Skip to content

Commit 773d14c

Browse files
matiwinnetouMateusz CzeladkaclaudeVladislavKudrinlinconvidal
authored
chore: prepare 1.4.1 (#621)
* fix: enable peer discovery by default. * refactor: remove assetName (#619) Co-authored-by: Mateusz Czeladka <mateusz.czeladka@cardanofoundation.org> * fix: symbol search will be now in hex, not ascii, which will support CIP-26, CIP-68 and other type of such assets. (#620) Co-authored-by: Mateusz Czeladka <mateusz.czeladka@cardanofoundation.org> * chore: upgrade cardano-node from 10.4.1 to 10.5.1 (#626) Updates cardano-node version across Dockerfile, config files, and documentation to 10.5.1. Key changes in 10.5.1: - PeerSharing configuration behavior changes (default depends on BP vs relay) - Networking improvements (DNS caching reduced to 15min, Windows socket fixes) - Tracing system improvements for slotsMissed_int metric Changes: - Update CARDANO_NODE_VERSION build arg to 10.5.1 in both Dockerfiles - Update MinNodeVersion to 10.5.0 in mainnet/preprod/preview configs - Download official config.json, topology.json, checkpoints.json for all networks - Download peer-snapshot.json for mainnet, preprod, and preview - Keep hasPrometheus as 0.0.0.0 in all configs for metrics access - Update version references in documentation and test configs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Mateusz Czeladka <mateusz.czeladka@cardanofoundation.org> Co-authored-by: Claude <noreply@anthropic.com> * chore: upgrade mithril from 2524.0 to 2537.0 (#630) Updated Mithril version across all Docker and environment configuration files to use the latest release 2537.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Mateusz Czeladka <mateusz.czeladka@cardanofoundation.org> Co-authored-by: Claude <noreply@anthropic.com> * chore: update cardano-node version to 10.5.1 in remaining env files Updated CARDANO_NODE_VERSION from 10.4.1 to 10.5.1 in additional environment configuration files that were missed in the previous upgrade. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: separate versions for cnode/mithril/pg in dockerhub * chore: disable peer discovery by default Set PEER_DISCOVERY to false in the default docker-compose configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: version upgrade to 1.4.1 Updated project version from 1.4.0 to 1.4.1 in pom.xml and README.md Docker run examples. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: update peer discovery and token registry config - Remove outdated token registry comment from preprod config - Change peer discovery initial delay from 1 to 5 minutes - Refactor TimeUnit import to use static import for MINUTES 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: add Ouroboros Genesis support for Cardano Node 10.5.1+ (#637) Implement support for Cardano Node 10.5.1 which uses Ouroboros Genesis consensus protocol. This replaces bootstrap peers with big ledger peer snapshots for better decentralization. Changes: - Add PeerSnapshotService to load peers from Genesis peer snapshot files - Create model classes for BigLedgerPool, PeerSnapshotConfig, and Relay - Update TopologyConfigServiceImpl to use peer snapshots with bootstrap fallback - Add support for domain, IPv4, IPv6, and address relay formats - Update mainnet, preprod, and preview topology.json to use peer-snapshot.json - Add comprehensive unit tests (16 test cases) using mainnet peer snapshot - Keep devkit with bootstrap peers for backward compatibility The implementation maintains dynamic peer discovery priority: 1. Try dynamically discovered peers from yaci-indexer (when enabled) 2. Fallback to static peers from peer-snapshot.json (Genesis mode) 3. Fallback to bootstrap peers (legacy mode) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Mateusz Czeladka <mateusz.czeladka@cardanofoundation.org> Co-authored-by: Claude <noreply@anthropic.com> * test: fix currency hex encoding and refactor Issue #610 fixed: /search/transactions now requires hex-encoded currency symbols. Updated all tests to comply with this change and fixed several validation issues. Changes: - Add symbol_hex field to network_test_data.yaml for native assets - Convert test_native_asset_filtering_by_ascii_symbol to negative test (expects error 5059) - Unskip test_currency_filter_with_hex_encoded_symbol (issue #610 now fixed) - Update all currency search tests to use hex symbols instead of ASCII - Fix test assertions to validate ALL transactions contain filtered asset (not just "at least one") - Correct tokenBundle validation (native assets live there, not in operation amounts) - Update peer discovery test for Genesis mode (peer-snapshot.json) with time-based validation - Refactor token_registry tests: convert assertion helpers to pytest fixtures - Fix registry metadata extraction to handle v2 API structure ({value, source} objects) - Fix test_rosetta_metadata_matches_registry to compare Rosetta vs Registry (not vs config) - Add "domain" to valid peer types (Genesis peer-snapshot.json support) * ci: DRY test env configuration in PR workflow - Extracted env var configuration into configure_test_env() function. - Ensures rollback stage uses same config as PR test stage (fixes missing PEER_DISCOVERY and other vars in rollback). - Document testing patterns learned during hex symbol migration * feat: limit and randomize peer discovery to 25 peers (#640) Implements peer limiting and randomization to improve network peer distribution: - Limits peer responses to 25 peers (configurable via MAX_PEERS constant) - Randomizes peer selection on each load/discovery to avoid always returning the same peers - Updates PeerSnapshotServiceImpl to shuffle and limit peers from snapshot files - Updates PeerDiscoveryManager to shuffle and limit discovered peers from cardano-node - Maintains deterministic in-memory cache between refreshes - Updates tests to reflect new peer limiting and randomization behavior This prevents excessive peer lists and naturally distributes connections across the network without needing to track peer performance metrics. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Mateusz Czeladka <mateusz.czeladka@cardanofoundation.org> Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: Mateusz Czeladka <mateusz.czeladka@cardanofoundation.org> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: VladislavKudrin <vladislavkudrin@gmail.com> Co-authored-by: Lincon Vidal <lincon.vidal@cardanofoundation.org>
1 parent 7234c2f commit 773d14c

File tree

66 files changed

+10587
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+10587
-377
lines changed

.env.IntegrationTest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,4 @@ TOKEN_REGISTRY_LOGO_FETCH=false
162162
TOKEN_REGISTRY_REQUEST_TIMEOUT_SECONDS=2
163163

164164
## Mithril version for Docker build
165-
MITHRIL_VERSION=2524.0
165+
MITHRIL_VERSION=2537.0

.env.docker-compose

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CARDANO_NODE_HOST=cardano-node
2424
# Service name in docker-compose or local cardano node
2525
CARDANO_NODE_PORT=3001
2626
# Uncomment if you are using local cardano node
27-
CARDANO_NODE_VERSION=10.4.1
27+
CARDANO_NODE_VERSION=10.5.1
2828
CARDANO_NODE_SUBMIT_HOST=cardano-submit-api
2929
NODE_SUBMIT_API_PORT=8090
3030
CARDANO_NODE_DIR=/node
@@ -34,7 +34,7 @@ CARDANO_CONFIG=./config/node/${NETWORK}
3434

3535
## Mithril
3636
MITHRIL_SYNC=true
37-
MITHRIL_VERSION=2524.0
37+
MITHRIL_VERSION=2537.0
3838
SNAPSHOT_DIGEST=latest
3939
# if not set standard values will be used
4040
AGGREGATOR_ENDPOINT=

.env.docker-compose-preprod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CARDANO_NODE_HOST=cardano-node
2424
# Service name in docker-compose or local cardano node
2525
CARDANO_NODE_PORT=3001
2626
# Uncomment if you are using local cardano node
27-
CARDANO_NODE_VERSION=10.4.1
27+
CARDANO_NODE_VERSION=10.5.1
2828
CARDANO_NODE_SUBMIT_HOST=cardano-submit-api
2929
NODE_SUBMIT_API_PORT=8090
3030
CARDANO_NODE_DIR=/opt/rosetta-java-preprod/node_data
@@ -34,7 +34,7 @@ CARDANO_CONFIG=./config/node/${NETWORK}
3434

3535
## Mithril
3636
MITHRIL_SYNC=true
37-
MITHRIL_VERSION=2524.0
37+
MITHRIL_VERSION=2537.0
3838
SNAPSHOT_DIGEST=latest
3939
# if not set standard values will be used
4040
AGGREGATOR_ENDPOINT=
@@ -112,7 +112,6 @@ POSTGRESQL_EXPORTER_PORT=9187
112112
PEER_DISCOVERY=true
113113

114114
## Token Registry
115-
# Externally hosted token registry is currently only available for mainnet
116115
TOKEN_REGISTRY_ENABLED=false
117116
TOKEN_REGISTRY_BASE_URL=
118117
TOKEN_REGISTRY_CACHE_TTL_HOURS=1

.env.h2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CARDANO_NODE_HOST=localhost
1919
# Service name in docker-compose or local cardano node
2020
CARDANO_NODE_PORT=3001
2121
# Uncomment if you are using local cardano node
22-
CARDANO_NODE_VERSION=10.4.1
22+
CARDANO_NODE_VERSION=10.5.1
2323
CARDANO_NODE_SUBMIT_HOST=localhost
2424
NODE_SUBMIT_API_PORT=8090
2525

.env.h2-testdata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CARDANO_NODE_HOST=localhost
1919
# Service name in docker-compose or local cardano node
2020
CARDANO_NODE_PORT=3001
2121
# Uncomment if you are using local cardano node
22-
CARDANO_NODE_VERSION=10.4.1
22+
CARDANO_NODE_VERSION=10.5.1
2323
CARDANO_NODE_SUBMIT_HOST=localhost
2424
NODE_SUBMIT_API_PORT=8090
2525

.github/actions/build_docker_images/action.yml

Lines changed: 64 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,74 @@ inputs:
99
description: Is this a release build? If true, the latest tag will be applied
1010
required: false
1111
default: false
12+
node_version_key:
13+
required: false
14+
default: CARDANO_NODE_VERSION
15+
pg_version_key:
16+
required: false
17+
default: PG_VERSION_TAG
18+
mithril_version_key:
19+
required: false
20+
default: MITHRIL_VERSION
21+
1222
secrets:
1323
DOCKERHUB_USERNAME:
1424
description: Docker Hub username
1525
required: true
16-
DOCKERHUB_TOKEN:
17-
description: Docker Hub token
18-
required: true
26+
DOCKERHUB_TOKEN:
27+
description: Docker Hub token
28+
required: true
1929
runs:
2030
using: composite
2131
steps:
32+
- name: Read versions from .env
33+
id: envver
34+
shell: bash
35+
run: |
36+
NODE_KEY='${{ inputs.node_version_key }}'
37+
PG_KEY='${{ inputs.pg_version_key }}'
38+
MITHRIL_KEY='${{ inputs.mithril_version_key }}'
39+
40+
if [[ ! -f .env ]]; then
41+
echo ".env not found"
42+
exit 0
43+
fi
44+
45+
get_val() {
46+
local key="$1"
47+
grep -E "^${key}=" .env | head -1 | cut -d= -f2- | tr -d '\r'
48+
}
49+
50+
NODE_VAL="$(get_val "$NODE_KEY")"
51+
PG_VAL="$(get_val "$PG_KEY")"
52+
MITHRIL_VAL="$(get_val "$MITHRIL_KEY")"
53+
54+
if [[ -n "$NODE_VAL" ]]; then
55+
echo "node_version=$NODE_VAL" >> "$GITHUB_OUTPUT"
56+
else
57+
echo "No value for $NODE_KEY in .env"
58+
fi
59+
60+
if [[ -n "$PG_VAL" ]]; then
61+
echo "pg_version=$PG_VAL" >> "$GITHUB_OUTPUT"
62+
else
63+
echo "No value for $PG_KEY in .env"
64+
fi
65+
66+
if [[ -n "$MITHRIL_VAL" ]]; then
67+
echo "mithril_version=$MITHRIL_VAL" >> "$GITHUB_OUTPUT"
68+
else
69+
echo "No value for $MITHRIL_KEY in .env"
70+
fi
71+
2272
- name: API - Build and push Docker ${{ inputs.tag }} image
2373
uses: docker/build-push-action@v4
2474
with:
2575
context: .
2676
file: ./api/Dockerfile
2777
tags: cardanofoundation/cardano-rosetta-java-api:${{ inputs.tag }}
2878
push: true
79+
2980
- name: API - Build and push Docker latest image
3081
uses: docker/build-push-action@v4
3182
if: ${{ inputs.isRelease == 'true' }}
@@ -34,13 +85,15 @@ runs:
3485
file: ./api/Dockerfile
3586
tags: cardanofoundation/cardano-rosetta-java-api:latest
3687
push: true
88+
3789
- name: Indexer - Build and push Docker ${{ inputs.tag }} image
3890
uses: docker/build-push-action@v4
3991
with:
4092
context: .
4193
file: ./yaci-indexer/Dockerfile
4294
tags: cardanofoundation/cardano-rosetta-java-indexer:${{ inputs.tag }}
4395
push: true
96+
4497
- name: Indexer - Build and push Docker latest image
4598
uses: docker/build-push-action@v4
4699
if: ${{ inputs.isRelease == 'true' }}
@@ -49,58 +102,39 @@ runs:
49102
file: ./yaci-indexer/Dockerfile
50103
tags: cardanofoundation/cardano-rosetta-java-indexer:latest
51104
push: true
105+
52106
- name: Cardano Node - Build and push Docker ${{ inputs.tag }} image
53107
uses: docker/build-push-action@v4
54108
with:
55109
context: .
56110
file: ./docker/dockerfiles/node/Dockerfile
57-
tags: cardanofoundation/cardano-rosetta-java-cardano-node:${{ inputs.tag }}
58-
push: true
59-
- name: Cardano Node - Build and push Docker latest image
60-
uses: docker/build-push-action@v4
61-
if: ${{ inputs.isRelease == 'true' }}
62-
with:
63-
context: .
64-
file: ./docker/dockerfiles/node/Dockerfile
65-
tags: cardanofoundation/cardano-rosetta-java-cardano-node:latest
111+
tags: cardanofoundation/cardano-rosetta-java-cardano-node:${{ steps.envver.outputs.node_version }}
66112
push: true
113+
67114
- name: Postgres - Build and push Docker ${{ inputs.tag }} image
68115
uses: docker/build-push-action@v4
69116
with:
70117
context: .
71118
file: ./docker/dockerfiles/postgres/Dockerfile
72-
tags: cardanofoundation/cardano-rosetta-java-postgres:${{ inputs.tag }}
73-
push: true
74-
- name: Postgres - Build and push Docker latest image
75-
uses: docker/build-push-action@v4
76-
if: ${{ inputs.isRelease == 'true' }}
77-
with:
78-
context: .
79-
file: ./docker/dockerfiles/postgres/Dockerfile
80-
tags: cardanofoundation/cardano-rosetta-java-postgres:latest
119+
tags: cardanofoundation/cardano-rosetta-java-postgres:${{ steps.envver.outputs.pg_version }}
81120
push: true
121+
82122
- name: Mithril - Build and push Docker ${{ inputs.tag }} image
83123
uses: docker/build-push-action@v4
84124
with:
85125
context: .
86126
file: ./docker/dockerfiles/mithril/Dockerfile
87-
tags: cardanofoundation/cardano-rosetta-java-mithril:${{ inputs.tag }}
88-
push: true
89-
- name: Mithril - Build and push Docker latest image
90-
uses: docker/build-push-action@v4
91-
if: ${{ inputs.isRelease == 'true' }}
92-
with:
93-
context: .
94-
file: ./docker/dockerfiles/mithril/Dockerfile
95-
tags: cardanofoundation/cardano-rosetta-java-mithril:latest
127+
tags: cardanofoundation/cardano-rosetta-java-mithril:${{ steps.envver.outputs.mithril_version }}
96128
push: true
129+
97130
- name: All-in-one - Build and push Docker image
98131
uses: docker/build-push-action@v4
99132
with:
100133
context: .
101134
file: ./docker/Dockerfile
102135
tags: cardanofoundation/cardano-rosetta-java:${{ inputs.tag }}
103136
push: true
137+
104138
- name: All-in-one - Build and push Docker latest image
105139
uses: docker/build-push-action@v4
106140
if: ${{ inputs.isRelease == 'true' }}

.github/workflows/pr-preprod-tests.yaml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ jobs:
5858
fi
5959
}
6060
61-
ensure_var REMOVE_SPENT_UTXOS false
62-
ensure_var REMOVE_SPENT_UTXOS_LAST_BLOCKS_GRACE_COUNT 129600
63-
ensure_var DB_PORT 5433
64-
ensure_var TOKEN_REGISTRY_ENABLED true
65-
ensure_var TOKEN_REGISTRY_BASE_URL http://preview.integrations.cf-systems.internal:8080/api
66-
ensure_var TOKEN_REGISTRY_CACHE_TTL_HOURS 1
67-
ensure_var TOKEN_REGISTRY_LOGO_FETCH true
68-
ensure_var TOKEN_REGISTRY_REQUEST_TIMEOUT_SECONDS 2
69-
ensure_var PEER_DISCOVERY true
61+
configure_test_env() {
62+
ensure_var REMOVE_SPENT_UTXOS false
63+
ensure_var REMOVE_SPENT_UTXOS_LAST_BLOCKS_GRACE_COUNT 129600
64+
ensure_var DB_PORT 5433
65+
ensure_var TOKEN_REGISTRY_ENABLED true
66+
ensure_var TOKEN_REGISTRY_BASE_URL http://preview.integrations.cf-systems.internal:8080/api
67+
ensure_var TOKEN_REGISTRY_CACHE_TTL_HOURS 1
68+
ensure_var TOKEN_REGISTRY_LOGO_FETCH true
69+
ensure_var TOKEN_REGISTRY_REQUEST_TIMEOUT_SECONDS 2
70+
ensure_var PEER_DISCOVERY true
71+
}
72+
73+
configure_test_env
7074
7175
7276
- name: Build and start services with PR code
@@ -275,7 +279,29 @@ jobs:
275279
if: failure() && (steps.test.outcome == 'failure' || steps.test.outcome == 'cancelled')
276280
run: |
277281
cd /home/integration/git/cardano-rosetta-java
278-
sed -i "s#^DB_PORT=.*#DB_PORT=5433#" .env.docker-compose-preprod
282+
283+
ensure_var() {
284+
local key="$1"
285+
local value="$2"
286+
local file=".env.docker-compose-preprod"
287+
if grep -q "^${key}=" "$file"; then
288+
sed -i "s#^${key}=.*#${key}=${value}#" "$file"
289+
else
290+
echo "${key}=${value}" >> "$file"
291+
fi
292+
}
293+
294+
configure_test_env() {
295+
ensure_var REMOVE_SPENT_UTXOS false
296+
ensure_var REMOVE_SPENT_UTXOS_LAST_BLOCKS_GRACE_COUNT 129600
297+
ensure_var DB_PORT 5433
298+
ensure_var TOKEN_REGISTRY_ENABLED true
299+
ensure_var TOKEN_REGISTRY_BASE_URL http://preview.integrations.cf-systems.internal:8080/api
300+
ensure_var TOKEN_REGISTRY_CACHE_TTL_HOURS 1
301+
ensure_var TOKEN_REGISTRY_LOGO_FETCH true
302+
ensure_var TOKEN_REGISTRY_REQUEST_TIMEOUT_SECONDS 2
303+
ensure_var PEER_DISCOVERY true
304+
}
279305
280306
echo "⚠️ Test failed - stopping services"
281307
@@ -346,7 +372,9 @@ jobs:
346372
LAST_TAG=$(git tag --sort=-version:refname | head -1)
347373
echo "Rolling back to stable version: $LAST_TAG"
348374
git checkout -f $LAST_TAG
349-
sed -i "s#^DB_PORT=.*#DB_PORT=5433#" .env.docker-compose-preprod
375+
376+
# Re-apply test configuration for stable version
377+
configure_test_env
350378
351379
docker compose \
352380
--env-file .env.docker-compose-preprod \

api/src/main/java/org/cardanofoundation/rosetta/api/account/mapper/AccountMapperUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public List<Coin> mapUtxosToCoins(List<Utxo> utxos,
7676
Amt adaAsset = utxo.getAmounts().stream()
7777
.filter(amt -> Constants.LOVELACE.equals(amt.getUnit()))
7878
.findFirst()
79-
.orElseGet(() -> new Amt(null, null, Constants.ADA, BigInteger.ZERO));
79+
.orElseGet(() -> new Amt(null, Constants.ADA, BigInteger.ZERO));
80+
8081
String coinIdentifier = "%s:%d".formatted(utxo.getTxHash(), utxo.getOutputIndex());
8182

8283
return Coin.builder()

api/src/main/java/org/cardanofoundation/rosetta/api/account/model/domain/Amt.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ public class Amt implements Serializable {
2323
private String unit; // subject = policyId + hex(assetName)
2424
private String policyId;
2525

26-
// TODO avoid using assetName field for now
27-
// TODO ASCI in case of CIP-26 and bech32 in case of CIP-68, actually it should always be ASCII and never bech32
28-
@Deprecated
29-
// consider removing
30-
private String assetName;
31-
3226
private BigInteger quantity;
3327

28+
/**
29+
* Returns symbol as hex
30+
*
31+
* unit (subject) = policyId(hex) + symbol(hex)
32+
*/
33+
@Nullable
34+
public String getAssetNameAsHex() {
35+
return getSymbolHex();
36+
}
37+
3438
/**
3539
* Returns symbol as hex
3640
*
@@ -45,10 +49,4 @@ public String getSymbolHex() {
4549
return unit.replace(policyId, "");
4650
}
4751

48-
@Deprecated
49-
// TODO avoid using assetName field for now
50-
public String getAssetName() {
51-
return assetName;
52-
}
53-
5452
}

api/src/main/java/org/cardanofoundation/rosetta/api/block/model/repository/TxRepositoryCustomBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public final Condition buildCurrencyCondition(Currency currency) {
4646
!"lovelace".equalsIgnoreCase(symbol) && !"ada".equalsIgnoreCase(symbol)) {
4747
String escapedSymbol = symbol.trim().replace("\"", "\\\"");
4848
return buildPolicyIdAndSymbolCondition(escapedPolicyId, escapedSymbol);
49-
} else {
50-
return buildPolicyIdOnlyCondition(escapedPolicyId);
5149
}
50+
51+
return buildPolicyIdOnlyCondition(escapedPolicyId);
5252
}
5353

5454
if (symbol != null && !symbol.trim().isEmpty()) {

0 commit comments

Comments
 (0)