Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions l1-contracts/src/core/libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ library Errors {
error TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(uint256 slashOffset);
error TallySlashingProposer__InvalidEpochIndex(uint256 epochIndex, uint256 roundSizeInEpochs);
error TallySlashingProposer__VoteSizeTooBig(uint256 voteSize, uint256 maxSize);
error TallySlashingProposer__VotesMustBeMultipleOf4(uint256 votes);

// SlashPayloadLib
error SlashPayload_ArraySizeMismatch(uint256 expected, uint256 actual);
Expand Down
5 changes: 5 additions & 0 deletions l1-contracts/src/core/slashing/TallySlashingProposer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ contract TallySlashingProposer is EIP712 {
// We have allocated 4 bytes32 slots = 128 bytes maximum
uint256 voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4;
require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));

require(
COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0,
Errors.TallySlashingProposer__VotesMustBeMultipleOf4(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS)
);
}

/**
Expand Down
16 changes: 6 additions & 10 deletions yarn-project/aztec/src/cli/chain_l2_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
/** The minimum stake for a validator. */
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
/** The slashing round size */
slashingRoundSize: 32 * 6, // 6 epochs
/** The slashing quorum */
slashingQuorum: (32 * 6) / 2 + 1, // 6 epochs, majority of validators
/** Governance proposing quorum */
governanceProposerQuorum: 151,
slashingRoundSizeInEpochs: 4,
/** Governance proposing round size */
governanceProposerRoundSize: 300,
/** The mana target for the rollup */
Expand Down Expand Up @@ -219,9 +215,9 @@ export async function getL2ChainConfig(
return undefined;
}

function enrichVar(envVar: EnvVar, value: string) {
function enrichVar(envVar: EnvVar, value: string | undefined) {
// Don't override
if (process.env[envVar]) {
if (process.env[envVar] || value === undefined) {
return;
}
process.env[envVar] = value;
Expand Down Expand Up @@ -306,9 +302,9 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum.toString());
enrichVar('AZTEC_SLASHING_ROUND_SIZE', config.slashingRoundSize.toString());
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum.toString());
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
Expand Down
1 change: 1 addition & 0 deletions yarn-project/aztec/src/sandbox/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export async function deployContractsToL1(
salt: opts.salt,
feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
aztecTargetCommitteeSize: 0, // no committee in sandbox
slasherFlavor: 'none', // no slashing in sandbox
realVerifier: false,
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ describe('e2e_epochs/epochs_invalidate_block', () => {
archiverPollingIntervalMS: 200,
anvilAccounts: 20,
anvilPort: ++anvilPort,
slashingRoundSizeInEpochs: 4,
slashingOffsetInRounds: 256,
slasherFlavor: 'tally',
});

Expand Down
3 changes: 1 addition & 2 deletions yarn-project/end-to-end/src/e2e_p2p/add_rollup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ describe('e2e_p2p_add_rollup', () => {
initialConfig: {
...SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES,
listenAddress: '127.0.0.1',
governanceProposerQuorum: 6,
governanceProposerRoundSize: 10,
},
});
Expand Down Expand Up @@ -158,7 +157,7 @@ describe('e2e_p2p_add_rollup', () => {
aztecTargetCommitteeSize: t.ctx.aztecNodeConfig.aztecTargetCommitteeSize,
aztecProofSubmissionEpochs: t.ctx.aztecNodeConfig.aztecProofSubmissionEpochs,
slashingQuorum: t.ctx.aztecNodeConfig.slashingQuorum,
slashingRoundSize: t.ctx.aztecNodeConfig.slashingRoundSize,
slashingRoundSizeInEpochs: t.ctx.aztecNodeConfig.slashingRoundSizeInEpochs,
slashingLifetimeInRounds: t.ctx.aztecNodeConfig.slashingLifetimeInRounds,
slashingExecutionDelayInRounds: t.ctx.aztecNodeConfig.slashingExecutionDelayInRounds,
slashingVetoer: t.ctx.aztecNodeConfig.slashingVetoer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('e2e_p2p_data_withholding_slash', () => {
aztecSlotDuration,
aztecProofSubmissionEpochs: 0, // effectively forces instant reorgs
slashingQuorum,
slashingRoundSize,
slashingRoundSizeInEpochs: slashingRoundSize / 2,
slashAmountSmall: slashingUnit,
slashAmountMedium: slashingUnit * 2n,
slashAmountLarge: slashingUnit * 3n,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('e2e_p2p_network', () => {
initialConfig: {
...SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES,
aztecEpochDuration: 4,
slashingRoundSize: 8,
slashingRoundSizeInEpochs: 2,
slashingQuorum: 5,
listenAddress: '127.0.0.1',
},
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/e2e_p2p/inactivity_slash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('e2e_p2p_inactivity_slash', () => {
basePort: BOOT_NODE_UDP_PORT,
startProverNode: true,
initialConfig: {
aztecTargetCommitteeSize: NUM_NODES, // ensure we can progress even after slash happens
aztecTargetCommitteeSize: NUM_VALIDATORS,
aztecSlotDuration: AZTEC_SLOT_DURATION,
ethereumSlotDuration: ETHEREUM_SLOT_DURATION,
aztecProofSubmissionEpochs: 1024, // effectively do not reorg
Expand All @@ -51,7 +51,7 @@ describe('e2e_p2p_inactivity_slash', () => {
validatorReexecute: false,
sentinelEnabled: true,
slashingQuorum: SLASHING_QUORUM,
slashingRoundSize: SLASHING_ROUND_SIZE,
slashingRoundSizeInEpochs: SLASHING_ROUND_SIZE / EPOCH_DURATION,
slashInactivityTargetPercentage: 0.5,
slashAmountSmall: SLASHING_UNIT,
slashAmountMedium: SLASHING_UNIT * 2n,
Expand Down
6 changes: 4 additions & 2 deletions yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export class P2PNetworkTest {
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
aztecProofSubmissionEpochs:
initialValidatorConfig.aztecProofSubmissionEpochs ?? l1ContractsConfig.aztecProofSubmissionEpochs,
slashingRoundSize: initialValidatorConfig.slashingRoundSize ?? l1ContractsConfig.slashingRoundSize,
slashingRoundSizeInEpochs:
initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
slasherFlavor: initialValidatorConfig.slasherFlavor ?? 'tally',
aztecTargetCommitteeSize: numberOfValidators,
salt: 420,
Expand All @@ -127,7 +128,8 @@ export class P2PNetworkTest {
{
...initialValidatorConfig,
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
slashingRoundSize: initialValidatorConfig.slashingRoundSize ?? l1ContractsConfig.slashingRoundSize,
slashingRoundSizeInEpochs:
initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
slasherFlavor: initialValidatorConfig.slasherFlavor ?? 'tally',

ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/end-to-end/src/e2e_p2p/reqresp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ describe('e2e_p2p_reqresp_tx', () => {
...SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES,
listenAddress: '127.0.0.1',
aztecEpochDuration: 64, // stable committee
slashingRoundSize: 128,
slashingQuorum: 65,
},
});
await t.applyBaseSnapshots();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ describe('e2e_p2p_reqresp_tx_no_handshake', () => {
p2pDisableStatusHandshake: true, // DIFFERENCE FROM reqresp.test.ts
listenAddress: '127.0.0.1',
aztecEpochDuration: 64, // stable committee
slashingRoundSize: 128,
slashingQuorum: 65,
},
});
await t.applyBaseSnapshots();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('veto slash', () => {
slashAmountSmall: SLASHING_UNIT,
slashAmountMedium: SLASHING_UNIT * 2n,
slashAmountLarge: SLASHING_UNIT * 3n,
slashingRoundSize: SLASHING_ROUND_SIZE,
slashingRoundSizeInEpochs: SLASHING_ROUND_SIZE / EPOCH_DURATION,
slashingQuorum: SLASHING_QUORUM,
slashInactivityTargetPercentage: SLASH_INACTIVITY_TARGET_PERCENTAGE,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe('e2e_p2p_governance_proposer', () => {
initialConfig: {
...SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES,
listenAddress: '127.0.0.1',
governanceProposerQuorum: 6,
governanceProposerRoundSize: 10,
activationThreshold: 10n ** 22n,
ejectionThreshold: 5n ** 22n,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('e2e_p2p_valid_epoch_pruned', () => {
aztecSlotDuration,
aztecProofSubmissionEpochs: 0, // reorg as soon as epoch ends
slashingQuorum,
slashingRoundSize,
slashingRoundSizeInEpochs: slashingRoundSize / 2,
slashSelfAllowed: true,
slashAmountSmall: slashingUnit,
slashAmountMedium: slashingUnit * 2n,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ describe('e2e_p2p_validators_sentinel', () => {
listenAddress: '127.0.0.1',
minTxsPerBlock: 0,
aztecEpochDuration: EPOCH_DURATION,
slashingRoundSize: EPOCH_DURATION * 2,
slashingQuorum: EPOCH_DURATION + 1,
slashingRoundSizeInEpochs: 2,
validatorReexecute: false,
sentinelEnabled: true,
slashInactivityPenalty: 0n, // Set to 0 to disable
Expand Down
6 changes: 5 additions & 1 deletion yarn-project/end-to-end/src/fixtures/snapshot_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,13 @@ async function setupFromFresh(

const blobSinkPort = await getPort();

// Default to no slashing
opts.slasherFlavor ??= 'none';
deployL1ContractsArgs.slasherFlavor ??= opts.slasherFlavor;

// Fetch the AztecNode config.
// TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
const aztecNodeConfig: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), slasherFlavor: 'none', ...opts };
const aztecNodeConfig: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
aztecNodeConfig.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
aztecNodeConfig.maxTxPoolSize = opts.maxTxPoolSize ?? TEST_MAX_TX_POOL_SIZE;
// Only enable proving if specifically requested.
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,9 @@ export async function setup(
let anvil: Anvil | undefined;
try {
opts.aztecTargetCommitteeSize ??= 0;
opts.slasherFlavor ??= 'none';

const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), slasherFlavor: 'none', ...opts };
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
// use initialValidators for the node config
config.validatorPrivateKeys = new SecretValue(opts.initialValidators?.map(v => v.privateKey) ?? []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
// aztecProofSubmissionEpochs: 1,
// aztecTargetCommitteeSize: 48,
// slashingQuorum: 5,
// slashingRoundSize: 8,
// slashingRoundSizeInEpochs: 2,
// slashingLifetimeInRounds: 5,
// slashingExecutionDelayInRounds: 0,
// slashingVetoer: EthAddress.ZERO,
Expand Down
Loading
Loading