rchain / rchip-proposals

Where RChain improvement proposals can be submitted
Apache License 2.0
8 stars 5 forks source link

On-chain shard configuration storage. #24

Open nzpr opened 4 years ago

nzpr commented 4 years ago

Motivation

1. To allow seamless experience for new node joining the shard. Casper protocol has variables that all nodes in a shard have to obey, otherwise peers can slash each other. At the moment some of them are defined on node startup with CLI option/config file. The most obvious one is --max-number-if-parents. These parameters should be on chain, so node operator has no option aside from following on-chain configuration.

2. To increase decentralisation by extracting shard level variables from the scope of the core protocol. Core protocol for RChain network is a set of rules all nodes in the network have to obey and is governed by RChain Cooperative. But there are variables that each shard free/can/have-to to decide on. Core protocol contracts (e.g. PoS) should only reference shard configuration.

3. To give ability for shard variables to be changed with multisig. Each shard can have its own governance process for shard level variables, from social consensus to on-chain stake weighted voting. Multisig covers all cases.

4. To prepare for future sharding implementation. All shard level logic have to be abstracted from the core protocol.

Subject of this RCHIP

Design

Name Definition
shardName Name of a shard
faultToleranceThreshold Number from [-10^8; 10^8]. Actual faultToleranceThreshold is this value divided by 10^8
maxNumberOfParents Maximum number of parents allowed
maxParentDepth Maximum depth of parent allowed (see https://github.com/rchain/rchain/pull/2816)
finalizationRate Finalization will be triggered when (block-height % finalizationRate) = 0
synchronyConstraintThreshold Node is allowed to create block only when % of stake in justification blocks is more then this percent of total stake in the shard
heightConstraintThreshold (experimental) Node is allowed to create block only if last finalised block is behind tip no more then this value
deployLifespan Validators will try to put deploy in a block only for next deployLifespan blocks. Enable protection from re-submitting duplicate deploys
casperVersion Version of Casper that shard is running
configVersion Version of this config
bondMaximum Max bond amount allowed in the shard
bondMinimum Min bond amount allowed in the shard
epochLength Epoch length. On epoch change the following events happen: new validators bonding, validator rotation, rewards distribution. TBD, clarification is needed
quarantineLength Quarantine length. TBD, clarification is needed
{
    shardName: GString,
    faultToleranceThreshold: GInt,
    maxNumberOfParents: GInt,
    maxParentDepth: GInt,
    finalizationRate: GInt,
    synchronyConstraintThreshold: GString,
    heightConstraintThreshold: GInt,
    deployLifespan: GInt,
    casperVersion: GInt,
    configVersion: GInt,
    bondMinimum: GInt,
    bondMaximum: GInt,
    epochLength: GInt,
    quarantineLength: GInt
}

Implementation