Skip to content

Commit 2b0b61a

Browse files
Mateusz Czeladkaclaude
andcommitted
fix: adjust pool retirement epoch to work with fresh devkit chains
Change the hardcoded retirement epoch from 19 to 2 to fix validation errors on fresh devkit/testnet environments where current epoch is 0. The Cardano protocol requires: current_epoch < retirement_epoch <= current_epoch + eMax (18) With epoch 0, retirement epoch 19 exceeds the maximum allowed offset, causing StakePoolRetirementWrongEpochPOOL validation errors. Using epoch 2 provides a conservative offset that works on fresh chains while still allowing successful pool retirement testing. Changes: - Update pool retirement epoch from 19 to 2 in PoolTransactions.java - Update devkit genesis configuration and test data Related error: StakePoolRetirementWrongEpochPOOL (Mismatch {mismatchSupplied = EpochNo 19, mismatchExpected = EpochNo 0}) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ddb4aa8 commit 2b0b61a

File tree

7 files changed

+39
-38
lines changed

7 files changed

+39
-38
lines changed

.env.h2

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ API_PORT=8082
3131
PRINT_EXCEPTION=true
3232

3333
ROSETTA_VERSION=1.4.13
34-
TOPOLOGY_FILEPATH=./config/${NETWORK}/topology.json
35-
GENESIS_SHELLEY_PATH=./config/${NETWORK}/shelley-genesis.json
36-
GENESIS_BYRON_PATH=./config/${NETWORK}/byron-genesis.json
37-
GENESIS_ALONZO_PATH=./config/${NETWORK}/alonzo-genesis.json
38-
GENESIS_CONWAY_PATH=./config/${NETWORK}/conway-genesis.json
34+
TOPOLOGY_FILEPATH=./config/node/${NETWORK}/topology.json
35+
GENESIS_SHELLEY_PATH=./config/node/${NETWORK}/shelley-genesis.json
36+
GENESIS_BYRON_PATH=./config/node/${NETWORK}/byron-genesis.json
37+
GENESIS_ALONZO_PATH=./config/node/${NETWORK}/alonzo-genesis.json
38+
GENESIS_CONWAY_PATH=./config/node/${NETWORK}/conway-genesis.json
3939
SEARCH_LIMIT=100
4040

4141
## Yaci Indexer env

.env.h2-testdata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ API_PORT=8082
3131
PRINT_EXCEPTION=true
3232

3333
ROSETTA_VERSION=1.4.13
34-
TOPOLOGY_FILEPATH=./config/${NETWORK}/topology.json
35-
GENESIS_SHELLEY_PATH=./config/${NETWORK}/shelley-genesis.json
36-
GENESIS_BYRON_PATH=./config/${NETWORK}/byron-genesis.json
37-
GENESIS_ALONZO_PATH=./config/${NETWORK}/alonzo-genesis.json
38-
GENESIS_CONWAY_PATH=./config/${NETWORK}/conway-genesis.json
34+
TOPOLOGY_FILEPATH=./config/node/${NETWORK}/topology.json
35+
GENESIS_SHELLEY_PATH=./config/node/${NETWORK}/shelley-genesis.json
36+
GENESIS_BYRON_PATH=./config/node/${NETWORK}/byron-genesis.json
37+
GENESIS_ALONZO_PATH=./config/node/${NETWORK}/alonzo-genesis.json
38+
GENESIS_CONWAY_PATH=./config/node/${NETWORK}/conway-genesis.json
3939
SEARCH_LIMIT=100
4040

4141
## Yaci Indexer env

api/src/test/java/org/cardanofoundation/rosetta/api/construction/service/MetadataApiTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void combineWithMetadataTest() throws IOException {
4343
assertEquals(ADA, constructionMetadataResponse.getSuggestedFee().getFirst().getCurrency().getSymbol());
4444
assertEquals(ADA_DECIMALS, constructionMetadataResponse.getSuggestedFee().getFirst().getCurrency().getDecimals());
4545

46-
assertEquals(BigDecimal.valueOf(695), constructionMetadataResponse.getMetadata().getTtl());
46+
assertEquals(BigDecimal.valueOf(115), constructionMetadataResponse.getMetadata().getTtl());
4747
assertEquals("4310", constructionMetadataResponse.getMetadata().getProtocolParameters().getCoinsPerUtxoSize());
4848
assertEquals("2000000", constructionMetadataResponse.getMetadata().getProtocolParameters().getKeyDeposit());
4949
assertEquals("500000000", constructionMetadataResponse.getMetadata().getProtocolParameters().getPoolDeposit());

config/node/devkit/shelley-genesis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"relays" : [ ],
6565
"rewardAccount" : {
6666
"credential" : {
67-
"key hash" : "11a14edf73b08a0a27cb98b2c57eb37c780df18fcfcf6785ed5df84a"
67+
"keyHash" : "11a14edf73b08a0a27cb98b2c57eb37c780df18fcfcf6785ed5df84a"
6868
},
6969
"network" : "Testnet"
7070
},

test-data-generator/src/main/java/org/cardanofoundation/rosetta/testgenerator/transactions/impl/PoolTransactions.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ public TransactionBlockDetails retirePool() {
181181
log.info("Sender2 address: {}", sender2Addr);
182182

183183
Tx retirePool = new Tx()
184-
.retirePool(poolId, 19)
184+
//.retirePool(poolId, 19)
185+
.retirePool(poolId, 2)
185186
.from(sender2Addr);
186187

187188
Result<String> result = quickTxBuilder.compose(retirePool)

testData/devkit.db.mv.db

296 KB
Binary file not shown.

testData/testdata.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
{
22
"stake_key_deregistration" : {
33
"txHash" : "c4f15eadca085f6253b471465bca384abac385978120cbf5280514edb5e04772",
4-
"blockHash" : "8ef9b39aefeab4355cf2695355b1a4dd6ac5c655e63d1143b289e79cc4f0e4b1",
5-
"blockNumber" : 65
4+
"blockHash" : "fb480af5b764ede8fcf6ccf6e69ae741ac6d507726c3fc66335a5fbfd2d110c7",
5+
"blockNumber" : 79
66
},
77
"pool_retirement" : {
8-
"txHash" : "a0e0183c756228b1066a460f1d85448cbfc5c01748d15f9cb05debe68acac72b",
9-
"blockHash" : "f2bf317a056d3fbbb02f22553adde53ef0d016cf3380b596855b7c4959db00a6",
10-
"blockNumber" : 81
8+
"txHash" : "80d2aeddbef7f29258fa8643dfee2c55b17cee51250e3182e1c2b7eb6e1a16ff",
9+
"blockHash" : "98ba2717fb9d2b60db0291f120bc07d40bcfb71261a40e0c2f73044c836c6938",
10+
"blockNumber" : 95
1111
},
1212
"simple_new_empty_name_coins_transaction" : {
13-
"txHash" : "0d5902595c9c51fc05a22adbc86c790a5ea57f081cac47e224c1bd3a73d46640",
14-
"blockHash" : "9845d8e756260416edf1e508d47469de266f5fc7be6597d5bcf876cd2ef2da22",
15-
"blockNumber" : 59
13+
"txHash" : "243f340f61f72378d115ed1d8ea1648e7bb578a06cf9ba0f202b992d9d6d8352",
14+
"blockHash" : "23d74beedd7b287fec6e8b218f3958efbf897e673163d66bdd44c09c6e41dec9",
15+
"blockNumber" : 73
1616
},
1717
"simple_second_lovelace_transaction" : {
1818
"txHash" : "d3a478ff5e2c11164fc7a1048152d01eea6ae709dc572e4bce598353a84dfe1d",
19-
"blockHash" : "b20e511bc66d08b1df74e5a33827875cb407d2e5f4c4f6593a2dd090eb1489af",
20-
"blockNumber" : 53
19+
"blockHash" : "9e30e7e335ce257b5736f9ae824bd026f13f60d059c99c5e2c160d989b22beb7",
20+
"blockNumber" : 66
2121
},
2222
"pool_delegation" : {
2323
"txHash" : "85f60602259f85f0f2ff6f7acc9e4ef0b30b6512165fac3121ed02c7d5f389ea",
24-
"blockHash" : "eff75cc22ea34f9a977e5d2d7689d507d7c8dd15ab8e77057f5104c1ad5320f6",
25-
"blockNumber" : 78
24+
"blockHash" : "1752a01d971c7f564162b70d0730e34b44506a1d2efca910b44da8c8a18f8951",
25+
"blockNumber" : 91
2626
},
2727
"simple_first_lovelace_transaction" : {
2828
"txHash" : "cb39cb98a915cf5470aad14c568594840e55acbe26f8439a12901049180643a5",
29-
"blockHash" : "b771da44cc0c3461504fc384d7f8909b0f635ef521c7fcae7a5837b84c18fc6d",
30-
"blockNumber" : 50
29+
"blockHash" : "cf619455aa69ee227873ec10c98b6c7ec00accba5ef067064a9063c4c3f33791",
30+
"blockNumber" : 63
3131
},
3232
"simple_transaction_2" : {
3333
"txHash" : "5e6bd32366df3d831680b91b6b39b59b9a3b6207ec48111d4d01c878a8bf41b1",
34-
"blockHash" : "14416c8fdb9890cb50e4375829b7b2e26340933593c3d4ba5194578fa8b3e648",
35-
"blockNumber" : 69
34+
"blockHash" : "36601ccdd896e43e7dd4c26f815e7f5c2a7844524bbbd0cfb80c2e58b372c637",
35+
"blockNumber" : 82
3636
},
3737
"pool_registration" : {
3838
"txHash" : "6c75f5d8d696b7d8b1ae7254b540dd11b3485fb74d722b8c2fc284dff3df9b77",
39-
"blockHash" : "d584713f1854026ba12bbbc2a2bad4fca5e28fc8b5227ff4f3440b5fe7da86cb",
40-
"blockNumber" : 72
39+
"blockHash" : "f74f275b87ba9f897fd7dc8153f874686bed4d80ca8f55505885369df558727a",
40+
"blockNumber" : 85
4141
},
4242
"simple_new_coins_transaction" : {
43-
"txHash" : "cbeeefcdef2de4208c1dbf91b146d752860f7627ba722e1264a1b604fd441c89",
44-
"blockHash" : "a0826c9897d6f71105aa191be639aaaa39fef5aa8810ec3c49d947f8f8a252d9",
45-
"blockNumber" : 56
43+
"txHash" : "cb2a2e32c23da6bdc23a08f2304037f5b8ee6d9c55a0db721a8b72d1db5f0b1c",
44+
"blockHash" : "79a5f14d03677c7c4ec0cfdd243bdef877ac2b7cd1e4b04d550249a1fb82a9a3",
45+
"blockNumber" : 69
4646
},
4747
"stake_key_registration" : {
4848
"txHash" : "81a05a1fb532c19e5c14826db918e654bdc486faeb3722bc0f71fbbf1ed1cc3e",
49-
"blockHash" : "16f5de22952ad54030814d2761502b395adeb1db2d45d4a30ee3069154dd606d",
50-
"blockNumber" : 62
49+
"blockHash" : "3cfa680bf4c3754d03cd579f1aee2d8c0315f514118b1d6235da4be7108ccea7",
50+
"blockNumber" : 76
5151
},
5252
"simple_transaction" : {
5353
"txHash" : "8eb6c049474008db804d48b32f884b77274b5d97c502ffb52d8204c8b3334747",
54-
"blockHash" : "2323754fb69b48c19d69252de906c65f3b1d4fb967635beab4b66880b1e578be",
55-
"blockNumber" : 47
54+
"blockHash" : "c475f92f6356fbf5c759f6325801324935755b82fba909f97d13eec0e95ffe64",
55+
"blockNumber" : 60
5656
}
5757
}

0 commit comments

Comments
 (0)