-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: abort cctx on dust amount in revert outbound (Bitcoin and Solana) (
#3149) * fix dust amount for revert case in Bitcoin and Solana * add changelog entry for the fix * verify dust amount in the CCTX revert outbound * add error message check for aborted CCTX caused by dust amount * Update changelog.md Co-authored-by: Tanmay <[email protected]> --------- Co-authored-by: Tanmay <[email protected]>
- Loading branch information
1 parent
07120f1
commit 420f83a
Showing
8 changed files
with
95 additions
and
25 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
34 changes: 34 additions & 0 deletions
34
e2e/e2etests/test_solana_deposit_and_call_revert_with_dust.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,34 @@ | ||
package e2etests | ||
|
||
import ( | ||
"math/big" | ||
"strings" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/zeta-chain/node/e2e/runner" | ||
"github.com/zeta-chain/node/e2e/utils" | ||
"github.com/zeta-chain/node/pkg/constant" | ||
"github.com/zeta-chain/node/testutil/sample" | ||
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" | ||
) | ||
|
||
// TestSolanaDepositAndCallRevertWithDust tests Solana deposit and call that reverts with a dust amount in the revert outbound. | ||
func TestSolanaDepositAndCallRevertWithDust(r *runner.E2ERunner, args []string) { | ||
require.Len(r, args, 0) | ||
|
||
// deposit the rent exempt amount which will result in a dust amount (after fee deduction) in the revert outbound | ||
depositAmount := big.NewInt(constant.SolanaWalletRentExempt) | ||
|
||
// ACT | ||
// execute the deposit and call transaction | ||
nonExistReceiver := sample.EthAddress() | ||
data := []byte("dust lamports should abort cctx") | ||
sig := r.SOLDepositAndCall(nil, nonExistReceiver, depositAmount, data) | ||
|
||
// ASSERT | ||
// Now we want to make sure cctx is aborted. | ||
cctx := utils.WaitCctxAbortedByInboundHash(r.Ctx, r, sig.String(), r.CctxClient) | ||
require.True(r, cctx.GetCurrentOutboundParam().Amount.Uint64() < constant.SolanaWalletRentExempt) | ||
require.True(r, strings.Contains(cctx.CctxStatus.ErrorMessage, crosschaintypes.ErrInvalidWithdrawalAmount.Error())) | ||
} |
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