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

fix(clique): err types #59

Merged
merged 3 commits into from
Mar 13, 2019
Merged

fix(clique): err types #59

merged 3 commits into from
Mar 13, 2019

Conversation

niklasad1
Copy link

Fixes grumble #54 (comment)

@niklasad1
Copy link
Author

After this I think only the Timestamp overflows need to fixed and it should be ready to reviewed in parity

@@ -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 {
Copy link
Author

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 {
Copy link
Author

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

Copy link
Member

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.

Copy link
Member

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?

Copy link
Author

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");
Copy link
Author

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() {
Copy link
Author

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

Copy link
Member

@jwasinger jwasinger left a 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.

Copy link
Member

@jwasinger jwasinger left a 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.

@soc1c
Copy link

soc1c commented Mar 13, 2019

@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")
Copy link
Member

Choose a reason for hiding this comment

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

Too much indent here.

Copy link
Member

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.

@soc1c soc1c merged commit 941d454 into goerli:master Mar 13, 2019
@niklasad1 niklasad1 deleted the clique-errors branch March 13, 2019 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants