From f2bee2744d7d219e11da8bf24b40e8b72e50be7c Mon Sep 17 00:00:00 2001 From: LHerskind <16536249+LHerskind@users.noreply.github.com> Date: Wed, 17 Sep 2025 09:14:31 +0000 Subject: [PATCH] chore: ignition parameters --- .../cli/src/config/chain_l2_config.ts | 55 +++++++- .../end-to-end/src/e2e_fees/fees_test.ts | 5 +- yarn-project/ethereum/src/config.ts | 122 +++++++----------- yarn-project/ethereum/src/contracts/rollup.ts | 4 + .../ethereum/src/deploy_l1_contracts.ts | 2 +- 5 files changed, 101 insertions(+), 87 deletions(-) diff --git a/yarn-project/cli/src/config/chain_l2_config.ts b/yarn-project/cli/src/config/chain_l2_config.ts index 5c58d46ff9d1..c1ef7254f070 100644 --- a/yarn-project/cli/src/config/chain_l2_config.ts +++ b/yarn-project/cli/src/config/chain_l2_config.ts @@ -72,7 +72,7 @@ const DefaultSlashConfig = { export const stagingIgnitionL2ChainConfig: L2ChainConfig = { l1ChainId: 11155111, - testAccounts: true, + testAccounts: false, sponsoredFPC: false, p2pEnabled: true, p2pBootstrapNodes: [], @@ -90,23 +90,64 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = { publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics', publicMetricsCollectFrom: ['sequencer'], - ...DefaultL1ContractsConfig, - ...DefaultSlashConfig, - /** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12, /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ - aztecSlotDuration: 36, + aztecSlotDuration: 72, /** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32, /** The target validator committee size. */ - aztecTargetCommitteeSize: 48, + aztecTargetCommitteeSize: 24, + /** The number of epochs to lag behind the current epoch for validator selection. */ + lagInEpochs: 2, /** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1, + /** How many sequencers must agree with a slash for it to be executed. */ + slashingQuorum: 65, + + slashingRoundSizeInEpochs: 4, + slashingLifetimeInRounds: 40, + slashingExecutionDelayInRounds: 28, + slashAmountSmall: 2_000n * 10n ** 18n, + slashAmountMedium: 10_000n * 10n ** 18n, + slashAmountLarge: 50_000n * 10n ** 18n, + slashingOffsetInRounds: 2, + slasherFlavor: 'tally', + slashingVetoer: EthAddress.ZERO, // TODO TMNT-329 + /** The mana target for the rollup */ manaTarget: 0n, + + exitDelaySeconds: 5 * 24 * 60 * 60, + /** The proving cost per mana */ provingCostPerMana: 0n, + localEjectionThreshold: 196_000n * 10n ** 18n, + + ejectionThreshold: 100_000n * 10n ** 18n, + activationThreshold: 200_000n * 10n ** 18n, + + governanceProposerRoundSize: 300, // TODO TMNT-322 + governanceProposerQuorum: 151, // TODO TMNT-322 + + // Node slashing config + // TODO TMNT-330 + slashMinPenaltyPercentage: 0.5, + slashMaxPenaltyPercentage: 2.0, + slashInactivityTargetPercentage: 0.7, + slashInactivityConsecutiveEpochThreshold: 2, + slashInactivityPenalty: 2_000n * 10n ** 18n, + slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now + slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now + slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n, + slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n, + slashUnknownPenalty: 2_000n * 10n ** 18n, + slashBroadcastedInvalidBlockPenalty: 10_000n * 10n ** 18n, + slashMaxPayloadSize: 50, + slashGracePeriodL2Slots: 32 * 4, // One round from genesis + slashOffenseExpirationRounds: 8, + sentinelEnabled: true, + slashingDisableDuration: 5 * 24 * 60 * 60, }; export const stagingPublicL2ChainConfig: L2ChainConfig = { @@ -213,6 +254,8 @@ export const testnetL2ChainConfig: L2ChainConfig = { exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds, ...DefaultSlashConfig, + slashPrunePenalty: 0n, + slashDataWithholdingPenalty: 0n, }; const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour; diff --git a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts index 98e6219eb309..94016689b7fa 100644 --- a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts @@ -136,13 +136,14 @@ export class FeesTest { async getBlockRewards() { const blockReward = await this.rollupContract.getBlockReward(); + const rewardConfig = await this.rollupContract.getRewardConfig(); const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance( - this.context.deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress, + EthAddress.fromString(rewardConfig.rewardDistributor), ); const toDistribute = balance > blockReward ? blockReward : balance; - const sequencerBlockRewards = toDistribute / 2n; + const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n; const proverBlockRewards = toDistribute - sequencerBlockRewards; return { sequencerBlockRewards, proverBlockRewards }; diff --git a/yarn-project/ethereum/src/config.ts b/yarn-project/ethereum/src/config.ts index 1c1f11cf660a..494cddeaa53f 100644 --- a/yarn-project/ethereum/src/config.ts +++ b/yarn-project/ethereum/src/config.ts @@ -79,12 +79,12 @@ export const DefaultL1ContractsConfig = { aztecTargetCommitteeSize: 48, lagInEpochs: 2, aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends - activationThreshold: BigInt(100e18), - ejectionThreshold: BigInt(50e18), - localEjectionThreshold: BigInt(98e18), - slashAmountSmall: BigInt(10e18), - slashAmountMedium: BigInt(20e18), - slashAmountLarge: BigInt(50e18), + activationThreshold: 100n * 10n ** 18n, + ejectionThreshold: 50n * 10n ** 18n, + localEjectionThreshold: 98n * 10n ** 18n, + slashAmountSmall: 10n * 10n ** 18n, + slashAmountMedium: 20n * 10n ** 18n, + slashAmountLarge: 50n * 10n ** 18n, slashingRoundSizeInEpochs: 4, slashingLifetimeInRounds: 5, slashingExecutionDelayInRounds: 0, // round N may be submitted in round N + 1 @@ -128,31 +128,32 @@ const StagingPublicGovernanceConfiguration = { const TestnetGovernanceConfiguration = { proposeConfig: { - lockDelay: 60n * 60n * 24n, - lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n, + lockDelay: 10n * 365n * 24n * 60n * 60n, + lockAmount: 1250n * 200_000n * 10n ** 18n, }, - votingDelay: 60n, - votingDuration: 60n * 60n, - executionDelay: 60n * 60n * 24n, - gracePeriod: 60n * 60n * 24n * 7n, - quorum: 3n * 10n ** 17n, // 30% - requiredYeaMargin: 4n * 10n ** 16n, // 4% - minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n, + + votingDelay: 12n * 60n * 60n, // 12 hours + votingDuration: 1n * 24n * 60n * 60n, // 1 day + executionDelay: 12n * 60n * 60n, // 12 hours + gracePeriod: 1n * 24n * 60n * 60n, // 1 day + quorum: 2n * 10n ** 17n, // 20% + requiredYeaMargin: 1n * 10n ** 17n, // 10% + minimumVotes: 1250n * 200_000n * 10n ** 18n, }; const StagingIgnitionGovernanceConfiguration = { proposeConfig: { - lockDelay: 60n * 60n * 24n * 30n, // 30 days - lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n, + lockDelay: 10n * 365n * 24n * 60n * 60n, + lockAmount: 1250n * 200_000n * 10n ** 18n, }, - votingDelay: 60n, - votingDuration: 60n * 60n, - executionDelay: 60n, - gracePeriod: 60n * 60n * 24n * 7n, - quorum: 3n * 10n ** 17n, // 30% - requiredYeaMargin: 4n * 10n ** 16n, // 4% - minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n, // >= 200 validators must vote + votingDelay: 7n * 24n * 60n * 60n, + votingDuration: 7n * 24n * 60n * 60n, + executionDelay: 30n * 24n * 60n * 60n, + gracePeriod: 7n * 24n * 60n * 60n, + quorum: 2n * 10n ** 17n, // 20% + requiredYeaMargin: 1n * 10n ** 17n, // 10% + minimumVotes: 1250n * 200_000n * 10n ** 18n, }; export const getGovernanceConfiguration = (networkName: NetworkNames) => { @@ -175,10 +176,10 @@ export const getGovernanceConfiguration = (networkName: NetworkNames) => { // for it seems overkill const DefaultRewardConfig = { - sequencerBps: 5000, + sequencerBps: 8000, rewardDistributor: EthAddress.ZERO.toString(), booster: EthAddress.ZERO.toString(), - blockReward: BigInt(50e18), + blockReward: 500n * 10n ** 18n, }; export const getRewardConfig = (networkName: NetworkNames) => { @@ -193,51 +194,16 @@ export const getRewardConfig = (networkName: NetworkNames) => { } }; -const LocalRewardBoostConfig = { - increment: 200000, - maxScore: 5000000, - a: 5000, - k: 1000000, - minimum: 100000, -}; - -const StagingPublicRewardBoostConfig = { - increment: 200000, - maxScore: 5000000, - a: 5000, - k: 1000000, - minimum: 100000, -}; - -const TestnetRewardBoostConfig = { - increment: 125000, - maxScore: 15000000, - a: 1000, - k: 1000000, - minimum: 100000, -}; - -const StagingIgnitionRewardBoostConfig = { - increment: 200000, - maxScore: 5000000, - a: 5000, - k: 1000000, - minimum: 100000, -}; - -export const getRewardBoostConfig = (networkName: NetworkNames) => { - switch (networkName) { - case 'local': - return LocalRewardBoostConfig; - case 'staging-public': - return StagingPublicRewardBoostConfig; - case 'testnet': - return TestnetRewardBoostConfig; - case 'staging-ignition': - return StagingIgnitionRewardBoostConfig; - default: - throw new Error(`Unrecognized network name: ${networkName}`); - } +export const getRewardBoostConfig = () => { + // The reward configuration is specified with a precision of 1e5, and we use the same across + // all networks. + return { + increment: 125000, // 1.25 + maxScore: 15000000, // 150 + a: 1000, // 0.01 + k: 1000000, // 10 + minimum: 100000, // 1 + }; }; // Similar to the above, no need for environment variables for this. @@ -259,18 +225,18 @@ const StagingPublicEntryQueueConfig = { const TestnetEntryQueueConfig = { bootstrapValidatorSetSize: 750n, - bootstrapFlushSize: 48n, // will effectively be bounded by maxQueueFlushSize - normalFlushSizeMin: 1n, + bootstrapFlushSize: 32n, + normalFlushSizeMin: 32n, normalFlushSizeQuotient: 2475n, - maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas. + maxQueueFlushSize: 32n, }; const StagingIgnitionEntryQueueConfig = { - bootstrapValidatorSetSize: 750n, - bootstrapFlushSize: 48n, // will effectively be bounded by maxQueueFlushSize + bootstrapValidatorSetSize: 1250n, + bootstrapFlushSize: 8n, normalFlushSizeMin: 1n, - normalFlushSizeQuotient: 2475n, - maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas. + normalFlushSizeQuotient: 2048n, + maxQueueFlushSize: 8n, }; export const getEntryQueueConfig = (networkName: NetworkNames) => { diff --git a/yarn-project/ethereum/src/contracts/rollup.ts b/yarn-project/ethereum/src/contracts/rollup.ts index 8be3e3423487..92d43b4c3a89 100644 --- a/yarn-project/ethereum/src/contracts/rollup.ts +++ b/yarn-project/ethereum/src/contracts/rollup.ts @@ -713,6 +713,10 @@ export class RollupContract { return this.rollup.read.getStakingAsset(); } + getRewardConfig() { + return this.rollup.read.getRewardConfig(); + } + setupEpoch(l1TxUtils: L1TxUtils) { return l1TxUtils.sendAndMonitorTransaction({ to: this.address, diff --git a/yarn-project/ethereum/src/deploy_l1_contracts.ts b/yarn-project/ethereum/src/deploy_l1_contracts.ts index 825ac7ad88cb..40c6d0721bb6 100644 --- a/yarn-project/ethereum/src/deploy_l1_contracts.ts +++ b/yarn-project/ethereum/src/deploy_l1_contracts.ts @@ -551,7 +551,7 @@ export const deployRollup = async ( provingCostPerMana: args.provingCostPerMana, rewardConfig: rewardConfig, version: 0, - rewardBoostConfig: getRewardBoostConfig(networkName), + rewardBoostConfig: getRewardBoostConfig(), stakingQueueConfig: getEntryQueueConfig(networkName), exitDelaySeconds: BigInt(args.exitDelaySeconds), slasherFlavor: slasherFlavorToSolidityEnum(args.slasherFlavor),