Skip to content

Commit

Permalink
fix e2e tests to comply with purpose=1854' for multisig keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra committed May 13, 2021
1 parent 284f260 commit 73225b4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion test/e2e/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'cardano_wallet', '~> 0.3.5'
gem 'cardano_wallet', '~> 0.3.6'
# gem 'cardano_wallet', path: "~/wb/cardano_wallet"
gem 'bip_mnemonic', '0.0.4'
gem 'rake', '12.3.3'
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
bip_mnemonic (0.0.4)
cardano_wallet (0.3.5)
cardano_wallet (0.3.6)
httparty (~> 0.18.0)
diff-lcs (1.4.4)
httparty (0.18.1)
Expand Down Expand Up @@ -32,7 +32,7 @@ PLATFORMS

DEPENDENCIES
bip_mnemonic (= 0.0.4)
cardano_wallet (~> 0.3.5)
cardano_wallet (~> 0.3.6)
rake (= 12.3.3)
rspec (= 3.10.0)

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/helpers/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def cmd(cmd)

def cardano_address_get_acc_xpub(mnemonics, derivation_path)
cmd(%(echo #{mnemonics.join(' ')} \
| cardano-address key from-recovery-phrase Shelley \
| cardano-address key from-recovery-phrase Shared \
| cardano-address key child #{derivation_path} \
| cardano-address key public --with-chain-code \
| bech32)).gsub("\n", '')
Expand Down
23 changes: 11 additions & 12 deletions test/e2e/spec/shared_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

m24 = mnemonic_sentence(24)
acc_ix = '0H'
acc_xpub = cardano_address_get_acc_xpub(m24, "1852H/1815H/#{acc_ix}")

acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}")
script_template = { "cosigners" =>
{ "cosigner#0" => acc_xpub },
"template" =>
Expand Down Expand Up @@ -48,7 +47,7 @@

m24 = mnemonic_sentence(24)
acc_ix = '0H'
acc_xpub = cardano_address_get_acc_xpub(m24, "1852H/1815H/#{acc_ix}")
acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/#{acc_ix}")

payment_script_template = { "cosigners" =>
{ "cosigner#0" => acc_xpub },
Expand Down Expand Up @@ -93,7 +92,7 @@
m24 = mnemonic_sentence(24)
acc_ix = '0H'
acc_xpub_wrong = cardano_address_get_acc_xpub(mnemonic_sentence(24),
"1852H/1815H/0H")
"1854H/1815H/0H")

payment_script_template = { "cosigners" =>
{ "cosigner#0" => acc_xpub_wrong },
Expand Down Expand Up @@ -131,7 +130,7 @@

m24 = mnemonic_sentence(24)
acc_ix = '0H'
acc_xpub_wrong = cardano_address_get_acc_xpub(m24, "1852H/1815H/255H")
acc_xpub_wrong = cardano_address_get_acc_xpub(m24, "1854H/1815H/255H")

payment_script_template = { "cosigners" =>
{ "cosigner#0" => acc_xpub_wrong },
Expand Down Expand Up @@ -166,11 +165,11 @@

it "I can create pending wallet and update cosigners with acc_xpub from cardano-address" do
m24 = mnemonic_sentence(24)
acc_xpub = cardano_address_get_acc_xpub(m24, "1852H/1815H/0H")
acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/0H")
pending_wid = create_pending_shared_wallet(m24, '0H', acc_xpub)

acc_xpub_upd = cardano_address_get_acc_xpub(mnemonic_sentence(24),
"1852H/1815H/0H")
"1854H/1815H/0H")

update_payment = SHARED.wallets.update_payment_script(pending_wid,
"cosigner#1",
Expand All @@ -191,11 +190,11 @@

it "Create / update partially / get / delete" do
m24 = mnemonic_sentence(24)
acc_xpub = cardano_address_get_acc_xpub(m24, "1852H/1815H/0H")
acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/0H")
pending_wid = create_pending_shared_wallet(m24, '0H', acc_xpub)

acc_xpub_upd = cardano_address_get_acc_xpub(mnemonic_sentence(24),
"1852H/1815H/0H")
"1854H/1815H/0H")

update_payment = SHARED.wallets.update_payment_script(pending_wid,
"cosigner#1",
Expand All @@ -210,10 +209,10 @@

it "Cannot update main cosigner" do
m24 = mnemonic_sentence(24)
acc_xpub = cardano_address_get_acc_xpub(m24, "1852H/1815H/0H")
acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/0H")
pending_wid = create_pending_shared_wallet(m24, '0H', acc_xpub)
acc_xpub_upd = cardano_address_get_acc_xpub(mnemonic_sentence(24),
"1852H/1815H/0H")
"1854H/1815H/0H")

update_payment = SHARED.wallets.update_payment_script(pending_wid,
"cosigner#0",
Expand All @@ -232,7 +231,7 @@

it "Cannot update cosigner with main cosigner's xpub" do
m24 = mnemonic_sentence(24)
acc_xpub = cardano_address_get_acc_xpub(m24, "1852H/1815H/0H")
acc_xpub = cardano_address_get_acc_xpub(m24, "1854H/1815H/0H")
pending_wid = create_pending_shared_wallet(m24, '0H', acc_xpub)

update_payment = SHARED.wallets.update_payment_script(pending_wid,
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/spec/shelley_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,19 +381,19 @@
end
end

it "Create account public key - extended = true" do
it "Create account public key - extended" do
wid = create_shelley_wallet
["0H", "1H", "2147483647H", "44H"].each do |index|
res = SHELLEY.keys.create_acc_public_key(wid, index, PASS, extended = true)
res = SHELLEY.keys.create_acc_public_key(wid, index, PASS, 'extended')
expect(res).to be_correct_and_respond 202
expect(res.to_s).to include "acc"
end
end

it "Create account public key - extended = false" do
it "Create account public key - non_extended" do
wid = create_shelley_wallet
["0H", "1H", "2147483647H", "44H"].each do |index|
res = SHELLEY.keys.create_acc_public_key(wid, index, PASS, extended = false)
res = SHELLEY.keys.create_acc_public_key(wid, index, PASS, 'non_extended')
expect(res).to be_correct_and_respond 202
expect(res.to_s).to include "acc"
end
Expand Down

0 comments on commit 73225b4

Please sign in to comment.