diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eefe4a3ded0..1d2d96146b0 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.1-pre", "8.9.0" ] 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" @@ -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 diff --git a/Cargo.lock b/Cargo.lock index cc12a443e5e..677be164de3 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-aggregator/Dockerfile b/mithril-aggregator/Dockerfile index e71c298da44..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 @@ -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..b1bf00e60d8 100644 --- a/mithril-aggregator/Dockerfile.ci +++ b/mithril-aggregator/Dockerfile.ci @@ -14,10 +14,10 @@ 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 ./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-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-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-signer/Dockerfile b/mithril-signer/Dockerfile index 18ef826d81c..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 @@ -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..eb9a63d04d7 100644 --- a/mithril-signer/Dockerfile.ci +++ b/mithril-signer/Dockerfile.ci @@ -14,10 +14,10 @@ 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 ./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-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh index 0291b136fa4..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";; @@ -72,11 +83,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 [ $(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 + cp $SCRIPT_DIRECTORY/configuration/byron/configuration.yaml "${ARTIFACTS_DIR_TEMP}/" $SED -i "${ARTIFACTS_DIR_TEMP}/configuration.yaml" \ -e 's/Protocol: RealPBFT/Protocol: Cardano/' \ @@ -188,18 +205,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-init.sh b/mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh index fcf8f470c84..2c1799f9ad6 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 @@ -66,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 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..cc91916fd3d 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,68 @@ 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}" - + +# Is semver on the first argument strictly lower than 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 +} + +# 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" ] && [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then + KEY_REGISTRATION_DEPOSIT_ANOUNT=0 + # 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 +done + EOF +# User N will delegate to pool N +for N in ${POOL_NODES_N}; do + cat >> delegate.sh <> delegate.sh <