Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CuttingBoardManagerV1_1

Git Source

Inherits: CuttingBoardManager

Title: CuttingBoardManagerV1_1

Upgrade adding three capabilities to CuttingBoardManager:

  1. validateWeights — public view exposing the internal _validateWeights check so keepers, the syndicate, and off-chain monitoring can verify whether a set of weights would pass under current BeraChef rules without submitting a transaction.
  2. refreshAllocation — keeper-gated function that re-queues the current active reward allocation for a validator controlled by an NFT. Bypasses the propose/approve flow since the weights have not changed. Designed for the BeraChef rewardAllocationInactivityBlockSpan which can cause an unchanged allocation to become stale and fall back to the default if not periodically refreshed.
  3. isAllocationAtRisk — view that checks whether a validator's active allocation is approaching the inactivity boundary and will need a refresh soon.

State Variables

_STORAGE_LOCATION

bytes32 private constant _STORAGE_LOCATION =
    0x9fd5aaf305ec5d9d4acf2d4a2d8f6d67e82cf32b8c76929329ec5790707b7d00

Functions

_getStorage

function _getStorage()
    private
    pure
    returns (CuttingBoardManagerStorage storage $);

validateWeights

Check whether weights satisfy current BeraChef rules.

Pure read-only logic reimplemented as view since the inherited _validateWeights lacks the view modifier (deployed V1 cannot be changed).

function validateWeights(IBeraChef.Weight[] calldata weights)
    external
    view
    virtual
    returns (bool valid);

Returns

NameTypeDescription
validboolTrue if valid otherwise false

refreshAllocation

Re-queue the current active allocation for a validator to prevent inactivity-based staleness in BeraChef.

Keeper-only, bypasses the 2-step propose/approve flow since the weights are unchanged. Reads the validator's current active allocation directly from BeraChef and re-queues it via Infrared. Requirements:

  • NFT must be valid (active and not expired).
  • The validator must have an active allocation with weights.
  • No queued allocation may be pending for this validator.
  • Respects rewardAllocationBlockDelay between updates.
function refreshAllocation(uint256 tokenId)
    external
    virtual
    whenNotPaused
    onlyKeeper;

Parameters

NameTypeDescription
tokenIduint256The control NFT token ID.

isAllocationAtRisk

Check if a validator's active allocation is approaching staleness.

Returns true if the allocation's start block plus the inactivity span is within marginBlocks of the current block number. Returns false if the inactivity span is not configured (returns 0) or the validator has no active allocation.

function isAllocationAtRisk(bytes memory validatorPubkey)
    public
    view
    virtual
    returns (bool atRisk, uint256 blocksRemaining);

Parameters

NameTypeDescription
validatorPubkeybytesThe validator's 48-byte public key.

Returns

NameTypeDescription
atRiskboolTrue if stale for more than half inactivity period.
blocksRemaininguint256Blocks until inactivity deadline (0 if already stale or if inactivity span is not configured).

Events

AllocationRefreshed

Emitted when a keeper refreshes an allocation without changing weights.

event AllocationRefreshed(
    uint256 indexed tokenId, bytes validatorPubkey, uint64 startBlock
);

Errors

NoActiveAllocation

Thrown when the active allocation has no weights to refresh.

error NoActiveAllocation();