Skip to content

Tests use a bugged implementation of LibERC7579 of Solady #137

@Kelvyne

Description

@Kelvyne

The ERC-7579 states that :

The execution mode is a bytes32 value that is structured as follows:

callType (1 byte): 0x00 for a single call, 0x01 for a batch call, 0xfe for staticcall and 0xff for delegatecall
execType (1 byte): 0x00 for executions that revert on failure, 0x01 for executions that do not revert on failure but implement some form of error handling
unused (4 bytes): this range is reserved for future standardization
modeSelector (4 bytes): an additional mode selector that can be used to create further execution modes
modePayload (22 bytes): additional data to be passed

The implementation of Solady has the following code:

    function encodeMode(bytes1 callType, bytes1 execType, bytes4 selector, bytes22 payload)
        internal
        pure
        returns (bytes32 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, callType)
            mstore(0x01, execType)
            mstore(0x02, selector)
            mstore(0x06, 0)
            mstore(0x0a, payload)
            result := mload(0x00)
        }
    }

which I believe swaps the unused 4 bytes and the selector 4 bytes.
This was later fixed but the dependency of Kernel seems to be the outdated.

I don't think there are any implication other than some tests not passing (or missing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions