Skip to content

Solana-to-Base transfer.to recipient encoding is not clearly documented and is easy to misuse #190

@mssystem1

Description

@mssystem1

TokenLib.finalizeTransfer() decodes the EVM recipient address from transfer.to using:

address to = address(bytes20(transfer.to));

This takes the first 20 bytes of the bytes32 value.

That means Solana-to-Base EVM recipients must be encoded as left-aligned bytes20 inside bytes32:

bytes32(bytes20(recipient))

This is easy to misuse because common Solidity-style address-to-bytes32 encoding is often right-aligned:

bytes32(uint256(uint160(recipient)))

If a client or integration uses right-aligned encoding, the bridge may decode the wrong recipient address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions