From 3eeb78a4f1a23d190a826055841cdfe04b4f7d64 Mon Sep 17 00:00:00 2001 From: skosito Date: Fri, 27 Sep 2024 14:15:37 +0100 Subject: [PATCH] feat: add sender to revert context (#2919) * e2e tests and modifications for authenticated call * extend test with sender check and revert case * separate tests into separate files * cleanup * withdraw and call support and tests * bump protocol contracts * split tests into separate files * small cleanup * fmt * generate * lint * changelog * PR comments * fix case in proto * bump vote inbound gas limit in zetaclient * fix test * generate * fixing tests * call options non empty * generate * test fix * rename gateway caller * pr comments rename tests * PR comment * generate * tests * add sender in test contract * extend e2e tests * generate * changelog * PR comment * generate * update tests fixes * tests fixes * fix * test fix * gas limit fixes * PR comment fix * fix bad merge --- changelog.md | 1 + ...2_erc20_deposit_and_call_revert_with_call.go | 9 +++++++++ ..._erc20_withdraw_and_call_revert_with_call.go | 9 +++++++++ ..._v2_eth_deposit_and_call_revert_with_call.go | 9 +++++++++ ...v2_eth_withdraw_and_call_revert_with_call.go | 9 +++++++++ go.mod | 2 +- go.sum | 4 ++-- pkg/contracts/testdappv2/TestDAppV2.abi | 5 +++++ pkg/contracts/testdappv2/TestDAppV2.bin | 2 +- pkg/contracts/testdappv2/TestDAppV2.go | 17 +++++++++-------- pkg/contracts/testdappv2/TestDAppV2.json | 7 ++++++- pkg/contracts/testdappv2/TestDAppV2.sol | 3 +++ testutil/keeper/mocks/crosschain/fungible.go | 10 +++++----- .../cctx_orchestrator_validate_outbound.go | 1 + x/crosschain/keeper/gas_payment.go | 6 ++++++ x/crosschain/types/expected_keepers.go | 1 + x/fungible/keeper/v2_deposits.go | 4 +++- x/fungible/keeper/v2_evm.go | 4 ++++ zetaclient/chains/evm/signer/v2_sign.go | 4 ++++ zetaclient/chains/evm/signer/v2_signer.go | 4 ++-- 20 files changed, 90 insertions(+), 21 deletions(-) diff --git a/changelog.md b/changelog.md index 3a43031bb4..d78c1861ae 100644 --- a/changelog.md +++ b/changelog.md @@ -15,6 +15,7 @@ * [2907](https://github.com/zeta-chain/node/pull/2907) - derive Bitcoin tss address by chain id and added more Signet static info * [2911](https://github.com/zeta-chain/node/pull/2911) - add chain static information for btc testnet4 * [2904](https://github.com/zeta-chain/node/pull/2904) - integrate authenticated calls smart contract functionality into protocol +* [2919](https://github.com/zeta-chain/node/pull/2919) - add inbound sender to revert context ### Refactor diff --git a/e2e/e2etests/test_v2_erc20_deposit_and_call_revert_with_call.go b/e2e/e2etests/test_v2_erc20_deposit_and_call_revert_with_call.go index 40a880ac6e..41b92fee4f 100644 --- a/e2e/e2etests/test_v2_erc20_deposit_and_call_revert_with_call.go +++ b/e2e/e2etests/test_v2_erc20_deposit_and_call_revert_with_call.go @@ -3,6 +3,7 @@ package e2etests import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayevm.sol" @@ -38,4 +39,12 @@ func TestV2ERC20DepositAndCallRevertWithCall(r *runner.E2ERunner, args []string) // check the payload was received on the contract r.AssertTestDAppEVMCalled(true, payloadMessageDepositOnRevertERC20, big.NewInt(0)) + + // check expected sender was used + senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( + &bind.CallOpts{}, + []byte(payloadMessageDepositOnRevertERC20), + ) + require.NoError(r, err) + require.Equal(r, r.EVMAuth.From, senderForMsg) } diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go b/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go index 9ce4b48613..45bab52ae6 100644 --- a/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go +++ b/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go @@ -3,6 +3,7 @@ package e2etests import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayzevm.sol" @@ -43,4 +44,12 @@ func TestV2ERC20WithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string require.Equal(r, crosschaintypes.CctxStatus_Reverted, cctx.CctxStatus.Status) r.AssertTestDAppZEVMCalled(true, payloadMessageWithdrawOnRevertERC20, big.NewInt(0)) + + // check expected sender was used + senderForMsg, err := r.TestDAppV2ZEVM.SenderWithMessage( + &bind.CallOpts{}, + []byte(payloadMessageWithdrawOnRevertERC20), + ) + require.NoError(r, err) + require.Equal(r, r.ZEVMAuth.From, senderForMsg) } diff --git a/e2e/e2etests/test_v2_eth_deposit_and_call_revert_with_call.go b/e2e/e2etests/test_v2_eth_deposit_and_call_revert_with_call.go index 47c3f20755..245aa3e636 100644 --- a/e2e/e2etests/test_v2_eth_deposit_and_call_revert_with_call.go +++ b/e2e/e2etests/test_v2_eth_deposit_and_call_revert_with_call.go @@ -3,6 +3,7 @@ package e2etests import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayevm.sol" @@ -38,4 +39,12 @@ func TestV2ETHDepositAndCallRevertWithCall(r *runner.E2ERunner, args []string) { // check the payload was received on the contract r.AssertTestDAppEVMCalled(true, payloadMessageDepositOnRevertETH, big.NewInt(0)) + + // check expected sender was used + senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( + &bind.CallOpts{}, + []byte(payloadMessageDepositOnRevertETH), + ) + require.NoError(r, err) + require.Equal(r, r.EVMAuth.From, senderForMsg) } diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go b/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go index 391e37e150..f4d31d5d14 100644 --- a/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go +++ b/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go @@ -3,6 +3,7 @@ package e2etests import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayzevm.sol" @@ -42,4 +43,12 @@ func TestV2ETHWithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string) require.Equal(r, crosschaintypes.CctxStatus_Reverted, cctx.CctxStatus.Status) r.AssertTestDAppZEVMCalled(true, payloadMessageWithdrawOnRevertETH, big.NewInt(0)) + + // check expected sender was used + senderForMsg, err := r.TestDAppV2ZEVM.SenderWithMessage( + &bind.CallOpts{}, + []byte(payloadMessageWithdrawOnRevertETH), + ) + require.NoError(r, err) + require.Equal(r, r.ZEVMAuth.From, senderForMsg) } diff --git a/go.mod b/go.mod index 17899e5ccb..b169010e38 100644 --- a/go.mod +++ b/go.mod @@ -59,7 +59,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/zeta-chain/ethermint v0.0.0-20240909234716-2fad916e7179 github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138 - github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240920151810-cabe34920d52 + github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240924201108-3a274ce7bad0 gitlab.com/thorchain/tss/go-tss v1.6.5 go.nhat.io/grpcmock v0.25.0 golang.org/x/crypto v0.23.0 diff --git a/go.sum b/go.sum index 972c2695ce..b06cf25283 100644 --- a/go.sum +++ b/go.sum @@ -4182,8 +4182,8 @@ github.com/zeta-chain/go-tss v0.0.0-20240916173049-89fee4b0ae7f h1:XqUvw9a3EnDa2 github.com/zeta-chain/go-tss v0.0.0-20240916173049-89fee4b0ae7f/go.mod h1:B1FDE6kHs8hozKSX1/iXgCdvlFbS6+FeAupoBHDK0Cc= github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138 h1:vck/FcIIpFOvpBUm0NO17jbEtmSz/W/a5Y4jRuSJl6I= github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138/go.mod h1:U494OsZTWsU75hqoriZgMdSsgSGP1mUL1jX+wN/Aez8= -github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240920151810-cabe34920d52 h1:DlSY9awQteXVmvY0lPD4Or83iuL4P5KwSGky+n4mYio= -github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240920151810-cabe34920d52/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w= +github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240924201108-3a274ce7bad0 h1:GbfO2dyjSAWqBH0xDIttwPB2fE5A+zw0UUbEoW3S3wU= +github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240924201108-3a274ce7bad0/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w= github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901 h1:9whtN5fjYHfk4yXIuAsYP2EHxImwDWDVUOnZJ2pfL3w= github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901/go.mod h1:d2iTC62s9JwKiCMPhcDDXbIZmuzAyJ4lwso0H5QyRbk= github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= diff --git a/pkg/contracts/testdappv2/TestDAppV2.abi b/pkg/contracts/testdappv2/TestDAppV2.abi index b57adc2484..cbfdc1bfca 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.abi +++ b/pkg/contracts/testdappv2/TestDAppV2.abi @@ -204,6 +204,11 @@ "inputs": [ { "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, { "internalType": "address", "name": "asset", diff --git a/pkg/contracts/testdappv2/TestDAppV2.bin b/pkg/contracts/testdappv2/TestDAppV2.bin index b8768f52b4..0a7fe69007 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.bin +++ b/pkg/contracts/testdappv2/TestDAppV2.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b5061147c806100206000396000f3fe6080604052600436106100c65760003560e01c8063a799911f1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063a799911f146101f9578063c234fecf14610215578063c7a339a91461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a77714610138578063660b9de014610163578063676cc0541461018c5780639291fe26146101bc576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610b78565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610bf7565b610371565b60405161012f9190610c3d565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a9190610c99565b60405180910390f35b34801561016f57600080fd5b5061018a60048036038101906101859190610cd8565b6103ad565b005b6101a660048036038101906101a19190610da0565b610468565b6040516101b39190610e88565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190610b78565b61061d565b6040516101f09190610c3d565b60405180910390f35b610213600480360381019061020e9190610b78565b610660565b005b34801561022157600080fd5b5061023c60048036038101906102379190610ed6565b610689565b005b34801561024a57600080fd5b5061026560048036038101906102609190610f6d565b6106cc565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ffb565b610780565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610bf7565b610879565b6040516102c491906110ba565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610b78565b610899565b60405161030191906110ba565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190611176565b6108e9565b60405161033e9190610c99565b60405180910390f35b61035081610932565b1561035a57600080fd5b61036381610988565b61036e8160006109dc565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104088180604001906103c091906111ce565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b61046581806040019061041b91906111ce565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505060006109dc565b50565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906104b49190610ed6565b73ffffffffffffffffffffffffffffffffffffffff161461050a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019061128e565b60405180910390fd5b61055783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b6105a583838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050346109dc565b8360000160208101906105b89190610ed6565b600284846040516105ca9291906112de565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b60006003600083604051602001610634919061133e565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b61066981610932565b1561067357600080fd5b61067c81610988565b61068681346109dc565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6106d581610932565b156106df57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161071c93929190611355565b6020604051808303816000875af115801561073b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075f91906113b8565b61076857600080fd5b61077181610988565b61077b81836109dc565b505050565b6107cd82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610932565b156107d757600080fd5b61082482828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b61087282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050846109dc565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b600060016000836040516020016108b0919061133e565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405160200161094390611431565b604051602081830303815290604052805190602001208260405160200161096a919061133e565b60405160208183030381529060405280519060200120149050919050565b60018060008360405160200161099e919061133e565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b8060036000846040516020016109f2919061133e565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a8582610a3c565b810181811067ffffffffffffffff82111715610aa457610aa3610a4d565b5b80604052505050565b6000610ab7610a1e565b9050610ac38282610a7c565b919050565b600067ffffffffffffffff821115610ae357610ae2610a4d565b5b610aec82610a3c565b9050602081019050919050565b82818337600083830152505050565b6000610b1b610b1684610ac8565b610aad565b905082815260208101848484011115610b3757610b36610a37565b5b610b42848285610af9565b509392505050565b600082601f830112610b5f57610b5e610a32565b5b8135610b6f848260208601610b08565b91505092915050565b600060208284031215610b8e57610b8d610a28565b5b600082013567ffffffffffffffff811115610bac57610bab610a2d565b5b610bb884828501610b4a565b91505092915050565b6000819050919050565b610bd481610bc1565b8114610bdf57600080fd5b50565b600081359050610bf181610bcb565b92915050565b600060208284031215610c0d57610c0c610a28565b5b6000610c1b84828501610be2565b91505092915050565b6000819050919050565b610c3781610c24565b82525050565b6000602082019050610c526000830184610c2e565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c8382610c58565b9050919050565b610c9381610c78565b82525050565b6000602082019050610cae6000830184610c8a565b92915050565b600080fd5b600060608284031215610ccf57610cce610cb4565b5b81905092915050565b600060208284031215610cee57610ced610a28565b5b600082013567ffffffffffffffff811115610d0c57610d0b610a2d565b5b610d1884828501610cb9565b91505092915050565b600060208284031215610d3757610d36610cb4565b5b81905092915050565b600080fd5b600080fd5b60008083601f840112610d6057610d5f610a32565b5b8235905067ffffffffffffffff811115610d7d57610d7c610d40565b5b602083019150836001820283011115610d9957610d98610d45565b5b9250929050565b600080600060408486031215610db957610db8610a28565b5b6000610dc786828701610d21565b935050602084013567ffffffffffffffff811115610de857610de7610a2d565b5b610df486828701610d4a565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b83811015610e3a578082015181840152602081019050610e1f565b83811115610e49576000848401525b50505050565b6000610e5a82610e00565b610e648185610e0b565b9350610e74818560208601610e1c565b610e7d81610a3c565b840191505092915050565b60006020820190508181036000830152610ea28184610e4f565b905092915050565b610eb381610c78565b8114610ebe57600080fd5b50565b600081359050610ed081610eaa565b92915050565b600060208284031215610eec57610eeb610a28565b5b6000610efa84828501610ec1565b91505092915050565b6000610f0e82610c78565b9050919050565b610f1e81610f03565b8114610f2957600080fd5b50565b600081359050610f3b81610f15565b92915050565b610f4a81610c24565b8114610f5557600080fd5b50565b600081359050610f6781610f41565b92915050565b600080600060608486031215610f8657610f85610a28565b5b6000610f9486828701610f2c565b9350506020610fa586828701610f58565b925050604084013567ffffffffffffffff811115610fc657610fc5610a2d565b5b610fd286828701610b4a565b9150509250925092565b600060608284031215610ff257610ff1610cb4565b5b81905092915050565b60008060008060006080868803121561101757611016610a28565b5b600086013567ffffffffffffffff81111561103557611034610a2d565b5b61104188828901610fdc565b955050602061105288828901610ec1565b945050604061106388828901610f58565b935050606086013567ffffffffffffffff81111561108457611083610a2d565b5b61109088828901610d4a565b92509250509295509295909350565b60008115159050919050565b6110b48161109f565b82525050565b60006020820190506110cf60008301846110ab565b92915050565b600067ffffffffffffffff8211156110f0576110ef610a4d565b5b6110f982610a3c565b9050602081019050919050565b6000611119611114846110d5565b610aad565b90508281526020810184848401111561113557611134610a37565b5b611140848285610af9565b509392505050565b600082601f83011261115d5761115c610a32565b5b813561116d848260208601611106565b91505092915050565b60006020828403121561118c5761118b610a28565b5b600082013567ffffffffffffffff8111156111aa576111a9610a2d565b5b6111b684828501611148565b91505092915050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126111eb576111ea6111bf565b5b80840192508235915067ffffffffffffffff82111561120d5761120c6111c4565b5b602083019250600182023603831315611229576112286111c9565b5b509250929050565b600082825260208201905092915050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b6000611278601683611231565b915061128382611242565b602082019050919050565b600060208201905081810360008301526112a78161126b565b9050919050565b600081905092915050565b60006112c583856112ae565b93506112d2838584610af9565b82840190509392505050565b60006112eb8284866112b9565b91508190509392505050565b600081519050919050565b600081905092915050565b6000611318826112f7565b6113228185611302565b9350611332818560208601610e1c565b80840191505092915050565b600061134a828461130d565b915081905092915050565b600060608201905061136a6000830186610c8a565b6113776020830185610c8a565b6113846040830184610c2e565b949350505050565b6113958161109f565b81146113a057600080fd5b50565b6000815190506113b28161138c565b92915050565b6000602082840312156113ce576113cd610a28565b5b60006113dc848285016113a3565b91505092915050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b600061141b600683611302565b9150611426826113e5565b600682019050919050565b600061143c8261140e565b915081905091905056fea264697066735822122046fb444f8c754142359339f5f1d728822414688169d0d22f23bd25c688c73fdf64736f6c634300080a0033 +608060405234801561001057600080fd5b5061150a806100206000396000f3fe6080604052600436106100c65760003560e01c8063a799911f1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063a799911f146101f9578063c234fecf14610215578063c7a339a91461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a777146101385780635ac1e07014610163578063676cc0541461018c5780639291fe26146101bc576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610de7565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610d02565b610371565b60405161012f9190611173565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a91906110c4565b60405180910390f35b34801561016f57600080fd5b5061018a60048036038101906101859190610e90565b6103ad565b005b6101a660048036038101906101a19190610e30565b6104e7565b6040516101b39190611131565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190610de7565b61069c565b6040516101f09190611173565b60405180910390f35b610213600480360381019061020e9190610de7565b6106df565b005b34801561022157600080fd5b5061023c60048036038101906102379190610ca8565b610708565b005b34801561024a57600080fd5b5061026560048036038101906102609190610d78565b61074b565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ed9565b61080e565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610d02565b610907565b6040516102c49190611116565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610de7565b610927565b6040516103019190611116565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190610d2f565b610977565b60405161033e91906110c4565b60405180910390f35b610350816109c0565b1561035a57600080fd5b61036381610a16565b61036e816000610a6a565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104088180606001906103c0919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61046581806060019061041b919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a6a565b8060000160208101906104789190610ca8565b600282806060019061048a919061118e565b60405161049892919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906105339190610ca8565b73ffffffffffffffffffffffffffffffffffffffff1614610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058090611153565b60405180910390fd5b6105d683838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61062483838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505034610a6a565b8360000160208101906106379190610ca8565b6002848460405161064992919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060036000836040516020016106b39190611098565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6106e8816109c0565b156106f257600080fd5b6106fb81610a16565b6107058134610a6a565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610754816109c0565b1561075e57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161079b939291906110df565b602060405180830381600087803b1580156107b557600080fd5b505af11580156107c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ed9190610cd5565b6107f657600080fd5b6107ff81610a16565b6108098183610a6a565b505050565b61085b82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109c0565b1561086557600080fd5b6108b282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61090082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610a6a565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000600160008360405160200161093e9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109d1906110af565b60405160208183030381529060405280519060200120826040516020016109f89190611098565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a2c9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a809190611098565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000610abf610aba84611216565b6111f1565b905082815260208101848484011115610adb57610ada6113ef565b5b610ae684828561132a565b509392505050565b6000610b01610afc84611247565b6111f1565b905082815260208101848484011115610b1d57610b1c6113ef565b5b610b2884828561132a565b509392505050565b600081359050610b3f81611461565b92915050565b600081519050610b5481611478565b92915050565b600081359050610b698161148f565b92915050565b60008083601f840112610b8557610b846113d1565b5b8235905067ffffffffffffffff811115610ba257610ba16113cc565b5b602083019150836001820283011115610bbe57610bbd6113e5565b5b9250929050565b600082601f830112610bda57610bd96113d1565b5b8135610bea848260208601610aac565b91505092915050565b600081359050610c02816114a6565b92915050565b600082601f830112610c1d57610c1c6113d1565b5b8135610c2d848260208601610aee565b91505092915050565b600060208284031215610c4c57610c4b6113db565b5b81905092915050565b600060808284031215610c6b57610c6a6113db565b5b81905092915050565b600060608284031215610c8a57610c896113db565b5b81905092915050565b600081359050610ca2816114bd565b92915050565b600060208284031215610cbe57610cbd6113f9565b5b6000610ccc84828501610b30565b91505092915050565b600060208284031215610ceb57610cea6113f9565b5b6000610cf984828501610b45565b91505092915050565b600060208284031215610d1857610d176113f9565b5b6000610d2684828501610b5a565b91505092915050565b600060208284031215610d4557610d446113f9565b5b600082013567ffffffffffffffff811115610d6357610d626113f4565b5b610d6f84828501610bc5565b91505092915050565b600080600060608486031215610d9157610d906113f9565b5b6000610d9f86828701610bf3565b9350506020610db086828701610c93565b925050604084013567ffffffffffffffff811115610dd157610dd06113f4565b5b610ddd86828701610c08565b9150509250925092565b600060208284031215610dfd57610dfc6113f9565b5b600082013567ffffffffffffffff811115610e1b57610e1a6113f4565b5b610e2784828501610c08565b91505092915050565b600080600060408486031215610e4957610e486113f9565b5b6000610e5786828701610c36565b935050602084013567ffffffffffffffff811115610e7857610e776113f4565b5b610e8486828701610b6f565b92509250509250925092565b600060208284031215610ea657610ea56113f9565b5b600082013567ffffffffffffffff811115610ec457610ec36113f4565b5b610ed084828501610c55565b91505092915050565b600080600080600060808688031215610ef557610ef46113f9565b5b600086013567ffffffffffffffff811115610f1357610f126113f4565b5b610f1f88828901610c74565b9550506020610f3088828901610b30565b9450506040610f4188828901610c93565b935050606086013567ffffffffffffffff811115610f6257610f616113f4565b5b610f6e88828901610b6f565b92509250509295509295909350565b610f86816112c6565b82525050565b610f95816112d8565b82525050565b6000610fa7838561129f565b9350610fb483858461132a565b82840190509392505050565b6000610fcb82611278565b610fd5818561128e565b9350610fe5818560208601611339565b610fee816113fe565b840191505092915050565b600061100482611283565b61100e81856112bb565b935061101e818560208601611339565b80840191505092915050565b60006110376016836112aa565b91506110428261140f565b602082019050919050565b600061105a6006836112bb565b915061106582611438565b600682019050919050565b61107981611320565b82525050565b600061108c828486610f9b565b91508190509392505050565b60006110a48284610ff9565b915081905092915050565b60006110ba8261104d565b9150819050919050565b60006020820190506110d96000830184610f7d565b92915050565b60006060820190506110f46000830186610f7d565b6111016020830185610f7d565b61110e6040830184611070565b949350505050565b600060208201905061112b6000830184610f8c565b92915050565b6000602082019050818103600083015261114b8184610fc0565b905092915050565b6000602082019050818103600083015261116c8161102a565b9050919050565b60006020820190506111886000830184611070565b92915050565b600080833560016020038436030381126111ab576111aa6113e0565b5b80840192508235915067ffffffffffffffff8211156111cd576111cc6113d6565b5b6020830192506001820236038313156111e9576111e86113ea565b5b509250929050565b60006111fb61120c565b9050611207828261136c565b919050565b6000604051905090565b600067ffffffffffffffff8211156112315761123061139d565b5b61123a826113fe565b9050602081019050919050565b600067ffffffffffffffff8211156112625761126161139d565b5b61126b826113fe565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006112d182611300565b9050919050565b60008115159050919050565b6000819050919050565b60006112f9826112c6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561135757808201518184015260208101905061133c565b83811115611366576000848401525b50505050565b611375826113fe565b810181811067ffffffffffffffff821117156113945761139361139d565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61146a816112c6565b811461147557600080fd5b50565b611481816112d8565b811461148c57600080fd5b50565b611498816112e4565b81146114a357600080fd5b50565b6114af816112ee565b81146114ba57600080fd5b50565b6114c681611320565b81146114d157600080fd5b5056fea2646970667358221220e090c5cd81361f8bba5d13d4fb801ab148714dad774e12a4acf812e341dc93c564736f6c63430008070033 diff --git a/pkg/contracts/testdappv2/TestDAppV2.go b/pkg/contracts/testdappv2/TestDAppV2.go index 689014c847..50e4bbcecb 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.go +++ b/pkg/contracts/testdappv2/TestDAppV2.go @@ -36,6 +36,7 @@ type TestDAppV2MessageContext struct { // TestDAppV2RevertContext is an auto generated low-level Go binding around an user-defined struct. type TestDAppV2RevertContext struct { + Sender common.Address Asset common.Address Amount uint64 RevertMessage []byte @@ -50,8 +51,8 @@ type TestDAppV2zContext struct { // TestDAppV2MetaData contains all meta data concerning the TestDAppV2 contract. var TestDAppV2MetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"amountWithMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"calledWithMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"erc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"erc20Call\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"expectedOnCallSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"gasCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"getAmountWithMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"getCalledWithMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"internalType\":\"structTestDAppV2.MessageContext\",\"name\":\"messageContext\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCall\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"origin\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"}],\"internalType\":\"structTestDAppV2.zContext\",\"name\":\"_context\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCrossChainCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"amount\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"revertMessage\",\"type\":\"bytes\"}],\"internalType\":\"structTestDAppV2.RevertContext\",\"name\":\"revertContext\",\"type\":\"tuple\"}],\"name\":\"onRevert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"senderWithMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_expectedOnCallSender\",\"type\":\"address\"}],\"name\":\"setExpectedOnCallSender\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"simpleCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561001057600080fd5b5061147c806100206000396000f3fe6080604052600436106100c65760003560e01c8063a799911f1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063a799911f146101f9578063c234fecf14610215578063c7a339a91461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a77714610138578063660b9de014610163578063676cc0541461018c5780639291fe26146101bc576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610b78565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610bf7565b610371565b60405161012f9190610c3d565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a9190610c99565b60405180910390f35b34801561016f57600080fd5b5061018a60048036038101906101859190610cd8565b6103ad565b005b6101a660048036038101906101a19190610da0565b610468565b6040516101b39190610e88565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190610b78565b61061d565b6040516101f09190610c3d565b60405180910390f35b610213600480360381019061020e9190610b78565b610660565b005b34801561022157600080fd5b5061023c60048036038101906102379190610ed6565b610689565b005b34801561024a57600080fd5b5061026560048036038101906102609190610f6d565b6106cc565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ffb565b610780565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610bf7565b610879565b6040516102c491906110ba565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610b78565b610899565b60405161030191906110ba565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190611176565b6108e9565b60405161033e9190610c99565b60405180910390f35b61035081610932565b1561035a57600080fd5b61036381610988565b61036e8160006109dc565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104088180604001906103c091906111ce565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b61046581806040019061041b91906111ce565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505060006109dc565b50565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906104b49190610ed6565b73ffffffffffffffffffffffffffffffffffffffff161461050a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019061128e565b60405180910390fd5b61055783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b6105a583838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050346109dc565b8360000160208101906105b89190610ed6565b600284846040516105ca9291906112de565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b60006003600083604051602001610634919061133e565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b61066981610932565b1561067357600080fd5b61067c81610988565b61068681346109dc565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6106d581610932565b156106df57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161071c93929190611355565b6020604051808303816000875af115801561073b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075f91906113b8565b61076857600080fd5b61077181610988565b61077b81836109dc565b505050565b6107cd82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610932565b156107d757600080fd5b61082482828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b61087282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050846109dc565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b600060016000836040516020016108b0919061133e565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405160200161094390611431565b604051602081830303815290604052805190602001208260405160200161096a919061133e565b60405160208183030381529060405280519060200120149050919050565b60018060008360405160200161099e919061133e565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b8060036000846040516020016109f2919061133e565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a8582610a3c565b810181811067ffffffffffffffff82111715610aa457610aa3610a4d565b5b80604052505050565b6000610ab7610a1e565b9050610ac38282610a7c565b919050565b600067ffffffffffffffff821115610ae357610ae2610a4d565b5b610aec82610a3c565b9050602081019050919050565b82818337600083830152505050565b6000610b1b610b1684610ac8565b610aad565b905082815260208101848484011115610b3757610b36610a37565b5b610b42848285610af9565b509392505050565b600082601f830112610b5f57610b5e610a32565b5b8135610b6f848260208601610b08565b91505092915050565b600060208284031215610b8e57610b8d610a28565b5b600082013567ffffffffffffffff811115610bac57610bab610a2d565b5b610bb884828501610b4a565b91505092915050565b6000819050919050565b610bd481610bc1565b8114610bdf57600080fd5b50565b600081359050610bf181610bcb565b92915050565b600060208284031215610c0d57610c0c610a28565b5b6000610c1b84828501610be2565b91505092915050565b6000819050919050565b610c3781610c24565b82525050565b6000602082019050610c526000830184610c2e565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c8382610c58565b9050919050565b610c9381610c78565b82525050565b6000602082019050610cae6000830184610c8a565b92915050565b600080fd5b600060608284031215610ccf57610cce610cb4565b5b81905092915050565b600060208284031215610cee57610ced610a28565b5b600082013567ffffffffffffffff811115610d0c57610d0b610a2d565b5b610d1884828501610cb9565b91505092915050565b600060208284031215610d3757610d36610cb4565b5b81905092915050565b600080fd5b600080fd5b60008083601f840112610d6057610d5f610a32565b5b8235905067ffffffffffffffff811115610d7d57610d7c610d40565b5b602083019150836001820283011115610d9957610d98610d45565b5b9250929050565b600080600060408486031215610db957610db8610a28565b5b6000610dc786828701610d21565b935050602084013567ffffffffffffffff811115610de857610de7610a2d565b5b610df486828701610d4a565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b83811015610e3a578082015181840152602081019050610e1f565b83811115610e49576000848401525b50505050565b6000610e5a82610e00565b610e648185610e0b565b9350610e74818560208601610e1c565b610e7d81610a3c565b840191505092915050565b60006020820190508181036000830152610ea28184610e4f565b905092915050565b610eb381610c78565b8114610ebe57600080fd5b50565b600081359050610ed081610eaa565b92915050565b600060208284031215610eec57610eeb610a28565b5b6000610efa84828501610ec1565b91505092915050565b6000610f0e82610c78565b9050919050565b610f1e81610f03565b8114610f2957600080fd5b50565b600081359050610f3b81610f15565b92915050565b610f4a81610c24565b8114610f5557600080fd5b50565b600081359050610f6781610f41565b92915050565b600080600060608486031215610f8657610f85610a28565b5b6000610f9486828701610f2c565b9350506020610fa586828701610f58565b925050604084013567ffffffffffffffff811115610fc657610fc5610a2d565b5b610fd286828701610b4a565b9150509250925092565b600060608284031215610ff257610ff1610cb4565b5b81905092915050565b60008060008060006080868803121561101757611016610a28565b5b600086013567ffffffffffffffff81111561103557611034610a2d565b5b61104188828901610fdc565b955050602061105288828901610ec1565b945050604061106388828901610f58565b935050606086013567ffffffffffffffff81111561108457611083610a2d565b5b61109088828901610d4a565b92509250509295509295909350565b60008115159050919050565b6110b48161109f565b82525050565b60006020820190506110cf60008301846110ab565b92915050565b600067ffffffffffffffff8211156110f0576110ef610a4d565b5b6110f982610a3c565b9050602081019050919050565b6000611119611114846110d5565b610aad565b90508281526020810184848401111561113557611134610a37565b5b611140848285610af9565b509392505050565b600082601f83011261115d5761115c610a32565b5b813561116d848260208601611106565b91505092915050565b60006020828403121561118c5761118b610a28565b5b600082013567ffffffffffffffff8111156111aa576111a9610a2d565b5b6111b684828501611148565b91505092915050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126111eb576111ea6111bf565b5b80840192508235915067ffffffffffffffff82111561120d5761120c6111c4565b5b602083019250600182023603831315611229576112286111c9565b5b509250929050565b600082825260208201905092915050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b6000611278601683611231565b915061128382611242565b602082019050919050565b600060208201905081810360008301526112a78161126b565b9050919050565b600081905092915050565b60006112c583856112ae565b93506112d2838584610af9565b82840190509392505050565b60006112eb8284866112b9565b91508190509392505050565b600081519050919050565b600081905092915050565b6000611318826112f7565b6113228185611302565b9350611332818560208601610e1c565b80840191505092915050565b600061134a828461130d565b915081905092915050565b600060608201905061136a6000830186610c8a565b6113776020830185610c8a565b6113846040830184610c2e565b949350505050565b6113958161109f565b81146113a057600080fd5b50565b6000815190506113b28161138c565b92915050565b6000602082840312156113ce576113cd610a28565b5b60006113dc848285016113a3565b91505092915050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b600061141b600683611302565b9150611426826113e5565b600682019050919050565b600061143c8261140e565b915081905091905056fea264697066735822122046fb444f8c754142359339f5f1d728822414688169d0d22f23bd25c688c73fdf64736f6c634300080a0033", + ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"amountWithMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"calledWithMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"erc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"erc20Call\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"expectedOnCallSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"gasCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"getAmountWithMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"getCalledWithMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"internalType\":\"structTestDAppV2.MessageContext\",\"name\":\"messageContext\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCall\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"origin\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"}],\"internalType\":\"structTestDAppV2.zContext\",\"name\":\"_context\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCrossChainCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"amount\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"revertMessage\",\"type\":\"bytes\"}],\"internalType\":\"structTestDAppV2.RevertContext\",\"name\":\"revertContext\",\"type\":\"tuple\"}],\"name\":\"onRevert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"senderWithMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_expectedOnCallSender\",\"type\":\"address\"}],\"name\":\"setExpectedOnCallSender\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"simpleCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + Bin: "0x608060405234801561001057600080fd5b5061150a806100206000396000f3fe6080604052600436106100c65760003560e01c8063a799911f1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063a799911f146101f9578063c234fecf14610215578063c7a339a91461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a777146101385780635ac1e07014610163578063676cc0541461018c5780639291fe26146101bc576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610de7565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610d02565b610371565b60405161012f9190611173565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a91906110c4565b60405180910390f35b34801561016f57600080fd5b5061018a60048036038101906101859190610e90565b6103ad565b005b6101a660048036038101906101a19190610e30565b6104e7565b6040516101b39190611131565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190610de7565b61069c565b6040516101f09190611173565b60405180910390f35b610213600480360381019061020e9190610de7565b6106df565b005b34801561022157600080fd5b5061023c60048036038101906102379190610ca8565b610708565b005b34801561024a57600080fd5b5061026560048036038101906102609190610d78565b61074b565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ed9565b61080e565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610d02565b610907565b6040516102c49190611116565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610de7565b610927565b6040516103019190611116565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190610d2f565b610977565b60405161033e91906110c4565b60405180910390f35b610350816109c0565b1561035a57600080fd5b61036381610a16565b61036e816000610a6a565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104088180606001906103c0919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61046581806060019061041b919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a6a565b8060000160208101906104789190610ca8565b600282806060019061048a919061118e565b60405161049892919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906105339190610ca8565b73ffffffffffffffffffffffffffffffffffffffff1614610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058090611153565b60405180910390fd5b6105d683838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61062483838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505034610a6a565b8360000160208101906106379190610ca8565b6002848460405161064992919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060036000836040516020016106b39190611098565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6106e8816109c0565b156106f257600080fd5b6106fb81610a16565b6107058134610a6a565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610754816109c0565b1561075e57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161079b939291906110df565b602060405180830381600087803b1580156107b557600080fd5b505af11580156107c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ed9190610cd5565b6107f657600080fd5b6107ff81610a16565b6108098183610a6a565b505050565b61085b82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109c0565b1561086557600080fd5b6108b282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61090082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610a6a565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000600160008360405160200161093e9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109d1906110af565b60405160208183030381529060405280519060200120826040516020016109f89190611098565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a2c9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a809190611098565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000610abf610aba84611216565b6111f1565b905082815260208101848484011115610adb57610ada6113ef565b5b610ae684828561132a565b509392505050565b6000610b01610afc84611247565b6111f1565b905082815260208101848484011115610b1d57610b1c6113ef565b5b610b2884828561132a565b509392505050565b600081359050610b3f81611461565b92915050565b600081519050610b5481611478565b92915050565b600081359050610b698161148f565b92915050565b60008083601f840112610b8557610b846113d1565b5b8235905067ffffffffffffffff811115610ba257610ba16113cc565b5b602083019150836001820283011115610bbe57610bbd6113e5565b5b9250929050565b600082601f830112610bda57610bd96113d1565b5b8135610bea848260208601610aac565b91505092915050565b600081359050610c02816114a6565b92915050565b600082601f830112610c1d57610c1c6113d1565b5b8135610c2d848260208601610aee565b91505092915050565b600060208284031215610c4c57610c4b6113db565b5b81905092915050565b600060808284031215610c6b57610c6a6113db565b5b81905092915050565b600060608284031215610c8a57610c896113db565b5b81905092915050565b600081359050610ca2816114bd565b92915050565b600060208284031215610cbe57610cbd6113f9565b5b6000610ccc84828501610b30565b91505092915050565b600060208284031215610ceb57610cea6113f9565b5b6000610cf984828501610b45565b91505092915050565b600060208284031215610d1857610d176113f9565b5b6000610d2684828501610b5a565b91505092915050565b600060208284031215610d4557610d446113f9565b5b600082013567ffffffffffffffff811115610d6357610d626113f4565b5b610d6f84828501610bc5565b91505092915050565b600080600060608486031215610d9157610d906113f9565b5b6000610d9f86828701610bf3565b9350506020610db086828701610c93565b925050604084013567ffffffffffffffff811115610dd157610dd06113f4565b5b610ddd86828701610c08565b9150509250925092565b600060208284031215610dfd57610dfc6113f9565b5b600082013567ffffffffffffffff811115610e1b57610e1a6113f4565b5b610e2784828501610c08565b91505092915050565b600080600060408486031215610e4957610e486113f9565b5b6000610e5786828701610c36565b935050602084013567ffffffffffffffff811115610e7857610e776113f4565b5b610e8486828701610b6f565b92509250509250925092565b600060208284031215610ea657610ea56113f9565b5b600082013567ffffffffffffffff811115610ec457610ec36113f4565b5b610ed084828501610c55565b91505092915050565b600080600080600060808688031215610ef557610ef46113f9565b5b600086013567ffffffffffffffff811115610f1357610f126113f4565b5b610f1f88828901610c74565b9550506020610f3088828901610b30565b9450506040610f4188828901610c93565b935050606086013567ffffffffffffffff811115610f6257610f616113f4565b5b610f6e88828901610b6f565b92509250509295509295909350565b610f86816112c6565b82525050565b610f95816112d8565b82525050565b6000610fa7838561129f565b9350610fb483858461132a565b82840190509392505050565b6000610fcb82611278565b610fd5818561128e565b9350610fe5818560208601611339565b610fee816113fe565b840191505092915050565b600061100482611283565b61100e81856112bb565b935061101e818560208601611339565b80840191505092915050565b60006110376016836112aa565b91506110428261140f565b602082019050919050565b600061105a6006836112bb565b915061106582611438565b600682019050919050565b61107981611320565b82525050565b600061108c828486610f9b565b91508190509392505050565b60006110a48284610ff9565b915081905092915050565b60006110ba8261104d565b9150819050919050565b60006020820190506110d96000830184610f7d565b92915050565b60006060820190506110f46000830186610f7d565b6111016020830185610f7d565b61110e6040830184611070565b949350505050565b600060208201905061112b6000830184610f8c565b92915050565b6000602082019050818103600083015261114b8184610fc0565b905092915050565b6000602082019050818103600083015261116c8161102a565b9050919050565b60006020820190506111886000830184611070565b92915050565b600080833560016020038436030381126111ab576111aa6113e0565b5b80840192508235915067ffffffffffffffff8211156111cd576111cc6113d6565b5b6020830192506001820236038313156111e9576111e86113ea565b5b509250929050565b60006111fb61120c565b9050611207828261136c565b919050565b6000604051905090565b600067ffffffffffffffff8211156112315761123061139d565b5b61123a826113fe565b9050602081019050919050565b600067ffffffffffffffff8211156112625761126161139d565b5b61126b826113fe565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006112d182611300565b9050919050565b60008115159050919050565b6000819050919050565b60006112f9826112c6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561135757808201518184015260208101905061133c565b83811115611366576000848401525b50505050565b611375826113fe565b810181811067ffffffffffffffff821117156113945761139361139d565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61146a816112c6565b811461147557600080fd5b50565b611481816112d8565b811461148c57600080fd5b50565b611498816112e4565b81146114a357600080fd5b50565b6114af816112ee565b81146114ba57600080fd5b50565b6114c681611320565b81146114d157600080fd5b5056fea2646970667358221220e090c5cd81361f8bba5d13d4fb801ab148714dad774e12a4acf812e341dc93c564736f6c63430008070033", } // TestDAppV2ABI is the input ABI used to generate the binding from. @@ -491,23 +492,23 @@ func (_TestDAppV2 *TestDAppV2TransactorSession) OnCrossChainCall(_context TestDA return _TestDAppV2.Contract.OnCrossChainCall(&_TestDAppV2.TransactOpts, _context, _zrc20, amount, message) } -// OnRevert is a paid mutator transaction binding the contract method 0x660b9de0. +// OnRevert is a paid mutator transaction binding the contract method 0x5ac1e070. // -// Solidity: function onRevert((address,uint64,bytes) revertContext) returns() +// Solidity: function onRevert((address,address,uint64,bytes) revertContext) returns() func (_TestDAppV2 *TestDAppV2Transactor) OnRevert(opts *bind.TransactOpts, revertContext TestDAppV2RevertContext) (*types.Transaction, error) { return _TestDAppV2.contract.Transact(opts, "onRevert", revertContext) } -// OnRevert is a paid mutator transaction binding the contract method 0x660b9de0. +// OnRevert is a paid mutator transaction binding the contract method 0x5ac1e070. // -// Solidity: function onRevert((address,uint64,bytes) revertContext) returns() +// Solidity: function onRevert((address,address,uint64,bytes) revertContext) returns() func (_TestDAppV2 *TestDAppV2Session) OnRevert(revertContext TestDAppV2RevertContext) (*types.Transaction, error) { return _TestDAppV2.Contract.OnRevert(&_TestDAppV2.TransactOpts, revertContext) } -// OnRevert is a paid mutator transaction binding the contract method 0x660b9de0. +// OnRevert is a paid mutator transaction binding the contract method 0x5ac1e070. // -// Solidity: function onRevert((address,uint64,bytes) revertContext) returns() +// Solidity: function onRevert((address,address,uint64,bytes) revertContext) returns() func (_TestDAppV2 *TestDAppV2TransactorSession) OnRevert(revertContext TestDAppV2RevertContext) (*types.Transaction, error) { return _TestDAppV2.Contract.OnRevert(&_TestDAppV2.TransactOpts, revertContext) } diff --git a/pkg/contracts/testdappv2/TestDAppV2.json b/pkg/contracts/testdappv2/TestDAppV2.json index 04cbd8756a..3117879927 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.json +++ b/pkg/contracts/testdappv2/TestDAppV2.json @@ -205,6 +205,11 @@ "inputs": [ { "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, { "internalType": "address", "name": "asset", @@ -281,5 +286,5 @@ "type": "receive" } ], - "bin": "608060405234801561001057600080fd5b5061147c806100206000396000f3fe6080604052600436106100c65760003560e01c8063a799911f1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063a799911f146101f9578063c234fecf14610215578063c7a339a91461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a77714610138578063660b9de014610163578063676cc0541461018c5780639291fe26146101bc576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610b78565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610bf7565b610371565b60405161012f9190610c3d565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a9190610c99565b60405180910390f35b34801561016f57600080fd5b5061018a60048036038101906101859190610cd8565b6103ad565b005b6101a660048036038101906101a19190610da0565b610468565b6040516101b39190610e88565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190610b78565b61061d565b6040516101f09190610c3d565b60405180910390f35b610213600480360381019061020e9190610b78565b610660565b005b34801561022157600080fd5b5061023c60048036038101906102379190610ed6565b610689565b005b34801561024a57600080fd5b5061026560048036038101906102609190610f6d565b6106cc565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ffb565b610780565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610bf7565b610879565b6040516102c491906110ba565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610b78565b610899565b60405161030191906110ba565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190611176565b6108e9565b60405161033e9190610c99565b60405180910390f35b61035081610932565b1561035a57600080fd5b61036381610988565b61036e8160006109dc565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104088180604001906103c091906111ce565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b61046581806040019061041b91906111ce565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505060006109dc565b50565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906104b49190610ed6565b73ffffffffffffffffffffffffffffffffffffffff161461050a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019061128e565b60405180910390fd5b61055783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b6105a583838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050346109dc565b8360000160208101906105b89190610ed6565b600284846040516105ca9291906112de565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b60006003600083604051602001610634919061133e565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b61066981610932565b1561067357600080fd5b61067c81610988565b61068681346109dc565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6106d581610932565b156106df57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161071c93929190611355565b6020604051808303816000875af115801561073b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075f91906113b8565b61076857600080fd5b61077181610988565b61077b81836109dc565b505050565b6107cd82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610932565b156107d757600080fd5b61082482828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610988565b61087282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050846109dc565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b600060016000836040516020016108b0919061133e565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405160200161094390611431565b604051602081830303815290604052805190602001208260405160200161096a919061133e565b60405160208183030381529060405280519060200120149050919050565b60018060008360405160200161099e919061133e565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b8060036000846040516020016109f2919061133e565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a8582610a3c565b810181811067ffffffffffffffff82111715610aa457610aa3610a4d565b5b80604052505050565b6000610ab7610a1e565b9050610ac38282610a7c565b919050565b600067ffffffffffffffff821115610ae357610ae2610a4d565b5b610aec82610a3c565b9050602081019050919050565b82818337600083830152505050565b6000610b1b610b1684610ac8565b610aad565b905082815260208101848484011115610b3757610b36610a37565b5b610b42848285610af9565b509392505050565b600082601f830112610b5f57610b5e610a32565b5b8135610b6f848260208601610b08565b91505092915050565b600060208284031215610b8e57610b8d610a28565b5b600082013567ffffffffffffffff811115610bac57610bab610a2d565b5b610bb884828501610b4a565b91505092915050565b6000819050919050565b610bd481610bc1565b8114610bdf57600080fd5b50565b600081359050610bf181610bcb565b92915050565b600060208284031215610c0d57610c0c610a28565b5b6000610c1b84828501610be2565b91505092915050565b6000819050919050565b610c3781610c24565b82525050565b6000602082019050610c526000830184610c2e565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c8382610c58565b9050919050565b610c9381610c78565b82525050565b6000602082019050610cae6000830184610c8a565b92915050565b600080fd5b600060608284031215610ccf57610cce610cb4565b5b81905092915050565b600060208284031215610cee57610ced610a28565b5b600082013567ffffffffffffffff811115610d0c57610d0b610a2d565b5b610d1884828501610cb9565b91505092915050565b600060208284031215610d3757610d36610cb4565b5b81905092915050565b600080fd5b600080fd5b60008083601f840112610d6057610d5f610a32565b5b8235905067ffffffffffffffff811115610d7d57610d7c610d40565b5b602083019150836001820283011115610d9957610d98610d45565b5b9250929050565b600080600060408486031215610db957610db8610a28565b5b6000610dc786828701610d21565b935050602084013567ffffffffffffffff811115610de857610de7610a2d565b5b610df486828701610d4a565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b83811015610e3a578082015181840152602081019050610e1f565b83811115610e49576000848401525b50505050565b6000610e5a82610e00565b610e648185610e0b565b9350610e74818560208601610e1c565b610e7d81610a3c565b840191505092915050565b60006020820190508181036000830152610ea28184610e4f565b905092915050565b610eb381610c78565b8114610ebe57600080fd5b50565b600081359050610ed081610eaa565b92915050565b600060208284031215610eec57610eeb610a28565b5b6000610efa84828501610ec1565b91505092915050565b6000610f0e82610c78565b9050919050565b610f1e81610f03565b8114610f2957600080fd5b50565b600081359050610f3b81610f15565b92915050565b610f4a81610c24565b8114610f5557600080fd5b50565b600081359050610f6781610f41565b92915050565b600080600060608486031215610f8657610f85610a28565b5b6000610f9486828701610f2c565b9350506020610fa586828701610f58565b925050604084013567ffffffffffffffff811115610fc657610fc5610a2d565b5b610fd286828701610b4a565b9150509250925092565b600060608284031215610ff257610ff1610cb4565b5b81905092915050565b60008060008060006080868803121561101757611016610a28565b5b600086013567ffffffffffffffff81111561103557611034610a2d565b5b61104188828901610fdc565b955050602061105288828901610ec1565b945050604061106388828901610f58565b935050606086013567ffffffffffffffff81111561108457611083610a2d565b5b61109088828901610d4a565b92509250509295509295909350565b60008115159050919050565b6110b48161109f565b82525050565b60006020820190506110cf60008301846110ab565b92915050565b600067ffffffffffffffff8211156110f0576110ef610a4d565b5b6110f982610a3c565b9050602081019050919050565b6000611119611114846110d5565b610aad565b90508281526020810184848401111561113557611134610a37565b5b611140848285610af9565b509392505050565b600082601f83011261115d5761115c610a32565b5b813561116d848260208601611106565b91505092915050565b60006020828403121561118c5761118b610a28565b5b600082013567ffffffffffffffff8111156111aa576111a9610a2d565b5b6111b684828501611148565b91505092915050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126111eb576111ea6111bf565b5b80840192508235915067ffffffffffffffff82111561120d5761120c6111c4565b5b602083019250600182023603831315611229576112286111c9565b5b509250929050565b600082825260208201905092915050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b6000611278601683611231565b915061128382611242565b602082019050919050565b600060208201905081810360008301526112a78161126b565b9050919050565b600081905092915050565b60006112c583856112ae565b93506112d2838584610af9565b82840190509392505050565b60006112eb8284866112b9565b91508190509392505050565b600081519050919050565b600081905092915050565b6000611318826112f7565b6113228185611302565b9350611332818560208601610e1c565b80840191505092915050565b600061134a828461130d565b915081905092915050565b600060608201905061136a6000830186610c8a565b6113776020830185610c8a565b6113846040830184610c2e565b949350505050565b6113958161109f565b81146113a057600080fd5b50565b6000815190506113b28161138c565b92915050565b6000602082840312156113ce576113cd610a28565b5b60006113dc848285016113a3565b91505092915050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b600061141b600683611302565b9150611426826113e5565b600682019050919050565b600061143c8261140e565b915081905091905056fea264697066735822122046fb444f8c754142359339f5f1d728822414688169d0d22f23bd25c688c73fdf64736f6c634300080a0033" + "bin": "608060405234801561001057600080fd5b5061150a806100206000396000f3fe6080604052600436106100c65760003560e01c8063a799911f1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063a799911f146101f9578063c234fecf14610215578063c7a339a91461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a777146101385780635ac1e07014610163578063676cc0541461018c5780639291fe26146101bc576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610de7565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610d02565b610371565b60405161012f9190611173565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a91906110c4565b60405180910390f35b34801561016f57600080fd5b5061018a60048036038101906101859190610e90565b6103ad565b005b6101a660048036038101906101a19190610e30565b6104e7565b6040516101b39190611131565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190610de7565b61069c565b6040516101f09190611173565b60405180910390f35b610213600480360381019061020e9190610de7565b6106df565b005b34801561022157600080fd5b5061023c60048036038101906102379190610ca8565b610708565b005b34801561024a57600080fd5b5061026560048036038101906102609190610d78565b61074b565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ed9565b61080e565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610d02565b610907565b6040516102c49190611116565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610de7565b610927565b6040516103019190611116565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190610d2f565b610977565b60405161033e91906110c4565b60405180910390f35b610350816109c0565b1561035a57600080fd5b61036381610a16565b61036e816000610a6a565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104088180606001906103c0919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61046581806060019061041b919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a6a565b8060000160208101906104789190610ca8565b600282806060019061048a919061118e565b60405161049892919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906105339190610ca8565b73ffffffffffffffffffffffffffffffffffffffff1614610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058090611153565b60405180910390fd5b6105d683838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61062483838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505034610a6a565b8360000160208101906106379190610ca8565b6002848460405161064992919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060036000836040516020016106b39190611098565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6106e8816109c0565b156106f257600080fd5b6106fb81610a16565b6107058134610a6a565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610754816109c0565b1561075e57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161079b939291906110df565b602060405180830381600087803b1580156107b557600080fd5b505af11580156107c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ed9190610cd5565b6107f657600080fd5b6107ff81610a16565b6108098183610a6a565b505050565b61085b82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109c0565b1561086557600080fd5b6108b282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61090082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610a6a565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000600160008360405160200161093e9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109d1906110af565b60405160208183030381529060405280519060200120826040516020016109f89190611098565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a2c9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a809190611098565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000610abf610aba84611216565b6111f1565b905082815260208101848484011115610adb57610ada6113ef565b5b610ae684828561132a565b509392505050565b6000610b01610afc84611247565b6111f1565b905082815260208101848484011115610b1d57610b1c6113ef565b5b610b2884828561132a565b509392505050565b600081359050610b3f81611461565b92915050565b600081519050610b5481611478565b92915050565b600081359050610b698161148f565b92915050565b60008083601f840112610b8557610b846113d1565b5b8235905067ffffffffffffffff811115610ba257610ba16113cc565b5b602083019150836001820283011115610bbe57610bbd6113e5565b5b9250929050565b600082601f830112610bda57610bd96113d1565b5b8135610bea848260208601610aac565b91505092915050565b600081359050610c02816114a6565b92915050565b600082601f830112610c1d57610c1c6113d1565b5b8135610c2d848260208601610aee565b91505092915050565b600060208284031215610c4c57610c4b6113db565b5b81905092915050565b600060808284031215610c6b57610c6a6113db565b5b81905092915050565b600060608284031215610c8a57610c896113db565b5b81905092915050565b600081359050610ca2816114bd565b92915050565b600060208284031215610cbe57610cbd6113f9565b5b6000610ccc84828501610b30565b91505092915050565b600060208284031215610ceb57610cea6113f9565b5b6000610cf984828501610b45565b91505092915050565b600060208284031215610d1857610d176113f9565b5b6000610d2684828501610b5a565b91505092915050565b600060208284031215610d4557610d446113f9565b5b600082013567ffffffffffffffff811115610d6357610d626113f4565b5b610d6f84828501610bc5565b91505092915050565b600080600060608486031215610d9157610d906113f9565b5b6000610d9f86828701610bf3565b9350506020610db086828701610c93565b925050604084013567ffffffffffffffff811115610dd157610dd06113f4565b5b610ddd86828701610c08565b9150509250925092565b600060208284031215610dfd57610dfc6113f9565b5b600082013567ffffffffffffffff811115610e1b57610e1a6113f4565b5b610e2784828501610c08565b91505092915050565b600080600060408486031215610e4957610e486113f9565b5b6000610e5786828701610c36565b935050602084013567ffffffffffffffff811115610e7857610e776113f4565b5b610e8486828701610b6f565b92509250509250925092565b600060208284031215610ea657610ea56113f9565b5b600082013567ffffffffffffffff811115610ec457610ec36113f4565b5b610ed084828501610c55565b91505092915050565b600080600080600060808688031215610ef557610ef46113f9565b5b600086013567ffffffffffffffff811115610f1357610f126113f4565b5b610f1f88828901610c74565b9550506020610f3088828901610b30565b9450506040610f4188828901610c93565b935050606086013567ffffffffffffffff811115610f6257610f616113f4565b5b610f6e88828901610b6f565b92509250509295509295909350565b610f86816112c6565b82525050565b610f95816112d8565b82525050565b6000610fa7838561129f565b9350610fb483858461132a565b82840190509392505050565b6000610fcb82611278565b610fd5818561128e565b9350610fe5818560208601611339565b610fee816113fe565b840191505092915050565b600061100482611283565b61100e81856112bb565b935061101e818560208601611339565b80840191505092915050565b60006110376016836112aa565b91506110428261140f565b602082019050919050565b600061105a6006836112bb565b915061106582611438565b600682019050919050565b61107981611320565b82525050565b600061108c828486610f9b565b91508190509392505050565b60006110a48284610ff9565b915081905092915050565b60006110ba8261104d565b9150819050919050565b60006020820190506110d96000830184610f7d565b92915050565b60006060820190506110f46000830186610f7d565b6111016020830185610f7d565b61110e6040830184611070565b949350505050565b600060208201905061112b6000830184610f8c565b92915050565b6000602082019050818103600083015261114b8184610fc0565b905092915050565b6000602082019050818103600083015261116c8161102a565b9050919050565b60006020820190506111886000830184611070565b92915050565b600080833560016020038436030381126111ab576111aa6113e0565b5b80840192508235915067ffffffffffffffff8211156111cd576111cc6113d6565b5b6020830192506001820236038313156111e9576111e86113ea565b5b509250929050565b60006111fb61120c565b9050611207828261136c565b919050565b6000604051905090565b600067ffffffffffffffff8211156112315761123061139d565b5b61123a826113fe565b9050602081019050919050565b600067ffffffffffffffff8211156112625761126161139d565b5b61126b826113fe565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006112d182611300565b9050919050565b60008115159050919050565b6000819050919050565b60006112f9826112c6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561135757808201518184015260208101905061133c565b83811115611366576000848401525b50505050565b611375826113fe565b810181811067ffffffffffffffff821117156113945761139361139d565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61146a816112c6565b811461147557600080fd5b50565b611481816112d8565b811461148c57600080fd5b50565b611498816112e4565b81146114a357600080fd5b50565b6114af816112ee565b81146114ba57600080fd5b50565b6114c681611320565b81146114d157600080fd5b5056fea2646970667358221220e090c5cd81361f8bba5d13d4fb801ab148714dad774e12a4acf812e341dc93c564736f6c63430008070033" } diff --git a/pkg/contracts/testdappv2/TestDAppV2.sol b/pkg/contracts/testdappv2/TestDAppV2.sol index 431ccf417d..5f301a08cf 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.sol +++ b/pkg/contracts/testdappv2/TestDAppV2.sol @@ -13,10 +13,12 @@ contract TestDAppV2 { } /// @notice Struct containing revert context passed to onRevert. + /// @param sender Address of account that initiated smart contract call. /// @param asset Address of asset, empty if it's gas token. /// @param amount Amount specified with the transaction. /// @param revertMessage Arbitrary data sent back in onRevert. struct RevertContext { + address sender; address asset; uint64 amount; bytes revertMessage; @@ -100,6 +102,7 @@ contract TestDAppV2 { function onRevert(RevertContext calldata revertContext) external { setCalledWithMessage(string(revertContext.revertMessage)); setAmountWithMessage(string(revertContext.revertMessage), 0); + senderWithMessage[revertContext.revertMessage] = revertContext.sender; } function setExpectedOnCallSender(address _expectedOnCallSender) external { diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index e7cd2bfe09..d2de2b7a98 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -418,17 +418,17 @@ func (_m *CrosschainFungibleKeeper) GetUniswapV2Router02Address(ctx types.Contex return r0, r1 } -// ProcessV2RevertDeposit provides a mock function with given fields: ctx, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage -func (_m *CrosschainFungibleKeeper) ProcessV2RevertDeposit(ctx types.Context, amount *big.Int, chainID int64, coinType coin.CoinType, asset string, revertAddress common.Address, callOnRevert bool, revertMessage []byte) error { - ret := _m.Called(ctx, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage) +// ProcessV2RevertDeposit provides a mock function with given fields: ctx, inboundSender, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage +func (_m *CrosschainFungibleKeeper) ProcessV2RevertDeposit(ctx types.Context, inboundSender string, amount *big.Int, chainID int64, coinType coin.CoinType, asset string, revertAddress common.Address, callOnRevert bool, revertMessage []byte) error { + ret := _m.Called(ctx, inboundSender, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage) if len(ret) == 0 { panic("no return value specified for ProcessV2RevertDeposit") } var r0 error - if rf, ok := ret.Get(0).(func(types.Context, *big.Int, int64, coin.CoinType, string, common.Address, bool, []byte) error); ok { - r0 = rf(ctx, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage) + if rf, ok := ret.Get(0).(func(types.Context, string, *big.Int, int64, coin.CoinType, string, common.Address, bool, []byte) error); ok { + r0 = rf(ctx, inboundSender, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage) } else { r0 = ret.Error(0) } diff --git a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go index d788e60fe0..17c848613a 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -341,6 +341,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT // process the revert on ZEVM if err := k.fungibleKeeper.ProcessV2RevertDeposit( ctx, + cctx.InboundParams.Sender, cctx.GetCurrentOutboundParam().Amount.BigInt(), chainID, cctx.InboundParams.CoinType, diff --git a/x/crosschain/keeper/gas_payment.go b/x/crosschain/keeper/gas_payment.go index d0bd4921df..ed1417b405 100644 --- a/x/crosschain/keeper/gas_payment.go +++ b/x/crosschain/keeper/gas_payment.go @@ -121,6 +121,12 @@ func (k Keeper) PayGasNativeAndUpdateCctx( return cosmoserrors.Wrap(types.ErrCannotFindGasParams, err.Error()) } + // with V2 protocol, reverts on connected chains can eventually call a onRevert function which can require a higher gas limit + if cctx.ProtocolContractVersion == types.ProtocolContractVersion_V2 && cctx.RevertOptions.CallOnRevert && + !cctx.RevertOptions.RevertGasLimit.IsZero() { + gas.GasLimit = cctx.RevertOptions.RevertGasLimit + } + // calculate the final gas fee outTxGasFee := gas.GasLimit.Mul(gas.GasPrice).Add(gas.ProtocolFlatFee) diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index c1bc41bdf2..140c9b2db2 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -149,6 +149,7 @@ type FungibleKeeper interface { ) (*evmtypes.MsgEthereumTxResponse, bool, error) ProcessV2RevertDeposit( ctx sdk.Context, + inboundSender string, amount *big.Int, chainID int64, coinType coin.CoinType, diff --git a/x/fungible/keeper/v2_deposits.go b/x/fungible/keeper/v2_deposits.go index 16001d2f58..812f2c0b81 100644 --- a/x/fungible/keeper/v2_deposits.go +++ b/x/fungible/keeper/v2_deposits.go @@ -49,6 +49,7 @@ func (k Keeper) ProcessV2Deposit( // ProcessV2RevertDeposit handles a revert deposit from an inbound tx with protocol version 2 func (k Keeper) ProcessV2RevertDeposit( ctx sdk.Context, + inboundSender string, amount *big.Int, chainID int64, coinType coin.CoinType, @@ -74,7 +75,7 @@ func (k Keeper) ProcessV2RevertDeposit( if callOnRevert { // no asset, call simple revert - _, err := k.CallExecuteRevert(ctx, zrc20Addr, amount, revertAddress, revertMessage) + _, err := k.CallExecuteRevert(ctx, inboundSender, zrc20Addr, amount, revertAddress, revertMessage) return err } else { // no asset, no call, do nothing @@ -87,6 +88,7 @@ func (k Keeper) ProcessV2RevertDeposit( // revert with a ZRC20 asset _, err := k.CallDepositAndRevert( ctx, + inboundSender, zrc20Addr, amount, revertAddress, diff --git a/x/fungible/keeper/v2_evm.go b/x/fungible/keeper/v2_evm.go index 364c857bdc..4f76606151 100644 --- a/x/fungible/keeper/v2_evm.go +++ b/x/fungible/keeper/v2_evm.go @@ -153,6 +153,7 @@ func (k Keeper) CallExecute( // ) func (k Keeper) CallExecuteRevert( ctx sdk.Context, + inboundSender string, zrc20 common.Address, amount *big.Int, target common.Address, @@ -184,6 +185,7 @@ func (k Keeper) CallExecuteRevert( "executeRevert", target, revert.RevertContext{ + Sender: common.HexToAddress(inboundSender), Asset: zrc20, Amount: amount.Uint64(), RevertMessage: message, @@ -203,6 +205,7 @@ func (k Keeper) CallExecuteRevert( // ) func (k Keeper) CallDepositAndRevert( ctx sdk.Context, + inboundSender string, zrc20 common.Address, amount *big.Int, target common.Address, @@ -236,6 +239,7 @@ func (k Keeper) CallDepositAndRevert( amount, target, revert.RevertContext{ + Sender: common.HexToAddress(inboundSender), Asset: zrc20, Amount: amount.Uint64(), RevertMessage: message, diff --git a/zetaclient/chains/evm/signer/v2_sign.go b/zetaclient/chains/evm/signer/v2_sign.go index 81702d2aba..510c0e2a4d 100644 --- a/zetaclient/chains/evm/signer/v2_sign.go +++ b/zetaclient/chains/evm/signer/v2_sign.go @@ -66,6 +66,7 @@ func (signer *Signer) signGatewayExecute( // bytes calldata data func (signer *Signer) signGatewayExecuteRevert( ctx context.Context, + inboundSender string, txData *OutboundData, ) (*ethtypes.Transaction, error) { gatewayABI, err := gatewayevm.GatewayEVMMetaData.GetAbi() @@ -78,6 +79,7 @@ func (signer *Signer) signGatewayExecuteRevert( txData.to, txData.message, revert.RevertContext{ + Sender: common.HexToAddress(inboundSender), Asset: txData.asset, Amount: txData.amount.Uint64(), RevertMessage: txData.revertOptions.RevertMessage, @@ -182,6 +184,7 @@ func (signer *Signer) signERC20CustodyWithdrawAndCall( // bytes calldata data func (signer *Signer) signERC20CustodyWithdrawRevert( ctx context.Context, + inboundSender string, txData *OutboundData, ) (*ethtypes.Transaction, error) { erc20CustodyV2ABI, err := erc20custodyv2.ERC20CustodyMetaData.GetAbi() @@ -196,6 +199,7 @@ func (signer *Signer) signERC20CustodyWithdrawRevert( txData.amount, txData.message, revert.RevertContext{ + Sender: common.HexToAddress(inboundSender), Asset: txData.asset, Amount: txData.amount.Uint64(), RevertMessage: txData.revertOptions.RevertMessage, diff --git a/zetaclient/chains/evm/signer/v2_signer.go b/zetaclient/chains/evm/signer/v2_signer.go index b3a06a19c2..e687454b3b 100644 --- a/zetaclient/chains/evm/signer/v2_signer.go +++ b/zetaclient/chains/evm/signer/v2_signer.go @@ -29,9 +29,9 @@ func (signer *Signer) SignOutboundFromCCTXV2( // no-asset call simply hash msg.value == 0 return signer.signGatewayExecute(ctx, cctx.InboundParams.Sender, outboundData) case evm.OutboundTypeGasWithdrawRevertAndCallOnRevert: - return signer.signGatewayExecuteRevert(ctx, outboundData) + return signer.signGatewayExecuteRevert(ctx, cctx.InboundParams.Sender, outboundData) case evm.OutboundTypeERC20WithdrawRevertAndCallOnRevert: - return signer.signERC20CustodyWithdrawRevert(ctx, outboundData) + return signer.signERC20CustodyWithdrawRevert(ctx, cctx.InboundParams.Sender, outboundData) } return nil, fmt.Errorf("unsupported outbound type %d", outboundType) }