diff --git a/zetaclient/bitcoin/bitcoin_client.go b/zetaclient/bitcoin/bitcoin_client.go index f1124014e0..defb5bd054 100644 --- a/zetaclient/bitcoin/bitcoin_client.go +++ b/zetaclient/bitcoin/bitcoin_client.go @@ -504,15 +504,15 @@ func (ob *BTCChainClient) ConfirmationsThreshold(amount *big.Int) int64 { return int64(ob.GetChainParams().ConfirmationCount) } -// IsCctxOutTxProcessed returns isIncluded(or inMempool), isConfirmed, Error -func (ob *BTCChainClient) IsCctxOutTxProcessed(cctx *types.CrossChainTx, logger zerolog.Logger) (bool, bool, error) { +// IsOutboundProcessed returns isIncluded(or inMempool), isConfirmed, Error +func (ob *BTCChainClient) IsOutboundProcessed(cctx *types.CrossChainTx, logger zerolog.Logger) (bool, bool, error) { params := *cctx.GetCurrentOutTxParam() sendHash := cctx.Index nonce := cctx.GetCurrentOutTxParam().OutboundTxTssNonce // get broadcasted outtx and tx result outTxID := ob.GetTxID(nonce) - logger.Info().Msgf("IsCctxOutTxProcessed %s", outTxID) + logger.Info().Msgf("IsOutboundProcessed %s", outTxID) ob.Mu.Lock() txnHash, broadcasted := ob.broadcastedTx[outTxID] @@ -537,7 +537,7 @@ func (ob *BTCChainClient) IsCctxOutTxProcessed(cctx *types.CrossChainTx, logger if txResult == nil { // check failed, try again next time return false, false, nil } else if inMempool { // still in mempool (should avoid unnecessary Tss keysign) - ob.logger.OutTx.Info().Msgf("IsCctxOutTxProcessed: outTx %s is still in mempool", outTxID) + ob.logger.OutTx.Info().Msgf("IsOutboundProcessed: outTx %s is still in mempool", outTxID) return true, false, nil } // included @@ -548,7 +548,7 @@ func (ob *BTCChainClient) IsCctxOutTxProcessed(cctx *types.CrossChainTx, logger if res == nil { return false, false, nil } - ob.logger.OutTx.Info().Msgf("IsCctxOutTxProcessed: setIncludedTx succeeded for outTx %s", outTxID) + ob.logger.OutTx.Info().Msgf("IsOutboundProcessed: setIncludedTx succeeded for outTx %s", outTxID) } // It's safe to use cctx's amount to post confirmation because it has already been verified in observeOutTx() @@ -573,9 +573,9 @@ func (ob *BTCChainClient) IsCctxOutTxProcessed(cctx *types.CrossChainTx, logger coin.CoinType_Gas, ) if err != nil { - logger.Error().Err(err).Msgf("IsCctxOutTxProcessed: error confirming bitcoin outTx %s, nonce %d ballot %s", res.TxID, nonce, ballot) + logger.Error().Err(err).Msgf("IsOutboundProcessed: error confirming bitcoin outTx %s, nonce %d ballot %s", res.TxID, nonce, ballot) } else if zetaHash != "" { - logger.Info().Msgf("IsCctxOutTxProcessed: confirmed Bitcoin outTx %s, zeta tx hash %s nonce %d ballot %s", res.TxID, zetaHash, nonce, ballot) + logger.Info().Msgf("IsOutboundProcessed: confirmed Bitcoin outTx %s, zeta tx hash %s nonce %d ballot %s", res.TxID, zetaHash, nonce, ballot) } return true, true, nil } diff --git a/zetaclient/evm/evm_client.go b/zetaclient/evm/evm_client.go index c62bc39c44..916f9e636f 100644 --- a/zetaclient/evm/evm_client.go +++ b/zetaclient/evm/evm_client.go @@ -158,11 +158,15 @@ func NewEVMChainClient( return &ob, nil } + +// WithChain attaches a new chain to the chain client func (ob *ChainClient) WithChain(chain chains.Chain) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.chain = chain } + +// WithLogger attaches a new logger to the chain client func (ob *ChainClient) WithLogger(logger zerolog.Logger) { ob.Mu.Lock() defer ob.Mu.Unlock() @@ -174,36 +178,42 @@ func (ob *ChainClient) WithLogger(logger zerolog.Logger) { } } +// WithEvmClient attaches a new evm client to the chain client func (ob *ChainClient) WithEvmClient(client interfaces.EVMRPCClient) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.evmClient = client } +// WithEvmJSONRPC attaches a new evm json rpc client to the chain client func (ob *ChainClient) WithEvmJSONRPC(client interfaces.EVMJSONRPCClient) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.evmJSONRPC = client } +// WithZetaBridge attaches a new bridge to interact with ZetaCore to the chain client func (ob *ChainClient) WithZetaBridge(bridge interfaces.ZetaCoreBridger) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.zetaBridge = bridge } +// WithBlockCache attaches a new block cache to the chain client func (ob *ChainClient) WithBlockCache(cache *lru.Cache) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.blockCache = cache } +// SetChainParams sets the chain params for the chain client func (ob *ChainClient) SetChainParams(params observertypes.ChainParams) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.chainParams = params } +// GetChainParams returns the chain params for the chain client func (ob *ChainClient) GetChainParams() observertypes.ChainParams { ob.Mu.Lock() defer ob.Mu.Unlock() @@ -339,7 +349,7 @@ func (ob *ChainClient) WatchOutTx() { } for _, tracker := range trackers { nonceInt := tracker.Nonce - if ob.isTxConfirmed(nonceInt) { // Go to next tracker if this one already has a confirmed tx + if ob.IsTxConfirmed(nonceInt) { // Go to next tracker if this one already has a confirmed tx continue } txCount := 0 @@ -403,8 +413,8 @@ func (ob *ChainClient) GetTxNReceipt(nonce uint64) (*ethtypes.Receipt, *ethtypes return receipt, transaction } -// isTxConfirmed returns true if there is a confirmed tx for 'nonce' -func (ob *ChainClient) isTxConfirmed(nonce uint64) bool { +// IsTxConfirmed returns true if there is a confirmed tx for 'nonce' +func (ob *ChainClient) IsTxConfirmed(nonce uint64) bool { ob.Mu.Lock() defer ob.Mu.Unlock() return ob.outTXConfirmedReceipts[ob.GetTxID(nonce)] != nil && ob.outTXConfirmedTransactions[ob.GetTxID(nonce)] != nil diff --git a/zetaclient/evm/evm_signer_test.go b/zetaclient/evm/evm_signer_test.go index eace105ff2..03e014adde 100644 --- a/zetaclient/evm/evm_signer_test.go +++ b/zetaclient/evm/evm_signer_test.go @@ -1,7 +1,6 @@ package evm import ( - "path" "testing" sdktypes "github.com/cosmos/cosmos-sdk/types" @@ -67,15 +66,14 @@ func getNewOutTxProcessor() *outtxprocessor.Processor { } func getCCTX(t *testing.T) *crosschaintypes.CrossChainTx { - var cctx crosschaintypes.CrossChainTx - testutils.LoadObjectFromJSONFile(t, &cctx, path.Join("../", testutils.TestDataPathCctx, "cctx_56_68270.json")) - return &cctx + return testutils.LoadCctxByNonce(t, 56, 68270) } func getInvalidCCTX(t *testing.T) *crosschaintypes.CrossChainTx { - var cctx crosschaintypes.CrossChainTx - testutils.LoadObjectFromJSONFile(t, &cctx, path.Join("../", testutils.TestDataPathCctx, "cctx_56_68270_invalidChainID.json")) - return &cctx + cctx := getCCTX(t) + // modify receiver chain id to make it invalid + cctx.GetCurrentOutTxParam().ReceiverChainId = 13378337 + return cctx } func TestSigner_SetGetConnectorAddress(t *testing.T) { diff --git a/zetaclient/evm/inbounds_test.go b/zetaclient/evm/inbounds_test.go index 1b5a10fc82..645a87d108 100644 --- a/zetaclient/evm/inbounds_test.go +++ b/zetaclient/evm/inbounds_test.go @@ -190,7 +190,7 @@ func TestEVM_BuildInboundVoteMsgForZetaSentEvent(t *testing.T) { chain := chains.EthChain() intxHash := "0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76" receipt := testutils.LoadEVMIntxReceipt(t, chainID, intxHash, coin.CoinType_Zeta) - cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, coin.CoinType_Zeta) + cctx := testutils.LoadCctxByIntx(t, chainID, coin.CoinType_Zeta, intxHash) // parse ZetaSent event ob := MockEVMClient(t, chain, nil, nil, nil, nil, 1, stub.MockChainParams(1, 1)) @@ -237,7 +237,7 @@ func TestEVM_BuildInboundVoteMsgForDepositedEvent(t *testing.T) { chainID := chain.ChainId intxHash := "0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da" tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, coin.CoinType_ERC20) - cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, coin.CoinType_ERC20) + cctx := testutils.LoadCctxByIntx(t, chainID, coin.CoinType_ERC20, intxHash) // parse Deposited event ob := MockEVMClient(t, chain, nil, nil, nil, nil, 1, stub.MockChainParams(1, 1)) @@ -283,7 +283,7 @@ func TestEVM_BuildInboundVoteMsgForTokenSentToTSS(t *testing.T) { intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, coin.CoinType_Gas) require.NoError(t, evm.ValidateEvmTransaction(tx)) - cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, coin.CoinType_Gas) + cctx := testutils.LoadCctxByIntx(t, chainID, coin.CoinType_Gas, intxHash) // load archived gas token donation to TSS // https://etherscan.io/tx/0x52f214cf7b10be71f4d274193287d47bc9632b976e69b9d2cdeb527c2ba32155 diff --git a/zetaclient/evm/outbound_transaction_data.go b/zetaclient/evm/outbound_transaction_data.go index 25f59e5e2e..47a7333197 100644 --- a/zetaclient/evm/outbound_transaction_data.go +++ b/zetaclient/evm/outbound_transaction_data.go @@ -135,9 +135,9 @@ func NewOutBoundTransactionData( // Get nonce, Early return if the cctx is already processed nonce := cctx.GetCurrentOutTxParam().OutboundTxTssNonce - included, confirmed, err := evmClient.IsCctxOutTxProcessed(cctx, logger) + included, confirmed, err := evmClient.IsOutboundProcessed(cctx, logger) if err != nil { - return nil, true, errors.New("IsCctxOutTxProcessed failed") + return nil, true, errors.New("IsOutboundProcessed failed") } if included || confirmed { logger.Info().Msgf("CCTX already processed; exit signer") diff --git a/zetaclient/evm/outbounds.go b/zetaclient/evm/outbounds.go index cda7403828..64a04b58fd 100644 --- a/zetaclient/evm/outbounds.go +++ b/zetaclient/evm/outbounds.go @@ -50,12 +50,12 @@ func (ob *ChainClient) PostVoteOutbound( } } -// IsCctxOutTxProcessed checks outtx status and returns (isIncluded, isConfirmed, error) +// IsOutboundProcessed checks outtx status and returns (isIncluded, isConfirmed, error) // It also posts vote to zetacore if the tx is confirmed -func (ob *ChainClient) IsCctxOutTxProcessed(cctx *crosschaintypes.CrossChainTx, logger zerolog.Logger) (bool, bool, error) { +func (ob *ChainClient) IsOutboundProcessed(cctx *crosschaintypes.CrossChainTx, logger zerolog.Logger) (bool, bool, error) { // skip if outtx is not confirmed nonce := cctx.GetCurrentOutTxParam().OutboundTxTssNonce - if !ob.isTxConfirmed(nonce) { + if !ob.IsTxConfirmed(nonce) { return false, false, nil } receipt, transaction := ob.GetTxNReceipt(nonce) @@ -92,7 +92,7 @@ func (ob *ChainClient) IsCctxOutTxProcessed(cctx *crosschaintypes.CrossChainTx, // parse the received value from the outtx receipt receiveValue, receiveStatus, err = ParseOuttxReceivedValue(cctx, receipt, transaction, cointype, connectorAddr, connector, custodyAddr, custody) if err != nil { - logger.Error().Err(err).Msgf("IsCctxOutTxProcessed: error parsing outtx event for chain %d txhash %s", ob.chain.ChainId, receipt.TxHash) + logger.Error().Err(err).Msgf("IsOutboundProcessed: error parsing outtx event for chain %d txhash %s", ob.chain.ChainId, receipt.TxHash) return false, false, err } @@ -189,7 +189,8 @@ func ParseAndCheckWithdrawnEvent( return nil, errors.New("no ERC20 Withdrawn event found") } -// ParseOuttxReceivedValue parses the received value from the outtx receipt +// ParseOuttxReceivedValue parses the received value and status from the outtx receipt +// The receivd value is the amount of Zeta/ERC20/Gas token (released from connector/custody/TSS) sent to the receiver func ParseOuttxReceivedValue( cctx *crosschaintypes.CrossChainTx, receipt *ethtypes.Receipt, @@ -198,7 +199,8 @@ func ParseOuttxReceivedValue( connectorAddress ethcommon.Address, connector *zetaconnector.ZetaConnectorNonEth, custodyAddress ethcommon.Address, - custody *erc20custody.ERC20Custody) (*big.Int, chains.ReceiveStatus, error) { + custody *erc20custody.ERC20Custody, +) (*big.Int, chains.ReceiveStatus, error) { // determine the receive status and value // https://docs.nethereum.com/en/latest/nethereum-receipt-status/ receiveValue := big.NewInt(0) diff --git a/zetaclient/evm/outbounds_test.go b/zetaclient/evm/outbounds_test.go index df167b1fc9..30f523614f 100644 --- a/zetaclient/evm/outbounds_test.go +++ b/zetaclient/evm/outbounds_test.go @@ -27,32 +27,7 @@ func getContractsByChainID(chainID int64) (*zetaconnector.ZetaConnectorNonEth, e return connector, connectorAddress, custody, custodyAddress } -func Test_PostVoteOutbound(t *testing.T) { - // Note: outtx of Gas/ERC20 token can also be used for this test - // load archived cctx, outtx and receipt for a ZetaReceived event - // https://etherscan.io/tx/0x81342051b8a85072d3e3771c1a57c7bdb5318e8caf37f5a687b7a91e50a7257f - chain := chains.EthChain() - nonce := uint64(9718) - coinType := coin.CoinType_Zeta - cctx, outtx, receipt := testutils.LoadEVMCctxNOuttxNReceipt(t, chain.ChainId, nonce, testutils.EventZetaReceived) - - t.Run("post vote outbound successfully", func(t *testing.T) { - // the amount and status to be used for vote - receiveValue := cctx.GetCurrentOutTxParam().Amount.BigInt() - receiveStatus := chains.ReceiveStatus_Success - - // create evm client using mock zetaBridge and post outbound vote - zetaBridge := stub.NewMockZetaCoreBridge() - client := MockEVMClient(t, chain, nil, nil, zetaBridge, nil, 1, observertypes.ChainParams{}) - client.PostVoteOutbound(cctx.Index, receipt, outtx, receiveValue, receiveStatus, nonce, coinType, zerolog.Logger{}) - - // pause the mock zetaBridge to simulate error posting vote - zetaBridge.Pause() - client.PostVoteOutbound(cctx.Index, receipt, outtx, receiveValue, receiveStatus, nonce, coinType, zerolog.Logger{}) - }) -} - -func Test_IsCctxOutTxProcessed(t *testing.T) { +func Test_IsOutboundProcessed(t *testing.T) { // load archived outtx receipt that contains ZetaReceived event // https://etherscan.io/tx/0x81342051b8a85072d3e3771c1a57c7bdb5318e8caf37f5a687b7a91e50a7257f chain := chains.EthChain() @@ -69,7 +44,7 @@ func Test_IsCctxOutTxProcessed(t *testing.T) { client := MockEVMClient(t, chain, nil, nil, nil, nil, 1, chainParam) client.SetTxNReceipt(nonce, receipt, outtx) // post outbound vote - isIncluded, isConfirmed, err := client.IsCctxOutTxProcessed(cctx, zerolog.Logger{}) + isIncluded, isConfirmed, err := client.IsOutboundProcessed(cctx, zerolog.Logger{}) require.NoError(t, err) require.True(t, isIncluded) require.True(t, isConfirmed) @@ -93,7 +68,7 @@ func Test_IsCctxOutTxProcessed(t *testing.T) { config.LoadComplianceConfig(cfg) // post outbound vote - isIncluded, isConfirmed, err := client.IsCctxOutTxProcessed(cctx, zerolog.Logger{}) + isIncluded, isConfirmed, err := client.IsOutboundProcessed(cctx, zerolog.Logger{}) require.NoError(t, err) require.True(t, isIncluded) require.True(t, isConfirmed) @@ -101,7 +76,7 @@ func Test_IsCctxOutTxProcessed(t *testing.T) { t.Run("should return false if outtx is not confirmed", func(t *testing.T) { // create evm client and DO NOT set outtx as confirmed client := MockEVMClient(t, chain, nil, nil, nil, nil, 1, chainParam) - isIncluded, isConfirmed, err := client.IsCctxOutTxProcessed(cctx, zerolog.Logger{}) + isIncluded, isConfirmed, err := client.IsOutboundProcessed(cctx, zerolog.Logger{}) require.NoError(t, err) require.False(t, isIncluded) require.False(t, isConfirmed) @@ -115,13 +90,82 @@ func Test_IsCctxOutTxProcessed(t *testing.T) { chainParamsNew := client.GetChainParams() chainParamsNew.ConnectorContractAddress = sample.EthAddress().Hex() client.SetChainParams(chainParamsNew) - isIncluded, isConfirmed, err := client.IsCctxOutTxProcessed(cctx, zerolog.Logger{}) + isIncluded, isConfirmed, err := client.IsOutboundProcessed(cctx, zerolog.Logger{}) require.Error(t, err) require.False(t, isIncluded) require.False(t, isConfirmed) }) } +func Test_IsOutboundProcessed_ContractError(t *testing.T) { + // Note: this test is skipped because it will cause CI failure. + // The only way to replicate a contract error is to use an invalid ABI. + // See the code: https://github.com/ethereum/go-ethereum/blob/v1.10.26/accounts/abi/bind/base.go#L97 + // The ABI is hardcoded in the protocol-contracts package and initialized the 1st time it binds the contract. + // Any subsequent modification to the ABI will not work and therefor fail the unit test. + t.Skip("uncomment this line to run this test separately, otherwise it will fail CI") + + // load archived outtx receipt that contains ZetaReceived event + // https://etherscan.io/tx/0x81342051b8a85072d3e3771c1a57c7bdb5318e8caf37f5a687b7a91e50a7257f + chain := chains.EthChain() + chainID := chains.EthChain().ChainId + nonce := uint64(9718) + chainParam := stub.MockChainParams(chain.ChainId, 1) + outtxHash := "0x81342051b8a85072d3e3771c1a57c7bdb5318e8caf37f5a687b7a91e50a7257f" + cctx := testutils.LoadCctxByNonce(t, chainID, nonce) + receipt := testutils.LoadEVMOuttxReceipt(t, chainID, outtxHash, coin.CoinType_Zeta, testutils.EventZetaReceived) + cctx, outtx, receipt := testutils.LoadEVMCctxNOuttxNReceipt(t, chainID, nonce, testutils.EventZetaReceived) + + t.Run("should fail if unable to get connector/custody contract", func(t *testing.T) { + // create evm client and set outtx and receipt + client := MockEVMClient(t, chain, nil, nil, nil, nil, 1, chainParam) + client.SetTxNReceipt(nonce, receipt, outtx) + abiConnector := zetaconnector.ZetaConnectorNonEthMetaData.ABI + abiCustody := erc20custody.ERC20CustodyMetaData.ABI + + // set invalid connector ABI + zetaconnector.ZetaConnectorNonEthMetaData.ABI = "invalid abi" + isIncluded, isConfirmed, err := client.IsOutboundProcessed(cctx, zerolog.Logger{}) + zetaconnector.ZetaConnectorNonEthMetaData.ABI = abiConnector // reset connector ABI + require.ErrorContains(t, err, "error getting zeta connector") + require.False(t, isIncluded) + require.False(t, isConfirmed) + + // set invalid custody ABI + erc20custody.ERC20CustodyMetaData.ABI = "invalid abi" + isIncluded, isConfirmed, err = client.IsOutboundProcessed(cctx, zerolog.Logger{}) + require.ErrorContains(t, err, "error getting erc20 custody") + require.False(t, isIncluded) + require.False(t, isConfirmed) + erc20custody.ERC20CustodyMetaData.ABI = abiCustody // reset custody ABI + }) +} + +func Test_PostVoteOutbound(t *testing.T) { + // Note: outtx of Gas/ERC20 token can also be used for this test + // load archived cctx, outtx and receipt for a ZetaReceived event + // https://etherscan.io/tx/0x81342051b8a85072d3e3771c1a57c7bdb5318e8caf37f5a687b7a91e50a7257f + chain := chains.EthChain() + nonce := uint64(9718) + coinType := coin.CoinType_Zeta + cctx, outtx, receipt := testutils.LoadEVMCctxNOuttxNReceipt(t, chain.ChainId, nonce, testutils.EventZetaReceived) + + t.Run("post vote outbound successfully", func(t *testing.T) { + // the amount and status to be used for vote + receiveValue := cctx.GetCurrentOutTxParam().Amount.BigInt() + receiveStatus := chains.ReceiveStatus_Success + + // create evm client using mock zetaBridge and post outbound vote + zetaBridge := stub.NewMockZetaCoreBridge() + client := MockEVMClient(t, chain, nil, nil, zetaBridge, nil, 1, observertypes.ChainParams{}) + client.PostVoteOutbound(cctx.Index, receipt, outtx, receiveValue, receiveStatus, nonce, coinType, zerolog.Logger{}) + + // pause the mock zetaBridge to simulate error posting vote + zetaBridge.Pause() + client.PostVoteOutbound(cctx.Index, receipt, outtx, receiveValue, receiveStatus, nonce, coinType, zerolog.Logger{}) + }) +} + func Test_ParseZetaReceived(t *testing.T) { // load archived outtx receipt that contains ZetaReceived event // https://etherscan.io/tx/0x81342051b8a85072d3e3771c1a57c7bdb5318e8caf37f5a687b7a91e50a7257f diff --git a/zetaclient/interfaces/interfaces.go b/zetaclient/interfaces/interfaces.go index a938d6af68..20d56bc320 100644 --- a/zetaclient/interfaces/interfaces.go +++ b/zetaclient/interfaces/interfaces.go @@ -39,7 +39,7 @@ const ( type ChainClient interface { Start() Stop() - IsCctxOutTxProcessed(cctx *crosschaintypes.CrossChainTx, logger zerolog.Logger) (bool, bool, error) + IsOutboundProcessed(cctx *crosschaintypes.CrossChainTx, logger zerolog.Logger) (bool, bool, error) SetChainParams(observertypes.ChainParams) GetChainParams() observertypes.ChainParams GetTxID(nonce uint64) string diff --git a/zetaclient/testdata/cctx/all_cctxs.go b/zetaclient/testdata/cctx/all_cctxs.go new file mode 100644 index 0000000000..359a10c8dd --- /dev/null +++ b/zetaclient/testdata/cctx/all_cctxs.go @@ -0,0 +1,49 @@ +package cctx + +import ( + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// CCtxByNonceMap maps the [chainID, nonce] to the cross chain transaction +var CCtxByNonceMap = map[int64]map[uint64]*crosschaintypes.CrossChainTx{ + // Ethereum mainnet + 1: { + chain_1_cctx_6270.GetCurrentOutTxParam().OutboundTxTssNonce: chain_1_cctx_6270, + chain_1_cctx_7260.GetCurrentOutTxParam().OutboundTxTssNonce: chain_1_cctx_7260, + chain_1_cctx_8014.GetCurrentOutTxParam().OutboundTxTssNonce: chain_1_cctx_8014, + chain_1_cctx_9718.GetCurrentOutTxParam().OutboundTxTssNonce: chain_1_cctx_9718, + }, + // BSC mainnet + 56: { + chain_56_cctx_68270.GetCurrentOutTxParam().OutboundTxTssNonce: chain_56_cctx_68270, + }, + // local goerli testnet + 1337: { + chain_1337_cctx_14.GetCurrentOutTxParam().OutboundTxTssNonce: chain_1337_cctx_14, + }, + // Bitcoin mainnet + 8332: { + chain_8332_cctx_148.GetCurrentOutTxParam().OutboundTxTssNonce: chain_8332_cctx_148, + }, +} + +// CctxByIntxMap maps the [chainID, coinType, intxHash] to the cross chain transaction +var CctxByIntxMap = map[int64]map[coin.CoinType]map[string]*crosschaintypes.CrossChainTx{ + // Ethereum mainnet + 1: { + coin.CoinType_Zeta: { + chain_1_cctx_intx_Zeta_0xf393520.InboundTxParams.InboundTxObservedHash: chain_1_cctx_intx_Zeta_0xf393520, + }, + coin.CoinType_ERC20: { + chain_1_cctx_intx_ERC20_0x4ea69a0.InboundTxParams.InboundTxObservedHash: chain_1_cctx_intx_ERC20_0x4ea69a0, + }, + coin.CoinType_Gas: { + chain_1_cctx_intx_Gas_0xeaec67d.InboundTxParams.InboundTxObservedHash: chain_1_cctx_intx_Gas_0xeaec67d, + }, + }, + // BSC mainnet + 56: {}, + // Bitcoin mainnet + 8332: {}, +} diff --git a/zetaclient/testdata/cctx/cctx_1337_14.json b/zetaclient/testdata/cctx/cctx_1337_14.json deleted file mode 100644 index 058849a351..0000000000 --- a/zetaclient/testdata/cctx/cctx_1337_14.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "creator": "zeta1plfrp7ejn0s9tmwufuxvsyn8nlf6a7u9ndgk9m", - "index": "0x85d06ac908823d125a919164f0596e3496224b206ebe8125ffe7b4ab766f85df", - "zeta_fees": "4000000000009027082", - "relayed_message": "bgGCGUux3roBhJr9PgNaC3DOfLBp5ILuZjUZx2z1abQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ==", - "cctx_status": { - "status": 5, - "status_message": "Outbound failed, start revert : Outbound succeeded, revert executed", - "lastUpdate_timestamp": 1712705995 - }, - "inbound_tx_params": { - "sender": "0xBFF76e77D56B3C1202107f059425D56f0AEF87Ed", - "sender_chain_id": 1337, - "tx_origin": "0x5cC2fBb200A929B372e3016F1925DcF988E081fd", - "amount": "10000000000000000000", - "inbound_tx_observed_hash": "0xa5589bf24eca8f108ca35048adc9d5582a303d416c01319391159269ae7e4e6f", - "inbound_tx_observed_external_height": 177, - "inbound_tx_ballot_index": "0x85d06ac908823d125a919164f0596e3496224b206ebe8125ffe7b4ab766f85df", - "inbound_tx_finalized_zeta_height": 150, - "tx_finalization_status": 2 - }, - "outbound_tx_params": [ - { - "receiver": "0xbff76e77d56b3c1202107f059425d56f0aef87ed", - "receiver_chainId": 1337, - "amount": "7999999999995486459", - "outbound_tx_tss_nonce": 13, - "outbound_tx_gas_limit": 250000, - "outbound_tx_gas_price": "18", - "outbound_tx_hash": "0x19f99459da6cb08f917f9b0ee2dac94a7be328371dff788ad46e64a24e8c06c9", - "outbound_tx_observed_external_height": 187, - "outbound_tx_gas_used": 67852, - "outbound_tx_effective_gas_price": "18", - "outbound_tx_effective_gas_limit": 250000, - "tss_pubkey": "zetapub1addwnpepqggky6z958k7hhxs6k5quuvs27uv5vtmlv330ppt2362p8ejct88w4g64jv", - "tx_finalization_status": 2 - }, - { - "receiver": "0xBFF76e77D56B3C1202107f059425D56f0AEF87Ed", - "receiver_chainId": 1337, - "amount": "5999999999990972918", - "outbound_tx_tss_nonce": 14, - "outbound_tx_gas_limit": 250000, - "outbound_tx_gas_price": "18", - "outbound_tx_hash": "0x1487e6a31dd430306667250b72bf15b8390b73108b69f3de5c1b2efe456036a7", - "outbound_tx_ballot_index": "0xc36c689fdaf09a9b80a614420cd4fea4fec15044790df60080cdefca0090a9dc", - "outbound_tx_observed_external_height": 201, - "outbound_tx_gas_used": 76128, - "outbound_tx_effective_gas_price": "18", - "outbound_tx_effective_gas_limit": 250000, - "tss_pubkey": "zetapub1addwnpepqggky6z958k7hhxs6k5quuvs27uv5vtmlv330ppt2362p8ejct88w4g64jv", - "tx_finalization_status": 2 - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_1_6270.json b/zetaclient/testdata/cctx/cctx_1_6270.json deleted file mode 100644 index 3797b52c3c..0000000000 --- a/zetaclient/testdata/cctx/cctx_1_6270.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "index": "0xe930f363591b348a07e0a6d309b4301b84f702e3e81e0d0902340c7f7da4b5af", - "zeta_fees": "0", - "cctx_status": { "status": 3, "lastUpdate_timestamp": 1708464433 }, - "inbound_tx_params": { - "sender": "0xd91b507F2A3e2D4A32d0C86Ac19FEAD2D461008D", - "sender_chain_id": 7000, - "tx_origin": "0x18D0E2c38b4188D8Ae07008C3BeeB1c80748b41c", - "coin_type": 1, - "amount": "9831832641427386", - "inbound_tx_observed_hash": "0x8bd0df31e512c472e3162a41281b740b518216cc8eb787c2eb59c81e0cffbe89", - "inbound_tx_observed_external_height": 1846989, - "inbound_tx_ballot_index": "0xe930f363591b348a07e0a6d309b4301b84f702e3e81e0d0902340c7f7da4b5af" - }, - "outbound_tx_params": [ - { - "receiver": "0x18D0E2c38b4188D8Ae07008C3BeeB1c80748b41c", - "receiver_chainId": 1, - "coin_type": 1, - "amount": "9831832641427386", - "outbound_tx_tss_nonce": 6270, - "outbound_tx_gas_limit": 21000, - "outbound_tx_gas_price": "69197693654", - "outbound_tx_hash": "0x20104d41e042db754cf7908c5441914e581b498eedbca40979c9853f4b7f8460", - "outbound_tx_ballot_index": "0x346a1d00a4d26a2065fe1dc7d5af59a49ad6a8af25853ae2ec976c07349f48c1", - "outbound_tx_observed_external_height": 19271550, - "outbound_tx_gas_used": 21000, - "outbound_tx_effective_gas_price": "69197693654", - "outbound_tx_effective_gas_limit": 21000, - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", - "tx_finalization_status": 2 - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_1_7260.json b/zetaclient/testdata/cctx/cctx_1_7260.json deleted file mode 100644 index 46cb2e2a3a..0000000000 --- a/zetaclient/testdata/cctx/cctx_1_7260.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "index": "0xbebecbf1d8c12016e38c09d095290df503fe29731722d939433fa47e3ed1f986", - "zeta_fees": "0", - "cctx_status": { "status": 3, "lastUpdate_timestamp": 1709574082 }, - "inbound_tx_params": { - "sender": "0xd91b507F2A3e2D4A32d0C86Ac19FEAD2D461008D", - "sender_chain_id": 7000, - "tx_origin": "0x8E62e3e6FbFF3E21F725395416A20EA4E2DeF015", - "coin_type": 1, - "amount": "42635427434588308", - "inbound_tx_observed_hash": "0x2720e3a98f18c288f4197d412bfce57e58f00dc4f8b31e335ffc0bf7208dd3c5", - "inbound_tx_observed_external_height": 2031411, - "inbound_tx_ballot_index": "0xbebecbf1d8c12016e38c09d095290df503fe29731722d939433fa47e3ed1f986" - }, - "outbound_tx_params": [ - { - "receiver": "0x8E62e3e6FbFF3E21F725395416A20EA4E2DeF015", - "receiver_chainId": 1, - "coin_type": 1, - "amount": "42635427434588308", - "outbound_tx_tss_nonce": 7260, - "outbound_tx_gas_limit": 21000, - "outbound_tx_gas_price": "236882693686", - "outbound_tx_hash": "0xd13b593eb62b5500a00e288cc2fb2c8af1339025c0e6bc6183b8bef2ebbed0d3", - "outbound_tx_ballot_index": "0x689d894606642a2a7964fa906ebf4998c22a00708544fa88e9c56b86c955066b", - "outbound_tx_observed_external_height": 19363323, - "outbound_tx_gas_used": 21000, - "outbound_tx_effective_gas_price": "236882693686", - "outbound_tx_effective_gas_limit": 21000, - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", - "tx_finalization_status": 2 - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_1_8014.json b/zetaclient/testdata/cctx/cctx_1_8014.json deleted file mode 100644 index b702f8d7f6..0000000000 --- a/zetaclient/testdata/cctx/cctx_1_8014.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "index": "0x5a100fdb426da35ad4c95520d7a4f1fd2f38c88067c9e80ba209d3a655c6e06e", - "zeta_fees": "0", - "cctx_status": { "status": 3, "lastUpdate_timestamp": 1710834402 }, - "inbound_tx_params": { - "sender": "0x7c8dDa80bbBE1254a7aACf3219EBe1481c6E01d7", - "sender_chain_id": 7000, - "tx_origin": "0x8d8D67A8B71c141492825CAE5112Ccd8581073f2", - "coin_type": 2, - "asset": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "amount": "23726342442", - "inbound_tx_observed_hash": "0x114ed9d327b6afc068c3fa891b82f7c7f2d42ae25a571f7dc004c05e77af592a", - "inbound_tx_observed_external_height": 2241077, - "inbound_tx_ballot_index": "0x5a100fdb426da35ad4c95520d7a4f1fd2f38c88067c9e80ba209d3a655c6e06e" - }, - "outbound_tx_params": [ - { - "receiver": "0x8d8D67A8B71c141492825CAE5112Ccd8581073f2", - "receiver_chainId": 1, - "coin_type": 2, - "amount": "23726342442", - "outbound_tx_tss_nonce": 8014, - "outbound_tx_gas_limit": 100000, - "outbound_tx_gas_price": "58619665744", - "outbound_tx_hash": "0xd2eba7ac3da1b62800165414ea4bcaf69a3b0fb9b13a0fc32f4be11bfef79146", - "outbound_tx_ballot_index": "0x4213f2c335758301b8bbb09d9891949ed6ffeea5dd95e5d9eaa8d410baaa0884", - "outbound_tx_observed_external_height": 19467367, - "outbound_tx_gas_used": 60625, - "outbound_tx_effective_gas_price": "58619665744", - "outbound_tx_effective_gas_limit": 100000, - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", - "tx_finalization_status": 2 - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_1_9718.json b/zetaclient/testdata/cctx/cctx_1_9718.json deleted file mode 100644 index ebd71301e2..0000000000 --- a/zetaclient/testdata/cctx/cctx_1_9718.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "index": "0xbf7a214cf9868e1c618123ab4df0081da87bade74eeb5aef37843e35f25e67b7", - "zeta_fees": "19525506001302763608", - "cctx_status": { "status": 3, "lastUpdate_timestamp": 1712336965 }, - "inbound_tx_params": { - "sender": "0xF0a3F93Ed1B126142E61423F9546bf1323Ff82DF", - "sender_chain_id": 7000, - "tx_origin": "0x87257C910a19a3fe64AfFAbFe8cF9AAF2ab148BF", - "amount": "20000000000000000000", - "inbound_tx_observed_hash": "0xb136652cd58fb6a537b0a1677965983059a2004d98919cdacd52551f877cc44f", - "inbound_tx_observed_external_height": 2492552, - "inbound_tx_ballot_index": "0xbf7a214cf9868e1c618123ab4df0081da87bade74eeb5aef37843e35f25e67b7" - }, - "outbound_tx_params": [ - { - "receiver": "0x30735c88fa430f11499b0edcfcc25246fb9182e3", - "receiver_chainId": 1, - "amount": "474493998697236392", - "outbound_tx_tss_nonce": 9718, - "outbound_tx_gas_limit": 90000, - "outbound_tx_gas_price": "112217884384", - "outbound_tx_hash": "0x81342051b8a85072d3e3771c1a57c7bdb5318e8caf37f5a687b7a91e50a7257f", - "outbound_tx_ballot_index": "0xff07eaa34ca02a08bca1558e5f6220cbfc734061f083622b24923e032f0c480f", - "outbound_tx_observed_external_height": 19590894, - "outbound_tx_gas_used": 64651, - "outbound_tx_effective_gas_price": "112217884384", - "outbound_tx_effective_gas_limit": 100000, - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", - "tx_finalization_status": 2 - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_1_intx_Gas_0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098.json b/zetaclient/testdata/cctx/cctx_1_intx_Gas_0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098.json deleted file mode 100644 index a167134b35..0000000000 --- a/zetaclient/testdata/cctx/cctx_1_intx_Gas_0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "creator": "zeta1hjct6q7npsspsg3dgvzk3sdf89spmlpf7rqmnw", - "index": "0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098", - "zeta_fees": "0", - "cctx_status": { - "status": 3, - "status_message": "Remote omnichain contract call completed", - "lastUpdate_timestamp": 1709177431 - }, - "inbound_tx_params": { - "sender": "0xF829fa7069680b8C37A8086b37d4a24697E5003b", - "sender_chain_id": 1, - "tx_origin": "0xF829fa7069680b8C37A8086b37d4a24697E5003b", - "coin_type": 1, - "amount": "4000000000000000", - "inbound_tx_observed_hash": "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532", - "inbound_tx_observed_external_height": 19330473, - "inbound_tx_ballot_index": "0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098", - "inbound_tx_finalized_zeta_height": 1965579, - "tx_finalization_status": 2 - }, - "outbound_tx_params": [ - { - "receiver": "0xF829fa7069680b8C37A8086b37d4a24697E5003b", - "receiver_chainId": 7000, - "coin_type": 1, - "amount": "0", - "outbound_tx_gas_limit": 90000, - "outbound_tx_hash": "0x3b8c1dab5aa21ff90ddb569f2f962ff2d4aa8d914c9177900102e745955e6f35", - "outbound_tx_observed_external_height": 1965579, - "outbound_tx_effective_gas_price": "0", - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc" - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_56_68270.json b/zetaclient/testdata/cctx/cctx_56_68270.json deleted file mode 100644 index 1c0ae6b762..0000000000 --- a/zetaclient/testdata/cctx/cctx_56_68270.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "creator": "", - "index": "0x541b570182950809f9b9077861a0fc7038af9a14ce8af4e151a83adfa308c7a9", - "zeta_fees": "0", - "relayed_message": "", - "cctx_status": { - "status": 1, - "status_message": "", - "lastUpdate_timestamp": 1709145057 - }, - "inbound_tx_params": { - "sender": "0xd91b507F2A3e2D4A32d0C86Ac19FEAD2D461008D", - "sender_chain_id": 7000, - "tx_origin": "0xb0C04e07A301927672A8A7a874DB6930576C90B8", - "coin_type": 1, - "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": 0 - }, - "outbound_tx_params": [ - { - "receiver": "0xb0C04e07A301927672A8A7a874DB6930576C90B8", - "receiver_chainId": 56, - "coin_type": 1, - "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": 0 - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_56_68270_invalidChainID.json b/zetaclient/testdata/cctx/cctx_56_68270_invalidChainID.json deleted file mode 100644 index 2e4cc4d97a..0000000000 --- a/zetaclient/testdata/cctx/cctx_56_68270_invalidChainID.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "creator": "", - "index": "0x541b570182950809f9b9077861a0fc7038af9a14ce8af4e151a83adfa308c7a9", - "zeta_fees": "0", - "relayed_message": "", - "cctx_status": { - "status": 1, - "status_message": "", - "lastUpdate_timestamp": 1709145057 - }, - "inbound_tx_params": { - "sender": "0xd91b507F2A3e2D4A32d0C86Ac19FEAD2D461008D", - "sender_chain_id": 7000, - "tx_origin": "0xb0C04e07A301927672A8A7a874DB6930576C90B8", - "coin_type": 1, - "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": 0 - }, - "outbound_tx_params": [ - { - "receiver": "0xb0C04e07A301927672A8A7a874DB6930576C90B8", - "receiver_chainId": 13378337, - "coin_type": 1, - "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": 0 - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_8332_148.json b/zetaclient/testdata/cctx/cctx_8332_148.json deleted file mode 100644 index 4564858f58..0000000000 --- a/zetaclient/testdata/cctx/cctx_8332_148.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "index": "0xb3f5f3cf2ed2e0c3fa64c8297c9e50fbc07351fb2d26d8eae4cfbbd45e47a524", - "zeta_fees": "0", - "cctx_status": { "status": 3, "lastUpdate_timestamp": 1708608895 }, - "inbound_tx_params": { - "sender": "0x13A0c5930C028511Dc02665E7285134B6d11A5f4", - "sender_chain_id": 7000, - "tx_origin": "0xe99174F08e1186134830f8511De06bd010978533", - "coin_type": 1, - "amount": "12000", - "inbound_tx_observed_hash": "0x06455013319acb1b027461134853c77b003d8eab162b1f37673da5ad8a50b74f", - "inbound_tx_observed_external_height": 1870408, - "inbound_tx_ballot_index": "0xb3f5f3cf2ed2e0c3fa64c8297c9e50fbc07351fb2d26d8eae4cfbbd45e47a524" - }, - "outbound_tx_params": [ - { - "receiver": "bc1qpsdlklfcmlcfgm77c43x65ddtrt7n0z57hsyjp", - "receiver_chainId": 8332, - "coin_type": 1, - "amount": "12000", - "outbound_tx_tss_nonce": 148, - "outbound_tx_gas_limit": 254, - "outbound_tx_gas_price": "46", - "outbound_tx_hash": "030cd813443f7b70cc6d8a544d320c6d8465e4528fc0f3410b599dc0b26753a0", - "outbound_tx_ballot_index": "0x43845693f799b7a5e84dcf11321ae681ec018d709ecc919773968018f93e21c1", - "outbound_tx_observed_external_height": 150, - "outbound_tx_effective_gas_price": "0", - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", - "tx_finalization_status": 2 - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_intx_1_ERC20_0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da.json b/zetaclient/testdata/cctx/cctx_intx_1_ERC20_0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da.json deleted file mode 100644 index 6df7bcfe3e..0000000000 --- a/zetaclient/testdata/cctx/cctx_intx_1_ERC20_0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "creator": "zeta1hjct6q7npsspsg3dgvzk3sdf89spmlpf7rqmnw", - "index": "0xd326700a1931f28853f44f8462f72588f94b1f248214d59a23c3e1b141ff5ede", - "zeta_fees": "0", - "cctx_status": { - "status": 3, - "status_message": "Remote omnichain contract call completed", - "lastUpdate_timestamp": 1709052990 - }, - "inbound_tx_params": { - "sender": "0x56BF8D4a6E7b59D2C0E40Cba2409a4a30ab4FbE2", - "sender_chain_id": 1, - "tx_origin": "0x56BF8D4a6E7b59D2C0E40Cba2409a4a30ab4FbE2", - "coin_type": 2, - "asset": "0xdAC17F958D2ee523a2206206994597C13D831ec7", - "amount": "9992000000", - "inbound_tx_observed_hash": "0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da", - "inbound_tx_observed_external_height": 19320188, - "inbound_tx_ballot_index": "0xd326700a1931f28853f44f8462f72588f94b1f248214d59a23c3e1b141ff5ede", - "inbound_tx_finalized_zeta_height": 1944675, - "tx_finalization_status": 2 - }, - "outbound_tx_params": [ - { - "receiver": "0x56bf8d4a6e7b59d2c0e40cba2409a4a30ab4fbe2", - "receiver_chainId": 7000, - "coin_type": 2, - "amount": "0", - "outbound_tx_gas_limit": 1500000, - "outbound_tx_hash": "0xf63eaa3e01af477673aa9e86fb634df15d30a00734dab7450cb0fc28dbc9d11b", - "outbound_tx_observed_external_height": 1944675, - "outbound_tx_effective_gas_price": "0", - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc" - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_intx_1_Gas_0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532.json b/zetaclient/testdata/cctx/cctx_intx_1_Gas_0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532.json deleted file mode 100644 index a167134b35..0000000000 --- a/zetaclient/testdata/cctx/cctx_intx_1_Gas_0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "creator": "zeta1hjct6q7npsspsg3dgvzk3sdf89spmlpf7rqmnw", - "index": "0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098", - "zeta_fees": "0", - "cctx_status": { - "status": 3, - "status_message": "Remote omnichain contract call completed", - "lastUpdate_timestamp": 1709177431 - }, - "inbound_tx_params": { - "sender": "0xF829fa7069680b8C37A8086b37d4a24697E5003b", - "sender_chain_id": 1, - "tx_origin": "0xF829fa7069680b8C37A8086b37d4a24697E5003b", - "coin_type": 1, - "amount": "4000000000000000", - "inbound_tx_observed_hash": "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532", - "inbound_tx_observed_external_height": 19330473, - "inbound_tx_ballot_index": "0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098", - "inbound_tx_finalized_zeta_height": 1965579, - "tx_finalization_status": 2 - }, - "outbound_tx_params": [ - { - "receiver": "0xF829fa7069680b8C37A8086b37d4a24697E5003b", - "receiver_chainId": 7000, - "coin_type": 1, - "amount": "0", - "outbound_tx_gas_limit": 90000, - "outbound_tx_hash": "0x3b8c1dab5aa21ff90ddb569f2f962ff2d4aa8d914c9177900102e745955e6f35", - "outbound_tx_observed_external_height": 1965579, - "outbound_tx_effective_gas_price": "0", - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc" - } - ] -} diff --git a/zetaclient/testdata/cctx/cctx_intx_1_Zeta_0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76.json b/zetaclient/testdata/cctx/cctx_intx_1_Zeta_0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76.json deleted file mode 100644 index b31c759c5f..0000000000 --- a/zetaclient/testdata/cctx/cctx_intx_1_Zeta_0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "creator": "zeta1p0uwsq4naus5r4l7l744upy0k8ezzj84mn40nf", - "index": "0x477544c4b8c8be544b23328b21286125c89cd6bb5d1d6d388d91eea8ea1a6f1f", - "zeta_fees": "0", - "cctx_status": { - "status": 3, - "status_message": "Remote omnichain contract call completed", - "lastUpdate_timestamp": 1708490549 - }, - "inbound_tx_params": { - "sender": "0x2f993766e8e1Ef9288B1F33F6aa244911A0A77a7", - "sender_chain_id": 1, - "tx_origin": "0x2f993766e8e1Ef9288B1F33F6aa244911A0A77a7", - "amount": "20000000000000000000", - "inbound_tx_observed_hash": "0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76", - "inbound_tx_observed_external_height": 19273702, - "inbound_tx_ballot_index": "0x477544c4b8c8be544b23328b21286125c89cd6bb5d1d6d388d91eea8ea1a6f1f", - "inbound_tx_finalized_zeta_height": 1851403, - "tx_finalization_status": 2 - }, - "outbound_tx_params": [ - { - "receiver": "0x2f993766e8e1ef9288b1f33f6aa244911a0a77a7", - "receiver_chainId": 7000, - "amount": "0", - "outbound_tx_gas_limit": 100000, - "outbound_tx_hash": "0x947434364da7c74d7e896a389aa8cb3122faf24bbcba64b141cb5acd7838209c", - "outbound_tx_observed_external_height": 1851403, - "outbound_tx_effective_gas_price": "0", - "tss_pubkey": "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc" - } - ] -} diff --git a/zetaclient/testdata/cctx/chain_1337_cctx_14.go b/zetaclient/testdata/cctx/chain_1337_cctx_14.go new file mode 100644 index 0000000000..ec4fafd8c4 --- /dev/null +++ b/zetaclient/testdata/cctx/chain_1337_cctx_14.go @@ -0,0 +1,122 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// This cctx was generated in local e2e tests, see original json text attached at end of file +var chain_1337_cctx_14 = &crosschaintypes.CrossChainTx{ + Creator: "zeta1plfrp7ejn0s9tmwufuxvsyn8nlf6a7u9ndgk9m", + Index: "0x85d06ac908823d125a919164f0596e3496224b206ebe8125ffe7b4ab766f85df", + ZetaFees: sdkmath.NewUintFromString("4000000000009027082"), + RelayedMessage: "bgGCGUux3roBhJr9PgNaC3DOfLBp5ILuZjUZx2z1abQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ==", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_Reverted, + StatusMessage: "Outbound failed, start revert : Outbound succeeded, revert executed", + LastUpdateTimestamp: 1712705995, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0xBFF76e77D56B3C1202107f059425D56f0AEF87Ed", + SenderChainId: 1337, + TxOrigin: "0x5cC2fBb200A929B372e3016F1925DcF988E081fd", + Amount: sdkmath.NewUintFromString("10000000000000000000"), + InboundTxObservedHash: "0xa5589bf24eca8f108ca35048adc9d5582a303d416c01319391159269ae7e4e6f", + InboundTxObservedExternalHeight: 177, + InboundTxBallotIndex: "0x85d06ac908823d125a919164f0596e3496224b206ebe8125ffe7b4ab766f85df", + InboundTxFinalizedZetaHeight: 150, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0xbff76e77d56b3c1202107f059425d56f0aef87ed", + ReceiverChainId: 1337, + Amount: sdkmath.NewUintFromString("7999999999995486459"), + OutboundTxTssNonce: 13, + OutboundTxGasLimit: 250000, + OutboundTxGasPrice: "18", + OutboundTxHash: "0x19f99459da6cb08f917f9b0ee2dac94a7be328371dff788ad46e64a24e8c06c9", + OutboundTxObservedExternalHeight: 187, + OutboundTxGasUsed: 67852, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(18), + OutboundTxEffectiveGasLimit: 250000, + TssPubkey: "zetapub1addwnpepqggky6z958k7hhxs6k5quuvs27uv5vtmlv330ppt2362p8ejct88w4g64jv", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + { + Receiver: "0xBFF76e77D56B3C1202107f059425D56f0AEF87Ed", + ReceiverChainId: 1337, + Amount: sdkmath.NewUintFromString("5999999999990972918"), + OutboundTxTssNonce: 14, + OutboundTxGasLimit: 250000, + OutboundTxGasPrice: "18", + OutboundTxHash: "0x1487e6a31dd430306667250b72bf15b8390b73108b69f3de5c1b2efe456036a7", + OutboundTxBallotIndex: "0xc36c689fdaf09a9b80a614420cd4fea4fec15044790df60080cdefca0090a9dc", + OutboundTxObservedExternalHeight: 201, + OutboundTxGasUsed: 76128, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(18), + OutboundTxEffectiveGasLimit: 250000, + TssPubkey: "zetapub1addwnpepqggky6z958k7hhxs6k5quuvs27uv5vtmlv330ppt2362p8ejct88w4g64jv", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + }, +} + +// Here is the original cctx json data used to create above chain_1337_cctx_14 +/* +{ + "creator": "zeta1plfrp7ejn0s9tmwufuxvsyn8nlf6a7u9ndgk9m", + "index": "0x85d06ac908823d125a919164f0596e3496224b206ebe8125ffe7b4ab766f85df", + "zeta_fees": "4000000000009027082", + "relayed_message": "bgGCGUux3roBhJr9PgNaC3DOfLBp5ILuZjUZx2z1abQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ==", + "cctx_status": { + "status": 5, + "status_message": "Outbound failed, start revert : Outbound succeeded, revert executed", + "lastUpdate_timestamp": 1712705995 + }, + "inbound_tx_params": { + "sender": "0xBFF76e77D56B3C1202107f059425D56f0AEF87Ed", + "sender_chain_id": 1337, + "tx_origin": "0x5cC2fBb200A929B372e3016F1925DcF988E081fd", + "amount": "10000000000000000000", + "inbound_tx_observed_hash": "0xa5589bf24eca8f108ca35048adc9d5582a303d416c01319391159269ae7e4e6f", + "inbound_tx_observed_external_height": 177, + "inbound_tx_ballot_index": "0x85d06ac908823d125a919164f0596e3496224b206ebe8125ffe7b4ab766f85df", + "inbound_tx_finalized_zeta_height": 150, + "tx_finalization_status": 2 + }, + "outbound_tx_params": [ + { + "receiver": "0xbff76e77d56b3c1202107f059425d56f0aef87ed", + "receiver_chainId": 1337, + "amount": "7999999999995486459", + "outbound_tx_tss_nonce": 13, + "outbound_tx_gas_limit": 250000, + "outbound_tx_gas_price": "18", + "outbound_tx_hash": "0x19f99459da6cb08f917f9b0ee2dac94a7be328371dff788ad46e64a24e8c06c9", + "outbound_tx_observed_external_height": 187, + "outbound_tx_gas_used": 67852, + "outbound_tx_effective_gas_price": "18", + "outbound_tx_effective_gas_limit": 250000, + "tss_pubkey": "zetapub1addwnpepqggky6z958k7hhxs6k5quuvs27uv5vtmlv330ppt2362p8ejct88w4g64jv", + "tx_finalization_status": 2 + }, + { + "receiver": "0xBFF76e77D56B3C1202107f059425D56f0AEF87Ed", + "receiver_chainId": 1337, + "amount": "5999999999990972918", + "outbound_tx_tss_nonce": 14, + "outbound_tx_gas_limit": 250000, + "outbound_tx_gas_price": "18", + "outbound_tx_hash": "0x1487e6a31dd430306667250b72bf15b8390b73108b69f3de5c1b2efe456036a7", + "outbound_tx_ballot_index": "0xc36c689fdaf09a9b80a614420cd4fea4fec15044790df60080cdefca0090a9dc", + "outbound_tx_observed_external_height": 201, + "outbound_tx_gas_used": 76128, + "outbound_tx_effective_gas_price": "18", + "outbound_tx_effective_gas_limit": 250000, + "tss_pubkey": "zetapub1addwnpepqggky6z958k7hhxs6k5quuvs27uv5vtmlv330ppt2362p8ejct88w4g64jv", + "tx_finalization_status": 2 + } + ] +} +*/ diff --git a/zetaclient/testdata/cctx/chain_1_cctx_6270.go b/zetaclient/testdata/cctx/chain_1_cctx_6270.go new file mode 100644 index 0000000000..31c8158f42 --- /dev/null +++ b/zetaclient/testdata/cctx/chain_1_cctx_6270.go @@ -0,0 +1,53 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/1/6270 +var chain_1_cctx_6270 = &crosschaintypes.CrossChainTx{ + Creator: "", + Index: "0xe930f363591b348a07e0a6d309b4301b84f702e3e81e0d0902340c7f7da4b5af", + ZetaFees: sdkmath.ZeroUint(), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_OutboundMined, + StatusMessage: "", + LastUpdateTimestamp: 1708464433, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0xd91b507F2A3e2D4A32d0C86Ac19FEAD2D461008D", + SenderChainId: 7000, + TxOrigin: "0x18D0E2c38b4188D8Ae07008C3BeeB1c80748b41c", + CoinType: coin.CoinType_Gas, + Asset: "", + Amount: sdkmath.NewUint(9831832641427386), + InboundTxObservedHash: "0x8bd0df31e512c472e3162a41281b740b518216cc8eb787c2eb59c81e0cffbe89", + InboundTxObservedExternalHeight: 1846989, + InboundTxBallotIndex: "0xe930f363591b348a07e0a6d309b4301b84f702e3e81e0d0902340c7f7da4b5af", + InboundTxFinalizedZetaHeight: 0, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0x18D0E2c38b4188D8Ae07008C3BeeB1c80748b41c", + ReceiverChainId: 1, + CoinType: coin.CoinType_Gas, + Amount: sdkmath.NewUint(9831832641427386), + OutboundTxTssNonce: 6270, + OutboundTxGasLimit: 21000, + OutboundTxGasPrice: "69197693654", + OutboundTxHash: "0x20104d41e042db754cf7908c5441914e581b498eedbca40979c9853f4b7f8460", + OutboundTxBallotIndex: "0x346a1d00a4d26a2065fe1dc7d5af59a49ad6a8af25853ae2ec976c07349f48c1", + OutboundTxObservedExternalHeight: 19271550, + OutboundTxGasUsed: 21000, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(69197693654), + OutboundTxEffectiveGasLimit: 21000, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + }, +} diff --git a/zetaclient/testdata/cctx/chain_1_cctx_7260.go b/zetaclient/testdata/cctx/chain_1_cctx_7260.go new file mode 100644 index 0000000000..b7e00b954f --- /dev/null +++ b/zetaclient/testdata/cctx/chain_1_cctx_7260.go @@ -0,0 +1,53 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/1/7260 +var chain_1_cctx_7260 = &crosschaintypes.CrossChainTx{ + Creator: "", + Index: "0xbebecbf1d8c12016e38c09d095290df503fe29731722d939433fa47e3ed1f986", + ZetaFees: sdkmath.ZeroUint(), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_OutboundMined, + StatusMessage: "", + LastUpdateTimestamp: 1709574082, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0xd91b507F2A3e2D4A32d0C86Ac19FEAD2D461008D", + SenderChainId: 7000, + TxOrigin: "0x8E62e3e6FbFF3E21F725395416A20EA4E2DeF015", + CoinType: coin.CoinType_Gas, + Asset: "", + Amount: sdkmath.NewUint(42635427434588308), + InboundTxObservedHash: "0x2720e3a98f18c288f4197d412bfce57e58f00dc4f8b31e335ffc0bf7208dd3c5", + InboundTxObservedExternalHeight: 2031411, + InboundTxBallotIndex: "0xbebecbf1d8c12016e38c09d095290df503fe29731722d939433fa47e3ed1f986", + InboundTxFinalizedZetaHeight: 0, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0x8E62e3e6FbFF3E21F725395416A20EA4E2DeF015", + ReceiverChainId: 1, + CoinType: coin.CoinType_Gas, + Amount: sdkmath.NewUint(42635427434588308), + OutboundTxTssNonce: 7260, + OutboundTxGasLimit: 21000, + OutboundTxGasPrice: "236882693686", + OutboundTxHash: "0xd13b593eb62b5500a00e288cc2fb2c8af1339025c0e6bc6183b8bef2ebbed0d3", + OutboundTxBallotIndex: "0x689d894606642a2a7964fa906ebf4998c22a00708544fa88e9c56b86c955066b", + OutboundTxObservedExternalHeight: 19363323, + OutboundTxGasUsed: 21000, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(236882693686), + OutboundTxEffectiveGasLimit: 21000, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + }, +} diff --git a/zetaclient/testdata/cctx/chain_1_cctx_8014.go b/zetaclient/testdata/cctx/chain_1_cctx_8014.go new file mode 100644 index 0000000000..cc6c201b67 --- /dev/null +++ b/zetaclient/testdata/cctx/chain_1_cctx_8014.go @@ -0,0 +1,53 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/1/8014 +var chain_1_cctx_8014 = &crosschaintypes.CrossChainTx{ + Creator: "", + Index: "0x5a100fdb426da35ad4c95520d7a4f1fd2f38c88067c9e80ba209d3a655c6e06e", + ZetaFees: sdkmath.ZeroUint(), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_OutboundMined, + StatusMessage: "", + LastUpdateTimestamp: 1710834402, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0x7c8dDa80bbBE1254a7aACf3219EBe1481c6E01d7", + SenderChainId: 7000, + TxOrigin: "0x8d8D67A8B71c141492825CAE5112Ccd8581073f2", + CoinType: coin.CoinType_ERC20, + Asset: "0xdac17f958d2ee523a2206206994597c13d831ec7", + Amount: sdkmath.NewUint(23726342442), + InboundTxObservedHash: "0x114ed9d327b6afc068c3fa891b82f7c7f2d42ae25a571f7dc004c05e77af592a", + InboundTxObservedExternalHeight: 2241077, + InboundTxBallotIndex: "0x5a100fdb426da35ad4c95520d7a4f1fd2f38c88067c9e80ba209d3a655c6e06e", + InboundTxFinalizedZetaHeight: 0, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0x8d8D67A8B71c141492825CAE5112Ccd8581073f2", + ReceiverChainId: 1, + CoinType: coin.CoinType_ERC20, + Amount: sdkmath.NewUint(23726342442), + OutboundTxTssNonce: 8014, + OutboundTxGasLimit: 100000, + OutboundTxGasPrice: "58619665744", + OutboundTxHash: "0xd2eba7ac3da1b62800165414ea4bcaf69a3b0fb9b13a0fc32f4be11bfef79146", + OutboundTxBallotIndex: "0x4213f2c335758301b8bbb09d9891949ed6ffeea5dd95e5d9eaa8d410baaa0884", + OutboundTxObservedExternalHeight: 19467367, + OutboundTxGasUsed: 60625, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(58619665744), + OutboundTxEffectiveGasLimit: 100000, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + }, +} diff --git a/zetaclient/testdata/cctx/chain_1_cctx_9718.go b/zetaclient/testdata/cctx/chain_1_cctx_9718.go new file mode 100644 index 0000000000..8c42dbdb33 --- /dev/null +++ b/zetaclient/testdata/cctx/chain_1_cctx_9718.go @@ -0,0 +1,53 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/1/9718 +var chain_1_cctx_9718 = &crosschaintypes.CrossChainTx{ + Creator: "", + Index: "0xbf7a214cf9868e1c618123ab4df0081da87bade74eeb5aef37843e35f25e67b7", + ZetaFees: sdkmath.NewUintFromString("19525506001302763608"), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_OutboundMined, + StatusMessage: "", + LastUpdateTimestamp: 1712336965, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0xF0a3F93Ed1B126142E61423F9546bf1323Ff82DF", + SenderChainId: 7000, + TxOrigin: "0x87257C910a19a3fe64AfFAbFe8cF9AAF2ab148BF", + CoinType: coin.CoinType_Zeta, + Asset: "", + Amount: sdkmath.NewUintFromString("20000000000000000000"), + InboundTxObservedHash: "0xb136652cd58fb6a537b0a1677965983059a2004d98919cdacd52551f877cc44f", + InboundTxObservedExternalHeight: 2492552, + InboundTxBallotIndex: "0xbf7a214cf9868e1c618123ab4df0081da87bade74eeb5aef37843e35f25e67b7", + InboundTxFinalizedZetaHeight: 0, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0x30735c88fa430f11499b0edcfcc25246fb9182e3", + ReceiverChainId: 1, + CoinType: coin.CoinType_Zeta, + Amount: sdkmath.NewUint(474493998697236392), + OutboundTxTssNonce: 9718, + OutboundTxGasLimit: 90000, + OutboundTxGasPrice: "112217884384", + OutboundTxHash: "0x81342051b8a85072d3e3771c1a57c7bdb5318e8caf37f5a687b7a91e50a7257f", + OutboundTxBallotIndex: "0xff07eaa34ca02a08bca1558e5f6220cbfc734061f083622b24923e032f0c480f", + OutboundTxObservedExternalHeight: 19590894, + OutboundTxGasUsed: 64651, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(112217884384), + OutboundTxEffectiveGasLimit: 100000, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + }, +} diff --git a/zetaclient/testdata/cctx/chain_1_cctx_intx_ERC20_0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da.go b/zetaclient/testdata/cctx/chain_1_cctx_intx_ERC20_0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da.go new file mode 100644 index 0000000000..3fcc564b22 --- /dev/null +++ b/zetaclient/testdata/cctx/chain_1_cctx_intx_ERC20_0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da.go @@ -0,0 +1,53 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/0xd326700a1931f28853f44f8462f72588f94b1f248214d59a23c3e1b141ff5ede +var chain_1_cctx_intx_ERC20_0x4ea69a0 = &crosschaintypes.CrossChainTx{ + Creator: "zeta1hjct6q7npsspsg3dgvzk3sdf89spmlpf7rqmnw", + Index: "0xd326700a1931f28853f44f8462f72588f94b1f248214d59a23c3e1b141ff5ede", + ZetaFees: sdkmath.NewUintFromString("0"), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_OutboundMined, + StatusMessage: "Remote omnichain contract call completed", + LastUpdateTimestamp: 1709052990, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0x56BF8D4a6E7b59D2C0E40Cba2409a4a30ab4FbE2", + SenderChainId: 1, + TxOrigin: "0x56BF8D4a6E7b59D2C0E40Cba2409a4a30ab4FbE2", + CoinType: coin.CoinType_ERC20, + Asset: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + Amount: sdkmath.NewUintFromString("9992000000"), + InboundTxObservedHash: "0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da", + InboundTxObservedExternalHeight: 19320188, + InboundTxBallotIndex: "0xd326700a1931f28853f44f8462f72588f94b1f248214d59a23c3e1b141ff5ede", + InboundTxFinalizedZetaHeight: 1944675, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0x56bf8d4a6e7b59d2c0e40cba2409a4a30ab4fbe2", + ReceiverChainId: 7000, + CoinType: coin.CoinType_ERC20, + Amount: sdkmath.NewUintFromString("0"), + OutboundTxTssNonce: 0, + OutboundTxGasLimit: 1500000, + OutboundTxGasPrice: "", + OutboundTxHash: "0xf63eaa3e01af477673aa9e86fb634df15d30a00734dab7450cb0fc28dbc9d11b", + OutboundTxBallotIndex: "", + OutboundTxObservedExternalHeight: 1944675, + OutboundTxGasUsed: 0, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(0), + OutboundTxEffectiveGasLimit: 0, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + }, +} diff --git a/zetaclient/testdata/cctx/chain_1_cctx_intx_Gas_0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532.go b/zetaclient/testdata/cctx/chain_1_cctx_intx_Gas_0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532.go new file mode 100644 index 0000000000..d281302309 --- /dev/null +++ b/zetaclient/testdata/cctx/chain_1_cctx_intx_Gas_0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532.go @@ -0,0 +1,53 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098 +var chain_1_cctx_intx_Gas_0xeaec67d = &crosschaintypes.CrossChainTx{ + Creator: "zeta1hjct6q7npsspsg3dgvzk3sdf89spmlpf7rqmnw", + Index: "0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098", + ZetaFees: sdkmath.NewUint(0), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_OutboundMined, + StatusMessage: "Remote omnichain contract call completed", + LastUpdateTimestamp: 1709177431, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0xF829fa7069680b8C37A8086b37d4a24697E5003b", + SenderChainId: 1, + TxOrigin: "0xF829fa7069680b8C37A8086b37d4a24697E5003b", + CoinType: coin.CoinType_Gas, + Asset: "", + Amount: sdkmath.NewUintFromString("4000000000000000"), + InboundTxObservedHash: "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532", + InboundTxObservedExternalHeight: 19330473, + InboundTxBallotIndex: "0x0210925c7dceeff563e6e240d6d650a5f0e8fca6f5b76044a6cf106d21f27098", + InboundTxFinalizedZetaHeight: 1965579, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0xF829fa7069680b8C37A8086b37d4a24697E5003b", + ReceiverChainId: 7000, + CoinType: coin.CoinType_Gas, + Amount: sdkmath.NewUint(0), + OutboundTxTssNonce: 0, + OutboundTxGasLimit: 90000, + OutboundTxGasPrice: "", + OutboundTxHash: "0x3b8c1dab5aa21ff90ddb569f2f962ff2d4aa8d914c9177900102e745955e6f35", + OutboundTxBallotIndex: "", + OutboundTxObservedExternalHeight: 1965579, + OutboundTxGasUsed: 0, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(0), + OutboundTxEffectiveGasLimit: 0, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + }, +} diff --git a/zetaclient/testdata/cctx/chain_1_cctx_intx_Zeta_0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76.go b/zetaclient/testdata/cctx/chain_1_cctx_intx_Zeta_0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76.go new file mode 100644 index 0000000000..22162d8ab7 --- /dev/null +++ b/zetaclient/testdata/cctx/chain_1_cctx_intx_Zeta_0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76.go @@ -0,0 +1,53 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/0x477544c4b8c8be544b23328b21286125c89cd6bb5d1d6d388d91eea8ea1a6f1f +var chain_1_cctx_intx_Zeta_0xf393520 = &crosschaintypes.CrossChainTx{ + Creator: "zeta1p0uwsq4naus5r4l7l744upy0k8ezzj84mn40nf", + Index: "0x477544c4b8c8be544b23328b21286125c89cd6bb5d1d6d388d91eea8ea1a6f1f", + ZetaFees: sdkmath.NewUintFromString("0"), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_OutboundMined, + StatusMessage: "Remote omnichain contract call completed", + LastUpdateTimestamp: 1708490549, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0x2f993766e8e1Ef9288B1F33F6aa244911A0A77a7", + SenderChainId: 1, + TxOrigin: "0x2f993766e8e1Ef9288B1F33F6aa244911A0A77a7", + CoinType: coin.CoinType_Zeta, + Asset: "", + Amount: sdkmath.NewUintFromString("20000000000000000000"), + InboundTxObservedHash: "0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76", + InboundTxObservedExternalHeight: 19273702, + InboundTxBallotIndex: "0x477544c4b8c8be544b23328b21286125c89cd6bb5d1d6d388d91eea8ea1a6f1f", + InboundTxFinalizedZetaHeight: 1851403, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0x2f993766e8e1ef9288b1f33f6aa244911a0a77a7", + ReceiverChainId: 7000, + CoinType: coin.CoinType_Zeta, + Amount: sdkmath.ZeroUint(), + OutboundTxTssNonce: 0, + OutboundTxGasLimit: 100000, + OutboundTxGasPrice: "", + OutboundTxHash: "0x947434364da7c74d7e896a389aa8cb3122faf24bbcba64b141cb5acd7838209c", + OutboundTxBallotIndex: "", + OutboundTxObservedExternalHeight: 1851403, + OutboundTxGasUsed: 0, + OutboundTxEffectiveGasPrice: sdkmath.ZeroInt(), + OutboundTxEffectiveGasLimit: 0, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + }, +} diff --git a/zetaclient/testdata/cctx/chain_56_cctx_68270.go b/zetaclient/testdata/cctx/chain_56_cctx_68270.go new file mode 100644 index 0000000000..d39ddc17f1 --- /dev/null +++ b/zetaclient/testdata/cctx/chain_56_cctx_68270.go @@ -0,0 +1,53 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/56/68270 +var chain_56_cctx_68270 = &crosschaintypes.CrossChainTx{ + Creator: "", + Index: "0x541b570182950809f9b9077861a0fc7038af9a14ce8af4e151a83adfa308c7a9", + ZetaFees: sdkmath.ZeroUint(), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_PendingOutbound, + StatusMessage: "", + LastUpdateTimestamp: 1709145183, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0xd91b507F2A3e2D4A32d0C86Ac19FEAD2D461008D", + SenderChainId: 7000, + TxOrigin: "0xb0C04e07A301927672A8A7a874DB6930576C90B8", + CoinType: coin.CoinType_Gas, + Asset: "", + Amount: sdkmath.NewUint(657177295293237048), + InboundTxObservedHash: "0x093f4ca4c1884df0fd9dd59b75979342ded29d3c9b6861644287a2e1417b9a39", + InboundTxObservedExternalHeight: 1960153, + InboundTxBallotIndex: "0x541b570182950809f9b9077861a0fc7038af9a14ce8af4e151a83adfa308c7a9", + InboundTxFinalizedZetaHeight: 0, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "0xb0C04e07A301927672A8A7a874DB6930576C90B8", + ReceiverChainId: 56, + CoinType: coin.CoinType_Gas, + Amount: sdkmath.NewUint(657177295293237048), + OutboundTxTssNonce: 68270, + OutboundTxGasLimit: 21000, + OutboundTxGasPrice: "6000000000", + OutboundTxHash: "0xeb2b183ece6638688b9df9223180b13a67208cd744bbdadeab8de0482d7f4e3c", + OutboundTxBallotIndex: "0xa4600c952934f797e162d637d70859a611757407908d96bc53e45a81c80b006b", + OutboundTxObservedExternalHeight: 36537856, + OutboundTxGasUsed: 21000, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(6000000000), + OutboundTxEffectiveGasLimit: 21000, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + }, +} diff --git a/zetaclient/testdata/cctx/chain_8332_cctx_148.go b/zetaclient/testdata/cctx/chain_8332_cctx_148.go new file mode 100644 index 0000000000..f679164bda --- /dev/null +++ b/zetaclient/testdata/cctx/chain_8332_cctx_148.go @@ -0,0 +1,52 @@ +package cctx + +import ( + sdkmath "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// https://zetachain-mainnet-archive.allthatnode.com:1317/zeta-chain/crosschain/cctx/8332/148 +var chain_8332_cctx_148 = &crosschaintypes.CrossChainTx{ + Creator: "", + Index: "0xb3f5f3cf2ed2e0c3fa64c8297c9e50fbc07351fb2d26d8eae4cfbbd45e47a524", + ZetaFees: sdkmath.ZeroUint(), + RelayedMessage: "", + CctxStatus: &crosschaintypes.Status{ + Status: crosschaintypes.CctxStatus_OutboundMined, + StatusMessage: "", + LastUpdateTimestamp: 1708608895, + IsAbortRefunded: false, + }, + InboundTxParams: &crosschaintypes.InboundTxParams{ + Sender: "0x13A0c5930C028511Dc02665E7285134B6d11A5f4", + SenderChainId: 7000, + TxOrigin: "0xe99174F08e1186134830f8511De06bd010978533", + CoinType: coin.CoinType_Gas, + Asset: "", + Amount: sdkmath.NewUint(12000), + InboundTxObservedHash: "0x06455013319acb1b027461134853c77b003d8eab162b1f37673da5ad8a50b74f", + InboundTxObservedExternalHeight: 1870408, + InboundTxBallotIndex: "0xb3f5f3cf2ed2e0c3fa64c8297c9e50fbc07351fb2d26d8eae4cfbbd45e47a524", + InboundTxFinalizedZetaHeight: 0, + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_NotFinalized, + }, + OutboundTxParams: []*crosschaintypes.OutboundTxParams{ + { + Receiver: "bc1qpsdlklfcmlcfgm77c43x65ddtrt7n0z57hsyjp", + ReceiverChainId: 8332, + CoinType: coin.CoinType_Gas, + Amount: sdkmath.NewUint(12000), + OutboundTxTssNonce: 148, + OutboundTxGasLimit: 254, + OutboundTxGasPrice: "46", + OutboundTxHash: "030cd813443f7b70cc6d8a544d320c6d8465e4528fc0f3410b599dc0b26753a0", + OutboundTxObservedExternalHeight: 150, + OutboundTxGasUsed: 0, + OutboundTxEffectiveGasPrice: sdkmath.NewInt(0), + OutboundTxEffectiveGasLimit: 0, + TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", + TxFinalizationStatus: crosschaintypes.TxFinalizationStatus_Executed, + }, + }, +} diff --git a/zetaclient/testutils/stub/chain_client.go b/zetaclient/testutils/stub/chain_client.go index e6bcdf03b9..a79cc3f731 100644 --- a/zetaclient/testutils/stub/chain_client.go +++ b/zetaclient/testutils/stub/chain_client.go @@ -29,7 +29,7 @@ func (s *EVMClient) Start() { func (s *EVMClient) Stop() { } -func (s *EVMClient) IsCctxOutTxProcessed(_ *crosschaintypes.CrossChainTx, _ zerolog.Logger) (bool, bool, error) { +func (s *EVMClient) IsOutboundProcessed(_ *crosschaintypes.CrossChainTx, _ zerolog.Logger) (bool, bool, error) { return false, false, nil } @@ -70,7 +70,7 @@ func (s *BTCClient) Start() { func (s *BTCClient) Stop() { } -func (s *BTCClient) IsCctxOutTxProcessed(_ *crosschaintypes.CrossChainTx, _ zerolog.Logger) (bool, bool, error) { +func (s *BTCClient) IsOutboundProcessed(_ *crosschaintypes.CrossChainTx, _ zerolog.Logger) (bool, bool, error) { return false, false, nil } diff --git a/zetaclient/testutils/testdata.go b/zetaclient/testutils/testdata.go index d9e1981c6e..001ca2b07b 100644 --- a/zetaclient/testutils/testdata.go +++ b/zetaclient/testutils/testdata.go @@ -14,6 +14,7 @@ import ( "github.com/zeta-chain/zetacore/pkg/coin" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/zetaclient/config" + testcctx "github.com/zeta-chain/zetacore/zetaclient/testdata/cctx" ) const ( @@ -24,6 +25,16 @@ const ( RestrictedBtcAddressTest = "bcrt1qzp4gt6fc7zkds09kfzaf9ln9c5rvrzxmy6qmpp" ) +// cloneCctx returns a deep copy of the cctx +func cloneCctx(t *testing.T, cctx *crosschaintypes.CrossChainTx) *crosschaintypes.CrossChainTx { + data, err := cctx.Marshal() + require.NoError(t, err) + cloned := &crosschaintypes.CrossChainTx{} + err = cloned.Unmarshal(data) + require.NoError(t, err) + return cloned +} + // SaveObjectToJSONFile saves an object to a file in JSON format func SaveObjectToJSONFile(obj interface{}, filename string) error { file, err := os.Create(filepath.Clean(filename)) @@ -76,6 +87,48 @@ func SaveBTCBlockTrimTx(blockVb *btcjson.GetBlockVerboseTxResult, filename strin return SaveObjectToJSONFile(blockVb, filename) } +// LoadCctxByIntx loads archived cctx by intx +func LoadCctxByIntx( + t *testing.T, + chainID int64, + coinType coin.CoinType, + intxHash string, +) *crosschaintypes.CrossChainTx { + // nameCctx := path.Join("../", TestDataPathCctx, FileNameCctxByIntx(chainID, intxHash, coinType)) + + // cctx := &crosschaintypes.CrossChainTx{} + // LoadObjectFromJSONFile(t, &cctx, nameCctx) + // return cctx + + // get cctx + cctx, found := testcctx.CctxByIntxMap[chainID][coinType][intxHash] + require.True(t, found) + + // clone cctx for each individual test + cloned := cloneCctx(t, cctx) + return cloned +} + +// LoadCctxByNonce loads archived cctx by nonce +func LoadCctxByNonce( + t *testing.T, + chainID int64, + nonce uint64, +) *crosschaintypes.CrossChainTx { + // nameCctx := path.Join("../", TestDataPathCctx, FileNameCctxByNonce(chainID, nonce)) + + // cctx := &crosschaintypes.CrossChainTx{} + // LoadObjectFromJSONFile(t, &cctx, nameCctx) + + // get cctx + cctx, found := testcctx.CCtxByNonceMap[chainID][nonce] + require.True(t, found) + + // clone cctx for each individual test + cloned := cloneCctx(t, cctx) + return cloned +} + // LoadEVMBlock loads archived evm block from file func LoadEVMBlock(t *testing.T, chainID int64, blockNumber uint64, trimmed bool) *ethrpc.Block { name := path.Join("../", TestDataPathEVM, FileNameEVMBlock(chainID, blockNumber, trimmed)) @@ -99,9 +152,7 @@ func LoadBTCTxRawResultNCctx(t *testing.T, chainID int64, nonce uint64) (*btcjso rawResult := &btcjson.TxRawResult{} LoadObjectFromJSONFile(t, rawResult, nameTx) - nameCctx := path.Join("../", TestDataPathCctx, FileNameCctxByNonce(chainID, nonce)) - cctx := &crosschaintypes.CrossChainTx{} - LoadObjectFromJSONFile(t, cctx, nameCctx) + cctx := LoadCctxByNonce(t, chainID, nonce) return rawResult, cctx } @@ -131,31 +182,6 @@ func LoadEVMIntxReceipt( return receipt } -// LoadEVMIntxCctx loads archived intx cctx from file -func LoadEVMIntxCctx( - t *testing.T, - chainID int64, - intxHash string, - coinType coin.CoinType) *crosschaintypes.CrossChainTx { - nameCctx := path.Join("../", TestDataPathCctx, FileNameEVMIntxCctx(chainID, intxHash, coinType)) - - cctx := &crosschaintypes.CrossChainTx{} - LoadObjectFromJSONFile(t, &cctx, nameCctx) - return cctx -} - -// LoadCctxByNonce loads archived cctx by nonce from file -func LoadCctxByNonce( - t *testing.T, - chainID int64, - nonce uint64) *crosschaintypes.CrossChainTx { - nameCctx := path.Join("../", TestDataPathCctx, FileNameCctxByNonce(chainID, nonce)) - - cctx := &crosschaintypes.CrossChainTx{} - LoadObjectFromJSONFile(t, &cctx, nameCctx) - return cctx -} - // LoadEVMIntxNReceipt loads archived intx and receipt from file func LoadEVMIntxNReceipt( t *testing.T, @@ -217,7 +243,7 @@ func LoadEVMIntxNReceiptNCctx( // load archived intx, receipt and cctx tx := LoadEVMIntx(t, chainID, intxHash, coinType) receipt := LoadEVMIntxReceipt(t, chainID, intxHash, coinType) - cctx := LoadEVMIntxCctx(t, chainID, intxHash, coinType) + cctx := LoadCctxByIntx(t, chainID, coinType, intxHash) return tx, receipt, cctx } diff --git a/zetaclient/testutils/testdata_naming.go b/zetaclient/testutils/testdata_naming.go index 47928ff934..675a1a7b0b 100644 --- a/zetaclient/testutils/testdata_naming.go +++ b/zetaclient/testutils/testdata_naming.go @@ -14,6 +14,16 @@ func FileNameEVMBlock(chainID int64, blockNumber uint64, trimmed bool) string { return fmt.Sprintf("chain_%d_block_ethrpc_trimmed_%d.json", chainID, blockNumber) } +// FileNameCctxByIntx returns unified archive cctx file name by intx +func FileNameCctxByIntx(chainID int64, intxHash string, coinType coin.CoinType) string { + return fmt.Sprintf("cctx_intx_%d_%s_%s.json", chainID, coinType, intxHash) +} + +// FileNameCctxByNonce returns unified archive cctx file name by nonce +func FileNameCctxByNonce(chainID int64, nonce uint64) string { + return fmt.Sprintf("chain_%d_cctx_%d.json", chainID, nonce) +} + // FileNameEVMIntx returns unified archive file name for inbound tx func FileNameEVMIntx(chainID int64, intxHash string, coinType coin.CoinType, donation bool) string { if !donation { @@ -30,11 +40,6 @@ func FileNameEVMIntxReceipt(chainID int64, intxHash string, coinType coin.CoinTy return fmt.Sprintf("chain_%d_intx_receipt_donation_%s_%s.json", chainID, coinType, intxHash) } -// FileNameEVMIntxCctx returns unified archive file name for inbound cctx -func FileNameEVMIntxCctx(chainID int64, intxHash string, coinType coin.CoinType) string { - return fmt.Sprintf("cctx_intx_%d_%s_%s.json", chainID, coinType, intxHash) -} - // FileNameBTCIntx returns unified archive file name for inbound tx func FileNameBTCIntx(chainID int64, intxHash string, donation bool) string { if !donation { @@ -59,11 +64,6 @@ func FileNameBTCMsgTx(chainID int64, txHash string) string { return fmt.Sprintf("chain_%d_msgtx_%s.json", chainID, txHash) } -// FileNameCctxByNonce returns unified archive file name for cctx by nonce -func FileNameCctxByNonce(chainID int64, nonce uint64) string { - return fmt.Sprintf("cctx_%d_%d.json", chainID, nonce) -} - // FileNameEVMOuttx returns unified archive file name for outbound tx func FileNameEVMOuttx(chainID int64, txHash string, coinType coin.CoinType) string { return fmt.Sprintf("chain_%d_outtx_%s_%s.json", chainID, coinType, txHash) diff --git a/zetaclient/zetacore_observer.go b/zetaclient/zetacore_observer.go index 6c3ce5beae..48771bc9bc 100644 --- a/zetaclient/zetacore_observer.go +++ b/zetaclient/zetacore_observer.go @@ -218,9 +218,9 @@ func (co *CoreObserver) scheduleCctxEVM( } // try confirming the outtx - included, _, err := ob.IsCctxOutTxProcessed(cctx, co.logger.ZetaChainWatcher) + included, _, err := ob.IsOutboundProcessed(cctx, co.logger.ZetaChainWatcher) if err != nil { - co.logger.ZetaChainWatcher.Error().Err(err).Msgf("scheduleCctxEVM: IsCctxOutTxProcessed faild for chain %d nonce %d", chainID, nonce) + co.logger.ZetaChainWatcher.Error().Err(err).Msgf("scheduleCctxEVM: IsOutboundProcessed faild for chain %d nonce %d", chainID, nonce) continue } if included { @@ -298,9 +298,9 @@ func (co *CoreObserver) scheduleCctxBTC( continue } // try confirming the outtx - included, confirmed, err := btcClient.IsCctxOutTxProcessed(cctx, co.logger.ZetaChainWatcher) + included, confirmed, err := btcClient.IsOutboundProcessed(cctx, co.logger.ZetaChainWatcher) if err != nil { - co.logger.ZetaChainWatcher.Error().Err(err).Msgf("scheduleCctxBTC: IsCctxOutTxProcessed faild for chain %d nonce %d", chainID, nonce) + co.logger.ZetaChainWatcher.Error().Err(err).Msgf("scheduleCctxBTC: IsOutboundProcessed faild for chain %d nonce %d", chainID, nonce) continue } if included || confirmed {