Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 0 additions & 163 deletions l1-contracts/src/core/ProofCommitmentEscrow.sol

This file was deleted.

90 changes: 58 additions & 32 deletions l1-contracts/src/core/Rollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import {
Signature,
DataStructures,
ExtRollupLib,
IntRollupLib
IntRollupLib,
EpochRewards
} from "./RollupCore.sol";
// solhint-enable no-unused-import

Expand Down Expand Up @@ -137,56 +138,30 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
);
}

function getProofClaim()
external
view
override(IRollup)
returns (DataStructures.EpochProofClaim memory)
{
return rollupStore.proofClaim;
}

/**
* @notice Returns the computed public inputs for the given epoch proof.
*
* @dev Useful for debugging and testing. Allows submitter to compare their
* own public inputs used for generating the proof vs the ones assembled
* by this contract when verifying it.
*
* @param _epochSize - The size of the epoch (to be promoted to a constant)
* @param _start - The start of the epoch (inclusive)
* @param _end - The end of the epoch (inclusive)
* @param _args - Array of public inputs to the proof (previousArchive, endArchive, previousBlockHash, endBlockHash, endTimestamp, outHash, proverId)
* @param _fees - Array of recipient-value pairs with fees to be distributed for the epoch
* @param _aggregationObject - The aggregation object for the proof
*/
function getEpochProofPublicInputs(
uint256 _epochSize,
uint256 _start,
uint256 _end,
bytes32[7] calldata _args,
bytes32[] calldata _fees,
bytes calldata _blobPublicInputs,
bytes calldata _aggregationObject
) external view override(IRollup) returns (bytes32[] memory) {
return ExtRollupLib.getEpochProofPublicInputs(
rollupStore, _epochSize, _args, _fees, _blobPublicInputs, _aggregationObject
);
}

/**
* @notice Get the next epoch that can be claimed
* @dev Will revert if the epoch has already been claimed or if there is no epoch to prove
*/
function getClaimableEpoch() external view override(IRollup) returns (Epoch) {
Epoch epochToProve = getEpochToProve();
require(
// If the epoch has been claimed, it cannot be claimed again
rollupStore.proofClaim.epochToProve != epochToProve
// Edge case for if no claim has been made yet.
// We know that the bondProvider is always set,
// Since otherwise the claimEpochProofRight would have reverted,
// because the zero address cannot have deposited funds into escrow.
|| rollupStore.proofClaim.bondProvider == address(0),
Errors.Rollup__ProofRightAlreadyClaimed()
rollupStore, _start, _end, _args, _fees, _blobPublicInputs, _aggregationObject
);
return epochToProve;
}

/**
Expand Down Expand Up @@ -455,6 +430,57 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
return _slotNumber.epochFromSlot();
}

function getProofSubmissionWindow() external view override(IRollup) returns (uint256) {
return PROOF_SUBMISSION_WINDOW;
}

function getSequencerRewards(address _sequencer)
external
view
override(IRollup)
returns (uint256)
{
return sequencerRewards[_sequencer];
}

function getCollectiveProverRewardsForEpoch(Epoch _epoch)
external
view
override(IRollup)
returns (uint256)
{
return epochRewards[_epoch].rewards;
}

function getSpecificProverRewardsForEpoch(Epoch _epoch, address _prover)
external
view
override(IRollup)
returns (uint256)
{
EpochRewards storage er = epochRewards[_epoch];
uint256 length = er.longestProvenLength;

if (er.subEpoch[length].hasSubmitted[_prover]) {
return er.rewards / er.subEpoch[length].summedCount;
}

return 0;
}

function getHasSubmitted(Epoch _epoch, uint256 _length, address _prover)
external
view
override(IRollup)
returns (bool)
{
return epochRewards[_epoch].subEpoch[_length].hasSubmitted[_prover];
}

function getProvingCostPerMana() external view override(IRollup) returns (uint256) {
return provingCostPerMana;
}

/**
* @notice Check if msg.sender can propose at a given time
*
Expand Down
Loading
Loading