-
Notifications
You must be signed in to change notification settings - Fork 4
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(clique): err types #59
Conversation
After this I think only the |
5d8c7dd
to
98218fe
Compare
@@ -405,8 +404,12 @@ impl Engine<EthereumMachine> for Clique { | |||
let mut seal: Vec<u8> = Vec::with_capacity(VANITY_LENGTH + SIGNATURE_LENGTH); | |||
|
|||
// At this point, extra_data should only contain miner vanity. | |||
if header.extra_data().len() > VANITY_LENGTH { | |||
panic!("on_seal_block: unexpected extra_data: {:?}", header); | |||
if header.extra_data().len() != VANITY_LENGTH { |
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 more accurate because VANITY_DATA
should be 32 bytes but it may be out-of-scope for this PR
} | ||
} | ||
} | ||
if header.extra_data().len() < VANITY_LENGTH + SIGNATURE_LENGTH { |
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.
only style cleanup to reduce the indentation level but it will fetch the state before trying to read the signer
.
Also might be out-of-scope
for this PR
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 doesn't seem to be any issue with this that I can identify off the top of my head.
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.
Actually.. this adds a bit of extra overhead that we don't need. Can we move state query after the signer is read?
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.
Yeah, let's revert it
} | ||
} | ||
} else { | ||
trace!(target: "engine", "populate_from_parent: no signer registered"); |
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.
new trace might be annoying if no signer is enabled!
Can revert it
assert!(tester.new_block_and_import(CliqueBlockType::Empty, &b, None, 'A').is_err()); | ||
let err = tester.new_block_and_import(CliqueBlockType::Empty, &b, None, 'A').unwrap_err(); | ||
|
||
match err.kind() { |
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.
ugly workaround because error_chain::ErrorKind
doesn't implement PartialEq
AFAIU
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.
LGTM other than a few formatting/stylistic issues.
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.
LGTM other than a few formatting/stylistic issues.
@jwasinger sorry, I wasn't aware org members only have read access, you should be able to review now |
"just pushed to front, reference must exist; qed" | ||
)?.parent_hash()); | ||
let last_checkpoint_hash = *chain.front() | ||
.expect("chain has at least one element; qed") |
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.
Too much indent 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.
Jk.. this just looks terrible in github. Looks fine on my editor locally.
Fixes grumble #54 (comment)