Skip to content

Commit 9c7e831

Browse files
Upgrade to Node 8.9.2 (#1251)
chore: Upgrade to Ogmios 6.3.0, Node 8.9.2 and DbSsync 13.2.0.2 Backports changes done in `conway-era` branch: - Upgraded Ogmios to 6.3 following migration guide [ADR-017](https://github.com/CardanoSolutions/ogmios/blob/master/architectural-decisions/accepted/017-api-version-6-major-rewrite.md) - Upgraded Node to 8.9.2 and DbSync to 13.2.0.2 - Enabled Peer2Peer topology support. - DbSync based providers updated for schema compatibility with DbSync 13.2.0.2: DbSyncChainSyncProvider, DbSyncNetworkInfoProvider, DbSyncStakePoolProvider, - Added Ogmios NodeTxSubmitProvider. - Modified Ogmios block structure mappers for Ogmios6 model. - Updated Ogmios errors and handles for detailed error handling.
1 parent ddb7e72 commit 9c7e831

File tree

188 files changed

+17371
-16571
lines changed

Some content is hidden

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

188 files changed

+17371
-16571
lines changed

.github/workflows/std.yml

+9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
type: boolean
1414
required: true
1515
default: false
16+
deploy-dev-preprod-resync:
17+
description: Deploy to dev-preprod-resync
18+
type: boolean
19+
required: true
20+
default: false
1621
deploy-staging-preprod:
1722
description: Deploy to staging-preprod
1823
type: boolean
@@ -104,6 +109,9 @@ jobs:
104109
if [ "true" == ${{ inputs.deploy-dev-preprod || false }} ] ; then
105110
echo '{"environment":"dev-preprod", "target":"dev-preprod@us-east-1@v2", "url": "https://dev-preprod.lw.iog.io/"}'
106111
fi
112+
if [ "true" == ${{ inputs.deploy-dev-preprod-resync || false }} ] ; then
113+
echo '{"environment":"dev-preprod-resync", "target":"dev-preprod-resync@us-east-1@v2", "url": "https://dev-preprod-resync.lw.iog.io/"}'
114+
fi
107115
if [ "true" == ${{ inputs.deploy-staging-preprod || false }} ] ; then
108116
echo '{"environment":"staging-preprod", "target":"staging-preprod@us-east-1@v2", "url": "https://staging-preprod.lw.iog.io/"}'
109117
fi
@@ -218,6 +226,7 @@ jobs:
218226
for target in \
219227
"dev-preview@us-east-1" \
220228
"dev-preprod@us-east-1@v2" \
229+
"dev-preprod-resync@us-east-1@v2" \
221230
"dev-mainnet@us-east-1" \
222231
; do
223232
git restore .kube

compose/aarch64.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
services:
44
cardano-db-sync:
5-
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.1.0.0}
5+
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.2.0.2}
66
cardano-node:
7-
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-node:${CARDANO_NODE_VERSION:-1.35.5}
7+
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-node:${CARDANO_NODE_VERSION:-8.9.2}
88
ogmios:
9-
image: ghcr.io/input-output-hk/ogmios-tracker/ogmios:v${OGMIOS_VERSION:-5.6.0}
9+
image: ghcr.io/input-output-hk/ogmios-tracker/ogmios:v${OGMIOS_VERSION:-6.3.0}
1010
cardano-submit-api:
11-
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-submit-api:${CARDANO_NODE_VERSION:-1.35.5}
11+
image: ghcr.io/input-output-hk/ogmios-tracker/cardano-submit-api:${CARDANO_NODE_VERSION:-8.9.2}

compose/common.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ services:
111111
depends_on:
112112
ogmios:
113113
condition: service_healthy
114-
image: ghcr.io/intersectmbo/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.1.0.2}
114+
image: ghcr.io/intersectmbo/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.2.0.2}
115115
restart: on-failure
116116
stop_signal: SIGINT
117117
volumes:
@@ -122,7 +122,7 @@ services:
122122
<<:
123123
- *logging
124124
- *with-postgres
125-
image: ghcr.io/intersectmbo/cardano-smash-server:${CARDANO_DB_SYNC_VERSION:-13.1.0.2}
125+
image: ghcr.io/intersectmbo/cardano-smash-server:${CARDANO_DB_SYNC_VERSION:-13.2.0.2}-docker
126126
command: ['--config', '/config/cardano-db-sync/config.json']
127127
environment:
128128
POSTGRES_HOST: postgres
@@ -143,7 +143,7 @@ services:
143143

144144
cardano-node:
145145
<<: *logging
146-
image: public.ecr.aws/e8d0p1a5/cardano-node:${CARDANO_NODE_VERSION:-1.35.5}
146+
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-8.9.2}
147147
command:
148148
[
149149
'run',
@@ -163,9 +163,12 @@ services:
163163

164164
ogmios:
165165
<<: *logging
166-
image: cardanosolutions/ogmios:v${OGMIOS_VERSION:-5.6.0}
166+
image: cardanosolutions/ogmios:v${OGMIOS_VERSION:-6.3.0}
167167
command:
168168
['--host', '0.0.0.0', '--node-socket', '/ipc/node.socket', '--node-config', '/config/cardano-node/config.json']
169+
depends_on:
170+
cardano-node:
171+
condition: service_started
169172
healthcheck:
170173
retries: 2000
171174
ports:
@@ -176,7 +179,7 @@ services:
176179

177180
cardano-submit-api:
178181
command: --config /config/cardano-submit-api/config.json --listen-address 0.0.0.0 --socket-path /ipc/node.socket $SUBMIT_API_ARGS
179-
image: public.ecr.aws/e8d0p1a5/cardano-submit-api:${CARDANO_NODE_VERSION:-1.35.5}
182+
image: ghcr.io/intersectmbo/cardano-submit-api:${CARDANO_NODE_VERSION:-8.9.2}
180183
ports:
181184
- 8090:8090
182185
restart: on-failure
@@ -216,7 +219,7 @@ services:
216219
POSTGRES_DB_FILE: /run/secrets/postgres_db_db_sync
217220
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
218221
POSTGRES_USER_FILE: /run/secrets/postgres_user
219-
image: postgres:${POSTGRES_VERSION:-11.5-alpine}
222+
image: postgres:${POSTGRES_VERSION:-12.16-alpine}
220223
healthcheck:
221224
test: ['CMD-SHELL', 'pg_isready -U postgres']
222225
interval: 10s

nix/cardano-services/deployments/default.nix

+45-4
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ in
193193
env.OVERRIDE_FUZZY_OPTIONS = "true";
194194
};
195195
handle-provider.enabled = true;
196-
# asset-provider.enabled = true;
196+
# asset-provider.enabled = true;
197197
};
198198

199199
projectors = {
@@ -337,13 +337,13 @@ in
337337
env.OVERRIDE_FUZZY_OPTIONS = "true";
338338
};
339339
handle-provider.enabled = true;
340-
# asset-provider.enabled = true;
340+
# asset-provider.enabled = true;
341341
};
342342

343343
projectors = {
344344
handle.enabled = true;
345345
stake-pool.enabled = true;
346-
# asset.enabled = true;
346+
# asset.enabled = true;
347347
};
348348

349349
values = {
@@ -384,7 +384,7 @@ in
384384
env.OVERRIDE_FUZZY_OPTIONS = "true";
385385
};
386386
handle-provider.enabled = true;
387-
# asset-provider.enabled = true;
387+
# asset-provider.enabled = true;
388388
};
389389

390390
projectors = {
@@ -406,6 +406,44 @@ in
406406
};
407407
};
408408

409+
"dev-preprod-resync@us-east-1@v2" = final: {
410+
name = "${final.namespace}-cardanojs-v2";
411+
namespace = "dev-preprod-resync";
412+
context = "eks-devs";
413+
network = "preprod";
414+
region = "us-east-1";
415+
416+
providers = {
417+
backend = {
418+
enabled = true;
419+
env.NODE_EXTRA_OPTIONS = "--trace-gc";
420+
};
421+
stake-pool-provider = {
422+
enabled = true;
423+
env.OVERRIDE_FUZZY_OPTIONS = "true";
424+
};
425+
handle-provider.enabled = true;
426+
};
427+
428+
projectors = {
429+
handle.enabled = true;
430+
stake-pool.enabled = true;
431+
};
432+
433+
values = {
434+
stakepool.databaseName = "stakepoolv2";
435+
backend.allowedOrigins = lib.concatStringsSep "," allowedOriginsDev;
436+
backend.hostnames = ["${final.namespace}.${baseUrl}"];
437+
438+
pg-boss-worker.enabled = true;
439+
440+
blockfrost-worker.enabled = true;
441+
cardano-services = {
442+
ingresOrder = 98;
443+
};
444+
};
445+
};
446+
409447
"staging-preprod@us-east-1@v2" = final: {
410448
name = "${final.namespace}-cardanojs-v2";
411449
namespace = "staging-preprod";
@@ -435,6 +473,8 @@ in
435473
stakepool.databaseName = "stakepoolv2";
436474
blockfrost-worker.enabled = true;
437475
pg-boss-worker.enabled = true;
476+
pg-boss-worker.metadata-fetch-mode = "direct";
477+
pg-boss-worker.queues = "pool-metadata,pool-metrics,pool-rewards";
438478
cardano-services = {
439479
ingresOrder = 98;
440480
};
@@ -905,6 +945,7 @@ in
905945
};
906946

907947
"ops-preview-1@us-east-1" = final: {
948+
name = "${final.namespace}-cardanojs-v2";
908949
namespace = "ops-preview-1";
909950
network = "preview";
910951
region = "us-east-1";
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
/* eslint-disable wrap-regex */
22
import { TxSubmissionError, TxSubmissionErrorCode } from '@cardano-sdk/core';
33

4+
// TODO: LW-9890 Map cardano-submit-api to core errors
5+
// For now this is a very superficial mapping, we should improve it in the future
6+
const parseStringishError = (errorData: string) => {
7+
if (/outsideofvalidity/i.test(errorData)) {
8+
return new TxSubmissionError(TxSubmissionErrorCode.OutsideOfValidityInterval, null, errorData);
9+
}
10+
if (/valuenotconserved/i.test(errorData)) {
11+
return new TxSubmissionError(TxSubmissionErrorCode.ValueNotConserved, null, errorData);
12+
}
13+
if (/nonadacollateral/i.test(errorData)) {
14+
return new TxSubmissionError(TxSubmissionErrorCode.NonAdaCollateral, null, errorData);
15+
}
16+
if (/incompletewithdrawals/i.test(errorData)) {
17+
return new TxSubmissionError(TxSubmissionErrorCode.IncompleteWithdrawals, null, errorData);
18+
}
19+
return null;
20+
};
21+
422
export const mapCardanoTxSubmitError = (errorData: unknown): TxSubmissionError | null => {
523
if (typeof errorData === 'string') {
6-
if (/outsideofvalidity/i.test(errorData)) {
7-
return new TxSubmissionError(TxSubmissionErrorCode.OutsideOfValidityInterval, null, errorData);
8-
}
9-
if (/valuenotconserved/i.test(errorData)) {
10-
return new TxSubmissionError(TxSubmissionErrorCode.ValueNotConserved, null, errorData);
11-
}
12-
if (/nonadacollateral/i.test(errorData)) {
13-
return new TxSubmissionError(TxSubmissionErrorCode.NonAdaCollateral, null, errorData);
14-
}
15-
if (/incompletewithdrawals/i.test(errorData)) {
16-
return new TxSubmissionError(TxSubmissionErrorCode.IncompleteWithdrawals, null, errorData);
17-
}
24+
return parseStringishError(errorData);
25+
} else if (typeof errorData === 'object' && errorData) {
26+
// cardano-submit-api started returning json instead of raw string.
27+
// For the moment, simply stringify it. In the future we may want to make use of it.
28+
return parseStringishError(JSON.stringify(errorData));
1829
}
1930
return null;
2031
};

packages/cardano-services-client/src/version.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// auto-generated using ../scripts/createVersionSource.js
22
export const apiVersion = {
33
assetInfo: '1.0.0',
4-
chainHistory: '3.0.1',
4+
chainHistory: '3.1.0',
55
handle: '1.0.0',
66
networkInfo: '1.0.0',
77
rewards: '1.0.0',

packages/cardano-services-client/supportedVersions.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
],
55
"chainHistory": [
66
"3.0.0",
7-
"3.0.1"
7+
"3.0.1",
8+
"3.1.0"
89
],
910
"handle": [
1011
"1.0.0"

packages/cardano-services-client/test/TxSubmitProvider/cardanoTxSubmitErrorMapper.test.ts

+24
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,28 @@ describe('mapCardanoTxSubmitError', () => {
2828
expect(mapCardanoTxSubmitError(errorData)).toBeNull();
2929
});
3030
});
31+
32+
describe('json errors', () => {
33+
const errorData = {
34+
contents: {
35+
contents: {
36+
contents: {
37+
era: 'ShelleyBasedEraConway',
38+
error: [
39+
'ConwayUtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure (ValueNotConservedUTxO (MaryValue (Coin 0) (MultiAsset (fromList []))) (MaryValue (Coin 4999969413825) (MultiAsset (fromList []))))))',
40+
'ConwayUtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash "5f968400f05638454896883ae0f34491e14d748194a10df3f5a7fe2d10f52373"}) (TxIx 1)]))))'
41+
],
42+
kind: 'ShelleyTxValidationError'
43+
},
44+
tag: 'TxValidationErrorInCardanoMode'
45+
},
46+
tag: 'TxCmdTxSubmitValidationError'
47+
},
48+
tag: 'TxSubmitFail'
49+
};
50+
51+
it('can map ValueNotConservedError to TxSubmissionErrorCode.ValueNotConserved', () => {
52+
expect(CardanoNodeUtil.isValueNotConservedError(mapCardanoTxSubmitError(errorData))).toBeTruthy();
53+
});
54+
});
3155
});

packages/cardano-services/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ for each of them can be an easy way to iterate over all the impacted models.
180180

181181
See [code coverage report]
182182

183-
[cardano db sync]: https://github.com/input-output-hk/cardano-db-sync
184-
[cardano node]: https://github.com/input-output-hk/cardano-node
183+
[cardano db sync]: https://github.com/IntersectMBO/cardano-db-sync
184+
[cardano node]: https://github.com/IntersectMBO/cardano-node
185185
[cli]: ./src/cli.ts
186186
[code coverage report]: https://input-output-hk.github.io/cardano-js-sdk/coverage/cardano-services
187187
[install and build]: ../../README.md#install-and-build
188188
[ogmios]: https://ogmios.dev/
189189
[postgresql]: https://www.postgresql.org/
190190
[prometheus]: https://prometheus.io/
191191
[provider]: ../core/src/Provider
192-
[submit-api]: https://github.com/input-output-hk/cardano-node/tree/master/cardano-submit-api
192+
[submit-api]: https://github.com/IntersectMBO/cardano-node/tree/master/cardano-submit-api
193193
[txsubmithttpservice]: ./src/TxSubmit/TxSubmitHttpService.ts
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/bin/bash
22

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

85
CARDANO_CONFIG_URL=$1
96
CARDANO_NETWORK=$2
@@ -14,47 +11,18 @@ mkdir -p \
1411
network/$CARDANO_NETWORK/cardano-db-sync \
1512
network/$CARDANO_NETWORK/cardano-submit-api
1613

17-
SOURCE_TOPOLOGY=$(wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/topology.json)
18-
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"')
19-
DB_SYNC_CONFIG=$(wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/db-sync-config.json | jq '.NodeConfigFile = "../cardano-node/config.json"')
20-
SUBMIT_API_CONFIG=$(wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/submit-api-config.json)
14+
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/topology.json -O network/$CARDANO_NETWORK/cardano-node/topology.json
15+
wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/config.json \
16+
| jq '.ByronGenesisFile = "../genesis/byron.json" | .ShelleyGenesisFile = "../genesis/shelley.json" | .AlonzoGenesisFile = "../genesis/alonzo.json" | .ConwayGenesisFile = "../genesis/conway.json"' \
17+
| jq '.' > network/$CARDANO_NETWORK/cardano-node/config.json
18+
wget -qO- $CARDANO_CONFIG_URL/$CARDANO_NETWORK/db-sync-config.json \
19+
| jq '.NodeConfigFile = "../cardano-node/config.json"' \
20+
| jq '.' > network/$CARDANO_NETWORK/cardano-db-sync/config.json
21+
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/submit-api-config.json -O network/$CARDANO_NETWORK/cardano-submit-api/config.json
2122

23+
24+
# Genesis
2225
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/byron-genesis.json -O network/$CARDANO_NETWORK/genesis/byron.json
2326
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/shelley-genesis.json -O network/$CARDANO_NETWORK/genesis/shelley.json
2427
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/alonzo-genesis.json -O network/$CARDANO_NETWORK/genesis/alonzo.json
2528
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/conway-genesis.json -O network/$CARDANO_NETWORK/genesis/conway.json
26-
27-
if [ $(echo $SOURCE_TOPOLOGY | jq 'has("publicRoots")') = true ];
28-
then
29-
ACCESS_POINT=$(echo $SOURCE_TOPOLOGY | jq '.publicRoots[0].accessPoints[0]')
30-
31-
# Add separate p2p config
32-
mkdir -p \
33-
network/${CARDANO_NETWORK}_p2p/cardano-node \
34-
network/${CARDANO_NETWORK}_p2p/genesis \
35-
network/${CARDANO_NETWORK}_p2p/cardano-db-sync \
36-
network/${CARDANO_NETWORK}_p2p/cardano-submit-api
37-
38-
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/byron-genesis.json -O network/${CARDANO_NETWORK}_p2p/genesis/byron.json
39-
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/shelley-genesis.json -O network/${CARDANO_NETWORK}_p2p/genesis/shelley.json
40-
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/alonzo-genesis.json -O network/${CARDANO_NETWORK}_p2p/genesis/alonzo.json
41-
wget -q $CARDANO_CONFIG_URL/$CARDANO_NETWORK/conway-genesis.json -O network/${CARDANO_NETWORK}_p2p/genesis/conway.json
42-
43-
echo $SOURCE_TOPOLOGY | jq '.' > network/${CARDANO_NETWORK}_p2p/cardano-node/topology.json
44-
echo $NODE_CONFIG | jq '.' > network/${CARDANO_NETWORK}_p2p/cardano-node/config.json
45-
echo $DB_SYNC_CONFIG | jq '.' > network/${CARDANO_NETWORK}_p2p/cardano-db-sync/config.json
46-
echo $SUBMIT_API_CONFIG | jq '.' > network/${CARDANO_NETWORK}_p2p/cardano-submit-api/config.json
47-
48-
# Transform defaults to disable p2p
49-
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
50-
# See https://github.com/input-output-hk/cardano-node/blob/0681cdeb07d81b3b088a6c14e703d03751c3d25d/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs#L366
51-
echo $NODE_CONFIG | jq '.EnableP2P = false | del(.TestEnableDevelopmentNetworkProtocols)'> network/$CARDANO_NETWORK/cardano-node/config.json
52-
echo $DB_SYNC_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-db-sync/config.json
53-
echo $SUBMIT_API_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-submit-api/config.json
54-
else
55-
# Source config doesn't have p2p enabled, so no further transformation required
56-
echo $SOURCE_TOPOLOGY | jq '.' > network/$CARDANO_NETWORK/cardano-node/topology.json
57-
echo $NODE_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-node/config.json
58-
echo $DB_SYNC_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-db-sync/config.json
59-
echo $SUBMIT_API_CONFIG | jq '.' > network/$CARDANO_NETWORK/cardano-submit-api/config.json
60-
fi

0 commit comments

Comments
 (0)