-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix proposal policy transition rules #483
Conversation
@heifner The commit 59e716e passed most tests, but failed a few. Can you see anything obviously wrong? Thanks.
|
…proposer_policy_at, get_computed_scheduled_producer with get_scheduled_producer_at, and computed_active_producers with scheduled_active_producers_at
@arhag The current PR has not implemented the enhancement described by #454:
This is due to the fact the
But at that time we don't know the QC claim of the next block and cannot calculate the last_final_block_timestamp .
But we know the |
libraries/chain/include/eosio/chain/block_header_state_utils.hpp
Outdated
Show resolved
Hide resolved
Note:start |
…that LIB advances every 12 blocks
return detail::get_scheduled_producer(get_active_proposer_policy_for_block_at(t)->proposer_schedule.producers, t); | ||
} | ||
|
||
const producer_authority_schedule* block_header_state::get_next_producer_schedule() const { |
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.
Is this correct? We need a timestamp to know if these will be active.
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.
This is changed to pending_producers
.
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.
This still seems like an odd API to me. What do we need it for?
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.
By net_plugin and chain_plugin. Please see the discussion in telegram channel.
…ducers to better match what it is returning
Consider the following case:
In the current implementation, the first block in round 3 will not use the proposer policy that was proposed in round 1 despite that being our intention. That would however be the case if there was a block present in the 12th time slot of round 2.
Fixing the bug means that at the time of building a new block that is the first block of a round, it will always choose as the active proposal policy the last proposed proposer policy in the blockchain that was not proposed from a block in the current round or the one prior.
Instead of a
map
to track all the proposed proposal policies in theblock_header_state
, only twooptional
fields:latest_pending_proposer_policy
andlatest_proposed_proposer_policy
are needed. Additionally, instead of tracking anactive_time
with each proposed policy, we just track the timestamp in which it was proposed:proposal_time
.When creating a
block_header_state
for the first block of a round, those fields are computed by:latest_proposed_proposer_policy
is notnullopt
and itsproposal_time
indicates that it was proposed in a round before the prior round, then promotelatest_proposed_proposer_policy
toactive_proposer_policy
.latest_pending_proposer_policy
andlatest_proposed_proposer_policy
should be set tonullopt
at this point in time (latest_proposed_proposer_policy
may still be changed in later steps).latest_pending_proposer_policy
is notnullopt
, promotelatest_pending_proposer_policy
toactive_proposer_policy
.latest_pending_proposer_policy
should be set tonullopt
at this point in time (may still be changed in later steps).latest_proposed_proposer_policy
is notnullopt
andlatest_pending_proposer_policy
is nownullopt
,latest_proposed_proposer_policy
is moved intolatest_pending_proposer_policy
. If it is moved, thenlatest_proposed_proposer_policy
is set tonullopt
at this point in time (may still be changed in later steps).The final related step should occur for any block (whether it is the first block of the round or not) and can only be computed after the block has been assembled:
latest_proposed_proposer_policy
(replacing whatever happened to be there).Resolves #454