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 export-history subcommand. #25325

Closed
wants to merge 7 commits into from
Closed

Conversation

henridf
Copy link
Contributor

@henridf henridf commented Jul 18, 2022

geth export-history exports blocks and receipts in SSZ format.

running todo:

  • Add logging
  • Check cli params: start < end
  • Print out hash root for info purposes (it can also be computed with bart )

@henridf henridf marked this pull request as ready for review July 21, 2022 22:47
@ligi ligi assigned fjl and holiman Jul 28, 2022
@fjl fjl unassigned holiman Jul 28, 2022
@fjl fjl removed the status:triage label Jul 28, 2022
@lightclient
Copy link
Member

I rebased to master.

cmd/utils/cmd.go Outdated
}

func ExportHistoryRange(bc *core.BlockChain, fn string, first uint64, last uint64, targetSize int) error {
var blocks []*spec.Block
Copy link
Member

Choose a reason for hiding this comment

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

We should define the block here to target the spec and not define externally.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm is there a reason to define another block type if we annotate types.Block here?

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 should define the block here to target the spec and not define externally.

Happy to move it here (maybe in its own package under cmd/utils) If you're ok with adding that here (along with all the go.mod dependency additions)

Hmm is there a reason to define another block type if we annotate types.Block here?

Back when I was defining that it seemed hard to do it all via just annotations on the existing geth structs, but I've paged out all the details 😬. Will take another look (maybe it is possible?) and report back.

return ExportHistoryRange(bc, fn, uint64(0), bc.CurrentBlock().NumberU64(), targetSize)
}

func ExportHistoryRange(bc *core.BlockChain, fn string, first uint64, last uint64, targetSize int) error {
Copy link
Member

Choose a reason for hiding this comment

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

I think there should be verification that first+last < maxBlocks?

Copy link
Contributor Author

@henridf henridf Aug 25, 2022

Choose a reason for hiding this comment

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

🤔 what would maxBlocks be here?

@henridf
Copy link
Contributor Author

henridf commented Sep 16, 2022

@lightclient I moved the ssz definitions into the repo.

Unfortunately right now annotating types.Block isn't possible due to some current limitations of fastssz:

@holiman
Copy link
Contributor

holiman commented Feb 6, 2023

Superseded by #26621

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.

5 participants