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

Pass predefined blocks via the CLI #2094

Merged
merged 38 commits into from
Aug 18, 2024

Conversation

xgreenx
Copy link
Collaborator

@xgreenx xgreenx commented Aug 16, 2024

Follow-up PR for #2081.

Closes #1902

Add a CLI argument to process predefined blocks.

Checklist

  • New behavior is reflected in tests

Before requesting review

  • I have reviewed the code myself

@xgreenx xgreenx requested a review from a team August 16, 2024 11:26
@xgreenx xgreenx self-assigned this Aug 16, 2024
Copy link
Member

@MitchTurner MitchTurner left a comment

Choose a reason for hiding this comment

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

Looking good.

tests/test-helpers/src/lib.rs Outdated Show resolved Hide resolved
));
}

if on_chain_height > target_block_height {
self.on_chain().rollback_last_block()?;
tracing::info!(
Copy link
Collaborator Author

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

@xgreenx xgreenx requested review from MitchTurner and a team August 16, 2024 17:00
Ok(latest_height)
}

fn rollback_block_at(&self, height_to_rollback: u64) -> StorageResult<()> {
Copy link
Member

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

Suggested change
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))
Copy link
Member

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))
Copy link
Member

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.

@@ -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<()>;
Copy link
Member

Choose a reason for hiding this comment

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

I think I prefer

Suggested change
fn rollback_block_at(&self, height: &Height) -> StorageResult<()>;
fn rollback_block_to(&self, height: &Height) -> StorageResult<()>;

Base automatically changed from feature/produce-predefined-blocks to master August 16, 2024 17:19
…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
@xgreenx xgreenx requested review from MitchTurner and a team August 17, 2024 20:31
@xgreenx xgreenx merged commit f999c83 into master Aug 18, 2024
34 checks passed
@xgreenx xgreenx deleted the feature/pass-oredefined-blocks-via-cli branch August 18, 2024 10:18
@xgreenx xgreenx mentioned this pull request Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support reapplying of the rollbacked blocks during the production of the blocks
2 participants