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

Improves block commit error typing (WIP) #5682

Closed
wants to merge 1 commit into from

Conversation

arya2
Copy link
Contributor

@arya2 arya2 commented Nov 21, 2022

Motivation

This is a rough draft and there are a lot of fixes to be made if it's to be pursued.

I had started on this when there wasn't much else in need of urgent attention.

Briefly opening this up for comments on whether this issue is something that could be addressed in the near-term and if this PR is in the right direction.

This is likely very low priority (though I'd be happy to be convinced otherwise) and unlikely to be merged.

Related to #2908.

Review

This PR is a rough draft.

Reviewer Checklist

  • Will the PR name make sense to users?
    • Does it need extra CHANGELOG info? (new features, breaking changes, large changes)
  • Are the PR labels correct?
  • Does the code do what the ticket and PR says?
  • How do you know it works? Does it have tests?

@arya2 arya2 added A-rust Area: Updates to Rust code do-not-merge Tells Mergify not to merge this PR labels Nov 21, 2022
@arya2 arya2 self-assigned this Nov 21, 2022
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

This looks like a good refactor. Just wondering if it is needed for the getblocktemplate work?

We are currently in an audit freeze for all other Rust changes, so we can make any audit changes quickly and easily.

We could add the branch to the ticket, and open a PR when we are out of the freeze?

@@ -271,10 +272,10 @@ where
match state_service
.ready()
.await
.map_err(VerifyBlockError::Commit)?
.expect("poll_ready method of state service and Ready::<StateService>::poll will never return Err")
Copy link
Contributor

Choose a reason for hiding this comment

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

For your information - no changes needed:

This change locks us into always having the state service ready.

That might be ok, because our design requires the service is either ready: Poll::Ready(Ok(_)), or permanently failed: Poll::Ready(Err(_)). The state service can never be temporarily paused: Poll::Pending.

The state needs to commit blocks in order. So we want to pause higher blocks, but still let lower blocks commit. But Tower services can only pause all requests, so we can't use poll_ready() to do that.

So as long as we're sure we'll never error here, even on shutdown, it would be ok to do this.

Copy link
Contributor Author

@arya2 arya2 Nov 21, 2022

Choose a reason for hiding this comment

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

Got it! I was very uncertain about this part, that's good to know.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am also unsure about this!

@arya2
Copy link
Contributor Author

arya2 commented Nov 21, 2022

Just wondering if it is needed for the getblocktemplate work?

It's not needed (unless we find out #5487 is required), I was just curious.

Thank you for taking a look.

We could add the branch to the ticket, and open a PR when we are out of the freeze?

This sounds good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code do-not-merge Tells Mergify not to merge this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants