Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support advanced abort workflow (onAbort) #3414

Merged
merged 48 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b7a5010
some file renaming
lumtis Jan 24, 2025
59f7331
update protocol contracts
lumtis Jan 24, 2025
f5db4b5
more renaming
lumtis Jan 24, 2025
6050784
add onAbort to test contract
lumtis Jan 24, 2025
cb893a3
process abort
lumtis Jan 24, 2025
f181821
crosschain abort
lumtis Jan 24, 2025
a2ca86c
conflicts
lumtis Jan 28, 2025
950266e
generate
lumtis Jan 28, 2025
34600a0
small fix
lumtis Feb 5, 2025
031b771
add onAbort event parsing
lumtis Feb 5, 2025
fa516b6
Merge branch 'develop' into feat/crosschain-onabort
lumtis Feb 5, 2025
5a3a773
add abort error message
lumtis Feb 5, 2025
fe5ec79
Merge branch 'develop' into feat/crosschain-onabort
lumtis Feb 6, 2025
ee3e815
add process abort
lumtis Feb 6, 2025
5eb374e
changelog
lumtis Feb 12, 2025
d32b86a
rename abort refund function
lumtis Feb 12, 2025
e1f76b5
improve check
lumtis Feb 12, 2025
74e1518
generate
lumtis Feb 12, 2025
2b19d1f
conflicts
lumtis Feb 12, 2025
a21ce7d
add test contract for abort
lumtis Feb 12, 2025
7eb071e
iniialize first on abort test
lumtis Feb 12, 2025
615be3d
fix tx response parsing
lumtis Feb 12, 2025
e283bf0
get connected chain function
lumtis Feb 13, 2025
70f218b
fix eth deposit tests
lumtis Feb 13, 2025
b8f7d86
withdraw onAbort test
lumtis Feb 13, 2025
84364ea
fix test
lumtis Feb 13, 2025
c98ca0a
change tests
lumtis Feb 13, 2025
98fe706
conflicts
lumtis Feb 14, 2025
85e4ba4
logs change
lumtis Feb 14, 2025
adc7e64
modify logic to process abort for withdraw
lumtis Feb 14, 2025
0218efd
some code reorg
lumtis Feb 14, 2025
a554d0f
add erc20 tests
lumtis Feb 14, 2025
0a7b905
fix asset address
lumtis Feb 14, 2025
4d11fa2
fix address check
lumtis Feb 14, 2025
233e163
fix unit tests
lumtis Feb 14, 2025
0b8c524
add balance check in tests
lumtis Feb 14, 2025
69cbbc0
add all tests back
lumtis Feb 14, 2025
f74258b
add back logs processing
lumtis Feb 14, 2025
976f441
abort test
lumtis Feb 14, 2025
ba3326b
new comments
lumtis Feb 14, 2025
a9b2b5b
conflicts
lumtis Feb 14, 2025
b0f4a0e
Update x/crosschain/keeper/abort.go
lumtis Feb 14, 2025
53d95ac
set minimum version for new e2e tests
lumtis Feb 14, 2025
0b29452
Update changelog.md
lumtis Feb 14, 2025
19ad132
Update e2e/e2etests/test_eth_deposit_revert_and_abort.go
lumtis Feb 14, 2025
251d113
comments
lumtis Feb 17, 2025
310a533
remove useless balance check in e2e/e2etests/test_eth_deposit_and_cal…
lumtis Feb 17, 2025
262dd67
Merge branch 'develop' into feat/crosschain-onabort
lumtis Feb 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features

* [3414](https://github.com/zeta-chain/node/pull/3414) - support advanced abort workflow (onAbort)
* [3461](https://github.com/zeta-chain/node/pull/3461) - add new `ConfirmationParams` field to chain params to enable multiple confirmation count values, deprecating `confirmation_count`
* [3489](https://github.com/zeta-chain/node/pull/3489) - add Sui chain info
* [3455](https://github.com/zeta-chain/node/pull/3455) - add `track-cctx` command to zetatools
Expand Down
4 changes: 4 additions & 0 deletions cmd/zetae2e/local/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ func startEVMTests(eg *errgroup.Group, conf config.Config, deployerRunner *runne
e2etests.TestETHDepositName, // necessary to pay fees on ZEVM and withdraw
e2etests.TestETHDepositAndCallRevertName,
e2etests.TestETHDepositAndCallRevertWithCallName,
e2etests.TestETHDepositRevertAndAbortName,
e2etests.TestETHWithdrawAndCallRevertName,
e2etests.TestETHWithdrawAndCallRevertWithCallName,
e2etests.TestETHWithdrawRevertAndAbortName,
e2etests.TestETHWithdrawAndCallRevertWithWithdrawName,
e2etests.TestDepositAndCallOutOfGasName,
),
Expand All @@ -79,8 +81,10 @@ func startEVMTests(eg *errgroup.Group, conf config.Config, deployerRunner *runne
e2etests.TestOperationAddLiquidityERC20Name,
e2etests.TestERC20DepositAndCallRevertName,
e2etests.TestERC20DepositAndCallRevertWithCallName,
e2etests.TestERC20DepositRevertAndAbortName,
e2etests.TestERC20WithdrawAndCallRevertName,
e2etests.TestERC20WithdrawAndCallRevertWithCallName,
e2etests.TestERC20WithdrawRevertAndAbortName,
),
)
}
Expand Down
3 changes: 3 additions & 0 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60435,6 +60435,9 @@ definitions:
title: |-
error_message_revert carries information about the revert outbound tx ,
which is created if the first outbound tx fails
error_message_abort:
type: string
title: error_message_abort carries information when aborting the CCTX fails
zetacoreemissionsParams:
type: object
properties:
Expand Down
176 changes: 176 additions & 0 deletions e2e/contracts/testabort/TestAbort.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
[
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [],
"name": "aborted",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "abortedWithMessage",
"outputs": [
{
"internalType": "bytes",
"name": "sender",
"type": "bytes"
},
{
"internalType": "address",
"name": "asset",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "bool",
"name": "outgoing",
"type": "bool"
},
{
"internalType": "uint256",
"name": "chainID",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "revertMessage",
"type": "bytes"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "message",
"type": "string"
}
],
"name": "getAbortedWithMessage",
"outputs": [
{
"components": [
{
"internalType": "bytes",
"name": "sender",
"type": "bytes"
},
{
"internalType": "address",
"name": "asset",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "bool",
"name": "outgoing",
"type": "bool"
},
{
"internalType": "uint256",
"name": "chainID",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "revertMessage",
"type": "bytes"
}
],
"internalType": "struct AbortContext",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isAborted",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "bytes",
"name": "sender",
"type": "bytes"
},
{
"internalType": "address",
"name": "asset",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "bool",
"name": "outgoing",
"type": "bool"
},
{
"internalType": "uint256",
"name": "chainID",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "revertMessage",
"type": "bytes"
}
],
"internalType": "struct AbortContext",
"name": "abortContext",
"type": "tuple"
}
],
"name": "onAbort",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
1 change: 1 addition & 0 deletions e2e/contracts/testabort/TestAbort.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6080604052348015600f57600080fd5b506111c28061001f6000396000f3fe60806040526004361061004e5760003560e01c80632d4cfb7e1461005757806372748f7d1461008057806380b62b70146100c25780639e59f463146100ed578063fe4caa641461012a57610055565b3661005557005b005b34801561006357600080fd5b5061007e600480360381019061007991906106e2565b610155565b005b34801561008c57600080fd5b506100a760048036038101906100a29190610761565b6101bd565b6040516100b996959493929190610893565b60405180910390f35b3480156100ce57600080fd5b506100d7610336565b6040516100e49190610902565b60405180910390f35b3480156100f957600080fd5b50610114600480360381019061010f9190610a52565b610349565b6040516101219190610ba2565b60405180910390f35b34801561013657600080fd5b5061013f610544565b60405161014c9190610902565b60405180910390f35b6101ba818060a001906101689190610bd3565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826101b590610e3d565b61055b565b50565b60006020528060005260406000206000915090508060000180546101e090610e7f565b80601f016020809104026020016040519081016040528092919081815260200182805461020c90610e7f565b80156102595780601f1061022e57610100808354040283529160200191610259565b820191906000526020600020905b81548152906001019060200180831161023c57829003601f168201915b5050505050908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154908060030160009054906101000a900460ff16908060040154908060050180546102b390610e7f565b80601f01602080910402602001604051908101604052809291908181526020018280546102df90610e7f565b801561032c5780601f106103015761010080835404028352916020019161032c565b820191906000526020600020905b81548152906001019060200180831161030f57829003601f168201915b5050505050905086565b600160009054906101000a900460ff1681565b61035161065c565b600080836040516020016103659190610ef7565b6040516020818303038152906040528051906020012081526020019081526020016000206040518060c00160405290816000820180546103a490610e7f565b80601f01602080910402602001604051908101604052809291908181526020018280546103d090610e7f565b801561041d5780601f106103f25761010080835404028352916020019161041d565b820191906000526020600020905b81548152906001019060200180831161040057829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282015481526020016003820160009054906101000a900460ff16151515158152602001600482015481526020016005820180546104bb90610e7f565b80601f01602080910402602001604051908101604052809291908181526020018280546104e790610e7f565b80156105345780601f1061050957610100808354040283529160200191610534565b820191906000526020600020905b81548152906001019060200180831161051757829003601f168201915b5050505050815250509050919050565b6000600160009054906101000a900460ff16905090565b80600080846040516020016105709190610ef7565b60405160208183030381529060405280519060200120815260200190815260200160002060008201518160000190816105a991906110ba565b5060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040820151816002015560608201518160030160006101000a81548160ff0219169083151502179055506080820151816004015560a082015181600501908161063a91906110ba565b5090505060018060006101000a81548160ff0219169083151502179055505050565b6040518060c0016040528060608152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160001515815260200160008152602001606081525090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600060c082840312156106d9576106d86106be565b5b81905092915050565b6000602082840312156106f8576106f76106b4565b5b600082013567ffffffffffffffff811115610716576107156106b9565b5b610722848285016106c3565b91505092915050565b6000819050919050565b61073e8161072b565b811461074957600080fd5b50565b60008135905061075b81610735565b92915050565b600060208284031215610777576107766106b4565b5b60006107858482850161074c565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c85780820151818401526020810190506107ad565b60008484015250505050565b6000601f19601f8301169050919050565b60006107f08261078e565b6107fa8185610799565b935061080a8185602086016107aa565b610813816107d4565b840191505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006108498261081e565b9050919050565b6108598161083e565b82525050565b6000819050919050565b6108728161085f565b82525050565b60008115159050919050565b61088d81610878565b82525050565b600060c08201905081810360008301526108ad81896107e5565b90506108bc6020830188610850565b6108c96040830187610869565b6108d66060830186610884565b6108e36080830185610869565b81810360a08301526108f581846107e5565b9050979650505050505050565b60006020820190506109176000830184610884565b92915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61095f826107d4565b810181811067ffffffffffffffff8211171561097e5761097d610927565b5b80604052505050565b60006109916106aa565b905061099d8282610956565b919050565b600067ffffffffffffffff8211156109bd576109bc610927565b5b6109c6826107d4565b9050602081019050919050565b82818337600083830152505050565b60006109f56109f0846109a2565b610987565b905082815260208101848484011115610a1157610a10610922565b5b610a1c8482856109d3565b509392505050565b600082601f830112610a3957610a3861091d565b5b8135610a498482602086016109e2565b91505092915050565b600060208284031215610a6857610a676106b4565b5b600082013567ffffffffffffffff811115610a8657610a856106b9565b5b610a9284828501610a24565b91505092915050565b600082825260208201905092915050565b6000610ab78261078e565b610ac18185610a9b565b9350610ad18185602086016107aa565b610ada816107d4565b840191505092915050565b610aee8161083e565b82525050565b610afd8161085f565b82525050565b610b0c81610878565b82525050565b600060c0830160008301518482036000860152610b2f8282610aac565b9150506020830151610b446020860182610ae5565b506040830151610b576040860182610af4565b506060830151610b6a6060860182610b03565b506080830151610b7d6080860182610af4565b5060a083015184820360a0860152610b958282610aac565b9150508091505092915050565b60006020820190508181036000830152610bbc8184610b12565b905092915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112610bf057610bef610bc4565b5b80840192508235915067ffffffffffffffff821115610c1257610c11610bc9565b5b602083019250600182023603831315610c2e57610c2d610bce565b5b509250929050565b600080fd5b600080fd5b600067ffffffffffffffff821115610c5b57610c5a610927565b5b610c64826107d4565b9050602081019050919050565b6000610c84610c7f84610c40565b610987565b905082815260208101848484011115610ca057610c9f610922565b5b610cab8482856109d3565b509392505050565b600082601f830112610cc857610cc761091d565b5b8135610cd8848260208601610c71565b91505092915050565b610cea8161083e565b8114610cf557600080fd5b50565b600081359050610d0781610ce1565b92915050565b610d168161085f565b8114610d2157600080fd5b50565b600081359050610d3381610d0d565b92915050565b610d4281610878565b8114610d4d57600080fd5b50565b600081359050610d5f81610d39565b92915050565b600060c08284031215610d7b57610d7a610c36565b5b610d8560c0610987565b9050600082013567ffffffffffffffff811115610da557610da4610c3b565b5b610db184828501610cb3565b6000830152506020610dc584828501610cf8565b6020830152506040610dd984828501610d24565b6040830152506060610ded84828501610d50565b6060830152506080610e0184828501610d24565b60808301525060a082013567ffffffffffffffff811115610e2557610e24610c3b565b5b610e3184828501610cb3565b60a08301525092915050565b6000610e493683610d65565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610e9757607f821691505b602082108103610eaa57610ea9610e50565b5b50919050565b600081519050919050565b600081905092915050565b6000610ed182610eb0565b610edb8185610ebb565b9350610eeb8185602086016107aa565b80840191505092915050565b6000610f038284610ec6565b915081905092915050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302610f707fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610f33565b610f7a8683610f33565b95508019841693508086168417925050509392505050565b6000819050919050565b6000610fb7610fb2610fad8461085f565b610f92565b61085f565b9050919050565b6000819050919050565b610fd183610f9c565b610fe5610fdd82610fbe565b848454610f40565b825550505050565b600090565b610ffa610fed565b611005818484610fc8565b505050565b5b818110156110295761101e600082610ff2565b60018101905061100b565b5050565b601f82111561106e5761103f81610f0e565b61104884610f23565b81016020851015611057578190505b61106b61106385610f23565b83018261100a565b50505b505050565b600082821c905092915050565b600061109160001984600802611073565b1980831691505092915050565b60006110aa8383611080565b9150826002028217905092915050565b6110c38261078e565b67ffffffffffffffff8111156110dc576110db610927565b5b6110e68254610e7f565b6110f182828561102d565b600060209050601f8311600181146111245760008415611112578287015190505b61111c858261109e565b865550611184565b601f19841661113286610f0e565b60005b8281101561115a57848901518255600182019150602085019450602081019050611135565b868310156111775784890151611173601f891682611080565b8355505b6001600288020188555050505b50505050505056fea264697066735822122073b672b76653cfb3aa192e6bbbea81b40276e37f9ae4e034167d2012fb55ebaa64736f6c634300081a0033
Loading
Loading