Calls

noteStalled

Note that the current authority set of the GRANDPA finality gadget has stalled. This will trigger a forced authority set change at the beginning of the next session, to be enacted delay blocks after that. The delay should be high enough to safely assume that the block signalling the forced change will not be re-orged e.g. 1000 blocks. The block production rate (which may be slowed down because of finality lagging) should be taken into account when choosing the delay. The GRANDPA voters based on the new authority will start voting on top of best_finalized_block_number for new finalized blocks. best_finalized_block_number should be the highest of the latest finalized block of all validators of the new authority set.
Note: Only callable by root.
Namespace
api.tx.grandpa.noteStalled
Type
function noteStalled(
  delay: u32,
  best_finalized_block_number: u32
)

reportEquivocation

Report voter equivocation/misbehavior. This method will verify the equivocation proof and validate the given key ownership proof against the extracted offender. If both are valid, the offence will be reported. Namespace
api.tx.grandpa.reportEquivocation
Type
function reportEquivocation(
  equivocation_proof: SpFinalityGrandpaEquivocationProof,
  key_owner_proof: SpCoreVoid
)

reportEquivocationUnsigned

Report voter equivocation/misbehavior. This method will verify the equivocation proof and validate the given key ownership proof against the extracted offender. If both are valid, the offence will be reported. This extrinsic must be called unsigned and it is expected that only block authors will call it (validated in ValidateUnsigned), as such if the block author is defined it will be defined as the equivocation reporter. Namespace
api.tx.grandpa.reportEquivocationUnsigned
Type
function reportEquivocationUnsigned(
  equivocation_proof: SpFinalityGrandpaEquivocationProof,
  key_owner_proof: SpCoreVoid
)

Storage

currentSetId

The number of changes (both in terms of keys and underlying economic responsibilities) in the “set” of Grandpa validators from genesis. Namespace
api.query.grandpa.currentSetId
Type
function currentSetId(

): u64

nextForced

next block number where we can force a change. Namespace
api.query.grandpa.nextForced
Type
function nextForced(

): Option<u32>

pendingChange

Pending change: (signaled at, scheduled change). Namespace
api.query.grandpa.pendingChange
Type
function pendingChange(

): Option<PalletGrandpaStoredPendingChange>

setIdSession

A mapping from grandpa set ID to the index of the most recent session for which its members were responsible. TWOX-NOTE: SetId is not under user control. Namespace
api.query.grandpa.setIdSession
Type
function setIdSession(
  u64
): Option<u32>

stalled

true if we are currently stalled. Namespace
api.query.grandpa.stalled
Type
function stalled(

): Option<(u32,u32)>

state

State of the current authority set. Namespace
api.query.grandpa.state
Type
function state(

): PalletGrandpaStoredState

Events

NewAuthorities

New authority set has been applied. Namespace
api.events.grandpa.NewAuthorities
Type
type NewAuthorities = {
  authority_set: Vec<(SpFinalityGrandpaAppPublic,u64)>
}

Paused

Current authority set has been paused. Namespace
api.events.grandpa.Paused
Type
type Paused = {

}

Resumed

Current authority set has been resumed. Namespace
api.events.grandpa.Resumed
Type
type Resumed = {

}

Errors

ChangePending

Attempt to signal GRANDPA change with one already pending. Namespace
api.errors.grandpa.ChangePending

DuplicateOffenceReport

A given equivocation report is valid but already previously reported. Namespace
api.errors.grandpa.DuplicateOffenceReport

InvalidEquivocationProof

An equivocation proof provided as part of an equivocation report is invalid. Namespace
api.errors.grandpa.InvalidEquivocationProof

InvalidKeyOwnershipProof

A key ownership proof provided as part of an equivocation report is invalid. Namespace
api.errors.grandpa.InvalidKeyOwnershipProof

PauseFailed

Attempt to signal GRANDPA pause when the authority set isn’t live (either paused or already pending pause). Namespace
api.errors.grandpa.PauseFailed

ResumeFailed

Attempt to signal GRANDPA resume when the authority set isn’t paused (either live or already pending resume). Namespace
api.errors.grandpa.ResumeFailed

TooSoon

Cannot signal forced change so soon after last. Namespace
api.errors.grandpa.TooSoon

Constants

maxAuthorities

Max Authorities in use Namespace
api.consts.grandpa.maxAuthorities
Type
type maxAuthorities = u32

JSON-RPC Methods

proveFinality

Prove finality for the given block number, returning the Justification for the last block in the set. Interface
api.rpc.grandpa.proveFinality(blockNumber: BlockNumber): Option<EncodedFinalityProofs>
JSON
{ "id":1, "jsonrpc":"2.0", "method":"grandpa_proveFinality", "params":[blockNumber: BlockNumber] }

roundState

Returns the state of the current best round state as well as the ongoing background rounds Interface
api.rpc.grandpa.roundState(): ReportedRoundStates
JSON
{ "id":1, "jsonrpc":"2.0", "method":"grandpa_roundState", "params":[] }

subscribeJustifications

Subscribes to grandpa justifications Interface
api.rpc.grandpa.subscribeJustifications(): JustificationNotification
JSON
{ "id":1, "jsonrpc":"2.0", "method":"grandpa_subscribeJustifications", "params":[] }