Skip to main content

Prover Contract

Overview

Polymer deploys the CrossL2ProverV2 contract (contract info), inspired by Superchain interop's CrossL2Inbox. Our implementation emphasizes on-chain proof validation with modified methods specifically designed to validate logs.

Core Validation Methods

Primary Method: validateEvent

Validate any event with a single call. For applications validating specific events emitted by their contracts on a given origin chain, this method provides a straightforward, plug-and-play solution.

validateEvent Function
function validateEvent(bytes calldata proof) 
returns (
uint32 chainId,
address emittingContract,
bytes memory topics,
bytes memory unindexedData
)

⚙️ Function Behavior

Validates a cross-chain event from a counterparty chain and returns the event along with event identifiers. The function will revert if validation fails.

Parameters

ParameterTypeDescription
proofbytes calldataA byte payload containing the IAVL proof of the application's log stored in the Polymer Rollup, along with the Sequencer-attested state root and corresponding block height.

Return Values

Return ValueTypeDescription
chainIduint32Chain ID of the emitting chain (identifier)
emittingContractaddressThe contract which emitted the event (identifier)
topicsbytes memoryThe topics array from the emitted event (indexed data)
unindexedDatabytes memoryThe ABI-encoded event data for the matched log (unindexed data)

Advanced Inspection Methods

warning

These methods are optional and designed for applications requiring enhanced transparency and proof inspection capabilities.

These methods enable applications to:

  • Perform static calls to examine proof contents
  • Inspect origin chain transaction details
  • Verify Sequencer-attested roots against public RPC endpoints
  • Match proof components against API inputs

inspectLogIdentifier

Inspect the origin transaction that a given proof corresponds to—useful for verification against API inputs.

inspectLogIdentifier Function
function inspectLogIdentifier(bytes calldata proof) 
returns (
uint32 srcChain,
uint64 blockNumber,
uint16 receiptIndex,
uint8 logIndex
)

Parameters

ParameterTypeDescription
proofbytes calldataA byte payload containing the IAVL proof of the application's log stored in the Polymer Rollup, along with the Sequencer-attested state root and corresponding block height.

Return Values

Return ValueTypeDescription
srcChainuint32Source chain that emitted the log
blockNumberuint64Block number on the source chain where the log was emitted
receiptIndexuint16Index of the transaction (receipt belongs to) in the array of all transactions in that block
logIndexuint8Index of the event in the logs array of the receipt (local to your transaction)
info

Note: logIndex is not the global log index—it's local to the specific transaction receipt.