diff --git a/abi-bindings/go/Utilities/ValidatorSetSig/ValidatorSetSig.go b/abi-bindings/go/Utilities/ValidatorSetSig/ValidatorSetSig.go index 37ba79d65..b97fe7f77 100644 --- a/abi-bindings/go/Utilities/ValidatorSetSig/ValidatorSetSig.go +++ b/abi-bindings/go/Utilities/ValidatorSetSig/ValidatorSetSig.go @@ -31,17 +31,17 @@ var ( // ValidatorSetSigMessage is an auto generated low-level Go binding around an user-defined struct. type ValidatorSetSigMessage struct { + TargetBlockchainID [32]byte ValidatorSetSigAddress common.Address TargetContractAddress common.Address - TargetBlockchainID [32]byte Nonce *big.Int Payload []byte } // ValidatorSetSigMetaData contains all meta data concerning the ValidatorSetSig contract. var ValidatorSetSigMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validatorBlockchainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"targetContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"Delivered\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"VALIDATORS_SOURCE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractIWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"executeCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"targetContractAddress\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"validatorSetSigAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"targetContractAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"targetBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"internalType\":\"structValidatorSetSigMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"validateMessage\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60c060405234801561001057600080fd5b50604051610b95380380610b9583398101604081905261002f916100b6565b600160005560808190526040805163084279ef60e31b8152905173020000000000000000000000000000000000000591634213cf789160048083019260209291908290030181865afa158015610089573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ad91906100b6565b60a052506100cf565b6000602082840312156100c857600080fd5b5051919050565b60805160a051610a946101016000396000818161012401526104f901526000818160ef015261023e0152610a946000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638d6e579d1161005b5780638d6e579d146100ea578063b771b3bc14610111578063d127dc9b1461011f578063e5a4c2fc1461014657600080fd5b80630731775d146100825780635433da42146100a75780637ecebe00146100bc575b600080fd5b61008a600081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ba6100b5366004610651565b610159565b005b6100dc6100ca366004610693565b60016020526000908152604090205481565b60405190815260200161009e565b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b61008a6005600160991b0181565b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6100ba6101543660046107c1565b610486565b6101616105f8565b6040516306f8253560e41b815263ffffffff8216600482015260009081906005600160991b0190636f82535090602401600060405180830381865afa1580156101ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101d691908101906108db565b915091508061023a5760405162461bcd60e51b815260206004820152602560248201527f56616c696461746f725365745369673a20696e76616c69642077617270206d65604482015264737361676560d81b60648201526084015b60405180910390fd5b81517f0000000000000000000000000000000000000000000000000000000000000000146102b95760405162461bcd60e51b815260206004820152602660248201527f56616c696461746f725365745369673a20696e76616c696420736f75726365436044820152651a185a5b925160d21b6064820152608401610231565b60208201516001600160a01b03161561032a5760405162461bcd60e51b815260206004820152602d60248201527f56616c696461746f725365745369673a206e6f6e2d7a65726f206f726967696e60448201526c53656e6465724164647265737360981b6064820152608401610231565b600082604001518060200190518101906103449190610981565b905061034f81610486565b80606001516001600083602001516001600160a01b03166001600160a01b0316815260200190815260200160002081905550600081602001516001600160a01b031682608001516040516103a39190610a1b565b6000604051808303816000865af19150503d80600081146103e0576040519150601f19603f3d011682016040523d82523d6000602084013e6103e5565b606091505b50509050806104365760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f725365745369673a2063616c6c206661696c6564000000006044820152606401610231565b816060015182602001516001600160a01b03167f5942a9a3968c7d49fc51c027041544ea295f5c1e395d6d8aa35c4369959f8ed960405160405180910390a3505050506104836001600055565b50565b80516001600160a01b031630146104f75760405162461bcd60e51b815260206004820152602f60248201527f56616c696461746f725365745369673a20696e76616c69642076616c6964617460448201526e6f725365745369674164647265737360881b6064820152608401610231565b7f000000000000000000000000000000000000000000000000000000000000000081604001511461057e5760405162461bcd60e51b815260206004820152602b60248201527f56616c696461746f725365745369673a20696e76616c6964207461726765744260448201526a1b1bd8dad8da185a5b925160aa1b6064820152608401610231565b60608101516020808301516001600160a01b0316600090815260019182905260409020546105ab91610a37565b146104835760405162461bcd60e51b815260206004820152601e60248201527f56616c696461746f725365745369673a20696e76616c6964206e6f6e636500006044820152606401610231565b60026000540361064a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610231565b6002600055565b60006020828403121561066357600080fd5b813563ffffffff8116811461067757600080fd5b9392505050565b6001600160a01b038116811461048357600080fd5b6000602082840312156106a557600080fd5b81356106778161067e565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff811182821017156106e9576106e96106b0565b60405290565b6040516060810167ffffffffffffffff811182821017156106e9576106e96106b0565b604051601f8201601f1916810167ffffffffffffffff8111828210171561073b5761073b6106b0565b604052919050565b600067ffffffffffffffff82111561075d5761075d6106b0565b50601f01601f191660200190565b600082601f83011261077c57600080fd5b813561078f61078a82610743565b610712565b8181528460208386010111156107a457600080fd5b816020850160208301376000918101602001919091529392505050565b6000602082840312156107d357600080fd5b813567ffffffffffffffff808211156107eb57600080fd5b9083019060a082860312156107ff57600080fd5b6108076106c6565b82356108128161067e565b815260208301356108228161067e565b80602083015250604083013560408201526060830135606082015260808301358281111561084f57600080fd5b61085b8782860161076b565b60808301525095945050505050565b60005b8381101561088557818101518382015260200161086d565b50506000910152565b600082601f83011261089f57600080fd5b81516108ad61078a82610743565b8181528460208386010111156108c257600080fd5b6108d382602083016020870161086a565b949350505050565b600080604083850312156108ee57600080fd5b825167ffffffffffffffff8082111561090657600080fd5b908401906060828703121561091a57600080fd5b6109226106ef565b8251815260208301516109348161067e565b602082015260408301518281111561094b57600080fd5b6109578882860161088e565b6040830152508094505050506020830151801515811461097657600080fd5b809150509250929050565b60006020828403121561099357600080fd5b815167ffffffffffffffff808211156109ab57600080fd5b9083019060a082860312156109bf57600080fd5b6109c76106c6565b82516109d28161067e565b815260208301516109e28161067e565b806020830152506040830151604082015260608301516060820152608083015182811115610a0f57600080fd5b61085b8782860161088e565b60008251610a2d81846020870161086a565b9190910192915050565b80820180821115610a5857634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212200696682b37a67685d7a9aa9fb79349702924baf48fa389cf1c8a6ca737b46f0b64736f6c63430008120033", + ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validatorBlockchainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"targetContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"Delivered\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"VALIDATORS_SOURCE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractIWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"executeCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"targetContractAddress\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"targetBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"validatorSetSigAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"targetContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"internalType\":\"structValidatorSetSigMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"validateMessage\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x60c060405234801561001057600080fd5b50604051610b79380380610b7983398101604081905261002f916100b6565b600160005560808190526040805163084279ef60e31b8152905173020000000000000000000000000000000000000591634213cf789160048083019260209291908290030181865afa158015610089573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ad91906100b6565b60a052506100cf565b6000602082840312156100c857600080fd5b5051919050565b60805160a051610a7761010260003960008181610137015261047e015260008181610102015261023e0152610a776000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637ecebe001161005b5780637ecebe00146100cf5780638d6e579d146100fd578063b771b3bc14610124578063d127dc9b1461013257600080fd5b80630731775d146100825780635433da42146100a75780635f659d8d146100bc575b600080fd5b61008a600081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ba6100b5366004610638565b610159565b005b6100ba6100ca36600461078b565b61047a565b6100ef6100dd366004610832565b60016020526000908152604090205481565b60405190815260200161009e565b6100ef7f000000000000000000000000000000000000000000000000000000000000000081565b61008a6005600160991b0181565b6100ef7f000000000000000000000000000000000000000000000000000000000000000081565b6101616105df565b6040516306f8253560e41b815263ffffffff8216600482015260009081906005600160991b0190636f82535090602401600060405180830381865afa1580156101ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101d691908101906108c0565b915091508061023a5760405162461bcd60e51b815260206004820152602560248201527f56616c696461746f725365745369673a20696e76616c69642077617270206d65604482015264737361676560d81b60648201526084015b60405180910390fd5b81517f0000000000000000000000000000000000000000000000000000000000000000146102b95760405162461bcd60e51b815260206004820152602660248201527f56616c696461746f725365745369673a20696e76616c696420736f75726365436044820152651a185a5b925160d21b6064820152608401610231565b60208201516001600160a01b03161561032a5760405162461bcd60e51b815260206004820152602d60248201527f56616c696461746f725365745369673a206e6f6e2d7a65726f206f726967696e60448201526c53656e6465724164647265737360981b6064820152608401610231565b600082604001518060200190518101906103449190610966565b905061034f8161047a565b606081015161035f9060016109fe565b604080830180516001600160a01b03908116600090815260016020528381209490945590516080850151925191169161039791610a25565b6000604051808303816000865af19150503d80600081146103d4576040519150601f19603f3d011682016040523d82523d6000602084013e6103d9565b606091505b505090508061042a5760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f725365745369673a2063616c6c206661696c6564000000006044820152606401610231565b816060015182604001516001600160a01b03167f5942a9a3968c7d49fc51c027041544ea295f5c1e395d6d8aa35c4369959f8ed960405160405180910390a3505050506104776001600055565b50565b80517f0000000000000000000000000000000000000000000000000000000000000000146104fe5760405162461bcd60e51b815260206004820152602b60248201527f56616c696461746f725365745369673a20696e76616c6964207461726765744260448201526a1b1bd8dad8da185a5b925160aa1b6064820152608401610231565b60208101516001600160a01b031630146105725760405162461bcd60e51b815260206004820152602f60248201527f56616c696461746f725365745369673a20696e76616c69642076616c6964617460448201526e6f725365745369674164647265737360881b6064820152608401610231565b60608101516040808301516001600160a01b0316600090815260016020522054146104775760405162461bcd60e51b815260206004820152601e60248201527f56616c696461746f725365745369673a20696e76616c6964206e6f6e636500006044820152606401610231565b6002600054036106315760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610231565b6002600055565b60006020828403121561064a57600080fd5b813563ffffffff8116811461065e57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff8111828210171561069e5761069e610665565b60405290565b6040516060810167ffffffffffffffff8111828210171561069e5761069e610665565b604051601f8201601f1916810167ffffffffffffffff811182821017156106f0576106f0610665565b604052919050565b6001600160a01b038116811461047757600080fd5b600067ffffffffffffffff82111561072757610727610665565b50601f01601f191660200190565b600082601f83011261074657600080fd5b81356107596107548261070d565b6106c7565b81815284602083860101111561076e57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561079d57600080fd5b813567ffffffffffffffff808211156107b557600080fd5b9083019060a082860312156107c957600080fd5b6107d161067b565b8235815260208301356107e3816106f8565b602082015260408301356107f6816106f8565b60408201526060838101359082015260808301358281111561081757600080fd5b61082387828601610735565b60808301525095945050505050565b60006020828403121561084457600080fd5b813561065e816106f8565b60005b8381101561086a578181015183820152602001610852565b50506000910152565b600082601f83011261088457600080fd5b81516108926107548261070d565b8181528460208386010111156108a757600080fd5b6108b882602083016020870161084f565b949350505050565b600080604083850312156108d357600080fd5b825167ffffffffffffffff808211156108eb57600080fd5b90840190606082870312156108ff57600080fd5b6109076106a4565b825181526020830151610919816106f8565b602082015260408301518281111561093057600080fd5b61093c88828601610873565b6040830152508094505050506020830151801515811461095b57600080fd5b809150509250929050565b60006020828403121561097857600080fd5b815167ffffffffffffffff8082111561099057600080fd5b9083019060a082860312156109a457600080fd5b6109ac61067b565b8251815260208301516109be816106f8565b602082015260408301516109d1816106f8565b6040820152606083810151908201526080830151828111156109f257600080fd5b61082387828601610873565b80820180821115610a1f57634e487b7160e01b600052601160045260246000fd5b92915050565b60008251610a3781846020870161084f565b919091019291505056fea26469706673582212201b7d5ff961822b4590c42e8de6b2a4885b1804fef33e03edb4bb54c5d7fa182a64736f6c63430008120033", } // ValidatorSetSigABI is the input ABI used to generate the binding from. @@ -335,9 +335,9 @@ func (_ValidatorSetSig *ValidatorSetSigCallerSession) Nonces(targetContractAddre return _ValidatorSetSig.Contract.Nonces(&_ValidatorSetSig.CallOpts, targetContractAddress) } -// ValidateMessage is a free data retrieval call binding the contract method 0xe5a4c2fc. +// ValidateMessage is a free data retrieval call binding the contract method 0x5f659d8d. // -// Solidity: function validateMessage((address,address,bytes32,uint256,bytes) message) view returns() +// Solidity: function validateMessage((bytes32,address,address,uint256,bytes) message) view returns() func (_ValidatorSetSig *ValidatorSetSigCaller) ValidateMessage(opts *bind.CallOpts, message ValidatorSetSigMessage) error { var out []interface{} err := _ValidatorSetSig.contract.Call(opts, &out, "validateMessage", message) @@ -350,16 +350,16 @@ func (_ValidatorSetSig *ValidatorSetSigCaller) ValidateMessage(opts *bind.CallOp } -// ValidateMessage is a free data retrieval call binding the contract method 0xe5a4c2fc. +// ValidateMessage is a free data retrieval call binding the contract method 0x5f659d8d. // -// Solidity: function validateMessage((address,address,bytes32,uint256,bytes) message) view returns() +// Solidity: function validateMessage((bytes32,address,address,uint256,bytes) message) view returns() func (_ValidatorSetSig *ValidatorSetSigSession) ValidateMessage(message ValidatorSetSigMessage) error { return _ValidatorSetSig.Contract.ValidateMessage(&_ValidatorSetSig.CallOpts, message) } -// ValidateMessage is a free data retrieval call binding the contract method 0xe5a4c2fc. +// ValidateMessage is a free data retrieval call binding the contract method 0x5f659d8d. // -// Solidity: function validateMessage((address,address,bytes32,uint256,bytes) message) view returns() +// Solidity: function validateMessage((bytes32,address,address,uint256,bytes) message) view returns() func (_ValidatorSetSig *ValidatorSetSigCallerSession) ValidateMessage(message ValidatorSetSigMessage) error { return _ValidatorSetSig.Contract.ValidateMessage(&_ValidatorSetSig.CallOpts, message) } diff --git a/contracts/src/Utilities/ValidatorSetSig.sol b/contracts/src/Utilities/ValidatorSetSig.sol index d29f40d28..1e07d1016 100644 --- a/contracts/src/Utilities/ValidatorSetSig.sol +++ b/contracts/src/Utilities/ValidatorSetSig.sol @@ -19,16 +19,16 @@ import {ReentrancyGuard} from "@openzeppelin/contracts@4.8.1/security/Reentrancy /** * @dev Message format for the WarpMessage payload to be forwarded to the target contract * + * targetBlockchainID: Blockchain ID of the chain the message is intended for * validatorSetSigAddress: Address of the ValidatorSetSig contract this message is intended for * targetContractAddress: Address of the contract that the payload should be forwarded to - * targetBlockchainID: Blockchain ID of the chain the message is intended for * nonce: Unique nonce for the target contract address to provide replay protection * payload: Payload to be forwarded to the target contract. Usually ABI encoded function call with parameters. */ struct ValidatorSetSigMessage { + bytes32 targetBlockchainID; address validatorSetSigAddress; address targetContractAddress; - bytes32 targetBlockchainID; uint256 nonce; bytes payload; } @@ -108,7 +108,7 @@ contract ValidatorSetSig is ReentrancyGuard { validateMessage(validatorSetSigMessage); - nonces[validatorSetSigMessage.targetContractAddress] = validatorSetSigMessage.nonce; + nonces[validatorSetSigMessage.targetContractAddress] = validatorSetSigMessage.nonce + 1; // We don't need to protect against return bomb vectors below here since the caller is expected to have full control over the contract called. (bool success,) = @@ -122,17 +122,16 @@ contract ValidatorSetSig is ReentrancyGuard { } function validateMessage(ValidatorSetSigMessage memory message) public view { - require( - message.validatorSetSigAddress == address(this), - "ValidatorSetSig: invalid validatorSetSigAddress" - ); require( message.targetBlockchainID == blockchainID, "ValidatorSetSig: invalid targetBlockchainID" ); require( - nonces[message.targetContractAddress] + 1 == message.nonce, - "ValidatorSetSig: invalid nonce" + message.validatorSetSigAddress == address(this), + "ValidatorSetSig: invalid validatorSetSigAddress" + ); + require( + nonces[message.targetContractAddress] == message.nonce, "ValidatorSetSig: invalid nonce" ); } } diff --git a/contracts/src/Utilities/tests/ValidatorSetSigTests.t.sol b/contracts/src/Utilities/tests/ValidatorSetSigTests.t.sol index 73089abe5..95b235fc5 100644 --- a/contracts/src/Utilities/tests/ValidatorSetSigTests.t.sol +++ b/contracts/src/Utilities/tests/ValidatorSetSigTests.t.sol @@ -118,8 +118,8 @@ contract ValidatorSetSigTest is Test { function testNonces() public { WarpMessage memory warpMessage = _getValidWarpMessage(); ValidatorSetSigMessage memory validatorSetSigMessage = _getValidValidatorSetSigMessage(); - // Set nonce to invalid value, since first message should have nonce 1 - validatorSetSigMessage.nonce = 0; + // Set nonce to invalid value, since first message should have nonce 0 + validatorSetSigMessage.nonce = 1; warpMessage.payload = abi.encode(validatorSetSigMessage); vm.mockCall( WARP_PRECOMPILE_ADDRESS, @@ -139,8 +139,8 @@ contract ValidatorSetSigTest is Test { vm.expectRevert("ValidatorSetSig: invalid nonce"); validatorSetSig.executeCall(0); - // Set nonce to 1 which is valid - validatorSetSigMessage.nonce = 1; + // Set nonce to 0 which is valid + validatorSetSigMessage.nonce = 0; warpMessage.payload = abi.encode(validatorSetSigMessage); vm.mockCall( WARP_PRECOMPILE_ADDRESS, @@ -151,8 +151,8 @@ contract ValidatorSetSigTest is Test { validatorSetSig.executeCall(0); assertEq(validatorSetSig.nonces(_DEFAULT_TARGET_ADDRESS), 1); - // Set nonce to 2 which is valid - validatorSetSigMessage.nonce = 2; + // Set nonce to 1 which is valid + validatorSetSigMessage.nonce = 1; warpMessage.payload = abi.encode(validatorSetSigMessage); vm.mockCall( WARP_PRECOMPILE_ADDRESS, @@ -164,7 +164,7 @@ contract ValidatorSetSigTest is Test { // finally test different target address validatorSetSigMessage.targetContractAddress = _OTHER_TARGET_ADDRESS; - validatorSetSigMessage.nonce = 1; + validatorSetSigMessage.nonce = 0; warpMessage.payload = abi.encode(validatorSetSigMessage); vm.mockCall( WARP_PRECOMPILE_ADDRESS, @@ -228,10 +228,10 @@ contract ValidatorSetSigTest is Test { returns (ValidatorSetSigMessage memory) { return ValidatorSetSigMessage({ + targetBlockchainID: _MOCK_BLOCKCHAIN_ID, validatorSetSigAddress: address(validatorSetSig), targetContractAddress: _DEFAULT_TARGET_ADDRESS, - targetBlockchainID: _MOCK_BLOCKCHAIN_ID, - nonce: 1, + nonce: 0, payload: "" }); }