Skip to content

Commit b89c48b

Browse files
authored
chore: Accumulated backports to v5-next (#24750)
BEGIN_COMMIT_OVERRIDE fix(docs-examples): pin typescript to 5.x in execute runner (#24736) chore(spartan): restore 7 day mainnet slash grace period (#24804) chore(spartan): restore 7 day mainnet slash grace period (backport #24804) (#24808) feat: allow custom proof submission target address (#24270) END_COMMIT_OVERRIDE
2 parents 2ec0175 + f803ed2 commit b89c48b

10 files changed

Lines changed: 122 additions & 8 deletions

File tree

docs/docs-developers/docs/tutorials/js_tutorials/aztecjs-getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ yarn init -y
2424
Next, add the TypeScript dependencies:
2525

2626
```sh
27-
yarn add typescript @types/node tsx
27+
yarn add "typescript@^5.3.3" @types/node tsx
2828
```
2929

3030
:::tip

docs/docs-operate/operators/sequencer-management/slashing-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Round N: Proposers vote on offenses from Round N-2
4545
- **Round Size**: 128 L2 slots (approximately 2.6 hours at 72 seconds per slot)
4646
- **Slashing Offset**: 2 rounds (proposers in round N vote on offenses from round N-2)
4747
- **Execution Delay**: 2 rounds on the v5 testnet (~5 hours; mainnet uses 28 rounds, ~3 days)
48-
- **Grace Period**: First 64 slots after the rollup becomes canonical on the v5 testnet (~1.3 hours; mainnet uses 1,200 slots, ~1 day); configurable per node via `SLASH_GRACE_PERIOD_L2_SLOTS`
48+
- **Grace Period**: First 64 slots after the rollup becomes canonical on the v5 testnet (~1.3 hours; mainnet uses 8,400 slots, ~7 days); configurable per node via `SLASH_GRACE_PERIOD_L2_SLOTS`
4949

5050
### Slashing Amounts
5151

docs/examples/ts/aztecjs_runner/run.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ setup_project() {
115115
[ ${#NPM_DEPS[@]} -gt 0 ] && yarn_add_with_retry "${NPM_DEPS[@]}"
116116
fi
117117

118-
yarn_add_with_retry -D typescript@^5.3.3 tsx
118+
# Pin typescript to the 5.x line used across the monorepo. An unpinned
119+
# `yarn add typescript` now resolves to the 7.x native port, whose package
120+
# layout has no lib/_tsc.js, so yarn 4's builtin compat patch fails to apply.
121+
yarn_add_with_retry -D "typescript@^5.3.3" tsx
119122

120123
# Copy tsconfig
121124
cp "$EXAMPLES_DIR/tsconfig.template.json" tsconfig.json

spartan/environments/network-defaults.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ networks:
358358
ENABLE_AUTO_SHUTDOWN: false
359359
# Slasher penalties - more lenient initially
360360
SLASH_DATA_WITHHOLDING_PENALTY: 0
361-
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.8
361+
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.7
362362
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 2
363363
SLASH_INACTIVITY_PENALTY: 2000e18
364364
SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 2000e18
@@ -369,4 +369,4 @@ networks:
369369
SLASH_UNKNOWN_PENALTY: 2000e18
370370
SLASH_INVALID_BLOCK_PENALTY: 2000e18
371371
SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 2000e18 # AZIP-16: activated at SMALL
372-
SLASH_GRACE_PERIOD_L2_SLOTS: 1200
372+
SLASH_GRACE_PERIOD_L2_SLOTS: 8400 # 7 days at a 72s slot

yarn-project/foundation/src/config/env_var.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export type EnvVar =
191191
| 'PROVER_FAILED_PROOF_STORE'
192192
| 'PROVER_NODE_FAILED_EPOCH_STORE'
193193
| 'PROVER_NODE_DISABLE_PROOF_PUBLISH'
194+
| 'PROVER_NODE_PROOF_SUBMISSION_TARGET_ADDRESS'
194195
| 'PROVER_ID'
195196
| 'PROVER_NODE_POLLING_INTERVAL_MS'
196197
| 'PROVER_NODE_MAX_PENDING_JOBS'

yarn-project/prover-node/src/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
numberConfigHelper,
77
pickConfigMappings,
88
} from '@aztec/foundation/config';
9+
import { EthAddress } from '@aztec/foundation/eth-address';
910
import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore/config';
1011
import { ethPrivateKeySchema } from '@aztec/node-keystore/schemas';
1112
import type { KeyStore } from '@aztec/node-keystore/types';
@@ -44,6 +45,7 @@ export type SpecificProverNodeConfig = {
4445
txGatheringIntervalMs: number;
4546
txGatheringBatchSize: number;
4647
txGatheringMaxParallelRequestsPerNode: number;
48+
proofSubmissionTargetAddress?: EthAddress;
4749
};
4850

4951
export const specificProverNodeConfigMappings: ConfigMappingsType<SpecificProverNodeConfig> = {
@@ -97,6 +99,14 @@ export const specificProverNodeConfigMappings: ConfigMappingsType<SpecificProver
9799
description: 'Whether the prover node skips publishing proofs to L1',
98100
...booleanConfigHelper(false),
99101
},
102+
proofSubmissionTargetAddress: {
103+
env: 'PROVER_NODE_PROOF_SUBMISSION_TARGET_ADDRESS',
104+
description:
105+
'Optional L1 address the submitEpochRootProof tx is sent to. Must expose the identical submitEpochRootProof ABI ' +
106+
'and forward to the rollup. Defaults to the rollup address.',
107+
parseEnv: (val: string) => EthAddress.fromString(val),
108+
defaultValue: undefined,
109+
},
100110
};
101111

102112
export const proverNodeConfigMappings: ConfigMappingsType<ProverNodeConfig> = {

yarn-project/prover-node/src/factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export async function createProverNode(
135135
deps.publisherFactory ??
136136
new ProverPublisherFactory(config, {
137137
rollupContract,
138+
proofSubmissionTarget: config.proofSubmissionTargetAddress,
138139
publisherManager: new PublisherManager(l1TxUtils, getPublisherConfigFromProverConfig(config), {
139140
bindings: log.getBindings(),
140141
funder: funderL1TxUtils,

yarn-project/prover-node/src/prover-node-publisher.test.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,68 @@ describe('prover-node-publisher', () => {
4747
publisher = new ProverNodePublisher(config, { rollupContract: rollup, l1TxUtils: l1Utils });
4848
});
4949

50+
const setupPublishData = (pending: number, proven: number, fromCheckpoint: number, toCheckpoint: number) => {
51+
// Create public inputs for every checkpoint
52+
const checkpoints = Array.from({ length: 100 }, () => {
53+
return RootRollupPublicInputs.random();
54+
});
55+
56+
// Return the tips specified by the test
57+
rollup.getTips.mockResolvedValue({
58+
pending: CheckpointNumber(pending),
59+
proven: CheckpointNumber(proven),
60+
});
61+
62+
// Return the requested checkpoint
63+
rollup.getCheckpoint.mockImplementation((checkpointNumber: CheckpointNumber) =>
64+
Promise.resolve({
65+
archive: checkpoints[checkpointNumber - 1].endArchiveRoot,
66+
attestationsHash: Buffer32.ZERO, // unused,
67+
payloadDigest: Buffer32.ZERO, // unused,
68+
headerHash: Buffer32.ZERO, // unused,
69+
blobCommitmentsHash: Buffer32.ZERO, // unused,
70+
outHash: '0x', // unused,
71+
slotNumber: SlotNumber(0), // unused,
72+
feeHeader: {
73+
excessMana: 0n, // unused
74+
manaUsed: 0n, // unused
75+
ethPerFeeAsset: 0n, // unused
76+
congestionCost: 0n, // unused
77+
proverCost: 0n, // unused
78+
},
79+
}),
80+
);
81+
82+
// We have built a rollup proof of the range fromCheckpoint - toCheckpoint
83+
// so we need to set our archives and hashes accordingly
84+
const ourPublicInputs = RootRollupPublicInputs.random();
85+
ourPublicInputs.previousArchiveRoot = checkpoints[fromCheckpoint - 2]?.endArchiveRoot ?? Fr.ZERO;
86+
ourPublicInputs.endArchiveRoot = checkpoints[toCheckpoint - 1]?.endArchiveRoot ?? Fr.ZERO;
87+
88+
const ourBatchedBlob = new BatchedBlob(
89+
ourPublicInputs.blobPublicInputs.blobCommitmentsHash,
90+
ourPublicInputs.blobPublicInputs.z,
91+
ourPublicInputs.blobPublicInputs.y,
92+
ourPublicInputs.blobPublicInputs.c,
93+
ourPublicInputs.blobPublicInputs.c.negate(), // Fill with dummy value
94+
);
95+
96+
// Return our public inputs
97+
const totalFields = ourPublicInputs.toFields();
98+
rollup.getEpochProofPublicInputs.mockResolvedValue(totalFields);
99+
100+
return {
101+
epochNumber: EpochNumber(2),
102+
fromCheckpoint: CheckpointNumber(fromCheckpoint),
103+
toCheckpoint: CheckpointNumber(toCheckpoint),
104+
publicInputs: ourPublicInputs,
105+
headers: makeHeadersForRange(fromCheckpoint, toCheckpoint),
106+
proof: Proof.empty(),
107+
batchedBlobInputs: ourBatchedBlob,
108+
attestations: [],
109+
};
110+
};
111+
50112
const testCases = [
51113
// Usual case of proving full epoch
52114
{ pending: 65, proven: 32, fromCheckpoint: 33, toCheckpoint: 64, expectedPublish: true, message: '' },
@@ -336,4 +398,34 @@ describe('prover-node-publisher', () => {
336398

337399
expect(result).toBe(false);
338400
});
401+
402+
describe('proof submission target', () => {
403+
it('defaults the submit tx target to the rollup address', async () => {
404+
const rollupAddress = EthAddress.random().toString();
405+
(rollup as any).address = rollupAddress;
406+
publisher = new ProverNodePublisher(config, { rollupContract: rollup, l1TxUtils: l1Utils });
407+
408+
await publisher.submitEpochProof(setupPublishData(65, 32, 33, 64));
409+
expect(l1Utils.sendAndMonitorTransaction).toHaveBeenCalledWith(
410+
expect.objectContaining({ to: rollupAddress }),
411+
expect.anything(),
412+
);
413+
});
414+
415+
it('redirects the submit tx to the configured proof submission target', async () => {
416+
(rollup as any).address = EthAddress.random().toString();
417+
const target = EthAddress.random();
418+
publisher = new ProverNodePublisher(config, {
419+
rollupContract: rollup,
420+
l1TxUtils: l1Utils,
421+
proofSubmissionTarget: target,
422+
});
423+
424+
await publisher.submitEpochProof(setupPublishData(65, 32, 33, 64));
425+
expect(l1Utils.sendAndMonitorTransaction).toHaveBeenCalledWith(
426+
expect.objectContaining({ to: target.toString() }),
427+
expect.anything(),
428+
);
429+
});
430+
});
339431
});

yarn-project/prover-node/src/prover-node-publisher.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ export class ProverNodePublisher {
4040

4141
protected rollupContract: RollupContract;
4242

43+
protected proofSubmissionTarget: Hex;
44+
4345
public readonly l1TxUtils: L1TxUtils;
4446

4547
constructor(
4648
config: TxSenderConfig & PublisherConfig,
4749
deps: {
4850
rollupContract: RollupContract;
4951
l1TxUtils: L1TxUtils;
52+
proofSubmissionTarget?: EthAddress;
5053
telemetry?: TelemetryClient;
5154
},
5255
bindings?: LoggerBindings,
@@ -57,6 +60,7 @@ export class ProverNodePublisher {
5760
this.log = createLogger('prover-node:l1-tx-publisher', bindings);
5861

5962
this.rollupContract = deps.rollupContract;
63+
this.proofSubmissionTarget = deps.proofSubmissionTarget?.toString() ?? deps.rollupContract.address;
6064
this.l1TxUtils = deps.l1TxUtils;
6165
}
6266

@@ -217,7 +221,7 @@ export class ProverNodePublisher {
217221
const senderAddress = this.l1TxUtils.getSenderAddress();
218222

219223
const [gasLimit, gasPrice, latestBlock] = await Promise.all([
220-
this.l1TxUtils.estimateGas(senderAddress.toString() as `0x${string}`, { to: this.rollupContract.address, data }),
224+
this.l1TxUtils.estimateGas(senderAddress.toString() as `0x${string}`, { to: this.proofSubmissionTarget, data }),
221225
this.l1TxUtils.getGasPrice(),
222226
this.l1TxUtils.client.getBlock({ blockTag: 'latest' }),
223227
]);
@@ -288,7 +292,7 @@ export class ProverNodePublisher {
288292
});
289293
try {
290294
const { receipt } = await this.l1TxUtils.sendAndMonitorTransaction(
291-
{ to: this.rollupContract.address, data },
295+
{ to: this.proofSubmissionTarget, data },
292296
{ txTimeoutAt: args.deadline },
293297
);
294298
if (receipt.status !== 'success') {
@@ -298,7 +302,7 @@ export class ProverNodePublisher {
298302
args: [...txArgs],
299303
functionName: 'submitEpochRootProof',
300304
abi: RollupAbi,
301-
address: this.rollupContract.address,
305+
address: this.proofSubmissionTarget,
302306
},
303307
/*blobInputs*/ undefined,
304308
/*stateOverride*/ [],

yarn-project/prover-node/src/prover-publisher-factory.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { RollupContract } from '@aztec/ethereum/contracts';
22
import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
33
import type { PublisherManager } from '@aztec/ethereum/publisher-manager';
4+
import type { EthAddress } from '@aztec/foundation/eth-address';
45
import type { LoggerBindings } from '@aztec/foundation/log';
56
import type { ProverPublisherConfig, ProverTxSenderConfig } from '@aztec/sequencer-client';
67
import type { TelemetryClient } from '@aztec/telemetry-client';
@@ -13,6 +14,7 @@ export class ProverPublisherFactory {
1314
private deps: {
1415
rollupContract: RollupContract;
1516
publisherManager: PublisherManager<L1TxUtils>;
17+
proofSubmissionTarget?: EthAddress;
1618
telemetry?: TelemetryClient;
1719
},
1820
private bindings?: LoggerBindings,
@@ -37,6 +39,7 @@ export class ProverPublisherFactory {
3739
{
3840
rollupContract: this.deps.rollupContract,
3941
l1TxUtils: l1Publisher,
42+
proofSubmissionTarget: this.deps.proofSubmissionTarget,
4043
telemetry: this.deps.telemetry,
4144
},
4245
this.bindings,

0 commit comments

Comments
 (0)