fix: dryRun check + fix multiple solutions bug#443
Conversation
src/monitor.rs
Outdated
| .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.
dry run the extrinsic before submitting, if that fails bail
There was a problem hiding this comment.
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.
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.
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
| 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.
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.
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.
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
No description provided.