Commit e13fe02b authored by clabby's avatar clabby

Ignore high byte in Alphabet game

parent f6c7fa5b
...@@ -75,19 +75,10 @@ func BuildAlphabetPreimage(i uint64, letter string) []byte { ...@@ -75,19 +75,10 @@ func BuildAlphabetPreimage(i uint64, letter string) []byte {
return append(IndexToBytes(i), LetterToBytes(letter)...) return append(IndexToBytes(i), LetterToBytes(letter)...)
} }
const maxAlphabet = 26
func alphabetStateHash(state []byte) common.Hash { func alphabetStateHash(state []byte) common.Hash {
h := crypto.Keccak256Hash(state) h := crypto.Keccak256Hash(state)
// instead of the state containing an "exited" boolean, we just check if the index reached the end // In the alphabet game, we ignore the VM status code and always set it to 1.
i := new(big.Int).SetBytes(state[:32]) h[0] = 1
if !i.IsUint64() || i.Uint64() > maxAlphabet {
h[0] = types.VMStatusPanic // this state should never be reached, if we increment by 1 per step
} else if i.Uint64() == maxAlphabet {
h[0] = types.VMStatusValid
} else {
h[0] = types.VMStatusUnfinished
}
return h return h
} }
......
...@@ -17,7 +17,7 @@ AttestationStationTest:test_attest_bulk_succeeds() (gas: 703749) ...@@ -17,7 +17,7 @@ AttestationStationTest:test_attest_bulk_succeeds() (gas: 703749)
AttestationStationTest:test_attest_individual_succeeds() (gas: 632087) AttestationStationTest:test_attest_individual_succeeds() (gas: 632087)
AttestationStationTest:test_attest_single_succeeds() (gas: 651325) AttestationStationTest:test_attest_single_succeeds() (gas: 651325)
BlockOracle_Test:test_checkpointAndLoad_succeeds() (gas: 58341) BlockOracle_Test:test_checkpointAndLoad_succeeds() (gas: 58341)
BlockOracle_Test:test_load_noBlockHash_reverts() (gas: 12805) BlockOracle_Test:test_load_noBlockHash_reverts() (gas: 13659)
Bytes_slice_Test:test_slice_acrossMultipleWords_works() (gas: 9413) Bytes_slice_Test:test_slice_acrossMultipleWords_works() (gas: 9413)
Bytes_slice_Test:test_slice_acrossWords_works() (gas: 1430) Bytes_slice_Test:test_slice_acrossWords_works() (gas: 1430)
Bytes_slice_Test:test_slice_fromNonZeroIdx_works() (gas: 17240) Bytes_slice_Test:test_slice_fromNonZeroIdx_works() (gas: 17240)
...@@ -88,38 +88,38 @@ FaucetTest:test_nonAdmin_drip_fails() (gas: 262520) ...@@ -88,38 +88,38 @@ FaucetTest:test_nonAdmin_drip_fails() (gas: 262520)
FaucetTest:test_receive_succeeds() (gas: 17401) FaucetTest:test_receive_succeeds() (gas: 17401)
FaucetTest:test_withdraw_nonAdmin_reverts() (gas: 13145) FaucetTest:test_withdraw_nonAdmin_reverts() (gas: 13145)
FaucetTest:test_withdraw_succeeds() (gas: 78359) FaucetTest:test_withdraw_succeeds() (gas: 78359)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot1:test_resolvesCorrectly_succeeds() (gas: 498906) FaultDisputeGame_ResolvesCorrectly_CorrectRoot1:test_resolvesCorrectly_succeeds() (gas: 499188)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 505746) FaultDisputeGame_ResolvesCorrectly_CorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 506048)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 502447) FaultDisputeGame_ResolvesCorrectly_CorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 502729)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 505644) FaultDisputeGame_ResolvesCorrectly_CorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 505946)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot5:test_resolvesCorrectly_succeeds() (gas: 504933) FaultDisputeGame_ResolvesCorrectly_CorrectRoot5:test_resolvesCorrectly_succeeds() (gas: 505215)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot1:test_resolvesCorrectly_succeeds() (gas: 497671) FaultDisputeGame_ResolvesCorrectly_IncorrectRoot1:test_resolvesCorrectly_succeeds() (gas: 497953)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 504511) FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 504813)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 501212) FaultDisputeGame_ResolvesCorrectly_IncorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 501494)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 502409) FaultDisputeGame_ResolvesCorrectly_IncorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 502711)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5:test_resolvesCorrectly_succeeds() (gas: 501698) FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5:test_resolvesCorrectly_succeeds() (gas: 501980)
FaultDisputeGame_Test:test_addLocalData_static_succeeds() (gas: 640503) FaultDisputeGame_Test:test_addLocalData_static_succeeds() (gas: 640504)
FaultDisputeGame_Test:test_createdAt_succeeds() (gas: 10342) FaultDisputeGame_Test:test_createdAt_succeeds() (gas: 10342)
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 32377) FaultDisputeGame_Test:test_extraData_succeeds() (gas: 32377)
FaultDisputeGame_Test:test_gameData_succeeds() (gas: 32829) FaultDisputeGame_Test:test_gameData_succeeds() (gas: 32804)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8250) FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8309)
FaultDisputeGame_Test:test_initialize_correctData_succeeds() (gas: 57650) FaultDisputeGame_Test:test_initialize_correctData_succeeds() (gas: 57628)
FaultDisputeGame_Test:test_initialize_firstOutput_reverts() (gas: 210554) FaultDisputeGame_Test:test_initialize_firstOutput_reverts() (gas: 210609)
FaultDisputeGame_Test:test_initialize_l1HeadTooOld_reverts() (gas: 228337) FaultDisputeGame_Test:test_initialize_l1HeadTooOld_reverts() (gas: 228370)
FaultDisputeGame_Test:test_move_clockCorrectness_succeeds() (gas: 415993) FaultDisputeGame_Test:test_move_clockCorrectness_succeeds() (gas: 415971)
FaultDisputeGame_Test:test_move_clockTimeExceeded_reverts() (gas: 23219) FaultDisputeGame_Test:test_move_clockTimeExceeded_reverts() (gas: 23197)
FaultDisputeGame_Test:test_move_defendRoot_reverts() (gas: 13366) FaultDisputeGame_Test:test_move_defendRoot_reverts() (gas: 13344)
FaultDisputeGame_Test:test_move_duplicateClaim_reverts() (gas: 102920) FaultDisputeGame_Test:test_move_duplicateClaim_reverts() (gas: 102898)
FaultDisputeGame_Test:test_move_gameDepthExceeded_reverts() (gas: 407913) FaultDisputeGame_Test:test_move_gameDepthExceeded_reverts() (gas: 407913)
FaultDisputeGame_Test:test_move_gameNotInProgress_reverts() (gas: 11024) FaultDisputeGame_Test:test_move_gameNotInProgress_reverts() (gas: 11002)
FaultDisputeGame_Test:test_move_nonExistentParent_reverts() (gas: 24732) FaultDisputeGame_Test:test_move_nonExistentParent_reverts() (gas: 24710)
FaultDisputeGame_Test:test_move_simpleAttack_succeeds() (gas: 107341) FaultDisputeGame_Test:test_move_simpleAttack_succeeds() (gas: 107384)
FaultDisputeGame_Test:test_resolve_challengeContested_succeeds() (gas: 224906) FaultDisputeGame_Test:test_resolve_challengeContested_succeeds() (gas: 224949)
FaultDisputeGame_Test:test_resolve_notInProgress_reverts() (gas: 9664) FaultDisputeGame_Test:test_resolve_notInProgress_reverts() (gas: 9686)
FaultDisputeGame_Test:test_resolve_rootContested_succeeds() (gas: 109856) FaultDisputeGame_Test:test_resolve_rootContested_succeeds() (gas: 109879)
FaultDisputeGame_Test:test_resolve_rootUncontestedClockNotExpired_succeeds() (gas: 21421) FaultDisputeGame_Test:test_resolve_rootUncontestedClockNotExpired_succeeds() (gas: 21421)
FaultDisputeGame_Test:test_resolve_rootUncontested_succeeds() (gas: 27256) FaultDisputeGame_Test:test_resolve_rootUncontested_succeeds() (gas: 27279)
FaultDisputeGame_Test:test_resolve_teamDeathmatch_succeeds() (gas: 395635) FaultDisputeGame_Test:test_resolve_teamDeathmatch_succeeds() (gas: 395658)
FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 8276) FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 8276)
FeeVault_Test:test_constructor_succeeds() (gas: 18185) FeeVault_Test:test_constructor_succeeds() (gas: 18185)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 354286) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 354286)
...@@ -174,7 +174,7 @@ L1CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 12343) ...@@ -174,7 +174,7 @@ L1CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 12343)
L1CrossDomainMessenger_Test:test_replayMessage_withValue_reverts() (gas: 33166) L1CrossDomainMessenger_Test:test_replayMessage_withValue_reverts() (gas: 33166)
L1CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 392870) L1CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 392870)
L1CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 1669046) L1CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 1669046)
L1CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 87043) L1CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 87904)
L1CrossDomainMessenger_Test:test_xDomainSender_notSet_reverts() (gas: 24253) L1CrossDomainMessenger_Test:test_xDomainSender_notSet_reverts() (gas: 24253)
L1ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 62677) L1ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 62677)
L1ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 37273) L1ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 37273)
...@@ -218,7 +218,7 @@ L2CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 3 ...@@ -218,7 +218,7 @@ L2CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 3
L2CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 11689) L2CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 11689)
L2CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 123768) L2CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 123768)
L2CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 135434) L2CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 135434)
L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 48422) L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 49281)
L2CrossDomainMessenger_Test:test_xDomainSender_senderNotSet_reverts() (gas: 10590) L2CrossDomainMessenger_Test:test_xDomainSender_senderNotSet_reverts() (gas: 10590)
L2ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 31428) L2ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 31428)
L2ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 26826) L2ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 26826)
...@@ -251,12 +251,12 @@ L2OutputOracle_deleteOutputs_Test:test_deleteL2Outputs_ifNotChallenger_reverts() ...@@ -251,12 +251,12 @@ L2OutputOracle_deleteOutputs_Test:test_deleteL2Outputs_ifNotChallenger_reverts()
L2OutputOracle_deleteOutputs_Test:test_deleteL2Outputs_nonExistent_reverts() (gas: 111651) L2OutputOracle_deleteOutputs_Test:test_deleteL2Outputs_nonExistent_reverts() (gas: 111651)
L2OutputOracle_deleteOutputs_Test:test_deleteOutputs_multipleOutputs_succeeds() (gas: 307411) L2OutputOracle_deleteOutputs_Test:test_deleteOutputs_multipleOutputs_succeeds() (gas: 307411)
L2OutputOracle_deleteOutputs_Test:test_deleteOutputs_singleOutput_succeeds() (gas: 185564) L2OutputOracle_deleteOutputs_Test:test_deleteOutputs_singleOutput_succeeds() (gas: 185564)
L2OutputOracle_getter_Test:test_computeL2Timestamp_succeeds() (gas: 37341) L2OutputOracle_getter_Test:test_computeL2Timestamp_succeeds() (gas: 38198)
L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_multipleOutputsExist_succeeds() (gas: 269700) L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_multipleOutputsExist_succeeds() (gas: 269700)
L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_noOutputsExis_reverts() (gas: 17892) L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_noOutputsExis_reverts() (gas: 17892)
L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_previousBlock_succeeds() (gas: 98188) L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_previousBlock_succeeds() (gas: 98188)
L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_sameBlock_succeeds() (gas: 98096) L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_sameBlock_succeeds() (gas: 98096)
L2OutputOracle_getter_Test:test_getL2Output_succeeds() (gas: 103735) L2OutputOracle_getter_Test:test_getL2Output_succeeds() (gas: 104600)
L2OutputOracle_getter_Test:test_latestBlockNumber_succeeds() (gas: 99129) L2OutputOracle_getter_Test:test_latestBlockNumber_succeeds() (gas: 99129)
L2OutputOracle_getter_Test:test_nextBlockNumber_succeeds() (gas: 17447) L2OutputOracle_getter_Test:test_nextBlockNumber_succeeds() (gas: 17447)
L2OutputOracle_proposeL2Output_Test:test_proposeL2Output_emptyOutput_reverts() (gas: 28812) L2OutputOracle_proposeL2Output_Test:test_proposeL2Output_emptyOutput_reverts() (gas: 28812)
...@@ -298,81 +298,81 @@ LegacyERC20ETH_Test:test_transferFrom_doesNotExist_reverts() (gas: 12957) ...@@ -298,81 +298,81 @@ LegacyERC20ETH_Test:test_transferFrom_doesNotExist_reverts() (gas: 12957)
LegacyERC20ETH_Test:test_transfer_doesNotExist_reverts() (gas: 10755) LegacyERC20ETH_Test:test_transfer_doesNotExist_reverts() (gas: 10755)
LegacyMessagePasser_Test:test_passMessageToL1_succeeds() (gas: 34524) LegacyMessagePasser_Test:test_passMessageToL1_succeeds() (gas: 34524)
LibPosition_Test:test_pos_correctness_succeeds() (gas: 38689) LibPosition_Test:test_pos_correctness_succeeds() (gas: 38689)
MIPS_Test:test_add_succeeds() (gas: 122197) MIPS_Test:test_add_succeeds() (gas: 122488)
MIPS_Test:test_addiSign_succeeds() (gas: 122188) MIPS_Test:test_addiSign_succeeds() (gas: 122479)
MIPS_Test:test_addi_succeeds() (gas: 122385) MIPS_Test:test_addi_succeeds() (gas: 122676)
MIPS_Test:test_addu_succeeds() (gas: 122239) MIPS_Test:test_addu_succeeds() (gas: 122530)
MIPS_Test:test_addui_succeeds() (gas: 122447) MIPS_Test:test_addui_succeeds() (gas: 122738)
MIPS_Test:test_and_succeeds() (gas: 122258) MIPS_Test:test_and_succeeds() (gas: 122549)
MIPS_Test:test_andi_succeeds() (gas: 122191) MIPS_Test:test_andi_succeeds() (gas: 122482)
MIPS_Test:test_beq_succeeds() (gas: 202355) MIPS_Test:test_beq_succeeds() (gas: 202937)
MIPS_Test:test_bgez_succeeds() (gas: 121484) MIPS_Test:test_bgez_succeeds() (gas: 121775)
MIPS_Test:test_bgtz_succeeds() (gas: 121405) MIPS_Test:test_bgtz_succeeds() (gas: 121696)
MIPS_Test:test_blez_succeeds() (gas: 121361) MIPS_Test:test_blez_succeeds() (gas: 121652)
MIPS_Test:test_bltz_succeeds() (gas: 121504) MIPS_Test:test_bltz_succeeds() (gas: 121795)
MIPS_Test:test_bne_succeeds() (gas: 121570) MIPS_Test:test_bne_succeeds() (gas: 121861)
MIPS_Test:test_branch_inDelaySlot_fails() (gas: 85999) MIPS_Test:test_branch_inDelaySlot_fails() (gas: 85999)
MIPS_Test:test_brk_succeeds() (gas: 121869) MIPS_Test:test_brk_succeeds() (gas: 122160)
MIPS_Test:test_clo_succeeds() (gas: 121926) MIPS_Test:test_clo_succeeds() (gas: 122217)
MIPS_Test:test_clone_succeeds() (gas: 121822) MIPS_Test:test_clone_succeeds() (gas: 122113)
MIPS_Test:test_clz_succeeds() (gas: 122397) MIPS_Test:test_clz_succeeds() (gas: 122688)
MIPS_Test:test_div_succeeds() (gas: 122376) MIPS_Test:test_div_succeeds() (gas: 122667)
MIPS_Test:test_divu_succeeds() (gas: 122361) MIPS_Test:test_divu_succeeds() (gas: 122652)
MIPS_Test:test_exit_succeeds() (gas: 121746) MIPS_Test:test_exit_succeeds() (gas: 122160)
MIPS_Test:test_fcntl_succeeds() (gas: 203827) MIPS_Test:test_fcntl_succeeds() (gas: 204409)
MIPS_Test:test_illegal_instruction_fails() (gas: 91462) MIPS_Test:test_illegal_instruction_fails() (gas: 91462)
MIPS_Test:test_invalid_root_fails() (gas: 435636) MIPS_Test:test_invalid_root_fails() (gas: 435636)
MIPS_Test:test_jal_nonzeroRegion_succeeds() (gas: 120514) MIPS_Test:test_jal_nonzeroRegion_succeeds() (gas: 120805)
MIPS_Test:test_jal_succeeds() (gas: 120503) MIPS_Test:test_jal_succeeds() (gas: 120794)
MIPS_Test:test_jalr_succeeds() (gas: 121622) MIPS_Test:test_jalr_succeeds() (gas: 121913)
MIPS_Test:test_jr_succeeds() (gas: 121316) MIPS_Test:test_jr_succeeds() (gas: 121607)
MIPS_Test:test_jump_inDelaySlot_fails() (gas: 85367) MIPS_Test:test_jump_inDelaySlot_fails() (gas: 85367)
MIPS_Test:test_jump_nonzeroRegion_succeeds() (gas: 120258) MIPS_Test:test_jump_nonzeroRegion_succeeds() (gas: 120549)
MIPS_Test:test_jump_succeeds() (gas: 120188) MIPS_Test:test_jump_succeeds() (gas: 120479)
MIPS_Test:test_lb_succeeds() (gas: 127429) MIPS_Test:test_lb_succeeds() (gas: 127720)
MIPS_Test:test_lbu_succeeds() (gas: 127327) MIPS_Test:test_lbu_succeeds() (gas: 127618)
MIPS_Test:test_lh_succeeds() (gas: 127450) MIPS_Test:test_lh_succeeds() (gas: 127741)
MIPS_Test:test_lhu_succeeds() (gas: 127367) MIPS_Test:test_lhu_succeeds() (gas: 127658)
MIPS_Test:test_ll_succeeds() (gas: 127589) MIPS_Test:test_ll_succeeds() (gas: 127880)
MIPS_Test:test_lui_succeeds() (gas: 121470) MIPS_Test:test_lui_succeeds() (gas: 121761)
MIPS_Test:test_lw_succeeds() (gas: 127218) MIPS_Test:test_lw_succeeds() (gas: 127509)
MIPS_Test:test_lwl_succeeds() (gas: 241600) MIPS_Test:test_lwl_succeeds() (gas: 242182)
MIPS_Test:test_lwr_succeeds() (gas: 241888) MIPS_Test:test_lwr_succeeds() (gas: 242470)
MIPS_Test:test_mfhi_succeeds() (gas: 121831) MIPS_Test:test_mfhi_succeeds() (gas: 122122)
MIPS_Test:test_mflo_succeeds() (gas: 121960) MIPS_Test:test_mflo_succeeds() (gas: 122251)
MIPS_Test:test_mmap_succeeds() (gas: 118789) MIPS_Test:test_mmap_succeeds() (gas: 119080)
MIPS_Test:test_movn_succeeds() (gas: 203027) MIPS_Test:test_movn_succeeds() (gas: 203609)
MIPS_Test:test_movz_succeeds() (gas: 202895) MIPS_Test:test_movz_succeeds() (gas: 203477)
MIPS_Test:test_mthi_succeeds() (gas: 121875) MIPS_Test:test_mthi_succeeds() (gas: 122166)
MIPS_Test:test_mtlo_succeeds() (gas: 121983) MIPS_Test:test_mtlo_succeeds() (gas: 122274)
MIPS_Test:test_mul_succeeds() (gas: 121475) MIPS_Test:test_mul_succeeds() (gas: 121766)
MIPS_Test:test_mult_succeeds() (gas: 122179) MIPS_Test:test_mult_succeeds() (gas: 122470)
MIPS_Test:test_multu_succeeds() (gas: 122216) MIPS_Test:test_multu_succeeds() (gas: 122507)
MIPS_Test:test_nor_succeeds() (gas: 122308) MIPS_Test:test_nor_succeeds() (gas: 122599)
MIPS_Test:test_or_succeeds() (gas: 122265) MIPS_Test:test_or_succeeds() (gas: 122556)
MIPS_Test:test_ori_succeeds() (gas: 122268) MIPS_Test:test_ori_succeeds() (gas: 122559)
MIPS_Test:test_preimage_read_succeeds() (gas: 234185) MIPS_Test:test_preimage_read_succeeds() (gas: 234476)
MIPS_Test:test_preimage_write_succeeds() (gas: 126811) MIPS_Test:test_preimage_write_succeeds() (gas: 127102)
MIPS_Test:test_prestate_exited_succeeds() (gas: 112992) MIPS_Test:test_prestate_exited_succeeds() (gas: 113346)
MIPS_Test:test_sb_succeeds() (gas: 160300) MIPS_Test:test_sb_succeeds() (gas: 160591)
MIPS_Test:test_sc_succeeds() (gas: 160494) MIPS_Test:test_sc_succeeds() (gas: 160785)
MIPS_Test:test_sh_succeeds() (gas: 160337) MIPS_Test:test_sh_succeeds() (gas: 160628)
MIPS_Test:test_sll_succeeds() (gas: 121436) MIPS_Test:test_sll_succeeds() (gas: 121727)
MIPS_Test:test_sllv_succeeds() (gas: 121665) MIPS_Test:test_sllv_succeeds() (gas: 121956)
MIPS_Test:test_slt_succeeds() (gas: 204222) MIPS_Test:test_slt_succeeds() (gas: 204804)
MIPS_Test:test_sltu_succeeds() (gas: 122482) MIPS_Test:test_sltu_succeeds() (gas: 122773)
MIPS_Test:test_sra_succeeds() (gas: 121687) MIPS_Test:test_sra_succeeds() (gas: 121978)
MIPS_Test:test_srav_succeeds() (gas: 121955) MIPS_Test:test_srav_succeeds() (gas: 122246)
MIPS_Test:test_srl_succeeds() (gas: 121518) MIPS_Test:test_srl_succeeds() (gas: 121809)
MIPS_Test:test_srlv_succeeds() (gas: 121683) MIPS_Test:test_srlv_succeeds() (gas: 121974)
MIPS_Test:test_step_abi_succeeds() (gas: 58312) MIPS_Test:test_step_abi_succeeds() (gas: 58481)
MIPS_Test:test_sub_succeeds() (gas: 122292) MIPS_Test:test_sub_succeeds() (gas: 122583)
MIPS_Test:test_subu_succeeds() (gas: 122289) MIPS_Test:test_subu_succeeds() (gas: 122580)
MIPS_Test:test_sw_succeeds() (gas: 160312) MIPS_Test:test_sw_succeeds() (gas: 160603)
MIPS_Test:test_swl_succeeds() (gas: 160373) MIPS_Test:test_swl_succeeds() (gas: 160664)
MIPS_Test:test_swr_succeeds() (gas: 160448) MIPS_Test:test_swr_succeeds() (gas: 160739)
MIPS_Test:test_xor_succeeds() (gas: 122293) MIPS_Test:test_xor_succeeds() (gas: 122584)
MIPS_Test:test_xori_succeeds() (gas: 122345) MIPS_Test:test_xori_succeeds() (gas: 122636)
MerkleTrie_get_Test:test_get_corruptedProof_reverts() (gas: 5733) MerkleTrie_get_Test:test_get_corruptedProof_reverts() (gas: 5733)
MerkleTrie_get_Test:test_get_extraProofElements_reverts() (gas: 58889) MerkleTrie_get_Test:test_get_extraProofElements_reverts() (gas: 58889)
MerkleTrie_get_Test:test_get_invalidDataRemainder_reverts() (gas: 35845) MerkleTrie_get_Test:test_get_invalidDataRemainder_reverts() (gas: 35845)
...@@ -465,7 +465,7 @@ OptimismPortal_Test:test_depositTransaction_withEthValueAndContractContractCreat ...@@ -465,7 +465,7 @@ OptimismPortal_Test:test_depositTransaction_withEthValueAndContractContractCreat
OptimismPortal_Test:test_depositTransaction_withEthValueAndEOAContractCreation_succeeds() (gas: 75929) OptimismPortal_Test:test_depositTransaction_withEthValueAndEOAContractCreation_succeeds() (gas: 75929)
OptimismPortal_Test:test_depositTransaction_withEthValueFromContract_succeeds() (gas: 83476) OptimismPortal_Test:test_depositTransaction_withEthValueFromContract_succeeds() (gas: 83476)
OptimismPortal_Test:test_depositTransaction_withEthValueFromEOA_succeeds() (gas: 84069) OptimismPortal_Test:test_depositTransaction_withEthValueFromEOA_succeeds() (gas: 84069)
OptimismPortal_Test:test_isOutputFinalized_succeeds() (gas: 126749) OptimismPortal_Test:test_isOutputFinalized_succeeds() (gas: 127617)
OptimismPortal_Test:test_minimumGasLimit_succeeds() (gas: 17430) OptimismPortal_Test:test_minimumGasLimit_succeeds() (gas: 17430)
OptimismPortal_Test:test_pause_onlyGuardian_reverts() (gas: 24487) OptimismPortal_Test:test_pause_onlyGuardian_reverts() (gas: 24487)
OptimismPortal_Test:test_pause_succeeds() (gas: 27344) OptimismPortal_Test:test_pause_succeeds() (gas: 27344)
...@@ -525,7 +525,7 @@ PreimageOracle_Test:test_loadKeccak256PreimagePart_outOfBoundsOffset_reverts() ( ...@@ -525,7 +525,7 @@ PreimageOracle_Test:test_loadKeccak256PreimagePart_outOfBoundsOffset_reverts() (
PreimageOracle_Test:test_loadKeccak256PreimagePart_succeeds() (gas: 76098) PreimageOracle_Test:test_loadKeccak256PreimagePart_succeeds() (gas: 76098)
PreimageOracle_Test:test_loadLocalData_onePart_succeeds() (gas: 75840) PreimageOracle_Test:test_loadLocalData_onePart_succeeds() (gas: 75840)
PreimageOracle_Test:test_loadLocalData_outOfBoundsOffset_reverts() (gas: 8803) PreimageOracle_Test:test_loadLocalData_outOfBoundsOffset_reverts() (gas: 8803)
ProxyAdmin_Test:test_chugsplashChangeProxyAdmin_succeeds() (gas: 35586) ProxyAdmin_Test:test_chugsplashChangeProxyAdmin_succeeds() (gas: 36440)
ProxyAdmin_Test:test_chugsplashGetProxyAdmin_succeeds() (gas: 15675) ProxyAdmin_Test:test_chugsplashGetProxyAdmin_succeeds() (gas: 15675)
ProxyAdmin_Test:test_chugsplashGetProxyImplementation_succeeds() (gas: 51084) ProxyAdmin_Test:test_chugsplashGetProxyImplementation_succeeds() (gas: 51084)
ProxyAdmin_Test:test_chugsplashUpgradeAndCall_succeeds() (gas: 82311) ProxyAdmin_Test:test_chugsplashUpgradeAndCall_succeeds() (gas: 82311)
...@@ -535,7 +535,7 @@ ProxyAdmin_Test:test_delegateResolvedGetProxyAdmin_succeeds() (gas: 17691) ...@@ -535,7 +535,7 @@ ProxyAdmin_Test:test_delegateResolvedGetProxyAdmin_succeeds() (gas: 17691)
ProxyAdmin_Test:test_delegateResolvedGetProxyImplementation_succeeds() (gas: 62028) ProxyAdmin_Test:test_delegateResolvedGetProxyImplementation_succeeds() (gas: 62028)
ProxyAdmin_Test:test_delegateResolvedUpgradeAndCall_succeeds() (gas: 98039) ProxyAdmin_Test:test_delegateResolvedUpgradeAndCall_succeeds() (gas: 98039)
ProxyAdmin_Test:test_delegateResolvedUpgrade_succeeds() (gas: 58482) ProxyAdmin_Test:test_delegateResolvedUpgrade_succeeds() (gas: 58482)
ProxyAdmin_Test:test_erc1967ChangeProxyAdmin_succeeds() (gas: 33820) ProxyAdmin_Test:test_erc1967ChangeProxyAdmin_succeeds() (gas: 34674)
ProxyAdmin_Test:test_erc1967GetProxyAdmin_succeeds() (gas: 15616) ProxyAdmin_Test:test_erc1967GetProxyAdmin_succeeds() (gas: 15616)
ProxyAdmin_Test:test_erc1967GetProxyImplementation_succeeds() (gas: 52073) ProxyAdmin_Test:test_erc1967GetProxyImplementation_succeeds() (gas: 52073)
ProxyAdmin_Test:test_erc1967UpgradeAndCall_succeeds() (gas: 78971) ProxyAdmin_Test:test_erc1967UpgradeAndCall_succeeds() (gas: 78971)
...@@ -553,9 +553,9 @@ Proxy_Test:test_implementationKey_succeeds() (gas: 20911) ...@@ -553,9 +553,9 @@ Proxy_Test:test_implementationKey_succeeds() (gas: 20911)
Proxy_Test:test_implementation_isZeroAddress_reverts() (gas: 47628) Proxy_Test:test_implementation_isZeroAddress_reverts() (gas: 47628)
Proxy_Test:test_implementation_zeroAddressCaller_succeeds() (gas: 14752) Proxy_Test:test_implementation_zeroAddressCaller_succeeds() (gas: 14752)
Proxy_Test:test_ownerKey_succeeds() (gas: 19067) Proxy_Test:test_ownerKey_succeeds() (gas: 19067)
Proxy_Test:test_ownerProxyCall_notAdmin_succeeds() (gas: 34623) Proxy_Test:test_ownerProxyCall_notAdmin_succeeds() (gas: 35477)
Proxy_Test:test_proxyCallToImp_notAdmin_succeeds() (gas: 30010) Proxy_Test:test_proxyCallToImp_notAdmin_succeeds() (gas: 30010)
Proxy_Test:test_upgradeToAndCall_functionDoesNotExist_reverts() (gas: 104567) Proxy_Test:test_upgradeToAndCall_functionDoesNotExist_reverts() (gas: 107980)
Proxy_Test:test_upgradeToAndCall_isPayable_succeeds() (gas: 53744) Proxy_Test:test_upgradeToAndCall_isPayable_succeeds() (gas: 53744)
Proxy_Test:test_upgradeToAndCall_succeeds() (gas: 125192) Proxy_Test:test_upgradeToAndCall_succeeds() (gas: 125192)
Proxy_Test:test_upgradeTo_clashingFunctionSignatures_succeeds() (gas: 101363) Proxy_Test:test_upgradeTo_clashingFunctionSignatures_succeeds() (gas: 101363)
...@@ -648,8 +648,8 @@ StandardBridge_Stateless_Test:test_isOptimismMintableERC20_succeeds() (gas: 3307 ...@@ -648,8 +648,8 @@ StandardBridge_Stateless_Test:test_isOptimismMintableERC20_succeeds() (gas: 3307
SystemConfig_Initialize_Test:test_initialize_events_succeeds() (gas: 72060) SystemConfig_Initialize_Test:test_initialize_events_succeeds() (gas: 72060)
SystemConfig_Initialize_Test:test_initialize_startBlockOverride_succeeds() (gas: 65242) SystemConfig_Initialize_Test:test_initialize_startBlockOverride_succeeds() (gas: 65242)
SystemConfig_Initialize_Test:test_initialize_values_succeeds() (gas: 64946) SystemConfig_Initialize_Test:test_initialize_values_succeeds() (gas: 64946)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 55655) SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 57243)
SystemConfig_Initialize_TestFail:test_initialize_startBlock_reverts() (gas: 78352) SystemConfig_Initialize_TestFail:test_initialize_startBlock_reverts() (gas: 79938)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 15607) SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 15607)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 15577) SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 15577)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 15676) SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 15676)
...@@ -660,9 +660,9 @@ SystemConfig_Setters_TestFail:test_setResourceConfig_notOwner_reverts() (gas: 16 ...@@ -660,9 +660,9 @@ SystemConfig_Setters_TestFail:test_setResourceConfig_notOwner_reverts() (gas: 16
SystemConfig_Setters_TestFail:test_setResourceConfig_zeroDenominator_reverts() (gas: 18578) SystemConfig_Setters_TestFail:test_setResourceConfig_zeroDenominator_reverts() (gas: 18578)
SystemConfig_Setters_TestFail:test_setUnsafeBlockSigner_notOwner_reverts() (gas: 15590) SystemConfig_Setters_TestFail:test_setUnsafeBlockSigner_notOwner_reverts() (gas: 15590)
TransactorTest:test_call_succeeds() (gas: 26709) TransactorTest:test_call_succeeds() (gas: 26709)
TransactorTest:test_call_unauthorized_reverts() (gas: 16543) TransactorTest:test_call_unauthorized_reverts() (gas: 18117)
TransactorTest:test_constructor_succeeds() (gas: 9739) TransactorTest:test_constructor_succeeds() (gas: 9739)
TransactorTest:test_delegateCall_succeeds() (gas: 20909) TransactorTest:test_delegateCall_succeeds() (gas: 20909)
TransactorTest:test_delegateCall_unauthorized_reverts() (gas: 16550) TransactorTest:test_delegateCall_unauthorized_reverts() (gas: 18124)
TransferOnionTest:test_constructor_succeeds() (gas: 564855) TransferOnionTest:test_constructor_succeeds() (gas: 564855)
TransferOnionTest:test_unwrap_succeeds() (gas: 724955) TransferOnionTest:test_unwrap_succeeds() (gas: 724955)
\ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"src/L2/L2StandardBridge.sol": "0xe025dcccbf21d48828ecf588941c9ba04c91b87bdd177a653d3f1b265b0b02a8", "src/L2/L2StandardBridge.sol": "0xe025dcccbf21d48828ecf588941c9ba04c91b87bdd177a653d3f1b265b0b02a8",
"src/L2/L2ToL1MessagePasser.sol": "0xda56ba2e5b2c28fa8ca2df24077d49e96155a00ecc99cd0778d681be6ed166fe", "src/L2/L2ToL1MessagePasser.sol": "0xda56ba2e5b2c28fa8ca2df24077d49e96155a00ecc99cd0778d681be6ed166fe",
"src/L2/SequencerFeeVault.sol": "0x37816035c992d38cf7e3d5a1846b02d017dd7bdca46abe6e5c5171b9ee6225ab", "src/L2/SequencerFeeVault.sol": "0x37816035c992d38cf7e3d5a1846b02d017dd7bdca46abe6e5c5171b9ee6225ab",
"src/dispute/FaultDisputeGame.sol": "0x72c917e8513d17f274753a391bdbddc1f4daeca1a392f79492df29a1107c3525", "src/dispute/FaultDisputeGame.sol": "0x1ee46e383f6017c8a381c54ff26958659d54995c97144879586a0d827f4a82c8",
"src/legacy/DeployerWhitelist.sol": "0xf2129ec3da75307ba8e21bc943c332bb04704642e6e263149b5c8ee92dbcb7a8", "src/legacy/DeployerWhitelist.sol": "0xf2129ec3da75307ba8e21bc943c332bb04704642e6e263149b5c8ee92dbcb7a8",
"src/legacy/L1BlockNumber.sol": "0x30aae1fc85103476af0226b6e98c71c01feebbdc35d93401390b1ad438a37be6", "src/legacy/L1BlockNumber.sol": "0x30aae1fc85103476af0226b6e98c71c01feebbdc35d93401390b1ad438a37be6",
"src/legacy/LegacyMessagePasser.sol": "0x5c08b0a663cc49d30e4e38540f6aefab19ef287c3ecd31c8d8c3decd5f5bd497", "src/legacy/LegacyMessagePasser.sol": "0x5c08b0a663cc49d30e4e38540f6aefab19ef287c3ecd31c8d8c3decd5f5bd497",
......
...@@ -85,7 +85,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -85,7 +85,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
/// @param _blockOracle The block oracle, used for loading block hashes further back /// @param _blockOracle The block oracle, used for loading block hashes further back
/// than the `BLOCKHASH` opcode allows as well as their estimated /// than the `BLOCKHASH` opcode allows as well as their estimated
/// timestamps. /// timestamps.
/// @custom:semver 0.0.7 /// @custom:semver 0.0.8
constructor( constructor(
GameType _gameType, GameType _gameType,
Claim _absolutePrestate, Claim _absolutePrestate,
...@@ -149,7 +149,11 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -149,7 +149,11 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
// INVARIANT: The prestate is always invalid if the passed `_stateData` is not the // INVARIANT: The prestate is always invalid if the passed `_stateData` is not the
// preimage of the prestate claim hash. // preimage of the prestate claim hash.
if (keccak256(_stateData) != Claim.unwrap(preStateClaim)) revert InvalidPrestate(); // We ignore the highest order byte of the digest because it is used to
// indicate the VM Status.
if (cleanHighByte(keccak256(_stateData)) != cleanHighByte(Claim.unwrap(preStateClaim))) {
revert InvalidPrestate();
}
// INVARIANT: If a step is an attack, the poststate is valid if the step produces // INVARIANT: If a step is an attack, the poststate is valid if the step produces
// the same poststate hash as the parent claim's value. // the same poststate hash as the parent claim's value.
...@@ -434,11 +438,13 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -434,11 +438,13 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
function initialize() external { function initialize() external {
// SAFETY: Any revert in this function will bubble up to the DisputeGameFactory and // SAFETY: Any revert in this function will bubble up to the DisputeGameFactory and
// prevent the game from being created. // prevent the game from being created.
//
// Implicit assumptions: // Implicit assumptions:
// - The `gameStatus` state variable defaults to 0, which is `GameStatus.IN_PROGRESS` // - The `gameStatus` state variable defaults to 0, which is `GameStatus.IN_PROGRESS`
// The VMStatus must indicate (1) 'invalid', to argue that disputed thing is invalid. // The VMStatus must indicate (1) 'invalid', to argue that disputed thing is invalid.
// Games that agree with the existing outcome are not allowed. // Games that agree with the existing outcome are not allowed.
// NOTE(clabby): This assumption will change in Alpha Chad.
if (uint8(Claim.unwrap(rootClaim())[0]) != 1) revert UnexpectedRootClaim(rootClaim()); if (uint8(Claim.unwrap(rootClaim())[0]) != 1) revert UnexpectedRootClaim(rootClaim());
// Set the game's starting timestamp // Set the game's starting timestamp
...@@ -535,4 +541,13 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -535,4 +541,13 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
ancestor_ = claimData[ancestor_.parentIndex]; ancestor_ = claimData[ancestor_.parentIndex];
} }
} }
/// @notice Cleans the highest order byte of a given fixed bytes value.
/// @param _in The bytes32 value to clean.
/// @return out_ The cleaned bytes32 value.
function cleanHighByte(bytes32 _in) internal pure returns (bytes32 out_) {
assembly {
out_ := and(not(shl(248, 0xFF)), _in)
}
}
} }
...@@ -77,7 +77,7 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init { ...@@ -77,7 +77,7 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {
contract FaultDisputeGame_Test is FaultDisputeGame_Init { contract FaultDisputeGame_Test is FaultDisputeGame_Init {
/// @dev The root claim of the game. /// @dev The root claim of the game.
Claim internal constant ROOT_CLAIM = Claim.wrap(bytes32((uint256(1) << 248) + uint256(10))); Claim internal constant ROOT_CLAIM = Claim.wrap(bytes32((uint256(1) << 248) | uint256(10)));
/// @dev The absolute prestate of the trace. /// @dev The absolute prestate of the trace.
Claim internal constant ABSOLUTE_PRESTATE = Claim.wrap(bytes32(uint256(0))); Claim internal constant ABSOLUTE_PRESTATE = Claim.wrap(bytes32(uint256(0)));
...@@ -609,9 +609,11 @@ contract GamePlayer { ...@@ -609,9 +609,11 @@ contract GamePlayer {
/// @notice Returns the player's claim that commits to a given trace index. /// @notice Returns the player's claim that commits to a given trace index.
function claimAt(uint256 _traceIndex) public view returns (Claim claim_) { function claimAt(uint256 _traceIndex) public view returns (Claim claim_) {
return Claim.wrap( bytes32 hash =
keccak256(abi.encode(_traceIndex >= trace.length ? trace.length - 1 : _traceIndex, traceAt(_traceIndex))) keccak256(abi.encode(_traceIndex >= trace.length ? trace.length - 1 : _traceIndex, traceAt(_traceIndex)));
); assembly {
claim_ := or(and(hash, not(shl(248, 0xFF))), shl(248, 1))
}
} }
/// @notice Returns the player's claim that commits to a given trace index. /// @notice Returns the player's claim that commits to a given trace index.
...@@ -631,7 +633,7 @@ contract OneVsOne_Arena is FaultDisputeGame_Init { ...@@ -631,7 +633,7 @@ contract OneVsOne_Arena is FaultDisputeGame_Init {
GamePlayer internal challenger; GamePlayer internal challenger;
function init(GamePlayer _defender, GamePlayer _challenger, uint256 _finalTraceIndex) public { function init(GamePlayer _defender, GamePlayer _challenger, uint256 _finalTraceIndex) public {
Claim rootClaim = Claim.wrap(keccak256(abi.encode(_finalTraceIndex, _defender.traceAt(_finalTraceIndex)))); Claim rootClaim = _defender.claimAt(_finalTraceIndex);
super.init(rootClaim, ABSOLUTE_PRESTATE_CLAIM); super.init(rootClaim, ABSOLUTE_PRESTATE_CLAIM);
defender = _defender; defender = _defender;
challenger = _challenger; challenger = _challenger;
...@@ -995,5 +997,8 @@ contract AlphabetVM is IBigStepper { ...@@ -995,5 +997,8 @@ contract AlphabetVM is IBigStepper {
} }
// STF: n -> n + 1 // STF: n -> n + 1
postState_ = keccak256(abi.encode(traceIndex, claim + 1)); postState_ = keccak256(abi.encode(traceIndex, claim + 1));
assembly {
postState_ := or(and(postState_, not(shl(248, 0xFF))), shl(248, 1))
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment