-
Notifications
You must be signed in to change notification settings - Fork 186
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
[Feature] Implement sol-types
traits in sol!
without tuples
#261
Comments
this should have been fixed by the Encodable trait being implemented for |
This might also be related to this message: Basically, there could be an issue between how Solidity encodes: abi.encode(bytes,bytes[]) (without offset) and: let encoded_inputs = <sol! { (bytes, bytes[]) }>::abi_encode(...) which adds an offset ( When doing: <sol! { (address, uint128) }>::abi_encode(&( There is no such issues as (address, uint128) is a fixed-size structure, so it does not introduce extra offsets. I encountered such problem when trying to interact with UniversalRouter: https://github.com/Uniswap/universal-router/blob/main/contracts/UniversalRouter.sol#L44 SolidityNo offset Welcome to Chisel! Type `!help` to show available commands.
➜ bytes memory a = hex"aa"
➜ bytes memory b = hex"ff"
➜ bytes memory c = abi.encode(a,b)
➜ c
Type: dynamic bytes
├ Hex (Memory):
├─ Length ([0x00:0x20]): 0x00000000000000000000000000000000000000000000000000000000000000c0
├─ Contents ([0x20:..]): 0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001aa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001ff00000000000000000000000000000000000000000000000000000000000000
├ Hex (Tuple Encoded):
├─ Pointer ([0x00:0x20]): 0x0000000000000000000000000000000000000000000000000000000000000020
├─ Length ([0x20:0x40]): 0x00000000000000000000000000000000000000000000000000000000000000c0
└─ Contents ([0x40:..]): 0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001aa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001ff00000000000000000000000000000000000000000000000000000000000000 Alloy-rsOffset added let c = <sol! { (bytes, bytes) }>::abi_encode(&([0xaa], [0xff]));
info!("c: {:?}", hex::encode(&c));
|
Component
sol! macro
Describe the feature you would like
Currently we implement all traits by deferring everything to a tuple of the inner types (struct, function arguments and returns, etc.).
This is bad because it:
Additional context
No response
The text was updated successfully, but these errors were encountered: