Skip to content

Fix issue #14986 Tool to add blocks to db #15054

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Sahil-4555
Copy link

@Sahil-4555 Sahil-4555 commented Mar 15, 2025

What type of PR is this?

Uncomment one line below and remove others.

Bug fix
Feature
Documentation
Other

What does this PR do? Why is it needed?
Tool to add blocks to db

Which issues(s) does this PR fix?
#14986

Fixes #

Other notes for review

Acknowledgements

@Sahil-4555 Sahil-4555 requested a review from a team as a code owner March 15, 2025 05:25
@CLAassistant
Copy link

CLAassistant commented Mar 15, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Why can't you use SaveBlock?

@@ -1150,3 +1151,59 @@ func (s *Store) deleteValidatorHashes(tx *bolt.Tx, root []byte) error {

return nil
}

func (s *Store) AddBeaconBlock(ctx context.Context, serBlock []byte) error {
Copy link
Member

Choose a reason for hiding this comment

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

Please add unit tests

@@ -1150,3 +1151,59 @@ func (s *Store) deleteValidatorHashes(tx *bolt.Tx, root []byte) error {

return nil
}

func (s *Store) AddBeaconBlock(ctx context.Context, serBlock []byte) error {
Copy link
Member

Choose a reason for hiding this comment

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

Please add a godoc comment

Comment on lines +1191 to +1194
parentBlk, err := unmarshalBlock(ctx, parentExists)
if err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

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

Do you need to unmarshal the whole block to get the slot or can we read only that data from the ssz format? cc: @kasey

Comment on lines +1202 to +1205
// Save the block
if err := bkt.Put(blockRoot[:], serBlock); err != nil {
return errors.Wrapf(err, "could not write block to db with root %#x", blockRoot)
}
Copy link
Member

Choose a reason for hiding this comment

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

What about all of the indices we have on blocks?

Why can't you use SaveBlock?

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.

3 participants