Skip to content

[NONEVM-5608] Fix Receiver_CCIPReceive potential overflow - #841

Open
duck-types wants to merge 3 commits into
mainfrom
fix/ccip-receive-overflow
Open

[NONEVM-5608] Fix Receiver_CCIPReceive potential overflow#841
duck-types wants to merge 3 commits into
mainfrom
fix/ccip-receive-overflow

Conversation

@duck-types

@duck-types duck-types commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

NONEVM-5608

Receiver_CCIPReceive serialization was: 553-1065 bits, 1-2 refs.

Long sender can cause an overflow in serialization

@duck-types duck-types changed the title Fix Receiver_CCIPReceive potential overflow [NONEVM-5608] Fix Receiver_CCIPReceive potential overflow Aug 20, 2026
@duck-types
duck-types changed the base branch from sec/overflow-static-analyzer to main August 20, 2026 17:39
@duck-types
duck-types force-pushed the fix/ccip-receive-overflow branch from 50e332c to 8051889 Compare August 20, 2026 17:44
@duck-types
duck-types requested a lite review from Copilot August 21, 2026 12:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes potential Receiver_CCIPReceive serialization overflow by moving the message payload into a referenced cell and migrating bindings, scripts, and tests.

Changes:

  • Updates Receiver and Router serialization.
  • Adds generated Receiver/TestReceiver bindings.
  • Migrates deployment scripts, gas reports, and tests.

Final findings:

  • Critical (2 votes): The inline-to-reference format is wire-incompatible with deployed 1.6.1 receivers; a compatible or explicitly versioned migration path is needed.
  • Critical (3 votes): The gas-report setup references a nonexistent artifact; use ccip.test.receiver.
  • Moderate (2 votes): Add a regression test using a 64-byte sender to cover the overflow boundary.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Summary
contracts/wrappers/link.chain.ton.ccip.lib.Receiver.compile.ts Adds Receiver binding compiler configuration.
contracts/wrappers/libraries/Receiver.ts Removes the handwritten serializer.
contracts/wrappers/gen/index.ts Registers generated bindings.
contracts/wrappers/gen/ccip/TestReceiver.ts Adds the generated TestReceiver wrapper.
contracts/wrappers/gen/ccip/Router.ts Updates generated message encoding.
contracts/wrappers/gen/ccip/Receiver.ts Adds the generated Receiver wrapper.
contracts/wrappers/examples/Receiver.ts Updates Receiver metadata usage.
contracts/tests/gas-report/ccip/messaging/opMapFunc.ts Updates opcode mappings.
contracts/tests/gas-report/ccip/messaging/OffRamp.spec.ts Migrates gas-report receiver setup.
contracts/tests/ExitCode.spec.ts Updates generated error references.
contracts/tests/ccip/router/Router.ccipReceive.spec.ts Uses the generated Receiver opcode.
contracts/tests/ccip/Receiver.spec.ts Migrates Receiver tests.
contracts/tests/ccip/offramp/OffRamp.Setup.ts Migrates receiver setup.
contracts/tests/ccip/offramp/OffRamp.execute.spec.ts Migrates behavior calls.
contracts/scripts/updateReceiverBehavior.ts Uses the generated wrapper.
contracts/scripts/deployReceiver.ts Uses the generated wrapper.
contracts/contracts/lib/receiver/wrapper.tolk Adds a binding-generation stub contract.
contracts/contracts/lib/receiver/messages.tolk Stores messages in a referenced cell.
contracts/contracts/ccip/test/receiver/storage.tolk Renames the behavior enum.
contracts/contracts/ccip/test/receiver/messages.tolk Updates enum references.
contracts/contracts/ccip/test/receiver/contract.tolk Loads cell-backed messages.
contracts/contracts/ccip/router/contract.tolk Forwards cell-backed messages.
contracts/Acton.toml Registers Receiver contracts.
Suppressed comments (1)

contracts/tests/ccip/Receiver.spec.ts:48

  • The regression target is not exercised here: the updated receive tests use the fixed EVM_ADDRESS fixture, while CrossChainAddressCodec accepts addresses up to 64 bytes. Add a test that builds/routes Receiver_CCIPReceive with a 64-byte sender and verifies the message is accepted; otherwise the overflow fix can regress without detecting the original failure.
    sender: EVM_ADDRESS,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread contracts/contracts/lib/receiver/messages.tolk
Comment thread contracts/contracts/lib/receiver/messages.tolk
Comment thread contracts/tests/gas-report/ccip/messaging/OffRamp.spec.ts Outdated
@duck-types
duck-types marked this pull request as ready for review August 21, 2026 13:14
@duck-types
duck-types requested a review from a team as a code owner August 21, 2026 13:14
@duck-types
duck-types requested a review from krebernisak August 21, 2026 13:14
@duck-types
duck-types force-pushed the fix/ccip-receive-overflow branch from 6c7414d to 49b3ec2 Compare August 26, 2026 13:05
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.

2 participants