Skip to content
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

Change candidates/kickoutList state DB implementation #1858

Merged

Conversation

koseoyoung
Copy link
Contributor

We've been storing candidate information by height key, so I change to only store current/next epoch's candidate/kickout information. And the archive node will store all of it.

  • one issue: how should we rename the funcs (~byepoch) and API not supporting byEpoch

setCandidate -> store with nextKey (mid of epoch)
setKickout -> store with next Key (end of epoch)

shift -> move next data to current data (start of epoch at createPreState())

getCandidates -> read with currentKey (in consensus, start of epoch, with next key)
getKickouts -> read with currentKey (in consensus, start of epoch, with next key)

@koseoyoung koseoyoung requested a review from a team as a code owner February 4, 2020 22:38
@codecov
Copy link

codecov bot commented Feb 4, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@5b3da64). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1858   +/-   ##
=========================================
  Coverage          ?   61.03%           
=========================================
  Files             ?      164           
  Lines             ?    13636           
  Branches          ?        0           
=========================================
  Hits              ?     8323           
  Misses            ?     4238           
  Partials          ?     1075

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b3da64...700b616. Read the comment docs.

@koseoyoung
Copy link
Contributor Author

latest commit is that

  1. poll protocol interface has 4 func- Delegates/ DelegatesOfNextEpoch/ Candidates/ CandidatesOfNextEpoch
  2. In side of consensus and blockchain, it compares tip<-> target and calls a corresponding func (call back func)
  3. Because now retrieving only tipEpoch delegate and candidate data is available, fixed some dependency with consensus unit test/ API

@koseoyoung koseoyoung force-pushed the change_stateDB_implementation branch 2 times, most recently from c882b4e to 7982b02 Compare February 11, 2020 00:53
action/protocol/poll/governance_protocol.go Outdated Show resolved Hide resolved
action/protocol/poll/governance_protocol.go Outdated Show resolved Hide resolved
action/protocol/poll/governance_protocol.go Show resolved Hide resolved
Comment on lines 160 to 167
if blkCtx.BlockHeight == 1 {
return nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if we do a shift in shiftKickoutList?

action/protocol/poll/util.go Outdated Show resolved Hide resolved
action/protocol/poll/util.go Outdated Show resolved Hide resolved
action/protocol/poll/util.go Outdated Show resolved Hide resolved
action/protocol/poll/util.go Outdated Show resolved Hide resolved
action/protocol/poll/util.go Outdated Show resolved Hide resolved
action/protocol/poll/util.go Outdated Show resolved Hide resolved
action/protocol/poll/governance_protocol.go Outdated Show resolved Hide resolved
action/protocol/poll/util.go Outdated Show resolved Hide resolved
action/protocol/poll/util.go Outdated Show resolved Hide resolved
action/protocol/poll/util.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@CoderZhi CoderZhi left a comment

Choose a reason for hiding this comment

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

Unblock it for now, a lot to modify once we have the native staking implementation.

action/protocol/poll/governance_protocol.go Outdated Show resolved Hide resolved
action/protocol/poll/governance_protocol.go Outdated Show resolved Hide resolved
@koseoyoung koseoyoung merged commit 2e20e5a into iotexproject:master Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants