diff --git a/test/e2e/spec/e2e_spec.rb b/test/e2e/spec/e2e_spec.rb index dd70d04c011..5234b537d74 100644 --- a/test/e2e/spec/e2e_spec.rb +++ b/test/e2e/spec/e2e_spec.rb @@ -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