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

refactor: remove Option<BlockHeight> and use new enum where applicable #2033

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

matt-user
Copy link
Contributor

@matt-user matt-user commented Jul 16, 2024

closes #2005

I replaced Option<BlockHeight> with BlockHeightQuery where applicable. IIUC there are Option<BlockHeight> which should remain.

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

After merging, notify other teams

[Add or remove entries as needed]

@matt-user matt-user added the enhancement New feature or request label Jul 16, 2024
@matt-user matt-user self-assigned this Jul 16, 2024
@matt-user matt-user marked this pull request as ready for review July 16, 2024 01:21
@matt-user matt-user requested a review from a team July 16, 2024 01:21
crates/fuel-core/src/schema/tx.rs Outdated Show resolved Hide resolved
crates/fuel-core/src/graphql_api/database.rs Outdated Show resolved Hide resolved
@@ -508,7 +508,7 @@ where
off_chain_height.map(|height| BlockHeight::new(height.saturating_add(1)));

let import_result =
import_result_provider.block_event_at_height(next_block_height)?;
import_result_provider.block_event_at_height(next_block_height.into())?;
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to make on_chain_database.latest_height() return BlockHeightQuery?

This makes me think that the name should be something different.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could change latest_height() to return BlockHeightQuery. I didn't do this because, IIUC, a database should be able to return None if it can't find the requested key. Is the genesis block stored in the DB? I agree the name BlockHeightQuery isn't quite right. The only other name I can think of is SpecificBlockOrGenesis

crates/fuel-core/src/schema/block.rs Outdated Show resolved Hide resolved
MitchTurner
MitchTurner previously approved these changes Aug 14, 2024
@rymnc
Copy link
Member

rymnc commented Aug 17, 2024

@matt-user / @MitchTurner can I just regen the state transition bytecode, run tests again and then merge?

@MitchTurner
Copy link
Member

Ah dang. Sorry @matt-user I thought this got merged :o

@AurelienFT
Copy link
Contributor

Hello @matt-user ,

Sorry for letting your PR became stale like this. Are you ok to resolve the conflicts so that we can gett this merge soonish ? If you prefer we can take care of the conflicts for you, let me know :)
Sorry again.

@matt-user
Copy link
Contributor Author

Hello @matt-user ,

Sorry for letting your PR became stale like this. Are you ok to resolve the conflicts so that we can gett this merge soonish ? If you prefer we can take care of the conflicts for you, let me know :) Sorry again.

Yeah sorry, I completely forgot about this. I will resolve the conflicts

@matt-user matt-user enabled auto-merge (squash) November 7, 2024 08:53
@matt-user matt-user requested review from MitchTurner, Voxelot and a team November 10, 2024 05:02
AurelienFT
AurelienFT previously approved these changes Nov 21, 2024
Copy link
Contributor

@AurelienFT AurelienFT left a comment

Choose a reason for hiding this comment

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

LGTM

@AurelienFT AurelienFT requested a review from a team November 21, 2024 14:26
@@ -37,38 +37,42 @@ impl ImportResultProvider {
impl ImportResultProvider {
pub fn result_at_height(
Copy link
Collaborator

Choose a reason for hiding this comment

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

The mentioned issue was only related to this part of the code: #2004 (comment)

All other changes are not needed. All other places uses None because it means no prefix or not starting block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove use of Option<BlockHeight> as a query for blocks
7 participants