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

bfgd: simpler finality calculations with new table #353

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ClaytonNorthey92
Copy link
Contributor

@ClaytonNorthey92 ClaytonNorthey92 commented Jan 3, 2025

Summary
simpler finality calculations with new table

Changes

  • add table who's rows each represent the lowest published btc block that an l2_keystone is found in
  • on bfg startup, backfill existing l2_keystones' lowest btc block
  • use pop_basis database notifications to continue to index these l2_keyston <-> lowest btc block
  • update finality queries to use this
  • add tests

more context:

this pr adds a database table l2_keystones_lowest_btc_block, which as l2_keystone_abrev_hash as a primary key. this represents, for each distinct l2 keystone, the published lowest btc block this l2 keystone was found in. this way, we no longer have to calculate this at query time.

@github-actions github-actions bot added the area: bfg This is a change to BFG (Bitcoin Finality Governor) label Jan 3, 2025
* add table who's rows each represent the lowest published btc block that an l2_keystone is found in
* on bfg startup, backfill existing l2_keystones' lowest btc block
* use pop_basis database notifications to continue to index these l2_keyston <-> lowest btc block
* update finality queries to use this
* allowing insertion of l2_keystone abreviated fields, as we sometimes will pull these from the btc chain and they are abbreviated there
* add tests
@ClaytonNorthey92 ClaytonNorthey92 force-pushed the clayton/finality-redo-2 branch from 91bcc9d to 4f843a2 Compare January 3, 2025 23:27
@ClaytonNorthey92 ClaytonNorthey92 marked this pull request as ready for review January 3, 2025 23:32
@ClaytonNorthey92 ClaytonNorthey92 requested a review from a team as a code owner January 3, 2025 23:32
database/bfgd/database.go Outdated Show resolved Hide resolved
database/bfgd/database_ext_test.go Outdated Show resolved Hide resolved
database/bfgd/scripts/0012.sql Outdated Show resolved Hide resolved
database/bfgd/postgres/postgres.go Outdated Show resolved Hide resolved
service/bfg/bfg.go Outdated Show resolved Hide resolved
@joshuasing
Copy link
Contributor

Two remaining copyright header issues (I really need to fix the linter, sorry!) - otherwise looks good to me.

@joshuasing joshuasing changed the title simpler finality calculations with new table bfgd: simpler finality calculations with new table Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: bfg This is a change to BFG (Bitcoin Finality Governor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants