Skip to content

Commit 406ee9c

Browse files
authored
feat: add pool operations to e2e tests (#532)
- Introduced new tests for pool registration, certificate updates, governance voting, and retirement in `test_pool_operations.py`. - Added environment variables for pool governance proposal ID and pool registration certificate in `conftest.py`. - Updated `README.md` to include new pool operation scenarios and usage instructions. - Implemented pool cold key signing functionality in `signing_handler.py`. - Created new methods in `OperationBuilder` for building pool-related operations. - Added a new environment configuration file `example.env` for easier setup of testing parameters.
2 parents 15738e5 + 08fc228 commit 406ee9c

File tree

9 files changed

+1141
-120
lines changed

9 files changed

+1141
-120
lines changed

e2e_tests/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ TEST_WALLET_MNEMONIC="your mnemonic here"
6666
STAKE_POOL_HASH=d9812f8d30b5db4b03e5b76cfd242db9cd2763da4671ed062be808a0 # Required for stake delegation tests
6767
DREP_KEY_HASH_ID=03ccae794affbe27a5f5f74da6266002db11daa6ae446aea783b972d # Required for DRep vote delegation tests with key_hash type
6868
DREP_SCRIPT_HASH_ID=2d4cb680b5f400d3521d272b4295d61150e0eff3950ef4285406a953 # Required for DRep vote delegation tests with script_hash type
69+
POOL_REGISTRATION_CERT=<hex-encoded-cert> # Required for poolRegistrationWithCert test
70+
POOL_GOVERNANCE_PROPOSAL_ID=df58f714c0765f3489afb6909384a16c31d600695be7e86ff9c59cf2e8a48c7900 # Required for pool governance vote tests
71+
POOL_VOTE_CHOICE=yes # Optional: Vote choice for pool governance vote (yes/no/abstain, default: yes)
6972
```
7073

7174
## Usage
@@ -126,6 +129,17 @@ pytest --log-cli-level=INFO tests/test_stake_operations.py::test_drep_vote_deleg
126129
pytest --log-cli-level=INFO tests/test_stake_operations.py::test_drep_vote_delegation_key_hash
127130
pytest --log-cli-level=INFO tests/test_stake_operations.py::test_drep_vote_delegation_script_hash
128131
pytest --log-cli-level=INFO tests/test_stake_operations.py::test_scenario_B_final_deregistration
132+
133+
# Pool operation tests
134+
135+
# Run all pool operation tests
136+
pytest --log-cli-level=INFO tests/test_pool_operations.py
137+
138+
# Run specific pool operation tests
139+
pytest --log-cli-level=INFO tests/test_pool_operations.py::test_pool_registration
140+
pytest --log-cli-level=INFO tests/test_pool_operations.py::test_pool_registration_with_cert
141+
pytest --log-cli-level=INFO tests/test_pool_operations.py::test_pool_governance_vote
142+
pytest --log-cli-level=INFO tests/test_pool_operations.py::test_pool_retirement
129143
```
130144

131145
## Test Scenarios
@@ -151,6 +165,13 @@ pytest --log-cli-level=INFO tests/test_stake_operations.py::test_scenario_B_fina
151165
3. **DRep Vote Delegation - Key Hash**: Delegate voting power to a DRep with key hash
152166
4. **DRep Vote Delegation - Script Hash**: Delegate voting power to a DRep with script hash
153167

168+
### Pool Operations
169+
170+
1. **Pool Registration**: Register a new stake pool with generated parameters
171+
2. **Pool Registration With Certificate**: Register a pool using a pre-created certificate
172+
3. **Pool Governance Vote**: Submit governance votes as a Stake Pool Operator (SPO)
173+
4. **Pool Retirement**: Retire the registered stake pool and reclaim deposit
174+
154175
## API Coverage
155176

156177
The following Rosetta API endpoints are covered in our e2e tests:

e2e_tests/example.env

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Rosetta API endpoint (default: local testnet)
2+
ROSETTA_ENDPOINT=http://localhost:8082/
3+
4+
# Network to use (mainnet, preprod, preview, testnet)
5+
CARDANO_NETWORK=preprod
6+
7+
# Test wallet mnemonic - NEVER use a real wallet with funds
8+
# Replace with your test wallet mnemonic
9+
TEST_WALLET_MNEMONIC="test test test test test test test test test test test test"
10+
STAKE_POOL_ID=d9812f8d30b5db4b03e5b76cfd242db9cd2763da4671ed062be808a0 # Required for stake delegation tests
11+
12+
# note: 22 and 23 are the prefix for the DRep key hash and script hash,
13+
# and need to be removed for the actual hex got from explorers
14+
# eg: #22 03ccae794affbe27a5f5f74da6266002db11daa6ae446aea783b972d - 22 for drep key hash
15+
# eg: #23 2d4cb680b5f400d3521d272b4295d61150e0eff3950ef4285406a953 - 23 for drep script hash
16+
DREP_KEY_HASH_ID=03ccae794affbe27a5f5f74da6266002db11daa6ae446aea783b972d # Required for DRep vote delegation tests with key_hash type
17+
DREP_SCRIPT_HASH_ID=2d4cb680b5f400d3521d272b4295d61150e0eff3950ef4285406a953 # Required for DRep vote delegation tests with script_hash type
18+
19+
# Data for pool scenarios
20+
POOL_REGISTRATION_CERT="8a03581c2dcfdb151c8f8688359b252034a987adb7ea952eefd1562e0fa3d6bd5820544a0e0979dbdcbbcfe8c2c93cf7c2007de142f25b4e7dc3afb1560410bee7b01a004c4b401a002dc6c0d81e820101581de06bc0fb7bf3fb63213db81655a33d8c4a7c1c7e4bd75fc33ff176784bd9010281581c6bc0fb7bf3fb63213db81655a33d8c4a7c1c7e4bd75fc33ff176784b8184001820445820f5d9505820f5d9ea167fd2e0b19647f18dd1e0826f706f6f6c4d6574616461746155726c58209ac2217288d1ae0b4e15c41b58d3e05a13206fd9ab81cb15943e4174bf30c90b"
21+
POOL_GOVERNANCE_PROPOSAL_ID="c16d3ce65e05d1b439c32c336789565f10d59dbdf20742ac26b3c9cdc791469f00"
22+
POOL_VOTE_CHOICE=yes

e2e_tests/rosetta_client/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ def account_coins(self, address: str) -> Dict:
154154
url = f"{self.endpoint}/account/coins"
155155
payload = {
156156
"network_identifier": self.network_identifier,
157-
"account_identifier": {"address": address},
158-
"include_mempool": False
157+
"account_identifier": {"address": address}
159158
}
160159

161160
try:

0 commit comments

Comments
 (0)