mirror of https://github.com/nucypher/nucypher.git
Always inject poa middleware for Web3 instances used for evaluating RPCConditions (and sub-classes).
parent
930eaf9b23
commit
f692b0650f
|
@ -102,11 +102,10 @@ class EthereumClient:
|
|||
f"Blockchain: {self.chain_name} (chain_id={chain_id}, poa={is_poa})"
|
||||
)
|
||||
|
||||
# proof-of-authority blockchain
|
||||
# add POA middleware irrespective of chain
|
||||
poa_middleware_name = "poa"
|
||||
self.log.info("Injecting POA middleware at layer 0")
|
||||
self.inject_middleware(
|
||||
# use naming from redundancy middleware
|
||||
geth_poa_middleware,
|
||||
layer=0,
|
||||
name=poa_middleware_name,
|
||||
|
|
|
@ -18,7 +18,6 @@ from web3.middleware import geth_poa_middleware
|
|||
from web3.providers import BaseProvider
|
||||
from web3.types import ABIFunction
|
||||
|
||||
from nucypher.blockchain.eth.constants import POA_CHAINS
|
||||
from nucypher.policy.conditions import STANDARD_ABI_CONTRACT_TYPES, STANDARD_ABIS
|
||||
from nucypher.policy.conditions.base import AccessControlCondition
|
||||
from nucypher.policy.conditions.context import (
|
||||
|
@ -211,9 +210,9 @@ class RPCCondition(AccessControlCondition):
|
|||
# Instantiate a local web3 instance
|
||||
self.provider = provider
|
||||
w3 = Web3(provider)
|
||||
if self.chain in POA_CHAINS:
|
||||
# inject web3 middleware to handle POA chain extra_data field.
|
||||
w3.middleware_onion.inject(geth_poa_middleware, layer=0)
|
||||
# inject web3 middleware to handle POA chain extra_data field.
|
||||
w3.middleware_onion.inject(geth_poa_middleware, layer=0, name="poa")
|
||||
|
||||
return w3
|
||||
|
||||
def _check_chain_id(self) -> None:
|
||||
|
|
Loading…
Reference in New Issue