Skip to content
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

Conway [12.0.0-alpha.4] - New certificates .kind() return in correct value. #642

Closed
Ryun1 opened this issue Sep 8, 2023 · 3 comments
Closed

Comments

@Ryun1
Copy link

Ryun1 commented Sep 8, 2023

Using Conway Alpha Build: @emurgo/[email protected].

Describe the bug

  • When using the .kind() call on new Conway certificates I get incorrect indexes, when comparing to the Conway CDDL schema.
  • Using .kind() on older certificates the correct value is returned.
  • Perhaps I misunderstand what .kind() is meant to do?

Expected behaviour

Old Certificates (working):

  • console.log(CSL.Certificate.new_stake_registration(CSL.StakeRegistration.new(randomCredential)).kind());
    • 0 is expected and 0 is returned.
  • console.log(CSL.Certificate.new_stake_deregistration(CSL.StakeDeregistration.new(randomCredential)).kind());
    • 1 is expected and 1 is returned.
  • console.log(CSL.Certificate.new_stake_delegation(CSL.StakeDelegation.new(randomCredential, randomKeyHash)).kind());
    • 2 is expected and 2 is returned.

New Certificates (not working):

  • console.log(CSL.Certificate.new_vote_delegation(CSL.VoteDelegation.new(randomCredential, randomDRep)).kind());
    • 9 is expected (see CDDL), but 15 is returned.
  • console.log(CSL.Certificate.new_drep_registration(dRepRegCert).kind());
    • 16 is expected (see CDDL), but 10 is returned.
  • console.log(CSL.Certificate.new_drep_deregistration(dRepDeRegCert).kind());
    • 17 is expected (see CDDL), but 9 is returned.

(sorry I did not have time to test every new cert🙏)

@lisicky
Copy link
Contributor

lisicky commented Sep 8, 2023

It is not cbor map key. It is number of our internal enum. See CertificateKind enum to match types from kind() function. Also as there is possibility to serialize StakeRegistration and StakeDeregistration with coin and without coin these types have two constructors new and new_with_coin depends on it these types serialize into different certs according to CDDL.

@Ryun1
Copy link
Author

Ryun1 commented Sep 8, 2023

Understood - thank you @lisicky 🙏

@Ryun1 Ryun1 closed this as completed Sep 8, 2023
@lisicky
Copy link
Contributor

lisicky commented Sep 8, 2023

If you wanna to check a cbor map key of certificate you can serialize a certificate into cbor in look into cbor by third party tool. Like https://cardananium.github.io/cquisitor/ (made by me) or https://cbor.nemo157.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants