-
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
Pass predefined blocks via the CLI #2094
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.
Looking good.
Co-authored-by: Mitchell Turner <[email protected]>
…ure/pass-oredefined-blocks-via-cli
…rror instead of ignore
…ure/pass-oredefined-blocks-via-cli # Conflicts: # crates/services/consensus_module/poa/src/service.rs
)); | ||
} | ||
|
||
if on_chain_height > target_block_height { | ||
self.on_chain().rollback_last_block()?; | ||
tracing::info!( |
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.
We have the same log inside of the rollback_last_block
Ok(latest_height) | ||
} | ||
|
||
fn rollback_block_at(&self, height_to_rollback: u64) -> StorageResult<()> { |
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 think I'd prefer the name
fn rollback_block_at(&self, height_to_rollback: u64) -> StorageResult<()> { | |
fn rollback_block_to(&self, height: u64) -> StorageResult<()> { |
@@ -177,7 +177,7 @@ impl worker::OffChainDatabase for Database<OffChain> { | |||
type Transaction<'a> = StorageTransaction<&'a mut Self> where Self: 'a; | |||
|
|||
fn latest_height(&self) -> StorageResult<Option<BlockHeight>> { | |||
self.latest_height() | |||
Ok(fuel_core_storage::transactional::HistoricalView::latest_height(self)) |
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.
Let's use normal method syntax.
@@ -140,6 +140,6 @@ impl OnChainDatabase for OnChainIterableKeyValueView {} | |||
|
|||
impl worker::OnChainDatabase for Database<OnChain> { | |||
fn latest_height(&self) -> StorageResult<Option<BlockHeight>> { | |||
self.latest_height() | |||
Ok(fuel_core_storage::transactional::HistoricalView::latest_height(self)) |
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.
Let's use normal method syntax.
crates/fuel-core/src/state.rs
Outdated
@@ -71,7 +71,7 @@ pub trait TransactableStorage<Height>: IterableStore + Debug + Send + Sync { | |||
|
|||
fn latest_view(&self) -> StorageResult<IterableKeyValueView<Self::Column>>; | |||
|
|||
fn rollback_last_block(&self) -> StorageResult<()>; | |||
fn rollback_block_at(&self, height: &Height) -> StorageResult<()>; |
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 think I prefer
fn rollback_block_at(&self, height: &Height) -> StorageResult<()>; | |
fn rollback_block_to(&self, height: &Height) -> StorageResult<()>; |
…via-cli # Conflicts: # CHANGELOG.md # crates/fuel-core/src/service/sub_services.rs # crates/services/consensus_module/poa/src/ports.rs # crates/services/consensus_module/poa/src/service.rs
Follow-up PR for #2081.
Closes #1902
Add a CLI argument to process predefined blocks.
Checklist
Before requesting review