Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Errors & warnings for inappropriate RPCs #6029

Merged
merged 10 commits into from
Jul 12, 2017
Merged

Errors & warnings for inappropriate RPCs #6029

merged 10 commits into from
Jul 12, 2017

Conversation

sjeohp-zz
Copy link

@sjeohp-zz sjeohp-zz commented Jul 10, 2017

Joseph Mark added 3 commits July 10, 2017 18:20
Function checks if sealing is currently underway, not to be confused
with checking whether the engine performs internal sealing.
@sjeohp-zz sjeohp-zz requested a review from tomusdrw July 10, 2017 13:18
@parity-cla-bot
Copy link

It looks like @sjeohp hasn'signed our Contributor License Agreement, yet.

The purpose of a CLA is to ensure that the guardian of a project's outputs has the necessary ownership or grants of rights over all contributions to allow them to distribute under the chosen licence.
Wikipedia

You can read and sign our full Contributor License Agreement at the following URL: https://cla.parity.io

Once you've signed, plesae reply to this thread with [clabot:check] to prove it.

Many thanks,

Parity Technologies CLA Bot

@sjeohp-zz sjeohp-zz requested a review from keorn July 10, 2017 13:18
@sjeohp-zz sjeohp-zz changed the title Issues/4605 Errors & warnings when requesting/submitting work on internally sealing chains Jul 10, 2017
Copy link
Collaborator

@tomusdrw tomusdrw left a comment

Choose a reason for hiding this comment

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

Grumbles.

@@ -1083,6 +1083,11 @@ impl MinerService for Miner {
self.transaction_queue.read().last_nonce(address)
}

fn engine_seals_internally(&self) -> bool
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Style: keep the opening brace in the same line.

@@ -136,6 +136,9 @@ pub trait MinerService : Send + Sync {
/// Called when blocks are imported to chain, updates transactions queue.
fn chain_new_blocks(&self, chain: &MiningBlockChainClient, imported: &[H256], invalid: &[H256], enacted: &[H256], retracted: &[H256]);

/// Engine seals internally - no external input required (ie. not an Ethash chain)
fn engine_seals_internally(&self) -> bool;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I would call it more explicitly as: fn can_produce_work_package(&self) -> bool.

pub fn no_work_required() -> Error {
Error {
code: ErrorCode::ServerError(codes::NO_WORK_REQUIRED),
message: "External work is only required for Ethash engines.".into(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

for Proof of Work engines?

Copy link
Author

Choose a reason for hiding this comment

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

Hm? No work required for internal sealing engines, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, but the comment says that it's required only for Ethash engines. In principle we could support other engines that work the same way as Ethash (Request work package -> Submit seal).
So my point was that the comment can be made more general.

@sjeohp-zz
Copy link
Author

[clabot:check]

@parity-cla-bot
Copy link

It looks like @sjeohp signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

@rphmeier rphmeier added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Jul 10, 2017
@sjeohp-zz sjeohp-zz changed the title Errors & warnings when requesting/submitting work on internally sealing chains Errors & warnings for inappropriate RPC calls Jul 11, 2017
@sjeohp-zz sjeohp-zz changed the title Errors & warnings for inappropriate RPC calls Errors & warnings for inappropriate RPCs Jul 11, 2017
SStore(SSError)
SStore(SSError),
/// Inappropriate chain
InappropriateChain
Copy link
Contributor

Choose a reason for hiding this comment

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

missing ,

@@ -74,6 +76,7 @@ impl fmt::Display for SignError {
SignError::NotFound => write!(f, "Account does not exist"),
SignError::Hardware(ref e) => write!(f, "{}", e),
SignError::SStore(ref e) => write!(f, "{}", e),
SignError::InappropriateChain => write!(f, "Inappropriate chain")
Copy link
Contributor

Choose a reason for hiding this comment

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

missing ,

Error {
code: ErrorCode::ServerError(codes::NO_WORK_REQUIRED),
message: "External work is only required for Proof of Work engines.".into(),
data: None
Copy link
Contributor

Choose a reason for hiding this comment

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

missing ,

@@ -553,6 +553,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
}

fn work(&self, no_new_work_timeout: Trailing<u64>) -> Result<Work, Error> {

Copy link
Contributor

Choose a reason for hiding this comment

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

superfluous (or at least non-conventional) empty line

@gavofyork gavofyork added A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jul 11, 2017
@gavofyork
Copy link
Contributor

minor style grumbles. looks good otherwise.

@keorn keorn added A8-looksgood 🦄 Pull request is reviewed well. and removed A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Jul 11, 2017
@gavofyork gavofyork merged commit 0fca4f9 into master Jul 12, 2017
@gavofyork gavofyork deleted the issues/4605 branch July 12, 2017 06:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants