Commit 02052f09 authored by clabby's avatar clabby

Merge branch 'develop' into cl/ctb/deployment-checks

parents 8e593108 d3417abb
...@@ -80,13 +80,13 @@ func (m *MIPSEVM) Step(t *testing.T, stepWitness *StepWitness) []byte { ...@@ -80,13 +80,13 @@ func (m *MIPSEVM) Step(t *testing.T, stepWitness *StepWitness) []byte {
if stepWitness.HasPreimage() { if stepWitness.HasPreimage() {
t.Logf("reading preimage key %x at offset %d", stepWitness.PreimageKey, stepWitness.PreimageOffset) t.Logf("reading preimage key %x at offset %d", stepWitness.PreimageKey, stepWitness.PreimageOffset)
poInput, err := encodePreimageOracleInput(t, stepWitness, 0) poInput, err := encodePreimageOracleInput(t, stepWitness, LocalContext{})
require.NoError(t, err, "encode preimage oracle input") require.NoError(t, err, "encode preimage oracle input")
_, leftOverGas, err := m.env.Call(vm.AccountRef(sender), m.addrs.Oracle, poInput, startingGas, big.NewInt(0)) _, leftOverGas, err := m.env.Call(vm.AccountRef(sender), m.addrs.Oracle, poInput, startingGas, big.NewInt(0))
require.NoErrorf(t, err, "evm should not fail, took %d gas", startingGas-leftOverGas) require.NoErrorf(t, err, "evm should not fail, took %d gas", startingGas-leftOverGas)
} }
input := encodeStepInput(t, stepWitness, 0) input := encodeStepInput(t, stepWitness, LocalContext{})
ret, leftOverGas, err := m.env.Call(vm.AccountRef(sender), m.addrs.MIPS, input, startingGas, big.NewInt(0)) ret, leftOverGas, err := m.env.Call(vm.AccountRef(sender), m.addrs.MIPS, input, startingGas, big.NewInt(0))
require.NoError(t, err, "evm should not fail") require.NoError(t, err, "evm should not fail")
require.Len(t, ret, 32, "expecting 32-byte state hash") require.Len(t, ret, 32, "expecting 32-byte state hash")
...@@ -109,7 +109,7 @@ func encodeStepInput(t *testing.T, wit *StepWitness, localContext LocalContext) ...@@ -109,7 +109,7 @@ func encodeStepInput(t *testing.T, wit *StepWitness, localContext LocalContext)
mipsAbi, err := bindings.MIPSMetaData.GetAbi() mipsAbi, err := bindings.MIPSMetaData.GetAbi()
require.NoError(t, err) require.NoError(t, err)
input, err := mipsAbi.Pack("step", wit.State, wit.MemProof, new(big.Int).SetUint64(uint64(localContext))) input, err := mipsAbi.Pack("step", wit.State, wit.MemProof, localContext)
require.NoError(t, err) require.NoError(t, err)
return input return input
} }
...@@ -132,7 +132,7 @@ func encodePreimageOracleInput(t *testing.T, wit *StepWitness, localContext Loca ...@@ -132,7 +132,7 @@ func encodePreimageOracleInput(t *testing.T, wit *StepWitness, localContext Loca
copy(tmp[:], preimagePart) copy(tmp[:], preimagePart)
input, err := preimageAbi.Pack("loadLocalData", input, err := preimageAbi.Pack("loadLocalData",
new(big.Int).SetBytes(wit.PreimageKey[1:]), new(big.Int).SetBytes(wit.PreimageKey[1:]),
new(big.Int).SetUint64(uint64(localContext)), localContext,
tmp, tmp,
new(big.Int).SetUint64(uint64(len(preimagePart))), new(big.Int).SetUint64(uint64(len(preimagePart))),
new(big.Int).SetUint64(uint64(wit.PreimageOffset)), new(big.Int).SetUint64(uint64(wit.PreimageOffset)),
...@@ -292,7 +292,7 @@ func TestEVMFault(t *testing.T) { ...@@ -292,7 +292,7 @@ func TestEVMFault(t *testing.T) {
State: initialState.EncodeWitness(), State: initialState.EncodeWitness(),
MemProof: insnProof[:], MemProof: insnProof[:],
} }
input := encodeStepInput(t, stepWitness, 0) input := encodeStepInput(t, stepWitness, LocalContext{})
startingGas := uint64(30_000_000) startingGas := uint64(30_000_000)
_, _, err := env.Call(vm.AccountRef(sender), addrs.MIPS, input, startingGas, big.NewInt(0)) _, _, err := env.Call(vm.AccountRef(sender), addrs.MIPS, input, startingGas, big.NewInt(0))
......
package mipsevm package mipsevm
type LocalContext uint64 import "github.com/ethereum/go-ethereum/common"
type LocalContext common.Hash
type StepWitness struct { type StepWitness struct {
// encoded state witness // encoded state witness
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ const AlphabetVMStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\": ...@@ -13,7 +13,7 @@ const AlphabetVMStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":
var AlphabetVMStorageLayout = new(solc.StorageLayout) var AlphabetVMStorageLayout = new(solc.StorageLayout)
var AlphabetVMDeployedBin = "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80637dc0d1d01461003b578063836e7b3214610085575b600080fd5b60005461005b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610098610093366004610213565b6100a6565b60405190815260200161007c565b600080600060087f0000000000000000000000000000000000000000000000000000000000000000901b600889896040516100e2929190610287565b6040518091039020901b03610108576000915061010187890189610297565b9050610127565b610114878901896102b0565b90925090508161012381610301565b9250505b81610133826001610339565b604080516020810193909352820152606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001798975050505050505050565b60008083601f8401126101dc57600080fd5b50813567ffffffffffffffff8111156101f457600080fd5b60208301915083602082850101111561020c57600080fd5b9250929050565b60008060008060006060868803121561022b57600080fd5b853567ffffffffffffffff8082111561024357600080fd5b61024f89838a016101ca565b9097509550602088013591508082111561026857600080fd5b50610275888289016101ca565b96999598509660400135949350505050565b8183823760009101908152919050565b6000602082840312156102a957600080fd5b5035919050565b600080604083850312156102c357600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610332576103326102d2565b5060010190565b6000821982111561034c5761034c6102d2565b50019056fea164736f6c634300080f000a" var AlphabetVMDeployedBin = "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80637dc0d1d01461003b578063e14ced3214610085575b600080fd5b60005461005b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610098610093366004610213565b6100a6565b60405190815260200161007c565b600080600060087f0000000000000000000000000000000000000000000000000000000000000000901b600889896040516100e2929190610287565b6040518091039020901b03610108576000915061010187890189610297565b9050610127565b610114878901896102b0565b90925090508161012381610301565b9250505b81610133826001610339565b604080516020810193909352820152606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001798975050505050505050565b60008083601f8401126101dc57600080fd5b50813567ffffffffffffffff8111156101f457600080fd5b60208301915083602082850101111561020c57600080fd5b9250929050565b60008060008060006060868803121561022b57600080fd5b853567ffffffffffffffff8082111561024357600080fd5b61024f89838a016101ca565b9097509550602088013591508082111561026857600080fd5b50610275888289016101ca565b96999598509660400135949350505050565b8183823760009101908152919050565b6000602082840312156102a957600080fd5b5035919050565b600080604083850312156102c357600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610332576103326102d2565b5060010190565b6000821982111561034c5761034c6102d2565b50019056fea164736f6c634300080f000a"
func init() { func init() {
if err := json.Unmarshal([]byte(AlphabetVMStorageLayoutJSON), AlphabetVMStorageLayout); err != nil { if err := json.Unmarshal([]byte(AlphabetVMStorageLayoutJSON), AlphabetVMStorageLayout); err != nil {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -232,7 +232,7 @@ func (f *FaultDisputeGameContract) addLocalDataTx(data *types.PreimageOracleData ...@@ -232,7 +232,7 @@ func (f *FaultDisputeGameContract) addLocalDataTx(data *types.PreimageOracleData
call := f.contract.Call( call := f.contract.Call(
methodAddLocalData, methodAddLocalData,
data.GetIdent(), data.GetIdent(),
new(big.Int).SetBytes(data.LocalContext.Bytes()), data.LocalContext,
new(big.Int).SetUint64(uint64(data.OracleOffset)), new(big.Int).SetUint64(uint64(data.OracleOffset)),
) )
return call.ToTxCandidate() return call.ToTxCandidate()
......
...@@ -260,7 +260,7 @@ func TestUpdateOracleTx(t *testing.T) { ...@@ -260,7 +260,7 @@ func TestUpdateOracleTx(t *testing.T) {
} }
stubRpc.SetResponse(fdgAddr, methodAddLocalData, batching.BlockLatest, []interface{}{ stubRpc.SetResponse(fdgAddr, methodAddLocalData, batching.BlockLatest, []interface{}{
data.GetIdent(), data.GetIdent(),
new(big.Int).SetBytes(data.LocalContext.Bytes()), data.LocalContext,
new(big.Int).SetUint64(uint64(data.OracleOffset)), new(big.Int).SetUint64(uint64(data.OracleOffset)),
}, nil) }, nil)
tx, err := game.UpdateOracleTx(context.Background(), data) tx, err := game.UpdateOracleTx(context.Background(), data)
......
...@@ -16,13 +16,13 @@ import ( ...@@ -16,13 +16,13 @@ import (
func TestMintOnRevertedDeposit(t *testing.T) { func TestMintOnRevertedDeposit(t *testing.T) {
InitParallel(t) InitParallel(t)
cfg := DefaultSystemConfig(t) cfg := DefaultSystemConfig(t)
delete(cfg.Nodes, "verifier")
sys, err := cfg.Start(t) sys, err := cfg.Start(t)
require.Nil(t, err, "Error starting up system") require.Nil(t, err, "Error starting up system")
defer sys.Close() defer sys.Close()
l1Client := sys.Clients["l1"] l1Client := sys.Clients["l1"]
l2Verif := sys.Clients["verifier"] l2Verif := sys.Clients["sequencer"]
// create signer // create signer
aliceKey := cfg.Secrets.Alice aliceKey := cfg.Secrets.Alice
......
...@@ -47,7 +47,9 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l ...@@ -47,7 +47,9 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l
reconstructedDep, err := derive.UnmarshalDepositLogEvent(l1Receipt.Logs[0]) reconstructedDep, err := derive.UnmarshalDepositLogEvent(l1Receipt.Logs[0])
require.NoError(t, err, "Could not reconstruct L2 Deposit") require.NoError(t, err, "Could not reconstruct L2 Deposit")
tx = types.NewTx(reconstructedDep) tx = types.NewTx(reconstructedDep)
l2Receipt, err := geth.WaitForTransaction(tx.Hash(), l2Client, 10*time.Duration(cfg.DeployConfig.L2BlockTime)*time.Second) // Use a long wait because the l2Client may not be configured to receive gossip from the sequencer
// so has to wait for the batcher to submit and then import those blocks from L1.
l2Receipt, err := geth.WaitForTransaction(tx.Hash(), l2Client, 60*time.Second)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, l2Opts.ExpectedStatus, l2Receipt.Status, "l2 transaction status") require.Equal(t, l2Opts.ExpectedStatus, l2Receipt.Status, "l2 transaction status")
return l2Receipt return l2Receipt
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
"upgrade:abigen": "abigen --version | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g' -e 's/ /./g' -e 's/^/v/' > .abigenrc" "upgrade:abigen": "abigen --version | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g' -e 's/ /./g' -e 's/^/v/' > .abigenrc"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.18.2", "@babel/eslint-parser": "^7.23.3",
"@changesets/changelog-github": "^0.4.8", "@changesets/changelog-github": "^0.4.8",
"@types/chai": "^4.3.10", "@types/chai": "^4.3.10",
"@types/chai-as-promised": "^7.1.8", "@types/chai-as-promised": "^7.1.8",
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/morgan": "^1.9.9", "@types/morgan": "^1.9.9",
"@types/pino": "^7.0.5", "@types/pino": "^7.0.5",
"@types/pino-multi-stream": "^5.1.5", "@types/pino-multi-stream": "^5.1.6",
"chai": "^4.3.10", "chai": "^4.3.10",
"supertest": "^6.3.3" "supertest": "^6.3.3"
} }
......
...@@ -102,31 +102,31 @@ FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5:test_resolvesCorrectly_succeed ...@@ -102,31 +102,31 @@ FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5:test_resolvesCorrectly_succeed
FaultDisputeGame_Test:test_addLocalData_static_succeeds() (gas: 642385) FaultDisputeGame_Test:test_addLocalData_static_succeeds() (gas: 642385)
FaultDisputeGame_Test:test_createdAt_succeeds() (gas: 10388) FaultDisputeGame_Test:test_createdAt_succeeds() (gas: 10388)
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 32363) FaultDisputeGame_Test:test_extraData_succeeds() (gas: 32363)
FaultDisputeGame_Test:test_gameData_succeeds() (gas: 32835) FaultDisputeGame_Test:test_gameData_succeeds() (gas: 32878)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8288) FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8288)
FaultDisputeGame_Test:test_initialize_correctData_succeeds() (gas: 57873) FaultDisputeGame_Test:test_initialize_correctData_succeeds() (gas: 57851)
FaultDisputeGame_Test:test_initialize_firstOutput_reverts() (gas: 213831) FaultDisputeGame_Test:test_initialize_firstOutput_reverts() (gas: 213831)
FaultDisputeGame_Test:test_initialize_l1HeadTooOld_reverts() (gas: 228573) FaultDisputeGame_Test:test_initialize_l1HeadTooOld_reverts() (gas: 228551)
FaultDisputeGame_Test:test_move_clockCorrectness_succeeds() (gas: 594267) FaultDisputeGame_Test:test_move_clockCorrectness_succeeds() (gas: 594245)
FaultDisputeGame_Test:test_move_clockTimeExceeded_reverts() (gas: 23175) FaultDisputeGame_Test:test_move_clockTimeExceeded_reverts() (gas: 23153)
FaultDisputeGame_Test:test_move_defendRoot_reverts() (gas: 13344) FaultDisputeGame_Test:test_move_defendRoot_reverts() (gas: 13322)
FaultDisputeGame_Test:test_move_duplicateClaim_reverts() (gas: 147368) FaultDisputeGame_Test:test_move_duplicateClaim_reverts() (gas: 147413)
FaultDisputeGame_Test:test_move_duplicateClaimsDifferentSubgames_succeeds() (gas: 556854) FaultDisputeGame_Test:test_move_duplicateClaimsDifferentSubgames_succeeds() (gas: 556821)
FaultDisputeGame_Test:test_move_gameDepthExceeded_reverts() (gas: 585831) FaultDisputeGame_Test:test_move_gameDepthExceeded_reverts() (gas: 585831)
FaultDisputeGame_Test:test_move_gameNotInProgress_reverts() (gas: 11032) FaultDisputeGame_Test:test_move_gameNotInProgress_reverts() (gas: 11010)
FaultDisputeGame_Test:test_move_nonExistentParent_reverts() (gas: 24690) FaultDisputeGame_Test:test_move_nonExistentParent_reverts() (gas: 24690)
FaultDisputeGame_Test:test_move_simpleAttack_succeeds() (gas: 151964) FaultDisputeGame_Test:test_move_simpleAttack_succeeds() (gas: 151964)
FaultDisputeGame_Test:test_resolve_challengeContested_succeeds() (gas: 269456) FaultDisputeGame_Test:test_resolve_challengeContested_succeeds() (gas: 269492)
FaultDisputeGame_Test:test_resolve_claimAlreadyResolved_reverts() (gas: 272379) FaultDisputeGame_Test:test_resolve_claimAlreadyResolved_reverts() (gas: 272379)
FaultDisputeGame_Test:test_resolve_claimAtMaxDepthAlreadyResolved_reverts() (gas: 586629) FaultDisputeGame_Test:test_resolve_claimAtMaxDepthAlreadyResolved_reverts() (gas: 586629)
FaultDisputeGame_Test:test_resolve_notInProgress_reverts() (gas: 9754) FaultDisputeGame_Test:test_resolve_notInProgress_reverts() (gas: 9754)
FaultDisputeGame_Test:test_resolve_outOfOrderResolution_reverts() (gas: 308993) FaultDisputeGame_Test:test_resolve_outOfOrderResolution_reverts() (gas: 309038)
FaultDisputeGame_Test:test_resolve_rootContested_succeeds() (gas: 139141) FaultDisputeGame_Test:test_resolve_rootContested_succeeds() (gas: 139119)
FaultDisputeGame_Test:test_resolve_rootUncontestedButUnresolved_reverts() (gas: 15958) FaultDisputeGame_Test:test_resolve_rootUncontestedButUnresolved_reverts() (gas: 15958)
FaultDisputeGame_Test:test_resolve_rootUncontestedClockNotExpired_succeeds() (gas: 18406) FaultDisputeGame_Test:test_resolve_rootUncontestedClockNotExpired_succeeds() (gas: 18406)
FaultDisputeGame_Test:test_resolve_rootUncontested_succeeds() (gas: 51462) FaultDisputeGame_Test:test_resolve_rootUncontested_succeeds() (gas: 51506)
FaultDisputeGame_Test:test_resolve_stepReached_succeeds() (gas: 498465) FaultDisputeGame_Test:test_resolve_stepReached_succeeds() (gas: 498465)
FaultDisputeGame_Test:test_resolve_teamDeathmatch_succeeds() (gas: 443381) FaultDisputeGame_Test:test_resolve_teamDeathmatch_succeeds() (gas: 443416)
FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 8277) FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 8277)
FeeVault_Test:test_constructor_baseFeeVault_succeeds() (gas: 17406) FeeVault_Test:test_constructor_baseFeeVault_succeeds() (gas: 17406)
FeeVault_Test:test_constructor_l1FeeVault_succeeds() (gas: 17374) FeeVault_Test:test_constructor_l1FeeVault_succeeds() (gas: 17374)
...@@ -382,7 +382,7 @@ MIPS_Test:test_multu_succeeds() (gas: 123040) ...@@ -382,7 +382,7 @@ MIPS_Test:test_multu_succeeds() (gas: 123040)
MIPS_Test:test_nor_succeeds() (gas: 123065) MIPS_Test:test_nor_succeeds() (gas: 123065)
MIPS_Test:test_or_succeeds() (gas: 123068) MIPS_Test:test_or_succeeds() (gas: 123068)
MIPS_Test:test_ori_succeeds() (gas: 123026) MIPS_Test:test_ori_succeeds() (gas: 123026)
MIPS_Test:test_preimage_read_succeeds() (gas: 235480) MIPS_Test:test_preimage_read_succeeds() (gas: 235436)
MIPS_Test:test_preimage_write_succeeds() (gas: 127574) MIPS_Test:test_preimage_write_succeeds() (gas: 127574)
MIPS_Test:test_prestate_exited_succeeds() (gas: 113813) MIPS_Test:test_prestate_exited_succeeds() (gas: 113813)
MIPS_Test:test_sb_succeeds() (gas: 161547) MIPS_Test:test_sb_succeeds() (gas: 161547)
...@@ -544,10 +544,10 @@ OptimistTest:test_tokenURI_returnsCorrectTokenURI_succeeds() (gas: 195905) ...@@ -544,10 +544,10 @@ OptimistTest:test_tokenURI_returnsCorrectTokenURI_succeeds() (gas: 195905)
OptimistTest:test_transferFrom_soulbound_reverts() (gas: 75512) OptimistTest:test_transferFrom_soulbound_reverts() (gas: 75512)
PreimageOracle_Test:test_keccak256PreimageKey_succeeds() (gas: 342) PreimageOracle_Test:test_keccak256PreimageKey_succeeds() (gas: 342)
PreimageOracle_Test:test_loadKeccak256PreimagePart_outOfBoundsOffset_reverts() (gas: 8971) PreimageOracle_Test:test_loadKeccak256PreimagePart_outOfBoundsOffset_reverts() (gas: 8971)
PreimageOracle_Test:test_loadKeccak256PreimagePart_succeeds() (gas: 76076) PreimageOracle_Test:test_loadKeccak256PreimagePart_succeeds() (gas: 76120)
PreimageOracle_Test:test_loadLocalData_multipleContexts_succeeds() (gas: 147718) PreimageOracle_Test:test_loadLocalData_multipleContexts_succeeds() (gas: 147718)
PreimageOracle_Test:test_loadLocalData_onePart_succeeds() (gas: 75905) PreimageOracle_Test:test_loadLocalData_onePart_succeeds() (gas: 75905)
PreimageOracle_Test:test_loadLocalData_outOfBoundsOffset_reverts() (gas: 8882) PreimageOracle_Test:test_loadLocalData_outOfBoundsOffset_reverts() (gas: 8861)
ProtocolVersions_Initialize_Test:test_initialize_events_succeeds() (gas: 59548) ProtocolVersions_Initialize_Test:test_initialize_events_succeeds() (gas: 59548)
ProtocolVersions_Initialize_Test:test_initialize_values_succeeds() (gas: 45091) ProtocolVersions_Initialize_Test:test_initialize_values_succeeds() (gas: 45091)
ProtocolVersions_Setters_TestFail:test_setRecommended_notOwner_reverts() (gas: 15597) ProtocolVersions_Setters_TestFail:test_setRecommended_notOwner_reverts() (gas: 15597)
...@@ -690,4 +690,3 @@ TransactorTest:test_constructor_succeeds() (gas: 9673) ...@@ -690,4 +690,3 @@ TransactorTest:test_constructor_succeeds() (gas: 9673)
TransactorTest:test_delegateCall_succeeds() (gas: 20931) TransactorTest:test_delegateCall_succeeds() (gas: 20931)
TransactorTest:test_delegateCall_unauthorized_reverts() (gas: 18124) TransactorTest:test_delegateCall_unauthorized_reverts() (gas: 18124)
TransferOnionTest:test_constructor_succeeds() (gas: 564789) TransferOnionTest:test_constructor_succeeds() (gas: 564789)
TransferOnionTest:test_unwrap_succeeds() (gas: 724955)
\ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"src/Safe/LivenessModule.sol": "0x45621d74ea464c75064f9194261d29d47552cf4a9c4f4b3a733f5df5803fc0dd", "src/Safe/LivenessModule.sol": "0x45621d74ea464c75064f9194261d29d47552cf4a9c4f4b3a733f5df5803fc0dd",
"src/dispute/BlockOracle.sol": "0x7e724b1ee0116dfd744f556e6237af449c2f40c6426d6f1462ae2a47589283bb", "src/dispute/BlockOracle.sol": "0x7e724b1ee0116dfd744f556e6237af449c2f40c6426d6f1462ae2a47589283bb",
"src/dispute/DisputeGameFactory.sol": "0xfdfa141408d7f8de7e230ff4bef088e30d0e4d569ca743d60d292abdd21ff270", "src/dispute/DisputeGameFactory.sol": "0xfdfa141408d7f8de7e230ff4bef088e30d0e4d569ca743d60d292abdd21ff270",
"src/dispute/FaultDisputeGame.sol": "0x0766707ab32338a6586c2340ddfbfd4e9023eeb9dfa3ef87e4b404fb0260479f", "src/dispute/FaultDisputeGame.sol": "0x7ac7553a47d96a4481a6b95363458bed5f160112b647829c4defc134fa178d9a",
"src/legacy/DeployerWhitelist.sol": "0x0a6840074734c9d167321d3299be18ef911a415e4c471fa92af7d6cfaa8336d4", "src/legacy/DeployerWhitelist.sol": "0x0a6840074734c9d167321d3299be18ef911a415e4c471fa92af7d6cfaa8336d4",
"src/legacy/L1BlockNumber.sol": "0x20d83a636c5e2067fca8c0ed505b295174e6eddb25960d8705e6b6fea8e77fa6", "src/legacy/L1BlockNumber.sol": "0x20d83a636c5e2067fca8c0ed505b295174e6eddb25960d8705e6b6fea8e77fa6",
"src/legacy/LegacyMessagePasser.sol": "0x80f355c9710af586f58cf6a86d1925e0073d1e504d0b3d814284af1bafe4dece", "src/legacy/LegacyMessagePasser.sol": "0x80f355c9710af586f58cf6a86d1925e0073d1e504d0b3d814284af1bafe4dece",
......
...@@ -143,7 +143,7 @@ contract MIPS { ...@@ -143,7 +143,7 @@ contract MIPS {
/// @notice Handles a syscall. /// @notice Handles a syscall.
/// @param _localContext The local key context for the preimage oracle. /// @param _localContext The local key context for the preimage oracle.
/// @return out_ The hashed MIPS state. /// @return out_ The hashed MIPS state.
function handleSyscall(uint256 _localContext) internal returns (bytes32 out_) { function handleSyscall(bytes32 _localContext) internal returns (bytes32 out_) {
unchecked { unchecked {
// Load state from memory // Load state from memory
State memory state; State memory state;
...@@ -626,7 +626,7 @@ contract MIPS { ...@@ -626,7 +626,7 @@ contract MIPS {
/// @param _proof The encoded proof data for leaves within the MIPS VM's memory. /// @param _proof The encoded proof data for leaves within the MIPS VM's memory.
/// @param _localContext The local key context for the preimage oracle. Optional, can be set as a constant /// @param _localContext The local key context for the preimage oracle. Optional, can be set as a constant
/// if the caller only requires one set of local keys. /// if the caller only requires one set of local keys.
function step(bytes calldata _stateData, bytes calldata _proof, uint256 _localContext) public returns (bytes32) { function step(bytes calldata _stateData, bytes calldata _proof, bytes32 _localContext) public returns (bytes32) {
unchecked { unchecked {
State memory state; State memory state;
......
...@@ -9,7 +9,7 @@ library PreimageKeyLib { ...@@ -9,7 +9,7 @@ library PreimageKeyLib {
/// @param _ident The identifier of the local data. [0, 32) bytes in size. /// @param _ident The identifier of the local data. [0, 32) bytes in size.
/// @param _localContext The local context for the key. /// @param _localContext The local context for the key.
/// @return key_ The context-specific local key. /// @return key_ The context-specific local key.
function localizeIdent(uint256 _ident, uint256 _localContext) internal view returns (bytes32 key_) { function localizeIdent(uint256 _ident, bytes32 _localContext) internal view returns (bytes32 key_) {
assembly { assembly {
// Set the type byte in the given identifier to `1` (Local). We only care about // Set the type byte in the given identifier to `1` (Local). We only care about
// the [1, 32) bytes in this value. // the [1, 32) bytes in this value.
...@@ -26,7 +26,7 @@ library PreimageKeyLib { ...@@ -26,7 +26,7 @@ library PreimageKeyLib {
/// @param _key The local data key to localize. /// @param _key The local data key to localize.
/// @param _localContext The local context for the key. /// @param _localContext The local context for the key.
/// @return localizedKey_ The localized local data key. /// @return localizedKey_ The localized local data key.
function localize(bytes32 _key, uint256 _localContext) internal view returns (bytes32 localizedKey_) { function localize(bytes32 _key, bytes32 _localContext) internal view returns (bytes32 localizedKey_) {
assembly { assembly {
// Grab the current free memory pointer to restore later. // Grab the current free memory pointer to restore later.
let ptr := mload(0x40) let ptr := mload(0x40)
......
...@@ -34,7 +34,7 @@ contract PreimageOracle is IPreimageOracle { ...@@ -34,7 +34,7 @@ contract PreimageOracle is IPreimageOracle {
/// @inheritdoc IPreimageOracle /// @inheritdoc IPreimageOracle
function loadLocalData( function loadLocalData(
uint256 _ident, uint256 _ident,
uint256 _localContext, bytes32 _localContext,
bytes32 _word, bytes32 _word,
uint256 _size, uint256 _size,
uint256 _partOffset uint256 _partOffset
......
...@@ -34,7 +34,7 @@ interface IPreimageOracle { ...@@ -34,7 +34,7 @@ interface IPreimageOracle {
/// └────────────┴────────────────────────┘ /// └────────────┴────────────────────────┘
function loadLocalData( function loadLocalData(
uint256 _ident, uint256 _ident,
uint256 _localContext, bytes32 _localContext,
bytes32 _word, bytes32 _word,
uint256 _size, uint256 _size,
uint256 _partOffset uint256 _partOffset
......
...@@ -82,8 +82,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver { ...@@ -82,8 +82,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
bool internal subgameAtRootResolved; bool internal subgameAtRootResolved;
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 0.0.11 /// @custom:semver 0.0.12
string public constant version = "0.0.11"; string public constant version = "0.0.12";
/// @param _gameType The type ID of the game. /// @param _gameType The type ID of the game.
/// @param _absolutePrestate The absolute prestate of the instruction trace. /// @param _absolutePrestate The absolute prestate of the instruction trace.
...@@ -281,7 +281,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver { ...@@ -281,7 +281,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
} }
/// @inheritdoc IFaultDisputeGame /// @inheritdoc IFaultDisputeGame
function addLocalData(uint256 _ident, uint256 _l2BlockNumber, uint256 _partOffset) external { function addLocalData(uint256 _ident, bytes32 _localContext, uint256 _partOffset) external {
// INVARIANT: Local data can only be added if the game is currently in progress. // INVARIANT: Local data can only be added if the game is currently in progress.
if (status != GameStatus.IN_PROGRESS) revert GameNotInProgress(); if (status != GameStatus.IN_PROGRESS) revert GameNotInProgress();
...@@ -293,7 +293,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver { ...@@ -293,7 +293,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
// Store the `_ident` argument // Store the `_ident` argument
mstore(0x20, _ident) mstore(0x20, _ident)
// Store the `_localContext` argument // Store the `_localContext` argument
mstore(0x40, _l2BlockNumber) mstore(0x40, _localContext)
// Store the data to load // Store the data to load
let data let data
switch _ident switch _ident
......
...@@ -35,7 +35,7 @@ interface IBigStepper { ...@@ -35,7 +35,7 @@ interface IBigStepper {
function step( function step(
bytes calldata _stateData, bytes calldata _stateData,
bytes calldata _proof, bytes calldata _proof,
uint256 _localContext bytes32 _localContext
) )
external external
returns (bytes32 postState_); returns (bytes32 postState_);
......
...@@ -70,10 +70,9 @@ interface IFaultDisputeGame is IDisputeGame { ...@@ -70,10 +70,9 @@ interface IFaultDisputeGame is IDisputeGame {
/// @notice Posts the requested local data to the VM's `PreimageOralce`. /// @notice Posts the requested local data to the VM's `PreimageOralce`.
/// @param _ident The local identifier of the data to post. /// @param _ident The local identifier of the data to post.
/// @param _l2BlockNumber The L2 block number being disputed. This serves as the local context for the /// @param _localContext The local context for the `PreimageOracle` key.
/// `PreimageOracle` key.
/// @param _partOffset The offset of the data to post. /// @param _partOffset The offset of the data to post.
function addLocalData(uint256 _ident, uint256 _l2BlockNumber, uint256 _partOffset) external; function addLocalData(uint256 _ident, bytes32 _localContext, uint256 _partOffset) external;
/// @notice Resolves the subgame rooted at the given claim index. /// @notice Resolves the subgame rooted at the given claim index.
/// @dev This function must be called bottom-up in the DAG /// @dev This function must be called bottom-up in the DAG
......
...@@ -484,7 +484,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -484,7 +484,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
} }
/// @dev Tests that adding local data with an out of bounds identifier reverts. /// @dev Tests that adding local data with an out of bounds identifier reverts.
function testFuzz_addLocalData_oob_reverts(uint256 _ident, uint256 _localContext) public { function testFuzz_addLocalData_oob_reverts(uint256 _ident, bytes32 _localContext) public {
// [1, 5] are valid local data identifiers. // [1, 5] are valid local data identifiers.
if (_ident <= 5) _ident = 0; if (_ident <= 5) _ident = 0;
...@@ -529,7 +529,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -529,7 +529,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
} }
/// @dev Helper to get the localized key for an identifier in the context of the game proxy. /// @dev Helper to get the localized key for an identifier in the context of the game proxy.
function _getKey(uint256 _ident, uint256 _localContext) internal view returns (bytes32) { function _getKey(uint256 _ident, bytes32 _localContext) internal view returns (bytes32) {
bytes32 h = keccak256(abi.encode(_ident | (1 << 248), address(gameProxy), _localContext)); bytes32 h = keccak256(abi.encode(_ident | (1 << 248), address(gameProxy), _localContext));
return bytes32((uint256(h) & ~uint256(0xFF << 248)) | (1 << 248)); return bytes32((uint256(h) & ~uint256(0xFF << 248)) | (1 << 248));
} }
......
...@@ -60,7 +60,7 @@ contract PreimageOracle_Test is Test { ...@@ -60,7 +60,7 @@ contract PreimageOracle_Test is Test {
for (uint256 i; i < words.length; i++) { for (uint256 i; i < words.length; i++) {
// Load the local data into the preimage oracle under the test contract's context // Load the local data into the preimage oracle under the test contract's context
// and the given local context. // and the given local context.
bytes32 contextKey = oracle.loadLocalData(ident, i, words[i], size, partOffset); bytes32 contextKey = oracle.loadLocalData(ident, bytes32(i), words[i], size, partOffset);
// Validate that the pre-image part is set // Validate that the pre-image part is set
bool ok = oracle.preimagePartOk(contextKey, partOffset); bool ok = oracle.preimagePartOk(contextKey, partOffset);
...@@ -79,7 +79,7 @@ contract PreimageOracle_Test is Test { ...@@ -79,7 +79,7 @@ contract PreimageOracle_Test is Test {
/// @notice Tests that context-specific data [0, 32] bytes in length can be loaded correctly. /// @notice Tests that context-specific data [0, 32] bytes in length can be loaded correctly.
function testFuzz_loadLocalData_varyingLength_succeeds( function testFuzz_loadLocalData_varyingLength_succeeds(
uint256 ident, uint256 ident,
uint256 localContext, bytes32 localContext,
bytes32 word, bytes32 word,
uint256 size, uint256 size,
uint256 partOffset uint256 partOffset
......
...@@ -17,7 +17,7 @@ contract AlphabetVM is IBigStepper { ...@@ -17,7 +17,7 @@ contract AlphabetVM is IBigStepper {
} }
/// @inheritdoc IBigStepper /// @inheritdoc IBigStepper
function step(bytes calldata _stateData, bytes calldata, uint256) external view returns (bytes32 postState_) { function step(bytes calldata _stateData, bytes calldata, bytes32) external view returns (bytes32 postState_) {
uint256 traceIndex; uint256 traceIndex;
uint256 claim; uint256 claim;
if ((keccak256(_stateData) << 8) == (Claim.unwrap(ABSOLUTE_PRESTATE) << 8)) { if ((keccak256(_stateData) << 8) == (Claim.unwrap(ABSOLUTE_PRESTATE) << 8)) {
......
This diff is collapsed.
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