Skip to content
Open
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bc85d5f
init
guha-rahul Jul 5, 2025
c50ca55
Merge branch 'ChainSafe:unstable' into add_types_era
guha-rahul Aug 16, 2025
438f2d3
chore: update docs
guha-rahul Aug 16, 2025
d053457
fix types
guha-rahul Aug 16, 2025
0823b50
export Snappy decompress
guha-rahul Aug 17, 2025
d44951f
remove non-reader types
guha-rahul Aug 17, 2025
10c4e98
add reading of era
guha-rahul Aug 17, 2025
21b8081
fix build
guha-rahul Aug 19, 2025
b3de442
lint
guha-rahul Aug 19, 2025
a2f0b4b
lint
guha-rahul Aug 19, 2025
91e7470
add tests and era downloader script
guha-rahul Aug 24, 2025
7226611
Merge branch 'ChainSafe:unstable' into add_types_era
guha-rahul Aug 24, 2025
f710bcf
add block reading
guha-rahul Sep 1, 2025
f6885b4
Merge branch 'add_types_era' of https://github.com/guha-rahul/lodesta…
guha-rahul Sep 1, 2025
bd9a39b
add era writing and chores
guha-rahul Sep 6, 2025
5a73946
Merge branch 'ChainSafe:unstable' into add_types_era
guha-rahul Oct 1, 2025
1c211d1
refactor
guha-rahul Oct 4, 2025
5159399
export encodeSnappy
guha-rahul Oct 4, 2025
fd825bf
move test to e2e
guha-rahul Oct 6, 2025
a910d40
refactor class
guha-rahul Oct 7, 2025
ee62c05
update package.json
guha-rahul Oct 21, 2025
648e80a
Merge branch 'unstable' into HEAD
wemeetagain Oct 28, 2025
4e21a0f
chore: pr review
wemeetagain Oct 30, 2025
cbb31a3
chore: clean up validate function
wemeetagain Oct 31, 2025
17c1f5a
move encodeSnappy and SnappyFramesUncompress to utils to remove futur…
guha-rahul Oct 31, 2025
baa6a72
Merge branch 'ChainSafe:unstable' into add_types_era
guha-rahul Oct 31, 2025
8141404
Merge branch 'add_types_era' of https://github.com/guha-rahul/lodesta…
guha-rahul Oct 31, 2025
64d8e53
replace with Buffer.prototype
guha-rahul Nov 1, 2025
47cc25d
fix : out of range bug
guha-rahul Nov 1, 2025
30fd6f8
lint
guha-rahul Nov 1, 2025
1ce7d39
add comment
guha-rahul Nov 1, 2025
9b0a7ab
remove console
guha-rahul Nov 3, 2025
fe80768
port snappy fnutions from package/utils to package/reqresp/src/utils
guha-rahul Nov 3, 2025
6375888
buump verrsion to 1.36.0
guha-rahul Nov 3, 2025
2df24fb
push back to 1.35.0
guha-rahul Nov 3, 2025
623a86d
Merge branch 'ChainSafe:unstable' into add_types_era
guha-rahul Nov 4, 2025
f3f67a4
bump to 1.36.0
guha-rahul Nov 4, 2025
850c169
add readme
guha-rahul Nov 4, 2025
571bc70
add claude to git ignore
guha-rahul Nov 4, 2025
4fc585b
clear cache
guha-rahul Nov 4, 2025
374c32d
add readme
guha-rahul Nov 5, 2025
6ac0887
fix docs
guha-rahul Nov 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions packages/era/test/e2e-mainnet/era.readwrite.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,14 @@ describe.runIf(!process.env.CI)("read original era and re-write our own era file
const SPR = SLOTS_PER_HISTORICAL_ROOT;
const stateSlot = expectedEra * SPR;

const startTime = Date.now();
let t0 = startTime;

console.log("stage: open and read original era file");
const reader = await EraReader.open(config, eraPath);
console.log(` time: ${Date.now() - t0}ms`);
t0 = Date.now();

console.log(`progress: ${reader.groups.length} group(s) found`);

console.log("stage: validate original era file");
await reader.validate();
console.log(` time: ${Date.now() - t0}ms`);
t0 = Date.now();

console.log("stage: create new era file writer");
const outDir = path.resolve(__dirname, "../out");
if (!existsSync(outDir)) mkdirSync(outDir, {recursive: true});
let outFile = path.resolve(outDir, `mainnet-${String(expectedEra).padStart(5, "0")}-deadbeef.era`);

const writer = await EraWriter.create(config, outFile, expectedEra);
console.log(` time: ${Date.now() - t0}ms`);
t0 = Date.now();

console.log("stage: read blocks from original and write to new era file");
const blocksIndex = reader.groups[0].blocksIndex;
if (!blocksIndex) {
throw new Error("Original era file missing blocks index");
Expand All @@ -57,39 +40,16 @@ describe.runIf(!process.env.CI)("read original era and re-write our own era file
if (block === null) continue;
await writer.writeBlock(block);
}
console.log(` time: ${Date.now() - t0}ms`);
t0 = Date.now();

console.log("stage: read state from original era file");
const originalState = await reader.readState();
expect(originalState.slot).to.equal(stateSlot);
console.log(` time: ${Date.now() - t0}ms`);
t0 = Date.now();

console.log("stage: write state to new era file");
await writer.writeState(originalState);
console.log(` time: ${Date.now() - t0}ms`);
t0 = Date.now();

console.log("stage: finish reading and writing");
await reader.close();
outFile = await writer.finish();
console.log(` time: ${Date.now() - t0}ms`);
t0 = Date.now();

expect(basename(outFile)).to.equal(basename(eraPath));

console.log("stage: open and validate new era file");
const newReader = await EraReader.open(config, outFile);
await newReader.validate();
console.log(` time: ${Date.now() - t0}ms`);
t0 = Date.now();

// Cleanup
await newReader.close();

const totalTime = Date.now() - startTime;
console.log("Round-trip test passed");
console.log(` Total time: ${totalTime}ms (${(totalTime / 1000).toFixed(2)}s)`);
}, 1000000);
});