-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: circular deps finalized head #35
Conversation
for this change, we need to update the FP e2e test.
|
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.
.circleci/config.yml
Outdated
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.
why is this removed? should we add back?
lgtm but will let @SebastianElvis take another look |
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.
Great work! Some non-blocking comments
@@ -174,6 +166,39 @@ func (bb *BBoltHandler) GetBlockByHash(hash string) (*types.Block, error) { | |||
return bb.GetBlockByHeight(blockHeight) | |||
} | |||
|
|||
func (bb *BBoltHandler) QueryIsBlockRangeFinalizedByHeight(startHeight, endHeight uint64) ([]bool, error) { |
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.
Would it be possible that block h
is finalised but block h+1
is not? I think it's not possiible as BTC staking enforces consecutive finalisation. So wdyt of maintaining the last finalised height in DB and accessing that value, instead of iterating over all these blocks?
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.
Would it be possible that block h is finalised but block h+1 is not?
no it's not possible (we can enforce it in bbolt.go as well but can go into another pr)
So wdyt of maintaining the last finalised height in DB and accessing that value, instead of iterating over all these blocks?
good point. we already maintain fist and last finalized heights. we can use them
const (
blocksBucket = "blocks"
blockHeightsBucket = "block_heights"
indexerBucket = "indexer"
earliestBlockKey = "earliest"
latestBlockKey = "latest"
activatedTimestampKey = "activated_timestamp"
)
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.
Yes, if using last finalised height then the logic can be greatly simplified. Can be done in a separate PR though
we tested it with a new devnet and it works! will merge to main |
Summary
This PR addresses various circular dependency issues with the current FG implementation.
Problems
Proposed fixes
QueryBlockRangeBabylonFinalized
to query the internal DB rather than call the Babylon nodeTest plan