-
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.
- Loading branch information
Showing
9 changed files
with
496 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package evm | ||
|
||
import ( | ||
"path" | ||
"testing" | ||
|
||
ethcommon "github.com/ethereum/go-ethereum/common" | ||
"github.com/rs/zerolog" | ||
"github.com/stretchr/testify/require" | ||
corecommon "github.com/zeta-chain/zetacore/common" | ||
"github.com/zeta-chain/zetacore/x/crosschain/types" | ||
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" | ||
"github.com/zeta-chain/zetacore/zetaclient/common" | ||
"github.com/zeta-chain/zetacore/zetaclient/config" | ||
"github.com/zeta-chain/zetacore/zetaclient/metrics" | ||
"github.com/zeta-chain/zetacore/zetaclient/outtxprocessor" | ||
"github.com/zeta-chain/zetacore/zetaclient/testutils" | ||
"github.com/zeta-chain/zetacore/zetaclient/testutils/mock" | ||
) | ||
|
||
const ( | ||
// Dummy addresses as they are just used as transaction data to be signed | ||
ConnectorAddress = "0x00000000219ab540356cbb839cbe05303d7705fa" | ||
ERC20CustodyAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" | ||
) | ||
|
||
func getNewEvmSigner() (*Signer, error) { | ||
mpiAddress := ethcommon.HexToAddress(ConnectorAddress) | ||
erc20CustodyAddress := ethcommon.HexToAddress(ERC20CustodyAddress) | ||
logger := common.ClientLogger{} | ||
ts := &metrics.TelemetryServer{} | ||
return NewEVMSigner( | ||
corecommon.BscMainnetChain(), | ||
mock.EVMRPCEnabled, | ||
mock.NewTSSMainnet(), | ||
config.GetConnectorABI(), | ||
config.GetERC20CustodyABI(), | ||
mpiAddress, | ||
erc20CustodyAddress, | ||
logger, | ||
ts) | ||
} | ||
|
||
func getNewOutTxProcessor() *outtxprocessor.Processor { | ||
logger := zerolog.Logger{} | ||
return outtxprocessor.NewOutTxProcessorManager(logger) | ||
} | ||
|
||
func getCCTX() (*types.CrossChainTx, error) { | ||
var cctx crosschaintypes.CrossChainTx | ||
err := testutils.LoadObjectFromJSONFile(&cctx, path.Join("../", testutils.TestDataPathCctx, "cctx_56_68270.json")) | ||
return &cctx, err | ||
} | ||
|
||
func TestSigner_TryProcessOutTx(t *testing.T) { | ||
evmSigner, err := getNewEvmSigner() | ||
require.NoError(t, err) | ||
|
||
cctx, err := getCCTX() | ||
require.NoError(t, err) | ||
|
||
processorManager := getNewOutTxProcessor() | ||
|
||
mockChainClient := &ChainClient{ | ||
chain: corecommon.BscMainnetChain(), | ||
zetaClient: mock.NewZetaCoreBridge(), | ||
Tss: mock.NewTSSMainnet(), | ||
} | ||
evmSigner.TryProcessOutTx(cctx, processorManager, "123", mockChainClient, mock.NewZetaCoreBridge(), 123) | ||
} | ||
|
||
func TestSigner_SignOutboundTx(t *testing.T) { | ||
} | ||
|
||
func TestSigner_SignRevertTx(t *testing.T) { | ||
} | ||
|
||
func TestSigner_SignWithdrawTx(t *testing.T) { | ||
} | ||
|
||
func TestSigner_SignCommandTx(t *testing.T) { | ||
} | ||
|
||
func TestSigner_SignERC20WithdrawTx(t *testing.T) { | ||
} | ||
|
||
func TestSigner_BroadcastOutTx(t *testing.T) { | ||
} | ||
|
||
func TestSigner_SetChainAndSender(t *testing.T) { | ||
} | ||
|
||
func TestSigner_SetupGas(t *testing.T) { | ||
} | ||
|
||
func TestSigner_SetTransactionData(t *testing.T) { | ||
} |
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,48 @@ | ||
{ | ||
"CrossChainTx": [ | ||
{ | ||
"creator": "", | ||
"index": "0x541b570182950809f9b9077861a0fc7038af9a14ce8af4e151a83adfa308c7a9", | ||
"zeta_fees": "0", | ||
"relayed_message": "", | ||
"cctx_status": { | ||
"status": "PendingOutbound", | ||
"status_message": "", | ||
"lastUpdate_timestamp": "1709145057" | ||
}, | ||
"inbound_tx_params": { | ||
"sender": "0xd91b507F2A3e2D4A32d0C86Ac19FEAD2D461008D", | ||
"sender_chain_id": "7000", | ||
"tx_origin": "0xb0C04e07A301927672A8A7a874DB6930576C90B8", | ||
"coin_type": "Gas", | ||
"asset": "", | ||
"amount": "657177295293237048", | ||
"inbound_tx_observed_hash": "0x093f4ca4c1884df0fd9dd59b75979342ded29d3c9b6861644287a2e1417b9a39", | ||
"inbound_tx_observed_external_height": "1960153", | ||
"inbound_tx_ballot_index": "0x541b570182950809f9b9077861a0fc7038af9a14ce8af4e151a83adfa308c7a9", | ||
"inbound_tx_finalized_zeta_height": "0", | ||
"tx_finalization_status": "NotFinalized" | ||
}, | ||
"outbound_tx_params": [ | ||
{ | ||
"receiver": "0xb0C04e07A301927672A8A7a874DB6930576C90B8", | ||
"receiver_chainId": "56", | ||
"coin_type": "Gas", | ||
"amount": "657177295293237048", | ||
"outbound_tx_tss_nonce": "68270", | ||
"outbound_tx_gas_limit": "21000", | ||
"outbound_tx_gas_price": "6000000000", | ||
"outbound_tx_hash": "", | ||
"outbound_tx_ballot_index": "", | ||
"outbound_tx_observed_external_height": "0", | ||
"outbound_tx_gas_used": "0", | ||
"outbound_tx_effective_gas_price": "0", | ||
"outbound_tx_effective_gas_limit": "0", | ||
"tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", | ||
"tx_finalization_status": "NotFinalized" | ||
} | ||
] | ||
} | ||
], | ||
"totalPending": "1" | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.