-
Notifications
You must be signed in to change notification settings - Fork 14
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:add Mary protocol parameters support #589
Conversation
997486d
to
2b3a091
Compare
ledger/shelley.go
Outdated
type Nonce struct { | ||
cbor.StructAsArray | ||
Type uint `cbor:"0,keyasint"` | ||
Value any `cbor:"1,keyasint,omitempty"` |
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.
Remove these cbor
tags. They don't do anything when using cbor.StructAsArray
. The keyasint
and omitempty
tags only work when dealing with a map (this is a list).
ledger/shelley.go
Outdated
type Nonce struct { | ||
cbor.StructAsArray | ||
Type uint `cbor:"0,keyasint"` | ||
Value any `cbor:"1,keyasint,omitempty"` |
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 nonce value is bytes .size 32
according to the CDDL, so we should use [32]byte
instead of any
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.
When I set to [32]byte, it cannot unmarshal positive integer into Go struct field struct { StructAsArray cbor.StructAsArray; Type uint; Value [32]uint8 }.Value of type [32]uint8
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.
Then I tried to use temp struct
tmp := struct {
cbor.StructAsArray
Type uint
Value []byte
}{}
And got
cbor: cannot unmarshal positive integer into Go struct field struct { StructAsArray cbor.StructAsArray; Type uint; Value []uint8 }.Value of type []uint8
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 tried also
tmp := struct {
cbor.StructAsArray
Type uint
Value []uint8
}{}
I am not sure what does error want to tell me
{ | ||
name: "UnsupportedNonceType", | ||
data: []byte{0x83, 0x00, 0x01, 0x02}, | ||
}, |
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 doesn't actually fail. Your unmarshal function is checking the first value in the list (0
in this case), which is a supported value. Instead I'd use something like 8102
([2]
), which will cause an error.
04b9cf6
to
f6dc9e2
Compare
Signed-off-by: Ales Verbic <verbotenj@blinklabs.io>
f6dc9e2
to
5a5d5d2
Compare
Closes #326