-
Notifications
You must be signed in to change notification settings - Fork 0
Description
A possible design looks like this:
-
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 thePerasCfg
(for simplicity, we might want to just wrap aLedgerCfg
).(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.)
-
Change
PerasCertDB.addCert
to take aValidatedPerasCert
. -
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.