From befcdea71a5b6a9d82041dac39811ec78c9d4fee Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 14 Feb 2024 16:36:01 +0100 Subject: [PATCH 01/13] feat: support Cardano node pre-release in e2e test Support '8.8..0-pre' version sepcifically. --- .../mithril-devnet/mkfiles/mkfiles-cardano.sh | 8 +++++++- mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh index 0291b136fa4..06e7d484050 100644 --- a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh +++ b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh @@ -72,11 +72,17 @@ $CARDANO_CLI byron genesis genesis \ cp $SCRIPT_DIRECTORY/configuration/babbage/alonzo-babbage-test-genesis.json "${ARTIFACTS_DIR_TEMP}/genesis.alonzo.spec.json" cp $SCRIPT_DIRECTORY/configuration/babbage/conway-babbage-test-genesis.json "${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json" -if [ "${CARDANO_NODE_VERSION}" = "8.1.2" ]; then +if [ "${CARDANO_NODE_VERSION_RELEASE}" = "8.1.2" ]; then # Fix 8.1.2, to avoid the following error: 'Command failed: genesis create-staked Error: Error while decoding Shelley genesis at: example/genesis.conway.spec.json Error: Error in $: key "genDelegs" not found' mv ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp && cat ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp | jq '. += {"genDelegs":{}}' > ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json && rm ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp fi +if [ "${CARDANO_NODE_VERSION_RELEASE}" = "8.8.0" ]; then + # Fix 8.8.0, to avoid the following errors: 'Command failed: genesis create-staked Error: Error: Error while decoding Shelley genesis at: ./temp/genesis.conway.spec.json Error: Error in $.poolVotingThresholds: key "motionNoConfidence" not found + mv ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp && cat ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp | jq '. += {"poolVotingThresholds": {"motionNoConfidence": 0.51, "committeeNormal": 0.51, "committeeNoConfidence": 0.51, "hardForkInitiation": 0.51, "ppSecurityGroup": 0.51}, "dRepVotingThresholds": {"motionNoConfidence": 0.51, "committeeNormal": 0.51, "committeeNoConfidence": 0.51, "updateToConstitution": 0.51, "hardForkInitiation": 0.51, "ppNetworkGroup": 0.51, "ppEconomicGroup": 0.51, "ppTechnicalGroup": 0.51, "ppGovGroup": 0.51, "treasuryWithdrawal": 0.51}}' > ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json && rm ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp + cat ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json +fi + cp $SCRIPT_DIRECTORY/configuration/byron/configuration.yaml "${ARTIFACTS_DIR_TEMP}/" $SED -i "${ARTIFACTS_DIR_TEMP}/configuration.yaml" \ -e 's/Protocol: RealPBFT/Protocol: Cardano/' \ diff --git a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh index fcf8f470c84..4373e4af699 100644 --- a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh +++ b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh @@ -11,8 +11,11 @@ esac if [ -z "${CARDANO_NODE_VERSION}" ]; then CARDANO_NODE_VERSION="8.7.3" fi +if [ -z "${CARDANO_NODE_VERSION_RELEASE}" ]; then + CARDANO_NODE_VERSION_RELEASE=$(echo ${CARDANO_NODE_VERSION} | cut -d'-' -f1) +fi if [ -z "${CARDANO_BINARY_URL}" ]; then - CARDANO_BINARY_URL="https://github.com/input-output-hk/cardano-node/releases/download/${CARDANO_NODE_VERSION}/cardano-node-${CARDANO_NODE_VERSION}-${OPERATING_SYSTEM}.tar.gz" + CARDANO_BINARY_URL="https://github.com/input-output-hk/cardano-node/releases/download/${CARDANO_NODE_VERSION}/cardano-node-${CARDANO_NODE_VERSION_RELEASE}-${OPERATING_SYSTEM}.tar.gz" fi if [ -z "${NETWORK_MAGIC}" ]; then NETWORK_MAGIC=42 From 782acbadd836d6d3e85f5a7c8f2a8ad504a0e4a2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 28 Feb 2024 15:41:45 +0100 Subject: [PATCH 02/13] fix: stake delegation not working on '8.8.0' in e2e test A new '--key-reg-deposit-amt' parameter is required with version '8.8.0' when creating the stake address registration certificate. --- .../mithril-devnet/mkfiles/mkfiles-cardano.sh | 14 +----- .../mkfiles/mkfiles-mithril-delegation.sh | 46 ++++++++++++++++++- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh index 06e7d484050..9ce6f41d20c 100644 --- a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh +++ b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh @@ -194,18 +194,6 @@ for ADDR in ${USER_ADDRS}; do --stake-verification-key-file addresses/${ADDR}-stake.vkey \ --testnet-magic ${NETWORK_MAGIC} \ --out-file addresses/${ADDR}-stake.addr - - # Stake addresses registration certs - ./cardano-cli stake-address registration-certificate \ - --stake-verification-key-file addresses/${ADDR}-stake.vkey \ - --out-file addresses/${ADDR}-stake.reg.cert + done -# User N will delegate to pool N -for N in ${POOL_NODES_N}; do - # Stake address delegation certs - ./cardano-cli stake-address delegation-certificate \ - --stake-verification-key-file addresses/user${N}-stake.vkey \ - --cold-verification-key-file node-pool${N}/shelley/cold.vkey \ - --out-file addresses/user${N}-stake.deleg.cert -done diff --git a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh index 44556106eb2..566355af500 100644 --- a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh +++ b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh @@ -20,9 +20,53 @@ CURRENT_EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano- --cardano-mode \\ --testnet-magic ${NETWORK_MAGIC} | jq .epoch) echo ">>>> Current Epoch: \${CURRENT_EPOCH}" - + +# Stake addresses registration certs +for ADDR in ${USER_ADDRS}; do + if [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then + KEY_REGISTRATION_DEPOSIT_ANOUNT=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} query gov-state --testnet-magic ${NETWORK_MAGIC} | jq -r .enactState.curPParams.keyDeposit) + if [ "\${KEY_REGISTRATION_DEPOSIT_ANOUNT}" != "null" ]; then + # Conway specific creation of registration certificate + ./cardano-cli \${CURRENT_CARDANO_ERA} stake-address registration-certificate \ + --stake-verification-key-file addresses/\${ADDR}-stake.vkey \ + --out-file addresses/\${ADDR}-stake.reg.cert \ + --key-reg-deposit-amt \$KEY_REGISTRATION_DEPOSIT_ANOUNT + else + # Legacy creation of registration certificate + ./cardano-cli stake-address registration-certificate \ + --stake-verification-key-file addresses/\${ADDR}-stake.vkey \ + --out-file addresses/\${ADDR}-stake.reg.cert + fi + else + # Legacy creation of registration certificate + ./cardano-cli stake-address registration-certificate \ + --stake-verification-key-file addresses/\${ADDR}-stake.vkey \ + --out-file addresses/\${ADDR}-stake.reg.cert + fi +done + EOF +# User N will delegate to pool N +for N in ${POOL_NODES_N}; do + cat >> delegate.sh <> delegate.sh < Date: Wed, 14 Feb 2024 16:37:08 +0100 Subject: [PATCH 03/13] feat: add Cardano node '8.8.0-pre' test case in CI e2e test --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eefe4a3ded0..350e022167b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -266,13 +266,13 @@ jobs: matrix: mode: [ "std" ] era: ${{ fromJSON(needs.build-ubuntu-X64.outputs.eras) }} - cardano_node_version: [ "8.7.3" ] + cardano_node_version: [ "8.7.3", "8.8.0-pre" ] hard_fork_latest_era_at_epoch: [ 0,10,100 ] - run_id: [ "#1","#2" ] + run_id: [ "#1" ] extra_args: [ "" ] include: - # Include a hard fork test for `8.1.2` which is not concerned + # Include a test for `8.1.2` which is not concerned by the hard fork - mode: "std" era: ${{ fromJSON(needs.build-ubuntu-X64.outputs.eras)[0] }} cardano_node_version: "8.1.2" From 2832f32388cec3bdb9e331b0a4551a87c8961de5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Thu, 15 Feb 2024 11:25:17 +0100 Subject: [PATCH 04/13] fix: support new stake address creation of registration certificate in infra --- .../assets/tools/pool/create-keys.sh | 17 +++++++++++++--- .../mithril-devnet/mkfiles/mkfiles-cardano.sh | 15 ++++++++++++-- .../mkfiles/mkfiles-mithril-delegation.sh | 20 +++++++++++++++---- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/mithril-infra/assets/tools/pool/create-keys.sh b/mithril-infra/assets/tools/pool/create-keys.sh index 3d9924eca0f..92541c27a5c 100644 --- a/mithril-infra/assets/tools/pool/create-keys.sh +++ b/mithril-infra/assets/tools/pool/create-keys.sh @@ -62,9 +62,20 @@ CARDANO_CLI_CMD node issue-op-cert \ --out-file ${POOL_ARTIFACTS_DIR}/opcert.cert ### Create a registration certificate -CARDANO_CLI_CMD stake-address registration-certificate \ ---stake-verification-key-file ${POOL_ARTIFACTS_DIR}/stake.vkey \ ---out-file ${POOL_ARTIFACTS_DIR}/stake.cert +if [ "${CARDANO_ERA}" == "conway"]; then + KEY_REGISTRATION_DEPOSIT_ANOUNT=$(CARDANO_CLI_CMD ${CARDANO_ERA} query gov-state --testnet-magic ${NETWORK_MAGIC} | jq -r .enactState.curPParams.keyDeposit) + # Conway specific creation of registration certificate + CARDANO_CLI_CMD stake-address registration-certificate \ + --stake-verification-key-file ${POOL_ARTIFACTS_DIR}/stake.vkey \ + --out-file ${POOL_ARTIFACTS_DIR}/stake.cert \ + --key-reg-deposit-amt $KEY_REGISTRATION_DEPOSIT_ANOUNT +else + # Legacy creation of registration certificate + CARDANO_CLI_CMD stake-address registration-certificate \ + --stake-verification-key-file ${POOL_ARTIFACTS_DIR}/stake.vkey \ + --out-file ${POOL_ARTIFACTS_DIR}/stake.cert +fi + ### Compute Pool Id POOL_ID=$(CARDANO_CLI_CMD stake-pool id --cold-verification-key-file ${POOL_ARTIFACTS_DIR}/cold.vkey) diff --git a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh index 9ce6f41d20c..c4c75af18dd 100644 --- a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh +++ b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh @@ -4,6 +4,17 @@ mkdir -p ${ARTIFACTS_DIR_TEMP} # Step 1: Bootstrap the devnet artifacts # Adapted from https://github.com/IntersectMBO/cardano-node/blob/master/scripts/babbage/mkfiles.sh +# Is semver on the first argument strictly lower than equal to the second argument? +version_lt() { + VERSION_LHS=$1 + VERSION_RHS=$2 + if [ "${VERSION_LHS}" != "${VERSION_RHS}" ] && [ "${VERSION_LHS}" = "`echo -e "${VERSION_LHS}\n${VERSION_RHS}" | sort -V | head -n1`" ]; then + echo "true" + else + echo "false" + fi +} + UNAME=$(uname -s) SED= case $UNAME in Darwin ) SED="gsed";; @@ -77,8 +88,8 @@ if [ "${CARDANO_NODE_VERSION_RELEASE}" = "8.1.2" ]; then mv ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp && cat ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp | jq '. += {"genDelegs":{}}' > ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json && rm ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp fi -if [ "${CARDANO_NODE_VERSION_RELEASE}" = "8.8.0" ]; then - # Fix 8.8.0, to avoid the following errors: 'Command failed: genesis create-staked Error: Error: Error while decoding Shelley genesis at: ./temp/genesis.conway.spec.json Error: Error in $.poolVotingThresholds: key "motionNoConfidence" not found +if [ $(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") = "false" ]; then + # Fix >=8.8.0, to avoid the following errors: 'Command failed: genesis create-staked Error: Error: Error while decoding Shelley genesis at: ./temp/genesis.conway.spec.json Error: Error in $.poolVotingThresholds: key "motionNoConfidence" not found mv ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp && cat ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp | jq '. += {"poolVotingThresholds": {"motionNoConfidence": 0.51, "committeeNormal": 0.51, "committeeNoConfidence": 0.51, "hardForkInitiation": 0.51, "ppSecurityGroup": 0.51}, "dRepVotingThresholds": {"motionNoConfidence": 0.51, "committeeNormal": 0.51, "committeeNoConfidence": 0.51, "updateToConstitution": 0.51, "hardForkInitiation": 0.51, "ppNetworkGroup": 0.51, "ppEconomicGroup": 0.51, "ppTechnicalGroup": 0.51, "ppGovGroup": 0.51, "treasuryWithdrawal": 0.51}}' > ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json && rm ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp cat ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json fi diff --git a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh index 566355af500..4d4c09a7910 100644 --- a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh +++ b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh @@ -21,11 +21,23 @@ CURRENT_EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano- --testnet-magic ${NETWORK_MAGIC} | jq .epoch) echo ">>>> Current Epoch: \${CURRENT_EPOCH}" +# Is semver on the first argument strictly lower than equal to the second argument? +version_lt() { + VERSION_LHS=\$1 + VERSION_RHS=\$2 + if [ "\${VERSION_LHS}" != "\${VERSION_RHS}" ] && [ "\${VERSION_LHS}" = "`echo -e "\${VERSION_LHS}\n\${VERSION_RHS}" | sort -V | head -n1`" ]; then + echo "true" + else + echo "false" + fi +} + # Stake addresses registration certs for ADDR in ${USER_ADDRS}; do - if [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then - KEY_REGISTRATION_DEPOSIT_ANOUNT=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} query gov-state --testnet-magic ${NETWORK_MAGIC} | jq -r .enactState.curPParams.keyDeposit) - if [ "\${KEY_REGISTRATION_DEPOSIT_ANOUNT}" != "null" ]; then + if [ \$(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") = "false" ]; then + #KEY_REGISTRATION_DEPOSIT_ANOUNT=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} query gov-state --testnet-magic ${NETWORK_MAGIC} | jq -r .enactState.curPParams.keyDeposit) + KEY_REGISTRATION_DEPOSIT_ANOUNT=0 + if [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then # Conway specific creation of registration certificate ./cardano-cli \${CURRENT_CARDANO_ERA} stake-address registration-certificate \ --stake-verification-key-file addresses/\${ADDR}-stake.vkey \ @@ -50,7 +62,7 @@ EOF # User N will delegate to pool N for N in ${POOL_NODES_N}; do cat >> delegate.sh < Date: Fri, 15 Mar 2024 10:15:44 +0100 Subject: [PATCH 05/13] fix: support new Cardano binary archive folder structure in devnet The binaries are produced in 'bin' folder from '8.9.0' when they used to be at root of archive. --- mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh index 4373e4af699..2c1799f9ad6 100644 --- a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh +++ b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh @@ -69,7 +69,7 @@ fi if [[ "$SKIP_CARDANO_BIN_DOWNLOAD" != "true" ]]; then echo ">> Downloading cardano-cli & cardano-node..." curl -sL ${CARDANO_BINARY_URL} --output cardano-bin.tar.gz - tar xzf cardano-bin.tar.gz ./cardano-cli ./cardano-node + tar xzf cardano-bin.tar.gz ./bin/cardano-cli ./bin/cardano-node && mv ./bin/cardano-{cli,node} . && rm -rf ./bin || tar xzf cardano-bin.tar.gz ./cardano-cli ./cardano-node rm -f cardano-bin.tar.gz fi From 8bd96c73092d8e39bb87cb00051bfeb30c66ded9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Fri, 15 Mar 2024 10:19:48 +0100 Subject: [PATCH 06/13] fix: support new Cardano binary archive folder structure in Docker images The binaries are produced in 'bin' folder from '8.9.0' when they used to be at root of archive. --- mithril-aggregator/Dockerfile | 10 +++++----- mithril-aggregator/Dockerfile.ci | 2 +- mithril-signer/Dockerfile | 10 +++++----- mithril-signer/Dockerfile.ci | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mithril-aggregator/Dockerfile b/mithril-aggregator/Dockerfile index e71c298da44..93d4b9f51c2 100644 --- a/mithril-aggregator/Dockerfile +++ b/mithril-aggregator/Dockerfile @@ -47,16 +47,16 @@ COPY --from=rustbuilder /app/target/release/mithril-aggregator /app/bin/mithril- # Copy the config files COPY --from=rustbuilder /app/mithril-aggregator/config /app/config -#Workdir -WORKDIR /app/ -RUN chown -R appuser /app/ - # Install cardano-cli RUN wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL -RUN tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin +RUN (tar xzf cardano-bin.tar.gz ./bin/cardano-cli && mv /bin/cardano-cli /app/bin) || (tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin) RUN /app/bin/cardano-cli --version RUN rm -f cardano-bin.tar.gz +#Workdir +WORKDIR /app/ +RUN chown -R appuser /app/ + # Use an unprivileged user USER appuser diff --git a/mithril-aggregator/Dockerfile.ci b/mithril-aggregator/Dockerfile.ci index 448731433c0..1c915ec2121 100644 --- a/mithril-aggregator/Dockerfile.ci +++ b/mithril-aggregator/Dockerfile.ci @@ -17,7 +17,7 @@ RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && a ARG CARDANO_NODE_VERSION=8.7.3 ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz RUN wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL \ - && tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin \ + && (tar xzf cardano-bin.tar.gz ./bin/cardano-cli && mv /bin/cardano-cli /app/bin) || (tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin) \ && /app/bin/cardano-cli --version \ && rm -f cardano-bin.tar.gz diff --git a/mithril-signer/Dockerfile b/mithril-signer/Dockerfile index 18ef826d81c..bdf8acb2f64 100644 --- a/mithril-signer/Dockerfile +++ b/mithril-signer/Dockerfile @@ -48,16 +48,16 @@ COPY --from=rustbuilder /app/target/release/mithril-signer /app/bin/mithril-sign # Copy the config files COPY --from=rustbuilder /app/mithril-signer/config /app/config -#Workdir -WORKDIR /app/ -RUN chown -R appuser /app/ - # Install cardano-cli RUN wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL -RUN tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin +RUN (tar xzf cardano-bin.tar.gz ./bin/cardano-cli && mv /bin/cardano-cli /app/bin) || (tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin) RUN /app/bin/cardano-cli --version RUN rm -f cardano-bin.tar.gz +#Workdir +WORKDIR /app/ +RUN chown -R appuser /app/ + # Use an unprivileged user USER appuser diff --git a/mithril-signer/Dockerfile.ci b/mithril-signer/Dockerfile.ci index 66d89d798d8..78edd376aed 100644 --- a/mithril-signer/Dockerfile.ci +++ b/mithril-signer/Dockerfile.ci @@ -17,7 +17,7 @@ RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && a ARG CARDANO_NODE_VERSION=8.7.3 ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz RUN wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL \ - && tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin \ + && (tar xzf cardano-bin.tar.gz ./bin/cardano-cli && mv /bin/cardano-cli /app/bin) || (tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin) \ && /app/bin/cardano-cli --version \ && rm -f cardano-bin.tar.gz From 18b521cbdcca25516f0d1f32433881bea58ae91b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Fri, 15 Mar 2024 10:21:05 +0100 Subject: [PATCH 07/13] fix: add Cardano node '8.9.0' test case in e2e test in CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 350e022167b..8f7ea671d4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -266,7 +266,7 @@ jobs: matrix: mode: [ "std" ] era: ${{ fromJSON(needs.build-ubuntu-X64.outputs.eras) }} - cardano_node_version: [ "8.7.3", "8.8.0-pre" ] + cardano_node_version: [ "8.7.3", "8.8.0-pre", "8.9.0" ] hard_fork_latest_era_at_epoch: [ 0,10,100 ] run_id: [ "#1" ] extra_args: [ "" ] From 30e8f3e9d87be6b5f00890803b510d205d03f7cb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Fri, 15 Mar 2024 10:22:36 +0100 Subject: [PATCH 08/13] fix: support stake delegation new commands in Cardano '8.8.0+' --- .../mkfiles/mkfiles-mithril-delegation.sh | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh index 4d4c09a7910..cc91916fd3d 100644 --- a/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh +++ b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-delegation.sh @@ -21,7 +21,7 @@ CURRENT_EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano- --testnet-magic ${NETWORK_MAGIC} | jq .epoch) echo ">>>> Current Epoch: \${CURRENT_EPOCH}" -# Is semver on the first argument strictly lower than equal to the second argument? +# Is semver on the first argument strictly lower than the second argument? version_lt() { VERSION_LHS=\$1 VERSION_RHS=\$2 @@ -32,23 +32,26 @@ version_lt() { fi } +# Is semver on the first argument lower or equal to the second argument? +version_lte() { + VERSION_LHS=\$1 + VERSION_RHS=\$2 + if [ "\${VERSION_LHS}" == "\${VERSION_RHS}" ]; then + echo "true" + else + version_lt $VERSION_LHS $VERSION_RHS + fi +} + # Stake addresses registration certs for ADDR in ${USER_ADDRS}; do - if [ \$(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") = "false" ]; then - #KEY_REGISTRATION_DEPOSIT_ANOUNT=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} query gov-state --testnet-magic ${NETWORK_MAGIC} | jq -r .enactState.curPParams.keyDeposit) + if [ \$(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") == "false" ] && [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then KEY_REGISTRATION_DEPOSIT_ANOUNT=0 - if [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then - # Conway specific creation of registration certificate - ./cardano-cli \${CURRENT_CARDANO_ERA} stake-address registration-certificate \ - --stake-verification-key-file addresses/\${ADDR}-stake.vkey \ - --out-file addresses/\${ADDR}-stake.reg.cert \ - --key-reg-deposit-amt \$KEY_REGISTRATION_DEPOSIT_ANOUNT - else - # Legacy creation of registration certificate - ./cardano-cli stake-address registration-certificate \ - --stake-verification-key-file addresses/\${ADDR}-stake.vkey \ - --out-file addresses/\${ADDR}-stake.reg.cert - fi + # Conway specific creation of registration certificate + ./cardano-cli \${CURRENT_CARDANO_ERA} stake-address registration-certificate \ + --stake-verification-key-file addresses/\${ADDR}-stake.vkey \ + --out-file addresses/\${ADDR}-stake.reg.cert \ + --key-reg-deposit-amt \$KEY_REGISTRATION_DEPOSIT_ANOUNT else # Legacy creation of registration certificate ./cardano-cli stake-address registration-certificate \ @@ -62,14 +65,14 @@ EOF # User N will delegate to pool N for N in ${POOL_NODES_N}; do cat >> delegate.sh < Date: Fri, 15 Mar 2024 10:40:03 +0100 Subject: [PATCH 09/13] chore: bump default Cardano version to '8.9.0' in Docker images --- mithril-aggregator/Dockerfile | 2 +- mithril-aggregator/Dockerfile.ci | 2 +- mithril-signer/Dockerfile | 2 +- mithril-signer/Dockerfile.ci | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mithril-aggregator/Dockerfile b/mithril-aggregator/Dockerfile index 93d4b9f51c2..d219859a3e8 100644 --- a/mithril-aggregator/Dockerfile +++ b/mithril-aggregator/Dockerfile @@ -32,7 +32,7 @@ RUN /app/target/release/mithril-aggregator --version FROM debian:11-slim # Args -ARG CARDANO_NODE_VERSION=8.7.3 +ARG CARDANO_NODE_VERSION=8.9.0 ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz # Upgrade diff --git a/mithril-aggregator/Dockerfile.ci b/mithril-aggregator/Dockerfile.ci index 1c915ec2121..b1bf00e60d8 100644 --- a/mithril-aggregator/Dockerfile.ci +++ b/mithril-aggregator/Dockerfile.ci @@ -14,7 +14,7 @@ RUN mkdir -p /app/bin RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && apt-get clean && rm -rf /var/lib/apt/lists/* # Install cardano-cli -ARG CARDANO_NODE_VERSION=8.7.3 +ARG CARDANO_NODE_VERSION=8.9.0 ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz RUN wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL \ && (tar xzf cardano-bin.tar.gz ./bin/cardano-cli && mv /bin/cardano-cli /app/bin) || (tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin) \ diff --git a/mithril-signer/Dockerfile b/mithril-signer/Dockerfile index bdf8acb2f64..376e76b7578 100644 --- a/mithril-signer/Dockerfile +++ b/mithril-signer/Dockerfile @@ -33,7 +33,7 @@ RUN /app/target/release/mithril-signer --version FROM debian:11-slim # Args -ARG CARDANO_NODE_VERSION=8.7.3 +ARG CARDANO_NODE_VERSION=8.9.0 ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz # Upgrade diff --git a/mithril-signer/Dockerfile.ci b/mithril-signer/Dockerfile.ci index 78edd376aed..eb9a63d04d7 100644 --- a/mithril-signer/Dockerfile.ci +++ b/mithril-signer/Dockerfile.ci @@ -14,7 +14,7 @@ RUN mkdir -p /app/bin RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && apt-get clean && rm -rf /var/lib/apt/lists/* # Install cardano-cli -ARG CARDANO_NODE_VERSION=8.7.3 +ARG CARDANO_NODE_VERSION=8.9.0 ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz RUN wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL \ && (tar xzf cardano-bin.tar.gz ./bin/cardano-cli && mv /bin/cardano-cli /app/bin) || (tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin) \ From ad216ad36e08af2038834ca8790d5283343c07e2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Fri, 15 Mar 2024 10:41:20 +0100 Subject: [PATCH 10/13] chore: bump default Cardano version to '8.9.0' in e2e test --- mithril-test-lab/mithril-end-to-end/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril-test-lab/mithril-end-to-end/src/main.rs b/mithril-test-lab/mithril-end-to-end/src/main.rs index 234576b6bdc..298b70528c0 100644 --- a/mithril-test-lab/mithril-end-to-end/src/main.rs +++ b/mithril-test-lab/mithril-end-to-end/src/main.rs @@ -57,7 +57,7 @@ pub struct Args { cardano_epoch_length: f64, /// Cardano node version - #[clap(long, default_value = "8.7.3")] + #[clap(long, default_value = "8.9.0")] cardano_node_version: String, /// Epoch at which hard fork to the latest Cardano era will be made (starts with the latest era by default) From c8e53b3273adad4302849f5b5d31896d4fac7f7f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Fri, 15 Mar 2024 11:03:39 +0100 Subject: [PATCH 11/13] fix: add missing network in compatibility table --- .github/workflows/ci.yml | 2 +- .github/workflows/pre-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f7ea671d4e..f640791af14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -527,7 +527,7 @@ jobs: version-name: unstable-${{ steps.slug.outputs.sha8 }} download-url-base: ${{ github.server_url }}/${{ github.repository }}/releases/download/unstable gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }} - compatibility-table: '{ "release-mainnet": "⛔", "release-preprod": "⛔", "pre-release-preview": "⛔", "testing-preview": "✔" }' + compatibility-table: '{ "release-mainnet": "⛔", "release-preprod": "⛔", "pre-release-preview": "⛔", "testing-preview": "✔", "testing-sanchonet": "✔" }' - name: Update unstable release uses: marvinpinto/action-automatic-releases@latest diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 9e6e4ab8825..de4a4031541 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -64,7 +64,7 @@ jobs: version-name: ${{ github.ref_name }} download-url-base: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }} gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }} - compatibility-table: '{ "release-mainnet": "⛔", "release-preprod": "⛔", "pre-release-preview": "✔", "testing-preview": "✔" }' + compatibility-table: '{ "release-mainnet": "⛔", "release-preprod": "⛔", "pre-release-preview": "✔", "testing-preview": "✔", "testing-sanchonet": "✔" }' - name: Create pre-release ${{ github.ref_name }} uses: marvinpinto/action-automatic-releases@latest From d127ce0567439cc512f5c7871424395e00463888 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Fri, 15 Mar 2024 13:22:14 +0100 Subject: [PATCH 12/13] chore: update '8.8.0-pre' to '8.8.1-pre' in e2e in CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f640791af14..1d2d96146b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -266,7 +266,7 @@ jobs: matrix: mode: [ "std" ] era: ${{ fromJSON(needs.build-ubuntu-X64.outputs.eras) }} - cardano_node_version: [ "8.7.3", "8.8.0-pre", "8.9.0" ] + cardano_node_version: [ "8.7.3", "8.8.1-pre", "8.9.0" ] hard_fork_latest_era_at_epoch: [ 0,10,100 ] run_id: [ "#1" ] extra_args: [ "" ] From b3c6c0ab260e03da352b8538a1aa0b7f94e5d7cd Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Fri, 15 Mar 2024 13:25:06 +0100 Subject: [PATCH 13/13] chore: bump crates versions - 'mithril-infra' from '0.2.11' to '0.2.12' - 'mithril-devnet' from '0.3.2' to '0.3.3' - 'mithril-end-to-end' from '0.4.5' to '0.4.6' --- Cargo.lock | 2 +- mithril-infra/assets/infra.version | 2 +- mithril-test-lab/mithril-devnet/VERSION | 2 +- mithril-test-lab/mithril-end-to-end/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77cf2d95ed4..8d8e8f04aa7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3555,7 +3555,7 @@ dependencies = [ [[package]] name = "mithril-end-to-end" -version = "0.4.5" +version = "0.4.6" dependencies = [ "anyhow", "async-recursion", diff --git a/mithril-infra/assets/infra.version b/mithril-infra/assets/infra.version index d3b5ba4bfc3..f2722b13396 100644 --- a/mithril-infra/assets/infra.version +++ b/mithril-infra/assets/infra.version @@ -1 +1 @@ -0.2.11 +0.2.12 diff --git a/mithril-test-lab/mithril-devnet/VERSION b/mithril-test-lab/mithril-devnet/VERSION index d15723fbe8d..1c09c74e221 100644 --- a/mithril-test-lab/mithril-devnet/VERSION +++ b/mithril-test-lab/mithril-devnet/VERSION @@ -1 +1 @@ -0.3.2 +0.3.3 diff --git a/mithril-test-lab/mithril-end-to-end/Cargo.toml b/mithril-test-lab/mithril-end-to-end/Cargo.toml index 3b5d4361f64..3d7fe7cf0c7 100644 --- a/mithril-test-lab/mithril-end-to-end/Cargo.toml +++ b/mithril-test-lab/mithril-end-to-end/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mithril-end-to-end" -version = "0.4.5" +version = "0.4.6" authors = { workspace = true } edition = { workspace = true } documentation = { workspace = true }