Skip to content

Commit

Permalink
Merge branch 'develop' into cherry-pick-athens3-solana-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie authored Dec 6, 2024
2 parents 2463828 + bc1d8ae commit bf28edf
Show file tree
Hide file tree
Showing 18 changed files with 367 additions and 69 deletions.
2 changes: 2 additions & 0 deletions e2e/e2etests/test_deploy_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func deployZEVMTestDApp(r *runner.E2ERunner) (ethcommon.Address, error) {
r.ZEVMAuth,
r.ZEVMClient,
true,
r.GatewayEVMAddr,
)
if err != nil {
return addr, err
Expand All @@ -66,6 +67,7 @@ func deployEVMTestDApp(r *runner.E2ERunner) (ethcommon.Address, error) {
r.EVMAuth,
r.EVMClient,
false,
r.GatewayEVMAddr,
)
if err != nil {
return addr, err
Expand Down
8 changes: 1 addition & 7 deletions e2e/e2etests/test_eth_deposit_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,5 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) {

r.Logger.Info("Cross-chain call to reverter reverted")

// Check the error carries the revert executed.
// tolerate the error in both the ErrorMessage field and the StatusMessage field
if cctx.CctxStatus.ErrorMessage != "" {
require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed")
} else {
require.Contains(r, cctx.CctxStatus.StatusMessage, utils.ErrHashRevertFoo)
}
require.Contains(r, cctx.CctxStatus.ErrorMessage, utils.ErrHashRevertFoo)
}
28 changes: 28 additions & 0 deletions e2e/e2etests/test_inbound_trackers.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,32 @@ func TestInboundTrackers(r *runner.E2ERunner, args []string) {
)
addTrackerAndWaitForCCTX(coin.CoinType_NoAssetCall, tx.Hash().Hex())
r.Logger.Print("🍾v2 call observed")

// set value of the payable transactions
previousValue := r.EVMAuth.Value
r.EVMAuth.Value = amount

// send v2 deposit through contract
r.Logger.Print("🏃test v2 deposit through contract")
tx, err := r.TestDAppV2EVM.GatewayDeposit(r.EVMAuth, r.EVMAddress())
require.NoError(r, err)
addTrackerAndWaitForCCTX(coin.CoinType_Gas, tx.Hash().Hex())
r.Logger.Print("🍾v2 deposit through contract observed")

// send v2 deposit and call through contract
r.Logger.Print("🏃test v2 deposit and call through contract")
tx, err = r.TestDAppV2EVM.GatewayDepositAndCall(r.EVMAuth, r.TestDAppV2ZEVMAddr, []byte(randomPayload(r)))
require.NoError(r, err)
addTrackerAndWaitForCCTX(coin.CoinType_Gas, tx.Hash().Hex())
r.Logger.Print("🍾v2 deposit and call through contract observed")

// reset the value of the payable transactions
r.EVMAuth.Value = previousValue

// send v2 call through contract
r.Logger.Print("🏃test v2 call through contract")
tx, err = r.TestDAppV2EVM.GatewayCall(r.EVMAuth, r.TestDAppV2ZEVMAddr, []byte(randomPayload(r)))
require.NoError(r, err)
addTrackerAndWaitForCCTX(coin.CoinType_NoAssetCall, tx.Hash().Hex())
r.Logger.Print("🍾v2 call through contract observed")
}
8 changes: 1 addition & 7 deletions e2e/e2etests/test_solana_deposit_refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,5 @@ func TestSolanaDepositAndCallRevert(r *runner.E2ERunner, args []string) {
r.Logger.CCTX(*cctx, "solana_deposit_and_refund")
utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted)

// Check the error carries the revert executed.
// tolerate the error in both the ErrorMessage field and the StatusMessage field
if cctx.CctxStatus.ErrorMessage != "" {
require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed")
} else {
require.Contains(r, cctx.CctxStatus.StatusMessage, utils.ErrHashRevertFoo)
}
require.Contains(r, cctx.CctxStatus.ErrorMessage, utils.ErrHashRevertFoo)
}
9 changes: 1 addition & 8 deletions e2e/e2etests/test_ton_deposit_refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,5 @@ func TestTONDepositAndCallRefund(r *runner.E2ERunner, args []string) {
require.NoError(r, err)
r.Logger.CCTX(*cctx, "ton_deposit_and_refund")

// Check the error carries the revert executed.
// tolerate the error in both the ErrorMessage field and the StatusMessage field
if cctx.CctxStatus.ErrorMessage != "" {
require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed")
return
}

require.Contains(r, cctx.CctxStatus.StatusMessage, utils.ErrHashRevertFoo)
require.Contains(r, cctx.CctxStatus.ErrorMessage, utils.ErrHashRevertFoo)
}
2 changes: 1 addition & 1 deletion e2e/runner/balances.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (r *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, error) {
// solana
var solSOL *big.Int
var solSPL *big.Int
if r.Account.SolanaAddress != "" && r.Account.SolanaPrivateKey != "" {
if r.Account.SolanaAddress != "" && r.Account.SolanaPrivateKey != "" && r.SolanaClient != nil {
solanaAddr := solana.MustPublicKeyFromBase58(r.Account.SolanaAddress.String())
privateKey := solana.MustPrivateKeyFromBase58(r.Account.SolanaPrivateKey.String())
solSOLBalance, err := r.SolanaClient.GetBalance(
Expand Down
2 changes: 1 addition & 1 deletion e2e/runner/v2_setup_evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (r *E2ERunner) SetupEVMV2() {
require.NoError(r, err)

// deploy test dapp v2
testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(r.EVMAuth, r.EVMClient, false)
testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(r.EVMAuth, r.EVMClient, false, r.GatewayEVMAddr)
require.NoError(r, err)

r.TestDAppV2EVMAddr = testDAppV2Addr
Expand Down
7 changes: 6 additions & 1 deletion e2e/runner/v2_setup_zeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ func (r *E2ERunner) SetZEVMContractsV2() {
require.NoError(r, err)

// deploy test dapp v2
testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(r.ZEVMAuth, r.ZEVMClient, true)
testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(
r.ZEVMAuth,
r.ZEVMClient,
true,
r.GatewayEVMAddr,
)
require.NoError(r, err)

r.TestDAppV2ZEVMAddr = testDAppV2Addr
Expand Down
67 changes: 67 additions & 0 deletions pkg/contracts/testdappv2/TestDAppV2.abi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"internalType": "bool",
"name": "isZetaChain_",
"type": "bool"
},
{
"internalType": "address",
"name": "gateway_",
"type": "address"
}
],
"stateMutability": "nonpayable",
Expand Down Expand Up @@ -97,6 +102,68 @@
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "gateway",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "dst",
"type": "address"
},
{
"internalType": "bytes",
"name": "payload",
"type": "bytes"
}
],
"name": "gatewayCall",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "dst",
"type": "address"
}
],
"name": "gatewayDeposit",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "dst",
"type": "address"
},
{
"internalType": "bytes",
"name": "payload",
"type": "bytes"
}
],
"name": "gatewayDepositAndCall",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/contracts/testdappv2/TestDAppV2.bin

Large diffs are not rendered by default.

102 changes: 98 additions & 4 deletions pkg/contracts/testdappv2/TestDAppV2.go

Large diffs are not rendered by default.

Loading

0 comments on commit bf28edf

Please sign in to comment.