-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat-observe-blob-transaction
- Loading branch information
Showing
15 changed files
with
1,005 additions
and
76 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
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,45 @@ | ||
package e2etests | ||
|
||
import ( | ||
"fmt" | ||
"math/big" | ||
|
||
"github.com/btcsuite/btcutil" | ||
"github.com/zeta-chain/zetacore/e2e/runner" | ||
"github.com/zeta-chain/zetacore/e2e/utils" | ||
) | ||
|
||
func TestBitcoinWithdrawToInvalidAddress(r *runner.E2ERunner) { | ||
WithdrawToInvalidAddress(r) | ||
} | ||
|
||
func WithdrawToInvalidAddress(r *runner.E2ERunner) { | ||
|
||
amount := big.NewInt(0.00001 * btcutil.SatoshiPerBitcoin) | ||
approvalAmount := 1000000000000000000 | ||
// approve the ZRC20 contract to spend approvalAmount BTC from the deployer address. | ||
// the actual amount transferred is 0.00001 BTC, but we approve more to cover withdraw fee | ||
tx, err := r.BTCZRC20.Approve(r.ZevmAuth, r.BTCZRC20Addr, big.NewInt(int64(approvalAmount))) | ||
if err != nil { | ||
panic(err) | ||
} | ||
receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) | ||
if receipt.Status != 1 { | ||
panic(fmt.Errorf("approve receipt status is not 1")) | ||
} | ||
|
||
// mine blocks | ||
stop := r.MineBlocks() | ||
|
||
// withdraw 0.00001 BTC from ZRC20 to BTC legacy address | ||
tx, err = r.BTCZRC20.Withdraw(r.ZevmAuth, []byte("1EYVvXLusCxtVuEwoYvWRyN5EZTXwPVvo3"), amount) | ||
if err != nil { | ||
panic(err) | ||
} | ||
receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) | ||
if receipt.Status == 1 { | ||
panic(fmt.Errorf("withdraw receipt status is successful for an invalid BTC address")) | ||
} | ||
// stop mining | ||
stop <- struct{}{} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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.