-
Notifications
You must be signed in to change notification settings - Fork 58
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
node: add missing_iterations
logs
#1154
Conversation
a9ca8be
to
96fc593
Compare
node/src/chain/acceptor.rs
Outdated
prov.create_committee(&sortition::Config { | ||
committee_size: SELECTION_COMMITTEE_SIZE, | ||
round: blk.header().height, | ||
seed: blk.header().seed, |
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 wrong. You need mrb.header().seed
here.
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.
It also returns:
{"level":"ERROR","message":"Unable to generate voting committee for missed block","target":"node::chain::acceptor"}
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.
To resolve this error you need to update eligiblity_flag:
for iter in 0..blk.header().iteration {
let mut prov = provisioners_list.clone();
+ prov.update_eligibility_flag(blk.header().height);
let committee_keys =
prov.create_committee(&sortition::Config {
committee_size: SELECTION_COMMITTEE_SIZE,
round: blk.header().height,
- seed: blk.header().seed,
+ seed: mrb.header().seed,
step: iter * 3,
});
This should fix all issues and generate correct result.
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.
Why there is the need of update eligibility flag if the block height is already specified in the sortition config?
Maybe we should change that API (unless there is a use case for calling one of those two methods without the other one)
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.
These are distinct scenarios. In essence, for each step within a single round, it is necessary to invoke the create_committee
, whereas the update_eligibility_flag
is called only once per round execution.
node/src/chain/acceptor.rs
Outdated
@@ -270,6 +298,7 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> { | |||
fsv_bitset, | |||
ssv_bitset, | |||
block_time, | |||
generator = blk.header().generator_bls_pubkey.to_base58(), |
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.
As this is printed in Info level, why don't we use the truncated bs58 version?
{"level":"INFO","event":"block accepted","height":6,"iter":2,"hash":"ab91718e2b839959...f9e24b5b90e49eac","txs":0,"state_hash":"e72889f7b945edbf...3185aaf382334050","fsv_bitset":15,"ssv_bitset":14,"block_time":13,"generator":"rm6jwcM9xQChnVeHYw6W8HP7kW3E8nejgs4XhmKoYspQnrZL5dDcQjVR5e2UmbyNNF4DJDRdZGdYLgJfZ3qQXuhSCL6UTDkcQ2QEf6RW3aCtfqQMKCFMNaBsfNrZuzrP23Z","dur_ms":"5","target":"node::chain::acceptor"}
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.
For different reason:
- Previous node was logging it as full bs58 to properly match the staking address
- There is no truncated bs58 for the PublicKeyBytes
Anyway, we can get rid of previous impl, moving it to shortened bs58
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.
There is no value of having a full bs58 here. We may introduce (if not available already) an grpc/graphql API that prints full bs58 of the generator only on demand instead of polluting INFO level logs with extra data.
node/src/chain/acceptor.rs
Outdated
for iter in 0..blk.header().iteration { | ||
let mut prov = provisioners_list.clone(); | ||
let committee_keys = | ||
prov.create_committee(&sortition::Config { | ||
committee_size: SELECTION_COMMITTEE_SIZE, | ||
round: blk.header().height, | ||
seed: blk.header().seed, | ||
step: iter * 3, | ||
}); | ||
if committee_keys.len() != 1 { | ||
error!( | ||
"Unable to generate voting committee for missed block" | ||
) | ||
} else { | ||
let generator = committee_keys | ||
.first() | ||
.expect("committee to have 1 entry") | ||
.to_full_bs58(); | ||
warn!( | ||
event = "missed iteration", | ||
height = blk.header().height, | ||
iter, | ||
generator, | ||
); | ||
} | ||
} | ||
|
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.
nitpick: Could you move this block in a separate function for better readability? I try to keep try_accept_block
lean.
node/src/chain/acceptor.rs
Outdated
}); | ||
if committee_keys.len() != 1 { | ||
error!( | ||
"Unable to generate voting committee for missed block" |
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.
Print here the committee_keys.len().
node/src/chain/acceptor.rs
Outdated
@@ -228,6 +229,33 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> { | |||
Ok(txs) | |||
})?; | |||
|
|||
for iter in 0..blk.header().iteration { | |||
let mut prov = provisioners_list.clone(); |
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.
Duplicating the provisioners_list for every iteration could be inefficient, especially if a block originates from a higher iteration
96fc593
to
84ff576
Compare
Resolves #1150