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

Add migration for remaining off chain tables #1790

Closed
segfault-magnet opened this issue Mar 29, 2024 · 0 comments · Fixed by #1860
Closed

Add migration for remaining off chain tables #1790

segfault-magnet opened this issue Mar 29, 2024 · 0 comments · Fixed by #1860
Assignees
Labels
enhancement New feature or request

Comments

@segfault-magnet
Copy link
Contributor

segfault-magnet commented Mar 29, 2024

@xgreenx wrote:

We need to migrate as well:
FuelBlocks - for that we need to disable guard on commit.
FuelBlockIdsToHeights - Cab be generated form the FuelBlocks.
SpentMessages - can be derived from Transactions or removed entirly
ProcessedTransactions - can be derived from Transactions
FuelBlockConsensus

and

Actually, maybe transactions and blocks should be migrated to the off-chain database. Because we are only migrating them for GraphQL service and only to support queries for old data.

and

[...] the idea is to have OldFuelBlocks and OldTransactions as part of the off-chain database. If the requested block is lower than genesis block height, we go to off_chain::OldFuelBlocks , otherwise to on_chain::FuelBlocks. In the case of transactions, yeah, first we go to on_chain::Transactions and if no success, go to off_chain::OldTransactions

From the above, we should have a table for blocks and transactions in the off chain db and populate it upon regenesis.

@segfault-magnet segfault-magnet added the enhancement New feature or request label Mar 29, 2024
Dentosal added a commit that referenced this issue Apr 18, 2024
Work towards #1790

This PR adds `OldFuelBlocks`, `OldFuelBlockConsensus` and
`OldTransactions` tables to the off-chain database. If the requested
block is lower than genesis block height, we go to
`off_chain::OldFuelBlocks` , otherwise to `on_chain::FuelBlocks`. For
transactions, we try `on_chain::Transactions` and fallback to
`off_chain::OldTransactions`.

Also exposes `fuel_core_bin` as a library to help with e2e testing.

## Checklist
- [x] Breaking changes are clearly marked as such in the PR description
and changelog (no breaking changes)
- [x] New behavior is reflected in tests
- [x] [The specification](https://github.com/FuelLabs/fuel-specs/)
matches the implemented behavior (link update PR if changes are needed)

### Before requesting review
- [x] I have reviewed the code myself

### Before merge
- [x] Retarget to master branch

---------

Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
xgreenx added a commit that referenced this issue Apr 18, 2024
Re-implementation of the #1829
Work towards #1790

The change migrates the `ProcessedTransactions` table as part of the
on-chain snapshot. Since it is used to validate blocks, the root of all
processed transactions must be part of the `Genesis` structure along
with messages, coins, and contracts.

The changes also moved `SpentMessages` from the on-chain database to the
off-chain database since now it is only used for the GraphQL API.

### Before requesting review
- [x] I have reviewed the code myself

---------

Co-authored-by: Hannes Karppila <hannes.karppila@gmail.com>
xgreenx added a commit that referenced this issue Apr 29, 2024
Closes #1790 by completing the last missing item.
Closes #1545 by completing
the last missing item as well.

This PR regenerates `FuelBlockIdsToHeights` for both blocks on
regenesis.

## Checklist
- [x] Breaking changes are clearly marked as such in the PR description
and changelog
- [ ] New behavior is reflected in tests

### Before requesting review
- [x] I have reviewed the code myself
- [ ] I have created follow-up issues caused by this PR and linked them
here

---------

Co-authored-by: xgreenx <xgreenx9999@gmail.com>
GoldenPath1109 added a commit to GoldenPath1109/fuel-core that referenced this issue Sep 7, 2024
Re-implementation of the FuelLabs/fuel-core#1829
Work towards FuelLabs/fuel-core#1790

The change migrates the `ProcessedTransactions` table as part of the
on-chain snapshot. Since it is used to validate blocks, the root of all
processed transactions must be part of the `Genesis` structure along
with messages, coins, and contracts.

The changes also moved `SpentMessages` from the on-chain database to the
off-chain database since now it is only used for the GraphQL API.

### Before requesting review
- [x] I have reviewed the code myself

---------

Co-authored-by: Hannes Karppila <hannes.karppila@gmail.com>
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 a pull request may close this issue.

2 participants