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

LightClientV3

Git Source

Inherits: LightClientV2

Title: LightClientV3

LightClientV2 with an additional root for gas-efficient state authentication and

improved public input derivation for efficiency and future-proof.

State Variables

authRoot

a state value signed by validators as part of the extended light client state

uint256 public authRoot

_firstEpoch

Unfortunate re-declaration since V2 mark firstEpoch as private

uint64 internal _firstEpoch

Functions

initializeV3

function initializeV3() public onlyOwner reinitializer(3);

getVersion

function getVersion()
    public
    pure
    virtual
    override
    returns (uint8 majorVersion, uint8 minorVersion, uint8 patchVersion);

newFinalizedState

override the V2’s to disable calling it

function newFinalizedState(
    LightClientState memory,
    StakeTableState memory,
    IPlonkVerifier.PlonkProof memory
) external pure override;

newFinalizedState

See detailed doc in LightClient.sol and LightClientV2.sol

more detailed inline code comments, see LightClientV2.sol

diff w/ V2 is marked with “DIFF:” in comment

function newFinalizedState(
    LightClientState memory newState,
    StakeTableState memory nextStakeTable,
    uint256 newAuthRoot,
    IPlonkVerifier.PlonkProof memory proof
) external virtual;

Parameters

NameTypeDescription
newStateLightClientState
nextStakeTableStakeTableState
newAuthRootuint256is the authentication root corresponding to newState
proofIPlonkVerifier.PlonkProof

_getVk

function _getVk() public pure virtual override returns (IPlonkVerifier.VerifyingKey memory vk);

verifyProof

compare to V2, we change public input length from 11 to 5:

4 from votingStakeTableState, 1 from msg_signed := H(authenticated states)

function verifyProof(
    LightClientState memory state,
    StakeTableState memory nextStakeTable,
    uint256 newAuthRoot,
    IPlonkVerifier.PlonkProof memory proof
) internal virtual;