From 70c2025934ad2ceb997838520456006198cfc82e Mon Sep 17 00:00:00 2001 From: Paul Chen Date: Mon, 24 Jun 2024 13:38:53 +0800 Subject: [PATCH 1/3] fix: added back authz message handler in worker --- modules/module.go | 5 +---- parser/worker.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/modules/module.go b/modules/module.go index 8b717a4e..37231f38 100644 --- a/modules/module.go +++ b/modules/module.go @@ -4,11 +4,8 @@ import ( "encoding/json" "strings" - "github.com/cosmos/cosmos-sdk/x/authz" - tmctypes "github.com/cometbft/cometbft/rpc/core/types" tmtypes "github.com/cometbft/cometbft/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/go-co-op/gocron" "github.com/forbole/juno/v6/types" @@ -106,5 +103,5 @@ type AuthzMessageModule interface { // are passed as well. // NOTE. The returned error will be logged using the MsgError method. All other modules' handlers // will still be called. - HandleMsgExec(index int, msgExec *authz.MsgExec, authzMsgIndex int, executedMsg sdk.Msg, tx *types.Transaction) error + HandleMsgExec(index int, authzMsgIndex int, executedMsg types.Message, tx *types.Transaction) error } diff --git a/parser/worker.go b/parser/worker.go index 7b039878..ebda1cf9 100644 --- a/parser/worker.go +++ b/parser/worker.go @@ -295,6 +295,35 @@ func (w Worker) handleMessage(index int, msg types.Message, tx *types.Transactio w.logger.MsgError(module, tx, msg, err) } } + + // If it's a MsgExecute, we need to make sure the included messages are handled as well + if msg.GetType() == "/cosmos.authz.v1beta1.MsgExec" { + var msgExec struct { + Msgs []json.RawMessage `json:"msgs"` + } + + err := json.Unmarshal(msg.GetBytes(), &msgExec) + if err != nil { + w.logger.Error("unable to unmarshal MsgExec inner messages", "error", err) + return + } + + for authzIndex, msgAny := range msgExec.Msgs { + executedMsg, err := types.UnmarshalMessage(authzIndex, msgAny) + if err != nil { + w.logger.Error("unable to unpack MsgExec inner message", "index", authzIndex, "error", err) + } + + for _, module := range w.modules { + if messageModule, ok := module.(modules.AuthzMessageModule); ok { + err = messageModule.HandleMsgExec(index, authzIndex, executedMsg, tx) + if err != nil { + w.logger.MsgError(module, tx, executedMsg, err) + } + } + } + } + } } } From a46948048025f2fd7a0041051d21507c76ba2415 Mon Sep 17 00:00:00 2001 From: Paul Chen Date: Mon, 24 Jun 2024 13:40:29 +0800 Subject: [PATCH 2/3] chore: run format --- node/builder/builder.go | 1 + types/config/config.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/node/builder/builder.go b/node/builder/builder.go index f6f1003c..397c5422 100644 --- a/node/builder/builder.go +++ b/node/builder/builder.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + "github.com/forbole/juno/v6/node" nodeconfig "github.com/forbole/juno/v6/node/config" "github.com/forbole/juno/v6/node/local" diff --git a/types/config/config.go b/types/config/config.go index cf3a1495..a7532429 100644 --- a/types/config/config.go +++ b/types/config/config.go @@ -3,11 +3,12 @@ package config import ( "strings" + "gopkg.in/yaml.v3" + databaseconfig "github.com/forbole/juno/v6/database/config" loggingconfig "github.com/forbole/juno/v6/logging/config" nodeconfig "github.com/forbole/juno/v6/node/config" parserconfig "github.com/forbole/juno/v6/parser/config" - "gopkg.in/yaml.v3" ) var ( From a1faf5d4d39f2bb46b747871176a04ebda9bc23d Mon Sep 17 00:00:00 2001 From: Paul Chen Date: Mon, 24 Jun 2024 13:45:21 +0800 Subject: [PATCH 3/3] chore: update mergify --- .mergify.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.mergify.yml b/.mergify.yml index 57109505..33b4df7e 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -15,4 +15,12 @@ pull_request_rules: commit_message_template: > {{ title }} (#{{ number }}) - {{ body }} \ No newline at end of file + {{ body }} + - name: backport patches to v0.47.x branch + conditions: + - base=cosmos/v0.50.x + - label=backport/v0.47.x + actions: + backport: + branches: + - cosmos/v0.47.x \ No newline at end of file