From bc05ed63c0cdbc079f88e3f1bced74ead59b46cd Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Wed, 20 Nov 2024 18:34:55 +0100 Subject: [PATCH 1/6] Raw collection of existing tests in a document --- tests.md | 824 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 824 insertions(+) create mode 100644 tests.md diff --git a/tests.md b/tests.md new file mode 100644 index 00000000000..e59394f194e --- /dev/null +++ b/tests.md @@ -0,0 +1,824 @@ +# System-level Tests + +This document attempts to collect all system-level tests that are part of the cardano-wallet codebase in order to be able to consolidate testing assets into a coherent suite of tests. To this end, the plan is: + +* Collect existing Haskell integration tests and Ruby end-to-end tests +* Identify tests in the latter that are surely covered by the former +* Identify gaps, eg. existing e2e tests that do not have a counterpart as integration tests. + * For each of those gaps, decide whether or not we want to pay the cost of maintaining the test + * If the answer is yes, port the test as an Integration Tests +* Identify system-level (integration) tests who could be implemented at a lower-level, eg. as unit or component level tests, not requiring a full blown process and cardano-node to run + * Port thos tests as unit tests + +This process is expected to take time. This document will serve as a central point to track progress. + +## Categories of tests + +By _System tests_ we mean tests that depend on running external processes, possibly even servers, to run. Our Haskell "integration" tests and Ruby E2E tests fall into this category as they both rely on runnning cardano-wallet process, and cardano-node process. + +## Integration Tests + +``` +describe "SHELLEY_WALLETS" + it "WALLETS_CREATE_01 - Create a wallet" + it "WALLETS_CREATE_01.1 create a wallet restoring from tip" + describe "OWASP_INJECTION_CREATE_WALLET_01 - \ + it "WALLETS_CREATE_02 - Restored wallet preserves funds" + it "WALLETS_CREATE_03,09 - Cannot create wallet that exists" + describe "WALLETS_CREATE_04 - Wallet name" + describe "WALLETS_CREATE_05 - Mnemonics" + describe "WALLETS_CREATE_06 - Mnemonics second factor" + describe "WALLETS_CREATE_07 - Passphrase" + describe "WALLETS_CREATE_08 - address_pool_gap" + it "WALLETS_CREATE_08 - default address_pool_gap" + describe "WALLETS_CREATE_09 - HTTP headers" + it "WALLETS_CREATE_10 - Create wallet with one change address mode on" + it "WALLETS_GET_01 - can get wallet details" + it "WALLETS_GET_02, WALLETS_DELETE_01 - Deleted wallet is not available" + it "WALLETS_LIST_01 - Created a wallet can be listed" + it "WALLETS_LIST_01 - Wallets are listed from oldest to newest" + it "WALLETS_LIST_02 - Deleted wallet not listed" + it "WALLETS_UPDATE_01 - Updated wallet name is available" + describe "WALLETS_UPDATE_02 - Various names" + it "WALLETS_UPDATE_03 - Deleted wallet cannot be updated (404)" + describe "WALLETS_UPDATE_04 - HTTP headers" + it "WALLETS_UPDATE_PASS_01a - passphraseLastUpdate gets updated" + it "WALLETS_UPDATE_PASS_01b - passphraseLastUpdate gets updated, mnemonic" + it "WALLETS_UPDATE_PASS_01c - passphraseLastUpdate gets updated, mnemonic \ + describe "WALLETS_UPDATE_PASS_02 - New passphrase values" + it "WALLETS_UPDATE_PASS_03 - Old passphrase incorrect" + it "WALLETS_UPDATE_PASS_03 - Mnemonic incorrect" + describe "WALLETS_UPDATE_PASS_03 - Can update pass from pass that's boundary\ + it "WALLETS_UPDATE_PASS_04 - Deleted wallet is not available" + it "WALLETS_UPDATE_PASS_04 - Deleted wallet is not available, mnemonic" + describe "WALLETS_UPDATE_PASS_05,06 - Transaction after updating passphrase" + describe "WALLETS_UPDATE_PASS_07 - HTTP headers" + it "WALLETS_UTXO_01 - Wallet's inactivity is reflected in utxo" + it "WALLET_UTXO_SNAPSHOT_01 - \ + it "WALLET_UTXO_SNAPSHOT_02 - \ + it "WALLET_UTXO_SNAPSHOT_03 - \ + it "WALLETS_UTXO_02 - Sending and receiving funds updates wallet's utxo." + it "WALLETS_UTXO_03 - Deleted wallet is not available for utxo" + describe "WALLETS_UTXO_04 - HTTP headers" + it "WALLETS_GET_KEY_01 - golden tests for verification key" + it "WALLETS_GET_KEY_02 - invalid index for verification key" + it "WALLETS_GET_KEY_03 - unknown wallet" + it "WALLETS_SIGNATURES_01 - can verify signature" + it "WALLETS_SIGNATURES_02 - invalid index for signing key" + it "WALLETS_SIGNATURES_03 - unknown wallet" + it "BYRON_WALLETS_UTXO -\ + it "BYRON_WALLETS_UPDATE_PASS -\ + it "BYRON_WALLETS_UPDATE -\ + it "BYRON_WALLETS_GET_02 - Byron ep does not show Shelley wallet" + it "BYRON_WALLETS_GET_03 - Shelley ep does not show Byron wallet" + it "BYRON_WALLETS_LIST_02,03 - \ + it "BYRON_WALLETS_LIST_04, DELETE_01 - \ + it "BYRON_WALLETS_DELETE_02 - Byron ep does not delete Shelley wallet" + it "BYRON_WALLETS_DELETE_03 - Shelley ep does not delete Byron wallet" + it "WALLETS_NETWORK_SHELLEY - Wallet has the same tip as network/information" + +describe "No backend required" + $ describe "Miscellaneous CLI tests" MiscellaneousCLI.spec + describe "API Specifications" $ do + parallel $ describe "CLI Specifications" $ do + +spec = describe "COMMON_CLI_PORTS" + it "PORT_01 - Can't reach server with wrong port (wallet list)" + it "PORT_01 - Can't reach server with wrong port (wallet create)" + it "PORT_01 - Can't reach server with wrong port (wallet get)" + it "PORT_01 - Can't reach server with wrong port (wallet delete)" + it "PORT_01 - Can't reach server with wrong port (wallet update)" + it "PORT_01 - Can't reach server with wrong port (transction create)" + it "PORT_01 - Can't reach server with wrong port (address list)" + describe "PORT_04 - Fail nicely when port is out-of-bounds" +spec = describe "restoration of wallets" +/spec = describe "COMMON_CLI_NETWORK" + it "CLI_NETWORK - cardano-wallet network information" + it "NETWORK_PARAMS - network parameters" + it "CLI_NETWORK - network clock" + +spec = describe "BYRON_WALLETS" + it "BYRON_GET_04, DELETE_01 - Deleted wallet is not available" + it "BYRON_LIST_01 - Byron Wallets are listed from oldest to newest" + it "BYRON_LIST_01 - Interleave of Icarus and Random wallets" + describe "BYRON_RESTORE_01, GET_01, LIST_01 - Restore a wallet" + it "BYRON_RESTORE_02 - One can restore previously deleted wallet" + it "BYRON_RESTORE_03 - Cannot restore wallet that exists" + describe "BYRON_RESTORE_06 - Passphrase" + it "BYRON_UPDATE_NAME_01 - Update names of wallets" + it "BYRON_UPDATE_NAME_02 - Update names of wallets from Xprv" + it "BYRON_UTXO_01 - Wallet's inactivity is reflected in utxo" + it "BYRON_WALLET_UTXO_SNAPSHOT_01 - \ + it "BYRON_WALLET_UTXO_SNAPSHOT_02 - \ + it "BYRON_WALLET_UTXO_SNAPSHOT_03 - \ + it "BYRON_UPDATE_PASS_01 - change passphrase" + it "BYRON_UPDATE_PASS_02 - Old passphrase incorrect" + it "BYRON_UPDATE_PASS_03 - Updating passphrase with no password wallets" + it "BYRON_UPDATE_PASS_04a - Updating passphrase with no password wallets" + it "BYRON_UPDATE_PASS_04b - Regression test" + it "BYRON_UPDATE_PASS_07 - Updating passphrase with short password wallets" + +spec = describe "BYRON_MIGRATIONS" + it "BYRON_CREATE_MIGRATION_PLAN_01r - Can create a migration plan for a random wallet." + it "BYRON_CREATE_MIGRATION_PLAN_01i - Can create a migration plan for an Icarus wallet." + it "BYRON_CREATE_MIGRATION_PLAN_02r - Cannot create plan for empty wallet." + it "BYRON_CREATE_MIGRATION_PLAN_02i - Cannot create plan for empty wallet." + it "BYRON_CREATE_MIGRATION_PLAN_03 - Cannot create plan for Shelley wallet using Byron endpoint." + it "BYRON_CREATE_MIGRATION_PLAN_04 - Cannot create a plan for a wallet that only contains dust." + it "BYRON_CREATE_MIGRATION_PLAN_05r - Creating a plan is deterministic." + it "BYRON_CREATE_MIGRATION_PLAN_05i - Creating a plan is deterministic." + describe "BYRON_MIGRATE_01 - \After a migration operation successfully completes, the correct amounts eventually become available in the target wallet for an arbitrary number of specified addresses, and the balance of the source wallet is completely depleted." + it "BYRON_MIGRATE_02 - Can migrate a large wallet requiring more than one transaction." + it "BYRON_MIGRATE_03 - Migrating an empty wallet should fail." + it "BYRON_MIGRATE_04 - Actual fee for migration is identical to predicted fee." + it "BYRON_MIGRATE_05 - Migration fails if the wrong passphrase is supplied." + describe "BYRON_MIGRATE_06 - It's possible to migrate to any valid address." + it "BYRON_MIGRATE_07 - Including an invalidly-formatted passphrase results in a parser error." + it "BYRON_MIGRATE_08 - It's not possible to migrate a wallet whose total balance is less than the minimum ada quantity for an output." + +spec = describe "BYRON_CLI_WALLETS" + describe "CLI_BYRON_GET_04, CLI_BYRON_DELETE_01, BYRON_RESTORE_02, BYRON_RESTORE_03 -\ + describe "CLI_BYRON_RESTORE_01, CLI_BYRON_GET_01, CLI_BYRON_LIST_01 -\ + describe "CLI_BYRON_RESTORE_06 - Passphrase" + it "CLI_BYRON_UPDATE_NAME_01 - Update names of wallets" + it "CLI_BYRON_UPDATE_NAME_02 - When updated name too long" + it "CLI_BYRON_UTXO_01 - Wallet's inactivity is reflected in utxo" + it "CLI_BYRON_UPDATE_PASS_01 - change passphrase" + it "CLI_BYRON_UPDATE_PASS_02 - Old passphrase incorrect" + describe "CLI_BYRON_UPDATE_PASS_03 - Pass length incorrect" + +spec = describe "NEW_SHELLEY_TRANSACTIONS" + it "TRANS_NEW_CREATE_01a - Empty payload is not allowed" + it "TRANS_NEW_CREATE_01b - Validity interval only is not allowed" + it "TRANS_NEW_CREATE_01c - No payload is bad request" + it "TRANS_NEW_CREATE_02a - Only metadata" + it "TRANS_NEW_CREATE_02b - Only metadata, untyped" + it "TRANS_NEW_CREATE_04ab - Constructed inputs = Decoded inputs" + it "TRANS_NEW_CREATE_04b - Cannot spend less than minUTxOValue" + it "TRANS_NEW_CREATE_04c - Can't cover fee" + it "TRANS_NEW_CREATE_04d - Not enough money" + it "TRANS_NEW_CREATE_04d - No UTxOs available" + it "TRANS_NEW_CREATE_04e- Multiple Output Tx to single wallet" + it "TRANS_NEW_ASSETS_CREATE_01a - Multi-asset tx with Ada" + it "TRANS_NEW_ASSETS_CREATE_01b - Multi-asset tx with not enough Ada" + it "TRANS_NEW_ASSETS_CREATE_01c - Multi-asset tx without Ada" + it "TRANS_NEW_ASSETS_CREATE_02 - using reference script" + it "TRANS_NEW_BALANCE_02a - Cannot balance on empty wallet" + it "TRANS_NEW_BALANCE_02b - Cannot balance when I cannot afford fee" + it "TRANS_NEW_SIGN_01 - Sign single-output transaction" + it "TRANS_NEW_SIGN_02 - Rejects unsigned transaction" + it "TRANS_NEW_SIGN_03 - Sign withdrawals" + it "TRANS_NEW_SIGN_04 - Sign extra required signatures" + describe + describe + it "TRANS_NEW_SUBMIT_03 - Can submit transaction encoded in base16" + xdescribe "Plutus scenarios" + it "TRANS_NEW_SUBMIT_04 - Mary and Babbage foreign txs submitted" + it "TRANS_NEW_CREATE_10l - Minting when assetName too long" + it "TRANS_NEW_CREATE_10m1 - Minting amount too big" + it "TRANS_NEW_CREATE_10m2 - Minting amount = 0" + it "TRANS_NEW_CREATE_10d - Minting assets without timelock" + it "TRANS_NEW_CREATE_10f - Burning assets without timelock" + describe + describe + it "TRANS_NEW_CREATE_12 - Cannot vote in Babbage" + it "TRANS_NEW_LIST_05 - filter address output side" + it "TRANS_NEW_LIST_06 - filter address input side" + +spec = describe "SHELLEY_SETTINGS" + it "SETTINGS_01 - Can put and read settings" + it "SETTINGS_02 - Changing pool_metadata_source re-syncs metadata" + +spec = describe "SHELLEY_HW_WALLETS" + it "HW_WALLETS_01 - Restoration from account public key preserves funds" + describe "HW_WALLETS_03 - Cannot do operations requiring private key" + it "Cannot send tx" + it "Cannot update pass" + describe "HW_WALLETS_04 - Can manage HW wallet the same way as others" + it "Can update name" + it "Can get tx fee" + it "Can delete" + it "Can see utxo" + it "Can list addresses" + it "Can have address pool gap" + it "Can list transactions" + it "Can create a coin selection" + describe "HW_WALLETS_05 - Wallet from pubKey is available" + it "Can get wallet" + it "Can list wallet" + it "The same account and mnemonic wallet can live side-by-side" + +spec = describe "SHELLEY_NETWORK" + it "NETWORK_PARAMS - Able to fetch network parameters" + +spec = describe "WITHDRAWALS" + it "TRANS_NEW_CREATE_03a - Withdrawal from self, 0 rewards" + it "TRANS_NEW_CREATE_03a - Withdrawal from self" + +spec = describe "BYRON_NETWORK" + it "NETWORK_PARAMS - Able to fetch network parameters" + +spec = describe "SHELLEY_CLI_WALLETS" + it "BYRON_GET_03 - Shelley CLI does not show Byron wallet" + it "BYRON_LIST_03 - Shelley CLI does not list Byron wallet" + it "BYRON_DELETE_03 - Shelley CLI does not delete Byron wallet" + it "BYRON_WALLETS_UTXO -\ + it "BYRON_WALLETS_UPDATE_PASS -\ + it "BYRON_WALLETS_UPDATE -\ + it "WALLETS_CREATE_01,08 - Can create a wallet" + it "WALLETS_CREATE_02 - Restored wallet preserves funds" + it "WALLETS_CREATE_03 - Cannot create wallet that exists" + describe "WALLETS_CREATE_04 - Wallet names" + describe "WALLETS_CREATE_04 - Wallet names invalid" + describe "WALLETS_CREATE_05 - Can create wallet with different mnemonic sizes" + describe "WALLETS_CREATE_05 - Can't create wallet with wrong size of mnemonic" + describe "WALLETS_CREATE_06 - Can create wallet with different mnemonic snd factor sizes" + describe "WALLETS_CREATE_06 - Can't create wallet with wrong size of mnemonic snd factor" + describe "WALLETS_CREATE_07 - Passphrase is valid" + describe "WALLETS_CREATE_07 - When passphrase is invalid" + describe "WALLETS_CREATE_08 - --address-pool-gap values" + it "WALLETS_GET_01 - Can get a wallet" + describe "WALLETS_GET_03,04 - Cannot get wallets with false ids" + it "WALLETS_LIST_01 - Can list wallets" + it "WALLETS_LIST_01 - Wallets are listed from oldest to newest" + describe "WALLETS_UPDATE_01,02 - Can update wallet name" + it "WALLETS_UPDATE_PASS_01 - Can update passphrase normally" + it "WALLETS_UPDATE_PASS_01 - Can update passphrase normally, mnemonic" + describe "WALLETS_UPDATE_PASS_02 - New passphrase values" + it "WALLETS_UPDATE_PASS_02 - \ + describe "WALLETS_UPDATE_PASS_03 - Old passphrase values" + describe "WALLETS_UPDATE_PASS_03 - \ + describe "WALLETS_UPDATE_PASS_04 - Cannot update pass of wallets with false ids" + describe "WALLETS_UPDATE_PASS_05,06 - \ + it "WALLETS_DELETE_01, WALLETS_LIST_02 - Can delete wallet" + it "WALLETS_UTXO_01 - Wallet's inactivity is reflected in utxo" + it "WALLET_UTXO_SNAPSHOT_01 - \ + it "WALLETS_UTXO_02 - Utxo statistics works properly" + describe "WALLETS_UTXO_03 - non-existing wallets" + it "WALLETS_UTXO_03 - Deleted wallet is not available for utxo" + it "WALLETS_UTXO_03 - 'almost' valid walletId" + + describe "BYRON_CLI_ADDRESSES" + describe "CLI_ADDRESS_CREATE_07 - False indexes" + +spec = describe "SHELLEY_TRANSACTIONS" + it "Regression ADP-626 - Filtering transactions between eras" $ do + it "TRANS_CREATE_01x - Single Output Transaction" + it "TRANS_CREATE_02x - Multiple Output Tx to single wallet" + it "TRANS_CREATE_03 - 0 balance after transaction" + it "TRANS_CREATE_04 - Can't cover fee" + it "TRANS_CREATE_04 - Not enough money" + it "TRANS_CREATE_04 - Wrong password" + it "TRANS_CREATE_07 - Deleted wallet" + describe "TRANS_CREATE_08 - Bad payload" + it "TRANS_ASSETS_CREATE_01 - Multi-asset balance" + it "TRANS_ASSETS_CREATE_01a - Multi-asset transaction with Ada" + it "TRANS_ASSETS_CREATE_02a - Multi-asset transaction without Ada" + it "TRANS_ASSETS_CREATE_02c - Send SeaHorses" + it "TRANS_ASSETS_CREATE_02b - Multi-asset tx history" + it "TRANS_ASSETS_LIST_01 - Asset list present" + it "TRANS_ASSETS_LIST_02 - Asset list present when not used" + it "TRANS_ASSETS_LIST_02a - Asset list present when not used" + it "TRANS_ASSETS_GET_01 - Asset list present" + it "TRANS_ASSETS_GET_02 - Asset not present when isn't associated" + it "TRANS_ASSETS_GET_02a - Asset not present when isn't associated" + it "TRANS_TTL_04 - Large TTL" + describe "TRANSMETA_CREATE_01 - Including metadata within transactions" + it "TRANSMETA_CREATE_03 - Transaction with too much metadata" + it "TRANSMETA_ESTIMATE_03 - fee estimation with too much metadata" + describe "TRANS_ESTIMATE_08 - Bad payload" + it "TRANS_ESTIMATE_03a - we see result when we can't cover fee" + it "TRANS_ESTIMATE_04 - Not enough money" + it "TRANS_ESTIMATE_07 - Deleted wallet" + it "TRANS_LIST_01 - Can list Incoming and Outgoing transactions" + it "TRANS_LIST_02,03x - Can limit/order results with start, end and order" + describe "TRANS_LIST_02,03 - Faulty start, end, order values" + it "TRANS_LIST_02 - Start time shouldn't be later than end time" + it "TRANS_LIST_03 - Minimum withdrawal shouldn't be 0" + it "TRANS_LIST_04 - Deleted wallet" + it "TRANS_GET_01 - Can get Incoming and Outgoing transaction" + it "TRANS_GET_02 - Deleted wallet" + it "TRANS_GET_03 - Using wrong transaction id" + it "TRANS_GET_04 - Sumbitted transactions result in pending state" + describe "TRANS_DELETE_03 - checking no transaction id error for " + describe + it "SHELLEY_TX_REDEEM_01 - Can redeem rewards from self" + it "SHELLEY_TX_REDEEM_02 - Can redeem rewards from other" + it "SHELLEY_TX_REDEEM_03 - Can't redeem rewards from other if none left" + it "SHELLEY_TX_REDEEM_04 - Can always ask for self redemption" + it "SHELLEY_TX_REDEEM_05 - Can't redeem rewards from unknown key" + it "SHELLEY_TX_REDEEM_06 - Can't redeem rewards using byron wallet" + it "SHELLEY_TX_REDEEM_06a - Can't redeem rewards if utxo = 0 from other" + it "SHELLEY_TX_REDEEM_06b - Can't redeem rewards if utxo = 0 from self" + it "SHELLEY_TX_REDEEM_07b - Can't redeem rewards if not enough money" + +spec = describe "SHELLEY_CLI_TRANSACTIONS" + it "TRANS_CREATE_01 - Can create transaction via CLI" + it "TRANS_CREATE_02 - Multiple Output Tx to single wallet via CLI" + it "TRANS_CREATE_04 - Wrong password" + describe "TRANS_CREATE_05 - Invalid addresses" + describe "TRANS_CREATE_06 - Invalid amount" + describe "TRANS_CREATE_07 - False wallet ids" + it "TRANS_CREATE_07 - 'almost' valid walletId" + it "TRANS_CREATE_07 - Deleted wallet" + it "TRANSMETA_CREATE_01a - \ + it "TRANSMETA_CREATE_01b - \ + it "TRANSTTL_CREATE_01 - Transaction with TTL via CLI" + describe "TRANS_ESTIMATE_08 - Invalid addresses" + describe "TRANS_ESTIMATE_09 - Invalid amount" + describe "TRANS_LIST_01 - Listing transactions for an empty wallet" + it "TRANS_LIST_01 - Can list Incoming and Outgoing transactions" + describe "TRANS_LIST_02 - Start time shouldn't be later than end time" + it "TRANS_LIST_03 - Can order results" + describe "TRANS_LIST_02,03 - Faulty start, end, order values" + it "TRANS_LIST_04 - 'almost' valid walletId" + it "TRANS_LIST_04 - Deleted wallet" + describe "TRANS_LIST_04 - False wallet ids" + it "TRANS_LIST_RANGE_01 - \ + it "TRANS_LIST_RANGE_02 - \ + it "TRANS_LIST_RANGE_03 - \ + it "TRANS_GET_01 - Can get Incoming and Outgoing transaction" + it "TRANS_GET_02 - Deleted wallet" + it "TRANS_GET_03 - Using wrong transaction id" + it "TRANS_DELETE_01 - Cannot forget pending transaction when not pending anymore via CLI" + it "TRANS_DELETE_03 - Cannot forget tx that is not found via CLI" + describe "TRANS_DELETE_04 - False wallet ids via CLI" + it "TRANS_DELETE_06 -\ + describe "TRANS_DELETE_07 - invalid tx id via CLI" + it "BYRON_TX_LIST_03 -\ + it "BYRON_TRANS_DELETE -\ + describe "BYRON_TRANS_CREATE / BYRON_TRANS_ESTIMATE -\ + +spec = describe "SHELLEY_COIN_SELECTION" + describe "WALLETS_COIN_SELECTION_04 - HTTP headers" + it "WALLETS_COIN_SELECTION_05a - can include metadata" + it "WALLETS_COIN_SELECTION_05b - choke on invalid metadata" + it "WALLETS_COIN_SELECTION_06a - can redeem rewards from self" + it "WALLETS_COIN_SELECTION_06b - can redeem rewards from other" + +spec = describe "BYRON_TRANSACTIONS" + describe "BYRON_TRANS_ASSETS_CREATE_01 - Multi-asset transaction with ADA" + describe "BYRON_TRANS_ASSETS_CREATE_02 - Multi-asset transaction with too little ADA" + describe "BYRON_TRANS_ASSETS_CREATE_02a - Multi-asset transaction with no ADA" + describe "BYRON_TRANS_ASSETS_LIST_01 - Asset list present" + describe "BYRON_TRANS_ASSETS_LIST_02 - Asset list present when not used" + describe "BYRON_TRANS_ASSETS_GET_01 - Asset list present" + describe "BYRON_TRANS_ASSETS_GET_02 - Asset not present when isn't associated" + describe "BYRON_TRANS_ASSETS_GET_02a - Asset not present when isn't associated" + describe "BYRON_TRANS_CREATE_01 - Single Output Transaction Byron -> Shelley" + describe "BYRON_TRANS_CREATE_01a - Single Output Transaction Byron -> Byron" + it "BYRON_TRANS_CREATE_02 -\ + it "BYRON_TRANS_DELETE -\ + it "BYRON_TRANS_ESTIMATE -\ + it "BYRON_TX_LIST_02 -\ + it "BYRON_TX_LIST_03 -\ + it "BYRON_RESTORE_09 - Ledger wallet" + it "BYRON_TX_LIST_01 - 0 txs on empty Byron wallet" + it "BYRON_TX_LIST_01 - Can list transactions on Byron Wallet" + it "BYRON_TX_LIST_01 - Can list transactions on Icarus Wallet" + describe "BYRON_TX_LIST_LIMIT - Transactions can be limited" + describe "BYRON_TX_LIST_01 - Faulty start, end, order values" + it "BYRON_TX_LIST_01 - Start time shouldn't be later than end time" + it "BYRON_TX_LIST_04 - Deleted wallet" + describe "BYRON_TX_LIST_ADDRESS - Transactions can be filtered by address" + +spec = describe "SHARED_WALLETS" + it "SHARED_WALLETS_CREATE_01 - Create an active shared wallet from root xprv" + it "SHARED_WALLETS_CREATE_01 - Compare wallet ids" + it "SHARED_WALLETS_CREATE_01 - golden test comparing wallet id" + it "SHARED_WALLETS_CREATE_02 - Create a pending shared wallet from root xprv" + it "SHARED_WALLETS_CREATE_03 - Create an active shared wallet from account xpub" + it "SHARED_WALLETS_CREATE_04 - Create a pending shared wallet from account xpub" + it "SHARED_WALLETS_CREATE_05 - Create an active shared wallet from root xprv with self" + it "SHARED_WALLETS_CREATE_06 - Create an active shared wallet from account xpub with self" + it "SHARED_WALLETS_CREATE_07 - Incorrect script template due to NoCosignerInScript" + it "SHARED_WALLETS_CREATE_08 - Incorrect script template due to UnknownCosigner" + it "SHARED_WALLETS_CREATE_09 - Incorrect script template due to DuplicateXPub" + it "SHARED_WALLETS_CREATE_10 - when recommended validation" + it "SHARED_WALLETS_CREATE_11 - Correct script template when required validation" + it "SHARED_WALLETS_CREATE_12 - Incorrect script template due to WrongScript - timelocks" + it "SHARED_WALLETS_CREATE_13 - Incorrect account index" + it "SHARED_WALLETS_CREATE_14 - Create wallet with one change address mode on" + it "SHARED_WALLETS_DELETE_01 - Delete of a shared wallet" + it "SHARED_WALLETS_PATCH_01 - active shared wallet" + it "SHARED_WALLETS_PATCH_02 - Add cosigner for delegation script template" + it "SHARED_WALLETS_PATCH_03 - Cannot add cosigner key in an active shared wallet" + it "SHARED_WALLETS_PATCH_04 - add already existent key to other cosigner" + it "SHARED_WALLETS_PATCH_05 - key in template" + it "SHARED_WALLETS_PATCH_06 - payment one" + it "SHARED_WALLETS_PATCH_07 - shared wallet's account key" + it "SHARED_WALLETS_KEYS_01 - Getting verification keys works for active shared wallet" + it "SHARED_WALLETS_KEYS_02 - Getting verification keys works for pending shared wallet" + it "SHARED_WALLETS_LIST_01 - Created a wallet can be listed" + it "SHARED_WALLETS_LIST_01 - Wallets are listed from oldest to newest" + it "SHARED_WALLETS_LIST_02 - Deleted wallet not listed" + it "SHARED_WALLETS_DISCOVER_01 - " + it "SHARED_WALLETS_UTXO_01 -" + it "SHARED_WALLETS_UTXO_02 - Sending and receiving funds updates " + it "SHARED_WALLETS_UTXO_03 - Deleted wallet is not available ctx -> runResourceT + describe "SHARED_WALLETS_UTXO_04 - HTTP headers" + it "SHARED_WALLETS_UTXO_SNAPSHOT_01 - Can generate UTxO snapshot of empty wallet" + it "SHARED_WALLETS_UTXO_SNAPSHOT_02 - Can generate UTxO snapshot of pure-ada wallet" + +spec = describe "SHELLEY_MIGRATIONS" + describe + describe + +spec = describe "SHELLEY_CLI_ADDRESSES" + it "ADDRESS_LIST_01 - Can list addresses - default poolGap" + it "ADDRESS_LIST_01 - Can list addresses - non-default poolGap" + it "ADDRESS_LIST_02 - Can filter used and unused addresses" + it "ADDRESS_LIST_02 - Shows nothing when there are no used addresses" + describe "ADDRESS_LIST_02 - Invalid filters show error message" + it "ADDRESS_LIST_03 - Generates new address pool gap" + describe "ADDRESS_LIST_04 - False wallet ids" + it "ADDRESS_LIST_04 - 'almost' valid walletId" + it "ADDRESS_LIST_04 - Deleted wallet" + it "BYRON_ADDRESS_LIST - Byron wallet on Shelley CLI" + +spec = describe "SHELLEY_STAKE_POOLS" + it "STAKE_POOLS_JOIN_01 - Cannot join non-existent wallet" + it "STAKE_POOLS_JOIN_01 - Cannot join non-existent stakepool" + it "STAKE_POOLS_JOIN_02 - \ + it "STAKE_POOLS_JOIN_02 - \ + it "STAKE_POOLS_JOIN_02a - \ + it "STAKE_POOLS_JOIN_02b - \ + it "STAKE_POOLS_JOIN_03 - Cannot join a pool that has retired" + it "STAKE_POOLS_JOIN_EMPTY - Empty wallet cannot join a pool" + it "STAKE_POOLS_QUIT_02 - Passphrase must be correct to quit" + it "STAKE_POOLS_QUIT_03 - Can quit with rewards" + it "STAKE_POOLS_JOIN_01 - Can rejoin another stakepool" + it "STAKE_POOLS_JOIN_04 - Rewards accumulate" + describe "STAKE_POOLS_JOIN_UNSIGNED_01" + it "Can join a pool that's not retiring" + describe "STAKE_POOLS_JOIN_UNSIGNED_02" + $ it "Can join a pool that's retiring" + describe "STAKE_POOLS_JOIN_UNSIGNED_03" + $ it "Cannot join a pool that's retired" + describe "STAKE_POOLS_JOIN_UNSIGNED_04" + $ it "Cannot join a pool that's never existed" + describe "STAKE_POOLS_QUIT_UNSIGNED_02" + $ it "Cannot quit if not delegating" + describe "STAKE_POOLS_JOIN_01x - Fee boundary values" + describe "STAKE_POOLS_QUIT_01x - Fee boundary values" + it "STAKE_POOLS_ESTIMATE_FEE_01 - can estimate fees" + describe "STAKE_POOLS_LIST_01 - List stake pools" + it "has non-zero saturation & stake" + it "pools have the correct retirement information" + it "eventually has correct margin, cost and pledge" + it "at least one pool eventually produces block" + it "contains pool metadata" + it "contains and is sorted by non-myopic-rewards" + it "non-myopic-rewards are based on stake" + it "STAKE_POOLS_LIST_05 - Fails without query parameter" + it "STAKE_POOLS_SMASH_01 - fetching metadata from SMASH works with delisted pools" + it "STAKE_POOLS_SMASH_HEALTH_01 - Can check SMASH health when configured" + describe "STAKE_POOLS_SMASH_HEALTH_02 - Cannot check SMASH health when not configured" + it "STAKE_POOLS_SMASH_HEALTH_03 - Can check SMASH health via url" + describe "STAKE_POOLS_SMASH_HEALTH_04 - SMASH url needs to be valid" + it "STAKE_KEY_LIST_01 - Can list stake keys" + it "STAKE_KEY_LIST_02 - Can list foreign stake key from UTxO" + +spec = describe "SHELLEY_ADDRESSES" + it "BYRON_ADDRESS_LIST - Byron wallet on Shelley ep" + it "ADDRESS_LIST_01 - Can list known addresses on a default wallet" + it "ADDRESS_LIST_01 - Can list addresses with non-default pool gap" + it "ADDRESS_LIST_02 - Can filter used and unused addresses" + it "ADDRESS_LIST_02 - Shows nothing when there are no used addresses" + describe "ADDRESS_LIST_02 - Invalid filters are bad requests" + it "ADDRESS_LIST_03 - Generates new address pool gap" + it "ADDRESS_LIST_04 - Deleted wallet" + it "ADDRESS_LIST_05 - bech32 HRP is correct - testnet" + it "ADDRESS_LIST_06 - Used change addresses are listed after a transaction \ + it "ADDRESS_INSPECT_01 - Address inspect OK Icarus" + it "ADDRESS_INSPECT_02 - Address inspect OK Byron" + it "ADDRESS_INSPECT_03 - Address inspect OK reward" + it "ADDRESS_INSPECT_04 - Address inspect KO" + it "ADDRESS_INSPECT_05 - Address inspect OK bech32" + it "ANY_ADDRESS_POST_01 - Golden tests for enterprise script address - signature" + it "ANY_ADDRESS_POST_02 - Golden tests for enterprise script address - any" + it "ANY_ADDRESS_POST_03 - Golden tests for enterprise script address - all" + it "ANY_ADDRESS_POST_04 - Golden tests for enterprise script address - some" + it "ANY_ADDRESS_POST_05 - Golden tests for reward account script address - any" + it "ANY_ADDRESS_POST_06 - Golden tests for delegating script address - any" + it "ANY_ADDRESS_POST_07a - Golden tests for enterprise address - from non-extended public key" + it "ANY_ADDRESS_POST_07b - Golden tests for enterprise address - from extended public key" + it "ANY_ADDRESS_POST_07c - Golden tests for enterprise address - from key hash" + it "ANY_ADDRESS_POST_08a - Golden tests for reward account address - from non-extended public key" + it "ANY_ADDRESS_POST_08b - Golden tests for reward account address - from extended public key" + it "ANY_ADDRESS_POST_08c - Golden tests for reward account address - from key hash" + it "ANY_ADDRESS_POST_09a - Golden tests for delegating address with both non-extended pub key credentials" + it "ANY_ADDRESS_POST_09b - Golden tests for delegating address with both extended pub key credentials" + it "ANY_ADDRESS_POST_09c - Golden tests for delegating address with both key hash credentials" + it "ANY_ADDRESS_POST_09d - Golden tests for delegating address with mixed credentials" + it "ANY_ADDRESS_POST_09e - Golden tests for delegating address with mixed credentials" + it "ANY_ADDRESS_POST_09f - Golden tests for delegating address with mixed credentials" + it "ANY_ADDRESS_POST_10 - Golden tests for delegating address - payment from script, stake from key" + it "ANY_ADDRESS_POST_11 - Golden tests for delegating address - payment from key, stake from script" + it "ANY_ADDRESS_POST_12 - Delegating addresses API roundtrip" + it "ANY_ADDRESS_POST_13 - Golden tests for script with timelocks" + it "ANY_ADDRESS_POST_14a - at_least 0 is valid when non-validated" + it "ANY_ADDRESS_POST_14b - at_least 0 is valid when validation is required" + it "ANY_ADDRESS_POST_14c - at_least 0 is not valid when validation is recommended" + it "ANY_ADDRESS_POST_15a - at_least 4 is valid when non-validated" + it "ANY_ADDRESS_POST_15b - at_least 4 is valid when validation is required" + it "ANY_ADDRESS_POST_15c - at_least 4 is not valid when validation is recommended" + it "ANY_ADDRESS_POST_16a - script with duplicated verification keys is valid when non-validated" + it "ANY_ADDRESS_POST_16b - script with duplicated verification keys is valid when required validation used" + it "ANY_ADDRESS_POST_16c - script with duplicated verification keys is invalid when recommended validation used" + it "ANY_ADDRESS_POST_17a - Script with contradictory timelocks is valid when validation not used" + it "ANY_ADDRESS_POST_17b - Script with contradictory timelocks is invalid when required validation is used" + it "ANY_ADDRESS_POST_17c - Script with contradictory timelocks is invalid when recommended validation is used" + it "ANY_ADDRESS_POST_17d - script with mixed payment/delegation verification keys is invalid" + it "POST_ACCOUNT_01 - Can retrieve account public keys" + it "POST_ACCOUNT_02 - Can get account public key using purpose" + it "ANY_ADDRESS_POST_15 - Staking address using stake credential non-hashed" + it "ANY_ADDRESS_POST_16 - Staking address using stake credential hashed" + +spec = describe "BLOCKS" + it "LATEST_BLOCK Current tip is reported" + +spec = describe "VOTING_TRANSACTIONS" + it "VOTING_01a - Can vote and revote and then delegate" + it "VOTING_01b - Can vote and revote after delegation" + it "VOTING_01c - Can vote together with delegation" + it "VOTING_01d - Can joinStakePool and quitStakePool" + it "VOTING_01e - Cannot vote in Babbage" + it "VOTING_01f - Voting works in Conway in absence of pool delegation" + it "VOTING_01g - Voting works in Conway in presence of pool delegation" + it "VOTING_01h - Delegation works in Conway in presence of voting and does not change it" + it "VOTING_01i - Delegation works in Conway in presence of voting and does not change it" + it "VOTING_01j - Delegation works in Conway in presence of voting after wallet delations and restoration" + +spec = describe "SHARED_TRANSACTIONS" + it "SHARED_TRANSACTIONS_CREATE_01a -Empty payload is not allowed" + it "SHARED_TRANSACTIONS_CREATE_04d - Can't cover fee" + describe + it "SHARED_TRANSACTIONS_LIST_03 - Minimum withdrawal shouldn't be 0" + it "SHARED_TRANSACTIONS_LIST_04 - Deleted wallet" + it "SHARED_TRANSACTIONS_GET_02 - Deleted wallet" + it "SHARED_TRANSACTIONS_GET_03 - Using wrong transaction id" + it "SHARED_TRANSACTIONS_LIST_05 - filter address output side" + it "SHARED_TRANSACTIONS_LIST_06 - filter address input side" + +spec = describe "BYRON_COIN_SELECTION" + it "BYRON_COIN_SELECTION_00 - No coin selection on Byron random" + +spec = describe "SHARED_ADDRESSES" + it "SHARED_ADDRESSES_LIST_01 - Can list known addresses on a default wallet" + it "SHARED_ADDRESSES_LIST_02 - Can list known addresses on a pending wallet" + + describe "BYRON_ADDRESSES" + +spec = describe "SHELLEY_CLI_HW_WALLETS" + it "HW_WALLETS_01x - Restoration from account public key preserves funds" + describe "HW_WALLETS_03 - Cannot do operations requiring private key" + it "Cannot send tx" + it "Cannot update pass" + describe "HW_WALLETS_04 - Can manage HW wallet the same way as others" + it "Can update name" + it "Can get tx fee" + it "Can delete" + it "Can see utxo" + it "Can list addresses" + it "Can have address pool gap" + it "Can list transactions" + describe "HW_WALLETS_05 - Wallet from pubKey is available" + it "The same account and mnemonic wallet can live side-by-side" + describe "HW_WALLETS_06 - Test parameters" + describe "Wallet names valid" + describe "Wallet names invalid" + describe "Pub Key invalid" + describe "Address pool gap invalid" + +spec = describe "BYRON_HW_WALLETS" + it "HW_WALLETS_01 - Restoration from account public key preserves funds" + describe "HW_WALLETS_03 - Cannot do operations requiring private key" + it "Cannot send tx" + it "Cannot update pass" + describe "HW_WALLETS_04 - Can manage HW wallet the same way as others" + it "Can update name" + it "Can get tx fee" + it "Can delete" + it "Can see utxo" + it "Can list addresses" + it "Can have address pool gap" + it "Can list transactions" + it "Can get coin selection" + describe "HW_WALLETS_05 - Wallet from pubKey is available" + it "Can get wallet" + it "Can list wallet" + it "The same account and mnemonic wallet can live side-by-side" + +spec = describe "NEW_SHELLEY_TRANSACTIONS" + it "TRANS_NEW_JOIN_01b - Invalid pool id" + it "TRANS_NEW_JOIN_01b - Absent pool id" + it "TRANS_NEW_JOIN_01c - Multidelegation not supported" + it "TRANS_NEW_JOIN_01d - Multiaccount not supported" + it "TRANS_NEW_JOIN_01e - Can re-join and withdraw at once" + it "TRANS_NEW_JOIN_01f - Cannot re-join the same pool in Babbage" + it "TRANS_NEW_JOIN_01f - Can re-join the same pool in Conway" + it "TRANS_NEW_QUIT_01 - Cannot quit if not joined" +``` + +## E2E Tests + +``` +misc: + describe CardanoWallet::Misc::Node do + it 'Can get latest block header info' do + describe CardanoWallet::Misc::Network do + it 'Can get network information' do + it 'Can check network clock offset' do + it 'Can check network parameters' do + it 'SMASH health - unreachable' do + it 'SMASH health - bad url' do + it 'Inspect invalid address' do + it 'Inspect Shelley payment address' do + it 'Inspect Shelley stake address' do + it 'Inspect Byron Random address' do + it 'Inspect Byron Icarus address' do + it 'Enterprise script address - signature' do + it 'Enterprise script address - any' do + it 'Enterprise script address - all' do + it 'Enterprise script address - some' do + it 'Reward account script address - any' do + it 'Delegating script address - any' do + it 'Enterprise pub key address' do + it 'Reward account pub key address' do + it 'Delegating address with both pub key credentials' do + it 'Delegating address - payment from script, stake from key' do + it 'Delegating address - payment from key, stake from script' do + it 'Malformed payload when tx is not binary' do +shared: it 'I can create, get and delete wallet from mnemonics getting acc_xpub from cardano-address' do + it 'I can create, get and delete wallet from pub key getting acc_xpub from cardano-address' do + it 'Cannot create wallet with different acc xpub - derived from different mnemonic sentence' do + it 'Cannot create wallet with different acc xpub - derived from different acc ix' do + it 'I can create incomplete wallet and update cosigners with acc_xpub from cardano-address' do + it 'Create / update partially / get / list / delete' do + it 'Cannot update main cosigner' do + it 'Shared walletid with only spending template from cardano-addresses' do + it 'Shared walletid with spending and delegation template from cardano-addresses' do + it 'Can see utxo' do + it 'Can see utxo snapshot' do + it 'Can list addresses on active shared wallet - from pub key' do + it 'Can list addresses on active shared wallet - from mnemonics' do + it 'Lists empty addresses on incomplete shared wallet - from pub key' do + it 'Lists empty addresses on incomplete shared wallet - from mnemonics' do + it 'Get public key - incomplete wallet from mnemonics' do + it 'Get public key - incomplete wallet from acc pub key' do + it 'Get public key - active wallet from mnemonics' do + it 'Get public key - active wallet from acc pub key' do + it 'Create account public key - incomplete wallet from mnemonics' do + it 'Cannot create account public key - incomplete wallet from acc pub key' do + it 'Create account public key - active wallet from mnemonics' do + it 'Cannot create account public key - active wallet from acc pub key' do + it 'Get account public key - active wallet from mnemonics' do + it 'Get account public key - active wallet from acc pub key' do + it 'Get account public key - incomplete wallet from mnemonics' do + it 'Get account public key - incomplete wallet from acc pub key' do + it 'I could get a tx if I had proper id' do + it 'Can list transactions' do +e2e: it 'ADP-2523 - Make sure there are no null values in the response', :adp_2523 do + it 'AlwaysFails.plutus with collateral return to the wallet' do + it 'cannot balance on empty wallet' do + it 'ping-pong' do + it 'game' do + it 'mint-burn' do + it 'withdrawal' do + it 'currency' do + it 'I can get min_utxo_value when contructing tx' do + it 'Single output transaction' do + it 'Multi output transaction' do + it 'Multi-assets transaction' do + it 'Only withdrawal' do + it 'Only metadata' do + it 'Validity intervals' do + it 'Delegation (join and quit)' do + it 'Can mint and then burn' do + it 'Can mint and burn with metadata' do + it 'Can mint NFT attaching CIP-25 metadata' do + it 'Can mint and burn in the same tx' do + it 'Can mint and burn the same asset in single tx' do + it 'Cannot burn with wrong policy_script or more than I have' do + it 'Cannot mint if I make too big transaction' do + it 'Fixture shelley wallet has utxos' do + it 'I can list native assets' do + it 'I can list native assets and get offchain metadata', :offchain do + it 'I can send native assets tx and they are received' do + it 'I can create migration plan shelley -> shelley' do + it 'I can send transaction and funds are received (min_utxo_value)' do + it 'I can send transaction with ttl and funds are received' do + it 'Transaction with ttl = 0 would expire and I can forget it' do + it 'I can send transaction with metadata' do + it 'I can estimate fee (min_utxo_value)' do + it 'I can list transactions and limit response with query parameters' do + it 'I could check delegation fees - if I could cover fee' do + it 'Can list stake pools only when stake is provided' do + it 'Can join and quit Stake Pool' do + it 'I can trigger random coin selection' do + it 'I can trigger random coin selection delegation action' do + it 'I could trigger random coin selection delegation action - if I had money' do + it 'I could trigger random coin selection delegation action - if I known pool id' do + it 'I can update passphrase with mnemonic and the wallet does not have to re-sync' do + it 'Fixture shared wallets have utxos' do + it 'I can estimate fees (min_utxo_value), random' do + it 'I can estimate fees (min_utxo_value), icarus' do + it 'I can send transaction and funds are received (min_utxo_value), random -> shelley' do + it 'I can send transaction and funds are received (min_utxo_value), icarus -> shelley' do + it 'I can send native assets tx and they are received (random -> shelley)' do + it 'I can send native assets tx and they are received (icarus -> shelley)' do + it 'I can list transactions and limit response with query parameters (byron)' do + it 'I can list transactions and limit response with query parameters (icarus)' do + it 'I can create migration plan byron -> shelley' do + it 'I can create migration plan icarus -> shelley' do + it 'I can list assets -> random' do + it 'I can list assets -> icarus' do + it 'I can list assets with offchain metadata -> random', :offchain do + it 'I can list assets with offchain metadata -> icarus', :offchain do + it 'Submit tx via POST /proxy/transactions' do + it 'Cannot submit unsigned tx via POST /proxy/transactions' do + it 'I can migrate all funds back to fixture wallet' do +byron: it 'I can list byron wallets' do + it 'I could get a wallet' do + it 'I could delete a wallet' do + it 'I can create, get and delete byron icarus wallet from mnemonics' do + it 'I can create, get and delete byron random wallet from mnemonics' do + it 'Can see utxo' do + it 'Can see utxo snapshot' do + it 'Can list addresses - random', :adp_2211 do + it 'Can list addresses - icarus' do + it 'Can list addresses - ledger' do + it 'Can list addresses - trezor' do + it 'Can create address - random' do + it 'I can import address - random' do + it 'I cannot import address - icarus' do + it 'I cannot import address - ledger' do + it 'I cannot import address - trezor' do + it 'I could trigger random coin selection - if had money' do + it 'I could create migration plan - icarus' do + it 'I could create migration plan - random' do + it 'I could migrate all my funds' do +shelley: it 'I can list wallets' do + it 'When wallet does not exist it gives 404' do + it 'I can create, get and delete wallet from mnemonics' do + it 'I can create, get and delete wallet from mnemonics / second factor' do + it 'I can set address pool gap' do + it 'I can create, get and delete wallet from pub key' do + it 'I can get Shelley walletid using cardano-addresses' do + it 'Shelley walletid is not based on acct key' do + it 'Can update_metadata' do + it 'Can update_passphrase' do + it 'Cannot update_passphrase not knowing old pass' do + it 'Can update_passphrase, mnemonics' do + it 'Can update_passphrase, mnemonics, mnemonic_second_factor' do + it 'Cannot update_passphrase with wrong mnemonics' do + it 'Cannot update_passphrase with wrong mnemonic_second_factor' do + it 'Cannot update_passphrase of wallet from pub key' do + it 'Can update_passphrase of wallet from pub key using mnemonics from which pub key is derived' do + it 'Cannot update_passphrase of wallet from pub key using wrong mnemonics' do + it 'Can see utxo' do + it 'Can see utxo snapshot' do + it 'Can list addresses' do + it 'I could trigger random coin selection - if had money' do + it 'I could get a tx if I had proper id' do + it 'Can list transactions' do + it 'I could create transaction - if I had money' do + it 'I could create transaction using rewards - if I had money' do + it 'I could estimate transaction fee - if I had money' do + it 'I could forget transaction' do + it 'I can list stake keys' do + it 'pool_metadata_source = direct <> none' do + it 'I could quit stake pool - if I was delegating' do + it 'I could create migration plan' do + it 'I could migrate all my funds' do + it 'Get signed metadata' do + it 'Get public key' do + it 'Create account public key - extended' do + it 'Create account public key - non_extended' do + it 'Create account public key - extended with purpose' do + it 'Create account public key - non_extended with purpose' do + it 'Get account public key - wallet from acc pub key' do + it 'Get account public key - wallet from mnemonics' do + it 'Get account public key (mnemonic_snd_factor)' do +e2e_shared: it 'Fixture shared wallets have utxos' do + it 'Cannot submit if partially signed - one cosigner, all' do + it 'Cannot submit if tx is foreign - two cosigners, all' do + it 'Single output transaction - two cosigners, all' do + it 'Multi output transaction - two cosigners, all' do + it 'Multi-assets transaction - two cosigners, all' do + it 'Validity intervals - two cosigners, all' do + it 'Only metadata - two cosigners, all' do + it 'Single output transaction - one cosigner, any' do + it 'I can get min_utxo_value when contructing tx' do + it 'Single output transaction' do + it 'Multi output transaction' do + it 'Multi-assets transaction' do + it 'Validity intervals' do + it 'Only metadata' do + it 'Delegation (join and quit)' do + it 'Can mint and then burn (without submitting)' do + it 'I can receive transaction to shared wallet' do + it 'I can list transactions and limit response with query parameters' do + it 'I can migrate all funds back to fixture shared wallet' do +``` From ee822715f0796338a1780131c1995e5a6a8a6c71 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Thu, 21 Nov 2024 09:51:31 +0100 Subject: [PATCH 2/6] Remove 'misc' E2E tests These tests are actually testing other software, namely cardano-address and SMASH which are outside our control. And we know for a fact the former is thoroughly tested. --- test/e2e/spec/misc_spec.rb | 357 ------------------------------------- tests.md | 11 +- 2 files changed, 10 insertions(+), 358 deletions(-) delete mode 100644 test/e2e/spec/misc_spec.rb diff --git a/test/e2e/spec/misc_spec.rb b/test/e2e/spec/misc_spec.rb deleted file mode 100644 index 9e97fea58d9..00000000000 --- a/test/e2e/spec/misc_spec.rb +++ /dev/null @@ -1,357 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe CardanoWallet::Misc, :all, :misc do - describe CardanoWallet::Misc::Node do - it 'Can get latest block header info' do - res = NODE.block_header - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'block_height' - expect(res.to_s).to include 'header_hash' - expect(res.to_s).to include 'slot_no' - end - end - - describe CardanoWallet::Misc::Network do - it 'Can get network information' do - res = NETWORK.information - expect(res).to be_correct_and_respond 200 - expect(res['network_info']['protocol_magic']).to eq get_protocol_magic(CONTEXT.env) - expect(res['network_info']['network_id']).to eq 'testnet' - expect(res['wallet_mode']).to eq 'node' - end - - it 'Can check network clock offset' do - res = NETWORK.clock - expect(res).to be_correct_and_respond 200 - end - - it 'Can check network parameters' do - network_params = %w[slot_length - decentralization_level - maximum_token_bundle_size - genesis_block_hash - blockchain_start_time - desired_pool_number - execution_unit_prices - eras - minimum_collateral_percentage - active_slot_coefficient - security_parameter - maximum_collateral_input_count] - res = NETWORK.parameters - expect(res).to be_correct_and_respond 200 - network_params.each do |p| - expect(res.to_s).to include p - end - end - end - - describe CardanoWallet::Misc::Utils do - describe 'SMASH health' do - it 'SMASH health - unreachable' do - r = UTILS.smash_health({ url: 'http://onet.pl' }) - expect(r).to be_correct_and_respond 200 - expect(r.to_s).to include 'unreachable' - end - - it 'SMASH health - bad url' do - r = UTILS.smash_health({ url: 'dsds' }) - expect(r).to be_correct_and_respond 400 - expect(r.to_s).to include 'bad_request' - end - end - - it 'Inspect invalid address' do - addr = 'addr' - res = UTILS.addresses addr - expect(res).to be_correct_and_respond 400 - expect(res.to_s).to include 'bad_request' - end - - it 'Inspect Shelley payment address' do - addr = 'addr1qqlgm2dh3vpv07cjfcyuu6vhaqhf8998qcx6s8ucpkly6f8l0dw5r75vk42mv3ykq8vyjeaanvpytg79xqzymqy5acmqej0mk7' - res = UTILS.addresses addr - - expect(res).to be_correct_and_respond 200 - expect(res['address_style']).to eq 'Shelley' - expect(res['stake_reference']).to eq 'by value' - expect(res['stake_key_hash']).to eq 'ff7b5d41fa8cb555b6449601d84967bd9b0245a3c530044d8094ee36' - expect(res['spending_key_hash']).to eq '3e8da9b78b02c7fb124e09ce6997e82e9394a7060da81f980dbe4d24' - expect(res['network_tag']).to eq 0 - end - - it 'Inspect Shelley stake address' do - addr = 'stake_test1uzws33ghf8kugc8ea8p7h8mr7dcsl6ggw7tfy479y9t0d4qp48dkq' - res = UTILS.addresses addr - - expect(res).to be_correct_and_respond 200 - expect(res['address_style']).to eq 'Shelley' - expect(res['stake_reference']).to eq 'by value' - expect(res['stake_key_hash']).to eq '9d08c51749edc460f9e9c3eb9f63f3710fe90877969257c52156f6d4' - expect(res['network_tag']).to eq 0 - end - - it 'Inspect Byron Random address' do - addr = '37btjrVyb4KEzz6YprjHfqz3DS4JvoDpAf3QWLABzQ7uzMEk7g3PD2AwL1SbYWekneuRFkyTipbyKMZyEMed5LroZtQAvA2LqcWmJuwaqt6oJLbssS' - res = UTILS.addresses addr - - expect(res).to be_correct_and_respond 200 - expect(res['address_style']).to eq 'Byron' - expect(res['stake_reference']).to eq 'none' - expect(res['address_root']).to eq 'c23a0f86c7bc977f0dee4721c9850467047a0e6acd928a991b5cbba8' - expect(res['derivation_path']).to eq '581c6a6589ca57730b33d1bb316c13a76d7794a11ba2d077724bdfb51b45' - expect(res['network_tag']).to eq 1_097_911_063 - end - - it 'Inspect Byron Icarus address' do - addr = '2cWKMJemoBajQcoTotf4xYba7fV7Ztx7AvbnzvaQY6PbezPWM6DtJD6Df2bVejBCpykmt' - res = UTILS.addresses addr - - expect(res).to be_correct_and_respond 200 - expect(res['address_style']).to eq 'Icarus' - expect(res['stake_reference']).to eq 'none' - expect(res['address_root']).to eq '88940c753ee50d556ecaefadd0d2fee9fabacf4366a7d4a8cdfa2b64' - expect(res['network_tag']).to eq 1_097_911_063 - end - - describe 'Construct addresses' do - it 'Enterprise script address - signature' do - script = { - payment: 'addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq' - } - res = UTILS.post_address(script) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include 'addr_test1wrrqr8fmk4ulc7pgycd96fuqcg40e5ecuway0ypc2tsnteqqu6qs0' - end - - it 'Enterprise script address - any' do - script = { - payment: { - any: %w[ - addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq - addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp - ] - } - } - res = UTILS.post_address(script) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include 'addr_test1wrjtlgneqelxxlckcsgrkd7rd6ycrgegu5th24x0f058gmqvc8s20' - end - - it 'Enterprise script address - all' do - addr1 = 'addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq' - addr2 = 'addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp' - script = { - payment: { - all: [ - addr1, - addr2 - ] - } - } - ca_script_hash = CA.script_hash("all [#{addr1}, #{addr2}]") - script_hash = { payment: ca_script_hash } - - script_res = UTILS.post_address(script) - expect(script_res).to be_correct_and_respond 202 - script_hash_res = UTILS.post_address(script_hash) - expect(script_hash_res).to be_correct_and_respond 202 - - expect(script_res['address']).to eq script_hash_res['address'] - - expect(script_res['address']).to eq 'addr_test1wpq0ghwy73wapjcdwqxm6ytwe66j8eccsmn9jptshrjerashp7y82' - end - - it 'Enterprise script address - some' do - addr1 = 'addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq' - addr2 = 'addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp' - addr3 = 'addr_shared_vkh175wsm9ckhm3snwcsn72543yguxeuqm7v9r6kl6gx57h8gdydcd9' - script = { - payment: { - some: { - from: [ - addr1, - addr2, - addr3 - ], - at_least: 2 - } - } - } - ca_script_hash = CA.script_hash("at_least 2 [#{addr1}, #{addr2}, #{addr3}]") - script_hash = { payment: ca_script_hash } - - script_res = UTILS.post_address(script) - expect(script_res).to be_correct_and_respond 202 - script_hash_res = UTILS.post_address(script_hash) - expect(script_hash_res).to be_correct_and_respond 202 - - expect(script_res['address']).to eq script_hash_res['address'] - expect(script_res['address']).to eq 'addr_test1wqqmnmwuh85e0fxaggl6ac2hfeqncg76gsr0ld8qdjd84agpc0nuz' - end - - it 'Reward account script address - any' do - addr1 = 'stake_shared_vkh1nqc00hvlc6cq0sfhretk0rmzw8dywmusp8retuqnnxzajtzhjg5' - addr2 = 'stake_shared_vkh1nac0awgfa4zjsh4elnjmsscz0huhss8q2g0x3n7m539mwaa5m7s' - script = { - stake: { - any: [ - addr1, - addr2 - ] - } - } - - ca_script_hash = CA.script_hash("any [#{addr1}, #{addr2}]") - script_hash = { stake: ca_script_hash } - - script_res = UTILS.post_address(script) - expect(script_res).to be_correct_and_respond 202 - script_hash_res = UTILS.post_address(script_hash) - expect(script_hash_res).to be_correct_and_respond 202 - - expect(script_res['address']).to eq script_hash_res['address'] - expect(script_res['address']).to eq 'stake_test17qshpfjkgh98wumvnn9y3yfhevllp4y04u6y84q3flxcv9s2kvrnx' - end - - it 'Delegating script address - any' do - addr1 = 'addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq' - addr2 = 'addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp' - addr3 = 'addr_shared_vkh175wsm9ckhm3snwcsn72543yguxeuqm7v9r6kl6gx57h8gdydcd9' - addr4 = 'addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq' - addr5 = 'addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp' - script = { - payment: { - some: { - from: [ - addr1, - addr2, - addr3 - ], - at_least: 2 - } - }, - stake: { - any: [ - addr4, - addr5 - ] - } - } - ca_script_hash_payment = CA.script_hash("at_least 2 [#{addr1}, #{addr2}, #{addr3}]") - ca_script_hash_stake = CA.script_hash("any [#{addr4}, #{addr5}]") - script_hash = { payment: ca_script_hash_payment, stake: ca_script_hash_stake } - - script_res = UTILS.post_address(script) - expect(script_res).to be_correct_and_respond 202 - script_hash_res = UTILS.post_address(script_hash) - expect(script_hash_res).to be_correct_and_respond 202 - - expect(script_res['address']).to eq script_hash_res['address'] - expect(script_res['address']).to eq 'addr_test1xqqmnmwuh85e0fxaggl6ac2hfeqncg76gsr0ld8qdjd84a0yh738jpn7vdl3d3qs8vmuxm5fsx3j3eghw42v7jlgw3kqrw53af' - end - - it 'Enterprise pub key address' do - script = { - payment: 'addr_vk1lqglg77z6kajsdz4739q22c0zm0yhuy567z6xk2vc0z5ucjtkwpschzd2j' - } - res = UTILS.post_address(script) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include 'addr_test1vpqthemrg5kczwfjjnahwt65elhrl95e9hcgufnajtp6wfgdmxm9u' - end - - it 'Reward account pub key address' do - script = { - stake: 'stake_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7qau558d' - } - res = UTILS.post_address(script) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include 'stake_test1uq6pmlvyl3wn4ca6807e26gy2gek9hqu0gastzh5tk0xx0gdfvj8f' - end - - it 'Delegating address with both pub key credentials' do - script = { - payment: 'addr_vk1lqglg77z6kajsdz4739q22c0zm0yhuy567z6xk2vc0z5ucjtkwpschzd2j', - stake: 'stake_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7qau558d' - } - res = UTILS.post_address(script) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include 'addr_test1qpqthemrg5kczwfjjnahwt65elhrl95e9hcgufnajtp6wff5rh7cflza8t3m5wlaj45sg53nvtwpc73mqk90ghv7vv7ser7yl4' - end - - it 'Delegating address - payment from script, stake from key' do - script = { - payment: { - some: { - from: %w[ - addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq - addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp - addr_shared_vkh175wsm9ckhm3snwcsn72543yguxeuqm7v9r6kl6gx57h8gdydcd9 - ], - at_least: 2 - } - }, - stake: 'stake_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7qau558d' - } - res = UTILS.post_address(script) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include 'addr_test1zqqmnmwuh85e0fxaggl6ac2hfeqncg76gsr0ld8qdjd84af5rh7cflza8t3m5wlaj45sg53nvtwpc73mqk90ghv7vv7sq4jdnx' - end - - it 'Delegating address - payment from key, stake from script' do - script = { - payment: 'addr_vk1lqglg77z6kajsdz4739q22c0zm0yhuy567z6xk2vc0z5ucjtkwpschzd2j', - stake: { - some: { - from: %w[ - addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq - addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp - addr_shared_vkh175wsm9ckhm3snwcsn72543yguxeuqm7v9r6kl6gx57h8gdydcd9 - ], - at_least: 2 - } - } - } - res = UTILS.post_address(script) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include 'addr_test1ypqthemrg5kczwfjjnahwt65elhrl95e9hcgufnajtp6wfgph8kaew0fj7jd6s3l4ms4wnjp8s3a53qxl76wqmy60t6snk9ahl' - end - end - end - - describe CardanoWallet::Misc::Proxy do - it 'Malformed payload when tx is not binary' do - pending 'ADP-1145 - DecoderErrorDeserialiseFailure error message from the API /proxy/transactions' - no_binary_blob = 'test' - res = PROXY.submit_external_transaction(no_binary_blob) - expect(res).to be_correct_and_respond 400 - expect(res.to_s).to include 'malformed_tx_payload' - end - end - - describe CardanoWallet::Misc::Settings do - after(:all) do - SETTINGS.update({ pool_metadata_source: 'none' }) - end - - matrix = { 'direct' => 'no_smash_configured', - 'https://smash.pl' => 'unreachable', - 'none' => 'no_smash_configured' } - - matrix.each do |strategy, smash_health_response| - it "I can read and update settings to #{strategy} and verify SMASH health = #{smash_health_response}" do - s = SETTINGS.update({ pool_metadata_source: strategy }) - expect(s).to be_correct_and_respond 204 - - g = SETTINGS.get - expect(g['pool_metadata_source']).to eq strategy - expect(g).to be_correct_and_respond 200 - - # check smash health - r = UTILS.smash_health - expect(r).to be_correct_and_respond 200 - expect(r.to_s).to include smash_health_response - end - end - end -end diff --git a/tests.md b/tests.md index e59394f194e..b5b40d944bc 100644 --- a/tests.md +++ b/tests.md @@ -623,6 +623,11 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" ## E2E Tests +the following tests are actually not about cardano-wallet at all but testing other utilities: [cardano-address]() +They also depend on code defined in [cardano-wallet-rb](https://github.com/piotr-iohk/cardano-wallet-rb) + +**They can be safely discarded** + ``` misc: describe CardanoWallet::Misc::Node do @@ -648,8 +653,12 @@ misc: it 'Reward account pub key address' do it 'Delegating address with both pub key credentials' do it 'Delegating address - payment from script, stake from key' do - it 'Delegating address - payment from key, stake from script' do + it 'Delegating address - payment from key, stake from script' d it 'Malformed payload when tx is not binary' do +``` + + +``` shared: it 'I can create, get and delete wallet from mnemonics getting acc_xpub from cardano-address' do it 'I can create, get and delete wallet from pub key getting acc_xpub from cardano-address' do it 'Cannot create wallet with different acc xpub - derived from different mnemonic sentence' do From d34dc1959305c3afa44c997deb616d4a53daf574 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Tue, 26 Nov 2024 16:13:32 +0100 Subject: [PATCH 3/6] Remove wrong statement about what ruby e2e tests are testing --- tests.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests.md b/tests.md index b5b40d944bc..51b3915dee7 100644 --- a/tests.md +++ b/tests.md @@ -623,11 +623,6 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" ## E2E Tests -the following tests are actually not about cardano-wallet at all but testing other utilities: [cardano-address]() -They also depend on code defined in [cardano-wallet-rb](https://github.com/piotr-iohk/cardano-wallet-rb) - -**They can be safely discarded** - ``` misc: describe CardanoWallet::Misc::Node do From fabbdef5c8b30b6ca4343fc023be8c329d06548c Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Thu, 12 Dec 2024 08:01:49 +0100 Subject: [PATCH 4/6] Remove ruby e2e tests and corresponding CI actions --- .buildkite/pipeline.yml | 20 - nix/haskell.nix | 2 - nix/release-package.nix | 1 - scripts/buildkite/main/linux-e2e.sh | 53 - scripts/buildkite/main/macos-silicon-e2e.sh | 54 - .../buildkite/release/release-candidate.sh | 16 +- scripts/check-bundle.rb | 64 - scripts/connect_wallet.rb | 30 - test/e2e/.envrc | 17 - test/e2e/.gitattributes | 9 - test/e2e/.gitignore | 26 - test/e2e/.rake_tasks~ | 21 - test/e2e/.rspec | 3 - test/e2e/.rubocop.yml | 44 - test/e2e/.ruby-version | 1 - test/e2e/Gemfile | 12 - test/e2e/Gemfile.lock | 58 - test/e2e/README.md | 174 - test/e2e/Rakefile | 429 --- test/e2e/docker-compose-test.yml | 24 - test/e2e/docker_compose.sh | 10 - test/e2e/env.rb | 34 - test/e2e/fixtures/create-wallets.sh | 142 - test/e2e/fixtures/fixture_wallets.json.gpg | Bin 2230 -> 0 bytes test/e2e/fixtures/plutus/42.redeemer | 1 - test/e2e/fixtures/plutus/alwaysfails.plutus | 5 - .../fixtures/plutus/anyone-can-mint.plutus | 5 - test/e2e/fixtures/plutus/currency.json | 22 - test/e2e/fixtures/plutus/currency_policy | 1 - test/e2e/fixtures/plutus/game_1.json | 5 - test/e2e/fixtures/plutus/game_2.json | 31 - test/e2e/fixtures/plutus/game_3.json | 26 - test/e2e/fixtures/plutus/mintBurn_1.json | 11 - test/e2e/fixtures/plutus/mintBurn_2.json | 11 - test/e2e/fixtures/plutus/mintBurn_policy | 1 - test/e2e/fixtures/plutus/ping-pong_1.json | 5 - test/e2e/fixtures/plutus/ping-pong_2.json | 26 - test/e2e/fixtures/plutus/withdrawal.json | 11 - test/e2e/fixtures/plutus/withdrawal_validator | 1 - .../withdrawal_validator_cardano_cli.script | 1 - test/e2e/fixtures/simple/policy.script | 9 - test/e2e/fixtures/simple/policy.skey | 5 - test/e2e/fixtures/simple/policy.vkey | 5 - .../wallet_assets/happy_coin/policy.script | 9 - .../wallet_assets/happy_coin/policy.skey | 5 - .../wallet_assets/happy_coin/policy.vkey | 5 - .../wallet_assets/sad_coin/policy.script | 9 - .../wallet_assets/sad_coin/policy.skey | 5 - .../wallet_assets/sad_coin/policy.vkey | 5 - test/e2e/flake.lock | 61 - test/e2e/flake.nix | 52 - test/e2e/gemset.nix | 232 -- test/e2e/helpers/buildkite.rb | 74 - test/e2e/helpers/cardano_addresses.rb | 32 - test/e2e/helpers/cardano_cli.rb | 149 - test/e2e/helpers/context.rb | 22 - test/e2e/helpers/matchers.rb | 69 - test/e2e/helpers/tx_history.rb | 129 - test/e2e/helpers/utils.rb | 179 - test/e2e/helpers/wallet_factory.rb | 41 - test/e2e/regenerate-nix.sh | 3 - test/e2e/run_all_tests.sh | 8 - test/e2e/spec/byron_spec.rb | 343 -- test/e2e/spec/e2e_shared_spec.rb | 1549 -------- test/e2e/spec/e2e_spec.rb | 3389 ----------------- test/e2e/spec/shared_spec.rb | 786 ---- test/e2e/spec/shelley_spec.rb | 699 ---- test/e2e/spec/spec_helper.rb | 683 ---- test/e2e/state/configs/preprod | 1 - tests.md | 828 ---- 70 files changed, 4 insertions(+), 10789 deletions(-) delete mode 100755 scripts/buildkite/main/linux-e2e.sh delete mode 100755 scripts/buildkite/main/macos-silicon-e2e.sh delete mode 100755 scripts/check-bundle.rb delete mode 100755 scripts/connect_wallet.rb delete mode 100644 test/e2e/.envrc delete mode 100644 test/e2e/.gitattributes delete mode 100644 test/e2e/.gitignore delete mode 100644 test/e2e/.rake_tasks~ delete mode 100644 test/e2e/.rspec delete mode 100644 test/e2e/.rubocop.yml delete mode 100644 test/e2e/.ruby-version delete mode 100644 test/e2e/Gemfile delete mode 100644 test/e2e/Gemfile.lock delete mode 100644 test/e2e/README.md delete mode 100644 test/e2e/Rakefile delete mode 100644 test/e2e/docker-compose-test.yml delete mode 100755 test/e2e/docker_compose.sh delete mode 100644 test/e2e/env.rb delete mode 100755 test/e2e/fixtures/create-wallets.sh delete mode 100644 test/e2e/fixtures/fixture_wallets.json.gpg delete mode 100644 test/e2e/fixtures/plutus/42.redeemer delete mode 100644 test/e2e/fixtures/plutus/alwaysfails.plutus delete mode 100644 test/e2e/fixtures/plutus/anyone-can-mint.plutus delete mode 100644 test/e2e/fixtures/plutus/currency.json delete mode 100644 test/e2e/fixtures/plutus/currency_policy delete mode 100644 test/e2e/fixtures/plutus/game_1.json delete mode 100644 test/e2e/fixtures/plutus/game_2.json delete mode 100644 test/e2e/fixtures/plutus/game_3.json delete mode 100644 test/e2e/fixtures/plutus/mintBurn_1.json delete mode 100644 test/e2e/fixtures/plutus/mintBurn_2.json delete mode 100644 test/e2e/fixtures/plutus/mintBurn_policy delete mode 100644 test/e2e/fixtures/plutus/ping-pong_1.json delete mode 100644 test/e2e/fixtures/plutus/ping-pong_2.json delete mode 100644 test/e2e/fixtures/plutus/withdrawal.json delete mode 100644 test/e2e/fixtures/plutus/withdrawal_validator delete mode 100644 test/e2e/fixtures/plutus/withdrawal_validator_cardano_cli.script delete mode 100644 test/e2e/fixtures/simple/policy.script delete mode 100644 test/e2e/fixtures/simple/policy.skey delete mode 100644 test/e2e/fixtures/simple/policy.vkey delete mode 100644 test/e2e/fixtures/wallet_assets/happy_coin/policy.script delete mode 100644 test/e2e/fixtures/wallet_assets/happy_coin/policy.skey delete mode 100644 test/e2e/fixtures/wallet_assets/happy_coin/policy.vkey delete mode 100644 test/e2e/fixtures/wallet_assets/sad_coin/policy.script delete mode 100644 test/e2e/fixtures/wallet_assets/sad_coin/policy.skey delete mode 100644 test/e2e/fixtures/wallet_assets/sad_coin/policy.vkey delete mode 100644 test/e2e/flake.lock delete mode 100644 test/e2e/flake.nix delete mode 100644 test/e2e/gemset.nix delete mode 100644 test/e2e/helpers/buildkite.rb delete mode 100644 test/e2e/helpers/cardano_addresses.rb delete mode 100644 test/e2e/helpers/cardano_cli.rb delete mode 100644 test/e2e/helpers/context.rb delete mode 100644 test/e2e/helpers/matchers.rb delete mode 100644 test/e2e/helpers/tx_history.rb delete mode 100644 test/e2e/helpers/utils.rb delete mode 100644 test/e2e/helpers/wallet_factory.rb delete mode 100755 test/e2e/regenerate-nix.sh delete mode 100755 test/e2e/run_all_tests.sh delete mode 100644 test/e2e/spec/byron_spec.rb delete mode 100644 test/e2e/spec/e2e_shared_spec.rb delete mode 100644 test/e2e/spec/e2e_spec.rb delete mode 100644 test/e2e/spec/shared_spec.rb delete mode 100644 test/e2e/spec/shelley_spec.rb delete mode 100644 test/e2e/spec/spec_helper.rb delete mode 120000 test/e2e/state/configs/preprod delete mode 100644 tests.md diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 855a042177d..d6868a8c91b 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -123,26 +123,6 @@ steps: agents: system: ${linux} - - block: Run Ruby E2E Tests (linux) - if: build.env("RELEASE_CANDIDATE") == null - depends_on: [] - key: trigger-e2e-tests - - - label: Run Ruby Linux E2E Tests (linux) - depends_on: - - trigger-e2e-tests - commands: | - ./scripts/buildkite/main/linux-e2e.sh - artifact_paths: - - "./result/linux/**" - - "./logs/**/*" - env: - NODE_STATE_DIR: "${STATE_DIR?}/node/preprod" - agents: - system: ${linux} - concurrency: 1 - concurrency_group: 'linux-e2e-tests' - - label: Preview Network Boot Sync timeout_in_minutes: 2 depends_on: [] diff --git a/nix/haskell.nix b/nix/haskell.nix index 08ce8b1999f..dc3665ed720 100644 --- a/nix/haskell.nix +++ b/nix/haskell.nix @@ -134,8 +134,6 @@ CHaP: haskell-nix: nixpkgs-recent: nodePkgs: haskell-nix.cabalProject' [ just pkg-config nixpkgs-recent.python3Packages.openapi-spec-validator - (ruby_3_1.withPackages (ps: [ ps.rake ps.thor ])) - rubyPackages_3_1.rubocop sqlite-interactive curlFull jq diff --git a/nix/release-package.nix b/nix/release-package.nix index ca3acc682c8..bba8070a3d4 100644 --- a/nix/release-package.nix +++ b/nix/release-package.nix @@ -45,7 +45,6 @@ pkgs.stdenv.mkDerivation { ++ lib.optionals makeTarball [ gnutar gzip ] ++ lib.optionals makeZip [ zip ]; checkInputs = with pkgs.buildPackages; [ - ruby_3_1 gnugrep gnused ] diff --git a/scripts/buildkite/main/linux-e2e.sh b/scripts/buildkite/main/linux-e2e.sh deleted file mode 100755 index af977aecadb..00000000000 --- a/scripts/buildkite/main/linux-e2e.sh +++ /dev/null @@ -1,53 +0,0 @@ -#! /usr/bin/env -S nix shell 'nixpkgs#rsync' 'nixpkgs#gnutar' 'nixpkgs#gnupg' --command bash -# shellcheck shell=bash - -set -euox pipefail - -mkdir -p "$(pwd)/logs" - -TESTS_LOGDIR="$(pwd)/logs" -export TESTS_LOGDIR - -CARDANO_NODE_CONFIGS="$(pwd)/configs/cardano" -export CARDANO_NODE_CONFIGS - -CURRENT_VERSION=v2024-11-18 - -VERSION=$(buildkite-agent meta-data get "release-version" --default "$CURRENT_VERSION") - -echo "VERSION=$VERSION" - -buildkite-agent artifact \ - download "result/linux/cardano-wallet-$VERSION-linux64.tar.gz" "." - -tar xvzf "result/linux/cardano-wallet-$VERSION-linux64.tar.gz" - -TESTS_E2E_BINDIR="$(pwd)/cardano-wallet-$VERSION-linux64" -export TESTS_E2E_BINDIR - -cd test/e2e - -TESTS_NODE_DB="$(pwd)/state/node_db" -export TESTS_NODE_DB - -mkdir -p "$TESTS_NODE_DB"/preprod -rsync -a --delete "$NODE_STATE_DIR/db/" "$TESTS_NODE_DB/preprod" - -tmpfile=$(mktemp /tmp/node-preprod.XXXXXX) - -CARDANO_NODE_SOCKET_PATH="$tmpfile" -export CARDANO_NODE_SOCKET_PATH - -TESTS_E2E_STATEDIR=$(pwd)/state -export TESTS_E2E_STATEDIR - -TESTS_E2E_TOKEN_METADATA=https://metadata.world.dev.cardano.org/ -export TESTS_E2E_TOKEN_METADATA - -TESTS_E2E_FIXTURES="$FIXTURE_DECRYPTION_KEY" - -export TESTS_E2E_FIXTURES - -nix develop -c rake "run_on[preprod,sync,true]" # SPEC_OPTS="-e ''" - -rm "$tmpfile" diff --git a/scripts/buildkite/main/macos-silicon-e2e.sh b/scripts/buildkite/main/macos-silicon-e2e.sh deleted file mode 100755 index 59b521000c5..00000000000 --- a/scripts/buildkite/main/macos-silicon-e2e.sh +++ /dev/null @@ -1,54 +0,0 @@ -#! /usr/bin/env bash -# shellcheck shell=bash - -set -euox pipefail - -mkdir -p "$(pwd)/logs" - -TESTS_LOGDIR="$(pwd)/logs" -export TESTS_LOGDIR - -CARDANO_NODE_CONFIGS="$(pwd)/configs/cardano" -export CARDANO_NODE_CONFIGS - -CURRENT_VERSION=v2024-11-18 - -VERSION=$(buildkite-agent meta-data get "release-version" --default $CURRENT_VERSION) -echo "VERSION=$VERSION" - -buildkite-agent artifact \ - download "result/macos-silicon/cardano-wallet-$VERSION-macos-silicon.tar.gz" "." - -tar xvzf "result/macos-silicon/cardano-wallet-$VERSION-macos-silicon.tar.gz" - -TESTS_E2E_BINDIR="$(pwd)/cardano-wallet-$VERSION-macos-silicon" -export TESTS_E2E_BINDIR - -cd test/e2e - -TESTS_NODE_DB="$(pwd)/state/node_db" -export TESTS_NODE_DB - -mkdir -p "$TESTS_NODE_DB"/preprod -rsync -a --delete "$NODE_STATE_DIR/db/" "$TESTS_NODE_DB/preprod" - -tmpdir=$(mktemp -d /tmp/node-preprod.XXXXXX) - -CARDANO_NODE_SOCKET_PATH="$tmpdir/node.socket" -export CARDANO_NODE_SOCKET_PATH - -TESTS_E2E_STATEDIR=$(pwd)/state -export TESTS_E2E_STATEDIR - -TESTS_E2E_TOKEN_METADATA=https://metadata.world.dev.cardano.org/ -export TESTS_E2E_TOKEN_METADATA - -TESTS_E2E_FIXTURES="$FIXTURE_DECRYPTION_KEY" - -export TESTS_E2E_FIXTURES - -# We have to use the `nix develop` shell defined for x86_64-darwin -# But we can still *test* the aarch64-darwin cardano-wallet executable -nix develop --system x86_64-darwin -c rake "run_on[preprod,sync,true]" - -rm -Rv "$tmpdir" diff --git a/scripts/buildkite/release/release-candidate.sh b/scripts/buildkite/release/release-candidate.sh index 973968cf722..ee03ea29281 100755 --- a/scripts/buildkite/release/release-candidate.sh +++ b/scripts/buildkite/release/release-candidate.sh @@ -6,12 +6,12 @@ set -euox pipefail # date from git tag # example v2023-04-04 -> 2023-04-04 tag_date() { - echo "${1##v}" + echo "${1##v}" } # cabal version from git tag # example v2023-04-04 -> 2023.4.4 tag_cabal_ver() { - tag_date "$1" | sed -e s/-0/-/g -e s/-/./g + tag_date "$1" | sed -e s/-0/-/g -e s/-/./g } git tag -l | xargs git tag -d @@ -27,7 +27,7 @@ NEW_GIT_TAG=v$today NEW_CABAL_VERSION=$(tag_cabal_ver "$NEW_GIT_TAG") -OLD_GIT_TAG=$( git tag -l "v2*-*-*" | sort | tail -n1) +OLD_GIT_TAG=$(git tag -l "v2*-*-*" | sort | tail -n1) LAST_RELEASE_DATE=$(tag_date "$OLD_GIT_TAG") @@ -52,7 +52,7 @@ git checkout -b "$RELEASE_CANDIDATE_BRANCH" || true sed -i "s|version: .*|version: $NEW_GIT_TAG|g" specifications/api/swagger.yaml git commit -m "Update wallet version in swagger.yaml" specifications/api/swagger.yaml -git ls-files '*.cabal' | xargs sed -i "s|$OLD_CABAL_VERSION|$NEW_CABAL_VERSION|g" +git ls-files '*.cabal' | xargs sed -i "s|$OLD_CABAL_VERSION|$NEW_CABAL_VERSION|g" git commit -am "Update cardano-wallet version in *.cabal files" sed -i "s|NODE_TAG=.*|NODE_TAG=$CARDANO_NODE_TAG|g" README.md @@ -60,14 +60,6 @@ sed -i "s|WALLET_TAG=.*|WALLET_TAG=$NEW_CABAL_VERSION|g" README.md sed -i "s|WALLET_VERSION=.*|WALLET_VERSION=$NEW_GIT_TAG|g" README.md git commit -am "Update cardano-wallet version in README.md" -sed -i "s|$OLD_GIT_TAG|$NEW_GIT_TAG|g" scripts/buildkite/main/linux-e2e.sh -git commit -am "Update cardano-wallet version in linux-e2e.sh" -sed -i "s|$OLD_GIT_TAG|$NEW_GIT_TAG|g" scripts/buildkite/main/macos-silicon-e2e.sh -git commit -am "Update cardano-wallet version in macos-silicon-e2e.sh" - -sed -i "s|RELEASE_WALLET_TAG=.*|RELEASE_WALLET_TAG=$NEW_CABAL_VERSION|g" run/common/docker/run.sh -git commit -am "Update cardano-wallet version in run/common/docker/run.sh" - RELEASE_COMMIT=$(git rev-parse HEAD) git remote set-url origin "git@github.com:cardano-foundation/cardano-wallet.git" diff --git a/scripts/check-bundle.rb b/scripts/check-bundle.rb deleted file mode 100755 index d6d0f5bf8ff..00000000000 --- a/scripts/check-bundle.rb +++ /dev/null @@ -1,64 +0,0 @@ - -############################################################################ -#!/usr/bin/env ruby -# Checks that every executable required in the release package is -# present and works. -# On Linux it checks if executables are statically linked. -# On macOS it checks that there are no /nix/store dylibs. -############################################################################ - -require 'open3' - -tests = { - "cardano-wallet.exe" => [ "cardano-node", "cardano-cli", "bech32", "cardano-address" ], "cardano-wallet" => [ "cardano-node", "cardano-cli", "bech32", "cardano-address" ] -} - -if ARGV.length < 1 || ARGV.length > 2 || tests[ARGV[0]] == nil - STDERR.puts "Usage: check-bundle cardano-wallet [RUNNER]" - STDERR.puts ARGV[0] - STDERR.puts ARGV[1] - exit 1 -end - -wallet = ARGV[0] - -# Runner is used to run windows exes under wine. -runner = ARGV.fetch(1, "") - -$failed = 0 - -def report(cmd, status) - res = status == 0 ? "pass" : "FAIL" - puts "#{cmd.ljust(40)}[#{res}]" - if status != 0 then - $failed = 1 - end -end - -cmd = "#{wallet} version" -begin - ver, status = Open3.capture2("#{runner} #{cmd}") - report(cmd, status.to_i) -rescue Errno::ENOENT - report(cmd, 1) -end - -tests[wallet].unshift(wallet).each do |cmd| - begin - stdout_str, status = Open3.capture2("#{runner} #{cmd} --help") - report(cmd, status.to_i) - rescue Errno::ENOENT - report(cmd, 1) - next - end - - if /darwin/ =~ RUBY_PLATFORM then - system("! otool -L `type -p #{cmd}` | sed 1d | grep nix"); - report("#{cmd} is free of /nix/store", $?.exitstatus) - elsif /linux/ =~ RUBY_PLATFORM then - system("! ldd `type -p #{cmd}` > /dev/null"); - report("#{cmd} is static linked", $?.exitstatus) - end -end - -exit($failed) diff --git a/scripts/connect_wallet.rb b/scripts/connect_wallet.rb deleted file mode 100755 index ce5927948ad..00000000000 --- a/scripts/connect_wallet.rb +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env ruby - -require 'cardano_wallet' - -timeout = 100 -threshold = Time.now + timeout - -$stdout.sync = true - -def is_connected? - begin - CardanoWallet.new.misc.network.information - true - rescue - false - end -end - -while (is_connected? == false && (Time.now <= threshold)) - puts "Wallet is not up yet... will check again in 5 seconds" - sleep 5 -end - -if is_connected? - puts "Wallet is up and running!!!" - exit 0 -else - puts "Didn't manage to connect to wallet within #{timeout}s!!!" - exit 1 -end diff --git a/test/e2e/.envrc b/test/e2e/.envrc deleted file mode 100644 index fdb3995c2fe..00000000000 --- a/test/e2e/.envrc +++ /dev/null @@ -1,17 +0,0 @@ -if [ -e .envrc-override ]; then - # This env file will trump lorri, if present. - source_env .envrc-override -elif type lorri &>/dev/null; then - eval "$(lorri direnv)" -else - # Fall back to using direnv's builtin nix support - # to prevent bootstrapping problems. - # It's definitely better to use lorri, because direnv won't - # be fast like this. - use flake -fi - -# Source a user-specific config in .envrc-local at the project -# top-level. -# This file can contain your customizations of `env.rb`. -source_env_if_exists ../../.envrc-local diff --git a/test/e2e/.gitattributes b/test/e2e/.gitattributes deleted file mode 100644 index bb362ff9516..00000000000 --- a/test/e2e/.gitattributes +++ /dev/null @@ -1,9 +0,0 @@ -# Pin line endings for genesis files. -# -# Genesis files are -# * human-readable text data -# * but they also have a hash. -# -# `cardano-node` is sensitive to the line endings in the genesis file. -# -/state/configs/*/*.json text eol=lf diff --git a/test/e2e/.gitignore b/test/e2e/.gitignore deleted file mode 100644 index 7286e195758..00000000000 --- a/test/e2e/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# data for tests -/bins/ -/state/logs/ -/state/node_db/ -/state/wallet_db/ - -# secrets -/fixtures/fixture_wallets.json - -# local environment variables -/.envrc-local - -# rspec reports and failure tracking -/spec/reports/ -.rspec_status - -# temporary files -/.bundle/ -/tmp/ -/cardano-wallet-*/ -/binaryDist/ -*binary-dist* -*.prv - -# rake -/.rakeTasks/ diff --git a/test/e2e/.rake_tasks~ b/test/e2e/.rake_tasks~ deleted file mode 100644 index f63a6ecdfb9..00000000000 --- a/test/e2e/.rake_tasks~ +++ /dev/null @@ -1,21 +0,0 @@ -clean_bins -clean_logs -clean_node_db -clean_wallet_db -datetime -display_versions -secrets_decode -secrets_encode -fixture_wallets_template -get_docker_logs -get_latest_bins -get_latest_configs -get_latest_node_db -run_on -spec -setup -start_node_and_wallet -stop_node_and_wallet -start_wallet_light -stop_wallet_light -wait_until_node_synced diff --git a/test/e2e/.rspec b/test/e2e/.rspec deleted file mode 100644 index 34c5164d9b5..00000000000 --- a/test/e2e/.rspec +++ /dev/null @@ -1,3 +0,0 @@ ---format documentation ---color ---require spec_helper diff --git a/test/e2e/.rubocop.yml b/test/e2e/.rubocop.yml deleted file mode 100644 index bee05376449..00000000000 --- a/test/e2e/.rubocop.yml +++ /dev/null @@ -1,44 +0,0 @@ -AllCops: - TargetRubyVersion: 3.1 - NewCops: enable - -Metrics/AbcSize: - Enabled: false - -Metrics/ModuleLength: - Enabled: false - -Metrics/BlockLength: - Enabled: false - -Metrics/ClassLength: - Enabled: false - -Layout/LineLength: - Enabled: false - -Layout/TrailingWhitespace: - Enabled: false - -Style/RedundantLineContinuation: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ParameterLists: - Max: 15 - MaxOptionalParameters: 10 - -Naming/VariableNumber: - CheckSymbols: false - -Naming/MethodParameterName: - Enabled: false - -Style/HashSyntax: - EnforcedStyle: no_mixed_keys - EnforcedShorthandSyntax: either - -Style/MixinUsage: - Enabled: false \ No newline at end of file diff --git a/test/e2e/.ruby-version b/test/e2e/.ruby-version deleted file mode 100644 index ef538c28109..00000000000 --- a/test/e2e/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -3.1.2 diff --git a/test/e2e/Gemfile b/test/e2e/Gemfile deleted file mode 100644 index 9e6b7b86c7e..00000000000 --- a/test/e2e/Gemfile +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -source 'https://rubygems.org' - -gem 'cardano_wallet', '~> 0.4.2' -# gem 'cardano_wallet', path: "~/wb/cardano_wallet" -gem 'blake2b', '0.10.0' -gem 'buildkit', '1.5' -gem 'cbor', '0.5.9.8' -gem 'mustache', '1.1.1' -gem 'rake', '12.3.3' -gem 'rspec', '3.11.0' diff --git a/test/e2e/Gemfile.lock b/test/e2e/Gemfile.lock deleted file mode 100644 index 18bfb1b8c2b..00000000000 --- a/test/e2e/Gemfile.lock +++ /dev/null @@ -1,58 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - addressable (2.8.1) - public_suffix (>= 2.0.2, < 6.0) - bip_mnemonic (0.0.4) - blake2b (0.10.0) - buildkit (1.5.0) - sawyer (>= 0.6) - cardano_wallet (0.4.2) - bip_mnemonic (= 0.0.4) - httparty (~> 0.21.0) - cbor (0.5.9.8) - diff-lcs (1.5.0) - faraday (2.7.1) - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.2) - httparty (0.21.0) - mini_mime (>= 1.0.0) - multi_xml (>= 0.5.2) - mini_mime (1.1.2) - multi_xml (0.6.0) - mustache (1.1.1) - public_suffix (5.0.1) - rake (12.3.3) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-support (3.11.1) - ruby2_keywords (0.0.5) - sawyer (0.9.2) - addressable (>= 2.3.5) - faraday (>= 0.17.3, < 3) - -PLATFORMS - ruby - -DEPENDENCIES - blake2b (= 0.10.0) - buildkit (= 1.5) - cardano_wallet (~> 0.4.2) - cbor (= 0.5.9.8) - mustache (= 1.1.1) - rake (= 12.3.3) - rspec (= 3.11.0) - -BUNDLED WITH - 2.4.22 diff --git a/test/e2e/README.md b/test/e2e/README.md deleted file mode 100644 index 8ed532c0b10..00000000000 --- a/test/e2e/README.md +++ /dev/null @@ -1,174 +0,0 @@ -# E2E testing - -E2E functional tests of cardano-wallet are running nightly on [cardano preprod testnet](https://book.world.dev.cardano.org/environments.html). Running tests against public testnet allows to exercise cardano-wallet on environment close to production (mainnet) utilizing and integrating maximally all components of the Cardano ecosystem like Stake pools, SMASH, metadata token server etc. - - -## Running tests - -In order to run tests one needs to [have ruby](https://www.ruby-lang.org/en/documentation/installation/) (at least 3.1.2). - -### Configuring test project -1. Get necessary _gems_. -```bash -cd test/e2e -bundle install -``` -2. Decrypt secret files using `$TESTS_E2E_FIXTURES` secret: - - `fixture_wallets.json.gpg` containing mnemonics of testnet fixture wallets - -```bash -export TESTS_E2E_FIXTURES=******* -rake secrets_decode -``` -> :information_source: **_TESTS_E2E_FIXTURES_** secret -Note that this step is also executed on very first test run. -> :information_source: **_TESTS_E2E_FIXTURES_** is also kept in the team's 1Password. - -#### Fixture wallets -The command `rake secrets_decode` can be used to decode the file [fixture_wallets.json.gpg](https://github.com/cardano-foundation/cardano-wallet/blob/master/test/e2e/fixtures/fixture_wallets.json.gpg) into a plain JSON file named `fixture_wallets.json`. This file contains mnemonic sentences of the wallets that are utilized in tests. The test framework will retrieve these wallets from the file. It is important to note that there are separate sets of wallets for different operating systems, namely Linux, MacOS, and Windows. This allows tests to be run in parallel on different operating systems. - -#### Fixture wallets update -If there is a need to update the mnemonics to new ones, it is certainly possible. After making the updates, remember to use the `rake secrets_encode` command to encode the updated plain JSON file into a GPG-encoded file. The updated GPG file then needs to be pushed to the repository so that it can be used by the continuous integration (CI) system. - -> :information_source: There is a utility command `rake fixture_wallets_template` which generates the file `fixture_wallets.json` from scratch with new mnemonic sentences. - -Please note that the wallets used in tests must have ADA and specific assets on their balance. Test ADA can be obtained from the [Faucet](https://docs.cardano.org/cardano-testnet/tools/faucet/). The assets required on the wallet's balance are: - -- SadCoin (with [metadata](https://metadata.world.dev.cardano.org/metadata/ee1ce9d7560f48a4ba3867037dbec2d8fed776d94dd6b00a35309073)) -- HappyCoin (with [metadata](https://metadata.world.dev.cardano.org/metadata/919e8a1922aaa764b1d66407c6f62244e77081215f385b60a62091494861707079436f696e)) - -Both assets have metadata in the [Testnet Metadata Registry](https://github.com/input-output-hk/metadata-registry-testnet), and there are tests in place to ensure that the wallet reads data from there correctly. Both assets can be minted outside of the wallet using tools such as `cardano-cli` or [token-minter](https://github.com/piotr-iohk/token_minter), and then sent to the balances of the fixture wallets. Policy scripts and keys required for minting are availeble in [tests/e2e/fixtuers/wallet_assets](https://github.com/cardano-foundation/cardano-wallet/tree/master/test/e2e/fixtures/wallet_assets). - -#### Further test setup -There may be certain tests that require additional actions to be performed before they can be successfully executed. In such cases, the test will fail and display an appropriate message with instructions. An example of such a test is `AlwaysFails.plutus with collateral return to the wallet`, which requires a specific UTXO to be set up on the testnet where the test will be executed. This setup is a one-time operation and is only necessary when running tests on a new testnet or when the existing testnet has been reset. The scenario is accompanied by detailed comments and step-by-step instructions on how to proceed. If the required actions have not been taken, the test will fail and display the appropriate message. - -### Running all tests -In order to run all `e2e` tests one can simply run single [rake](https://github.com/ruby/rake) task: -```bash -$ rake run_on[preprod] -``` -This master task is performing also all the necessary configuration steps (i.e. getting latest testnet configs and wallet/node binaries from [Cardano Book](https://book.world.dev.cardano.org/environments.html), starting everything up). All steps can also be executed as separate tasks , i.e.: - -```bash -$ rake secrets_decode -$ rake get_latest_bins -$ rake get_latest_configs[preprod] -$ rake start_node_and_wallet[preprod] -$ rake wait_until_node_synced -$ rake spec -$ rake stop_node_and_wallet[preprod] -``` -> :information_source: **_Linux / MacOS_** -cardano-node and cardano-wallet are started as separate [screen](https://www.gnu.org/software/screen/manual/screen.html) sessions. One can attach to the respective session using: ->```bash ->$ screen -r NODE_preprod ->$ screen -r WALLET_preprod ->``` - -> :information_source: **_Windows_** -cardano-node and cardano-wallet are started as separate Windows services using [nssm](https://nssm.cc/) tool. One can examine services using Windows service manager like `services.msc`. - -> :information_source: **_Docker_** -One can also start tests against cardano-wallet docker. There is docker-compose-test.yml provided that includes cardano-node and cardano-wallet. To start it several env variables need to be set to feed docker-compose: ->```bash ->NETWORK=preprod \ ->TESTS_E2E_TOKEN_METADATA=https://metadata.world.dev.cardano.org/ \ ->WALLET=dev-master \ ->NODE=10.1.3 \ ->NODE_CONFIG_PATH=`pwd`/state/configs/$NETWORK \ ->DATA=`pwd`/state/node_db/$NETWORK ->docker-compose -f docker-compose-test.yml up ->``` -> Then running tests against docker is just: ->```bash ->$ rake wait_until_node_synced ->$ rake spec ->``` - -#### Running tests against local wallet -One can also run tests against `cardano-wallet` and `cardano-node` which are specified on machine's `$PATH`: - -```bash -$ TESTS_E2E_BINDIR="" rake run_on[testnet] -``` -Running tests as such skips downloading latest wallet and node binaries. - -### Test artifacts - -By default following locations are used for different artifacts used by the tests: -- `./bins` - location for wallet and node binaries (will be downloaded here from [Buildkite](https://buildkite.com/cardano-foundation/cardano-wallet)) -- `./state` - wallet/node databases, logs and configs - -Locations are relative to `test/e2e` directory. -Default values can be changed by providing environment variables, for instance: - -```bash -TESTS_E2E_STATEDIR=~/state \ -TESTS_E2E_BINDIR=~/bins \ -rake run_on[preprod] -``` -Full list of environment variables is available in `e2e/env.rb`. - -### Running specific tests -There are two types of tests within the suite: - - `e2e` - tests that require node and wallet to be synced with the network (i.e. `rake wait_until_node_synced` step needs to pass before running them) - - `non-e2e` - tests do not require node to be fully synced - -One can run specific tests using by providing `SPEC` or `SPEC_OPTS` arguments to the rake task. For example: - - - run all tests (by default it'll download binaries from Hydra and wait for node to be synced before starting tests) - ```ruby - $ rake run_on[preprod] - ``` - - run only `e2e` tests - ```ruby - $ rake run_on[preprod] SPEC_OPTS="-t e2e" - ``` - - run only `non-e2e` tests on downloaded binaries and don't wait for node to be synced - ```ruby - $ rake run_on[preprod,no-sync] SPEC_OPTS="-t ~e2e" - ``` - - run only tests matching specific string - ```ruby - $ rake run_on[preprod] SPEC_OPTS="-e 'CardanoWallet::Shelley::Wallets'" - ``` - - run only specific test identified by line of test code against node and wallet from the `$PATH` (skips downloading from CI) - ```ruby - $ TESTS_E2E_BINDIR="" rake run_on[preprod] SPEC=spec/shelley_spec.rb:9 - ``` - ->:information_source: Tests can be also executed using `rspec`. - -### Skipping / making test pending - -When test is failing due to a bug it can be marked as `pending`. This mark expects test to fail. When such test actually passes the report will indicate such test as failure indicating that it can be turned on again. - -```ruby -it "Wallet can make multi-address transaction" do - pending "ADP-777 - Failures on multi-address transactions" - ... -end -``` - -Test can be also skipped, so it is not executed at all. - -```ruby -it "Wallet can show utxo distribution" do - skip "This functionality works intermittently - to be investigated" - ... -end -``` - -### Running tests from CI - -There are several steps in the Buildkite pipeline for testing against different platforms (Linux, MacOS, Windows), which can be triggered manually if desired. - -#### Node DB cache - -For speeding up execution in wallet's full mode we use cardano-node DB from cache. Thanks to this we don't have to wait for hours on each execution until cardano-node is synced with the chain. - -## Documentation - -Cardano-wallet-rb repository: https://github.com/piotr-iohk/cardano-wallet-rb. - -Ruby doc: https://piotr-iohk.github.io/cardano-wallet-rb/master/. diff --git a/test/e2e/Rakefile b/test/e2e/Rakefile deleted file mode 100644 index 89a7b2360aa..00000000000 --- a/test/e2e/Rakefile +++ /dev/null @@ -1,429 +0,0 @@ -# frozen_string_literal: true - -require 'rspec/core/rake_task' -require 'cardano_wallet' -require_relative 'env' -require_relative 'helpers/utils' -require_relative 'helpers/buildkite' -require 'io/console' - -include Helpers::Utils - -$stdout.sync = true - -STATE = absolute_path ENV.fetch('TESTS_E2E_STATEDIR', nil) -CONFIGS = absolute_path ENV.fetch('CARDANO_NODE_CONFIGS', nil) -LOGS = absolute_path ENV.fetch('TESTS_LOGDIR', nil) -NODE_DB = absolute_path ENV.fetch('TESTS_NODE_DB', nil) -WALLET_DB = absolute_path ENV.fetch('TESTS_WALLET_DB', nil) -NODE_SOCKET_PATH = ENV.fetch('CARDANO_NODE_SOCKET_PATH', nil) - -BINS = absolute_path ENV.fetch('TESTS_E2E_BINDIR', nil) - -FIXTURES_FILE = absolute_path ENV.fetch('TESTS_E2E_FIXTURES_FILE', nil) -FIXTURES_SECRET = ENV.fetch('TESTS_E2E_FIXTURES', nil) - -TOKEN_METADATA = ENV.fetch('TESTS_E2E_TOKEN_METADATA', nil) -WALLET_PORT = ENV.fetch('WALLET_PORT', nil) - -path_separator = win? ? ';' : ':' -ENV['PATH'] = "#{BINS}#{path_separator}#{ENV.fetch('PATH', nil)}" - -RSpec::Core::RakeTask.new(:spec) -task default: :spec - -task :secrets_encode do - desc 'Encode secrets using $TESTS_E2E_FIXTURES phrase' - - log ">> Encoding #{FIXTURES_FILE}..." - log `gpg --pinentry-mode loopback --passphrase=#{FIXTURES_SECRET} --symmetric --output=#{FIXTURES_FILE}.gpg #{FIXTURES_FILE}` -end - -task :secrets_decode do - desc 'Decode secrets using $TESTS_E2E_FIXTURES phrase' - - if File.exist?(FIXTURES_FILE) - log ">> Skipping decoding #{FIXTURES_FILE}.gpg... #{FIXTURES_FILE} already exists!" - else - log ">> Decoding #{FIXTURES_FILE}.gpg..." - log `gpg --pinentry-mode loopback --yes --passphrase=#{FIXTURES_SECRET} --output #{FIXTURES_FILE} --decrypt #{FIXTURES_FILE}.gpg` - end -end - -task :fixture_wallets_template do - log ">> Creating #{FIXTURES_FILE}" - utils = CardanoWallet.new.utils - fixture_wallets = { linux: { - fixture: { shelley: { mnemonics: utils.mnemonic_sentence(24) }, - icarus: { mnemonics: utils.mnemonic_sentence(24) }, - random: { mnemonics: utils.mnemonic_sentence(24) }, - shared: { mnemonics: utils.mnemonic_sentence(24) }, - shared2: { mnemonics: utils.mnemonic_sentence(24) } }, - target: { shelley: { mnemonics: utils.mnemonic_sentence(24) } } - }, - macos: { - fixture: { shelley: { mnemonics: utils.mnemonic_sentence(24) }, - icarus: { mnemonics: utils.mnemonic_sentence(24) }, - random: { mnemonics: utils.mnemonic_sentence(24) }, - shared: { mnemonics: utils.mnemonic_sentence(24) }, - shared2: { mnemonics: utils.mnemonic_sentence(24) } }, - target: { shelley: { mnemonics: utils.mnemonic_sentence(24) } } - }, - windows: { - fixture: { shelley: { mnemonics: utils.mnemonic_sentence(24) }, - icarus: { mnemonics: utils.mnemonic_sentence(24) }, - random: { mnemonics: utils.mnemonic_sentence(24) }, - shared: { mnemonics: utils.mnemonic_sentence(24) }, - shared2: { mnemonics: utils.mnemonic_sentence(24) } }, - target: { shelley: { mnemonics: utils.mnemonic_sentence(24) } } - }, - currency_contract_wallet: { mnemonics: utils.mnemonic_sentence(24) } } - if File.exist?(FIXTURES_FILE) - err = " - File #{FIXTURES_FILE} already exists! - I don't want to overwrite it in case it - contains fixture wallets already... - " - warn err - else - File.write(FIXTURES_FILE, JSON.pretty_generate(fixture_wallets)) - end -end - -task :clean_logs, [:env] do |_task, args| - log '>> Removing logs' - log_dir = File.join(LOGS, args[:env]) - rm_files(log_dir) -end - -task :clean_node_db, [:env] do |_task, args| - log '>> Removing node_db' - rm_files(File.join(NODE_DB, args[:env])) - rm_files(File.join(NODE_DB, "db-#{args[:env]}.tar.gz")) -end - -task :clean_wallet_db, [:env] do |_task, args| - log '>> Removing wallet_db' - rm_files(File.join(WALLET_DB, args[:env])) -end - -task :clean_bins do - log '>> Removing old bins' - rm_files(BINS) -end - -task :wait_until_node_synced do - log '>> Waiting for node to be synced' - - network = CardanoWallet.new.misc.network - # allow 180 mins for connecting to the node in case it needs to replay ledger - timeout = 180 * 60 - current_time = Time.now - timeout_treshold = current_time + timeout - log "Timeout: #{timeout}s" - log "Current time: #{current_time}" - log "Threshold: #{timeout_treshold}" - log 'Waiting for node to start...' - begin - current_time = Time.now - while network.information['sync_progress']['status'] == 'syncing' - log "Syncing node... #{network.information['sync_progress']['progress']['quantity']}%" - - sleep 5 - end - rescue StandardError => e - if current_time <= timeout_treshold - log "Retrying after error #{e}" - sleep 5 - retry - end - raise("[#{Time.now}] Could not connect to wallet within #{timeout} seconds, last error: #{e}") - end - - log '>> Cardano-node and cardano-wallet are synced! <<' -end - -## -# `rake start_node_and_wallet[testnet]' assumes cardano-node and cardano-wallet in $TESTS_E2E_BINDIR -task :start_node_and_wallet, [:env] do |_task, args| - log '>> Setting up cardano-node and cardano-wallet' - - bin_dir = BINS == '' ? BINS : "#{BINS}/" - config_dir = File.join(CONFIGS, args[:env]) - log ">> Using config directory '#{config_dir}'" - log_dir = File.join(LOGS, args[:env]) - log ">> Using log directory '#{log_dir}'" - wallet_db_dir = File.join(WALLET_DB, args[:env]) - log ">> Using wallet_db directory '#{wallet_db_dir}'" - node_db_dir = File.join(NODE_DB, args[:env]) - log ">> Using node_db directory '#{node_db_dir}'" - cd = Dir.pwd - mk_dir(STATE) - mk_dir(log_dir) - network = args[:env] == 'mainnet' ? '--mainnet' : "--testnet #{config_dir}/byron-genesis.json" - - if win? - # create cardano-node.bat file - node_cmd = "#{bin_dir}cardano-node.exe run --config #{config_dir}/config.json --topology #{config_dir}/topology.json --database-path #{node_db_dir} --socket-path \\\\.\\pipe\\cardano-node-testnet" - File.write('cardano-node.bat', node_cmd) - - # create cardano-wallet.bat file - wallet_cmd = "#{bin_dir}cardano-wallet.exe serve --port #{WALLET_PORT} --node-socket \\\\.\\pipe\\cardano-node-testnet #{network} --database #{wallet_db_dir} --token-metadata-server #{TOKEN_METADATA}" - File.write('cardano-wallet.bat', wallet_cmd) - - install_node = "nssm install cardano-node #{cd}/cardano-node.bat" - install_wallet = "nssm install cardano-wallet #{cd}/cardano-wallet.bat" - log_stdout_node = "nssm set cardano-node AppStdout #{log_dir}/node.log" - log_stderr_node = "nssm set cardano-node AppStderr #{log_dir}/node.log" - log_stdout_wallet = "nssm set cardano-wallet AppStdout #{log_dir}/wallet.log" - log_stderr_wallet = "nssm set cardano-wallet AppStderr #{log_dir}/wallet.log" - start_node = 'nssm start cardano-node' - start_wallet = 'nssm start cardano-wallet' - - cmd install_node - cmd install_wallet - cmd log_stdout_node - cmd log_stderr_node - cmd log_stdout_wallet - cmd log_stderr_wallet - cmd start_node - cmd start_wallet - else - start_node = <<~CMD - #{bin_dir}cardano-node run \ - --config #{config_dir}/config.json \ - --topology #{config_dir}/topology.json \ - --database-path #{node_db_dir} \ - --socket-path #{NODE_SOCKET_PATH} - CMD - log ">> Starting cardano-node with command: #{start_node}" - # wait a couple of seconds for the node to provide a socket file, at least - sleep 5.0 - - start_wallet = <<~CMD - #{bin_dir}cardano-wallet serve #{network} \ - --port #{WALLET_PORT} \ - --node-socket #{NODE_SOCKET_PATH} \ - --database #{wallet_db_dir} \ - --token-metadata-server #{TOKEN_METADATA} - CMD - log ">> Starting cardano-wallet with command: #{start_wallet}" - cmd <<~CMD - screen -dmS NODE_#{args[:env]} -L \ - -Logfile #{log_dir}/node.log \ - #{start_node} - CMD - cmd <<~CMD - screen -dmS WALLET_#{args[:env]} -L \ - -Logfile #{log_dir}/wallet.log \ - #{start_wallet} - CMD - cmd 'screen -ls', display_result: true - end -end - -task :stop_node_and_wallet, [:env] do |_task, args| - log '>> Stopping cardano-node and cardano-wallet' - - if win? - cmd 'nssm stop cardano-wallet' - cmd 'nssm stop cardano-node' - - cmd 'nssm remove cardano-wallet confirm' - cmd 'nssm remove cardano-node confirm' - else - cmd "screen -S WALLET_#{args[:env]} -X at '0' stuff '^C'" - cmd "screen -XS WALLET_#{args[:env]} quit" - cmd "screen -S NODE_#{args[:env]} -X at '0' stuff '^C'" - cmd "screen -XS NODE_#{args[:env]} quit" - end -end - -task :display_versions, [:bin_dir] do |_task, args| - puts "\n >> cardano-node and cardano-wallet versions:" - bin_dir = args[:bin_dir] || BINS - - if win? - cmd "#{bin_dir}/cardano-wallet.exe version", display_result: true - cmd "#{bin_dir}/cardano-node.exe version", display_result: true - else - cmd "#{bin_dir}/cardano-wallet version", display_result: true - cmd "#{bin_dir}/cardano-node version", display_result: true - end -end - -task :get_latest_windows_tests, [:branch, :destination, :status, :build] do |_task, args| - destination = args[:destination] || 'cardano-wallet-tests-win64' - job_key = 'windows-testing-bundle' - bk = Buildkite.new - status = args[:status] - branch = args[:branch] || 'master' - build = args[:build] || 'latest' - options = status == 'any' ? { branch: branch } : { branch: branch, state: status } - last_build = - build == 'latest' ? bk.last_build_number(options) : build - log "Latest passing buildkite '#{bk.pipeline}' pipeline for branch '#{branch}' is #{last_build}" - jobs = bk.jobs(last_build) - mk_dir(destination) - log "Getting '#{job_key}' artifact ๐Ÿ‘‡" - bk.get_artifacts(last_build, jobs[job_key], destination, 'cardano-wallet-tests-win64.zip', unzip: true) -end - -task :get_bins, [:nb] do |_task, args| - log ">> Getting node and wallet binaries from Buildkite into #{BINS}" - last_build = args[:nb] || 1 - bk = Buildkite.new - log "Latest passing buildkite '#{bk.pipeline}' pipeline build is #{last_build}" - jobs = bk.jobs(last_build) - mk_dir(BINS) - - if linux? - job_key = 'linux-package' - log "Getting '#{job_key}' artifact ๐Ÿ‘‡" - bk.get_artifacts(last_build, jobs[job_key], BINS) - elsif win? - job_key = 'windows-package' - log "Getting '#{job_key}' artifact ๐Ÿ‘‡" - bk.get_artifacts(last_build, jobs[job_key], BINS) - elsif mac? - job_key = 'macos-package' - log "Getting '#{job_key}' artifact ๐Ÿ‘‡" - bk.get_artifacts(last_build, jobs[job_key], BINS) - end -end - -task :get_latest_bins, [:branch, :state] do |_task, args| - log ">> Getting latest node and wallet binaries from Buildkite into #{BINS}" - branch = args[:branch] || 'master' - state = args[:state] || 'any' - filter = state == 'any' ? { branch: branch } : { branch: branch, state: state } - bk = Buildkite.new - last_build = bk.last_build_number(filter) - log "Latest #{filter} buildkite '#{bk.pipeline}' pipeline build is #{last_build}" - jobs = bk.jobs(last_build) - mk_dir(BINS) - - if linux? - job_key = 'linux-package' - log "Getting '#{job_key}' artifact ๐Ÿ‘‡" - bk.get_artifacts(last_build, jobs[job_key], BINS) - elsif win? - job_key = 'windows-package' - log "Getting '#{job_key}' artifact ๐Ÿ‘‡" - bk.get_artifacts(last_build, jobs[job_key], BINS) - elsif mac? - job_key = 'macos-intel-package' - log "Getting '#{job_key}' artifact ๐Ÿ‘‡" - bk.get_artifacts(last_build, jobs[job_key], BINS) - end -end - -task :get_latest_configs, [:env] do |_task, args| - env = args[:env] - out = File.join(CONFIGS, env) - - if File.exist?(out) - # The config directory is probably a /nix/store path - log ">> Using config directory '#{out}'" - else - log ">> Getting latest configs for '#{env}' into #{CONFIGS}" - - base_url = get_latest_configs_base_url(env) - mk_dir(STATE) - mk_dir(CONFIGS) - mk_dir(out) - config_file = File.join(out, 'config.json') - wget("#{base_url}config.json", config_file) - wget("#{base_url}byron-genesis.json", "#{out}/byron-genesis.json") - wget("#{base_url}shelley-genesis.json", "#{out}/shelley-genesis.json") - wget("#{base_url}alonzo-genesis.json", "#{out}/alonzo-genesis.json") - wget("#{base_url}conway-genesis.json", "#{out}/conway-genesis.json") - wget("#{base_url}topology.json", "#{out}/topology.json") - - config_dir = File.join(CONFIGS, args[:env]) - # Temporary/ad-hoc config changes for cardano-node: - config_json = JSON.parse(File.read("#{config_dir}/config.json")) - config_json['EnableP2P'] = false - File.write("#{config_dir}/config.json", JSON.pretty_generate(config_json)) - - topology = %({ - "Producers": [ - { - "addr": "#{ENV.fetch('NETWORK', nil)}-node.world.dev.cardano.org", - "port": 30000, - "valency": 2 - } - ] - }) - File.write("#{config_dir}/topology.json", topology) - end -end - -task :get_docker_logs do - log ">> Getting docker logs into #{LOGS}" - - mk_dir(LOGS) - node_logfile = `docker inspect --format='{{.LogPath}}' cardano-node`.gsub("\n", '') - wallet_logfile = `docker inspect --format='{{.LogPath}}' cardano-wallet`.gsub("\n", '') - - cmd "sudo cp #{node_logfile} #{LOGS}/node.log" - cmd "sudo cp #{wallet_logfile} #{LOGS}/wallet.log" - - # Add permissions so logs can be uploaded from workflow - cmd "sudo chmod a+rw #{LOGS}/node.log" - cmd "sudo chmod a+rw #{LOGS}/wallet.log" -end - -## -# Setup utility task getting node and wallet binaries, configs and decoding fixtures -# so it is ready to start -task :setup, [:env, :branch, :skip_bins, :skip_configs] do |_task, args| - log '>> Getting latest binaries and configs and decoding fixtures...' - env = args[:env] - branch = args[:branch] || 'master' - - if args[:skip_bins] - log '>> Skipping getting latest binaries. Will test wallet and node from $PATH.' - else - Rake::Task[:get_latest_bins].invoke(branch) - end - - if args[:skip_configs] - log '>> Skipping getting latest configs.' - else - Rake::Task[:get_latest_configs].invoke(env) - end - - Rake::Task[:secrets_decode].invoke -end - -task :run_on, [:env, :sync_strategy, :skip_bins, :skip_configs, :branch] do |_task, args| - log '>> Setting up env and running tests...' - log "TESTS_E2E_STATEDIR=#{STATE}" - env = args[:env] - sync_strategy = args[:sync_strategy] || :sync - branch = args[:branch] || nil - - Rake::Task[:setup].invoke(env, branch, args[:skip_bins], args[:skip_configs]) - Rake::Task[:display_versions].invoke - - Rake::Task[:stop_node_and_wallet].invoke(env) - Rake::Task[:start_node_and_wallet].invoke(env) - - if sync_strategy == 'no-sync' - log '>> Skipping waiting for node to be synced...' - else - Rake::Task[:wait_until_node_synced].invoke - end - - Rake::Task[:spec].invoke - Rake::Task[:stop_node_and_wallet].invoke(env) -end - -## -# print datetime in format that's consistent across different OS -# $ rake datetime -# 20211122-94332 -task :datetime do - puts Time.now.strftime('%Y%m%d-%H%M%S') -end diff --git a/test/e2e/docker-compose-test.yml b/test/e2e/docker-compose-test.yml deleted file mode 100644 index c3474244f96..00000000000 --- a/test/e2e/docker-compose-test.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: "3.5" - -services: - cardano-node: - container_name: cardano-node - image: ghcr.io/intersectmbo/cardano-node:${NODE} - volumes: - - ${DATA}:/data - - ${DATA}:/ipc - - ${NODE_CONFIG_PATH}:/config - command: run --socket-path /ipc/node.socket --config /config/config.json --topology /config/topology.json --database-path /data - restart: on-failure - - cardano-wallet: - container_name: cardano-wallet - image: cardanofoundation/cardano-wallet:${WALLET} - volumes: - - ${WALLET_DATA}:/wallet-db - - ${DATA}:/ipc - - ${NODE_CONFIG_PATH}:/config - ports: - - 8090:8090 - command: serve --testnet /config/byron-genesis.json --node-socket /ipc/node.socket --database /wallet-db --listen-address 0.0.0.0 --token-metadata-server $TESTS_E2E_TOKEN_METADATA - restart: on-failure diff --git a/test/e2e/docker_compose.sh b/test/e2e/docker_compose.sh deleted file mode 100755 index 2821509e9ee..00000000000 --- a/test/e2e/docker_compose.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -NETWORK=preprod \ -TESTS_E2E_TOKEN_METADATA=https://metadata.world.dev.cardano.org/ \ -WALLET=dev-master \ -NODE=10.1.3 \ -NODE_CONFIG_PATH=`pwd`/state/configs/$NETWORK \ -DATA=`pwd`/state/node_db/$NETWORK \ -WALLET_DATA=`pwd`/state/wallet_db/$NETWORK \ -docker-compose -f docker-compose-test.yml $1 diff --git a/test/e2e/env.rb b/test/e2e/env.rb deleted file mode 100644 index 0f2ea6e95c1..00000000000 --- a/test/e2e/env.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -## -# secrets ๐Ÿคซ -# One needs to set these environment variables to run the tests -# on CI they are set in GitHub Secrets -# $ export TESTS_E2E_FIXTURES=... - for decrypting ./fixtures/fixture_wallets.json.gpg -# $ export BUILDKITE_API_TOKEN=... - for downloading artifacts from Buildkite - -# file with mnemonics of fixture wallets -# decoded from ./fixtures/fixture_wallets.json.gpg using $TESTS_E2E_FIXTURES -ENV['TESTS_E2E_FIXTURES_FILE'] ||= './fixtures/fixture_wallets.json' - -## -# Wallet/node databases, logs and configs will be stored here -ENV['TESTS_E2E_STATEDIR'] ||= './state' -ENV['CARDANO_NODE_CONFIGS'] ||= File.join(ENV.fetch('TESTS_E2E_STATEDIR', nil), 'configs') -ENV['TESTS_LOGDIR'] ||= File.join(ENV.fetch('TESTS_E2E_STATEDIR', nil), 'logs') -ENV['TESTS_NODE_DB'] ||= File.join(ENV.fetch('TESTS_E2E_STATEDIR', nil), 'node_db') -ENV['TESTS_WALLET_DB'] ||= File.join(ENV.fetch('TESTS_E2E_STATEDIR', nil), 'wallet_db') - -## -# Wallet/node binaries will be downloaded here from Hydra. -# NOTE: Running `rake run_on[testnet,local]' overrides this and assumes node and wallet on $PATH -ENV['TESTS_E2E_BINDIR'] ||= './bins' - -ENV['TESTS_E2E_TOKEN_METADATA'] ||= 'https://metadata.world.dev.cardano.org' -ENV['TESTS_E2E_SMASH'] ||= 'https://smash.shelley-qa.dev.cardano.org/' -ENV['WALLET_PORT'] ||= '8090' -ENV['NETWORK'] ||= 'preprod' - -## -# Apply workaround for ADP-827 - Deleting wallets sometimes takes >60s in integration tests -ENV['CARDANO_WALLET_TEST_INTEGRATION'] = '1' diff --git a/test/e2e/fixtures/create-wallets.sh b/test/e2e/fixtures/create-wallets.sh deleted file mode 100755 index 99b02dd2035..00000000000 --- a/test/e2e/fixtures/create-wallets.sh +++ /dev/null @@ -1,142 +0,0 @@ -#! /bin/bash - -set -euox pipefail - -load_shelley() { - local name=$1 - mnemonics=$(jq -r ".$name" fixture_wallets.json) - - json_data=$( - cat <1 zx>23_po-?zH*YBM(6N^sByETaMR{A^1+FsoQN|@qRL}m z6dY^~deKOwuMn*~*(0PKMqe9R3@469ibN-7G)>q{bYhBA03%ZpXalB6@jk{r6s|0c zZ5GBYwp24`yRc?BoM&pEh6&=gM0f)kUZH6{!7Hw|#~N*EoGq(TJPX&3ww{Egr4MlT z+}qj6Q0h&?WSl+sHR7g-aF5Djy6iow9aWs{4kXAW3-)0Y{9vz@jdf>_6v$~_fmbrc z8N8NiYFd@tNvb!}xbr?iP zvvf1Kni+CC%2~!6HCXQ9Bdpt$m!7`}lHI-jPA+qQoGWZr?JQMU0+UaVs%3W;| zRL7%}XtBYvzYFJ7p+i`o&I!^><4$-M^+k{PVO!6`~vbH z5+^@PtZGOJRJ-wgj=`jV@k8h%#F&`Y?+c*It=d#r8v5{vT!F3uQ;!53Mr*&m@!y0y zGC@$z6`r-5SPftjLXV>1RTiYiI7B|jh|CK!4O1+PjpIxYoyBWM6|*R09l*T|%I)D)T-YYe0NQ+cb8b+2 z39~<2hmH9p57^Zov##E6#q^W+nLV0&78hoib;8F)_}PcySDb zh*#!@ogPmcGcPP&!7uNO_Ho>ibHegzNwUPqGV1a8pGx+B5{RU zAWq%lJx9MM85)-)O^nH!yIHiW_Y^!luYEf}{mky}^$=gjkLMwg#_4%liwqReFQjCj zkTd}v=6H3N(kl+{76m*066-N#XzFH6X+Tf}y!4%Zcojjdo~MlDGbV_eS3F3oj4)u?i0EozU`2Jd7fM?5_RKy9$R8!y}k4 zE60fu$K)Os2O^1^rS&nypeo{E21QMM+y)qxm`s&~xzbfD@gSddhJ5{Q5JzAVP6KK! z&J*j^$PIkI7#@Okg_!H4GXgL0iDls7uJ&7V2PRM=o#!`O+5tnbnol`TcjWXyS-WZ3 zHnJ*ea^|OYsR0Sur-A3mT>B#`$G?kXkh5A4drRZmjh|(m|0honFrSVk1Iaz|+b{jA zw~rQub>+gtwCW7rUbBY6mZd!P^@sTXce;=~z|LCJGW@x~uAr7ei@?bb^-RQm*fO_} zSr6Tou8nDRRbOob(7(UXOU8mZfzeAw_1t}Gw}Vwra(w~>$!&T?B=fi}W-G~LeNfQh zPGhF^GTQ7_9W1w>OHc62se7vNhWz0ceDhFdj^m3n0{e1sGGH2Wza)ZYE`3S++~rZ1 z&*l7Yeyz)nl*tW=6np)wgsO(Sc~pF5y_S-EG^7FC;fEflTge^}-<=KCC_kLqIc;>= zw-$cnw4|~z=heoVA$~lPUIYzHepmWg!j8_sw5Ay_1U{ljz~IfF z;=ccLs1OQt@*NpA)#!t90=-aCZ4gZzV`nMKFcV0Uo=9U)o>cVZ05Lb?%!1U)k-TyJ z#SSQ`Q=|p@09pVHi>Z)F?V9WIFEl0 zY$5^r8Up%zr|pfcFa*7h;ZDUTIQp>%|H@GKvY!o#dd*`{n})v;wdw|CA$!LVw27)k EOC~-`tpET3 diff --git a/test/e2e/fixtures/plutus/42.redeemer b/test/e2e/fixtures/plutus/42.redeemer deleted file mode 100644 index 68ce4d981cf..00000000000 --- a/test/e2e/fixtures/plutus/42.redeemer +++ /dev/null @@ -1 +0,0 @@ -{"int":42} \ No newline at end of file diff --git a/test/e2e/fixtures/plutus/alwaysfails.plutus b/test/e2e/fixtures/plutus/alwaysfails.plutus deleted file mode 100644 index 6bf973a0424..00000000000 --- a/test/e2e/fixtures/plutus/alwaysfails.plutus +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "PlutusScriptV2", - "description": "", - "cborHex": "4746010000222601" -} diff --git a/test/e2e/fixtures/plutus/anyone-can-mint.plutus b/test/e2e/fixtures/plutus/anyone-can-mint.plutus deleted file mode 100644 index c630ab1327e..00000000000 --- a/test/e2e/fixtures/plutus/anyone-can-mint.plutus +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "PlutusScriptV2", - "description": "", - "cborHex": "5907655907620100003232323232323232323232323232332232323232322232325335320193333573466e1cd55cea80124000466442466002006004646464646464646464646464646666ae68cdc39aab9d500c480008cccccccccccc88888888888848cccccccccccc00403403002c02802402001c01801401000c008cd4050054d5d0a80619a80a00a9aba1500b33501401635742a014666aa030eb9405cd5d0a804999aa80c3ae501735742a01066a02803e6ae85401cccd54060081d69aba150063232323333573466e1cd55cea801240004664424660020060046464646666ae68cdc39aab9d5002480008cc8848cc00400c008cd40a9d69aba15002302b357426ae8940088c98c80b4cd5ce01701681589aab9e5001137540026ae854008c8c8c8cccd5cd19b8735573aa004900011991091980080180119a8153ad35742a00460566ae84d5d1280111931901699ab9c02e02d02b135573ca00226ea8004d5d09aba2500223263202933573805405204e26aae7940044dd50009aba1500533501475c6ae854010ccd540600708004d5d0a801999aa80c3ae200135742a004603c6ae84d5d1280111931901299ab9c026025023135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d55cf280089baa00135742a004601c6ae84d5d1280111931900b99ab9c018017015101613263201633573892010350543500016135573ca00226ea800448c88c008dd6000990009aa80a911999aab9f0012500a233500930043574200460066ae880080508c8c8cccd5cd19b8735573aa004900011991091980080180118061aba150023005357426ae8940088c98c8050cd5ce00a80a00909aab9e5001137540024646464646666ae68cdc39aab9d5004480008cccc888848cccc00401401000c008c8c8c8cccd5cd19b8735573aa0049000119910919800801801180a9aba1500233500f014357426ae8940088c98c8064cd5ce00d00c80b89aab9e5001137540026ae854010ccd54021d728039aba150033232323333573466e1d4005200423212223002004357426aae79400c8cccd5cd19b875002480088c84888c004010dd71aba135573ca00846666ae68cdc3a801a400042444006464c6403666ae7007006c06406005c4d55cea80089baa00135742a00466a016eb8d5d09aba2500223263201533573802c02a02626ae8940044d5d1280089aab9e500113754002266aa002eb9d6889119118011bab00132001355012223233335573e0044a010466a00e66442466002006004600c6aae754008c014d55cf280118021aba200301213574200222440042442446600200800624464646666ae68cdc3a800a40004642446004006600a6ae84d55cf280191999ab9a3370ea0049001109100091931900819ab9c01101000e00d135573aa00226ea80048c8c8cccd5cd19b875001480188c848888c010014c01cd5d09aab9e500323333573466e1d400920042321222230020053009357426aae7940108cccd5cd19b875003480088c848888c004014c01cd5d09aab9e500523333573466e1d40112000232122223003005375c6ae84d55cf280311931900819ab9c01101000e00d00c00b135573aa00226ea80048c8c8cccd5cd19b8735573aa004900011991091980080180118029aba15002375a6ae84d5d1280111931900619ab9c00d00c00a135573ca00226ea80048c8cccd5cd19b8735573aa002900011bae357426aae7940088c98c8028cd5ce00580500409baa001232323232323333573466e1d4005200c21222222200323333573466e1d4009200a21222222200423333573466e1d400d2008233221222222233001009008375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c4664424444444660040120106eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc8848888888cc018024020c030d5d0a8049bae357426ae8940248cccd5cd19b875006480088c848888888c01c020c034d5d09aab9e500b23333573466e1d401d2000232122222223005008300e357426aae7940308c98c804ccd5ce00a00980880800780700680600589aab9d5004135573ca00626aae7940084d55cf280089baa0012323232323333573466e1d400520022333222122333001005004003375a6ae854010dd69aba15003375a6ae84d5d1280191999ab9a3370ea0049000119091180100198041aba135573ca00c464c6401866ae700340300280244d55cea80189aba25001135573ca00226ea80048c8c8cccd5cd19b875001480088c8488c00400cdd71aba135573ca00646666ae68cdc3a8012400046424460040066eb8d5d09aab9e500423263200933573801401200e00c26aae7540044dd500089119191999ab9a3370ea00290021091100091999ab9a3370ea00490011190911180180218031aba135573ca00846666ae68cdc3a801a400042444004464c6401466ae7002c02802001c0184d55cea80089baa0012323333573466e1d40052002200723333573466e1d40092000212200123263200633573800e00c00800626aae74dd5000a4c2400292010350543100122002112323001001223300330020020011" -} \ No newline at end of file diff --git a/test/e2e/fixtures/plutus/currency.json b/test/e2e/fixtures/plutus/currency.json deleted file mode 100644 index 411ecc205dc..00000000000 --- a/test/e2e/fixtures/plutus/currency.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "transaction": "84a40081825820{{transactionId}}{{transactionIdxHex}}0180020009a1581c{{policyId}}a245617066656c1903e84662616e616e6101a10381590cd0{{policy}}f5f6", - "inputs": [ - { - "id": "{{transactionId}}", - "index": {{transactionIdx}}, - "address": "{{address}}", - "amount": { - "quantity": {{amount}}, - "unit": "lovelace" - }, - "assets": [] - } - ], - "redeemers": [ - { - "purpose": "minting", - "policy_id": "{{policyId}}", - "data": "D87980" - } - ] -} diff --git a/test/e2e/fixtures/plutus/currency_policy b/test/e2e/fixtures/plutus/currency_policy deleted file mode 100644 index 972094df469..00000000000 --- a/test/e2e/fixtures/plutus/currency_policy +++ /dev/null @@ -1 +0,0 @@ -590ccd0100003323233322232332233322233223322332232323232323233223232323233332222323232323322323332223233322232333333332222222232323333222232323322323332223232323322332232323333322222332233223322332233223322222323253353061332235305b00722353550620022235300c005223305b33058491024330003322333553055120013505e505c235355069001223335530581200135061505f23535506c0012233353550550012330714800000488cc1c80080048cc1c400520000013304c002001332235306300122333223355002001200130571200133506222335530581200123535506d0012233550700023355305b1200123535507000122335507300233353550590012330794800000488cc1e80080048cc1e400520000013305000200150693355305d1200123535506b0012233506b335506e00733506b335506e002001506c506c00135300e00722533335301c001213504c35304a335738921024c680004b4988400484d4130d4c128cd5ce249024c680004b49884d4130d4c128cd5ce2481024c680004b498034d4c040008888888888801ccc161240102433100353010002222222222233355305d120013505b505e253353074333573466e3c03cd4c07400488d4c0e4008880081d81d44ccd5cd19b8700e35301d0012235303900222001076075107500a3333573466e1cd55ce9baa0044800081048d4108d4c100cd5ce2490350543100041499263333573466e1cd55cea8012400046601064646464646464646464646666ae68cdc39aab9d500a480008cccccccccc058cd40908c8c8cccd5cd19b8735573aa004900011980e181a1aba150023029357426ae8940088d4148d4c140cd5ce249035054310005149926135573ca00226ea8004d5d0a80519a8120129aba150093335502b75ca0546ae854020ccd540add728151aba1500733502403a35742a00c66a04866aa096086eb4d5d0a8029919191999ab9a3370e6aae7540092000233501e3232323333573466e1cd55cea80124000466a04c66a078eb4d5d0a80118209aba135744a00446a0ac6a60a866ae712401035054310005549926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233502433503c75a6ae854008c104d5d09aba250022350563530543357389201035054310005549926135573ca00226ea8004d5d09aba250022350523530503357389201035054310005149926135573ca00226ea8004d5d0a80219a8123ae35742a00666a04866aa096eb88004d5d0a80118199aba135744a00446a09c6a609866ae71241035054310004d49926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea00290031180d98191aba135573ca00646666ae68cdc3a801240084603460786ae84d55cf280211999ab9a3370ea00690011180d18151aba135573ca00a46666ae68cdc3a802240004603a6eb8d5d09aab9e50062350493530473357389201035054310004849926499264984d55cea80089baa001357426ae8940088d4108d4c100cd5ce249035054310004149926104013504135303f335738920103505435000404984d55cf280089baa0012212330010030022001222222222212333333333300100b00a00900800700600500400300220012212330010030022001122123300100300212001122123300100300212001122123300100300212001212222300400521222230030052122223002005212222300100520011232230023758002640026aa09e446666aae7c004941288cd4124c010d5d080118019aba200202c23232323333573466e1cd55cea801a4000466600e6464646666ae68cdc39aab9d5002480008cc034c0acd5d0a80119a8080139aba135744a00446a0646a606066ae712401035054310003149926135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a018eb8d5d09aba2500223502e35302c335738921035054310002d49926135744a00226aae7940044dd50009110919980080200180110009109198008018011000899aa800bae75a224464460046eac004c8004d5412488c8cccd55cf80112822919a82219aa82398031aab9d5002300535573ca00460086ae8800c09c4d5d080089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a01046a0506a604c66ae712410350543100027499264984d55cea80089baa001121223002003112200112001232323333573466e1cd55cea8012400046600c600e6ae854008dd69aba135744a00446a0446a604066ae71241035054310002149926135573ca00226ea80048848cc00400c00880048c8cccd5cd19b8735573aa002900011bae357426aae7940088d4078d4c070cd5ce2481035054310001d499261375400224464646666ae68cdc3a800a40084a00e46666ae68cdc3a8012400446a014600c6ae84d55cf280211999ab9a3370ea00690001280511a8109a980f99ab9c490103505431000204992649926135573aa00226ea8004484888c00c0104488800844888004480048c8cccd5cd19b8750014800880e88cccd5cd19b8750024800080e88d4064d4c05ccd5ce2490350543100018499264984d55ce9baa001232323232323333573466e1d4005200c200b23333573466e1d4009200a200d23333573466e1d400d200823300b375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c46601a6eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc048c050d5d0a8049bae357426ae8940248cccd5cd19b875006480088c050c054d5d09aab9e500b23333573466e1d401d2000230133016357426aae7940308d4084d4c07ccd5ce2481035054310002049926499264992649926135573aa00826aae79400c4d55cf280109aab9e500113754002424444444600e01044244444446600c012010424444444600a010244444440082444444400644244444446600401201044244444446600201201040024646464646666ae68cdc3a800a400446660106eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d400920002300a300b357426aae7940188d4048d4c040cd5ce2490350543100011499264984d55cea80189aba25001135573ca00226ea80048488c00800c888488ccc00401401000c80048c8c8cccd5cd19b875001480088c018dd71aba135573ca00646666ae68cdc3a80124000460106eb8d5d09aab9e500423500c35300a3357389201035054310000b499264984d55cea80089baa001212230020032122300100320011122232323333573466e1cd55cea80124000466aa04e600c6ae854008c014d5d09aba25002235009353007335738921035054310000849926135573ca00226ea800448004800449888cd54c028480048d4d5407c00488cd54088008ccd4d540200048cd54c038480048d4d5408c00488cd54098008d5403c00400488ccd5540200500080048cd54c038480048d4d5408c00488cd54098008d54034004004ccd55400c03c008004444888ccd54c010480054070cd54c028480048d4d5407c00488cd54088008d5402c004ccd54c0104800488d4d54080008894cd4c094ccd54c03c48004d403540408d4d5408c00488cc028008014018400c4cd408001000d4074004cd54c028480048d4d5407c00488c8cd5408c00cc004014c8004d540a0894cd4d40800044d5402c00c884d4d54094008894cd4c0a8cc0300080204cd5404001c0044c01800c008c8004d5408488448894cd4d40700044008884cc014008ccd54c01c480040140100044484888c00c01044884888cc0080140104484888c00401044800448cd403888ccd4d401c00c88008008004d4d401400488004c8004d5406c8844894cd4d40540045405c884cd4060c010008cd54c01848004010004c8004d5406888448894cd4d40540044d4d403c00c88004884ccd4d404401488008c010008ccd54c01c480040140100044cd4008894cd4c05c0084064400405848848cc00400c0084800488ccd5cd19b8f002001016015225335301300110151335738004028640026aa028442244a66a6a01c0022a02044266a022600800466aa600c24002008002266a00c00202244a66a6020004200220222466a00644666a6a00c006440040040026a6a008002440022442466002006004240022442466002006004240024424660020060044002224400424424466002008006240022244246600200600422400244666ae68cdc380100080280209100109100090009119b800020011123230010012233003300200200133223332223322330023355007488120{{transactionId}}0048{{encodedTransactionIdx}}d4010cd5401d220105617066656c00483403ccd4010cd5401d22010662616e616e61004800940148848cc00400c00880044488008488488cc00401000c48004448848cc00400c008448005 diff --git a/test/e2e/fixtures/plutus/game_1.json b/test/e2e/fixtures/plutus/game_1.json deleted file mode 100644 index 06b09af817a..00000000000 --- a/test/e2e/fixtures/plutus/game_1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "transaction": "84a30080018183581d70ca80730a8bb1eb9ed5c5c9deb55a3ee495f96fc3cee0646b76e1e7c31a00989680582014845e067bf83c19a97207c8a2057d9499624783f1fce1ef5abf600392240ad00200a10481d8799f581ca1c0a4e322cb639198421ec70e4d9d2c3586df70103a63c35494f51745677565737358202cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824fff5f6", - "inputs": [], - "redeemers": [] -} diff --git a/test/e2e/fixtures/plutus/game_2.json b/test/e2e/fixtures/plutus/game_2.json deleted file mode 100644 index 4f79614ff56..00000000000 --- a/test/e2e/fixtures/plutus/game_2.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "transaction": "84a40081825820{{transactionId}}00018183581d70ca80730a8bb1eb9ed5c5c9deb55a3ee495f96fc3cee0646b76e1e7c31a0098968058204401f9f4de01abb2164d77909afb1249f2c519331aa034bbfc5248e50b08db86020009a1581ca1c0a4e322cb639198421ec70e4d9d2c3586df70103a63c35494f517a145677565737301a2038259092a5909270100003323322333222323322323322323332223233322232333333332222222232333222323333222232323322323332223232323322332232323333322222332233223322332233223322332222232325335302f332235300a0012235300e0022222222222533335302200b2103f21333553058120013233505e223335350180032200200200135350160012200133501622533530400021042100103f235302b35301c0012200122235303000322335305500220462333573466e3c00406c11c11802c840fc840fccccd5cd19b8735573a6ea80112000204623504735304533573892010350543100046499263333573466e1cd55cea8012400046601464646464646464646464646666ae68cdc39aab9d500a480008cccccccccc060cd40988c8c8cccd5cd19b8735573aa004900011980f181b1aba15002302b357426ae8940088d415cd4c154cd5ce249035054310005649926135573ca00226ea8004d5d0a80519a8130139aba150093335502d75ca0586ae854020ccd540b5d728161aba1500733502603f35742a00c66a04c66aa0a0090eb4d5d0a8029919191999ab9a3370e6aae754009200023350203232323333573466e1cd55cea80124000466a05066a07ceb4d5d0a80118219aba135744a00446a0b66a60b266ae712401035054310005a49926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233502633503e75a6ae854008c10cd5d09aba2500223505b3530593357389201035054310005a49926135573ca00226ea8004d5d09aba250022350573530553357389201035054310005649926135573ca00226ea8004d5d0a80219a8133ae35742a00666a04c66aa0a0eb88004d5d0a801181a9aba135744a00446a0a66a60a266ae71241035054310005249926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea00290031180e981b9aba135573ca00646666ae68cdc3a801240084603860826ae84d55cf280211999ab9a3370ea00690011180e18161aba135573ca00a46666ae68cdc3a802240004603e6eb8d5d09aab9e500623504e35304c3357389201035054310004d49926499264984d55cea80089baa001357426ae8940088d411cd4c114cd5ce2490350543100046499261045135046353044335738920103505435000454984d55cf280089baa0011221233001003002120012212330010030022001222222222212333333333300100b00a00900800700600500400300220012212330010030022001122123300100300212001122123300100300212001122123300100300212001212222300400521222230030052122223002005212222300100520011232230023758002640026aa06e446666aae7c004940dc8cd40d8c010d5d080118019aba200202f23232323333573466e1cd55cea801a4000466600e6464646666ae68cdc39aab9d5002480008cc034c0b8d5d0a80119a8080151aba135744a00446a06a6a606666ae71241035054310003449926135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a018eb8d5d09aba2500223503135302f335738921035054310003049926135744a00226aae7940044dd50009110919980080200180110009109198008018011000899aa800bae75a224464460046eac004c8004d540c488c8cccd55cf80112819119a81899aa81718031aab9d5002300535573ca00460086ae8800c0a84d5d080089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a01046a0566a605266ae71241035054310002a499264984d55cea80089baa001121223002003112200112001232323333573466e1cd55cea8012400046600c600e6ae854008dd69aba135744a00446a04a6a604666ae71241035054310002449926135573ca00226ea80048848cc00400c00880048c8cccd5cd19b8735573aa002900011bae357426aae7940088d4084d4c07ccd5ce24810350543100020499261375400224464646666ae68cdc3a800a40084a00e46666ae68cdc3a8012400446a014600c6ae84d55cf280211999ab9a3370ea00690001280511a8121a981119ab9c490103505431000234992649926135573aa00226ea8004484888c00c0104488800844888004480048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188d4070d4c068cd5ce249035054310001b499264984d55ce9baa0011220021220012001232323232323333573466e1d4005200c200b23333573466e1d4009200a200d23333573466e1d400d200823300b375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c46601a6eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc048c050d5d0a8049bae357426ae8940248cccd5cd19b875006480088c050c054d5d09aab9e500b23333573466e1d401d2000230133016357426aae7940308d4084d4c07ccd5ce2481035054310002049926499264992649926135573aa00826aae79400c4d55cf280109aab9e500113754002424444444600e01044244444446600c012010424444444600a010244444440082444444400644244444446600401201044244444446600201201040024646464646666ae68cdc3a800a400446660106eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d400920002300a300b357426aae7940188d4048d4c040cd5ce2490350543100011499264984d55cea80189aba25001135573ca00226ea80048488c00800c888488ccc00401401000c80048c8c8cccd5cd19b875001480088c018dd71aba135573ca00646666ae68cdc3a80124000460106eb8d5d09aab9e500423500c35300a3357389201035054310000b499264984d55cea80089baa001212230020032122300100320011122232323333573466e1cd55cea80124000466aa016600c6ae854008c014d5d09aba25002235009353007335738921035054310000849926135573ca00226ea8004480048004498448848cc00400c008448004c8004d5401888448894cd4d40180044d4d402400c88004884ccd4d402c01488008c010008ccd54c01c480040140100044488008488488cc00401000c4800448848cc00400c00848004448c8c00400488cc00cc0080080052211cca80730a8bb1eb9ed5c5c9deb55a3ee495f96fc3cee0646b76e1e7c30001591ca6591ca3010000332323233223332223332223332223322323233322232333222323333333322222222323332223233332222323233223233322232323233223322323233333222223322332233223322332233222232323232323223232323223232533530383330103333573466e1d402520022333052375c6ae854030dd71aba1500b3505c357426ae89402c8cccd5cd19b87500a480008ccc150dd71aba1500f375c6ae854038d4174d5d09aba2500e23504f353050335738921035054310005149926498cccd5cd19b875004480088ccc158cd4175d71aba150073505c35742a00c666aa054eb940a4d5d09aba2500623333573466e1d40152000205623504f3530503357389201035054310005149926498cccd5cd19b8735573aa004900011980999191919191919191919191999ab9a3370e6aae75402920002333333333302133502f232323333573466e1cd55cea8012400046604e607e6ae854008c0d0d5d09aba2500223505e35305f3357389201035054310006049926135573ca00226ea8004d5d0a80519a8178181aba150093335503675ca06a6ae854020ccd540d9d7281a9aba1500733502f04835742a00c66a05e66aa0b20a2eb4d5d0a8029919191999ab9a3370e6aae754009200023350293232323333573466e1cd55cea80124000466a06266a08eeb4d5d0a80118261aba135744a00446a0c46a60c666ae712401035054310006449926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233502f33504775a6ae854008c130d5d09aba250022350623530633357389201035054310006449926135573ca00226ea8004d5d09aba2500223505e35305f3357389201035054310006049926135573ca00226ea8004d5d0a80219a817bae35742a00666a05e66aa0b2eb88004d5d0a801181f1aba135744a00446a0b46a60b666ae71241035054310005c49926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea00290031181318201aba135573ca00646666ae68cdc3a801240084604a60946ae84d55cf280211999ab9a3370ea006900111812981a9aba135573ca00a46666ae68cdc3a80224000460506eb8d5d09aab9e50062350553530563357389201035054310005749926499264984d55cea80089baa001357426ae8940088d4138d4c13ccd5ce249035054310005049926104f13504d35304e3357389201035054350004f4984d55cf280089baa001135573aa00626ae8940044d55cf280089baa001135573aa00a26ae8940044d55cf280189aba25001135573ca00226ea80048848cc00400c0088004888888888848cccccccccc00402c02802402001c01801401000c00880048848cc00400c008800448848cc00400c0084800448848cc00400c0084800448848cc00400c00848004848888c010014848888c00c014848888c008014848888c004014800448c88c008dd6000990009aa81e111999aab9f0012503a233503930043574200460066ae880080c08c8c8c8cccd5cd19b8735573aa006900011998039919191999ab9a3370e6aae754009200023300d302e35742a00466a0200546ae84d5d1280111a8199a981a19ab9c4901035054310003549926135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a018eb8d5d09aba2500223502f353030335738921035054310003149926135744a00226aae7940044dd50009110919980080200180110009109198008018011000899aa800bae75a224464460046eac004c8004d540d888c8cccd55cf8011281a919a81a19aa81b98031aab9d5002300535573ca00460086ae8800c0ac4d5d080089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a01046a0526a605466ae71241035054310002b499264984d55cea80089baa001121223002003112200112001232323333573466e1cd55cea8012400046600c600e6ae854008dd69aba135744a00446a0466a604866ae71241035054310002549926135573ca00226ea80048848cc00400c00880048c8cccd5cd19b8735573aa002900011bae357426aae7940088d407cd4c080cd5ce24810350543100021499261375400224464646666ae68cdc3a800a40084a00e46666ae68cdc3a8012400446a014600c6ae84d55cf280211999ab9a3370ea00690001280511a8111a981199ab9c490103505431000244992649926135573aa00226ea8004484888c00c0104488800844888004480048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188d4068d4c06ccd5ce249035054310001c499264984d55ce9baa0011220021220012001232323232323333573466e1d4005200c200b23333573466e1d4009200a200d23333573466e1d400d200823300b375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c46601a6eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc048c050d5d0a8049bae357426ae8940248cccd5cd19b875006480088c050c054d5d09aab9e500b23333573466e1d401d2000230133016357426aae7940308d407cd4c080cd5ce2481035054310002149926499264992649926135573aa00826aae79400c4d55cf280109aab9e500113754002424444444600e01044244444446600c012010424444444600a010244444440082444444400644244444446600401201044244444446600201201040024646464646666ae68cdc3a800a400446660106eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d400920002300a300b357426aae7940188d4040d4c044cd5ce2490350543100012499264984d55cea80189aba25001135573ca00226ea80048488c00800c888488ccc00401401000c80048c8c8cccd5cd19b875001480088c018dd71aba135573ca00646666ae68cdc3a80124000460106eb8d5d09aab9e500423500a35300b3357389201035054310000c499264984d55cea80089baa001212230020032122300100320011122232323333573466e1cd55cea80124000466aa028600c6ae854008c014d5d09aba25002235007353008335738921035054310000949926135573ca00226ea8004498480048004888488ccc00801401000c888488ccc00401401000c8004888488ccc00801401000c48800480044488008488488cc00401000c48004448848cc00400c0084480044d4005d70900088919180080091198019801001000991919911991191999111919191919199911199911199911191999911119199119199991111919911919911919991119191991191919911919191999911119191919191991191991199119999999999999111111111111191919191919999999911111111991199119911991191999991111191991199119911919911991199119199119191919911999111999111919191111a9aa8090021111191919299a9849009998028050048040a8008a99a98490099ab9c491025331000930115001109301153353508301003215335309201333573466e1cccc111400cd4c08000488004c0600212002094010930115002153353092013357389201025332000930115002109301150011533535082013300533501d00833304004150013301448004cd4054008c05801801c84d4d5425c040048c88d4d4080004894cd4c25804c02800854cd4c25804ccd54c1c048004d41b141ac8d4d542740400488ccd54c1cc48004d41bd41b88d4d542800400488ccd5cd19b874800000427804274040040045401054cd4c25804cd5ce248102533300097011500410970113535502000522253353099013333355029233530160012223374a900019aba0375200666ae80dd480119aba037520026ec5262223374a900119aba0375200666ae80dd480119aba037520026ec526003002350141223300233502d00733304b04c00633502000d302101100100f109b0113357389210253350009a0113535501c0012225335309501333335502525301f00100300200100b10970113357389201025334000960113357389201025336000910113530240052235302f002222222222253353508d013303200a00b2135303c001223530400012220021350a30135309f013357389201025330000a001498cccd5403c88d4d405400888cd4c01c0088894cd4c03401888854210044d420804cd5425404ccd54064d4024488cc008cccc13001540280112002001506b506b33501b33300b0030020010042225335300d006222153353091013308c01004372400626a10a0266aa1300266446a6aaa02a666aaa02c6a6aa03a004444666aa60c224002a0e46a6aa0400084440060066a6aa03a004444666aa60c224002a0e46a6aa0400084440040046a6aa03a004444666aa60c224002a0e46a6aa040008444002002444666aa042006004002666aa0386a01824466004609466a0de66aa1340201066a0de66aa1340200e900128382838000a8372837199aa80e1a8060911980119998278042806803a4000002a0dca0dc66a03c66601c00c00a00466608208400e6602a90008008a842008a8408090448091104600a83d099ba548000dd8a4c2466a002a0c4a0c644424466600400a00800644424466600200a008006400244424466600400a00800624400240022224442466600200800600422240024466aa609e2400246a6aa10a020024466aa1100200466aa60a42400246a6aa110020024466aa1160200466e08020004004004494cd4d41b8004848cd4168cd5421404d4c03000888004cd4168cd54214040052002505b505b12505a235355081013530100012235301b00222222222225335350793301e00a00b213530280012235302c00122235303100322335308701002230930116253353508201004213355098010020011309301161308a01162200211222212333300100500400300211200120011122212333001004003002112001122123300100300212001221233001003002200111222225335307533355304f120013504b504a235300b002223301500200300415335307533355304f120013504b504a235300b002223530160022222222222353501500d22533530840133355305e120013505450562353025001223304b00200400c10860113357389201024c30000850100315335307533355304f120013504b504a235300b002223530160022222222222353501300d22533530840133355305e12001350545056235302700122253353507a00121533530890133305108501003006153353507b330623019007009213308501001002108a01108a011089015335350763301b00c00d2135302500122353029001222333553055120012235302e00222235303300822353035005225335309301333308401004003002001133506f0090081008506701113508c01353088013357389201024c6600089014984218044cd5ce2481024c3100085010021077150741507415074122123300100300212001122123300100300212001221233001003002200122533335300300121505f21505f21505f2133355304612001504a235300d001225335306f3303300200413506300315062003212222300400521222230030052122223002005212222300100520013200135506c22233333333333353019001235300500322222222225335307153353506333355304b12001504f253353072333573466e3c0300041d01cc4d41980045419400c841d041c841cc4cd5ce249024c340007222353006004222222222253353506453353506433355304c1200150502353550790012253353075333573466e3c00803c1dc1d84d41a400c541a000884d419cd4d541e40048800454194854cd4c1ccccd5cd19baf00100c0750741075150701506f235300500322222222225335307133355304b120013504150432333573466ebc0300041d01cccd54c108480048d4d541e00048800400841cc4cd5ce249024c320007222225335306a333573466e1cd4c0200188888888888ccc09801c0380300041b01ac41b04cd5ce2481024c390006b22235300700522222222225335307333355304d1200135043504523530160012225335350690012153353078333040074003010153353506a35301601422222222223305b01b0022153353079333573466e3c0040081ec1e84d4c07401488cccc1b0008004c1d005541b841e841e441e441e002441d44cd5ce249024c6200074225335306833303002f0013335530331200150175045353006004222222222233355303d120012235301600222235301b00322335307100225335307a333573466e3c0500041f01ec4cd415801401c401c801d413c02441a84cd5ce2481024c610006925335306733302f02e001353005003222222222233355304b12001501f235301400122200200910691335738921024c36000682533530673335530411200135037503923300500400100110691335738921024c640006825335306733302f02e001353005003222222222233355304b12001501f23530120012235301600122200200a106913357389201024c35000682353005003222222222253353506333355304b12001504f235301200122533530743303800200e1350680031506700a213530120012235301600122253353506900121507610791506f22353006004222222222253353506433355304c120015050235301300122533530753303900200f1350690031506800a2107513357389201024c380007323530050032222222222353503100b22353503500222353503500822353503900222533530793333333222222253335306d33350640070060031533530800100215335308001005133350610070010041081011333506100700100410810113335061007001004333333335064075225335307b333573466e1c0080041f41f041ac54cd4c1ecccd5cd19b8900200107d07c1069106a22333573466e200080041f41f010088ccd5cd19b8900200107c07d22333573466e200080041f01f4894cd4c1ecccd5cd19b8900200107d07c10011002225335307b333573466e240080041f41f04008400401801401c00800400c41ec4cd5ce249024c330007a222222222212333333333300100b00a009008007006005004003002200122123300100300220012221233300100400300220012212330010030022001212222222300700822122222223300600900821222222230050081222222200412222222003221222222233002009008221222222233001009008200113350325001502f13001002222335530241200123535505a00122335505d002335530271200123535505d001223355060002333535502500123300a4800000488cc02c0080048cc02800520000013301c00200122337000040024446464600200a640026aa0b64466a6a05e0029000111a9aa82e00111299a982c199ab9a3371e0040120b40b22600e0022600c006640026aa0b44466a6a05c0029000111a9aa82d80111299a982b999ab9a3371e00400e0b20b020022600c00642444444444444601801a4424444444444446601601c01a42444444444444601401a44442444444444444666601202001e01c01a444244444444444466601001e01c01a4424444444444446600e01c01a42444444444444600c01a42444444444444600a01a42444444444444600801a42444444444444600601a4424444444444446600401c01a42444444444444600201a400224424660020060042400224424660020060042400244a66a607c666ae68cdc79a9801801110011a98018009100102001f8999ab9a3370e6a6006004440026a60060024400208007e207e442466002006004400244666ae68cdc480100081e81e111199aa980a890009a808a80811a9aa82100091199aa980c090009a80a280991a9aa82280091199a9aa8068009198052400000244660160040024660140029000000998020010009119aa98050900091a9aa8200009119aa821801199a9aa804000919aa98070900091a9aa8220009119aa8238011aa80780080091199aaa80401c801000919aa98070900091a9aa8220009119aa8238011aa806800800999aaa80181a001000888911199aa980209000a80a99aa98050900091a9aa8200009119aa8218011aa805800999aa980209000911a9aa82080111299a981e999aa980b890009a806a80791a9aa82200091198050010028030801899a80c802001a80b00099aa98050900091a9aa820000911919aa8220019800802990009aa82291299a9a80c80089aa8058019109a9aa82300111299a982119806001004099aa80800380089803001801190009aa81f1108911299a9a80a800880111099802801199aa980389000802802000889091118018020891091119801002802089091118008020890008919a80891199a9a803001910010010009a9a80200091000990009aa81c110891299a9a8070008a80811099a808980200119aa980309000802000899a80111299a981800108190800817891091980080180109000899a80191299a9816801080088170168919a80591199a9a802001910010010009a9a8010009100089109198008018010900091299a9a80d999aa980189000a80391a9aa81800091299a9816199ab9a3375e00200a05c05a26a0400062a03e002426a03c6a6aa060002440042a038640026aa05e4422444a66a6a00c00226a6a01400644002442666a6a01800a440046008004666aa600e2400200a00800222440042442446600200800624002266a00444a66a6a02c004420062002a02a24424660020060042400224446a6a008004446a6a00c00644a666a6026666a01400e0080042a66a604c00620022050204e2050244246600200600424002244464646464a666a6a01000c42a666a6a01200c42a666a6a0140104260082c260062c2a666a6a01400e4260082c260062c202a20262a666a6a01200e4260082c260062c2a666a6a01200c4260082c260062c20282a666a6a01000a42024202620222a666a6a01000a42a666a6a01200e42600a2c260082c2a666a6a01200c42600a2c260082c202820242a666a6a01000c42600a2c260082c2a666a6a01000a42600a2c260082c20264a666a6a01000a42a666a6a01200e42a666a6a01400e42666a01e014004002260222c260222c260202c20262a666a6a01000c42a666a6a01200c42666a01c012004002260202c260202c2601e2c202420224a666a6a00e00842a666a6a01000c42a666a6a01200c42666a01c012004002260202c260202c2601e2c20242a666a6a00e00a42a666a6a01000a42666a01a0100040022601e2c2601e2c2601c2c202220204a666a6a00c00642a666a6a00e00a42a666a6a01000a42666a01a0100040022601e2c2601e2c2601c2c20222a666a6a00c00842a666a6a00e00842666a01800e0040022601c2c2601c2c2601a2c2020201e4a666a6a00a00442a666a6a00c00842a666a6a00e00842666a01800e0040022601c2c2601c2c2601a2c20202a666a6a00a00642a666a6a00c00642666a01600c0040022601a2c2601a2c260182c201e201c2424446006008224440042244400224002246a6a0040024444444400e244444444246666666600201201000e00c00a008006004240024c244400624440042444002400244446466a601800a466a601a0084a66a602c666ae68cdc780100080c00b8a801880b900b919a9806802100b9299a980b199ab9a3371e00400203002e2a006202e2a66a6a00a00642a66a6a00c0044266a6014004466a6016004466a601e004466a60200044660280040024034466a6020004403446602800400244403444466a601a0084034444a66a6036666ae68cdc380300180e80e0a99a980d999ab9a3370e00a00403a03826602e00800220382038202a2a66a6a00a0024202a202a2424460040062244002240024244600400644424466600200a00800640024244600400642446002006400244666ae68cdc780100080480411199ab9a3370e00400201000e266ae712401024c630000413357389201024c370000313357389201024c64000021220021220012001235006353002335738921024c6700003498480048004448848cc00400c008448004498448c8c00400488cc00cc0080080050482d8799f581ca1c0a4e322cb639198421ec70e4d9d2c3586df70103a63c35494f51745677565737358202cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824ffd87a9f581ca1c0a4e322cb639198421ec70e4d9d2c3586df70103a63c35494f51745677565737358202cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824fff5f6", - "inputs": [ - { - "id": "{{transactionId}}", - "index": 0, - "address": "addr_test1wr9gquc23wc7h8k4chyaad268mjft7t0c08wqertwms70sc0fvx8w", - "datum": "14845e067bf83c19a97207c8a2057d9499624783f1fce1ef5abf600392240ad0", - "amount": { - "quantity": 10000000, - "unit": "lovelace" - }, - "assets": [] - } - ], - "redeemers": [ - { - "purpose": "spending", - "input": { - "id": "{{transactionId}}", - "index": 0 - }, - "data": "D87980" - }, - { - "purpose": "minting", - "policy_id": "a1c0a4e322cb639198421ec70e4d9d2c3586df70103a63c35494f517", - "data": "D87980" - } - ] -} diff --git a/test/e2e/fixtures/plutus/game_3.json b/test/e2e/fixtures/plutus/game_3.json deleted file mode 100644 index f18a51090f6..00000000000 --- a/test/e2e/fixtures/plutus/game_3.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "transaction": "84A30081825820{{transactionId}}00018282581D60FABC30D46356151102CC57D427D338B8790B2244C1250159685400DD821A001E8480A1581CA1C0A4E322CB639198421EC70E4D9D2C3586DF70103A63C35494F517A14567756573730183581D70CA80730A8BB1EB9ED5C5C9DEB55A3EE495F96FC3CEE0646B76E1E7C31A007A1200582016AE33FF78BAC196BC387E612FD0BC45BD900ABD29A42DAA791A03FB7CDAE4630200A20381591CA6591CA3010000332323233223332223332223332223322323233322232333222323333333322222222323332223233332222323233223233322232323233223322323233333222223322332233223322332233222232323232323223232323223232533530383330103333573466E1D402520022333052375C6AE854030DD71ABA1500B3505C357426AE89402C8CCCD5CD19B87500A480008CCC150DD71ABA1500F375C6AE854038D4174D5D09ABA2500E23504F353050335738921035054310005149926498CCCD5CD19B875004480088CCC158CD4175D71ABA150073505C35742A00C666AA054EB940A4D5D09ABA2500623333573466E1D40152000205623504F3530503357389201035054310005149926498CCCD5CD19B8735573AA004900011980999191919191919191919191999AB9A3370E6AAE75402920002333333333302133502F232323333573466E1CD55CEA8012400046604E607E6AE854008C0D0D5D09ABA2500223505E35305F3357389201035054310006049926135573CA00226EA8004D5D0A80519A8178181ABA150093335503675CA06A6AE854020CCD540D9D7281A9ABA1500733502F04835742A00C66A05E66AA0B20A2EB4D5D0A8029919191999AB9A3370E6AAE754009200023350293232323333573466E1CD55CEA80124000466A06266A08EEB4D5D0A80118261ABA135744A00446A0C46A60C666AE712401035054310006449926135573CA00226EA8004D5D0A8011919191999AB9A3370E6AAE7540092000233502F33504775A6AE854008C130D5D09ABA250022350623530633357389201035054310006449926135573CA00226EA8004D5D09ABA2500223505E35305F3357389201035054310006049926135573CA00226EA8004D5D0A80219A817BAE35742A00666A05E66AA0B2EB88004D5D0A801181F1ABA135744A00446A0B46A60B666AE71241035054310005C49926135744A00226AE8940044D5D1280089ABA25001135744A00226AE8940044D5D1280089ABA25001135573CA00226EA8004D5D0A8011919191999AB9A3370EA00290031181318201ABA135573CA00646666AE68CDC3A801240084604A60946AE84D55CF280211999AB9A3370EA006900111812981A9ABA135573CA00A46666AE68CDC3A80224000460506EB8D5D09AAB9E50062350553530563357389201035054310005749926499264984D55CEA80089BAA001357426AE8940088D4138D4C13CCD5CE249035054310005049926104F13504D35304E3357389201035054350004F4984D55CF280089BAA001135573AA00626AE8940044D55CF280089BAA001135573AA00A26AE8940044D55CF280189ABA25001135573CA00226EA80048848CC00400C0088004888888888848CCCCCCCCCC00402C02802402001C01801401000C00880048848CC00400C008800448848CC00400C0084800448848CC00400C0084800448848CC00400C00848004848888C010014848888C00C014848888C008014848888C004014800448C88C008DD6000990009AA81E111999AAB9F0012503A233503930043574200460066AE880080C08C8C8C8CCCD5CD19B8735573AA006900011998039919191999AB9A3370E6AAE754009200023300D302E35742A00466A0200546AE84D5D1280111A8199A981A19AB9C4901035054310003549926135573CA00226EA8004D5D0A801999AA805BAE500A35742A00466A018EB8D5D09ABA2500223502F353030335738921035054310003149926135744A00226AAE7940044DD50009110919980080200180110009109198008018011000899AA800BAE75A224464460046EAC004C8004D540D888C8CCCD55CF8011281A919A81A19AA81B98031AAB9D5002300535573CA00460086AE8800C0AC4D5D080089119191999AB9A3370EA002900011A80418029ABA135573CA00646666AE68CDC3A801240044A01046A0526A605466AE71241035054310002B499264984D55CEA80089BAA001121223002003112200112001232323333573466E1CD55CEA8012400046600C600E6AE854008DD69ABA135744A00446A0466A604866AE71241035054310002549926135573CA00226EA80048848CC00400C00880048C8CCCD5CD19B8735573AA002900011BAE357426AAE7940088D407CD4C080CD5CE24810350543100021499261375400224464646666AE68CDC3A800A40084A00E46666AE68CDC3A8012400446A014600C6AE84D55CF280211999AB9A3370EA00690001280511A8111A981199AB9C490103505431000244992649926135573AA00226EA8004484888C00C0104488800844888004480048C8CCCD5CD19B8750014800880188CCCD5CD19B8750024800080188D4068D4C06CCD5CE249035054310001C499264984D55CE9BAA0011220021220012001232323232323333573466E1D4005200C200B23333573466E1D4009200A200D23333573466E1D400D200823300B375C6AE854014DD69ABA135744A00A46666AE68CDC3A8022400C46601A6EB8D5D0A8039BAE357426AE89401C8CCCD5CD19B875005480108CC048C050D5D0A8049BAE357426AE8940248CCCD5CD19B875006480088C050C054D5D09AAB9E500B23333573466E1D401D2000230133016357426AAE7940308D407CD4C080CD5CE2481035054310002149926499264992649926135573AA00826AAE79400C4D55CF280109AAB9E500113754002424444444600E01044244444446600C012010424444444600A010244444440082444444400644244444446600401201044244444446600201201040024646464646666AE68CDC3A800A400446660106EB4D5D0A8021BAD35742A0066EB4D5D09ABA2500323333573466E1D400920002300A300B357426AAE7940188D4040D4C044CD5CE2490350543100012499264984D55CEA80189ABA25001135573CA00226EA80048488C00800C888488CCC00401401000C80048C8C8CCCD5CD19B875001480088C018DD71ABA135573CA00646666AE68CDC3A80124000460106EB8D5D09AAB9E500423500A35300B3357389201035054310000C499264984D55CEA80089BAA001212230020032122300100320011122232323333573466E1CD55CEA80124000466AA028600C6AE854008C014D5D09ABA25002235007353008335738921035054310000949926135573CA00226EA8004498480048004888488CCC00801401000C888488CCC00401401000C8004888488CCC00801401000C48800480044488008488488CC00401000C48004448848CC00400C0084480044D4005D70900088919180080091198019801001000991919911991191999111919191919199911199911199911191999911119199119199991111919911919911919991119191991191919911919191999911119191919191991191991199119999999999999111111111111191919191919999999911111111991199119911991191999991111191991199119911919911991199119199119191919911999111999111919191111A9AA8090021111191919299A9849009998028050048040A8008A99A98490099AB9C491025331000930115001109301153353508301003215335309201333573466E1CCCC111400CD4C08000488004C0600212002094010930115002153353092013357389201025332000930115002109301150011533535082013300533501D00833304004150013301448004CD4054008C05801801C84D4D5425C040048C88D4D4080004894CD4C25804C02800854CD4C25804CCD54C1C048004D41B141AC8D4D542740400488CCD54C1CC48004D41BD41B88D4D542800400488CCD5CD19B874800000427804274040040045401054CD4C25804CD5CE248102533300097011500410970113535502000522253353099013333355029233530160012223374A900019ABA0375200666AE80DD480119ABA037520026EC5262223374A900119ABA0375200666AE80DD480119ABA037520026EC526003002350141223300233502D00733304B04C00633502000D302101100100F109B0113357389210253350009A0113535501C0012225335309501333335502525301F00100300200100B10970113357389201025334000960113357389201025336000910113530240052235302F002222222222253353508D013303200A00B2135303C001223530400012220021350A30135309F013357389201025330000A001498CCCD5403C88D4D405400888CD4C01C0088894CD4C03401888854210044D420804CD5425404CCD54064D4024488CC008CCCC13001540280112002001506B506B33501B33300B0030020010042225335300D006222153353091013308C01004372400626A10A0266AA1300266446A6AAA02A666AAA02C6A6AA03A004444666AA60C224002A0E46A6AA0400084440060066A6AA03A004444666AA60C224002A0E46A6AA0400084440040046A6AA03A004444666AA60C224002A0E46A6AA040008444002002444666AA042006004002666AA0386A01824466004609466A0DE66AA1340201066A0DE66AA1340200E900128382838000A8372837199AA80E1A8060911980119998278042806803A4000002A0DCA0DC66A03C66601C00C00A00466608208400E6602A90008008A842008A8408090448091104600A83D099BA548000DD8A4C2466A002A0C4A0C644424466600400A00800644424466600200A008006400244424466600400A00800624400240022224442466600200800600422240024466AA609E2400246A6AA10A020024466AA1100200466AA60A42400246A6AA110020024466AA1160200466E08020004004004494CD4D41B8004848CD4168CD5421404D4C03000888004CD4168CD54214040052002505B505B12505A235355081013530100012235301B00222222222225335350793301E00A00B213530280012235302C00122235303100322335308701002230930116253353508201004213355098010020011309301161308A01162200211222212333300100500400300211200120011122212333001004003002112001122123300100300212001221233001003002200111222225335307533355304F120013504B504A235300B002223301500200300415335307533355304F120013504B504A235300B002223530160022222222222353501500D22533530840133355305E120013505450562353025001223304B00200400C10860113357389201024C30000850100315335307533355304F120013504B504A235300B002223530160022222222222353501300D22533530840133355305E12001350545056235302700122253353507A00121533530890133305108501003006153353507B330623019007009213308501001002108A01108A011089015335350763301B00C00D2135302500122353029001222333553055120012235302E00222235303300822353035005225335309301333308401004003002001133506F0090081008506701113508C01353088013357389201024C6600089014984218044CD5CE2481024C3100085010021077150741507415074122123300100300212001122123300100300212001221233001003002200122533335300300121505F21505F21505F2133355304612001504A235300D001225335306F3303300200413506300315062003212222300400521222230030052122223002005212222300100520013200135506C22233333333333353019001235300500322222222225335307153353506333355304B12001504F253353072333573466E3C0300041D01CC4D41980045419400C841D041C841CC4CD5CE249024C340007222353006004222222222253353506453353506433355304C1200150502353550790012253353075333573466E3C00803C1DC1D84D41A400C541A000884D419CD4D541E40048800454194854CD4C1CCCCD5CD19BAF00100C0750741075150701506F235300500322222222225335307133355304B120013504150432333573466EBC0300041D01CCCD54C108480048D4D541E00048800400841CC4CD5CE249024C320007222225335306A333573466E1CD4C0200188888888888CCC09801C0380300041B01AC41B04CD5CE2481024C390006B22235300700522222222225335307333355304D1200135043504523530160012225335350690012153353078333040074003010153353506A35301601422222222223305B01B0022153353079333573466E3C0040081EC1E84D4C07401488CCCC1B0008004C1D005541B841E841E441E441E002441D44CD5CE249024C6200074225335306833303002F0013335530331200150175045353006004222222222233355303D120012235301600222235301B00322335307100225335307A333573466E3C0500041F01EC4CD415801401C401C801D413C02441A84CD5CE2481024C610006925335306733302F02E001353005003222222222233355304B12001501F235301400122200200910691335738921024C36000682533530673335530411200135037503923300500400100110691335738921024C640006825335306733302F02E001353005003222222222233355304B12001501F23530120012235301600122200200A106913357389201024C35000682353005003222222222253353506333355304B12001504F235301200122533530743303800200E1350680031506700A213530120012235301600122253353506900121507610791506F22353006004222222222253353506433355304C120015050235301300122533530753303900200F1350690031506800A2107513357389201024C380007323530050032222222222353503100B22353503500222353503500822353503900222533530793333333222222253335306D33350640070060031533530800100215335308001005133350610070010041081011333506100700100410810113335061007001004333333335064075225335307B333573466E1C0080041F41F041AC54CD4C1ECCCD5CD19B8900200107D07C1069106A22333573466E200080041F41F010088CCD5CD19B8900200107C07D22333573466E200080041F01F4894CD4C1ECCCD5CD19B8900200107D07C10011002225335307B333573466E240080041F41F04008400401801401C00800400C41EC4CD5CE249024C330007A222222222212333333333300100B00A009008007006005004003002200122123300100300220012221233300100400300220012212330010030022001212222222300700822122222223300600900821222222230050081222222200412222222003221222222233002009008221222222233001009008200113350325001502F13001002222335530241200123535505A00122335505D002335530271200123535505D001223355060002333535502500123300A4800000488CC02C0080048CC02800520000013301C00200122337000040024446464600200A640026AA0B64466A6A05E0029000111A9AA82E00111299A982C199AB9A3371E0040120B40B22600E0022600C006640026AA0B44466A6A05C0029000111A9AA82D80111299A982B999AB9A3371E00400E0B20B020022600C00642444444444444601801A4424444444444446601601C01A42444444444444601401A44442444444444444666601202001E01C01A444244444444444466601001E01C01A4424444444444446600E01C01A42444444444444600C01A42444444444444600A01A42444444444444600801A42444444444444600601A4424444444444446600401C01A42444444444444600201A400224424660020060042400224424660020060042400244A66A607C666AE68CDC79A9801801110011A98018009100102001F8999AB9A3370E6A6006004440026A60060024400208007E207E442466002006004400244666AE68CDC480100081E81E111199AA980A890009A808A80811A9AA82100091199AA980C090009A80A280991A9AA82280091199A9AA8068009198052400000244660160040024660140029000000998020010009119AA98050900091A9AA8200009119AA821801199A9AA804000919AA98070900091A9AA8220009119AA8238011AA80780080091199AAA80401C801000919AA98070900091A9AA8220009119AA8238011AA806800800999AAA80181A001000888911199AA980209000A80A99AA98050900091A9AA8200009119AA8218011AA805800999AA980209000911A9AA82080111299A981E999AA980B890009A806A80791A9AA82200091198050010028030801899A80C802001A80B00099AA98050900091A9AA820000911919AA8220019800802990009AA82291299A9A80C80089AA8058019109A9AA82300111299A982119806001004099AA80800380089803001801190009AA81F1108911299A9A80A800880111099802801199AA980389000802802000889091118018020891091119801002802089091118008020890008919A80891199A9A803001910010010009A9A80200091000990009AA81C110891299A9A8070008A80811099A808980200119AA980309000802000899A80111299A981800108190800817891091980080180109000899A80191299A9816801080088170168919A80591199A9A802001910010010009A9A8010009100089109198008018010900091299A9A80D999AA980189000A80391A9AA81800091299A9816199AB9A3375E00200A05C05A26A0400062A03E002426A03C6A6AA060002440042A038640026AA05E4422444A66A6A00C00226A6A01400644002442666A6A01800A440046008004666AA600E2400200A00800222440042442446600200800624002266A00444A66A6A02C004420062002A02A24424660020060042400224446A6A008004446A6A00C00644A666A6026666A01400E0080042A66A604C00620022050204E2050244246600200600424002244464646464A666A6A01000C42A666A6A01200C42A666A6A0140104260082C260062C2A666A6A01400E4260082C260062C202A20262A666A6A01200E4260082C260062C2A666A6A01200C4260082C260062C20282A666A6A01000A42024202620222A666A6A01000A42A666A6A01200E42600A2C260082C2A666A6A01200C42600A2C260082C202820242A666A6A01000C42600A2C260082C2A666A6A01000A42600A2C260082C20264A666A6A01000A42A666A6A01200E42A666A6A01400E42666A01E014004002260222C260222C260202C20262A666A6A01000C42A666A6A01200C42666A01C012004002260202C260202C2601E2C202420224A666A6A00E00842A666A6A01000C42A666A6A01200C42666A01C012004002260202C260202C2601E2C20242A666A6A00E00A42A666A6A01000A42666A01A0100040022601E2C2601E2C2601C2C202220204A666A6A00C00642A666A6A00E00A42A666A6A01000A42666A01A0100040022601E2C2601E2C2601C2C20222A666A6A00C00842A666A6A00E00842666A01800E0040022601C2C2601C2C2601A2C2020201E4A666A6A00A00442A666A6A00C00842A666A6A00E00842666A01800E0040022601C2C2601C2C2601A2C20202A666A6A00A00642A666A6A00C00642666A01600C0040022601A2C2601A2C260182C201E201C2424446006008224440042244400224002246A6A0040024444444400E244444444246666666600201201000E00C00A008006004240024C244400624440042444002400244446466A601800A466A601A0084A66A602C666AE68CDC780100080C00B8A801880B900B919A9806802100B9299A980B199AB9A3371E00400203002E2A006202E2A66A6A00A00642A66A6A00C0044266A6014004466A6016004466A601E004466A60200044660280040024034466A6020004403446602800400244403444466A601A0084034444A66A6036666AE68CDC380300180E80E0A99A980D999AB9A3370E00A00403A03826602E00800220382038202A2A66A6A00A0024202A202A2424460040062244002240024244600400644424466600200A00800640024244600400642446002006400244666AE68CDC780100080480411199AB9A3370E00400201000E266AE712401024C630000413357389201024C370000313357389201024C64000021220021220012001235006353002335738921024C6700003498480048004448848CC00400C008448004498448C8C00400488CC00CC0080080050482D87A9F581CA1C0A4E322CB639198421EC70E4D9D2C3586DF70103A63C35494F5174567756573735820859601DEB772672B933EF30D66609610C928BCF116951A52F4B8698F34C1FC80FFD87A9F581CA1C0A4E322CB639198421EC70E4D9D2C3586DF70103A63C35494F51745677565737358202CF24DBA5FB0A30E26E83B2AC5B9E29E1B161E5C1FA7425E73043362938B9824FFF5F6", - "inputs": [ - { - "id": "{{transactionId}}", - "index": 0, - "address": "addr_test1wr9gquc23wc7h8k4chyaad268mjft7t0c08wqertwms70sc0fvx8w", - "datum": "4401f9f4de01abb2164d77909afb1249f2c519331aa034bbfc5248e50b08db86", - "amount": { - "quantity": 10000000, - "unit": "lovelace" - }, - "assets": [] - } - ], - "redeemers": [ - { - "purpose": "spending", - "input": { - "id": "{{transactionId}}", - "index": 0 - }, - "data": "D87A834568656C6C6F5820859601DEB772672B933EF30D66609610C928BCF116951A52F4B8698F34C1FC80A140A1401A001E8480" - } - ] -} diff --git a/test/e2e/fixtures/plutus/mintBurn_1.json b/test/e2e/fixtures/plutus/mintBurn_1.json deleted file mode 100644 index 795ce2f287f..00000000000 --- a/test/e2e/fixtures/plutus/mintBurn_1.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "transaction": "84a50080018002000e81581c{{ vkHash }}09a1581c{{ policyId }}a1496d696e742d6275726e01a10381591611{{ policy }}f5f6", - "inputs": [], - "redeemers": [ - { - "purpose": "minting", - "policy_id": "{{ policyId }}", - "data": "D87980" - } - ] -} diff --git a/test/e2e/fixtures/plutus/mintBurn_2.json b/test/e2e/fixtures/plutus/mintBurn_2.json deleted file mode 100644 index 1c22f57ce8c..00000000000 --- a/test/e2e/fixtures/plutus/mintBurn_2.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "transaction": "84a50080018002000e81581c{{ vkHash }}09a1581c{{ policyId }}a1496d696e742d6275726e20a10381591611{{ policy }}f5f6", - "inputs": [], - "redeemers": [ - { - "purpose": "minting", - "policy_id": "{{ policyId }}", - "data": "D87980" - } - ] -} diff --git a/test/e2e/fixtures/plutus/mintBurn_policy b/test/e2e/fixtures/plutus/mintBurn_policy deleted file mode 100644 index 24c72d94640..00000000000 --- a/test/e2e/fixtures/plutus/mintBurn_policy +++ /dev/null @@ -1 +0,0 @@ -59160e0100003323332223232323233223232323332223332223332223233332222323322323333222232332232332232333222323322323322323233223232323333222232323232323322332233333333333332222222222222323233333333222222223322332233223322323322332233223233223232323232323232323232323233333222223322332223003300200122232325335308601330053333573466e1cd55ce9baa0044800080708d4074d4c06ccd5ce2481035054310001c499263333573466e1cd55cea8012400046601064646464646464646464646666ae68cdc39aab9d500a480008cccccccccc0c8cd40688c8c8cccd5cd19b8735573aa004900011981c18119aba15002301f357426ae8940088d40b4d4c0accd5ce249035054310002c49926135573ca00226ea8004d5d0a80519a80d00d9aba150093335501d75ca0386ae854020ccd54075d7280e1aba1500733501a02335742a00c66a03466aa04c048eb4d5d0a8029919191999ab9a3370e6aae754009200023350553232323333573466e1cd55cea80124000466a0b666a052eb4d5d0a80118151aba135744a00446a0626a605e66ae712401035054310003049926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233507a33502975a6ae854008c0a8d5d09aba2500223503135302f3357389201035054310003049926135573ca00226ea8004d5d09aba2500223502d35302b3357389201035054310002c49926135573ca00226ea8004d5d0a80219a80d3ae35742a00666a03466aa04ceb88004d5d0a80118101aba135744a00446a0526a604e66ae71241035054310002849926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea002900311808980d9aba135573ca00646666ae68cdc3a8012400846020603a6ae84d55cf280211999ab9a3370ea006900111808180c9aba135573ca00a46666ae68cdc3a80224000460266eb8d5d09aab9e50062350243530223357389201035054310002349926499264984d55cea80089baa001357426ae8940088d4074d4c06ccd5ce249035054310001c49926101b13501c35301a3357389201035054350001b4984d55cf280089baa00122235301800233223535501d002222533530890133355305f12001350595058235300a00522330290020030031533530890133355305f12001350595058235300a0052235302a0022222222222353503100d22533530980133355306e12001350625064235303900122330940100200400c109a0113357389201024c3000099010021533530890133355305f12001350595058235300a0052235302a0022222222222353502f00d22533530980133355306e12001350625064235303b00122253353508a01001215335309d0133305f09501003006153353508b01330703530310073374a90001bb149802484cc254040040084278044278044274054cd4d4218054cccd4c06803485422004854220048542200484ccd54c1bc4800541cc8d4c0e8004894cd4c27004cc254040080104d42300400c5422c0403484d4c0e400488d4c0f4004888ccd54c18c4800488d4c108008888d4c11c02088d4c124014894cd4c29c04cccc2500401000c0080044cd41fc024020402141dc0444d40b8d4c0b0cd5ce249024c660002d4984268044cd5ce2481024c310009901001108b011508801150880115088013335501c3322330023042005001505c505d505d505d0012212330010030022001212222300400521222230030052122223002005212222300100520011232230023758002640026aa0fa446666aae7c004941588cd4154c010d5d080118019aba200201123232323333573466e1cd55cea801a400046660406464646666ae68cdc39aab9d5002480008cc098c04cd5d0a80119a8060091aba135744a00446a02e6a602a66ae712401035054310001649926135573ca00226ea8004d5d0a801999aa803bae500635742a00466a010eb8d5d09aba25002235013353011335738921035054310001249926135744a00226aae7940044dd5000899aa800bae75a224464460046eac004c8004d541ec88c8cccd55cf8011282a919a82a19aa82898031aab9d5002300535573ca00460086ae8800c0404d5d080089119191999ab9a3370ea002900011a83518029aba135573ca00646666ae68cdc3a801240044a0d446a0226a601e66ae7124010350543100010499264984d55cea80089baa001232323333573466e1cd55cea801240004660e6600a6ae854008dd69aba135744a00446a01c6a601866ae71241035054310000d49926135573ca00226ea80048c8cccd5cd19b8735573aa002900011bae357426aae7940088d4030d4c028cd5ce249035054310000b499261375400224464646666ae68cdc3a800a40084a0b246666ae68cdc3a8012400446a0b8600c6ae84d55cf280211999ab9a3370ea00690001282e11a8079a980699ab9c4901035054310000e4992649926135573aa00226ea80048c8cccd5cd19b8750014800881d88cccd5cd19b8750024800081d88d402cd4c024cd5ce249035054310000a499264984d55ce9baa001232323232323333573466e1d4005200c202023333573466e1d4009200a202223333573466e1d400d2008233020375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c4660446eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc09cc030d5d0a8049bae357426ae8940248cccd5cd19b875006480088c0a4c034d5d09aab9e500b23333573466e1d401d200023028300e357426aae7940308d404cd4c044cd5ce2481035054310001249926499264992649926135573aa00826aae79400c4d55cf280109aab9e5001137540024646464646666ae68cdc3a800a400446660ce6eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d40092000230693008357426aae7940188d4030d4c028cd5ce2481035054310000b499264984d55cea80189aba25001135573ca00226ea80048c8c8cccd5cd19b875001480088c19cdd71aba135573ca00646666ae68cdc3a80124000460d26eb8d5d09aab9e500423500935300733573892010350543100008499264984d55cea80089baa0011122232323333573466e1cd55cea80124000466aa090600c6ae854008c014d5d09aba25002235009353007335738921035054310000849926135573ca00226ea80044800480044984488848ccc00401000c00844800448848cc00400c0084800448848cc00400c00848004c8004d54198888cccccccccccd4c0580048d4c01400c88888888894cd4c1c54cd4d417cccd54c11c48005412c94cd4c1c8ccd5cd19b8f00c0010740731350620011506100321074107210731335738921024c340007222353006004222222222253353506053353506033355304812001504c2353550470012253353075333573466e3c00803c1dc1d84d419400c5419000884d418cd4d5411c0048800454184854cd4c1ccccd5cd19baf00100c07507410751506f1506e2353005003222222222253353071333553047120013503b503d2333573466ebc0300041d01cccd54c0f0480048d4d541180048800400841cc4cd5ce249024c3200072222323225335306c333573466e1cd4c0280208888888888c03001c0041b81b441b84cd5ce2481024c390006d3200135506d22335350430014800088d4d54108008894cd4c1c0ccd5cd19b8f00200a07207113007001130060033200135506c22335350420014800088d4d54104008894cd4c1bcccd5cd19b8f002007071070100113006003222353007005222222222253353073333553049120013503d503f2353016001222533535065001215335307833303a070003010153353506635301601422222222223305501b0022153353079333573466e3c0040081ec1e84d4c07401488cccc1a0008004c1c005541a841e841e441e441e002441d44cd5ce249024c6200074225335306833302a02900133355302d12001501750413530060042222222222333553037120012235301600222235301b00322335306d00225335307a333573466e3c0500041f01ec4cd414801401c401c801d412c02441a84cd5ce2481024c6100069253353067333029028001353005003222222222233355304712001501f235301400122200200910691335738921024c360006825335306733355303d1200135031503323300500400100110691335738921024c6400068253353067333029028001353005003222222222233355304712001501f23530120012235301600122200200a106913357389201024c35000682353005003222222222253353505f33355304712001504b235301200122533530743306d00200e1350640031506300a213530120012235301600122253353506500121507510791506e22353006004222222222253353506033355304812001504c235301300122533530753306e00200f1350650031506400a2107513357389201024c380007323530050032222222222353502e00b223535032002223535032008223535036002225335307933333332222222533353069333506000700600315335308001002153353080010051333505d0070010041081011333505d0070010041081011333505d007001004333333335060071225335307b333573466e1c0080041f41f0419c54cd4c1ecccd5cd19b8900200107d07c1065106622333573466e200080041f41f00e888ccd5cd19b8900200107c07d22333573466e200080041f01f4894cd4c1ecccd5cd19b8900200107d07c10011002225335307b333573466e240080041f41f04008400401801401c00800400c41ec4cd5ce249024c330007a222222222212333333333300100b00a0090080070060050040030022001221233001003002200122212333001004003002200122123300100300220012122222223007008221222222233006009008212222222300500812222222004122222220032212222222330020090082212222222330010090082001133502e5001502b1223355301e1200123535502800122335502b002335530211200123535502b00122335502e002333535501f0012330584800000488cc1640080048cc16000520000013301600200121222222222222300c00d2212222222222223300b00e00d21222222222222300a00d22221222222222222333300901000f00e00d222122222222222233300800f00e00d2212222222222223300700e00d21222222222222300600d21222222222222300500d21222222222222300400d21222222222222300300d2212222222222223300200e00d21222222222222300100d200112212330010030021200112212330010030021200122333573466e2400800410c108888ccd54c05c48004d404540408d4d5405800488ccd54c06848004d4051404c8d4d5406400488ccd4d540340048cc0292000001223300b00200123300a00148000004cc01000800488cd54c028480048d4d5405000488cd5405c008ccd4d540200048cd54c038480048d4d5406000488cd5406c008d5403c00400488ccd5540200ec0080048cd54c038480048d4d5406000488cd5406c008d54034004004ccd55400c0d8008004444888ccd54c01048005405ccd54c028480048d4d5405000488cd5405c008d5402c004ccd54c0104800488d4d54054008894cd4c10cccd54c06448004d4035403c8d4d5406000488cc028008014018400c4cd406c01000d4060004cd54c028480048d4d5405000488c8cd5406000cc004014c8004d54114894cd4d406c0044d5402c00c884d4d54068008894cd4c120cc0300080204cd5404001c0044c01800c008c8004d540f888448894cd4d405c0044008884cc014008ccd54c01c480040140100044484888c00c01044884888cc0080140104484888c00401044800448cd404c88ccd4d401800c88008008004d4d401000488004c8004d540e08844894cd4d404000454048884cd404cc010008cd54c018480040100044cd4008894cd4c0d800840e040040d448848cc00400c008480044cd400c894cd4c0cc008400440d00cc48cd403488ccd4d401000c88008008004d4d40080048800448848cc00400c00848004894cd4d4074ccd54c0144800540248d4d54010004894cd4c0c8ccd5cd19baf00100503403313502200315021001213502035355004001220021501e112212330010030021120013200135502d22112225335350060011353500a0032200122133353500c005220023004002333553007120010050040011122002122122330010040031200113350022253353501600221003100150151221233001003002120011222353500400222353500600322533353013333500a00700400215335302a0031001102c102b102c122123300100300212001122232323232533353500800621533353500900621533353500a0082130041613003161533353500a0072130041613003161015101315333535009007213004161300316153335350090062130041613003161014153335350080052101210131011153335350080052153335350090072130051613004161533353500900621300516130041610141012153335350080062130051613004161533353500800521300516130041610132533353500800521533353500900721533353500a00721333500f00a00200113011161301116130101610131533353500800621533353500900621333500e009002001130101613010161300f16101210112533353500700421533353500800621533353500900621333500e009002001130101613010161300f1610121533353500700521533353500800521333500d0080020011300f161300f161300e16101110102533353500600321533353500700521533353500800521333500d0080020011300f161300f161300e1610111533353500600421533353500700421333500c0070020011300e161300e161300d161010100f2533353500500221533353500600421533353500700421333500c0070020011300e161300e161300d1610101533353500500321533353500600321333500b0060020011300d161300d161300c16100f100e121222300300411222002112220011200112353500200122222222007122222222123333333300100900800700600500400300212001261222003122200212220012001222232335300c0052335300d00425335301a333573466e3c00800407006c5400c406c806c8cd4c034010806c94cd4c068ccd5cd19b8f00200101c01b15003101b15335350050032153353500600221335300a0022335300b0022335300f00223353010002233014002001201e23353010002201e23301400200122201e222335300d004201e2225335301f333573466e1c01800c08408054cd4c07cccd5cd19b8700500202102013301700400110201020101915335350050012101910191212230020031122001120012122300200322212233300100500400320012122300200321223001003200122333573466e3c00800403403088ccd5cd19b8700200100c00b2253353009333573466e3cd4c00c00888008d4c00c0048800802c0284ccd5cd19b87353003002220013530030012200100b00a100a221233001003002200113357389201024c630000513357389201024c37000042233700004002266ae71241024c640000212200212200120011123230010012233003300200200148811c{{vkHash}}0001 diff --git a/test/e2e/fixtures/plutus/ping-pong_1.json b/test/e2e/fixtures/plutus/ping-pong_1.json deleted file mode 100644 index 8b65c652942..00000000000 --- a/test/e2e/fixtures/plutus/ping-pong_1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "transaction": "84a30080018183581d704d72cf569a339a18a7d9302313983f56e0d96cd45bdcb1d6512dca6a1a001e84805820923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec0200a10481d87980f5f6", - "redeemers": [], - "inputs": [] -} diff --git a/test/e2e/fixtures/plutus/ping-pong_2.json b/test/e2e/fixtures/plutus/ping-pong_2.json deleted file mode 100644 index c9ba75d002b..00000000000 --- a/test/e2e/fixtures/plutus/ping-pong_2.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "transaction": "84a30081825820{{transactionId}}00018183581d704d72cf569a339a18a7d9302313983f56e0d96cd45bdcb1d6512dca6a1a001e848058208392f0c940435c06888f9bdb8c74a95dc69f156367d6a089cf008ae05caae01e0200a20381591b72591b6f01000033233332222333322223322332232323332223233322232333333332222222232333222323333222232323322323332223233322232323322332232323333322222332233223322332233223322223223223232533530333330083333573466e1d40192004204f23333573466e1d401d2002205123333573466e1d40212000205323504b35304c3357389201035054310004d49926499263333573466e1d40112004205323333573466e1d40152002205523333573466e1d40192000205723504b35304c3357389201035054310004d49926499263333573466e1cd55cea8012400046601664646464646464646464646666ae68cdc39aab9d500a480008cccccccccc064cd409c8c8c8cccd5cd19b8735573aa004900011980f981d1aba15002302c357426ae8940088d4164d4c168cd5ce2481035054310005b49926135573ca00226ea8004d5d0a80519a8138141aba150093335502e75ca05a6ae854020ccd540b9d728169aba1500733502704335742a00c66a04e66aa0a8098eb4d5d0a8029919191999ab9a3370e6aae754009200023350213232323333573466e1cd55cea80124000466a05266a084eb4d5d0a80118239aba135744a00446a0ba6a60bc66ae712401035054310005f49926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233502733504275a6ae854008c11cd5d09aba2500223505d35305e3357389201035054310005f49926135573ca00226ea8004d5d09aba2500223505935305a3357389201035054310005b49926135573ca00226ea8004d5d0a80219a813bae35742a00666a04e66aa0a8eb88004d5d0a801181c9aba135744a00446a0aa6a60ac66ae71241035054310005749926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea00290031180f181d9aba135573ca00646666ae68cdc3a801240084603a608a6ae84d55cf280211999ab9a3370ea00690011180e98181aba135573ca00a46666ae68cdc3a80224000460406eb8d5d09aab9e50062350503530513357389201035054310005249926499264984d55cea80089baa001357426ae8940088d4124d4c128cd5ce249035054310004b49926104a1350483530493357389201035054350004a4984d55cf280089baa001135573a6ea80044d55ce9baa0012212330010030022001222222222212333333333300100b00a00900800700600500400300220012212330010030022001122123300100300212001122123300100300212001122123300100300212001212222300400521222230030052122223002005212222300100520011232230023758002640026aa078446666aae7c004940388cd4034c010d5d080118019aba200203323232323333573466e1cd55cea801a4000466600e6464646666ae68cdc39aab9d5002480008cc034c0c4d5d0a80119a8098169aba135744a00446a06c6a606e66ae71241035054310003849926135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a01eeb8d5d09aba25002235032353033335738921035054310003449926135744a00226aae7940044dd50009110919980080200180110009109198008018011000899aa800bae75a224464460046eac004c8004d540d888c8cccd55cf80112804919a80419aa81898031aab9d5002300535573ca00460086ae8800c0b84d5d08008891001091091198008020018900089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a01046a0526a605466ae712401035054310002b499264984d55cea80089baa001121223002003112200112001232323333573466e1cd55cea8012400046600c600e6ae854008dd69aba135744a00446a0466a604866ae71241035054310002549926135573ca00226ea80048848cc00400c00880048c8cccd5cd19b8735573aa002900011bae357426aae7940088d407cd4c080cd5ce24810350543100021499261375400224464646666ae68cdc3a800a40084a00e46666ae68cdc3a8012400446a014600c6ae84d55cf280211999ab9a3370ea00690001280511a8111a981199ab9c490103505431000244992649926135573aa00226ea8004484888c00c0104488800844888004480048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188d4068d4c06ccd5ce249035054310001c499264984d55ce9baa0011220021220012001232323232323333573466e1d4005200c200b23333573466e1d4009200a200d23333573466e1d400d200823300b375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c46601a6eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc048c050d5d0a8049bae357426ae8940248cccd5cd19b875006480088c050c054d5d09aab9e500b23333573466e1d401d2000230133016357426aae7940308d407cd4c080cd5ce2481035054310002149926499264992649926135573aa00826aae79400c4d55cf280109aab9e500113754002424444444600e01044244444446600c012010424444444600a010244444440082444444400644244444446600401201044244444446600201201040024646464646666ae68cdc3a800a400446660106eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d400920002300a300b357426aae7940188d4040d4c044cd5ce2490350543100012499264984d55cea80189aba25001135573ca00226ea80048488c00800c888488ccc00401401000c80048c8c8cccd5cd19b875001480088c018dd71aba135573ca00646666ae68cdc3a80124000460106eb8d5d09aab9e500423500a35300b3357389201035054310000c499264984d55cea80089baa001212230020032122300100320011122232323333573466e1cd55cea80124000466aa016600c6ae854008c014d5d09aba25002235007353008335738921035054310000949926135573ca00226ea8004498480048004448848cc00400c008448004488800c488800848880048004488800c488800848880048004448c8c00400488cc00cc008008004c8c8cc88cc88c8ccc888c8c8c8c8c8ccc888ccc888ccc888c8cccc8888c8cc88c8cccc8888c8cc88c8cc88c8ccc888c8c8cc88c8c8cc88c8c8c8cccc8888c8c8c8c8c8cc88c8cc88cc88ccccccccccccc8888888888888c8c8c8c8c8cccccccc88888888cc88cc88cc88cc88c8ccccc88888c8cc88cc88cc88c8cc88cc88cc88c8cc88c8c8c8cccc8888cccc8888c8888d4d540400108888c8c8c94cd4c24004ccc0140280240205400454cd4c24004cd5ce249025331000910115001109101153353508101003215335309001333573466e1cccc109400cd4c07800488004c0580212002092010910115002153353090013357389201025332000910115002109101150011533535080013300533501b00833303e03f5001323355306012001235355096010012233550990100233553063120012353550990100122335509c0100233704900080080080099a809801180a003003909a9aa84a8080091911a9a80f00091299a984a0098050010a99a984a00999aa9837090009a835283491a9aa84d8080091199aa9838890009a836a83611a9aa84f0080091199ab9a3370e900000084e0084d808008008a8020a99a984a0099ab9c49102533300095011500410950113535501e00522253353097013333355027253335301400113374a90001bb14984cdd2a40046ec52613374a90021bb149800c008c8cd400541d141d4488cc008cd40ac01cccc124128018cd4078034c07c04400403c4264044cd5ce249025335000980113535501a0012225335309301333335502325301d00100300200100b109501133573892010253340009401133573892010253360008f0113530220052235302d002222222222253353508b013303000a00b2135303a0012235303e0012220021350a10135309d0133573892010253300009e01498cccd5403488d4d404c008894ccd4c02400c54ccd4c01400854ccd4c02400c541f04d41f4cd542400554034cd405801c004541f054ccd4c02400c4d41f4cd542400554034cd4058020004541f0541f0541f054ccd4c01400854ccd4c02400c541f04d41f4cd542400554034cd405801c004541f054ccd4c02400c4d41f4cd542400554034cd4058020004541f0541f0541f04d41f4cd542400554034cd4058019419894ccd4c008004421c04421c044220048882280541e0488800c488800848880048004488800c48880084888004800444ccd5401d416541654164494cd4d41b8004848cd4168cd5421404d4c03000888004cd4168cd54214040052002505b505b12505a235355081013530100012235301b00222222222225335350793301e00a00b213530280012235302c00122235303100322335308701002230930116253353508201004213355098010020011309301161308a01162200211222212333300100500400300211200120011122212333001004003002112001122123300100300212001221233001003002200111222225335307533355304f120013504b504a235300b002223301500200300415335307533355304f120013504b504a235300b002223530160022222222222353501500d22533530840133355305e120013505450562353025001223304b00200400c10860113357389201024c30000850100315335307533355304f120013504b504a235300b002223530160022222222222353501300d22533530840133355305e12001350545056235302700122253353507a00121533530890133305108501003006153353507b330623019007009213308501001002108a01108a011089015335350763301b00c00d2135302500122353029001222333553055120012235302e00222235303300822353035005225335309301333308401004003002001133506f0090081008506701113508c01353088013357389201024c6600089014984218044cd5ce2481024c3100085010021077150741507415074122123300100300212001122123300100300212001221233001003002200122533335300300121505f21505f21505f2133355304612001504a235300d001225335306f3303300200413506300315062003212222300400521222230030052122223002005212222300100520013200135506c22233333333333353019001235300500322222222225335307153353506333355304b12001504f253353072333573466e3c0300041d01cc4d41980045419400c841d041c841cc4cd5ce249024c340007222353006004222222222253353506453353506433355304c1200150502353550790012253353075333573466e3c00803c1dc1d84d41a400c541a000884d419cd4d541e40048800454194854cd4c1ccccd5cd19baf00100c0750741075150701506f235300500322222222225335307133355304b120013504150432333573466ebc0300041d01cccd54c108480048d4d541e00048800400841cc4cd5ce249024c320007222225335306a333573466e1cd4c0200188888888888ccc09801c0380300041b01ac41b04cd5ce2481024c390006b22235300700522222222225335307333355304d1200135043504523530160012225335350690012153353078333040074003010153353506a35301601422222222223305b01b0022153353079333573466e3c0040081ec1e84d4c07401488cccc1b0008004c1d005541b841e841e441e441e002441d44cd5ce249024c6200074225335306833303002f0013335530331200150175045353006004222222222233355303d120012235301600222235301b00322335307100225335307a333573466e3c0500041f01ec4cd415801401c401c801d413c02441a84cd5ce2481024c610006925335306733302f02e001353005003222222222233355304b12001501f235301400122200200910691335738921024c36000682533530673335530411200135037503923300500400100110691335738921024c640006825335306733302f02e001353005003222222222233355304b12001501f23530120012235301600122200200a106913357389201024c35000682353005003222222222253353506333355304b12001504f235301200122533530743303800200e1350680031506700a213530120012235301600122253353506900121507610791506f22353006004222222222253353506433355304c120015050235301300122533530753303900200f1350690031506800a2107513357389201024c380007323530050032222222222353503100b22353503500222353503500822353503900222533530793333333222222253335306d33350640070060031533530800100215335308001005133350610070010041081011333506100700100410810113335061007001004333333335064075225335307b333573466e1c0080041f41f041ac54cd4c1ecccd5cd19b8900200107d07c1069106a22333573466e200080041f41f010088ccd5cd19b8900200107c07d22333573466e200080041f01f4894cd4c1ecccd5cd19b8900200107d07c10011002225335307b333573466e240080041f41f04008400401801401c00800400c41ec4cd5ce249024c330007a222222222212333333333300100b00a009008007006005004003002200122123300100300220012221233300100400300220012212330010030022001212222222300700822122222223300600900821222222230050081222222200412222222003221222222233002009008221222222233001009008200113350325001502f13001002222335530241200123535505a00122335505d002335530271200123535505d001223355060002333535502500123300a4800000488cc02c0080048cc02800520000013301c00200122337000040024446464600200a640026aa0b64466a6a05e0029000111a9aa82e00111299a982c199ab9a3371e0040120b40b22600e0022600c006640026aa0b44466a6a05c0029000111a9aa82d80111299a982b999ab9a3371e00400e0b20b020022600c00642444444444444601801a4424444444444446601601c01a42444444444444601401a44442444444444444666601202001e01c01a444244444444444466601001e01c01a4424444444444446600e01c01a42444444444444600c01a42444444444444600a01a42444444444444600801a42444444444444600601a4424444444444446600401c01a42444444444444600201a400224424660020060042400224424660020060042400244a66a607c666ae68cdc79a9801801110011a98018009100102001f8999ab9a3370e6a6006004440026a60060024400208007e207e442466002006004400244666ae68cdc480100081e81e111199aa980a890009a808a80811a9aa82100091199aa980c090009a80a280991a9aa82280091199a9aa8068009198052400000244660160040024660140029000000998020010009119aa98050900091a9aa8200009119aa821801199a9aa804000919aa98070900091a9aa8220009119aa8238011aa80780080091199aaa80401c801000919aa98070900091a9aa8220009119aa8238011aa806800800999aaa80181a001000888911199aa980209000a80a99aa98050900091a9aa8200009119aa8218011aa805800999aa980209000911a9aa82080111299a981e999aa980b890009a806a80791a9aa82200091198050010028030801899a80c802001a80b00099aa98050900091a9aa820000911919aa8220019800802990009aa82291299a9a80c80089aa8058019109a9aa82300111299a982119806001004099aa80800380089803001801190009aa81f1108911299a9a80a800880111099802801199aa980389000802802000889091118018020891091119801002802089091118008020890008919a80891199a9a803001910010010009a9a80200091000990009aa81c110891299a9a8070008a80811099a808980200119aa980309000802000899a80111299a981800108190800817891091980080180109000899a80191299a9816801080088170168919a80591199a9a802001910010010009a9a8010009100089109198008018010900091299a9a80d999aa980189000a80391a9aa81800091299a9816199ab9a3375e00200a05c05a26a0400062a03e002426a03c6a6aa060002440042a038640026aa05e4422444a66a6a00c00226a6a01400644002442666a6a01800a440046008004666aa600e2400200a00800222440042442446600200800624002266a00444a66a6a02c004420062002a02a24424660020060042400224446a6a008004446a6a00c00644a666a6026666a01400e0080042a66a604c00620022050204e2050244246600200600424002244464646464a666a6a01000c42a666a6a01200c42a666a6a0140104260082c260062c2a666a6a01400e4260082c260062c202a20262a666a6a01200e4260082c260062c2a666a6a01200c4260082c260062c20282a666a6a01000a42024202620222a666a6a01000a42a666a6a01200e42600a2c260082c2a666a6a01200c42600a2c260082c202820242a666a6a01000c42600a2c260082c2a666a6a01000a42600a2c260082c20264a666a6a01000a42a666a6a01200e42a666a6a01400e42666a01e014004002260222c260222c260202c20262a666a6a01000c42a666a6a01200c42666a01c012004002260202c260202c2601e2c202420224a666a6a00e00842a666a6a01000c42a666a6a01200c42666a01c012004002260202c260202c2601e2c20242a666a6a00e00a42a666a6a01000a42666a01a0100040022601e2c2601e2c2601c2c202220204a666a6a00c00642a666a6a00e00a42a666a6a01000a42666a01a0100040022601e2c2601e2c2601c2c20222a666a6a00c00842a666a6a00e00842666a01800e0040022601c2c2601c2c2601a2c2020201e4a666a6a00a00442a666a6a00c00842a666a6a00e00842666a01800e0040022601c2c2601c2c2601a2c20202a666a6a00a00642a666a6a00c00642666a01600c0040022601a2c2601a2c260182c201e201c2424446006008224440042244400224002246a6a0040024444444400e244444444246666666600201201000e00c00a008006004240024c244400624440042444002400244446466a601800a466a601a0084a66a602c666ae68cdc780100080c00b8a801880b900b919a9806802100b9299a980b199ab9a3371e00400203002e2a006202e2a66a6a00a00642a66a6a00c0044266a6014004466a6016004466a601e004466a60200044660280040024034466a6020004403446602800400244403444466a601a0084034444a66a6036666ae68cdc380300180e80e0a99a980d999ab9a3370e00a00403a03826602e00800220382038202a2a66a6a00a0024202a202a2424460040062244002240024244600400644424466600200a00800640024244600400642446002006400244666ae68cdc780100080480411199ab9a3370e00400201000e266ae712401024c630000413357389201024c370000313357389201024c64000021220021220012001235006353002335738921024c6700003498480048004448848cc00400c008448004498448c8c00400488cc00cc0080080050482d87a80d87980f5f6", - "inputs": [ - { - "id": "{{transactionId}}", - "index": 0, - "address": "addr_test1wpxh9n6kngee5x98myczxyuc8atwpktv63daevwk2yku56sr3mkap", - "datum": "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec", - "amount": { - "quantity": 2000000, - "unit": "lovelace" - }, - "assets": [] - } - ], - "redeemers": [ - { - "purpose": "spending", - "input": { - "id": "{{transactionId}}", - "index": 0 - }, - "data": "D87A80" - } - ] -} diff --git a/test/e2e/fixtures/plutus/withdrawal.json b/test/e2e/fixtures/plutus/withdrawal.json deleted file mode 100644 index aaac7a22623..00000000000 --- a/test/e2e/fixtures/plutus/withdrawal.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "transaction": "84A400800180020005A1581DF0{{scriptHash}}00A10381590853{{script}}F5F6", - "inputs": [], - "redeemers": [ - { - "purpose": "rewarding", - "stake_address": "stake_test17qdcxaxsk222fgeenle97p4qwpa3vg20r6dk0nufhgj9ffsytg3a0", - "data": "D87980" - } - ] -} diff --git a/test/e2e/fixtures/plutus/withdrawal_validator b/test/e2e/fixtures/plutus/withdrawal_validator deleted file mode 100644 index 159b6191010..00000000000 --- a/test/e2e/fixtures/plutus/withdrawal_validator +++ /dev/null @@ -1 +0,0 @@ -5908500100003233223322323233322232333222323333333322222222323332223233332222323233223233322232333222323233223322323233333222223322332233223322332233222232325335302f33223530470020333333573466e1cd55ce9baa00448000811c8d4114d4c118cd5ce2490350543100047499263333573466e1cd55cea8012400046600e64646464646464646464646666ae68cdc39aab9d500a480008cccccccccc054cd408c8c8c8cccd5cd19b8735573aa004900011980d981b1aba150023028357426ae8940088d4154d4c158cd5ce249035054310005749926135573ca00226ea8004d5d0a80519a8118121aba150093335502a75ca0526ae854020ccd540a9d728149aba1500733502303f35742a00c66a04666aa0a0090eb4d5d0a8029919191999ab9a3370e6aae7540092000233501d3232323333573466e1cd55cea80124000466a04a66a07ceb4d5d0a80118219aba135744a00446a0b26a60b466ae712401035054310005b49926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233502333503e75a6ae854008c10cd5d09aba2500223505935305a3357389201035054310005b49926135573ca00226ea8004d5d09aba250022350553530563357389201035054310005749926135573ca00226ea8004d5d0a80219a811bae35742a00666a04666aa0a0eb88004d5d0a801181a9aba135744a00446a0a26a60a466ae71241035054310005349926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea00290031180d181b9aba135573ca00646666ae68cdc3a801240084603260826ae84d55cf280211999ab9a3370ea00690011180c98161aba135573ca00a46666ae68cdc3a80224000460386eb8d5d09aab9e500623504c35304d3357389201035054310004e49926499264984d55cea80089baa001357426ae8940088d4114d4c118cd5ce2490350543100047499261046135044353045335738920103505435000464984d55cf280089baa0012212330010030022001222222222212333333333300100b00a00900800700600500400300220012212330010030022001122123300100300212001122123300100300212001122123300100300212001212222300400521222230030052122223002005212222300100520011232230023758002640026aa068446666aae7c004940388cd4034c010d5d080118019aba200203323232323333573466e1cd55cea801a4000466600e6464646666ae68cdc39aab9d5002480008cc034c0c4d5d0a80119a8098169aba135744a00446a06c6a606e66ae712401035054310003849926135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a01eeb8d5d09aba25002235032353033335738921035054310003449926135744a00226aae7940044dd50009110919980080200180110009109198008018011000899aa800bae75a224464460046eac004c8004d540b888c8cccd55cf80112804919a80419aa81898031aab9d5002300535573ca00460086ae8800c0b84d5d08008891001091091198008020018900089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a01046a0526a605466ae712401035054310002b499264984d55cea80089baa001121223002003112200112001232323333573466e1cd55cea8012400046600c600e6ae854008dd69aba135744a00446a0466a604866ae71241035054310002549926135573ca00226ea80048848cc00400c00880048c8cccd5cd19b8735573aa002900011bae357426aae7940088d407cd4c080cd5ce24810350543100021499261375400224464646666ae68cdc3a800a40084a00e46666ae68cdc3a8012400446a014600c6ae84d55cf280211999ab9a3370ea00690001280511a8111a981199ab9c490103505431000244992649926135573aa00226ea8004484888c00c0104488800844888004480048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188d4068d4c06ccd5ce249035054310001c499264984d55ce9baa0011220021220012001232323232323333573466e1d4005200c200b23333573466e1d4009200a200d23333573466e1d400d200823300b375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c46601a6eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc048c050d5d0a8049bae357426ae8940248cccd5cd19b875006480088c050c054d5d09aab9e500b23333573466e1d401d2000230133016357426aae7940308d407cd4c080cd5ce2481035054310002149926499264992649926135573aa00826aae79400c4d55cf280109aab9e500113754002424444444600e01044244444446600c012010424444444600a010244444440082444444400644244444446600401201044244444446600201201040024646464646666ae68cdc3a800a400446660106eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d400920002300a300b357426aae7940188d4040d4c044cd5ce2490350543100012499264984d55cea80189aba25001135573ca00226ea80048488c00800c888488ccc00401401000c80048c8c8cccd5cd19b875001480088c018dd71aba135573ca00646666ae68cdc3a80124000460106eb8d5d09aab9e500423500a35300b3357389201035054310000c499264984d55cea80089baa001212230020032122300100320011122232323333573466e1cd55cea80124000466aa016600c6ae854008c014d5d09aba25002235007353008335738921035054310000949926135573ca00226ea8004498480048004448848cc00400c008448004448c8c00400488cc00cc0080080041 diff --git a/test/e2e/fixtures/plutus/withdrawal_validator_cardano_cli.script b/test/e2e/fixtures/plutus/withdrawal_validator_cardano_cli.script deleted file mode 100644 index 3655e498596..00000000000 --- a/test/e2e/fixtures/plutus/withdrawal_validator_cardano_cli.script +++ /dev/null @@ -1 +0,0 @@ -{"cborHex":"5908535908500100003233223322323233322232333222323333333322222222323332223233332222323233223233322232333222323233223322323233333222223322332233223322332233222232325335302f33223530470020333333573466e1cd55ce9baa00448000811c8d4114d4c118cd5ce2490350543100047499263333573466e1cd55cea8012400046600e64646464646464646464646666ae68cdc39aab9d500a480008cccccccccc054cd408c8c8c8cccd5cd19b8735573aa004900011980d981b1aba150023028357426ae8940088d4154d4c158cd5ce249035054310005749926135573ca00226ea8004d5d0a80519a8118121aba150093335502a75ca0526ae854020ccd540a9d728149aba1500733502303f35742a00c66a04666aa0a0090eb4d5d0a8029919191999ab9a3370e6aae7540092000233501d3232323333573466e1cd55cea80124000466a04a66a07ceb4d5d0a80118219aba135744a00446a0b26a60b466ae712401035054310005b49926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233502333503e75a6ae854008c10cd5d09aba2500223505935305a3357389201035054310005b49926135573ca00226ea8004d5d09aba250022350553530563357389201035054310005749926135573ca00226ea8004d5d0a80219a811bae35742a00666a04666aa0a0eb88004d5d0a801181a9aba135744a00446a0a26a60a466ae71241035054310005349926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea00290031180d181b9aba135573ca00646666ae68cdc3a801240084603260826ae84d55cf280211999ab9a3370ea00690011180c98161aba135573ca00a46666ae68cdc3a80224000460386eb8d5d09aab9e500623504c35304d3357389201035054310004e49926499264984d55cea80089baa001357426ae8940088d4114d4c118cd5ce2490350543100047499261046135044353045335738920103505435000464984d55cf280089baa0012212330010030022001222222222212333333333300100b00a00900800700600500400300220012212330010030022001122123300100300212001122123300100300212001122123300100300212001212222300400521222230030052122223002005212222300100520011232230023758002640026aa068446666aae7c004940388cd4034c010d5d080118019aba200203323232323333573466e1cd55cea801a4000466600e6464646666ae68cdc39aab9d5002480008cc034c0c4d5d0a80119a8098169aba135744a00446a06c6a606e66ae712401035054310003849926135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a01eeb8d5d09aba25002235032353033335738921035054310003449926135744a00226aae7940044dd50009110919980080200180110009109198008018011000899aa800bae75a224464460046eac004c8004d540b888c8cccd55cf80112804919a80419aa81898031aab9d5002300535573ca00460086ae8800c0b84d5d08008891001091091198008020018900089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a01046a0526a605466ae712401035054310002b499264984d55cea80089baa001121223002003112200112001232323333573466e1cd55cea8012400046600c600e6ae854008dd69aba135744a00446a0466a604866ae71241035054310002549926135573ca00226ea80048848cc00400c00880048c8cccd5cd19b8735573aa002900011bae357426aae7940088d407cd4c080cd5ce24810350543100021499261375400224464646666ae68cdc3a800a40084a00e46666ae68cdc3a8012400446a014600c6ae84d55cf280211999ab9a3370ea00690001280511a8111a981199ab9c490103505431000244992649926135573aa00226ea8004484888c00c0104488800844888004480048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188d4068d4c06ccd5ce249035054310001c499264984d55ce9baa0011220021220012001232323232323333573466e1d4005200c200b23333573466e1d4009200a200d23333573466e1d400d200823300b375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c46601a6eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc048c050d5d0a8049bae357426ae8940248cccd5cd19b875006480088c050c054d5d09aab9e500b23333573466e1d401d2000230133016357426aae7940308d407cd4c080cd5ce2481035054310002149926499264992649926135573aa00826aae79400c4d55cf280109aab9e500113754002424444444600e01044244444446600c012010424444444600a010244444440082444444400644244444446600401201044244444446600201201040024646464646666ae68cdc3a800a400446660106eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d400920002300a300b357426aae7940188d4040d4c044cd5ce2490350543100012499264984d55cea80189aba25001135573ca00226ea80048488c00800c888488ccc00401401000c80048c8c8cccd5cd19b875001480088c018dd71aba135573ca00646666ae68cdc3a80124000460106eb8d5d09aab9e500423500a35300b3357389201035054310000c499264984d55cea80089baa001212230020032122300100320011122232323333573466e1cd55cea80124000466aa016600c6ae854008c014d5d09aba25002235007353008335738921035054310000949926135573ca00226ea8004498480048004448848cc00400c008448004448c8c00400488cc00cc0080080041","type":"PlutusScriptV1","description":""} diff --git a/test/e2e/fixtures/simple/policy.script b/test/e2e/fixtures/simple/policy.script deleted file mode 100644 index 3ff4c9ef44e..00000000000 --- a/test/e2e/fixtures/simple/policy.script +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "all", - "scripts": [ - { - "type": "sig", - "keyHash": "83ffcc26a977eb2cb7238334b91ec94de72fba2e8b58dda4d2afea6f" - } - ] - } \ No newline at end of file diff --git a/test/e2e/fixtures/simple/policy.skey b/test/e2e/fixtures/simple/policy.skey deleted file mode 100644 index 5c599a0bff0..00000000000 --- a/test/e2e/fixtures/simple/policy.skey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "PaymentSigningKeyShelley_ed25519", - "description": "Payment Signing Key", - "cborHex": "5820f97fb59fbe095e54da6e80c3f473172198c5564ec205e246f25ea50cc38c8a04" -} diff --git a/test/e2e/fixtures/simple/policy.vkey b/test/e2e/fixtures/simple/policy.vkey deleted file mode 100644 index 0c1123831e7..00000000000 --- a/test/e2e/fixtures/simple/policy.vkey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "PaymentVerificationKeyShelley_ed25519", - "description": "Payment Verification Key", - "cborHex": "5820705fd8b8e253e6b7e14a28e8a2ec456306fef7a221e6b88867b06f6887d38ee0" -} diff --git a/test/e2e/fixtures/wallet_assets/happy_coin/policy.script b/test/e2e/fixtures/wallet_assets/happy_coin/policy.script deleted file mode 100644 index 777c8ba6e4b..00000000000 --- a/test/e2e/fixtures/wallet_assets/happy_coin/policy.script +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "all", - "scripts": [ - { - "type": "sig", - "keyHash": "69303ce3536df260efddbc949ccb94e6993302b10b778d8b4d98bfb5" - } - ] - } \ No newline at end of file diff --git a/test/e2e/fixtures/wallet_assets/happy_coin/policy.skey b/test/e2e/fixtures/wallet_assets/happy_coin/policy.skey deleted file mode 100644 index 880ed707dcb..00000000000 --- a/test/e2e/fixtures/wallet_assets/happy_coin/policy.skey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "PaymentSigningKeyShelley_ed25519", - "description": "Payment Signing Key", - "cborHex": "582012095eef0beaeb0224063a9b9a823c20a02fca9f59f7dd339f765ffd6992ddfb" -} diff --git a/test/e2e/fixtures/wallet_assets/happy_coin/policy.vkey b/test/e2e/fixtures/wallet_assets/happy_coin/policy.vkey deleted file mode 100644 index d912386bb3b..00000000000 --- a/test/e2e/fixtures/wallet_assets/happy_coin/policy.vkey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "PaymentVerificationKeyShelley_ed25519", - "description": "Payment Verification Key", - "cborHex": "5820db2c42a7c5b70d7e635b95c5864439f22ccd6639cc7bc128a88a804f149a4448" -} diff --git a/test/e2e/fixtures/wallet_assets/sad_coin/policy.script b/test/e2e/fixtures/wallet_assets/sad_coin/policy.script deleted file mode 100644 index 388cc15342f..00000000000 --- a/test/e2e/fixtures/wallet_assets/sad_coin/policy.script +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "all", - "scripts": [ - { - "type": "sig", - "keyHash": "fda874ee455948ba27fe50ea44228995f47b278ef0f35cec8cd31933" - } - ] - } \ No newline at end of file diff --git a/test/e2e/fixtures/wallet_assets/sad_coin/policy.skey b/test/e2e/fixtures/wallet_assets/sad_coin/policy.skey deleted file mode 100644 index 1183dfbb6c4..00000000000 --- a/test/e2e/fixtures/wallet_assets/sad_coin/policy.skey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "PaymentSigningKeyShelley_ed25519", - "description": "Payment Signing Key", - "cborHex": "5820379ec44d0e7df5a23c37ce79be82217ecaa0676abcb1439ebf25d05ea3369ac6" -} diff --git a/test/e2e/fixtures/wallet_assets/sad_coin/policy.vkey b/test/e2e/fixtures/wallet_assets/sad_coin/policy.vkey deleted file mode 100644 index f703f9cbff2..00000000000 --- a/test/e2e/fixtures/wallet_assets/sad_coin/policy.vkey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "PaymentVerificationKeyShelley_ed25519", - "description": "Payment Verification Key", - "cborHex": "5820ff26429770c4f3a6b562d027323c287767a9893aa14085006dd96cc5abf68f18" -} diff --git a/test/e2e/flake.lock b/test/e2e/flake.lock deleted file mode 100644 index 7db1127420c..00000000000 --- a/test/e2e/flake.lock +++ /dev/null @@ -1,61 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1681378341, - "narHash": "sha256-2qUN04W6X9cHHytEsJTM41CmusifPTC0bgTtYsHSNY8=", - "owner": "hamishmack", - "repo": "flake-utils", - "rev": "2767bafdb189cd623354620c2dacbeca8fd58b17", - "type": "github" - }, - "original": { - "owner": "hamishmack", - "ref": "hkm/nested-hydraJobs", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1719486507, - "narHash": "sha256-5rD75idBP4BrhcLMtkosrpLnOS5i1ebzN5az2JtmgMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "febf0c45943643f076d39bce6cd6f90ce20b2eaa", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/test/e2e/flake.nix b/test/e2e/flake.nix deleted file mode 100644 index c2d222c4024..00000000000 --- a/test/e2e/flake.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - description = '' - Shell for the Ruby E2E tests. - This shell does *not* include `cardano-wallet` and `cardano-node`, - only the Ruby environment. - ''; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs"; - flake-utils.url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs"; - }; - - outputs = inputs: - let - supportedSystems = [ - "x86_64-linux" - "x86_64-darwin" - # The `blake2b` Ruby gem does not compile on aarch64-* - # "aarch64-linux" - # "aarch64-darwin" - ]; in - inputs.flake-utils.lib.eachSystem supportedSystems (system: - let - # Imports - pkgs = inputs.nixpkgs.legacyPackages.${system}; - - # To update gemset.nix, run: - # nix develop -c bundix - gems = pkgs.bundlerEnv { - name = "gems-cardano-wallet-e2e"; - gemdir = ./.; - ruby = pkgs.ruby_3_1; - }; - in { - packages = { }; - - devShells.default = pkgs.mkShell { - buildInputs = [ - pkgs.curl - pkgs.jq - gems - gems.wrappedRuby - pkgs.bundix - pkgs.screen - ]; - shellHook = '' - # use this hook to set up additional environment variables - ''; - }; - } - ); -} diff --git a/test/e2e/gemset.nix b/test/e2e/gemset.nix deleted file mode 100644 index 41d6f67a602..00000000000 --- a/test/e2e/gemset.nix +++ /dev/null @@ -1,232 +0,0 @@ -{ - addressable = { - dependencies = ["public_suffix"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1ypdmpdn20hxp5vwxz3zc04r5xcwqc25qszdlg41h8ghdqbllwmw"; - type = "gem"; - }; - version = "2.8.1"; - }; - bip_mnemonic = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0p9kdsy0i6x4170l83726lrm52c1g62pfzi6ip3nx0ysj6h3qffy"; - type = "gem"; - }; - version = "0.0.4"; - }; - blake2b = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1i7kxnnvv2lqglc1crhkqp0s9hybx20wgrl04jqkk7y2sawyb6hg"; - type = "gem"; - }; - version = "0.10.0"; - }; - buildkit = { - dependencies = ["sawyer"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1phnc6p52xphg8vx54gys70anip8wqx44yixjf6xqxlf46nbiqn0"; - type = "gem"; - }; - version = "1.5.0"; - }; - cardano_wallet = { - dependencies = ["bip_mnemonic" "httparty"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1igkk6mh3nwal86fifwa7swrmxyb1x8p1rn6xricsg9p1hbn0wvl"; - type = "gem"; - }; - version = "0.4.2"; - }; - cbor = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1dsf9gjc2cj79vrnz2vgq573biqjw7ad4b0idm05xg6rb3y9gq4y"; - type = "gem"; - }; - version = "0.5.9.8"; - }; - diff-lcs = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0rwvjahnp7cpmracd8x732rjgnilqv2sx7d1gfrysslc3h039fa9"; - type = "gem"; - }; - version = "1.5.0"; - }; - faraday = { - dependencies = ["faraday-net_http" "ruby2_keywords"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1wyz9ab0mzi84gpf81fs19vrixglmmxi25k6n1mn9h141qmsp590"; - type = "gem"; - }; - version = "2.7.1"; - }; - faraday-net_http = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "13byv3mp1gsjyv8k0ih4612y6vw5kqva6i03wcg4w2fqpsd950k8"; - type = "gem"; - }; - version = "3.0.2"; - }; - httparty = { - dependencies = ["mini_mime" "multi_xml"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "050jzsa6fbfvy2rldhk7mf1sigildaqvbplfz2zs6c0zlzwppvq0"; - type = "gem"; - }; - version = "0.21.0"; - }; - mini_mime = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0lbim375gw2dk6383qirz13hgdmxlan0vc5da2l072j3qw6fqjm5"; - type = "gem"; - }; - version = "1.1.2"; - }; - multi_xml = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0lmd4f401mvravi1i1yq7b2qjjli0yq7dfc4p1nj5nwajp7r6hyj"; - type = "gem"; - }; - version = "0.6.0"; - }; - mustache = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1l0p4wx15mi3wnamfv92ipkia4nsx8qi132c6g51jfdma3fiz2ch"; - type = "gem"; - }; - version = "1.1.1"; - }; - public_suffix = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0hz0bx2qs2pwb0bwazzsah03ilpf3aai8b7lk7s35jsfzwbkjq35"; - type = "gem"; - }; - version = "5.0.1"; - }; - rake = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1cvaqarr1m84mhc006g3l1vw7sa5qpkcw0138lsxlf769zdllsgp"; - type = "gem"; - }; - version = "12.3.3"; - }; - rspec = { - dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "19dyb6rcvgi9j2mksd29wfdhfdyzqk7yjhy1ai77559hbhpg61w9"; - type = "gem"; - }; - version = "3.11.0"; - }; - rspec-core = { - dependencies = ["rspec-support"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "118hkfw9b11hvvalr7qlylwal5h8dihagm9xg7k4gskg7587hca6"; - type = "gem"; - }; - version = "3.11.0"; - }; - rspec-expectations = { - dependencies = ["diff-lcs" "rspec-support"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0l1bzk6a68i1b2qix83vs40r0pbjawv67hixiq2qxsja19bbq3bc"; - type = "gem"; - }; - version = "3.11.1"; - }; - rspec-mocks = { - dependencies = ["diff-lcs" "rspec-support"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "07vagjxdm5a6s103y8zkcnja6avpl8r196hrpiffmg7sk83dqdsm"; - type = "gem"; - }; - version = "3.11.1"; - }; - rspec-support = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1c01iicvrjk6vv744jgh0y4kk9d0kg2rd2ihdyzvg5p06xm2fpzq"; - type = "gem"; - }; - version = "3.11.1"; - }; - ruby2_keywords = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1vz322p8n39hz3b4a9gkmz9y7a5jaz41zrm2ywf31dvkqm03glgz"; - type = "gem"; - }; - version = "0.0.5"; - }; - sawyer = { - dependencies = ["addressable" "faraday"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1jks1qjbmqm8f9kvwa81vqj39avaj9wdnzc531xm29a55bb74fps"; - type = "gem"; - }; - version = "0.9.2"; - }; -} diff --git a/test/e2e/helpers/buildkite.rb b/test/e2e/helpers/buildkite.rb deleted file mode 100644 index a231744daab..00000000000 --- a/test/e2e/helpers/buildkite.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -require 'buildkit' -require 'httparty' - -## -# Buildkite helper -class Buildkite - include HTTParty - include Helpers::Utils - - attr_reader :org, :pipeline, :client - - def initialize(pipeline = 'cardano-wallet') - @org = 'cardano-foundation' - @pipeline = pipeline - @api_token = ENV.fetch('BUILDKITE_API_TOKEN', nil) - @client = Buildkit.new(token: @api_token) - end - - def build_numbers(options = { branch: 'master' }) - num = @client.pipeline_builds(@org, @pipeline, options).map { |b| b[:number] } - raise "No builds found for #{options}" if num.empty? - - num - end - - def last_build_number(options = { branch: 'master' }) - build_numbers(options).first - end - - def build_details(build_no) - @client.build(@org, @pipeline, build_no) - end - - def last_build_details(options = { branch: 'master' }) - build_details(last_build_number(options)) - end - - # get job details for given build number: job_key => job_id - def jobs(build_no) - build_details(build_no)[:jobs].to_h { |j| [j[:step_key], j[:id]] } - end - - # get list of artifacts for given job_id - def artifacts(build_no, job_id) - @client.job_artifacts(@org, @pipeline, build_no, job_id) - end - - # get artifact urls for given job_id - def artifact_urls(build_no, job_id) - artifacts(build_no, job_id).map { |a| a[:download_url] } - end - - # artifact url is redirecting to s3 and requires auth, - # so we need to follow it to retrieve the downloadable url - def make_artifact_url_downloadable(url) - r = self.class.get(url, follow_redirects: false, - headers: { 'Authorization' => "Bearer #{@api_token}" }) - r.to_hash['url'] - end - - # we assume that there is only one artifact for given job - def get_artifact_url(build_no, job_id) - make_artifact_url_downloadable(artifact_urls(build_no, job_id).first) - end - - def get_artifacts(build_no, job_id, target_dir, target_file = 'binary-dist', unzip: true) - log "Downloading artifacts for build #{build_no} job #{job_id} to #{target_dir}" - url = get_artifact_url(build_no, job_id) - wget(url, target_file) - unzip_artifact(target_file, target_dir) if unzip - end -end diff --git a/test/e2e/helpers/cardano_addresses.rb b/test/e2e/helpers/cardano_addresses.rb deleted file mode 100644 index ddf45da2de1..00000000000 --- a/test/e2e/helpers/cardano_addresses.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -## -# cardano-address cmd helper wrapper -# -class CardanoAddresses - ## - # @param mnemonics - def prv_key_from_recovery_phrase(mnemonics, cmd_params) - cmd(%(echo #{mnemonics.join(' ')}| cardano-address key from-recovery-phrase #{cmd_params})).gsub( - "\n", '' - ) - end - - def key_public(key, with_chain_code: true) - cmd(%(echo #{key}| cardano-address key public #{with_chain_code ? '--with-chain-code' : '--without-chain-code'})).gsub( - "\n", '' - ) - end - - def key_child(key, derivation_path) - cmd(%(echo #{key}| cardano-address key child #{derivation_path})).gsub("\n", '') - end - - def key_walletid(key, templates = '') - cmd(%(echo #{key}| cardano-address key walletid #{templates})).gsub("\n", '') - end - - def script_hash(script) - cmd(%(cardano-address script hash "#{script}")).gsub("\n", '') - end -end diff --git a/test/e2e/helpers/cardano_cli.rb b/test/e2e/helpers/cardano_cli.rb deleted file mode 100644 index 16f5e1bcd94..00000000000 --- a/test/e2e/helpers/cardano_cli.rb +++ /dev/null @@ -1,149 +0,0 @@ -# frozen_string_literal: true - -## -# cardano-cli cmd helper wrapper -# -class CardanoCli - attr_reader :node_state, :socket_path, :protocol_magic - - def initialize(protocol_magic) - @node_state = File.join(absolute_path(ENV.fetch('TESTS_NODE_DB', nil)), CONTEXT.env) - @protocol_magic = protocol_magic - - if win? - @socket_path = '\\\\.\\pipe\\cardano-node-testnet' - else - @socket_path = ENV.fetch('CARDANO_NODE_SOCKET_PATH') - # Add additional permissions to node.socket if we're in e2e docker test suite, - # so cardano-cli can work with cardano-node from the docker container - cmd(%(sudo chmod a+rwx #{@socket_path})) if ENV['E2E_DOCKER_RUN'] == '1' - end - ENV['CARDANO_NODE_SOCKET_PATH'] = @socket_path - end - - def cli(*options) - cmd(%(cardano-cli #{options.join(' ')})) - end - - def build_script_address(script_file_path) - cli('address', 'build', '--payment-script-file', script_file_path, '--testnet-magic', @protocol_magic).strip - end - - def generate_payment_keys - keys = { - payment_vkey: File.join(@node_state, 'payment.vkey'), - payment_skey: File.join(@node_state, 'payment.skey') - } - cli('address', 'key-gen', - '--verification-key-file', keys[:payment_vkey], - '--signing-key-file', keys[:payment_skey]) - keys - end - - def build_payment_address(keys) - cli('address', 'build', - '--payment-verification-key-file', keys[:payment_vkey], - '--testnet-magic', @protocol_magic).strip - end - - ## - # Returns simplified utxo array for an address. - # Parse cardano-cli query utxo output, like: - # TxHash TxIx Amount - # -------------------------------------------------------------------------------------- - # 4f10e314ca4f71031ae2f801638d1671571bc0fa811bd59520b34d3e68ae5344 0 10000000 lovelace + TxOutDatumNone - # f8e12cf50ebf8b0a3d87869f8ca31ed1a95acc77dcc6007997ea97cb9f5a24cd 0 10000000 lovelace + TxOutDatumNone - # - # into: - # @return [Array] - [{utxo: utxoId, ix: index, amt: ada amount}, ...] - def get_utxos(address) - output = cli('query', 'utxo', - '--address', address, - '--testnet-magic', @protocol_magic) - # [utxo1, utxo2, ... utxoN] - # where utxoN = {utxo: utxoId, ix: index, amt: ada amount} - output.partition('-' * 86).last.strip.split("\n").map do |utxo| - utxo_arr = utxo.split - { utxo: utxo_arr[0], ix: utxo_arr[1], amt: utxo_arr[2] } - end - end - - def get_protocol_params_to_file(file = 'pparams.json') - pparams_path = File.join(@node_state, file) - cli('query', 'protocol-parameters', - '--testnet-magic', @protocol_magic, - '--out-file', pparams_path) - pparams_path - end - - def protocol_params - pparams = cli('query', 'protocol-parameters', - '--testnet-magic', @protocol_magic) - JSON.parse(pparams) - end - - ## - # Build (using trasaction build-raw) an invalid transaction that is - # spending from script address and always fails. Using collateral return option. - def tx_build_raw_always_fails(script_file, - script_utxo, - collateral_utxo, - collateral_utxo_amt, - fee, - target_addr, - collateral_ret_addr) - txbody = File.join(@node_state, 'txbody') - cli('conway', 'transaction', 'build-raw', - '--tx-in', script_utxo, - '--tx-out', "#{target_addr}+#{50_000_000 - fee}", - '--tx-in-script-file', script_file, - '--tx-in-datum-value', 1914, - '--tx-in-redeemer-value', 123, - '--tx-in-collateral', collateral_utxo, - '--tx-in-execution-units', '"(10, 10)"', - '--protocol-params-file', get_protocol_params_to_file, - '--fee', fee, - '--tx-out-return-collateral', "#{collateral_ret_addr}+#{collateral_utxo_amt - (fee * 1.5).to_i}", - '--tx-total-collateral', (fee * 1.5).to_i, - '--script-invalid', - '--out-file', txbody) - txbody - end - - def tx_build(*options) - txbody = File.join(@node_state, 'txbody') - cli('conway', 'transaction', 'build', - '--testnet-magic', @protocol_magic, - '--out-file', txbody, - *options) - txbody - end - - def tx_sign(txbody, keys) - txsigned = File.join(@node_state, 'txsigned') - signing_keys = keys.filter { |k, _| k.to_s.end_with?('_skey') }.map { |_, v| "--signing-key-file #{v}" } - cli('conway', 'transaction', 'sign', - '--tx-body-file', txbody, - '--testnet-magic', @protocol_magic, - signing_keys.join(' '), # --signing-key-file key1 --signing-key-file key2 ... - '--out-file', txsigned) - txsigned - end - - # @return [String] - tx id - def tx_submit(txsigned) - # submit - cli('conway', 'transaction', 'submit', - '--tx-file', txsigned, - '--testnet-magic', @protocol_magic) - - # return tx id - cli('conway', 'transaction', 'txid', - '--tx-file', txsigned).strip - end - - def policy_id(script_file) - cli('conway', 'transaction', 'policyid', - '--script-file', script_file).strip - end -end diff --git a/test/e2e/helpers/context.rb b/test/e2e/helpers/context.rb deleted file mode 100644 index 01504cc8fe5..00000000000 --- a/test/e2e/helpers/context.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -## -# Class for keeping track of wallet ids. WalletFactory keeps track of the context. -# CONTEXT = Context.new -# WalletFactory.create(:shelley, payload) -# CONTEXT.shelley.each do |wid| -# WalletFactory.delete(:shelley, wid) -# end -class Context - attr_accessor :env, :shelley, :shared, :byron - - def initialize - clear! - end - - def clear! - @shelley = [] - @shared = [] - @byron = [] - end -end diff --git a/test/e2e/helpers/matchers.rb b/test/e2e/helpers/matchers.rb deleted file mode 100644 index 207ea628d89..00000000000 --- a/test/e2e/helpers/matchers.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true - -require 'rspec/expectations' - -RSpec::Matchers.define :be_correct_and_respond do |code| - match do |response| - if code == 204 - response.code == code - else - response.code == code && response.headers >= { 'content-type' => ['application/json;charset=utf-8'] } - end - end - failure_message do |response| - method = response.request.http_method.to_s.split('::').last.upcase - uri = response.request.last_uri - body = response.request.options[:body] - headers = response.request.options[:headers] - - " - The response did not return expected HTTP code or header 'content-type: application/json'! - Expected code = #{code} - Actual code = #{response.code} - - Actual request: - #{method} #{uri} - #{"Body: #{body}" if body} - #{"Headers: #{headers}" if headers} - - Actual response: - #{response} - - Actual response headers: - #{response.headers} - - Time: #{Time.now} - " - end -end - -RSpec::Matchers.define :respond_with do |code| - match do |response| - response.code == code - end - failure_message do |response| - method = response.request.http_method.to_s.split('::').last.upcase - uri = response.request.last_uri - body = response.request.options[:body] - headers = response.request.options[:headers] - - " - The response did not return expected HTTP code! - Expected code = #{code} - Actual code = #{response.code} - - Actual request: - #{method} #{uri} - #{"Body: #{body}" if body} - #{"Headers: #{headers}" if headers} - - Actual response: - #{response} - - Actual response headers: - #{response.headers} - - Time: #{Time.now} - " - end -end diff --git a/test/e2e/helpers/tx_history.rb b/test/e2e/helpers/tx_history.rb deleted file mode 100644 index 34996608265..00000000000 --- a/test/e2e/helpers/tx_history.rb +++ /dev/null @@ -1,129 +0,0 @@ -# frozen_string_literal: true - -# helper methods for inspecting tx history from GET/LIST tx or decoded tx -module TxHistory - def tx_amount(tx, amt) - expect(tx['amount']['quantity'].to_i).to eq amt - end - - def tx_fee(tx, fee) - expect(tx['fee']['quantity'].to_i).to eq fee - end - - def tx_inputs(tx, present: true) - if present - expect(tx['inputs']).not_to eq [] - else - expect(tx['inputs']).to eq [] - end - end - - def tx_outputs(tx, present: true) - if present - expect(tx['outputs']).not_to eq [] - else - expect(tx['outputs']).to eq [] - end - end - - def tx_direction(tx, direction) - expect(tx['direction']).to eq direction - end - - def tx_status(tx, status) - expect(tx['status']).to eq status - end - - def tx_script_validity(tx, validity) - expect(tx['script_validity']).to eq validity - end - - def tx_script_integrity(tx, present: true) - if present - expect(tx['script_integrity']).to start_with 'script_data' - else - expect(tx['script_integrity']).to eq nil - end - end - - def tx_extra_signatures(tx, present: true) - if present - tx['extra_signatures'].each do |e| - expect(e).to start_with 'req_signer_vkh' - end - else - expect(tx['extra_signatures']).to eq [] - end - end - - def tx_collateral(tx, present: true) - if present - expect(tx['collateral']).not_to eq [] - else - expect(tx['collateral']).to eq [] - end - end - - def tx_collateral_outputs(tx, present: true) - if present - expect(tx['collateral_outputs']).not_to eq [] - else - expect(tx['collateral_outputs']).to eq [] - end - end - - def tx_metadata(tx, metadata) - expect(tx['metadata']).to eq metadata - end - - def tx_deposits(tx, deposit_taken: taken_amt, deposit_returned: returned_amt) - expect(tx['deposit_taken']).to eq({ 'quantity' => deposit_taken, 'unit' => 'lovelace' }) - expect(tx['deposit_returned']).to eq({ 'quantity' => deposit_returned, 'unit' => 'lovelace' }) - end - - def tx_withdrawals(tx, present: true) - if present - expect(tx['withdrawals']).not_to eq [] - else - expect(tx['withdrawals']).to eq [] - end - end - - def tx_mint_burn(tx, mint: nil, burn: nil) - expect(tx['mint']['tokens']).to eq mint if mint - expect(tx['burn']['tokens']).to eq burn if burn - end - - def tx_has_mint_or_burn(tx, mint: true, burn: true) - if mint - expect(tx['mint']['tokens']).not_to eq [] - else - expect(tx['mint']['tokens']).to eq [] - end - - if burn - expect(tx['burn']['tokens']).not_to eq [] - else - expect(tx['burn']['tokens']).to eq [] - end - end - - def tx_validity_interval(tx, invalid_before: before, invalid_hereafter: hereafter) - expect(tx['validity_interval']['invalid_before']).to eq({ 'quantity' => invalid_before, 'unit' => 'slot' }) - expect(tx['validity_interval']['invalid_hereafter']).to eq({ 'quantity' => invalid_hereafter, 'unit' => 'slot' }) - end - - def tx_validity_interval_default(tx) - expect(tx['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx['validity_interval']['invalid_hereafter']['quantity'].positive?).to be true - end - - def tx_certificates(tx, present: true, certificates: nil) - if present - expect(tx['certificates']).not_to eq [] - expect(tx['certificates']).to eq certificates if certificates - else - expect(tx['certificates']).to eq [] - end - end -end diff --git a/test/e2e/helpers/utils.rb b/test/e2e/helpers/utils.rb deleted file mode 100644 index a4a5af97a9e..00000000000 --- a/test/e2e/helpers/utils.rb +++ /dev/null @@ -1,179 +0,0 @@ -# frozen_string_literal: true - -require 'httparty' -require 'fileutils' - -module Helpers - # general utility methods - module Utils - def log(message) - puts "[#{Time.now}] #{message}" - end - - def cmd(cmd, display_result: false) - cmd.gsub(/\s+/, ' ') - res = `#{cmd}` - log cmd if display_result - log res if display_result - res - end - - ## - # Generate Byron address from mnemonic sentence and derivation path - # $ cat mnemonics \ - # | cardano-address key from-recovery-phrase Byron > root.prv - # - # $ cat root.prv \ - # | cardano-address key child 14H/42H | tee addr.prv \ - # | cardano-address key public --with-chain-code \ - # | cardano-address address bootstrap --root $(cat root.prv | cardano-address key public --with-chain-code) \ - # --network-tag testnet 14H/42H - def cardano_address_get_byron_addr(mnemonics, derivation_path) - root = cmd(%(echo #{mnemonics.join(' ')} | cardano-address key from-recovery-phrase Byron | cardano-address key public --with-chain-code)).gsub( - "\n", '' - ) - cmd(%(echo #{mnemonics.join(' ')} \ - | cardano-address key from-recovery-phrase Byron \ - | cardano-address key child #{derivation_path} \ - | cardano-address key public --with-chain-code \ - | cardano-address address bootstrap \ - --root #{root} \ - --network-tag testnet #{derivation_path} - )).gsub("\n", '') - end - - def cardano_address_get_acc_xpub(mnemonics, derivation_path, wallet_type = 'Shared', - chain_code = '--with-chain-code', hex: false) - cmd(%(echo #{mnemonics.join(' ')} \ - | cardano-address key from-recovery-phrase #{wallet_type} \ - | cardano-address key child #{derivation_path} \ - | cardano-address key public #{chain_code} #{' | bech32' if hex})).gsub("\n", '') - end - - def bech32_to_base16(key) - cmd(%(echo #{key} | bech32)).gsub("\n", '') - end - - def hex_to_bytes(str) - str.scan(/../).map { |x| x.hex.chr }.join - end - - def binary_to_hex(binary_as_string) - format('%02x', binary_as_string.to_i(2)) - end - - ## - # encode string asset_name to hex representation - def asset_name(asset_name) - asset_name.unpack1('H*') - end - - def absolute_path(path) - if path.start_with? '.' - File.join(Dir.pwd, path[1..]) - else - path - end - end - - # Get wallet mnemonics/payment template/delegation template from fixures file - # @param kind [Symbol] :fixture or :target (fixture wallet with funds or target wallet) - # @param wallet_type [Symbol] wallet type = :shelley, :shared, :icarus, :random - # @param info_type [Symbol] wallet type = :mnemonics, :payment_template, :delegation_template - def get_fixture_wallet(kind, wallet_type, info_type = :mnemonics) - fixture = ENV.fetch('TESTS_E2E_FIXTURES_FILE', nil) - raise "File #{fixture} does not exist! (Hint: Template fixture file can be created with 'rake fixture_wallets_template'). Make sure to feed it with mnemonics of wallets with funds and assets." unless File.exist? fixture - - wallets = from_json(fixture) - if linux? - wallets[:linux][kind][wallet_type][info_type] - elsif mac? - wallets[:macos][kind][wallet_type][info_type] - elsif win? - wallets[:windows][kind][wallet_type][info_type] - else - raise 'Unsupported platform!' - end - end - - def from_json(file) - JSON.parse(File.read(file), { symbolize_names: true }) - end - - def wget(url, file = nil) - file ||= File.basename(url) - resp = HTTParty.get(url) - File.binwrite(file, resp.body) - log "#{url} -> #{resp.code}" - end - - def unzip_artifact(target_file, target_dir) - log "Unzipping #{target_file} to #{target_dir}" - if win? - cmd "unzip -o #{target_file} -d #{target_dir}" - cmd "del \\f #{target_file}" - else - cmd "tar -xvf #{target_file}" - cmd "cp -r cardano-wallet-*/* #{target_dir}" - cmd "rm -rf cardano-wallet-*/ #{target_file}" - end - end - - def mk_dir(path) - FileUtils.mkdir_p(path) - end - - def rm_files(path) - FileUtils.rm_rf(path, secure: true) - end - - def mv(src, dst) - FileUtils.mv(src, dst, force: true) - end - - def win? - RUBY_PLATFORM =~ /cygwin|mswin|mingw|bccwin|wince|emx/ - end - - def linux? - RUBY_PLATFORM =~ /linux/ - end - - def mac? - RUBY_PLATFORM =~ /darwin/ - end - - ## - # Latest Cardano configs - def get_latest_configs_base_url(env) - envs = %w[preview preprod].freeze - raise "Env '#{env}' is not supported, supported are: #{envs}" unless envs.include? env - - "https://book.world.dev.cardano.org/environments/#{env}/" - end - - ## - # Get protocol magic from byron-genesis.json corresponding to particular env - def get_protocol_magic(env) - config = File.join(absolute_path(ENV.fetch('CARDANO_NODE_CONFIGS', nil)), env) - byron_genesis = JSON.parse(File.read(File.join(config, 'byron-genesis.json'))) - byron_genesis['protocolConsts']['protocolMagic'].to_i - end - - def base64?(value) - value.is_a?(String) && Base64.strict_encode64(Base64.decode64(value)) == value - end - - def base16?(value) - value.is_a?(String) && value.match?(/^[[:xdigit:]]+$/) - end - end -end - -## -# extend String class with hexdump methods -class String - def cbor_to_hex - bytes.map { |x| format('%02x', x) }.join - end -end diff --git a/test/e2e/helpers/wallet_factory.rb b/test/e2e/helpers/wallet_factory.rb deleted file mode 100644 index 065c61942f1..00000000000 --- a/test/e2e/helpers/wallet_factory.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -## -# Factory helper for creating and deleting wallets and keeping their ids in shared context. -# Assumes CONTEXT, SHELLEY, SHARED, BYRON to be initialized. -class WalletFactory - def self.create(type, payload) - case type - when :shelley - wallet = SHELLEY.wallets.create(payload) - CONTEXT.shelley << wallet['id'] - wallet - when :shared - wallet = SHARED.wallets.create(payload) - CONTEXT.shared << wallet['id'] - wallet - when :byron - wallet = BYRON.wallets.create(payload) - CONTEXT.byron << wallet['id'] - wallet - else - raise "Unsupported wallet type: #{type}." - end - end - - def self.delete(type, wid) - case type - when :shelley - CONTEXT.shelley.delete(wid) - SHELLEY.wallets.delete(wid) - when :shared - CONTEXT.shared.delete(wid) - SHARED.wallets.delete(wid) - when :byron - CONTEXT.byron.delete(wid) - BYRON.wallets.delete(wid) - else - raise "Unsupported wallet type: #{type}." - end - end -end diff --git a/test/e2e/regenerate-nix.sh b/test/e2e/regenerate-nix.sh deleted file mode 100755 index 264e2809a36..00000000000 --- a/test/e2e/regenerate-nix.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -exec nix-shell --run "bundle lock && bundix" diff --git a/test/e2e/run_all_tests.sh b/test/e2e/run_all_tests.sh deleted file mode 100755 index a617e532a90..00000000000 --- a/test/e2e/run_all_tests.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -TESTS_E2E_STATEDIR=./state \ -TESTS_E2E_BINDIR=./bins \ -TESTS_E2E_TOKEN_METADATA=https://metadata.world.dev.cardano.org/ \ -CARDANO_NODE_SOCKET_PATH=./state/node.socket \ -rake stop_node_and_wallet -rake run_on[preprod,sync,skip] diff --git a/test/e2e/spec/byron_spec.rb b/test/e2e/spec/byron_spec.rb deleted file mode 100644 index c8c45572b26..00000000000 --- a/test/e2e/spec/byron_spec.rb +++ /dev/null @@ -1,343 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe CardanoWallet::Byron, :all, :byron do - after(:each) do - teardown - end - - describe CardanoWallet::Byron::Wallets do - it 'I can list byron wallets' do - l = BYRON.wallets.list - expect(l).to be_correct_and_respond 200 - end - - it 'I could get a wallet' do - g = BYRON.wallets.get 'db66f3d0d796c6aa0ad456a36d5a3ee88d62bd5d' - expect(g).to be_correct_and_respond 404 - end - - it 'I could delete a wallet' do - g = BYRON.wallets.delete 'db66f3d0d796c6aa0ad456a36d5a3ee88d62bd5d' - expect(g).to be_correct_and_respond 404 - end - - it 'I can create, get and delete byron icarus wallet from mnemonics' do - payload = { style: 'icarus', - name: 'Wallet from mnemonic_sentence', - passphrase: 'Secure Passphrase', - mnemonic_sentence: CW.utils.mnemonic_sentence(15) } - wallet = WalletFactory.create(:byron, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - expect(BYRON.wallets.get(wid)).to be_correct_and_respond 200 - expect(WalletFactory.delete(:byron, wid)).to be_correct_and_respond 204 - end - - it 'I can create, get and delete byron random wallet from mnemonics' do - payload = { style: 'random', - name: 'Wallet from mnemonic_sentence', - passphrase: 'Secure Passphrase', - mnemonic_sentence: CW.utils.mnemonic_sentence(12) } - wallet = WalletFactory.create(:byron, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - expect(BYRON.wallets.get(wid)).to be_correct_and_respond 200 - expect(WalletFactory.delete(:byron, wid)).to be_correct_and_respond 204 - end - - describe 'Update wallet' do - matrix = %w[random icarus] - matrix.each do |wallet_style| - it "Can update_metadata of #{wallet_style} wallet" do - w = BYRON.wallets - id = create_byron_wallet(wallet_style) - u = w.update_metadata(id, { name: 'New wallet name' }) - expect(u).to be_correct_and_respond 200 - end - - it "Can update_passphrase of #{wallet_style} wallet" do - w = BYRON.wallets - id = create_byron_wallet(wallet_style) - upd = w.update_passphrase(id, { old_passphrase: 'Secure Passphrase', - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 204 - end - - it "Cannot update_passphrase of #{wallet_style} wallet not knowing old pass" do - w = BYRON.wallets - id = create_byron_wallet(wallet_style) - upd = w.update_passphrase(id, { old_passphrase: 'wrong-passphrase', - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 403 - expect(upd.to_s).to include 'wrong_encryption_passphrase' - end - end - end - - it 'Can see utxo' do - id = create_byron_wallet - utxo = BYRON.wallets.utxo(id) - expect(utxo).to be_correct_and_respond 200 - end - - it 'Can see utxo snapshot' do - id = create_byron_wallet - utxo = BYRON.wallets.utxo_snapshot(id) - expect(utxo).to be_correct_and_respond 200 - end - - describe 'Wallet id' do - matrix = [ - %w[Byron random], - %w[Icarus icarus] - ] - matrix.each do |m| - wallet_type = m[0] - wallet_style = m[1] - it "I can get #{wallet_type} #{wallet_style} walletid using cardano-addresses" do - mnemonics = CW.utils.mnemonic_sentence(24) - wid = create_byron_wallet(wallet_style, 'Wallet - ID', mnemonics) - - # based on root prv key - root_xsk = CA.prv_key_from_recovery_phrase(mnemonics, wallet_type) - ca_wid_root_xsk = CA.key_walletid(root_xsk) - expect(wid).to eq ca_wid_root_xsk - - # based on pub key - pub_key = CA.key_public(root_xsk) - ca_wid_pub_key = CA.key_walletid(pub_key) - expect(wid).to eq ca_wid_pub_key - end - - it "#{wallet_type} walletid is not based on acct key" do - mnemonics = CW.utils.mnemonic_sentence(24) - wid = create_byron_wallet(wallet_style, 'Wallet - ID', mnemonics) - - # based on acct prv key - root_xsk = CA.prv_key_from_recovery_phrase(mnemonics, wallet_type) - acct_key = CA.key_child(root_xsk, '1852H/1815H/0H') - ca_wid_acct_key = CA.key_walletid(acct_key) - - # based on pub key from acct prv key - pub_key = CA.key_public(acct_key) - ca_wid_pub_key = CA.key_walletid(pub_key) - - # wallet id from cardano-wallet is not the same - expect(ca_wid_acct_key).to eq ca_wid_pub_key - expect(wid).not_to eq ca_wid_acct_key - end - end - end - end - - describe CardanoWallet::Byron::Addresses do - it 'Can list addresses - random', :adp_2211 do - id = create_byron_wallet - addresses = BYRON.addresses.list id - expect(addresses).to be_correct_and_respond 200 - expect(addresses.size).to eq 0 - - create_addr = BYRON.addresses.create(id, { passphrase: PASS }) - expect(create_addr).to be_correct_and_respond 201 - - addresses = BYRON.addresses.list id - expect(addresses).to be_correct_and_respond 200 - - expect(addresses.size).to eq 1 - expect(addresses.first['id']).to eq create_addr['id'] - expect(addresses.first['derivation_path'][0]).to eq create_addr['derivation_path'].first - expect(addresses.first['derivation_path'][1]).to eq create_addr['derivation_path'].last - end - - it 'Can list addresses - icarus' do - id = create_byron_wallet 'icarus' - addresses_unused = BYRON.addresses.list id, { state: 'unused' } - expect(addresses_unused).to be_correct_and_respond 200 - - expect(addresses_unused.size).to eq 20 - addresses_unused.each_with_index do |a, i| - expect(a['derivation_path']).to eq ['44H', '1815H', '0H', '0', i.to_s] - end - end - - it 'Can list addresses - ledger' do - id = create_byron_wallet 'ledger' - addresses_unused = BYRON.addresses.list id, { state: 'unused' } - expect(addresses_unused).to be_correct_and_respond 200 - - expect(addresses_unused.size).to eq 20 - addresses_unused.each_with_index do |a, i| - expect(a['derivation_path']).to eq ['44H', '1815H', '0H', '0', i.to_s] - end - end - - it 'Can list addresses - trezor' do - id = create_byron_wallet 'trezor' - addresses_unused = BYRON.addresses.list id, { state: 'unused' } - expect(addresses_unused).to be_correct_and_respond 200 - - expect(addresses_unused.size).to eq 20 - addresses_unused.each_with_index do |a, i| - expect(a['derivation_path']).to eq ['44H', '1815H', '0H', '0', i.to_s] - end - end - - it 'Can create address - random' do - id = create_byron_wallet - addr = BYRON.addresses.create(id, { passphrase: PASS, - address_index: 2_147_483_648 }) - expect(addr).to be_correct_and_respond 201 - expect(addr['derivation_path']).to eq %w[0H 0H] - - addr_r = BYRON.addresses.create(id, { passphrase: PASS }) - expect(addr_r).to be_correct_and_respond 201 - expect(addr_r['derivation_path'][0]).to eq '0H' - expect(addr_r['derivation_path'][1]).to end_with 'H' - end - - it 'I can import address - random' do - mnemonics = CW.utils.mnemonic_sentence(15) - derivation_path = '14H/42H' - id = create_byron_wallet('random', 'Wallet - import', mnemonics) - - addr = cardano_address_get_byron_addr(mnemonics, derivation_path) - - addr_import = BYRON.addresses.import(id, addr) - expect(addr_import).to be_correct_and_respond 204 - - addresses = BYRON.addresses.list id - expect(addresses).to be_correct_and_respond 200 - expect(addresses.size).to eq 1 - expect(addresses.first['derivation_path']).to eq derivation_path.split('/') - end - - it 'I cannot import address - icarus' do - id = create_byron_wallet 'icarus' - addr = BYRON.addresses.list(id)[0]['id'] - addr_import = BYRON.addresses.import(id, addr) - expect(addr_import).to be_correct_and_respond 403 - expect(addr_import.to_s).to include 'invalid_wallet_type' - end - - it 'I cannot import address - ledger' do - id = create_byron_wallet 'ledger' - addr = BYRON.addresses.list(id)[0]['id'] - addr_import = BYRON.addresses.import(id, addr) - expect(addr_import).to be_correct_and_respond 403 - expect(addr_import.to_s).to include 'invalid_wallet_type' - end - - it 'I cannot import address - trezor' do - id = create_byron_wallet 'trezor' - addr = BYRON.addresses.list(id)[0]['id'] - addr_import = BYRON.addresses.import(id, addr) - expect(addr_import).to be_correct_and_respond 403 - expect(addr_import.to_s).to include 'invalid_wallet_type' - end - end - - describe CardanoWallet::Byron::CoinSelections do - it 'I could trigger random coin selection - if had money' do - wid = create_byron_wallet 'icarus' - addresses = BYRON.addresses.list(wid) - addr_amount = [ - { addresses[0]['id'] => MIN_UTXO_VALUE_PURE_ADA }, - { addresses[1]['id'] => MIN_UTXO_VALUE_PURE_ADA } - ] - - rnd = BYRON.coin_selections.random wid, addr_amount - - expect(rnd).to be_correct_and_respond 403 - expect(rnd.to_s).to include 'no_utxos_available' - end - end - - describe CardanoWallet::Byron::Transactions do - # Run for random and icarus - %w[random icarus].each do |style| - it "I could get a tx if I had proper id - #{style}" do - wid = create_byron_wallet style - txs = BYRON.transactions - g = txs.get(wid, TXID) - expect(g).to be_correct_and_respond 404 - expect(g.to_s).to include 'no_such_transaction' - end - - it "Can list transactions - #{style}" do - id = create_byron_wallet style - txs = BYRON.transactions - - expect(txs.list(id)).to be_correct_and_respond 200 - expect(txs.list(id, { max_count: 1 })).to be_correct_and_respond 200 - expect(txs.list(id, - { start: '2012-09-25T10:15:00Z', - end: '2016-11-21T10:15:00Z', - order: 'ascending', - max_count: 10 })) - .to be_correct_and_respond 200 - expect(txs.list(id, { order: 'bad_order' })).to be_correct_and_respond 400 - expect(txs.list(id, { max_count: 'bad_count' })).to be_correct_and_respond 400 - end - - it "I could send tx if I had money - #{style}" do - id = create_byron_wallet style - target_id = create_byron_wallet 'icarus' - target_addr = BYRON.addresses.list(target_id)[0]['id'] - - tx_sent = BYRON.transactions.create(id, PASS, [{ target_addr => 1_000_000 }]) - expect(tx_sent).to be_correct_and_respond 403 - expect(tx_sent.to_s).to include 'no_utxos_available' - end - - it "I could estimate fees if I had money - #{style}" do - id = create_byron_wallet style - target_id = create_byron_wallet 'icarus' - target_addr = BYRON.addresses.list(target_id)[0]['id'] - - fees = BYRON.transactions.payment_fees(id, [{ target_addr => 1_000_000 }]) - expect(fees).to be_correct_and_respond 403 - expect(fees.to_s).to include 'no_utxos_available' - end - - it "I could forget transaction - #{style}" do - id = create_byron_wallet style - txs = BYRON.transactions - res = txs.forget(id, TXID) - expect(res).to be_correct_and_respond 404 - end - end - end - - describe CardanoWallet::Byron::Migrations do - it 'I could create migration plan - icarus' do - id = create_byron_wallet 'icarus' - target_id = create_shelley_wallet - addrs = SHELLEY.addresses.list(target_id).map { |a| a['id'] } - - plan = BYRON.migrations.plan(id, addrs) - expect(plan).to be_correct_and_respond 403 - expect(plan.to_s).to include 'nothing_to_migrate' - end - - it 'I could create migration plan - random' do - id = create_byron_wallet 'random' - target_id = create_shelley_wallet - addrs = SHELLEY.addresses.list(target_id).map { |a| a['id'] } - - plan = BYRON.migrations.plan(id, addrs) - expect(plan).to be_correct_and_respond 403 - expect(plan.to_s).to include 'nothing_to_migrate' - end - - it 'I could migrate all my funds' do - id = create_byron_wallet 'random' - target_wal_id = create_byron_wallet 'icarus' - addresses = BYRON.addresses.list(target_wal_id).map { |a| a['id'] } - migr = BYRON.migrations.migrate(id, PASS, addresses) - expect(migr).to be_correct_and_respond 403 - expect(migr.to_s).to include 'nothing_to_migrate' - end - end -end diff --git a/test/e2e/spec/e2e_shared_spec.rb b/test/e2e/spec/e2e_shared_spec.rb deleted file mode 100644 index f7c7fa8cf2e..00000000000 --- a/test/e2e/spec/e2e_shared_spec.rb +++ /dev/null @@ -1,1549 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe 'Cardano Wallet E2E tests - Shared wallets', :all, :e2e, :shared do - before(:all) do - # shelley wallets - @wid = create_fixture_wallet(:shelley) - @target_id = create_target_wallet(:shelley) - - # shared wallets - @wid_sha = create_fixture_wallet(:shared, :payment_cosigner0_all0, :delegation_cosigner0_all0) - @wid_sha_cos0_all = create_fixture_wallet(:shared, :payment_cosigner0_all, :delegation_cosigner0_all) - @wid_sha_cos1_all = create_fixture_wallet(:shared2, :payment_cosigner1_all, :delegation_cosigner1_all) - @wid_sha_cos0_any = create_fixture_wallet(:shared, :payment_cosigner0_any, :delegation_cosigner0_any) - cos0 = shared_acc_pubkey(@wid_sha_cos0_all) - cos1 = shared_acc_pubkey(@wid_sha_cos1_all) - patch_if_incomplete(@wid_sha_cos0_all, { 'cosigner#1' => cos1 }, { 'cosigner#1' => cos1 }) - patch_if_incomplete(@wid_sha_cos1_all, { 'cosigner#0' => cos0 }, { 'cosigner#0' => cos0 }) - patch_if_incomplete(@wid_sha_cos0_any, { 'cosigner#1' => cos1 }, { 'cosigner#1' => cos1 }) - - @nightly_shared_wallets = [@wid_sha, @wid_sha_cos0_all, @wid_sha_cos1_all, @wid_sha_cos0_any] - @nightly_shelley_wallets = [@wid, @target_id] - wait_for_all_shelley_wallets(@nightly_shelley_wallets) - wait_for_all_shared_wallets(@nightly_shared_wallets) - end - - after(:each) do - teardown - end - - after(:all) do - quit_pool = [{ 'quit' => { 'stake_key_index' => '0H' } }] - tx_constructed = SHARED.transactions.construct(@wid_sha, - nil, # payment - nil, # withdrawal - nil, # metadata - quit_pool, - nil, # mint_burn - nil) # validity_interval - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - SHARED.transactions.submit(@wid_sha, tx_signed['transaction']) - end - - describe 'E2E Shared' do - describe 'UTxOs' do - it 'Fixture shared wallets have utxos' do - @nightly_shared_wallets.each do |wid| - utxo_stats = SHARED.wallets.utxo(wid) - expect(utxo_stats).to be_correct_and_respond 200 - - utxo_snap = SHARED.wallets.utxo_snapshot(wid) - expect(utxo_snap).to be_correct_and_respond 200 - expect(utxo_snap['entries'].size).to be > 0 - end - end - end - - describe 'E2E Construct -> Sign -> Submit - multi signers' do - it 'Cannot submit if partially signed - one cosigner, all' do - amt = MIN_UTXO_VALUE_PURE_ADA * 2 - src_wid = @wid_sha_cos0_all - target_wid = @target_id - address = SHELLEY.addresses.list(target_wid)[1]['id'] - - tx_constructed = SHARED.transactions.construct(src_wid, payment_payload(amt, address)) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(src_wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # cosigner0 signs - tx_signed1 = SHARED.transactions.sign(src_wid, PASS, tx_constructed['transaction']) - expect(tx_signed1).to be_correct_and_respond 202 - - # cosigner0 submits - tx_submitted = SHARED.transactions.submit(src_wid, tx_signed1['transaction']) - expect(tx_submitted).to be_correct_and_respond 403 - expect(tx_submitted['code']).to eq 'missing_witnesses_in_transaction' - end - - it 'Cannot submit if tx is foreign - two cosigners, all' do - amt = MIN_UTXO_VALUE_PURE_ADA * 2 - src_wid = @wid_sha_cos0_all - cosigner_wid = @wid_sha_cos1_all - foreign_wid = @wid_sha - target_wid = @target_id - address = SHELLEY.addresses.list(target_wid)[1]['id'] - - tx_constructed = SHARED.transactions.construct(src_wid, payment_payload(amt, address)) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(src_wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # cosigner0 signs - tx_signed1 = SHARED.transactions.sign(src_wid, PASS, tx_constructed['transaction']) - expect(tx_signed1).to be_correct_and_respond 202 - - # cosigner1 signs - tx_signed = SHARED.transactions.sign(cosigner_wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # foreign submits - tx_submitted = SHARED.transactions.submit(foreign_wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 403 - expect(tx_submitted['code']).to eq 'foreign_transaction' - end - - it 'Single output transaction - two cosigners, all' do - amt = MIN_UTXO_VALUE_PURE_ADA * 2 - src_wid = @wid_sha_cos0_all - cosigner_wid = @wid_sha_cos1_all - target_wid = @target_id - address = SHELLEY.addresses.list(target_wid)[1]['id'] - target_before = get_shelley_balances(target_wid) - src_before = get_shared_balances(src_wid) - - tx_constructed = SHARED.transactions.construct(src_wid, payment_payload(amt, address)) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(src_wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # cosigner0 signs - tx_signed1 = SHARED.transactions.sign(src_wid, PASS, tx_constructed['transaction']) - expect(tx_signed1).to be_correct_and_respond 202 - - # cosigner1 signs - tx_signed = SHARED.transactions.sign(cosigner_wid, PASS, tx_signed1['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # cosigner0 submits - tx_submitted = SHARED.transactions.submit(src_wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(src_wid, tx_id, SHARED) - verify_tx_status(src_wid, tx_id, 'in_ledger', SHARED) - - target_after = get_shelley_balances(target_wid) - src_after = get_shared_balances(src_wid) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, expected_fee) - # tx history - # on src wallet - tx = SHARED.transactions.get(src_wid, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on co-signer wid - tx = SHARED.transactions.get(cosigner_wid, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(target_wid, tx_id) - tx_amount(txt, amt) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'Multi output transaction - two cosigners, all' do - amt = MIN_UTXO_VALUE_PURE_ADA - src_wid = @wid_sha_cos0_all - cosigner_wid = @wid_sha_cos1_all - target_wid = @target_id - address = SHELLEY.addresses.list(target_wid)[1]['id'] - target_before = get_shelley_balances(target_wid) - src_before = get_shared_balances(src_wid) - payment = [{ address: address, - amount: { quantity: amt, - unit: 'lovelace' } }, - { address: address, - amount: { quantity: amt, - unit: 'lovelace' } }] - - tx_constructed = SHARED.transactions.construct(src_wid, payment) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(src_wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # cosigner0 signs - tx_signed1 = SHARED.transactions.sign(src_wid, PASS, tx_constructed['transaction']) - expect(tx_signed1).to be_correct_and_respond 202 - - # cosigner1 signs - tx_signed = SHARED.transactions.sign(cosigner_wid, PASS, tx_signed1['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # cosigner1 submits - tx_submitted = SHARED.transactions.submit(cosigner_wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(src_wid, tx_id, SHARED) - verify_tx_status(cosigner_wid, tx_id, 'in_ledger', SHARED) - - target_after = get_shelley_balances(target_wid) - src_after = get_shared_balances(src_wid) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt * 2, expected_fee) - # tx history - # on src wallet - tx = SHARED.transactions.get(src_wid, tx_id) - tx_amount(tx, (amt * 2) + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on co-signer wid - tx = SHARED.transactions.get(cosigner_wid, tx_id) - tx_amount(tx, (amt * 2) + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(target_wid, tx_id) - tx_amount(txt, amt * 2) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'Multi-assets transaction - two cosigners, all' do - # TODO: [ADP-3419] https://cardanofoundation.atlassian.net/browse/ADP-3419 - skip 'wallet has run out of HappyCoin and SadCoin' - amt = 1 - amt_ada = 1_600_000 - src_wid = @wid_sha_cos0_all - cosigner_wid = @wid_sha_cos1_all - target_wid = @target_id - address = SHELLEY.addresses.list(target_wid)[1]['id'] - target_before = get_shelley_balances(target_wid) - src_before = get_shared_balances(src_wid) - payment = [{ 'address' => address, - 'amount' => { 'quantity' => amt_ada, 'unit' => 'lovelace' }, - 'assets' => [{ 'policy_id' => ASSETS[0]['policy_id'], - 'asset_name' => ASSETS[0]['asset_name'], - 'quantity' => amt }, - { 'policy_id' => ASSETS[1]['policy_id'], - 'asset_name' => ASSETS[1]['asset_name'], - 'quantity' => amt }] }] - - tx_constructed = SHARED.transactions.construct(src_wid, payment) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(src_wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # cosigner0 signs - tx_signed1 = SHARED.transactions.sign(src_wid, PASS, tx_constructed['transaction']) - expect(tx_signed1).to be_correct_and_respond 202 - - # cosigner1 signs - tx_signed = SHARED.transactions.sign(cosigner_wid, PASS, tx_signed1['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # cosigner0 submits - tx_submitted = SHARED.transactions.submit(src_wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(src_wid, tx_id, SHARED) - - target_after = get_shelley_balances(target_wid) - src_after = get_shared_balances(src_wid) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt_ada, expected_fee) - # tx history - # on src wallet - tx = SHARED.transactions.get(src_wid, tx_id) - tx_amount(tx, amt_ada + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on co-signer wid - tx = SHARED.transactions.get(cosigner_wid, tx_id) - tx_amount(tx, amt_ada + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(target_wid, tx_id) - tx_amount(txt, amt_ada) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'Validity intervals - two cosigners, all' do - amt = MIN_UTXO_VALUE_PURE_ADA - src_wid = @wid_sha_cos0_all - cosigner_wid = @wid_sha_cos1_all - target_wid = @target_id - address = SHELLEY.addresses.list(target_wid)[1]['id'] - target_before = get_shelley_balances(target_wid) - src_before = get_shared_balances(src_wid) - inv_before = 500 - inv_hereafter = 5_000_000_000 - validity_interval = { 'invalid_before' => { 'quantity' => inv_before, 'unit' => 'slot' }, - 'invalid_hereafter' => { 'quantity' => inv_hereafter, 'unit' => 'slot' } } - tx_constructed = SHARED.transactions.construct(cosigner_wid, - payment_payload(amt, address), - nil, # withdrawal - nil, # metadata - nil, # delegations - nil, # mint_burn - validity_interval) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(src_wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # cosigner0 signs - tx_signed1 = SHARED.transactions.sign(src_wid, PASS, tx_constructed['transaction']) - expect(tx_signed1).to be_correct_and_respond 202 - - # cosigner1 signs - tx_signed = SHARED.transactions.sign(cosigner_wid, PASS, tx_signed1['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # cosigner0 submits - tx_submitted = SHARED.transactions.submit(src_wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(src_wid, tx_id, SHARED) - - target_after = get_shelley_balances(target_wid) - src_after = get_shared_balances(src_wid) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, expected_fee) - # tx history - # on src wallet - tx = SHARED.transactions.get(src_wid, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval(tx, invalid_before: inv_before, invalid_hereafter: inv_hereafter) - tx_certificates(tx, present: false) - - # on co-signer wid - tx = SHARED.transactions.get(cosigner_wid, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval(tx, invalid_before: inv_before, invalid_hereafter: inv_hereafter) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(target_wid, tx_id) - tx_amount(txt, amt) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval(txt, invalid_before: inv_before, invalid_hereafter: inv_hereafter) - tx_certificates(txt, present: false) - end - - it 'Only metadata - two cosigners, all' do - src_wid = @wid_sha_cos0_all - cosigner_wid = @wid_sha_cos1_all - metadata = METADATA - balance = get_shared_balances(src_wid) - - tx_constructed = SHARED.transactions.construct(src_wid, - nil, # payments - nil, # withdrawal - metadata) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(src_wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # cosigner0 signs - tx_signed1 = SHARED.transactions.sign(src_wid, PASS, tx_constructed['transaction']) - expect(tx_signed1).to be_correct_and_respond 202 - - # cosigner1 signs - tx_signed = SHARED.transactions.sign(cosigner_wid, PASS, tx_signed1['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # cosigner0 submits - tx_submitted = SHARED.transactions.submit(src_wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(src_wid, tx_id, SHARED) - - # examine the tx in history - # on src wallet - tx = SHARED.transactions.get(src_wid, tx_id) - tx_amount(tx, expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, metadata) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # verify balance is as expected - new_balance = get_shared_balances(src_wid) - expect(new_balance['available']).to eq(balance['available'] - expected_fee) - expect(new_balance['total']).to eq(balance['total'] - expected_fee) - end - - it 'Single output transaction - one cosigner, any' do - amt = MIN_UTXO_VALUE_PURE_ADA * 2 - src_wid = @wid_sha_cos0_any - target_wid = @target_id - address = SHELLEY.addresses.list(target_wid)[1]['id'] - target_before = get_shelley_balances(target_wid) - src_before = get_shared_balances(src_wid) - - tx_constructed = SHARED.transactions.construct(src_wid, payment_payload(amt, address)) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(src_wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # cosigner0 signs - tx_signed = SHARED.transactions.sign(src_wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # cosigner0 submits - tx_submitted = SHARED.transactions.submit(src_wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(src_wid, tx_id, SHARED) - - target_after = get_shelley_balances(target_wid) - src_after = get_shared_balances(src_wid) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, expected_fee) - # tx history - # on src wallet - tx = SHARED.transactions.get(src_wid, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(target_wid, tx_id) - tx_amount(txt, amt) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - end - describe 'E2E Construct -> Sign -> Submit - single signer' do - it 'I can get min_utxo_value when contructing tx' do - amt = 1 - tx_constructed = SHARED.transactions.construct(@wid_sha, payment_payload(amt)) - expect(tx_constructed.code).to eq 403 - expect(tx_constructed['code']).to eq 'utxo_too_small' - required_minimum = tx_constructed['info']['tx_output_lovelace_required_minimum']['quantity'] - - tx_constructed = SHARED.transactions.construct(@wid_sha, payment_payload(required_minimum)) - expect(tx_constructed).to be_correct_and_respond 202 - end - - it 'Single output transaction' do - amt = MIN_UTXO_VALUE_PURE_ADA * 2 - address = SHELLEY.addresses.list(@target_id)[1]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shared_balances(@wid_sha) - - tx_constructed = SHARED.transactions.construct(@wid_sha, payment_payload(amt, address)) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(@wid_sha, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - tx_submitted = SHARED.transactions.submit(@wid_sha, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid_sha, tx_id, SHARED) - - target_after = get_shelley_balances(@target_id) - src_after = get_shared_balances(@wid_sha) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, expected_fee) - # tx history - # on src wallet - tx = SHARED.transactions.get(@wid_sha, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'Multi output transaction' do - amt = MIN_UTXO_VALUE_PURE_ADA - address = SHELLEY.addresses.list(@target_id)[1]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shared_balances(@wid_sha) - - payment = [{ address: address, - amount: { quantity: amt, - unit: 'lovelace' } }, - { address: address, - amount: { quantity: amt, - unit: 'lovelace' } }] - tx_constructed = SHARED.transactions.construct(@wid_sha, payment) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(@wid_sha, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - tx_submitted = SHARED.transactions.submit(@wid_sha, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid_sha, tx_id, SHARED) - - target_after = get_shelley_balances(@target_id) - src_after = get_shared_balances(@wid_sha) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt * 2, expected_fee) - # tx history - # on src wallet - tx = SHARED.transactions.get(@wid_sha, tx_id) - tx_amount(tx, (amt * 2) + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt * 2) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'Multi-assets transaction' do - amt = 1 - amt_ada = MIN_UTXO_VALUE_PURE_ADA * 2 - address = SHELLEY.addresses.list(@target_id)[1]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shared_balances(@wid_sha) - - payment = [{ 'address' => address, - 'amount' => { 'quantity' => amt_ada, 'unit' => 'lovelace' }, - 'assets' => [{ 'policy_id' => ASSETS[0]['policy_id'], - 'asset_name' => ASSETS[0]['asset_name'], - 'quantity' => amt }, - { 'policy_id' => ASSETS[1]['policy_id'], - 'asset_name' => ASSETS[1]['asset_name'], - 'quantity' => amt }] }] - tx_constructed = SHARED.transactions.construct(@wid_sha, payment) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(@wid_sha, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - tx_submitted = SHARED.transactions.submit(@wid_sha, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid_sha, tx_id, SHARED) - - target_after = get_shelley_balances(@target_id) - src_after = get_shared_balances(@wid_sha) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt_ada, expected_fee) - - verify_asset_balance(src_after, src_before, - target_after, target_before, - amt) - # tx history - # on src wallet - tx = SHARED.transactions.get(@wid_sha, tx_id) - tx_amount(tx, amt_ada + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt_ada) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'Validity intervals' do - amt = MIN_UTXO_VALUE_PURE_ADA - address = SHELLEY.addresses.list(@target_id)[1]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shared_balances(@wid_sha) - inv_before = 500 - inv_hereafter = 5_000_000_000 - validity_interval = { 'invalid_before' => { 'quantity' => inv_before, 'unit' => 'slot' }, - 'invalid_hereafter' => { 'quantity' => inv_hereafter, 'unit' => 'slot' } } - tx_constructed = SHARED.transactions.construct(@wid_sha, - payment_payload(amt, address), - nil, # withdrawal - nil, # metadata - nil, # delegations - nil, # mint_burn - validity_interval) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(@wid_sha, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq validity_interval['invalid_before'] - expect(tx_decoded['validity_interval']['invalid_hereafter']).to eq validity_interval['invalid_hereafter'] - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - tx_submitted = SHARED.transactions.submit(@wid_sha, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid_sha, tx_id, SHARED) - - target_after = get_shelley_balances(@target_id) - src_after = get_shared_balances(@wid_sha) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, expected_fee) - # tx history - # on src wallet - tx = SHARED.transactions.get(@wid_sha, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval(tx, invalid_before: inv_before, invalid_hereafter: inv_hereafter) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval(txt, invalid_before: inv_before, invalid_hereafter: inv_hereafter) - tx_certificates(txt, present: false) - end - - it 'Only metadata' do - metadata = METADATA - balance = get_shared_balances(@wid_sha) - tx_constructed = SHARED.transactions.construct(@wid_sha, - nil, # payments - nil, # withdrawal - metadata) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - # Can be decoded - tx_decoded = SHARED.transactions.decode(@wid_sha, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expect(tx_decoded['id'].size).to be 64 - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq metadata - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - tx_submitted = SHARED.transactions.submit(@wid_sha, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - signed_decoded = SHARED.transactions.decode(@wid_sha, tx_signed['transaction']) - expect(signed_decoded['witness_count']['verification_key']).to be >= 1 - expect(expected_fee).to eq signed_decoded['fee']['quantity'] - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid_sha, tx_id, SHARED) - - # examine the tx in history - # on src wallet - tx = SHARED.transactions.get(@wid_sha, tx_id) - tx_amount(tx, expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, metadata) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # verify balance is as expected - new_balance = get_shared_balances(@wid_sha) - expect(new_balance['available']).to eq(balance['available'] - expected_fee) - expect(new_balance['total']).to eq(balance['total'] - expected_fee) - end - - it 'Delegation (join and quit)' do - balance = get_shared_balances(@wid_sha) - expected_deposit = CARDANO_CLI.protocol_params['stakeAddressDeposit'] - puts "Expected deposit #{expected_deposit}" - - # Check wallet stake keys before joing stake pool - wallet = SHARED.wallets.get(@wid_sha) - expect(wallet['delegation']['active']['status']).to eq 'not_delegating' - - # Pick up pool id to join - pools = SHELLEY.stake_pools - pool_id = pools.list({ stake: 1000 }).sample['id'] - - # Join pool - delegation = [{ - 'join' => { - 'pool' => pool_id, - 'stake_key_index' => '0H' - } - }] - - tx_constructed = SHARED.transactions.construct(@wid_sha, - nil, # payment - nil, # withdrawal - nil, # metadata - delegation, - nil, # mint_burn - nil) # validity_interval - # Check fee and deposit on joining - tx_decoded = SHARED.transactions.decode(@wid_sha, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - deposit_taken = tx_constructed['coin_selection']['deposits_taken'].first['quantity'] - decoded_deposit_taken = tx_decoded['deposits_taken'].first['quantity'] - expect(deposit_taken).to eq decoded_deposit_taken - expect(deposit_taken).to eq expected_deposit - - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(decoded_fee).to eq expected_fee - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - - # Certificates - expect(tx_decoded['certificates']).to include(have_key('certificate_type')).twice - expect(tx_decoded['certificates']).to include(have_value('register_reward_account')).once - expect(tx_decoded['certificates']).to include(have_value('join_pool')).once - expect(tx_decoded['certificates']).to include(have_key('reward_account_path')).twice - expect(tx_decoded['certificates']).to include(have_value(%w[1854H 1815H 0H 2 0])).twice - expect(tx_decoded['certificates']).to include(have_key('pool')).once - expect(tx_decoded['certificates']).to include(have_value(pool_id)).once - - # Sign - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # Submit - tx_submitted = SHARED.transactions.submit(@wid_sha, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid_sha, tx_id, SHARED) - - # Check fee and balance and deposit after joining - tx = SHARED.transactions.get(@wid_sha, tx_id) - tx_amount(tx, expected_deposit + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: deposit_taken, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: true, certificates: tx_decoded['certificates']) - expect(tx['certificates'].to_s).to include 'register_reward_account' - expect(tx['certificates'].to_s).to include 'join_pool' - expect(tx['certificates'].to_s).to include pool_id - - join_balance = get_shared_balances(@wid_sha) - expected_join_balance = balance['total'] - deposit_taken - expected_fee - expect(join_balance['total']).to eq expected_join_balance - - # Quit pool - quit_pool = [{ 'quit' => { 'stake_key_index' => '0H' } }] - tx_constructed = SHARED.transactions.construct(@wid_sha, - nil, # payment - nil, # withdrawal - nil, # metadata - quit_pool, - nil, # mint_burn - nil) # validity_interval - - # Check fee and deposit on quitting - decoded_tx = SHARED.transactions.decode(@wid_sha, tx_constructed['transaction']) - expect(decoded_tx).to be_correct_and_respond 202 - - # Certificates - expect(decoded_tx['certificates']).to include(have_key('certificate_type')).once - expect(decoded_tx['certificates']).to include(have_value('quit_pool')).once - expect(decoded_tx['certificates']).to include(have_key('reward_account_path')).once - expect(decoded_tx['certificates']).to include(have_value(%w[1854H 1815H 0H 2 0])).once - expect(decoded_tx['certificates']).not_to include(have_value('register_reward_account')) - expect(decoded_tx['certificates']).not_to include(have_key('pool')).once - expect(decoded_tx['certificates']).not_to include(have_value(pool_id)).once - - expect(tx_constructed['coin_selection']['deposits_taken']).to eq [] - expect(decoded_tx['deposits_taken']).to eq [] - deposit_returned = tx_constructed['coin_selection']['deposits_returned'].first['quantity'] - decoded_deposit_returned = decoded_tx['deposits_returned'].first['quantity'] - expect(deposit_returned).to eq decoded_deposit_returned - expect(deposit_returned).to eq expected_deposit - - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = decoded_tx['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # Sign - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # Submit - tx_submitted = SHARED.transactions.submit(@wid_sha, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid_sha, tx_id, SHARED) - - # Check fee and balance and deposit after quitting - quit_balance = get_shared_balances(@wid_sha) - tx = SHARED.transactions.get(@wid_sha, tx_id) - expect(tx['amount']['quantity']).to be > 0 - expect(tx['amount']['quantity']).to be < deposit_returned - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'incoming') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: deposit_returned) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: true, certificates: decoded_tx['certificates']) - expect(tx['certificates'].to_s).to include 'quit_pool' - - expected_quit_balance = join_balance['total'] + deposit_returned - expected_fee - expect(quit_balance['total']).to eq expected_quit_balance - end - - describe 'Minting and Burning' do - it 'Can mint and then burn (without submitting)' do - # Minting and Burning not yet implemented, only construct and sign in this tc - # src_before = get_shared_balances(@wid_sha) - policy_script1 = 'cosigner#0' - policy_script2 = { 'all' => ['cosigner#0'] } - policy_script3 = { 'any' => ['cosigner#0'] } - - # Minting: - mint = [mint(asset_name('Token1'), 1000, policy_script1), - mint(asset_name('Token2'), 1000, policy_script2), - mint('', 1000, policy_script3)] - - tx_constructed = SHARED.transactions.construct(@wid_sha, - nil, # payment - nil, # withdrawal - nil, # metadata - nil, # delegation - mint) - expect(tx_constructed).to be_correct_and_respond 202 - - tx_decoded = SHARED.transactions.decode(@wid_sha, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - # TODO: mint / burn currently not decoded - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - - tx_signed = SHARED.transactions.sign(@wid_sha, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - end - end - end - - it 'I can receive transaction to shared wallet' do - amt = 1 - amt_ada = 3_000_000 - address = SHARED.addresses.list(@wid_sha)[1]['id'] - target_before = get_shared_balances(@wid_sha) - src_before = get_shelley_balances(@wid) - - payload = [{ 'address' => address, - 'amount' => { 'quantity' => amt_ada, 'unit' => 'lovelace' }, - 'assets' => [{ 'policy_id' => ASSETS[0]['policy_id'], - 'asset_name' => ASSETS[0]['asset_name'], - 'quantity' => amt }, - { 'policy_id' => ASSETS[1]['policy_id'], - 'asset_name' => ASSETS[1]['asset_name'], - 'quantity' => amt }] }] - - tx_sent = SHELLEY.transactions.create(@wid, PASS, payload) - - expect(tx_sent).to be_correct_and_respond 202 - wait_for_tx_in_ledger(@wid, tx_sent['id']) - - target_after = get_shared_balances(@wid_sha) - src_after = get_shelley_balances(@wid) - fee = SHELLEY.transactions.get(@wid, tx_sent['id'])['fee']['quantity'] - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt_ada, fee) - - verify_asset_balance(src_after, src_before, - target_after, target_before, - amt) - end - - it 'I can list transactions and limit response with query parameters' do - wid = @wid_sha - - # get 3 txs - txs = SHARED.transactions.list(wid, { max_count: 3, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to be 3 - - last_tx_time = txs.first['inserted_at']['time'] - first_tx_time = txs.last['inserted_at']['time'] - - # get 2 txs - txs = SHARED.transactions.list(wid, { max_count: 2, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq last_tx_time - - # get 2 txs in ascending order - txs = SHARED.transactions.list(wid, { max_count: 2, start: first_tx_time, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq first_tx_time - - # get 2 txs in ascending order with start and end time - txs = SHARED.transactions.list(wid, { max_count: 2, start: last_tx_time, end: first_tx_time, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq last_tx_time - end - end - - describe 'E2E Migration' do - it 'I can migrate all funds back to fixture shared wallet' do - address = SHARED.addresses.list(@wid_sha)[0]['id'] - src_before = get_shelley_balances(@target_id) - target_before = get_shared_balances(@wid_sha) - - migration = SHELLEY.migrations.migrate(@target_id, PASS, [address]) - tx_ids = migration.map { |m| m['id'] } - fees = migration.map { |m| m['fee']['quantity'] }.sum - amounts = migration.map { |m| m['amount']['quantity'] }.sum - fees - tx_ids.each do |tx_id| - wait_for_tx_in_ledger(@target_id, tx_id) - end - src_after = get_shelley_balances(@target_id) - target_after = get_shared_balances(@wid_sha) - expected_src_balance = { 'total' => 0, - 'available' => 0, - 'rewards' => 0, - 'assets_total' => [], - 'assets_available' => [] } - - expect(src_after).to eq expected_src_balance - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amounts, fees) - - tx_ids.each do |tx_id| - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@target_id, tx_id) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHARED.transactions.get(@wid_sha, tx_id) - expect(tx['fee']['quantity'].to_i).to be > 0 - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - end - end -end diff --git a/test/e2e/spec/e2e_spec.rb b/test/e2e/spec/e2e_spec.rb deleted file mode 100644 index 83042c49c2e..00000000000 --- a/test/e2e/spec/e2e_spec.rb +++ /dev/null @@ -1,3389 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe 'Cardano Wallet E2E tests', :all, :e2e do - before(:all) do - # shelley wallets - @wid = create_fixture_wallet(:shelley) - @target_id = create_target_wallet(:shelley) - - # byron wallets - @wid_rnd = create_fixture_wallet(:random) - @wid_ic = create_fixture_wallet(:icarus) - - @nightly_byron_wallets = [@wid_rnd, @wid_ic] - @nightly_shelley_wallets = [@wid, @target_id] - wait_for_all_shelley_wallets(@nightly_shelley_wallets) - wait_for_all_byron_wallets(@nightly_byron_wallets) - end - - after(:each) do - teardown - end - - after(:all) do - SHELLEY.stake_pools.quit(@target_id, PASS) - end - - describe 'Regressions' do - it 'ADP-2523 - Make sure there are no null values in the response', :adp_2523 do - pools = SHELLEY.stake_pools - l = pools.list({ stake: 1000 }) - expect(l).to be_correct_and_respond 200 - expect(l.length).to be > 0 - expect(l.to_s).not_to include 'null' - end - end - - describe 'Collateral return', :collateral do - it 'AlwaysFails.plutus with collateral return to the wallet' do - ## - # This test is trying to spend utxo from a script address - # that will always fail. - # Script: https://github.com/IntersectMBO/cardano-node/blob/master/scripts/plutus/scripts/v2/always-fails.plutus - # - # The spending transaction sets: - # - collateral return output to be sent to wallet address - # - aims to spend ADA also to the wallet address - # - # Because the script will fail we expect: - # - collateral return output to be send to the wallet address - # - wallet to show balance correctly - # - wallet to be able to spend this collateral output in the subsequent transaction - # - # We are trying to spend pre-created UTxO from the script address, - # which was created as follows using fixtures/alwaysfails.plutus: - # - # export NETWORK_ID="--testnet-magic 2" - # cardano-cli address build --payment-script-file alwaysfails.plutus $NETWORK_ID > AlwaysFails.addr - # cardano-cli transaction hash-script-data --script-data-value 1914 > datumhash - # cardano-cli transaction build \ - # --babbage-era \ - # $NETWORK_ID \ - # --tx-in "ab08ccdf5c62ad8008d0ac165b68ff714b88de19235a9bd65c731fc264125daf#0" \ - # --tx-out $( collateral_utxo[:utxo], 'index' => collateral_utxo[:ix].to_i }] - collateral_outputs = [{ 'address' => target_address, - 'amount' => { 'quantity' => collateral_ret_amt, 'unit' => 'lovelace' }, - 'assets' => [] }] - expect(tx['collateral']).to eq collateral - expect(tx['collateral_outputs']).to eq collateral_outputs - expect(tx['script_validity']).to eq 'invalid' - - # Make sure balance is correct (+collateral_ret_amt) - target_after = get_shelley_balances(@target_id) - expect(target_after['available']).to eq(target_before['available'] + collateral_ret_amt) - - # Make sure you can spend collateral return output from the wallet - tx = construct_sign_submit(@target_id, payment_payload(6_500_000, payment_address)) - wait_for_tx_in_ledger(@target_id, tx.last['id']) - end - end - - describe 'E2E Balance -> Sign -> Submit' do - def run_script(script, payload) - tx_balanced, tx_signed, tx_submitted = balance_sign_submit(@wid, payload) - tx_id = tx_submitted['id'] - - eventually "#{script} is in ledger" do - tx = SHELLEY.transactions.get(@wid, tx_id) - tx.code == 200 && tx['status'] == 'in_ledger' - end - - { tx_id: tx_id, - tx_unbalanced: SHELLEY.transactions.decode(@wid, payload['transaction']).parsed_response, - tx_balanced: SHELLEY.transactions.decode(@wid, tx_balanced['transaction']).parsed_response, - tx_signed: SHELLEY.transactions.decode(@wid, tx_signed['transaction']).parsed_response } - end - - def run_contract(contract_setup, scripts) - # Contract setup - payload = get_plutus_tx(contract_setup) - r = run_script(contract_setup, payload) - tx_id = r[:tx_id] - - # Run Plutus contract - scripts.each do |s| - payload = get_templated_plutus_tx(s, { transactionId: tx_id }) - r = run_script(s, payload) - tx_id = r[:tx_id] - end - end - - before(:all) do - log 'Making transaction with 10 pure ADA inputs to the wallet to make sure there is collateral' - amt = 10_000_000 - address = SHELLEY.addresses.list(@wid)[0]['id'] - payment = [] - 10.times do - payment << { address: address, amount: { quantity: amt, unit: 'lovelace' } } - end - _, _, tx_submitted = construct_sign_submit(@wid, payment) - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - end - - it 'cannot balance on empty wallet' do - wid = create_shelley_wallet - payload = get_plutus_tx 'ping-pong_1.json' - tx_balanced = SHELLEY.transactions.balance(wid, payload) - expect(tx_balanced).to be_correct_and_respond 403 - expect(tx_balanced.to_s).to include 'no_utxos_available' - end - - it 'ping-pong' do - init_src = get_shelley_balances(@wid) - contract_setup = 'ping-pong_1.json' - script = 'ping-pong_2.json' - - # run contract setup - payload = get_plutus_tx(contract_setup) - r = run_script(contract_setup, payload) - # verify that decoded balanced tx is the same as signed tx (modulo witness_count) - r_balanced = r[:tx_balanced].clone - r_signed = r[:tx_signed].clone - r_balanced.delete('witness_count') - r_signed.delete('witness_count') - expect(r_balanced).to eq r_signed - - # verify witness count - expect(r[:tx_balanced]['witness_count']['verification_key']).to eq 0 - expect(r[:tx_signed]['witness_count']['verification_key']).to be >= 1 - - # verify wallet balance decreases as expected after transaction (by fee + amt) - fee = r[:tx_balanced]['fee']['quantity'] - amt = get_sent_amt(r[:tx_balanced]['outputs']) - src_after = get_shelley_balances(@wid) - expect(src_after['total']).to eq(init_src['total'] - fee - amt) - - # examine tx history - tx1 = SHELLEY.transactions.get(@wid, r[:tx_id]) - tx_inputs(tx1, present: true) - tx_outputs(tx1, present: true) - tx_direction(tx1, 'outgoing') - tx_script_validity(tx1, 'valid') - tx_status(tx1, 'in_ledger') - tx_collateral(tx1, present: false) - tx_collateral_outputs(tx1, present: false) - tx_metadata(tx1, nil) - tx_deposits(tx1, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx1, present: false) - tx_mint_burn(tx1, mint: [], burn: []) - tx_extra_signatures(tx1, present: true) - tx_script_integrity(tx1, present: true) - tx_validity_interval_default(tx1) - tx_certificates(tx1, present: false) - - # run ping-pong_2 - src_before2 = get_shelley_balances(@wid) - payload2 = get_templated_plutus_tx(script, { transactionId: r[:tx_id] }) - r2 = run_script(script, payload2) - - # verify that decoded balanced tx is the same as signed tx (modulo witness_count) - r2_balanced = r2[:tx_balanced].clone - r2_signed = r2[:tx_signed].clone - r2_balanced.delete('witness_count') - r2_signed.delete('witness_count') - expect(r2_balanced).to eq r2_signed - - # verify witness count - expect(r2[:tx_balanced]['witness_count']['verification_key']).to eq 0 - expect(r2[:tx_signed]['witness_count']['verification_key']).to be >= 1 - - fee2 = r2[:tx_balanced]['fee']['quantity'] - - # verify balance decreases as expected after transaction - # ping-pong_2 spends from external utxo, so wallet balance decreases only by fee2 - src_after2 = get_shelley_balances(@wid) - expect(src_after2['total']).to eq(src_before2['total'] - fee2) - - # examine tx history - tx2 = SHELLEY.transactions.get(@wid, r2[:tx_id]) - tx_inputs(tx2, present: true) - tx_outputs(tx2, present: true) - tx_direction(tx2, 'outgoing') - tx_script_validity(tx2, 'valid') - tx_status(tx2, 'in_ledger') - tx_collateral(tx2, present: true) - tx_collateral_outputs(tx2, present: false) - tx_metadata(tx2, nil) - tx_deposits(tx2, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx2, present: false) - tx_mint_burn(tx2, mint: [], burn: []) - tx_extra_signatures(tx2, present: true) - tx_script_integrity(tx2, present: true) - tx_validity_interval_default(tx2) - tx_certificates(tx2, present: false) - end - - it 'game' do - contract_setup = 'game_1.json' - scripts = ['game_2.json', 'game_3.json'] - - run_contract(contract_setup, scripts) - end - - it 'mint-burn' do - vk = SHELLEY.keys.get_public_key(@wid, 'utxo_external', 0, { hash: true }).gsub('"', '') - vk_hash = bech32_to_base16(vk) - policy = read_mustached_file('mintBurn_policy', { vkHash: vk_hash }) - policy_id = get_policy_id(policy) - def fingerprint - if linux? - 'asset1q78ea9ds0rc3tfwu2damsjehjup2xuzddtg6xh' - elsif mac? - 'asset1kjxaamf0p2p2z9g3k4xu0ne0g6h5j70st6z4pz' - elsif win? - 'asset1arj5nz8zxjuxvut5wqt5q0xw7905hllugahvu7' - end - end - - def script_hash - if linux? - 'c22560ac64be051102d6d1cfe5b9b82eb6af4f00dd3806e5cd82e837' - elsif mac? - '87c822cd8fb44f2e3bffc3eaf41c63c2301a0ac2325ee3db634bd435' - elsif win? - 'c8a35944deea4a336faaeb88c35fee23ca88316eb698646e58a9298c' - end - end - mint_script = 'mintBurn_1.json' - burn_script = 'mintBurn_2.json' - assets = [{ 'policy_script' => { 'script_info' => { 'language_version' => 'v1', - 'script_hash' => script_hash }, - 'script_type' => 'plutus' }, - 'policy_id' => policy_id, - 'assets' => [{ 'fingerprint' => fingerprint, - 'quantity' => 1, - 'asset_name' => asset_name('mint-burn') }] }] - - payload_mint = get_templated_plutus_tx(mint_script, { vkHash: vk_hash, - policyId: policy_id, - policy: policy }) - - payload_burn = get_templated_plutus_tx(burn_script, { vkHash: vk_hash, - policyId: policy_id, - policy: policy }) - mint = run_script(mint_script, payload_mint) - burn = run_script(burn_script, payload_burn) - - # verify that decoded balanced tx is the same as signed tx (modulo witness_count) - mint_balanced = mint[:tx_balanced].clone - mint_signed = mint[:tx_signed].clone - mint_balanced.delete('witness_count') - mint_signed.delete('witness_count') - expect(mint_balanced).to eq mint_signed - burn_balanced = burn[:tx_balanced].clone - burn_signed = burn[:tx_signed].clone - burn_balanced.delete('witness_count') - burn_signed.delete('witness_count') - expect(burn_balanced).to eq burn_signed - - # verify witness count - expect(mint[:tx_balanced]['witness_count']['verification_key']).to eq 0 - expect(mint[:tx_signed]['witness_count']['verification_key']).to be >= 1 - expect(burn[:tx_balanced]['witness_count']['verification_key']).to eq 0 - expect(burn[:tx_signed]['witness_count']['verification_key']).to be >= 1 - - # verify decoded unbalanced transaction includes assets minted and burned - expect(mint[:tx_unbalanced]['mint']['tokens']).to eq assets - expect(mint[:tx_unbalanced]['burn']['tokens']).to eq [] - expect(burn[:tx_unbalanced]['mint']['tokens']).to eq [] - expect(burn[:tx_unbalanced]['burn']['tokens']).to eq assets - - # verify decoded balanced transaction includes assets minted and burned - expect(mint[:tx_balanced]['mint']['tokens']).to eq assets - expect(mint[:tx_balanced]['burn']['tokens']).to eq [] - expect(burn[:tx_balanced]['mint']['tokens']).to eq [] - expect(burn[:tx_balanced]['burn']['tokens']).to eq assets - - # examine tx history - mint_tx = SHELLEY.transactions.get(@wid, mint[:tx_id]) - burn_tx = SHELLEY.transactions.get(@wid, burn[:tx_id]) - - tx_inputs(mint_tx, present: true) - tx_outputs(mint_tx, present: true) - tx_direction(mint_tx, 'outgoing') - tx_script_validity(mint_tx, 'valid') - tx_status(mint_tx, 'in_ledger') - tx_collateral(mint_tx, present: true) - tx_collateral_outputs(mint_tx, present: false) - tx_metadata(mint_tx, nil) - tx_deposits(mint_tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(mint_tx, present: false) - tx_mint_burn(mint_tx, mint: assets, burn: []) - tx_extra_signatures(mint_tx, present: true) - tx_script_integrity(mint_tx, present: true) - tx_validity_interval_default(mint_tx) - tx_certificates(mint_tx, present: false) - - tx_inputs(burn_tx, present: true) - tx_outputs(burn_tx, present: true) - tx_direction(burn_tx, 'outgoing') - tx_script_validity(burn_tx, 'valid') - tx_status(burn_tx, 'in_ledger') - tx_collateral(burn_tx, present: true) - tx_collateral_outputs(burn_tx, present: false) - tx_metadata(burn_tx, nil) - tx_deposits(burn_tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(burn_tx, present: false) - tx_mint_burn(burn_tx, mint: [], burn: assets) - tx_extra_signatures(burn_tx, present: true) - tx_script_integrity(burn_tx, present: true) - tx_validity_interval_default(burn_tx) - tx_certificates(burn_tx, present: false) - end - - it 'withdrawal' do - ## - # This test is withdrawing 0 rewards from stake account that has... 0 rewards. - # Such tx is silly but allowed by the node. - # Producing rewards on testnet is not practical due to long epoch length, - # however there is full e2e test version of this script redeemding 42 A rewards on local cluster. - # - # NOTE: - # The script cert had to be registered on-chain such that withdrawing is permitted. - # It was done once, manually: - # - # 1. Create cert from Plutus script: - # - # $ cat fixtures/plutus/withdrawal_validator_cardano_cli.script - # {"cborHex":"590853590850[...]cc0080080041","type":"PlutusScriptV1","description":""} - # $ cardano-cli stake-address registration-certificate --stake-script-file fixtures/plutus/withdrawal_validator_cardano_cli.script --out-file stake.cert - # - # 2. Register cert on-chain - # - # $ cardano-cli query utxo --address $(cat payment.addr) --testnet-magic 2 - # $ cardano-cli transaction build \ - # --babbage-era \ - # --testnet-magic 2 \ - # --change-address "addr_test1qrfqc909vvxfq7903kaz09cuh5q2un8zw7j9ys4uh3k7j3qpgncz6fapajjvkyqka2sldfpk250nml40sf67am68wd2shl9fth" \ - # --tx-in "0c07395aed88bdddc6de0518d1462dd0ec7e52e1e3a53599f7cdb24dc80237f8#0" \ - # --certificate-file stake.cert \ - # --protocol-params-file protocol.json \ - # --out-file body.tx - # - # $ cardano-cli transaction sign \ - # --tx-body-file body.tx \ - # --testnet-magic 2 \ - # --signing-key-file payment.skey \ - # --out-file signed.tx - # - # $ cardano-cli transaction submit --tx-file signed.tx --testnet-magic 2 - validator = read_mustached_file('withdrawal_validator') - validator_hash = get_policy_id(validator) - withdrawal_script = 'withdrawal.json' - payload = get_templated_plutus_tx(withdrawal_script, { script: validator, - scriptHash: validator_hash }) - - init_src = get_shelley_balances(@wid) - - r = run_script(withdrawal_script, payload) - - # verify wallet balance decreases as expected by fee - fee = r[:tx_balanced]['fee']['quantity'] - src_after = get_shelley_balances(@wid) - expect(src_after['total']).to eq(init_src['total'] - fee) - - # examine tx history - tx = SHELLEY.transactions.get(@wid, r[:tx_id]) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: true) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: true) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: true) - tx_script_integrity(tx, present: true) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - end - - it 'currency' do - currency_script = 'currency.json' - currency_policy = 'currency_policy' - - # Perform coin selection to select input to be used in minting contract - address = SHELLEY.addresses.list(@wid)[0]['id'] - payload_cs = [{ address: address, - amount: { quantity: 10_000_000, unit: 'lovelace' } }] - coin_selection = SHELLEY.coin_selections.random(@wid, payload_cs) - print coin_selection if coin_selection['inputs'].nil? - input = coin_selection['inputs'].select { |i| i['assets'] == [] }.first - tx_id = input['id'] - tx_idx = input['index'].to_i - amount = input['amount']['quantity'].to_i - address = input['address'] - - # encode input indexes for contract payload - tx_idx_hex = tx_idx.to_cbor.cbor_to_hex # cbor as hex - encoded_tx_idx = plutus_encode_idx(tx_idx) # special Plutus bit-wise encoding - - # feed payload for contract with data from coin selection - policy = read_mustached_file(currency_policy, { transactionId: tx_id, - encodedTransactionIdx: encoded_tx_idx }) - policy_id = get_policy_id(policy) - payload = get_templated_plutus_tx(currency_script, { policy: policy, - policyId: policy_id, - transactionId: tx_id, - transactionIdx: tx_idx, - transactionIdxHex: tx_idx_hex, - amount: amount, - address: address }) - - # run contract - r = run_script(currency_script, payload) - - # expected minted currency - apfel = { 'policy_id' => policy_id, - 'asset_name' => asset_name('apfel'), - 'quantity' => 1000 } - banana = { 'policy_id' => policy_id, - 'asset_name' => asset_name('banana'), - 'quantity' => 1 } - - # verify decoded transactions show that currency will be minted - expect(r[:tx_unbalanced]['mint']['tokens'].to_s).to include policy_id - expect(r[:tx_unbalanced]['mint']['tokens'].to_s).to include asset_name('apfel') - expect(r[:tx_unbalanced]['mint']['tokens'].to_s).to include asset_name('banana') - expect(r[:tx_balanced]['mint']['tokens'].to_s).to include policy_id - expect(r[:tx_balanced]['mint']['tokens'].to_s).to include asset_name('apfel') - expect(r[:tx_balanced]['mint']['tokens'].to_s).to include asset_name('banana') - - # make sure currency is minted as expected - src_balance = get_shelley_balances(@wid) - expect(src_balance['assets_total']).to include(apfel) - expect(src_balance['assets_total']).to include(banana) - - # examine tx history - tx = SHELLEY.transactions.get(@wid, r[:tx_id]) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: true) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - mint_tokens = tx['mint']['tokens'].to_s - expect(mint_tokens).to include(asset_name('apfel')) - expect(mint_tokens).to include(asset_name('banana')) - expect(mint_tokens).to include(policy_id) - expect(mint_tokens).to include('plutus') - tx_mint_burn(tx, burn: []) - tx_extra_signatures(tx, present: true) - tx_script_integrity(tx, present: true) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # send out minted currency to special address not to litter fixture wallet - payment = [{ address: 'addr_test1qqkgrywfhejgd67twkzqmx84rsr3v374pzujd5rlm0e8exnlxjupjgrqwk5dk9tard6zfwwjq4lc89szs2w599js35tqmaykuj', - amount: { quantity: 0, unit: 'lovelace' }, - assets: [apfel, banana] }] - tx_constructed = SHELLEY.transactions.construct(@wid, payment) - tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction']) - tx_submitted = SHELLEY.transactions.submit(@wid, tx_signed['transaction']) - tx_id = tx_submitted['id'] - - wait_for_tx_in_ledger(@wid, tx_id) - - src_balance_after = get_shelley_balances(@wid) - expect(src_balance_after['assets_total']).not_to include(apfel) - expect(src_balance_after['assets_total']).not_to include(banana) - end - end - - describe 'E2E Construct -> Sign -> Submit' do - it 'I can get min_utxo_value when contructing tx' do - amt = 1 - tx_constructed = SHELLEY.transactions.construct(@wid, payment_payload(amt)) - expect(tx_constructed.code).to eq 403 - expect(tx_constructed['code']).to eq 'utxo_too_small' - required_minimum = tx_constructed['info']['tx_output_lovelace_required_minimum']['quantity'] - - tx_constructed = SHELLEY.transactions.construct(@wid, payment_payload(required_minimum)) - expect(tx_constructed).to be_correct_and_respond 202 - end - - it 'Single output transaction' do - amt = MIN_UTXO_VALUE_PURE_ADA - address = SHELLEY.addresses.list(@target_id)[0]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shelley_balances(@wid) - - tx_constructed = SHELLEY.transactions.construct(@wid, payment_payload(amt, address)) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - expect(tx_decoded['witness_count']['verification_key']).to eq 0 - - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - signed_decoded = SHELLEY.transactions.decode(@wid, tx_signed['transaction']) - expect(signed_decoded['witness_count']['verification_key']).to be >= 1 - expect(expected_fee).to eq signed_decoded['fee']['quantity'] - - tx_submitted = SHELLEY.transactions.submit(@wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - tx_id = tx_submitted['id'] - - wait_for_tx_in_ledger(@wid, tx_id) - - target_after = get_shelley_balances(@target_id) - src_after = get_shelley_balances(@wid) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, expected_fee) - end - - it 'Multi output transaction' do - amt = MIN_UTXO_VALUE_PURE_ADA - address = SHELLEY.addresses.list(@target_id)[0]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shelley_balances(@wid) - - payment = [{ address: address, - amount: { quantity: amt, - unit: 'lovelace' } }, - { address: address, - amount: { quantity: amt, - unit: 'lovelace' } }] - tx_constructed = SHELLEY.transactions.construct(@wid, payment) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - expect(tx_decoded['witness_count']['verification_key']).to eq 0 - - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - signed_decoded = SHELLEY.transactions.decode(@wid, tx_signed['transaction']) - expect(signed_decoded['witness_count']['verification_key']).to be >= 1 - expect(expected_fee).to eq signed_decoded['fee']['quantity'] - - tx_submitted = SHELLEY.transactions.submit(@wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - tx_id = tx_submitted['id'] - - wait_for_tx_in_ledger(@wid, tx_id) - - target_after = get_shelley_balances(@target_id) - src_after = get_shelley_balances(@wid) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, (amt * 2) + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt * 2) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - (amt * 2), expected_fee) - end - - it 'Multi-assets transaction' do - amt = 1 - amt_ada = 1_600_000 - address = SHELLEY.addresses.list(@target_id)[1]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shelley_balances(@wid) - - payment = [{ 'address' => address, - 'amount' => { 'quantity' => amt_ada, 'unit' => 'lovelace' }, - 'assets' => [{ 'policy_id' => ASSETS[0]['policy_id'], - 'asset_name' => ASSETS[0]['asset_name'], - 'quantity' => amt }, - { 'policy_id' => ASSETS[1]['policy_id'], - 'asset_name' => ASSETS[1]['asset_name'], - 'quantity' => amt }] }] - - tx_constructed = SHELLEY.transactions.construct(@wid, payment) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - expect(tx_decoded['witness_count']['verification_key']).to eq 0 - - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - signed_decoded = SHELLEY.transactions.decode(@wid, tx_signed['transaction']) - expect(signed_decoded['witness_count']['verification_key']).to be >= 1 - expect(expected_fee).to eq signed_decoded['fee']['quantity'] - - tx_submitted = SHELLEY.transactions.submit(@wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - tx_id = tx_submitted['id'] - - wait_for_tx_in_ledger(@wid, tx_id) - - target_after = get_shelley_balances(@target_id) - src_after = get_shelley_balances(@wid) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, amt_ada + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt_ada) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt_ada, expected_fee) - - verify_asset_balance(src_after, src_before, - target_after, target_before, - amt) - - # Target wallet lists my associated assets - assets = SHELLEY.assets.get(@target_id) - expect(assets).to be_correct_and_respond 200 - expect(assets.to_s).to include ASSETS[0]['policy_id'] - expect(assets.to_s).to include ASSETS[0]['asset_name'] - expect(assets.to_s).to include ASSETS[1]['policy_id'] - expect(assets.to_s).to include ASSETS[1]['asset_name'] - end - - it 'Only withdrawal' do - balance = get_shelley_balances(@wid) - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - 'self') # withdrawal - expect(tx_constructed).to be_correct_and_respond 202 - # withdrawal = tx_constructed['coin_selection']['withdrawals'].map { |x| x['amount']['quantity'] }.first - # expect(withdrawal).to eq 0 - expected_fee = tx_constructed['fee']['quantity'] - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - expect(tx_decoded['witness_count']['verification_key']).to eq 0 - - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - signed_decoded = SHELLEY.transactions.decode(@wid, tx_signed['transaction']) - expect(signed_decoded['witness_count']['verification_key']).to be >= 1 - expect(expected_fee).to eq signed_decoded['fee']['quantity'] - - tx_submitted = SHELLEY.transactions.submit(@wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - tx_id = tx_submitted['id'] - - wait_for_tx_in_ledger(@wid, tx_id) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) # tx has no withdrawals - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # verify balance is as expected - new_balance = get_shelley_balances(@wid) - expect(new_balance['available']).to eq(balance['available'] - expected_fee) - expect(new_balance['total']).to eq(balance['total'] - expected_fee) - end - - it 'Only metadata' do - metadata = METADATA - balance = get_shelley_balances(@wid) - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - metadata) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq({ 'quantity' => 0, 'unit' => 'slot' }) - expect(tx_decoded['validity_interval']['invalid_hereafter']['quantity']).to be > 0 - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq metadata - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - expect(tx_decoded['witness_count']['verification_key']).to eq 0 - - tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - signed_decoded = SHELLEY.transactions.decode(@wid, tx_signed['transaction']) - expect(signed_decoded['witness_count']['verification_key']).to be >= 1 - expect(expected_fee).to eq signed_decoded['fee']['quantity'] - - tx_submitted = SHELLEY.transactions.submit(@wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - tx_id = tx_submitted['id'] - - wait_for_tx_in_ledger(@wid, tx_id) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, metadata) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # verify balance is as expected - new_balance = get_shelley_balances(@wid) - expect(new_balance['available']).to eq(balance['available'] - expected_fee) - expect(new_balance['total']).to eq(balance['total'] - expected_fee) - end - - it 'Validity intervals' do - amt = MIN_UTXO_VALUE_PURE_ADA - address = SHELLEY.addresses.list(@target_id)[0]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shelley_balances(@wid) - inv_before = 500 - inv_hereafter = 5_000_000_000 - validity_interval = { 'invalid_before' => { 'quantity' => inv_before, 'unit' => 'slot' }, - 'invalid_hereafter' => { 'quantity' => inv_hereafter, 'unit' => 'slot' } } - - tx_constructed = SHELLEY.transactions.construct(@wid, - payment_payload(amt, address), - nil, # withdrawal - nil, # metadata - nil, # delegations - nil, # mint_burn - validity_interval) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - # inputs are ours - expect(tx_decoded['inputs'].to_s).to include 'address' - expect(tx_decoded['inputs'].to_s).to include 'amount' - expect(tx_decoded['outputs']).not_to eq [] - expect(tx_decoded['script_validity']).to eq 'valid' - expect(tx_decoded['validity_interval']['invalid_before']).to eq validity_interval['invalid_before'] - expect(tx_decoded['validity_interval']['invalid_hereafter']).to eq validity_interval['invalid_hereafter'] - expect(tx_decoded['collateral']).to eq [] - expect(tx_decoded['collateral_outputs']).to eq [] - expect(tx_decoded['metadata']).to eq nil - expect(tx_decoded['deposits_taken']).to eq [] - expect(tx_decoded['deposits_returned']).to eq [] - expect(tx_decoded['withdrawals']).to eq [] - expect(tx_decoded['mint']).to eq({ 'tokens' => [] }) - expect(tx_decoded['burn']).to eq({ 'tokens' => [] }) - expect(tx_decoded['certificates']).to eq [] - expect(tx_decoded['witness_count']['verification_key']).to eq 0 - - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - signed_decoded = SHELLEY.transactions.decode(@wid, tx_signed['transaction']) - expect(signed_decoded['witness_count']['verification_key']).to be >= 1 - expect(expected_fee).to eq signed_decoded['fee']['quantity'] - - tx_submitted = SHELLEY.transactions.submit(@wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - tx_id = tx_submitted['id'] - - wait_for_tx_in_ledger(@wid, tx_id) - - target_after = get_shelley_balances(@target_id) - src_after = get_shelley_balances(@wid) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, amt + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval(tx, invalid_before: inv_before, invalid_hereafter: inv_hereafter) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt) - tx_fee(tx, expected_fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval(txt, invalid_before: inv_before, invalid_hereafter: inv_hereafter) - tx_certificates(txt, present: false) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, expected_fee) - end - - it 'Delegation (join and quit)' do - skip 'ADP-3243' - balance = get_shelley_balances(@target_id) - expected_deposit = CARDANO_CLI.protocol_params['stakeAddressDeposit'] - puts "Expected deposit #{expected_deposit}" - # Check wallet stake keys before joing stake pool - stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id) - expect(stake_keys).to be_correct_and_respond 200 - expect(stake_keys['foreign'].size).to eq 0 - expect(stake_keys['ours'].size).to eq 1 - expect(stake_keys['ours'].first['stake']['quantity']).to eq balance['total'] - expect(stake_keys['none']['stake']['quantity']).to eq 0 - expect(stake_keys['ours'].first['delegation']['active']['status']).to eq 'not_delegating' - - # Pick up pool id to join - pools = SHELLEY.stake_pools - pool_id = pools.list({ stake: 1000 }).sample['id'] - - # Join pool - delegation = [{ - 'join' => { - 'pool' => pool_id, - 'stake_key_index' => '0H' - } - }] - tx_constructed, tx_signed, tx_submitted = construct_sign_submit(@target_id, - nil, # payments - nil, # withdrawal - nil, # metadata - delegation) - # Check fee and deposit on joining - decoded_tx = SHELLEY.transactions.decode(@target_id, tx_constructed['transaction']) - deposit_taken = tx_constructed['coin_selection']['deposits_taken'].first['quantity'] - decoded_deposit_taken = decoded_tx['deposits_taken'].first['quantity'] - expect(deposit_taken).to eq decoded_deposit_taken - expect(deposit_taken).to eq expected_deposit - expect(decoded_tx['deposits_returned']).to eq [] - - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = decoded_tx['fee']['quantity'] - expect(decoded_fee).to eq expected_fee - - # witness count - expect(decoded_tx['witness_count']['verification_key']).to eq 0 - signed_tx = SHELLEY.transactions.decode(@target_id, tx_signed['transaction']) - expect(signed_tx['witness_count']['verification_key']).to be >= 1 - - # Certificates - expect(decoded_tx['certificates']).to include(have_key('certificate_type')).twice - expect(decoded_tx['certificates']).to include(have_value('register_reward_account')).once - expect(decoded_tx['certificates']).to include(have_value('join_pool')).once - expect(decoded_tx['certificates']).to include(have_key('reward_account_path')).twice - expect(decoded_tx['certificates']).to include(have_value(%w[1852H 1815H 0H 2 0])).twice - expect(decoded_tx['certificates']).to include(have_key('pool')).once - expect(decoded_tx['certificates']).to include(have_value(pool_id)).once - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@target_id, tx_id) - - # Check fee and balance and deposit after joining - tx = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(tx, expected_deposit + expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: deposit_taken, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: true, certificates: decoded_tx['certificates']) - expect(tx['certificates'].to_s).to include 'register_reward_account' - expect(tx['certificates'].to_s).to include 'join_pool' - expect(tx['certificates'].to_s).to include pool_id - - join_balance = get_shelley_balances(@target_id) - expected_join_balance = balance['total'] - deposit_taken - expected_fee - expect(join_balance['total']).to eq expected_join_balance - - # Check wallet stake keys after joing stake pool - stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id) - expect(stake_keys).to be_correct_and_respond 200 - expect(stake_keys['foreign'].size).to eq 0 - expect(stake_keys['ours'].size).to eq 1 - expect(stake_keys['ours'].first['stake']['quantity']).to eq expected_join_balance - expect(stake_keys['none']['stake']['quantity']).to eq 0 - expect(stake_keys['ours'].first['delegation']['active']['status']).to eq 'not_delegating' - expect(stake_keys['ours'].first['delegation']['next'].last['status']).to eq 'delegating' - - # Quit pool - quit_pool = [{ 'quit' => { 'stake_key_index' => '0H' } }] - tx_constructed, tx_signed, tx_submitted = construct_sign_submit(@target_id, - nil, # payments - nil, # withdrawal - nil, # metadata - quit_pool) - - # Check fee and deposit on quitting - decoded_tx = SHELLEY.transactions.decode(@target_id, tx_constructed['transaction']) - expect(decoded_tx).to be_correct_and_respond 202 - - # witness count - expect(decoded_tx['witness_count']['verification_key']).to eq 0 - signed_tx = SHELLEY.transactions.decode(@target_id, tx_signed['transaction']) - expect(signed_tx['witness_count']['verification_key']).to be >= 1 - - # Certificates - expect(decoded_tx['certificates']).to include(have_key('certificate_type')).once - expect(decoded_tx['certificates']).to include(have_value('quit_pool')).once - expect(decoded_tx['certificates']).to include(have_key('reward_account_path')).once - expect(decoded_tx['certificates']).to include(have_value(%w[1852H 1815H 0H 2 0])).once - expect(decoded_tx['certificates']).not_to include(have_value('register_reward_account')) - expect(decoded_tx['certificates']).not_to include(have_key('pool')).once - expect(decoded_tx['certificates']).not_to include(have_value(pool_id)).once - - expect(tx_constructed['coin_selection']['deposits_taken']).to eq [] - expect(decoded_tx['deposits_taken']).to eq [] - deposit_returned = tx_constructed['coin_selection']['deposits_returned'].first['quantity'] - decoded_deposit_returned = decoded_tx['deposits_returned'].first['quantity'] - expect(deposit_returned).to eq decoded_deposit_returned - expect(deposit_returned).to eq expected_deposit - - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = decoded_tx['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@target_id, tx_id) - - # Check fee and balance and deposit after quitting - quit_balance = get_shelley_balances(@target_id) - tx = SHELLEY.transactions.get(@target_id, tx_id) - expect(tx['amount']['quantity']).to be > 0 - expect(tx['amount']['quantity']).to be < deposit_returned - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'incoming') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(tx, deposit_taken: 0, deposit_returned: deposit_returned) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: true, certificates: decoded_tx['certificates']) - expect(tx['certificates'].to_s).to include 'quit_pool' - - expected_quit_balance = join_balance['total'] + deposit_returned - expected_fee - expect(quit_balance['total']).to eq expected_quit_balance - - # Check wallet stake keys after quitting - stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id) - expect(stake_keys).to be_correct_and_respond 200 - expect(stake_keys['foreign'].size).to eq 0 - expect(stake_keys['ours'].size).to eq 1 - # deposit is back on quitting so stake is higher than before - expect(stake_keys['ours'].first['stake']['quantity']).to eq expected_quit_balance - expect(stake_keys['none']['stake']['quantity']).to eq 0 - expect(stake_keys['ours'].first['delegation']['active']['status']).to eq 'not_delegating' - expect(stake_keys['ours'].first['delegation']['next'].last['status']).to eq 'not_delegating' - end - - describe 'Minting and Burning' do - ## - # Tx1: Mints 3 x 1000 assets, each guarded by different policy script - # Tx2: Burns 3 x 500 of each and verifies 500 of each remain on wallet - # Tx3: Burns remaining 3 x 500 and verifies they're no longer on balance - it 'Can mint and then burn' do - src_before = get_shelley_balances(@wid) - address = SHELLEY.addresses.list(@wid).first['id'] - policy_script1 = 'cosigner#0' - policy_script2 = { 'all' => ['cosigner#0'] } - policy_script3 = { 'any' => ['cosigner#0'] } - # Get policy_ids: - policy_id1 = SHELLEY.keys.create_policy_id(@wid, policy_script1)['policy_id'] - policy_id2 = SHELLEY.keys.create_policy_id(@wid, policy_script2)['policy_id'] - policy_id3 = SHELLEY.keys.create_policy_id(@wid, policy_script3)['policy_id'] - # Get policy key hash - policy_vkh = SHELLEY.keys.get_policy_key(@wid, { hash: true }).gsub('"', '') - - # Minting: - mint = [mint(asset_name('Token1'), 1000, policy_script1, address), - mint(asset_name('Token2'), 1000, policy_script2), - mint('', 1000, policy_script3)] - create_policy_key_if_not_exists(@wid) - tx_constructed, tx_signed, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # witness count - expect(tx_decoded['witness_count']['verification_key']).to eq 0 - signed_tx = SHELLEY.transactions.decode(@wid, tx_signed['transaction']) - expect(signed_tx['witness_count']['verification_key']).to be >= 1 - - # Mint - expect(tx_decoded['mint']['tokens']).to include(have_key('assets')).exactly(3).times - expect(tx_decoded['mint']['tokens'].to_s).to include(policy_vkh).exactly(3).times - expect(tx_decoded['mint']['tokens'].to_s).to include('1000').exactly(3).times - expect(tx_decoded['mint']['tokens'].to_s).to include(policy_id1).once - expect(tx_decoded['mint']['tokens'].to_s).to include(policy_id2).once - expect(tx_decoded['mint']['tokens'].to_s).to include(policy_id3).once - expect(tx_decoded['mint']['tokens'].to_s).to include(asset_name('Token1')).once - expect(tx_decoded['mint']['tokens'].to_s).to include(asset_name('Token2')).once - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - expect(tx['mint']).to eq tx_decoded['mint'] - tx_mint_burn(tx, mint: tx_decoded['mint']['tokens'], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # verify ADA balance is correct (fee is deducted) - src_after_minting = get_shelley_balances(@wid) - expect(src_after_minting['available']).to eq(src_before['available'] - expected_fee) - expect(src_after_minting['total']).to eq(src_before['total'] - expected_fee) - - # verify assets have been minted and on wallet's balance - assets_to_check = get_assets_from_decode(tx_decoded['mint']) - assets = assets_balance(src_after_minting['assets_total'], { assets_to_check: assets_to_check }) - expect(assets).to eq(assets_to_check.to_set { |z| { z => 1000 } }) - - # Burn half: - burn = [burn(asset_name('Token1'), 500, policy_script1), - burn(asset_name('Token2'), 500, policy_script2), - burn('', 500, policy_script3)] - tx_constructed, tx_signed, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # witness count - expect(tx_decoded['witness_count']['verification_key']).to eq 0 - signed_tx = SHELLEY.transactions.decode(@target_id, tx_signed['transaction']) - expect(signed_tx['witness_count']['verification_key']).to be >= 1 - - # Burn - expect(tx_decoded['burn']['tokens']).to include(have_key('assets')).exactly(3).times - expect(tx_decoded['burn']['tokens'].to_s).to include(policy_vkh).exactly(3).times - expect(tx_decoded['burn']['tokens'].to_s).to include('500').exactly(3).times - expect(tx_decoded['burn']['tokens'].to_s).to include(policy_id1).once - expect(tx_decoded['burn']['tokens'].to_s).to include(policy_id2).once - expect(tx_decoded['burn']['tokens'].to_s).to include(policy_id3).once - expect(tx_decoded['burn']['tokens'].to_s).to include(asset_name('Token1')).once - expect(tx_decoded['burn']['tokens'].to_s).to include(asset_name('Token2')).once - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - # examine the burn tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - expect(tx['burn']).to eq tx_decoded['burn'] - tx_mint_burn(tx, mint: [], burn: tx_decoded['burn']['tokens']) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # verify ADA balance is correct (fee is deducted) - src_after_burning = get_shelley_balances(@wid) - expect(src_after_burning['available']).to eq(src_after_minting['available'] - expected_fee) - expect(src_after_burning['total']).to eq(src_after_minting['total'] - expected_fee) - - # verify half of assets have ben burned - assets = assets_balance(src_after_burning['assets_total'], - { assets_to_check: assets_to_check }) - expect(assets).to eq(assets_to_check.to_set { |z| { z => 500 } }) - - # Burn all the rest: - burn = [burn(asset_name('Token1'), 500, policy_script1), - burn(asset_name('Token2'), 500, policy_script2), - burn(nil, 500, policy_script3)] - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - # Burn again - expect(tx_decoded['burn']['tokens']).to include(have_key('assets')).exactly(3).times - expect(tx_decoded['burn']['tokens'].to_s).to include(policy_vkh).exactly(3).times - expect(tx_decoded['burn']['tokens'].to_s).to include('500').exactly(3).times - expect(tx_decoded['burn']['tokens'].to_s).to include(policy_id1).once - expect(tx_decoded['burn']['tokens'].to_s).to include(policy_id2).once - expect(tx_decoded['burn']['tokens'].to_s).to include(policy_id3).once - expect(tx_decoded['burn']['tokens'].to_s).to include(asset_name('Token1')).once - expect(tx_decoded['burn']['tokens'].to_s).to include(asset_name('Token2')).once - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_burning_all = get_shelley_balances(@wid) - # examine the burn again tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - tx_amount(tx, expected_fee) - tx_fee(tx, expected_fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - expect(tx['burn']).to eq tx_decoded['burn'] - tx_mint_burn(tx, mint: [], burn: tx_decoded['burn']['tokens']) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # verify ADA balance is correct (fee is deducted) - expect(src_after_burning_all['available']).to eq(src_after_burning['available'] - expected_fee) - expect(src_after_burning_all['total']).to eq(src_after_burning['total'] - expected_fee) - - # verify all assets have been burned and no longer on wallet's balance - assets = assets_balance(src_after_burning_all['assets_total'], - { assets_to_check: assets_to_check }) - expect(assets).to eq({}.to_set) - end - - ## - # Tx1: Mints 3 x 1 assets with metadata - # Tx2: Burns 3 x 1 assets and also assign metadata to tx - it 'Can mint and burn with metadata' do - src_before = get_shelley_balances(@wid) - address = SHELLEY.addresses.list(@wid).first['id'] - policy_script1 = 'cosigner#0' - policy_script2 = 'cosigner#0' - policy_script3 = { 'any' => ['cosigner#0'] } - metadata = METADATA - assets_quantity = 1 - - # Minting: - mint = [mint(asset_name('TokenMetadata1'), assets_quantity, policy_script1, address), - mint(asset_name('TokenMetadata2'), assets_quantity, policy_script2), - mint(asset_name('TokenMetadata3'), assets_quantity, policy_script3)] - create_policy_key_if_not_exists(@wid) - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - metadata, - nil, # delegations - mint) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_minting = get_shelley_balances(@wid) - - # verify tx has metadata - tx = SHELLEY.transactions.get(@wid, tx_id) - expect(tx['metadata']).to eq metadata - - # verify ADA balance is correct (fee is deducted) - expect(src_after_minting['available']).to eq(src_before['available'] - expected_fee) - expect(src_after_minting['total']).to eq(src_before['total'] - expected_fee) - - # verify assets have been minted and on wallet's balance - assets_to_check = get_assets_from_decode(tx_decoded['mint']) - assets = assets_balance(src_after_minting['assets_total'], { assets_to_check: assets_to_check }) - expect(assets).to eq(assets_to_check.to_set { |z| { z => assets_quantity } }) - - # Burn all: - burn = [burn(asset_name('TokenMetadata1'), assets_quantity, policy_script1), - burn(asset_name('TokenMetadata2'), assets_quantity, policy_script2), - burn(asset_name('TokenMetadata3'), assets_quantity, policy_script3)] - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - metadata, - nil, # delegations - burn) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_burning = get_shelley_balances(@wid) - - # verify tx has metadata - tx = SHELLEY.transactions.get(@wid, tx_id) - expect(tx['metadata']).to eq metadata - - # verify ADA balance is correct (fee is deducted) - expect(src_after_burning['available']).to eq(src_after_minting['available'] - expected_fee) - expect(src_after_burning['total']).to eq(src_after_minting['total'] - expected_fee) - - # verify all assets have been burned and no longer on wallet's balance - assets = assets_balance(src_after_burning['assets_total'], - { assets_to_check: assets_to_check }) - expect(assets).to eq({}.to_set) - end - - ## - # Mint NFT with CIP-25 metadata - it 'Can mint NFT attaching CIP-25 metadata' do - src_before = get_shelley_balances(@wid) - address = SHELLEY.addresses.list(@wid).first['id'] - policy_script = 'cosigner#0' - assets_quantity = 1 - nft_name = 'MyAmazingNFT' - nft_name_hex = asset_name(nft_name) - mint = [mint(nft_name_hex, assets_quantity, policy_script, address)] - - create_policy_key_if_not_exists(@wid) - - # Get policy_id: - policy_id = SHELLEY.keys.create_policy_id(@wid, policy_script)['policy_id'] - - # Build CIP-25 metadata - cip25_metadata = { '721' => { - policy_id.to_s => { - nft_name.to_s => { - 'name' => "NFT FTW: #{nft_name}", - 'image' => 'ipfs://XXXXYYYYZZZZ' - } - } - } } - - # Minting: - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - cip25_metadata, - nil, # delegations - mint) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_minting = get_shelley_balances(@wid) - - # verify tx has metadata - tx = SHELLEY.transactions.get(@wid, tx_id, 'simple-metadata' => true) - expect(tx['metadata']).to eq cip25_metadata - - # verify ADA balance is correct (fee is deducted) - expect(src_after_minting['available']).to eq(src_before['available'] - expected_fee) - expect(src_after_minting['total']).to eq(src_before['total'] - expected_fee) - - # verify assets have been minted and on wallet's balance - assets_to_check = get_assets_from_decode(tx_decoded['mint']) - assets = assets_balance(src_after_minting['assets_total'], { assets_to_check: assets_to_check }) - expect(assets).to eq(assets_to_check.to_set { |z| { z => assets_quantity } }) - - # Burn: - burn = [burn(nft_name_hex, assets_quantity, policy_script)] - - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_burning = get_shelley_balances(@wid) - - # verify ADA balance is correct (fee is deducted) - expect(src_after_burning['available']).to eq(src_after_minting['available'] - expected_fee) - expect(src_after_burning['total']).to eq(src_after_minting['total'] - expected_fee) - - # verify all assets have been burned and no longer on wallet's balance - assets = assets_balance(src_after_burning['assets_total'], - { assets_to_check: assets_to_check }) - expect(assets).to eq({}.to_set) - end - - ## - # Tx1: Mints 2 x 500 assets, each guarded by different policy script => A1 = 500, A2 = 500 - # Tx2: Mints 500 more of A1 and burns 500 of A2 => A1 = 1000, A2 = 0 - # Tx3: Burns remaining 1000 of A1 => A1 = 0, A2 = 0 - it 'Can mint and burn in the same tx' do - src_before = get_shelley_balances(@wid) - address = SHELLEY.addresses.list(@wid).first['id'] - policy_script1 = { 'some' => { 'at_least' => 1, 'from' => ['cosigner#0'] } } - policy_script2 = { 'any' => ['cosigner#0'] } - - # Minting: - mint = [mint(asset_name('Asset1'), 500, policy_script1, address), - mint(asset_name('Asset2'), 500, policy_script2)] - - create_policy_key_if_not_exists(@wid) - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_minting = get_shelley_balances(@wid) - - # verify ADA balance is correct (fee is deducted) - expect(src_after_minting['available']).to eq(src_before['available'] - expected_fee) - expect(src_after_minting['total']).to eq(src_before['total'] - expected_fee) - - # verify assets have been minted and on wallet's balance - assets_to_check = get_assets_from_decode(tx_decoded['mint']) - assets = assets_balance(src_after_minting['assets_total'], { assets_to_check: assets_to_check }) - expect(assets).to eq(assets_to_check.to_set { |z| { z => 500 } }) - - # Minting and burning: - mint_burn = [mint(asset_name('Asset1'), 500, policy_script1), - burn(asset_name('Asset2'), 500, policy_script2)] - - # p JSON.parse(mint_burn.to_json) - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint_burn) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_minting_burning = get_shelley_balances(@wid) - - # verify ADA balance is correct (fee is deducted) - expect(src_after_minting_burning['available']).to eq(src_after_minting['available'] - expected_fee) - expect(src_after_minting_burning['total']).to eq(src_after_minting['total'] - expected_fee) - - # verify Asset1 has been minted and Asset2 burned - assets_minted_to_check = get_assets_from_decode(tx_decoded['mint']) - assets_burned_to_check = get_assets_from_decode(tx_decoded['burn']) - assets_minted = assets_balance(src_after_minting_burning['assets_total'], - { assets_to_check: assets_minted_to_check }) - assets_burned = assets_balance(src_after_minting_burning['assets_total'], - { assets_to_check: assets_burned_to_check }) - - expect(assets_minted).to eq(assets_minted_to_check.to_set { |z| { z => 1000 } }) - expect(assets_burned).to eq({}.to_set) - - # Burn all the rest: - burn = [burn(asset_name('Asset1'), 1000, policy_script1)] - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_burning = get_shelley_balances(@wid) - - # verify ADA balance is correct (fee is deducted) - expect(src_after_burning['available']).to eq(src_after_minting_burning['available'] - expected_fee) - expect(src_after_burning['total']).to eq(src_after_minting_burning['total'] - expected_fee) - - # verify Asset1 has been burned - assets_burned_to_check = get_assets_from_decode(tx_decoded['burn']) - assets_burned = assets_balance(src_after_burning['assets_total'], - { assets_to_check: assets_burned_to_check }) - expect(assets_burned).to eq({}.to_set) - end - - ## - # Tx1: Mints 10 asset => has 10 - # Tx2: Burns 10 and mints 1 of the same asset => has 1 - # Tx3: Burns 1 remaining assets => has 0 - it 'Can mint and burn the same asset in single tx' do - src_before = get_shelley_balances(@wid) - address = SHELLEY.addresses.list(@wid).first['id'] - policy_script = 'cosigner#0' - assets_name = asset_name('MintBurnX') - - # Minting 10 MintBurn: - mint = [mint(assets_name, 10, policy_script, address)] - - create_policy_key_if_not_exists(@wid) - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_minting = get_shelley_balances(@wid) - - # verify ADA balance is correct (fee is deducted) - expect(src_after_minting['available']).to eq(src_before['available'] - expected_fee) - expect(src_after_minting['total']).to eq(src_before['total'] - expected_fee) - - # verify assets have been minted and on wallet's balance - assets_to_check = get_assets_from_decode(tx_decoded['mint']) - assets = assets_balance(src_after_minting['assets_total'], { assets_to_check: assets_to_check }) - expect(assets).to eq(assets_to_check.to_set { |z| { z => 10 } }) - - # Burning 10 MintBurn and minting 1 MintBurn: - mint_burn = [burn(assets_name, 10, policy_script), - mint(assets_name, 1, policy_script, address)] - - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint_burn) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_minting_burning = get_shelley_balances(@wid) - - # verify ADA balance is correct (fee is deducted) - expect(src_after_minting_burning['available']).to eq(src_after_minting['available'] - expected_fee) - expect(src_after_minting_burning['total']).to eq(src_after_minting['total'] - expected_fee) - - # verify MintBurn has 1 (because 10 was burned and 1 additional minted) - assets_minted_to_check = get_assets_from_decode(tx_decoded['mint']) - assets_minted = assets_balance(src_after_minting_burning['assets_total'], - { assets_to_check: assets_minted_to_check }) - - expect(assets_minted).to eq(assets_minted_to_check.to_set { |z| { z => 1 } }) - - # Burn all the rest: - burn = [burn(assets_name, 1, policy_script)] - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_burning = get_shelley_balances(@wid) - - # verify ADA balance is correct (fee is deducted) - expect(src_after_burning['available']).to eq(src_after_minting_burning['available'] - expected_fee) - expect(src_after_burning['total']).to eq(src_after_minting_burning['total'] - expected_fee) - - # verify all is burned - assets_burned_to_check = get_assets_from_decode(tx_decoded['burn']) - assets_burned = assets_balance(src_after_burning['assets_total'], - { assets_to_check: assets_burned_to_check }) - expect(assets_burned).to eq({}.to_set) - end - - ## - # Tx1: Fail to burn asset that's not on the wallet - it "Cannot burn if I don't have it" do - policy_script = 'cosigner#0' - burn = [burn(asset_name('AmazingNFTIdontHave'), 1, policy_script)] - create_policy_key_if_not_exists(@wid) - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - expect(tx_constructed).to be_correct_and_respond 403 - expect(tx_constructed['code'].to_s).to eq 'not_enough_money' - shortfall = tx_constructed['info']['shortfall']['assets'][0] - expect(shortfall['asset_name']).to eq asset_name('AmazingNFTIdontHave') - expect(shortfall['quantity']).to eq 1 - end - - ## - # Tx1: Mints 1000 assets - # Tx2: Fails to burn 1000 assets using different policy_script - # Tx2: Fails to burn 1022 assets using correct policy_script - # Tx3: Burns remaining 1000 assets - it 'Cannot burn with wrong policy_script or more than I have' do - address = SHELLEY.addresses.list(@wid).first['id'] - policy_script = 'cosigner#0' - - # Mint it: - mint = [mint(asset_name('MintIt'), 1000, policy_script, address)] - create_policy_key_if_not_exists(@wid) - _, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - - # Try to burn: - # - with different policy_script - burn1 = [burn(asset_name('MintIt'), 1000, { 'all' => ['cosigner#0'] })] - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn1) - - expect(tx_constructed).to be_correct_and_respond 403 - expect(tx_constructed['code'].to_s).to eq 'not_enough_money' - shortfall = tx_constructed['info']['shortfall']['assets'][0] - expect(shortfall['asset_name']).to eq asset_name('MintIt') - expect(shortfall['quantity']).to eq 1000 - - # - correct policy_script but too much - burn2 = [burn(asset_name('MintIt'), 1022, policy_script)] - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn2) - - expect(tx_constructed).to be_correct_and_respond 403 - expect(tx_constructed['code'].to_s).to eq 'not_enough_money' - shortfall = tx_constructed['info']['shortfall']['assets'][0] - expect(shortfall['asset_name']).to eq asset_name('MintIt') - expect(shortfall['quantity']).to eq 22 - - # Burn it: - burn3 = [burn(asset_name('MintIt'), 1000, policy_script)] - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn3) - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - src_after_burning = get_shelley_balances(@wid) - - # verify MintIt has been burned - assets_burned_to_check = get_assets_from_decode(tx_decoded['burn']) - assets_burned = assets_balance(src_after_burning['assets_total'], - { assets_to_check: assets_burned_to_check }) - expect(assets_burned).to eq({}.to_set) - end - - ## - # Tx1: Mints 1500 assets to different wallet - # Tx2: Fails to burn 1500 assets on different wallet - # Tx3: Sends assets back to src wallet - # Tx4: Burns them - it "Mint to foreign wallet / Cannot burn if I don't have keys" do - address = SHELLEY.addresses.list(@target_id).first['id'] - policy_script = 'cosigner#0' - assets_quantity = 1500 - assets_name = asset_name('ToForeignWallet') - - # Mint it: - mint = [mint(assets_name, assets_quantity, policy_script, address)] - create_policy_key_if_not_exists(@wid) - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - target_after_minting = get_shelley_balances(@target_id) - - # verify assets have been minted and on target wallet's balance - assets_to_check = get_assets_from_decode(tx_decoded['mint']) - assets = assets_balance(target_after_minting['assets_total'], { assets_to_check: assets_to_check }) - expect(assets).to eq(assets_to_check.to_set { |z| { z => assets_quantity } }) - - # Try to burn on target wallet and fail: - create_policy_key_if_not_exists(@target_id) - burn = [burn(assets_name, assets_quantity, policy_script)] - tx_constructed = SHELLEY.transactions.construct(@target_id, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - expect(tx_constructed).to be_correct_and_respond 403 - expect(tx_constructed['code'].to_s).to eq 'not_enough_money' - shortfall = tx_constructed['info']['shortfall']['assets'][0] - expect(shortfall['asset_name']).to eq assets_name - expect(shortfall['quantity']).to eq assets_quantity - - # Send them back to src wallet: - src_address = SHELLEY.addresses.list(@wid).first['id'] - policy_id = get_policy_id_from_decode(tx_decoded['mint']) - # Make sure decoded policy id correct - expect(policy_id).to eq SHELLEY.keys.create_policy_id(@wid, policy_script)['policy_id'] - payment = [{ 'address' => src_address, - 'amount' => { 'quantity' => 0, 'unit' => 'lovelace' }, - 'assets' => [{ 'policy_id' => policy_id, - 'asset_name' => assets_name, - 'quantity' => assets_quantity }] }] - - _, _, tx_submitted = construct_sign_submit(@target_id, payment) - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@target_id, tx_id) - src_after_sending = get_shelley_balances(@wid) - assets = assets_balance(src_after_sending['assets_total'], { assets_to_check: assets_to_check }) - expect(assets).to eq(assets_to_check.to_set { |z| { z => assets_quantity } }) - - # Burn them on src wallet: - burn = [burn(assets_name, assets_quantity, policy_script)] - tx_constructed, _, tx_submitted = construct_sign_submit(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - - # make sure it was burned - src_after_burning = get_shelley_balances(@wid) - assets_to_check = get_assets_from_decode(tx_decoded['burn']) - assets = assets_balance(src_after_burning['assets_total'], { assets_to_check: assets_to_check }) - expect(assets).to eq({}.to_set) - end - - ## - # Make sure minting above boundary quantity values returns proper error - describe 'Mint/Burn quantities' do - matrix = [ - [-9_223_372_036_854_775_808, 400, 'bad_request'], - [-1, 400, 'bad_request'], - [0, 403, 'mint_or_burn_asset_quantity_out_of_bounds'], - [9_223_372_036_854_775_808, 403, 'mint_or_burn_asset_quantity_out_of_bounds'] - ] - matrix.each do |m| - quantity = m[0] - code = m[1] - message = m[2] - it "Cannot mint #{quantity} assets" do - policy_script = 'cosigner#0' - assets_name = asset_name('AmazingNFTIdontHave') - assets_quantity = quantity - address = SHELLEY.addresses.list(@wid).first['id'] - mint = [mint(assets_name, assets_quantity, policy_script, address)] - create_policy_key_if_not_exists(@wid) - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - expect(tx_constructed).to be_correct_and_respond code - expect(tx_constructed['code'].to_s).to eq message - end - - it "Cannot burn #{quantity} assets" do - policy_script = 'cosigner#0' - assets_name = asset_name('AmazingNFTIdontHave') - assets_quantity = quantity - burn = [burn(assets_name, assets_quantity, policy_script)] - create_policy_key_if_not_exists(@wid) - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - burn) - expect(tx_constructed).to be_correct_and_respond code - expect(tx_constructed['code'].to_s).to eq message - end - end - end - - ## - # Make sure minting above boundary asset_name values returns proper error - describe 'Mint/Burn asset_name' do - matrix = [ - ['too long', '1' * 66, 403, 'asset_name_too_long'], - ['invalid hex', '1', 400, 'bad_request'] - ] - matrix.each do |m| - test = m[0] - assets_name = m[1] - code = m[2] - message = m[3] - it "Cannot mint if my asset name is #{test}" do - address = SHELLEY.addresses.list(@wid).first['id'] - policy_script = 'cosigner#0' - assets_quantity = 1500 - mint = [mint(assets_name, assets_quantity, policy_script, address)] - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - - expect(tx_constructed).to be_correct_and_respond code - expect(tx_constructed['code']).to eq message - end - end - end - - ## - # Test against some invalid policy script examples - describe 'Mint/Burn invalid policy script' do - matrix = [ - ['cosigner#1', 403, 'created_wrong_policy_script_template'], - [{ 'all' => ['cosigner#0', 'cosigner#1'] }, 403, 'created_wrong_policy_script_template'], - [{ 'any' => ['cosigner#0', 'cosigner#0'] }, 403, 'created_wrong_policy_script_template'], - [{ 'some' => { 'at_least' => 2, 'from' => ['cosigner#0'] } }, 403, 'created_wrong_policy_script_template'], - [{ 'some' => ['cosigner#0'] }, 400, 'bad_request'] - ] - - matrix.each do |m| - policy_script = m[0] - code = m[1] - message = m[2] - it "Cannot mint if my policy script is invalid: #{policy_script}" do - address = SHELLEY.addresses.list(@wid).first['id'] - assets_name = asset_name('WillNotMintIt') - assets_quantity = 1500 - mint = [mint(assets_name, assets_quantity, policy_script, address)] - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - - expect(tx_constructed).to be_correct_and_respond code - expect(tx_constructed['code']).to eq message - end - end - end - - it 'Cannot mint if I make too big transaction' do - address = SHELLEY.addresses.list(@wid).first['id'] - policy_script = 'cosigner#0' - assets_quantity = 1500 - - mint = [] - 1000.times do |i| - mint << mint(asset_name("TooBIG#{i}"), assets_quantity, policy_script, address) - end - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - nil, # metadata - nil, # delegations - mint) - - expect(tx_constructed).to be_correct_and_respond 403 - expect(tx_constructed['code']).to eq 'output_token_bundle_size_exceeds_limit' - end - end - - describe 'Output encoding' do - # Check construct and sign output has desired encoding as per - # encoding parameter - matrix = %w[base16 base64] - matrix.each do |o_enc| - it o_enc do - tx_constructed = SHELLEY.transactions.construct(@wid, - nil, # payments - nil, # withdrawal - METADATA, - nil, # delegations - nil, # mint - nil, # validity_interval - o_enc) # encoding - expect(tx_constructed).to be_correct_and_respond 202 - expect(method("#{o_enc}?").call(tx_constructed['transaction'])).to be true - - tx_signed = SHELLEY.transactions.sign(@wid, PASS, - tx_constructed['transaction'], - o_enc) - expect(tx_signed).to be_correct_and_respond 202 - expect(method("#{o_enc}?").call(tx_signed['transaction'])).to be true - end - end - end - end - - describe 'E2E Shelley' do - describe 'UTxOs' do - it 'Fixture shelley wallet has utxos' do - utxo_stats = SHELLEY.wallets.utxo(@wid) - expect(utxo_stats).to be_correct_and_respond 200 - - utxo_snap = SHELLEY.wallets.utxo_snapshot(@wid) - expect(utxo_snap).to be_correct_and_respond 200 - expect(utxo_snap['entries'].size).to be > 0 - end - end - - describe 'Native Assets' do - it 'I can list native assets' do - assets = SHELLEY.assets.get @wid - expect(assets).to be_correct_and_respond 200 - expect(assets.to_s).to include ASSETS[0]['policy_id'] - expect(assets.to_s).to include ASSETS[0]['asset_name'] - expect(assets.to_s).to include ASSETS[1]['policy_id'] - expect(assets.to_s).to include ASSETS[1]['asset_name'] - - assets = SHELLEY.assets.get(@wid, ASSETS[0]['policy_id']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[0]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[0]['asset_name'] - expect(assets['asset_name']).not_to eq ASSETS[1]['asset_name'] - - assets = SHELLEY.assets.get(@wid, ASSETS[1]['policy_id'], - ASSETS[1]['asset_name']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[1]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[1]['asset_name'] - expect(assets['asset_name']).not_to eq ASSETS[0]['asset_name'] - end - - it 'I can list native assets and get offchain metadata', :offchain do - assets = SHELLEY.assets.get @wid - expect(assets).to be_correct_and_respond 200 - expect(assets.to_s).to include ASSETS[0]['policy_id'] - expect(assets.to_s).to include ASSETS[0]['asset_name'] - expect(assets.to_s).to include ASSETS[0]['metadata']['name'] - expect(assets.to_s).to include ASSETS[1]['policy_id'] - expect(assets.to_s).to include ASSETS[1]['asset_name'] - expect(assets.to_s).to include ASSETS[1]['metadata']['name'] - - assets = SHELLEY.assets.get(@wid, ASSETS[0]['policy_id']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[0]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[0]['asset_name'] - expect(assets['metadata']).to eq ASSETS[0]['metadata'] - expect(assets['asset_name']).not_to eq ASSETS[1]['asset_name'] - expect(assets['metadata']).not_to eq ASSETS[1]['metadata'] - - assets = SHELLEY.assets.get(@wid, ASSETS[1]['policy_id'], - ASSETS[1]['asset_name']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[1]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[1]['asset_name'] - expect(assets['metadata']).to eq ASSETS[1]['metadata'] - expect(assets['asset_name']).not_to eq ASSETS[0]['asset_name'] - expect(assets['metadata']).not_to eq ASSETS[0]['metadata']['name'] - end - - it 'I can send native assets tx and they are received' do - amt = 1 - address = SHELLEY.addresses.list(@target_id)[1]['id'] - target_before = get_shelley_balances(@target_id) - - payload = [{ 'address' => address, - 'amount' => { 'quantity' => 0, 'unit' => 'lovelace' }, - 'assets' => [{ 'policy_id' => ASSETS[0]['policy_id'], - 'asset_name' => ASSETS[0]['asset_name'], - 'quantity' => amt }, - { 'policy_id' => ASSETS[1]['policy_id'], - 'asset_name' => ASSETS[1]['asset_name'], - 'quantity' => amt }] }] - - tx_sent = SHELLEY.transactions.create(@wid, PASS, payload) - - expect(tx_sent).to be_correct_and_respond 202 - wait_for_tx_in_ledger(@wid, tx_sent['id']) - verify_tx_status(@wid, tx_sent['id'], 'in_ledger') - - target_after = get_shelley_balances(@target_id) - - # verify balances are correct on target wallet - assets_to_check = ["#{ASSETS[0]['policy_id']}#{ASSETS[0]['asset_name']}", - "#{ASSETS[1]['policy_id']}#{ASSETS[1]['asset_name']}"] - target_total_after = assets_balance(target_after['assets_total'], { assets_to_check: assets_to_check }) - target_avail_after = assets_balance(target_after['assets_available'], { assets_to_check: assets_to_check }) - target_total_expected = assets_balance(target_before['assets_total'], { assets_to_check: assets_to_check, delta: +amt }) - target_avail_expected = assets_balance(target_before['assets_available'], { assets_to_check: assets_to_check, delta: +amt }) - if target_before['assets_total'] == [] - target_balance_expected = assets_to_check.to_set { |a| { a => amt } } - expect(target_total_after).to eq target_balance_expected - expect(target_avail_after).to eq target_balance_expected - else - expect(target_total_after).to eq target_total_expected - expect(target_avail_after).to eq target_avail_expected - end - end - end - - describe 'Shelley Migrations' do - it 'I can create migration plan shelley -> shelley' do - addrs = SHELLEY.addresses.list(@target_id).map { |a| a['id'] } - - plan = SHELLEY.migrations.plan(@wid, addrs) - expect(plan).to be_correct_and_respond 202 - expect(plan['balance_selected']['assets']).not_to be [] - expect(plan['balance_leftover']).to eq({ 'ada' => { 'quantity' => 0, - 'unit' => 'lovelace' }, - 'assets' => [] }) - end - end - - describe 'Shelley Transactions' do - it 'I can send transaction and funds are received (min_utxo_value)' do - address = SHELLEY.addresses.list(@target_id)[0]['id'] - available_before = SHELLEY.wallets.get(@target_id)['balance']['available']['quantity'] - total_before = SHELLEY.wallets.get(@target_id)['balance']['total']['quantity'] - - # get required minimum ada - tx = SHELLEY.transactions.create(@wid, PASS, payment_payload(1, address)) - expect(tx.code).to eq 403 - expect(tx['code']).to eq 'utxo_too_small' - amt = tx['info']['tx_output_lovelace_required_minimum']['quantity'] - - tx_sent = SHELLEY.transactions.create(@wid, PASS, payment_payload(amt, address)) - - expect(tx_sent).to be_correct_and_respond 202 - tx_id = tx_sent['id'] - wait_for_tx_in_ledger(@wid, tx_id) - verify_tx_status(@wid, tx_id, 'in_ledger') - - eventually "Funds are on target wallet: #{@target_id}" do - available = SHELLEY.wallets.get(@target_id)['balance']['available']['quantity'] - total = SHELLEY.wallets.get(@target_id)['balance']['total']['quantity'] - (available == amt + available_before) && (total == amt + total_before) - end - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - expect(tx['amount']['quantity']).to be > amt - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt) - # in old tx workflow, only expecting fee to be present because fee calculation is not reliable enough for strong assertions - expect(tx['fee']['quantity'].to_i).to be > 0 - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'I can send transaction with ttl and funds are received' do - amt = MIN_UTXO_VALUE_PURE_ADA - ttl_in_s = 1200 - - address = SHELLEY.addresses.list(@target_id)[0]['id'] - target_before = get_shelley_balances(@target_id) - tx_sent = SHELLEY.transactions.create(@wid, - PASS, - [{ address => amt }], - nil, # withdrawal - nil, # metadata - ttl_in_s) - - expect(tx_sent).to be_correct_and_respond 202 - tx_id = tx_sent['id'] - wait_for_tx_in_ledger(@wid, tx_id) - verify_tx_status(@wid, tx_id, 'in_ledger') - - target_after = get_shelley_balances(@target_id) - - expect(target_after['available']).to eq(amt + target_before['available']) - expect(target_after['total']).to eq(amt + target_before['total']) - expect(target_after['reward']).to eq(target_before['reward']) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - expect(tx['amount']['quantity']).to be > amt - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt) - expect(tx['fee']['quantity'].to_i).to be > 0 - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'Transaction with ttl = 0 would expire and I can forget it' do - skip 'Test is flaky due to ADP-608' - amt = MIN_UTXO_VALUE_PURE_ADA - ttl_in_s = 0 - - address = SHELLEY.addresses.list(@target_id)[0]['id'] - tx_sent = SHELLEY.transactions.create(@wid, - PASS, - [{ address => amt }], - nil, # withdrawal - nil, # metadata - ttl_in_s) - - expect(tx_sent).to be_correct_and_respond 202 - - eventually "TX `#{tx_sent['id']}' expires on `#{@wid}'" do - SHELLEY.transactions.get(@wid, tx_sent['id'])['status'] == 'expired' - end - - res = SHELLEY.transactions.forget(@wid, tx_sent['id']) - expect(res).to be_correct_and_respond 204 - - fres = SHELLEY.transactions.get(@wid, tx_sent['id']) - expect(fres).to be_correct_and_respond 404 - end - - it "I can send transaction using 'withdrawal' flag and funds are received" do - amt = MIN_UTXO_VALUE_PURE_ADA - address = SHELLEY.addresses.list(@target_id)[0]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shelley_balances(@wid) - - tx_sent = SHELLEY.transactions.create(@wid, PASS, [{ address => amt }], 'self') - - expect(tx_sent).to be_correct_and_respond 202 - tx_id = tx_sent['id'] - wait_for_tx_in_ledger(@wid, tx_id) - verify_tx_status(@wid, tx_id, 'in_ledger') - - fee = SHELLEY.transactions.get(@wid, tx_id)['fee']['quantity'] - target_after = get_shelley_balances(@target_id) - src_after = get_shelley_balances(@wid) - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, fee) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - expect(tx['amount']['quantity']).to be > amt - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt) - expect(tx['fee']['quantity'].to_i).to be > 0 - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'I can send transaction with metadata' do - amt = MIN_UTXO_VALUE_PURE_ADA - metadata = METADATA - - address = SHELLEY.addresses.list(@target_id)[0]['id'] - target_before = get_shelley_balances(@target_id) - - tx_sent = SHELLEY.transactions.create(@wid, - PASS, - [{ address => amt }], - nil, - metadata) - - expect(tx_sent).to be_correct_and_respond 202 - tx_id = tx_sent['id'] - wait_for_tx_in_ledger(@wid, tx_id) - verify_tx_status(@wid, tx_id, 'in_ledger') - - target_after = get_shelley_balances(@target_id) - - expect(target_after['available']).to eq(amt + target_before['available']) - expect(target_after['total']).to eq(amt + target_before['total']) - expect(target_after['reward']).to eq(target_before['reward']) - - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@wid, tx_id) - expect(tx['amount']['quantity']).to be > amt - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, metadata) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@target_id, tx_id) - tx_amount(txt, amt) - expect(tx['fee']['quantity'].to_i).to be > 0 - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, metadata) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - it 'I can estimate fee (min_utxo_value)' do - metadata = METADATA - txs = SHELLEY.transactions - # get required minimum ada - fees = txs.payment_fees(@wid, payment_payload(1)) - expect(fees.code).to eq 403 - expect(fees['code']).to eq 'utxo_too_small' - amt = fees['info']['tx_output_lovelace_required_minimum']['quantity'] - - fees = txs.payment_fees(@wid, payment_payload(amt)) - expect(fees).to be_correct_and_respond 202 - - fees = txs.payment_fees(@wid, payment_payload(amt), 'self') - expect(fees).to be_correct_and_respond 202 - - fees = txs.payment_fees(@wid, payment_payload(amt), 'self', metadata) - expect(fees).to be_correct_and_respond 202 - end - - it 'I can list transactions and limit response with query parameters' do - wid = @wid - - # get 3 txs - txs = SHELLEY.transactions.list(wid, { max_count: 3, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to be 3 - - last_tx_time = txs.first['inserted_at']['time'] - first_tx_time = txs.last['inserted_at']['time'] - - # get 2 txs - txs = SHELLEY.transactions.list(wid, { max_count: 2, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq last_tx_time - - # get 2 txs in ascending order - txs = SHELLEY.transactions.list(wid, { max_count: 2, start: first_tx_time, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq first_tx_time - - # get 2 txs in ascending order with start and end time - txs = SHELLEY.transactions.list(wid, { max_count: 2, start: last_tx_time, end: first_tx_time, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq last_tx_time - end - end - - describe 'Stake Pools' do - it "I could join Stake Pool - if I knew it's id" do - pools = SHELLEY.stake_pools - - join = pools.join(SPID, @wid, PASS) - expect(join).to be_correct_and_respond 404 - expect(join.to_s).to include 'no_such_pool' - end - - it 'I could check delegation fees - if I could cover fee' do - id = create_shelley_wallet - - pools = SHELLEY.stake_pools - fees = pools.delegation_fees(id) - expect(fees).to be_correct_and_respond 403 - expect(fees.to_s).to include 'no_utxos_available' - end - - it 'Can list stake pools only when stake is provided' do - pools = SHELLEY.stake_pools - l = pools.list({ stake: 1000 }) - l_bad = pools.list - expect(l).to be_correct_and_respond 200 - - expect(l_bad).to be_correct_and_respond 400 - expect(l_bad.to_s).to include 'query_param_missing' - end - - it 'Can join and quit Stake Pool' do - skip 'ADP-3243' - # Get funds on the wallet - address = SHELLEY.addresses.list(@target_id)[0]['id'] - amt = 10_000_000 - deposit = CARDANO_CLI.protocol_params['stakeAddressDeposit'] - tx_sent = SHELLEY.transactions.create(@wid, - PASS, - [{ address => amt }]) - - expect(tx_sent).to be_correct_and_respond 202 - wait_for_tx_in_ledger(@wid, tx_sent['id']) - verify_tx_status(@wid, tx_sent['id'], 'in_ledger') - - stake = get_shelley_balances(@target_id)['total'] - - # Check wallet stake keys before joing stake pool - stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id) - expect(stake_keys).to be_correct_and_respond 200 - expect(stake_keys['foreign'].size).to eq 0 - expect(stake_keys['ours'].size).to eq 1 - expect(stake_keys['ours'].first['stake']['quantity']).to eq stake - expect(stake_keys['none']['stake']['quantity']).to eq 0 - expect(stake_keys['ours'].first['delegation']['active']['status']).to eq 'not_delegating' - # expect(stake_keys['ours'].first['delegation']['next']).to eq [] - - # Pick up pool id to join - pools = SHELLEY.stake_pools - pool_id = pools.list({ stake: 1000 }).sample['id'] - - # Join pool - puts "Joining pool: #{pool_id}" - join = pools.join(pool_id, @target_id, PASS) - - expect(join).to be_correct_and_respond 202 - expect(join.to_s).to include 'status' - - join_tx_id = join['id'] - eventually "Checking if join tx id (#{join_tx_id}) is in_ledger" do - tx = SHELLEY.transactions.get(@target_id, join_tx_id) - tx['status'] == 'in_ledger' - end - tx = SHELLEY.transactions.get(@target_id, join_tx_id) - fee = tx['fee']['quantity'] - - stake_after_joining = stake - deposit - fee - - # Check wallet stake keys after joing stake pool - stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id) - expect(stake_keys).to be_correct_and_respond 200 - expect(stake_keys['foreign'].size).to eq 0 - expect(stake_keys['ours'].size).to eq 1 - expect(stake_keys['ours'].first['stake']['quantity']).to eq stake_after_joining - expect(stake_keys['none']['stake']['quantity']).to eq 0 - expect(stake_keys['ours'].first['delegation']['active']['status']).to eq 'not_delegating' - expect(stake_keys['ours'].first['delegation']['next'].last['status']).to eq 'delegating' - - # examine the tx in history - tx_amount(tx, fee + deposit) - tx_fee(tx, fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: deposit, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: true) - expect(tx['certificates'].to_s).to include 'register_reward_account' - expect(tx['certificates'].to_s).to include 'join_pool' - expect(tx['certificates'].to_s).to include pool_id - - # Quit pool - puts "Quitting pool: #{pool_id}" - quit = pools.quit(@target_id, PASS) - - expect(quit).to be_correct_and_respond 202 - expect(quit.to_s).to include 'status' - - quit_tx_id = quit['id'] - eventually "Checking if quit tx id (#{quit_tx_id}) is in_ledger" do - tx = SHELLEY.transactions.get(@target_id, quit_tx_id) - tx['status'] == 'in_ledger' - end - total_balance_after = get_shelley_balances(@target_id)['total'] - - # Check wallet stake keys after quitting stake pool - stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id) - expect(stake_keys).to be_correct_and_respond 200 - expect(stake_keys['foreign'].size).to eq 0 - expect(stake_keys['ours'].size).to eq 1 - # deposit is back on quitting so stake is higher than before - expect(stake_keys['ours'].first['stake']['quantity']).to be > stake_after_joining - expect(stake_keys['ours'].first['stake']['quantity']).to eq total_balance_after - expect(stake_keys['none']['stake']['quantity']).to eq 0 - expect(stake_keys['ours'].first['delegation']['active']['status']).to eq 'not_delegating' - expect(stake_keys['ours'].first['delegation']['next'].last['status']).to eq 'not_delegating' - - # examine the tx in history - tx = SHELLEY.transactions.get(@target_id, quit_tx_id) - expect(tx['amount']['quantity']).to be > 0 - expect(tx['amount']['quantity']).to be < deposit - expect(tx['fee']['quantity'].to_i).to be > 0 - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'incoming') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: deposit) - tx_withdrawals(tx, present: true) # automatic withdrawal - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: true) - expect(tx['certificates'].to_s).to include 'quit_pool' - end - end - - describe 'Coin Selection' do - it 'I can trigger random coin selection' do - addresses = SHELLEY.addresses.list(@target_id) - payload = [{ 'address' => addresses[0]['id'], - 'amount' => { 'quantity' => 2_000_000, 'unit' => 'lovelace' }, - 'assets' => [{ 'policy_id' => ASSETS[0]['policy_id'], - 'asset_name' => ASSETS[0]['asset_name'], - 'quantity' => 1 }, - { 'policy_id' => ASSETS[1]['policy_id'], - 'asset_name' => ASSETS[1]['asset_name'], - 'quantity' => 1 }] }] - - rnd = SHELLEY.coin_selections.random(@wid, payload, 'self', METADATA) - - expect(rnd).to be_correct_and_respond 200 - expect(rnd.to_s).to include 'outputs' - expect(rnd.to_s).to include 'change' - expect(rnd.to_s).to include 'metadata' - expect(rnd['inputs']).not_to be_empty - expect(rnd['outputs']).not_to be_empty - end - - it 'I can trigger random coin selection delegation action' do - pid = SHELLEY.stake_pools.list({ stake: 10_000_000 }).sample['id'] - action_join = { action: 'join', pool: pid } - - rnd = SHELLEY.coin_selections.random_deleg @wid, action_join - - expect(rnd).to be_correct_and_respond 200 - expect(rnd.to_s).to include 'outputs' - expect(rnd.to_s).to include 'change' - expect(rnd['inputs']).not_to be_empty - expect(rnd['change']).not_to be_empty - expect(rnd['outputs']).to be_empty - expect(rnd['certificates']).not_to be_empty - # expect(rnd['certificates'].to_s).to include "register_reward_account" - expect(rnd['certificates'].to_s).to include 'join_pool' - end - - it 'I could trigger random coin selection delegation action - if I had money' do - wid = create_shelley_wallet - pid = SHELLEY.stake_pools.list({ stake: 10_000_000 }).sample['id'] - action_join = { action: 'join', pool: pid } - - rnd = SHELLEY.coin_selections.random_deleg wid, action_join - expect(rnd).to be_correct_and_respond 403 - expect(rnd.to_s).to include 'no_utxos_available' - end - - it 'I could trigger random coin selection delegation action - if I known pool id' do - action_join = { action: 'join', pool: SPID_BECH32 } - action_quit = { action: 'quit' } - - rnd = SHELLEY.coin_selections.random_deleg @wid, action_join - expect(rnd).to be_correct_and_respond 404 - expect(rnd.to_s).to include 'no_such_pool' - - rnd = SHELLEY.coin_selections.random_deleg @wid, action_quit - expect(rnd).to be_correct_and_respond 403 - expect(rnd.to_s).to include 'not_delegating_to' - end - end - - describe 'Update passphrase' do - it 'I can update passphrase with mnemonic and the wallet does not have to re-sync' do - mnemonics = get_fixture_wallet(:fixture, :shelley, :mnemonics) - upd = SHELLEY.wallets.update_passphrase(@wid, { mnemonic_sentence: mnemonics, - new_passphrase: PASS }) - expect(upd).to be_correct_and_respond 204 - wallet = SHELLEY.wallets.get(@wid) - expect(wallet['state']['status']).to eq 'ready' - end - end - end - - describe 'E2E Byron' do - def test_byron_fees(source_wid) - txs = BYRON.transactions - # get required minimum ada - fees = txs.payment_fees(source_wid, payment_payload(1)) - expect(fees.code).to eq 403 - expect(fees['code']).to eq 'utxo_too_small' - amt = fees['info']['tx_output_lovelace_required_minimum']['quantity'] - - fees = txs.payment_fees(source_wid, payment_payload(amt)) - expect(fees).to be_correct_and_respond 202 - end - - def test_byron_tx(source_wid, target_wid) - address = SHELLEY.addresses.list(target_wid)[0]['id'] - target_before = get_shelley_balances(target_wid) - src_before = get_byron_balances(source_wid) - - # get required minimum ada - tx = BYRON.transactions.create(source_wid, PASS, payment_payload(1, address)) - expect(tx.code).to eq 403 - expect(tx['code']).to eq 'utxo_too_small' - amt = tx['info']['tx_output_lovelace_required_minimum']['quantity'] - - tx_sent = BYRON.transactions.create(source_wid, PASS, payment_payload(amt, address)) - - expect(tx_sent).to be_correct_and_respond 202 - tx_id = tx_sent['id'] - wait_for_tx_in_ledger(target_wid, tx_id) - verify_tx_status(source_wid, tx_id, 'in_ledger', BYRON) - - target_after = get_shelley_balances(target_wid) - src_after = get_byron_balances(source_wid) - fee = BYRON.transactions.get(source_wid, tx_id)['fee']['quantity'] - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, fee) - - # examine the tx in history - # on src wallet - tx = BYRON.transactions.get(source_wid, tx_id) - tx_amount(tx, amt + fee) - tx_fee(tx, fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(target_wid, tx_id) - tx_amount(txt, amt) - tx_fee(tx, fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - def test_byron_assets_tx(source_id, target_id) - amt = 1 - address = SHELLEY.addresses.list(target_id)[1]['id'] - target_before = get_shelley_balances(target_id) - src_before = get_byron_balances(source_id) - payload = [{ 'address' => address, - 'amount' => { 'quantity' => 0, 'unit' => 'lovelace' }, - 'assets' => [{ 'policy_id' => ASSETS[0]['policy_id'], - 'asset_name' => ASSETS[0]['asset_name'], - 'quantity' => amt }, - { 'policy_id' => ASSETS[1]['policy_id'], - 'asset_name' => ASSETS[1]['asset_name'], - 'quantity' => amt }] }] - - tx_sent = BYRON.transactions.create(source_id, PASS, payload) - - expect(tx_sent).to be_correct_and_respond 202 - tx_id = tx_sent['id'] - wait_for_tx_in_ledger(target_id, tx_id) - verify_tx_status(source_id, tx_id, 'in_ledger', BYRON) - - target_after = get_shelley_balances(target_id) - src_after = get_byron_balances(source_id) - tx = BYRON.transactions.get(source_id, tx_id) - fee = tx['fee']['quantity'] - amt_ada = tx['amount']['quantity'] - fee - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt_ada, fee) - - verify_asset_balance(src_after, src_before, - target_after, target_before, - amt) - - # Target wallet lists my associated assets - assets = SHELLEY.assets.get(target_id) - expect(assets).to be_correct_and_respond 200 - expect(assets.to_s).to include ASSETS[0]['policy_id'] - expect(assets.to_s).to include ASSETS[0]['asset_name'] - expect(assets.to_s).to include ASSETS[1]['policy_id'] - expect(assets.to_s).to include ASSETS[1]['asset_name'] - - # examine the tx in history - # on src wallet - tx = BYRON.transactions.get(source_id, tx_id) - tx_amount(tx, amt_ada + fee) - tx_fee(tx, fee) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(target_id, tx_id) - tx_amount(txt, amt_ada) - tx_fee(tx, fee) - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - - def test_byron_trans_list(wid) - # get 3 txs - txs = BYRON.transactions.list(wid, { max_count: 3, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to be 3 - - last_tx_time = txs.first['inserted_at']['time'] - first_tx_time = txs.last['inserted_at']['time'] - - # get 2 txs - txs = BYRON.transactions.list(wid, { max_count: 2, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq last_tx_time - - # get 2 txs in ascending order - txs = BYRON.transactions.list(wid, { max_count: 2, start: first_tx_time, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq first_tx_time - - # get 2 txs in ascending order with start and end time - txs = BYRON.transactions.list(wid, { max_count: 2, start: last_tx_time, end: first_tx_time, order: 'ascending' }) - expect(txs).to be_correct_and_respond 200 - expect(txs.size).to eq 2 - expect(txs.first['inserted_at']['time']).to eq last_tx_time - end - - describe 'UTxOs' do - it 'Fixture shared wallets have utxos' do - @nightly_byron_wallets.each do |wid| - utxo_stats = BYRON.wallets.utxo(wid) - expect(utxo_stats).to be_correct_and_respond 200 - - utxo_snap = BYRON.wallets.utxo_snapshot(wid) - expect(utxo_snap).to be_correct_and_respond 200 - expect(utxo_snap['entries'].size).to be > 0 - end - end - end - describe 'Byron Transactions' do - it 'I can estimate fees (min_utxo_value), random' do - test_byron_fees(@wid_rnd) - end - - it 'I can estimate fees (min_utxo_value), icarus' do - test_byron_fees(@wid_ic) - end - - it 'I can send transaction and funds are received (min_utxo_value), random -> shelley' do - test_byron_tx(@wid_rnd, @target_id) - end - - it 'I can send transaction and funds are received (min_utxo_value), icarus -> shelley' do - test_byron_tx(@wid_ic, @target_id) - end - - it 'I can send native assets tx and they are received (random -> shelley)' do - test_byron_assets_tx(@wid_rnd, @target_id) - end - - it 'I can send native assets tx and they are received (icarus -> shelley)' do - test_byron_assets_tx(@wid_ic, @target_id) - end - - it 'I can list transactions and limit response with query parameters (byron)' do - test_byron_trans_list(@wid_rnd) - end - - it 'I can list transactions and limit response with query parameters (icarus)' do - test_byron_trans_list(@wid_ic) - end - end - - describe 'Byron Migrations' do - it 'I can create migration plan byron -> shelley' do - addrs = SHELLEY.addresses.list(@target_id).map { |a| a['id'] } - - plan = BYRON.migrations.plan(@wid_rnd, addrs) - expect(plan).to be_correct_and_respond 202 - expect(plan['balance_selected']['assets']).not_to be [] - expect(plan['balance_leftover']).to eq({ 'ada' => { 'quantity' => 0, - 'unit' => 'lovelace' }, - 'assets' => [] }) - end - - it 'I can create migration plan icarus -> shelley' do - addrs = SHELLEY.addresses.list(@target_id).map { |a| a['id'] } - - plan = BYRON.migrations.plan(@wid_ic, addrs) - expect(plan).to be_correct_and_respond 202 - expect(plan['balance_selected']['assets']).not_to be [] - expect(plan['balance_leftover']).to eq({ 'ada' => { 'quantity' => 0, - 'unit' => 'lovelace' }, - 'assets' => [] }) - end - end - - describe 'Native Assets' do - it 'I can list assets -> random' do - assets = BYRON.assets.get @wid_rnd - expect(assets).to be_correct_and_respond 200 - expect(assets.to_s).to include ASSETS[0]['policy_id'] - expect(assets.to_s).to include ASSETS[0]['asset_name'] - expect(assets.to_s).to include ASSETS[1]['policy_id'] - expect(assets.to_s).to include ASSETS[1]['asset_name'] - - assets = BYRON.assets.get(@wid_rnd, ASSETS[0]['policy_id']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[0]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[0]['asset_name'] - expect(assets['asset_name']).not_to eq ASSETS[1]['asset_name'] - - assets = BYRON.assets.get(@wid_rnd, ASSETS[1]['policy_id'], ASSETS[1]['asset_name']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[1]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[1]['asset_name'] - expect(assets['asset_name']).not_to eq ASSETS[0]['asset_name'] - end - - it 'I can list assets -> icarus' do - assets = BYRON.assets.get @wid_ic - expect(assets).to be_correct_and_respond 200 - expect(assets.to_s).to include ASSETS[0]['policy_id'] - expect(assets.to_s).to include ASSETS[0]['asset_name'] - expect(assets.to_s).to include ASSETS[1]['policy_id'] - expect(assets.to_s).to include ASSETS[1]['asset_name'] - - assets = BYRON.assets.get(@wid_ic, ASSETS[0]['policy_id']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[0]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[0]['asset_name'] - expect(assets['asset_name']).not_to eq ASSETS[1]['asset_name'] - - assets = BYRON.assets.get(@wid_ic, ASSETS[1]['policy_id'], ASSETS[1]['asset_name']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[1]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[1]['asset_name'] - expect(assets['asset_name']).not_to eq ASSETS[0]['asset_name'] - end - - it 'I can list assets with offchain metadata -> random', :offchain do - assets = BYRON.assets.get(@wid_rnd, ASSETS[0]['policy_id']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[0]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[0]['asset_name'] - expect(assets['metadata']).to eq ASSETS[0]['metadata'] - expect(assets['asset_name']).not_to eq ASSETS[1]['asset_name'] - expect(assets['metadata']).not_to eq ASSETS[1]['metadata'] - - assets = BYRON.assets.get(@wid_rnd, ASSETS[1]['policy_id'], ASSETS[1]['asset_name']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[1]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[1]['asset_name'] - expect(assets['metadata']).to eq ASSETS[1]['metadata'] - expect(assets['asset_name']).not_to eq ASSETS[0]['asset_name'] - expect(assets['metadata']).not_to eq ASSETS[0]['metadata']['name'] - end - - it 'I can list assets with offchain metadata -> icarus', :offchain do - assets = BYRON.assets.get(@wid_ic, ASSETS[0]['policy_id']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[0]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[0]['asset_name'] - expect(assets['metadata']).to eq ASSETS[0]['metadata'] - expect(assets['asset_name']).not_to eq ASSETS[1]['asset_name'] - expect(assets['metadata']).not_to eq ASSETS[1]['metadata'] - - assets = BYRON.assets.get(@wid_ic, ASSETS[1]['policy_id'], ASSETS[1]['asset_name']) - expect(assets).to be_correct_and_respond 200 - expect(assets['policy_id']).to eq ASSETS[1]['policy_id'] - expect(assets['asset_name']).to eq ASSETS[1]['asset_name'] - expect(assets['metadata']).to eq ASSETS[1]['metadata'] - expect(assets['asset_name']).not_to eq ASSETS[0]['asset_name'] - expect(assets['metadata']).not_to eq ASSETS[0]['metadata']['name'] - end - end - end - - describe 'E2E External transaction' do - it 'Submit tx via POST /proxy/transactions' do - amt = MIN_UTXO_VALUE_PURE_ADA - address = SHELLEY.addresses.list(@target_id)[0]['id'] - target_before = get_shelley_balances(@target_id) - src_before = get_shelley_balances(@wid) - - tx_constructed = SHELLEY.transactions.construct(@wid, payment_payload(amt, address)) - expect(tx_constructed).to be_correct_and_respond 202 - expected_fee = tx_constructed['fee']['quantity'] - tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed['transaction']) - expect(tx_decoded).to be_correct_and_respond 202 - - decoded_fee = tx_decoded['fee']['quantity'] - expect(expected_fee).to eq decoded_fee - - tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - # construct tx binary blob - serialized_tx = Base64.decode64(tx_signed['transaction'].strip) - # submitting tx via POST /proxy/transactions - tx_submitted = PROXY.submit_external_transaction(serialized_tx) - expect(tx_submitted).to be_correct_and_respond 202 - - # tx is visible on the src wallet as inputs belong to it - tx_id = tx_submitted['id'] - wait_for_tx_in_ledger(@wid, tx_id) - - target_after = get_shelley_balances(@target_id) - src_after = get_shelley_balances(@wid) - tx = SHELLEY.transactions.get(@wid, tx_id) - # verify actual fee the same as constructed - expect(expected_fee).to eq tx['fee']['quantity'] - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amt, expected_fee) - end - - it 'Cannot submit unsigned tx via POST /proxy/transactions' do - amt = MIN_UTXO_VALUE_PURE_ADA - address = SHELLEY.addresses.list(@target_id)[0]['id'] - - tx_constructed = SHELLEY.transactions.construct(@wid, payment_payload(amt, address)) - expect(tx_constructed).to be_correct_and_respond 202 - - # construct tx binary blob - serialized_tx = Base64.decode64(tx_constructed['transaction'].strip) - # submitting tx via POST /proxy/transactions - tx_submitted = PROXY.submit_external_transaction(serialized_tx) - expect(tx_submitted.parsed_response).to include 'code' => 'created_invalid_transaction' - end - end - - describe 'E2E Migration' do - it 'I can migrate all funds back to fixture wallet' do - address = SHELLEY.addresses.list(@wid)[0]['id'] - src_before = get_shelley_balances(@target_id) - target_before = get_shelley_balances(@wid) - - migration = SHELLEY.migrations.migrate(@target_id, PASS, [address]) - tx_ids = migration.map { |m| m['id'] } - fees = migration.map { |m| m['fee']['quantity'] }.sum - amounts = migration.map { |m| m['amount']['quantity'] }.sum - fees - - tx_ids.each do |tx_id| - wait_for_tx_in_ledger(@target_id, tx_id) - end - src_after = get_shelley_balances(@target_id) - target_after = get_shelley_balances(@wid) - expected_src_balance = { 'total' => 0, - 'available' => 0, - 'rewards' => 0, - 'assets_total' => [], - 'assets_available' => [] } - - expect(src_after).to eq expected_src_balance - - verify_ada_balance(src_after, src_before, - target_after, target_before, - amounts, fees) - - tx_ids.each do |tx_id| - # examine the tx in history - # on src wallet - tx = SHELLEY.transactions.get(@target_id, tx_id) - tx_inputs(tx, present: true) - tx_outputs(tx, present: true) - tx_direction(tx, 'outgoing') - tx_script_validity(tx, 'valid') - tx_status(tx, 'in_ledger') - tx_collateral(tx, present: false) - tx_collateral_outputs(tx, present: false) - tx_metadata(tx, nil) - tx_deposits(tx, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(tx, present: false) - tx_mint_burn(tx, mint: [], burn: []) - tx_extra_signatures(tx, present: false) - tx_script_integrity(tx, present: false) - tx_validity_interval_default(tx) - tx_certificates(tx, present: false) - - # on target wallet - txt = SHELLEY.transactions.get(@wid, tx_id) - expect(tx['fee']['quantity'].to_i).to be > 0 - tx_inputs(txt, present: true) - tx_outputs(txt, present: true) - tx_direction(txt, 'incoming') - tx_script_validity(txt, 'valid') - tx_status(txt, 'in_ledger') - tx_collateral(txt, present: false) - tx_collateral_outputs(txt, present: false) - tx_metadata(txt, nil) - # ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) - # tx_deposits(txt, deposit_taken: 0, deposit_returned: 0) - tx_withdrawals(txt, present: false) - tx_mint_burn(txt, mint: [], burn: []) - tx_extra_signatures(txt, present: false) - tx_script_integrity(txt, present: false) - tx_validity_interval_default(txt) - tx_certificates(txt, present: false) - end - end - end -end diff --git a/test/e2e/spec/shared_spec.rb b/test/e2e/spec/shared_spec.rb deleted file mode 100644 index 457487c63d4..00000000000 --- a/test/e2e/spec/shared_spec.rb +++ /dev/null @@ -1,786 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe CardanoWallet::Shared, :all, :shared do - after(:each) do - teardown - end - - describe CardanoWallet::Shared::Wallets do - describe 'Create wallets' do - it 'I can create, get and delete wallet from mnemonics getting acc_xpub from cardano-address' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub }, - 'template' => - { 'all' => - ['cosigner#0', - { 'active_from' => 120 }] } } - - payload = { mnemonic_sentence: m24, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: script_template, - delegation_script_template: script_template } - - wallet = WalletFactory.create(:shared, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - g = SHARED.wallets.get(wid) - expect(g).to be_correct_and_respond 200 - - l = SHARED.wallets.list - expect(l).to be_correct_and_respond 200 - - expect(WalletFactory.delete(:shared, wid)).to be_correct_and_respond 204 - end - - it 'I can create, get and delete wallet from pub key getting acc_xpub from cardano-address' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - - payment_script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub }, - 'template' => - { 'all' => - ['cosigner#0', - { 'active_from' => 120 }] } } - - delegation_script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub }, - 'template' => - { 'all' => - ['cosigner#0', - 'cosigner#1'] } } - payload = { account_public_key: acc_xpub, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: payment_script_template, - delegation_script_template: delegation_script_template } - - wallet = WalletFactory.create(:shared, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - g = SHARED.wallets.get(wid) - expect(g).to be_correct_and_respond 200 - - l = SHARED.wallets.list - expect(l).to be_correct_and_respond 200 - - expect(WalletFactory.delete(:shared, wid)).to be_correct_and_respond 204 - end - - it 'Cannot create wallet with different acc xpub - derived from different mnemonic sentence' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub_wrong = cardano_address_get_acc_xpub(CW.utils.mnemonic_sentence(24), - '1854H/1815H/0H') - - payment_script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub_wrong }, - 'template' => - { 'all' => - ['cosigner#0'] } } - - delegation_script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub_wrong }, - 'template' => - { 'all' => - ['cosigner#0', - 'cosigner#1'] } } - payload = { mnemonic_sentence: m24, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: payment_script_template, - delegation_script_template: delegation_script_template } - - size = SHARED.wallets.list.size - wallet = SHARED.wallets.create(payload) - expect(wallet).to be_correct_and_respond 403 - - l = SHARED.wallets.list - expect(l).to be_correct_and_respond 200 - expect(l.size).to be size - end - - it 'Cannot create wallet with different acc xpub - derived from different acc ix' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub_wrong = cardano_address_get_acc_xpub(m24, '1854H/1815H/255H') - - payment_script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub_wrong }, - 'template' => - { 'all' => - ['cosigner#0'] } } - - delegation_script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub_wrong }, - 'template' => - { 'all' => - ['cosigner#0', - 'cosigner#1'] } } - payload = { mnemonic_sentence: m24, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: payment_script_template, - delegation_script_template: delegation_script_template } - - size = SHARED.wallets.list.size - wallet = SHARED.wallets.create(payload) - expect(wallet).to be_correct_and_respond 403 - - l = SHARED.wallets.list - expect(l).to be_correct_and_respond 200 - expect(l.size).to be size - end - - it 'I can create incomplete wallet and update cosigners with acc_xpub from cardano-address' do - m24 = CW.utils.mnemonic_sentence(24) - acc_xpub = cardano_address_get_acc_xpub(m24, '1854H/1815H/0H') - incomplete_wid = create_incomplete_shared_wallet(m24, '0H', acc_xpub) - addr = SHARED.addresses.list(incomplete_wid) - expect(addr).to be_correct_and_respond 200 - expect(addr.size).to eq 0 - - acc_xpub_upd = cardano_address_get_acc_xpub(CW.utils.mnemonic_sentence(24), - '1854H/1815H/0H') - - update_payment = SHARED.wallets.update_payment_script(incomplete_wid, - 'cosigner#1', - acc_xpub_upd) - - expect(update_payment).to be_correct_and_respond 200 - expect(SHARED.wallets.get(incomplete_wid)['state']['status']).to eq 'incomplete' - expect(SHARED.wallets.get(incomplete_wid)).to be_correct_and_respond 200 - addr = SHARED.addresses.list(incomplete_wid) - expect(addr).to be_correct_and_respond 200 - expect(addr.size).to eq 0 - - update_delegation = SHARED.wallets.update_delegation_script(incomplete_wid, - 'cosigner#1', - acc_xpub_upd) - - expect(update_delegation).to be_correct_and_respond 200 - eventually "The wallet is no longer 'incomplete'" do - SHARED.wallets.get(incomplete_wid)['state']['status'] != 'incomplete' - end - expect(SHARED.wallets.list).to be_correct_and_respond 200 - addr = SHARED.addresses.list(incomplete_wid) - expect(addr).to be_correct_and_respond 200 - expect(addr.size).to eq 20 - end - - it 'Create / update partially / get / list / delete' do - m24 = CW.utils.mnemonic_sentence(24) - acc_xpub = cardano_address_get_acc_xpub(m24, '1854H/1815H/0H') - incomplete_wid = create_incomplete_shared_wallet(m24, '0H', acc_xpub) - - acc_xpub_upd = cardano_address_get_acc_xpub(CW.utils.mnemonic_sentence(24), - '1854H/1815H/0H') - - update_payment = SHARED.wallets.update_payment_script(incomplete_wid, - 'cosigner#1', - acc_xpub_upd) - - expect(update_payment).to be_correct_and_respond 200 - - expect(SHARED.wallets.get(incomplete_wid)).to be_correct_and_respond 200 - expect(SHARED.wallets.get(incomplete_wid)['state']['status']).to eq 'incomplete' - - expect(SHARED.wallets.list).to be_correct_and_respond 200 - - expect(WalletFactory.delete(:shared, incomplete_wid)).to be_correct_and_respond 204 - end - - it 'Cannot update main cosigner' do - m24 = CW.utils.mnemonic_sentence(24) - acc_xpub = cardano_address_get_acc_xpub(m24, '1854H/1815H/0H') - incomplete_wid = create_incomplete_shared_wallet(m24, '0H', acc_xpub) - acc_xpub_upd = cardano_address_get_acc_xpub(CW.utils.mnemonic_sentence(24), - '1854H/1815H/0H') - - update_payment = SHARED.wallets.update_payment_script(incomplete_wid, - 'cosigner#0', - acc_xpub_upd) - - expect(update_payment).to be_correct_and_respond 403 - - update_delegation = SHARED.wallets.update_delegation_script(incomplete_wid, - 'cosigner#0', - acc_xpub_upd) - - expect(update_delegation).to be_correct_and_respond 403 - end - - it "Cannot update cosigner with main cosigner's xpub" do - m24 = CW.utils.mnemonic_sentence(24) - acc_xpub = cardano_address_get_acc_xpub(m24, '1854H/1815H/0H') - incomplete_wid = create_incomplete_shared_wallet(m24, '0H', acc_xpub) - - update_payment = SHARED.wallets.update_payment_script(incomplete_wid, - 'cosigner#1', - acc_xpub) - - expect(update_payment).to be_correct_and_respond 403 - - update_delegation = SHARED.wallets.update_delegation_script(incomplete_wid, - 'cosigner#1', - acc_xpub) - - expect(update_delegation).to be_correct_and_respond 403 - end - - it "I can create/get/list/delete wallet using cosigner: 'self' - from mnemonics" do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - script_template = { 'cosigners' => - { 'cosigner#0' => 'self' }, - 'template' => - { 'all' => - ['cosigner#0'] } } - - payload = { mnemonic_sentence: m24, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: script_template, - delegation_script_template: script_template } - - wallet = WalletFactory.create(:shared, payload) - expect(wallet).to be_correct_and_respond 201 - expect(wallet['state']['status']).to eq 'syncing' - - wid = wallet['id'] - g = SHARED.wallets.get(wid) - expect(g).to be_correct_and_respond 200 - - l = SHARED.wallets.list - expect(l).to be_correct_and_respond 200 - expect(l.to_s).to include wid - - expect(WalletFactory.delete(:shared, wid)).to be_correct_and_respond 204 - end - - it "I can create/get/list/delete wallet using cosigner: 'self' - from pub key" do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - payment_script_template = { 'cosigners' => - { 'cosigner#0' => 'self' }, - 'template' => - { 'all' => - ['cosigner#0', - { 'active_from' => 120 }] } } - - delegation_script_template = { 'cosigners' => - { 'cosigner#0' => 'self' }, - 'template' => - { 'all' => - ['cosigner#0', - 'cosigner#1'] } } - payload = { account_public_key: acc_xpub, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: payment_script_template, - delegation_script_template: delegation_script_template } - - wallet = WalletFactory.create(:shared, payload) - expect(wallet).to be_correct_and_respond 201 - expect(wallet['state']['status']).to eq 'incomplete' - - wid = wallet['id'] - g = SHARED.wallets.get(wid) - expect(g).to be_correct_and_respond 200 - - l = SHARED.wallets.list - expect(l).to be_correct_and_respond 200 - expect(l.to_s).to include wid - - expect(WalletFactory.delete(:shared, wid)).to be_correct_and_respond 204 - end - - describe 'Wallet id' do - it 'Shared walletid with only spending template from cardano-addresses' do - mnemonics = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - script_template = { 'cosigners' => { 'cosigner#0' => 'self' }, - 'template' => - { 'all' => - ['cosigner#0', - { 'active_from' => 120 }] } } - - payload = { mnemonic_sentence: mnemonics, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: script_template } - - wallet = WalletFactory.create(:shared, payload) - expect(wallet).to be_correct_and_respond 201 - wid = wallet['id'] - - # based on acct prv key - template = '--spending "all [cosigner#0, active_from 120]"' - root_xsk = CA.prv_key_from_recovery_phrase(mnemonics, 'Shared') - acct_key = CA.key_child(root_xsk, "1854H/1815H/#{acc_ix}") - ca_wid_acct_key = CA.key_walletid(acct_key, template) - - # based on pub key from acct prv key - pub_key = CA.key_public(acct_key, with_chain_code: true) - ca_wid_pub_key = CA.key_walletid(pub_key, template) - - # wallet id from cardano-wallet is the same - expect(ca_wid_acct_key).to eq ca_wid_pub_key - expect(wid).to eq ca_wid_acct_key - end - - it 'Shared walletid with spending and delegation template from cardano-addresses' do - mnemonics = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - script_template = { 'cosigners' => { 'cosigner#0' => 'self' }, - 'template' => - { 'all' => - ['cosigner#0', - { 'active_from' => 120 }] } } - - delegation_template = { 'cosigners' => { 'cosigner#1' => 'self' }, - 'template' => - { 'any' => - ['cosigner#0', - 'cosigner#1'] } } - - payload = { mnemonic_sentence: mnemonics, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: script_template, - delegation_script_template: delegation_template } - - wallet = WalletFactory.create(:shared, payload) - expect(wallet).to be_correct_and_respond 201 - wid = wallet['id'] - - # based on acct prv key - template = '--spending "all [cosigner#0, active_from 120]" --staking "any [cosigner#0, cosigner#1]"' - root_xsk = CA.prv_key_from_recovery_phrase(mnemonics, 'Shared') - acct_key = CA.key_child(root_xsk, "1854H/1815H/#{acc_ix}") - ca_wid_acct_key = CA.key_walletid(acct_key, template) - - # based on pub key from acct prv key - pub_key = CA.key_public(acct_key, with_chain_code: true) - ca_wid_pub_key = CA.key_walletid(pub_key, template) - - # wallet id from cardano-wallet is the same - expect(ca_wid_acct_key).to eq ca_wid_pub_key - expect(wid).to eq ca_wid_acct_key - end - end - end - - describe 'UTxOs' do - it 'Can see utxo' do - id = create_active_shared_wallet(CW.utils.mnemonic_sentence(24), '0H', 'self') - utxo = SHARED.wallets.utxo(id) - expect(utxo).to be_correct_and_respond 200 - end - - it 'Can see utxo snapshot' do - id = create_active_shared_wallet(CW.utils.mnemonic_sentence(24), '0H', 'self') - utxo = SHARED.wallets.utxo_snapshot(id) - expect(utxo).to be_correct_and_respond 200 - end - end - - describe 'Addresses' do - it 'Can list addresses on active shared wallet - from pub key' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - active_wid = create_active_shared_wallet(acc_xpub, acc_ix, 'self') - - a = SHARED.addresses.list(active_wid) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 20 - - a = SHARED.addresses.list(active_wid, { state: 'used' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - a = SHARED.addresses.list(active_wid, { state: 'unused' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 20 - end - - it 'Can list addresses on active shared wallet - from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - active_wid = create_active_shared_wallet(m24, '0H', 'self') - - a = SHARED.addresses.list(active_wid) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 20 - - a = SHARED.addresses.list(active_wid, { state: 'used' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - a = SHARED.addresses.list(active_wid, { state: 'unused' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 20 - end - - it 'Lists empty addresses on incomplete shared wallet - from pub key' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - incomplete_wid = create_incomplete_shared_wallet(acc_xpub, acc_ix, 'self') - - a = SHARED.addresses.list(incomplete_wid) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - a = SHARED.addresses.list(incomplete_wid, { state: 'used' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - a = SHARED.addresses.list(incomplete_wid, { state: 'unused' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - acc_xpub = cardano_address_get_acc_xpub(CW.utils.mnemonic_sentence(24), '1854H/1815H/0H') - patch_incomplete_shared_wallet(incomplete_wid, - { 'cosigner#1' => acc_xpub }, - { 'cosigner#1' => acc_xpub }) - - a = SHARED.addresses.list(incomplete_wid) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 20 - - a = SHARED.addresses.list(incomplete_wid, { state: 'used' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - a = SHARED.addresses.list(incomplete_wid, { state: 'unused' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 20 - end - - it 'Lists empty addresses on incomplete shared wallet - from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - incomplete_wid = create_incomplete_shared_wallet(m24, '0H', 'self') - - a = SHARED.addresses.list(incomplete_wid) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - a = SHARED.addresses.list(incomplete_wid, { state: 'used' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - a = SHARED.addresses.list(incomplete_wid, { state: 'unused' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - acc_xpub = cardano_address_get_acc_xpub(CW.utils.mnemonic_sentence(24), '1854H/1815H/0H') - patch_incomplete_shared_wallet(incomplete_wid, - { 'cosigner#1' => acc_xpub }, - { 'cosigner#1' => acc_xpub }) - - a = SHARED.addresses.list(incomplete_wid) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 20 - - a = SHARED.addresses.list(incomplete_wid, { state: 'used' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 0 - - a = SHARED.addresses.list(incomplete_wid, { state: 'unused' }) - expect(a).to be_correct_and_respond 200 - expect(a.size).to be 20 - end - end - - describe 'Public Keys' do - matrix = { - 'utxo_internal' => 'addr_shared_vk', - 'utxo_external' => 'addr_shared_vk', - 'mutable_account' => 'stake_shared_vk' - } - matrix_h = { - 'utxo_internal' => 'addr_shared_vkh', - 'utxo_external' => 'addr_shared_vkh', - 'mutable_account' => 'stake_shared_vkh' - } - - it 'Get public key - incomplete wallet from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - acc_xpub = cardano_address_get_acc_xpub(m24, '1854H/1815H/0H') - incomplete_wid = create_incomplete_shared_wallet(m24, '0H', acc_xpub) - - matrix.each do |role, addr_prefix| - id = [*0..100_000].sample - res = SHARED.keys.get_public_key(incomplete_wid, role, id) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include addr_prefix - end - - matrix_h.each do |role, addr_prefix| - id = [*0..100_000].sample - res = SHARED.keys.get_public_key(incomplete_wid, role, id, { hash: true }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include addr_prefix - end - end - - it 'Get public key - incomplete wallet from acc pub key' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - incomplete_wid = create_incomplete_shared_wallet(acc_xpub, acc_ix, acc_xpub) - - matrix.each do |role, addr_prefix| - id = [*0..100_000].sample - res = SHARED.keys.get_public_key(incomplete_wid, role, id) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include addr_prefix - end - - matrix_h.each do |role, addr_prefix| - id = [*0..100_000].sample - res = SHARED.keys.get_public_key(incomplete_wid, role, id, { hash: true }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include addr_prefix - end - end - - it 'Get public key - active wallet from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - active_wid = create_incomplete_shared_wallet(m24, '11H', 'self') - - matrix.each do |role, addr_prefix| - id = [*0..100_000].sample - res = SHARED.keys.get_public_key(active_wid, role, id) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include addr_prefix - end - - matrix_h.each do |role, addr_prefix| - id = [*0..100_000].sample - res = SHARED.keys.get_public_key(active_wid, role, id, { hash: true }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include addr_prefix - end - end - - it 'Get public key - active wallet from acc pub key' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - active_wid = create_active_shared_wallet(acc_xpub, acc_ix, 'self') - - matrix.each do |role, addr_prefix| - id = [*0..100_000].sample - res = SHARED.keys.get_public_key(active_wid, role, id) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include addr_prefix - end - - matrix_h.each do |role, addr_prefix| - id = [*0..100_000].sample - res = SHARED.keys.get_public_key(active_wid, role, id, { hash: true }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include addr_prefix - end - end - end - - describe 'Account Public Keys' do - it 'Create account public key - incomplete wallet from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - der_path = '1854H/1815H/0H' - acc_xpub = cardano_address_get_acc_xpub(m24, der_path) - incomplete_wid = create_incomplete_shared_wallet(m24, '0H', acc_xpub) - %w[0H 1H 2147483647H 44H].each do |index| - payload = { passphrase: PASS, format: 'extended' } - res = SHARED.keys.create_acc_public_key(incomplete_wid, index, payload) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include cardano_address_get_acc_xpub(m24, - "1854H/1815H/#{index}", - 'Shared', - '--with-chain-code', - hex: false) - - payload = { passphrase: PASS, format: 'non_extended' } - res = SHARED.keys.create_acc_public_key(incomplete_wid, index, payload) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include cardano_address_get_acc_xpub(m24, - "1854H/1815H/#{index}", - 'Shared', - '--without-chain-code', - hex: false) - end - end - - it 'Cannot create account public key - incomplete wallet from acc pub key' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - incomplete_wid = create_incomplete_shared_wallet(acc_xpub, acc_ix, 'self') - %w[0H 1H 2147483647H 44H].each do |index| - res = SHARED.keys.create_acc_public_key(incomplete_wid, index, { passphrase: PASS, format: 'extended' }) - expect(res).to be_correct_and_respond 403 - expect(res.to_s).to include 'no_root_key' - - res = SHARED.keys.create_acc_public_key(incomplete_wid, index, { passphrase: PASS, format: 'non_extended' }) - expect(res).to be_correct_and_respond 403 - expect(res.to_s).to include 'no_root_key' - end - end - - it 'Create account public key - active wallet from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - acc_xpub = cardano_address_get_acc_xpub(m24, '1854H/1815H/0H') - active_wid = create_active_shared_wallet(m24, '0H', acc_xpub) - %w[0H 1H 2147483647H 44H].each do |index| - res = SHARED.keys.create_acc_public_key(active_wid, index, { passphrase: PASS, format: 'extended' }) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include cardano_address_get_acc_xpub(m24, - "1854H/1815H/#{index}", - 'Shared', - '--with-chain-code', - hex: false) - - res = SHARED.keys.create_acc_public_key(active_wid, index, { passphrase: PASS, format: 'non_extended' }) - expect(res).to be_correct_and_respond 202 - expect(res.to_s).to include cardano_address_get_acc_xpub(m24, - "1854H/1815H/#{index}", - 'Shared', - '--without-chain-code', - hex: false) - end - end - - it 'Cannot create account public key - active wallet from acc pub key' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - active_wid = create_active_shared_wallet(acc_xpub, acc_ix, 'self') - %w[0H 1H 2147483647H 44H].each do |index| - res = SHARED.keys.create_acc_public_key(active_wid, index, { passphrase: PASS, format: 'extended' }) - expect(res).to be_correct_and_respond 403 - expect(res.to_s).to include 'no_root_key' - - res = SHARED.keys.create_acc_public_key(active_wid, index, { passphrase: PASS, format: 'non_extended' }) - expect(res).to be_correct_and_respond 403 - expect(res.to_s).to include 'no_root_key' - end - end - - it 'Get account public key - active wallet from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - acc_xpub = cardano_address_get_acc_xpub(m24, '1854H/1815H/0H') - active_wid = create_active_shared_wallet(m24, '0H', acc_xpub) - - res = SHARED.keys.get_acc_public_key(active_wid) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_vk' - - res = SHARED.keys.get_acc_public_key(active_wid, { format: 'extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_xvk' - - res = SHARED.keys.get_acc_public_key(active_wid, { format: 'non_extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_vk' - end - - it 'Get account public key - active wallet from acc pub key' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - active_wid = create_active_shared_wallet(acc_xpub, acc_ix, 'self') - - res = SHARED.keys.get_acc_public_key(active_wid) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_vk' - - res = SHARED.keys.get_acc_public_key(active_wid, { format: 'extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_xvk' - - res = SHARED.keys.get_acc_public_key(active_wid, { format: 'non_extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_vk' - end - - it 'Get account public key - incomplete wallet from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - acc_xpub = cardano_address_get_acc_xpub(m24, '1854H/1815H/0H') - incomplete_wid = create_incomplete_shared_wallet(m24, '0H', acc_xpub) - - res = SHARED.keys.get_acc_public_key(incomplete_wid) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_vk' - - res = SHARED.keys.get_acc_public_key(incomplete_wid, { format: 'extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_xvk' - - res = SHARED.keys.get_acc_public_key(incomplete_wid, { format: 'non_extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_vk' - end - - it 'Get account public key - incomplete wallet from acc pub key' do - m24 = CW.utils.mnemonic_sentence(24) - acc_ix = '0H' - acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}") - incomplete_wid = create_incomplete_shared_wallet(acc_xpub, acc_ix, 'self') - - res = SHARED.keys.get_acc_public_key(incomplete_wid) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_vk' - - res = SHARED.keys.get_acc_public_key(incomplete_wid, { format: 'extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_xvk' - - res = SHARED.keys.get_acc_public_key(incomplete_wid, { format: 'non_extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.to_s).to include 'acct_shared_vk' - end - end - end - - describe CardanoWallet::Shared::Transactions do - it 'I could get a tx if I had proper id' do - wid = create_active_shared_wallet(CW.utils.mnemonic_sentence(24), '0H', 'self') - txs = SHARED.transactions - g = txs.get(wid, TXID) - expect(g).to be_correct_and_respond 404 - expect(g.to_s).to include 'no_such_transaction' - end - - it 'Can list transactions' do - id = create_active_shared_wallet(CW.utils.mnemonic_sentence(24), '0H', 'self') - txs = SHARED.transactions - expect(txs.list(id)).to be_correct_and_respond 200 - expect(txs.list(id, { max_count: 1 })).to be_correct_and_respond 200 - expect(txs.list(id, { start: '2012-09-25T10:15:00Z', - end: '2016-11-21T10:15:00Z', - order: 'ascending', - max_count: 10 })).to be_correct_and_respond 200 - expect(txs.list(id, { order: 'bad_order' })).to be_correct_and_respond 400 - expect(txs.list(id, { max_count: 'bad_count' })).to be_correct_and_respond 400 - end - end -end diff --git a/test/e2e/spec/shelley_spec.rb b/test/e2e/spec/shelley_spec.rb deleted file mode 100644 index a2466f1e3be..00000000000 --- a/test/e2e/spec/shelley_spec.rb +++ /dev/null @@ -1,699 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe CardanoWallet::Shelley, :all, :shelley do - after(:each) do - teardown - end - - describe CardanoWallet::Shelley::Wallets do - it 'I can list wallets' do - l = SHELLEY.wallets.list - expect(l).to be_correct_and_respond 200 - size = l.size - - create_shelley_wallet - l = SHELLEY.wallets.list - expect(l).to be_correct_and_respond 200 - expect(l.size).to eq(size + 1) - end - - it 'When wallet does not exist it gives 404' do - wid = create_shelley_wallet - WalletFactory.delete :shelley, wid - g = SHELLEY.wallets.get wid - expect(g).to be_correct_and_respond 404 - - d = SHELLEY.wallets.delete wid - expect(d).to be_correct_and_respond 404 - end - - describe 'Create wallets' do - it 'I can create, get and delete wallet from mnemonics' do - payload = { name: 'Wallet from mnemonic_sentence', - passphrase: 'Secure Passphrase', - mnemonic_sentence: CW.utils.mnemonic_sentence(15) } - wallet = WalletFactory.create(:shelley, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - g = SHELLEY.wallets.get(wid) - expect(g).to be_correct_and_respond 200 - - expect(WalletFactory.delete(:shelley, wid)).to be_correct_and_respond 204 - end - - it 'I can create, get and delete wallet from mnemonics / second factor' do - payload = { name: 'Wallet from mnemonic_sentence', - passphrase: 'Secure Passphrase', - mnemonic_sentence: CW.utils.mnemonic_sentence(15), - mnemonic_second_factor: CW.utils.mnemonic_sentence(12) } - wallet = WalletFactory.create(:shelley, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - g = SHELLEY.wallets.get(wid) - expect(g).to be_correct_and_respond 200 - expect(WalletFactory.delete(:shelley, wid)).to be_correct_and_respond 204 - end - - it 'I can set address pool gap' do - pool_gap = 55 - payload = { name: 'Wallet from mnemonic_sentence', - passphrase: 'Secure Passphrase', - mnemonic_sentence: CW.utils.mnemonic_sentence(15), - address_pool_gap: pool_gap } - wallet = WalletFactory.create(:shelley, payload) - expect(wallet).to be_correct_and_respond 201 - addr = SHELLEY.addresses.list(wallet['id']) - expect(addr).to be_correct_and_respond 200 - expect(addr.size).to eq pool_gap - end - - it 'I can create, get and delete wallet from pub key' do - payload = { name: 'Wallet from pub key', - account_public_key: 'b47546e661b6c1791452d003d375756dde6cac2250093ce4630f16b9b9c0ac87411337bda4d5bc0216462480b809824ffb48f17e08d95ab9f1b91d391e48e66b', - address_pool_gap: 20 } - wallet = WalletFactory.create(:shelley, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - g = SHELLEY.wallets.get(wid) - expect(g).to be_correct_and_respond 200 - expect(WalletFactory.delete(:shelley, wid)).to be_correct_and_respond 204 - end - - describe 'Wallet id' do - it 'I can get Shelley walletid using cardano-addresses' do - mnemonics = CW.utils.mnemonic_sentence(24) - wid = create_shelley_wallet('Shelley Wallet', mnemonics) - - # based on root prv key - root_xsk = CA.prv_key_from_recovery_phrase(mnemonics, 'Shelley') - ca_wid_root_xsk = CA.key_walletid(root_xsk) - expect(wid).to eq ca_wid_root_xsk - - # based on pub key - pub_key = CA.key_public(root_xsk) - ca_wid_pub_key = CA.key_walletid(pub_key) - expect(wid).to eq ca_wid_pub_key - end - - it 'Shelley walletid is not based on acct key' do - mnemonics = CW.utils.mnemonic_sentence(24) - wid = create_shelley_wallet('Shelley Wallet', mnemonics) - - # based on acct prv key - root_xsk = CA.prv_key_from_recovery_phrase(mnemonics, 'Shelley') - acct_key = CA.key_child(root_xsk, '1852H/1815H/0H') - ca_wid_acct_key = CA.key_walletid(acct_key) - - # based on pub key from acct prv key - pub_key = CA.key_public(acct_key) - ca_wid_pub_key = CA.key_walletid(pub_key) - - # wallet id from cardano-wallet is not the same - expect(ca_wid_acct_key).to eq ca_wid_pub_key - expect(wid).not_to eq ca_wid_acct_key - end - end - end - - describe 'Update wallet' do - it 'Can update_metadata' do - new_name = 'New wallet name' - w = SHELLEY.wallets - id = create_shelley_wallet - u = w.update_metadata(id, { name: new_name }) - expect(u).to be_correct_and_respond 200 - expect(w.get(id)['name']).to eq new_name - end - - it 'Can update_passphrase' do - w = SHELLEY.wallets - id = create_shelley_wallet - upd = w.update_passphrase(id, { old_passphrase: 'Secure Passphrase', - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 204 - end - - it 'Cannot update_passphrase not knowing old pass' do - w = SHELLEY.wallets - id = create_shelley_wallet - upd = w.update_passphrase(id, { old_passphrase: 'wrong-passphrase', - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 403 - expect(upd.to_s).to include 'wrong_encryption_passphrase' - end - - it 'Can update_passphrase, mnemonics' do - w = SHELLEY.wallets - mnemonics = CW.utils.mnemonic_sentence(24) - id = create_shelley_wallet('Wallet', mnemonics) - upd = w.update_passphrase(id, { mnemonic_sentence: mnemonics, - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 204 - end - - it 'Can update_passphrase, mnemonics, mnemonic_second_factor' do - w = SHELLEY.wallets - mnemonics = CW.utils.mnemonic_sentence(24) - mnemonic_second_factor = CW.utils.mnemonic_sentence(12) - id = create_shelley_wallet('Wallet', mnemonics, mnemonic_second_factor) - upd = w.update_passphrase(id, { mnemonic_sentence: mnemonics, - mnemonic_second_factor: mnemonic_second_factor, - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 204 - end - - it 'Cannot update_passphrase with wrong mnemonics' do - w = SHELLEY.wallets - mnemonics = CW.utils.mnemonic_sentence(24) - wrong_mnemonics = CW.utils.mnemonic_sentence(24) - id = create_shelley_wallet('Wallet', mnemonics) - upd = w.update_passphrase(id, { mnemonic_sentence: wrong_mnemonics, - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 403 - expect(upd.to_s).to include 'wrong_mnemonic' - end - - it 'Cannot update_passphrase with wrong mnemonic_second_factor' do - w = SHELLEY.wallets - mnemonics = CW.utils.mnemonic_sentence(24) - mnemonic_second_factor = CW.utils.mnemonic_sentence(12) - wrong_mnemonic_second_factor = CW.utils.mnemonic_sentence(12) - id = create_shelley_wallet('Wallet', mnemonics, mnemonic_second_factor) - upd = w.update_passphrase(id, { mnemonic_sentence: mnemonics, - mnemonic_second_factor: wrong_mnemonic_second_factor, - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 403 - expect(upd.to_s).to include 'wrong_mnemonic' - end - - it 'Cannot update_passphrase of wallet from pub key' do - payload = { name: 'Wallet from pub key', - account_public_key: 'b47546e661b6c1791452d003d375756dde6cac2250093ce4630f16b9b9c0ac87411337bda4d5bc0216462480b809824ffb48f17e08d95ab9f1b91d391e48e66b', - address_pool_gap: 20 } - wallet = WalletFactory.create(:shelley, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - upd = SHELLEY.wallets.update_passphrase(wid, { old_passphrase: 'Secure Passphrase', - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 403 - expect(upd.to_s).to include 'no_root_key' - end - - it 'Can update_passphrase of wallet from pub key using mnemonics from which pub key is derived' do - mnemonics = CW.utils.mnemonic_sentence(24) - root_xsk = CA.prv_key_from_recovery_phrase(mnemonics, 'Shelley') - acct_key = CA.key_child(root_xsk, '1852H/1815H/0H') - pub_key = CA.key_public(acct_key) - acc_pub_key_base16 = bech32_to_base16(pub_key) - - payload = { name: 'Wallet from pub key', - account_public_key: acc_pub_key_base16, - address_pool_gap: 20 } - wallet = WalletFactory.create(:shelley, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - - # I can update passphrase using mnemonics - upd = SHELLEY.wallets.update_passphrase(wid, { mnemonic_sentence: mnemonics, - new_passphrase: 'Secure Passphrase' }) - expect(upd).to be_correct_and_respond 204 - - # Once password is set I can perform passphrase-protected operations, - # like update passphrase using old passprase - upd2 = SHELLEY.wallets.update_passphrase(wid, { old_passphrase: 'Secure Passphrase', - new_passphrase: 'Securer Passphrase' }) - expect(upd2).to be_correct_and_respond 204 - end - - it 'Cannot update_passphrase of wallet from pub key using wrong mnemonics' do - mnemonics = CW.utils.mnemonic_sentence(24) - root_xsk = CA.prv_key_from_recovery_phrase(mnemonics, 'Shelley') - acct_key = CA.key_child(root_xsk, '1852H/1815H/0H') - pub_key = CA.key_public(acct_key) - acc_pub_key_base16 = bech32_to_base16(pub_key) - - payload = { name: 'Wallet from pub key', - account_public_key: acc_pub_key_base16, - address_pool_gap: 20 } - wallet = WalletFactory.create(:shelley, payload) - expect(wallet).to be_correct_and_respond 201 - - wid = wallet['id'] - wrong_mnemonics = CW.utils.mnemonic_sentence(24) - upd = SHELLEY.wallets.update_passphrase(wid, { mnemonic_sentence: wrong_mnemonics, - new_passphrase: 'Securer Passphrase' }) - expect(upd).to be_correct_and_respond 403 - expect(upd.to_s).to include 'wrong_mnemonic' - end - end - - it 'Can see utxo' do - id = create_shelley_wallet - utxo = SHELLEY.wallets.utxo(id) - expect(utxo).to be_correct_and_respond 200 - end - - it 'Can see utxo snapshot' do - id = create_shelley_wallet - utxo = SHELLEY.wallets.utxo_snapshot(id) - expect(utxo).to be_correct_and_respond 200 - end - end - - describe CardanoWallet::Shelley::Addresses do - it 'Can list addresses' do - id = create_shelley_wallet - shelley_addr = SHELLEY.addresses - addresses = shelley_addr.list id - expect(addresses).to be_correct_and_respond 200 - expect(addresses.size).to eq 20 - addresses.each_with_index do |a, i| - expect(a['derivation_path']).to eq ['1852H', '1815H', '0H', '0', i.to_s] - end - - addresses_unused = shelley_addr.list id, { state: 'used' } - expect(addresses_unused).to be_correct_and_respond 200 - expect(addresses_unused.size).to eq 0 - - addresses_unused = shelley_addr.list id, { state: 'unused' } - expect(addresses_unused).to be_correct_and_respond 200 - expect(addresses_unused.size).to eq 20 - addresses_unused.each_with_index do |a, i| - expect(a['derivation_path']).to eq ['1852H', '1815H', '0H', '0', i.to_s] - end - end - end - - describe CardanoWallet::Shelley::CoinSelections do - it 'I could trigger random coin selection - if had money' do - wid = create_shelley_wallet - addresses = SHELLEY.addresses.list(wid) - addr_amount = [ - { addresses[0]['id'] => MIN_UTXO_VALUE_PURE_ADA }, - { addresses[1]['id'] => MIN_UTXO_VALUE_PURE_ADA } - ] - - rnd = SHELLEY.coin_selections.random wid, addr_amount - expect(rnd).to be_correct_and_respond 403 - expect(rnd.to_s).to include 'no_utxos_available' - end - end - - describe CardanoWallet::Shelley::Transactions do - it 'I could get a tx if I had proper id' do - wid = create_shelley_wallet - txs = SHELLEY.transactions - g = txs.get(wid, TXID) - expect(g).to be_correct_and_respond 404 - expect(g.to_s).to include 'no_such_transaction' - end - - it 'Can list transactions' do - id = create_shelley_wallet - txs = SHELLEY.transactions - expect(txs.list(id)).to be_correct_and_respond 200 - expect(txs.list(id, { max_count: 1 })).to be_correct_and_respond 200 - expect(txs.list(id, { start: '2012-09-25T10:15:00Z', - end: '2016-11-21T10:15:00Z', - order: 'ascending', - max_count: 10 })).to be_correct_and_respond 200 - expect(txs.list(id, { order: 'bad_order' })).to be_correct_and_respond 400 - expect(txs.list(id, { max_count: 'bad_count' })).to be_correct_and_respond 400 - end - - it 'I could create transaction - if I had money' do - id = create_shelley_wallet - target_id = create_shelley_wallet - address = SHELLEY.addresses.list(target_id)[0]['id'] - txs = SHELLEY.transactions - amt = [{ address => 1_000_000 }] - - tx_sent = txs.create(id, PASS, amt) - expect(tx_sent).to be_correct_and_respond 403 - expect(tx_sent.to_s).to include 'no_utxos_available' - end - - it 'I could create transaction using rewards - if I had money' do - id = create_shelley_wallet - target_id = create_shelley_wallet - address = SHELLEY.addresses.list(target_id)[0]['id'] - txs = SHELLEY.transactions - amt = [{ address => 1_000_000 }] - - tx_sent = txs.create(id, PASS, amt, 'self') - expect(tx_sent).to be_correct_and_respond 403 - expect(tx_sent.to_s).to include 'no_utxos_available' - end - - it 'I could estimate transaction fee - if I had money' do - id = create_shelley_wallet - target_id = create_shelley_wallet - address = SHELLEY.addresses.list(target_id)[0]['id'] - amt = [{ address => 1_000_000 }] - - txs = SHELLEY.transactions - - fees = txs.payment_fees(id, amt) - expect(fees).to be_correct_and_respond 403 - expect(fees.to_s).to include 'no_utxos_available' - - fees = txs.payment_fees(id, amt, 'self') - expect(fees).to be_correct_and_respond 403 - expect(fees.to_s).to include 'no_utxos_available' - - metadata = { '0' => { 'string' => 'cardano' }, - '1' => { 'int' => 14 }, - '2' => { 'bytes' => '2512a00e9653fe49a44a5886202e24d77eeb998f' }, - '3' => { 'list' => [{ 'int' => 14 }, { 'int' => 42 }, { 'string' => '1337' }] }, - '4' => { 'map' => [{ 'k' => { 'string' => 'key' }, 'v' => { 'string' => 'value' } }, - { 'k' => { 'int' => 14 }, 'v' => { 'int' => 42 } }] } } - - fees = txs.payment_fees(id, amt, 'self', metadata) - expect(fees).to be_correct_and_respond 403 - expect(fees.to_s).to include 'no_utxos_available' - end - - it 'I could forget transaction' do - id = create_shelley_wallet - txs = SHELLEY.transactions - res = txs.forget(id, TXID) - expect(res).to be_correct_and_respond 404 - end - end - - describe CardanoWallet::Shelley::StakePools do - after(:each) do - settings = CW.misc.settings - settings.update({ pool_metadata_source: 'none' }) - end - - it 'I can list stake keys' do - id = create_shelley_wallet - stake_keys = SHELLEY.stake_pools.list_stake_keys(id) - expect(stake_keys).to be_correct_and_respond 200 - expect(stake_keys['foreign'].size).to eq 0 - expect(stake_keys['ours'].size).to eq 1 - expect(stake_keys['ours'].first['stake']).to eq({ 'quantity' => 0, 'unit' => 'lovelace' }) - expect(stake_keys['none']['stake']).to eq({ 'quantity' => 0, 'unit' => 'lovelace' }) - expect(stake_keys['ours'].first['delegation']).to eq({ 'next' => [], - 'active' => - { 'status' => 'not_delegating' } }) - end - - describe 'ADP-634 - Pool metadata is updated when settings are updated', :offchain, :smash do - it 'pool_metadata_source = direct <> none' do - settings = CW.misc.settings - pools = SHELLEY.stake_pools - - s = settings.update({ pool_metadata_source: 'direct' }) - expect(s).to be_correct_and_respond 204 - - eventually "Pools have metadata when 'pool_metadata_source' => 'direct'" do - pools.list({ stake: 1000 }).any? { |p| p['metadata'] } - end - - s = settings.update({ pool_metadata_source: 'none' }) - expect(s).to be_correct_and_respond 204 - - eventually "Pools have no metadata when 'pool_metadata_source' => 'none'" do - pools.list({ stake: 1000 }).none? { |p| p['metadata'] } - end - end - - it "pool_metadata_source = #{ENV.fetch('TESTS_E2E_SMASH', nil)} <> none" do - skip 'Smash is not set up yet on preview / preprod' - settings = CW.misc.settings - pools = SHELLEY.stake_pools - s = settings.update({ pool_metadata_source: ENV.fetch('TESTS_E2E_SMASH', nil) }) - expect(s).to be_correct_and_respond 204 - - eventually "Pools have metadata when 'pool_metadata_source' => '#{ENV.fetch('TESTS_E2E_SMASH', nil)}'" do - pools.list({ stake: 1000 }).any? { |p| p['metadata'] } - end - - s = settings.update({ pool_metadata_source: 'none' }) - expect(s).to be_correct_and_respond 204 - - eventually "Pools have no metadata when 'pool_metadata_source' => 'none'" do - pools.list({ stake: 1000 }).none? { |p| p['metadata'] } - end - end - end - - describe 'Stake Pools GC Maintenance' do - matrix = [{ 'direct' => 'not_applicable' }, - { 'none' => 'not_applicable' }] - matrix.each do |tc| - it "GC metadata maintenance action on metadata source #{tc}" do - settings = CW.misc.settings - pools = SHELLEY.stake_pools - - s = settings.update({ pool_metadata_source: tc.keys.first }) - expect(s).to be_correct_and_respond 204 - - t = pools.trigger_maintenance_actions({ maintenance_action: 'gc_stake_pools' }) - expect(t).to be_correct_and_respond 204 - - eventually "Maintenance action has status = #{tc.values.first}" do - r = pools.view_maintenance_actions - (r.code == 200) && (r.to_s.include? tc.values.first) - end - end - end - end - describe 'Stake Pools GC Maintenance' do - matrix = [{ ENV.fetch('TESTS_E2E_SMASH', nil) => 'has_run' }] - matrix.each do |tc| - it "GC metadata maintenance action on metadata source #{tc}" do - pending "GC metadata maintenance action on metadata source #{ENV.fetch('TESTS_E2E_SMASH', nil)}" - settings = CW.misc.settings - pools = SHELLEY.stake_pools - - s = settings.update({ pool_metadata_source: tc.keys.first }) - expect(s).to be_correct_and_respond 204 - - t = pools.trigger_maintenance_actions({ maintenance_action: 'gc_stake_pools' }) - expect(t).to be_correct_and_respond 204 - - eventually "Maintenance action has status = #{tc.values.first}" do - r = pools.view_maintenance_actions - (r.code == 200) && (r.to_s.include? tc.values.first) - end - end - end - end - it 'I could quit stake pool - if I was delegating' do - id = create_shelley_wallet - - pools = SHELLEY.stake_pools - quit = pools.quit(id, PASS) - expect(quit).to be_correct_and_respond 403 - expect(quit.to_s).to include 'not_delegating_to' - end - end - - describe CardanoWallet::Shelley::Migrations do - it 'I could create migration plan' do - id = create_shelley_wallet - target_id = create_shelley_wallet - addrs = SHELLEY.addresses.list(target_id).map { |a| a['id'] } - - plan = SHELLEY.migrations.plan(id, addrs) - expect(plan).to be_correct_and_respond 403 - expect(plan.to_s).to include 'nothing_to_migrate' - end - - it 'I could migrate all my funds' do - id = create_shelley_wallet - target_id = create_shelley_wallet - addrs = SHELLEY.addresses.list(target_id).map { |a| a['id'] } - migr = SHELLEY.migrations.migrate(id, PASS, addrs) - expect(migr).to be_correct_and_respond 403 - expect(migr.to_s).to include 'nothing_to_migrate' - end - end - - describe CardanoWallet::Shelley::Keys do - it 'Get signed metadata' do - wid = create_shelley_wallet - %w[utxo_internal utxo_external mutable_account].each do |role| - id = [*0..100_000].sample - res = SHELLEY.keys.sign_metadata(wid, - role, - id, - 'Secure Passphrase', - { '0' => { 'string' => 'cardano' } }) - puts "#{wid}/#{role}/#{id}" - expect(res).to respond_with 200 - end - end - - it 'Get public key' do - wid = create_shelley_wallet - %w[utxo_internal utxo_external mutable_account].each do |role| - id = [*0..100_000].sample - res = SHELLEY.keys.get_public_key(wid, role, id) - puts "#{wid}/#{role}/#{id}" - expect(res).to be_correct_and_respond 200 - end - end - - it 'Create account public key - extended' do - m24 = CW.utils.mnemonic_sentence(24) - wid = create_shelley_wallet('Wallet', m24) - %w[0H 1H 2147483647H 44H].each do |index| - payload = { passphrase: PASS, format: 'extended' } - res = SHELLEY.keys.create_acc_public_key(wid, index, payload) - expect(res).to be_correct_and_respond 202 - expect(res.parsed_response).to eq cardano_address_get_acc_xpub(m24, - "1852H/1815H/#{index}", - 'Shelley', - '--with-chain-code', - hex: false) - end - end - - it 'Create account public key - non_extended' do - m24 = CW.utils.mnemonic_sentence(24) - wid = create_shelley_wallet('Wallet', m24) - %w[0H 1H 2147483647H 44H].each do |index| - payload = { passphrase: PASS, format: 'non_extended' } - res = SHELLEY.keys.create_acc_public_key(wid, index, payload) - expect(res.parsed_response).to eq cardano_address_get_acc_xpub(m24, - "1852H/1815H/#{index}", - 'Shelley', - '--without-chain-code', - hex: false) - end - end - - it 'Create account public key - extended with purpose' do - m24 = CW.utils.mnemonic_sentence(24) - wid = create_shelley_wallet('Wallet', m24) - %w[0H 1H 2147483647H 1854H].each do |index_purpose| - payload = { passphrase: PASS, format: 'extended', purpose: index_purpose } - res = SHELLEY.keys.create_acc_public_key(wid, index_purpose, payload) - expect(res).to be_correct_and_respond 202 - type_for_cardano_address = index_purpose == '1854H' ? 'Shared' : 'Shelley' - expect(res.parsed_response).to eq cardano_address_get_acc_xpub(m24, - "#{index_purpose}/1815H/#{index_purpose}", - type_for_cardano_address, - '--with-chain-code', - hex: false) - end - end - - it 'Create account public key - non_extended with purpose' do - m24 = CW.utils.mnemonic_sentence(24) - wid = create_shelley_wallet('Wallet', m24) - %w[0H 1H 2147483647H 1854H].each do |index_purpose| - payload = { passphrase: PASS, format: 'non_extended', purpose: index_purpose } - res = SHELLEY.keys.create_acc_public_key(wid, index_purpose, payload) - expect(res).to be_correct_and_respond 202 - type_for_cardano_address = index_purpose == '1854H' ? 'Shared' : 'Shelley' - expect(res.parsed_response).to eq cardano_address_get_acc_xpub(m24, - "#{index_purpose}/1815H/#{index_purpose}", - type_for_cardano_address, - '--without-chain-code', - hex: false) - end - end - - it 'Get account public key - wallet from acc pub key' do - payload = { name: 'Wallet from pub key 2', - account_public_key: 'b47546e661b6c1791452d003d375756dde6cac2250093ce4630f16b9b9c0ac87411337bda4d5bc0216462480b809824ffb48f17e08d95ab9f1b91d391e48e66b', - address_pool_gap: 20 } - wallet = WalletFactory.create(:shelley, payload) - expect(wallet).to be_correct_and_respond 201 - - res = SHELLEY.keys.get_acc_public_key(wallet['id'], { format: 'non_extended' }) - expect(res).to be_correct_and_respond 200 - expect(res.parsed_response).to include 'acct_vk' - end - - it 'Get account public key - wallet from mnemonics' do - m24 = CW.utils.mnemonic_sentence(24) - wid = create_shelley_wallet('Wallet', m24) - - # Get account pub key from the wallet - w_acct_key = SHELLEY.keys.get_acc_public_key(wid, { format: 'extended' }) - expect(w_acct_key).to be_correct_and_respond 200 - - # Get equivalent account pub key using cardano-addresses - root_xsk = CA.prv_key_from_recovery_phrase(m24, 'Shelley') - acct_key = CA.key_child(root_xsk, '1852H/1815H/0H') - pub_key = CA.key_public(acct_key) - - expect(pub_key).to eq w_acct_key.parsed_response - end - - it 'Get account public key (mnemonic_snd_factor)' do - m24 = CW.utils.mnemonic_sentence(24) - m12 = CW.utils.mnemonic_sentence(12) - wid = create_shelley_wallet('Wallet', m24, m12) - - # Get account pub key from the wallet - w_acct_key = SHELLEY.keys.get_acc_public_key(wid, { format: 'extended' }) - expect(w_acct_key).to be_correct_and_respond 200 - - # Get equivalent account pub key using cardano-addresses - pub_key = Dir.mktmpdir do |dir| - sndfactor_file = File.join(dir, 'sndfactor.prv') - File.write(sndfactor_file, m12.join(' ')) - root_xsk = CA.prv_key_from_recovery_phrase(m24, "Shelley --passphrase from-mnemonic --from-file #{sndfactor_file}") - acct_key = CA.key_child(root_xsk, '1852H/1815H/0H') - CA.key_public(acct_key) - end - - expect(pub_key).to eq w_acct_key.parsed_response - end - - it "I can create and get policy key and it's hash" do - wid = create_shelley_wallet - created = SHELLEY.keys.create_policy_key(wid, PASS, { hash: true }) - expect(created).to be_correct_and_respond 202 - expect(created.to_s).to include 'policy_vkh' - - get = SHELLEY.keys.get_policy_key(wid, { hash: true }) - expect(get).to be_correct_and_respond 200 - - expect(get.to_s).to eq created.to_s - - created = SHELLEY.keys.create_policy_key(wid, PASS) - expect(created).to be_correct_and_respond 202 - expect(created.to_s).to include 'policy_vk' - expect(created.to_s).not_to include 'policy_vkh' - - get = SHELLEY.keys.get_policy_key(wid) - expect(get).to be_correct_and_respond 200 - - expect(get.to_s).to eq created.to_s - end - - describe 'Policy Id' do - matrix = [ - ['cosigner#0', 202], - [{ all: ['cosigner#0'] }, 202], - [{ any: ['cosigner#0'] }, 202], - [{ some: { at_least: 1, from: ['cosigner#0'] } }, 202], - [{ all: ['cosigner#0', { active_from: 120 }] }, 202], - ['cosigner#1', 403], - [{ all: ['cosigner#0', 'cosigner#1'] }, 403] - ] - matrix.each do |m| - template = m[0] - code = m[1] - it "Script template = #{template} gives #{code}" do - wid = create_shelley_wallet - created = SHELLEY.keys.create_policy_id(wid, template) - expect(created).to be_correct_and_respond code - end - end - end - end -end diff --git a/test/e2e/spec/spec_helper.rb b/test/e2e/spec/spec_helper.rb deleted file mode 100644 index def8b80e298..00000000000 --- a/test/e2e/spec/spec_helper.rb +++ /dev/null @@ -1,683 +0,0 @@ -# frozen_string_literal: true - -require 'bundler/setup' -require 'cardano_wallet' -require 'base64' -require 'blake2b' -require 'mustache' -require 'cbor' -require 'tmpdir' -require 'set' -require_relative '../env' -require_relative '../helpers/utils' -require_relative '../helpers/tx_history' -require_relative '../helpers/matchers' -require_relative '../helpers/context' -require_relative '../helpers/wallet_factory' -require_relative '../helpers/cardano_addresses' -require_relative '../helpers/cardano_cli' - -include Helpers::Utils -include TxHistory - -RSpec.configure do |config| - # Enable flags like --only-failures and --next-failure - config.example_status_persistence_file_path = '.rspec_status' - - # Disable RSpec exposing methods globally on `Module` and `main` - config.disable_monkey_patching! - - config.expect_with :rspec do |c| - c.syntax = :expect - c.max_formatted_output_length = nil - end -end - -# Helpers - -## -# timeout in seconds for custom verifications -TIMEOUT = 600 -FIXTURES_DIR = 'fixtures' - -## -# Intit cardano-wallet wrapper with timeout for getting the response back -CW = CardanoWallet.new({ timeout: TIMEOUT, port: ENV['WALLET_PORT'].to_i }) -BYRON = CW.byron -SHELLEY = CW.shelley -SHARED = CW.shared -SETTINGS = CW.misc.settings -UTILS = CW.misc.utils -NETWORK = CW.misc.network -PROXY = CW.misc.proxy -NODE = CW.misc.node -CA = CardanoAddresses.new - -CONTEXT = Context.new -CONTEXT.env = ENV.fetch('NETWORK', nil) - -CARDANO_CLI = CardanoCli.new(get_protocol_magic(CONTEXT.env)) - -## -# default passphrase for wallets -PASS = 'Secure Passphrase' - -## -# Artificial, non-existing id's -TXID = '1acf9c0f504746cbd102b49ffaf16dcafd14c0a2f1bbb23af265fbe0a04951cc' -SPID = 'feea59bc6664572e631e9adfee77142cb51264156debf2e52970cc00' -SPID_BECH32 = 'pool1v7g9ays8h668d74xjvln9xuh9adzh6xz0v0hvcd3xukpck5z56d' -DEV_NULL_ADDR = 'addr_test1qp760qtlwv6cyvvkpz3a6s0y72aea4xd4da85rm5qe2u6awgscyn6cz7plwgtanjanvpg9xt4lc3wlrqhcw5cmxk334q0wca8l' - -# exemplary metadata -METADATA = { '0' => { 'string' => 'cardano' }, - '1' => { 'int' => 14 }, - '2' => { 'bytes' => '2512a00e9653fe49a44a5886202e24d77eeb998f' }, - '3' => { 'list' => [{ 'int' => 14 }, { 'int' => 42 }, { 'string' => '1337' }] }, - '4' => { 'map' => [{ 'k' => { 'string' => 'key' }, 'v' => { 'string' => 'value' } }, - { 'k' => { 'int' => 14 }, 'v' => { 'int' => 42 } }] } }.freeze - -# Testnet assets with metadata from mock server https://metadata.world.dev.cardano.org/ -ASSETS = [{ 'policy_id' => 'ee1ce9d7560f48a4ba3867037dbec2d8fed776d94dd6b00a35309073', - 'asset_name' => '', - 'fingerprint' => 'asset1s3yhz885gnyu2wcpz5h275u37hw3axz3c9sfqu', - 'metadata' => { 'name' => 'SadCoin', - 'description' => 'Coin with no asset name', - 'url' => 'https://sad.io', - 'ticker' => 'SAD', - 'logo' => 'iVBORw0KGgoAAAANSUhEUgAAABkAAAAeCAYAAADZ7LXbAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACbUlEQVRIie3Vy0tUURzA8e855965c8lXUhlhEQVBSEmQRAURQbSIEqFl4N6/oHYtAhdtonatK8hVBCERZC+0jbZpIRVkIeagTJrO3Nd5tBhDMHOcGiHCA2dxHvDh9zs/fkc45xwbPORGA5tI/RFdGCL9MgAm/mNEVKuuaHA3OW+RlDb8zjt4O07VjFRPV8NBZC5PGMxj3/YQv7uGs7p+iJ5+ipgfIZr7hnWSXBjgT98iHr6IS+fqg7h0Dl8ZQpmQFKdJSmWkkuSj10TD3WCzv0f89m6S8BjWQehbVDpPWiojsASlEeLxG3WIJFtANneQei3EqpnMeWRxgtMahYGP/dhoqiry2+rKJh9i3l8l2KIRUlVQazDlRXTpOzIr43uQ7LlCvrO/9kjisT7Ehz6CBgtCki4sEC+ALpdQQUC+qQmXC3EO3NQAsHaP/QVx1mBnh5BKYpOYON2L6npJ/sw4svMRacmCc+TyOQwKGX/CRl9rQ4SQyPZeFqM27L7bhCcHUY37AVCtR7EtZ8EZhLN4vkIKhy1N1Ibo4ijq83UavAl04QmIFVekB1aDNQhnQFBZ14KABauRaFThHrrwbPmkPImYeQw6A5OBNRjnIxsPrIl4KzdUcwep9SFL8JVHNnqJeFcvyBCm7hJQBKPBZJWH334eGe5cE1m1hKM3l8nP3kcICVLiEEuXLfycQKpBnnhRtWmuWsLBkZtEucNYa8BkCJMiTFrJ/RLgHJjWc+vqyqsiMthGePo5SWsP2ohKWpamdZBqQbz1AvnjD6oCsI7/RM+8whTHljf8RrzWLlTLoXUB60LqMf6NP34T+T+RH/HOKLJ+ho1iAAAAAElFTkSuQmCC' } }, - { 'policy_id' => '919e8a1922aaa764b1d66407c6f62244e77081215f385b60a6209149', - 'asset_name' => asset_name('HappyCoin'), - 'fingerprint' => 'asset19mwamgpre24at3z34v2e5achszlhhqght9djqp', - 'metadata' => { 'name' => 'HappyCoin', - 'description' => 'Coin with asset name - and everyone is happy!!!', - 'url' => 'https://happy.io', - 'decimals' => 6, - 'ticker' => 'HAPP', - 'logo' => 'iVBORw0KGgoAAAANSUhEUgAAABkAAAAeCAYAAADZ7LXbAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACbUlEQVRIie3Vy0tUURzA8e855965c8lXUhlhEQVBSEmQRAURQbSIEqFl4N6/oHYtAhdtonatK8hVBCERZC+0jbZpIRVkIeagTJrO3Nd5tBhDMHOcGiHCA2dxHvDh9zs/fkc45xwbPORGA5tI/RFdGCL9MgAm/mNEVKuuaHA3OW+RlDb8zjt4O07VjFRPV8NBZC5PGMxj3/YQv7uGs7p+iJ5+ipgfIZr7hnWSXBjgT98iHr6IS+fqg7h0Dl8ZQpmQFKdJSmWkkuSj10TD3WCzv0f89m6S8BjWQehbVDpPWiojsASlEeLxG3WIJFtANneQei3EqpnMeWRxgtMahYGP/dhoqiry2+rKJh9i3l8l2KIRUlVQazDlRXTpOzIr43uQ7LlCvrO/9kjisT7Ehz6CBgtCki4sEC+ALpdQQUC+qQmXC3EO3NQAsHaP/QVx1mBnh5BKYpOYON2L6npJ/sw4svMRacmCc+TyOQwKGX/CRl9rQ4SQyPZeFqM27L7bhCcHUY37AVCtR7EtZ8EZhLN4vkIKhy1N1Ibo4ijq83UavAl04QmIFVekB1aDNQhnQFBZ14KABauRaFThHrrwbPmkPImYeQw6A5OBNRjnIxsPrIl4KzdUcwep9SFL8JVHNnqJeFcvyBCm7hJQBKPBZJWH334eGe5cE1m1hKM3l8nP3kcICVLiEEuXLfycQKpBnnhRtWmuWsLBkZtEucNYa8BkCJMiTFrJ/RLgHJjWc+vqyqsiMthGePo5SWsP2ohKWpamdZBqQbz1AvnjD6oCsI7/RM+8whTHljf8RrzWLlTLoXUB60LqMf6NP34T+T+RH/HOKLJ+ho1iAAAAAElFTkSuQmCC' } }].freeze - -## -# Since alonzo min_utxo_value is calculated based on the particular output size -# 1 ADA, however should be enough for sending pure Ada output to shelley address -# setting it to 2 ADA temporarily because of: -# ADP-2298 - Deposit_returned is falsely reported on some incoming transactions (intermittently) -MIN_UTXO_VALUE_PURE_ADA = 2_000_000 - -def payment_payload(amt, addr = DEV_NULL_ADDR) - [{ :address => addr, - :amount => { :quantity => amt, - :unit => 'lovelace' } }] -end - -def create_incomplete_shared_wallet(m, acc_ix, acc_xpub) - script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub }, - 'template' => - { 'all' => - ['cosigner#0', - 'cosigner#1'] } } - pscript = script_template - dscript = script_template - payload = if m.is_a? Array - { mnemonic_sentence: m, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: pscript, - delegation_script_template: dscript } - else - { account_public_key: m, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: pscript, - delegation_script_template: dscript } - end - WalletFactory.create(:shared, payload)['id'] -end - -def shared_acc_pubkey(wallet_id) - SHARED.keys.get_acc_public_key(wallet_id, { format: 'extended' }).parsed_response.delete_prefix('"').delete_suffix('"') -end - -def patch_incomplete_shared_wallet(wid, payment_patch, deleg_patch) - if payment_patch - p_upd = SHARED.wallets.update_payment_script(wid, - payment_patch.keys.first, - payment_patch.values.first) - expect(p_upd).to be_correct_and_respond 200 - end - - return unless deleg_patch - - d_upd = SHARED.wallets.update_delegation_script(wid, - deleg_patch.keys.first, - deleg_patch.values.first) - expect(d_upd).to be_correct_and_respond 200 -end - -def patch_if_incomplete(wid, payment_patch, deleg_patch) - if payment_patch - p_upd = SHARED.wallets.update_payment_script(wid, - payment_patch.keys.first, - payment_patch.values.first) - case p_upd.code - when 200 - expect(p_upd).to be_correct_and_respond 200 - when 403 - expect(p_upd).to be_correct_and_respond 403 - expect(p_upd.parsed_response['code']).to eq 'shared_wallet_active' - end - end - - return unless deleg_patch - - d_upd = SHARED.wallets.update_delegation_script(wid, - deleg_patch.keys.first, - deleg_patch.values.first) - case d_upd.code - when 200 - expect(d_upd).to be_correct_and_respond 200 - when 403 - expect(d_upd).to be_correct_and_respond 403 - expect(d_upd.parsed_response['code']).to eq 'shared_wallet_active' - end -end - -def create_active_shared_wallet(m, acc_ix, acc_xpub) - script_template = { 'cosigners' => - { 'cosigner#0' => acc_xpub }, - 'template' => - { 'all' => - ['cosigner#0'] } } - pscript = script_template - dscript = script_template - payload = if m.is_a? Array - { mnemonic_sentence: m, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: pscript, - delegation_script_template: dscript } - else - { account_public_key: m, - passphrase: PASS, - name: 'Shared wallet', - account_index: acc_ix, - payment_script_template: pscript, - delegation_script_template: dscript } - end - - WalletFactory.create(:shared, payload)['id'] -end - -def wait_for_shared_wallet_to_sync(wid) - puts 'Syncing Shared wallet...' - retry_count = 10 - begin - while SHARED.wallets.get(wid)['state']['status'].to_s == 'syncing' - w = SHARED.wallets.get(wid) - puts " Syncing... #{w['state']['progress']['quantity'].to_i}%" if w['state']['progress'] - sleep 5 - end - rescue StandardError - puts "Retry #{retry_count}" - retry_count -= 1 - puts "SHARED.wallets.get(#{wid}) returned:" - puts SHARED.wallets.get(wid) - retry if retry_count > 0 - end -end - -def wait_for_all_shared_wallets(wids) - wids.each do |w| - wait_for_shared_wallet_to_sync(w) - end -end - -def create_shelley_wallet(name = 'Wallet from mnemonic_sentence', - mnemonic_sentence = CW.utils.mnemonic_sentence(24), - mnemonic_second_factor = nil) - payload = { name: name, - passphrase: PASS, - mnemonic_sentence: mnemonic_sentence } - payload[:mnemonic_second_factor] = mnemonic_second_factor if mnemonic_second_factor - WalletFactory.create(:shelley, payload)['id'] -end - -def wait_for_shelley_wallet_to_sync(wid) - puts 'Syncing Shelley wallet...' - retry_count = 10 - begin - while SHELLEY.wallets.get(wid)['state']['status'].to_s == 'syncing' - w = SHELLEY.wallets.get(wid) - puts " Syncing... #{w['state']['progress']['quantity'].to_i}%" if w['state']['progress'] - sleep 5 - end - rescue StandardError - puts "Retry #{retry_count}" - retry_count -= 1 - puts "SHELLEY.wallets.get(#{wid}) returned:" - puts w - retry if retry_count > 0 - end -end - -def wait_for_all_shelley_wallets(wids) - wids.each do |w| - wait_for_shelley_wallet_to_sync(w) - end -end - -def create_byron_wallet(style = 'random', - name = 'Wallet from mnemonic_sentence', - mnemonics = CW.utils.mnemonic_sentence(24)) - payload = { style: style, - name: name, - passphrase: PASS, - mnemonic_sentence: mnemonics } - WalletFactory.create(:byron, payload)['id'] -end - -def wait_for_byron_wallet_to_sync(wid) - puts 'Syncing Byron wallet...' - retry_count = 10 - begin - while BYRON.wallets.get(wid)['state']['status'].to_s == 'syncing' - w = BYRON.wallets.get(wid) - puts " Syncing... #{w['state']['progress']['quantity'].to_i}%" if w['state']['progress'] - sleep 5 - end - rescue StandardError - puts "Retry #{retry_count}" - retry_count -= 1 - puts "BYRON.wallets.get(#{wid}) returned:" - puts BYRON.wallets.get(wid) - retry if retry_count > 0 - end -end - -def wait_for_all_byron_wallets(wids) - wids.each do |w| - wait_for_byron_wallet_to_sync(w) - end -end - -## FIXTURE AND TARGET WALLETS ## - -## -# return wallet id from create wallet response even if it already exists -def return_wallet_id(create_wallet_response) - if create_wallet_response.code == 409 - create_wallet_response['message'].split[10] - else - create_wallet_response['id'] - end -end - -## -# create fixture wallet or return it's id if it exists -# @param type [Symbol] :shelley, :shared, :shared_cosigner_0, :shared_cosigner_1, :random, :icarus -# @param templates [Symbols] ':payment_cosigner{0,1}_{all,any,all0}', :delegation_cosigner{0,1}_{all,any,all0} -# rubocop:disable Metrics/CyclomaticComplexity -def create_fixture_wallet(type, *templates) - payload = { name: "Fixture wallet with funds (#{type}#{" #{templates}" unless templates.empty?}", - passphrase: PASS, - mnemonic_sentence: get_fixture_wallet(:fixture, type.to_sym, :mnemonics) } - case type.to_sym - when :shelley - wallet = SHELLEY.wallets.create(payload) - return_wallet_id(wallet) - when :random, :icarus - payload[:style] = type - wallet = BYRON.wallets.create(payload) - return_wallet_id(wallet) - when :shared, :shared2 - templates.each do |t| - case t - when :payment_cosigner0_all - payload[:payment_script_template] = { 'cosigners' => { 'cosigner#0' => 'self' }, 'template' => { 'all' => ['cosigner#0', 'cosigner#1'] } } - when :delegation_cosigner0_all - payload[:delegation_script_template] = { 'cosigners' => { 'cosigner#0' => 'self' }, 'template' => { 'all' => ['cosigner#0', 'cosigner#1'] } } - when :payment_cosigner1_all - payload[:payment_script_template] = { 'cosigners' => { 'cosigner#1' => 'self' }, 'template' => { 'all' => ['cosigner#0', 'cosigner#1'] } } - when :delegation_cosigner1_all - payload[:delegation_script_template] = { 'cosigners' => { 'cosigner#1' => 'self' }, 'template' => { 'all' => ['cosigner#0', 'cosigner#1'] } } - when :payment_cosigner0_any - payload[:payment_script_template] = { 'cosigners' => { 'cosigner#0' => 'self' }, 'template' => { 'any' => ['cosigner#0', 'cosigner#1'] } } - when :delegation_cosigner0_any - payload[:delegation_script_template] = { 'cosigners' => { 'cosigner#0' => 'self' }, 'template' => { 'any' => ['cosigner#0', 'cosigner#1'] } } - when :payment_cosigner1_any - payload[:payment_script_template] = { 'cosigners' => { 'cosigner#1' => 'self' }, 'template' => { 'any' => ['cosigner#0', 'cosigner#1'] } } - when :delegation_cosigner1_any - payload[:delegation_script_template] = { 'cosigners' => { 'cosigner#1' => 'self' }, 'template' => { 'any' => ['cosigner#0', 'cosigner#1'] } } - when :payment_cosigner0_all0 - payload[:payment_script_template] = { 'cosigners' => { 'cosigner#0' => 'self' }, 'template' => { 'all' => ['cosigner#0'] } } - when :delegation_cosigner0_all0 - payload[:delegation_script_template] = { 'cosigners' => { 'cosigner#0' => 'self' }, 'template' => { 'all' => ['cosigner#0'] } } - end - end - payload[:account_index] = '0H' - wallet = SHARED.wallets.create(payload) - return_wallet_id(wallet) - else - raise "Unsupported wallet type: #{type}" - end -end -# rubocop:enable Metrics/CyclomaticComplexity - -## -# create target wallet or return it's id if it exists -# @param type [Symbol] :shelley, :shared -def create_target_wallet(type) - payload = { name: 'Target wallet for txs', - passphrase: PASS, - mnemonic_sentence: get_fixture_wallet(:target, type.to_sym, :mnemonics) } - case type.to_sym - when :shelley - wallet = SHELLEY.wallets.create(payload) - return_wallet_id(wallet) - else - raise "Unsupported wallet type: #{type}" - end -end - -## -# wait until action passed as &block returns true or TIMEOUT is reached -def eventually(label, &block) - current_time = Time.now - timeout_treshold = current_time + TIMEOUT - while (block.call == false) && (current_time <= timeout_treshold) - sleep 5 - current_time = Time.now - end - raise "Action '#{label}' did not resolve within timeout: #{TIMEOUT}s" if current_time > timeout_treshold -end - -def teardown - CONTEXT.byron.dup.each do |wid| - WalletFactory.delete(:byron, wid) - end - - CONTEXT.shelley.dup.each do |wid| - WalletFactory.delete(:shelley, wid) - end - - CONTEXT.shared.dup.each do |wid| - WalletFactory.delete(:shared, wid) - end -end - -## -# return asset total or available balance for comparison -# @param [Hash] assets - asset balance Hash from the wallet (output of get_wallet_balances['assets_*']) -# @param [Hash] options - -# options[:delta] [Int] - received/sent assets that we are expecting (default: 0) -# options[:assets_to_check] [Array] - limit looking up balance to only assets in the array ["#{policy_id}#{asset_name}",...] (default: nil) -# @return [Set] Set of Hashes {"#{policy_id}#{asset_name}" => balance} -def assets_balance(assets, options = {}) - options[:delta] ||= 0 - assets_to_check = options[:assets_to_check] - - asset_set = assets.to_set { |x| { "#{x['policy_id']}#{x['asset_name']}" => x['quantity'] + options[:delta] } } - if assets_to_check - asset_set.select { |a| assets_to_check.include? a.keys.first }.to_set - else - asset_set - end -end - -## -# return ada and asset accounts balance for wallet -# identified by wallet_api -def get_wallet_balances(wid, wallet_api) - w = wallet_api.wallets.get(wid) - total = w['balance']['total']['quantity'] - available = w['balance']['available']['quantity'] - reward = w['balance']['reward']['quantity'] - assets_total = w['assets']['total'] - assets_available = w['assets']['available'] - { 'total' => total, - 'available' => available, - 'rewards' => reward, - 'assets_available' => assets_available, - 'assets_total' => assets_total } -end - -def get_shelley_balances(wid) - get_wallet_balances(wid, SHELLEY) -end - -def get_shared_balances(wid) - get_wallet_balances(wid, SHARED) -end - -def get_byron_balances(wid) - w = BYRON.wallets.get(wid) - total = w['balance']['total']['quantity'] - available = w['balance']['available']['quantity'] - assets_total = w['assets']['total'] - assets_available = w['assets']['available'] - { 'total' => total, - 'available' => available, - 'assets_available' => assets_available, - 'assets_total' => assets_total } -end - -## -# verify ADA balance on src and target wallets after transaction for amt ADA -# incurring fee ADA -def verify_ada_balance(src_after, src_before, target_after, target_before, amt, fee) - expect(target_after['available']).to eq(amt + target_before['available']) - expect(target_after['total']).to eq(amt + target_before['total']) - - expect(src_after['available']).to eq(src_before['available'] - amt - fee) - expect(src_after['total']).to eq(src_before['total'] - amt - fee) -end - -## -# Verify assets balance on target and src wallets after transaction -# @params src_after, src_before, target_after, target_before - src and target wallet balances before and after tx -# @param [Int] amt - amt of assets sent in tx -# @param [Array] assets_to_check - array of assets sent in the tx in the form of ["#{policy_id}#{asset_name}",...] -def verify_asset_balance(src_after, src_before, target_after, target_before, amt, - assets_to_check = ["#{ASSETS[0]['policy_id']}#{ASSETS[0]['asset_name']}", - "#{ASSETS[1]['policy_id']}#{ASSETS[1]['asset_name']}"]) - - target_total_after = assets_balance(target_after['assets_total'], { assets_to_check: assets_to_check }) - target_avail_after = assets_balance(target_after['assets_available'], { assets_to_check: assets_to_check }) - target_total_expected = assets_balance(target_before['assets_total'], { assets_to_check: assets_to_check, delta: +amt }) - target_avail_expected = assets_balance(target_before['assets_available'], { assets_to_check: assets_to_check, delta: +amt }) - src_total_after = assets_balance(src_after['assets_total'], { assets_to_check: assets_to_check }) - src_avail_after = assets_balance(src_after['assets_available'], { assets_to_check: assets_to_check }) - src_total_expected = assets_balance(src_before['assets_total'], { assets_to_check: assets_to_check, delta: -amt }) - src_avail_expected = assets_balance(src_before['assets_available'], { assets_to_check: assets_to_check, delta: -amt }) - - if target_before['assets_total'] == [] - target_balance_expected = assets_to_check.to_set { |a| { a => amt } } - expect(target_total_after).to eq target_balance_expected - expect(target_avail_after).to eq target_balance_expected - else - expect(target_total_after).to eq target_total_expected - expect(target_avail_after).to eq target_avail_expected - end - - expect(src_total_after).to eq src_total_expected - expect(src_avail_after).to eq src_avail_expected -end - -def wait_for_tx_in_ledger(wid, tx_id, wallet_api = SHELLEY) - eventually "Tx #{tx_id} is in ledger" do - tx = wallet_api.transactions.get(wid, tx_id) - tx.code == 200 && tx['status'] == 'in_ledger' - end -end - -def verify_tx_status(wid, tx_id, status, wallet_api = SHELLEY) - tx = wallet_api.transactions.get(wid, tx_id) - expect(tx.code).to eq(200) - expect(tx['status']).to eq(status) -end - -## Mint/burn helpers - -# Build mint payload for construct tx -def mint(asset_name, quantity, policy_script, address = nil) - mint = { 'operation' => { 'mint' => { 'quantity' => quantity } }, - 'policy_script_template' => policy_script } - mint['operation']['mint']['receiving_address'] = address unless address.nil? - mint['asset_name'] = asset_name unless asset_name.nil? - mint -end - -# Build burn payload for construct tx -def burn(asset_name, quantity, policy_script) - burn = { 'operation' => { 'burn' => { 'quantity' => quantity } }, - 'policy_script_template' => policy_script } - burn['asset_name'] = asset_name unless asset_name.nil? - burn -end - -## -# Gets assets list in the form of 'policy_id + asset_name' array -# @return [Array] - ["#{policy_id}#{asset_name}"...] of all minted/burnt assets -def get_assets_from_decode(tx_decoded_mint_or_burn) - tx_decoded_mint_or_burn['tokens'].map do |x| - assets = x['assets'].map { |z| z['asset_name'] } - assets.map { |a| "#{x['policy_id']}#{a}" } - end.flatten -end - -def get_policy_id_from_decode(tx_decoded_mint_or_burn) - tx_decoded_mint_or_burn['tokens'].first['policy_id'] -end - -## -# Balance -> Sign -> Submit -def balance_sign_submit(wid, payload) - tx_balanced = SHELLEY.transactions.balance(wid, payload) - expect(tx_balanced).to be_correct_and_respond 202 - - tx_signed = SHELLEY.transactions.sign(wid, PASS, tx_balanced['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - tx_submitted = SHELLEY.transactions.submit(wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - [tx_balanced, tx_signed, tx_submitted] -end - -## -# Construct -> Sign -> Submit -def construct_sign_submit(wid, - payments = nil, - withdrawal = nil, - metadata = nil, - delegations = nil, - mint = nil, - validity_interval = nil) - - tx_constructed = SHELLEY.transactions.construct(wid, - payments, - withdrawal, - metadata, - delegations, - mint, - validity_interval) - expect(tx_constructed).to be_correct_and_respond 202 - - tx_signed = SHELLEY.transactions.sign(wid, PASS, tx_constructed['transaction']) - expect(tx_signed).to be_correct_and_respond 202 - - tx_submitted = SHELLEY.transactions.submit(wid, tx_signed['transaction']) - expect(tx_submitted).to be_correct_and_respond 202 - - [tx_constructed, tx_signed, tx_submitted] -end - -def create_policy_key_if_not_exists(wid) - gpkey = SHELLEY.keys.get_policy_key(wid) - if gpkey.code == 403 && gpkey['code'] == 'missing_policy_public_key' - pkey = SHELLEY.keys.create_policy_key(wid, PASS) - expect(pkey).to be_correct_and_respond 202 - pkey - else - gpkey - end -end - -## -# Plutus helpers - -## -# Encode input index the way Plutus does in hex-encoded CBOR script -# _probably_ should work fine for 0-127 index range -# @param [Int] input idx -# @return [Hex] hex encoded input idx imitating Plutus bit-wise, non-standard encoding -# -# @example -# > plutus_encode_idx(43) -# => "158c" -# -# @see lib/wallet/extra/Plutus/FlatInteger.hs -# reference Haskell impl of encoding Int into sequence of bits -# @see lib/wallet/src/Test/Integration/Plutus.hs -# the way it's done in the integration tests -# ``` -# idxEncoded = toHex $ BS.pack $ Bits.asBytes -# $ toBits "00" <> Bits.bits (fromIntegral idx :: Integer) <> toBits "001100" -# ``` -def plutus_encode_idx(int) - raise 'Not supported index. (0-127) are supported.' if int > 127 - - # convert int to binary and add trailing bit - b = "#{int.to_s(2)}0" - # add additional leading bits so it is 8-bit long - b = ('0' * (8 - b.length)) + b - # add additional leading and trailing bits - b = "00#{b}001100" - # convert to hex and add leading 0's if needed (so it is 4 digit long) - h = binary_to_hex(b) - ('0' * (4 - h.length)) + h -end - -def get_simple_scripts_file_path(file) - File.join(FIXTURES_DIR, 'simple', file) -end - -def get_plutus_file_path(file) - File.join(FIXTURES_DIR, 'plutus', file) -end - -def get_plutus_tx(file) - JSON.parse(File.read(get_plutus_file_path(file))) -end - -def read_mustached_file(file, ctx = {}) - Mustache.render(File.read(get_plutus_file_path(file)), ctx).strip -end - -def get_templated_plutus_tx(file, ctx = {}) - JSON.parse(read_mustached_file(file, ctx)) -end - -## -# Get policyId of base16-encoded minting policy -# which is Blake2b (28 byte long) hash of (script tag = 0x01 + policy) -def get_policy_id(policy) - key = Blake2b::Key.none - Blake2b.hex(hex_to_bytes("01#{policy}"), key, 28) -end - -## -# Get all sent ADA amounts from the wallet from decoded tx outputs -# We assume multi output transaction -def get_sent_amts(outputs) - outputs.map { |o| o['amount']['quantity'] if o['derivation_path'].nil? } -end - -## -# The same as get_sent_amts, but we assume single output tx -def get_sent_amt(outputs) - get_sent_amts(outputs).first -end diff --git a/test/e2e/state/configs/preprod b/test/e2e/state/configs/preprod deleted file mode 120000 index f88eefd17a6..00000000000 --- a/test/e2e/state/configs/preprod +++ /dev/null @@ -1 +0,0 @@ -../../../../configs/cardano/preprod \ No newline at end of file diff --git a/tests.md b/tests.md deleted file mode 100644 index 51b3915dee7..00000000000 --- a/tests.md +++ /dev/null @@ -1,828 +0,0 @@ -# System-level Tests - -This document attempts to collect all system-level tests that are part of the cardano-wallet codebase in order to be able to consolidate testing assets into a coherent suite of tests. To this end, the plan is: - -* Collect existing Haskell integration tests and Ruby end-to-end tests -* Identify tests in the latter that are surely covered by the former -* Identify gaps, eg. existing e2e tests that do not have a counterpart as integration tests. - * For each of those gaps, decide whether or not we want to pay the cost of maintaining the test - * If the answer is yes, port the test as an Integration Tests -* Identify system-level (integration) tests who could be implemented at a lower-level, eg. as unit or component level tests, not requiring a full blown process and cardano-node to run - * Port thos tests as unit tests - -This process is expected to take time. This document will serve as a central point to track progress. - -## Categories of tests - -By _System tests_ we mean tests that depend on running external processes, possibly even servers, to run. Our Haskell "integration" tests and Ruby E2E tests fall into this category as they both rely on runnning cardano-wallet process, and cardano-node process. - -## Integration Tests - -``` -describe "SHELLEY_WALLETS" - it "WALLETS_CREATE_01 - Create a wallet" - it "WALLETS_CREATE_01.1 create a wallet restoring from tip" - describe "OWASP_INJECTION_CREATE_WALLET_01 - \ - it "WALLETS_CREATE_02 - Restored wallet preserves funds" - it "WALLETS_CREATE_03,09 - Cannot create wallet that exists" - describe "WALLETS_CREATE_04 - Wallet name" - describe "WALLETS_CREATE_05 - Mnemonics" - describe "WALLETS_CREATE_06 - Mnemonics second factor" - describe "WALLETS_CREATE_07 - Passphrase" - describe "WALLETS_CREATE_08 - address_pool_gap" - it "WALLETS_CREATE_08 - default address_pool_gap" - describe "WALLETS_CREATE_09 - HTTP headers" - it "WALLETS_CREATE_10 - Create wallet with one change address mode on" - it "WALLETS_GET_01 - can get wallet details" - it "WALLETS_GET_02, WALLETS_DELETE_01 - Deleted wallet is not available" - it "WALLETS_LIST_01 - Created a wallet can be listed" - it "WALLETS_LIST_01 - Wallets are listed from oldest to newest" - it "WALLETS_LIST_02 - Deleted wallet not listed" - it "WALLETS_UPDATE_01 - Updated wallet name is available" - describe "WALLETS_UPDATE_02 - Various names" - it "WALLETS_UPDATE_03 - Deleted wallet cannot be updated (404)" - describe "WALLETS_UPDATE_04 - HTTP headers" - it "WALLETS_UPDATE_PASS_01a - passphraseLastUpdate gets updated" - it "WALLETS_UPDATE_PASS_01b - passphraseLastUpdate gets updated, mnemonic" - it "WALLETS_UPDATE_PASS_01c - passphraseLastUpdate gets updated, mnemonic \ - describe "WALLETS_UPDATE_PASS_02 - New passphrase values" - it "WALLETS_UPDATE_PASS_03 - Old passphrase incorrect" - it "WALLETS_UPDATE_PASS_03 - Mnemonic incorrect" - describe "WALLETS_UPDATE_PASS_03 - Can update pass from pass that's boundary\ - it "WALLETS_UPDATE_PASS_04 - Deleted wallet is not available" - it "WALLETS_UPDATE_PASS_04 - Deleted wallet is not available, mnemonic" - describe "WALLETS_UPDATE_PASS_05,06 - Transaction after updating passphrase" - describe "WALLETS_UPDATE_PASS_07 - HTTP headers" - it "WALLETS_UTXO_01 - Wallet's inactivity is reflected in utxo" - it "WALLET_UTXO_SNAPSHOT_01 - \ - it "WALLET_UTXO_SNAPSHOT_02 - \ - it "WALLET_UTXO_SNAPSHOT_03 - \ - it "WALLETS_UTXO_02 - Sending and receiving funds updates wallet's utxo." - it "WALLETS_UTXO_03 - Deleted wallet is not available for utxo" - describe "WALLETS_UTXO_04 - HTTP headers" - it "WALLETS_GET_KEY_01 - golden tests for verification key" - it "WALLETS_GET_KEY_02 - invalid index for verification key" - it "WALLETS_GET_KEY_03 - unknown wallet" - it "WALLETS_SIGNATURES_01 - can verify signature" - it "WALLETS_SIGNATURES_02 - invalid index for signing key" - it "WALLETS_SIGNATURES_03 - unknown wallet" - it "BYRON_WALLETS_UTXO -\ - it "BYRON_WALLETS_UPDATE_PASS -\ - it "BYRON_WALLETS_UPDATE -\ - it "BYRON_WALLETS_GET_02 - Byron ep does not show Shelley wallet" - it "BYRON_WALLETS_GET_03 - Shelley ep does not show Byron wallet" - it "BYRON_WALLETS_LIST_02,03 - \ - it "BYRON_WALLETS_LIST_04, DELETE_01 - \ - it "BYRON_WALLETS_DELETE_02 - Byron ep does not delete Shelley wallet" - it "BYRON_WALLETS_DELETE_03 - Shelley ep does not delete Byron wallet" - it "WALLETS_NETWORK_SHELLEY - Wallet has the same tip as network/information" - -describe "No backend required" - $ describe "Miscellaneous CLI tests" MiscellaneousCLI.spec - describe "API Specifications" $ do - parallel $ describe "CLI Specifications" $ do - -spec = describe "COMMON_CLI_PORTS" - it "PORT_01 - Can't reach server with wrong port (wallet list)" - it "PORT_01 - Can't reach server with wrong port (wallet create)" - it "PORT_01 - Can't reach server with wrong port (wallet get)" - it "PORT_01 - Can't reach server with wrong port (wallet delete)" - it "PORT_01 - Can't reach server with wrong port (wallet update)" - it "PORT_01 - Can't reach server with wrong port (transction create)" - it "PORT_01 - Can't reach server with wrong port (address list)" - describe "PORT_04 - Fail nicely when port is out-of-bounds" -spec = describe "restoration of wallets" -/spec = describe "COMMON_CLI_NETWORK" - it "CLI_NETWORK - cardano-wallet network information" - it "NETWORK_PARAMS - network parameters" - it "CLI_NETWORK - network clock" - -spec = describe "BYRON_WALLETS" - it "BYRON_GET_04, DELETE_01 - Deleted wallet is not available" - it "BYRON_LIST_01 - Byron Wallets are listed from oldest to newest" - it "BYRON_LIST_01 - Interleave of Icarus and Random wallets" - describe "BYRON_RESTORE_01, GET_01, LIST_01 - Restore a wallet" - it "BYRON_RESTORE_02 - One can restore previously deleted wallet" - it "BYRON_RESTORE_03 - Cannot restore wallet that exists" - describe "BYRON_RESTORE_06 - Passphrase" - it "BYRON_UPDATE_NAME_01 - Update names of wallets" - it "BYRON_UPDATE_NAME_02 - Update names of wallets from Xprv" - it "BYRON_UTXO_01 - Wallet's inactivity is reflected in utxo" - it "BYRON_WALLET_UTXO_SNAPSHOT_01 - \ - it "BYRON_WALLET_UTXO_SNAPSHOT_02 - \ - it "BYRON_WALLET_UTXO_SNAPSHOT_03 - \ - it "BYRON_UPDATE_PASS_01 - change passphrase" - it "BYRON_UPDATE_PASS_02 - Old passphrase incorrect" - it "BYRON_UPDATE_PASS_03 - Updating passphrase with no password wallets" - it "BYRON_UPDATE_PASS_04a - Updating passphrase with no password wallets" - it "BYRON_UPDATE_PASS_04b - Regression test" - it "BYRON_UPDATE_PASS_07 - Updating passphrase with short password wallets" - -spec = describe "BYRON_MIGRATIONS" - it "BYRON_CREATE_MIGRATION_PLAN_01r - Can create a migration plan for a random wallet." - it "BYRON_CREATE_MIGRATION_PLAN_01i - Can create a migration plan for an Icarus wallet." - it "BYRON_CREATE_MIGRATION_PLAN_02r - Cannot create plan for empty wallet." - it "BYRON_CREATE_MIGRATION_PLAN_02i - Cannot create plan for empty wallet." - it "BYRON_CREATE_MIGRATION_PLAN_03 - Cannot create plan for Shelley wallet using Byron endpoint." - it "BYRON_CREATE_MIGRATION_PLAN_04 - Cannot create a plan for a wallet that only contains dust." - it "BYRON_CREATE_MIGRATION_PLAN_05r - Creating a plan is deterministic." - it "BYRON_CREATE_MIGRATION_PLAN_05i - Creating a plan is deterministic." - describe "BYRON_MIGRATE_01 - \After a migration operation successfully completes, the correct amounts eventually become available in the target wallet for an arbitrary number of specified addresses, and the balance of the source wallet is completely depleted." - it "BYRON_MIGRATE_02 - Can migrate a large wallet requiring more than one transaction." - it "BYRON_MIGRATE_03 - Migrating an empty wallet should fail." - it "BYRON_MIGRATE_04 - Actual fee for migration is identical to predicted fee." - it "BYRON_MIGRATE_05 - Migration fails if the wrong passphrase is supplied." - describe "BYRON_MIGRATE_06 - It's possible to migrate to any valid address." - it "BYRON_MIGRATE_07 - Including an invalidly-formatted passphrase results in a parser error." - it "BYRON_MIGRATE_08 - It's not possible to migrate a wallet whose total balance is less than the minimum ada quantity for an output." - -spec = describe "BYRON_CLI_WALLETS" - describe "CLI_BYRON_GET_04, CLI_BYRON_DELETE_01, BYRON_RESTORE_02, BYRON_RESTORE_03 -\ - describe "CLI_BYRON_RESTORE_01, CLI_BYRON_GET_01, CLI_BYRON_LIST_01 -\ - describe "CLI_BYRON_RESTORE_06 - Passphrase" - it "CLI_BYRON_UPDATE_NAME_01 - Update names of wallets" - it "CLI_BYRON_UPDATE_NAME_02 - When updated name too long" - it "CLI_BYRON_UTXO_01 - Wallet's inactivity is reflected in utxo" - it "CLI_BYRON_UPDATE_PASS_01 - change passphrase" - it "CLI_BYRON_UPDATE_PASS_02 - Old passphrase incorrect" - describe "CLI_BYRON_UPDATE_PASS_03 - Pass length incorrect" - -spec = describe "NEW_SHELLEY_TRANSACTIONS" - it "TRANS_NEW_CREATE_01a - Empty payload is not allowed" - it "TRANS_NEW_CREATE_01b - Validity interval only is not allowed" - it "TRANS_NEW_CREATE_01c - No payload is bad request" - it "TRANS_NEW_CREATE_02a - Only metadata" - it "TRANS_NEW_CREATE_02b - Only metadata, untyped" - it "TRANS_NEW_CREATE_04ab - Constructed inputs = Decoded inputs" - it "TRANS_NEW_CREATE_04b - Cannot spend less than minUTxOValue" - it "TRANS_NEW_CREATE_04c - Can't cover fee" - it "TRANS_NEW_CREATE_04d - Not enough money" - it "TRANS_NEW_CREATE_04d - No UTxOs available" - it "TRANS_NEW_CREATE_04e- Multiple Output Tx to single wallet" - it "TRANS_NEW_ASSETS_CREATE_01a - Multi-asset tx with Ada" - it "TRANS_NEW_ASSETS_CREATE_01b - Multi-asset tx with not enough Ada" - it "TRANS_NEW_ASSETS_CREATE_01c - Multi-asset tx without Ada" - it "TRANS_NEW_ASSETS_CREATE_02 - using reference script" - it "TRANS_NEW_BALANCE_02a - Cannot balance on empty wallet" - it "TRANS_NEW_BALANCE_02b - Cannot balance when I cannot afford fee" - it "TRANS_NEW_SIGN_01 - Sign single-output transaction" - it "TRANS_NEW_SIGN_02 - Rejects unsigned transaction" - it "TRANS_NEW_SIGN_03 - Sign withdrawals" - it "TRANS_NEW_SIGN_04 - Sign extra required signatures" - describe - describe - it "TRANS_NEW_SUBMIT_03 - Can submit transaction encoded in base16" - xdescribe "Plutus scenarios" - it "TRANS_NEW_SUBMIT_04 - Mary and Babbage foreign txs submitted" - it "TRANS_NEW_CREATE_10l - Minting when assetName too long" - it "TRANS_NEW_CREATE_10m1 - Minting amount too big" - it "TRANS_NEW_CREATE_10m2 - Minting amount = 0" - it "TRANS_NEW_CREATE_10d - Minting assets without timelock" - it "TRANS_NEW_CREATE_10f - Burning assets without timelock" - describe - describe - it "TRANS_NEW_CREATE_12 - Cannot vote in Babbage" - it "TRANS_NEW_LIST_05 - filter address output side" - it "TRANS_NEW_LIST_06 - filter address input side" - -spec = describe "SHELLEY_SETTINGS" - it "SETTINGS_01 - Can put and read settings" - it "SETTINGS_02 - Changing pool_metadata_source re-syncs metadata" - -spec = describe "SHELLEY_HW_WALLETS" - it "HW_WALLETS_01 - Restoration from account public key preserves funds" - describe "HW_WALLETS_03 - Cannot do operations requiring private key" - it "Cannot send tx" - it "Cannot update pass" - describe "HW_WALLETS_04 - Can manage HW wallet the same way as others" - it "Can update name" - it "Can get tx fee" - it "Can delete" - it "Can see utxo" - it "Can list addresses" - it "Can have address pool gap" - it "Can list transactions" - it "Can create a coin selection" - describe "HW_WALLETS_05 - Wallet from pubKey is available" - it "Can get wallet" - it "Can list wallet" - it "The same account and mnemonic wallet can live side-by-side" - -spec = describe "SHELLEY_NETWORK" - it "NETWORK_PARAMS - Able to fetch network parameters" - -spec = describe "WITHDRAWALS" - it "TRANS_NEW_CREATE_03a - Withdrawal from self, 0 rewards" - it "TRANS_NEW_CREATE_03a - Withdrawal from self" - -spec = describe "BYRON_NETWORK" - it "NETWORK_PARAMS - Able to fetch network parameters" - -spec = describe "SHELLEY_CLI_WALLETS" - it "BYRON_GET_03 - Shelley CLI does not show Byron wallet" - it "BYRON_LIST_03 - Shelley CLI does not list Byron wallet" - it "BYRON_DELETE_03 - Shelley CLI does not delete Byron wallet" - it "BYRON_WALLETS_UTXO -\ - it "BYRON_WALLETS_UPDATE_PASS -\ - it "BYRON_WALLETS_UPDATE -\ - it "WALLETS_CREATE_01,08 - Can create a wallet" - it "WALLETS_CREATE_02 - Restored wallet preserves funds" - it "WALLETS_CREATE_03 - Cannot create wallet that exists" - describe "WALLETS_CREATE_04 - Wallet names" - describe "WALLETS_CREATE_04 - Wallet names invalid" - describe "WALLETS_CREATE_05 - Can create wallet with different mnemonic sizes" - describe "WALLETS_CREATE_05 - Can't create wallet with wrong size of mnemonic" - describe "WALLETS_CREATE_06 - Can create wallet with different mnemonic snd factor sizes" - describe "WALLETS_CREATE_06 - Can't create wallet with wrong size of mnemonic snd factor" - describe "WALLETS_CREATE_07 - Passphrase is valid" - describe "WALLETS_CREATE_07 - When passphrase is invalid" - describe "WALLETS_CREATE_08 - --address-pool-gap values" - it "WALLETS_GET_01 - Can get a wallet" - describe "WALLETS_GET_03,04 - Cannot get wallets with false ids" - it "WALLETS_LIST_01 - Can list wallets" - it "WALLETS_LIST_01 - Wallets are listed from oldest to newest" - describe "WALLETS_UPDATE_01,02 - Can update wallet name" - it "WALLETS_UPDATE_PASS_01 - Can update passphrase normally" - it "WALLETS_UPDATE_PASS_01 - Can update passphrase normally, mnemonic" - describe "WALLETS_UPDATE_PASS_02 - New passphrase values" - it "WALLETS_UPDATE_PASS_02 - \ - describe "WALLETS_UPDATE_PASS_03 - Old passphrase values" - describe "WALLETS_UPDATE_PASS_03 - \ - describe "WALLETS_UPDATE_PASS_04 - Cannot update pass of wallets with false ids" - describe "WALLETS_UPDATE_PASS_05,06 - \ - it "WALLETS_DELETE_01, WALLETS_LIST_02 - Can delete wallet" - it "WALLETS_UTXO_01 - Wallet's inactivity is reflected in utxo" - it "WALLET_UTXO_SNAPSHOT_01 - \ - it "WALLETS_UTXO_02 - Utxo statistics works properly" - describe "WALLETS_UTXO_03 - non-existing wallets" - it "WALLETS_UTXO_03 - Deleted wallet is not available for utxo" - it "WALLETS_UTXO_03 - 'almost' valid walletId" - - describe "BYRON_CLI_ADDRESSES" - describe "CLI_ADDRESS_CREATE_07 - False indexes" - -spec = describe "SHELLEY_TRANSACTIONS" - it "Regression ADP-626 - Filtering transactions between eras" $ do - it "TRANS_CREATE_01x - Single Output Transaction" - it "TRANS_CREATE_02x - Multiple Output Tx to single wallet" - it "TRANS_CREATE_03 - 0 balance after transaction" - it "TRANS_CREATE_04 - Can't cover fee" - it "TRANS_CREATE_04 - Not enough money" - it "TRANS_CREATE_04 - Wrong password" - it "TRANS_CREATE_07 - Deleted wallet" - describe "TRANS_CREATE_08 - Bad payload" - it "TRANS_ASSETS_CREATE_01 - Multi-asset balance" - it "TRANS_ASSETS_CREATE_01a - Multi-asset transaction with Ada" - it "TRANS_ASSETS_CREATE_02a - Multi-asset transaction without Ada" - it "TRANS_ASSETS_CREATE_02c - Send SeaHorses" - it "TRANS_ASSETS_CREATE_02b - Multi-asset tx history" - it "TRANS_ASSETS_LIST_01 - Asset list present" - it "TRANS_ASSETS_LIST_02 - Asset list present when not used" - it "TRANS_ASSETS_LIST_02a - Asset list present when not used" - it "TRANS_ASSETS_GET_01 - Asset list present" - it "TRANS_ASSETS_GET_02 - Asset not present when isn't associated" - it "TRANS_ASSETS_GET_02a - Asset not present when isn't associated" - it "TRANS_TTL_04 - Large TTL" - describe "TRANSMETA_CREATE_01 - Including metadata within transactions" - it "TRANSMETA_CREATE_03 - Transaction with too much metadata" - it "TRANSMETA_ESTIMATE_03 - fee estimation with too much metadata" - describe "TRANS_ESTIMATE_08 - Bad payload" - it "TRANS_ESTIMATE_03a - we see result when we can't cover fee" - it "TRANS_ESTIMATE_04 - Not enough money" - it "TRANS_ESTIMATE_07 - Deleted wallet" - it "TRANS_LIST_01 - Can list Incoming and Outgoing transactions" - it "TRANS_LIST_02,03x - Can limit/order results with start, end and order" - describe "TRANS_LIST_02,03 - Faulty start, end, order values" - it "TRANS_LIST_02 - Start time shouldn't be later than end time" - it "TRANS_LIST_03 - Minimum withdrawal shouldn't be 0" - it "TRANS_LIST_04 - Deleted wallet" - it "TRANS_GET_01 - Can get Incoming and Outgoing transaction" - it "TRANS_GET_02 - Deleted wallet" - it "TRANS_GET_03 - Using wrong transaction id" - it "TRANS_GET_04 - Sumbitted transactions result in pending state" - describe "TRANS_DELETE_03 - checking no transaction id error for " - describe - it "SHELLEY_TX_REDEEM_01 - Can redeem rewards from self" - it "SHELLEY_TX_REDEEM_02 - Can redeem rewards from other" - it "SHELLEY_TX_REDEEM_03 - Can't redeem rewards from other if none left" - it "SHELLEY_TX_REDEEM_04 - Can always ask for self redemption" - it "SHELLEY_TX_REDEEM_05 - Can't redeem rewards from unknown key" - it "SHELLEY_TX_REDEEM_06 - Can't redeem rewards using byron wallet" - it "SHELLEY_TX_REDEEM_06a - Can't redeem rewards if utxo = 0 from other" - it "SHELLEY_TX_REDEEM_06b - Can't redeem rewards if utxo = 0 from self" - it "SHELLEY_TX_REDEEM_07b - Can't redeem rewards if not enough money" - -spec = describe "SHELLEY_CLI_TRANSACTIONS" - it "TRANS_CREATE_01 - Can create transaction via CLI" - it "TRANS_CREATE_02 - Multiple Output Tx to single wallet via CLI" - it "TRANS_CREATE_04 - Wrong password" - describe "TRANS_CREATE_05 - Invalid addresses" - describe "TRANS_CREATE_06 - Invalid amount" - describe "TRANS_CREATE_07 - False wallet ids" - it "TRANS_CREATE_07 - 'almost' valid walletId" - it "TRANS_CREATE_07 - Deleted wallet" - it "TRANSMETA_CREATE_01a - \ - it "TRANSMETA_CREATE_01b - \ - it "TRANSTTL_CREATE_01 - Transaction with TTL via CLI" - describe "TRANS_ESTIMATE_08 - Invalid addresses" - describe "TRANS_ESTIMATE_09 - Invalid amount" - describe "TRANS_LIST_01 - Listing transactions for an empty wallet" - it "TRANS_LIST_01 - Can list Incoming and Outgoing transactions" - describe "TRANS_LIST_02 - Start time shouldn't be later than end time" - it "TRANS_LIST_03 - Can order results" - describe "TRANS_LIST_02,03 - Faulty start, end, order values" - it "TRANS_LIST_04 - 'almost' valid walletId" - it "TRANS_LIST_04 - Deleted wallet" - describe "TRANS_LIST_04 - False wallet ids" - it "TRANS_LIST_RANGE_01 - \ - it "TRANS_LIST_RANGE_02 - \ - it "TRANS_LIST_RANGE_03 - \ - it "TRANS_GET_01 - Can get Incoming and Outgoing transaction" - it "TRANS_GET_02 - Deleted wallet" - it "TRANS_GET_03 - Using wrong transaction id" - it "TRANS_DELETE_01 - Cannot forget pending transaction when not pending anymore via CLI" - it "TRANS_DELETE_03 - Cannot forget tx that is not found via CLI" - describe "TRANS_DELETE_04 - False wallet ids via CLI" - it "TRANS_DELETE_06 -\ - describe "TRANS_DELETE_07 - invalid tx id via CLI" - it "BYRON_TX_LIST_03 -\ - it "BYRON_TRANS_DELETE -\ - describe "BYRON_TRANS_CREATE / BYRON_TRANS_ESTIMATE -\ - -spec = describe "SHELLEY_COIN_SELECTION" - describe "WALLETS_COIN_SELECTION_04 - HTTP headers" - it "WALLETS_COIN_SELECTION_05a - can include metadata" - it "WALLETS_COIN_SELECTION_05b - choke on invalid metadata" - it "WALLETS_COIN_SELECTION_06a - can redeem rewards from self" - it "WALLETS_COIN_SELECTION_06b - can redeem rewards from other" - -spec = describe "BYRON_TRANSACTIONS" - describe "BYRON_TRANS_ASSETS_CREATE_01 - Multi-asset transaction with ADA" - describe "BYRON_TRANS_ASSETS_CREATE_02 - Multi-asset transaction with too little ADA" - describe "BYRON_TRANS_ASSETS_CREATE_02a - Multi-asset transaction with no ADA" - describe "BYRON_TRANS_ASSETS_LIST_01 - Asset list present" - describe "BYRON_TRANS_ASSETS_LIST_02 - Asset list present when not used" - describe "BYRON_TRANS_ASSETS_GET_01 - Asset list present" - describe "BYRON_TRANS_ASSETS_GET_02 - Asset not present when isn't associated" - describe "BYRON_TRANS_ASSETS_GET_02a - Asset not present when isn't associated" - describe "BYRON_TRANS_CREATE_01 - Single Output Transaction Byron -> Shelley" - describe "BYRON_TRANS_CREATE_01a - Single Output Transaction Byron -> Byron" - it "BYRON_TRANS_CREATE_02 -\ - it "BYRON_TRANS_DELETE -\ - it "BYRON_TRANS_ESTIMATE -\ - it "BYRON_TX_LIST_02 -\ - it "BYRON_TX_LIST_03 -\ - it "BYRON_RESTORE_09 - Ledger wallet" - it "BYRON_TX_LIST_01 - 0 txs on empty Byron wallet" - it "BYRON_TX_LIST_01 - Can list transactions on Byron Wallet" - it "BYRON_TX_LIST_01 - Can list transactions on Icarus Wallet" - describe "BYRON_TX_LIST_LIMIT - Transactions can be limited" - describe "BYRON_TX_LIST_01 - Faulty start, end, order values" - it "BYRON_TX_LIST_01 - Start time shouldn't be later than end time" - it "BYRON_TX_LIST_04 - Deleted wallet" - describe "BYRON_TX_LIST_ADDRESS - Transactions can be filtered by address" - -spec = describe "SHARED_WALLETS" - it "SHARED_WALLETS_CREATE_01 - Create an active shared wallet from root xprv" - it "SHARED_WALLETS_CREATE_01 - Compare wallet ids" - it "SHARED_WALLETS_CREATE_01 - golden test comparing wallet id" - it "SHARED_WALLETS_CREATE_02 - Create a pending shared wallet from root xprv" - it "SHARED_WALLETS_CREATE_03 - Create an active shared wallet from account xpub" - it "SHARED_WALLETS_CREATE_04 - Create a pending shared wallet from account xpub" - it "SHARED_WALLETS_CREATE_05 - Create an active shared wallet from root xprv with self" - it "SHARED_WALLETS_CREATE_06 - Create an active shared wallet from account xpub with self" - it "SHARED_WALLETS_CREATE_07 - Incorrect script template due to NoCosignerInScript" - it "SHARED_WALLETS_CREATE_08 - Incorrect script template due to UnknownCosigner" - it "SHARED_WALLETS_CREATE_09 - Incorrect script template due to DuplicateXPub" - it "SHARED_WALLETS_CREATE_10 - when recommended validation" - it "SHARED_WALLETS_CREATE_11 - Correct script template when required validation" - it "SHARED_WALLETS_CREATE_12 - Incorrect script template due to WrongScript - timelocks" - it "SHARED_WALLETS_CREATE_13 - Incorrect account index" - it "SHARED_WALLETS_CREATE_14 - Create wallet with one change address mode on" - it "SHARED_WALLETS_DELETE_01 - Delete of a shared wallet" - it "SHARED_WALLETS_PATCH_01 - active shared wallet" - it "SHARED_WALLETS_PATCH_02 - Add cosigner for delegation script template" - it "SHARED_WALLETS_PATCH_03 - Cannot add cosigner key in an active shared wallet" - it "SHARED_WALLETS_PATCH_04 - add already existent key to other cosigner" - it "SHARED_WALLETS_PATCH_05 - key in template" - it "SHARED_WALLETS_PATCH_06 - payment one" - it "SHARED_WALLETS_PATCH_07 - shared wallet's account key" - it "SHARED_WALLETS_KEYS_01 - Getting verification keys works for active shared wallet" - it "SHARED_WALLETS_KEYS_02 - Getting verification keys works for pending shared wallet" - it "SHARED_WALLETS_LIST_01 - Created a wallet can be listed" - it "SHARED_WALLETS_LIST_01 - Wallets are listed from oldest to newest" - it "SHARED_WALLETS_LIST_02 - Deleted wallet not listed" - it "SHARED_WALLETS_DISCOVER_01 - " - it "SHARED_WALLETS_UTXO_01 -" - it "SHARED_WALLETS_UTXO_02 - Sending and receiving funds updates " - it "SHARED_WALLETS_UTXO_03 - Deleted wallet is not available ctx -> runResourceT - describe "SHARED_WALLETS_UTXO_04 - HTTP headers" - it "SHARED_WALLETS_UTXO_SNAPSHOT_01 - Can generate UTxO snapshot of empty wallet" - it "SHARED_WALLETS_UTXO_SNAPSHOT_02 - Can generate UTxO snapshot of pure-ada wallet" - -spec = describe "SHELLEY_MIGRATIONS" - describe - describe - -spec = describe "SHELLEY_CLI_ADDRESSES" - it "ADDRESS_LIST_01 - Can list addresses - default poolGap" - it "ADDRESS_LIST_01 - Can list addresses - non-default poolGap" - it "ADDRESS_LIST_02 - Can filter used and unused addresses" - it "ADDRESS_LIST_02 - Shows nothing when there are no used addresses" - describe "ADDRESS_LIST_02 - Invalid filters show error message" - it "ADDRESS_LIST_03 - Generates new address pool gap" - describe "ADDRESS_LIST_04 - False wallet ids" - it "ADDRESS_LIST_04 - 'almost' valid walletId" - it "ADDRESS_LIST_04 - Deleted wallet" - it "BYRON_ADDRESS_LIST - Byron wallet on Shelley CLI" - -spec = describe "SHELLEY_STAKE_POOLS" - it "STAKE_POOLS_JOIN_01 - Cannot join non-existent wallet" - it "STAKE_POOLS_JOIN_01 - Cannot join non-existent stakepool" - it "STAKE_POOLS_JOIN_02 - \ - it "STAKE_POOLS_JOIN_02 - \ - it "STAKE_POOLS_JOIN_02a - \ - it "STAKE_POOLS_JOIN_02b - \ - it "STAKE_POOLS_JOIN_03 - Cannot join a pool that has retired" - it "STAKE_POOLS_JOIN_EMPTY - Empty wallet cannot join a pool" - it "STAKE_POOLS_QUIT_02 - Passphrase must be correct to quit" - it "STAKE_POOLS_QUIT_03 - Can quit with rewards" - it "STAKE_POOLS_JOIN_01 - Can rejoin another stakepool" - it "STAKE_POOLS_JOIN_04 - Rewards accumulate" - describe "STAKE_POOLS_JOIN_UNSIGNED_01" - it "Can join a pool that's not retiring" - describe "STAKE_POOLS_JOIN_UNSIGNED_02" - $ it "Can join a pool that's retiring" - describe "STAKE_POOLS_JOIN_UNSIGNED_03" - $ it "Cannot join a pool that's retired" - describe "STAKE_POOLS_JOIN_UNSIGNED_04" - $ it "Cannot join a pool that's never existed" - describe "STAKE_POOLS_QUIT_UNSIGNED_02" - $ it "Cannot quit if not delegating" - describe "STAKE_POOLS_JOIN_01x - Fee boundary values" - describe "STAKE_POOLS_QUIT_01x - Fee boundary values" - it "STAKE_POOLS_ESTIMATE_FEE_01 - can estimate fees" - describe "STAKE_POOLS_LIST_01 - List stake pools" - it "has non-zero saturation & stake" - it "pools have the correct retirement information" - it "eventually has correct margin, cost and pledge" - it "at least one pool eventually produces block" - it "contains pool metadata" - it "contains and is sorted by non-myopic-rewards" - it "non-myopic-rewards are based on stake" - it "STAKE_POOLS_LIST_05 - Fails without query parameter" - it "STAKE_POOLS_SMASH_01 - fetching metadata from SMASH works with delisted pools" - it "STAKE_POOLS_SMASH_HEALTH_01 - Can check SMASH health when configured" - describe "STAKE_POOLS_SMASH_HEALTH_02 - Cannot check SMASH health when not configured" - it "STAKE_POOLS_SMASH_HEALTH_03 - Can check SMASH health via url" - describe "STAKE_POOLS_SMASH_HEALTH_04 - SMASH url needs to be valid" - it "STAKE_KEY_LIST_01 - Can list stake keys" - it "STAKE_KEY_LIST_02 - Can list foreign stake key from UTxO" - -spec = describe "SHELLEY_ADDRESSES" - it "BYRON_ADDRESS_LIST - Byron wallet on Shelley ep" - it "ADDRESS_LIST_01 - Can list known addresses on a default wallet" - it "ADDRESS_LIST_01 - Can list addresses with non-default pool gap" - it "ADDRESS_LIST_02 - Can filter used and unused addresses" - it "ADDRESS_LIST_02 - Shows nothing when there are no used addresses" - describe "ADDRESS_LIST_02 - Invalid filters are bad requests" - it "ADDRESS_LIST_03 - Generates new address pool gap" - it "ADDRESS_LIST_04 - Deleted wallet" - it "ADDRESS_LIST_05 - bech32 HRP is correct - testnet" - it "ADDRESS_LIST_06 - Used change addresses are listed after a transaction \ - it "ADDRESS_INSPECT_01 - Address inspect OK Icarus" - it "ADDRESS_INSPECT_02 - Address inspect OK Byron" - it "ADDRESS_INSPECT_03 - Address inspect OK reward" - it "ADDRESS_INSPECT_04 - Address inspect KO" - it "ADDRESS_INSPECT_05 - Address inspect OK bech32" - it "ANY_ADDRESS_POST_01 - Golden tests for enterprise script address - signature" - it "ANY_ADDRESS_POST_02 - Golden tests for enterprise script address - any" - it "ANY_ADDRESS_POST_03 - Golden tests for enterprise script address - all" - it "ANY_ADDRESS_POST_04 - Golden tests for enterprise script address - some" - it "ANY_ADDRESS_POST_05 - Golden tests for reward account script address - any" - it "ANY_ADDRESS_POST_06 - Golden tests for delegating script address - any" - it "ANY_ADDRESS_POST_07a - Golden tests for enterprise address - from non-extended public key" - it "ANY_ADDRESS_POST_07b - Golden tests for enterprise address - from extended public key" - it "ANY_ADDRESS_POST_07c - Golden tests for enterprise address - from key hash" - it "ANY_ADDRESS_POST_08a - Golden tests for reward account address - from non-extended public key" - it "ANY_ADDRESS_POST_08b - Golden tests for reward account address - from extended public key" - it "ANY_ADDRESS_POST_08c - Golden tests for reward account address - from key hash" - it "ANY_ADDRESS_POST_09a - Golden tests for delegating address with both non-extended pub key credentials" - it "ANY_ADDRESS_POST_09b - Golden tests for delegating address with both extended pub key credentials" - it "ANY_ADDRESS_POST_09c - Golden tests for delegating address with both key hash credentials" - it "ANY_ADDRESS_POST_09d - Golden tests for delegating address with mixed credentials" - it "ANY_ADDRESS_POST_09e - Golden tests for delegating address with mixed credentials" - it "ANY_ADDRESS_POST_09f - Golden tests for delegating address with mixed credentials" - it "ANY_ADDRESS_POST_10 - Golden tests for delegating address - payment from script, stake from key" - it "ANY_ADDRESS_POST_11 - Golden tests for delegating address - payment from key, stake from script" - it "ANY_ADDRESS_POST_12 - Delegating addresses API roundtrip" - it "ANY_ADDRESS_POST_13 - Golden tests for script with timelocks" - it "ANY_ADDRESS_POST_14a - at_least 0 is valid when non-validated" - it "ANY_ADDRESS_POST_14b - at_least 0 is valid when validation is required" - it "ANY_ADDRESS_POST_14c - at_least 0 is not valid when validation is recommended" - it "ANY_ADDRESS_POST_15a - at_least 4 is valid when non-validated" - it "ANY_ADDRESS_POST_15b - at_least 4 is valid when validation is required" - it "ANY_ADDRESS_POST_15c - at_least 4 is not valid when validation is recommended" - it "ANY_ADDRESS_POST_16a - script with duplicated verification keys is valid when non-validated" - it "ANY_ADDRESS_POST_16b - script with duplicated verification keys is valid when required validation used" - it "ANY_ADDRESS_POST_16c - script with duplicated verification keys is invalid when recommended validation used" - it "ANY_ADDRESS_POST_17a - Script with contradictory timelocks is valid when validation not used" - it "ANY_ADDRESS_POST_17b - Script with contradictory timelocks is invalid when required validation is used" - it "ANY_ADDRESS_POST_17c - Script with contradictory timelocks is invalid when recommended validation is used" - it "ANY_ADDRESS_POST_17d - script with mixed payment/delegation verification keys is invalid" - it "POST_ACCOUNT_01 - Can retrieve account public keys" - it "POST_ACCOUNT_02 - Can get account public key using purpose" - it "ANY_ADDRESS_POST_15 - Staking address using stake credential non-hashed" - it "ANY_ADDRESS_POST_16 - Staking address using stake credential hashed" - -spec = describe "BLOCKS" - it "LATEST_BLOCK Current tip is reported" - -spec = describe "VOTING_TRANSACTIONS" - it "VOTING_01a - Can vote and revote and then delegate" - it "VOTING_01b - Can vote and revote after delegation" - it "VOTING_01c - Can vote together with delegation" - it "VOTING_01d - Can joinStakePool and quitStakePool" - it "VOTING_01e - Cannot vote in Babbage" - it "VOTING_01f - Voting works in Conway in absence of pool delegation" - it "VOTING_01g - Voting works in Conway in presence of pool delegation" - it "VOTING_01h - Delegation works in Conway in presence of voting and does not change it" - it "VOTING_01i - Delegation works in Conway in presence of voting and does not change it" - it "VOTING_01j - Delegation works in Conway in presence of voting after wallet delations and restoration" - -spec = describe "SHARED_TRANSACTIONS" - it "SHARED_TRANSACTIONS_CREATE_01a -Empty payload is not allowed" - it "SHARED_TRANSACTIONS_CREATE_04d - Can't cover fee" - describe - it "SHARED_TRANSACTIONS_LIST_03 - Minimum withdrawal shouldn't be 0" - it "SHARED_TRANSACTIONS_LIST_04 - Deleted wallet" - it "SHARED_TRANSACTIONS_GET_02 - Deleted wallet" - it "SHARED_TRANSACTIONS_GET_03 - Using wrong transaction id" - it "SHARED_TRANSACTIONS_LIST_05 - filter address output side" - it "SHARED_TRANSACTIONS_LIST_06 - filter address input side" - -spec = describe "BYRON_COIN_SELECTION" - it "BYRON_COIN_SELECTION_00 - No coin selection on Byron random" - -spec = describe "SHARED_ADDRESSES" - it "SHARED_ADDRESSES_LIST_01 - Can list known addresses on a default wallet" - it "SHARED_ADDRESSES_LIST_02 - Can list known addresses on a pending wallet" - - describe "BYRON_ADDRESSES" - -spec = describe "SHELLEY_CLI_HW_WALLETS" - it "HW_WALLETS_01x - Restoration from account public key preserves funds" - describe "HW_WALLETS_03 - Cannot do operations requiring private key" - it "Cannot send tx" - it "Cannot update pass" - describe "HW_WALLETS_04 - Can manage HW wallet the same way as others" - it "Can update name" - it "Can get tx fee" - it "Can delete" - it "Can see utxo" - it "Can list addresses" - it "Can have address pool gap" - it "Can list transactions" - describe "HW_WALLETS_05 - Wallet from pubKey is available" - it "The same account and mnemonic wallet can live side-by-side" - describe "HW_WALLETS_06 - Test parameters" - describe "Wallet names valid" - describe "Wallet names invalid" - describe "Pub Key invalid" - describe "Address pool gap invalid" - -spec = describe "BYRON_HW_WALLETS" - it "HW_WALLETS_01 - Restoration from account public key preserves funds" - describe "HW_WALLETS_03 - Cannot do operations requiring private key" - it "Cannot send tx" - it "Cannot update pass" - describe "HW_WALLETS_04 - Can manage HW wallet the same way as others" - it "Can update name" - it "Can get tx fee" - it "Can delete" - it "Can see utxo" - it "Can list addresses" - it "Can have address pool gap" - it "Can list transactions" - it "Can get coin selection" - describe "HW_WALLETS_05 - Wallet from pubKey is available" - it "Can get wallet" - it "Can list wallet" - it "The same account and mnemonic wallet can live side-by-side" - -spec = describe "NEW_SHELLEY_TRANSACTIONS" - it "TRANS_NEW_JOIN_01b - Invalid pool id" - it "TRANS_NEW_JOIN_01b - Absent pool id" - it "TRANS_NEW_JOIN_01c - Multidelegation not supported" - it "TRANS_NEW_JOIN_01d - Multiaccount not supported" - it "TRANS_NEW_JOIN_01e - Can re-join and withdraw at once" - it "TRANS_NEW_JOIN_01f - Cannot re-join the same pool in Babbage" - it "TRANS_NEW_JOIN_01f - Can re-join the same pool in Conway" - it "TRANS_NEW_QUIT_01 - Cannot quit if not joined" -``` - -## E2E Tests - -``` -misc: - describe CardanoWallet::Misc::Node do - it 'Can get latest block header info' do - describe CardanoWallet::Misc::Network do - it 'Can get network information' do - it 'Can check network clock offset' do - it 'Can check network parameters' do - it 'SMASH health - unreachable' do - it 'SMASH health - bad url' do - it 'Inspect invalid address' do - it 'Inspect Shelley payment address' do - it 'Inspect Shelley stake address' do - it 'Inspect Byron Random address' do - it 'Inspect Byron Icarus address' do - it 'Enterprise script address - signature' do - it 'Enterprise script address - any' do - it 'Enterprise script address - all' do - it 'Enterprise script address - some' do - it 'Reward account script address - any' do - it 'Delegating script address - any' do - it 'Enterprise pub key address' do - it 'Reward account pub key address' do - it 'Delegating address with both pub key credentials' do - it 'Delegating address - payment from script, stake from key' do - it 'Delegating address - payment from key, stake from script' d - it 'Malformed payload when tx is not binary' do -``` - - -``` -shared: it 'I can create, get and delete wallet from mnemonics getting acc_xpub from cardano-address' do - it 'I can create, get and delete wallet from pub key getting acc_xpub from cardano-address' do - it 'Cannot create wallet with different acc xpub - derived from different mnemonic sentence' do - it 'Cannot create wallet with different acc xpub - derived from different acc ix' do - it 'I can create incomplete wallet and update cosigners with acc_xpub from cardano-address' do - it 'Create / update partially / get / list / delete' do - it 'Cannot update main cosigner' do - it 'Shared walletid with only spending template from cardano-addresses' do - it 'Shared walletid with spending and delegation template from cardano-addresses' do - it 'Can see utxo' do - it 'Can see utxo snapshot' do - it 'Can list addresses on active shared wallet - from pub key' do - it 'Can list addresses on active shared wallet - from mnemonics' do - it 'Lists empty addresses on incomplete shared wallet - from pub key' do - it 'Lists empty addresses on incomplete shared wallet - from mnemonics' do - it 'Get public key - incomplete wallet from mnemonics' do - it 'Get public key - incomplete wallet from acc pub key' do - it 'Get public key - active wallet from mnemonics' do - it 'Get public key - active wallet from acc pub key' do - it 'Create account public key - incomplete wallet from mnemonics' do - it 'Cannot create account public key - incomplete wallet from acc pub key' do - it 'Create account public key - active wallet from mnemonics' do - it 'Cannot create account public key - active wallet from acc pub key' do - it 'Get account public key - active wallet from mnemonics' do - it 'Get account public key - active wallet from acc pub key' do - it 'Get account public key - incomplete wallet from mnemonics' do - it 'Get account public key - incomplete wallet from acc pub key' do - it 'I could get a tx if I had proper id' do - it 'Can list transactions' do -e2e: it 'ADP-2523 - Make sure there are no null values in the response', :adp_2523 do - it 'AlwaysFails.plutus with collateral return to the wallet' do - it 'cannot balance on empty wallet' do - it 'ping-pong' do - it 'game' do - it 'mint-burn' do - it 'withdrawal' do - it 'currency' do - it 'I can get min_utxo_value when contructing tx' do - it 'Single output transaction' do - it 'Multi output transaction' do - it 'Multi-assets transaction' do - it 'Only withdrawal' do - it 'Only metadata' do - it 'Validity intervals' do - it 'Delegation (join and quit)' do - it 'Can mint and then burn' do - it 'Can mint and burn with metadata' do - it 'Can mint NFT attaching CIP-25 metadata' do - it 'Can mint and burn in the same tx' do - it 'Can mint and burn the same asset in single tx' do - it 'Cannot burn with wrong policy_script or more than I have' do - it 'Cannot mint if I make too big transaction' do - it 'Fixture shelley wallet has utxos' do - it 'I can list native assets' do - it 'I can list native assets and get offchain metadata', :offchain do - it 'I can send native assets tx and they are received' do - it 'I can create migration plan shelley -> shelley' do - it 'I can send transaction and funds are received (min_utxo_value)' do - it 'I can send transaction with ttl and funds are received' do - it 'Transaction with ttl = 0 would expire and I can forget it' do - it 'I can send transaction with metadata' do - it 'I can estimate fee (min_utxo_value)' do - it 'I can list transactions and limit response with query parameters' do - it 'I could check delegation fees - if I could cover fee' do - it 'Can list stake pools only when stake is provided' do - it 'Can join and quit Stake Pool' do - it 'I can trigger random coin selection' do - it 'I can trigger random coin selection delegation action' do - it 'I could trigger random coin selection delegation action - if I had money' do - it 'I could trigger random coin selection delegation action - if I known pool id' do - it 'I can update passphrase with mnemonic and the wallet does not have to re-sync' do - it 'Fixture shared wallets have utxos' do - it 'I can estimate fees (min_utxo_value), random' do - it 'I can estimate fees (min_utxo_value), icarus' do - it 'I can send transaction and funds are received (min_utxo_value), random -> shelley' do - it 'I can send transaction and funds are received (min_utxo_value), icarus -> shelley' do - it 'I can send native assets tx and they are received (random -> shelley)' do - it 'I can send native assets tx and they are received (icarus -> shelley)' do - it 'I can list transactions and limit response with query parameters (byron)' do - it 'I can list transactions and limit response with query parameters (icarus)' do - it 'I can create migration plan byron -> shelley' do - it 'I can create migration plan icarus -> shelley' do - it 'I can list assets -> random' do - it 'I can list assets -> icarus' do - it 'I can list assets with offchain metadata -> random', :offchain do - it 'I can list assets with offchain metadata -> icarus', :offchain do - it 'Submit tx via POST /proxy/transactions' do - it 'Cannot submit unsigned tx via POST /proxy/transactions' do - it 'I can migrate all funds back to fixture wallet' do -byron: it 'I can list byron wallets' do - it 'I could get a wallet' do - it 'I could delete a wallet' do - it 'I can create, get and delete byron icarus wallet from mnemonics' do - it 'I can create, get and delete byron random wallet from mnemonics' do - it 'Can see utxo' do - it 'Can see utxo snapshot' do - it 'Can list addresses - random', :adp_2211 do - it 'Can list addresses - icarus' do - it 'Can list addresses - ledger' do - it 'Can list addresses - trezor' do - it 'Can create address - random' do - it 'I can import address - random' do - it 'I cannot import address - icarus' do - it 'I cannot import address - ledger' do - it 'I cannot import address - trezor' do - it 'I could trigger random coin selection - if had money' do - it 'I could create migration plan - icarus' do - it 'I could create migration plan - random' do - it 'I could migrate all my funds' do -shelley: it 'I can list wallets' do - it 'When wallet does not exist it gives 404' do - it 'I can create, get and delete wallet from mnemonics' do - it 'I can create, get and delete wallet from mnemonics / second factor' do - it 'I can set address pool gap' do - it 'I can create, get and delete wallet from pub key' do - it 'I can get Shelley walletid using cardano-addresses' do - it 'Shelley walletid is not based on acct key' do - it 'Can update_metadata' do - it 'Can update_passphrase' do - it 'Cannot update_passphrase not knowing old pass' do - it 'Can update_passphrase, mnemonics' do - it 'Can update_passphrase, mnemonics, mnemonic_second_factor' do - it 'Cannot update_passphrase with wrong mnemonics' do - it 'Cannot update_passphrase with wrong mnemonic_second_factor' do - it 'Cannot update_passphrase of wallet from pub key' do - it 'Can update_passphrase of wallet from pub key using mnemonics from which pub key is derived' do - it 'Cannot update_passphrase of wallet from pub key using wrong mnemonics' do - it 'Can see utxo' do - it 'Can see utxo snapshot' do - it 'Can list addresses' do - it 'I could trigger random coin selection - if had money' do - it 'I could get a tx if I had proper id' do - it 'Can list transactions' do - it 'I could create transaction - if I had money' do - it 'I could create transaction using rewards - if I had money' do - it 'I could estimate transaction fee - if I had money' do - it 'I could forget transaction' do - it 'I can list stake keys' do - it 'pool_metadata_source = direct <> none' do - it 'I could quit stake pool - if I was delegating' do - it 'I could create migration plan' do - it 'I could migrate all my funds' do - it 'Get signed metadata' do - it 'Get public key' do - it 'Create account public key - extended' do - it 'Create account public key - non_extended' do - it 'Create account public key - extended with purpose' do - it 'Create account public key - non_extended with purpose' do - it 'Get account public key - wallet from acc pub key' do - it 'Get account public key - wallet from mnemonics' do - it 'Get account public key (mnemonic_snd_factor)' do -e2e_shared: it 'Fixture shared wallets have utxos' do - it 'Cannot submit if partially signed - one cosigner, all' do - it 'Cannot submit if tx is foreign - two cosigners, all' do - it 'Single output transaction - two cosigners, all' do - it 'Multi output transaction - two cosigners, all' do - it 'Multi-assets transaction - two cosigners, all' do - it 'Validity intervals - two cosigners, all' do - it 'Only metadata - two cosigners, all' do - it 'Single output transaction - one cosigner, any' do - it 'I can get min_utxo_value when contructing tx' do - it 'Single output transaction' do - it 'Multi output transaction' do - it 'Multi-assets transaction' do - it 'Validity intervals' do - it 'Only metadata' do - it 'Delegation (join and quit)' do - it 'Can mint and then burn (without submitting)' do - it 'I can receive transaction to shared wallet' do - it 'I can list transactions and limit response with query parameters' do - it 'I can migrate all funds back to fixture shared wallet' do -``` From 107d7bc2b59be22499cd19f7a52a815f047e5681 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Thu, 12 Dec 2024 09:37:18 +0100 Subject: [PATCH 5/6] Remove reference to ruby bundle --- nix/release-package.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nix/release-package.nix b/nix/release-package.nix index bba8070a3d4..99c4bcc3e89 100644 --- a/nix/release-package.nix +++ b/nix/release-package.nix @@ -132,11 +132,6 @@ pkgs.stdenv.mkDerivation { export WINEDLLOVERRIDES="winemac.drv=d" export WINEDEBUG=warn-all,fixme-all,-menubuilder,-mscoree,-ole,-secur32,-winediag - '' + '' - export PATH=`pwd`/$name:$PATH - - echo " - running checks" - ruby ${../scripts/check-bundle.rb} $exeName $exeRunner ''; } // lib.optionalAttrs (pkgs.stdenv.buildPlatform.libc == "glibc") { LOCALE_ARCHIVE = "${pkgs.buildPackages.glibcLocales}/lib/locale/locale-archive"; From bf1b0c14a9e51725ed381ba427b3fe60fe97144e Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Fri, 13 Dec 2024 13:47:59 +0100 Subject: [PATCH 6/6] Remove E2E GHA workflows --- .github/workflows/e2e-windows.yml | 158 ------------------------------ .github/workflows/rubocop.yml | 35 ------- 2 files changed, 193 deletions(-) delete mode 100644 .github/workflows/e2e-windows.yml delete mode 100644 .github/workflows/rubocop.yml diff --git a/.github/workflows/e2e-windows.yml b/.github/workflows/e2e-windows.yml deleted file mode 100644 index edc342362e2..00000000000 --- a/.github/workflows/e2e-windows.yml +++ /dev/null @@ -1,158 +0,0 @@ -name: E2E Windows - -on: - push: - tags: - - rc-latest - - workflow_dispatch: - inputs: - branch: - description: 'Run tests against branch' - default: 'rc-latest' - tags: - description: 'Test tags (all, light, offchain...)' - default: 'all' -jobs: - test: - concurrency: - group: windows-e2e-group - cancel-in-progress: false - - runs-on: windows-latest - - env: - NETWORK: preprod - BUILDKITE_API_TOKEN: ${{ secrets.BUILDKITE_TOKEN_READ_BUILDS_ARTIFACTS }} - TESTS_E2E_FIXTURES: ${{ secrets.TESTS_E2E_FIXTURES }} - BRANCH: ${{ github.event.inputs.branch || 'rc-latest' }} - TAGS: ${{ github.event.inputs.tags || 'all' }} - - steps: - - name: Check space - run: Get-PSDrive - - - name: configure Pagefile - uses: al-cheb/configure-pagefile-action@v1.2 - with: - minimum-size: 16GB - maximum-size: 24GB - disk-root: "C:" - - - name: Checkout - shell: bash - run: | - git clone -b $BRANCH https://github.com/cardano-foundation/cardano-wallet.git C:/cardano-wallet --depth 1 --no-single-branch - cd /c/cardano-wallet - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7.1 - bundler-cache: true - working-directory: C:/cardano-wallet/test/e2e - - - name: Install dependencies - working-directory: C:/cardano-wallet/test/e2e - run: bundle install - - - name: Prepare Windows - run: | - choco install wget - choco install unzip - choco install nssm - choco install archiver - - - name: ๐Ÿ•’ Get Date/Time - working-directory: C:/cardano-wallet/test/e2e - run: bundle exec rake datetime - - - name: ๐Ÿ’พ GH Cache node db - id: cache-node - uses: actions/cache@v3 - with: - path: C:/cardano-wallet/test/e2e/state/node_db/preprod - key: node-db-e2e-windows-preprod - - - name: Fetch preprod snapshot - if: steps.cache-node.outputs.cache-hit != 'true' - working-directory: C:/cardano-wallet/test/e2e - run: | - mkdir state -ErrorAction SilentlyContinue - cd state - mkdir node_db - cd node_db - mkdir preprod - cd preprod - curl -s https://downloads.csnapshots.io/testnet/testnet-db-snapshot.json | jq -r .[].file_name > snapshot.json - curl -o snapshot.tar.lz4 https://downloads.csnapshots.io/testnet/$(cat snapshot.json) - arc unarchive snapshot.tar.lz4 - mv db/* . - - - name: โš™๏ธ Setup (get latest bins and configs and decode fixtures) - working-directory: C:/cardano-wallet/test/e2e - run: bundle exec rake setup[preprod,%BRANCH%] - - - name: ๐Ÿ” Display versions - working-directory: C:/cardano-wallet/test/e2e - run: bundle exec rake display_versions - - - name: ๐Ÿš€ Start node and wallet - working-directory: C:/cardano-wallet/test/e2e - run: bundle exec rake start_node_and_wallet[preprod] - - - name: โณ Wait until node is synced - working-directory: C:/cardano-wallet/test/e2e - run: bundle exec rake wait_until_node_synced - - - name: ๐Ÿงช Run all tests - working-directory: C:/cardano-wallet/test/e2e - run: bundle exec rake spec SPEC_OPTS="-t %TAGS%" - - - name: ๐Ÿ Stop node and wallet - working-directory: C:/cardano-wallet/test/e2e - run: bundle exec rake stop_node_and_wallet[preprod] - - - name: ๐Ÿ’พ GH Save Cache of node db - if: always() - uses: actions/cache/save@v3 - with: - path: C:/cardano-wallet/test/e2e/state/node_db/preprod - key: node-db-e2e-windows-preprod - - - name: ๐Ÿ“Ž Upload state - uses: actions/upload-artifact@v3 - if: always() - with: - name: windows-state - path: | - C:/cardano-wallet/test/e2e/state/logs - C:/cardano-wallet/test/e2e/state/configs - C:/cardano-wallet/test/e2e/state/wallet_db - - report: - needs: [test] - if: always() - runs-on: ubuntu-latest - steps: - - name: Slack Notification on failure - if: needs.test.result != 'success' - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_ICON_EMOJI: ':poop:' - SLACK_USERNAME: 'GitHub Action' - SLACK_MESSAGE: | - *Job Link:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - SLACK_COLOR: '#FF0000' - - - name: Slack Notification on success - if: needs.test.result == 'success' - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_ICON_EMOJI: ':rocket:' - SLACK_USERNAME: 'GitHub Action' - SLACK_MESSAGE: | - *Job Link:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - SLACK_COLOR: '#00FF00' \ No newline at end of file diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml deleted file mode 100644 index 37f46e0b776..00000000000 --- a/.github/workflows/rubocop.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Rubocop - -on: - push: - branches: [ "master" ] - paths: ['test/e2e/**.rb'] - pull_request: - branches: [ "master" ] - paths: ['test/e2e/**.rb'] - -permissions: - contents: read - -defaults: - run: - working-directory: ./test/e2e - -jobs: - rubocop-linter: - runs-on: ubuntu-latest - - steps: - - name: ๐Ÿ“ฅ Checkout repository - uses: actions/checkout@v3.2.0 - - - name: ๐Ÿ’Ž Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.1.2 - bundler-cache: true - - - name: ๐Ÿ‘ฎ Rubocop - run: | - gem install rubocop - rubocop