-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Plug ovm codec into ImportOpCommand #12759
Plug ovm codec into ImportOpCommand #12759
Conversation
this is incomplete and cuts too many corners. but the bigger issue is |
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.
build_import_pipeline
fails to compile with the error
error[E0271]: type mismatch resolving `<DatabaseProvider<<<N as NodeTypesWithDB>::DB as Database>::TXMut, N> as BlockWriter>::Body == BlockBody`
--> crates/optimism/cli/src/commands/build_pipeline.rs:95:14
|
95 | .builder()
| ^^^^^^^ expected `BlockBody`, found a different `BlockBody`
|
= note: `BlockBody` and `BlockBody` have similar names, but are actually distinct types
note: `BlockBody` is defined in crate `reth_primitives`
--> /home/dkathiriya/projects/reth/crates/primitives/src/block.rs:591:1
|
591 | pub struct BlockBody {
| ^^^^^^^^^^^^^^^^^^^^
note: `BlockBody` is defined in the current crate
--> crates/optimism/cli/src/ovm_file_codec.rs:102:1
|
102 | pub struct BlockBody {
| ^^^^^^^^^^^^^^^^^^^^
= note: required for `BodyStage<TaskDownloader<BlockBody>>` to implement `reth_stages::Stage<DatabaseProvider<<<N as NodeTypesWithDB>::DB as reth_db::Database>::TXMut, N>>`
= note: required for `OnlineStages<ProviderFactory<N>, ..., ...>` to implement `StageSet<DatabaseProvider<<<N as NodeTypesWithDB>::DB as reth_db::Database>::TXMut, N>>`
= note: 1 redundant requirement hidden
= note: required for `DefaultStages<ProviderFactory<...>, ..., ..., ...>` to implement `StageSet<DatabaseProvider<<<N as NodeTypesWithDB>::DB as reth_db::Database>::TXMut, N>>`
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.
I assume fixing this would require a large refactor of DatabaseProvider
?
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.
DatabaseProvider
is generic over N: NodeTypes
, so should be possible to use with custom N::Primitives
, i.e. making a new type
pub struct OvmPrimitives {
type BlockBody = ovm_file_codec::BlockBody;
..
}
and implementing the reth_primitives_traits::BlockBody
trait for ovm_file_codec::BlockBody
etc. then make a copy of the OpNode
called OvmNode
, replacing type Primitives = OpPrimitives
with type Primitives = OvmPrimitives
.
if you could impl these changes now, it's not sure if it will be able to take effect right away, since the complete integration of generic data primitives is pending #12454. however this pr will definitely be merged once it compiles.
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.
I was thinking maybe move ovm_file_codec::{Block, BlockBody, *}
to reth_optimism_primitives
and update OpPrimitives
itself with the new primitives. That way we won't have to introduce OvmNode
and OvmPrimitives
?
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.
OpNode
is EVM since the bedrock hardfork, that's why we are importing the OVM part of the op mainnet chain by this command as opposed to the traditional way: syncing from peers
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.
got it
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.
Since BlockFileCodec was made generic over Block, I think it makes more sense to pass the Block in the ovm codec file to the original BlockFileCodec, does that make sense?
You're right and I did that on my first attempt. But ends up on the same error as this one. |
@emhane the scope of this pr is huge compared to what I thought. Despite adding |
Towards #12587