Skip to content
Draft
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
11 changes: 5 additions & 6 deletions l1-contracts/src/core/slashing/SlashingProposer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ import {SafeCast} from "@oz/utils/math/SafeCast.sol";
*
* About SLASH_OFFSET_IN_ROUNDS:
* - This offset gives us time to detect an offense and then vote on it in a later
* round. For instance, an `VALID_EPOCH_PRUNED` offense for epoch N is only triggered after
* `PROOF_SUBMISSION_WINDOW` epochs. Consider the following:
* - Epoch 1 is valid
* - At the end of epoch 3, the proof for 1 has not landed, so epoch 1 is pruned
* - Network decides to slash the committee of epoch 1
* - This means that only starting from epoch 4 we should be voting for slashing the committee of epoch 1
* round. For instance, a `DATA_WITHHOLDING` offense for slot S is only triggered after
* `DATA_WITHHOLDING_TOLERANCE_SLOTS` slots. Consider:
* - Slot S publishes a checkpoint
* - At slot S + tolerance, observers find missing data and want to slash the attesters
* - Voting on that slash needs to happen in a round that starts after detection
* - In terms of voting, this parameter means that in round R we are voting for the committee of epochs starting
* from (R - SLASH_OFFSET_IN_ROUNDS) * ROUND_SIZE_IN_EPOCHS.
* - For example, with SLASH_OFFSET_IN_ROUNDS=2, ROUND_SIZE=10, and EPOCH_DURATION=2
Expand Down
8 changes: 4 additions & 4 deletions spartan/aztec-node/templates/_pod-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ spec:
- name: SLASH_VALIDATORS_NEVER
value: {{ join "," .Values.node.slash.validatorsNever | quote }}
{{- end }}
{{- if .Values.node.slash.prunePenalty }}
- name: SLASH_PRUNE_PENALTY
value: {{ .Values.node.slash.prunePenalty | quote }}
{{- end }}
{{- if .Values.node.slash.dataWithholdingPenalty }}
- name: SLASH_DATA_WITHHOLDING_PENALTY
value: {{ .Values.node.slash.dataWithholdingPenalty | quote }}
{{- end }}
{{- if .Values.node.slash.dataWithholdingToleranceSlots }}
- name: SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS
value: {{ .Values.node.slash.dataWithholdingToleranceSlots | quote }}
{{- end }}
{{- if .Values.node.slash.inactivityPenalty }}
- name: SLASH_INACTIVITY_PENALTY
value: {{ .Values.node.slash.inactivityPenalty | quote }}
Expand Down
2 changes: 1 addition & 1 deletion spartan/aztec-node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ node:
validatorsAlways: []
validatorsNever: []
# Penalty amounts for different offense types
prunePenalty: ""
dataWithholdingPenalty: ""
dataWithholdingToleranceSlots: ""
inactivityPenalty: ""
inactivityTargetPercentage: ""
invalidBlockPenalty: ""
Expand Down
7 changes: 2 additions & 5 deletions spartan/environments/network-defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ slasher: &slasher
SLASH_MAX_PAYLOAD_SIZE: 80
# Rounds to look back when executing slashes.
SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4
# Penalty for slashing validators of a valid pruned epoch.
SLASH_PRUNE_PENALTY: 10e18
# Penalty for data withholding.
SLASH_DATA_WITHHOLDING_PENALTY: 10e18
# L2 slots to wait after a checkpoint's slot before declaring its txs missing.
SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS: 3
# Missed attestation percentage to trigger inactivity slash (0, 1].
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.9
# Consecutive epochs a validator must be inactive before slashing.
Expand Down Expand Up @@ -233,7 +233,6 @@ networks:
PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: ""
PUBLIC_OTEL_COLLECT_FROM: ""
# Slasher penalties
SLASH_PRUNE_PENALTY: 10e18
SLASH_DATA_WITHHOLDING_PENALTY: 10e18
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.9
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 1
Expand Down Expand Up @@ -278,7 +277,6 @@ networks:
P2P_MAX_PENDING_TX_COUNT: 1000
P2P_TX_POOL_DELETE_TXS_AFTER_REORG: true
# Slasher penalties
SLASH_PRUNE_PENALTY: 10e18
SLASH_DATA_WITHHOLDING_PENALTY: 10e18
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.9
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 1
Expand Down Expand Up @@ -337,7 +335,6 @@ networks:
PUBLIC_OTEL_COLLECT_FROM: ""
ENABLE_VERSION_CHECK: false
# Slasher penalties - more lenient initially
SLASH_PRUNE_PENALTY: 0
SLASH_DATA_WITHHOLDING_PENALTY: 0
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.8
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 2
Expand Down
2 changes: 1 addition & 1 deletion spartan/scripts/deploy_network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ PROVER_PUBLISHERS_PER_PROVER = ${PUBLISHERS_PER_PROVER}
SENTINEL_ENABLED = ${SENTINEL_ENABLED:-null}
SLASH_INACTIVITY_TARGET_PERCENTAGE = ${SLASH_INACTIVITY_TARGET_PERCENTAGE:-null}
SLASH_INACTIVITY_PENALTY = ${SLASH_INACTIVITY_PENALTY:-null}
SLASH_PRUNE_PENALTY = ${SLASH_PRUNE_PENALTY:-null}
SLASH_DATA_WITHHOLDING_PENALTY = ${SLASH_DATA_WITHHOLDING_PENALTY:-null}
SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS = ${SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS:-null}
SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY = ${SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY:-null}
SLASH_DUPLICATE_PROPOSAL_PENALTY = ${SLASH_DUPLICATE_PROPOSAL_PENALTY:-null}
SLASH_DUPLICATE_ATTESTATION_PENALTY = ${SLASH_DUPLICATE_ATTESTATION_PENALTY:-null}
Expand Down
2 changes: 1 addition & 1 deletion spartan/terraform/deploy-aztec-infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ locals {
"validator.sentinel.enabled" = var.SENTINEL_ENABLED
"validator.slash.inactivityTargetPercentage" = var.SLASH_INACTIVITY_TARGET_PERCENTAGE
"validator.slash.inactivityPenalty" = var.SLASH_INACTIVITY_PENALTY
"validator.slash.prunePenalty" = var.SLASH_PRUNE_PENALTY
"validator.slash.dataWithholdingPenalty" = var.SLASH_DATA_WITHHOLDING_PENALTY
"validator.slash.dataWithholdingToleranceSlots" = var.SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS
"validator.slash.proposeInvalidAttestationsPenalty" = var.SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY
"validator.slash.duplicateProposalPenalty" = var.SLASH_DUPLICATE_PROPOSAL_PENALTY
"validator.slash.duplicateAttestationPenalty" = var.SLASH_DUPLICATE_ATTESTATION_PENALTY
Expand Down
8 changes: 4 additions & 4 deletions spartan/terraform/deploy-aztec-infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,14 @@ variable "SLASH_INACTIVITY_PENALTY" {
nullable = true
}

variable "SLASH_PRUNE_PENALTY" {
description = "The slash prune penalty"
variable "SLASH_DATA_WITHHOLDING_PENALTY" {
description = "The slash data withholding penalty"
type = string
nullable = true
}

variable "SLASH_DATA_WITHHOLDING_PENALTY" {
description = "The slash data withholding penalty"
variable "SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS" {
description = "L2 slots to wait after a checkpoint slot before slashing for data withholding"
type = string
nullable = true
}
Expand Down
28 changes: 14 additions & 14 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
import { PublicProcessorFactory } from '@aztec/simulator/server';
import {
AttestationsBlockWatcher,
EpochPruneWatcher,
DataWithholdingWatcher,
type SlasherClientInterface,
type Watcher,
createSlasher,
Expand Down Expand Up @@ -174,7 +174,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
protected readonly proverNode: ProverNode | undefined,
protected readonly slasherClient: SlasherClientInterface | undefined,
protected readonly validatorsSentinel: Sentinel | undefined,
protected readonly epochPruneWatcher: EpochPruneWatcher | undefined,
protected readonly dataWithholdingWatcher: DataWithholdingWatcher | undefined,
protected readonly attestationsBlockWatcher: AttestationsBlockWatcher | undefined,
protected readonly l1ChainId: number,
protected readonly version: number,
Expand Down Expand Up @@ -719,7 +719,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
await p2pClient.start();

let validatorsSentinel: Awaited<ReturnType<typeof createSentinel>> | undefined;
let epochPruneWatcher: EpochPruneWatcher | undefined;
let dataWithholdingWatcher: DataWithholdingWatcher | undefined;
let attestationsBlockWatcher: AttestationsBlockWatcher | undefined;

if (!proverOnly) {
Expand All @@ -728,16 +728,16 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
watchers.push(validatorsSentinel);
}

if (config.slashPrunePenalty > 0n || config.slashDataWithholdingPenalty > 0n) {
epochPruneWatcher = new EpochPruneWatcher(
archiver,
archiver,
if (config.slashDataWithholdingPenalty > 0n) {
dataWithholdingWatcher = new DataWithholdingWatcher(
epochCache,
archiver,
p2pClient.getTxProvider(),
validatorCheckpointsBuilder,
p2pClient,
{ chainId: config.l1ChainId, rollupAddress: config.l1Contracts.rollupAddress },
config,
);
watchers.push(epochPruneWatcher);
watchers.push(dataWithholdingWatcher);
}

// We assume we want to slash for invalid attestations unless all max penalties are set to 0
Expand All @@ -755,9 +755,9 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
await validatorsSentinel.start();
started.push(validatorsSentinel);
}
if (epochPruneWatcher) {
await epochPruneWatcher.start();
started.push(epochPruneWatcher);
if (dataWithholdingWatcher) {
await dataWithholdingWatcher.start();
started.push(dataWithholdingWatcher);
}
if (attestationsBlockWatcher) {
await attestationsBlockWatcher.start();
Expand Down Expand Up @@ -892,7 +892,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
proverNode,
slasherClient,
validatorsSentinel,
epochPruneWatcher,
dataWithholdingWatcher,
attestationsBlockWatcher,
ethereumChain.chainInfo.id,
config.rollupVersion,
Expand Down Expand Up @@ -1171,7 +1171,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
this.log.info(`Stopping Aztec Node`);
await tryStop(this.attestationsBlockWatcher);
await tryStop(this.validatorsSentinel);
await tryStop(this.epochPruneWatcher);
await tryStop(this.dataWithholdingWatcher);
await tryStop(this.slasherClient);
await Promise.all([tryStop(this.peerProofVerifier), tryStop(this.rpcProofVerifier)]);
await tryStop(this.sequencer);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec-node/src/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { EpochCacheInterface } from '@aztec/epoch-cache';
import type { P2P } from '@aztec/p2p';
import { SequencerClient } from '@aztec/sequencer-client';
import { EpochPruneWatcher, type SlasherClientInterface } from '@aztec/slasher';
import { DataWithholdingWatcher, type SlasherClientInterface } from '@aztec/slasher';
import type { L2BlockSource } from '@aztec/stdlib/block';
import type { ContractDataSource } from '@aztec/stdlib/contract';
import type { L2LogsSource, Service, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
Expand All @@ -23,7 +23,7 @@ export declare class TestAztecNodeService extends AztecNodeService {
declare public sequencer: SequencerClient | undefined;
declare public slasherClient: SlasherClientInterface | undefined;
declare public validatorsSentinel: Sentinel | undefined;
declare public epochPruneWatcher: EpochPruneWatcher | undefined;
declare public dataWithholdingWatcher: DataWithholdingWatcher | undefined;
declare public l1ChainId: number;
declare public version: number;
declare public globalVariableBuilder: GlobalVariableBuilderInterface;
Expand Down
Loading
Loading