Skip to content

Commit

Permalink
fix: tests with empty simple-dvt
Browse files Browse the repository at this point in the history
  • Loading branch information
krogla committed Jan 30, 2024
1 parent c3dad6b commit b533491
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 5 deletions.
16 changes: 16 additions & 0 deletions configs/config_mainnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
LIDO = "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
LEGACY_ORACLE = "0x442af784A788A5bd6F42A01Ebe9F287a871243fb"
NODE_OPERATORS_REGISTRY = "0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5"
SIMPLE_DVT = "0xaE7B191A31f627b4eB1d4DaC64eaB9976995b433"

LIDO_IMPL_V1 = "0x47EbaB13B806773ec2A2d16873e2dF770D130b50"
LEGACY_ORACLE_IMPL_V1 = "0x1430194905301504e8830ce4B0b0df7187E84AbD"
Expand Down Expand Up @@ -127,6 +128,21 @@
CURATED_STAKING_MODULE_OPERATORS_COUNT = 39
CURATED_STAKING_MODULE_OPERATORS_ACTIVE_COUNT = 37

# NodeOperatorsRegistry clone aka SimpleDVT
SIMPLE_DVT_IMPL = "0x8538930c385C0438A357d2c25CB3eAD95Ab6D8ed"
## see SimpleDVT's proxy appId()
SIMPLE_DVT_ARAGON_APP_ID = "0xe1635b63b5f7b5e545f2a637558a4029dea7905361a2f0fc28c66e9136cf86a4"
SIMPLE_DVT_MODULE_STUCK_PENALTY_DELAY = 432000
SIMPLE_DVT_MODULE_TARGET_SHARE_BP = 50
SIMPLE_DVT_MODULE_MODULE_FEE_BP = 800
SIMPLE_DVT_MODULE_TREASURY_FEE_BP = 200
SIMPLE_DVT_MODULE_ID = 2
SIMPLE_DVT_MODULE_NAME = "SimpleDVT"
SIMPLE_DVT_MODULE_TYPE = (
# bytes32("curated-onchain-v1")
"0x637572617465642d6f6e636861696e2d76310000000000000000000000000000"
)

# OracleDaemonConfig
ORACLE_DAEMON_CONFIG = "0xbf05A929c3D7885a6aeAd833a992dA6E5ac23b09"
NORMALIZED_CL_REWARD_PER_EPOCH = 64
Expand Down
Empty file added scripts/vote_simple_dvt.py
Empty file.
28 changes: 26 additions & 2 deletions tests/acceptance/test_staking_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
CURATED_STAKING_MODULE_MODULE_FEE_BP,
CURATED_STAKING_MODULE_TREASURY_FEE_BP,
WITHDRAWAL_CREDENTIALS,
SIMPLE_DVT_MODULE_ID,
SIMPLE_DVT_MODULE_MODULE_FEE_BP,
SIMPLE_DVT_MODULE_NAME,
SIMPLE_DVT_MODULE_TARGET_SHARE_BP,
SIMPLE_DVT_MODULE_TREASURY_FEE_BP,
)
from utils.evm_script import encode_error

Expand Down Expand Up @@ -71,15 +76,21 @@ def test_constants(contract):


def test_staking_modules(contract):
assert contract.getStakingModulesCount() == 1
assert contract.getStakingModulesCount() == 2

assert contract.getStakingModuleIds() == [CURATED_STAKING_MODULE_ID]
assert contract.getStakingModuleIds() == [CURATED_STAKING_MODULE_ID, SIMPLE_DVT_MODULE_ID]
assert contract.getStakingModuleIsActive(1) == True
assert contract.getStakingModuleIsStopped(1) == False
assert contract.getStakingModuleIsDepositsPaused(1) == False
assert contract.getStakingModuleNonce(1) >= 7260
assert contract.getStakingModuleStatus(1) == 0

assert contract.getStakingModuleIsActive(2) == True
assert contract.getStakingModuleIsStopped(2) == False
assert contract.getStakingModuleIsDepositsPaused(2) == False
assert contract.getStakingModuleNonce(2) >= 0
assert contract.getStakingModuleStatus(2) == 0

curated_module = contract.getStakingModule(1)
assert curated_module["id"] == CURATED_STAKING_MODULE_ID
assert curated_module["stakingModuleAddress"] == contracts.node_operators_registry
Expand All @@ -92,6 +103,19 @@ def test_staking_modules(contract):
assert curated_module["lastDepositBlock"] >= 8705383
assert curated_module["exitedValidatorsCount"] >= 145

simple_dvt_module = contract.getStakingModule(2)
assert simple_dvt_module["id"] == SIMPLE_DVT_MODULE_ID
assert simple_dvt_module["stakingModuleAddress"] == contracts.simple_dvt
assert simple_dvt_module["stakingModuleFee"] == SIMPLE_DVT_MODULE_MODULE_FEE_BP
assert simple_dvt_module["treasuryFee"] == SIMPLE_DVT_MODULE_TREASURY_FEE_BP
assert simple_dvt_module["targetShare"] == SIMPLE_DVT_MODULE_TARGET_SHARE_BP
assert simple_dvt_module["status"] == 0
assert simple_dvt_module["name"] == SIMPLE_DVT_MODULE_NAME
# TODO: fix values after adding new keys
# assert simple_dvt_module["lastDepositAt"] >= 0
# assert simple_dvt_module["lastDepositBlock"] >= 0
# assert simple_dvt_module["exitedValidatorsCount"] >= 0

fee_aggregate_distribution = contract.getStakingFeeAggregateDistribution()
assert fee_aggregate_distribution["modulesFee"] == SR_MODULES_FEE_E20
assert fee_aggregate_distribution["treasuryFee"] == SR_TREASURY_FEE_E20
Expand Down
16 changes: 14 additions & 2 deletions tests/regression/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
BURNER,
LIDO_LOCATOR,
LEGACY_ORACLE,
SIMPLE_DVT,
)


Expand All @@ -60,7 +61,7 @@ def protocol_permissions():
"roles": {
"DEFAULT_ADMIN_ROLE": [contracts.agent],
"REQUEST_BURN_MY_STETH_ROLE": [contracts.agent],
"REQUEST_BURN_SHARES_ROLE": [contracts.lido, contracts.node_operators_registry],
"REQUEST_BURN_SHARES_ROLE": [contracts.lido, contracts.node_operators_registry, contracts.simple_dvt],
},
},
STAKING_ROUTER: {
Expand Down Expand Up @@ -280,6 +281,17 @@ def protocol_permissions():
"STAKING_ROUTER_ROLE": [STAKING_ROUTER],
},
},
SIMPLE_DVT: {
"contract_name": "NodeOperatorsRegistry",
"contract": contracts.simple_dvt,
"type": "AragonApp",
"roles": {
"MANAGE_NODE_OPERATOR_ROLE": [EASYTRACK_EVMSCRIPT_EXECUTOR],
"MANAGE_SIGNING_KEYS": [EASYTRACK_EVMSCRIPT_EXECUTOR],
"SET_NODE_OPERATOR_LIMIT_ROLE": [EASYTRACK_EVMSCRIPT_EXECUTOR],
"STAKING_ROUTER_ROLE": [STAKING_ROUTER, EASYTRACK_EVMSCRIPT_EXECUTOR],
},
},
LEGACY_ORACLE: {
"contract_name": "LegacyOracle",
"contract": contracts.legacy_oracle,
Expand All @@ -299,7 +311,7 @@ def test_protocol_permissions(protocol_permissions):
method for method in permissions_config["contract"].signatures.keys() if method.endswith("_ROLE")
]

if contract_address == NODE_OPERATORS_REGISTRY:
if contract_address in [NODE_OPERATORS_REGISTRY, SIMPLE_DVT]:
abi_roles_list.append("MANAGE_SIGNING_KEYS")

roles = permissions_config["roles"]
Expand Down
6 changes: 5 additions & 1 deletion utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ def agent(self) -> interface.Agent:
def node_operators_registry(self) -> interface.NodeOperatorsRegistry:
return interface.NodeOperatorsRegistry(NODE_OPERATORS_REGISTRY)

@property
def simple_dvt(self) -> interface.NodeOperatorsRegistry:
return interface.NodeOperatorsRegistry(SIMPLE_DVT)

@property
def legacy_oracle(self) -> interface.LegacyOracle:
return interface.LegacyOracle(LEGACY_ORACLE)
Expand Down Expand Up @@ -227,7 +231,7 @@ def dai_token(self) -> interface.ERC20:
@property
def usdt_token(self) -> interface.ERC20:
return interface.ERC20(USDT_TOKEN)

@property
def usdc_token(self) -> interface.ERC20:
return interface.ERC20(USDC_TOKEN)
Expand Down

0 comments on commit b533491

Please sign in to comment.