diff --git a/appinterface/tendermint/blockresulteventattrivutedecoder.go b/appinterface/tendermint/blockresulteventattrivutedecoder.go new file mode 100644 index 000000000..29dbd31b2 --- /dev/null +++ b/appinterface/tendermint/blockresulteventattrivutedecoder.go @@ -0,0 +1,6 @@ +package tendermint + +type BlockResultEventAttributeDecoder interface { + DecodeKey(string) (string, error) + DecodeValue(string) (string, error) +} diff --git a/appinterface/tendermint/client.go b/appinterface/tendermint/client.go index de979cf10..7d0d3107b 100644 --- a/appinterface/tendermint/client.go +++ b/appinterface/tendermint/client.go @@ -9,6 +9,6 @@ type Client interface { Genesis() (*genesis.Genesis, error) GenesisChunked() (*genesis.Genesis, error) Block(height int64) (*usecase_model.Block, *usecase_model.RawBlock, error) - BlockResults(height int64) (*usecase_model.BlockResults, error) + BlockResults(height int64, decoder BlockResultEventAttributeDecoder) (*usecase_model.BlockResults, error) LatestBlockHeight() (int64, error) } diff --git a/bootstrap/config/config.go b/bootstrap/config/config.go index ede886161..2e230592a 100644 --- a/bootstrap/config/config.go +++ b/bootstrap/config/config.go @@ -16,14 +16,15 @@ type Config struct { } type IndexService struct { - Enable bool `yaml:"enable" toml:"enable" xml:"enable" json:"enable,omitempty"` - StartingBlockHeight int64 `yaml:"starting_block_height" toml:"starting_block_height" xml:"starting_block_height" json:"starting_block_height,omitempty"` - Mode string `yaml:"mode" toml:"mode" xml:"mode" json:"mode,omitempty"` - WindowSize int `yaml:"window_size" toml:"window_size" xml:"window_size" json:"window_size,omitempty"` - Projection Projection `yaml:"projection" toml:"projection" xml:"projection" json:"projection"` - CronJob CronJob `yaml:"cron_job" toml:"cron_job" xml:"cron_job" json:"cron_job"` - CosmosVersionEnabledHeight CosmosVersionEnabledHeight `yaml:"cosmos_version_enabled_height" toml:"cosmos_version_enabled_height" xml:"cosmos_version_enabled_height" json:"cosmos_version_enabled_height"` - GithubAPI GithubAPI `yaml:"github_api" toml:"github_api" xml:"github_api" json:"github_api"` + Enable bool `yaml:"enable" toml:"enable" xml:"enable" json:"enable,omitempty"` + StartingBlockHeight int64 `yaml:"starting_block_height" toml:"starting_block_height" xml:"starting_block_height" json:"starting_block_height,omitempty"` + Mode string `yaml:"mode" toml:"mode" xml:"mode" json:"mode,omitempty"` + WindowSize int `yaml:"window_size" toml:"window_size" xml:"window_size" json:"window_size,omitempty"` + Projection Projection `yaml:"projection" toml:"projection" xml:"projection" json:"projection"` + CronJob CronJob `yaml:"cron_job" toml:"cron_job" xml:"cron_job" json:"cron_job"` + CosmosVersionEnabledHeight CosmosVersionEnabledHeight `yaml:"cosmos_version_enabled_height" toml:"cosmos_version_enabled_height" xml:"cosmos_version_enabled_height" json:"cosmos_version_enabled_height"` + GithubAPI GithubAPI `yaml:"github_api" toml:"github_api" xml:"github_api" json:"github_api"` + BlockResultEventAttributeDecodeMethod string `yaml:"block_result_event_attribute_decode_method" toml:"block_result_event_attribute_decode_method" xml:"block_result_event_attribute_decode_method" json:"block_result_event_attribute_decode_method"` } type HTTPService struct { diff --git a/bootstrap/indexservice.go b/bootstrap/indexservice.go index 1573eac7a..fe0dc7026 100644 --- a/bootstrap/indexservice.go +++ b/bootstrap/indexservice.go @@ -22,17 +22,18 @@ type IndexService struct { projections []projection_entity.Projection cronJobs []projection_entity.CronJob - mode string - accountAddressPrefix string - consNodeAddressPrefix string - bondingDenom string - windowSize int - tendermintHTTPRPCURL string - cosmosAppHTTPRPCURL string - insecureTendermintClient bool - insecureCosmosAppClient bool - strictGenesisParsing bool - startingBlockHeight int64 + mode string + accountAddressPrefix string + consNodeAddressPrefix string + bondingDenom string + windowSize int + tendermintHTTPRPCURL string + cosmosAppHTTPRPCURL string + insecureTendermintClient bool + insecureCosmosAppClient bool + strictGenesisParsing bool + startingBlockHeight int64 + BlockResultEventAttributeDecodeMethod string cosmosVersionBlockHeight utils.CosmosVersionBlockHeight @@ -57,17 +58,18 @@ func NewIndexService( projections: projections, cronJobs: cronJobs, - mode: config.IndexService.Mode, - consNodeAddressPrefix: config.Blockchain.ConNodeAddressPrefix, - accountAddressPrefix: config.Blockchain.AccountAddressPrefix, - bondingDenom: config.Blockchain.BondingDenom, - windowSize: config.IndexService.WindowSize, - tendermintHTTPRPCURL: config.TendermintApp.HTTPRPCUrl, - cosmosAppHTTPRPCURL: config.CosmosApp.HTTPRPCUrl, - insecureTendermintClient: config.TendermintApp.Insecure, - insecureCosmosAppClient: config.CosmosApp.Insecure, - strictGenesisParsing: config.TendermintApp.StrictGenesisParsing, - startingBlockHeight: config.IndexService.StartingBlockHeight, + mode: config.IndexService.Mode, + consNodeAddressPrefix: config.Blockchain.ConNodeAddressPrefix, + accountAddressPrefix: config.Blockchain.AccountAddressPrefix, + bondingDenom: config.Blockchain.BondingDenom, + windowSize: config.IndexService.WindowSize, + tendermintHTTPRPCURL: config.TendermintApp.HTTPRPCUrl, + cosmosAppHTTPRPCURL: config.CosmosApp.HTTPRPCUrl, + insecureTendermintClient: config.TendermintApp.Insecure, + insecureCosmosAppClient: config.CosmosApp.Insecure, + strictGenesisParsing: config.TendermintApp.StrictGenesisParsing, + startingBlockHeight: config.IndexService.StartingBlockHeight, + BlockResultEventAttributeDecodeMethod: config.IndexService.BlockResultEventAttributeDecodeMethod, cosmosVersionBlockHeight: utils.CosmosVersionBlockHeight{ V0_42_7: utils.ParserBlockHeight(config.IndexService.CosmosVersionEnabledHeight.V0_42_7), }, @@ -144,15 +146,16 @@ func (service *IndexService) RunEventStoreMode() error { Logger: service.logger, RDbConn: service.rdbConn, Config: SyncManagerConfig{ - WindowSize: service.windowSize, - TendermintRPCUrl: service.tendermintHTTPRPCURL, - CosmosAppHTTPRPCURL: service.cosmosAppHTTPRPCURL, - InsecureTendermintClient: service.insecureTendermintClient, - InsecureCosmosAppClient: service.insecureCosmosAppClient, - StrictGenesisParsing: service.strictGenesisParsing, - AccountAddressPrefix: service.accountAddressPrefix, - StakingDenom: service.bondingDenom, - StartingBlockHeight: service.startingBlockHeight, + WindowSize: service.windowSize, + TendermintRPCUrl: service.tendermintHTTPRPCURL, + CosmosAppHTTPRPCURL: service.cosmosAppHTTPRPCURL, + InsecureTendermintClient: service.insecureTendermintClient, + InsecureCosmosAppClient: service.insecureCosmosAppClient, + StrictGenesisParsing: service.strictGenesisParsing, + AccountAddressPrefix: service.accountAddressPrefix, + StakingDenom: service.bondingDenom, + StartingBlockHeight: service.startingBlockHeight, + BlockResultEventAttributeDecodeMethod: service.BlockResultEventAttributeDecodeMethod, }, TxDecoder: service.txDecoder, }, diff --git a/bootstrap/syncmanager.go b/bootstrap/syncmanager.go index 2848e3b49..dd31e1a0a 100644 --- a/bootstrap/syncmanager.go +++ b/bootstrap/syncmanager.go @@ -7,6 +7,7 @@ import ( "github.com/cenkalti/backoff/v4" cosmosapp_interface "github.com/crypto-com/chain-indexing/appinterface/cosmosapp" eventhandler_interface "github.com/crypto-com/chain-indexing/appinterface/eventhandler" + tendermint_interface "github.com/crypto-com/chain-indexing/appinterface/tendermint" "github.com/crypto-com/chain-indexing/external/txdecoder" cosmosapp_infrastructure "github.com/crypto-com/chain-indexing/infrastructure/cosmosapp" "github.com/crypto-com/chain-indexing/usecase/model" @@ -54,6 +55,8 @@ type SyncManager struct { startingBlockHeight int64 txDecoder txdecoder.TxDecoder + + eventAttributeDecoder tendermint_interface.BlockResultEventAttributeDecoder } type SyncManagerParams struct { @@ -65,15 +68,16 @@ type SyncManagerParams struct { } type SyncManagerConfig struct { - WindowSize int - TendermintRPCUrl string - CosmosAppHTTPRPCURL string - InsecureTendermintClient bool - InsecureCosmosAppClient bool - StrictGenesisParsing bool - AccountAddressPrefix string - StakingDenom string - StartingBlockHeight int64 + WindowSize int + TendermintRPCUrl string + CosmosAppHTTPRPCURL string + InsecureTendermintClient bool + InsecureCosmosAppClient bool + StrictGenesisParsing bool + AccountAddressPrefix string + StakingDenom string + StartingBlockHeight int64 + BlockResultEventAttributeDecodeMethod string } // NewSyncManager creates a new feed with polling for latest block starts at a specific height @@ -106,6 +110,15 @@ func NewSyncManager( ) } + var eventAttributeDecoder tendermint_interface.BlockResultEventAttributeDecoder + + switch params.Config.BlockResultEventAttributeDecodeMethod { + case "base64": + eventAttributeDecoder = &tendermint.Base64BlockResultEventAttributeDecoder{} + default: + eventAttributeDecoder = &tendermint.RawBlockResultEventAttributeDecoder{} + } + return &SyncManager{ rdbConn: params.RDbConn, tendermintClient: tendermintClient, @@ -132,6 +145,8 @@ func NewSyncManager( startingBlockHeight: params.Config.StartingBlockHeight, txDecoder: params.TxDecoder, + + eventAttributeDecoder: eventAttributeDecoder, } } @@ -241,7 +256,7 @@ func (manager *SyncManager) syncBlockWorker(blockHeight int64) ([]command_entity return nil, fmt.Errorf("error requesting chain block at height %d: %v", blockHeight, err) } - blockResults, err := manager.tendermintClient.BlockResults(blockHeight) + blockResults, err := manager.tendermintClient.BlockResults(blockHeight, manager.eventAttributeDecoder) if err != nil { return nil, fmt.Errorf("error requesting chain block_results at height %d: %v", blockHeight, err) } diff --git a/example/go.sum b/example/go.sum index 42de6b740..bb30ac037 100644 --- a/example/go.sum +++ b/example/go.sum @@ -482,6 +482,7 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crypto-com/chain-indexing v1.2.1-0.20220111132225-b2712ba4fe23 h1:Pit1X4i8SXU/pUg60mo3tj/fKM+xYJ5j3TGtBK41D3k= github.com/crypto-com/chain-indexing v1.2.1-0.20220111132225-b2712ba4fe23/go.mod h1:0KBBR7C2RZDavMpCBKlNtHkMZZ7tyndioZQRWUTD4YI= +github.com/crypto-com/chain-indexing v1.3.0/go.mod h1:0KBBR7C2RZDavMpCBKlNtHkMZZ7tyndioZQRWUTD4YI= github.com/crypto-org-chain/chain-main/v3 v3.0.0-croeseid h1:YAffq+tYiSqYXgIb11Vc6dvBtgSvRsf2g1wPaMFkQUA= github.com/crypto-org-chain/chain-main/v3 v3.0.0-croeseid/go.mod h1:92Z70bDbsScrWzIHB496p7nXKydtq5am9rqa0fCpbM8= github.com/crypto-org-chain/cronos v0.6.0-testnet h1:iFLwra4QMZ6HgIEB1P0vMCa9pnQTeXjwSuYbH4glxqA= diff --git a/infrastructure/httpapi/handlers/blocks.go b/infrastructure/httpapi/handlers/blocks.go index 1da3fde2e..25e65c767 100644 --- a/infrastructure/httpapi/handlers/blocks.go +++ b/infrastructure/httpapi/handlers/blocks.go @@ -343,13 +343,8 @@ func (handler *Blocks) ListAccountByHeight(ctx *fasthttp.RequestCtx) { return } - for i := range rawEventAccounts { - accountStrSlice = append(accountStrSlice, rawEventAccounts[i]) - } - - for i := range rawTransactionAccounts { - accountStrSlice = append(accountStrSlice, rawTransactionAccounts[i]) - } + accountStrSlice = append(accountStrSlice, rawEventAccounts...) + accountStrSlice = append(accountStrSlice, rawTransactionAccounts...) accountStrSlice = unique(accountStrSlice) accounts := make([]account, 0) diff --git a/infrastructure/tendermint/blockresulteventattrivutedecoder.go b/infrastructure/tendermint/blockresulteventattrivutedecoder.go new file mode 100644 index 000000000..1a3db5b34 --- /dev/null +++ b/infrastructure/tendermint/blockresulteventattrivutedecoder.go @@ -0,0 +1,35 @@ +package tendermint + +import "encoding/base64" + +type RawBlockResultEventAttributeDecoder struct { +} + +func (decoder RawBlockResultEventAttributeDecoder) DecodeKey(s string) (string, error) { + return s, nil +} + +func (decoder RawBlockResultEventAttributeDecoder) DecodeValue(s string) (string, error) { + return s, nil +} + +type Base64BlockResultEventAttributeDecoder struct { +} + +func (decoder Base64BlockResultEventAttributeDecoder) DecodeKey(s string) (string, error) { + decoded, err := base64.StdEncoding.DecodeString(s) + if err != nil { + return "", err + } + + return string(decoded), nil +} + +func (decoder Base64BlockResultEventAttributeDecoder) DecodeValue(s string) (string, error) { + decoded, err := base64.StdEncoding.DecodeString(s) + if err != nil { + return "", err + } + + return string(decoded), nil +} diff --git a/infrastructure/tendermint/httpclient.go b/infrastructure/tendermint/httpclient.go index cfa182531..82c861622 100644 --- a/infrastructure/tendermint/httpclient.go +++ b/infrastructure/tendermint/httpclient.go @@ -164,7 +164,7 @@ func (client *HTTPClient) Block(height int64) (*usecase_model.Block, *usecase_mo return block, rawBlock, nil } -func (client *HTTPClient) BlockResults(height int64) (*usecase_model.BlockResults, error) { +func (client *HTTPClient) BlockResults(height int64, eventAttributeDecoder tendermint.BlockResultEventAttributeDecoder) (*usecase_model.BlockResults, error) { var err error rawRespBody, err := client.request("block_results", queryKV{ @@ -176,7 +176,7 @@ func (client *HTTPClient) BlockResults(height int64) (*usecase_model.BlockResult } defer rawRespBody.Close() - blockResults, err := ParseBlockResultsResp(rawRespBody) + blockResults, err := ParseBlockResultsResp(rawRespBody, eventAttributeDecoder) if err != nil { return nil, err } diff --git a/infrastructure/tendermint/httpclient_test.go b/infrastructure/tendermint/httpclient_test.go index 7c2a68fe8..29fdffdc7 100644 --- a/infrastructure/tendermint/httpclient_test.go +++ b/infrastructure/tendermint/httpclient_test.go @@ -62,7 +62,7 @@ var _ = Describe("HTTPClient", func() { client := NewHTTPClient(server.URL(), true) - blockResults, err := client.BlockResults(anyBlockHeight) + blockResults, err := client.BlockResults(anyBlockHeight, &Base64BlockResultEventAttributeDecoder{}) Expect(err).To(BeNil()) Expect(*blockResults).To(Equal(usecase_model.BlockResults{ Height: anyBlockHeight, @@ -97,7 +97,7 @@ var _ = Describe("HTTPClient", func() { client := NewHTTPClient(server.URL(), true) - blockResults, err := client.BlockResults(anyBlockHeight) + blockResults, err := client.BlockResults(anyBlockHeight, &Base64BlockResultEventAttributeDecoder{}) Expect(err).To(BeNil()) expected := "{\"height\":367216,\"txsResults\":[{\"code\":0,\"data\":\"\\n\\n\\n\\u0008delegate\",\"log\":[{\"msgIndex\":0,\"events\":[{\"type\":\"delegate\",\"attributes\":[{\"key\":\"validator\",\"value\":\"tcrocncl1pm27djcs5djxjsxw3unrkv3m3jtxdexktw5epu\",\"index\":false},{\"key\":\"amount\",\"value\":\"19302674761\",\"index\":false}]},{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"delegate\",\"index\":false},{\"key\":\"sender\",\"value\":\"tcro1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8339p4l\",\"index\":false},{\"key\":\"module\",\"value\":\"staking\",\"index\":false},{\"key\":\"sender\",\"value\":\"tcro1pm27djcs5djxjsxw3unrkv3m3jtxdexk73hqel\",\"index\":false}]},{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"tcro1pm27djcs5djxjsxw3unrkv3m3jtxdexk73hqel\",\"index\":false},{\"key\":\"sender\",\"value\":\"tcro1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8339p4l\",\"index\":false},{\"key\":\"amount\",\"value\":\"1913979901basetcro\",\"index\":false}]}]}],\"rawLog\":\"[{\\\"events\\\":[{\\\"type\\\":\\\"delegate\\\",\\\"attributes\\\":[{\\\"key\\\":\\\"validator\\\",\\\"value\\\":\\\"tcrocncl1pm27djcs5djxjsxw3unrkv3m3jtxdexktw5epu\\\"},{\\\"key\\\":\\\"amount\\\",\\\"value\\\":\\\"19302674761\\\"}]},{\\\"type\\\":\\\"message\\\",\\\"attributes\\\":[{\\\"key\\\":\\\"action\\\",\\\"value\\\":\\\"delegate\\\"},{\\\"key\\\":\\\"sender\\\",\\\"value\\\":\\\"tcro1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8339p4l\\\"},{\\\"key\\\":\\\"module\\\",\\\"value\\\":\\\"staking\\\"},{\\\"key\\\":\\\"sender\\\",\\\"value\\\":\\\"tcro1pm27djcs5djxjsxw3unrkv3m3jtxdexk73hqel\\\"}]},{\\\"type\\\":\\\"transfer\\\",\\\"attributes\\\":[{\\\"key\\\":\\\"recipient\\\",\\\"value\\\":\\\"tcro1pm27djcs5djxjsxw3unrkv3m3jtxdexk73hqel\\\"},{\\\"key\\\":\\\"sender\\\",\\\"value\\\":\\\"tcro1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8339p4l\\\"},{\\\"key\\\":\\\"amount\\\",\\\"value\\\":\\\"1913979901basetcro\\\"}]}]}]\",\"info\":\"\",\"gasWanted\":\"200000\",\"gasUsed\":\"143179\",\"events\":[{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"tcro17xpfvakm2amg962yls6f84z3kell8c5lxhzaha\",\"index\":true},{\"key\":\"sender\",\"value\":\"tcro1pm27djcs5djxjsxw3unrkv3m3jtxdexk73hqel\",\"index\":true},{\"key\":\"amount\",\"value\":\"20000basetcro\",\"index\":true}]},{\"type\":\"message\",\"attributes\":[{\"key\":\"sender\",\"value\":\"tcro1pm27djcs5djxjsxw3unrkv3m3jtxdexk73hqel\",\"index\":true}]}],\"codespace\":\"\"},{\"code\":0,\"data\":\"\\n\\n\\n\\u0008delegate\",\"log\":[{\"msgIndex\":0,\"events\":[{\"type\":\"delegate\",\"attributes\":[{\"key\":\"validator\",\"value\":\"tcrocncl10gsqs8jzdlrem80shp0x6wx0jw7qu7m8cd29y5\",\"index\":false},{\"key\":\"amount\",\"value\":\"17338013566\",\"index\":false}]},{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"delegate\",\"index\":false},{\"key\":\"sender\",\"value\":\"tcro1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8339p4l\",\"index\":false},{\"key\":\"module\",\"value\":\"staking\",\"index\":false},{\"key\":\"sender\",\"value\":\"tcro10gsqs8jzdlrem80shp0x6wx0jw7qu7m8djfuuh\",\"index\":false}]},{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"tcro10gsqs8jzdlrem80shp0x6wx0jw7qu7m8djfuuh\",\"index\":false},{\"key\":\"sender\",\"value\":\"tcro1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8339p4l\",\"index\":false},{\"key\":\"amount\",\"value\":\"2310941249basetcro\",\"index\":false}]}]}],\"rawLog\":\"[{\\\"events\\\":[{\\\"type\\\":\\\"delegate\\\",\\\"attributes\\\":[{\\\"key\\\":\\\"validator\\\",\\\"value\\\":\\\"tcrocncl10gsqs8jzdlrem80shp0x6wx0jw7qu7m8cd29y5\\\"},{\\\"key\\\":\\\"amount\\\",\\\"value\\\":\\\"17338013566\\\"}]},{\\\"type\\\":\\\"message\\\",\\\"attributes\\\":[{\\\"key\\\":\\\"action\\\",\\\"value\\\":\\\"delegate\\\"},{\\\"key\\\":\\\"sender\\\",\\\"value\\\":\\\"tcro1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8339p4l\\\"},{\\\"key\\\":\\\"module\\\",\\\"value\\\":\\\"staking\\\"},{\\\"key\\\":\\\"sender\\\",\\\"value\\\":\\\"tcro10gsqs8jzdlrem80shp0x6wx0jw7qu7m8djfuuh\\\"}]},{\\\"type\\\":\\\"transfer\\\",\\\"attributes\\\":[{\\\"key\\\":\\\"recipient\\\",\\\"value\\\":\\\"tcro10gsqs8jzdlrem80shp0x6wx0jw7qu7m8djfuuh\\\"},{\\\"key\\\":\\\"sender\\\",\\\"value\\\":\\\"tcro1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8339p4l\\\"},{\\\"key\\\":\\\"amount\\\",\\\"value\\\":\\\"2310941249basetcro\\\"}]}]}]\",\"info\":\"\",\"gasWanted\":\"200000\",\"gasUsed\":\"143737\",\"events\":[{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"tcro17xpfvakm2amg962yls6f84z3kell8c5lxhzaha\",\"index\":true},{\"key\":\"sender\",\"value\":\"tcro10gsqs8jzdlrem80shp0x6wx0jw7qu7m8djfuuh\",\"index\":true},{\"key\":\"amount\",\"value\":\"20000basetcro\",\"index\":true}]},{\"type\":\"message\",\"attributes\":[{\"key\":\"sender\",\"value\":\"tcro10gsqs8jzdlrem80shp0x6wx0jw7qu7m8djfuuh\",\"index\":true}]}],\"codespace\":\"\"}],\"beginBlockEvents\":[{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"tcro17xpfvakm2amg962yls6f84z3kell8c5lxhzaha\",\"index\":true},{\"key\":\"sender\",\"value\":\"tcro1m3h30wlvsf8llruxtpukdvsy0km2kum87lx9mq\",\"index\":true},{\"key\":\"amount\",\"value\":\"17449528321basetcro\",\"index\":true}]},{\"type\":\"message\",\"attributes\":[{\"key\":\"sender\",\"value\":\"tcro1m3h30wlvsf8llruxtpukdvsy0km2kum87lx9mq\",\"index\":true}]},{\"type\":\"mint\",\"attributes\":[{\"key\":\"bonded_ratio\",\"value\":\"0.000809196054376644\",\"index\":true},{\"key\":\"inflation\",\"value\":\"0.013755821936855184\",\"index\":true},{\"key\":\"annual_provisions\",\"value\":\"110133046994204576.138016526579386288\",\"index\":true},{\"key\":\"amount\",\"value\":\"17449528321\",\"index\":true}]}],\"endBlockEvents\":[{\"type\":\"commission\",\"attributes\":[{\"key\":\"amount\",\"value\":\"87247841.605000000000000000basetcro\",\"index\":true},{\"key\":\"validator\",\"value\":\"tcrocncl18p07yvmphymscz6tl4a7zmh93g0k6vy72ww4s4\",\"index\":true}]},{\"type\":\"rewards\",\"attributes\":[{\"key\":\"amount\",\"value\":\"872478416.050000000000000000basetcro\",\"index\":true},{\"key\":\"validator\",\"value\":\"tcrocncl18p07yvmphymscz6tl4a7zmh93g0k6vy72ww4s4\",\"index\":true}]}],\"validatorUpdates\":[{\"pubkey\":{\"type\":\"tendermint.crypto.PublicKey_Ed25519\",\"pubkey\":\"SE5zeTjcYPXVrfcOva61QWokSZFfQu2h316fR6bB2dY=\"},\"address\":\"CA721C3A05F500838DDD1B16F4E2D2D09E463218\",\"power\":138525202},{\"pubkey\":{\"type\":\"tendermint.crypto.PublicKey_Ed25519\",\"pubkey\":\"Epmo3U6yXlxSDQzWZ8yBPOMHw2R85lc26RK98Rlo0oM=\"},\"address\":\"E067FCE33F7FDBD0CE4872F8E240A7AD6E654726\",\"power\":112904113}],\"consensusParamUpdates\":{\"block\":{\"maxBytes\":\"22020096\",\"maxGas\":\"-1\"},\"evidence\":{\"maxAgeNumBlocks\":\"100000\",\"maxAgeDuration\":\"172800000000000\",\"maxBytes\":\"\"},\"validator\":{\"pubKeyTypes\":[\"ed25519\"]}}}" Expect(jsoniter.MarshalToString(blockResults)).To(Equal(expected)) @@ -114,7 +114,7 @@ var _ = Describe("HTTPClient", func() { client := NewHTTPClient(server.URL(), true) - blockResults, err := client.BlockResults(anyBlockHeight) + blockResults, err := client.BlockResults(anyBlockHeight, &Base64BlockResultEventAttributeDecoder{}) Expect(err).To(BeNil()) Expect(jsoniter.MarshalToString(blockResults)).To(Equal("{\"height\":4794,\"txsResults\":[],\"beginBlockEvents\":[],\"endBlockEvents\":[],\"validatorUpdates\":[{\"pubkey\":{\"type\":\"tendermint.crypto.PublicKey_Ed25519\",\"pubkey\":\"CpCz+c19SHaNWW31P+7blzyHo0sQMn4uk8gIej+pXW8=\"},\"address\":\"02D50170AFB2B3718477AA607469BEA96C80CE88\",\"power\":null}],\"consensusParamUpdates\":{\"block\":{\"maxBytes\":\"22020096\",\"maxGas\":\"-1\"},\"evidence\":{\"maxAgeNumBlocks\":\"100000\",\"maxAgeDuration\":\"172800000000000\",\"maxBytes\":\"\"},\"validator\":{\"pubKeyTypes\":[\"ed25519\"]}}}")) }) diff --git a/infrastructure/tendermint/parser.go b/infrastructure/tendermint/parser.go index 2b07a743d..d08fcab11 100644 --- a/infrastructure/tendermint/parser.go +++ b/infrastructure/tendermint/parser.go @@ -3,6 +3,7 @@ package tendermint import ( "encoding/base64" "fmt" + tendermint_interface "github.com/crypto-com/chain-indexing/appinterface/tendermint" "io" "math/big" "strconv" @@ -100,7 +101,7 @@ func parseBlockSignatures(rawSignatures []model.RawBlockSignature) []model.Block } // RawBlockResults related parsing functions -func ParseBlockResultsResp(rawRespReader io.Reader) (*model.BlockResults, error) { +func ParseBlockResultsResp(rawRespReader io.Reader, eventAttributeDecoder tendermint_interface.BlockResultEventAttributeDecoder) (*model.BlockResults, error) { var err error var resp RawBlockResultsResp @@ -117,21 +118,21 @@ func ParseBlockResultsResp(rawRespReader io.Reader) (*model.BlockResults, error) return nil, fmt.Errorf("error converting block height to unsigned integer: %v", err) } - txsResults := parseBlockResultsTxsResults(rawBlockResults.TxsResults) + txsResults := parseBlockResultsTxsResults(rawBlockResults.TxsResults, eventAttributeDecoder) return &model.BlockResults{ Height: int64(height), TxsResults: txsResults, - BeginBlockEvents: parseBlockResultsEvents(rawBlockResults.BeginBlockEvents), - EndBlockEvents: parseBlockResultsEvents(rawBlockResults.EndBlockEvents), + BeginBlockEvents: parseBlockResultsEvents(rawBlockResults.BeginBlockEvents, eventAttributeDecoder), + EndBlockEvents: parseBlockResultsEvents(rawBlockResults.EndBlockEvents, eventAttributeDecoder), ValidatorUpdates: parseBlockResultsValidatorUpdates(rawBlockResults.ValidatorUpdates), ConsensusParamUpdates: parseBlockResultsConsensusParamsUpdates(rawBlockResults.ConsensusParamUpdates), }, nil } -func parseBlockResultsTxsResults(rawTxsResults []RawBlockResultsTxsResult) []model.BlockResultsTxsResult { +func parseBlockResultsTxsResults(rawTxsResults []RawBlockResultsTxsResult, eventAttributeDecoder tendermint_interface.BlockResultEventAttributeDecoder) []model.BlockResultsTxsResult { txsResults := make([]model.BlockResultsTxsResult, 0, len(rawTxsResults)) for _, rawTxsResult := range rawTxsResults { - events := parseBlockResultsEvents(rawTxsResult.Events) + events := parseBlockResultsEvents(rawTxsResult.Events, eventAttributeDecoder) txsResults = append(txsResults, model.BlockResultsTxsResult{ Code: rawTxsResult.Code, @@ -197,7 +198,7 @@ func parseBlockResultsTxsResultLogEvents(rawEvents []RawBlockResultsEvent) []mod return events } -func parseBlockResultsEvents(rawEvents []RawBlockResultsEvent) []model.BlockResultsEvent { +func parseBlockResultsEvents(rawEvents []RawBlockResultsEvent, eventAttributeDecoder tendermint_interface.BlockResultEventAttributeDecoder) []model.BlockResultsEvent { if rawEvents == nil { return []model.BlockResultsEvent{} } @@ -206,13 +207,13 @@ func parseBlockResultsEvents(rawEvents []RawBlockResultsEvent) []model.BlockResu for _, rawEvent := range rawEvents { attributes := make([]model.BlockResultsEventAttribute, 0, len(rawEvent.Attributes)) for _, rawAttribute := range rawEvent.Attributes { - key, err := base64Decode(rawAttribute.Key) + key, err := eventAttributeDecoder.DecodeKey(rawAttribute.Key) if err != nil { - key = rawAttribute.Key + panic(fmt.Sprintf("error blcok result event %s attribute key (%s): %v", rawEvent.Type, rawAttribute.Key, err)) } - value, err := base64Decode(rawAttribute.Value) + value, err := eventAttributeDecoder.DecodeValue(rawAttribute.Value) if err != nil { - value = rawAttribute.Value + panic(fmt.Sprintf("error blcok result event %s attribute key (%s): %v", rawEvent.Type, rawAttribute.Key, err)) } attributes = append(attributes, model.BlockResultsEventAttribute{ Key: key, @@ -270,14 +271,6 @@ func mustBase64Decode(s string) string { return string(decoded) } -func base64Decode(s string) (string, error) { - decoded, err := base64.StdEncoding.DecodeString(s) - if err != nil { - return "", err - } - return string(decoded), nil -} - func parseBlockResultsConsensusParamsUpdates(rawUpdates RawBlockResultsConsensusParamUpdates) model.BlockResultsConsensusParamUpdates { var validatorPubKeyTypes []string if rawUpdates.Validator.PubKeyTypes == nil { diff --git a/usecase/parser/begin_block_events_test.go b/usecase/parser/begin_block_events_test.go index 6a210ec4f..9987d730c 100644 --- a/usecase/parser/begin_block_events_test.go +++ b/usecase/parser/begin_block_events_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -15,7 +16,7 @@ import ( var _ = Describe("ParseBeginBlockEventsCommands", func() { Describe("MsgSend", func() { It("should return commands corresponding to events in begin_block_events", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.BEGIN_BLOCK_COMMON_EVENTS_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.BEGIN_BLOCK_COMMON_EVENTS_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) block, _ := mustParseBlockResp(usecase_parser_test.BEGIN_BLOCK_COMMON_EVENTS_BLOCK_RESP) bondingDenom := "basetcro" @@ -90,7 +91,7 @@ var _ = Describe("ParseBeginBlockEventsCommands", func() { }) It("should return ValidatorSlashed and ValidatorJailed command base on missing signature events", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.BEGIN_BLOCK_SLASH_MISSING_SIGNATURES_EVENT_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.BEGIN_BLOCK_SLASH_MISSING_SIGNATURES_EVENT_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) block, _ := mustParseBlockResp(usecase_parser_test.BEGIN_BLOCK_COMMON_EVENTS_BLOCK_RESP) bondingDenom := "basetcro" @@ -141,7 +142,7 @@ var _ = Describe("ParseBeginBlockEventsCommands", func() { }) It("should return ValidatorSlashed and ValidatorJailed command base on double sign events", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.BEGIN_BLOCK_SLASH_DOUBLE_SIGN_EVENT_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.BEGIN_BLOCK_SLASH_DOUBLE_SIGN_EVENT_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) block, _ := mustParseBlockResp(usecase_parser_test.BEGIN_BLOCK_COMMON_EVENTS_BLOCK_RESP) bondingDenom := "basetcro" diff --git a/usecase/parser/block_results_txs_result_create_send_to_ibc_test.go b/usecase/parser/block_results_txs_result_create_send_to_ibc_test.go index 977969d9c..e0ab076db 100644 --- a/usecase/parser/block_results_txs_result_create_send_to_ibc_test.go +++ b/usecase/parser/block_results_txs_result_create_send_to_ibc_test.go @@ -2,6 +2,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/json" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -14,7 +15,7 @@ import ( var _ = Describe("ParseEndBlockEventsCommands", func() { It("should return CreateCronosSendToIbc commands when end_block_events has cronos send to IBC transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.BLOCK_RESULTS_TXS_RESULTS_CREATE_SEND_TO_IBC_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.BLOCK_RESULTS_TXS_RESULTS_CREATE_SEND_TO_IBC_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.BLOCK_RESULTS_TXS_RESULTS_CREATE_SEND_TO_IBC_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) cmds, err := parser.ParseBlockResultsTxsResults( block, diff --git a/usecase/parser/block_results_txs_results_test.go b/usecase/parser/block_results_txs_results_test.go index 4f7c9db82..0d7aa40f8 100644 --- a/usecase/parser/block_results_txs_results_test.go +++ b/usecase/parser/block_results_txs_results_test.go @@ -3,6 +3,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/entity/command" "github.com/crypto-com/chain-indexing/external/utctime" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/projection/block_raw_event/types" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" @@ -16,7 +17,7 @@ import ( var _ = Describe("ParseTxsResultsBlockEventsCommands", func() { It("should return CreateSend commands when txs_results has simple send transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SEND_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_SEND_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_SEND_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) cmds, err := parser.ParseBlockResultsTxsResults( block, diff --git a/usecase/parser/end_block_events_ethereum_send_to_cosmos_handled_test.go b/usecase/parser/end_block_events_ethereum_send_to_cosmos_handled_test.go index 56a558640..29446d261 100644 --- a/usecase/parser/end_block_events_ethereum_send_to_cosmos_handled_test.go +++ b/usecase/parser/end_block_events_ethereum_send_to_cosmos_handled_test.go @@ -2,6 +2,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/utctime" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" @@ -14,7 +15,7 @@ import ( var _ = Describe("ParseEndBlockEventsCommands", func() { It("should return GravityEthereumSendToCosmosHandled commands when end_block_events has ethereum_send_to_cosmos_handled event", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_ETHEREUM_SEND_TO_COSMOS_HANDLED_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_ETHEREUM_SEND_TO_COSMOS_HANDLED_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) cmds, err := parser.ParseEndBlockEventsCommands( blockResults.Height, diff --git a/usecase/parser/end_block_events_test.go b/usecase/parser/end_block_events_test.go index 58991665f..98202b370 100644 --- a/usecase/parser/end_block_events_test.go +++ b/usecase/parser/end_block_events_test.go @@ -2,6 +2,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/utctime" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/projection/block_raw_event/types" "github.com/crypto-com/chain-indexing/usecase/coin" "github.com/crypto-com/chain-indexing/usecase/model" @@ -16,7 +17,7 @@ import ( var _ = Describe("ParseEndBlockEventsCommands", func() { It("should return EndProposal commands when end_block_events has proposal_active event", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_PROPOSAL_REJECTED_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_PROPOSAL_REJECTED_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) block, _ := mustParseBlockResp(usecase_parser_test.END_BLOCK_COMPLETE_UNBONDING_BLOCK_RESP) cmds, err := parser.ParseEndBlockEventsCommands( @@ -66,7 +67,7 @@ var _ = Describe("ParseEndBlockEventsCommands", func() { }) It("should return EndProposal commands when end_blocks_events has proposal_active passed event", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_PROPOSAL_PASSED_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_PROPOSAL_PASSED_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) block, _ := mustParseBlockResp(usecase_parser_test.END_BLOCK_COMPLETE_UNBONDING_BLOCK_RESP) cmds, err := parser.ParseEndBlockEventsCommands( @@ -116,7 +117,7 @@ var _ = Describe("ParseEndBlockEventsCommands", func() { }) It("should return InactiveProposal commands when end_blocks_events has proposal_inactive event", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_PROPOSAL_INACTIVED_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_PROPOSAL_INACTIVED_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) block, _ := mustParseBlockResp(usecase_parser_test.END_BLOCK_COMPLETE_UNBONDING_BLOCK_RESP) cmds, err := parser.ParseEndBlockEventsCommands( @@ -166,7 +167,7 @@ var _ = Describe("ParseEndBlockEventsCommands", func() { }) It("should return CompleteBonding commands when end_blocks_events has complete_unbonding event", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_COMPLETE_UNBONDING_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.END_BLOCK_COMPLETE_UNBONDING_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) block, _ := mustParseBlockResp(usecase_parser_test.END_BLOCK_COMPLETE_UNBONDING_BLOCK_RESP) cmds, err := parser.ParseEndBlockEventsCommands( diff --git a/usecase/parser/failedmsg_test.go b/usecase/parser/failedmsg_test.go index 11817ec60..e2d3279c2 100644 --- a/usecase/parser/failedmsg_test.go +++ b/usecase/parser/failedmsg_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -17,7 +18,7 @@ var _ = Describe("ParseMsgCommands", func() { Describe("Failed Msg", func() { It("should parse Msg Failed commands when the transaction has failed", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_FAILED_WITH_FEE_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_FAILED_WITH_FEE_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_FAILED_WITH_FEE_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_FAILED_WITH_FEE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_begin_redelegate_test.go b/usecase/parser/msg_begin_redelegate_test.go index e22c783a9..06c56179a 100644 --- a/usecase/parser/msg_begin_redelegate_test.go +++ b/usecase/parser/msg_begin_redelegate_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -17,7 +18,7 @@ var _ = Describe("ParseMsgCommands", func() { Describe("MsgBeginRedelegate", func() { It("should parse Msg commands when there is staking.MsgBeginRedelegate in the transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_BEGIN_REDELEGATE_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_BEGIN_REDELEGATE_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_BEGIN_REDELEGATE_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_BEGIN_REDELEGATE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_create_validator_test.go b/usecase/parser/msg_create_validator_test.go index 9cc4c0db2..60bf0b449 100644 --- a/usecase/parser/msg_create_validator_test.go +++ b/usecase/parser/msg_create_validator_test.go @@ -20,7 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { It("should parse Msg commands when there is staking.MsgCreateValidator in the transaction", func() { block, _, _ := tendermint.ParseBlockResp(strings.NewReader(usecase_parser_test.TX_MSG_CREATE_VALIDATOR_BLOCK_RESP)) - blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader(usecase_parser_test.TX_MSG_CREATE_VALIDATOR_BLOCK_RESULTS_RESP)) + blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader(usecase_parser_test.TX_MSG_CREATE_VALIDATOR_BLOCK_RESULTS_RESP), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CREATE_VALIDATOR_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_create_vesting_account_test.go b/usecase/parser/msg_create_vesting_account_test.go index ec5ba7ce1..86211643f 100644 --- a/usecase/parser/msg_create_vesting_account_test.go +++ b/usecase/parser/msg_create_vesting_account_test.go @@ -46,7 +46,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CREATE_VESTING_ACCOUNT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CREATE_VESTING_ACCOUNT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_delegate_test.go b/usecase/parser/msg_delegate_test.go index 74aebc371..a10d82288 100644 --- a/usecase/parser/msg_delegate_test.go +++ b/usecase/parser/msg_delegate_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,7 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { It("should parse Msg commands when there is staking.MsgDelegate in the transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_DELEGATE_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_DELEGATE_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_DELEGATE_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_DELEGATE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_deposit_start_voting_test.go b/usecase/parser/msg_deposit_start_voting_test.go index e88e2a39d..f772f84e0 100644 --- a/usecase/parser/msg_deposit_start_voting_test.go +++ b/usecase/parser/msg_deposit_start_voting_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -19,6 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_DEPOSIT_AND_START_VOTING_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_DEPOSIT_AND_START_VOTING_BLOCK_RESULT_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_DEPOSIT_AND_START_VOTING_TXS_RESP) diff --git a/usecase/parser/msg_deposit_test.go b/usecase/parser/msg_deposit_test.go index 7bf2906e9..7de2b6ab3 100644 --- a/usecase/parser/msg_deposit_test.go +++ b/usecase/parser/msg_deposit_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -19,6 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_DEPOSIT_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_DEPOSIT_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_DEPOSIT_TXS_RESP) diff --git a/usecase/parser/msg_deposit_v1_start_voting_test.go b/usecase/parser/msg_deposit_v1_start_voting_test.go index efae5e433..632d2f967 100644 --- a/usecase/parser/msg_deposit_v1_start_voting_test.go +++ b/usecase/parser/msg_deposit_v1_start_voting_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -20,6 +21,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_DEPOSIT_V1_AND_START_VOTING_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_DEPOSIT_V1_AND_START_VOTING_BLOCK_RESULT_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_DEPOSIT_V1_AND_START_VOTING_TXS_RESP) diff --git a/usecase/parser/msg_deposit_v1_test.go b/usecase/parser/msg_deposit_v1_test.go index 78d3bc146..00909390d 100644 --- a/usecase/parser/msg_deposit_v1_test.go +++ b/usecase/parser/msg_deposit_v1_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -20,6 +21,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_DEPOSIT_V1_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_DEPOSIT_V1_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_DEPOSIT_V1_TXS_RESP) diff --git a/usecase/parser/msg_edit_validator_test.go b/usecase/parser/msg_edit_validator_test.go index 4a2ebea8e..302825a8c 100644 --- a/usecase/parser/msg_edit_validator_test.go +++ b/usecase/parser/msg_edit_validator_test.go @@ -20,7 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { It("should parse Msg commands when there is staking.MsgEditValidator in the transaction", func() { block, _, _ := tendermint.ParseBlockResp(strings.NewReader(usecase_parser_test.TX_MSG_EDIT_VALIDATOR_BLOCK_RESP)) - blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader(usecase_parser_test.TX_MSG_EDIT_VALIDATOR_BLOCK_RESULTS_RESP)) + blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader(usecase_parser_test.TX_MSG_EDIT_VALIDATOR_BLOCK_RESULTS_RESP), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx1 := MustParseTxsResp(usecase_parser_test.TX_MSG_EDIT_VALIDATOR_TXS_RESP_1) tx2 := MustParseTxsResp(usecase_parser_test.TX_MSG_EDIT_VALIDATOR_TXS_RESP_2) diff --git a/usecase/parser/msg_ethereum_tx_test.go b/usecase/parser/msg_ethereum_tx_test.go index 22ae87836..df06b26f7 100644 --- a/usecase/parser/msg_ethereum_tx_test.go +++ b/usecase/parser/msg_ethereum_tx_test.go @@ -22,7 +22,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_ETHEREUM_TX_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_ETHEREUM_TX_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_exec_test.go b/usecase/parser/msg_exec_test.go index 71203d849..6633bf422 100644 --- a/usecase/parser/msg_exec_test.go +++ b/usecase/parser/msg_exec_test.go @@ -60,7 +60,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_EXEC_MSG_SEND_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_EXEC_MSG_SEND_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -150,7 +150,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_EXEC_MSG_DELEGATE_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_EXEC_MSG_DELEGATE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_fund_community_pool_test.go b/usecase/parser/msg_fund_community_pool_test.go index 82ad5c6ea..abd375769 100644 --- a/usecase/parser/msg_fund_community_pool_test.go +++ b/usecase/parser/msg_fund_community_pool_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -19,6 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_FUND_COMMUNITY_POOL_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_FUND_COMMUNITY_POOL_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_FUND_COMMUNITY_POOL_TXS_RESP) diff --git a/usecase/parser/msg_grant_basic_allowance_test.go b/usecase/parser/msg_grant_basic_allowance_test.go index 7a9a2deba..3e1dffd59 100644 --- a/usecase/parser/msg_grant_basic_allowance_test.go +++ b/usecase/parser/msg_grant_basic_allowance_test.go @@ -47,7 +47,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_GRANT_BASIC_ALLOWANCE_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_GRANT_BASIC_ALLOWANCE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_grant_send_grant_test.go b/usecase/parser/msg_grant_send_grant_test.go index 4983e449f..a067967c8 100644 --- a/usecase/parser/msg_grant_send_grant_test.go +++ b/usecase/parser/msg_grant_send_grant_test.go @@ -53,7 +53,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_GRANT_SEND_GRANT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_GRANT_SEND_GRANT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_grant_stake_grant_test.go b/usecase/parser/msg_grant_stake_grant_test.go index 493bc8a9f..48b943e40 100644 --- a/usecase/parser/msg_grant_stake_grant_test.go +++ b/usecase/parser/msg_grant_stake_grant_test.go @@ -52,7 +52,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_GRANT_STAKE_GRANT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_GRANT_STAKE_GRANT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_acknowledgement_test.go b/usecase/parser/msg_ibc_acknowledgement_test.go index 8e867de8e..995f69400 100644 --- a/usecase/parser/msg_ibc_acknowledgement_test.go +++ b/usecase/parser/msg_ibc_acknowledgement_test.go @@ -72,7 +72,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_ACKNOWLEDGEMENT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_ACKNOWLEDGEMENT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -164,7 +164,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_ACKNOWLEDGEMENT_ERROR_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_ACKNOWLEDGEMENT_ERROR_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -316,7 +316,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_ACKNOWLEDGEMENT_DUPLICATE_PACKET_SEQUENCE_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx1 := MustParseTxsResp(usecase_parser_test.TX_MSG_ACKNOWLEDGEMENT_DUPLICATE_PACKET_SEQUENCE_TXS_RESP_1) tx2 := MustParseTxsResp(usecase_parser_test.TX_MSG_ACKNOWLEDGEMENT_DUPLICATE_PACKET_SEQUENCE_TXS_RESP_2) diff --git a/usecase/parser/msg_ibc_channel_close_confirm_test.go b/usecase/parser/msg_ibc_channel_close_confirm_test.go index 9e6b0f6dc..1d0d1d7b8 100644 --- a/usecase/parser/msg_ibc_channel_close_confirm_test.go +++ b/usecase/parser/msg_ibc_channel_close_confirm_test.go @@ -44,7 +44,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CHANNEL_CLOSE_CONFIRM_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CHANNEL_CLOSE_CONFIRM_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_channel_close_init_test.go b/usecase/parser/msg_ibc_channel_close_init_test.go index ae79c5272..27fe28969 100644 --- a/usecase/parser/msg_ibc_channel_close_init_test.go +++ b/usecase/parser/msg_ibc_channel_close_init_test.go @@ -42,7 +42,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CHANNEL_CLOSE_INIT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CHANNEL_CLOSE_INIT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_channel_open_ack_test.go b/usecase/parser/msg_ibc_channel_open_ack_test.go index 97bfe77e9..99ef82643 100644 --- a/usecase/parser/msg_ibc_channel_open_ack_test.go +++ b/usecase/parser/msg_ibc_channel_open_ack_test.go @@ -48,7 +48,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CHANNEL_OPEN_ACK_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CHANNEL_OPEN_ACK_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_channel_open_confirm_test.go b/usecase/parser/msg_ibc_channel_open_confirm_test.go index 9e6158528..5716a2dba 100644 --- a/usecase/parser/msg_ibc_channel_open_confirm_test.go +++ b/usecase/parser/msg_ibc_channel_open_confirm_test.go @@ -47,7 +47,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CHANNEL_OPEN_CONFIRM_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CHANNEL_OPEN_CONFIRM_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_channel_open_init_test.go b/usecase/parser/msg_ibc_channel_open_init_test.go index 7731f13e8..7bf7cfe1d 100644 --- a/usecase/parser/msg_ibc_channel_open_init_test.go +++ b/usecase/parser/msg_ibc_channel_open_init_test.go @@ -52,7 +52,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CHANNEL_OPEN_INIT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CHANNEL_OPEN_INIT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_channel_open_try_test.go b/usecase/parser/msg_ibc_channel_open_try_test.go index 0bf27c6cb..df9be2510 100644 --- a/usecase/parser/msg_ibc_channel_open_try_test.go +++ b/usecase/parser/msg_ibc_channel_open_try_test.go @@ -59,7 +59,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CHANNEL_OPEN_TRY_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CHANNEL_OPEN_TRY_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_connection_open_ack_test.go b/usecase/parser/msg_ibc_connection_open_ack_test.go index 0feab155f..11eeca1d3 100644 --- a/usecase/parser/msg_ibc_connection_open_ack_test.go +++ b/usecase/parser/msg_ibc_connection_open_ack_test.go @@ -130,7 +130,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CONNECTION_OPEN_ACK_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CONNECTION_OPEN_ACK_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_connection_open_confirm_test.go b/usecase/parser/msg_ibc_connection_open_confirm_test.go index 1a05b3600..c2ad17fdb 100644 --- a/usecase/parser/msg_ibc_connection_open_confirm_test.go +++ b/usecase/parser/msg_ibc_connection_open_confirm_test.go @@ -46,7 +46,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CONNECTION_OPEN_CONFIRM_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CONNECTION_OPEN_CONFIRM_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_connection_open_init_test.go b/usecase/parser/msg_ibc_connection_open_init_test.go index fb6f476cb..842013071 100644 --- a/usecase/parser/msg_ibc_connection_open_init_test.go +++ b/usecase/parser/msg_ibc_connection_open_init_test.go @@ -48,7 +48,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CONNECTION_OPEN_INIT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CONNECTION_OPEN_INIT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_connection_open_try_test.go b/usecase/parser/msg_ibc_connection_open_try_test.go index a8dc48805..197d0e2cc 100644 --- a/usecase/parser/msg_ibc_connection_open_try_test.go +++ b/usecase/parser/msg_ibc_connection_open_try_test.go @@ -138,7 +138,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CONNECTION_OPEN_TRY_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CONNECTION_OPEN_TRY_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_create_solomachine_client_test.go b/usecase/parser/msg_ibc_create_solomachine_client_test.go index 52b960b12..4536bb989 100644 --- a/usecase/parser/msg_ibc_create_solomachine_client_test.go +++ b/usecase/parser/msg_ibc_create_solomachine_client_test.go @@ -56,7 +56,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CREATE_SOLOMACHINE_CLIENT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CREATE_SOLOMACHINE_CLIENT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_create_tendermint_client_test.go b/usecase/parser/msg_ibc_create_tendermint_client_test.go index ff8b04b69..cec9d9da6 100644 --- a/usecase/parser/msg_ibc_create_tendermint_client_test.go +++ b/usecase/parser/msg_ibc_create_tendermint_client_test.go @@ -101,7 +101,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_CREATE_TENDERMINT_CLIENT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CREATE_TENDERMINT_CLIENT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_recv_packet_test.go b/usecase/parser/msg_ibc_recv_packet_test.go index ba525f650..b7e664d0f 100644 --- a/usecase/parser/msg_ibc_recv_packet_test.go +++ b/usecase/parser/msg_ibc_recv_packet_test.go @@ -77,7 +77,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_RECV_PACKET_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_RECV_PACKET_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -165,7 +165,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_RECV_PACKET_PACKET_ACK_ERROR_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_RECV_PACKET_PACKET_ACK_ERROR_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -259,7 +259,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_RECV_PACKET_MISSING_FUNGIBLE_TOKEN_PACKET_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_RECV_PACKET_MISSING_FUNGIBLE_TOKEN_PACKET_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -350,7 +350,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_RECV_PACKET_SOLO_MACHINE_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_RECV_PACKET_SOLO_MACHINE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_timeout_test.go b/usecase/parser/msg_ibc_timeout_test.go index 25d2edda9..49caee9e1 100644 --- a/usecase/parser/msg_ibc_timeout_test.go +++ b/usecase/parser/msg_ibc_timeout_test.go @@ -72,7 +72,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_TIMEOUT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx1 := MustParseTxsResp(usecase_parser_test.TX_MSG_TIMEOUT_TXS_RESP_1) tx2 := MustParseTxsResp(usecase_parser_test.TX_MSG_TIMEOUT_TXS_RESP_2) @@ -169,7 +169,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_TIMEOUT_V1_0_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_TIMEOUT_V1_0_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_transfer_transfer_test.go b/usecase/parser/msg_ibc_transfer_transfer_test.go index 19ef15cd4..2fa067ad2 100644 --- a/usecase/parser/msg_ibc_transfer_transfer_test.go +++ b/usecase/parser/msg_ibc_transfer_transfer_test.go @@ -61,7 +61,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_TRANSFER_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_TRANSFER_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -144,7 +144,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_TRANSFER_STRING_AMOUNT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_TRANSFER_STRING_AMOUNT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_ibc_update_tendermint_client_test.go b/usecase/parser/msg_ibc_update_tendermint_client_test.go index 55e848b58..f93391caf 100644 --- a/usecase/parser/msg_ibc_update_tendermint_client_test.go +++ b/usecase/parser/msg_ibc_update_tendermint_client_test.go @@ -140,7 +140,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_UPDATE_TENDERMINT_CLIENT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_UPDATE_TENDERMINT_CLIENT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_multi_send_test.go b/usecase/parser/msg_multi_send_test.go index 9bc54439f..4314aad4a 100644 --- a/usecase/parser/msg_multi_send_test.go +++ b/usecase/parser/msg_multi_send_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" "github.com/crypto-com/chain-indexing/usecase/event" "github.com/crypto-com/chain-indexing/usecase/model" @@ -19,7 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { It("should parse Msg commands when there is bank.MsgMultiSend in the transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_MULTI_SEND_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_MULTI_SEND_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_MULTI_SEND_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_MULTI_SEND_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_nft_burn_nft_test.go b/usecase/parser/msg_nft_burn_nft_test.go index 5333fb128..957ce51ac 100644 --- a/usecase/parser/msg_nft_burn_nft_test.go +++ b/usecase/parser/msg_nft_burn_nft_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,6 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_NFT_BURN_NFT_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_NFT_BURN_NFT_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_NFT_BURN_NFT_TXS_RESP) diff --git a/usecase/parser/msg_nft_edit_nft_test.go b/usecase/parser/msg_nft_edit_nft_test.go index 05d873d45..ae139b167 100644 --- a/usecase/parser/msg_nft_edit_nft_test.go +++ b/usecase/parser/msg_nft_edit_nft_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,6 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_NFT_EDIT_NFT_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_NFT_EDIT_NFT_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_NFT_EDIT_NFT_TXS_RESP) diff --git a/usecase/parser/msg_nft_issue_denom_test.go b/usecase/parser/msg_nft_issue_denom_test.go index fa60b82aa..757b6b9b1 100644 --- a/usecase/parser/msg_nft_issue_denom_test.go +++ b/usecase/parser/msg_nft_issue_denom_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,6 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_NFT_ISSUE_DENOM_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_NFT_ISSUE_DENOM_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_NFT_ISSUE_DENOM_TXS_RESP) diff --git a/usecase/parser/msg_nft_mint_nft_test.go b/usecase/parser/msg_nft_mint_nft_test.go index c19f73761..ef55cd5ad 100644 --- a/usecase/parser/msg_nft_mint_nft_test.go +++ b/usecase/parser/msg_nft_mint_nft_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,6 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_NFT_MINT_NFT_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_NFT_MINT_NFT_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_NFT_MINT_NFT_TXS_RESP) diff --git a/usecase/parser/msg_nft_transfer_nft_test.go b/usecase/parser/msg_nft_transfer_nft_test.go index 2c86ad96f..6ea0396d4 100644 --- a/usecase/parser/msg_nft_transfer_nft_test.go +++ b/usecase/parser/msg_nft_transfer_nft_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,6 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_NFT_TRANSFER_NFT_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_NFT_TRANSFER_NFT_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_NFT_TRANSFER_NFT_TXS_RESP) diff --git a/usecase/parser/msg_register_account_test.go b/usecase/parser/msg_register_account_test.go index 02585a525..de6c66580 100644 --- a/usecase/parser/msg_register_account_test.go +++ b/usecase/parser/msg_register_account_test.go @@ -42,7 +42,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_REGISTER_ACCOUNT_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_REGISTER_ACCOUNT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_revoke_allowance_test.go b/usecase/parser/msg_revoke_allowance_test.go index 95021f3d4..babf298d8 100644 --- a/usecase/parser/msg_revoke_allowance_test.go +++ b/usecase/parser/msg_revoke_allowance_test.go @@ -38,7 +38,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_REVOKE_ALLOWANCE_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_REVOKE_ALLOWANCE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_revoke_test.go b/usecase/parser/msg_revoke_test.go index f5ced71be..ca42592b9 100644 --- a/usecase/parser/msg_revoke_test.go +++ b/usecase/parser/msg_revoke_test.go @@ -39,7 +39,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_REVOKE_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_REVOKE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_send_test.go b/usecase/parser/msg_send_test.go index e90e85867..d1e7210c1 100644 --- a/usecase/parser/msg_send_test.go +++ b/usecase/parser/msg_send_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,7 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { It("should parse Msg commands when there is bank.MsgSend in the transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SEND_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_SEND_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_SEND_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SEND_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -56,7 +57,7 @@ var _ = Describe("ParseMsgCommands", func() { It("should parse Msg commands when there are multiple bank.MsgSend in one transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.ONE_TX_TWO_MSG_SEND_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.ONE_TX_TWO_MSG_SEND_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.ONE_TX_TWO_MSG_SEND_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.ONE_TX_TWO_MSG_SEND_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_set_withdraw_address_test.go b/usecase/parser/msg_set_withdraw_address_test.go index 196402ef9..f9db15de7 100644 --- a/usecase/parser/msg_set_withdraw_address_test.go +++ b/usecase/parser/msg_set_withdraw_address_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,6 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SET_WITHDRAW_ADDRESS_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SET_WITHDRAW_ADDRESS_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SET_WITHDRAW_ADDRESS_TXS_RESP) diff --git a/usecase/parser/msg_submit_cancel_software_upgrade_proposal_test.go b/usecase/parser/msg_submit_cancel_software_upgrade_proposal_test.go index 9d64dae30..02eed5405 100644 --- a/usecase/parser/msg_submit_cancel_software_upgrade_proposal_test.go +++ b/usecase/parser/msg_submit_cancel_software_upgrade_proposal_test.go @@ -2,6 +2,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/primptr" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -20,6 +21,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SUBMIT_CANCEL_SOFTWARE_UPGRADE_PROPOSAL_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SUBMIT_CANCEL_SOFTWARE_UPGRADE_PROPOSAL_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SUBMIT_CANCEL_SOFTWARE_UPGRADE_PROPOSAL_TXS_RESP) diff --git a/usecase/parser/msg_submit_community_pool_spend_proposal_test.go b/usecase/parser/msg_submit_community_pool_spend_proposal_test.go index 4bdc67dec..d55a2724a 100644 --- a/usecase/parser/msg_submit_community_pool_spend_proposal_test.go +++ b/usecase/parser/msg_submit_community_pool_spend_proposal_test.go @@ -2,6 +2,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/primptr" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -20,6 +21,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SUBMIT_COMMUNITY_POOL_SPEND_PROPOSAL_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SUBMIT_COMMUNITY_POOL_SPEND_PROPOSAL_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SUBMIT_COMMUNITY_POOL_SPEND_PROPOSAL_TXS_RESP) diff --git a/usecase/parser/msg_submit_param_change_proposal_test.go b/usecase/parser/msg_submit_param_change_proposal_test.go index 0676e657e..0f34a780f 100644 --- a/usecase/parser/msg_submit_param_change_proposal_test.go +++ b/usecase/parser/msg_submit_param_change_proposal_test.go @@ -2,6 +2,7 @@ package parser_test import ( "encoding/json" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/external/primptr" "github.com/crypto-com/chain-indexing/usecase/coin" @@ -23,6 +24,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SUBMIT_PARAM_CHANGE_PROPOSAL_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SUBMIT_PARAM_CHANGE_PROPOSAL_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SUBMIT_PARAM_CHANGE_PROPOSAL_TXS_RESP) @@ -77,6 +79,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_FAILED_MSG_SUBMIT_PARAM_CHANGE_PROPOSAL_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_FAILED_MSG_SUBMIT_PARAM_CHANGE_PROPOSAL_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_FAILED_MSG_SUBMIT_PARAM_CHANGE_PROPOSAL_TXS_RESP) diff --git a/usecase/parser/msg_submit_proposal_test.go b/usecase/parser/msg_submit_proposal_test.go index b0f475841..8f7573bc0 100644 --- a/usecase/parser/msg_submit_proposal_test.go +++ b/usecase/parser/msg_submit_proposal_test.go @@ -2,6 +2,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/primptr" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" "github.com/crypto-com/chain-indexing/usecase/model" model_gov_v1 "github.com/crypto-com/chain-indexing/usecase/model/gov/v1" @@ -21,6 +22,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SOFTWARE_UPGRADE_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SOFTWARE_UPGRADE_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SOFTWARE_UPGRADE_TXS_RESP) @@ -84,6 +86,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_CANCEL_UPGRADE_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_CANCEL_UPGRADE_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_CANCEL_UPGRADE_TXS_RESP) @@ -140,6 +143,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_EXEC_LEGACY_CONTENT_V1_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_EXEC_LEGACY_CONTENT_V1_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_EXEC_LEGACY_CONTENT_V1_TXS_RESP) diff --git a/usecase/parser/msg_submit_software_upgrade_proposal_test.go b/usecase/parser/msg_submit_software_upgrade_proposal_test.go index 3a53db2ad..be94d37a9 100644 --- a/usecase/parser/msg_submit_software_upgrade_proposal_test.go +++ b/usecase/parser/msg_submit_software_upgrade_proposal_test.go @@ -3,6 +3,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/primptr" "github.com/crypto-com/chain-indexing/external/utctime" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -21,6 +22,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SUBMIT_SOFTWARE_UPGRADE_PROPOSAL_HEIGHT_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SUBMIT_SOFTWARE_UPGRADE_PROPOSAL_HEIGHT_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SUBMIT_SOFTWARE_UPGRADE_PROPOSAL_HEIGHT_TXS_RESP) @@ -75,6 +77,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SUBMIT_SOFTWARE_UPGRADE_PROPOSAL_TIME_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SUBMIT_SOFTWARE_UPGRADE_PROPOSAL_TIME_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SUBMIT_SOFTWARE_UPGRADE_PROPOSAL_TIME_TXS_RESP) diff --git a/usecase/parser/msg_submit_text_proposal_start_voting_test.go b/usecase/parser/msg_submit_text_proposal_start_voting_test.go index 316cdf6c4..6de45a297 100644 --- a/usecase/parser/msg_submit_text_proposal_start_voting_test.go +++ b/usecase/parser/msg_submit_text_proposal_start_voting_test.go @@ -2,6 +2,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/primptr" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -20,6 +21,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SUBMIT_TEXT_PROPOSAL_AND_START_VOTING_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SUBMIT_TEXT_PROPOSAL_AND_START_VOTING_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SUBMIT_TEXT_PROPOSAL_AND_START_VOTING_TXS_RESP) diff --git a/usecase/parser/msg_submit_text_proposal_test.go b/usecase/parser/msg_submit_text_proposal_test.go index b0d2427f3..3edbdacc3 100644 --- a/usecase/parser/msg_submit_text_proposal_test.go +++ b/usecase/parser/msg_submit_text_proposal_test.go @@ -2,6 +2,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/primptr" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/coin" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -20,6 +21,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_SUBMIT_TEXT_PROPOSAL_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_SUBMIT_TEXT_PROPOSAL_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SUBMIT_TEXT_PROPOSAL_TXS_RESP) diff --git a/usecase/parser/msg_submit_tx_test.go b/usecase/parser/msg_submit_tx_test.go index 7db759cec..5f21f71e7 100644 --- a/usecase/parser/msg_submit_tx_test.go +++ b/usecase/parser/msg_submit_tx_test.go @@ -55,7 +55,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_SUBMIT_TX_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_SUBMIT_TX_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_test.go b/usecase/parser/msg_test.go index 8599e4e11..c670891de 100644 --- a/usecase/parser/msg_test.go +++ b/usecase/parser/msg_test.go @@ -4,6 +4,8 @@ import ( "fmt" "strings" + tendermint_interface "github.com/crypto-com/chain-indexing/appinterface/tendermint" + "github.com/crypto-com/chain-indexing/infrastructure/cosmosapp" "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" @@ -19,8 +21,8 @@ func mustParseBlockResp(rawResp string) (*model.Block, *model.RawBlock) { return block, rawBlock } -func mustParseBlockResultsResp(rawResp string) *model.BlockResults { - blockResults, err := tendermint.ParseBlockResultsResp(strings.NewReader(rawResp)) +func mustParseBlockResultsResp(rawResp string, decoder tendermint_interface.BlockResultEventAttributeDecoder) *model.BlockResults { + blockResults, err := tendermint.ParseBlockResultsResp(strings.NewReader(rawResp), decoder) if err != nil { panic(fmt.Sprintf("error parsing block results response: %v", err)) diff --git a/usecase/parser/msg_undelegate_test.go b/usecase/parser/msg_undelegate_test.go index cc85d2e27..97e557464 100644 --- a/usecase/parser/msg_undelegate_test.go +++ b/usecase/parser/msg_undelegate_test.go @@ -3,6 +3,7 @@ package parser_test import ( "github.com/crypto-com/chain-indexing/external/primptr" "github.com/crypto-com/chain-indexing/external/utctime" + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -19,7 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { Describe("MsgDelegate", func() { It("should parse Msg commands when there is staking.MsgUndelegate in the transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_UNDELEGATE_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_UNDELEGATE_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_UNDELEGATE_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_UNDELEGATE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -59,7 +60,7 @@ var _ = Describe("ParseMsgCommands", func() { It("should parse MsgUndelegate command in failed transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_FAILED_MSG_UNDELEGATE_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_FAILED_MSG_UNDELEGATE_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_FAILED_MSG_UNDELEGATE_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_FAILED_MSG_UNDELEGATE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_unjail_test.go b/usecase/parser/msg_unjail_test.go index b35ee9092..dbc69e225 100644 --- a/usecase/parser/msg_unjail_test.go +++ b/usecase/parser/msg_unjail_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -17,7 +18,7 @@ var _ = Describe("ParseMsgCommands", func() { It("should parse Msg commands when there is slashing.MsgUnjail in the transaction", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_UNJAIL_BLOCK_RESP) - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_UNJAIL_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_UNJAIL_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_UNJAIL_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/msg_vote_test.go b/usecase/parser/msg_vote_test.go index d4de1550d..f3c6e0a59 100644 --- a/usecase/parser/msg_vote_test.go +++ b/usecase/parser/msg_vote_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,6 +19,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_VOTE_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_VOTE_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_VOTE_TXS_RESP) diff --git a/usecase/parser/msg_vote_v1_test.go b/usecase/parser/msg_vote_v1_test.go index 103d1aef4..5e4ac41c0 100644 --- a/usecase/parser/msg_vote_v1_test.go +++ b/usecase/parser/msg_vote_v1_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -19,6 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_VOTE_V1_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_VOTE_V1_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_VOTE_V1_TXS_RESP) diff --git a/usecase/parser/msg_vote_weighted_v1_test.go b/usecase/parser/msg_vote_weighted_v1_test.go index a5a9b365f..41f245f4f 100644 --- a/usecase/parser/msg_vote_weighted_v1_test.go +++ b/usecase/parser/msg_vote_weighted_v1_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -19,6 +20,7 @@ var _ = Describe("ParseMsgCommands", func() { block, _ := mustParseBlockResp(usecase_parser_test.TX_MSG_VOTE_WEIGHTED_V1_BLOCK_RESP) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSG_VOTE_WEIGHTED_V1_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_VOTE_WEIGHTED_V1_TXS_RESP) diff --git a/usecase/parser/msg_withdraw_validator_reward_test.go b/usecase/parser/msg_withdraw_validator_reward_test.go index a7494f975..19995ddac 100644 --- a/usecase/parser/msg_withdraw_validator_reward_test.go +++ b/usecase/parser/msg_withdraw_validator_reward_test.go @@ -24,6 +24,7 @@ var _ = Describe("ParseMsgCommands", func() { ) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_MSGS_WITHDRAW_DELEGATOR_REWARD_WITHDRAW_VALIDATOR_COMMISSION_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_MSGS_WITHDRAW_DELEGATOR_REWARD_WITHDRAW_VALIDATOR_COMMISSION_TXS_RESP) @@ -82,6 +83,7 @@ var _ = Describe("ParseMsgCommands", func() { ) blockResults := mustParseBlockResultsResp( usecase_parser_test.TX_FAILED_MSG_WITHDRAW_VALIDATOR_COMMISSION_BLOCK_RESULTS_RESP, + &tendermint.Base64BlockResultEventAttributeDecoder{}, ) tx := MustParseTxsResp(usecase_parser_test.TX_FAILED_MSG_WITHDRAW_VALIDATOR_COMMISSION_TXS_RESP) @@ -140,7 +142,7 @@ var _ = Describe("ParseMsgCommands", func() { usecase_parser_test.TX_MSG_WITHDRAW_DELEGATOR_REWARD_NO_REWARD_BLOCK_RESP)) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_test.TX_MSG_WITHDRAW_DELEGATOR_REWARD_NO_REWARD_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_MSG_WITHDRAW_DELEGATOR_REWARD_NO_REWARD_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/transaction_account_transfer_test.go b/usecase/parser/transaction_account_transfer_test.go index 8bac36b3c..089d38d07 100644 --- a/usecase/parser/transaction_account_transfer_test.go +++ b/usecase/parser/transaction_account_transfer_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -16,7 +17,7 @@ var _ = Describe("ParseTxAccountTransferCommands", func() { Describe("MsgSend", func() { It("should return CreateAccountTransfer command when there is transfer event in transaction", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_SEND_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_MSG_SEND_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) cmds, err := parser.ParseTxAccountTransferCommands( blockResults.Height, @@ -48,7 +49,7 @@ var _ = Describe("ParseTxAccountTransferCommands", func() { }) It("should return multiple CreateAccountTransfer commands when there are multiple bank.MsgSend in one transaction", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.ONE_TX_TWO_MSG_SEND_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.ONE_TX_TWO_MSG_SEND_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) cmds, err := parser.ParseTxAccountTransferCommands( blockResults.Height, @@ -80,7 +81,7 @@ var _ = Describe("ParseTxAccountTransferCommands", func() { }) It("should retur no command when there are transfer event with no amount", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_WITH_EMPTY_TRANSFER_AMOUNT_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_WITH_EMPTY_TRANSFER_AMOUNT_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) cmds, err := parser.ParseTxAccountTransferCommands( blockResults.Height, diff --git a/usecase/parser/transaction_test.go b/usecase/parser/transaction_test.go index 253e980cc..f32443e64 100644 --- a/usecase/parser/transaction_test.go +++ b/usecase/parser/transaction_test.go @@ -31,7 +31,7 @@ var _ = Describe("TransactionParser", func() { It("should parse Transaction commands when there is two Msg in one transaction", func() { mockClient := cosmosapp.NewMockClient() fakeLogger := FakeLogger.NewFakeLogger() - blockResults := mustParseBlockResultsResp(usecase_parser_test.ONE_TX_TWO_MSG_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.ONE_TX_TWO_MSG_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.ONE_TX_TWO_MSG_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -160,7 +160,7 @@ var _ = Describe("TransactionParser", func() { It("should parse Transaction commands when there is transaction fee", func() { mockClient := cosmosapp.NewMockClient() fakeLogger := FakeLogger.NewFakeLogger() - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_WITH_FEE_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_WITH_FEE_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_WITH_FEE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -258,7 +258,7 @@ var _ = Describe("TransactionParser", func() { It("should parse Transaction commands when transaction failed with fee", func() { mockClient := cosmosapp.NewMockClient() fakeLogger := FakeLogger.NewFakeLogger() - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_FAILED_WITH_FEE_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_FAILED_WITH_FEE_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_FAILED_WITH_FEE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -354,7 +354,7 @@ var _ = Describe("TransactionParser", func() { It("should parse Transaction commands when transaction failed without fee", func() { mockClient := cosmosapp.NewMockClient() fakeLogger := FakeLogger.NewFakeLogger() - blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader(usecase_parser_test.TX_FAILED_WITHOUT_FEE_BLOCK_RESULTS_RESP)) + blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader(usecase_parser_test.TX_FAILED_WITHOUT_FEE_BLOCK_RESULTS_RESP), &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_FAILED_WITHOUT_FEE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -467,7 +467,7 @@ var _ = Describe("TransactionParser", func() { It("should parse Transaction commands when there is transaction memo and timeout_height", func() { mockClient := cosmosapp.NewMockClient() fakeLogger := FakeLogger.NewFakeLogger() - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_WITH_MEMO_TIMEOUT_HEIGHT_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_WITH_MEMO_TIMEOUT_HEIGHT_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_WITH_MEMO_TIMEOUT_HEIGHT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -563,7 +563,7 @@ var _ = Describe("TransactionParser", func() { It("should parse failed Transaction commands when there is transaction memo and timeout_height", func() { mockClient := cosmosapp.NewMockClient() fakeLogger := FakeLogger.NewFakeLogger() - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_FAILED_WITH_MEMO_TIMEOUT_HEIGHT_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_FAILED_WITH_MEMO_TIMEOUT_HEIGHT_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_FAILED_WITH_MEMO_TIMEOUT_HEIGHT_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} @@ -659,7 +659,7 @@ var _ = Describe("TransactionParser", func() { It("should parse Transaction commands when the signer public key is empty", func() { mockClient := cosmosapp.NewMockClient() fakeLogger := FakeLogger.NewFakeLogger() - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_SIGNER_EMPTY_PUBKEY_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_SIGNER_EMPTY_PUBKEY_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx1 := MustParseTxsResp(usecase_parser_test.TX_SIGNER_EMPTY_PUBKEY_TXS_RESP_1) tx2 := MustParseTxsResp(usecase_parser_test.TX_SIGNER_EMPTY_PUBKEY_TXS_RESP_2) @@ -740,7 +740,7 @@ var _ = Describe("TransactionParser", func() { It("should parse Transaction commands when the signer public key is in state", func() { mockClient := cosmosapp.MockClient{} fakeLogger := FakeLogger.NewFakeLogger() - blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_SIGNER_PUBKEY_IN_STATE_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.TX_SIGNER_PUBKEY_IN_STATE_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) tx := MustParseTxsResp(usecase_parser_test.TX_SIGNER_PUBKEY_IN_STATE_TXS_RESP) txs := []model.CosmosTxWithHash{*tx} diff --git a/usecase/parser/v0_42_7/msg_ibc_recv_packet_test.go b/usecase/parser/v0_42_7/msg_ibc_recv_packet_test.go index a81633b1a..2338f1b6c 100644 --- a/usecase/parser/v0_42_7/msg_ibc_recv_packet_test.go +++ b/usecase/parser/v0_42_7/msg_ibc_recv_packet_test.go @@ -78,7 +78,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_V0_42_7_test.TX_MSG_RECV_PACKET_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) resTx, _ := cosmosapp.ParseTxsResp(strings.NewReader( usecase_parser_V0_42_7_test.TX_MSG_RECV_PACKET_TXS_RESP, @@ -174,7 +174,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_V0_42_7_test.TX_MSG_RECV_PACKET_PACKET_ACK_ERROR_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) resTx, _ := cosmosapp.ParseTxsResp(strings.NewReader( usecase_parser_V0_42_7_test.TX_MSG_RECV_PACKET_PACKET_ACK_ERROR_TXS_RESP, @@ -275,7 +275,7 @@ var _ = Describe("ParseMsgCommands", func() { )) blockResults, _ := tendermint.ParseBlockResultsResp(strings.NewReader( usecase_parser_V0_42_7_test.TX_MSG_RECV_PACKET_MISSING_FUNGIBLE_TOKEN_PACKET_BLOCK_RESULTS_RESP, - )) + ), &tendermint.Base64BlockResultEventAttributeDecoder{}) resTx, _ := cosmosapp.ParseTxsResp(strings.NewReader( usecase_parser_V0_42_7_test.TX_MSG_RECV_PACKET_MISSING_FUNGIBLE_TOKEN_PACKET_TXS_RESP, diff --git a/usecase/parser/validator_updates_test.go b/usecase/parser/validator_updates_test.go index 1b6095989..b5eda7be1 100644 --- a/usecase/parser/validator_updates_test.go +++ b/usecase/parser/validator_updates_test.go @@ -1,6 +1,7 @@ package parser_test import ( + "github.com/crypto-com/chain-indexing/infrastructure/tendermint" "github.com/crypto-com/chain-indexing/usecase/model" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -15,7 +16,7 @@ var _ = Describe("ParseValidatorUpdatesCommands", func() { Describe("MsgSend", func() { It("should return commands corresponding to events in validator_updates", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.VALIDATOR_UPDATES_CREATE_VALIDATOR_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.VALIDATOR_UPDATES_CREATE_VALIDATOR_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) cmds, err := parser.ParseValidatorUpdatesCommands( blockResults.Height, @@ -43,7 +44,7 @@ var _ = Describe("ParseValidatorUpdatesCommands", func() { }) It("should return 0 power commands when poser is not defined", func() { - blockResults := mustParseBlockResultsResp(usecase_parser_test.VALIDATOR_UPDATES_VALIDATOR_SLASHED_BLOCK_RESULTS_RESP) + blockResults := mustParseBlockResultsResp(usecase_parser_test.VALIDATOR_UPDATES_VALIDATOR_SLASHED_BLOCK_RESULTS_RESP, &tendermint.Base64BlockResultEventAttributeDecoder{}) cmds, err := parser.ParseValidatorUpdatesCommands( blockResults.Height,