Skip to content

Commit

Permalink
[ADP-3239] fix E2E tests on runtime node 8.7.2 (#4384)
Browse files Browse the repository at this point in the history
- [x] Revert all 8.7.2 changes in documentation and docker as no docker
image is available for the new node
- [x] Fix conway genesis configuration for E2E tests to support voting 
- [x] Fix docker-compose instructions to point to the new docker
registry for the node `ghcr.io/intersectmbo/cardano-node`
- [x] Remove 2 E2E tests as failing and we are trying to re-enable them
at the integration level
1. ADP-2666 - Tx history is available after receiving token from minting
tx made using reference script (Plutus script)
2. ADP-2666 - Tx history is available after receiving token from minting
tx made using reference script (Simple script)



ADP-3239
  • Loading branch information
paolino authored Jan 10, 2024
2 parents f7cbb90 + ebf3bae commit 0fc8457
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 191 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: E2E Docker

on:
schedule:
- cron: "0 6 * * *"
- cron: "0 6 * * *"
workflow_dispatch:
inputs:
nodeTag:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
- name: 🔍 Display versions
run: |
docker run --rm cardanofoundation/cardano-wallet:$WALLET version
docker run --rm inputoutput/cardano-node:${{ env.NODE }} cli version
docker run --rm ghcr.io/intersectmbo/cardano-node:${{ env.NODE }} cli version
- name: ⏳ Wait until node is synced
run: rake wait_until_node_synced
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.5"

services:
cardano-node:
image: inputoutput/cardano-node:${NODE_TAG}
image: ghcr.io/intersectmbo/cardano-node:${NODE_TAG}
environment:
NETWORK:
CARDANO_NODE_SOCKET_PATH: /ipc/node.socket
Expand Down
2 changes: 1 addition & 1 deletion lib/wallet-e2e/config/cardano-node/preprod/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ByronGenesisFile": "byron-genesis.json",
"ByronGenesisHash": "d4b8de7a11d929a323373cbab6c1a9bdc931beffff11db111cf9d57356ee1937",
"ConwayGenesisFile": "conway-genesis.json",
"ConwayGenesisHash": "f28f1c1280ea0d32f8cd3143e268650d6c1a8e221522ce4a7d20d62fc09783e1",
"ConwayGenesisHash": "4c14cc9ca7934a59575e57bb1c11954f25299bb5a9cb82b72923522d23b0acd5",
"EnableP2P": true,
"LastKnownBlockVersion-Alt": 0,
"LastKnownBlockVersion-Major": 2,
Expand Down
35 changes: 34 additions & 1 deletion lib/wallet-e2e/config/cardano-node/preprod/conway-genesis.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
{
"genDelegs": {}
"poolVotingThresholds": {
"pvtCommitteeNormal": 0.51,
"pvtCommitteeNoConfidence": 0.51,
"pvtHardForkInitiation": 0.51,
"pvtMotionNoConfidence": 0.51
},
"dRepVotingThresholds": {
"dvtMotionNoConfidence": 0.51,
"dvtCommitteeNormal": 0.51,
"dvtCommitteeNoConfidence": 0.51,
"dvtUpdateToConstitution": 0.51,
"dvtHardForkInitiation": 0.51,
"dvtPPNetworkGroup": 0.51,
"dvtPPEconomicGroup": 0.51,
"dvtPPTechnicalGroup": 0.51,
"dvtPPGovGroup": 0.51,
"dvtTreasuryWithdrawal": 0.51
},
"committeeMinSize": 0,
"committeeMaxTermLength": 200,
"govActionLifetime": 10,
"govActionDeposit": 1000000000,
"dRepDeposit": 2000000,
"dRepActivity": 20,
"constitution": {
"anchor": {
"url": "",
"dataHash": "0000000000000000000000000000000000000000000000000000000000000000"
}
},
"committee": {
"members": {},
"quorum": 0
}
}
2 changes: 1 addition & 1 deletion test/e2e/docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.5"
services:
cardano-node:
container_name: cardano-node
image: inputoutput/cardano-node:${NODE}
image: ghcr.io/intersectmbo/cardano-node:${NODE}
volumes:
- ${DATA}:/data
- ${DATA}:/ipc
Expand Down
183 changes: 0 additions & 183 deletions test/e2e/spec/e2e_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,189 +32,6 @@
expect(l.length).to be > 0
expect(l.to_s).not_to include 'null'
end

it 'ADP-2666 - Tx history is available after receiving token from minting tx made using reference script (Plutus script)', :adp_2666 do
##
# This test is to reproduce a bug where tx history was not available
# after receiving token from minting tx made using reference script.
# Reproduction steps:
# 1. [cardano-cli] Create an address and fund it with ada
# 2. [cardano-cli] Submit transaction to the address setting utxo for collateral and reference script utxo (Plutus script)
# 3. [cardano-cli] Submit minting transaction using reference script sending minted tokens to wallet address
# 4. [cardano-wallet] Check that tx history is available after receiving token from minting tx made using reference script
# 5. [cardano-wallet] Send token back to the address

# 1. [cardano-cli] Create an address and fund it with ada
payment_keys = CARDANO_CLI.generate_payment_keys
payment_address = CARDANO_CLI.build_payment_address(payment_keys)
init_amt = 20_000_000
tx = construct_sign_submit(@wid, payment_payload(init_amt, payment_address))
wait_for_tx_in_ledger(@wid, tx.last['id'])

# 2. [cardano-cli] Submit transaction to the address setting utxo for collateral and reference script utxo
init_utxo = CARDANO_CLI.get_utxos(payment_address).first
txbody = CARDANO_CLI.tx_build("--tx-in #{init_utxo[:utxo]}##{init_utxo[:ix]}",
"--tx-out #{payment_address}+10000000", # will be a reference script utxo (#0)
"--tx-out-reference-script-file #{get_plutus_file_path('anyone-can-mint.plutus')}",
"--tx-out #{payment_address}+3000000", # will be a collateral utxo (#1)
"--change-address #{payment_address}") # will be a regular utxo (#2)

txsigned = CARDANO_CLI.tx_sign(txbody, payment_keys)
txid = CARDANO_CLI.tx_submit(txsigned)

eventually 'Tx is in ledger' do
CARDANO_CLI.get_utxos(payment_address).to_s.include?(txid)
end

# 3. [cardano-cli] Submit minting transaction using reference script sending minted tokens to wallet address

wallet_id = @target_id
txs = SHELLEY.transactions.list(wallet_id)
expect(txs).to be_correct_and_respond 200

src_utxos = CARDANO_CLI.get_utxos(payment_address)
address = SHELLEY.addresses.list(wallet_id).first['id']
policy_id = CARDANO_CLI.policy_id(get_plutus_file_path('anyone-can-mint.plutus'))
hex_asset_name = asset_name('ReferencePlutusScriptAsset')
txbody2 = CARDANO_CLI.tx_build("--tx-in #{src_utxos[2][:utxo]}##{src_utxos[2][:ix]}",
"--tx-in-collateral #{src_utxos[1][:utxo]}##{src_utxos[1][:ix]}",
"--mint-tx-in-reference #{src_utxos[0][:utxo]}##{src_utxos[0][:ix]}",
"--tx-out \"#{address}+2000000+1 #{policy_id}.#{hex_asset_name}\"",
"--mint \"1 #{policy_id}.#{hex_asset_name}\"",
'--mint-plutus-script-v2',
"--mint-reference-tx-in-redeemer-file #{get_plutus_file_path('42.redeemer')}",
"--policy-id #{policy_id}",
"--change-address #{payment_address}",
"--protocol-params-file #{CARDANO_CLI.get_protocol_params_to_file}")

txsigned2 = CARDANO_CLI.tx_sign(txbody2, payment_keys)
txid2 = CARDANO_CLI.tx_submit(txsigned2)

eventually 'Minting Tx with reference Plutus script is in ledger' do
CARDANO_CLI.get_utxos(payment_address).to_s.include?(txid2)
end

# 4. [cardano-wallet] Check that tx history is available after receiving token from minting tx made using reference script
txs = SHELLEY.transactions.list(wallet_id)
expect(txs).to be_correct_and_respond 200

tx_details = SHELLEY.transactions.get(wallet_id, txid2)
tx_inputs(tx_details, present: true)
tx_outputs(tx_details, present: true)
tx_direction(tx_details, 'incoming')
tx_script_validity(tx_details, 'valid')
tx_status(tx_details, 'in_ledger')
tx_collateral(tx_details, present: true)
tx_collateral_outputs(tx_details, present: true)
tx_metadata(tx_details, nil)
tx_deposits(tx_details, deposit_taken: 0, deposit_returned: 0)
tx_withdrawals(tx_details, present: false)
tx_has_mint_or_burn(tx_details, mint: true, burn: false)
expect(tx_details['mint']['tokens'].first['policy_script']['script_type']).to eq 'reference script'
tx_extra_signatures(tx_details, present: true)
tx_script_integrity(tx_details, present: true)
tx_validity_interval_default(tx_details)
tx_certificates(tx_details, present: false)

# 5. [cardano-wallet] Send token back to the address
payment = [{ 'address' => payment_address,
'amount' => { 'quantity' => 0, 'unit' => 'lovelace' },
'assets' => [{ 'policy_id' => policy_id,
'asset_name' => hex_asset_name,
'quantity' => 1 }] }]
tx = construct_sign_submit(wallet_id, payment)
wait_for_tx_in_ledger(wallet_id, tx.last['id'])
end

it 'ADP-2666 - Tx history is available after receiving token from minting tx made using reference script (Simple script)', :adp_2666 do
##
# This test is to reproduce a bug where tx history was not available
# after receiving token from minting tx made using reference script (using simple script a.k.a. native script).
# Reproduction steps:
# 1. [cardano-cli] Create an address and fund it with ada
# 2. [cardano-cli] Submit transaction to the address setting utxo for collateral and reference script utxo
# 3. [cardano-cli] Submit minting transaction using reference script sending minted tokens to wallet address
# 4. [cardano-wallet] Check that tx history is available after receiving token from minting tx made using reference script
# 5. [cardano-wallet] Send token back to the address

# 1. [cardano-cli] Create an address and fund it with ada
payment_keys = CARDANO_CLI.generate_payment_keys
payment_address = CARDANO_CLI.build_payment_address(payment_keys)
init_amt = 10_000_000
tx = construct_sign_submit(@wid, payment_payload(init_amt, payment_address))
wait_for_tx_in_ledger(@wid, tx.last['id'])

# 2. [cardano-cli] Submit transaction to the address setting utxo for collateral and reference script utxo
init_utxo = CARDANO_CLI.get_utxos(payment_address).first
txbody = CARDANO_CLI.tx_build("--tx-in #{init_utxo[:utxo]}##{init_utxo[:ix]}",
"--tx-out #{payment_address}+5000000", # will be a reference script utxo (#0)
"--tx-out-reference-script-file #{get_simple_scripts_file_path('policy.script')}",
"--change-address #{payment_address}") # will be a regular utxo (#1)

txsigned = CARDANO_CLI.tx_sign(txbody, payment_keys)
txid = CARDANO_CLI.tx_submit(txsigned)

eventually 'Tx is in ledger' do
CARDANO_CLI.get_utxos(payment_address).to_s.include?(txid)
end

# 3. [cardano-cli] Submit minting transaction using reference script sending minted tokens to wallet address
wallet_id = @target_id
txs = SHELLEY.transactions.list(wallet_id)
expect(txs).to be_correct_and_respond 200

src_utxos = CARDANO_CLI.get_utxos(payment_address)
address = SHELLEY.addresses.list(wallet_id).first['id']
policy_id = CARDANO_CLI.policy_id(get_simple_scripts_file_path('policy.script'))
hex_asset_name = asset_name('ReferenceSimpleScriptAsset')
txbody2 = CARDANO_CLI.tx_build("--tx-in #{src_utxos[1][:utxo]}##{src_utxos[1][:ix]}",
'--witness-override 2',
"--simple-minting-script-tx-in-reference #{src_utxos[0][:utxo]}##{src_utxos[0][:ix]}",
"--tx-out \"#{address}+2000000+1 #{policy_id}.#{hex_asset_name}\"",
"--mint \"1 #{policy_id}.#{hex_asset_name}\"",
"--policy-id #{policy_id}",
"--change-address #{payment_address}",
"--protocol-params-file #{CARDANO_CLI.get_protocol_params_to_file}")

payment_keys[:policy_skey] = get_simple_scripts_file_path('policy.skey')
txsigned2 = CARDANO_CLI.tx_sign(txbody2, payment_keys)
txid2 = CARDANO_CLI.tx_submit(txsigned2)

eventually 'Minting Tx with reference Simple script is in ledger' do
CARDANO_CLI.get_utxos(payment_address).to_s.include?(txid2)
end

# 4. [cardano-wallet] Check that tx history is available after receiving token from minting tx made using reference script
txs = SHELLEY.transactions.list(wallet_id)
expect(txs).to be_correct_and_respond 200

tx_details = SHELLEY.transactions.get(wallet_id, txid2)
tx_inputs(tx_details, present: true)
tx_outputs(tx_details, present: true)
tx_direction(tx_details, 'incoming')
tx_script_validity(tx_details, 'valid')
tx_status(tx_details, 'in_ledger')
tx_collateral(tx_details, present: false)
tx_collateral_outputs(tx_details, present: false)
tx_metadata(tx_details, nil)
tx_deposits(tx_details, deposit_taken: 0, deposit_returned: 0)
tx_withdrawals(tx_details, present: false)
tx_has_mint_or_burn(tx_details, mint: true, burn: false)
expect(tx_details['mint']['tokens'].first['policy_script']['script_type']).to eq 'reference script'
tx_extra_signatures(tx_details, present: false)
tx_script_integrity(tx_details, present: false)
tx_validity_interval_default(tx_details)
tx_certificates(tx_details, present: false)

# 5. [cardano-wallet] Send token back to the address
payment = [{ 'address' => payment_address,
'amount' => { 'quantity' => 0, 'unit' => 'lovelace' },
'assets' => [{ 'policy_id' => policy_id,
'asset_name' => hex_asset_name,
'quantity' => 1 }] }]
tx = construct_sign_submit(wallet_id, payment)
wait_for_tx_in_ledger(wallet_id, tx.last['id'])
end
end

describe 'Collateral return', :collateral do
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/state/configs/preprod/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ByronGenesisFile": "byron-genesis.json",
"ByronGenesisHash": "d4b8de7a11d929a323373cbab6c1a9bdc931beffff11db111cf9d57356ee1937",
"ConwayGenesisFile": "conway-genesis.json",
"ConwayGenesisHash": "f28f1c1280ea0d32f8cd3143e268650d6c1a8e221522ce4a7d20d62fc09783e1",
"ConwayGenesisHash": "4c14cc9ca7934a59575e57bb1c11954f25299bb5a9cb82b72923522d23b0acd5",
"EnableP2P": false,
"LastKnownBlockVersion-Alt": 0,
"LastKnownBlockVersion-Major": 2,
Expand Down
35 changes: 34 additions & 1 deletion test/e2e/state/configs/preprod/conway-genesis.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
{
"genDelegs": {}
"poolVotingThresholds": {
"pvtCommitteeNormal": 0.51,
"pvtCommitteeNoConfidence": 0.51,
"pvtHardForkInitiation": 0.51,
"pvtMotionNoConfidence": 0.51
},
"dRepVotingThresholds": {
"dvtMotionNoConfidence": 0.51,
"dvtCommitteeNormal": 0.51,
"dvtCommitteeNoConfidence": 0.51,
"dvtUpdateToConstitution": 0.51,
"dvtHardForkInitiation": 0.51,
"dvtPPNetworkGroup": 0.51,
"dvtPPEconomicGroup": 0.51,
"dvtPPTechnicalGroup": 0.51,
"dvtPPGovGroup": 0.51,
"dvtTreasuryWithdrawal": 0.51
},
"committeeMinSize": 0,
"committeeMaxTermLength": 200,
"govActionLifetime": 10,
"govActionDeposit": 1000000000,
"dRepDeposit": 2000000,
"dRepActivity": 20,
"constitution": {
"anchor": {
"url": "",
"dataHash": "0000000000000000000000000000000000000000000000000000000000000000"
}
},
"committee": {
"members": {},
"quorum": 0
}
}

0 comments on commit 0fc8457

Please sign in to comment.