-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/mintlayer pk #1
base: mintlayer-master
Are you sure you want to change the base?
Conversation
bddbd25
to
967640b
Compare
5abd648
to
798be63
Compare
I wouldn't merge this to master but rather created a separate branch like One thing to consider is that CI might not work for "our" master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I can see, there are still many FIXMEs and commented lines, so it seems like this is still work-in-progress.
core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h
Outdated
Show resolved
Hide resolved
941d641
to
dd3f1e8
Compare
08dce8d
to
77bb6af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
554dbfd
to
0e27aff
Compare
2456d64
to
781eb0d
Compare
781eb0d
to
c929c9a
Compare
c75c2a2
to
9fb3fc1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it makes sense to review it one more time after the comments are applied.
@pytest.mark.setup_client( | ||
mnemonic="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" | ||
) | ||
def test_mintlayer_get_public_key(client: Client): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need tests for get_address as well (both for testbet and mainnet).
Though I'm still not sure how the network type should be passed to the firmware. The original code seems to use CoinInfo for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I'm still not sure how the network type should be passed to the firmware. The original code seems to use CoinInfo for that.
I think we should use CoinInfo
too, so that we can call validate_path_against_script_type
in get_address/get_public_key/sign_message
, which will ensure that the derivation path is correct and show a warning to the user if it's not (as I can see from the code at least)
9fb3fc1
to
6e03e86
Compare
Regarding |
15c716f
to
a6eca9f
Compare
a6eca9f
to
40022df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, trezor-client is outdated, e.g. it references MintlayerRequestType::TXMETA
which is no longer there.
And the brach refactor/wallet-generic-signer
in the main repo seems to be outdated too. I wonder if you just forgot to push the changes.
\b | ||
$ trezorctl mintlayer get-address -n m/44h/19788h/0h/0/0 | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to have an example for --coin
, including its possible values.
core/src/apps/mintlayer/__init__.py
Outdated
if name == REGTEST_COIN.coin_name: | ||
return REGTEST_COIN | ||
|
||
raise ValueError(f"unknown coin type {name}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This results in a cryptic message in trezorctl: Error: FirmwareError: Firmware error
. We should either catch such exceptions later and rethrow something from wire.errors
, such as DataError
, or throw DataError
in the first place.
(I suggest aways throwing DataError or one of its friends from wire.errors
unless we actually need to catch the exception in the firmware).
coin_info.prefixes.public_key_hash, data, Encoding.BECH32M | ||
) | ||
else: | ||
raise ValueError(f"Unknown Address type {msg.address_type}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataError?
raise ValueError("Token Fixed supply without amount") | ||
fixed_amount = int.from_bytes(x.total_supply.fixed_amount, "big") | ||
formated_amount = format_amount(fixed_amount, x.number_of_decimals) | ||
total_supply = f"FIXED {formated_amount}" | ||
else: | ||
raise ValueError("Unhandled Token total supply type") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataError?
message MintlayerSignMessage { | ||
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node | ||
required string coin_name = 2; // Coin to use Testnet or Mainnet | ||
required MintlayerAddressType address_type = 3; // destination address in bech32 encoding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong comment
1768ae8
to
361cb0a
Compare
877bde1
to
04bd932
Compare
Add new messages in the proto files for Mintlayer coin support, and handlers.