Skip to content

Commit

Permalink
Merge branch 'chore/LW-7691-conway-era-variant-for-master-merge' into…
Browse files Browse the repository at this point in the history
… chore/LW-7691-master-merge
  • Loading branch information
mirceahasegan committed May 7, 2024
2 parents 8036243 + 7aa3dd9 commit 9ca045b
Show file tree
Hide file tree
Showing 181 changed files with 20,940 additions and 22,443 deletions.
8 changes: 4 additions & 4 deletions compose/aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

services:
cardano-db-sync:
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.1.0.0}
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.2.0.2}
cardano-node:
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-node:${CARDANO_NODE_VERSION:-1.35.5}
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-node:${CARDANO_NODE_VERSION:-8.9.2}
ogmios:
image: ghcr.io/input-output-hk/ogmios-tracker/ogmios:v${OGMIOS_VERSION:-5.6.0}
image: ghcr.io/input-output-hk/ogmios-tracker/ogmios:v${OGMIOS_VERSION:-6.2.0}
cardano-submit-api:
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-submit-api:${CARDANO_NODE_VERSION:-1.35.5}
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-submit-api:${CARDANO_NODE_VERSION:-8.9.2}
19 changes: 11 additions & 8 deletions compose/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ services:
RESTORE_SNAPSHOT: ${RESTORE_SNAPSHOT:-}
RESTORE_RECREATE_DB: N
depends_on:
ogmios:
condition: service_healthy
cardano-node:
condition: service_started
healthcheck:
test: ['CMD', '/scripts/is-db-synced.sh']
interval: 5s
timeout: 1s
retries: 120
start_period: 100ms
image: ghcr.io/intersectmbo/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.1.0.2}
image: ghcr.io/intersectmbo/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.2.0.2}
restart: on-failure
stop_signal: SIGINT
volumes:
Expand All @@ -128,7 +128,7 @@ services:
<<:
- *logging
- *with-postgres
image: ghcr.io/intersectmbo/cardano-smash-server:${CARDANO_DB_SYNC_VERSION:-13.1.0.2}
image: ghcr.io/intersectmbo/cardano-smash-server:${CARDANO_DB_SYNC_VERSION:-13.2.0.1}
command: ['--config', '/config/cardano-db-sync/config.json']
environment:
POSTGRES_HOST: postgres
Expand All @@ -149,7 +149,7 @@ services:

cardano-node:
<<: *logging
image: public.ecr.aws/e8d0p1a5/cardano-node:${CARDANO_NODE_VERSION:-1.35.5}
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-8.9.2}
command:
[
'run',
Expand All @@ -169,9 +169,12 @@ services:

ogmios:
<<: *logging
image: cardanosolutions/ogmios:v${OGMIOS_VERSION:-5.6.0}
image: cardanosolutions/ogmios:v${OGMIOS_VERSION:-6.2.0}
command:
['--host', '0.0.0.0', '--node-socket', '/ipc/node.socket', '--node-config', '/config/cardano-node/config.json']
depends_on:
cardano-node:
condition: service_started
healthcheck:
retries: 2000
ports:
Expand All @@ -182,7 +185,7 @@ services:

cardano-submit-api:
command: --config /config/cardano-submit-api/config.json --listen-address 0.0.0.0 --socket-path /ipc/node.socket $SUBMIT_API_ARGS
image: public.ecr.aws/e8d0p1a5/cardano-submit-api:${CARDANO_NODE_VERSION:-1.35.5}
image: ghcr.io/intersectmbo/cardano-submit-api:${CARDANO_NODE_VERSION:-8.9.2}
ports:
- 8090:8090
restart: on-failure
Expand Down Expand Up @@ -224,7 +227,7 @@ services:
POSTGRES_DB_FILE: /run/secrets/postgres_db_db_sync
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
POSTGRES_USER_FILE: /run/secrets/postgres_user
image: postgres:${POSTGRES_VERSION:-11.5-alpine}
image: postgres:${POSTGRES_VERSION:-12.16-alpine}
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
Expand Down
3 changes: 3 additions & 0 deletions nix/cardano-services/deployments/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ in
blockfrost-worker.enabled = false;
pg-boss-worker.enabled = true;

backend.hostnames = ["backend.${final.namespace}.eks.${baseUrl}" "${final.namespace}.${baseUrl}"];
backend.allowedOrigins = lib.concatStringsSep "," allowedOriginsDev;
backend.routes = let
inherit (oci.meta) versions;
Expand Down Expand Up @@ -1050,6 +1051,7 @@ in
"live-sanchonet@us-east-2@v1" = final: {
namespace = "live-sanchonet";
name = "${final.namespace}-cardanojs-v1";
context = "eks-admin";
network = "sanchonet";
region = "us-east-2";

Expand All @@ -1075,6 +1077,7 @@ in
blockfrost-worker.enabled = false;
pg-boss-worker.enabled = true;
pg-boss-worker.queues = "pool-metadata,pool-metrics";
backend.hostnames = ["backend.${final.namespace}.eks.${baseUrl}" "${final.namespace}.${baseUrl}"];
backend.routes = let
inherit (oci.meta) versions;
in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
/* eslint-disable wrap-regex */
import { TxSubmissionError, TxSubmissionErrorCode } from '@cardano-sdk/core';

const parseStringishError = (errorData: string) => {
if (/outsideofvalidity/i.test(errorData)) {
return new TxSubmissionError(TxSubmissionErrorCode.OutsideOfValidityInterval, null, errorData);
}
if (/valuenotconserved/i.test(errorData)) {
return new TxSubmissionError(TxSubmissionErrorCode.ValueNotConserved, null, errorData);
}
if (/nonadacollateral/i.test(errorData)) {
return new TxSubmissionError(TxSubmissionErrorCode.NonAdaCollateral, null, errorData);
}
if (/incompletewithdrawals/i.test(errorData)) {
return new TxSubmissionError(TxSubmissionErrorCode.IncompleteWithdrawals, null, errorData);
}
return null;
};

export const mapCardanoTxSubmitError = (errorData: unknown): TxSubmissionError | null => {
if (typeof errorData === 'string') {
if (/outsideofvalidity/i.test(errorData)) {
return new TxSubmissionError(TxSubmissionErrorCode.OutsideOfValidityInterval, null, errorData);
}
if (/valuenotconserved/i.test(errorData)) {
return new TxSubmissionError(TxSubmissionErrorCode.ValueNotConserved, null, errorData);
}
if (/nonadacollateral/i.test(errorData)) {
return new TxSubmissionError(TxSubmissionErrorCode.NonAdaCollateral, null, errorData);
}
if (/incompletewithdrawals/i.test(errorData)) {
return new TxSubmissionError(TxSubmissionErrorCode.IncompleteWithdrawals, null, errorData);
}
return parseStringishError(errorData);
} else if (typeof errorData === 'object' && errorData) {
// cardano-submit-api started returning json instead of raw string.
// For the moment, simply stringify it. In the future we may want to make use of it.
return parseStringishError(JSON.stringify(errorData));
}
return null;
};
2 changes: 1 addition & 1 deletion packages/cardano-services-client/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// auto-generated using ../scripts/createVersionSource.js
export const apiVersion = {
assetInfo: '1.0.0',
chainHistory: '3.0.1',
chainHistory: '3.1.0',
handle: '1.0.0',
networkInfo: '1.0.0',
rewards: '1.0.0',
Expand Down
3 changes: 2 additions & 1 deletion packages/cardano-services-client/supportedVersions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
],
"chainHistory": [
"3.0.0",
"3.0.1"
"3.0.1",
"3.1.0"
],
"handle": [
"1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,28 @@ describe('mapCardanoTxSubmitError', () => {
expect(mapCardanoTxSubmitError(errorData)).toBeNull();
});
});

describe('json errors', () => {
const errorData = {
contents: {
contents: {
contents: {
era: 'ShelleyBasedEraConway',
error: [
'ConwayUtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure (ValueNotConservedUTxO (MaryValue (Coin 0) (MultiAsset (fromList []))) (MaryValue (Coin 4999969413825) (MultiAsset (fromList []))))))',
'ConwayUtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash "5f968400f05638454896883ae0f34491e14d748194a10df3f5a7fe2d10f52373"}) (TxIx 1)]))))'
],
kind: 'ShelleyTxValidationError'
},
tag: 'TxValidationErrorInCardanoMode'
},
tag: 'TxCmdTxSubmitValidationError'
},
tag: 'TxSubmitFail'
};

it('can map ValueNotConservedError to TxSubmissionErrorCode.ValueNotConserved', () => {
expect(CardanoNodeUtil.isValueNotConservedError(mapCardanoTxSubmitError(errorData))).toBeTruthy();
});
});
});
6 changes: 3 additions & 3 deletions packages/cardano-services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ for each of them can be an easy way to iterate over all the impacted models.

See [code coverage report]

[cardano db sync]: https://github.com/input-output-hk/cardano-db-sync
[cardano node]: https://github.com/input-output-hk/cardano-node
[cardano db sync]: https://github.com/IntersectMBO/cardano-db-sync
[cardano node]: https://github.com/IntersectMBO/cardano-node
[cli]: ./src/cli.ts
[code coverage report]: https://input-output-hk.github.io/cardano-js-sdk/coverage/cardano-services
[install and build]: ../../README.md#install-and-build
[ogmios]: https://ogmios.dev/
[postgresql]: https://www.postgresql.org/
[prometheus]: https://prometheus.io/
[provider]: ../core/src/Provider
[submit-api]: https://github.com/input-output-hk/cardano-node/tree/master/cardano-submit-api
[submit-api]: https://github.com/IntersectMBO/cardano-node/tree/master/cardano-submit-api
[txsubmithttpservice]: ./src/TxSubmit/TxSubmitHttpService.ts
52 changes: 10 additions & 42 deletions packages/cardano-services/config/.github/scripts/download-all.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/bash

# Download configuration files from a nominated URL for a nominated network
# If p2p is enabled, create an explicit p2p version, keeping the default aligned with the production
# networks, at least until https://github.com/input-output-hk/ouroboros-network/pull/3844 has been
# inclded in a cardano-node release.

CARDANO_CONFIG_URL=$1
CARDANO_NETWORK=$2
Expand All @@ -14,47 +11,18 @@ mkdir -p \
network/$CARDANO_NETWORK/cardano-db-sync \
network/$CARDANO_NETWORK/cardano-submit-api

SOURCE_TOPOLOGY=$(wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/topology.json)
NODE_CONFIG=$(wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/config.json | jq '.ByronGenesisFile = "../genesis/byron.json" | .ShelleyGenesisFile = "../genesis/shelley.json" | .AlonzoGenesisFile = "../genesis/alonzo.json" | .ConwayGenesisFile = "../genesis/conway.json"')
DB_SYNC_CONFIG=$(wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/db-sync-config.json | jq '.NodeConfigFile = "../cardano-node/config.json"')
SUBMIT_API_CONFIG=$(wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/submit-api-config.json)
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/topology.json -O network/$CARDANO_NETWORK/cardano-node/topology.json
wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/config.json \
| jq '.ByronGenesisFile = "../genesis/byron.json" | .ShelleyGenesisFile = "../genesis/shelley.json" | .AlonzoGenesisFile = "../genesis/alonzo.json" | .ConwayGenesisFile = "../genesis/conway.json"' \
| jq '.' > network/$CARDANO_NETWORK/cardano-node/config.json
wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/db-sync-config.json \
| jq '.NodeConfigFile = "../cardano-node/config.json"' \
| jq '.' > network/$CARDANO_NETWORK/cardano-db-sync/config.json
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/submit-api-config.json -O network/$CARDANO_NETWORK/cardano-submit-api/config.json


# Genesis
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/byron-genesis.json -O network/$CARDANO_NETWORK/genesis/byron.json
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/shelley-genesis.json -O network/$CARDANO_NETWORK/genesis/shelley.json
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/alonzo-genesis.json -O network/$CARDANO_NETWORK/genesis/alonzo.json
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/conway-genesis.json -O network/$CARDANO_NETWORK/genesis/conway.json

if [ $(echo $SOURCE_TOPOLOGY | jq 'has("publicRoots")') = true ];
then
ACCESS_POINT=$(echo $SOURCE_TOPOLOGY | jq '.publicRoots[0].accessPoints[0]')

# Add separate p2p config
mkdir -p \
network/${CARDANO_NETWORK}_p2p/cardano-node \
network/${CARDANO_NETWORK}_p2p/genesis \
network/${CARDANO_NETWORK}_p2p/cardano-db-sync \
network/${CARDANO_NETWORK}_p2p/cardano-submit-api

wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/byron-genesis.json -O network/${CARDANO_NETWORK}_p2p/genesis/byron.json
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/shelley-genesis.json -O network/${CARDANO_NETWORK}_p2p/genesis/shelley.json
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/alonzo-genesis.json -O network/${CARDANO_NETWORK}_p2p/genesis/alonzo.json
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/conway-genesis.json -O network/${CARDANO_NETWORK}_p2p/genesis/conway.json

echo $SOURCE_TOPOLOGY | jq '.' > network/${CARDANO_NETWORK}_p2p/cardano-node/topology.json
echo $NODE_CONFIG | jq '.' > network/${CARDANO_NETWORK}_p2p/cardano-node/config.json
echo $DB_SYNC_CONFIG | jq '.' > network/${CARDANO_NETWORK}_p2p/cardano-db-sync/config.json
echo $SUBMIT_API_CONFIG | jq '.' > network/${CARDANO_NETWORK}_p2p/cardano-submit-api/config.json

# Transform defaults to disable p2p
jq -nj --argjson address $(echo $ACCESS_POINT | jq '.address') --argjson port $(echo $ACCESS_POINT | jq '.port') '{"Producers": [{"addr": $address, "port": $port, "valency": 1 }]}' > network/$CARDANO_NETWORK/cardano-node/topology.json
# See https://github.com/input-output-hk/cardano-node/blob/0681cdeb07d81b3b088a6c14e703d03751c3d25d/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs#L366
echo $NODE_CONFIG | jq '.EnableP2P = false | del(.TestEnableDevelopmentNetworkProtocols)'> network/$CARDANO_NETWORK/cardano-node/config.json
echo $DB_SYNC_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-db-sync/config.json
echo $SUBMIT_API_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-submit-api/config.json
else
# Source config doesn't have p2p enabled, so no further transformation required
echo $SOURCE_TOPOLOGY | jq '.' > network/$CARDANO_NETWORK/cardano-node/topology.json
echo $NODE_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-node/config.json
echo $DB_SYNC_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-db-sync/config.json
echo $SUBMIT_API_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-submit-api/config.json
fi
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ jobs:
run: |
.github/scripts/download-all.sh $CARDANO_CONFIG_URL $CARDANO_NETWORK
env:
CARDANO_CONFIG_URL: https://book.world.dev.cardano.org/environments/
CARDANO_CONFIG_URL: https://book.play.dev.cardano.org/environments
CARDANO_NETWORK: mainnet

- name: Download from The Cardano Book (preprod)
shell: bash
run: |
.github/scripts/download-all.sh $CARDANO_CONFIG_URL $CARDANO_NETWORK
env:
CARDANO_CONFIG_URL: https://book.world.dev.cardano.org/environments
CARDANO_CONFIG_URL: https://book.play.dev.cardano.org/environments
CARDANO_NETWORK: preprod

- name: Download from The Cardano Book (preview)
shell: bash
run: |
.github/scripts/download-all.sh $CARDANO_CONFIG_URL $CARDANO_NETWORK
env:
CARDANO_CONFIG_URL: https://book.world.dev.cardano.org/environments
CARDANO_CONFIG_URL: https://book.play.dev.cardano.org/environments
CARDANO_NETWORK: preview

- name: Download from The Cardano Book (sanchonet)
shell: bash
run: |
.github/scripts/download-all.sh $CARDANO_CONFIG_URL $CARDANO_NETWORK
env:
CARDANO_CONFIG_URL: https://book.world.dev.cardano.org/environments
CARDANO_CONFIG_URL: https://book.play.dev.cardano.org/environments
CARDANO_NETWORK: sanchonet

- name: Push new configurations
Expand All @@ -51,4 +51,4 @@ jobs:
git status -s
.github/scripts/update-when-new.sh $CARDANO_CONFIG_URL
env:
CARDANO_CONFIG_URL: https://book.world.dev.cardano.org/environments
CARDANO_CONFIG_URL: https://book.play.dev.cardano.org/environments
6 changes: 3 additions & 3 deletions packages/cardano-services/config/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/input-output-hk/cardano-configurations.git
branch = master
commit = 898ec982eb35a9d6d5e8730a685a619d35234c37
parent = cb4b87fc4bd7bb8ccd4f35ab373b2a4bf931cb34
commit = f930b3b65d73e271afee2f379b00ddeeb8e5ba0d
parent = 98f58b3c1b0f72a6d3c9c4db43c965e305758544
method = merge
cmdver = 0.1.0
cmdver = 0.4.6
2 changes: 1 addition & 1 deletion packages/cardano-services/config/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cardano Configurations

This repository holds the latest configurations for various core Cardano components (cardano-node, cardano-db-sync...), as well as the genesis configurations of well-known networks (i.e. mainnet and testnet...). It's **updated automatically, when required, by a cron-job once a day**, using the [The Cardano Book](https://book.world.dev.cardano.org/environments.html) as a source, and, since they're a Git repository, can be added to a project as a Git submodule and specific configurations can be pinned via a commit reference. The folder structure is network-centric and works well for setup where the network is fixed via a command-line option or environment variable.
This repository holds the latest configurations for various core Cardano components (cardano-node, cardano-db-sync...), as well as the genesis configurations of well-known networks (i.e. mainnet and testnet...). It's **updated automatically, when required, by a cron-job once a day**, using the [The Cardano Book](https://book.play.dev.cardano.org/environments.html) as a source, and, since they're a Git repository, can be added to a project as a Git submodule and specific configurations can be pinned via a commit reference. The folder structure is network-centric and works well for setup where the network is fixed via a command-line option or environment variable.

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
{
"AlonzoGenesisFile": "../genesis/alonzo.json",
"AlonzoGenesisHash": "7e94a15f55d1e82d10f09203fa1d40f8eede58fd8066542cf6566008068ed874",
"ApplicationName": "cardano-sl",
"ApplicationVersion": 1,
"ByronGenesisFile": "../genesis/byron.json",
"ByronGenesisHash": "5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb",
"ConwayGenesisFile": "../genesis/conway.json",
"ConwayGenesisHash": "f28f1c1280ea0d32f8cd3143e268650d6c1a8e221522ce4a7d20d62fc09783e1",
"ConwayGenesisHash": "de609b281cb3d8ae91a9d63a00c87092975612d603aa54c0f1c6a781e33d6e1e",
"EnableP2P": true,
"LastKnownBlockVersion-Alt": 0,
"LastKnownBlockVersion-Major": 3,
"LastKnownBlockVersion-Minor": 0,
"MaxKnownMajorProtocolVersion": 2,
"MinNodeVersion": "8.9.2",
"PeerSharing": true,
"Protocol": "Cardano",
"RequiresNetworkMagic": "RequiresNoMagic",
"ShelleyGenesisFile": "../genesis/shelley.json",
"ShelleyGenesisHash": "1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81",
"TargetNumberOfActivePeers": 20,
"TargetNumberOfEstablishedPeers": 50,
"TargetNumberOfKnownPeers": 100,
"TargetNumberOfRootPeers": 60,
"TraceAcceptPolicy": true,
"TraceBlockFetchClient": false,
"TraceBlockFetchDecisions": false,
Expand All @@ -32,17 +37,18 @@
"TraceDiffusionInitialization": true,
"TraceErrorPolicy": true,
"TraceForge": true,
"TraceHandshake": false,
"TraceHandshake": true,
"TraceInboundGovernor": true,
"TraceIpSubscription": true,
"TraceLedgerPeers": true,
"TraceLocalChainSyncProtocol": false,
"TraceLocalConnectionManager": true,
"TraceLocalErrorPolicy": true,
"TraceLocalHandshake": false,
"TraceLocalHandshake": true,
"TraceLocalRootPeers": true,
"TraceLocalTxSubmissionProtocol": false,
"TraceLocalTxSubmissionServer": false,
"TraceMempool": true,
"TraceMempool": false,
"TraceMux": false,
"TracePeerSelection": true,
"TracePeerSelectionActions": true,
Expand Down

0 comments on commit 9ca045b

Please sign in to comment.