-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: backport for v26 onRevert CCTX and Solana withdraw fixes (#3380)
* update contracts * add revert and withdraw test * add tx response to revert deposit * process withdraw * tests * add withdraw and revert check in test * comment lint * add tests back * update changelog * add unit tests * fix test * update condition * remove minimum rent exempt check for SPL tokens * lower default SPL withdraw amount in E2E to ensure min rent exempt is not checked * add changelog entry * add comment to explain why rent exempt check is only applied to Solana gas token * changelog * update old version * add liquidity cap to message * update messages and tests * fix e2e tests * changelog * fix tests * proto add new chain types * add new chains * changelog * Revert "fix tests" This reverts commit 8e37fd0. * Revert "fix e2e tests" This reverts commit c27fc1d. * Revert "update messages and tests" This reverts commit 159af85. * Revert "add liquidity cap to message" This reverts commit 748eec1. --------- Co-authored-by: Charlie Chen <[email protected]>
- Loading branch information
1 parent
4a04d96
commit 178398a
Showing
25 changed files
with
792 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
e2e/e2etests/test_eth_withdraw_and_call_revert_with_withdraw.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package e2etests | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/stretchr/testify/require" | ||
"github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayzevm.sol" | ||
|
||
"github.com/zeta-chain/node/e2e/runner" | ||
"github.com/zeta-chain/node/e2e/utils" | ||
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" | ||
) | ||
|
||
func TestETHWithdrawAndCallRevertWithWithdraw(r *runner.E2ERunner, args []string) { | ||
require.Len(r, args, 1) | ||
|
||
amount := utils.ParseBigInt(r, args[0]) | ||
|
||
r.ApproveETHZRC20(r.GatewayZEVMAddr) | ||
|
||
// perform the withdraw | ||
tx := r.ETHWithdrawAndArbitraryCall( | ||
r.TestDAppV2EVMAddr, | ||
amount, | ||
r.EncodeGasCall("revert"), | ||
gatewayzevm.RevertOptions{ | ||
RevertAddress: r.TestDAppV2ZEVMAddr, | ||
CallOnRevert: true, | ||
RevertMessage: []byte("withdraw"), // call withdraw in the onRevert hook | ||
OnRevertGasLimit: big.NewInt(0), | ||
}, | ||
) | ||
|
||
// wait for the cctx to be mined | ||
cctxRevert := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) | ||
r.Logger.CCTX(*cctxRevert, "withdraw") | ||
require.Equal(r, crosschaintypes.CctxStatus_Reverted, cctxRevert.CctxStatus.Status) | ||
|
||
cctxWithdrawFromRevert := utils.WaitCctxMinedByInboundHash( | ||
r.Ctx, | ||
cctxRevert.Index, | ||
r.CctxClient, | ||
r.Logger, | ||
r.CctxTimeout, | ||
) | ||
|
||
// check the cctx status | ||
utils.RequireCCTXStatus(r, cctxWithdrawFromRevert, crosschaintypes.CctxStatus_OutboundMined) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.