Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

reduce chain id to u32::max - 1 at most #1078

Merged
merged 4 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
katana --chain-id test --validate-max-steps 16777216 --invoke-max-steps 16777216 --eth-gas-price 0 --strk-gas-price 0 --disable-fee
2 changes: 1 addition & 1 deletion src/backend/starknet.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/src/kakarot/instructions/test_block_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading