From 57beff23c663d9d64aab3fe50e16e0f2a3cc1d3c Mon Sep 17 00:00:00 2001 From: vincentysc Date: Wed, 4 Dec 2024 10:45:45 +0800 Subject: [PATCH] update test case --- .../v1_4_0_cronos/msg_ethereum_tx_test.go | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 usecase/parser/v1_4_0_cronos/msg_ethereum_tx_test.go diff --git a/usecase/parser/v1_4_0_cronos/msg_ethereum_tx_test.go b/usecase/parser/v1_4_0_cronos/msg_ethereum_tx_test.go deleted file mode 100644 index b2623c4f..00000000 --- a/usecase/parser/v1_4_0_cronos/msg_ethereum_tx_test.go +++ /dev/null @@ -1,108 +0,0 @@ -package parser_test - -import ( - "fmt" - "strings" - - "github.com/crypto-com/chain-indexing/usecase/model" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/crypto-com/chain-indexing/infrastructure/cosmosapp" - "github.com/crypto-com/chain-indexing/infrastructure/tendermint" - command_usecase "github.com/crypto-com/chain-indexing/usecase/command" - "github.com/crypto-com/chain-indexing/usecase/event" - "github.com/crypto-com/chain-indexing/usecase/parser" - V1_4_0_msg "github.com/crypto-com/chain-indexing/usecase/parser/v1_4_0_cronos/msg" - - usecase_parser_test "github.com/crypto-com/chain-indexing/usecase/parser/test" - usecase_parser_V1_4_0_test "github.com/crypto-com/chain-indexing/usecase/parser/v1_4_0_cronos/test" -) - -var _ = Describe("ParseMsgCommands", func() { - Describe("MsgEthereumTx", func() { - It("should parse Msg commands when there is MsgEthereumTx in the transaction", func() { - block, _, _ := tendermint.ParseBlockResp(strings.NewReader( - usecase_parser_V1_4_0_test.TX_MSG_ETHEREUM_TX_BLOCK_RESP, - )) - blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( - usecase_parser_V1_4_0_test.TX_MSG_ETHEREUM_TX_BLOCK_RESULTS_RESP, - ), &tendermint.RawBlockResultEventAttributeDecoder{}) - - tx := MustParseTxsResp(usecase_parser_V1_4_0_test.TX_MSG_ETHEREUM_TX_TXS_RESP) - txs := []model.CosmosTxWithHash{*tx} - - accountAddressPrefix := "tcro" - stakingDenom := "basecro" - - pm := usecase_parser_test.InitParserManager() - pm.RegisterParser("/ethermint.evm.v1.MsgEthereumTx", 27101800, V1_4_0_msg.ParseMsgEthereumTx) - - cmds, possibleSignerAddresses, err := parser.ParseBlockTxsMsgToCommands( - pm, - block.Height, - blockResults, - txs, - accountAddressPrefix, - stakingDenom, - ) - Expect(err).To(BeNil()) - Expect(cmds).To(HaveLen(1)) - cmd := cmds[0] - Expect(cmd.Name()).To(Equal("/ethermint.evm.v1.MsgEthereumTx.Create")) - - Expect(cmd).To(Equal(command_usecase.NewCreateMsgEthereumTx( - event.MsgCommonParams{ - BlockHeight: int64(27101811), - TxHash: "C25934D736EFAD9CF2978EEAAB166AE12534351EF4AF9ABC28CBA78B3296D451", - TxSuccess: true, - MsgIndex: 0, - }, - model.MsgEthereumTxParams{ - RawMsgEthereumTx: model.RawMsgEthereumTx{ - - Type: "/ethermint.evm.v1.MsgEthereumTx", - Size: 0, - Data: nil, - From: "0xc4468854fe73744d7d9805eb52fde77c5169ed6b", - Hash: "", - Raw: "0xf90430824f0e8606d23ad5f80083010df594b6256dcb23cee06eda2408e73945963606fdddd780b903c43798c7f2000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000006732fc2200000000000000000000000000000000000000000000000000000000017302d6000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000343524f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034441490000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000345544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004555344430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045553445400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000457425443000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000c4c7000000000000000000000000000000000000000000000000000000000003baa0c3f00000000000000000000000000000000000000000000000000000313a9eacf80000000000000000000000000000000000000000000000000000000003b97bcc0000000000000000000000000000000000000000000000000000000003bab44c00000000000000000000000000000000000000000000000000000519c73d3ac008202c7a056a66c6115dcbf7824e07203fab30da6b4bbf6126fe4ad4be71784525c0693a9a0428593e87eedc78f7ad7670ceb0d10c1a3ecd145571dc46a4af7f82b1a46ff55", - DecodedRaw: &model.DecodedRaw{ - Type: "0x0", - Hash: "0x3094941c989efc91ad9f8fec4d24a565b7f4423fb15738875eaf9fac633eb741", - Nonce: "0x4f0e", - GasLimit: "", - GasPrice: "0x6d23ad5f800", - MaxFeePerGas: "", - MaxPriorityFeePerGas: "", - From: "", - To: "0xb6256dcb23cee06eda2408e73945963606fdddd7", - PublicKey: "", - V: "0x2c7", - R: "0x56a66c6115dcbf7824e07203fab30da6b4bbf6126fe4ad4be71784525c0693a9", - S: "0x428593e87eedc78f7ad7670ceb0d10c1a3ecd145571dc46a4af7f82b1a46ff55", - Value: "0x0", - Input: "0x3798c7f2000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000006732fc2200000000000000000000000000000000000000000000000000000000017302d6000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000343524f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034441490000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000345544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004555344430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045553445400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000457425443000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000c4c7000000000000000000000000000000000000000000000000000000000003baa0c3f00000000000000000000000000000000000000000000000000000313a9eacf80000000000000000000000000000000000000000000000000000000003b97bcc0000000000000000000000000000000000000000000000000000000003bab44c00000000000000000000000000000000000000000000000000000519c73d3ac00", - }, - }, - }, - ))) - var emptyAddress []string - Expect(possibleSignerAddresses).To(Equal(emptyAddress)) - }) - }) -}) - -func MustParseTxsResp(rawResp string) *model.CosmosTxWithHash { - tx, err := cosmosapp.ParseTxsResp(strings.NewReader(rawResp)) - - if err != nil { - panic(fmt.Sprintf("error parsing block results response: %v", err)) - } - - return &model.CosmosTxWithHash{ - Tx: tx.Tx, - Hash: tx.TxResponse.TxHash, - } -}