Skip to content

Firedrill contracts#546

Open
vicentevieytes wants to merge 25 commits intomainfrom
vv/fire-drills
Open

Firedrill contracts#546
vicentevieytes wants to merge 25 commits intomainfrom
vv/fire-drills

Conversation

@vicentevieytes
Copy link
Collaborator

No description provided.

@vicentevieytes vicentevieytes marked this pull request as ready for review February 2, 2026 17:35
@vicentevieytes vicentevieytes requested a review from a team as a code owner February 2, 2026 17:35
Copilot AI review requested due to automatic review settings February 2, 2026 17:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces firedrill contracts - a testing framework for simulating CCIP message flows on TON. The implementation includes three main contracts (OnRamp, OffRamp, and Entrypoint) that emit events and facilitate end-to-end testing of the CCIP protocol without full deployment complexity.

Changes:

  • Added three new firedrill contracts (OnRamp, OffRamp, Entrypoint) with TypeScript wrappers and Tolk implementations
  • Enhanced log handling to support new price update events (UsdPerTokenUpdated, UsdPerUnitGasUpdated)
  • Fixed OffRamp buffer loading logic to use remainingBits instead of explicit length

Reviewed changes

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

Show a summary per file
File Description
contracts/wrappers/firedrill/FiredrillOnRamp.ts TypeScript wrapper for OnRamp contract with message emission functionality
contracts/wrappers/firedrill/FiredrillOffRamp.ts TypeScript wrapper for OffRamp contract with commit report handling
contracts/wrappers/firedrill/FiredrillEntrypoint.ts Main entrypoint contract managing firedrill flow coordination
contracts/wrappers/firedrill.*.compile.ts Compilation configuration files for the three firedrill contracts
contracts/wrappers/ccip/OffRamp.ts Updated buffer loading to use remainingBits for cross-chain addresses
contracts/wrappers/ccip/Logs.ts Added new log types and handlers for price update events
contracts/tests/firedrill/*.spec.ts Comprehensive test suites for all firedrill contracts
contracts/tests/firedrill/Firedrill.Setup.ts Test setup utilities and helper functions
contracts/tests/ccip/OffRamp.spec.ts Added test verification for onRamp address after update
contracts/tests/Logs.ts Added handlers for new price update log types
contracts/scripts/deployFiredrillComplete.ts Deployment script for complete firedrill system
contracts/contracts/firedrill/*.tolk Tolk contract implementations for firedrill system

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 445 to 465
const modifiedMsg = {
sourceChainSelector: msg.sourceChainSelector,
config: {
router: msg.config.router.toString(),
isEnabled: msg.config.isEnabled,
minSeqNr: msg.config.minSeqNr,
isRMNVerificationDisabled: msg.config.isRMNVerificationDisabled,
onRamp: msg.config.onRamp,
}
}

const modifiedMatch = {
sourceChainSelector: match.sourceChainSelector,
config: {
router: match.config.router.toString(),
isEnabled: match.config.isEnabled,
minSeqNr: match.config.minSeqNr,
isRMNVerificationDisabled: match.config.isRMNVerificationDisabled,
onRamp: match.config.onRamp,
}
}
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

The code attempts to call .toString() on match.config.router but doesn't verify that match.config.router exists or is an Address before calling the method. If the router property is undefined in the partial match object, this will throw a runtime error. Add a null/undefined check or use optional chaining: router: match.config?.router?.toString()

Copilot uses AI. Check for mistakes.
matchesObject(msg, match)
return true
})

Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

The testLogUsdPerUnitGasUpdated function has an empty line before the closing brace and after the return statement (line 542). This is inconsistent with the style of other similar functions in this file. Remove the empty line on line 542.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +13
struct FiredrillEntrypoint_Storage {
id: uint32;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we don't need the firedrill_* prefix on these contracts. They are already inside the firedrill directory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is done throughout the firedrill contracts for the rest of the chains, I think it makes sense to keep it this way

}

enum FiredrillEntrypoint_Error {
Unauthorized = 3000,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused

Comment on lines 13 to 16
const entrypointCode = await compile('firedrill.entrypoint');
const onRampCode = await compile('firedrill.onramp');
const offRampCode = await compile('firedrill.offramp');
console.log('✅ Contracts compiled');
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use already built bytecode with loadContractCode

Copy link
Collaborator Author

@vicentevieytes vicentevieytes Feb 4, 2026

Choose a reason for hiding this comment

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

These compile really quickly and we won't be redeploying them often, I prefer to have them compile, that way we are sure that we did not deploy any outdated bytecode because we forgot to build

@ogtownsend
Copy link
Collaborator

@bukata-sa could you help review from a firedrill setup standpoint once you get a chance please 🙏

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.

3 participants