@aztec/aztec 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dest/bin/index.d.ts +1 -1
- package/dest/bin/index.js +11 -10
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +9 -25
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +22 -39
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +46 -1
- package/dest/cli/cmds/start_archiver.d.ts +1 -1
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +9 -9
- package/dest/cli/cmds/start_bot.d.ts +4 -7
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +25 -14
- package/dest/cli/cmds/start_node.d.ts +1 -1
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +13 -21
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +12 -3
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +8 -3
- package/dest/cli/cmds/start_prover_node.d.ts +1 -1
- package/dest/cli/cmds/start_prover_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_node.js +16 -7
- package/dest/cli/cmds/start_txe.d.ts +1 -1
- package/dest/cli/index.d.ts +1 -1
- package/dest/cli/preload_crs.d.ts +1 -1
- package/dest/cli/release_version.d.ts +1 -1
- package/dest/cli/util.d.ts +12 -10
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +7 -7
- package/dest/cli/versioning.d.ts +1 -1
- package/dest/cli/versioning.js +3 -3
- package/dest/examples/token.d.ts +1 -1
- package/dest/examples/token.js +18 -16
- package/dest/examples/util.d.ts +3 -3
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/examples/util.js +1 -1
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/local-network/banana_fpc.d.ts +10 -0
- package/dest/local-network/banana_fpc.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/banana_fpc.js +15 -19
- package/dest/local-network/index.d.ts +4 -0
- package/dest/local-network/index.d.ts.map +1 -0
- package/dest/local-network/index.js +3 -0
- package/dest/local-network/local-network.d.ts +72 -0
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/{sandbox/sandbox.js → local-network/local-network.js} +43 -57
- package/dest/local-network/sponsored_fpc.d.ts +5 -0
- package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/sponsored_fpc.js +7 -8
- package/dest/mnemonic.d.ts +1 -1
- package/dest/splash.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts +4 -4
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +19 -18
- package/dest/testing/cheat_codes.d.ts +7 -10
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +9 -10
- package/dest/testing/index.d.ts +1 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +0 -1
- package/package.json +39 -37
- package/src/bin/index.ts +12 -10
- package/src/cli/aztec_start_action.ts +9 -22
- package/src/cli/aztec_start_options.ts +23 -40
- package/src/cli/cli.ts +46 -1
- package/src/cli/cmds/start_archiver.ts +9 -9
- package/src/cli/cmds/start_bot.ts +36 -13
- package/src/cli/cmds/start_node.ts +16 -17
- package/src/cli/cmds/start_p2p_bootstrap.ts +1 -1
- package/src/cli/cmds/start_prover_agent.ts +8 -11
- package/src/cli/cmds/start_prover_broker.ts +17 -3
- package/src/cli/cmds/start_prover_node.ts +13 -8
- package/src/cli/util.ts +12 -10
- package/src/cli/versioning.ts +3 -3
- package/src/examples/token.ts +20 -17
- package/src/examples/util.ts +2 -2
- package/src/index.ts +5 -5
- package/src/{sandbox → local-network}/banana_fpc.ts +16 -21
- package/src/local-network/index.ts +7 -0
- package/src/{sandbox/sandbox.ts → local-network/local-network.ts} +68 -99
- package/src/local-network/sponsored_fpc.ts +26 -0
- package/src/testing/anvil_test_watcher.ts +18 -19
- package/src/testing/cheat_codes.ts +13 -13
- package/src/testing/index.ts +0 -1
- package/dest/cli/chain_l2_config.d.ts +0 -31
- package/dest/cli/chain_l2_config.d.ts.map +0 -1
- package/dest/cli/chain_l2_config.js +0 -261
- package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
- package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
- package/dest/cli/cmds/start_blob_sink.js +0 -33
- package/dest/cli/cmds/start_pxe.d.ts +0 -16
- package/dest/cli/cmds/start_pxe.d.ts.map +0 -1
- package/dest/cli/cmds/start_pxe.js +0 -31
- package/dest/cli/get_l1_config.d.ts +0 -7
- package/dest/cli/get_l1_config.d.ts.map +0 -1
- package/dest/cli/get_l1_config.js +0 -13
- package/dest/sandbox/banana_fpc.d.ts +0 -11
- package/dest/sandbox/banana_fpc.d.ts.map +0 -1
- package/dest/sandbox/index.d.ts +0 -4
- package/dest/sandbox/index.d.ts.map +0 -1
- package/dest/sandbox/index.js +0 -3
- package/dest/sandbox/sandbox.d.ts +0 -83
- package/dest/sandbox/sandbox.d.ts.map +0 -1
- package/dest/sandbox/sponsored_fpc.d.ts +0 -4
- package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
- package/dest/testing/aztec_cheat_codes.d.ts +0 -59
- package/dest/testing/aztec_cheat_codes.d.ts.map +0 -1
- package/dest/testing/aztec_cheat_codes.js +0 -62
- package/src/cli/chain_l2_config.ts +0 -341
- package/src/cli/cmds/start_blob_sink.ts +0 -57
- package/src/cli/cmds/start_pxe.ts +0 -49
- package/src/cli/get_l1_config.ts +0 -19
- package/src/sandbox/index.ts +0 -4
- package/src/sandbox/sponsored_fpc.ts +0 -27
- package/src/testing/aztec_cheat_codes.ts +0 -77
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
-
import { DefaultL1ContractsConfig, type L1ContractsConfig } from '@aztec/ethereum';
|
|
3
|
-
import type { EnvVar, NetworkNames } from '@aztec/foundation/config';
|
|
4
|
-
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
5
|
-
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
6
|
-
|
|
7
|
-
import { mkdir, readFile, stat, writeFile } from 'fs/promises';
|
|
8
|
-
import path, { dirname, join } from 'path';
|
|
9
|
-
|
|
10
|
-
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
|
|
11
|
-
|
|
12
|
-
export type L2ChainConfig = L1ContractsConfig &
|
|
13
|
-
Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways'> & {
|
|
14
|
-
l1ChainId: number;
|
|
15
|
-
testAccounts: boolean;
|
|
16
|
-
sponsoredFPC: boolean;
|
|
17
|
-
p2pEnabled: boolean;
|
|
18
|
-
p2pBootstrapNodes: string[];
|
|
19
|
-
registryAddress: string;
|
|
20
|
-
slashFactoryAddress: string;
|
|
21
|
-
feeAssetHandlerAddress: string;
|
|
22
|
-
seqMinTxsPerBlock: number;
|
|
23
|
-
seqMaxTxsPerBlock: number;
|
|
24
|
-
realProofs: boolean;
|
|
25
|
-
snapshotsUrl: string;
|
|
26
|
-
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
27
|
-
autoUpdateUrl?: string;
|
|
28
|
-
maxTxPoolSize: number;
|
|
29
|
-
publicIncludeMetrics?: string[];
|
|
30
|
-
publicMetricsCollectorUrl?: string;
|
|
31
|
-
publicMetricsCollectFrom?: string[];
|
|
32
|
-
|
|
33
|
-
// Control whether sentinel is enabled or not. Needed for slashing
|
|
34
|
-
sentinelEnabled: boolean;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
|
|
38
|
-
l1ChainId: 11155111,
|
|
39
|
-
testAccounts: true,
|
|
40
|
-
sponsoredFPC: false,
|
|
41
|
-
p2pEnabled: true,
|
|
42
|
-
p2pBootstrapNodes: [],
|
|
43
|
-
registryAddress: '0x12b3ebc176a1646b911391eab3760764f2e05fe3',
|
|
44
|
-
slashFactoryAddress: '',
|
|
45
|
-
feeAssetHandlerAddress: '',
|
|
46
|
-
seqMinTxsPerBlock: 0,
|
|
47
|
-
seqMaxTxsPerBlock: 0,
|
|
48
|
-
realProofs: true,
|
|
49
|
-
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
|
|
50
|
-
autoUpdate: 'disabled',
|
|
51
|
-
autoUpdateUrl: undefined,
|
|
52
|
-
maxTxPoolSize: 100_000_000, // 100MB
|
|
53
|
-
|
|
54
|
-
...DefaultL1ContractsConfig,
|
|
55
|
-
|
|
56
|
-
/** How many seconds an L1 slot lasts. */
|
|
57
|
-
ethereumSlotDuration: 12,
|
|
58
|
-
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
59
|
-
aztecSlotDuration: 36,
|
|
60
|
-
/** How many L2 slots an epoch lasts. */
|
|
61
|
-
aztecEpochDuration: 32,
|
|
62
|
-
/** The target validator committee size. */
|
|
63
|
-
aztecTargetCommitteeSize: 48,
|
|
64
|
-
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
65
|
-
aztecProofSubmissionEpochs: 1,
|
|
66
|
-
/** The mana target for the rollup */
|
|
67
|
-
manaTarget: 0n,
|
|
68
|
-
/** The proving cost per mana */
|
|
69
|
-
provingCostPerMana: 0n,
|
|
70
|
-
|
|
71
|
-
slasherFlavor: 'none',
|
|
72
|
-
slashAmountSmall: 0n,
|
|
73
|
-
slashAmountMedium: 0n,
|
|
74
|
-
slashAmountLarge: 0n,
|
|
75
|
-
slashMinPenaltyPercentage: 0.5,
|
|
76
|
-
slashMaxPenaltyPercentage: 200,
|
|
77
|
-
slashInactivityTargetPercentage: 0,
|
|
78
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
79
|
-
slashInactivityPenalty: 0n,
|
|
80
|
-
slashPrunePenalty: 0n,
|
|
81
|
-
slashDataWithholdingPenalty: 0n,
|
|
82
|
-
slashProposeInvalidAttestationsPenalty: 0n,
|
|
83
|
-
slashAttestDescendantOfInvalidPenalty: 0n,
|
|
84
|
-
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
85
|
-
slashMaxPayloadSize: 50,
|
|
86
|
-
slashGracePeriodL2Slots: 0,
|
|
87
|
-
slashUnknownPenalty: 0n,
|
|
88
|
-
slashOffenseExpirationRounds: 10,
|
|
89
|
-
sentinelEnabled: false,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const alphaTestnetL2ChainConfig: L2ChainConfig = {
|
|
93
|
-
l1ChainId: 11155111,
|
|
94
|
-
testAccounts: false,
|
|
95
|
-
sponsoredFPC: true,
|
|
96
|
-
p2pEnabled: true,
|
|
97
|
-
p2pBootstrapNodes: [],
|
|
98
|
-
registryAddress: '0xec4156431d0f3df66d4e24ba3d30dcb4c85fa309',
|
|
99
|
-
slashFactoryAddress: '0x8b1566249dc8fb47234037538ce491f9500480b1',
|
|
100
|
-
feeAssetHandlerAddress: '0x4f0376b8bcbdf72ddb38c38f48317c00e9c9aec3',
|
|
101
|
-
seqMinTxsPerBlock: 0,
|
|
102
|
-
seqMaxTxsPerBlock: 20,
|
|
103
|
-
realProofs: true,
|
|
104
|
-
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
|
|
105
|
-
autoUpdate: 'config-and-version',
|
|
106
|
-
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/alpha-testnet.json',
|
|
107
|
-
maxTxPoolSize: 100_000_000, // 100MB
|
|
108
|
-
publicIncludeMetrics,
|
|
109
|
-
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
110
|
-
publicMetricsCollectFrom: ['sequencer'],
|
|
111
|
-
|
|
112
|
-
// Deployment stuff
|
|
113
|
-
/** How many seconds an L1 slot lasts. */
|
|
114
|
-
ethereumSlotDuration: 12,
|
|
115
|
-
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
116
|
-
aztecSlotDuration: 36,
|
|
117
|
-
/** How many L2 slots an epoch lasts. */
|
|
118
|
-
aztecEpochDuration: 32,
|
|
119
|
-
/** The target validator committee size. */
|
|
120
|
-
aztecTargetCommitteeSize: 48,
|
|
121
|
-
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
122
|
-
aztecProofSubmissionEpochs: 1,
|
|
123
|
-
/** The deposit amount for a validator */
|
|
124
|
-
activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
125
|
-
/** The minimum stake for a validator. */
|
|
126
|
-
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
127
|
-
/** The slashing round size */
|
|
128
|
-
slashingRoundSizeInEpochs: 4,
|
|
129
|
-
/** Governance proposing round size */
|
|
130
|
-
governanceProposerRoundSize: 300,
|
|
131
|
-
/** The mana target for the rollup */
|
|
132
|
-
manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
133
|
-
/** The proving cost per mana */
|
|
134
|
-
provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
135
|
-
/** Exit delay for stakers */
|
|
136
|
-
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
137
|
-
/** Tally-style slashing */
|
|
138
|
-
slasherFlavor: 'tally',
|
|
139
|
-
/** Allow one round for vetoing */
|
|
140
|
-
slashingExecutionDelayInRounds: 1,
|
|
141
|
-
/** How long for a slash payload to be executed */
|
|
142
|
-
slashingLifetimeInRounds: 4,
|
|
143
|
-
/** Allow 2 rounds to discover faults */
|
|
144
|
-
slashingOffsetInRounds: 2,
|
|
145
|
-
/** No slash vetoer */
|
|
146
|
-
slashingVetoer: EthAddress.ZERO,
|
|
147
|
-
/** Use default slash amounts */
|
|
148
|
-
slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
149
|
-
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
150
|
-
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
151
|
-
|
|
152
|
-
// Slashing stuff
|
|
153
|
-
slashMinPenaltyPercentage: 0.5,
|
|
154
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
155
|
-
slashInactivityTargetPercentage: 0.7,
|
|
156
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
157
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
158
|
-
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
159
|
-
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
160
|
-
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
161
|
-
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
162
|
-
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
163
|
-
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
164
|
-
slashMaxPayloadSize: 50,
|
|
165
|
-
slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
|
|
166
|
-
slashOffenseExpirationRounds: 8,
|
|
167
|
-
sentinelEnabled: true,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
|
|
171
|
-
|
|
172
|
-
export async function getBootnodes(networkName: NetworkNames, cacheDir?: string) {
|
|
173
|
-
const cacheFile = cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined;
|
|
174
|
-
try {
|
|
175
|
-
if (cacheFile) {
|
|
176
|
-
const info = await stat(cacheFile);
|
|
177
|
-
if (info.mtimeMs + BOOTNODE_CACHE_DURATION_MS > Date.now()) {
|
|
178
|
-
return JSON.parse(await readFile(cacheFile, 'utf-8'))['bootnodes'];
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
} catch {
|
|
182
|
-
// no-op. Get the remote-file
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
186
|
-
const response = await fetch(url);
|
|
187
|
-
if (!response.ok) {
|
|
188
|
-
throw new Error(
|
|
189
|
-
`Failed to fetch basic contract addresses from ${url}. Check you are using a correct network name.`,
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
const json = await response.json();
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
if (cacheFile) {
|
|
196
|
-
await mkdir(dirname(cacheFile), { recursive: true });
|
|
197
|
-
await writeFile(cacheFile, JSON.stringify(json), 'utf-8');
|
|
198
|
-
}
|
|
199
|
-
} catch {
|
|
200
|
-
// no-op
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return json['bootnodes'];
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export async function getL2ChainConfig(
|
|
207
|
-
networkName: NetworkNames,
|
|
208
|
-
cacheDir?: string,
|
|
209
|
-
): Promise<L2ChainConfig | undefined> {
|
|
210
|
-
if (networkName === 'testnet-ignition') {
|
|
211
|
-
const config = { ...testnetIgnitionL2ChainConfig };
|
|
212
|
-
config.p2pBootstrapNodes = await getBootnodes(networkName, cacheDir);
|
|
213
|
-
return config;
|
|
214
|
-
} else if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
215
|
-
const config = { ...alphaTestnetL2ChainConfig };
|
|
216
|
-
config.p2pBootstrapNodes = await getBootnodes('alpha-testnet', cacheDir);
|
|
217
|
-
return config;
|
|
218
|
-
}
|
|
219
|
-
return undefined;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function enrichVar(envVar: EnvVar, value: string | undefined) {
|
|
223
|
-
// Don't override
|
|
224
|
-
if (process.env[envVar] || value === undefined) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
process.env[envVar] = value;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function enrichEthAddressVar(envVar: EnvVar, value: string) {
|
|
231
|
-
// EthAddress doesn't like being given empty strings
|
|
232
|
-
if (value === '') {
|
|
233
|
-
enrichVar(envVar, EthAddress.ZERO.toString());
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
enrichVar(envVar, value);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function getDefaultDataDir(networkName: NetworkNames): string {
|
|
240
|
-
let prefix: string;
|
|
241
|
-
if (networkName === 'testnet-ignition') {
|
|
242
|
-
prefix = 'testnet-ignition';
|
|
243
|
-
} else if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
244
|
-
prefix = 'alpha-testnet';
|
|
245
|
-
} else {
|
|
246
|
-
prefix = networkName;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return path.join(process.env.HOME || '~', '.aztec', prefix, 'data');
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
253
|
-
if (networkName === 'local') {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
enrichVar('DATA_DIRECTORY', getDefaultDataDir(networkName));
|
|
258
|
-
const cacheDir = process.env.DATA_DIRECTORY ? join(process.env.DATA_DIRECTORY, 'cache') : undefined;
|
|
259
|
-
const config = await getL2ChainConfig(networkName, cacheDir);
|
|
260
|
-
|
|
261
|
-
if (!config) {
|
|
262
|
-
throw new Error(`Unknown network name: ${networkName}`);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
enrichVar('BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(','));
|
|
266
|
-
enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
|
|
267
|
-
enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
|
|
268
|
-
enrichVar('P2P_ENABLED', config.p2pEnabled.toString());
|
|
269
|
-
enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
|
|
270
|
-
enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
|
|
271
|
-
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
272
|
-
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
273
|
-
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
274
|
-
enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
|
|
275
|
-
enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
|
|
276
|
-
|
|
277
|
-
if (config.autoUpdate) {
|
|
278
|
-
enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (config.autoUpdateUrl) {
|
|
282
|
-
enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (config.publicIncludeMetrics) {
|
|
286
|
-
enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (config.publicMetricsCollectorUrl) {
|
|
290
|
-
enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (config.publicMetricsCollectFrom) {
|
|
294
|
-
enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
|
|
298
|
-
enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
|
|
299
|
-
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
|
|
300
|
-
|
|
301
|
-
// Deployment stuff
|
|
302
|
-
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
303
|
-
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
304
|
-
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
305
|
-
enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
|
|
306
|
-
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
307
|
-
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
|
|
308
|
-
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
|
|
309
|
-
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
|
|
310
|
-
enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
|
|
311
|
-
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
|
|
312
|
-
enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
|
|
313
|
-
enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
|
|
314
|
-
enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
|
|
315
|
-
enrichVar('AZTEC_SLASH_AMOUNT_SMALL', config.slashAmountSmall.toString());
|
|
316
|
-
enrichVar('AZTEC_SLASH_AMOUNT_MEDIUM', config.slashAmountMedium.toString());
|
|
317
|
-
enrichVar('AZTEC_SLASH_AMOUNT_LARGE', config.slashAmountLarge.toString());
|
|
318
|
-
enrichVar('AZTEC_SLASHING_LIFETIME_IN_ROUNDS', config.slashingLifetimeInRounds.toString());
|
|
319
|
-
enrichVar('AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS', config.slashingExecutionDelayInRounds.toString());
|
|
320
|
-
enrichVar('AZTEC_SLASHING_OFFSET_IN_ROUNDS', config.slashingOffsetInRounds.toString());
|
|
321
|
-
enrichVar('AZTEC_SLASHER_FLAVOR', config.slasherFlavor);
|
|
322
|
-
enrichVar('AZTEC_EXIT_DELAY_SECONDS', config.exitDelaySeconds.toString());
|
|
323
|
-
enrichEthAddressVar('AZTEC_SLASHING_VETOER', config.slashingVetoer.toString());
|
|
324
|
-
|
|
325
|
-
// Slashing
|
|
326
|
-
enrichVar('SLASH_MIN_PENALTY_PERCENTAGE', config.slashMinPenaltyPercentage.toString());
|
|
327
|
-
enrichVar('SLASH_MAX_PENALTY_PERCENTAGE', config.slashMaxPenaltyPercentage.toString());
|
|
328
|
-
enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
|
|
329
|
-
enrichVar('SLASH_DATA_WITHHOLDING_PENALTY', config.slashDataWithholdingPenalty.toString());
|
|
330
|
-
enrichVar('SLASH_INACTIVITY_TARGET_PERCENTAGE', config.slashInactivityTargetPercentage.toString());
|
|
331
|
-
enrichVar('SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD', config.slashInactivityConsecutiveEpochThreshold.toString());
|
|
332
|
-
enrichVar('SLASH_INACTIVITY_PENALTY', config.slashInactivityPenalty.toString());
|
|
333
|
-
enrichVar('SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY', config.slashProposeInvalidAttestationsPenalty.toString());
|
|
334
|
-
enrichVar('SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY', config.slashAttestDescendantOfInvalidPenalty.toString());
|
|
335
|
-
enrichVar('SLASH_UNKNOWN_PENALTY', config.slashUnknownPenalty.toString());
|
|
336
|
-
enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashBroadcastedInvalidBlockPenalty.toString());
|
|
337
|
-
enrichVar('SLASH_OFFENSE_EXPIRATION_ROUNDS', config.slashOffenseExpirationRounds.toString());
|
|
338
|
-
enrichVar('SLASH_MAX_PAYLOAD_SIZE', config.slashMaxPayloadSize.toString());
|
|
339
|
-
|
|
340
|
-
enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
|
|
341
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type BlobSinkConfig,
|
|
3
|
-
blobSinkConfigMappings,
|
|
4
|
-
createBlobSinkServer,
|
|
5
|
-
getBlobSinkConfigFromEnv,
|
|
6
|
-
} from '@aztec/blob-sink/server';
|
|
7
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
8
|
-
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
9
|
-
|
|
10
|
-
import { getL1Config } from '../get_l1_config.js';
|
|
11
|
-
import { extractRelevantOptions } from '../util.js';
|
|
12
|
-
|
|
13
|
-
export async function startBlobSink(options: any, signalHandlers: (() => Promise<void>)[], userLog: LogFn) {
|
|
14
|
-
if (options.prover || options.node || options.sequencer || options.pxe || options.p2pBootstrap || options.txe) {
|
|
15
|
-
userLog(
|
|
16
|
-
`Starting a blob sink with --node, --sequencer, --pxe, --p2p-bootstrap, --prover or --txe is not supported.`,
|
|
17
|
-
);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let blobSinkConfig: BlobSinkConfig = {
|
|
22
|
-
...getBlobSinkConfigFromEnv(), // get default config from env
|
|
23
|
-
...extractRelevantOptions<BlobSinkConfig>(options, blobSinkConfigMappings, 'blobSink'), // override with command line options
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
if (!blobSinkConfig.l1Contracts?.registryAddress || blobSinkConfig.l1Contracts.registryAddress.isZero()) {
|
|
27
|
-
throw new Error('REGISTRY_CONTRACT_ADDRESS not set');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!blobSinkConfig.l1RpcUrls || blobSinkConfig.l1RpcUrls.length === 0) {
|
|
31
|
-
throw new Error('ETHEREUM_HOSTS not set');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (typeof blobSinkConfig.l1ChainId !== 'number') {
|
|
35
|
-
throw new Error('L1_CHAIN_ID');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const telemetry = initTelemetryClient(getTelemetryClientConfig());
|
|
39
|
-
|
|
40
|
-
const { config: chainConfig, addresses } = await getL1Config(
|
|
41
|
-
blobSinkConfig.l1Contracts.registryAddress,
|
|
42
|
-
blobSinkConfig.l1RpcUrls,
|
|
43
|
-
blobSinkConfig.l1ChainId,
|
|
44
|
-
blobSinkConfig.rollupVersion,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
blobSinkConfig = {
|
|
48
|
-
...blobSinkConfig,
|
|
49
|
-
l1Contracts: addresses,
|
|
50
|
-
...chainConfig,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const blobSink = await createBlobSinkServer(blobSinkConfig, telemetry);
|
|
54
|
-
signalHandlers.push(blobSink.stop.bind(blobSink));
|
|
55
|
-
|
|
56
|
-
await blobSink.start();
|
|
57
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
4
|
-
type CliPXEOptions,
|
|
5
|
-
type PXEService,
|
|
6
|
-
type PXEServiceConfig,
|
|
7
|
-
allPxeConfigMappings,
|
|
8
|
-
createPXEService,
|
|
9
|
-
} from '@aztec/pxe/server';
|
|
10
|
-
import { type AztecNode, PXESchema, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
11
|
-
import { makeTracedFetch } from '@aztec/telemetry-client';
|
|
12
|
-
|
|
13
|
-
import { extractRelevantOptions } from '../util.js';
|
|
14
|
-
import { getVersions } from '../versioning.js';
|
|
15
|
-
|
|
16
|
-
export type { PXEServiceConfig, CliPXEOptions };
|
|
17
|
-
|
|
18
|
-
export async function startPXE(
|
|
19
|
-
options: any,
|
|
20
|
-
signalHandlers: (() => Promise<void>)[],
|
|
21
|
-
services: NamespacedApiHandlers,
|
|
22
|
-
userLog: LogFn,
|
|
23
|
-
): Promise<{ pxe: PXEService; config: PXEServiceConfig & CliPXEOptions }> {
|
|
24
|
-
return await addPXE(options, signalHandlers, services, userLog, {});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export async function addPXE(
|
|
28
|
-
options: any,
|
|
29
|
-
_signalHandlers: (() => Promise<void>)[],
|
|
30
|
-
services: NamespacedApiHandlers,
|
|
31
|
-
userLog: LogFn,
|
|
32
|
-
deps: { node?: AztecNode } = {},
|
|
33
|
-
): Promise<{ pxe: PXEService; config: PXEServiceConfig & CliPXEOptions }> {
|
|
34
|
-
const pxeConfig = extractRelevantOptions<PXEServiceConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
35
|
-
const nodeUrl = pxeConfig.nodeUrl;
|
|
36
|
-
|
|
37
|
-
if (!nodeUrl && !deps.node) {
|
|
38
|
-
userLog('Aztec Node URL (nodeUrl | AZTEC_NODE_URL) option is required to start PXE without --node option');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const node = deps.node ?? createAztecNodeClient(nodeUrl!, getVersions(pxeConfig), makeTracedFetch([1, 2, 3], true));
|
|
43
|
-
const pxe = await createPXEService(node, pxeConfig as PXEServiceConfig);
|
|
44
|
-
|
|
45
|
-
// Add PXE to services list
|
|
46
|
-
services.pxe = [pxe, PXESchema];
|
|
47
|
-
|
|
48
|
-
return { pxe, config: pxeConfig };
|
|
49
|
-
}
|
package/src/cli/get_l1_config.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type L1ContractAddresses, RegistryContract, getL1ContractsConfig, getPublicClient } from '@aztec/ethereum';
|
|
2
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
|
|
4
|
-
export async function getL1Config(
|
|
5
|
-
registryAddress: EthAddress,
|
|
6
|
-
l1RpcUrls: string[],
|
|
7
|
-
l1ChainId: number,
|
|
8
|
-
rollupVersion: number | 'canonical' = 'canonical',
|
|
9
|
-
): Promise<{ addresses: L1ContractAddresses; config: Awaited<ReturnType<typeof getL1ContractsConfig>> }> {
|
|
10
|
-
const publicClient = getPublicClient({ l1RpcUrls, l1ChainId });
|
|
11
|
-
const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, rollupVersion);
|
|
12
|
-
|
|
13
|
-
const config = await getL1ContractsConfig(publicClient, addresses);
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
addresses,
|
|
17
|
-
config,
|
|
18
|
-
};
|
|
19
|
-
}
|
package/src/sandbox/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ContractInstanceWithAddress,
|
|
3
|
-
Fr,
|
|
4
|
-
type PXE,
|
|
5
|
-
getContractInstanceFromInstantiationParams,
|
|
6
|
-
} from '@aztec/aztec.js';
|
|
7
|
-
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
8
|
-
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
9
|
-
|
|
10
|
-
async function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress> {
|
|
11
|
-
return await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
12
|
-
salt: new Fr(SPONSORED_FPC_SALT),
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function getSponsoredFPCAddress() {
|
|
17
|
-
return (await getSponsoredFPCInstance()).address;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function getDeployedSponsoredFPCAddress(pxe: PXE) {
|
|
21
|
-
const fpc = await getSponsoredFPCAddress();
|
|
22
|
-
const contracts = await pxe.getContracts();
|
|
23
|
-
if (!contracts.find(c => c.equals(fpc))) {
|
|
24
|
-
throw new Error('SponsoredFPC not deployed.');
|
|
25
|
-
}
|
|
26
|
-
return fpc;
|
|
27
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { deriveStorageSlotInMap } from '@aztec/stdlib/hash';
|
|
5
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
6
|
-
import type { Note } from '@aztec/stdlib/note';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A class that provides utility functions for interacting with the aztec chain.
|
|
10
|
-
*/
|
|
11
|
-
export class AztecCheatCodes {
|
|
12
|
-
constructor(
|
|
13
|
-
/**
|
|
14
|
-
* The PXE Service to use for interacting with the chain
|
|
15
|
-
*/
|
|
16
|
-
public pxe: PXE,
|
|
17
|
-
/**
|
|
18
|
-
* The logger to use for the aztec cheatcodes
|
|
19
|
-
*/
|
|
20
|
-
public logger = createLogger('aztecjs:cheat_codes'),
|
|
21
|
-
) {}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Computes the slot value for a given map and key.
|
|
25
|
-
* @param mapSlot - The slot of the map (specified in Aztec.nr contract)
|
|
26
|
-
* @param key - The key to lookup in the map
|
|
27
|
-
* @returns The storage slot of the value in the map
|
|
28
|
-
*/
|
|
29
|
-
public computeSlotInMap(mapSlot: Fr | bigint, key: Fr | bigint | AztecAddress): Promise<Fr> {
|
|
30
|
-
const keyFr = typeof key === 'bigint' ? new Fr(key) : key.toField();
|
|
31
|
-
return deriveStorageSlotInMap(mapSlot, keyFr);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get the current blocknumber
|
|
36
|
-
* @returns The current block number
|
|
37
|
-
*/
|
|
38
|
-
public async blockNumber(): Promise<number> {
|
|
39
|
-
return await this.pxe.getBlockNumber();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Get the current timestamp
|
|
44
|
-
* @returns The current timestamp
|
|
45
|
-
*/
|
|
46
|
-
public async timestamp(): Promise<number> {
|
|
47
|
-
const res = await this.pxe.getBlock(await this.blockNumber());
|
|
48
|
-
return Number(res?.header.globalVariables.timestamp ?? 0);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Loads the value stored at the given slot in the public storage of the given contract.
|
|
53
|
-
* @param who - The address of the contract
|
|
54
|
-
* @param slot - The storage slot to lookup
|
|
55
|
-
* @returns The value stored at the given slot
|
|
56
|
-
*/
|
|
57
|
-
public async loadPublic(who: AztecAddress, slot: Fr | bigint): Promise<Fr> {
|
|
58
|
-
const storageValue = await this.pxe.getPublicStorageAt(who, new Fr(slot));
|
|
59
|
-
return storageValue;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Loads the value stored at the given slot in the private storage of the given contract.
|
|
64
|
-
* @param contract - The address of the contract
|
|
65
|
-
* @param recipient - The address whose public key was used to encrypt the note
|
|
66
|
-
* @param slot - The storage slot to lookup
|
|
67
|
-
* @returns The notes stored at the given slot
|
|
68
|
-
*/
|
|
69
|
-
public async loadPrivate(recipient: AztecAddress, contract: AztecAddress, slot: Fr | bigint): Promise<Note[]> {
|
|
70
|
-
const extendedNotes = await this.pxe.getNotes({
|
|
71
|
-
recipient,
|
|
72
|
-
contractAddress: contract,
|
|
73
|
-
storageSlot: new Fr(slot),
|
|
74
|
-
});
|
|
75
|
-
return extendedNotes.map(extendedNote => extendedNote.note);
|
|
76
|
-
}
|
|
77
|
-
}
|