Skip to content

Commit 3bf6083

Browse files
authored
chore: set config params for staging-ignition and testnet (#16976)
See https://linear.app/aztec-labs/issue/TMNT-258/configuration
2 parents cea8238 + f2bee27 commit 3bf6083

File tree

5 files changed

+101
-87
lines changed

5 files changed

+101
-87
lines changed

yarn-project/cli/src/config/chain_l2_config.ts

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const DefaultSlashConfig = {
7272

7373
export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
7474
l1ChainId: 11155111,
75-
testAccounts: true,
75+
testAccounts: false,
7676
sponsoredFPC: false,
7777
p2pEnabled: true,
7878
p2pBootstrapNodes: [],
@@ -90,23 +90,64 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
9090
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
9191
publicMetricsCollectFrom: ['sequencer'],
9292

93-
...DefaultL1ContractsConfig,
94-
...DefaultSlashConfig,
95-
9693
/** How many seconds an L1 slot lasts. */
9794
ethereumSlotDuration: 12,
9895
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
99-
aztecSlotDuration: 36,
96+
aztecSlotDuration: 72,
10097
/** How many L2 slots an epoch lasts. */
10198
aztecEpochDuration: 32,
10299
/** The target validator committee size. */
103-
aztecTargetCommitteeSize: 48,
100+
aztecTargetCommitteeSize: 24,
101+
/** The number of epochs to lag behind the current epoch for validator selection. */
102+
lagInEpochs: 2,
104103
/** The number of epochs after an epoch ends that proofs are still accepted. */
105104
aztecProofSubmissionEpochs: 1,
105+
/** How many sequencers must agree with a slash for it to be executed. */
106+
slashingQuorum: 65,
107+
108+
slashingRoundSizeInEpochs: 4,
109+
slashingLifetimeInRounds: 40,
110+
slashingExecutionDelayInRounds: 28,
111+
slashAmountSmall: 2_000n * 10n ** 18n,
112+
slashAmountMedium: 10_000n * 10n ** 18n,
113+
slashAmountLarge: 50_000n * 10n ** 18n,
114+
slashingOffsetInRounds: 2,
115+
slasherFlavor: 'tally',
116+
slashingVetoer: EthAddress.ZERO, // TODO TMNT-329
117+
106118
/** The mana target for the rollup */
107119
manaTarget: 0n,
120+
121+
exitDelaySeconds: 5 * 24 * 60 * 60,
122+
108123
/** The proving cost per mana */
109124
provingCostPerMana: 0n,
125+
localEjectionThreshold: 196_000n * 10n ** 18n,
126+
127+
ejectionThreshold: 100_000n * 10n ** 18n,
128+
activationThreshold: 200_000n * 10n ** 18n,
129+
130+
governanceProposerRoundSize: 300, // TODO TMNT-322
131+
governanceProposerQuorum: 151, // TODO TMNT-322
132+
133+
// Node slashing config
134+
// TODO TMNT-330
135+
slashMinPenaltyPercentage: 0.5,
136+
slashMaxPenaltyPercentage: 2.0,
137+
slashInactivityTargetPercentage: 0.7,
138+
slashInactivityConsecutiveEpochThreshold: 2,
139+
slashInactivityPenalty: 2_000n * 10n ** 18n,
140+
slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
141+
slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
142+
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
143+
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
144+
slashUnknownPenalty: 2_000n * 10n ** 18n,
145+
slashBroadcastedInvalidBlockPenalty: 10_000n * 10n ** 18n,
146+
slashMaxPayloadSize: 50,
147+
slashGracePeriodL2Slots: 32 * 4, // One round from genesis
148+
slashOffenseExpirationRounds: 8,
149+
sentinelEnabled: true,
150+
slashingDisableDuration: 5 * 24 * 60 * 60,
110151
};
111152

112153
export const stagingPublicL2ChainConfig: L2ChainConfig = {
@@ -213,6 +254,8 @@ export const testnetL2ChainConfig: L2ChainConfig = {
213254
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
214255

215256
...DefaultSlashConfig,
257+
slashPrunePenalty: 0n,
258+
slashDataWithholdingPenalty: 0n,
216259
};
217260

218261
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;

yarn-project/end-to-end/src/e2e_fees/fees_test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ export class FeesTest {
136136

137137
async getBlockRewards() {
138138
const blockReward = await this.rollupContract.getBlockReward();
139+
const rewardConfig = await this.rollupContract.getRewardConfig();
139140

140141
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
141-
this.context.deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress,
142+
EthAddress.fromString(rewardConfig.rewardDistributor),
142143
);
143144

144145
const toDistribute = balance > blockReward ? blockReward : balance;
145-
const sequencerBlockRewards = toDistribute / 2n;
146+
const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n;
146147
const proverBlockRewards = toDistribute - sequencerBlockRewards;
147148

148149
return { sequencerBlockRewards, proverBlockRewards };

yarn-project/ethereum/src/config.ts

Lines changed: 44 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ export const DefaultL1ContractsConfig = {
7979
aztecTargetCommitteeSize: 48,
8080
lagInEpochs: 2,
8181
aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
82-
activationThreshold: BigInt(100e18),
83-
ejectionThreshold: BigInt(50e18),
84-
localEjectionThreshold: BigInt(98e18),
85-
slashAmountSmall: BigInt(10e18),
86-
slashAmountMedium: BigInt(20e18),
87-
slashAmountLarge: BigInt(50e18),
82+
activationThreshold: 100n * 10n ** 18n,
83+
ejectionThreshold: 50n * 10n ** 18n,
84+
localEjectionThreshold: 98n * 10n ** 18n,
85+
slashAmountSmall: 10n * 10n ** 18n,
86+
slashAmountMedium: 20n * 10n ** 18n,
87+
slashAmountLarge: 50n * 10n ** 18n,
8888
slashingRoundSizeInEpochs: 4,
8989
slashingLifetimeInRounds: 5,
9090
slashingExecutionDelayInRounds: 0, // round N may be submitted in round N + 1
@@ -128,31 +128,32 @@ const StagingPublicGovernanceConfiguration = {
128128

129129
const TestnetGovernanceConfiguration = {
130130
proposeConfig: {
131-
lockDelay: 60n * 60n * 24n,
132-
lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n,
131+
lockDelay: 10n * 365n * 24n * 60n * 60n,
132+
lockAmount: 1250n * 200_000n * 10n ** 18n,
133133
},
134-
votingDelay: 60n,
135-
votingDuration: 60n * 60n,
136-
executionDelay: 60n * 60n * 24n,
137-
gracePeriod: 60n * 60n * 24n * 7n,
138-
quorum: 3n * 10n ** 17n, // 30%
139-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
140-
minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n,
134+
135+
votingDelay: 12n * 60n * 60n, // 12 hours
136+
votingDuration: 1n * 24n * 60n * 60n, // 1 day
137+
executionDelay: 12n * 60n * 60n, // 12 hours
138+
gracePeriod: 1n * 24n * 60n * 60n, // 1 day
139+
quorum: 2n * 10n ** 17n, // 20%
140+
requiredYeaMargin: 1n * 10n ** 17n, // 10%
141+
minimumVotes: 1250n * 200_000n * 10n ** 18n,
141142
};
142143

143144
const StagingIgnitionGovernanceConfiguration = {
144145
proposeConfig: {
145-
lockDelay: 60n * 60n * 24n * 30n, // 30 days
146-
lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n,
146+
lockDelay: 10n * 365n * 24n * 60n * 60n,
147+
lockAmount: 1250n * 200_000n * 10n ** 18n,
147148
},
148149

149-
votingDelay: 60n,
150-
votingDuration: 60n * 60n,
151-
executionDelay: 60n,
152-
gracePeriod: 60n * 60n * 24n * 7n,
153-
quorum: 3n * 10n ** 17n, // 30%
154-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
155-
minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n, // >= 200 validators must vote
150+
votingDelay: 7n * 24n * 60n * 60n,
151+
votingDuration: 7n * 24n * 60n * 60n,
152+
executionDelay: 30n * 24n * 60n * 60n,
153+
gracePeriod: 7n * 24n * 60n * 60n,
154+
quorum: 2n * 10n ** 17n, // 20%
155+
requiredYeaMargin: 1n * 10n ** 17n, // 10%
156+
minimumVotes: 1250n * 200_000n * 10n ** 18n,
156157
};
157158

158159
export const getGovernanceConfiguration = (networkName: NetworkNames) => {
@@ -175,10 +176,10 @@ export const getGovernanceConfiguration = (networkName: NetworkNames) => {
175176
// for it seems overkill
176177

177178
const DefaultRewardConfig = {
178-
sequencerBps: 5000,
179+
sequencerBps: 8000,
179180
rewardDistributor: EthAddress.ZERO.toString(),
180181
booster: EthAddress.ZERO.toString(),
181-
blockReward: BigInt(50e18),
182+
blockReward: 500n * 10n ** 18n,
182183
};
183184

184185
export const getRewardConfig = (networkName: NetworkNames) => {
@@ -193,51 +194,16 @@ export const getRewardConfig = (networkName: NetworkNames) => {
193194
}
194195
};
195196

196-
const LocalRewardBoostConfig = {
197-
increment: 200000,
198-
maxScore: 5000000,
199-
a: 5000,
200-
k: 1000000,
201-
minimum: 100000,
202-
};
203-
204-
const StagingPublicRewardBoostConfig = {
205-
increment: 200000,
206-
maxScore: 5000000,
207-
a: 5000,
208-
k: 1000000,
209-
minimum: 100000,
210-
};
211-
212-
const TestnetRewardBoostConfig = {
213-
increment: 125000,
214-
maxScore: 15000000,
215-
a: 1000,
216-
k: 1000000,
217-
minimum: 100000,
218-
};
219-
220-
const StagingIgnitionRewardBoostConfig = {
221-
increment: 200000,
222-
maxScore: 5000000,
223-
a: 5000,
224-
k: 1000000,
225-
minimum: 100000,
226-
};
227-
228-
export const getRewardBoostConfig = (networkName: NetworkNames) => {
229-
switch (networkName) {
230-
case 'local':
231-
return LocalRewardBoostConfig;
232-
case 'staging-public':
233-
return StagingPublicRewardBoostConfig;
234-
case 'testnet':
235-
return TestnetRewardBoostConfig;
236-
case 'staging-ignition':
237-
return StagingIgnitionRewardBoostConfig;
238-
default:
239-
throw new Error(`Unrecognized network name: ${networkName}`);
240-
}
197+
export const getRewardBoostConfig = () => {
198+
// The reward configuration is specified with a precision of 1e5, and we use the same across
199+
// all networks.
200+
return {
201+
increment: 125000, // 1.25
202+
maxScore: 15000000, // 150
203+
a: 1000, // 0.01
204+
k: 1000000, // 10
205+
minimum: 100000, // 1
206+
};
241207
};
242208

243209
// Similar to the above, no need for environment variables for this.
@@ -259,18 +225,18 @@ const StagingPublicEntryQueueConfig = {
259225

260226
const TestnetEntryQueueConfig = {
261227
bootstrapValidatorSetSize: 750n,
262-
bootstrapFlushSize: 48n, // will effectively be bounded by maxQueueFlushSize
263-
normalFlushSizeMin: 1n,
228+
bootstrapFlushSize: 32n,
229+
normalFlushSizeMin: 32n,
264230
normalFlushSizeQuotient: 2475n,
265-
maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas.
231+
maxQueueFlushSize: 32n,
266232
};
267233

268234
const StagingIgnitionEntryQueueConfig = {
269-
bootstrapValidatorSetSize: 750n,
270-
bootstrapFlushSize: 48n, // will effectively be bounded by maxQueueFlushSize
235+
bootstrapValidatorSetSize: 1250n,
236+
bootstrapFlushSize: 8n,
271237
normalFlushSizeMin: 1n,
272-
normalFlushSizeQuotient: 2475n,
273-
maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas.
238+
normalFlushSizeQuotient: 2048n,
239+
maxQueueFlushSize: 8n,
274240
};
275241

276242
export const getEntryQueueConfig = (networkName: NetworkNames) => {

yarn-project/ethereum/src/contracts/rollup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,10 @@ export class RollupContract {
713713
return this.rollup.read.getStakingAsset();
714714
}
715715

716+
getRewardConfig() {
717+
return this.rollup.read.getRewardConfig();
718+
}
719+
716720
setupEpoch(l1TxUtils: L1TxUtils) {
717721
return l1TxUtils.sendAndMonitorTransaction({
718722
to: this.address,

yarn-project/ethereum/src/deploy_l1_contracts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ export const deployRollup = async (
551551
provingCostPerMana: args.provingCostPerMana,
552552
rewardConfig: rewardConfig,
553553
version: 0,
554-
rewardBoostConfig: getRewardBoostConfig(networkName),
554+
rewardBoostConfig: getRewardBoostConfig(),
555555
stakingQueueConfig: getEntryQueueConfig(networkName),
556556
exitDelaySeconds: BigInt(args.exitDelaySeconds),
557557
slasherFlavor: slasherFlavorToSolidityEnum(args.slasherFlavor),

0 commit comments

Comments
 (0)