Skip to content

Commit 65f75a5

Browse files
authored
Use correct version of hydra-node for script publishing (#1625)
This fixes the network tests by using the repo-version of hydra-node (i.e. the same one as the docker images that are run eventually, via the docker-compose-netem.yaml file.)
2 parents 6c30e32 + 67ef048 commit 65f75a5

File tree

4 files changed

+51
-75
lines changed

4 files changed

+51
-75
lines changed

.github/workflows/network-test.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,20 @@ jobs:
6767
sleep 5
6868
# :tear: socket permissions.
6969
sudo chown runner:docker devnet/node.socket
70-
./export-tx-id-and-pparams.sh
70+
71+
HYDRA_SCRIPTS_TX_ID=$(nix run .#hydra-node -- publish-scripts \
72+
--testnet-magic 42 \
73+
--node-socket devnet/node.socket \
74+
--cardano-signing-key devnet/credentials/faucet.sk)
75+
76+
echo $HYDRA_SCRIPTS_TX_ID >> .env
77+
78+
nix run .#cardano-cli query protocol-parameters \
79+
--socket-path devnet/node.socket \
80+
--out-file /dev/stdout \
81+
| jq ".txFeeFixed = 0 | .txFeePerByte = 0 | .executionUnitPrices.priceMemory = 0 | .executionUnitPrices.priceSteps = 0" \
82+
> devnet/protocol-parameters.json
83+
7184
# Specify two docker compose yamls; the second one overrides the
7285
# images to use the netem ones specifically
7386
docker compose -f docker-compose.yaml -f docker-compose-netem.yaml up -d hydra-node-{1,2,3}

demo/export-tx-id-and-pparams.sh

Lines changed: 0 additions & 71 deletions
This file was deleted.

demo/seed-devnet.sh

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ function ccli_() {
4343
fi
4444
}
4545

46+
# Invoke hydra-node in a container or via provided executable
47+
function hnode() {
48+
if [[ -n ${HYDRA_NODE_CMD} ]]; then
49+
${HYDRA_NODE_CMD} ${@}
50+
else
51+
docker run --rm -it \
52+
--pull always \
53+
-v ${SCRIPT_DIR}/devnet:/devnet \
54+
ghcr.io/cardano-scaling/hydra-node:0.18.1 -- ${@}
55+
fi
56+
}
57+
4658
# Retrieve some lovelace from faucet
4759
function seedFaucet() {
4860
ACTOR=${1}
@@ -77,6 +89,26 @@ function seedFaucet() {
7789
echo >&2 "Done"
7890
}
7991

92+
function publishReferenceScripts() {
93+
echo >&2 "Publishing reference scripts..."
94+
hnode publish-scripts \
95+
--testnet-magic ${NETWORK_ID} \
96+
--node-socket ${DEVNET_DIR}/node.socket \
97+
--cardano-signing-key devnet/credentials/faucet.sk
98+
}
99+
100+
function queryPParams() {
101+
echo >&2 "Query Protocol parameters"
102+
if [[ -x ${CCLI_CMD} ]]; then
103+
ccli query protocol-parameters --socket-path ${DEVNET_DIR}/node.socket --out-file /dev/stdout \
104+
| jq ".txFeeFixed = 0 | .txFeePerByte = 0 | .executionUnitPrices.priceMemory = 0 | .executionUnitPrices.priceSteps = 0" > devnet/protocol-parameters.json
105+
else
106+
docker exec demo-cardano-node-1 cardano-cli query protocol-parameters --testnet-magic ${NETWORK_ID} --socket-path ${DEVNET_DIR}/node.socket --out-file /dev/stdout \
107+
| jq ".txFeeFixed = 0 | .txFeePerByte = 0 | .executionUnitPrices.priceMemory = 0 | .executionUnitPrices.priceSteps = 0" > devnet/protocol-parameters.json
108+
fi
109+
echo >&2 "Saved in protocol-parameters.json"
110+
}
111+
80112
echo >&2 "Fueling up hydra nodes of alice, bob and carol..."
81113
seedFaucet "alice" 30000000 # 30 Ada to the node
82114
seedFaucet "bob" 30000000 # 30 Ada to the node
@@ -85,5 +117,7 @@ echo >&2 "Distributing funds to alice, bob and carol..."
85117
seedFaucet "alice-funds" 100000000 # 100 Ada to commit
86118
seedFaucet "bob-funds" 50000000 # 50 Ada to commit
87119
seedFaucet "carol-funds" 25000000 # 25 Ada to commit
88-
89-
./export-tx-id-and-pparams.sh
120+
queryPParams
121+
echo "HYDRA_SCRIPTS_TX_ID=$(publishReferenceScripts)" > .env
122+
echo >&2 "Environment variable stored in '.env'"
123+
echo >&2 -e "\n\t$(cat .env)\n"

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
x.components."${y}") [ "benchmarks" "exes" "sublibs" "tests" ]);
127127
in
128128
{
129-
legacyPackages = hsPkgs;
129+
legacyPackages = pkgs // hsPkgs;
130130

131131
packages =
132132
hydraPackages //

0 commit comments

Comments
 (0)