SignerIndex.sol

Overview

The SignerIndex.sol file defines the SignerIndex smart contract, which serves as a component in a blockchain-based system responsible for managing and verifying signer identities and their associated metadata. It acts as a proxy or intermediary that interacts with a root contract (BlockKeeperContractRoot) to confirm acceptance or continuation of signer status. The contract maintains signer-specific state, including readiness status and wallet association, and enforces strict access control via sender verification modifiers.

This contract primarily facilitates:

Contract: SignerIndex

State Variables

Variable

Type

Description

version

string constant

Version identifier for the contract ("1.0.0").

_signerIndex

uint16 static

Immutable index identifier for the signer, set at contract deployment.

_root

address static

Immutable address of the root contract (BlockKeeperContractRoot) managing signer indices.

_wallet

address

Address of the wallet associated with this signer index.

_ready

bool

Boolean flag indicating whether this signer index is ready (accepted).

Constructor

constructor(address wallet) senderIs(_root) accept

Private Function: ensureBalance

function ensureBalance() private pure

Public Function: isSignerIndexAccept

function isSignerIndexAccept(
    address wallet, 
    bytes blsKey, 
    uint256 pubkey, 
    uint128 rep_coef, 
    uint128 stake, 
    optional(uint128) virtualStake, 
    mapping(uint8 => string) ProxyList, 
    string myIp, 
    optional(string) nodeVersion
) public senderIs(_root) accept

Public Function: isSignerIndexAcceptContinue

function isSignerIndexAcceptContinue(
    address wallet, 
    bytes blsKey, 
    uint256 pubkey, 
    uint64 seqNoStartOld, 
    uint128 stake, 
    optional(uint128) virtualStake, 
    mapping(uint8 => string) ProxyList, 
    uint128 sumReputationCoef, 
    optional(string) nodeVersion
) public senderIs(_root) accept

Public Function: destroy

function destroy() public senderIs(_wallet) accept

External View Function: getReadyStatus

function getReadyStatus() external view returns(bool ready)

External Pure Function: getVersion

function getVersion() external pure returns(string, string)

Implementation Details

Interaction with Other System Components

Diagram: Contract Structure and Interaction Flow

classDiagram
class SignerIndex {
+string version
+uint16 static _signerIndex
+address static _root
-address _wallet
-bool _ready
+constructor(address)
-ensureBalance()
+isSignerIndexAccept(...)
+isSignerIndexAcceptContinue(...)
+destroy()
+getReadyStatus() bool
+getVersion() (string, string)
}
class BlockKeeperContractRoot {
+isSignerIndexAccepted(...)
+isSignerIndexContinue(...)
}
SignerIndex --> BlockKeeperContractRoot : calls

This class diagram illustrates the SignerIndex contract with its key properties and methods, and its interaction with the BlockKeeperContractRoot contract through external calls. The private method ensureBalance() supports other public functions internally. The destroy() method allows the wallet to self-destruct the contract.