-
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
feat(cardano): conway staking certificates #86
base: master
Are you sure you want to change the base?
Conversation
2f2adc9
to
bfad4c7
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.
Apart from the comments, LGTM!
cfa8c24
to
c20cefc
Compare
Handled comments except for the naming which I believe hasn't been decided on yet |
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.
For now LGTM! Let's add the third certificate.
98ed741
to
e6c17c4
Compare
core/src/apps/cardano/layout.py
Outdated
def _format_drep(drep: messages.CardanoDRep) -> tuple[str, str]: | ||
if drep.type == CardanoDRepType.KEY_HASH: | ||
assert drep.key_hash is not None # validate_drep | ||
return ( | ||
"Delegating to key hash:", | ||
bech32.encode(bech32.HRP_KEY_HASH, drep.key_hash), | ||
) | ||
elif drep.type == CardanoDRepType.SCRIPT_HASH: | ||
assert drep.script_hash is not None # validate_drep | ||
return ( | ||
"Delegating to script:", | ||
bech32.encode(bech32.HRP_SCRIPT_HASH, drep.script_hash), | ||
) |
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.
@janmazak just to make sure - the drep key hash / script hash should be displayed with the usual addr_vkh
and script
bech32 prefixes, right?
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.
The source code of this demo app suggests the prefix should be drep
const dRepIDBech32 = dRepID.to_bech32('drep');
But I wasn't able to find anything about it elsewhere
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.
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.
https://github.com/cardano-foundation/CIPs/blob/master/CIP-0005/README.md?plain=1#L118
@Ryun1 thanks, that explains key-hash drep IDs, is it also specified somewhere whether a script-hash drep ID should also have this prefix, or should it just be "script"?
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.
LGTM, I will do one final pass when we finalize the remaining features :)
a6ac340
to
8e84fc5
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.
Apart from the comments, LGTM.
Please also run make pystyle
.
certificate.key_hash, | ||
ProcessError("Invalid certificate"), | ||
) | ||
|
||
account_path_checker.add_certificate(certificate) | ||
|
||
|
||
def _validate_structure(certificate: messages.CardanoTxCertificate) -> None: | ||
pool = certificate.pool # local_cache_attribute | ||
pool_parameters = certificate.pool_parameters # local_cache_attribute |
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 don't understand these comments --- should the newly added items get some comments too?
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 don't understand them either. I gather they're used for some metaprogramming to reduce code size but I'm not sure when to use them. But it's a trivial fix so I expect to find out in a review from trezor
|
||
# See https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml | ||
_CBOR_RAW_TAG = const(0x18) # Tag 24 | ||
_CBOR_SET_TAG = const(0x102) # Tag 258 |
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.
What about tag 30? It is used in pool registration for unit_interval, so I'd perhaps expect it to appear in this list too?
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.
For whatever reason, all the cbor constants are private in this file. But yeah tag 30 is used in pool registration. Tag 24 is also used somewhere but, again, hardcoded instead of using the constant that already exists here
What about increased max URL / DNS name length? Not included in this PR yet? |
fdbfa20
to
8cd00fd
Compare
|
|
8cd00fd
to
6a8b99c
Compare
Right, length update added to this pr |
9846b99
to
d8922c3
Compare
d8922c3
to
7cd8dad
Compare
9ca2c8d
to
ad9b6e7
Compare
Update with select Cardano Conway features:
https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/conway/impl/cddl-files/conway.cddl
https://github.com/cardano-foundation/CIPs/tree/master/CIP-0005
https://github.com/cardano-foundation/CIPs/tree/master/CIP-1694
https://sancho.network/tools-resources/faq/#4-certificate-and-transaction-field-witnesses-and-deposits