Skip to content

Commit a3a472c

Browse files
authored
Merge pull request #24 from Peersyst/fix/disable-authz-staking-msgs
[FIX] Disable authz staking messages
2 parents 99a18b2 + ac5bf1b commit a3a472c

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

app/app.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,10 @@ func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) {
756756
MaxTxGasWanted: maxGasWanted,
757757
TxFeeChecker: ethante.NewDynamicFeeChecker(app.EvmKeeper),
758758
ExtraDecorator: poaante.NewPoaDecorator(),
759+
AuthzDisabledMsgTypes: []string{
760+
sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}),
761+
sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}),
762+
},
759763
}
760764

761765
if err := options.Validate(); err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ replace (
226226
// use Evmos geth fork
227227
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2
228228
// use exrp Evmos fork
229-
github.com/evmos/evmos/v15 => github.com/Peersyst/evmos/v15 v15.0.0-exrp.2
229+
github.com/evmos/evmos/v15 => github.com/Peersyst/evmos/v15 v15.0.0-exrp.3
230230
// Security Advisory https://github.com/advisories/GHSA-h395-qcrw-5vmq
231231
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
232232
// replace broken goleveldb

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2y
232232
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
233233
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
234234
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
235-
github.com/Peersyst/evmos/v15 v15.0.0-exrp.2 h1:tvBzN2PbH+zH6mW3TI2oJs4SE6qdubXCWc+vtN/q95c=
236-
github.com/Peersyst/evmos/v15 v15.0.0-exrp.2/go.mod h1:15ZOo7jqFRe5elw2ipTb3oHq3x7rebUjwq4y2vJEj4Q=
235+
github.com/Peersyst/evmos/v15 v15.0.0-exrp.3 h1:aPaHhkx1YTZ7gl/fTXjhXFP4wYWf/n4ecSWiB333Gas=
236+
github.com/Peersyst/evmos/v15 v15.0.0-exrp.3/go.mod h1:15ZOo7jqFRe5elw2ipTb3oHq3x7rebUjwq4y2vJEj4Q=
237237
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
238238
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
239239
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=

x/poa/ante/poa.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package ante
33
import (
44
"errors"
55
sdk "github.com/cosmos/cosmos-sdk/types"
6+
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
67
)
78

89
type PoaDecorator struct{}
@@ -14,8 +15,8 @@ func NewPoaDecorator() PoaDecorator {
1415
func (cbd PoaDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
1516
// loop through all the messages and check if the message type is allowed
1617
for _, msg := range tx.GetMsgs() {
17-
if sdk.MsgTypeURL(msg) == "/cosmos.staking.v1beta1.MsgUndelegate" ||
18-
sdk.MsgTypeURL(msg) == "/cosmos.staking.v1beta1.MsgBeginRedelegate" {
18+
if sdk.MsgTypeURL(msg) == sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}) ||
19+
sdk.MsgTypeURL(msg) == sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}) {
1920
return ctx, errors.New("tx type not allowed")
2021
}
2122
}

0 commit comments

Comments
 (0)