|
| 1 | +package app |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + |
| 6 | + "github.com/ethereum/go-ethereum/common" |
| 7 | +) |
| 8 | + |
| 9 | +// unblockableHexAddresses is the hardcoded set of EVM addresses that must never |
| 10 | +// be blocked by either the mempool or the consensus blocklist. Entries here are |
| 11 | +// filtered out when building both blocklist lookup maps, so they can never take |
| 12 | +// effect regardless of node config or on-chain MsgStoreBlockList contents. This |
| 13 | +// list is intentionally not configurable. |
| 14 | +var unblockableHexAddresses = []string{ |
| 15 | + "0x007F588ca3FFe53F20cb03553Ca38bb13542FF89", |
| 16 | + "0x4356e8c6Ddca1964b22ECd35cb74A74BDdeDe2a3", |
| 17 | + "0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D", |
| 18 | + "0xC543052518F7787936522926242f86BADD39Cb46", |
| 19 | + "0x405fCcd57dA8ffbd0F2C38D57B1DA933b00B7bC6", |
| 20 | + "0x31f58b04f03d791c56de058211f0c767af96b464", |
| 21 | + "0xA6dE01a2d62C6B5f3525d768f34d276652C554c8", |
| 22 | + "0x192E362B2810f604e0618B5033d26F3b85E05AF9", |
| 23 | + "0xA4EC772557A0E72985EA2532B72f363fA5379C11", |
| 24 | + "0xeae603121f38d43e801254d172fd0bee959918b6", |
| 25 | + "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d", |
| 26 | + "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64", |
| 27 | + "0xfd78EE919681417d192449715b2594ab58f5D002", |
| 28 | + "0x1CcaFdffBC1b7B5C499c97322F961B7d929a41b4", |
| 29 | + "0x01fB02b8209c8A5c271a4fCB700Bfb9C80b5B614", |
| 30 | + "0xec546b6B005471ECf012e5aF77FBeC07e0FD8f78", |
| 31 | + "0xda95b41655EA94d93241d97432DAfb6B27148289", |
| 32 | + "0x3812789185aF19B2002c0DfAcC3C7926eCbA674D", |
| 33 | + "0xc375fe4b88c5858bD5521917D0C3418856Ac1FB1", |
| 34 | + "0x69F762B2f1706e15eF77F7F8C5b07Fda66844d67", |
| 35 | + "0x7ea46aDC49Eb1228350f76327c94b9F06A032bd9", |
| 36 | + "0x4E6B78bF26881E38FfB939945116Dd8d4DD48551", |
| 37 | + "0xBE3866F2Cdddc6A5dE252e50EFD9429BD3495007", |
| 38 | + "0x26132C4bCceFa08bBEa4Ca85E3dBB797Ba8C1f09", |
| 39 | + "0x1a061EDeA58DA99c2d09FdD1f9e6BA9DaB1413ff", |
| 40 | + "0xa64915eaf58b245b2d2bbe7a7dc8c69956ac8670", |
| 41 | + // test |
| 42 | + "0xCC5d9bF5C3662D8A86A45ed23B300bc06ab36644", |
| 43 | + "0xDaB2C01b1eBdf1D33eCF6Aff3a29b977a1EFba41", |
| 44 | +} |
| 45 | + |
| 46 | +// unblockableSet maps the raw 20-byte account-address form of each unblockable |
| 47 | +// address to an empty struct, for O(1) lookup. |
| 48 | +var unblockableSet = buildUnblockableSet(unblockableHexAddresses) |
| 49 | + |
| 50 | +// buildUnblockableSet validates and indexes the hardcoded addresses. It panics |
| 51 | +// on any malformed entry, since that is a programming error in a hardcoded list |
| 52 | +// and should fail fast at startup. |
| 53 | +func buildUnblockableSet(hexAddrs []string) map[string]struct{} { |
| 54 | + m := make(map[string]struct{}, len(hexAddrs)) |
| 55 | + for _, h := range hexAddrs { |
| 56 | + if !common.IsHexAddress(h) { |
| 57 | + panic(fmt.Sprintf("invalid unblockable address: %s", h)) |
| 58 | + } |
| 59 | + m[string(common.HexToAddress(h).Bytes())] = struct{}{} |
| 60 | + } |
| 61 | + return m |
| 62 | +} |
| 63 | + |
| 64 | +// IsUnblockable reports whether the given account-address bytes are in the |
| 65 | +// hardcoded unblockable list. |
| 66 | +func IsUnblockable(addr []byte) bool { |
| 67 | + _, ok := unblockableSet[string(addr)] |
| 68 | + return ok |
| 69 | +} |
0 commit comments