Skip to content

chore: cardano-node: 10.3.1, cabal: 3.12.1.0, ghc: 9.6.7, mithril: v2517.1 #452

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

Merged
merged 1 commit into from
May 9, 2025
Merged
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
2 changes: 2 additions & 0 deletions .env.IntegrationTest
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ SNAPSHOT_DIGEST=latest
AGGREGATOR_ENDPOINT=
# if not set standard values will be used
GENESIS_VERIFICATION_KEY=
ANCILLARY_VERIFICATION_KEY=


## Api env
API_DOCKER_IMAGE_TAG=main
Expand Down
9 changes: 5 additions & 4 deletions .env.docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
API_SPRING_PROFILES_ACTIVE=online
LOG=INFO
NETWORK=mainnet
# mainnet, preprod, preview, sanchonet, devkit
# mainnet, preprod, preview, devkit
PROTOCOL_MAGIC=764824073
# mainnet 764824073, preprod 1, preview 2, sanchonet 4, devkit 42
# mainnet 764824073, preprod 1, preview 2, devkit 42

## Postgres image
PG_VERSION_TAG=REL_14_11
Expand All @@ -18,13 +18,12 @@ DB_HOST=db
DB_PORT=5432
DB_SCHEMA=${NETWORK}
DB_PATH=data

## Cardano Node variables
CARDANO_NODE_HOST=cardano-node
# Service name in docker-compose or local cardano node
CARDANO_NODE_PORT=3001
# Uncomment if you are using local cardano node
CARDANO_NODE_VERSION=10.2.1
CARDANO_NODE_VERSION=10.3.1
CARDANO_NODE_SUBMIT_HOST=$CARDANO_NODE_HOST
NODE_SUBMIT_API_PORT=8090
CARDANO_NODE_DIR=/node
Expand All @@ -34,11 +33,13 @@ CARDANO_CONFIG=./config/${NETWORK}

## Mithril
MITHRIL_SYNC=true
MITHRIL_VERSION=2517.1
SNAPSHOT_DIGEST=latest
# if not set standard values will be used
AGGREGATOR_ENDPOINT=
# if not set standard values will be used
GENESIS_VERIFICATION_KEY=
ANCILLARY_VERIFICATION_KEY=

## Api env
API_DOCKER_IMAGE_TAG=main
Expand Down
13 changes: 8 additions & 5 deletions .env.docker-compose-preprod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
API_SPRING_PROFILES_ACTIVE=online
LOG=INFO
NETWORK=preprod
# mainnet, preprod, preview, sanchonet, devkit
# mainnet, preprod, preview, devkit
PROTOCOL_MAGIC=1
# mainnet 764824073, preprod 1, preview 2, sanchonet 4, devkit 42
# mainnet 764824073, preprod 1, preview 2, devkit 42

## Postgres image
PG_VERSION_TAG=REL_14_11
Expand All @@ -22,22 +22,25 @@ DB_PATH=/opt/rosetta-java-preprod/sql_data
## Cardano Node variables
CARDANO_NODE_HOST=cardano-node
# Service name in docker-compose or local cardano node
CARDANO_NODE_PORT=3002
CARDANO_NODE_VERSION=10.2.1
CARDANO_NODE_PORT=3001
# Uncomment if you are using local cardano node
CARDANO_NODE_VERSION=10.3.1
CARDANO_NODE_SUBMIT_HOST=$CARDANO_NODE_HOST
NODE_SUBMIT_API_PORT=8091
NODE_SUBMIT_API_PORT=8090
CARDANO_NODE_DIR=/opt/rosetta-java-preprod/node_data
CARDANO_NODE_SOCKET_PATH=${CARDANO_NODE_DIR}/node.socket
CARDANO_NODE_DB=${CARDANO_NODE_DIR}/db
CARDANO_CONFIG=./config/${NETWORK}

## Mithril
MITHRIL_SYNC=true
MITHRIL_VERSION=2517.1
SNAPSHOT_DIGEST=latest
# if not set standard values will be used
AGGREGATOR_ENDPOINT=
# if not set standard values will be used
GENESIS_VERIFICATION_KEY=
ANCILLARY_VERIFICATION_KEY=

## Api env
API_DOCKER_IMAGE_TAG=main
Expand Down
6 changes: 3 additions & 3 deletions .env.h2
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Main variables
LOG=INFO
NETWORK=devkit
# mainnet, preprod, preview, sanchonet, devkit
# mainnet, preprod, preview, devkit
PROTOCOL_MAGIC=42
# mainnet 764824073, preprod 1, preview 2, sanchonet 4, devkit 42
# mainnet 764824073, preprod 1, preview 2, devkit 42

## H2 image
DB_IMAGE_NAME=h2
Expand All @@ -19,7 +19,7 @@ CARDANO_NODE_HOST=localhost
# Service name in docker-compose or local cardano node
CARDANO_NODE_PORT=3001
# Uncomment if you are using local cardano node
CARDANO_NODE_VERSION=10.2.1
CARDANO_NODE_VERSION=10.3.1
CARDANO_NODE_SUBMIT_HOST=localhost
NODE_SUBMIT_API_PORT=8090

Expand Down
6 changes: 3 additions & 3 deletions .env.h2-testdata
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Main variables
LOG=INFO
NETWORK=devkit
# mainnet, preprod, preview, sanchonet, devkit
# mainnet, preprod, preview, devkit
PROTOCOL_MAGIC=42
# mainnet 764824073, preprod 1, preview 2, sanchonet 4, devkit 42
# mainnet 764824073, preprod 1, preview 2, devkit 42

## H2 image
DB_IMAGE_NAME=h2
Expand All @@ -19,7 +19,7 @@ CARDANO_NODE_HOST=localhost
# Service name in docker-compose or local cardano node
CARDANO_NODE_PORT=3001
# Uncomment if you are using local cardano node
CARDANO_NODE_VERSION=10.2.1
CARDANO_NODE_VERSION=10.3.1
CARDANO_NODE_SUBMIT_HOST=localhost
NODE_SUBMIT_API_PORT=8090

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
[![License](https://img.shields.io:/github/license/cardano-foundation/cardano-rosetta-java?label=license)](https://github.com/cardano-foundation/cardano-rosetta-java/blob/master/LICENSE)
![Discord](https://img.shields.io/discord/1022471509173882950)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=cardano-foundation_cardano-rosetta-java&metric=coverage)](https://sonarcloud.io/summary/overall?id=cardano-foundation_cardano-rosetta-java)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B45571%2Fgithub.com%2Fcardano-foundation%2Fcardano-rosetta-java.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B45571%2Fgithub.com%2Fcardano-foundation%2Fcardano-rosetta-java?ref=badge_shield&issueType=license)

## What the project is about?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import org.cardanofoundation.rosetta.common.util.Constants;
import org.cardanofoundation.rosetta.common.util.RosettaConstants;

import static org.cardanofoundation.rosetta.common.util.Constants.*;

@Service
@Slf4j
@RequiredArgsConstructor
Expand Down Expand Up @@ -124,11 +126,11 @@ public Network getSupportedNetwork() {
int networkMagic = genesisDataProvider.getProtocolMagic();

return switch (networkMagic) {
case Constants.MAINNET_NETWORK_MAGIC -> Networks.mainnet();
case Constants.PREPROD_NETWORK_MAGIC -> Networks.preprod();
case Constants.PREVIEW_NETWORK_MAGIC -> Networks.preview();
case MAINNET_NETWORK_MAGIC -> Networks.mainnet();
case PREPROD_NETWORK_MAGIC -> Networks.preprod();
case PREVIEW_NETWORK_MAGIC -> Networks.preview();
case Constants.SANCHONET_NETWORK_MAGIC -> new Network(0b0000, Constants.SANCHONET_NETWORK_MAGIC);
case Constants.DEVKIT_NETWORK_MAGIC -> new Network(0b0000, Constants.DEVKIT_NETWORK_MAGIC);
case DEVKIT_NETWORK_MAGIC -> new Network(0b0000, DEVKIT_NETWORK_MAGIC);

default -> throw ExceptionFactory.invalidNetworkError();
};
Expand Down Expand Up @@ -186,30 +188,17 @@ private boolean verifyBlockchain(String blockchain) {
return blockchain.equals(Constants.CARDANO_BLOCKCHAIN);
}

private boolean verifyNetwork(String network) {
Network supportedNetwork = getSupportedNetwork();
private boolean verifyNetwork(String inputNetwork) {
Network currentNetwork = getSupportedNetwork();

switch ((int) supportedNetwork.getProtocolMagic()) {
case Constants.MAINNET_NETWORK_MAGIC -> {
return network.equalsIgnoreCase(Constants.MAINNET);
}
case Constants.PREPROD_NETWORK_MAGIC -> {
return network.equals(Constants.PREPROD);
}
case Constants.PREVIEW_NETWORK_MAGIC -> {
return network.equals(Constants.PREVIEW);
}
case Constants.DEVKIT_NETWORK_MAGIC -> {
return network.equals(Constants.DEVKIT);
}
case Constants.SANCHONET_NETWORK_MAGIC -> {
return network.equals(Constants.SANCHONET);
}
default -> {
return false;
}
}
}
return switch ((int) currentNetwork.getProtocolMagic()) {
case MAINNET_NETWORK_MAGIC -> inputNetwork.equalsIgnoreCase(MAINNET);
case PREPROD_NETWORK_MAGIC -> inputNetwork.equals(PREPROD);
case PREVIEW_NETWORK_MAGIC -> inputNetwork.equals(PREVIEW);
case DEVKIT_NETWORK_MAGIC -> inputNetwork.equals(DEVKIT);

default -> false;
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public enum NetworkEnum {
MAINNET(Constants.MAINNET, Networks.mainnet()),
PREPROD(Constants.PREPROD, Networks.preprod()),
DEVNET(Constants.DEVKIT, new Network(0b0000, 42)),
PREVIEW(Constants.PREVIEW, Networks.preview()),
SANCHONET(Constants.SANCHONET, new Network(0b0000, 4));
PREVIEW(Constants.PREVIEW, Networks.preview());

private final String name;
private final Network network;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ private Constants() {

public static final String LOVELACE = "lovelace";
public static final String DEVKIT = "devkit";
public static final String SANCHONET = "sanchonet";

public static final String ROSETTA_API_PATH = "classpath:/rosetta-specifications-1.4.15/api.yaml";
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public CardanoConverters cardanoConverters() {
return ClasspathConversionsFactory.createConverters(PREVIEW);
}

if (protocolMagic == Constants.SANCHONET_NETWORK_MAGIC) {
log.info("Creating CardanoConverters for sanchonet");
return ClasspathConversionsFactory.createConverters(SANCHONET);
}

if (protocolMagic == Constants.DEVKIT_NETWORK_MAGIC) {
log.info("Creating CardanoConverters for devkit, no converters available");
// Cardano Converters for DevKit is not supported but we still need to return something sensible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,6 @@ void parseTransactionSignedThrowTest() {
assertFalse(actualException.getError().isRetriable());
}

@SuppressWarnings("java:S5778")
@Test
void parseTransactionSignedThrowSanchonetTest() {
ApiException actualException = assertThrows(ApiException.class, () ->
cardanoService.parseTransaction(NetworkEnum.SANCHONET.getNetwork(), TRANSACTION_NOT_SIGNED, true));

assertEquals(RosettaErrorType.CANT_CREATE_SIGNED_TRANSACTION_ERROR.getMessage(),
actualException.getError().getMessage());
assertEquals(RosettaErrorType.CANT_CREATE_SIGNED_TRANSACTION_ERROR.getCode(),
actualException.getError().getCode());
assertFalse(actualException.getError().isRetriable());
}

@Test
void parseTransactionNotSignedTest() {
TransactionParsed actual = cardanoService.parseTransaction(NetworkEnum.PREVIEW.getNetwork(), TRANSACTION_NOT_SIGNED, false);
Expand Down
Loading