Skip to content

PovwAccounting

Inherits: IPovwAccounting, Initializable, EIP712Upgradeable, OwnableUpgradeable, UUPSUpgradeable

State Variables

VERSION

The version of the contract, with respect to upgrades.

uint64 public constant VERSION = 1;

VERIFIER

Note: oz-upgrades-unsafe-allow: state-variable-immutable

IRiscZeroVerifier public immutable VERIFIER;

LOG_UPDATER_ID

Image ID of the work log updater guest. The log updater ensures:

*The log updater ensures:

  • Update is signed by the ECDSA key associated with the log ID.
  • State transition from initial to updated root is append-only.
  • The update value is equal to the sum of work associated with new proofs. The log updater achieves some of these properties by verifying a proof from the log builder.*

Note: oz-upgrades-unsafe-allow: state-variable-immutable

bytes32 public immutable LOG_UPDATER_ID;

TOKEN

Note: oz-upgrades-unsafe-allow: state-variable-immutable

IZKC public immutable TOKEN;

workLogCommits

mapping(address => bytes32) internal workLogCommits;

_pendingEpoch

PendingEpochStorage internal _pendingEpoch;

Functions

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor(IRiscZeroVerifier verifier, IZKC token, bytes32 logUpdaterId);

initialize

function initialize(address initialOwner) external initializer;

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal override onlyOwner;

pendingEpoch

Return the number and total work (so far) of the pending epoch.

function pendingEpoch() external view returns (PendingEpoch memory);

finalizeEpoch

Finalize the pending epoch, logging the finalized epoch number and total work.

function finalizeEpoch() public;

_finalizePendingEpoch

End the pending epoch and start the new epoch. This function should only be called after checking that the pending epoch has ended.

function _finalizePendingEpoch(uint64 newEpoch) internal;

updateWorkLog

Update a work log and log an event with the associated update value.

The stored work log root is updated, preventing the same nonce from being counted twice. Work reported in this update will be assigned to the current epoch. A receipt from the work log updater is used to ensure the integrity of the update. If an epoch is pending finalization, finalization occurs atomically with this call.

function updateWorkLog(
    address workLogId,
    bytes32 updatedCommit,
    uint64 updateValue,
    address valueRecipient,
    bytes calldata seal
) public;

workLogCommit

Get the current work log commitment for the given work log.

This commits to the consumed nonces that have been included in a log update.

function workLogCommit(address workLogId) public view returns (bytes32);