github.com/MetalBlockchain/subnet-evm@v0.6.3/predicate/predicate_slots.go (about)

     1  // (c) 2023, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package predicate
     5  
     6  import (
     7  	"github.com/MetalBlockchain/subnet-evm/core/types"
     8  	"github.com/MetalBlockchain/subnet-evm/params"
     9  	"github.com/MetalBlockchain/subnet-evm/utils"
    10  	"github.com/ethereum/go-ethereum/common"
    11  )
    12  
    13  // PreparePredicateStorageSlots populates the the predicate storage slots of a transaction's access list
    14  // Note: if an address is specified multiple times in the access list, each storage slot for that address is
    15  // appended to a slice of byte slices. Each byte slice represents a predicate, making it a slice of predicates
    16  // for each access list address, and every predicate in the slice goes through verification.
    17  func PreparePredicateStorageSlots(rules params.Rules, list types.AccessList) map[common.Address][][]byte {
    18  	predicateStorageSlots := make(map[common.Address][][]byte)
    19  	for _, el := range list {
    20  		if !rules.PredicaterExists(el.Address) {
    21  			continue
    22  		}
    23  		predicateStorageSlots[el.Address] = append(predicateStorageSlots[el.Address], utils.HashSliceToBytes(el.StorageKeys))
    24  	}
    25  
    26  	return predicateStorageSlots
    27  }