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

decoding structured arrays from bytes #105

Open
cruzdanilo opened this issue Dec 1, 2024 · 0 comments
Open

decoding structured arrays from bytes #105

cruzdanilo opened this issue Dec 1, 2024 · 0 comments
Labels
question Further information is requested

Comments

@cruzdanilo
Copy link

does the current spec support decoding bytes into arbitrary arrays?

i'm trying to write a registry entry for uniswap's universal router. the main interface has multiple bytes arguments.

/// @notice Executes encoded commands along with provided inputs. Reverts if deadline has expired.
/// @param commands A set of concatenated commands, each 1 byte in length
/// @param inputs An array of byte strings containing abi encoded inputs for each command
/// @param deadline The deadline by which the transaction must be executed
function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable;

according to the spec, there are only 2 formats for bytes: raw and calldata. calldata can only decode other calls, which is not the case. i might be missing something, but it seems like this interface is significantly more complex than what's contemplated in the standard:

  • bytes commands is a packed array, not abi-decodable, each byte is a command
  • bytes[] inputs is an array of bytes
    • same number of elements as commands.length
    • each element is abi-decodable, but with different types and lengths depending on the corresponding command byte in commands (by index)
    • the dynamic length requires some kind of pagination. on the stax device it would probably make sense to have one screen per command in the approval flow. this could be somehow configured through the existing display.formats[signature].screens field

apart from uniswap itself, other applications use this same interface, like velodrome/aerodrome, and its usage is well spread, so it's important to support it.

@jnicoulaud-ledger jnicoulaud-ledger added the question Further information is requested label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants