From d738330d8577525559f75ca7ea46e59a7b6a9588 Mon Sep 17 00:00:00 2001 From: Charlie Chen Date: Thu, 6 Jun 2024 15:55:09 -0500 Subject: [PATCH 1/2] renamed BtcDustOffset as BtcNonceMarkOffset and created constant BTCWithdrawalDustAmount --- pkg/chains/chains.go | 3 ++- pkg/chains/conversion.go | 2 +- pkg/constant/constant.go | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/chains/chains.go b/pkg/chains/chains.go index 61fffece76..11c6f952f0 100644 --- a/pkg/chains/chains.go +++ b/pkg/chains/chains.go @@ -265,7 +265,8 @@ var ( } ) -func BtcDustOffset() int64 { +// BtcNonceMarkOffset is the offset satoshi amount to calculate the nonce mark output +func BtcNonceMarkOffset() int64 { return 2000 } diff --git a/pkg/chains/conversion.go b/pkg/chains/conversion.go index 6a6a6f4091..200061c3ae 100644 --- a/pkg/chains/conversion.go +++ b/pkg/chains/conversion.go @@ -11,7 +11,7 @@ import ( // A very special value to mark current nonce in UTXO func NonceMarkAmount(nonce uint64) int64 { // #nosec G701 always in range - return int64(nonce) + BtcDustOffset() // +2000 to avoid being a dust rejection + return int64(nonce) + BtcNonceMarkOffset() } // HashToString convert hash bytes to string diff --git a/pkg/constant/constant.go b/pkg/constant/constant.go index 9a81e1d8b2..62f898e85d 100644 --- a/pkg/constant/constant.go +++ b/pkg/constant/constant.go @@ -10,4 +10,7 @@ const ( // CmdMigrateTssFunds is used for CCTX of type cmd to give the instruction to the TSS to transfer its funds on a new address CmdMigrateTssFunds = "cmd_migrate_tss_funds" + + // BTCWithdrawalDustAmount is the minimum satoshis that can be withdrawn from zEVM to avoid outbound dust output + BTCWithdrawalDustAmount = 1000 ) From 1d3a2e9ef7d0ebb15ab8280deac4168eb52e8ac6 Mon Sep 17 00:00:00 2001 From: Charlie Chen Date: Fri, 7 Jun 2024 12:29:07 -0500 Subject: [PATCH 2/2] added changelog entry --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 598ce8dd6a..d95e8af05c 100644 --- a/changelog.md +++ b/changelog.md @@ -64,6 +64,7 @@ * [2233](https://github.com/zeta-chain/node/pull/2233) - fix `IsSupported` flag not properly updated in zetaclient's context * [2243](https://github.com/zeta-chain/node/pull/2243) - fix incorrect bitcoin outbound height in the CCTX outbound parameter * [2256](https://github.com/zeta-chain/node/pull/2256) - fix rate limiter falsely included reverted non-withdraw cctxs +* [2327](https://github.com/zeta-chain/node/pull/2327) - partially cherry picked the fix to Bitcoin outbound dust amount ### CI