Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add another v-function in local-env #477

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion dev/local-environment/configurations/cardano/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -89,8 +89,16 @@ echo "New address created: $new_address"

dave_address="addr_test1vphpcf32drhhznv6rqmrmgpuwq06kug0lkg22ux777rtlqst2er0r"
eve_address="addr_test1vzzt5pwz3pum9xdgxalxyy52m3aqur0n43pcl727l37ggscl8h7v8"

# An address that will keep an UTXO with script of a test V-function, related to the SPO rewards. See v-function.script file.
vfunction_address="addr_test1vzuasm5nqzh7n909f7wang7apjprpg29l2f9sk6shlt84rqep6nyc"
# total-accrued-function-script-hash (cardano-cli latest transaction policyid --script-file v-function.script)
# ef1eb7b85327a8460799025a5affd0a8d8015731e9aacd5d1106a82b

# updated vfunction address (cardano-cli address build --payment-script-file v-function-updated.script --testnet-magic 42):
vfunction_updated_address="addr_test1wpxhte72udea5ag3umnaukjmyjp8ywsgn2z6alkmhv42nxqcv2vwc"
# total-accrued-function-script-hash (cardano-cli latest transaction policyid --script-file v-function-updated.script)
# 4d75e7cae373da7511e6e7de5a5b2482723a089a85aefedbbb2aa998

# Define the UTXO details and amounts
tx_in1="781cb948a37c7c38b43872af9b1e22135a94826eafd3740260a6db0a303885d8#0"
@@ -104,9 +112,10 @@ tx_out4=1000000000 # partner-chains-node-5 (eve)
tx_out5_lovelace=10000000
tx_out5_reward_token="1000000 $reward_token_policy_id.$reward_token_asset_name"
tx_out6=10000000
tx_out7=10000000

# Total output without fee
total_output=$((tx_out1 + tx_out2 + tx_out3 + tx_out4 + tx_out5_lovelace + tx_out6))
total_output=$((tx_out1 + tx_out2 + tx_out3 + tx_out4 + tx_out5_lovelace + tx_out6 + tx_out7))

fee=1000000

@@ -124,6 +133,8 @@ cardano-cli latest transaction build-raw \
--tx-out "$new_address+$tx_out5_lovelace+$tx_out5_reward_token" \
--tx-out "$vfunction_address+$tx_out6" \
--tx-out-reference-script-file /shared/v-function.script \
--tx-out "$vfunction_updated_address+$tx_out7" \
--tx-out-reference-script-file /shared/v-function-updated.script \
--minting-script-file /shared/reward_token_policy.script \
--mint "$tx_out5_reward_token" \
--fee $fee \
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PlutusScriptV2",
"description": "V-function that allows to release one token each minute since 2025-02-07 10:46 UTC (timestamp 1738925213000)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use something round, like 1st Feb, to make calculations easier? After all humans are supposed to use this setup. If this is only for E2E, then it should be moved there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I'll move it then

"cborHex": "59072a59072701000033233223222253232335332232353232325333573466e1d20000021323232323232332212330010030023232325333573466e1d2000002132323232323232323232332323233323333323332332332222222222221233333333333300100d00c00b00a00900800700600500400300230013574202460026ae84044c00c8c8c8c94ccd5cd19b87480000084cc8848cc00400c008c070d5d080098029aba135744002260489201035054310035573c0046aae74004dd5000998018009aba100f23232325333573466e1d20000021323232333322221233330010050040030023232325333573466e1d20000021332212330010030023020357420026600803e6ae84d5d100089814a481035054310035573c0046aae74004dd51aba1004300835742006646464a666ae68cdc3a4000004224440062a666ae68cdc3a4004004264244460020086eb8d5d08008a999ab9a3370e9002001099091118010021aba100113029491035054310035573c0046aae74004dd51aba10023300175c6ae84d5d1001111919192999ab9a3370e900100108910008a999ab9a3370e9000001099091180100198029aba10011302a491035054310035573c0046aae74004dd50009aba20013574400226046921035054310035573c0046aae74004dd500098009aba100d30013574201860046004eb4cc00404cd5d080519980200a3ad35742012646464a666ae68cdc3a40000042646466442466002006004646464a666ae68cdc3a40000042664424660020060046600aeb4d5d080098021aba1357440022604c921035054310035573c0046aae74004dd51aba10033232325333573466e1d20000021332212330010030023300575a6ae84004c010d5d09aba2001130264901035054310035573c0046aae74004dd51aba1357440064646464a666ae68cdc3a400000420482a666ae68cdc3a4004004204a2604c921035054310035573c0046aae74004dd5000911919192999ab9a3370e9000001089110010a999ab9a3370e90010010990911180180218029aba100115333573466e1d20040021122200113026491035054310035573c0046aae74004dd500089810a49035054310035573c0046aae74004dd51aba10083300175c6ae8401c8c88c008dd60009813111999aab9f0012028233502730043574200460066ae88008084ccc00c044008d5d0802998008011aba1004300275c40024464460046eac004c09088cccd55cf800901311919a8131991091980080180118031aab9d001300535573c00260086ae8800cd5d080100f98099aba1357440026ae88004d5d10009aba2001357440026ae88004d5d10009aba2001357440026ae88004d5d100089808249035054310035573c0046aae74004dd51aba10073001357426ae8801c8c8c8c94ccd5cd19b87480000084c848888c00c014dd71aba100115333573466e1d20020021321222230010053008357420022a666ae68cdc3a400800426424444600400a600c6ae8400454ccd5cd19b87480180084c848888c010014c014d5d080089808249035054310035573c0046aae74004dd500091919192999ab9a3370e900000109909111111180280418029aba100115333573466e1d20020021321222222230070083005357420022a666ae68cdc3a400800426644244444446600c012010600a6ae84004dd71aba1357440022a666ae68cdc3a400c0042664424444444660040120106eb8d5d08009bae357426ae8800454ccd5cd19b87480200084cc8848888888cc004024020dd71aba1001375a6ae84d5d10008a999ab9a3370e90050010891111110020a999ab9a3370e900600108911111100189807a49035054310035573c0046aae74004dd500091919192999ab9a3370e9000001099091180100198029aba100115333573466e1d2002002132333222122333001005004003375a6ae84008dd69aba1001375a6ae84d5d10009aba20011300e4901035054310035573c0046aae74004dd500091919192999ab9a3370e900000109909118010019bae357420022a666ae68cdc3a400400426424460020066eb8d5d080089806a481035054310035573c0046aae74004dd500091919192999ab9a3370e900000109991091980080180118029aba1001375a6ae84d5d1000898062481035054310035573c0046aae74004dd500091919192999ab9a3370e900000109bae3574200226016921035054310035573c0046aae74004dd500089803a49035054310035573c0046aae74004dd5003111999a8009002919199ab9a337126602044a66a002290001109a801112999ab9a3371e004010260260022600c006600244444444444401066e0ccdc09a9a980091111111111100291001112999a80110a99a80108008b0b0b002a4181520e00e00ca006400a400a6eb401c48800848800440084c00524010350543500232633573800200424002600644a66a002290001109a8011119b800013006003122002122122330010040032323001001223300330020020014c01091b00000194e00505480001"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "PlutusScriptV2",
"description": "V-function that allows to release one token each minute since 2025-01-01 00:00 UTC (timestamp 1735689600)",
"description": "V-function that allows to release one token each minute since 1975-07-02 21:36 UTC (timestamp 000173568960)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh boy, I wish it was a fix in the function body, not in the description

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm automating some e2e tests for it. I'll probably add more v-functions and replace that with 01-01-2025 date

"cborHex": "59072659072301000033233223222253232335332232353232325333573466e1d20000021323232323232332212330010030023232325333573466e1d2000002132323232323232323232332323233323333323332332332222222222221233333333333300100d00c00b00a00900800700600500400300230013574202460026ae84044c00c8c8c8c94ccd5cd19b87480000084cc8848cc00400c008c070d5d080098029aba135744002260489201035054310035573c0046aae74004dd5000998018009aba100f23232325333573466e1d20000021323232333322221233330010050040030023232325333573466e1d20000021332212330010030023020357420026600803e6ae84d5d100089814a481035054310035573c0046aae74004dd51aba1004300835742006646464a666ae68cdc3a4000004224440062a666ae68cdc3a4004004264244460020086eb8d5d08008a999ab9a3370e9002001099091118010021aba100113029491035054310035573c0046aae74004dd51aba10023300175c6ae84d5d1001111919192999ab9a3370e900100108910008a999ab9a3370e9000001099091180100198029aba10011302a491035054310035573c0046aae74004dd50009aba20013574400226046921035054310035573c0046aae74004dd500098009aba100d30013574201860046004eb4cc00404cd5d080519980200a3ad35742012646464a666ae68cdc3a40000042646466442466002006004646464a666ae68cdc3a40000042664424660020060046600aeb4d5d080098021aba1357440022604c921035054310035573c0046aae74004dd51aba10033232325333573466e1d20000021332212330010030023300575a6ae84004c010d5d09aba2001130264901035054310035573c0046aae74004dd51aba1357440064646464a666ae68cdc3a400000420482a666ae68cdc3a4004004204a2604c921035054310035573c0046aae74004dd5000911919192999ab9a3370e9000001089110010a999ab9a3370e90010010990911180180218029aba100115333573466e1d20040021122200113026491035054310035573c0046aae74004dd500089810a49035054310035573c0046aae74004dd51aba10083300175c6ae8401c8c88c008dd60009813111999aab9f0012028233502730043574200460066ae88008084ccc00c044008d5d0802998008011aba1004300275c40024464460046eac004c09088cccd55cf800901311919a8131991091980080180118031aab9d001300535573c00260086ae8800cd5d080100f98099aba1357440026ae88004d5d10009aba2001357440026ae88004d5d10009aba2001357440026ae88004d5d100089808249035054310035573c0046aae74004dd51aba10073001357426ae8801c8c8c8c94ccd5cd19b87480000084c848888c00c014dd71aba100115333573466e1d20020021321222230010053008357420022a666ae68cdc3a400800426424444600400a600c6ae8400454ccd5cd19b87480180084c848888c010014c014d5d080089808249035054310035573c0046aae74004dd500091919192999ab9a3370e900000109909111111180280418029aba100115333573466e1d20020021321222222230070083005357420022a666ae68cdc3a400800426644244444446600c012010600a6ae84004dd71aba1357440022a666ae68cdc3a400c0042664424444444660040120106eb8d5d08009bae357426ae8800454ccd5cd19b87480200084cc8848888888cc004024020dd71aba1001375a6ae84d5d10008a999ab9a3370e90050010891111110020a999ab9a3370e900600108911111100189807a49035054310035573c0046aae74004dd500091919192999ab9a3370e9000001099091180100198029aba100115333573466e1d2002002132333222122333001005004003375a6ae84008dd69aba1001375a6ae84d5d10009aba20011300e4901035054310035573c0046aae74004dd500091919192999ab9a3370e900000109909118010019bae357420022a666ae68cdc3a400400426424460020066eb8d5d080089806a481035054310035573c0046aae74004dd500091919192999ab9a3370e900000109991091980080180118029aba1001375a6ae84d5d1000898062481035054310035573c0046aae74004dd500091919192999ab9a3370e900000109bae3574200226016921035054310035573c0046aae74004dd500089803a49035054310035573c0046aae74004dd5003111999a8009002919199ab9a337126602044a66a002290001109a801112999ab9a3371e004010260260022600c006600244444444444401066e0ccdc09a9a980091111111111100291001112999a80110a99a80108008b0b0b002a4181520e00e00ca006400a400a6eb401c48800848800440084c00524010350543500232633573800200424002600644a66a002290001109a8011119b800013006003122002122122330010040032323001001223300330020020014c01051a677485800001"
}
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ echo "Permissioned candidates policy ID: $PERMISSIONED_CANDIDATES_POLICY_ID"
echo "Setting values for NATIVE_TOKEN_POLICY_ID, NATIVE_TOKEN_ASSET_NAME, and ILLIQUID_SUPPLY_VALIDATOR_ADDRESS for chain-spec creation"
export NATIVE_TOKEN_POLICY_ID="1fab25f376bc49a181d03a869ee8eaa3157a3a3d242a619ca7995b2b"
export NATIVE_TOKEN_ASSET_NAME="52657761726420746f6b656e"
export ILLIQUID_SUPPLY_VALIDATOR_ADDRESS="addr_test1wpy8ewg646rg4ce78nl3aassmkquf4wlxcaugqlxwzcylkca0q8v3"
export ILLIQUID_SUPPLY_VALIDATOR_ADDRESS="addr_test1wq0mnff9xtddgxx8wjxt8sx68gxvf06yy2c60tqdgsp8ydsgvu7hq"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it because genesis_utxo changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it in addresses.IlliquidCirculationSupplyValidator field of addresses.json?


echo "Inserting D parameter..."

@@ -203,7 +203,7 @@ jq '.genesis.runtimeGenesis.config.sessionCommitteeManagement.initialAuthorities
}
]' chain-spec.json > tmp.json && mv tmp.json chain-spec.json

echo "Set initial funds to Alice (ecdsa), ?, and Alice (sr25519)"
echo "Setting initial funds to Alice (ecdsa), ?, and Alice (sr25519)"
jq '.genesis.runtimeGenesis.config.balances.balances = [
["5C7C2Z5sWbytvHpuLTvzKunnnRwQxft1jiqrLD5rhucQ5S9X", 1000000000000000],
["5D9eDKbFt4JKaEndQvMmbJYnpX9ENUj8U9UUg1AxSa64FJxE", 1000000000000000],
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
#!/bin/bash

echo "Installing dependencies..."
start_node() {
echo "Starting the node..."
export MC__FIRST_EPOCH_TIMESTAMP_MILLIS=$(cat /shared/MC__FIRST_EPOCH_TIMESTAMP_MILLIS)

/usr/local/bin/partner-chains-node \
--validator \
--chain=/shared/chain-spec.json \
--node-key-file=/data/chains/partner_chains_template/network/secret_ed25519 \
--base-path=/data \
--keystore-path=/data/chains/partner_chains_template/keystore \
--unsafe-rpc-external \
--rpc-port=9933 \
--rpc-cors=all \
--prometheus-port=9615 \
--prometheus-external \
--state-pruning=archive \
--blocks-pruning=archive &
wait
}

if [ -f "/shared/partner-chains-wizard-1.ready" ]; then
echo "/shared/partner-chains-wizard-1.ready exists. Skipping configuration and starting the node..."
start_node
exit 0
fi


echo "Installing dependencies..."
apt -qq update &> /dev/null
apt -qq -y install expect curl jq ncat &> /dev/null

cp /usr/local/bin/partner-chains-node /partner-chains-node

echo "Beginning configuration..."


echo "Beginning configuration..."
echo "Generating keys..."
expect <<EOF
spawn ./partner-chains-node wizards generate-keys
@@ -21,7 +45,6 @@ EOF


echo "Waiting for the Cardano network to sync and for Ogmios to start..."

while true; do
if nc -z ogmios $OGMIOS_PORT; then
break
@@ -50,11 +73,11 @@ send "ogmios\r"
expect "Ogmios port (1337)"
send "\r"
expect "path to the payment verification file (payment.vkey)"
send "keys/funded_address.vkey\r"
send "/keys/funded_address.vkey\r"
expect "Select an UTXO to use as the genesis UTXO"
send "\r"
expect "path to the payment signing key file (payment.skey)"
send "keys/funded_address.skey\r"
send "/keys/funded_address.skey\r"
expect "Do you want to configure a native token for you Partner Chain? (Y/n)"
send "n\r"
expect eof
@@ -63,7 +86,7 @@ EOF

echo "Waiting for permissioned candidate's keys to be generated..."
while true; do
if [ -f "/shared/partner-chains-wizard-2.ready" ]; then
if [ -f "/shared/partner-chains-wizard-2-keys.ready" ]; then
break
else
sleep 1
@@ -108,7 +131,6 @@ echo "Copying chain-spec.json file to /shared/chain-spec.json..."
cp chain-spec.json /shared/chain-spec.json
echo "chain-spec.json generation complete."


echo "Copying pc-chain-config.json file to /shared/pc-chain-config.json..."
cp pc-chain-config.json /shared/pc-chain-config.json

@@ -129,28 +151,21 @@ expect "Ogmios hostname (ogmios)"
send "\r"
expect "Ogmios port (1337)"
send "\r"
expect "path to the payment signing key file (keys/funded_address.skey)"
expect "path to the payment signing key file (/keys/funded_address.skey)"
send "\r"
expect "Do you want to set/update the D-parameter on the main chain? (y/N)"
send "y\r"
expect "Enter P, the number of permissioned candidates seats, as a non-negative integer. (0)"
send "2\r"
expect "Enter R, the number of registered candidates seats, as a non-negative integer. (0)"
send "1\r"
expect "path to the payment signing key file (keys/funded_address.skey)"
expect "path to the payment signing key file (/keys/funded_address.skey)"
send "\r"
expect "Done. Main chain state is set."
expect eof
EOF


touch /shared/partner-chains-wizard-1.ready
echo "Partner Chain configuration is complete, and will be able to start after two mainchain epochs."

echo "Starting the node..."
expect <<EOF
spawn ./partner-chains-node wizards start-node
expect "Proceed? (Y/n)"
send "\r"
set timeout -1
expect eof
EOF
start_node
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
#!/bin/bash

echo "Installing dependencies..."

apt -qq update &> /dev/null
apt -qq -y install expect jq &> /dev/null
cp /usr/local/bin/partner-chains-node /data/partner-chains-node
cd /data

cp /usr/local/bin/partner-chains-node /partner-chains-node

echo "Beginning configuration..."
if [ -f "/shared/partner-chains-wizard-2.ready" ]; then
echo "/shared/partner-chains-wizard-2.ready exists. Skipping configuration and starting the node..."
expect <<EOF
spawn ./partner-chains-node wizards start-node
expect "Proceed? (Y/n)"
send "Y\r"
set timeout -1
expect eof
EOF
exit 0
fi


echo "Beginning configuration..."
echo "Generating keys..."
expect <<EOF
spawn ./partner-chains-node wizards generate-keys
set timeout 60
expect "node base path (./data)"
send "\r"
send ".\r"
expect "All done!"
expect eof
EOF

cp partner-chains-public-keys.json /shared/partner-chains-public-keys.json
touch /shared/partner-chains-wizard-2.ready
touch /shared/partner-chains-wizard-2-keys.ready


echo "Waiting for chain-spec.json and pc-chain-config.json to be ready..."
@@ -33,13 +44,15 @@ while true; do
fi
done

cp /shared/chain-spec.json .
cp /shared/pc-chain-config.json .

cp /shared/chain-spec.json /data/chain-spec.json
cp /shared/pc-chain-config.json /data/pc-chain-config.json

echo "Configuring Node P2P port..."
jq '.node_p2p_port = 30334' pc-resources-config.json > tmp.json && mv tmp.json pc-resources-config.json

touch /shared/partner-chains-wizard-2.ready
echo "Configuration complete."

echo "Starting the node..."
expect <<EOF
spawn ./partner-chains-node wizards start-node
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
#!/bin/bash

echo "Installing dependencies..."

apt -qq update &> /dev/null
apt -qq -y install expect jq &> /dev/null
cp /usr/local/bin/partner-chains-node /data/partner-chains-node
cd /data

cp /usr/local/bin/partner-chains-node /partner-chains-node

echo "Beginning configuration..."
start_node() {
echo "Starting the node..."
expect <<EOF
spawn ./partner-chains-node wizards start-node
expect "Proceed? (Y/n)"
send "Y\r"
set timeout -1
expect eof
EOF
}


if [ -f "/shared/partner-chains-wizard-3.ready" ]; then
echo "/shared/partner-chains-wizard-3.ready exists. Skipping configuration..."
start_node
exit 0
fi


echo "Beginning configuration..."
echo "Generating keys..."
expect <<EOF
spawn ./partner-chains-node wizards generate-keys
set timeout 60
expect "node base path (./data)"
send "\r"
send ".\r"
expect eof
EOF

@@ -29,8 +46,8 @@ while true; do
fi
done

cp /shared/chain-spec.json .
cp /shared/pc-chain-config.json .
cp /shared/chain-spec.json /data/chain-spec.json
cp /shared/pc-chain-config.json /data/pc-chain-config.json


echo "Registering candidate..."
@@ -44,7 +61,7 @@ send "ogmios\r"
expect "Ogmios port (1337)"
send "\r"
expect "path to the payment verification file (payment.vkey)"
send "keys/funded_address.vkey\r"
send "/keys/funded_address.vkey\r"
expect "Select UTXO to use for registration"
send "\r"
expect eof
@@ -61,7 +78,7 @@ register2_output=$(expect <<EOF
spawn $register2_command
set timeout 60
expect "Path to mainchain signing key file (cold.skey)"
send "keys/cold.skey\r"
send "/keys/cold.skey\r"
expect "/partner-chains-node wizards register3"
expect eof
catch wait result
@@ -77,7 +94,7 @@ expect <<EOF
spawn $register3_command
set timeout 300
expect "path to the payment signing key file (payment.skey)"
send "keys/funded_address.skey\r"
send "/keys/funded_address.skey\r"
expect "Ogmios protocol (http/https)"
send "\r"
expect "Ogmios hostname (ogmios)"
@@ -94,13 +111,7 @@ EOF
echo "Configuring Node P2P port..."
jq '.node_p2p_port = 30335' pc-resources-config.json > tmp.json && mv tmp.json pc-resources-config.json

echo "Starting the node..."
expect <<EOF
spawn ./partner-chains-node wizards start-node
expect "Proceed? (Y/n)"
send "Y\r"
set timeout -1
expect eof
EOF
touch /shared/partner-chains-wizard-3.ready
echo "Registration complete."

# tail -f /dev/null
start_node
1 change: 1 addition & 0 deletions dev/local-environment/modules/cardano.txt
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
- ./configurations/cardano/keys/op.cert:/keys/node.cert
- ./configurations/cardano/reward_token_policy.script:/shared/reward_token_policy.script
- ./configurations/cardano/v-function.script:/shared/v-function.script
- ./configurations/cardano/v-function-updated.script:/shared/v-function-updated.script
- ./configurations/cardano/config-pool1.json:/shared/node-1-config.json.base
- ./configurations/db-sync/config.json:/shared/db-sync-config.json.base
- ./configurations/genesis/byron/genesis.json:/shared/byron/genesis.json.base
25 changes: 15 additions & 10 deletions dev/local-environment/modules/partner-chains-wizard.txt
Original file line number Diff line number Diff line change
@@ -6,16 +6,25 @@
user: "0:0"
volumes:
- shared-volume:/shared
- partner-chains-node-1-data:/data
- ./configurations/cardano/keys/funded_address.skey:/keys/funded_address.skey
- ./configurations/cardano/keys/funded_address.vkey:/keys/funded_address.vkey
- ./configurations/wizard/governance-authority/entrypoint.sh:/entrypoint.sh
environment:
- OGMIOS_PORT=${OGMIOS_PORT}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
OGMIOS_PORT: ${OGMIOS_PORT}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
DB_SYNC_POSTGRES_CONNECTION_STRING: "postgres://postgres:${POSTGRES_PASSWORD}@postgres:${POSTGRES_PORT}/cexplorer"
SIDECHAIN_BLOCK_BENEFICIARY: "0000000000000000000000000000000000000000000000000000000000000001"
CARDANO_SECURITY_PARAMETER: "5"
CARDANO_ACTIVE_SLOTS_COEFF: "0.4"
MC__FIRST_EPOCH_NUMBER: "0"
MC__FIRST_SLOT_NUMBER: "0"
MC__EPOCH_DURATION_MILLIS: "120000"
BLOCK_STABILITY_MARGIN: "0"
ports:
- "30333:30333"
- "9933:9944"
- "9933:9933"
entrypoint: ["/bin/bash", "/entrypoint.sh"]

partner-chains-wizard-2:
@@ -25,13 +34,11 @@
user: "0:0"
volumes:
- shared-volume:/shared
- partner-chains-node-2-data:/data
- ./configurations/wizard/permissioned/entrypoint.sh:/entrypoint.sh
environment:
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ports:
- "30334:30334"
- "9934:9944"
entrypoint: ["/bin/bash", "/entrypoint.sh"]

partner-chains-wizard-3:
@@ -41,6 +48,7 @@
user: "0:0"
volumes:
- shared-volume:/shared
- partner-chains-node-3-data:/data
- ./configurations/cardano/keys/funded_address.skey:/keys/funded_address.skey
- ./configurations/cardano/keys/funded_address.vkey:/keys/funded_address.vkey
- ./configurations/cardano/keys/cold.skey:/keys/cold.skey
@@ -49,7 +57,4 @@
environment:
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ports:
- "30335:30335"
- "9935:9944"
entrypoint: ["/bin/bash", "/entrypoint.sh"]
2 changes: 1 addition & 1 deletion e2e-tests/config/substrate/local_nodes.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"deployment_mc_epoch": 2,
"genesis_utxo": "f8fbe7316561e57de9ecd1c86ee8f8b512a314ba86499ba9a584bfa8fe2edc8d#0",
"genesis_utxo": "34899a3bdf82f3f6257a7018a0dd5d73065feb8aee8f91c803b1626048d3c0a7#0",
"main_chain": {
"network": "--testnet-magic 42",
"epoch_length": 120,
4 changes: 4 additions & 0 deletions e2e-tests/config/substrate/staging-ci.json
Original file line number Diff line number Diff line change
@@ -16,6 +16,10 @@
"validator-4": {
"host": "staging-preview-validator-4-service.staging-preview.svc.cluster.local",
"port": "${nodes_config[default_port]}"
},
"validator-5": {
"host": "staging-preview-validator-5-service.staging-preview.svc.cluster.local",
"port": "${nodes_config[default_port]}"
}
}
},
10 changes: 5 additions & 5 deletions e2e-tests/config/substrate/staging_nodes.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
"nodes": {
"validator-1": {
"host": "10.0.10.90",
"port": "30621",
"port": "30321",
"aura_ss58_address": "5GHLr2zBDNPXno9XdKgh541uRSiTxnZyzFcr4jK6HUbHMpit",
"pool_id": "da74fc8256d15c7ab3370a6ca28398986cb97c32e9ef66026ac61e99",
"public_key": "0x03b827f4da9711bab7292e5695576a841a4d20af9a07b1ba7a230168d2a78e9df4",
@@ -26,7 +26,7 @@
},
"validator-2": {
"host": "10.0.10.90",
"port": "30622",
"port": "30322",
"aura_ss58_address": "5DHbxU687f1Y3x8yBCWMtqSiJ5qt2yrxQPXNXZNNDaFtmXKv",
"pool_id": "eaed153a8b046770cfd094ee72d080ea682188e63ac11937e3f7f827",
"public_key": "0x02ef5bcd94d54a18ad199559782cd72ac3ccd850976aaaafbca8f9d2625afbf7c4",
@@ -44,7 +44,7 @@
},
"validator-3": {
"host": "10.0.10.90",
"port": "30623",
"port": "30323",
"aura_ss58_address": "5FYtL6HccYhk6KZeFP7hNnkMaXrAwVpTHJWsfnNJcu8AM6in",
"pool_id": "7dfba85597a867fffa59037df7f6adcd50e745dcceac2b48eda94b20",
"public_key": "0x02f2762ab6e1a125dc03908a7b738f8023d13763f28a11d7633c6c8bc463478430",
@@ -62,7 +62,7 @@
},
"validator-4": {
"host": "10.0.10.90",
"port": "30624",
"port": "30324",
"aura_ss58_address": "5GVpqdtqjxqUjuVKMkmh8ehSwcs2nXjpvzHqjouZXMJAyC4b",
"pool_id": "2a3f5dd02da1310e081f2367412e02b72baad3e2a5045f62df2c78c5",
"public_key": "0x025e19f82c5e2bac5e8869d49ff26359e442628bc5cfa38eeb5275f43d04015da8",
@@ -80,7 +80,7 @@
},
"validator-5": {
"host": "10.0.10.90",
"port": "30625",
"port": "30325",
"aura_ss58_address": "5DsfhT7HJe6i5LYeKBzefrXijW5UgPsn2Cuyw5WMa4uEktTn",
"pool_id": "ae81beee7a6c3fa13bba811f91f63ebdd7eb25dd8a62476d4996de10",
"public_key": "0x03f38a062a4b372c045c1dddc4fe98a2c9cb1d6eec8bf02f973fd29b1096cd8155",
34 changes: 23 additions & 11 deletions e2e-tests/src/substrate_api.py
Original file line number Diff line number Diff line change
@@ -280,33 +280,37 @@ def read_cardano_key_file(self, filepath) -> str:
def update_d_param(self, permissioned_candidates_count, registered_candidates_count):
signing_key = self.config.nodes_config.governance_authority.mainchain_key

tx_id = self.partner_chains_node.smart_contracts.update_d_param(
response = self.partner_chains_node.smart_contracts.update_d_param(
permissioned_candidates_count, registered_candidates_count, signing_key
)
tx_id = response.transaction_id
effective_in_mc_epoch = self._effective_in_mc_epoch()

if tx_id and effective_in_mc_epoch:
if tx_id:
logger.info(
f"Update of D Param of P: {permissioned_candidates_count} and R: {registered_candidates_count} "
f" was successful and will take effect in {effective_in_mc_epoch} epoch. Transaction id: {tx_id}"
)
return True, effective_in_mc_epoch
else:
logger.error(f"Update of D Param failed, STDOUT: {response.stdout}, STDERR: {response.stderr}")
return False, None

def upsert_permissioned_candidates(self, new_candidates_list):
txId = self.partner_chains_node.smart_contracts.upsert_permissioned_candidates(
response = self.partner_chains_node.smart_contracts.upsert_permissioned_candidates(
self.config.nodes_config.governance_authority.mainchain_key, new_candidates_list
)
tx_id = response.transaction_id
effective_in_mc_epoch = self._effective_in_mc_epoch()

if txId and effective_in_mc_epoch:
if tx_id:
logger.info(
f"Success! New permissioned candidates are set and will be effective in "
f"{effective_in_mc_epoch} MC epoch. Transaction id: {txId}"
f"{effective_in_mc_epoch} MC epoch. Transaction id: {tx_id}"
)
return True, effective_in_mc_epoch
else:
logger.error(f"Upsert permissioned candidates failed, STDOUT: {response.stdout}, STDERR: {response.stderr}")
return False, None

def register_candidate(self, candidate_name):
@@ -324,37 +328,45 @@ def register_candidate(self, candidate_name):
self.config.nodes_config.nodes[candidate_name].grandpa_public_key,
)

txId = self.partner_chains_node.smart_contracts.register(
response = self.partner_chains_node.smart_contracts.register(
signatures,
keys_files.cardano_payment_key,
self.read_cardano_key_file(keys_files.spo_public_key),
registration_utxo,
)
tx_id = response.transaction_id
effective_in_mc_epoch = self._effective_in_mc_epoch()

if txId and effective_in_mc_epoch:
if tx_id:
logger.info(
f"Registration of {candidate_name} was successful and will take effect in "
f"{effective_in_mc_epoch} MC epoch. Transaction id: {txId}"
f"{effective_in_mc_epoch} MC epoch. Transaction id: {tx_id}"
)
return True, effective_in_mc_epoch
else:
logger.error(
f"Registration of {candidate_name} failed, STDOUT: {response.stdout}, STDERR: {response.stderr}"
)
return False, None

def deregister_candidate(self, candidate_name):
keys_files = self.config.nodes_config.nodes[candidate_name].keys_files
txId = self.partner_chains_node.smart_contracts.deregister(
response = self.partner_chains_node.smart_contracts.deregister(
keys_files.cardano_payment_key, self.read_cardano_key_file(keys_files.spo_public_key)
)
tx_id = response.transaction_id
effective_in_mc_epoch = self._effective_in_mc_epoch()

if txId and effective_in_mc_epoch:
if tx_id:
logger.info(
f"Deregistration of {candidate_name} was successful and will take effect in "
f"{effective_in_mc_epoch} MC epoch. Transaction id: {txId}"
f"{effective_in_mc_epoch} MC epoch. Transaction id: {tx_id}"
)
return True, effective_in_mc_epoch
else:
logger.error(
f"Deregistration of {candidate_name} failed, STDOUT: {response.stdout}, STDERR: {response.stderr}"
)
return False, None

def get_pc_epoch(self):
3 changes: 2 additions & 1 deletion e2e-tests/tests/committee/test_committee.py
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ class TestCommitteeDistribution:
@mark.committee_distribution
@mark.ariadne
@mark.xdist_group("governance_action")
@mark.usefixtures("governance_skey_with_cli")
def test_update_d_param(
self,
api: BlockchainApi,
@@ -73,7 +74,7 @@ def test_update_d_param(
result, mc_epoch = api.update_d_param(
new_d_param.permissioned_candidates_number, new_d_param.trustless_candidates_number
)
assert result, "D-param update failed"
assert result, "D-param transaction id is empty. Check command output for errors."

# FIXME: ETCM-8945 - create and use wait_for_transaction function instead of wait_for_next_pc_block
api.wait_for_next_pc_block()
5 changes: 5 additions & 0 deletions toolkit/partner-chains-cli/src/config.rs
Original file line number Diff line number Diff line change
@@ -272,9 +272,14 @@ pub struct CardanoParameters {
pub first_slot_number: u64,
pub epoch_duration_millis: u64,
pub first_epoch_timestamp_millis: u64,
#[serde(default = "default_slot_duration_millis")]
pub slot_duration_millis: u64,
}

fn default_slot_duration_millis() -> u64 {
1000
}

impl CardanoParameters {
pub fn save(&self, context: &impl IOContext) {
CARDANO_SECURITY_PARAMETER.save_to_file(&self.security_parameter, context);