test: Add ENS support to functional tests and implement ENS registration test#7358
test: Add ENS support to functional tests and implement ENS registration test#7358
Conversation
|
236e25c to
5bbd72b
Compare
Jenkins BuildsClick to see older builds (79)
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #7358 +/- ##
===========================================
+ Coverage 60.98% 61.15% +0.17%
===========================================
Files 822 822
Lines 115168 115084 -84
===========================================
+ Hits 70239 70384 +145
+ Misses 37759 37493 -266
- Partials 7170 7207 +37
Flags with carried forward coverage won't be shown. Click here to find out more.
|
| // No NameWrapper on this chain — name can't be wrapped, return registry owner | ||
| return &owner, nil |
There was a problem hiding this comment.
I'm not sure of the consequences of this change.
@saledjenic is this safe?
There was a problem hiding this comment.
I'd rename it to sync_ens_registry.sh for clarity
There was a problem hiding this comment.
renamed to sync_ens_registry.sh and updated all references
tests-functional/tests/test_ens.py
Outdated
| @pytest.fixture(autouse=True) | ||
| def setup(self, backend_new_profile, foundry_client, ens_addresses, multicall3_deployer): | ||
| self.foundry = foundry_client | ||
| self.ens_addresses = ens_addresses | ||
| self.rpc_client = backend_new_profile( | ||
| name="ens_user", | ||
| multicall_contract_address=multicall3_deployer.contract_address, | ||
| ) | ||
|
|
||
| def test_ens_register_and_verify(self): | ||
| public_key = self.rpc_client.public_key |
There was a problem hiding this comment.
I thoght we've stopped using autouse fixtures and self.backend. But it's up to you
| @pytest.fixture(autouse=True) | |
| def setup(self, backend_new_profile, foundry_client, ens_addresses, multicall3_deployer): | |
| self.foundry = foundry_client | |
| self.ens_addresses = ens_addresses | |
| self.rpc_client = backend_new_profile( | |
| name="ens_user", | |
| multicall_contract_address=multicall3_deployer.contract_address, | |
| ) | |
| def test_ens_register_and_verify(self): | |
| public_key = self.rpc_client.public_key | |
| def backend(self, backend_new_profile, foundry_client, ens_addresses, multicall3_deployer): | |
| self.foundry = foundry_client | |
| self.ens_addresses = ens_addresses | |
| return backend_new_profile( | |
| name="ens_user", | |
| multicall_contract_address=multicall3_deployer.contract_address, | |
| ) | |
| def test_ens_register_and_verify(self, backend): | |
| public_key = backend.public_key |
There was a problem hiding this comment.
I thought we've stopped using autouse fixtures and self.backend. But it's up to you
There was a problem hiding this comment.
you're right. Fixed
tests-functional/tests/test_ens.py
Outdated
| logger = logging.getLogger(__name__) | ||
|
|
||
| ANVIL_RPC_URL = "http://anvil:8545" | ||
| ENS_USERNAME = "testuser" |
There was a problem hiding this comment.
Let's generate a random name each time
There was a problem hiding this comment.
removed hardcoded ENS_USERNAME/ENS_FULL_NAME constants, added random_ens_username() that generates test{uuid[:8]} per test run
| registrar_addr == self.ens_addresses["registrar"] | ||
| ), f"Registrar mismatch: RPC={registrar_addr}, deployed={self.ens_addresses['registrar']}" | ||
|
|
||
| register_ens_name( |
There was a problem hiding this comment.
Hmm, so it's not exactly test_ens_register_and_verify, because registration is happening outside status-go API. So it's rather test_ens_verify.
We should distinguish 2 tests:
- Register an ENS name fully with status-go API (as it is possible to do from status-app).
- Register an ENS name externally, then
add(link) it to Status profile with status-go API.
Both tests are valid and useful, just make sure to implement (1) too.
There was a problem hiding this comment.
Done. Implemented both:
- test_ens_register_via_router (new class TestEnsRouterRegistration) — registers ENS name through the wallet router flow (getSuggestedRoutes → buildTransactionsFromRoute → sign → sendRouterTransactionsWithSignatures), matching the production path used by status-app.
- test_ens_add_external_registration (renamed from test_ens_register_and_verify) — registers externally via cast, then links to Status profile via ens_service.add.
For (1), added Go changes to support Anvil (chainID 31337) in the wallet router ENS processors — this is Phase 2 from ENS_FUNCTIONAL_TESTS_PLAN.md. Token address is resolved dynamically via registrar.Token() with fallback to snt.ContractAddress().
|
👏 👏 👏 |
Closes #7356
Closes #7357