mirror of https://github.com/nucypher/nucypher.git
Reduce permitted chains to a tuple.
parent
8feb4bdc67
commit
77e0f2a1d4
|
@ -31,17 +31,14 @@ from nucypher.policy.conditions.base import ReencryptionCondition
|
|||
from nucypher.policy.conditions.context import get_context_value, is_context_variable
|
||||
from nucypher.policy.conditions.lingo import ReturnValueTest
|
||||
|
||||
|
||||
# Permitted blockchains for condition evaluation
|
||||
_CONDITION_CHAINS = {
|
||||
1: "Ethereum", # TODO: 60 ?
|
||||
5: "Goerli",
|
||||
# 6: "Kotti",
|
||||
# 42: "Kovan",
|
||||
# 77: "Sokol",
|
||||
# 100: "xDai",
|
||||
137: "Polygon/Mainnet",
|
||||
80001: "Polygon/Mumbai"
|
||||
}
|
||||
_CONDITION_CHAINS = (
|
||||
1, # ethereum/mainnet
|
||||
5, # ethereum/goerli
|
||||
137, # polygon/mainnet
|
||||
80001 # polygon/mumbai
|
||||
)
|
||||
|
||||
|
||||
def _resolve_abi(standard_contract_type: str, method: str, function_abi: List) -> List:
|
||||
|
|
|
@ -22,6 +22,7 @@ from pathlib import Path
|
|||
import pytest
|
||||
from web3 import Web3
|
||||
|
||||
import nucypher
|
||||
import tests.data
|
||||
from nucypher.blockchain.eth.agents import (
|
||||
ContractAgency,
|
||||
|
@ -33,7 +34,7 @@ from nucypher.blockchain.eth.sol.compile.compile import multiversion_compile
|
|||
from nucypher.blockchain.eth.sol.compile.types import SourceBundle
|
||||
from nucypher.crypto.powers import TransactingPower
|
||||
from nucypher.policy.conditions.context import USER_ADDRESS_CONTEXT
|
||||
from nucypher.policy.conditions.evm import ContractCondition, RPCCondition, _CONDITION_CHAINS
|
||||
from nucypher.policy.conditions.evm import ContractCondition, RPCCondition
|
||||
from nucypher.policy.conditions.lingo import AND, OR, ConditionLingo, ReturnValueTest
|
||||
from nucypher.policy.conditions.time import TimeCondition
|
||||
from tests.constants import TESTERCHAIN_CHAIN_ID
|
||||
|
@ -47,7 +48,8 @@ with open(VECTORS_FILE, 'r') as file:
|
|||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_condition_blockchains(mocker):
|
||||
mocker.patch.dict(_CONDITION_CHAINS, {131277322940537: 'testerchain'})
|
||||
"""adds testerchain to permitted conditional chains"""
|
||||
mocker.patch.object(nucypher.policy.conditions.evm, '_CONDITION_CHAINS', tuple([131277322940537]))
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
|
|
@ -21,9 +21,10 @@ from pathlib import Path
|
|||
import pytest
|
||||
from web3 import Web3
|
||||
|
||||
import nucypher
|
||||
import tests
|
||||
from nucypher.policy.conditions.context import USER_ADDRESS_CONTEXT
|
||||
from nucypher.policy.conditions.evm import ContractCondition, RPCCondition, _CONDITION_CHAINS
|
||||
from nucypher.policy.conditions.evm import ContractCondition, RPCCondition
|
||||
from nucypher.policy.conditions.lingo import AND, OR, ConditionLingo, ReturnValueTest
|
||||
from nucypher.policy.conditions.time import TimeCondition
|
||||
from tests.constants import TESTERCHAIN_CHAIN_ID
|
||||
|
@ -36,7 +37,8 @@ with open(VECTORS_FILE, 'r') as file:
|
|||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_condition_blockchains(mocker):
|
||||
mocker.patch.dict(_CONDITION_CHAINS, {131277322940537: 'testerchain'})
|
||||
"""adds testerchain to permitted conditional chains"""
|
||||
mocker.patch.object(nucypher.policy.conditions.evm, '_CONDITION_CHAINS', tuple([131277322940537]))
|
||||
|
||||
|
||||
# ERC1155
|
||||
|
|
Loading…
Reference in New Issue