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

ERA: Add ERA file support package #3853

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft

ERA: Add ERA file support package #3853

wants to merge 18 commits into from

Conversation

ScottyPoi
Copy link
Contributor

@ScottyPoi ScottyPoi commented Jan 29, 2025

Introduces new package "@ethereumjs/era"

Package will include utility functions to enable creation and parsing of ERA files (era, era1, era2, etc.)

  • era/src/types.ts
    • types for era data
  • era/src/snappy.ts
    • functions for compressing / decompressing era file data
  • era/src/e2store.ts
    • functions for encoding / decoding e2store objects
  • era/src/blockTuple.ts`
    • functions to serialize / deserialize block "tuples"
  • era/src/era1.ts`
    • functions to create / read era1 files

ERA1

era1 specs: ethereum/go-ethereum#26621

Era1 stores one epoch of history data along with the hash tree root of the epoch accumulator as an anchor for validation.

Era1 contains 8192 block tuples

A block tuple contains

  • header
  • body
  • block receipts
  • total difficulty

Era1 also contains the root of an Epoch Accumulator

Epoch Accumulator is an SSZ object used in Portal Network. An Epoch Accumulator is constructed from a list of 8192 Header Records

A Header Record is an object with a blockHash and totalDifficulty.

The accumulator can be reconstructed to validate the contents of era1 against the provided accumulator root.

The accumulator roots are part of a static set of roots that can be externally validated.

Client - @ethereumjs/client

  • Imports new era package.
  • Adds a new non-standard RPC method debug_exportHIstory which triggers a client to export its history to era1 files

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 14.47368% with 65 lines in your changes missing coverage. Please review.

Project coverage is 75.20%. Comparing base (4ed3482) to head (daa1850).

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 76.87% <ø> (ø)
blockchain 85.69% <ø> (ø)
client 66.01% <14.47%> (-0.26%) ⬇️
common 90.31% <ø> (ø)
devp2p 76.27% <ø> (ø)
ethash 81.04% <ø> (ø)
evm 69.34% <ø> (ø)
genesis 99.84% <ø> (ø)
mpt 59.92% <ø> (-0.04%) ⬇️
rlp 69.70% <ø> (ø)
statemanager 70.15% <ø> (ø)
tx 80.52% <ø> (ø)
util 77.51% <ø> (ø)
vm 57.81% <ø> (ø)
wallet 83.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@ScottyPoi ScottyPoi changed the title Client: Export history as era1 ERA: Add ERA file support package Jan 29, 2025
@ScottyPoi ScottyPoi force-pushed the export-history branch 5 times, most recently from 4fb9a0a to 75769ab Compare January 30, 2025 20:22
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.

2 participants