1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 23:08:14 +00:00

tests: fix reference to ckd_public

we aren't moving ckd_public out of trezorlib just yet. It will go away
in 0.12.

tests: move ckd_public

tests: remove useless usages of ckd_public
This commit is contained in:
matejcik 2019-08-06 15:08:48 +02:00 committed by matejcik
parent 67b879ac07
commit 0312fb264b
11 changed files with 48 additions and 102 deletions

View File

@ -16,10 +16,9 @@
import pytest
from trezorlib import btc, messages as proto
from trezorlib import btc, ckd_public as bip32, messages as proto
from trezorlib.tools import H_, CallException, parse_path
from ..support import ckd_public as bip32
from .common import TrezorTest

View File

@ -17,7 +17,6 @@
from trezorlib import btc, messages as proto
from trezorlib.tools import parse_path
from ..support import ckd_public as bip32
from .common import TrezorTest
@ -82,17 +81,13 @@ class TestMsgGetaddressSegwit(TrezorTest):
def test_show_multisig_3(self):
self.setup_mnemonic_allallall()
nodes = map(
lambda index: btc.get_public_node(
self.client, parse_path("999'/1'/%d'" % index)
),
range(1, 4),
)
nodes = [
btc.get_public_node(self.client, parse_path("999'/1'/%d'" % i)).node
for i in range(1, 4)
]
multisig1 = proto.MultisigRedeemScriptType(
nodes=[bip32.deserialize(n.xpub) for n in nodes],
address_n=[2, 0],
signatures=[b"", b"", b""],
m=2,
nodes=nodes, address_n=[2, 0], signatures=[b"", b"", b""], m=2
)
# multisig2 = proto.MultisigRedeemScriptType(
# pubkeys=map(lambda n: proto.HDNodePathType(node=bip32.deserialize(n.xpub), address_n=[2, 1]), nodes),

View File

@ -17,7 +17,6 @@
from trezorlib import btc, messages as proto
from trezorlib.tools import parse_path
from ..support import ckd_public as bip32
from .common import TrezorTest
@ -83,20 +82,14 @@ class TestMsgGetaddressSegwitNative(TrezorTest):
def test_show_multisig_3(self):
self.setup_mnemonic_allallall()
nodes = [
btc.get_public_node(self.client, parse_path("999'/1'/%d'" % index))
btc.get_public_node(self.client, parse_path("999'/1'/%d'" % index)).node
for index in range(1, 4)
]
multisig1 = proto.MultisigRedeemScriptType(
nodes=[bip32.deserialize(n.xpub) for n in nodes],
address_n=[2, 0],
signatures=[b"", b"", b""],
m=2,
nodes=nodes, address_n=[2, 0], signatures=[b"", b"", b""], m=2
)
multisig2 = proto.MultisigRedeemScriptType(
nodes=[bip32.deserialize(n.xpub) for n in nodes],
address_n=[2, 1],
signatures=[b"", b"", b""],
m=2,
nodes=nodes, address_n=[2, 1], signatures=[b"", b"", b""], m=2
)
for i in [1, 2, 3]:
assert (

View File

@ -14,9 +14,8 @@
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
from trezorlib import btc, messages as proto
from trezorlib import btc, ckd_public as bip32, messages as proto
from ..support import ckd_public as bip32
from .common import TrezorTest

View File

@ -14,10 +14,9 @@
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
from trezorlib import btc, messages as proto
from trezorlib import btc, ckd_public as bip32, messages as proto
from trezorlib.tools import H_
from ..support import ckd_public as bip32
from .common import TrezorTest

View File

@ -19,7 +19,6 @@ import pytest
from trezorlib import btc, messages as proto
from trezorlib.tools import H_, CallException, parse_path
from ..support.ckd_public import deserialize
from .common import TrezorTest
from .tx_cache import tx_cache
@ -413,21 +412,14 @@ class TestMsgSigntxBch(TrezorTest):
def test_send_bch_multisig_wrongchange(self):
self.setup_mnemonic_allallall()
xpubs = []
for n in map(
lambda index: btc.get_public_node(
self.client, parse_path("48'/145'/%d'" % index)
),
range(1, 4),
):
xpubs.append(n.xpub)
nodes = [
btc.get_public_node(self.client, parse_path("48'/145'/%d'" % i)).node
for i in range(1, 4)
]
def getmultisig(chain, nr, signatures=[b"", b"", b""], xpubs=xpubs):
def getmultisig(chain, nr, signatures=[b"", b"", b""], nodes=nodes):
return proto.MultisigRedeemScriptType(
nodes=[deserialize(xpub) for xpub in xpubs],
address_n=[chain, nr],
signatures=signatures,
m=2,
nodes=nodes, address_n=[chain, nr], signatures=signatures, m=2
)
correcthorse = proto.HDNodeType(
@ -459,7 +451,7 @@ class TestMsgSigntxBch(TrezorTest):
address_n=parse_path("48'/145'/1'/1/1"),
multisig=proto.MultisigRedeemScriptType(
pubkeys=[
proto.HDNodePathType(node=deserialize(xpubs[0]), address_n=[1, 1]),
proto.HDNodePathType(node=nodes[0], address_n=[1, 1]),
proto.HDNodePathType(node=correcthorse, address_n=[]),
proto.HDNodePathType(node=correcthorse, address_n=[]),
],
@ -507,21 +499,14 @@ class TestMsgSigntxBch(TrezorTest):
def test_send_bch_multisig_change(self):
self.setup_mnemonic_allallall()
xpubs = []
for n in map(
lambda index: btc.get_public_node(
self.client, parse_path("48'/145'/%d'" % index)
),
range(1, 4),
):
xpubs.append(n.xpub)
nodes = [
btc.get_public_node(self.client, parse_path("48'/145'/%d'" % i)).node
for i in range(1, 4)
]
def getmultisig(chain, nr, signatures=[b"", b"", b""], xpubs=xpubs):
def getmultisig(chain, nr, signatures=[b"", b"", b""], nodes=nodes):
return proto.MultisigRedeemScriptType(
nodes=[deserialize(xpub) for xpub in xpubs],
address_n=[chain, nr],
signatures=signatures,
m=2,
nodes=nodes, address_n=[chain, nr], signatures=signatures, m=2
)
inp1 = proto.TxInputType(

View File

@ -19,7 +19,6 @@ import pytest
from trezorlib import btc, messages as proto
from trezorlib.tools import H_, CallException, parse_path
from ..support.ckd_public import deserialize
from .common import TrezorTest
from .tx_cache import tx_cache
@ -224,21 +223,14 @@ class TestMsgSigntxBitcoinGold(TrezorTest):
def test_send_btg_multisig_change(self):
self.setup_mnemonic_allallall()
xpubs = []
for n in map(
lambda index: btc.get_public_node(
self.client, parse_path("48'/156'/%d'" % index)
),
range(1, 4),
):
xpubs.append(n.xpub)
nodes = [
btc.get_public_node(self.client, parse_path("48'/156'/%d'" % i)).node
for i in range(1, 4)
]
def getmultisig(chain, nr, signatures=[b"", b"", b""], xpubs=xpubs):
def getmultisig(chain, nr, signatures=[b"", b"", b""], nodes=nodes):
return proto.MultisigRedeemScriptType(
nodes=[deserialize(xpub) for xpub in xpubs],
address_n=[chain, nr],
signatures=signatures,
m=2,
nodes=nodes, address_n=[chain, nr], signatures=signatures, m=2
)
inp1 = proto.TxInputType(
@ -496,17 +488,12 @@ class TestMsgSigntxBitcoinGold(TrezorTest):
def test_send_multisig_1(self):
self.setup_mnemonic_allallall()
nodes = map(
lambda index: btc.get_public_node(
self.client, parse_path("49'/156'/%d'" % index)
),
range(1, 4),
)
nodes = [
btc.get_public_node(self.client, parse_path("49'/156'/%d'" % i)).node
for i in range(1, 4)
]
multisig = proto.MultisigRedeemScriptType(
nodes=[deserialize(n.xpub) for n in nodes],
address_n=[1, 0],
signatures=[b"", b"", b""],
m=2,
nodes=nodes, address_n=[1, 0], signatures=[b"", b"", b""], m=2
)
inp1 = proto.TxInputType(

View File

@ -19,7 +19,6 @@ import pytest
from trezorlib import btc, messages as proto
from trezorlib.tools import H_, CallException, parse_path
from ..support.ckd_public import deserialize
from .common import TrezorTest
from .conftest import TREZOR_VERSION
from .tx_cache import tx_cache
@ -216,17 +215,13 @@ class TestMsgSigntxSegwit(TrezorTest):
def test_send_multisig_1(self):
self.setup_mnemonic_allallall()
nodes = map(
lambda index: btc.get_public_node(
self.client, parse_path("49'/1'/%d'" % index)
),
range(1, 4),
)
nodes = [
btc.get_public_node(self.client, parse_path("49'/1'/%d'" % i)).node
for i in range(1, 4)
]
multisig = proto.MultisigRedeemScriptType(
nodes=[deserialize(n.xpub) for n in nodes],
address_n=[1, 0],
signatures=[b"", b"", b""],
m=2,
nodes=nodes, address_n=[1, 0], signatures=[b"", b"", b""], m=2
)
inp1 = proto.TxInputType(

View File

@ -15,9 +15,9 @@
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
from trezorlib import btc, messages as proto
from trezorlib.ckd_public import deserialize
from trezorlib.tools import H_, parse_path
from ..support.ckd_public import deserialize
from .common import TrezorTest
from .tx_cache import tx_cache

View File

@ -16,11 +16,9 @@
import pytest
from trezorlib import btc, messages as proto
from trezorlib import btc, ckd_public as bip32, messages as proto
from trezorlib.tools import CallException, parse_path
from ..support import ckd_public as bip32
from ..support.ckd_public import deserialize
from .common import TrezorTest
from .tx_cache import tx_cache
@ -35,15 +33,12 @@ class TestMultisig(TrezorTest):
def test_2_of_3(self):
self.setup_mnemonic_allallall()
nodes = [
btc.get_public_node(self.client, parse_path("48'/0'/%d'" % index))
btc.get_public_node(self.client, parse_path("48'/0'/%d'" % index)).node
for index in range(1, 4)
]
multisig = proto.MultisigRedeemScriptType(
nodes=[deserialize(n.xpub) for n in nodes],
address_n=[0, 0],
signatures=[b"", b"", b""],
m=2,
nodes=nodes, address_n=[0, 0], signatures=[b"", b"", b""], m=2
)
# Let's go to sign with key 1
inp1 = proto.TxInputType(
@ -125,7 +120,7 @@ class TestMultisig(TrezorTest):
# Let's do second signature using 3rd key
multisig = proto.MultisigRedeemScriptType(
nodes=[deserialize(n.xpub) for n in nodes],
nodes=nodes,
address_n=[0, 0],
signatures=[
signatures1[0],

View File

@ -14,10 +14,9 @@
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
from trezorlib import btc, messages as proto
from trezorlib import btc, ckd_public as bip32, messages as proto
from trezorlib.tools import H_, parse_path
from ..support import ckd_public as bip32
from .common import TrezorTest
from .tx_cache import tx_cache