Vyper interfaces and modules for integrating with Chainlink's CRE (Chainlink Runtime Environment) and CCIP (Cross-Chain Interoperability Protocol), built as a standalone package. Curve's Blockhash Oracle is powered by this module (https://github.com/curvefi/blockhash-oracle).
The module provides:
CCIP— sending and receiving cross-chain messages via a CCIP router (fee quoting, peer management, message transmission/receipt).CREReceiver— an abstract, permissioned receiver for Chainlink CRE workflow reports (onReport), with optional checks on forwarder, workflow author, name, and ID.IReceiver— theonReportinterface implemented by CRE report receivers.IWorkflowRegistry— a read-only interface for the CREWorkflowRegistry(always deployed on Ethereum mainnet) used to resolve a workflow's ID on-chain.
Always ensure proper peer/forwarder setup and ownership management when deploying. Code has not been audited yet and probably contains bugs.
- Call
CCIP._ccipReceive/CREReceiver._on_reportfirst in yourccipReceive/onReport, before decoding or acting on the payload. CCIP._transmitcalls the router; enable# pragma nonreentrancy onin the consuming contract so entry points that reach it cannot be re-entered mid-update. Mark only deliberate ETH receivers@reentrant, plus anysupportsInterfaceyou define yourself: routers ask it before delivering, and an answer the lock reverts reads as no receiver.CCIP._try_transmitgives each router callrouter_call_gas(500k by default) and reverts if the caller's gas cannot cover it. Exportset_router_call_gasto retune it without a redeploy; whoever sizes the caller's gas limit must follow the change.- The modules authenticate the source only. Payload validity, freshness, replay protection and ordering (CCIP out-of-order execution is always on) are the consumer's job.
- Keep
_on_report's default strict mode in production.strict_mode=Falseis for testing only: with no workflow identity configured it accepts any workflow the forwarder delivers. IWorkflowRegistrylookups return an empty struct, not a revert, for unknown workflows. Assertworkflow_id != empty(bytes32)before passing it toset_expected_workflow_id: zero there disables the check rather than rejecting everything.
Requirements:
- Python 3.12+
- Vyper 0.4.3
Testing:
# Setup virtual environment
uv venv
uv sync
source .venv/bin/activate
# Run all tests
pytest tests/Some tests (@pytest.mark.mainnet) fork Ethereum mainnet against a real CCIP router and
require a DRPC_API_KEY environment variable.
examples/ReactorConsumer.vy shows how to build a CRE report consumer on top of the
CREReceiver module: it validates the report via CREReceiver._on_report, then decodes
and acts on the payload (flagging an address). Use it as a template for wiring up your
own onReport handler.