Skip to main content

LineaRollup

CONTRACT_VERSION

string CONTRACT_VERSION

This is the ABI version and not the reinitialize version.

VERIFIER_SETTER_ROLE

bytes32 VERIFIER_SETTER_ROLE

The role required to set/add proof verifiers by type.

VERIFIER_UNSETTER_ROLE

bytes32 VERIFIER_UNSETTER_ROLE

The role required to set/remove proof verifiers by type.

GENESIS_SHNARF

bytes32 GENESIS_SHNARF

The default genesis shnarf using empty/default hashes and a default state.

SHNARF_EXISTS_DEFAULT_VALUE

uint256 SHNARF_EXISTS_DEFAULT_VALUE

Value indicating a shnarf exists.

EMPTY_HASH

bytes32 EMPTY_HASH

The default hash value.

BLS_CURVE_MODULUS

uint256 BLS_CURVE_MODULUS

The BLS Curve modulus value used.

POINT_EVALUATION_PRECOMPILE_ADDRESS

address POINT_EVALUATION_PRECOMPILE_ADDRESS

The well-known precompile address for point evaluation.

POINT_EVALUATION_RETURN_DATA_LENGTH

uint256 POINT_EVALUATION_RETURN_DATA_LENGTH

The expected point evaluation return data length.

POINT_EVALUATION_FIELD_ELEMENTS_LENGTH

uint256 POINT_EVALUATION_FIELD_ELEMENTS_LENGTH

The expected point evaluation field element length returned.

SIX_MONTHS_IN_SECONDS

uint256 SIX_MONTHS_IN_SECONDS

In practice, when used, this is expected to be a close approximation to 6 months, and is intentional.

dataFinalStateRootHashes

mapping(bytes32 => bytes32) dataFinalStateRootHashes

DEPRECATED in favor of the single blobShnarfExists mapping.

dataParents

mapping(bytes32 => bytes32) dataParents

DEPRECATED in favor of the single blobShnarfExists mapping.

dataShnarfHashes

mapping(bytes32 => bytes32) dataShnarfHashes

DEPRECATED in favor of the single blobShnarfExists mapping.

dataStartingBlock

mapping(bytes32 => uint256) dataStartingBlock

DEPRECATED in favor of the single blobShnarfExists mapping.

dataEndingBlock

mapping(bytes32 => uint256) dataEndingBlock

DEPRECATED in favor of the single blobShnarfExists mapping.

currentL2StoredL1MessageNumber

uint256 currentL2StoredL1MessageNumber

DEPRECATED in favor of currentFinalizedState hash.

currentL2StoredL1RollingHash

bytes32 currentL2StoredL1RollingHash

DEPRECATED in favor of currentFinalizedState hash.

currentFinalizedShnarf

bytes32 currentFinalizedShnarf

Contains the most recent finalized shnarf.

blobShnarfExists

mapping(bytes32 => uint256) blobShnarfExists

NB: THIS IS THE ONLY MAPPING BEING USED FOR DATA SUBMISSION TRACKING. NB: This was shnarfFinalBlockNumbers and is replaced to indicate only that a shnarf exists with a value of 1.

currentFinalizedState

bytes32 currentFinalizedState

Hash of the L2 computed L1 message number, rolling hash and finalized timestamp.

fallbackOperator

address fallbackOperator

The address of the fallback operator.

This address is granted the OPERATOR_ROLE after six months of finalization inactivity by the current operators.

constructor

constructor() public

initialize

function initialize(struct ILineaRollup.InitializationData _initializationData) external

Initializes LineaRollup and underlying service dependencies - used for new networks only.

DEFAULT_ADMIN_ROLE is set for the security council. OPERATOR_ROLE is set for operators. Note: This is used for new testnets and local/CI testing, and will not replace existing proxy based contracts.

Parameters

NameTypeDescription
_initializationDatastruct ILineaRollup.InitializationDataThe initial data used for proof verification.

reinitializeLineaRollupV6

function reinitializeLineaRollupV6(struct IPermissionsManager.RoleAddress[] _roleAddresses, struct IPauseManager.PauseTypeRole[] _pauseTypeRoles, struct IPauseManager.PauseTypeRole[] _unpauseTypeRoles, address _fallbackOperator) external

Sets permissions for a list of addresses and their roles as well as initialises the PauseManager pauseType:role mappings and fallback operator.

This function is a reinitializer and can only be called once per version. Should be called using an upgradeAndCall transaction to the ProxyAdmin.

Parameters

NameTypeDescription
_roleAddressesstruct IPermissionsManager.RoleAddress[]The list of addresses and roles to assign permissions to.
_pauseTypeRolesstruct IPauseManager.PauseTypeRole[]The list of pause types to associate with roles.
_unpauseTypeRolesstruct IPauseManager.PauseTypeRole[]The list of unpause types to associate with roles.
_fallbackOperatoraddressThe address of the fallback operator.

renounceRole

function renounceRole(bytes32 _role, address _account) public

Revokes role from the calling account.

Fallback operator cannot renounce role. Reverts with OnlyNonFallbackOperator.

Parameters

NameTypeDescription
_rolebytes32The role to renounce.
_accountaddressThe account to renounce - can only be the _msgSender().

setVerifierAddress

function setVerifierAddress(address _newVerifierAddress, uint256 _proofType) external

Adds or updates the verifier contract address for a proof type.

VERIFIER_SETTER_ROLE is required to execute.

Parameters

NameTypeDescription
_newVerifierAddressaddressThe address for the verifier contract.
_proofTypeuint256The proof type being set/updated.

setFallbackOperator

function setFallbackOperator(uint256 _messageNumber, bytes32 _rollingHash, uint256 _lastFinalizedTimestamp) external

Sets the fallback operator role to the specified address if six months have passed since the last finalization.

Reverts if six months have not passed since the last finalization.

Parameters

NameTypeDescription
_messageNumberuint256Last finalized L1 message number as part of the feedback loop.
_rollingHashbytes32Last finalized L1 rolling hash as part of the feedback loop.
_lastFinalizedTimestampuint256Last finalized L2 block timestamp.

unsetVerifierAddress

function unsetVerifierAddress(uint256 _proofType) external

Unset the verifier contract address for a proof type.

VERIFIER_UNSETTER_ROLE is required to execute.

Parameters

NameTypeDescription
_proofTypeuint256The proof type being set/updated.

submitBlobs

function submitBlobs(struct ILineaRollup.BlobSubmission[] _blobSubmissions, bytes32 _parentShnarf, bytes32 _finalBlobShnarf) external

Submit one or more EIP-4844 blobs.

OPERATOR_ROLE is required to execute. This should be a blob carrying transaction.

Parameters

NameTypeDescription
_blobSubmissionsstruct ILineaRollup.BlobSubmission[]The data for blob submission including proofs and required polynomials.
_parentShnarfbytes32The parent shnarf used in continuity checks as it includes the parentStateRootHash in its computation.
_finalBlobShnarfbytes32The expected final shnarf post computation of all the blob shnarfs.

submitDataAsCalldata

function submitDataAsCalldata(struct ILineaRollup.CompressedCalldataSubmission _submission, bytes32 _parentShnarf, bytes32 _expectedShnarf) external

Submit blobs using compressed data via calldata.

OPERATOR_ROLE is required to execute.

Parameters

NameTypeDescription
_submissionstruct ILineaRollup.CompressedCalldataSubmissionThe supporting data for compressed data submission including compressed data.
_parentShnarfbytes32The parent shnarf used in continuity checks as it includes the parentStateRootHash in its computation.
_expectedShnarfbytes32The expected shnarf post computation of all the submission.

_computeLastFinalizedState

function _computeLastFinalizedState(uint256 _messageNumber, bytes32 _rollingHash, uint256 _timestamp) internal pure returns (bytes32 hashedFinalizationState)

Internal function to compute and save the finalization state.

Using assembly this way is cheaper gas wise.

Parameters

NameTypeDescription
_messageNumberuint256Is the last L2 computed L1 message number in the finalization.
_rollingHashbytes32Is the last L2 computed L1 rolling hash in the finalization.
_timestampuint256The final timestamp in the finalization.

_computeShnarf

function _computeShnarf(bytes32 _parentShnarf, bytes32 _snarkHash, bytes32 _finalStateRootHash, bytes32 _dataEvaluationPoint, bytes32 _dataEvaluationClaim) internal pure returns (bytes32 shnarf)

Internal function to compute the shnarf more efficiently.

Using assembly this way is cheaper gas wise.

Parameters

NameTypeDescription
_parentShnarfbytes32The shnarf of the parent data item.
_snarkHashbytes32Is the computed hash for compressed data (using a SNARK-friendly hash function) that aggregates per data submission to be used in public input.
_finalStateRootHashbytes32The final state root hash of the data being submitted.
_dataEvaluationPointbytes32The data evaluation point.
_dataEvaluationClaimbytes32The data evaluation claim.

_verifyPointEvaluation

function _verifyPointEvaluation(bytes32 _currentDataHash, uint256 _dataEvaluationPoint, uint256 _dataEvaluationClaim, bytes _kzgCommitment, bytes _kzgProof) internal view

Performs point evaluation for the compressed blob.

_dataEvaluationPoint is modular reduced to be lower than the BLS_CURVE_MODULUS for precompile checks.

Parameters

NameTypeDescription
_currentDataHashbytes32The current blob versioned hash.
_dataEvaluationPointuint256The data evaluation point.
_dataEvaluationClaimuint256The data evaluation claim.
_kzgCommitmentbytesThe blob KZG commitment.
_kzgProofbytesThe blob KZG point proof.

finalizeBlocks

function finalizeBlocks(bytes _aggregatedProof, uint256 _proofType, struct ILineaRollup.FinalizationDataV3 _finalizationData) external

Finalize compressed blocks with proof.

OPERATOR_ROLE is required to execute.

Parameters

NameTypeDescription
_aggregatedProofbytesThe aggregated proof.
_proofTypeuint256The proof type.
_finalizationDatastruct ILineaRollup.FinalizationDataV3The full finalization data.

_finalizeBlocks

function _finalizeBlocks(struct ILineaRollup.FinalizationDataV3 _finalizationData, uint256 _lastFinalizedBlock) internal returns (bytes32 finalShnarf)

Internal function to finalize compressed blocks.

Parameters

NameTypeDescription
_finalizationDatastruct ILineaRollup.FinalizationDataV3The full finalization data.
_lastFinalizedBlockuint256The last finalized block.

Return Values

NameTypeDescription
finalShnarfbytes32The final computed shnarf in finalizing.

_validateL2ComputedRollingHash

function _validateL2ComputedRollingHash(uint256 _rollingHashMessageNumber, bytes32 _rollingHash) internal view

Internal function to validate l1 rolling hash.

Parameters

NameTypeDescription
_rollingHashMessageNumberuint256Message number associated with the rolling hash as computed on L2.
_rollingHashbytes32L1 rolling hash as computed on L2.

_calculateY

function _calculateY(bytes _data, bytes32 _dataEvaluationPoint) internal pure returns (bytes32 compressedDataComputedY)

Internal function to calculate Y for public input generation.

Each chunk of 32 bytes must start with a 0 byte. The dataEvaluationPoint value is modulo-ed down during the computation and scalar field checking is not needed. There is a hard constraint in the circuit to enforce the polynomial degree limit (4096), which will also be enforced with EIP-4844.

Parameters

NameTypeDescription
_databytesCompressed data from submission data.
_dataEvaluationPointbytes32The data evaluation point.

Return Values

NameTypeDescription
compressedDataComputedYbytes32The Y calculated value using the Horner method.