Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add anvil RPC node support #187

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,25 @@ def test_unsupported_extra_data_type(self):
):
self.report(extra_data, items_count=1)

def test_invalid_extra_data_sort_order(self):
def test_invalid_extra_data_sort_order(self, node_operators_registry):
node_operator_id = 1
summary = node_operators_registry.getNodeOperatorSummary(node_operator_id)
extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(
0,
ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS,
1,
[node_operator_id],
[summary["totalExitedValidators"]],
),
build_extra_data_item(
1,
ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS,
1,
[node_operator_id],
[summary["totalExitedValidators"]],
),
)
)

Expand Down
46 changes: 38 additions & 8 deletions tests/acceptance/test_accounting_oracle_negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,24 @@ def test_unsupported_extra_data_type(self):
self.report(extra_data, items_count=1)

def test_invalid_extra_data_sort_order(self):
node_operator_id = 1
summary = contracts.node_operators_registry.getNodeOperatorSummary(node_operator_id)
extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(
0,
ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS,
1,
[node_operator_id],
[summary["stuckValidatorsCount"]],
),
build_extra_data_item(
1,
ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS,
1,
[node_operator_id],
[summary["stuckValidatorsCount"]],
),
)
)

Expand All @@ -280,8 +294,20 @@ def test_invalid_extra_data_sort_order(self):

extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_EXITED_VALIDATORS, 1, [1], [1]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_EXITED_VALIDATORS, 1, [1], [1]),
build_extra_data_item(
0,
ItemType.EXTRA_DATA_TYPE_EXITED_VALIDATORS,
1,
[node_operator_id],
[summary["totalExitedValidators"]],
),
build_extra_data_item(
1,
ItemType.EXTRA_DATA_TYPE_EXITED_VALIDATORS,
1,
[node_operator_id],
[summary["totalExitedValidators"]],
),
)
)

Expand All @@ -294,9 +320,11 @@ def test_invalid_extra_data_sort_order(self):
self.report(extra_data)

def test_unexpected_extra_data_item(self, extra_data_service: ExtraDataService) -> None:
node_operator_id = 1
summary = contracts.node_operators_registry.getNodeOperatorSummary(node_operator_id)
extra_data = extra_data_service.collect(
{(1, 1): 1},
{(1, 1): 1},
{(1, node_operator_id): summary["stuckValidatorsCount"]},
{(1, node_operator_id): summary["totalExitedValidators"]},
MAX_ACCOUNTING_EXTRA_DATA_LIST_ITEMS_COUNT,
1,
)
Expand All @@ -321,9 +349,11 @@ def test_already_processed(
consensus_member: Account,
extra_data_service: ExtraDataService,
):
node_operator_id = 1
summary = contracts.node_operators_registry.getNodeOperatorSummary(node_operator_id)
extra_data = extra_data_service.collect(
{(1, 1): 1},
{(1, 1): 1},
{(1, node_operator_id): summary["stuckValidatorsCount"]},
{(1, node_operator_id): summary["totalExitedValidators"]},
MAX_ACCOUNTING_EXTRA_DATA_LIST_ITEMS_COUNT,
1,
)
Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def deployer():
def steth_holder(accounts):
steth_holder = accounts.at("0x176F3DAb24a159341c0509bB36B833E7fdd0a131", force=True)
web3.provider.make_request("evm_setAccountBalance", [steth_holder.address, "0x152D02C7E14AF6800000"])
web3.provider.make_request("anvil_setBalance", [steth_holder.address, "0x152D02C7E14AF6800000"])
steth_holder.transfer(contracts.lido, ETH(10000))
return steth_holder

Expand All @@ -49,6 +50,7 @@ def ldo_holder(accounts):
def stranger(accounts):
stranger = accounts.at("0x98eC059dC3aDFbdd63429454aeB0C990fbA4a124", force=True)
web3.provider.make_request("evm_setAccountBalance", [stranger.address, "0x152D02C7E14AF6800000"])
web3.provider.make_request("anvil_setBalance", [stranger.address, "0x152D02C7E14AF6800000"])
assert stranger.balance() == ETH(100000)
return stranger

Expand Down Expand Up @@ -149,6 +151,8 @@ def _prefetch_contracts_from_etherscan():
Contract.from_explorer(VALIDATORS_EXIT_BUS_ORACLE)
Contract.from_explorer(WITHDRAWAL_QUEUE)
Contract.from_explorer(STAKING_ROUTER)
Contract.from_explorer(LIDO)
Contract.from_explorer(NODE_OPERATORS_REGISTRY)

Helpers._etherscan_is_fetched = True

Expand Down
Loading