-
Notifications
You must be signed in to change notification settings - Fork 13
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: dryRun check
+ fix multiple solutions bug
#443
Conversation
src/monitor.rs
Outdated
@@ -426,6 +440,14 @@ async fn submit_and_watch_solution<T: MinerConfig + Send + Sync + 'static>( | |||
.tx() | |||
.create_signed_with_nonce(&tx, &*signer, nonce, ExtrinsicParams::default())?; | |||
|
|||
let outcome = api.rpc().dry_run(xt.encoded(), None).await?; |
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.
dry run the extrinsic before submitting, if that fails bail
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.
Should be optional, via a flag, in case we are running against a node that does not support unsafe RPCs.
Perhaps the default can be with dry-run, and --no-dry-run
flag added.
Or, if you prefer to keep it flexible, we always do-run iff it is available
Lastly, needs to inform devops that our nodes should expose unsafe RPCs :)
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.
let's add a flag then forgot that that RPC is unsafe
if e.code() == BAD_EXTRINSIC_FORMAT || e.code() == VERIFICATION_ERROR { | ||
if e.code() == BAD_EXTRINSIC_FORMAT || | ||
e.code() == VERIFICATION_ERROR || e.code() == | ||
ErrorCode::MethodNotFound.code() |
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.
if we got back method not found
is most likely because the RPC method was unsafe, then just terminate.
all solutions will be rejected anyway then
dryRun check
+ fix multiple solutions bugdryRun check
+ fix multiple solutions bug
Please add these project to the NPoS project as it helps me find them faster 👍 |
src/opt.rs
Outdated
@@ -223,6 +223,13 @@ pub struct MonitorConfig { | |||
/// configured, it might re-try and lose funds through transaction fees/deposits. | |||
#[clap(long, short, env = "SEED")] | |||
pub seed_or_path: String, | |||
|
|||
/// Verify the submission by `dry-run` the extrinsic to check the validity. | |||
/// If it fails then the block is ignored. |
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.
What does this mean? What block is ignored?
I guess what you are trying to say is: If this is set, against a node that does not support unsafe RPCs, then we don't submit anything?
I think we should test this at startup, and immediately terminate. Every time we connect to a node, if we have this flag set, we should check it it supports the unsafe stuff or not.
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.
Nah, it means if the dry-run fails on a solution at block x then we simply emit a warning and drop that solution.
Then we try on the next block.
Fair enough, it could be good to have a proper error if the RPC call itself is denied because of "unsafe", currently we just terminate when that occurs with the error from substrate.
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.
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
No description provided.