Closed blukat29 closed 1 month ago
@hyeonLewis PTAL. Without this PR, the CreateSnapshot at node startup might break.
@hyeonLewis I thought the Preload feature may be inaccurate because it stores StakingInfo keyed by block numbers. When there is a bad block then block rewind, the block state may differ on the same number. In the process of moving from number-keyed to roothash-keyed, I got to store the state. But on a second thought, while I will keep the roothash-key, but resource-wise it's better to store the StakingInfo than the whole StateDB.
@hyeonLewis Modified to store pre-calculated StakingInfo instead and tests pass. Let me polish it and fix the "can't be released" issues.
Proposed changes
Data structure
The SideState feature has two usages.
cn.New()
-- this usage will be removed as we introduce kaiax/gov and kaiax/valset. So I simply modified the existing reward.PreloadStakingInfo as a temporary fix.StateAtBlock
- properly using StakingModule.Types of changes
Please put an x in the boxes related to your change.
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
I have read the CLA Document and I hereby sign the CLA
in first time contribute$ make test
)Related issues
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...