Skip to content

Conversation

@mrice32
Copy link
Contributor

@mrice32 mrice32 commented Jan 27, 2026

No description provided.

@mrice32 mrice32 marked this pull request as draft January 27, 2026 05:34
Copy link
Contributor

@fusmanii fusmanii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just one Q

Comment on lines +350 to +352
bytes32 witness = keccak256(
abi.encodePacked(BRIDGE_AND_SWAP_WITNESS_IDENTIFIER, abi.encode(swapAndDepositData))
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we ensure witness uniqueness given that its now obtained from deposit data?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that the token implementing ERC-3009 will revert on the receiveWithAuthorization call if the witness has already been used

Also there's a nonce in SwapAndDepositData thats part of what gets hashed to generate the witness - so this can create uniqueness even if all the other intent data is identical

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, my undertsanding was the same as Taylor's, witness here is essentially the nonce for the ERC-3009 token's permit with auth

From https://eips.ethereum.org/EIPS/eip-3009 reference implementation:

        require(
            !_authorizationStates[from][nonce],
            "EIP3009: authorization is used"
        );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with the above. There is nonce reuse prevention that is per-user. The nonce within the hashed data means that a user should never have an identical witness hash unless they are accidentally reusing the same API response twice.

Signed-off-by: Ihor Farion <[email protected]>
@grasphoper
Copy link
Contributor

@mrice32 one other Q: do we need to explicitly use domainSeparator in our witness?

@mrice32
Copy link
Contributor Author

mrice32 commented Jan 28, 2026

@mrice32 one other Q: do we need to explicitly use domainSeparator in our witness?

I don't think so. I think the EIP-712 related info is only needed in the outermost layer: the 3009 data that's being signed (which contains the witness).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants