-
Notifications
You must be signed in to change notification settings - Fork 1
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
Value
s for collections
#30
Conversation
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.
Nice! I've left some comments
solarkraft/src/state/value.ts
Outdated
// Additionally, fixed-length byte arrays are valid only if their declared length matches their actual length | ||
case "arr": { | ||
const cast = (v as ArrValue) | ||
const lenMismatch = ((typeof (cast.len)) !== 'undefined') && (cast.val.length !== cast.len) |
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 missed that: Why do we need explicit array length, if we can compute it from the value length?
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.
If you look at the bytesN
constructor, that's exactly what it does. For now, I just want to keep parity with the Soroban types, where Bytes
and BytesN
are distinct, and if it turns out we don't need it we can axe it later.
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 great!
closes #23
Introduces types and constructors for all remaining
Value
s (byte arrays, vectors and maps).Note the following additional refactoring:
[0, 2^n]
, should have been[0, 2^n)
)u32T
has its own type declaration (to work with byte array type restrictions)