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

fix!: tolerate v2 contracts in tss migration tests #3002

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 3 additions & 2 deletions e2e/runner/admin_evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ func (r *E2ERunner) UpdateTssAddressForConnector() {
func (r *E2ERunner) UpdateTssAddressForErc20custody() {
require.NoError(r, r.SetTSSAddresses())

tx, err := r.ERC20Custody.UpdateTSSAddress(r.EVMAuth, r.TSSAddress)
tx, err := r.ERC20CustodyV2.UpdateTSSAddress(r.EVMAuth, r.TSSAddress)
require.NoError(r, err)
r.Logger.Info(fmt.Sprintf("TSS ERC20 Address Update Tx: %s", tx.Hash().String()))
receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout)
utils.RequireTxSuccessful(r, receipt)

tssAddressOnCustody, err := r.ERC20Custody.TSSAddress(&bind.CallOpts{Context: r.Ctx})
// we have to reference ERC20CustodyV2 since it's `TssAddress` on v2 and `TSSAddress` on v1
tssAddressOnCustody, err := r.ERC20CustodyV2.TssAddress(&bind.CallOpts{Context: r.Ctx})
require.NoError(r, err)
require.Equal(r, r.TSSAddress, tssAddressOnCustody)
}
20 changes: 16 additions & 4 deletions e2e/utils/require.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,27 @@ func RequireCCTXStatus(
// RequireTxSuccessful checks if the receipt status is successful.
// Currently, it accepts eth receipt, but we can make this more generic by using type assertion.
func RequireTxSuccessful(t require.TestingT, receipt *ethtypes.Receipt, msgAndArgs ...any) {
msg := "receipt status is not successful"
require.Equal(t, ethtypes.ReceiptStatusSuccessful, receipt.Status, msg+errSuffix(msgAndArgs...))
msg := "receipt status is not successful: %s"
require.Equal(
t,
ethtypes.ReceiptStatusSuccessful,
receipt.Status,
msg+errSuffix(msgAndArgs...),
receipt.TxHash.String(),
)
}

// RequiredTxFailed checks if the receipt status is failed.
// Currently, it accepts eth receipt, but we can make this more generic by using type assertion.
func RequiredTxFailed(t require.TestingT, receipt *ethtypes.Receipt, msgAndArgs ...any) {
msg := "receipt status is not successful"
require.Equal(t, ethtypes.ReceiptStatusFailed, receipt.Status, msg+errSuffix(msgAndArgs...))
msg := "receipt status is not successful: %s"
require.Equal(
t,
ethtypes.ReceiptStatusFailed,
receipt.Status,
msg+errSuffix(msgAndArgs...),
receipt.TxHash.String(),
)
skosito marked this conversation as resolved.
Show resolved Hide resolved
}

func errSuffix(msgAndArgs ...any) string {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ require (
github.com/stretchr/testify v1.9.0
github.com/zeta-chain/ethermint v0.0.0-20241010181243-044e22bdb7e7
github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240924201108-3a274ce7bad0
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241009160411-475acfac26ef
gitlab.com/thorchain/tss/go-tss v1.6.5
go.nhat.io/grpcmock v0.25.0
golang.org/x/crypto v0.23.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4208,8 +4208,8 @@ github.com/zeta-chain/go-tss v0.0.0-20240916173049-89fee4b0ae7f h1:XqUvw9a3EnDa2
github.com/zeta-chain/go-tss v0.0.0-20240916173049-89fee4b0ae7f/go.mod h1:B1FDE6kHs8hozKSX1/iXgCdvlFbS6+FeAupoBHDK0Cc=
github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138 h1:vck/FcIIpFOvpBUm0NO17jbEtmSz/W/a5Y4jRuSJl6I=
github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138/go.mod h1:U494OsZTWsU75hqoriZgMdSsgSGP1mUL1jX+wN/Aez8=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240924201108-3a274ce7bad0 h1:GbfO2dyjSAWqBH0xDIttwPB2fE5A+zw0UUbEoW3S3wU=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240924201108-3a274ce7bad0/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241009160411-475acfac26ef h1:tfF31iib7rTeBLGrvWMbW2HM6omkzPDjsX8QM2VY6a4=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241009160411-475acfac26ef/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w=
github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901 h1:9whtN5fjYHfk4yXIuAsYP2EHxImwDWDVUOnZJ2pfL3w=
github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901/go.mod h1:d2iTC62s9JwKiCMPhcDDXbIZmuzAyJ4lwso0H5QyRbk=
github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
Expand Down
4 changes: 2 additions & 2 deletions x/fungible/keeper/v2_evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (k Keeper) CallExecuteRevert(
revert.RevertContext{
Sender: common.HexToAddress(inboundSender),
Asset: zrc20,
Amount: amount.Uint64(),
Amount: amount,
RevertMessage: message,
},
)
Expand Down Expand Up @@ -241,7 +241,7 @@ func (k Keeper) CallDepositAndRevert(
revert.RevertContext{
Sender: common.HexToAddress(inboundSender),
Asset: zrc20,
Amount: amount.Uint64(),
Amount: amount,
RevertMessage: message,
},
)
Expand Down
4 changes: 2 additions & 2 deletions zetaclient/chains/evm/signer/v2_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (signer *Signer) signGatewayExecuteRevert(
revert.RevertContext{
Sender: common.HexToAddress(inboundSender),
Asset: txData.asset,
Amount: txData.amount.Uint64(),
Amount: txData.amount,
RevertMessage: txData.revertOptions.RevertMessage,
},
)
Expand Down Expand Up @@ -201,7 +201,7 @@ func (signer *Signer) signERC20CustodyWithdrawRevert(
revert.RevertContext{
Sender: common.HexToAddress(inboundSender),
Asset: txData.asset,
Amount: txData.amount.Uint64(),
Amount: txData.amount,
RevertMessage: txData.revertOptions.RevertMessage,
},
)
Expand Down
Loading