validate that accounts in the BAL are unique

This commit is contained in:
Jared Wasinger 2025-12-15 10:48:10 -08:00
parent 10a4b0917e
commit 1ef2b5d739

View file

@ -95,6 +95,16 @@ func (e BlockAccessList) Validate() error {
}) {
return errors.New("block access list accounts not in lexicographic order")
}
// check that the accounts are unique
addrs := make(map[common.Address]struct{})
for _, acct := range e {
addr := acct.Address
if _, ok := addrs[addr]; ok {
return fmt.Errorf("duplicate account in block access list: %x", addr)
}
addrs[addr] = struct{}{}
}
for _, entry := range e {
if err := entry.validate(); err != nil {
return err