-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: integrate HeaderValidator
+ make FileClient
generic over block
#12681
base: main
Are you sure you want to change the base?
Conversation
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.
scope has grown to #12475, conflicts with #12521 @TropicalDog17
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.
lgtm, one q
@@ -46,7 +46,9 @@ impl<'a> PostExecutionInput<'a> { | |||
|
|||
/// Consensus is a protocol that chooses canonical chain. | |||
#[auto_impl::auto_impl(&, Arc)] | |||
pub trait Consensus<H = Header, B = BlockBody>: HeaderValidator<H> + Debug + Send + Sync { | |||
pub trait Consensus<H = Header, B = BlockBody>: | |||
AsHeaderValidator<H> + HeaderValidator<H> + Debug + Send + Sync |
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.
hmm, isn't this AsHeaderValidator<H>
bound redundant if AsHeaderValidator is impl for all HeaderValidator
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.
doesn't compile without it, unsure why exactly, probably has something to do with the fact that we are invoking this on Arc
impl
error[E0599]: no method named `as_header_validator` found for struct `Arc<dyn reth_consensus::Consensus>` in the current scope
--> crates/stages/stages/src/sets.rs:250:35
|
250 | consensus.clone().as_header_validator(),
| ^^^^^^^^^^^^^^^^^^^ method not found in `Arc<dyn Consensus>`
|
::: /Users/klkvr/github/reth/crates/consensus/consensus/src/lib.rs:150:8
|
150 | fn as_header_validator<'a>(self: Arc<Self>) -> Arc<dyn HeaderValidator<H> + 'a>
| -------------------
| |
| the method is available for `Arc<Arc<dyn reth_consensus::Consensus>>` here
| the method is available for `Arc<&Arc<dyn reth_consensus::Consensus>>` here
|
help: consider wrapping the receiver expression with the appropriate type
|
250 | Arc::new(consensus.clone()).as_header_validator(),
| +++++++++ +
help: consider wrapping the receiver expression with the appropriate type
|
250 | Arc::new(&consensus.clone()).as_header_validator(),
Integrates
HeaderValidator
from #12648 intoReverseHeadersDownloader
. This required a small helper for casting traits (AsHeaderValidator
)Additionaly makes
FileClient
generic over block getting us closer to abstraction of CLI