The main thrust of this PR is implementing Stake Relativization, but in doing so, a few issues with the orphan handling and fork management code came up and so this PR has gotten a bit more complex with the various fixes.
Unfortunately the bugs were revealed after I had done the majority of the stake relativization implementation otherwise I would have split them out into smaller PR's.
notable bugs:
orphans from complex branching structures failed to validate
we would lose track of the current branch on re-org
The main thrust of this PR is implementing Stake Relativization, but in doing so, a few issues with the orphan handling and fork management code came up and so this PR has gotten a bit more complex with the various fixes.
Unfortunately the bugs were revealed after I had done the majority of the stake relativization implementation otherwise I would have split them out into smaller PR's.
notable bugs:
I've updated the specification in Notion from learnings having gone through the implementation process, namely the inference period is no longer the entire epoch, we need a stable value for total stake for when we enter the next epoch: https://www.notion.so/Stake-Relativization-65f5ed5522b64c36b625652023318d88?pvs=4#6e3c4d567eda49079822662075b847ed