Skip to content

Commit

Permalink
prepare genesis block generator
Browse files Browse the repository at this point in the history
  • Loading branch information
oXtxNt9U committed Nov 25, 2024
1 parent 3f8624d commit 94258b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ export class GenesisBlockGenerator extends Generator {

let transactions: Contracts.Crypto.Transaction[] = [];

if (options.legacySnapshotPath) {
// TODO:
// - read snapshot file
// - validate content hash
// - calculate premine
// - caculate state hash by loading snapshot into evm
// - include (compressed) snapshot data in genesis block
// - omit transactions (since there will be *many* wallets it is inefficient)
// - bootstrapper will check for snapshot data, validate it and seed the evm state instead
throw new Error("TODO");
}

if (options.distribute) {
transactions = transactions.concat(
...(await this.#createTransferTransactions(
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/source/contracts/network-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export type GenesisBlockOptions = {
premine: string;
pubKeyHash: number;
epoch: Date;
legacySnapshotPath?: string;
};

export type InternalOptions = EnvironmentOptions &
Expand Down

0 comments on commit 94258b3

Please sign in to comment.