From ac5bf1b328e3eb947e97b8e893a2ccc9a6799076 Mon Sep 17 00:00:00 2001 From: AdriaCarrera Date: Fri, 3 May 2024 10:32:55 +0200 Subject: [PATCH] fix: disable authz staking msgs --- app/app.go | 4 ++++ go.mod | 2 +- go.sum | 4 ++-- x/poa/ante/poa.go | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index 3b93996..42ca37d 100644 --- a/app/app.go +++ b/app/app.go @@ -756,6 +756,10 @@ func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) { MaxTxGasWanted: maxGasWanted, TxFeeChecker: ethante.NewDynamicFeeChecker(app.EvmKeeper), ExtraDecorator: poaante.NewPoaDecorator(), + AuthzDisabledMsgTypes: []string{ + sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}), + sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}), + }, } if err := options.Validate(); err != nil { diff --git a/go.mod b/go.mod index 5d6643b..2987bd1 100644 --- a/go.mod +++ b/go.mod @@ -226,7 +226,7 @@ replace ( // use Evmos geth fork github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2 // use exrp Evmos fork - github.com/evmos/evmos/v15 => github.com/Peersyst/evmos/v15 v15.0.0-exrp.2 + github.com/evmos/evmos/v15 => github.com/Peersyst/evmos/v15 v15.0.0-exrp.3 // Security Advisory https://github.com/advisories/GHSA-h395-qcrw-5vmq github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 // replace broken goleveldb diff --git a/go.sum b/go.sum index 0c3dc8c..13f0d26 100644 --- a/go.sum +++ b/go.sum @@ -232,8 +232,8 @@ github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2y github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Peersyst/evmos/v15 v15.0.0-exrp.2 h1:tvBzN2PbH+zH6mW3TI2oJs4SE6qdubXCWc+vtN/q95c= -github.com/Peersyst/evmos/v15 v15.0.0-exrp.2/go.mod h1:15ZOo7jqFRe5elw2ipTb3oHq3x7rebUjwq4y2vJEj4Q= +github.com/Peersyst/evmos/v15 v15.0.0-exrp.3 h1:aPaHhkx1YTZ7gl/fTXjhXFP4wYWf/n4ecSWiB333Gas= +github.com/Peersyst/evmos/v15 v15.0.0-exrp.3/go.mod h1:15ZOo7jqFRe5elw2ipTb3oHq3x7rebUjwq4y2vJEj4Q= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= diff --git a/x/poa/ante/poa.go b/x/poa/ante/poa.go index 1a0cd5b..bf0d786 100644 --- a/x/poa/ante/poa.go +++ b/x/poa/ante/poa.go @@ -3,6 +3,7 @@ package ante import ( "errors" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) type PoaDecorator struct{} @@ -14,8 +15,8 @@ func NewPoaDecorator() PoaDecorator { func (cbd PoaDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { // loop through all the messages and check if the message type is allowed for _, msg := range tx.GetMsgs() { - if sdk.MsgTypeURL(msg) == "/cosmos.staking.v1beta1.MsgUndelegate" || - sdk.MsgTypeURL(msg) == "/cosmos.staking.v1beta1.MsgBeginRedelegate" { + if sdk.MsgTypeURL(msg) == sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}) || + sdk.MsgTypeURL(msg) == sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}) { return ctx, errors.New("tx type not allowed") } }