Conversation
…n form _validatePayload derived the supported-token lookup key with an explicit bytes20() conversion, which keeps the FIRST 20 bytes of a dynamic bytes value. For a 32-byte left-padded token address (the canonical CCIP encoding for EVM addresses) that truncates to the padding, so the adapter override silently misses while the identity comparison two lines below still uses the full left-padded value. The bridge payload for an adapter-routed token encodes the adapter as toToken, so such messages revert with InvalidToken on verification: valid transfers for adapter-configured tokens cannot be verified. Derive the lookup key from the already-padded bytes32 instead (address(uint160(uint256(expected)))), so the lookup and the identity comparison agree for every input length up to 32 bytes. Adds a regression test covering a 32-byte-encoded destTokenAddress with a configured adapter (fails with InvalidToken before this change). Signed-off-by: SashaMIT <sash.t.mitchell@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
LombardVerifier._validatePayload, the supported-token lookup key is derived with an explicitbytes20()conversion, while the token-identity comparison two lines below usesInternal._leftPadBytesToBytes32:An explicit
bytes20()conversion of a dynamicbytesvalue keeps the leftmost 20 bytes. For a 32-byte left-padded address (the canonicalabi.encode(address)form CCIP uses for EVM addresses) that yields 12 zero bytes plus the first 8 bytes of the real address, so:expectedstays the padded token address,forwardToVerifierdeposited through the adapter, so the bridge payload'stoTokenis the adapter,InvalidToken.Net effect: valid transfers for adapter-configured tokens cannot be verified when
destTokenAddressarrives in the 32-byte form, with no length guard on the field to rule that representation out.Fix
Derive the lookup key from the already-padded
bytes32:so the adapter lookup and the identity comparison resolve the same address for every input length up to 32 bytes.
Test plan
test_verifyMessage_32ByteEncodedTokenWithAdapter: 32-byteabi.encodeddestTokenAddresswith a configured adapter; reverts withInvalidTokenbefore this change, passes afterforge test --match-path "*LombardVerifier*")Made with Cursor
Made with Cursor