diff --git a/abis/0.8.23/OptimismMessenger.json b/abis/0.8.23/OptimismMessenger.json index 4c727f8..af02f2f 100644 --- a/abis/0.8.23/OptimismMessenger.json +++ b/abis/0.8.23/OptimismMessenger.json @@ -22,33 +22,12 @@ { "inputs": [ { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "CDMContractProxyHome", - "type": "address" - } - ], - "name": "CDMContractProxyHomeOnly", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "foreignGovernor", - "type": "address" + "internalType": "bytes32", + "name": "deliveryHash", + "type": "bytes32" } ], - "name": "ForeignGovernorOnly", + "name": "AlreadyDelivered", "type": "error" }, { @@ -99,6 +78,22 @@ "name": "SelfCallOnly", "type": "error" }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "sourceGovernor", + "type": "address" + } + ], + "name": "SourceGovernorOnly", + "type": "error" + }, { "inputs": [ { @@ -120,23 +115,47 @@ "name": "TargetExecFailed", "type": "error" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "received", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "required", + "type": "uint256" + } + ], + "name": "WrongSourceChainId", + "type": "error" + }, { "inputs": [], "name": "ZeroAddress", "type": "error" }, { - "anonymous": false, + "inputs": [], + "name": "ZeroValue", + "type": "error" + }, + { "inputs": [ { - "indexed": true, "internalType": "address", - "name": "foreignMessageSender", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "sourceRelayer", "type": "address" } ], - "name": "ForeignGovernorUpdated", - "type": "event" + "name": "sourceRelayerOnly", + "type": "error" }, { "anonymous": false, @@ -176,6 +195,19 @@ "name": "MessageReceived", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sourceGovernor", + "type": "address" + } + ], + "name": "SourceGovernorUpdated", + "type": "event" + }, { "inputs": [], "name": "CDMContractProxyHome", @@ -206,11 +238,11 @@ "inputs": [ { "internalType": "address", - "name": "newForeignGovernor", + "name": "newSourceGovernor", "type": "address" } ], - "name": "changeForeignGovernor", + "name": "changeSourceGovernor", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -241,13 +273,26 @@ "stateMutability": "payable", "type": "function" }, + { + "inputs": [], + "name": "sourceGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "stateMutability": "payable", "type": "receive" } ], - "bytecode": "0x60a060405234801561001057600080fd5b50604051610b85380380610b8583398101604081905261002f916100ae565b6001600160a01b038216158061004c57506001600160a01b038116155b1561006a5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03918216608052600080546001600160a01b031916919092161790556100e1565b80516001600160a01b03811681146100a957600080fd5b919050565b600080604083850312156100c157600080fd5b6100ca83610092565b91506100d860208401610092565b90509250929050565b608051610a756101106000396000818160d30152818161029a0152818161030201526103780152610a756000f3fe60806040526004361061005e5760003560e01c8063cd9e30d911610043578063cd9e30d91461011f578063dd32a50614610132578063f02fb7741461015f57600080fd5b8063400a2c101461009f578063c8404330146100c157600080fd5b3661009a5760405134815233907f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f9060200160405180910390a2005b600080fd5b3480156100ab57600080fd5b506100bf6100ba3660046107a8565b610182565b005b3480156100cd57600080fd5b506100f57f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100bf61012d3660046107fb565b610282565b34801561013e57600080fd5b506000546100f59073ffffffffffffffffffffffffffffffffffffffff1681565b34801561016b57600080fd5b50610174602481565b604051908152602001610116565b3330146101c8576040517f0dbc9bfc0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610215576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917ff453e38063153897c0cb53422f7eb5eed0ee1866e8d47fd6b302acbe3b5d221d91a250565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461032f576040517f9a63be9400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044016101bf565b60008054604080517f6e296e45000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff92831693927f00000000000000000000000000000000000000000000000000000000000000001691636e296e45916004808301926020929190829003018187875af11580156103c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e891906108ca565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461046f576040517f33527f4900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152831660248201526044016101bf565b825160248110156104ba5783516040517f34c9027a0000000000000000000000000000000000000000000000000000000081526101bf91602491600401918252602082015260400190565b60005b8181101561072e57848101601481015160208201516024928301519290930192909173ffffffffffffffffffffffffffffffffffffffff831661052c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47826bffffffffffffffffffffffff16111561058a576040517fcf4791810000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff831660048201524760248201526044016101bf565b60008163ffffffff1667ffffffffffffffff8111156105ab576105ab6107cc565b6040519080825280601f01601f1916602001820160405280156105d5576020820181803683370190505b50905060005b8263ffffffff1681101561065857896105f482886108e7565b8151811061060457610604610927565b602001015160f81c60f81b82828151811061062157610621610927565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001016105db565b5061066963ffffffff8316866108e7565b945060008473ffffffffffffffffffffffffffffffffffffffff16846bffffffffffffffffffffffff16836040516106a1919061097a565b60006040518083038185875af1925050503d80600081146106de576040519150601f19603f3d011682016040523d82523d6000602084013e6106e3565b606091505b5050905080610724578484836040517f6cfc79a50000000000000000000000000000000000000000000000000000000081526004016101bf939291906109e0565b50505050506104bd565b508273ffffffffffffffffffffffffffffffffffffffff167f3c64b439784b3c09eba93acf868463aed0e339a92920e1d8822118261dfc1a7d856040516107759190610a2c565b60405180910390a250505050565b73ffffffffffffffffffffffffffffffffffffffff811681146107a557600080fd5b50565b6000602082840312156107ba57600080fd5b81356107c581610783565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561080d57600080fd5b813567ffffffffffffffff8082111561082557600080fd5b818401915084601f83011261083957600080fd5b81358181111561084b5761084b6107cc565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610891576108916107cc565b816040528281528760208487010111156108aa57600080fd5b826020860160208301376000928101602001929092525095945050505050565b6000602082840312156108dc57600080fd5b81516107c581610783565b80820180821115610921577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60005b83811015610971578181015183820152602001610959565b50506000910152565b6000825161098c818460208701610956565b9190910192915050565b600081518084526109ae816020860160208601610956565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff841681526bffffffffffffffffffffffff83166020820152606060408201526000610a236060830184610996565b95945050505050565b6020815260006107c5602083018461099656fea2646970667358221220054f953390cc097af8de869f5684350175af171b5ae32d718e066aaea486c2d064736f6c63430008170033", - "deployedBytecode": "0x60806040526004361061005e5760003560e01c8063cd9e30d911610043578063cd9e30d91461011f578063dd32a50614610132578063f02fb7741461015f57600080fd5b8063400a2c101461009f578063c8404330146100c157600080fd5b3661009a5760405134815233907f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f9060200160405180910390a2005b600080fd5b3480156100ab57600080fd5b506100bf6100ba3660046107a8565b610182565b005b3480156100cd57600080fd5b506100f57f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100bf61012d3660046107fb565b610282565b34801561013e57600080fd5b506000546100f59073ffffffffffffffffffffffffffffffffffffffff1681565b34801561016b57600080fd5b50610174602481565b604051908152602001610116565b3330146101c8576040517f0dbc9bfc0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610215576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917ff453e38063153897c0cb53422f7eb5eed0ee1866e8d47fd6b302acbe3b5d221d91a250565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461032f576040517f9a63be9400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044016101bf565b60008054604080517f6e296e45000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff92831693927f00000000000000000000000000000000000000000000000000000000000000001691636e296e45916004808301926020929190829003018187875af11580156103c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e891906108ca565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461046f576040517f33527f4900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152831660248201526044016101bf565b825160248110156104ba5783516040517f34c9027a0000000000000000000000000000000000000000000000000000000081526101bf91602491600401918252602082015260400190565b60005b8181101561072e57848101601481015160208201516024928301519290930192909173ffffffffffffffffffffffffffffffffffffffff831661052c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47826bffffffffffffffffffffffff16111561058a576040517fcf4791810000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff831660048201524760248201526044016101bf565b60008163ffffffff1667ffffffffffffffff8111156105ab576105ab6107cc565b6040519080825280601f01601f1916602001820160405280156105d5576020820181803683370190505b50905060005b8263ffffffff1681101561065857896105f482886108e7565b8151811061060457610604610927565b602001015160f81c60f81b82828151811061062157610621610927565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001016105db565b5061066963ffffffff8316866108e7565b945060008473ffffffffffffffffffffffffffffffffffffffff16846bffffffffffffffffffffffff16836040516106a1919061097a565b60006040518083038185875af1925050503d80600081146106de576040519150601f19603f3d011682016040523d82523d6000602084013e6106e3565b606091505b5050905080610724578484836040517f6cfc79a50000000000000000000000000000000000000000000000000000000081526004016101bf939291906109e0565b50505050506104bd565b508273ffffffffffffffffffffffffffffffffffffffff167f3c64b439784b3c09eba93acf868463aed0e339a92920e1d8822118261dfc1a7d856040516107759190610a2c565b60405180910390a250505050565b73ffffffffffffffffffffffffffffffffffffffff811681146107a557600080fd5b50565b6000602082840312156107ba57600080fd5b81356107c581610783565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561080d57600080fd5b813567ffffffffffffffff8082111561082557600080fd5b818401915084601f83011261083957600080fd5b81358181111561084b5761084b6107cc565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610891576108916107cc565b816040528281528760208487010111156108aa57600080fd5b826020860160208301376000928101602001929092525095945050505050565b6000602082840312156108dc57600080fd5b81516107c581610783565b80820180821115610921577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60005b83811015610971578181015183820152602001610959565b50506000910152565b6000825161098c818460208701610956565b9190910192915050565b600081518084526109ae816020860160208601610956565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff841681526bffffffffffffffffffffffff83166020820152606060408201526000610a236060830184610996565b95945050505050565b6020815260006107c5602083018461099656fea2646970667358221220054f953390cc097af8de869f5684350175af171b5ae32d718e066aaea486c2d064736f6c63430008170033", + "bytecode": "0x60a060405234801561001057600080fd5b50604051610bca380380610bca83398101604081905261002f916100ae565b6001600160a01b038216158061004c57506001600160a01b038116155b1561006a5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03918216608052600180546001600160a01b031916919092161790556100e1565b80516001600160a01b03811681146100a957600080fd5b919050565b600080604083850312156100c157600080fd5b6100ca83610092565b91506100d860208401610092565b90509250929050565b608051610aba6101106000396000818160bc015281816101d20152818161023a01526102970152610aba6000f3fe6080604052600436106100695760003560e01c8063e3b94a2311610043578063e3b94a231461014a578063f02fb77414610177578063f8b4870f1461019a57600080fd5b8063c8404330146100aa578063cd9e30d914610108578063dd32a5061461011d57600080fd5b366100a55760405134815233907f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f9060200160405180910390a2005b600080fd5b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61011b6101163660046107f7565b6101ba565b005b34801561012957600080fd5b506001546100de9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015657600080fd5b506000546100de9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561018357600080fd5b5061018c602481565b6040519081526020016100ff565b3480156101a657600080fd5b5061011b6101b53660046108eb565b610409565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461026c576040517f264cd9ca00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610302573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610326919061090f565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146103ad576040517f978c830c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808316600483015283166024820152604401610263565b6103b683610504565b8173ffffffffffffffffffffffffffffffffffffffff167f3c64b439784b3c09eba93acf868463aed0e339a92920e1d8822118261dfc1a7d846040516103fc919061099a565b60405180910390a2505050565b33301461044a576040517f0dbc9bfc000000000000000000000000000000000000000000000000000000008152336004820152306024820152604401610263565b73ffffffffffffffffffffffffffffffffffffffff8116610497576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917fbbc9d5867fd60faf098cfaa8adb3402dd83501cc76385968ddbb6b2610800f8e91a250565b8051602481101561054f5781516040517f34c9027a00000000000000000000000000000000000000000000000000000000815261026391602491600401918252602082015260400190565b60005b818110156107c357828101601481015160208201516024928301519290930192909173ffffffffffffffffffffffffffffffffffffffff83166105c1576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47826bffffffffffffffffffffffff16111561061f576040517fcf4791810000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff83166004820152476024820152604401610263565b60008163ffffffff1667ffffffffffffffff811115610640576106406107c8565b6040519080825280601f01601f19166020018201604052801561066a576020820181803683370190505b50905060005b8263ffffffff168110156106ed578761068982886109ad565b81518110610699576106996109ed565b602001015160f81c60f81b8282815181106106b6576106b66109ed565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600101610670565b506106fe63ffffffff8316866109ad565b945060008473ffffffffffffffffffffffffffffffffffffffff16846bffffffffffffffffffffffff16836040516107369190610a1c565b60006040518083038185875af1925050503d8060008114610773576040519150601f19603f3d011682016040523d82523d6000602084013e610778565b606091505b50509050806107b9578484836040517f6cfc79a500000000000000000000000000000000000000000000000000000000815260040161026393929190610a38565b5050505050610552565b505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561080957600080fd5b813567ffffffffffffffff8082111561082157600080fd5b818401915084601f83011261083557600080fd5b813581811115610847576108476107c8565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561088d5761088d6107c8565b816040528281528760208487010111156108a657600080fd5b826020860160208301376000928101602001929092525095945050505050565b73ffffffffffffffffffffffffffffffffffffffff811681146108e857600080fd5b50565b6000602082840312156108fd57600080fd5b8135610908816108c6565b9392505050565b60006020828403121561092157600080fd5b8151610908816108c6565b60005b8381101561094757818101518382015260200161092f565b50506000910152565b6000815180845261096881602086016020860161092c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006109086020830184610950565b808201808211156109e7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610a2e81846020870161092c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff841681526bffffffffffffffffffffffff83166020820152606060408201526000610a7b6060830184610950565b9594505050505056fea2646970667358221220ae653f9aafa635f317a390827150d6fda83a572884b398ddd9bfe84024f5591564736f6c63430008170033", + "deployedBytecode": "0x6080604052600436106100695760003560e01c8063e3b94a2311610043578063e3b94a231461014a578063f02fb77414610177578063f8b4870f1461019a57600080fd5b8063c8404330146100aa578063cd9e30d914610108578063dd32a5061461011d57600080fd5b366100a55760405134815233907f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f9060200160405180910390a2005b600080fd5b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61011b6101163660046107f7565b6101ba565b005b34801561012957600080fd5b506001546100de9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015657600080fd5b506000546100de9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561018357600080fd5b5061018c602481565b6040519081526020016100ff565b3480156101a657600080fd5b5061011b6101b53660046108eb565b610409565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461026c576040517f264cd9ca00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610302573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610326919061090f565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146103ad576040517f978c830c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808316600483015283166024820152604401610263565b6103b683610504565b8173ffffffffffffffffffffffffffffffffffffffff167f3c64b439784b3c09eba93acf868463aed0e339a92920e1d8822118261dfc1a7d846040516103fc919061099a565b60405180910390a2505050565b33301461044a576040517f0dbc9bfc000000000000000000000000000000000000000000000000000000008152336004820152306024820152604401610263565b73ffffffffffffffffffffffffffffffffffffffff8116610497576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917fbbc9d5867fd60faf098cfaa8adb3402dd83501cc76385968ddbb6b2610800f8e91a250565b8051602481101561054f5781516040517f34c9027a00000000000000000000000000000000000000000000000000000000815261026391602491600401918252602082015260400190565b60005b818110156107c357828101601481015160208201516024928301519290930192909173ffffffffffffffffffffffffffffffffffffffff83166105c1576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47826bffffffffffffffffffffffff16111561061f576040517fcf4791810000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff83166004820152476024820152604401610263565b60008163ffffffff1667ffffffffffffffff811115610640576106406107c8565b6040519080825280601f01601f19166020018201604052801561066a576020820181803683370190505b50905060005b8263ffffffff168110156106ed578761068982886109ad565b81518110610699576106996109ed565b602001015160f81c60f81b8282815181106106b6576106b66109ed565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600101610670565b506106fe63ffffffff8316866109ad565b945060008473ffffffffffffffffffffffffffffffffffffffff16846bffffffffffffffffffffffff16836040516107369190610a1c565b60006040518083038185875af1925050503d8060008114610773576040519150601f19603f3d011682016040523d82523d6000602084013e610778565b606091505b50509050806107b9578484836040517f6cfc79a500000000000000000000000000000000000000000000000000000000815260040161026393929190610a38565b5050505050610552565b505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561080957600080fd5b813567ffffffffffffffff8082111561082157600080fd5b818401915084601f83011261083557600080fd5b813581811115610847576108476107c8565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561088d5761088d6107c8565b816040528281528760208487010111156108a657600080fd5b826020860160208301376000928101602001929092525095945050505050565b73ffffffffffffffffffffffffffffffffffffffff811681146108e857600080fd5b50565b6000602082840312156108fd57600080fd5b8135610908816108c6565b9392505050565b60006020828403121561092157600080fd5b8151610908816108c6565b60005b8381101561094757818101518382015260200161092f565b50506000910152565b6000815180845261096881602086016020860161092c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006109086020830184610950565b808201808211156109e7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610a2e81846020870161092c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff841681526bffffffffffffffffffffffff83166020820152606060408201526000610a7b6060830184610950565b9594505050505056fea2646970667358221220ae653f9aafa635f317a390827150d6fda83a572884b398ddd9bfe84024f5591564736f6c63430008170033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/abis/0.8.23/WormholeMessenger.json b/abis/0.8.23/WormholeMessenger.json index 8cc816a..09bbb29 100644 --- a/abis/0.8.23/WormholeMessenger.json +++ b/abis/0.8.23/WormholeMessenger.json @@ -155,11 +155,11 @@ }, { "internalType": "address", - "name": "wormholeRelayer", + "name": "sourceRelayer", "type": "address" } ], - "name": "wormholeRelayerOnly", + "name": "sourceRelayerOnly", "type": "error" }, { @@ -218,7 +218,7 @@ { "indexed": true, "internalType": "address", - "name": "sourceMessageSender", + "name": "sourceGovernor", "type": "address" } ], @@ -347,8 +347,8 @@ "type": "receive" } ], - "bytecode": "0x60c060405234801561001057600080fd5b50604051610e0c380380610e0c83398101604081905261002f916100de565b6001600160a01b038316158061004c57506001600160a01b038216155b1561006a5760405163d92e233d60e01b815260040160405180910390fd5b8061ffff1660000361008f57604051637c946ed760e01b815260040160405180910390fd5b6001600160a01b03928316608052600080546001600160a01b031916929093169190911790915561ffff1660a05261012c565b80516001600160a01b03811681146100d957600080fd5b919050565b6000806000606084860312156100f357600080fd5b6100fc846100c2565b925061010a602085016100c2565b9150604084015161ffff8116811461012157600080fd5b809150509250925092565b60805160a051610c9f61016d6000396000818161010c015281816102d3015261033301526000818161016801528181610237015261029f0152610c9f6000f3fe6080604052600436106100745760003560e01c8063da25b7251161004e578063da25b72514610156578063e3b94a23146101af578063f02fb774146101dc578063f8b4870f146101ff57600080fd5b8063446a9695146100b557806347059760146100fa578063529dca321461014157600080fd5b366100b05760405134815233907f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f9060200160405180910390a2005b600080fd5b3480156100c157600080fd5b506100e56100d0366004610875565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561010657600080fd5b5061012e7f000000000000000000000000000000000000000000000000000000000000000081565b60405161ffff90911681526020016100f1565b61015461014f3660046109b1565b61021f565b005b34801561016257600080fd5b5061018a7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f1565b3480156101bb57600080fd5b5060005461018a9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156101e857600080fd5b506101f1602481565b6040519081526020016100f1565b34801561020b57600080fd5b5061015461021a366004610aba565b61077a565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146102d1576040517ffb8d9f7600000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000061ffff168261ffff1614610360576040517fab1e308b00000000000000000000000000000000000000000000000000000000815261ffff80841660048301527f00000000000000000000000000000000000000000000000000000000000000001660248201526044016102c8565b60005473ffffffffffffffffffffffffffffffffffffffff908116908490811682146103d8576040517f978c830c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152831660248201526044016102c8565b60008381526001602052604090205460ff1615610424576040517f56bc34a1000000000000000000000000000000000000000000000000000000008152600481018490526024016102c8565b600083815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055865160248110156104a95787516040517f34c9027a0000000000000000000000000000000000000000000000000000000081526102c891602491600401918252602082015260400190565b60005b8181101561071d57888101601481015160208201516024928301519290930192909173ffffffffffffffffffffffffffffffffffffffff831661051b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47826bffffffffffffffffffffffff161115610579576040517fcf4791810000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff831660048201524760248201526044016102c8565b60008163ffffffff1667ffffffffffffffff81111561059a5761059a61088e565b6040519080825280601f01601f1916602001820160405280156105c4576020820181803683370190505b50905060005b8263ffffffff16811015610647578d6105e38288610af7565b815181106105f3576105f3610b37565b602001015160f81c60f81b82828151811061061057610610610b37565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001016105ca565b5061065863ffffffff831686610af7565b945060008473ffffffffffffffffffffffffffffffffffffffff16846bffffffffffffffffffffffff16836040516106909190610b8a565b60006040518083038185875af1925050503d80600081146106cd576040519150601f19603f3d011682016040523d82523d6000602084013e6106d2565b606091505b5050905080610713578484836040517f6cfc79a50000000000000000000000000000000000000000000000000000000081526004016102c893929190610bf0565b50505050506104ac565b508273ffffffffffffffffffffffffffffffffffffffff167f538b8a300f32521e3c4b1bc21b3bc8bbc5752f33e4186f78ed3a359aa905adec89868860405161076893929190610c3c565b60405180910390a25050505050505050565b3330146107bb576040517f0dbc9bfc0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044016102c8565b73ffffffffffffffffffffffffffffffffffffffff8116610808576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917fbbc9d5867fd60faf098cfaa8adb3402dd83501cc76385968ddbb6b2610800f8e91a250565b60006020828403121561088757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156109045761090461088e565b604052919050565b600082601f83011261091d57600080fd5b813567ffffffffffffffff8111156109375761093761088e565b61096860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016108bd565b81815284602083860101111561097d57600080fd5b816020850160208301376000918101602001919091529392505050565b803561ffff811681146109ac57600080fd5b919050565b600080600080600060a086880312156109c957600080fd5b853567ffffffffffffffff808211156109e157600080fd5b6109ed89838a0161090c565b9650602091508188013581811115610a0457600080fd5b8801601f81018a13610a1557600080fd5b803582811115610a2757610a2761088e565b8060051b610a368582016108bd565b918252828101850191858101908d841115610a5057600080fd5b86850192505b83831015610a8c57823586811115610a6e5760008081fd5b610a7c8f898389010161090c565b8352509186019190860190610a56565b809a505050505050505060408601359250610aa96060870161099a565b949793965091946080013592915050565b600060208284031215610acc57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610af057600080fd5b9392505050565b80820180821115610b31577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60005b83811015610b81578181015183820152602001610b69565b50506000910152565b60008251610b9c818460208701610b66565b9190910192915050565b60008151808452610bbe816020860160208601610b66565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff841681526bffffffffffffffffffffffff83166020820152606060408201526000610c336060830184610ba6565b95945050505050565b606081526000610c4f6060830186610ba6565b905083602083015261ffff8316604083015294935050505056fea2646970667358221220174e1300e4e7fd65e944fe54a874430ebed7ab5db9cfbf2b958133ca6f24796b64736f6c63430008170033", - "deployedBytecode": "0x6080604052600436106100745760003560e01c8063da25b7251161004e578063da25b72514610156578063e3b94a23146101af578063f02fb774146101dc578063f8b4870f146101ff57600080fd5b8063446a9695146100b557806347059760146100fa578063529dca321461014157600080fd5b366100b05760405134815233907f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f9060200160405180910390a2005b600080fd5b3480156100c157600080fd5b506100e56100d0366004610875565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561010657600080fd5b5061012e7f000000000000000000000000000000000000000000000000000000000000000081565b60405161ffff90911681526020016100f1565b61015461014f3660046109b1565b61021f565b005b34801561016257600080fd5b5061018a7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f1565b3480156101bb57600080fd5b5060005461018a9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156101e857600080fd5b506101f1602481565b6040519081526020016100f1565b34801561020b57600080fd5b5061015461021a366004610aba565b61077a565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146102d1576040517ffb8d9f7600000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000061ffff168261ffff1614610360576040517fab1e308b00000000000000000000000000000000000000000000000000000000815261ffff80841660048301527f00000000000000000000000000000000000000000000000000000000000000001660248201526044016102c8565b60005473ffffffffffffffffffffffffffffffffffffffff908116908490811682146103d8576040517f978c830c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152831660248201526044016102c8565b60008381526001602052604090205460ff1615610424576040517f56bc34a1000000000000000000000000000000000000000000000000000000008152600481018490526024016102c8565b600083815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055865160248110156104a95787516040517f34c9027a0000000000000000000000000000000000000000000000000000000081526102c891602491600401918252602082015260400190565b60005b8181101561071d57888101601481015160208201516024928301519290930192909173ffffffffffffffffffffffffffffffffffffffff831661051b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47826bffffffffffffffffffffffff161115610579576040517fcf4791810000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff831660048201524760248201526044016102c8565b60008163ffffffff1667ffffffffffffffff81111561059a5761059a61088e565b6040519080825280601f01601f1916602001820160405280156105c4576020820181803683370190505b50905060005b8263ffffffff16811015610647578d6105e38288610af7565b815181106105f3576105f3610b37565b602001015160f81c60f81b82828151811061061057610610610b37565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001016105ca565b5061065863ffffffff831686610af7565b945060008473ffffffffffffffffffffffffffffffffffffffff16846bffffffffffffffffffffffff16836040516106909190610b8a565b60006040518083038185875af1925050503d80600081146106cd576040519150601f19603f3d011682016040523d82523d6000602084013e6106d2565b606091505b5050905080610713578484836040517f6cfc79a50000000000000000000000000000000000000000000000000000000081526004016102c893929190610bf0565b50505050506104ac565b508273ffffffffffffffffffffffffffffffffffffffff167f538b8a300f32521e3c4b1bc21b3bc8bbc5752f33e4186f78ed3a359aa905adec89868860405161076893929190610c3c565b60405180910390a25050505050505050565b3330146107bb576040517f0dbc9bfc0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044016102c8565b73ffffffffffffffffffffffffffffffffffffffff8116610808576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917fbbc9d5867fd60faf098cfaa8adb3402dd83501cc76385968ddbb6b2610800f8e91a250565b60006020828403121561088757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156109045761090461088e565b604052919050565b600082601f83011261091d57600080fd5b813567ffffffffffffffff8111156109375761093761088e565b61096860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016108bd565b81815284602083860101111561097d57600080fd5b816020850160208301376000918101602001919091529392505050565b803561ffff811681146109ac57600080fd5b919050565b600080600080600060a086880312156109c957600080fd5b853567ffffffffffffffff808211156109e157600080fd5b6109ed89838a0161090c565b9650602091508188013581811115610a0457600080fd5b8801601f81018a13610a1557600080fd5b803582811115610a2757610a2761088e565b8060051b610a368582016108bd565b918252828101850191858101908d841115610a5057600080fd5b86850192505b83831015610a8c57823586811115610a6e5760008081fd5b610a7c8f898389010161090c565b8352509186019190860190610a56565b809a505050505050505060408601359250610aa96060870161099a565b949793965091946080013592915050565b600060208284031215610acc57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610af057600080fd5b9392505050565b80820180821115610b31577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60005b83811015610b81578181015183820152602001610b69565b50506000910152565b60008251610b9c818460208701610b66565b9190910192915050565b60008151808452610bbe816020860160208601610b66565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff841681526bffffffffffffffffffffffff83166020820152606060408201526000610c336060830184610ba6565b95945050505050565b606081526000610c4f6060830186610ba6565b905083602083015261ffff8316604083015294935050505056fea2646970667358221220174e1300e4e7fd65e944fe54a874430ebed7ab5db9cfbf2b958133ca6f24796b64736f6c63430008170033", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610e18380380610e1883398101604081905261002f916100de565b6001600160a01b038316158061004c57506001600160a01b038216155b1561006a5760405163d92e233d60e01b815260040160405180910390fd5b8061ffff1660000361008f57604051637c946ed760e01b815260040160405180910390fd5b6001600160a01b03928316608052600080546001600160a01b031916929093169190911790915561ffff1660a05261012c565b80516001600160a01b03811681146100d957600080fd5b919050565b6000806000606084860312156100f357600080fd5b6100fc846100c2565b925061010a602085016100c2565b9150604084015161ffff8116811461012157600080fd5b809150509250925092565b60805160a051610cab61016d6000396000818161010c015281816102d3015261033301526000818161016801528181610237015261029f0152610cab6000f3fe6080604052600436106100745760003560e01c8063da25b7251161004e578063da25b72514610156578063e3b94a23146101af578063f02fb774146101dc578063f8b4870f146101ff57600080fd5b8063446a9695146100b557806347059760146100fa578063529dca321461014157600080fd5b366100b05760405134815233907f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f9060200160405180910390a2005b600080fd5b3480156100c157600080fd5b506100e56100d0366004610881565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561010657600080fd5b5061012e7f000000000000000000000000000000000000000000000000000000000000000081565b60405161ffff90911681526020016100f1565b61015461014f3660046109bd565b61021f565b005b34801561016257600080fd5b5061018a7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f1565b3480156101bb57600080fd5b5060005461018a9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156101e857600080fd5b506101f1602481565b6040519081526020016100f1565b34801561020b57600080fd5b5061015461021a366004610ac6565b6104c2565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146102d1576040517f264cd9ca00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000061ffff168261ffff1614610360576040517fab1e308b00000000000000000000000000000000000000000000000000000000815261ffff80841660048301527f00000000000000000000000000000000000000000000000000000000000000001660248201526044016102c8565b60005473ffffffffffffffffffffffffffffffffffffffff908116908490811682146103d8576040517f978c830c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152831660248201526044016102c8565b60008381526001602052604090205460ff1615610424576040517f56bc34a1000000000000000000000000000000000000000000000000000000008152600481018490526024016102c8565b600083815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055610467876105bd565b8173ffffffffffffffffffffffffffffffffffffffff167f538b8a300f32521e3c4b1bc21b3bc8bbc5752f33e4186f78ed3a359aa905adec8885876040516104b193929190610b71565b60405180910390a250505050505050565b333014610503576040517f0dbc9bfc0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044016102c8565b73ffffffffffffffffffffffffffffffffffffffff8116610550576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917fbbc9d5867fd60faf098cfaa8adb3402dd83501cc76385968ddbb6b2610800f8e91a250565b805160248110156106085781516040517f34c9027a0000000000000000000000000000000000000000000000000000000081526102c891602491600401918252602082015260400190565b60005b8181101561087c57828101601481015160208201516024928301519290930192909173ffffffffffffffffffffffffffffffffffffffff831661067a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47826bffffffffffffffffffffffff1611156106d8576040517fcf4791810000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff831660048201524760248201526044016102c8565b60008163ffffffff1667ffffffffffffffff8111156106f9576106f961089a565b6040519080825280601f01601f191660200182016040528015610723576020820181803683370190505b50905060005b8263ffffffff168110156107a657876107428288610b9e565b8151811061075257610752610bde565b602001015160f81c60f81b82828151811061076f5761076f610bde565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600101610729565b506107b763ffffffff831686610b9e565b945060008473ffffffffffffffffffffffffffffffffffffffff16846bffffffffffffffffffffffff16836040516107ef9190610c0d565b60006040518083038185875af1925050503d806000811461082c576040519150601f19603f3d011682016040523d82523d6000602084013e610831565b606091505b5050905080610872578484836040517f6cfc79a50000000000000000000000000000000000000000000000000000000081526004016102c893929190610c29565b505050505061060b565b505050565b60006020828403121561089357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156109105761091061089a565b604052919050565b600082601f83011261092957600080fd5b813567ffffffffffffffff8111156109435761094361089a565b61097460207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016108c9565b81815284602083860101111561098957600080fd5b816020850160208301376000918101602001919091529392505050565b803561ffff811681146109b857600080fd5b919050565b600080600080600060a086880312156109d557600080fd5b853567ffffffffffffffff808211156109ed57600080fd5b6109f989838a01610918565b9650602091508188013581811115610a1057600080fd5b8801601f81018a13610a2157600080fd5b803582811115610a3357610a3361089a565b8060051b610a428582016108c9565b918252828101850191858101908d841115610a5c57600080fd5b86850192505b83831015610a9857823586811115610a7a5760008081fd5b610a888f8983890101610918565b8352509186019190860190610a62565b809a505050505050505060408601359250610ab5606087016109a6565b949793965091946080013592915050565b600060208284031215610ad857600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610afc57600080fd5b9392505050565b60005b83811015610b1e578181015183820152602001610b06565b50506000910152565b60008151808452610b3f816020860160208601610b03565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606081526000610b846060830186610b27565b905083602083015261ffff83166040830152949350505050565b80820180821115610bd8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610c1f818460208701610b03565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff841681526bffffffffffffffffffffffff83166020820152606060408201526000610c6c6060830184610b27565b9594505050505056fea2646970667358221220d436c8dbe28cc449da521ac2e4e278b4d3ab40996ae6e9d170ef0bb4186da40b64736f6c63430008170033", + "deployedBytecode": "0x6080604052600436106100745760003560e01c8063da25b7251161004e578063da25b72514610156578063e3b94a23146101af578063f02fb774146101dc578063f8b4870f146101ff57600080fd5b8063446a9695146100b557806347059760146100fa578063529dca321461014157600080fd5b366100b05760405134815233907f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f9060200160405180910390a2005b600080fd5b3480156100c157600080fd5b506100e56100d0366004610881565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561010657600080fd5b5061012e7f000000000000000000000000000000000000000000000000000000000000000081565b60405161ffff90911681526020016100f1565b61015461014f3660046109bd565b61021f565b005b34801561016257600080fd5b5061018a7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f1565b3480156101bb57600080fd5b5060005461018a9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156101e857600080fd5b506101f1602481565b6040519081526020016100f1565b34801561020b57600080fd5b5061015461021a366004610ac6565b6104c2565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146102d1576040517f264cd9ca00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000061ffff168261ffff1614610360576040517fab1e308b00000000000000000000000000000000000000000000000000000000815261ffff80841660048301527f00000000000000000000000000000000000000000000000000000000000000001660248201526044016102c8565b60005473ffffffffffffffffffffffffffffffffffffffff908116908490811682146103d8576040517f978c830c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152831660248201526044016102c8565b60008381526001602052604090205460ff1615610424576040517f56bc34a1000000000000000000000000000000000000000000000000000000008152600481018490526024016102c8565b600083815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055610467876105bd565b8173ffffffffffffffffffffffffffffffffffffffff167f538b8a300f32521e3c4b1bc21b3bc8bbc5752f33e4186f78ed3a359aa905adec8885876040516104b193929190610b71565b60405180910390a250505050505050565b333014610503576040517f0dbc9bfc0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044016102c8565b73ffffffffffffffffffffffffffffffffffffffff8116610550576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917fbbc9d5867fd60faf098cfaa8adb3402dd83501cc76385968ddbb6b2610800f8e91a250565b805160248110156106085781516040517f34c9027a0000000000000000000000000000000000000000000000000000000081526102c891602491600401918252602082015260400190565b60005b8181101561087c57828101601481015160208201516024928301519290930192909173ffffffffffffffffffffffffffffffffffffffff831661067a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47826bffffffffffffffffffffffff1611156106d8576040517fcf4791810000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff831660048201524760248201526044016102c8565b60008163ffffffff1667ffffffffffffffff8111156106f9576106f961089a565b6040519080825280601f01601f191660200182016040528015610723576020820181803683370190505b50905060005b8263ffffffff168110156107a657876107428288610b9e565b8151811061075257610752610bde565b602001015160f81c60f81b82828151811061076f5761076f610bde565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600101610729565b506107b763ffffffff831686610b9e565b945060008473ffffffffffffffffffffffffffffffffffffffff16846bffffffffffffffffffffffff16836040516107ef9190610c0d565b60006040518083038185875af1925050503d806000811461082c576040519150601f19603f3d011682016040523d82523d6000602084013e610831565b606091505b5050905080610872578484836040517f6cfc79a50000000000000000000000000000000000000000000000000000000081526004016102c893929190610c29565b505050505061060b565b505050565b60006020828403121561089357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156109105761091061089a565b604052919050565b600082601f83011261092957600080fd5b813567ffffffffffffffff8111156109435761094361089a565b61097460207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016108c9565b81815284602083860101111561098957600080fd5b816020850160208301376000918101602001919091529392505050565b803561ffff811681146109b857600080fd5b919050565b600080600080600060a086880312156109d557600080fd5b853567ffffffffffffffff808211156109ed57600080fd5b6109f989838a01610918565b9650602091508188013581811115610a1057600080fd5b8801601f81018a13610a2157600080fd5b803582811115610a3357610a3361089a565b8060051b610a428582016108c9565b918252828101850191858101908d841115610a5c57600080fd5b86850192505b83831015610a9857823586811115610a7a5760008081fd5b610a888f8983890101610918565b8352509186019190860190610a62565b809a505050505050505060408601359250610ab5606087016109a6565b949793965091946080013592915050565b600060208284031215610ad857600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610afc57600080fd5b9392505050565b60005b83811015610b1e578181015183820152602001610b06565b50506000910152565b60008151808452610b3f816020860160208601610b03565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606081526000610b846060830186610b27565b905083602083015261ffff83166040830152949350505050565b80820180821115610bd8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610c1f818460208701610b03565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff841681526bffffffffffffffffffffffff83166020820152606060408201526000610c6c6060830184610b27565b9594505050505056fea2646970667358221220d436c8dbe28cc449da521ac2e4e278b4d3ab40996ae6e9d170ef0bb4186da40b64736f6c63430008170033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/contracts/bridges/BridgeMessenger.sol b/contracts/bridges/BridgeMessenger.sol new file mode 100644 index 0000000..55d8f0d --- /dev/null +++ b/contracts/bridges/BridgeMessenger.sol @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.23; + +import {IBridgeErrors} from "../interfaces/IBridgeErrors.sol"; + +/// @title BridgeMessenger - Smart contract for the governor bridge communication via wormhole +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Mariapia Moscatiello - +abstract contract BridgeMessenger is IBridgeErrors { + event FundsReceived(address indexed sender, uint256 value); + event SourceGovernorUpdated(address indexed sourceGovernor); + + // Default payload data length includes the number of bytes of at least one address (20 bytes or 160 bits), + // value (12 bytes or 96 bits) and the payload size (4 bytes or 32 bits) + uint256 public constant DEFAULT_DATA_LENGTH = 36; + // Source governor address on L1 that is authorized to propagate the transaction execution across the bridge + address public sourceGovernor; + + /// @dev Receives native network token. + receive() external payable { + emit FundsReceived(msg.sender, msg.value); + } + + /// @dev Changes the source governor address (original Timelock). + /// @notice The only way to change the source governor address is by the Timelock on L1 to request that change. + /// This triggers a self-contract transaction of BridgeMessenger that changes the source governor address. + /// @param newSourceGovernor New source governor address. + function changeSourceGovernor(address newSourceGovernor) external virtual { + // Check if the change is authorized by the previous governor itself + // This is possible only if all the checks in the message process function pass and the contract calls itself + if (msg.sender != address(this)) { + revert SelfCallOnly(msg.sender, address(this)); + } + + // Check for the zero address + if (newSourceGovernor == address(0)) { + revert ZeroAddress(); + } + + sourceGovernor = newSourceGovernor; + emit SourceGovernorUpdated(newSourceGovernor); + } + + /// @dev Processes received data. + /// @param data Bytes message sent from L2 Wormhole Relayer contract. The data must be encoded as a set of + /// continuous transactions packed into a single buffer, where each transaction is composed as follows: + /// - target address of 20 bytes (160 bits); + /// - value of 12 bytes (96 bits), as a limit for all of Autonolas ecosystem contracts; + /// - payload length of 4 bytes (32 bits), as 2^32 - 1 characters is more than enough to fill a whole block; + /// - payload as bytes, with the length equal to the specified payload length. + function _processData(bytes memory data) internal virtual { + // Check for the correct data length + uint256 dataLength = data.length; + if (dataLength < DEFAULT_DATA_LENGTH) { + revert IncorrectDataLength(DEFAULT_DATA_LENGTH, data.length); + } + + // Unpack and process the data + for (uint256 i = 0; i < dataLength;) { + address target; + uint96 value; + uint32 payloadLength; + // solhint-disable-next-line no-inline-assembly + assembly { + // First 20 bytes is the address (160 bits) + i := add(i, 20) + target := mload(add(data, i)) + // Offset the data by 12 bytes of value (96 bits) + i := add(i, 12) + value := mload(add(data, i)) + // Offset the data by 4 bytes of payload length (32 bits) + i := add(i, 4) + payloadLength := mload(add(data, i)) + } + + // Check for the zero address + if (target == address(0)) { + revert ZeroAddress(); + } + + // Check for the value compared to the contract's balance + if (value > address(this).balance) { + revert InsufficientBalance(value, address(this).balance); + } + + // Get the payload + bytes memory payload = new bytes(payloadLength); + for (uint256 j = 0; j < payloadLength; ++j) { + payload[j] = data[i + j]; + } + // Offset the data by the payload number of bytes + i += payloadLength; + + // Call the target with the provided payload + (bool success, ) = target.call{value: value}(payload); + if (!success) { + revert TargetExecFailed(target, value, payload); + } + } + } +} \ No newline at end of file diff --git a/contracts/bridges/OptimismMessenger.sol b/contracts/bridges/OptimismMessenger.sol index 51ddfbd..9fd2ec3 100644 --- a/contracts/bridges/OptimismMessenger.sol +++ b/contracts/bridges/OptimismMessenger.sol @@ -1,169 +1,59 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.23; +import {BridgeMessenger} from "./BridgeMessenger.sol"; + /// @dev Interface to the CrossDomainMessenger (CDM) Contract Proxy. interface ICrossDomainMessenger { function xDomainMessageSender() external returns (address); } -/// @dev Provided zero address. -error ZeroAddress(); - -/// @dev Only self contract is allowed to call the function. -/// @param sender Sender address. -/// @param instance Required contract instance address. -error SelfCallOnly(address sender, address instance); - -/// @dev Only `CDMContractProxyHome` is allowed to call the function. -/// @param sender Sender address. -/// @param CDMContractProxyHome Required CDM Contract Proxy (Home) address. -error CDMContractProxyHomeOnly(address sender, address CDMContractProxyHome); - -/// @dev Only on behalf of `foreignGovernor` the function is allowed to process the data. -/// @param sender Sender address. -/// @param foreignGovernor Required Foreign Governor address. -error ForeignGovernorOnly(address sender, address foreignGovernor); - -/// @dev Provided incorrect data length. -/// @param expected Expected minimum data length. -/// @param provided Provided data length. -error IncorrectDataLength(uint256 expected, uint256 provided); - -/// @dev Provided value is bigger than the actual balance. -/// @param value Provided value. -/// @param balance Actual balance. -error InsufficientBalance(uint256 value, uint256 balance); - -/// @dev Target execution failed. -/// @param target Target address. -/// @param value Provided value. -/// @param payload Provided payload. -error TargetExecFailed(address target, uint256 value, bytes payload); - /// @title OptimismMessenger - Smart contract for the governor home (Optimism) bridge implementation /// @author Aleksandr Kuperman - /// @author Andrey Lebedev - /// @author Mariapia Moscatiello - -contract OptimismMessenger { - event FundsReceived(address indexed sender, uint256 value); - event ForeignGovernorUpdated(address indexed foreignMessageSender); - event MessageReceived(address indexed foreignMessageSender, bytes data); +contract OptimismMessenger is BridgeMessenger { + event MessageReceived(address indexed sourceMessageSender, bytes data); - // Default payload data length includes the number of bytes of at least one address (20 bytes or 160 bits), - // value (12 bytes or 96 bits) and the payload size (4 bytes or 32 bits) - uint256 public constant DEFAULT_DATA_LENGTH = 36; - // CDM Contract Proxy (Home) address on L2 that receives the message across the bridge from the foreign L1 network + // CDM Contract Proxy (Home) address on L2 that receives the message across the bridge from the source L1 network address public immutable CDMContractProxyHome; - // Foreign governor address on L1 that is authorized to propagate the transaction execution across the bridge - address public foreignGovernor; /// @dev OptimismMessenger constructor. /// @param _CDMContractProxyHome CDM Contract Proxy (Home) address (Optimism). - /// @param _foreignGovernor Foreign Governor address (ETH). - constructor(address _CDMContractProxyHome, address _foreignGovernor) { + /// @param _sourceGovernor Source Governor address (ETH). + constructor(address _CDMContractProxyHome, address _sourceGovernor) { // Check fo zero addresses - if (_CDMContractProxyHome == address(0) || _foreignGovernor == address(0)) { + if (_CDMContractProxyHome == address(0) || _sourceGovernor == address(0)) { revert ZeroAddress(); } CDMContractProxyHome = _CDMContractProxyHome; - foreignGovernor = _foreignGovernor; - } - - /// @dev Receives native network token. - receive() external payable { - emit FundsReceived(msg.sender, msg.value); - } - - /// @dev Changes the Foreign Governor address (original Timelock). - /// @notice The only way to change the Foreign Governor address is by the Timelock on L1 to request that change. - /// This triggers a self-contract transaction of OptimismMessenger that changes the Foreign Governor address. - /// @param newForeignGovernor New Foreign Governor address. - function changeForeignGovernor(address newForeignGovernor) external { - // Check if the change is authorized by the previous governor itself - // This is possible only if all the checks in the message process function pass and the contract calls itself - if (msg.sender != address(this)) { - revert SelfCallOnly(msg.sender, address(this)); - } - - // Check for the zero address - if (newForeignGovernor == address(0)) { - revert ZeroAddress(); - } - - foreignGovernor = newForeignGovernor; - emit ForeignGovernorUpdated(newForeignGovernor); + sourceGovernor = _sourceGovernor; } /// @dev Processes a message received from the CDM Contract Proxy (Home) contract. - /// @notice The sender must be the Foreign Governor address (Timelock). + /// @notice The sender must be the Source Governor address (Timelock). /// @param data Bytes message sent from the CDM Contract Proxy (Home) contract. The data must be encoded as a set of /// continuous transactions packed into a single buffer, where each transaction is composed as follows: /// - target address of 20 bytes (160 bits); /// - value of 12 bytes (96 bits), as a limit for all of Autonolas ecosystem contracts; /// - payload length of 4 bytes (32 bits), as 2^32 - 1 characters is more than enough to fill a whole block; /// - payload as bytes, with the length equal to the specified payload length. - function processMessageFromForeign(bytes memory data) external payable { + function processMessageFromSource(bytes memory data) external payable { // Check for the CDM Contract Proxy (Home) address if (msg.sender != CDMContractProxyHome) { - revert CDMContractProxyHomeOnly(msg.sender, CDMContractProxyHome); + revert TargetRelayerOnly(msg.sender, CDMContractProxyHome); } - // Check for the Foreign Governor address - address governor = foreignGovernor; + // Check for the Source Governor address + address governor = sourceGovernor; address bridgeGovernor = ICrossDomainMessenger(CDMContractProxyHome).xDomainMessageSender(); if (bridgeGovernor != governor) { - revert ForeignGovernorOnly(bridgeGovernor, governor); - } - - // Check for the correct data length - uint256 dataLength = data.length; - if (dataLength < DEFAULT_DATA_LENGTH) { - revert IncorrectDataLength(DEFAULT_DATA_LENGTH, data.length); + revert SourceGovernorOnly(bridgeGovernor, governor); } - // Unpack and process the data - for (uint256 i = 0; i < dataLength;) { - address target; - uint96 value; - uint32 payloadLength; - // solhint-disable-next-line no-inline-assembly - assembly { - // First 20 bytes is the address (160 bits) - i := add(i, 20) - target := mload(add(data, i)) - // Offset the data by 12 bytes of value (96 bits) - i := add(i, 12) - value := mload(add(data, i)) - // Offset the data by 4 bytes of payload length (32 bits) - i := add(i, 4) - payloadLength := mload(add(data, i)) - } - - // Check for the zero address - if (target == address(0)) { - revert ZeroAddress(); - } - - // Check for the value compared to the contract's balance - if (value > address(this).balance) { - revert InsufficientBalance(value, address(this).balance); - } - - // Get the payload - bytes memory payload = new bytes(payloadLength); - for (uint256 j = 0; j < payloadLength; ++j) { - payload[j] = data[i + j]; - } - // Offset the data by the payload number of bytes - i += payloadLength; - - // Call the target with the provided payload - (bool success, ) = target.call{value: value}(payload); - if (!success) { - revert TargetExecFailed(target, value, payload); - } - } + // Process the data + _processData(data); // Emit received message emit MessageReceived(governor, data); diff --git a/contracts/bridges/WormholeMessenger.sol b/contracts/bridges/WormholeMessenger.sol index 376a22f..1828882 100644 --- a/contracts/bridges/WormholeMessenger.sol +++ b/contracts/bridges/WormholeMessenger.sol @@ -1,71 +1,20 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.23; -/// @dev Provided zero address. -error ZeroAddress(); - -/// @dev Provided zero value. -error ZeroValue(); - -/// @dev Only self contract is allowed to call the function. -/// @param sender Sender address. -/// @param instance Required contract instance address. -error SelfCallOnly(address sender, address instance); - -/// @dev Only `wormholeRelayer` is allowed to call the function. -/// @param sender Sender address. -/// @param wormholeRelayer Required L2 Wormhole Relayer address. -error wormholeRelayerOnly(address sender, address wormholeRelayer); - -/// @dev Wrong source chain Id. -/// @param received Chain Id received. -/// @param required Required chain Id. -error WrongSourceChainId(uint256 received, uint256 required); - -/// @dev Only on behalf of `sourceGovernor` the function is allowed to process the data. -/// @param sender Sender address. -/// @param sourceGovernor Required source governor address. -error SourceGovernorOnly(address sender, address sourceGovernor); - -/// @dev The message with a specified hash has already been delivered. -/// @param deliveryHash Delivery hash. -error AlreadyDelivered(bytes32 deliveryHash); - -/// @dev Provided incorrect data length. -/// @param expected Expected minimum data length. -/// @param provided Provided data length. -error IncorrectDataLength(uint256 expected, uint256 provided); - -/// @dev Provided value is bigger than the actual balance. -/// @param value Provided value. -/// @param balance Actual balance. -error InsufficientBalance(uint256 value, uint256 balance); - -/// @dev Target execution failed. -/// @param target Target address. -/// @param value Provided value. -/// @param payload Provided payload. -error TargetExecFailed(address target, uint256 value, bytes payload); +import {BridgeMessenger} from "./BridgeMessenger.sol"; /// @title WormholeMessenger - Smart contract for the governor bridge communication via wormhole /// @author Aleksandr Kuperman - /// @author Andrey Lebedev - /// @author Mariapia Moscatiello - -contract WormholeMessenger { - event FundsReceived(address indexed sender, uint256 value); - event SourceGovernorUpdated(address indexed sourceMessageSender); +contract WormholeMessenger is BridgeMessenger { event MessageReceived(address indexed sourceMessageSender, bytes data, bytes32 deliveryHash, uint256 sourceChain); - // Default payload data length includes the number of bytes of at least one address (20 bytes or 160 bits), - // value (12 bytes or 96 bits) and the payload size (4 bytes or 32 bits) - uint256 public constant DEFAULT_DATA_LENGTH = 36; // L2 Wormhole Relayer address that receives the message across the bridge from the source L1 network address public immutable wormholeRelayer; // Source governor chain Id uint16 public immutable sourceGovernorChainId; // Source governor address on L1 that is authorized to propagate the transaction execution across the bridge - address public sourceGovernor; - // Mapping of delivery hashes mapping(bytes32 => bool) public mapDeliveryHashes; /// @dev WormholeMessenger constructor. @@ -88,31 +37,6 @@ contract WormholeMessenger { sourceGovernorChainId = _sourceGovernorChainId; } - /// @dev Receives native network token. - receive() external payable { - emit FundsReceived(msg.sender, msg.value); - } - - /// @dev Changes the source governor address (original Timelock). - /// @notice The only way to change the source governor address is by the Timelock on L1 to request that change. - /// This triggers a self-contract transaction of WormholeMessenger that changes the source governor address. - /// @param newSourceGovernor New source governor address. - function changeSourceGovernor(address newSourceGovernor) external { - // Check if the change is authorized by the previous governor itself - // This is possible only if all the checks in the message process function pass and the contract calls itself - if (msg.sender != address(this)) { - revert SelfCallOnly(msg.sender, address(this)); - } - - // Check for the zero address - if (newSourceGovernor == address(0)) { - revert ZeroAddress(); - } - - sourceGovernor = newSourceGovernor; - emit SourceGovernorUpdated(newSourceGovernor); - } - /// @dev Processes a message received from L2 Wormhole Relayer contract. /// @notice The sender must be the source governor address (Timelock). /// @param data Bytes message sent from L2 Wormhole Relayer contract. The data must be encoded as a set of @@ -133,7 +57,7 @@ contract WormholeMessenger { ) external payable { // Check L2 Wormhole Relayer address if (msg.sender != wormholeRelayer) { - revert wormholeRelayerOnly(msg.sender, wormholeRelayer); + revert TargetRelayerOnly(msg.sender, wormholeRelayer); } // Check the source chain Id @@ -154,54 +78,8 @@ contract WormholeMessenger { } mapDeliveryHashes[deliveryHash] = true; - // Check for the correct data length - uint256 dataLength = data.length; - if (dataLength < DEFAULT_DATA_LENGTH) { - revert IncorrectDataLength(DEFAULT_DATA_LENGTH, data.length); - } - - // Unpack and process the data - for (uint256 i = 0; i < dataLength;) { - address target; - uint96 value; - uint32 payloadLength; - // solhint-disable-next-line no-inline-assembly - assembly { - // First 20 bytes is the address (160 bits) - i := add(i, 20) - target := mload(add(data, i)) - // Offset the data by 12 bytes of value (96 bits) - i := add(i, 12) - value := mload(add(data, i)) - // Offset the data by 4 bytes of payload length (32 bits) - i := add(i, 4) - payloadLength := mload(add(data, i)) - } - - // Check for the zero address - if (target == address(0)) { - revert ZeroAddress(); - } - - // Check for the value compared to the contract's balance - if (value > address(this).balance) { - revert InsufficientBalance(value, address(this).balance); - } - - // Get the payload - bytes memory payload = new bytes(payloadLength); - for (uint256 j = 0; j < payloadLength; ++j) { - payload[j] = data[i + j]; - } - // Offset the data by the payload number of bytes - i += payloadLength; - - // Call the target with the provided payload - (bool success, ) = target.call{value: value}(payload); - if (!success) { - revert TargetExecFailed(target, value, payload); - } - } + // Process the data + _processData(data); // Emit received message emit MessageReceived(governor, data, deliveryHash, sourceChain); diff --git a/contracts/bridges/test/MockAMBMediator.sol b/contracts/bridges/test/MockAMBMediator.sol deleted file mode 100644 index 512924d..0000000 --- a/contracts/bridges/test/MockAMBMediator.sol +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -interface IHomeMediator { - function processMessageFromForeign(bytes memory data) external; -} - -/// @title MockAMBMediator - Smart contract for mocking the AMBMediator contract on the Gnosis chain -/// @author Aleksandr Kuperman - -/// @author AL -contract MockAMBMediator { - address public homeMediator; - address public foreignGovernor; - - constructor(address _homeMediator, address _foreignGovernor) { - homeMediator = _homeMediator; - foreignGovernor = _foreignGovernor; - } - - function changeHomeMediator(address _homeMediator) external { - homeMediator = _homeMediator; - } - - function changeForeignGovernor(address _foreignGovernor) external { - foreignGovernor = _foreignGovernor; - } - - function messageSender() external view returns (address) { - return foreignGovernor; - } - - function processMessageFromForeign(bytes memory data) external { - IHomeMediator(homeMediator).processMessageFromForeign(data); - } -} \ No newline at end of file diff --git a/contracts/bridges/test/MockL2Relayer.sol b/contracts/bridges/test/MockL2Relayer.sol new file mode 100644 index 0000000..9f77336 --- /dev/null +++ b/contracts/bridges/test/MockL2Relayer.sol @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.23; + +interface IBridgeMessenger { + function processMessageFromForeign(bytes memory data) external; + function processMessageFromSource(bytes memory data) external; + function receiveWormholeMessages( + bytes memory data, + bytes[] memory, + bytes32 sourceAddress, + uint16 sourceChain, + bytes32 deliveryHash + ) external; +} + +/// @title MockL2Relayer - Smart contract for mocking the L2 relayer contract +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Mariapia Moscatiello - +contract MockL2Relayer { + address public homeMediator; + address public foreignGovernor; + + uint16 public sourceChain = 2; // ETH + bytes32 public constant DELIVERY_HASH = 0; + + constructor(address _homeMediator, address _foreignGovernor) { + homeMediator = _homeMediator; + foreignGovernor = _foreignGovernor; + } + + function changeBridgeMessenger(address _homeMediator) external { + homeMediator = _homeMediator; + } + + function changeForeignGovernor(address _foreignGovernor) external { + foreignGovernor = _foreignGovernor; + } + + function changeSourceGovernor(address _foreignGovernor) external { + foreignGovernor = _foreignGovernor; + } + + function messageSender() external view returns (address) { + return foreignGovernor; + } + + function xDomainMessageSender() external view returns (address) { + return foreignGovernor; + } + + function processMessageFromForeign(bytes memory data) public { + IBridgeMessenger(homeMediator).processMessageFromForeign(data); + } + + function processMessageFromSource(bytes memory data) external { + IBridgeMessenger(homeMediator).processMessageFromSource(data); + } + + function changeSourceChain(uint16 chainId) external { + sourceChain = chainId; + } + + function receiveWormholeMessages(bytes memory data) external { + bytes32 sourceAddress = bytes32(uint256(uint160(foreignGovernor))); + IBridgeMessenger(homeMediator).receiveWormholeMessages(data, new bytes[](0), sourceAddress, sourceChain, DELIVERY_HASH); + } +} \ No newline at end of file diff --git a/contracts/interfaces/IBridgeErrors.sol b/contracts/interfaces/IBridgeErrors.sol new file mode 100644 index 0000000..8a3d0e9 --- /dev/null +++ b/contracts/interfaces/IBridgeErrors.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.23; + +/// @dev Bridge errors. +interface IBridgeErrors { + /// @dev Provided zero address. + error ZeroAddress(); + + /// @dev Provided zero value. + error ZeroValue(); + + /// @dev Only self contract is allowed to call the function. + /// @param sender Sender address. + /// @param instance Required contract instance address. + error SelfCallOnly(address sender, address instance); + + /// @dev Only L2 relayer is allowed to call the function. + /// @param sender Sender address. + /// @param targetRelayer Required L2 relayer address. + error TargetRelayerOnly(address sender, address targetRelayer); + + /// @dev Wrong source chain Id. + /// @param received Chain Id received. + /// @param required Required chain Id. + error WrongSourceChainId(uint256 received, uint256 required); + + /// @dev Only on behalf of `sourceGovernor` the function is allowed to process the data. + /// @param sender Sender address. + /// @param sourceGovernor Required source governor address. + error SourceGovernorOnly(address sender, address sourceGovernor); + + /// @dev The message with a specified hash has already been delivered. + /// @param deliveryHash Delivery hash. + error AlreadyDelivered(bytes32 deliveryHash); + + /// @dev Provided incorrect data length. + /// @param expected Expected minimum data length. + /// @param provided Provided data length. + error IncorrectDataLength(uint256 expected, uint256 provided); + + /// @dev Provided value is bigger than the actual balance. + /// @param value Provided value. + /// @param balance Actual balance. + error InsufficientBalance(uint256 value, uint256 balance); + + /// @dev Target execution failed. + /// @param target Target address. + /// @param value Provided value. + /// @param payload Provided payload. + error TargetExecFailed(address target, uint256 value, bytes payload); +} diff --git a/test/HomeMediator.js b/test/HomeMediator.js index f98c1c1..b306b85 100644 --- a/test/HomeMediator.js +++ b/test/HomeMediator.js @@ -16,7 +16,7 @@ describe("HomeMediator", function () { deployer = signers[0]; // Deploy the mock of AMBMediator contract - const AMBMediator = await ethers.getContractFactory("MockAMBMediator"); + const AMBMediator = await ethers.getContractFactory("MockL2Relayer"); ambMediator = await AMBMediator.deploy(deployer.address, deployer.address); await ambMediator.deployed(); @@ -26,7 +26,7 @@ describe("HomeMediator", function () { await homeMediator.deployed(); // Change the HomeMediator contract address in the AMBMediator - await ambMediator.changeHomeMediator(homeMediator.address); + await ambMediator.changeBridgeMessenger(homeMediator.address); // OLAS represents a contract deployed on L2 const OLAS = await ethers.getContractFactory("OLAS"); diff --git a/test/buOLAS.js b/test/buOLAS.js index 8481d37..13cd271 100644 --- a/test/buOLAS.js +++ b/test/buOLAS.js @@ -2,6 +2,7 @@ const { expect } = require("chai"); const { ethers } = require("hardhat"); +const helpers = require("@nomicfoundation/hardhat-network-helpers"); describe("buOLAS", function () { let olas; @@ -408,4 +409,27 @@ describe("buOLAS", function () { ).to.be.revertedWithCustomError(bu, "NonTransferable"); }); }); + + context("Time sensitive functions.", async function () { + it("Should fail when creating a lock after the year of 2106", async function () { + // Take a snapshot of the current state of the blockchain + const snapshot = await helpers.takeSnapshot(); + + const account = signers[1].address; + await olas.approve(bu.address, oneOLASBalance); + + // Define 4 years for the lock duration + const numSteps = 4; + + // Move time to the year 2106 + const year2106 = 4291821394; + await helpers.time.increase(year2106); + await expect( + bu.createLockFor(account, oneOLASBalance, numSteps) + ).to.be.revertedWithCustomError(bu, "Overflow"); + + // Restore to the state of the snapshot + await snapshot.restore(); + }); + }); }); diff --git a/test/xbuOLAS.js b/test/xbuOLAS.js deleted file mode 100644 index f020ca8..0000000 --- a/test/xbuOLAS.js +++ /dev/null @@ -1,41 +0,0 @@ -/*global describe, context, beforeEach, it*/ - -const { expect } = require("chai"); -const { ethers } = require("hardhat"); - -describe("Time shifting buOLAS", function () { - let olas; - let bu; - let signers; - const initialMint = "1000000000000000000000000"; // 1000000 - const oneOLABalance = ethers.utils.parseEther("1"); - const numSteps = 4; - - beforeEach(async function () { - const OLAS = await ethers.getContractFactory("OLAS"); - olas = await OLAS.deploy(); - await olas.deployed(); - - signers = await ethers.getSigners(); - await olas.mint(signers[0].address, initialMint); - - const BU = await ethers.getContractFactory("buOLAS"); - bu = await BU.deploy(olas.address, "name", "symbol"); - await bu.deployed(); - }); - - context("Time sensitive functions. This must be the very last test", async function () { - it("Should fail when creating a lock after the year of 2106", async function () { - const account = signers[1].address; - await olas.approve(bu.address, oneOLABalance); - - // Move time to the year 2106 - const year2106 = 4291821394; - ethers.provider.send("evm_increaseTime", [year2106]); - ethers.provider.send("evm_mine"); - await expect( - bu.createLockFor(account, oneOLABalance, numSteps) - ).to.be.revertedWithCustomError(bu, "Overflow"); - }); - }); -});