-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ACP-181 ProposerVM Epochs #181
base: main
Are you sure you want to change the base?
Conversation
Epochs have a constant duration $D$, such that for any given epoch $E_n$, the difference between its start and end times equals this duration: | ||
|
||
$$ | ||
T_{end}^n - T_{start}^n = D | ||
$$ | ||
|
||
$D$ is hardcoded into the ProposerVM source code, and may only be changed by a required network upgrade. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if, instead of having a set epoch duration, where edge case 2
.
You would lose being able to keep track of the numbering of the epochs, but I don't think that's important anyway. In this case we should always be able to check the timestamp of the start of the epoch, because we already have to know PChainEpochHeight
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's a long gap between the epoch's end time and the block that seals it, you'd still have the same situation of PChainEpochHeight
and PChainHeight
skew.
Predictable epochs make implementing the current implementation very straightforward. I initially decided against including pseudocode of this in the ACP itself, but think it would go a long way to explaining why the definition is what it is. I'll add that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure it would eliminate the skew and actually simplify the current implementation. I'll write out an example...
D = 100
Epoch 0
Tstart = 0
Tend = 100
PChainEpochHeight = 0
Block 1 time = 0
Block 2 time = 57
Block 3 time = 99
Block 4 time = 103 SEALS EPOCH 0
Epoch 1
Tstart = 103
Tend = 203
PChainEpochHeight = 4
Block 5 time = 107
Block 6 time = 202
Block 7 time = 215 SEALS EPOCH 1
Epoch 2
Tstart = 215
Tend = 315
PChainEpochHeight = 7
Block 8 time = 400 SEALS EPOCH 2
Epoch 3
Tstart = 400
Tend = 500
PChainEpochHeight = 8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All we need to check is if the timestamp of the parent is greater than D + timestamp of the PChainEpochHeight of the parent
. If so, we advance the epoch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The edge case occurs if there's a long gap between the last block within the epoch bounds and the block that seals the epoch. Modifying your example:
Epoch 0 Tstart = 0 Tend = 100 PChainEpochHeight = 0
Block 1 time = 0
Block 2 time = 57
Block 3 time = 99
Block 4 time = 500 SEALS EPOCH 0
Block 4 will use the same PChainEpochHeight
as block 1, even though many epoch durations have elapsed.
Proposes enabling epochs in the ProposerVM to provide more stable views of the P-Chain to inner VMs
Rendered