From 7b4183ca88811b1e4069ac7fa36f3908ae947a5d Mon Sep 17 00:00:00 2001 From: Elias Tazartes Date: Sat, 6 Apr 2024 10:42:45 -0300 Subject: [PATCH 1/3] reduce chain id to u32::max - 1 at most --- src/backend/starknet.cairo | 2 +- tests/src/kakarot/instructions/test_block_information.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/starknet.cairo b/src/backend/starknet.cairo index e398a5a27..d88c9229a 100644 --- a/src/backend/starknet.cairo +++ b/src/backend/starknet.cairo @@ -120,7 +120,7 @@ namespace Starknet { // No idea why this is required - but trying to pass prev_randao directly causes bugs. let prev_randao = Uint256(low=prev_randao.low, high=prev_randao.high); - let (_, chain_id) = unsigned_div_rem(tx_info.chain_id, 2 ** 64); + let (_, chain_id) = unsigned_div_rem(tx_info.chain_id, 2 ** 32); return new model.Environment( origin=origin, diff --git a/tests/src/kakarot/instructions/test_block_information.py b/tests/src/kakarot/instructions/test_block_information.py index 17d67b57a..56e38a4ad 100644 --- a/tests/src/kakarot/instructions/test_block_information.py +++ b/tests/src/kakarot/instructions/test_block_information.py @@ -48,4 +48,4 @@ def test__exec_block_information(self, cairo_run, opcode, expected_result): ) def test__exec_chain_id__should_return_mod_64(self, cairo_run): output = cairo_run("test__exec_block_information", opcode=Opcodes.CHAINID) - assert output == hex(BIG_CHAIN_ID % 2**64) + assert output == hex(BIG_CHAIN_ID % 2**32) From fdce4a260d189e6947581d344383cdc922b25c2c Mon Sep 17 00:00:00 2001 From: Elias Tazartes Date: Sat, 6 Apr 2024 11:18:29 -0300 Subject: [PATCH 2/3] bump katana --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 871fe46ba..d225c3476 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ build-sol: forge build --names --force install-katana: - cargo install --git https://github.com/dojoengine/dojo --locked --tag v0.6.0-alpha.2 katana + cargo install --git https://github.com/dojoengine/dojo --locked --tag v0.6.0-alpha.6 katana run-katana: katana --validate-max-steps 16777216 --invoke-max-steps 16777216 --eth-gas-price 0 --strk-gas-price 0 --disable-fee From 3b1c381732412d828732dd41776fc04e5bbe0ee1 Mon Sep 17 00:00:00 2001 From: Elias Tazartes Date: Sat, 6 Apr 2024 11:22:55 -0300 Subject: [PATCH 3/3] set chain-id of katana --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d225c3476..d50d25673 100644 --- a/Makefile +++ b/Makefile @@ -68,4 +68,4 @@ install-katana: cargo install --git https://github.com/dojoengine/dojo --locked --tag v0.6.0-alpha.6 katana run-katana: - katana --validate-max-steps 16777216 --invoke-max-steps 16777216 --eth-gas-price 0 --strk-gas-price 0 --disable-fee + katana --chain-id test --validate-max-steps 16777216 --invoke-max-steps 16777216 --eth-gas-price 0 --strk-gas-price 0 --disable-fee