Skip to content

Commit 04f1d9a

Browse files
authored
chore: revert: feat(world-state): add genesis timestamp support and GenesisData type (#22201) (#22255)
## Summary Reverts #22201 which broke merge-train/spartan. This cleanly reverts all 48 files changed by the original PR, removing the `GenesisData` type and `genesisTimestamp` parameter that was threaded through the world state stack. ClaudeBox log: https://claudebox.work/s/d0871478ee07a313?run=1
1 parent 8ba2c51 commit 04f1d9a

48 files changed

Lines changed: 203 additions & 341 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

barretenberg/cpp/src/barretenberg/nodejs_module/world_state/world_state.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,8 @@ WorldStateWrapper::WorldStateWrapper(const Napi::CallbackInfo& info)
119119
throw Napi::TypeError::New(env, "Header generator point needs to be a number");
120120
}
121121

122-
uint64_t genesis_timestamp = 0;
123-
size_t genesis_timestamp_index = 5;
124-
if (info.Length() > genesis_timestamp_index) {
125-
if (info[genesis_timestamp_index].IsNumber()) {
126-
genesis_timestamp = static_cast<uint64_t>(info[genesis_timestamp_index].As<Napi::Number>().Int64Value());
127-
} else {
128-
throw Napi::TypeError::New(env, "Genesis timestamp needs to be a number");
129-
}
130-
}
131-
132122
// optional parameters
133-
size_t map_size_index = 6;
123+
size_t map_size_index = 5;
134124
if (info.Length() > map_size_index) {
135125
if (info[map_size_index].IsObject()) {
136126
Napi::Object obj = info[map_size_index].As<Napi::Object>();
@@ -150,7 +140,7 @@ WorldStateWrapper::WorldStateWrapper(const Napi::CallbackInfo& info)
150140
}
151141
}
152142

153-
size_t thread_pool_size_index = 7;
143+
size_t thread_pool_size_index = 6;
154144
if (info.Length() > thread_pool_size_index) {
155145
if (!info[thread_pool_size_index].IsNumber()) {
156146
throw Napi::TypeError::New(env, "Thread pool size must be a number");
@@ -165,8 +155,7 @@ WorldStateWrapper::WorldStateWrapper(const Napi::CallbackInfo& info)
165155
tree_height,
166156
tree_prefill,
167157
prefilled_public_data,
168-
initial_header_generator_point,
169-
genesis_timestamp);
158+
initial_header_generator_point);
170159

171160
_dispatcher.register_target(
172161
WorldStateMessageType::GET_TREE_INFO,

barretenberg/cpp/src/barretenberg/world_state/world_state.cpp

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ WorldState::WorldState(uint64_t thread_pool_size,
3939
const std::unordered_map<MerkleTreeId, uint32_t>& tree_heights,
4040
const std::unordered_map<MerkleTreeId, index_t>& tree_prefill,
4141
const std::vector<PublicDataLeafValue>& prefilled_public_data,
42-
uint32_t initial_header_generator_point,
43-
uint64_t genesis_timestamp)
42+
uint32_t initial_header_generator_point)
4443
: _workers(std::make_shared<ThreadPool>(thread_pool_size))
4544
, _tree_heights(tree_heights)
4645
, _initial_tree_size(tree_prefill)
4746
, _forkId(CANONICAL_FORK_ID)
4847
, _initial_header_generator_point(initial_header_generator_point)
49-
, _genesis_timestamp(genesis_timestamp)
5048
{
5149
// We set the max readers to be high, at least the number of given threads or the default if higher
5250
uint64_t maxReaders = std::max(thread_pool_size, DEFAULT_MIN_NUMBER_OF_READERS);
@@ -63,16 +61,14 @@ WorldState::WorldState(uint64_t thread_pool_size,
6361
const std::unordered_map<MerkleTreeId, uint64_t>& map_size,
6462
const std::unordered_map<MerkleTreeId, uint32_t>& tree_heights,
6563
const std::unordered_map<MerkleTreeId, index_t>& tree_prefill,
66-
uint32_t initial_header_generator_point,
67-
uint64_t genesis_timestamp)
64+
uint32_t initial_header_generator_point)
6865
: WorldState::WorldState(thread_pool_size,
6966
data_dir,
7067
map_size,
7168
tree_heights,
7269
tree_prefill,
7370
std::vector<PublicDataLeafValue>(),
74-
initial_header_generator_point,
75-
genesis_timestamp)
71+
initial_header_generator_point)
7672
{}
7773

7874
WorldState::WorldState(uint64_t thread_pool_size,
@@ -81,8 +77,7 @@ WorldState::WorldState(uint64_t thread_pool_size,
8177
const std::unordered_map<MerkleTreeId, uint32_t>& tree_heights,
8278
const std::unordered_map<MerkleTreeId, index_t>& tree_prefill,
8379
const std::vector<PublicDataLeafValue>& prefilled_public_data,
84-
uint32_t initial_header_generator_point,
85-
uint64_t genesis_timestamp)
80+
uint32_t initial_header_generator_point)
8681
: WorldState(thread_pool_size,
8782
data_dir,
8883
{
@@ -95,25 +90,22 @@ WorldState::WorldState(uint64_t thread_pool_size,
9590
tree_heights,
9691
tree_prefill,
9792
prefilled_public_data,
98-
initial_header_generator_point,
99-
genesis_timestamp)
93+
initial_header_generator_point)
10094
{}
10195

10296
WorldState::WorldState(uint64_t thread_pool_size,
10397
const std::string& data_dir,
10498
uint64_t map_size,
10599
const std::unordered_map<MerkleTreeId, uint32_t>& tree_heights,
106100
const std::unordered_map<MerkleTreeId, index_t>& tree_prefill,
107-
uint32_t initial_header_generator_point,
108-
uint64_t genesis_timestamp)
101+
uint32_t initial_header_generator_point)
109102
: WorldState(thread_pool_size,
110103
data_dir,
111104
map_size,
112105
tree_heights,
113106
tree_prefill,
114107
std::vector<PublicDataLeafValue>(),
115-
initial_header_generator_point,
116-
genesis_timestamp)
108+
initial_header_generator_point)
117109
{}
118110

119111
void WorldState::create_canonical_fork(const std::string& dataDir,
@@ -170,9 +162,7 @@ void WorldState::create_canonical_fork(const std::string& dataDir,
170162
{
171163
uint32_t levels = _tree_heights.at(MerkleTreeId::ARCHIVE);
172164
std::vector<bb::fr> initial_values{ compute_initial_block_header_hash(
173-
get_state_reference(WorldStateRevision::committed(), fork, true),
174-
_initial_header_generator_point,
175-
_genesis_timestamp) };
165+
get_state_reference(WorldStateRevision::committed(), fork, true), _initial_header_generator_point) };
176166
auto store = std::make_unique<FrStore>(
177167
getMerkleTreeName(MerkleTreeId::ARCHIVE), levels, _persistentStores->archiveStore);
178168
auto tree = std::make_unique<FrTree>(std::move(store), _workers, initial_values);
@@ -960,9 +950,7 @@ bool WorldState::remove_historical_block(const block_number_t& blockNumber, Worl
960950
return true;
961951
}
962952

963-
bb::fr WorldState::compute_initial_block_header_hash(const StateReference& initial_state_ref,
964-
uint32_t generator_point,
965-
uint64_t genesis_timestamp)
953+
bb::fr WorldState::compute_initial_block_header_hash(const StateReference& initial_state_ref, uint32_t generator_point)
966954
{
967955
// NOTE: this hash operations needs to match the one in
968956
// noir-project/noir-protocol-circuits/crates/types/src/abis/block_header.nr
@@ -981,15 +969,15 @@ bb::fr WorldState::compute_initial_block_header_hash(const StateReference& initi
981969
initial_state_ref.at(MerkleTreeId::PUBLIC_DATA_TREE).second,
982970
0, // sponge_blob_hash
983971
// global variables
984-
0, // chain_id
985-
0, // version
986-
0, // block_number
987-
0, // slot_number
988-
bb::fr(genesis_timestamp), // timestamp
989-
0, // coinbase
990-
0, // fee_recipient
991-
0, // gas_fee.fee_per_da_gas
992-
0, // gas_fee.fee_per_l2_gas
972+
0, // chain_id
973+
0, // version
974+
0, // block_number
975+
0, // slot_number
976+
0, // timestamp
977+
0, // coinbase
978+
0, // fee_recipient
979+
0, // gas_fee.fee_per_da_gas
980+
0, // gas_fee.fee_per_l2_gas
993981
// total fees
994982
0,
995983
// total mana used

barretenberg/cpp/src/barretenberg/world_state/world_state.hpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,34 +63,30 @@ class WorldState {
6363
uint64_t map_size,
6464
const std::unordered_map<MerkleTreeId, uint32_t>& tree_heights,
6565
const std::unordered_map<MerkleTreeId, index_t>& tree_prefill,
66-
uint32_t initial_header_generator_point,
67-
uint64_t genesis_timestamp = 0);
66+
uint32_t initial_header_generator_point);
6867

6968
WorldState(uint64_t thread_pool_size,
7069
const std::string& data_dir,
7170
const std::unordered_map<MerkleTreeId, uint64_t>& map_size,
7271
const std::unordered_map<MerkleTreeId, uint32_t>& tree_heights,
7372
const std::unordered_map<MerkleTreeId, index_t>& tree_prefill,
74-
uint32_t initial_header_generator_point,
75-
uint64_t genesis_timestamp = 0);
73+
uint32_t initial_header_generator_point);
7674

7775
WorldState(uint64_t thread_pool_size,
7876
const std::string& data_dir,
7977
uint64_t map_size,
8078
const std::unordered_map<MerkleTreeId, uint32_t>& tree_heights,
8179
const std::unordered_map<MerkleTreeId, index_t>& tree_prefill,
8280
const std::vector<PublicDataLeafValue>& prefilled_public_data,
83-
uint32_t initial_header_generator_point,
84-
uint64_t genesis_timestamp = 0);
81+
uint32_t initial_header_generator_point);
8582

8683
WorldState(uint64_t thread_pool_size,
8784
const std::string& data_dir,
8885
const std::unordered_map<MerkleTreeId, uint64_t>& map_size,
8986
const std::unordered_map<MerkleTreeId, uint32_t>& tree_heights,
9087
const std::unordered_map<MerkleTreeId, index_t>& tree_prefill,
9188
const std::vector<PublicDataLeafValue>& prefilled_public_data,
92-
uint32_t initial_header_generator_point,
93-
uint64_t genesis_timestamp = 0);
89+
uint32_t initial_header_generator_point);
9490

9591
/**
9692
* @brief Copies all underlying LMDB stores to the target directory while acquiring a write lock
@@ -307,7 +303,6 @@ class WorldState {
307303
std::unordered_map<uint64_t, Fork::SharedPtr> _forks;
308304
uint64_t _forkId = 0;
309305
uint32_t _initial_header_generator_point;
310-
uint64_t _genesis_timestamp;
311306

312307
TreeStateReference get_tree_snapshot(MerkleTreeId id);
313308
void create_canonical_fork(const std::string& dataDir,
@@ -335,9 +330,7 @@ class WorldState {
335330
bool is_archive_tip(const WorldStateRevision& revision, const bb::fr& block_header_hash) const;
336331

337332
bool is_same_state_reference(const WorldStateRevision& revision, const StateReference& state_ref) const;
338-
static bb::fr compute_initial_block_header_hash(const StateReference& initial_state_ref,
339-
uint32_t generator_point,
340-
uint64_t genesis_timestamp = 0);
333+
static bb::fr compute_initial_block_header_hash(const StateReference& initial_state_ref, uint32_t generator_point);
341334

342335
static StateReference get_state_reference(const WorldStateRevision& revision,
343336
Fork::SharedPtr fork,

yarn-project/aztec-node/src/aztec-node/server.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ import type { DebugLogStore, LogFilter, SiloedTag, Tag, TxScopedL2Log } from '@a
8282
import { InMemoryDebugLogStore, NullDebugLogStore } from '@aztec/stdlib/logs';
8383
import { InboxLeaf, type L1ToL2MessageSource } from '@aztec/stdlib/messaging';
8484
import type { Offense, SlashPayloadRound } from '@aztec/stdlib/slashing';
85-
import type { NullifierLeafPreimage, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
85+
import type { NullifierLeafPreimage, PublicDataTreeLeaf, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
8686
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
8787
import {
8888
type BlockHeader,
@@ -97,7 +97,6 @@ import {
9797
} from '@aztec/stdlib/tx';
9898
import { getPackageVersion } from '@aztec/stdlib/update-checker';
9999
import type { SingleValidatorStats, ValidatorsStats } from '@aztec/stdlib/validators';
100-
import type { GenesisData } from '@aztec/stdlib/world-state';
101100
import {
102101
Attributes,
103102
type TelemetryClient,
@@ -208,7 +207,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
208207
slashingProtectionDb?: SlashingProtectionDatabase;
209208
} = {},
210209
options: {
211-
genesis?: GenesisData;
210+
prefilledPublicData?: PublicDataTreeLeaf[];
212211
dontStartSequencer?: boolean;
213212
dontStartProverNode?: boolean;
214213
} = {},
@@ -311,7 +310,12 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
311310
);
312311

313312
// now create the merkle trees and the world state synchronizer
314-
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, options.genesis, telemetry);
313+
const worldStateSynchronizer = await createWorldStateSynchronizer(
314+
config,
315+
archiver,
316+
options.prefilledPublicData,
317+
telemetry,
318+
);
315319
const useRealVerifiers = config.realProofs || config.debugForceTxProofVerification;
316320
let peerProofVerifier: ClientProtocolCircuitVerifier;
317321
let rpcProofVerifier: ClientProtocolCircuitVerifier;

yarn-project/aztec/src/cli/cmds/standby.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export async function computeExpectedGenesisRoot(config: GenesisStateConfig, use
2828

2929
userLog(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
3030

31-
const { genesisArchiveRoot, genesis } = await getGenesisValues(initialFundedAccounts);
31+
const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
3232

3333
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
3434

35-
return { genesisArchiveRoot, genesis };
35+
return { genesisArchiveRoot, prefilledPublicData };
3636
}
3737

3838
async function checkRollupCompatibility(

yarn-project/aztec/src/cli/cmds/start_node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export async function startNode(
8383
await preloadCrsDataForVerifying(nodeConfig, userLog);
8484

8585
const genesisConfig = getGenesisStateConfigEnvVars();
86-
const { genesisArchiveRoot, genesis } = await computeExpectedGenesisRoot(genesisConfig, userLog);
86+
const { genesisArchiveRoot, prefilledPublicData } = await computeExpectedGenesisRoot(genesisConfig, userLog);
8787

8888
const followsCanonicalRollup =
8989
typeof nodeConfig.rollupVersion !== 'number' || (nodeConfig.rollupVersion as unknown as string) === 'canonical';
@@ -158,7 +158,7 @@ export async function startNode(
158158
const telemetry = await initTelemetryClient(telemetryConfig);
159159

160160
// Create and start Aztec Node
161-
const node = await createAztecNode(nodeConfig, { telemetry, proverBroker: broker }, { genesis });
161+
const node = await createAztecNode(nodeConfig, { telemetry, proverBroker: broker }, { prefilledPublicData });
162162

163163
// Add node and p2p to services list
164164
services.node = [node, AztecNodeApiSchema];

yarn-project/aztec/src/local-network/local-network.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { protocolContractsHash } from '@aztec/protocol-contracts';
2121
import { SequencerState } from '@aztec/sequencer-client';
2222
import { AztecAddress } from '@aztec/stdlib/aztec-address';
2323
import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
24-
import type { GenesisData } from '@aztec/stdlib/world-state';
24+
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
2525
import {
2626
type TelemetryClient,
2727
getConfigEnvVars as getTelemetryClientConfig,
@@ -151,7 +151,7 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
151151
...(initialAccounts.length ? [bananaFPC, sponsoredFPC] : []),
152152
...prefundAddresses,
153153
];
154-
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(fundedAddresses);
154+
const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(fundedAddresses);
155155

156156
const dateProvider = new TestDateProvider();
157157

@@ -190,7 +190,7 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
190190
const telemetry = await initTelemetryClient(getTelemetryClientConfig());
191191
// Create a local blob client client inside the local network, no http connectivity
192192
const blobClient = createBlobClient();
193-
const node = await createAztecNode(aztecNodeConfig, { telemetry, blobClient, dateProvider }, { genesis });
193+
const node = await createAztecNode(aztecNodeConfig, { telemetry, blobClient, dateProvider }, { prefilledPublicData });
194194

195195
// Now that the node is up, let the watcher check for pending txs so it can skip unfilled slots faster when
196196
// transactions are waiting in the mempool. Also let it check if the sequencer is actively building, to avoid
@@ -259,7 +259,7 @@ export async function createAztecNode(
259259
dateProvider?: DateProvider;
260260
proverBroker?: ProvingJobBroker;
261261
} = {},
262-
options: { genesis?: GenesisData } = {},
262+
options: { prefilledPublicData?: PublicDataTreeLeaf[] } = {},
263263
) {
264264
// TODO(#12272): will clean this up. This is criminal.
265265
const { l1Contracts, ...rest } = getConfigEnvVars();

yarn-project/end-to-end/src/composed/ha/e2e_ha_full.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* and Web3Signer for remote signing. Verifies that blocks are produced,
66
* attestations are signed, and no double-signing occurs.
77
*/
8-
import type { InitialAccountData } from '@aztec/accounts/testing';
98
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
109
import { NO_FROM } from '@aztec/aztec.js/account';
1110
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
@@ -26,7 +25,6 @@ import type { TestDateProvider } from '@aztec/foundation/timer';
2625
import { GovernanceProposerAbi } from '@aztec/l1-artifacts/GovernanceProposerAbi';
2726
import { StatefulTestContractArtifact } from '@aztec/noir-test-contracts.js/StatefulTest';
2827
import { type AttestationInfo, getAttestationInfoFromPublishedCheckpoint } from '@aztec/stdlib/block';
29-
import type { GenesisData } from '@aztec/stdlib/world-state';
3028
import type { ValidatorClient } from '@aztec/validator-client';
3129
import { PostgresSlashingProtectionDatabase } from '@aztec/validator-ha-signer/db';
3230
import { type DutyRow, DutyStatus, DutyType } from '@aztec/validator-ha-signer/types';
@@ -69,9 +67,9 @@ describe('HA Full Setup', () => {
6967
let aztecNode: AztecNode;
7068
let config: AztecNodeConfig;
7169
let teardown: () => Promise<void>;
72-
let initialFundedAccounts: InitialAccountData[];
70+
let initialFundedAccounts: any[];
7371
let dateProvider: TestDateProvider;
74-
let genesis: GenesisData | undefined;
72+
let prefilledPublicData: any[] | undefined;
7573

7674
// HA specific resources
7775
let haNodePools: Pool[]; // Database pools for HA nodes (for cleanup)
@@ -143,7 +141,7 @@ describe('HA Full Setup', () => {
143141
initialFundedAccounts,
144142
dateProvider,
145143
deployL1ContractsValues,
146-
genesis,
144+
prefilledPublicData,
147145
} = await setup(1, {
148146
initialValidators,
149147
sequencerPublisherPrivateKeys: [new SecretValue(publisherPrivateKeys[0])],
@@ -240,7 +238,7 @@ describe('HA Full Setup', () => {
240238
};
241239

242240
const nodeService = await withLoggerBindings({ actor: `HA-${i}` }, async () => {
243-
return await AztecNodeService.createAndSync(nodeConfig, { dateProvider }, { genesis });
241+
return await AztecNodeService.createAndSync(nodeConfig, { dateProvider }, { prefilledPublicData });
244242
});
245243

246244
haNodeServices.push(nodeService);

yarn-project/end-to-end/src/e2e_epochs/epochs_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export class EpochsTestContext {
223223
},
224224
},
225225
{
226-
genesis: this.context.genesis,
226+
prefilledPublicData: this.context.prefilledPublicData ?? [],
227227
dontStart: opts.dontStart,
228228
},
229229
),
@@ -278,7 +278,7 @@ export class EpochsTestContext {
278278
slashingProtectionDb: opts.slashingProtectionDb,
279279
},
280280
{
281-
genesis: this.context.genesis,
281+
prefilledPublicData: this.context.prefilledPublicData,
282282
...opts,
283283
},
284284
),

0 commit comments

Comments
 (0)