8000 updated governance state after setHead by jeongkyun-oh · Pull Request #1756 · klaytn/klaytn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

updated governance state after setHead #1756

Closed
wants to merge 1 commit into from

Conversation

jeongkyun-oh
Copy link
Contributor

Proposed changes

  • Describe your changes to communicate to the maintainers why we should accept this pull request.
  • If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

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 CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

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...

@blukat29
Copy link
Contributor
blukat29 commented Jan 6, 2023

This PR is supposed to show below behavior:

Governance fields values after SetHead(num)
voteMap ✅ empty set
nodeAddress ✅ same as original
totalVotingPower ✅ same as original
votingPower ✅ same as original
GovernanceVotes ❓ empty set -> recreated using snap.apply()
GovernanceTallies ❓ empty set -> recreated using snap.apply()
db ✅ same as original
itemCache ❓ reloaded from db.ReadGovernance(x) but only for x in idxCache
idxCache ❓ reloaded from db.ReadRecentGovernanceIdx() but only up to num
idxCahceLock ✅ freshly created
actualGovernanceBlock ❓ last epoch block less than num
lastGovernanceStateBlock ❓ last epoch block less than num -> last checkpoint block less than num along with snap.apply()
currentSet ❓ reloaded from db.ReadGovernance(num)
changeSet ❓ empty set -> recreated using snap.apply()
currentParams ❓ reloaded from db.ReadGovernance(num) using UpdateParams()
initialParams ❓ same as original (genesis params)
TxPool ❓ same as original
blockChain ❓ same as original

if err := b.cn.engine.ReplayHeadersForGovernance(number, hash); err != nil {
logger.Error("failed to replay headers to recalculate governance state", "num", number, "hash", hash, "err", err)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should WriteGovernanceState after the replay is complete.

@blukat29
Copy link
Contributor

Continued in #1966.

@blukat29 blukat29 closed this Oct 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0