Skip to content

Commit a0fd1f3

Browse files
authored
fix: add authorisation address check in the blocklist (#1924)
* add missing authorisation address * add changelog * remove extra line
1 parent 71cf364 commit a0fd1f3

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* [#1903](https://github.com/crypto-org-chain/cronos/pull/1903) Feat: check authorization list in e2ee.
88
* [#1922](https://github.com/crypto-org-chain/cronos/pull/1922) Feat: check destination address in the blocklist
99
* [#1904](https://github.com/crypto-org-chain/cronos/pull/1904) Test: add eip-7702 tests
10+
* [#1924](https://github.com/crypto-org-chain/cronos/pull/1924) Fix: check authorisation address in the blocklist
1011

1112
### Bug fixes
1213

app/block_address.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ func (bad BlockAddressesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
6262
return ctx, fmt.Errorf("signer is blocked: %s", addr.String())
6363
}
6464
}
65+
// check the target address
66+
if _, ok := bad.blockedMap[sdk.AccAddress(auth.Address.Bytes()).String()]; ok {
67+
return ctx, fmt.Errorf("authorisation address is blocked: %s", sdk.AccAddress(auth.Address.Bytes()).String())
68+
}
6569
}
6670
}
6771
}

app/proposal.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ func (h *ProposalHandler) ValidateTransaction(tx sdk.Tx, txBz []byte) error {
198198
return fmt.Errorf("signer is blocked: %s", addr.String())
199199
}
200200
}
201+
// check the target address
202+
encoded, err := h.addressCodec.BytesToString(auth.Address.Bytes())
203+
if err != nil {
204+
return fmt.Errorf("invalid bech32 address: %s, err: %w", auth.Address, err)
205+
}
206+
if _, ok := h.blocklist[encoded]; ok {
207+
return fmt.Errorf("authorisation address is blocked: %s", encoded)
208+
}
201209
}
202210
}
203211
}

0 commit comments

Comments
 (0)