44package core
55
66import (
7- "errors"
87 "fmt"
98
109 "github.com/ava-labs/subnet-evm/core/types"
@@ -14,8 +13,6 @@ import (
1413 "github.com/ethereum/go-ethereum/common"
1514)
1615
17- var errNilProposerVMBlockCtxWithProposerPredicate = errors .New ("engine cannot specify nil ProposerVM block context with non-empty proposer predicates" )
18-
1916// CheckPredicates checks that all precompile predicates are satisfied within the current [predicateContext] for [tx]
2017func CheckPredicates (rules params.Rules , predicateContext * precompileconfig.ProposerPredicateContext , tx * types.Transaction ) error {
2118 if err := checkPrecompilePredicates (rules , & predicateContext .PrecompilePredicateContext , tx ); err != nil {
@@ -43,7 +40,8 @@ func checkPrecompilePredicates(rules params.Rules, predicateContext *precompilec
4340 return fmt .Errorf ("predicate %s failed verification for tx %s: specified %s in access list multiple times" , address , tx .Hash (), address )
4441 }
4542 precompileAddressChecks [address ] = struct {}{}
46- if err := predicater .VerifyPredicate (predicateContext , utils .HashSliceToBytes (accessTuple .StorageKeys )); err != nil {
43+ predicateBytes := utils .HashSliceToBytes (accessTuple .StorageKeys )
44+ if err := predicater .VerifyPredicate (predicateContext , predicateBytes ); err != nil {
4745 return fmt .Errorf ("predicate %s failed verification for tx %s: %w" , address , tx .Hash (), err )
4846 }
4947 }
@@ -56,10 +54,6 @@ func checkProposerPrecompilePredicates(rules params.Rules, predicateContext *pre
5654 if len (rules .ProposerPredicates ) == 0 {
5755 return nil
5856 }
59- // If a proposer predicate is specified, reuqire that the ProposerVMBlockCtx is non-nil.
60- if predicateContext .ProposerVMBlockCtx == nil {
61- return errNilProposerVMBlockCtxWithProposerPredicate
62- }
6357 precompilePredicates := rules .ProposerPredicates
6458 // Track addresses that we've performed a predicate check for
6559 precompileAddressChecks := make (map [common.Address ]struct {})
@@ -74,7 +68,8 @@ func checkProposerPrecompilePredicates(rules params.Rules, predicateContext *pre
7468 return fmt .Errorf ("predicate %s failed verification for tx %s: specified %s in access list multiple times" , address , tx .Hash (), address )
7569 }
7670 precompileAddressChecks [address ] = struct {}{}
77- if err := predicater .VerifyPredicate (predicateContext , utils .HashSliceToBytes (accessTuple .StorageKeys )); err != nil {
71+ predicateBytes := utils .HashSliceToBytes (accessTuple .StorageKeys )
72+ if err := predicater .VerifyPredicate (predicateContext , predicateBytes ); err != nil {
7873 return fmt .Errorf ("predicate %s failed verification for tx %s: %w" , address , tx .Hash (), err )
7974 }
8075 }
0 commit comments