@aztec/stdlib 0.0.1-commit.c0b82b2 → 0.0.1-commit.c2eed6949
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/dest/abi/abi.d.ts +138 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +10 -2
- package/dest/abi/buffer.d.ts +14 -4
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +25 -4
- package/dest/abi/decoder.d.ts +2 -2
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +6 -1
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +28 -1
- package/dest/abi/event_metadata_definition.d.ts +3 -1
- package/dest/abi/event_metadata_definition.d.ts.map +1 -1
- package/dest/abi/event_metadata_definition.js +1 -1
- package/dest/abi/utils.d.ts +14 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +15 -0
- package/dest/avm/avm.d.ts +300 -300
- package/dest/block/l2_block.d.ts +9 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +12 -2
- package/dest/block/l2_block_source.d.ts +16 -8
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.d.ts +2 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +9 -4
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/validate.d.ts +36 -0
- package/dest/checkpoint/validate.d.ts.map +1 -0
- package/dest/checkpoint/validate.js +120 -0
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/pipelining-config.d.ts +19 -0
- package/dest/config/pipelining-config.d.ts.map +1 -0
- package/dest/config/pipelining-config.js +18 -0
- package/dest/config/sequencer-config.d.ts +4 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +6 -0
- package/dest/contract/contract_address.d.ts +3 -3
- package/dest/contract/contract_address.js +3 -3
- package/dest/contract/contract_class_id.d.ts +2 -2
- package/dest/contract/contract_class_id.js +2 -2
- package/dest/contract/index.d.ts +1 -3
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -2
- package/dest/contract/interfaces/contract_class.d.ts +3 -156
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +1 -28
- package/dest/epoch-helpers/index.d.ts +7 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +10 -2
- package/dest/gas/gas_fees.d.ts +1 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +4 -1
- package/dest/ha-signing/config.d.ts +49 -14
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +20 -15
- package/dest/ha-signing/index.d.ts +3 -2
- package/dest/ha-signing/index.d.ts.map +1 -1
- package/dest/ha-signing/index.js +2 -1
- package/dest/ha-signing/local_config.d.ts +63 -0
- package/dest/ha-signing/local_config.d.ts.map +1 -0
- package/dest/ha-signing/local_config.js +24 -0
- package/dest/hash/hash.d.ts +16 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +24 -0
- package/dest/interfaces/allowed_element.d.ts +26 -20
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +8 -8
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +3 -2
- package/dest/interfaces/aztec-node-admin.d.ts +76 -30
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +12 -6
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +5 -2
- package/dest/interfaces/block-builder.d.ts +38 -11
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +13 -6
- package/dest/interfaces/configs.d.ts +62 -32
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +6 -2
- package/dest/interfaces/l2_logs_source.d.ts +5 -3
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +9 -19
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +6 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/proving-job.d.ts +200 -200
- package/dest/interfaces/validator.d.ts +103 -41
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +8 -4
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
- package/dest/kv-store/config.d.ts +17 -0
- package/dest/kv-store/config.d.ts.map +1 -0
- package/dest/kv-store/config.js +26 -0
- package/dest/kv-store/index.d.ts +2 -0
- package/dest/kv-store/index.d.ts.map +1 -0
- package/dest/kv-store/index.js +1 -0
- package/dest/logs/index.d.ts +2 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +1 -0
- package/dest/logs/log_filter.d.ts +4 -1
- package/dest/logs/log_filter.d.ts.map +1 -1
- package/dest/logs/log_filter.js +2 -1
- package/dest/logs/public_log.d.ts +4 -3
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +2 -1
- package/dest/logs/tagging_index_range.d.ts +40 -0
- package/dest/logs/tagging_index_range.d.ts.map +1 -0
- package/dest/logs/tagging_index_range.js +8 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +7 -0
- package/dest/messaging/l1_to_l2_message.d.ts +3 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +11 -13
- package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +69 -26
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +1 -6
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +13 -23
- package/dest/p2p/peer_error.d.ts +3 -1
- package/dest/p2p/peer_error.d.ts.map +1 -1
- package/dest/p2p/peer_error.js +5 -0
- package/dest/proofs/chonk_proof.d.ts +46 -2
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +85 -10
- package/dest/slashing/tally.d.ts +7 -2
- package/dest/slashing/tally.d.ts.map +1 -1
- package/dest/slashing/tally.js +30 -2
- package/dest/tests/factories.d.ts +2 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +0 -27
- package/dest/tests/mocks.d.ts +4 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +13 -8
- package/dest/tx/block_header.d.ts +3 -1
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +4 -0
- package/dest/tx/private_execution_result.d.ts +6 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -6
- package/dest/tx/profiling.d.ts +14 -2
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +13 -3
- package/dest/tx/simulated_tx.d.ts +113 -2
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +4 -1
- package/dest/tx/tx.d.ts +6 -5
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +18 -6
- package/dest/tx/tx_receipt.d.ts +7 -2
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +6 -3
- package/dest/tx/validator/error_texts.d.ts +9 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +10 -0
- package/dest/update-checker/index.d.ts +3 -2
- package/dest/update-checker/index.d.ts.map +1 -1
- package/dest/update-checker/index.js +2 -1
- package/dest/update-checker/package_version.d.ts +3 -0
- package/dest/update-checker/package_version.d.ts.map +1 -0
- package/dest/update-checker/package_version.js +24 -0
- package/dest/update-checker/version_checker.d.ts +25 -0
- package/dest/update-checker/version_checker.d.ts.map +1 -0
- package/dest/update-checker/version_checker.js +50 -0
- package/dest/validators/errors.d.ts +6 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +7 -0
- package/dest/versioning/versioning.d.ts +4 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +4 -1
- package/package.json +10 -9
- package/src/abi/abi.ts +25 -2
- package/src/abi/buffer.ts +25 -4
- package/src/abi/decoder.ts +14 -2
- package/src/abi/encoder.ts +41 -1
- package/src/abi/event_metadata_definition.ts +2 -0
- package/src/abi/utils.ts +25 -0
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_source.ts +16 -7
- package/src/checkpoint/checkpoint.ts +12 -3
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/validate.ts +230 -0
- package/src/config/index.ts +1 -0
- package/src/config/pipelining-config.ts +31 -0
- package/src/config/sequencer-config.ts +9 -1
- package/src/contract/contract_address.ts +3 -3
- package/src/contract/contract_class_id.ts +2 -2
- package/src/contract/index.ts +0 -2
- package/src/contract/interfaces/contract_class.ts +2 -82
- package/src/epoch-helpers/index.ts +14 -0
- package/src/gas/README.md +123 -0
- package/src/gas/gas_fees.ts +7 -1
- package/src/ha-signing/config.ts +45 -38
- package/src/ha-signing/index.ts +9 -0
- package/src/ha-signing/local_config.ts +46 -0
- package/src/hash/hash.ts +29 -0
- package/src/interfaces/allowed_element.ts +29 -9
- package/src/interfaces/archiver.ts +3 -2
- package/src/interfaces/aztec-node.ts +24 -5
- package/src/interfaces/block-builder.ts +60 -14
- package/src/interfaces/configs.ts +25 -8
- package/src/interfaces/l2_logs_source.ts +4 -1
- package/src/interfaces/merkle_tree_operations.ts +8 -18
- package/src/interfaces/prover-client.ts +8 -0
- package/src/interfaces/validator.ts +50 -28
- package/src/interfaces/world_state.ts +4 -3
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
- package/src/kv-store/config.ts +36 -0
- package/src/kv-store/index.ts +1 -0
- package/src/logs/index.ts +1 -0
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/public_log.ts +4 -2
- package/src/logs/tagging_index_range.ts +24 -0
- package/src/logs/tx_scoped_l2_log.ts +16 -0
- package/src/messaging/l1_to_l2_message.ts +12 -9
- package/src/messaging/l1_to_l2_message_source.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +98 -33
- package/src/noir/index.ts +2 -2
- package/src/p2p/checkpoint_proposal.ts +23 -37
- package/src/p2p/peer_error.ts +7 -0
- package/src/proofs/chonk_proof.ts +91 -5
- package/src/slashing/tally.ts +34 -1
- package/src/tests/factories.ts +0 -33
- package/src/tests/mocks.ts +18 -7
- package/src/tx/block_header.ts +6 -0
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +11 -2
- package/src/tx/simulated_tx.ts +8 -1
- package/src/tx/tx.ts +20 -11
- package/src/tx/tx_receipt.ts +7 -2
- package/src/tx/validator/error_texts.ts +12 -0
- package/src/update-checker/index.ts +2 -1
- package/src/update-checker/package_version.ts +30 -0
- package/src/update-checker/version_checker.ts +65 -0
- package/src/validators/errors.ts +9 -0
- package/src/versioning/versioning.ts +4 -1
- package/dest/contract/private_function_membership_proof.d.ts +0 -32
- package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/private_function_membership_proof.js +0 -124
- package/dest/contract/utility_function_membership_proof.d.ts +0 -27
- package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/utility_function_membership_proof.js +0 -87
- package/dest/update-checker/update-checker.d.ts +0 -49
- package/dest/update-checker/update-checker.d.ts.map +0 -1
- package/dest/update-checker/update-checker.js +0 -130
- package/src/contract/private_function_membership_proof.ts +0 -167
- package/src/contract/utility_function_membership_proof.ts +0 -118
- package/src/update-checker/update-checker.ts +0 -166
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fileURLToPath } from '@aztec/foundation/url';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { dirname, resolve } from 'path';
|
|
4
|
+
/** Returns the package version from the release-please manifest or the package.json, or undefined if not found. */ export function getPackageVersion() {
|
|
5
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
// Try the release-please manifest first (works in dev/repo checkout).
|
|
7
|
+
try {
|
|
8
|
+
const releasePleaseManifestPath = resolve(dir, '../../../../.release-please-manifest.json');
|
|
9
|
+
return JSON.parse(readFileSync(releasePleaseManifestPath).toString())['.'];
|
|
10
|
+
} catch {
|
|
11
|
+
// Not in a repo checkout, fall through.
|
|
12
|
+
}
|
|
13
|
+
// Fall back to the stdlib package.json version (works in npm-installed packages).
|
|
14
|
+
try {
|
|
15
|
+
const packageJsonPath = resolve(dir, '../../package.json');
|
|
16
|
+
const version = JSON.parse(readFileSync(packageJsonPath).toString()).version;
|
|
17
|
+
if (version && version !== '0.1.0') {
|
|
18
|
+
return version;
|
|
19
|
+
}
|
|
20
|
+
} catch {
|
|
21
|
+
// No package.json found either.
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
export type EventMap = {
|
|
3
|
+
newVersion: [{
|
|
4
|
+
name: string;
|
|
5
|
+
currentVersion: string;
|
|
6
|
+
latestVersion: string;
|
|
7
|
+
}];
|
|
8
|
+
};
|
|
9
|
+
export type VersionCheck = {
|
|
10
|
+
name: string;
|
|
11
|
+
currentVersion: string;
|
|
12
|
+
getLatestVersion: () => Promise<string | undefined>;
|
|
13
|
+
};
|
|
14
|
+
export declare class VersionChecker extends EventEmitter<EventMap> {
|
|
15
|
+
private checks;
|
|
16
|
+
private logger;
|
|
17
|
+
private runningPromise;
|
|
18
|
+
constructor(checks: Array<VersionCheck>, intervalCheckMs?: number, logger?: import("@aztec/foundation/log").Logger);
|
|
19
|
+
start(): void;
|
|
20
|
+
trigger(): Promise<void>;
|
|
21
|
+
stop(): Promise<void>;
|
|
22
|
+
private run;
|
|
23
|
+
private checkVersion;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbl9jaGVja2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXBkYXRlLWNoZWNrZXIvdmVyc2lvbl9jaGVja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFM0MsTUFBTSxNQUFNLFFBQVEsR0FBRztJQUNyQixVQUFVLEVBQUUsQ0FBQztRQUFFLElBQUksRUFBRSxNQUFNLENBQUM7UUFBQyxjQUFjLEVBQUUsTUFBTSxDQUFDO1FBQUMsYUFBYSxFQUFFLE1BQU0sQ0FBQTtLQUFFLENBQUMsQ0FBQztDQUMvRSxDQUFDO0FBRUY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,GAAG,SAAS,CAAC,CAAC;CACrD,CAAC;AAEF,qBAAa,cAAe,SAAQ,YAAY,CAAC,QAAQ,CAAC;IAGtD,OAAO,CAAC,MAAM;IAEd,OAAO,CAAC,MAAM;IAJhB,OAAO,CAAC,cAAc,CAAiB;IACvC,YACU,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,EACnC,eAAe,SAAS,EAChB,MAAM,yCAAkC,EAIjD;IAEM,KAAK,IAAI,IAAI,CAQnB;IAEM,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAE9B;IAEY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAQjC;IAED,OAAO,CAAC,GAAG,CAET;YAEY,YAAY;CAU3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { RunningPromise } from '@aztec/foundation/promise';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
|
+
export class VersionChecker extends EventEmitter {
|
|
5
|
+
checks;
|
|
6
|
+
logger;
|
|
7
|
+
runningPromise;
|
|
8
|
+
constructor(checks, intervalCheckMs = 60_000, logger = createLogger('version_checker')){
|
|
9
|
+
super(), this.checks = checks, this.logger = logger, this.run = async ()=>{
|
|
10
|
+
await Promise.allSettled(this.checks.map((check)=>this.checkVersion(check)));
|
|
11
|
+
};
|
|
12
|
+
this.runningPromise = new RunningPromise(this.run, logger, intervalCheckMs);
|
|
13
|
+
}
|
|
14
|
+
start() {
|
|
15
|
+
if (this.runningPromise.isRunning()) {
|
|
16
|
+
this.logger.warn('VersionChecker is already running');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.runningPromise.start();
|
|
20
|
+
this.logger.info('Version check started');
|
|
21
|
+
}
|
|
22
|
+
trigger() {
|
|
23
|
+
return this.runningPromise.trigger();
|
|
24
|
+
}
|
|
25
|
+
async stop() {
|
|
26
|
+
if (!this.runningPromise.isRunning()) {
|
|
27
|
+
this.logger.warn('VersionChecker is not running');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
await this.runningPromise.stop();
|
|
31
|
+
this.logger.info('Version checker stopped');
|
|
32
|
+
}
|
|
33
|
+
run;
|
|
34
|
+
async checkVersion({ name, currentVersion, getLatestVersion }) {
|
|
35
|
+
try {
|
|
36
|
+
const latestVersion = await getLatestVersion();
|
|
37
|
+
if (latestVersion && latestVersion !== currentVersion) {
|
|
38
|
+
this.emit('newVersion', {
|
|
39
|
+
name,
|
|
40
|
+
latestVersion,
|
|
41
|
+
currentVersion
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
} catch (err) {
|
|
45
|
+
this.logger.warn(`Error checking for new ${name} versions: ${err}`, {
|
|
46
|
+
err
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -19,6 +19,11 @@ export declare class TransactionsNotAvailableError extends ValidatorError {
|
|
|
19
19
|
export declare class FailedToReExecuteTransactionsError extends ValidatorError {
|
|
20
20
|
constructor(txHashes: TxHash[]);
|
|
21
21
|
}
|
|
22
|
+
export declare class ReExInitialStateMismatchError extends ValidatorError {
|
|
23
|
+
readonly expectedArchiveRoot: Fr;
|
|
24
|
+
readonly actualArchiveRoot: Fr;
|
|
25
|
+
constructor(expectedArchiveRoot: Fr, actualArchiveRoot: Fr);
|
|
26
|
+
}
|
|
22
27
|
export declare class ReExStateMismatchError extends ValidatorError {
|
|
23
28
|
readonly expectedArchiveRoot: Fr;
|
|
24
29
|
readonly actualArchiveRoot: Fr;
|
|
@@ -30,4 +35,4 @@ export declare class ReExFailedTxsError extends ValidatorError {
|
|
|
30
35
|
export declare class ReExTimeoutError extends ValidatorError {
|
|
31
36
|
constructor();
|
|
32
37
|
}
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic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AAE,EAAE,EAGtC;CACF;AAED,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,YAAY,YAAY,EAAE,MAAM,EAE/B;CACF;AAED,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,cAEC;CACF"}
|
|
@@ -26,6 +26,13 @@ export class FailedToReExecuteTransactionsError extends ValidatorError {
|
|
|
26
26
|
super(`Failed to re-execute transactions: ${txHashes.join(', ')}`);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
export class ReExInitialStateMismatchError extends ValidatorError {
|
|
30
|
+
expectedArchiveRoot;
|
|
31
|
+
actualArchiveRoot;
|
|
32
|
+
constructor(expectedArchiveRoot, actualArchiveRoot){
|
|
33
|
+
super('Re-execution initial state mismatch'), this.expectedArchiveRoot = expectedArchiveRoot, this.actualArchiveRoot = actualArchiveRoot;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
29
36
|
export class ReExStateMismatchError extends ValidatorError {
|
|
30
37
|
expectedArchiveRoot;
|
|
31
38
|
actualArchiveRoot;
|
|
@@ -22,11 +22,13 @@ export declare function checkCompressedComponentVersion(compressed: string, expe
|
|
|
22
22
|
/** Checks that two component versions match. Undefined fields are ignored. */
|
|
23
23
|
export declare function validatePartialComponentVersionsMatch(expected: Partial<ComponentsVersions>, actual: Partial<ComponentsVersions>): void;
|
|
24
24
|
/** Returns a Koa middleware that injects the versioning info as headers. */
|
|
25
|
-
export declare function getVersioningMiddleware(versions: Partial<ComponentsVersions
|
|
25
|
+
export declare function getVersioningMiddleware(versions: Partial<ComponentsVersions>, opts?: {
|
|
26
|
+
packageVersion?: string;
|
|
27
|
+
}): (ctx: Koa.Context, next: () => Promise<void>) => Promise<void>;
|
|
26
28
|
/** Returns a json rpc client handler that rejects responses with mismatching versions. */
|
|
27
29
|
export declare function getVersioningResponseHandler(versions: Partial<ComponentsVersions>): ({ headers }: {
|
|
28
30
|
headers: {
|
|
29
31
|
get: (header: string) => string | null | undefined;
|
|
30
32
|
};
|
|
31
33
|
}) =>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M,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,qDAAqD;AACrD,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,WAAW,EACnB,uBAAuB,EAAE,MAAM,GAAG,EAAE,EACpC,oBAAoB,EAAE,MAAM,GAAG,EAAE,GAChC,kBAAkB,CAQpB;AAED,qGAAqG;AACrG,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAiB9E;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,YAAY,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAGvD;CACF;AAED,iGAAiG;AACjG,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,QA6B/F;AAED,8EAA8E;AAC9E,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,QAiBpC;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,kEAkBhH;AAED,0FAA0F;AAC1F,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC;;;;oBAajF"}
|
|
@@ -65,7 +65,7 @@ export class ComponentsVersionsError extends Error {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
/** Returns a Koa middleware that injects the versioning info as headers. */ export function getVersioningMiddleware(versions) {
|
|
68
|
+
/** Returns a Koa middleware that injects the versioning info as headers. */ export function getVersioningMiddleware(versions, opts) {
|
|
69
69
|
return async (ctx, next)=>{
|
|
70
70
|
try {
|
|
71
71
|
await next();
|
|
@@ -78,6 +78,9 @@ export class ComponentsVersionsError extends Error {
|
|
|
78
78
|
ctx.set(`x-aztec-${key}`, value.toString());
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
if (opts?.packageVersion) {
|
|
82
|
+
ctx.set('x-aztec-packageVersion', opts.packageVersion);
|
|
83
|
+
}
|
|
81
84
|
}
|
|
82
85
|
};
|
|
83
86
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.c2eed6949",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"./slashing": "./dest/slashing/index.js",
|
|
64
64
|
"./l1-contracts": "./dest/l1-contracts/index.js",
|
|
65
65
|
"./world-state": "./dest/world-state/index.js",
|
|
66
|
-
"./timetable": "./dest/timetable/index.js"
|
|
66
|
+
"./timetable": "./dest/timetable/index.js",
|
|
67
|
+
"./kv-store": "./dest/kv-store/index.js"
|
|
67
68
|
},
|
|
68
69
|
"typedocOptions": {
|
|
69
70
|
"entryPoints": [
|
|
@@ -91,13 +92,13 @@
|
|
|
91
92
|
},
|
|
92
93
|
"dependencies": {
|
|
93
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
94
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
95
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
96
|
-
"@aztec/constants": "0.0.1-commit.
|
|
97
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
98
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
99
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
100
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
95
|
+
"@aztec/bb.js": "0.0.1-commit.c2eed6949",
|
|
96
|
+
"@aztec/blob-lib": "0.0.1-commit.c2eed6949",
|
|
97
|
+
"@aztec/constants": "0.0.1-commit.c2eed6949",
|
|
98
|
+
"@aztec/ethereum": "0.0.1-commit.c2eed6949",
|
|
99
|
+
"@aztec/foundation": "0.0.1-commit.c2eed6949",
|
|
100
|
+
"@aztec/l1-artifacts": "0.0.1-commit.c2eed6949",
|
|
101
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.c2eed6949",
|
|
101
102
|
"@google-cloud/storage": "^7.15.0",
|
|
102
103
|
"axios": "^1.13.5",
|
|
103
104
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/abi.ts
CHANGED
|
@@ -224,7 +224,13 @@ export const FunctionDebugMetadataSchema = z.object({
|
|
|
224
224
|
acir_locations: z.record(z.number()),
|
|
225
225
|
brillig_locations: z.record(z.record(z.number())),
|
|
226
226
|
}),
|
|
227
|
-
files: z.record(
|
|
227
|
+
files: z.record(
|
|
228
|
+
z.object({
|
|
229
|
+
source: z.string(),
|
|
230
|
+
path: z.string(),
|
|
231
|
+
function_locations: z.array(z.object({ start: z.number(), name: z.string() })),
|
|
232
|
+
}),
|
|
233
|
+
),
|
|
228
234
|
}) satisfies z.ZodType<FunctionDebugMetadata>;
|
|
229
235
|
|
|
230
236
|
/** The artifact entry of a function. */
|
|
@@ -305,6 +311,14 @@ export interface ProgramDebugInfo {
|
|
|
305
311
|
debug_infos: Array<DebugInfo>;
|
|
306
312
|
}
|
|
307
313
|
|
|
314
|
+
/** The range a function occupies in a file. */
|
|
315
|
+
export type FunctionLocation = {
|
|
316
|
+
/** The byte where the function starts. */
|
|
317
|
+
start: number;
|
|
318
|
+
/** The name of the function. */
|
|
319
|
+
name: string;
|
|
320
|
+
};
|
|
321
|
+
|
|
308
322
|
/** Maps a file ID to its metadata for debugging purposes. */
|
|
309
323
|
export type DebugFileMap = Record<
|
|
310
324
|
FileId,
|
|
@@ -313,6 +327,8 @@ export type DebugFileMap = Record<
|
|
|
313
327
|
source: string;
|
|
314
328
|
/** The path of the file. */
|
|
315
329
|
path: string;
|
|
330
|
+
/** The range each function occupies in the file. */
|
|
331
|
+
function_locations: FunctionLocation[];
|
|
316
332
|
}
|
|
317
333
|
>;
|
|
318
334
|
|
|
@@ -367,7 +383,14 @@ export const ContractArtifactSchema = zodFor<ContractArtifact>()(
|
|
|
367
383
|
globals: z.record(z.array(AbiValueSchema)),
|
|
368
384
|
}),
|
|
369
385
|
storageLayout: z.record(z.object({ slot: schemas.Fr })),
|
|
370
|
-
fileMap: z.record(
|
|
386
|
+
fileMap: z.record(
|
|
387
|
+
z.coerce.number(),
|
|
388
|
+
z.object({
|
|
389
|
+
source: z.string(),
|
|
390
|
+
path: z.string(),
|
|
391
|
+
function_locations: z.array(z.object({ start: z.number(), name: z.string() })),
|
|
392
|
+
}),
|
|
393
|
+
),
|
|
371
394
|
}),
|
|
372
395
|
);
|
|
373
396
|
|
package/src/abi/buffer.ts
CHANGED
|
@@ -26,11 +26,32 @@ export function bufferAsFields(input: Buffer, targetLength: number): Fr[] {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Recovers a buffer from an array of fields.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* Recovers a buffer from an array of fields previously encoded with bufferAsFields.
|
|
30
|
+
*
|
|
31
|
+
* The first field encodes the byte length of the original buffer. The remaining fields
|
|
32
|
+
* each carry 31 bytes of payload (the leading byte of each 32-byte field element is skipped).
|
|
33
|
+
*
|
|
34
|
+
* If the declared byte length exceeds the bytes available from the payload fields, the result
|
|
35
|
+
* is zero-padded to the full declared length. This is important for correctness when the field
|
|
36
|
+
* array has been truncated (e.g. contract class logs reconstructed from blobs using a short
|
|
37
|
+
* emittedLength): without padding, the resulting buffer would be shorter than declared, causing
|
|
38
|
+
* bytecode commitment computations to diverge from what the circuit produced.
|
|
39
|
+
*
|
|
40
|
+
* @param fields - An output from bufferAsFields: [byteLength, ...payloadFields].
|
|
41
|
+
* @returns A buffer of exactly `byteLength` bytes.
|
|
32
42
|
*/
|
|
33
43
|
export function bufferFromFields(fields: Fr[]): Buffer {
|
|
34
44
|
const [length, ...payload] = fields;
|
|
35
|
-
|
|
45
|
+
const byteLength = length.toNumber();
|
|
46
|
+
const raw = Buffer.concat(payload.map(f => f.toBuffer().subarray(1)));
|
|
47
|
+
if (raw.length >= byteLength) {
|
|
48
|
+
return raw.subarray(0, byteLength);
|
|
49
|
+
}
|
|
50
|
+
// Pad with zeros if the declared length exceeds the available payload bytes.
|
|
51
|
+
// This ensures the returned buffer always matches the declared length, so that
|
|
52
|
+
// downstream bytecode commitment computations are consistent even when the
|
|
53
|
+
// source field array was truncated (e.g. reconstructed from blob with a short emittedLength).
|
|
54
|
+
const result = Buffer.alloc(byteLength);
|
|
55
|
+
raw.copy(result);
|
|
56
|
+
return result;
|
|
36
57
|
}
|
package/src/abi/decoder.ts
CHANGED
|
@@ -2,12 +2,19 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
|
|
3
3
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
4
|
import type { ABIParameter, ABIVariable, AbiType } from './abi.js';
|
|
5
|
-
import { isAztecAddressStruct, parseSignedInt } from './utils.js';
|
|
5
|
+
import { isAztecAddressStruct, isOptionStruct, parseSignedInt } from './utils.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The type of our decoded ABI.
|
|
9
9
|
*/
|
|
10
|
-
export type AbiDecoded =
|
|
10
|
+
export type AbiDecoded =
|
|
11
|
+
| bigint
|
|
12
|
+
| boolean
|
|
13
|
+
| string
|
|
14
|
+
| AztecAddress
|
|
15
|
+
| AbiDecoded[]
|
|
16
|
+
| { [key: string]: AbiDecoded }
|
|
17
|
+
| undefined;
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Decodes values using a provided ABI.
|
|
@@ -51,6 +58,11 @@ class AbiDecoder {
|
|
|
51
58
|
if (isAztecAddressStruct(abiType)) {
|
|
52
59
|
return new AztecAddress(this.getNextField().toBuffer());
|
|
53
60
|
}
|
|
61
|
+
if (isOptionStruct(abiType)) {
|
|
62
|
+
const isSome = this.decodeNext(abiType.fields[0].type);
|
|
63
|
+
const value = this.decodeNext(abiType.fields[1].type);
|
|
64
|
+
return isSome ? value : undefined;
|
|
65
|
+
}
|
|
54
66
|
|
|
55
67
|
for (const field of abiType.fields) {
|
|
56
68
|
struct[field.name] = this.decodeNext(field.type);
|
package/src/abi/encoder.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
|
|
3
3
|
import type { AbiType, FunctionAbi } from './abi.js';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
isAddressStruct,
|
|
6
|
+
isBoundedVecStruct,
|
|
7
|
+
isFunctionSelectorStruct,
|
|
8
|
+
isOptionStruct,
|
|
9
|
+
isWrappedFieldStruct,
|
|
10
|
+
} from './utils.js';
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
13
|
* Encodes arguments for a function call.
|
|
@@ -43,6 +49,32 @@ class ArgumentEncoder {
|
|
|
43
49
|
* @param name - Name.
|
|
44
50
|
*/
|
|
45
51
|
private encodeArgument(abiType: AbiType, arg: any, name?: string) {
|
|
52
|
+
if (isOptionStruct(abiType)) {
|
|
53
|
+
const optionType = abiType as Extract<AbiType, { kind: 'struct' }>;
|
|
54
|
+
const [isSomeField, valueField] = optionType.fields;
|
|
55
|
+
|
|
56
|
+
if (arg === undefined || arg === null) {
|
|
57
|
+
this.encodeArgument(isSomeField.type, false, `${name}._is_some`);
|
|
58
|
+
this.#encodeDefaultValue(valueField.type);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (typeof arg === 'object' && '_is_some' in arg) {
|
|
63
|
+
this.encodeArgument(isSomeField.type, arg._is_some, `${name}._is_some`);
|
|
64
|
+
|
|
65
|
+
if (arg._is_some) {
|
|
66
|
+
this.encodeArgument(valueField.type, arg._value, `${name}._value`);
|
|
67
|
+
} else {
|
|
68
|
+
this.#encodeDefaultValue(valueField.type);
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.encodeArgument(isSomeField.type, true, `${name}._is_some`);
|
|
74
|
+
this.encodeArgument(valueField.type, arg, `${name}._value`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
46
78
|
if (arg === undefined || arg == null) {
|
|
47
79
|
throw new Error(`Undefined argument ${name ?? 'unnamed'} of type ${abiType.kind}`);
|
|
48
80
|
}
|
|
@@ -227,6 +259,14 @@ class ArgumentEncoder {
|
|
|
227
259
|
this.encodeArgument(lenField.type, arg.length, 'len');
|
|
228
260
|
}
|
|
229
261
|
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Appends the flattened zero value for an ABI type.
|
|
265
|
+
* Option::None still serializes the wrapped value, so we need to zero-fill its footprint.
|
|
266
|
+
*/
|
|
267
|
+
#encodeDefaultValue(abiType: AbiType) {
|
|
268
|
+
this.flattened.push(...new Array(ArgumentEncoder.typeSize(abiType)).fill(Fr.ZERO));
|
|
269
|
+
}
|
|
230
270
|
}
|
|
231
271
|
|
|
232
272
|
/**
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { AbiType } from './abi.js';
|
|
2
2
|
import type { EventSelector } from './event_selector.js';
|
|
3
3
|
|
|
4
|
+
/** Metadata for a contract event, used to decode emitted event logs back into structured data. */
|
|
4
5
|
export type EventMetadataDefinition = {
|
|
5
6
|
eventSelector: EventSelector;
|
|
6
7
|
abiType: AbiType;
|
|
8
|
+
/** Names of the event's struct members (not serialized Noir Field elements). */
|
|
7
9
|
fieldNames: string[];
|
|
8
10
|
};
|
package/src/abi/utils.ts
CHANGED
|
@@ -81,6 +81,31 @@ export function isBoundedVecStruct(abiType: AbiType) {
|
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Returns whether the ABI type is Noir's std::option::Option lowered to a struct.
|
|
86
|
+
* @param abiType - Type to check.
|
|
87
|
+
* @returns A boolean indicating whether the ABI type is an Option struct.
|
|
88
|
+
*/
|
|
89
|
+
export function isOptionStruct(abiType: AbiType) {
|
|
90
|
+
return (
|
|
91
|
+
abiType.kind === 'struct' &&
|
|
92
|
+
abiType.path === 'std::option::Option' &&
|
|
93
|
+
abiType.fields.length === 2 &&
|
|
94
|
+
abiType.fields[0].name === '_is_some' &&
|
|
95
|
+
abiType.fields[1].name === '_value'
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Returns whether `null` or `undefined` can be mapped to a valid ABI value for this type.
|
|
101
|
+
*
|
|
102
|
+
* @param abiType - Type to check.
|
|
103
|
+
* @returns A boolean indicating whether nullish values are valid shorthand for this ABI type.
|
|
104
|
+
*/
|
|
105
|
+
export function canBeMappedFromNullOrUndefined(abiType: AbiType) {
|
|
106
|
+
return isOptionStruct(abiType);
|
|
107
|
+
}
|
|
108
|
+
|
|
84
109
|
/**
|
|
85
110
|
* Returns a bigint by parsing a serialized 2's complement signed int.
|
|
86
111
|
* @param b - The signed int as a buffer
|
package/src/block/l2_block.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type BlockBlobData, encodeBlockBlobData } from '@aztec/blob-lib/encoding';
|
|
2
|
+
import { DA_GAS_PER_FIELD } from '@aztec/constants';
|
|
2
3
|
import {
|
|
3
4
|
BlockNumber,
|
|
4
5
|
CheckpointNumber,
|
|
@@ -175,7 +176,7 @@ export class L2Block {
|
|
|
175
176
|
} & Partial<Parameters<typeof BlockHeader.random>[0]> = {},
|
|
176
177
|
): Promise<L2Block> {
|
|
177
178
|
const archive = new AppendOnlyTreeSnapshot(Fr.random(), blockNumber + 1);
|
|
178
|
-
const header = BlockHeader.random({
|
|
179
|
+
const header = BlockHeader.random({ ...blockHeaderOverrides, blockNumber });
|
|
179
180
|
const body = await Body.random({ txsPerBlock, makeTxOptions, ...txOptions });
|
|
180
181
|
return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
|
|
181
182
|
}
|
|
@@ -221,4 +222,15 @@ export class L2Block {
|
|
|
221
222
|
timestamp: this.header.globalVariables.timestamp,
|
|
222
223
|
};
|
|
223
224
|
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Compute how much DA gas this block uses.
|
|
228
|
+
*
|
|
229
|
+
* @remarks This assumes DA gas is computed solely based on the number of blob fields in transactions.
|
|
230
|
+
* This may change in the future, but we cannot access the actual DA gas used in a block since it's not exposed
|
|
231
|
+
* in the L2BlockHeader, so we have to rely on recomputing it.
|
|
232
|
+
*/
|
|
233
|
+
computeDAGasUsed(): number {
|
|
234
|
+
return this.body.txEffects.reduce((total, txEffect) => total + txEffect.getNumBlobFields(), 0) * DA_GAS_PER_FIELD;
|
|
235
|
+
}
|
|
224
236
|
}
|
|
@@ -49,6 +49,12 @@ export interface L2BlockSource {
|
|
|
49
49
|
*/
|
|
50
50
|
getBlockNumber(): Promise<BlockNumber>;
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Gets the number of the latest L2 checkpoint processed by the block source implementation.
|
|
54
|
+
* @returns The number of the latest L2 checkpoint processed by the block source implementation.
|
|
55
|
+
*/
|
|
56
|
+
getCheckpointNumber(): Promise<CheckpointNumber>;
|
|
57
|
+
|
|
52
58
|
/**
|
|
53
59
|
* Gets the number of the latest L2 block proven seen by the block source implementation.
|
|
54
60
|
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
@@ -62,9 +68,8 @@ export interface L2BlockSource {
|
|
|
62
68
|
getCheckpointedL2BlockNumber(): Promise<BlockNumber>;
|
|
63
69
|
|
|
64
70
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* TODO(#13569): Compute proper finalized block number based on L1 finalized block.
|
|
71
|
+
* Returns the finalized L2 block number. A block is finalized when it was proven
|
|
72
|
+
* in an L1 block that has itself been finalized on Ethereum.
|
|
68
73
|
* @returns The finalized block number.
|
|
69
74
|
*/
|
|
70
75
|
getFinalizedL2BlockNumber(): Promise<BlockNumber>;
|
|
@@ -170,14 +175,18 @@ export interface L2BlockSource {
|
|
|
170
175
|
getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
|
|
171
176
|
|
|
172
177
|
/**
|
|
173
|
-
* Returns the
|
|
178
|
+
* Returns the last L2 slot number for which we have all L1 data needed to build the next checkpoint.
|
|
179
|
+
* Determined by the max of two signals: L1 block sync progress and latest synced checkpoint slot.
|
|
180
|
+
* The checkpoint signal handles missed L1 blocks, since a published checkpoint seals the message tree
|
|
181
|
+
* for the next checkpoint via the inbox LAG mechanism.
|
|
174
182
|
*/
|
|
175
|
-
|
|
183
|
+
getSyncedL2SlotNumber(): Promise<SlotNumber | undefined>;
|
|
176
184
|
|
|
177
185
|
/**
|
|
178
|
-
* Returns the
|
|
186
|
+
* Returns the last L2 epoch number that has been fully synchronized from L1.
|
|
187
|
+
* An epoch is fully synced when all its L2 slots have been fully synced.
|
|
179
188
|
*/
|
|
180
|
-
|
|
189
|
+
getSyncedL2EpochNumber(): Promise<EpochNumber | undefined>;
|
|
181
190
|
|
|
182
191
|
/**
|
|
183
192
|
* Returns all checkpointed block headers for a given epoch.
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
IndexWithinCheckpoint,
|
|
7
7
|
SlotNumber,
|
|
8
8
|
} from '@aztec/foundation/branded-types';
|
|
9
|
-
import { sum } from '@aztec/foundation/collection';
|
|
9
|
+
import { pick, sum } from '@aztec/foundation/collection';
|
|
10
10
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
11
11
|
import { BufferReader, serializeSignedBigInt, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
12
12
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
@@ -152,10 +152,12 @@ export class Checkpoint {
|
|
|
152
152
|
startBlockNumber?: number;
|
|
153
153
|
previousArchive?: AppendOnlyTreeSnapshot;
|
|
154
154
|
feeAssetPriceModifier?: bigint;
|
|
155
|
+
archive?: AppendOnlyTreeSnapshot;
|
|
155
156
|
} & Partial<Parameters<typeof CheckpointHeader.random>[0]> &
|
|
156
157
|
Partial<Parameters<typeof L2Block.random>[1]> = {},
|
|
157
158
|
) {
|
|
158
|
-
const
|
|
159
|
+
const headerOptions = previousArchive ? { lastArchiveRoot: previousArchive.root, ...options } : options;
|
|
160
|
+
const header = CheckpointHeader.random(headerOptions);
|
|
159
161
|
|
|
160
162
|
// Create blocks sequentially to chain archive roots properly.
|
|
161
163
|
// Each block's header.lastArchive must equal the previous block's archive.
|
|
@@ -166,11 +168,18 @@ export class Checkpoint {
|
|
|
166
168
|
indexWithinCheckpoint: IndexWithinCheckpoint(i),
|
|
167
169
|
...options,
|
|
168
170
|
...(lastArchive ? { lastArchive } : {}),
|
|
171
|
+
...pick(header, 'slotNumber', 'timestamp', 'coinbase', 'feeRecipient', 'gasFees'),
|
|
169
172
|
});
|
|
170
173
|
lastArchive = block.archive;
|
|
171
174
|
blocks.push(block);
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
return new Checkpoint(
|
|
177
|
+
return new Checkpoint(
|
|
178
|
+
options.archive ?? AppendOnlyTreeSnapshot.random(),
|
|
179
|
+
header,
|
|
180
|
+
blocks,
|
|
181
|
+
checkpointNumber,
|
|
182
|
+
feeAssetPriceModifier,
|
|
183
|
+
);
|
|
175
184
|
}
|
|
176
185
|
}
|
package/src/checkpoint/index.ts
CHANGED