-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add missing 256 bits types which are needed by Solang #25
Conversation
Signed-off-by: Sean Young <[email protected]>
See also polkadot-js/api#2752 |
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
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.
Torn on this since they are not rust primitives. What about using a custom type e.g. U256([u8; 32])
, as used in https://github.com/paritytech/parity-common/blob/master/primitive-types/src/lib.rs#L38?
Imagine if I were using this type-info to generate some rust types for decoding, I would have to generate my own U256
type.
I guess would require a bit of extra code to handle that in polkadot-js though.
I am not following this. polkadot-js can handle |
Sorry, I think what you're saying is, these shouldn't be primitives at all. There is something to be said for that, to be fair. What would be helpful is a type which is signed or unsigned of N bytes long, I think. |
Are other types such as I personally have no favorite solution but we should be very careful what support for fundamental types we add in |
I haven't seen Having these types in scale-info is very useful as it really simplifies the ABI encoding/decoding: it's simply 32 bytes rather than a compact type. Added to that, the UI already supports this. I'm hoping that this useful enough to tip the balance 😀 clang has support for ints of N bits long -- the LLVM IR has had this feature for a long time. This is exactly what Solang uses I am somewhat arguing from the point of view of what's good for solang/solidity. Looking at the larger picture, I find it harder to favour one solution over another. |
I'm also still torn. Merging on the basis that it looks like the polkadotjs PRs are already in, and if it works then 👍 I think this whole topic needs revisiting because it is a departure from the rest of the
Perhaps that is the solution, since SCALE is language agnostic so should |
I would be strictly against this since the |
With this regard we should also add |
Yeah this is part of the reason I was torn on this. I'm not certain such types belong in there, perhaps in an external crate or just use https://github.com/paritytech/parity-common/blob/master/primitive-types/src/lib.rs#L38 and add |
Signed-off-by: Sean Young [email protected]