mirror of https://github.com/nucypher/nucypher.git
Always call `_check_chain_id` in rpc based condition
parent
47f8bd39c7
commit
6f03e2283d
|
@ -173,11 +173,9 @@ class RPCCall(ExecutionCall):
|
|||
self,
|
||||
provider: HTTPProvider,
|
||||
resolved_parameters: List[Any],
|
||||
check_chain: bool = True,
|
||||
) -> Any:
|
||||
w3 = self._configure_w3(provider)
|
||||
if check_chain:
|
||||
self._check_chain_id(w3)
|
||||
self._check_chain_id(w3)
|
||||
return self._execute(w3, resolved_parameters)
|
||||
|
||||
def execute(self, providers: Dict[int, Set[HTTPProvider]], **context) -> Any:
|
||||
|
@ -204,7 +202,7 @@ class RPCCall(ExecutionCall):
|
|||
|
||||
if self.rpc_endpoint:
|
||||
result, error = self._execute_with_provider(
|
||||
HTTPProvider(self.rpc_endpoint), resolved_parameters, check_chain=False
|
||||
HTTPProvider(self.rpc_endpoint), resolved_parameters
|
||||
)
|
||||
if error:
|
||||
raise RPCExecutionFailed(error)
|
||||
|
|
|
@ -145,7 +145,7 @@ def test_rpc_condition_uses_provided_endpoint(mocker):
|
|||
# Mock eth module
|
||||
mock_w3 = mocker.Mock()
|
||||
mock_w3.eth.get_balance.return_value = 0
|
||||
mock_w3.eth.chain_id = 8453
|
||||
mock_w3.eth.chain_id = TESTERCHAIN_CHAIN_ID
|
||||
|
||||
# Patch RPCCall._configure_w3 method
|
||||
mocker.patch(
|
||||
|
@ -206,7 +206,8 @@ def test_rpc_condition_execution_priority(mocker):
|
|||
mock_http_provider_spy.reset_mock()
|
||||
|
||||
# Test Case 2: Unsupported chain - should use rpc_endpoint
|
||||
unsupported_chain = 99999 # Chain not in _CONDITION_CHAINS
|
||||
unsupported_chain = 8453
|
||||
mock_eth.chain_id = unsupported_chain
|
||||
condition = RPCCondition(
|
||||
method="eth_getBalance",
|
||||
chain=unsupported_chain,
|
||||
|
|
Loading…
Reference in New Issue