Skip to content

Add basic API for certificate validation #94

@amesgen

Description

@amesgen

A possible design looks like this:

  1. Define a new type

    data ValidatedPerasCert blk = ValidatedPerasCert {
        validatedPerasCert :: PerasCert blk
      , validatedPerasCertBoost :: PerasWeight
      }

    and a function

    validatePerasCert :: 
      PerasCfg blk ->
      PerasCert blk ->
      Either (PerasCertError blk) (ValidatedPerasCert blk)

    For now, this doesn't actually need to perform any validation, and can read the PerasWeight from the PerasCfg (for simplicity, we might want to just wrap a LedgerCfg).

    (Eventually, this will also take some kind of state, derived from the ledger state, to read eg the stake distribution and the protocol parameters from.)

  2. Change PerasCertDB.addCert to take a ValidatedPerasCert.

  3. Adapt call sites, like cert diffusion and tests (PerasCertDB as well as ChainDB q-s-m).


One immediate increase in expressiveness:

Currently, the Peras boost used for all certificates across all blocks is hard-coded via boostPerCert in O.C.Block.SupportsPeras. Concretely, whenever a certificate is added to the PerasCertDB, this is the boost value that is used when adding it to the PerasWeightSnapshot. This is definitely too limiting for the eventual case where the boost is a protocol parameter subject to on-chain governance, but it is even annoying today for testing (cf #69). The change above would makes it possible to vary the boost for different certs easily.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions