chainweb-node
chainweb-node copied to clipboard
Per-Chain DA
Below tasks in involve the following breaking validation changes:
-
[ ] creation time depends on all parents (including adjacent). There is a chance that this is already valid for the current mainnet. [section (1.)]
-
[x] In the computation of
epochTime = endTime - epochStartTime
,endTime
is the creation time of the parent header and not on the creation time of the current header. [section (2.)] -
[ ] The block header stores the accumulative
epochTime
instead of theepochStartTime
. [section (3.)] -
[ ] The epoch time is computed as an approximation of the per-chain
solveTime
, which is different than the current used wall-clock time of the epoch. [section (4.)]
Changes should be applied/activated in order. It's (probably) possible/safe to enable all at the same block height, which must be at the start of a new epoch.
Tasks
For the top level task below,
- (1.) depends on nothing,
- (2.) depends on nothing
- (3.) depends on nothing
- (4.) depends on everything.
- (5.) mutually depends on all forking changes.
1. Make BlockHeader validation aware of adjacent headers
- [x] Subdivide inductive block header properties into single-chain and mutli-chain properties.
- [x] Refactor code to provide validation with parents from all chains.
- [x] adjust tests to either use singleton graph or mock all chains.
- [ ] Change
prop_block_creationTime
to enforce that creation time of block is strictly larger than creation time of all parents (adjacent chains and same chain).
2. Make target not depend on creation time of new header
- [x] Change DA to base epoch time on parent header and not on creation time of new header. (this will allow miners to inject the creation time without having to recompute the target)
- [ ] Adjust coordinator and miners to set block creation time close to solve time
- [ ] Adjust CPU miner to set creation time close to solve time
- [ ] Adjust bigoldchungus GPU miner to set creation time close to solve time
3. Accumulative EpochTime
- [ ] Replace
epochStart
byepochTime
.- [ ] rename property in the code
- [ ] compute
epochTime
by accumulatingcreationTime - creationTime(parent)
within an epoch. - [ ] In Target computation use
epochTime
instead of usingcreationTime - epochStartTime
. - [ ] adjust FromJSON instances (consider backward compatibility)
4. Per-Chain DA
- [ ] compute
epochTime
as solve time by accumulatingcreationTime - max_{parents} creationTime
within each epoch.
5. Transition
- [ ] come up with a plan for transitioning to the new model
- [ ] consider checkpointing all history in order to reduce complexity due to legacy code paths.
- [ ] add required guards
- [ ] come up with a test plan