-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Connect the block importer with outside world #915
Conversation
64df92f
to
646f3c5
Compare
6f48202
to
64facf2
Compare
88f203b
to
1400dcd
Compare
- Added `debug_assert_eq` to verify that the block header id is an identifier of the block. And that it uses the last hash of the application header. No unit tests right now.
Co-authored-by: Tom <tomrgowan@gmail.com>
1c50045
to
838a716
Compare
…track this information. - Added `manual_produce_block` into `PoA` and used it in the `GraphQL` to have the one source of the block production. There are no unit tests(help is appreciated). - Connected `PoA` and `BlockImporter` via ports. Added `BlockImporterAdapter`. - Added the `FuelBlockRoots` column with the corresponding table. It is used to track BMT MMR roots for fuel blocks. The implementation adds new `DatabaseColumn` and `IntoDatabaseKey` traits to automate the storage trait implementation for some tables. - Moved implementation of database ports into the corresponding file in the `fuel_core::service::adapter`. - Removed the `Database` generic from `PoA` at all. Now we must pass the `last_height` while creating the `Task`. Updated tests to work with it. - Block producer now accepts the `block_time` along with `block_height`.
d4b9fbb
to
ab8c5fd
Compare
@@ -95,6 +95,8 @@ jobs: | |||
include: | |||
- command: clippy | |||
args: --all-targets --all-features | |||
- command: check | |||
args: --all-targets |
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.
Is there anything caught by this that isn't already caught?
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.
Yep it catches running cargo check --all-targets
at the workspace root which nothing else does. It has a different feature set the all-features
or running the command at each crate level like the make command does.
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.
Actually, I guess we can remove it, because cargo test --all-features --workspace
do the same)
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.
Would prefer to remove it then since CI times are already pretty long
// TODO: When the port of BlockProducer will exist we need to replace it with | ||
// `Box<dyn BlockProducerPort> | ||
pub type BlockProducer = Arc<fuel_core_producer::Producer<crate::database::Database>>; | ||
pub type BlockProducer = crate::service::adapters::BlockProducerAdapter; |
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.
The surface area is really small to change this to Box<dyn BlockProducerPort>
and have it in line with the rest of the crate, there is already reference work in #909 you could cannabilize
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.
To use Box
here requires the definition of the port. I don't want to add a new code and mix the work that is already handled by a mentioned PR=)
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.
Ok, will refactor that PR off of this one when this gets merged then
}; | ||
use itertools::Itertools; | ||
|
||
/// Loads state from the chain config into database | ||
pub(crate) fn initialize_state( | ||
pub(crate) fn maybe_initialize_state( |
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's the primary reason for the rename? The function returns a result so is the maybe
needed?
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.
Returning the result means nothing=) The Err
only shows that we got an error during initialization, while Ok
maybe be "We changed something" or "We changed nothing"
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.
Oh I see, so it only maybe
will have an impact
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.
Just a few issues around errors instead of options
} | ||
|
||
/// The table has a corresponding column in the database. | ||
trait DatabaseColumn { |
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.
@Voxelot Is this the pattern you were talking about in last weeks sync?
# Conflicts: # crates/fuel-core/src/service/config.rs # crates/fuel-core/src/service/sub_services.rs
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.
Ok looks good
Bumping the CI check issue, would prefer to remove that before merging so CI times don't get too long if |
# Conflicts: # crates/fuel-core/src/service/config.rs # crates/fuel-core/src/service/sub_services.rs # crates/services/consensus_module/poa/src/service.rs # crates/services/consensus_module/poa/src/verifier.rs
What is done:
CHAIN_HEIGHT_KEY
, because now we have a genesis block to track this information.BlockHeight
to work with references. Previously in some places, it was the reference, in some not.manual_produce_block
intoPoA
and used it in theGraphQL
to have the one source of the block production. There are no unit tests(help is appreciated).PoA
andBlockImporter
via ports. AddedBlockImporterAdapter
.FuelBlockRoots
column with the corresponding table. It is used to track BMT MMR roots for fuel blocks. The implementation adds newDatabaseColumn
andIntoDatabaseKey
traits to automate the storage trait implementation for some tables.fuel_core::service::adapter
.Database
generic fromPoA
at all. Now we must pass thelast_height
while creating theTask
. Updated tests to work with it.block_time
along withblock_height
.