Skip to content

Commit ce676e9

Browse files
committed
check authorisation list for blocklisted address
1 parent c139f80 commit ce676e9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

app/block_address.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package app
22

33
import (
44
"fmt"
5+
evmtypes "github.com/evmos/ethermint/x/evm/types"
56

67
"github.com/crypto-org-chain/cronos/v2/x/cronos/types"
78

@@ -41,6 +42,25 @@ func (bad BlockAddressesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
4142
}
4243
}
4344
}
45+
46+
// check EIP-7702 authorisation list
47+
for _, msg := range tx.GetMsgs() {
48+
msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx)
49+
if ok {
50+
ethTx := msgEthTx.AsTransaction()
51+
if ethTx.SetCodeAuthorizations() != nil {
52+
for _, auth := range ethTx.SetCodeAuthorizations() {
53+
addr, err := auth.Authority()
54+
if err == nil {
55+
if _, ok := bad.blockedMap[sdk.AccAddress(addr.Bytes()).String()]; ok {
56+
return ctx, fmt.Errorf("signer is blocked: %s", addr.String())
57+
}
58+
}
59+
}
60+
}
61+
}
62+
}
63+
4464
admin := bad.getParams(ctx).CronosAdmin
4565
for _, msg := range tx.GetMsgs() {
4666
if blocklistMsg, ok := msg.(*types.MsgStoreBlockList); ok {

0 commit comments

Comments
 (0)