@aztec/slasher 0.0.1-commit.96dac018d → 0.0.1-commit.993d240

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +76 -79
  2. package/dest/config.d.ts +1 -1
  3. package/dest/config.d.ts.map +1 -1
  4. package/dest/config.js +29 -29
  5. package/dest/factory/create_facade.d.ts +3 -3
  6. package/dest/factory/create_facade.d.ts.map +1 -1
  7. package/dest/factory/create_facade.js +25 -2
  8. package/dest/factory/create_implementation.d.ts +6 -7
  9. package/dest/factory/create_implementation.d.ts.map +1 -1
  10. package/dest/factory/create_implementation.js +8 -56
  11. package/dest/factory/get_settings.d.ts +4 -4
  12. package/dest/factory/get_settings.d.ts.map +1 -1
  13. package/dest/factory/get_settings.js +3 -3
  14. package/dest/factory/index.d.ts +2 -2
  15. package/dest/factory/index.d.ts.map +1 -1
  16. package/dest/factory/index.js +1 -1
  17. package/dest/generated/slasher-defaults.d.ts +7 -7
  18. package/dest/generated/slasher-defaults.js +7 -7
  19. package/dest/index.d.ts +6 -4
  20. package/dest/index.d.ts.map +1 -1
  21. package/dest/index.js +5 -3
  22. package/dest/null_slasher_client.d.ts +3 -4
  23. package/dest/null_slasher_client.d.ts.map +1 -1
  24. package/dest/null_slasher_client.js +1 -4
  25. package/dest/slash_offenses_collector.d.ts +10 -9
  26. package/dest/slash_offenses_collector.d.ts.map +1 -1
  27. package/dest/slash_offenses_collector.js +50 -30
  28. package/dest/slasher_client.d.ts +112 -0
  29. package/dest/slasher_client.d.ts.map +1 -0
  30. package/dest/{tally_slasher_client.js → slasher_client.js} +45 -45
  31. package/dest/slasher_client_facade.d.ts +6 -8
  32. package/dest/slasher_client_facade.d.ts.map +1 -1
  33. package/dest/slasher_client_facade.js +6 -9
  34. package/dest/slasher_client_interface.d.ts +7 -21
  35. package/dest/slasher_client_interface.d.ts.map +1 -1
  36. package/dest/slasher_client_interface.js +1 -4
  37. package/dest/stores/offenses_store.d.ts +12 -12
  38. package/dest/stores/offenses_store.d.ts.map +1 -1
  39. package/dest/stores/offenses_store.js +61 -38
  40. package/dest/watcher.d.ts +8 -1
  41. package/dest/watcher.d.ts.map +1 -1
  42. package/dest/watcher.js +1 -0
  43. package/dest/watchers/attestations_block_watcher.d.ts +26 -13
  44. package/dest/watchers/attestations_block_watcher.d.ts.map +1 -1
  45. package/dest/watchers/attestations_block_watcher.js +76 -61
  46. package/dest/watchers/attested_invalid_proposal_watcher.d.ts +42 -0
  47. package/dest/watchers/attested_invalid_proposal_watcher.d.ts.map +1 -0
  48. package/dest/watchers/attested_invalid_proposal_watcher.js +117 -0
  49. package/dest/watchers/broadcasted_invalid_checkpoint_proposal_watcher.d.ts +38 -0
  50. package/dest/watchers/broadcasted_invalid_checkpoint_proposal_watcher.d.ts.map +1 -0
  51. package/dest/watchers/broadcasted_invalid_checkpoint_proposal_watcher.js +138 -0
  52. package/dest/watchers/checkpoint_equivocation_watcher.d.ts +30 -0
  53. package/dest/watchers/checkpoint_equivocation_watcher.d.ts.map +1 -0
  54. package/dest/watchers/checkpoint_equivocation_watcher.js +69 -0
  55. package/dest/watchers/data_withholding_watcher.d.ts +63 -0
  56. package/dest/watchers/data_withholding_watcher.d.ts.map +1 -0
  57. package/dest/watchers/data_withholding_watcher.js +193 -0
  58. package/package.json +10 -10
  59. package/src/config.ts +35 -29
  60. package/src/factory/create_facade.ts +32 -4
  61. package/src/factory/create_implementation.ts +24 -105
  62. package/src/factory/get_settings.ts +8 -8
  63. package/src/factory/index.ts +1 -1
  64. package/src/generated/slasher-defaults.ts +7 -7
  65. package/src/index.ts +5 -3
  66. package/src/null_slasher_client.ts +2 -6
  67. package/src/slash_offenses_collector.ts +70 -32
  68. package/src/{tally_slasher_client.ts → slasher_client.ts} +63 -54
  69. package/src/slasher_client_facade.ts +6 -11
  70. package/src/slasher_client_interface.ts +6 -21
  71. package/src/stores/offenses_store.ts +73 -47
  72. package/src/watcher.ts +8 -0
  73. package/src/watchers/attestations_block_watcher.ts +88 -82
  74. package/src/watchers/attested_invalid_proposal_watcher.ts +168 -0
  75. package/src/watchers/broadcasted_invalid_checkpoint_proposal_watcher.ts +192 -0
  76. package/src/watchers/checkpoint_equivocation_watcher.ts +96 -0
  77. package/src/watchers/data_withholding_watcher.ts +225 -0
  78. package/dest/empire_slasher_client.d.ts +0 -190
  79. package/dest/empire_slasher_client.d.ts.map +0 -1
  80. package/dest/empire_slasher_client.js +0 -564
  81. package/dest/stores/payloads_store.d.ts +0 -29
  82. package/dest/stores/payloads_store.d.ts.map +0 -1
  83. package/dest/stores/payloads_store.js +0 -128
  84. package/dest/tally_slasher_client.d.ts +0 -125
  85. package/dest/tally_slasher_client.d.ts.map +0 -1
  86. package/dest/watchers/epoch_prune_watcher.d.ts +0 -39
  87. package/dest/watchers/epoch_prune_watcher.d.ts.map +0 -1
  88. package/dest/watchers/epoch_prune_watcher.js +0 -176
  89. package/src/empire_slasher_client.ts +0 -649
  90. package/src/stores/payloads_store.ts +0 -149
  91. package/src/watchers/epoch_prune_watcher.ts +0 -253
package/README.md CHANGED
@@ -16,15 +16,9 @@ No manual intervention is required for normal operation. The slasher client hand
16
16
  - Generating appropriate slash actions
17
17
  - Coordinating with the SequencerPublisher for L1 execution
18
18
 
19
- ## Slashing Models
19
+ ## Slashing Model
20
20
 
21
- The system supports two slashing models:
22
-
23
- ### Tally Model
24
-
25
- _This is the model currently in use._
26
-
27
- The tally model uses consensus-based voting where proposers vote on individual validator offenses. Time is divided into rounds, and during each round, proposers submit votes indicating which validators from a given past round should be slashed (eg round N votes to slash the validators from round N-2). Votes are encoded as bytes where each validator's vote is represented by 2 bits indicating the slash amount (0-3 slash units) for each validator. The L1 contract tallies votes and slashes validators that reach quorum.
21
+ The slashing model uses consensus-based voting where proposers vote on individual validator offenses. Time is divided into rounds, and during each round, proposers submit votes indicating which validators from a given past round should be slashed (eg round N votes to slash the validators from round N-2). Votes are encoded as bytes where each validator's vote is represented by 2 bits indicating the slash amount (0-3 slash units) for each validator. The L1 contract tallies votes and slashes validators that reach quorum.
28
22
 
29
23
  Key characteristics:
30
24
  - Proposers vote directly on validator offenses
@@ -34,23 +28,12 @@ Key characteristics:
34
28
  - Execution happens after a delay period for review
35
29
  - Slash payloads can be vetoed during the execution delay period
36
30
 
37
- ### Empire Model
38
-
39
- _This model was developed during an earlier iteration and later modified, but never tested in a real network. It remains in the code in case we decide to switch from the tally model in the future._
40
-
41
- The empire model piggybacks on the empire governance system and uses fixed slash payloads that are created and voted on. Proposers aggregate pending offenses and create payloads containing multiple offenses, or vote for existing payloads. The payload with the highest score (based on total offenses, votes received, and round progress) gets executed.
42
-
43
- Key characteristics:
44
- - Fixed payloads containing multiple offenses
45
- - Payload scoring system for selection
46
- - Requires agreement on payload contents (main reason why it was dropped in favor of the Tally model)
47
-
48
31
  ## Architecture
49
32
 
50
33
  ### Core Components
51
34
 
52
35
  #### SlasherClientInterface
53
- Common interface implemented by both tally and empire clients. Provides methods for:
36
+ Interface implemented by the slasher client. Provides methods for:
54
37
  - `getProposerActions()`: Returns actions for the current proposer
55
38
  - `gatherOffensesForRound()`: Collects offenses for a specific round
56
39
 
@@ -73,11 +56,8 @@ Monitors slashing rounds and triggers actions on round transitions:
73
56
 
74
57
  #### ProposerSlashAction
75
58
  Actions returned by the slasher client to the SequencerPublisher:
76
- - `vote-offenses`: Vote on validator offenses (tally model)
77
- - `execute-slash`: Execute slashing for a round that reached quorum (tally model)
78
- - `create-empire-payload`: Create a new slash payload (empire model)
79
- - `vote-empire-payload`: Vote for an existing payload (empire model)
80
- - `execute-empire-payload`: Execute a payload with sufficient votes (empire model)
59
+ - `vote-offenses`: Vote on validator offenses
60
+ - `execute-slash`: Execute slashing for a round that reached quorum
81
61
 
82
62
  ### Integration Flow
83
63
 
@@ -101,53 +81,59 @@ Key features:
101
81
  List of all slashable offenses in the system:
102
82
 
103
83
  ### DATA_WITHHOLDING
104
- **Description**: The data required for proving an epoch was not made publicly available.
105
- **Detection**: EpochPruneWatcher detects when an epoch cannot be proven due to missing data.
106
- **Target**: Committee members of the affected epoch.
107
- **Time Unit**: Epoch-based offense.
108
-
109
- ### VALID_EPOCH_PRUNED
110
- **Description**: An epoch was not successfully proven within the proof submission window.
111
- **Detection**: EpochPruneWatcher monitors epochs that expire without valid proofs.
112
- **Target**: Committee members of the unpruned epoch.
113
- **Time Unit**: Epoch-based offense.
84
+ **Description**: The transaction data for a published checkpoint was not made available within the tolerance window.
85
+ **Detection**: DataWithholdingWatcher checks each published checkpoint's txs against the local mempool once `slashDataWithholdingToleranceSlots` full slots have elapsed past the checkpoint's slot (i.e. at `slotStart(checkpoint.slot + slashDataWithholdingToleranceSlots + 1)`).
86
+ **Target**: Validators who attested to the checkpoint.
87
+ **Time Unit**: Slot-based offense (the checkpoint's slot).
114
88
 
115
89
  ### INACTIVITY
116
- **Description**: A proposer failed to attest or propose blocks during their assigned slots.
117
- **Detection**: Sentinel tracks validator performance and identifies validators who miss attestations beyond threshold.
118
- **Target**: Individual inactive validator.
90
+ **Description**: A proposer failed to attest or propose blocks during their assigned slots.
91
+ **Detection**: Sentinel tracks validator performance and identifies validators who miss attestations beyond threshold.
92
+ **Target**: Individual inactive validator.
119
93
  **Time Unit**: Epoch-based offense.
120
94
 
121
95
  ### BROADCASTED_INVALID_BLOCK_PROPOSAL
122
- **Description**: A proposer broadcast an invalid block proposal over the p2p network.
123
- **Detection**: Validators detect invalid proposals during attestation validation.
124
- **Target**: Proposer who broadcast the invalid block.
125
- **Time Unit**: Slot-based offense.
96
+ **Description**: A proposer broadcast an invalid block proposal over the p2p network.
97
+ **Detection**: Validators detect invalid proposals during attestation validation.
98
+ **Target**: Proposer who broadcast the invalid block.
99
+ **Time Unit**: Slot-based offense.
126
100
 
127
101
  ### PROPOSED_INSUFFICIENT_ATTESTATIONS
128
- **Description**: A proposer submitted a block to L1 without sufficient committee attestations.
129
- **Detection**: AttestationsBlockWatcher checks L1 blocks for attestation count.
130
- **Target**: Block proposer.
102
+ **Description**: A proposer submitted a block to L1 without sufficient committee attestations.
103
+ **Detection**: AttestationsBlockWatcher checks L1 blocks for attestation count.
104
+ **Target**: Block proposer.
131
105
  **Time Unit**: Slot-based offense.
132
106
 
133
107
  ### PROPOSED_INCORRECT_ATTESTATIONS
134
- **Description**: A proposer submitted a block to L1 with signatures from non-committee members.
135
- **Detection**: AttestationsBlockWatcher validates attestation signatures against committee membership.
136
- **Target**: Block proposer.
108
+ **Description**: A proposer submitted a block to L1 with signatures from non-committee members.
109
+ **Detection**: AttestationsBlockWatcher validates attestation signatures against committee membership.
110
+ **Target**: Block proposer.
137
111
  **Time Unit**: Slot-based offense.
138
112
 
139
- ### ATTESTED_DESCENDANT_OF_INVALID
140
- **Description**: A committee member attested to a block built on top of an invalid ancestor.
141
- **Detection**: AttestationsBlockWatcher tracks invalid blocks and their descendants.
142
- **Target**: Committee members who attested to the descendant block.
113
+ ### PROPOSED_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS
114
+ **Description**: A proposer published a checkpoint to L1 that builds on an invalid checkpoint (one with invalid or insufficient attestations).
115
+ **Detection**: AttestationsBlockWatcher tracks invalid checkpoints and their descendants.
116
+ **Target**: Proposer of the descendant checkpoint.
143
117
  **Time Unit**: Slot-based offense.
144
118
 
145
119
  ### DUPLICATE_PROPOSAL
146
- **Description**: A proposer sent multiple block or checkpoint proposals for the same position (slot and indexWithinCheckpoint for blocks, or slot for checkpoints) with different content. Since each slot has exactly one designated proposer, sending conflicting proposals is equivocation.
147
- **Detection**: Detected in the P2P layer when proposals are received. The AttestationPool tracks proposals by position; when a second proposal arrives for the same position with a different archive, it flags the duplicate. The first duplicate is propagated (Accept) so other validators can witness the offense.
120
+ **Description**: A proposer sent multiple block or checkpoint proposals for the same position (slot and indexWithinCheckpoint for blocks, or slot for checkpoints) with different content. Since each slot has exactly one designated proposer, sending conflicting proposals is equivocation. This also covers the case where a proposer broadcasts one checkpoint proposal via P2P but submits a different checkpoint to L1 for the same slot.
121
+ **Detection**: Detected in two places. (1) The P2P layer flags duplicates when a second proposal arrives for the same position with a different archive; the AttestationPool tracks proposals by position and the first duplicate is propagated (Accept) so other validators can witness the offense. (2) CheckpointEquivocationWatcher compares the archive root of each L1-confirmed checkpoint against retained signed P2P checkpoint proposals from the same slot's proposer and flags any mismatch.
148
122
  **Target**: Proposer who broadcast the duplicate proposal.
149
123
  **Time Unit**: Slot-based offense.
150
124
 
125
+ ### ATTESTED_TO_INVALID_CHECKPOINT_PROPOSAL
126
+ **Description**: A committee member attested to a checkpoint proposal in a slot where this node detected a slashable invalid block proposal.
127
+ **Detection**: ValidatorClient marks slots with invalid block proposals detected via reexecution and slashes checkpoint attesters seen for that slot. If proposal equivocation is later detected for the slot, pending bad-attestation offenses are cleared.
128
+ **Target**: Committee members who attested in the invalid proposal slot.
129
+ **Time Unit**: Slot-based offense.
130
+
131
+ ### BROADCASTED_INVALID_CHECKPOINT_PROPOSAL
132
+ **Description**: A proposer broadcast an invalid checkpoint proposal, either one that terminates before a higher-index block proposal signed by the same proposer in the same slot, one whose signed header does not match deterministic validator recomputation, or one with a malformed fee asset price modifier. The first case also covers AZIP-7's _Submitting Block Proposal After Checkpoint_: a later block signed by the same proposer in the same slot makes the prior checkpoint retroactively invalid.
133
+ **Detection**: BroadcastedInvalidCheckpointProposalWatcher scans retained P2P proposal evidence and compares checkpoint archive roots to signed block proposals from the same slot and signer. ValidatorClient also validates checkpoint proposals during the all-nodes callback and emits this offense when checkpoint header recomputation fails or the signed fee asset price modifier is malformed.
134
+ **Target**: Proposer who broadcast the invalid checkpoint proposal.
135
+ **Time Unit**: Slot-based offense.
136
+
151
137
  ## Configuration
152
138
 
153
139
  ### L1 System Settings (L1ContractsConfig)
@@ -155,39 +141,43 @@ These settings are deployed with the L1 contracts and apply system-wide to the p
155
141
 
156
142
  - `slashingQuorumSize`: Votes required to slash (defaults to half the validators in a round, plus one)
157
143
  - `slashingRoundSizeInEpochs`: Number of epochs per slashing round
158
- - `slashingOffsetInRounds`: How many rounds to look back for offenses (tally model)
144
+ - `slashingOffsetInRounds`: How many rounds to look back for offenses
159
145
  - `slashingExecutionDelayInRounds`: Rounds to wait before execution
160
146
  - `slashingLifetimeInRounds`: Maximum age of executable rounds
161
- - `slashingAmounts`: Valid values for each individual slash (tally model)
147
+ - `slashingAmounts`: Valid values for each individual slash
162
148
 
163
149
  Considerations:
164
150
 
165
151
  - The `slashingQuorumSize` should be more than half and less than the total number of validators in a round, so that we require a majority to slash. The number of validators in a round is the committee size times the number of epochs in a round.
166
- - The bigger a `slashingRoundSizeInEpochs`, the bigger the upper bound on the quorum size. This increases security, as we need more validators to agree before slashing. However, it also makes slashing slower, and more expensive to execute in terms of gas in the tally model.
167
- - The `slashingOffsetInRounds` is required because the validators in a given slashing round must vote for _past_ offenses. Otherwise, if someone commits an offense near the end of a round, they can get away with their offense without the validators being able to collect enough votes to slash them. The offset needs to be big enough so that all offenses are discoverable, so this value should be strictly greater than the proof submission window in order to be able to slash for epoch prunes or data withholding.
152
+ - The bigger a `slashingRoundSizeInEpochs`, the bigger the upper bound on the quorum size. This increases security, as we need more validators to agree before slashing. However, it also makes slashing slower, and more expensive to execute in terms of gas.
153
+ - The `slashingOffsetInRounds` is required because the validators in a given slashing round must vote for _past_ offenses. Otherwise, if someone commits an offense near the end of a round, they can get away with their offense without the validators being able to collect enough votes to slash them. The offset needs to be big enough so that all offenses are discoverable, so this value should be strictly greater than the data-withholding tolerance window so that there is time to detect missing data and vote.
168
154
  - The `slashingExecutionDelayInRounds` allows vetoers to stop an invalid slash. This should be large enough to give vetoers time to act, but strictly smaller than the validator exit window, so an offender cannot escape before they are slashed. It should also be small enough so that an offender that would be kicked out does not get picked up to be a committee member again before their slash is executed. In other words, if a validator commits a serious enough offense that we want them out of the validator set as soon as possible, the execution delay should not allow them to be chosen to participate in another committee.
169
155
 
170
156
  ### Local Node Configuration (SlasherConfig)
171
157
 
172
158
  These settings are configured locally on each validator node:
173
159
 
160
+ Block and checkpoint validation settings are expected to be the same across all validators. Slashing relies on
161
+ validators making the same deterministic validity decisions for block and checkpoint proposals; operators should not run
162
+ with divergent validation limits.
163
+
174
164
  - `slashGracePeriodL2Slots`: Number of initial L2 slots where slashing is disabled
175
165
  - `slashOffenseExpirationRounds`: Number of rounds after which pending offenses expire
176
166
  - `slashValidatorsAlways`: Array of validator addresses that should always be slashed
177
167
  - `slashValidatorsNever`: Array of validator addresses that should never be slashed (own validator addresses are automatically added to this list)
178
168
  - `slashInactivityTargetPercentage`: Percentage of misses during an epoch to be slashed for INACTIVITY
179
169
  - `slashInactivityConsecutiveEpochThreshold`: How many consecutive inactive epochs are needed to trigger an INACTIVITY slash on a validator
180
- - `slashPrunePenalty`: Penalty for VALID_EPOCH_PRUNED
181
170
  - `slashDataWithholdingPenalty`: Penalty for DATA_WITHHOLDING
171
+ - `slashDataWithholdingToleranceSlots`: Number of full L2 slots to wait after a checkpoint's slot before declaring its txs missing
182
172
  - `slashInactivityPenalty`: Penalty for INACTIVITY
183
173
  - `slashBroadcastedInvalidBlockPenalty`: Penalty for BROADCASTED_INVALID_BLOCK_PROPOSAL
174
+ - `slashBroadcastedInvalidCheckpointProposalPenalty`: Penalty for BROADCASTED_INVALID_CHECKPOINT_PROPOSAL
184
175
  - `slashDuplicateProposalPenalty`: Penalty for DUPLICATE_PROPOSAL
185
176
  - `slashProposeInvalidAttestationsPenalty`: Penalty for PROPOSED_INSUFFICIENT_ATTESTATIONS and PROPOSED_INCORRECT_ATTESTATIONS
186
- - `slashAttestDescendantOfInvalidPenalty`: Penalty for ATTESTED_DESCENDANT_OF_INVALID
177
+ - `slashProposeDescendantOfCheckpointWithInvalidAttestationsPenalty`: Penalty for PROPOSED_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS
178
+ - `slashAttestInvalidCheckpointProposalPenalty`: Penalty for ATTESTED_TO_INVALID_CHECKPOINT_PROPOSAL
187
179
  - `slashUnknownPenalty`: Default penalty for unknown offense types
188
- - `slashMaxPayloadSize`: Maximum size of slash payloads (empire model)
189
- - `slashMinPenaltyPercentage`: Agree to slashes if they are at least this percentage of the configured penalty (empire model)
190
- - `slashMaxPenaltyPercentage`: Agree to slashes if they are at most this percentage of the configured penalty (empire model)
180
+ - `slashMaxPayloadSize`: Limits the number of **unique validators** (across all committees and epochs in a round) that receive non-zero votes. When this cap is hit, the lowest-severity validator-epoch pairs are zeroed out first, so the most severe slashes are always preserved. Note that multiple offenses for the same validator in the same epoch are summed and counted as a single validator entry against this limit.
191
181
 
192
182
  Considerations:
193
183
 
@@ -202,27 +192,34 @@ Details about specific offenses in the system:
202
192
 
203
193
  Inactivity slashing is one of the most critical, since it allows purging validators that are not fulfilling their duties, which could potentially bring the chain to a halt. This slashing must be aggressive enough to balance out the rate of the entry queue, in case the queue is filled with inactive validators. Furthermore, if enough inactive validators join the system, it may become impossible to gather enough quorum to pass any governance proposal.
204
194
 
205
- Inactivity slashing is handled by the `Sentinel` which monitors performance of all validators slot-by-slot. With the multiple-blocks-per-slot model, block proposals and checkpoints are distinct concepts: proposers build multiple blocks per slot, but attestations are only for checkpoints. After each slot, the sentinel assigns one of the following to the proposer for the slot:
206
- - `checkpoint-mined` if the checkpoint was added to L1
207
- - `checkpoint-proposed` if the checkpoint received at least one attestation, but didn't make it to L1
208
- - `checkpoint-missed` if blocks were proposed but the checkpoint received no attestations
209
- - `blocks-missed` if no block proposals were sent for this slot at all
195
+ Inactivity slashing is handled by the `Sentinel` (in `aztec-node/src/sentinel/`), which monitors performance of all validators slot-by-slot. With the multiple-blocks-per-slot model, block proposals and checkpoints are distinct concepts: proposers build multiple blocks per slot, but attestations are only for checkpoints. After each slot, the sentinel assigns one of the following to the proposer for the slot, in highest-confidence order:
210
196
 
211
- And assigns one of the following to each validator (these refer to checkpoint attestations):
212
- - `attestation-sent` if there was a `checkpoint-proposed` or `checkpoint-mined` and a checkpoint attestation from this validator was seen on either on L1 or on the P2P network
213
- - `attestation-missed` if there was a `checkpoint-proposed` or `checkpoint-mined` but no checkpoint attestation was seen
214
- - none if the slot was a `blocks-missed`
197
+ - `checkpoint-mined` a checkpoint covering this slot has landed on L1
198
+ - `checkpoint-valid` the local node re-executed a checkpoint proposal for this slot successfully
199
+ - `checkpoint-invalid` the local node re-executed a checkpoint proposal for this slot and rejected it (header / archive / out-hash mismatch, limit breach, etc.). Proposer-fault
200
+ - `checkpoint-unvalidated` a checkpoint proposal arrived but the local node could not validate it (missing blocks/txs, timeout). Treated as proposer-fault
201
+ - `checkpoint-missed` — block proposals seen on P2P but no checkpoint proposal at all
202
+ - `blocks-missed` — no block proposals seen for this slot at all
215
203
 
216
- Both `blocks-missed` and `checkpoint-missed` count as proposer inactivity.
204
+ Re-execution outcomes are read from the `CheckpointReexecutionTracker`, which the validator client populates at every early-return in `validateCheckpointProposal`. The same tracker is consumed by the data-withholding watcher via `hasReexecuted(checkpointNumber, archiveRoot)`.
217
205
 
218
- Once an epoch is proven, the sentinel computes the _proven performance_ for the epoch for each validator. Note that we wait until the epoch is proven so we know that the data for all blocks in the epoch was available, and validators who did not attest were effectively inactive. Then, for each validator such that:
206
+ Each non-proposer committee member is assigned one of:
207
+ - `attestation-sent` if their checkpoint attestation was seen on L1 or on the P2P network
208
+ - `attestation-missed` if the proposer status was `checkpoint-mined` or `checkpoint-valid` but no checkpoint attestation was seen
209
+ - none in any other case
210
+
211
+ `blocks-missed`, `checkpoint-missed`, `checkpoint-invalid`, and `checkpoint-unvalidated` all count as proposer inactivity for the slot.
212
+
213
+ The sentinel evaluates an epoch once `sentinelEpochEndBufferSlots` (default 2) L2 slots have elapsed past the epoch's last slot AND the per-slot recorder has covered that last slot. Epoch evaluation does not wait for an L1 proof — it relies on local-state evidence (the re-execution tracker plus L1 checkpoint landings) — so inactive validators are slashed promptly regardless of prover availability.
214
+
215
+ At end-of-epoch evaluation, for each validator such that:
219
216
 
220
217
  ```
221
- total_failures = count(blocks-missed) + count(checkpoint-missed) + count(attestation-missed)
218
+ total_failures = count(blocks-missed) + count(checkpoint-missed)
219
+ + count(checkpoint-invalid) + count(checkpoint-unvalidated)
220
+ + count(attestation-missed)
222
221
  total = count(checkpoint-*) + count(blocks-*) + count(attestation-*)
223
- total_failures / total >= slash_inactivity_target_percentage
222
+ total_failures / total >= slashInactivityTargetPercentage
224
223
  ```
225
224
 
226
- They are voted to be slashed for inactivity. Note that, if `slashInactivityConsecutiveEpochThreshold` is greater than one, we first check if the above is true for the last `threshold` times the given validator was part of a committee, and only then trigger the offense.
227
-
228
-
225
+ they are voted to be slashed for inactivity. If `slashInactivityConsecutiveEpochThreshold` is greater than one, the above must also hold for the last `threshold` times the validator was part of a committee.
package/dest/config.d.ts CHANGED
@@ -3,4 +3,4 @@ import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
3
3
  export type { SlasherConfig };
4
4
  export declare const DefaultSlasherConfig: SlasherConfig;
5
5
  export declare const slasherConfigMappings: ConfigMappingsType<SlasherConfig>;
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFRbkUsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFJckUsWUFBWSxFQUFFLGFBQWEsRUFBRSxDQUFDO0FBRTlCLGVBQU8sTUFBTSxvQkFBb0IsRUFBRSxhQXNCbEMsQ0FBQztBQUVGLGVBQU8sTUFBTSxxQkFBcUIsRUFBRSxrQkFBa0IsQ0FBQyxhQUFhLENBb0luRSxDQUFDIn0=
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFRbkUsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFJckUsWUFBWSxFQUFFLGFBQWEsRUFBRSxDQUFDO0FBRTlCLGVBQU8sTUFBTSxvQkFBb0IsRUFBRSxhQTBCbEMsQ0FBQztBQUVGLGVBQU8sTUFBTSxxQkFBcUIsRUFBRSxrQkFBa0IsQ0FBQyxhQUFhLENBc0luRSxDQUFDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAQnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAIrE,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,eAAO,MAAM,oBAAoB,EAAE,aAsBlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,kBAAkB,CAAC,aAAa,CAoInE,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAQnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAIrE,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,eAAO,MAAM,oBAAoB,EAAE,aA0BlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,kBAAkB,CAAC,aAAa,CAsInE,CAAC"}
package/dest/config.js CHANGED
@@ -3,20 +3,20 @@ import { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import { slasherDefaultEnv } from './generated/slasher-defaults.js';
4
4
  export const DefaultSlasherConfig = {
5
5
  slashOverridePayload: undefined,
6
- slashMinPenaltyPercentage: slasherDefaultEnv.SLASH_MIN_PENALTY_PERCENTAGE,
7
- slashMaxPenaltyPercentage: slasherDefaultEnv.SLASH_MAX_PENALTY_PERCENTAGE,
8
6
  slashValidatorsAlways: [],
9
7
  slashValidatorsNever: [],
10
- slashPrunePenalty: BigInt(slasherDefaultEnv.SLASH_PRUNE_PENALTY),
11
8
  slashDataWithholdingPenalty: BigInt(slasherDefaultEnv.SLASH_DATA_WITHHOLDING_PENALTY),
9
+ slashDataWithholdingToleranceSlots: slasherDefaultEnv.SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS,
12
10
  slashInactivityTargetPercentage: slasherDefaultEnv.SLASH_INACTIVITY_TARGET_PERCENTAGE,
13
11
  slashInactivityConsecutiveEpochThreshold: slasherDefaultEnv.SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD,
14
12
  slashBroadcastedInvalidBlockPenalty: BigInt(slasherDefaultEnv.SLASH_INVALID_BLOCK_PENALTY),
13
+ slashBroadcastedInvalidCheckpointProposalPenalty: BigInt(slasherDefaultEnv.SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY),
15
14
  slashDuplicateProposalPenalty: BigInt(slasherDefaultEnv.SLASH_DUPLICATE_PROPOSAL_PENALTY),
16
15
  slashDuplicateAttestationPenalty: BigInt(slasherDefaultEnv.SLASH_DUPLICATE_ATTESTATION_PENALTY),
17
16
  slashInactivityPenalty: BigInt(slasherDefaultEnv.SLASH_INACTIVITY_PENALTY),
18
17
  slashProposeInvalidAttestationsPenalty: BigInt(slasherDefaultEnv.SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY),
19
- slashAttestDescendantOfInvalidPenalty: BigInt(slasherDefaultEnv.SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY),
18
+ slashProposeDescendantOfCheckpointWithInvalidAttestationsPenalty: BigInt(slasherDefaultEnv.SLASH_PROPOSE_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS_PENALTY),
19
+ slashAttestInvalidCheckpointProposalPenalty: BigInt(slasherDefaultEnv.SLASH_ATTEST_INVALID_CHECKPOINT_PROPOSAL_PENALTY),
20
20
  slashUnknownPenalty: BigInt(slasherDefaultEnv.SLASH_UNKNOWN_PENALTY),
21
21
  slashOffenseExpirationRounds: slasherDefaultEnv.SLASH_OFFENSE_EXPIRATION_ROUNDS,
22
22
  slashMaxPayloadSize: slasherDefaultEnv.SLASH_MAX_PAYLOAD_SIZE,
@@ -28,19 +28,9 @@ export const slasherConfigMappings = {
28
28
  slashOverridePayload: {
29
29
  env: 'SLASH_OVERRIDE_PAYLOAD',
30
30
  description: 'An Ethereum address for a slash payload to vote for unconditionally.',
31
- parseEnv: (val)=>val ? EthAddress.fromString(val) : undefined,
31
+ parseEnv: (val)=>EthAddress.fromString(val),
32
32
  defaultValue: DefaultSlasherConfig.slashOverridePayload
33
33
  },
34
- slashMinPenaltyPercentage: {
35
- env: 'SLASH_MIN_PENALTY_PERCENTAGE',
36
- description: 'Minimum penalty percentage for slashing offenses (0.1 is 10%).',
37
- ...floatConfigHelper(DefaultSlasherConfig.slashMinPenaltyPercentage)
38
- },
39
- slashMaxPenaltyPercentage: {
40
- env: 'SLASH_MAX_PENALTY_PERCENTAGE',
41
- description: 'Maximum penalty percentage for slashing offenses (2.0 is 200%).',
42
- ...floatConfigHelper(DefaultSlasherConfig.slashMaxPenaltyPercentage)
43
- },
44
34
  slashValidatorsAlways: {
45
35
  env: 'SLASH_VALIDATORS_ALWAYS',
46
36
  description: 'Comma-separated list of validator addresses that should always be slashed.',
@@ -53,21 +43,26 @@ export const slasherConfigMappings = {
53
43
  parseEnv: (val)=>val.split(',').map((addr)=>addr.trim()).filter((addr)=>addr.length > 0).map((addr)=>EthAddress.fromString(addr)),
54
44
  defaultValue: DefaultSlasherConfig.slashValidatorsNever
55
45
  },
56
- slashPrunePenalty: {
57
- env: 'SLASH_PRUNE_PENALTY',
58
- description: 'Penalty amount for slashing validators of a valid pruned epoch (set to 0 to disable).',
59
- ...bigintConfigHelper(DefaultSlasherConfig.slashPrunePenalty)
60
- },
61
46
  slashDataWithholdingPenalty: {
62
47
  env: 'SLASH_DATA_WITHHOLDING_PENALTY',
63
- description: 'Penalty amount for slashing validators for data withholding (set to 0 to disable).',
48
+ description: 'Penalty for data withholding (0 records offenses without slash votes).',
64
49
  ...bigintConfigHelper(DefaultSlasherConfig.slashDataWithholdingPenalty)
65
50
  },
51
+ slashDataWithholdingToleranceSlots: {
52
+ env: 'SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS',
53
+ description: 'Number of full L2 slots that must elapse after a checkpoint slot before declaring its txs missing and slashing its attesters for data withholding.',
54
+ ...numberConfigHelper(DefaultSlasherConfig.slashDataWithholdingToleranceSlots)
55
+ },
66
56
  slashBroadcastedInvalidBlockPenalty: {
67
57
  env: 'SLASH_INVALID_BLOCK_PENALTY',
68
58
  description: 'Penalty amount for slashing a validator for an invalid block proposed via p2p.',
69
59
  ...bigintConfigHelper(DefaultSlasherConfig.slashBroadcastedInvalidBlockPenalty)
70
60
  },
61
+ slashBroadcastedInvalidCheckpointProposalPenalty: {
62
+ env: 'SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY',
63
+ description: 'Penalty amount for slashing a validator for an invalid checkpoint proposal proposed via p2p.',
64
+ ...bigintConfigHelper(DefaultSlasherConfig.slashBroadcastedInvalidCheckpointProposalPenalty)
65
+ },
71
66
  slashDuplicateProposalPenalty: {
72
67
  env: 'SLASH_DUPLICATE_PROPOSAL_PENALTY',
73
68
  description: 'Penalty amount for slashing a validator for sending duplicate proposals.',
@@ -101,22 +96,27 @@ export const slasherConfigMappings = {
101
96
  },
102
97
  slashInactivityPenalty: {
103
98
  env: 'SLASH_INACTIVITY_PENALTY',
104
- description: 'Penalty amount for slashing an inactive validator (set to 0 to disable).',
99
+ description: 'Penalty for an inactive validator (0 records offenses without slash votes).',
105
100
  ...bigintConfigHelper(DefaultSlasherConfig.slashInactivityPenalty)
106
101
  },
107
102
  slashProposeInvalidAttestationsPenalty: {
108
103
  env: 'SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY',
109
- description: 'Penalty amount for slashing a proposer that proposed invalid attestations (set to 0 to disable).',
104
+ description: 'Penalty for proposing invalid attestations (0 records offenses without slash votes).',
110
105
  ...bigintConfigHelper(DefaultSlasherConfig.slashProposeInvalidAttestationsPenalty)
111
106
  },
112
- slashAttestDescendantOfInvalidPenalty: {
113
- env: 'SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY',
114
- description: 'Penalty amount for slashing a validator that attested to a descendant of an invalid block (set to 0 to disable).',
115
- ...bigintConfigHelper(DefaultSlasherConfig.slashAttestDescendantOfInvalidPenalty)
107
+ slashProposeDescendantOfCheckpointWithInvalidAttestationsPenalty: {
108
+ env: 'SLASH_PROPOSE_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS_PENALTY',
109
+ description: 'Penalty for publishing a checkpoint building on an invalid checkpoint (0 records offenses without slash votes).',
110
+ ...bigintConfigHelper(DefaultSlasherConfig.slashProposeDescendantOfCheckpointWithInvalidAttestationsPenalty)
111
+ },
112
+ slashAttestInvalidCheckpointProposalPenalty: {
113
+ env: 'SLASH_ATTEST_INVALID_CHECKPOINT_PROPOSAL_PENALTY',
114
+ description: 'Penalty for attesting to an invalid checkpoint proposal (0 records offenses without slash votes).',
115
+ ...bigintConfigHelper(DefaultSlasherConfig.slashAttestInvalidCheckpointProposalPenalty)
116
116
  },
117
117
  slashUnknownPenalty: {
118
118
  env: 'SLASH_UNKNOWN_PENALTY',
119
- description: 'Penalty amount for slashing a validator for an unknown offense (set to 0 to disable).',
119
+ description: 'Penalty for an unknown offense (0 records offenses without slash votes).',
120
120
  ...bigintConfigHelper(DefaultSlasherConfig.slashUnknownPenalty)
121
121
  },
122
122
  slashOffenseExpirationRounds: {
@@ -130,7 +130,7 @@ export const slasherConfigMappings = {
130
130
  ...numberConfigHelper(DefaultSlasherConfig.slashMaxPayloadSize)
131
131
  },
132
132
  slashGracePeriodL2Slots: {
133
- description: 'Number of L2 slots to wait before considering a slashing offense expired.',
133
+ description: 'Number of L2 slots after the network upgrade during which slashing offenses are ignored. The upgrade time is determined from the CanonicalRollupUpdated event.',
134
134
  env: 'SLASH_GRACE_PERIOD_L2_SLOTS',
135
135
  ...numberConfigHelper(DefaultSlasherConfig.slashGracePeriodL2Slots)
136
136
  },
@@ -3,14 +3,14 @@ import type { L1ReaderConfig } from '@aztec/ethereum/l1-reader';
3
3
  import type { ViemClient } from '@aztec/ethereum/types';
4
4
  import { EthAddress } from '@aztec/foundation/eth-address';
5
5
  import { DateProvider } from '@aztec/foundation/timer';
6
- import type { DataStoreConfig } from '@aztec/kv-store/config';
7
6
  import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
7
+ import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
8
8
  import type { SlasherClientInterface } from '../slasher_client_interface.js';
9
9
  import type { Watcher } from '../watcher.js';
10
10
  /** Creates a slasher client facade that updates itself whenever the rollup slasher changes */
11
11
  export declare function createSlasherFacade(config: SlasherConfig & DataStoreConfig & {
12
12
  ethereumSlotDuration: number;
13
- }, l1Contracts: Pick<L1ReaderConfig['l1Contracts'], 'rollupAddress' | 'slashFactoryAddress'>, l1Client: ViemClient, watchers: Watcher[], dateProvider: DateProvider, epochCache: EpochCache,
13
+ }, l1Contracts: Pick<L1ReaderConfig, 'rollupAddress' | 'registryAddress'>, l1Client: ViemClient, watchers: Watcher[], dateProvider: DateProvider, epochCache: EpochCache,
14
14
  /** List of own validator addresses to add to the slashValidatorNever list unless slashSelfAllowed is true */
15
15
  validatorAddresses?: EthAddress[], logger?: import("@aztec/foundation/log").Logger): Promise<SlasherClientInterface>;
16
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX2ZhY2FkZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4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,EAAO,EACrC,MAAM,yCAA0B,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAwBjC"}
1
+ {"version":3,"file":"create_facade.d.ts","sourceRoot":"","sources":["../../src/factory/create_facade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,8FAA8F;AAC9F,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GAAG,eAAe,GAAG;IAAE,oBAAoB,EAAE,MAAM,CAAA;CAAE,EAC1E,WAAW,EAAE,IAAI,CAAC,cAAc,EAAE,eAAe,GAAG,iBAAiB,CAAC,EACtE,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,OAAO,EAAE,EACnB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU;AACtB,6GAA6G;AAC7G,kBAAkB,GAAE,UAAU,EAAO,EACrC,MAAM,yCAA0B,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAkDjC"}
@@ -1,8 +1,10 @@
1
- import { RollupContract } from '@aztec/ethereum/contracts';
1
+ import { RegistryContract, RollupContract } from '@aztec/ethereum/contracts';
2
+ import { SlotNumber } from '@aztec/foundation/branded-types';
2
3
  import { unique } from '@aztec/foundation/collection';
3
4
  import { EthAddress } from '@aztec/foundation/eth-address';
4
5
  import { createLogger } from '@aztec/foundation/log';
5
6
  import { createStore } from '@aztec/kv-store/lmdb-v2';
7
+ import { getSlotAtTimestamp } from '@aztec/stdlib/epoch-helpers';
6
8
  import { SlasherClientFacade } from '../slasher_client_facade.js';
7
9
  import { SCHEMA_VERSION } from '../stores/schema_version.js';
8
10
  /** Creates a slasher client facade that updates itself whenever the rollup slasher changes */ export async function createSlasherFacade(config, l1Contracts, l1Client, watchers, dateProvider, epochCache, /** List of own validator addresses to add to the slashValidatorNever list unless slashSelfAllowed is true */ validatorAddresses = [], logger = createLogger('slasher')) {
@@ -11,6 +13,27 @@ import { SCHEMA_VERSION } from '../stores/schema_version.js';
11
13
  }
12
14
  const kvStore = await createStore('slasher', SCHEMA_VERSION, config, logger.getBindings());
13
15
  const rollup = new RollupContract(l1Client, l1Contracts.rollupAddress);
16
+ // Compute and cache the L2 slot at which the rollup was registered as canonical
17
+ const settingsMap = kvStore.openMap('slasher-settings');
18
+ const cacheKey = `registeredSlot:${l1Contracts.rollupAddress}`;
19
+ let rollupRegisteredAtL2Slot = await settingsMap.getAsync(cacheKey);
20
+ if (rollupRegisteredAtL2Slot === undefined) {
21
+ const registry = new RegistryContract(l1Client, l1Contracts.registryAddress);
22
+ const l1StartBlock = await rollup.getL1StartBlock();
23
+ const registrationTimestamp = await registry.getCanonicalRollupRegistrationTimestamp(l1Contracts.rollupAddress, l1StartBlock);
24
+ if (registrationTimestamp !== undefined) {
25
+ const l1GenesisTime = await rollup.getL1GenesisTime();
26
+ const slotDuration = await rollup.getSlotDuration();
27
+ rollupRegisteredAtL2Slot = getSlotAtTimestamp(registrationTimestamp, {
28
+ l1GenesisTime,
29
+ slotDuration: Number(slotDuration)
30
+ });
31
+ } else {
32
+ rollupRegisteredAtL2Slot = SlotNumber(0);
33
+ }
34
+ await settingsMap.set(cacheKey, rollupRegisteredAtL2Slot);
35
+ logger.info(`Canonical rollup registered at L2 slot ${rollupRegisteredAtL2Slot}`);
36
+ }
14
37
  const slashValidatorsNever = config.slashSelfAllowed ? config.slashValidatorsNever : unique([
15
38
  ...config.slashValidatorsNever,
16
39
  ...validatorAddresses
@@ -19,5 +42,5 @@ import { SCHEMA_VERSION } from '../stores/schema_version.js';
19
42
  ...config,
20
43
  slashValidatorsNever
21
44
  };
22
- return new SlasherClientFacade(updatedConfig, rollup, l1Client, l1Contracts.slashFactoryAddress, watchers, epochCache, dateProvider, kvStore, logger);
45
+ return new SlasherClientFacade(updatedConfig, rollup, l1Client, watchers, epochCache, dateProvider, kvStore, rollupRegisteredAtL2Slot, logger);
23
46
  }
@@ -1,17 +1,16 @@
1
1
  import { EpochCache } from '@aztec/epoch-cache';
2
2
  import { RollupContract } from '@aztec/ethereum/contracts';
3
3
  import type { ViemClient } from '@aztec/ethereum/types';
4
- import { EthAddress } from '@aztec/foundation/eth-address';
4
+ import type { SlotNumber } from '@aztec/foundation/branded-types';
5
5
  import { DateProvider } from '@aztec/foundation/timer';
6
- import type { DataStoreConfig } from '@aztec/kv-store/config';
7
6
  import { AztecLMDBStoreV2 } from '@aztec/kv-store/lmdb-v2';
8
7
  import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
9
- import { EmpireSlasherClient } from '../empire_slasher_client.js';
8
+ import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
10
9
  import { NullSlasherClient } from '../null_slasher_client.js';
11
- import { TallySlasherClient } from '../tally_slasher_client.js';
10
+ import { SlasherClient } from '../slasher_client.js';
12
11
  import type { Watcher } from '../watcher.js';
13
- /** Creates a slasher client implementation (either tally or empire) based on the slasher proposer type in the rollup */
12
+ /** Creates a slasher client implementation based on the slasher proposer type in the rollup */
14
13
  export declare function createSlasherImplementation(config: SlasherConfig & DataStoreConfig & {
15
14
  ethereumSlotDuration: number;
16
- }, rollup: RollupContract, l1Client: ViemClient, slashFactoryAddress: EthAddress | undefined, watchers: Watcher[], epochCache: EpochCache, dateProvider: DateProvider, kvStore: AztecLMDBStoreV2, logger?: import("@aztec/foundation/log").Logger): Promise<EmpireSlasherClient | NullSlasherClient | TallySlasherClient>;
17
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX2ltcGxlbWVudGF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmFjdG9yeS9jcmVhdGVfaW1wbGVtZW50YXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ2hELE9BQU8sRUFFTCxjQUFjLEVBRWYsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUN4RCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFM0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3ZELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzlELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBR3JFLE9BQU8sRUFBRSxtQkFBbUIsRUFBOEIsTUFBTSw2QkFBNkIsQ0FBQztBQUM5RixPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUc5RCxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFHN0Msd0hBQXdIO0FBQ3hILHdCQUFzQiwyQkFBMkIsQ0FDL0MsTUFBTSxFQUFFLGFBQWEsR0FBRyxlQUFlLEdBQUc7SUFBRSxvQkFBb0IsRUFBRSxNQUFNLENBQUE7Q0FBRSxFQUMxRSxNQUFNLEVBQUUsY0FBYyxFQUN0QixRQUFRLEVBQUUsVUFBVSxFQUNwQixtQkFBbUIsRUFBRSxVQUFVLEdBQUcsU0FBUyxFQUMzQyxRQUFRLEVBQUUsT0FBTyxFQUFFLEVBQ25CLFVBQVUsRUFBRSxVQUFVLEVBQ3RCLFlBQVksRUFBRSxZQUFZLEVBQzFCLE9BQU8sRUFBRSxnQkFBZ0IsRUFDekIsTUFBTSx5Q0FBMEIseUVBY2pDIn0=
15
+ }, rollup: RollupContract, l1Client: ViemClient, watchers: Watcher[], epochCache: EpochCache, dateProvider: DateProvider, kvStore: AztecLMDBStoreV2, rollupRegisteredAtL2Slot: SlotNumber, logger?: import("@aztec/foundation/log").Logger): Promise<NullSlasherClient | SlasherClient>;
16
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX2ltcGxlbWVudGF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmFjdG9yeS9jcmVhdGVfaW1wbGVtZW50YXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ2hELE9BQU8sRUFBRSxjQUFjLEVBQTRCLE1BQU0sMkJBQTJCLENBQUM7QUFDckYsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDeEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFbEUsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlC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AAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,+FAA+F;AAC/F,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,aAAa,GAAG,eAAe,GAAG;IAAE,oBAAoB,EAAE,MAAM,CAAA;CAAE,EAC1E,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,OAAO,EAAE,EACnB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,gBAAgB,EACzB,wBAAwB,EAAE,UAAU,EACpC,MAAM,yCAA0B,8CAkBjC"}
@@ -1,73 +1,25 @@
1
- import { EthAddress } from '@aztec/foundation/eth-address';
2
1
  import { createLogger } from '@aztec/foundation/log';
3
- import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
4
- import { EmpireSlasherClient } from '../empire_slasher_client.js';
5
2
  import { NullSlasherClient } from '../null_slasher_client.js';
3
+ import { SlasherClient } from '../slasher_client.js';
6
4
  import { SlasherOffensesStore } from '../stores/offenses_store.js';
7
- import { SlasherPayloadsStore } from '../stores/payloads_store.js';
8
- import { TallySlasherClient } from '../tally_slasher_client.js';
9
- import { getTallySlasherSettings } from './get_settings.js';
10
- /** Creates a slasher client implementation (either tally or empire) based on the slasher proposer type in the rollup */ export async function createSlasherImplementation(config, rollup, l1Client, slashFactoryAddress, watchers, epochCache, dateProvider, kvStore, logger = createLogger('slasher')) {
5
+ import { getSlasherSettings } from './get_settings.js';
6
+ /** Creates a slasher client implementation based on the slasher proposer type in the rollup */ export async function createSlasherImplementation(config, rollup, l1Client, watchers, epochCache, dateProvider, kvStore, rollupRegisteredAtL2Slot, logger = createLogger('slasher')) {
11
7
  const proposer = await rollup.getSlashingProposer();
12
8
  if (!proposer) {
13
9
  return new NullSlasherClient(config);
14
- } else if (proposer.type === 'tally') {
15
- return createTallySlasher(config, rollup, proposer, watchers, dateProvider, epochCache, kvStore, logger);
16
10
  } else {
17
- if (!slashFactoryAddress || slashFactoryAddress.equals(EthAddress.ZERO)) {
18
- throw new Error('Cannot initialize an empire-based SlasherClient without a SlashFactory address');
19
- }
20
- const slashFactory = new SlashFactoryContract(l1Client, slashFactoryAddress.toString());
21
- return createEmpireSlasher(config, rollup, proposer, slashFactory, watchers, dateProvider, kvStore, logger);
11
+ return createSlasher(config, rollup, proposer, watchers, dateProvider, epochCache, kvStore, rollupRegisteredAtL2Slot, logger);
22
12
  }
23
13
  }
24
- async function createEmpireSlasher(config, rollup, slashingProposer, slashFactoryContract, watchers, dateProvider, kvStore, logger = createLogger('slasher')) {
25
- if (slashingProposer.type !== 'empire') {
26
- throw new Error('Slashing proposer contract is not of type Empire');
27
- }
28
- const [slashingExecutionDelayInRounds, slashingPayloadLifetimeInRounds, slashingRoundSize, slashingQuorumSize, epochDuration, proofSubmissionEpochs, l1GenesisTime, slotDuration, l1StartBlock, slasher] = await Promise.all([
29
- slashingProposer.getExecutionDelayInRounds(),
30
- slashingProposer.getLifetimeInRounds(),
31
- slashingProposer.getRoundSize(),
32
- slashingProposer.getQuorumSize(),
33
- rollup.getEpochDuration(),
34
- rollup.getProofSubmissionEpochs(),
35
- rollup.getL1GenesisTime(),
36
- rollup.getSlotDuration(),
37
- rollup.getL1StartBlock(),
38
- rollup.getSlasherContract()
39
- ]);
14
+ async function createSlasher(config, rollup, slashingProposer, watchers, dateProvider, epochCache, kvStore, rollupRegisteredAtL2Slot, logger = createLogger('slasher')) {
40
15
  const settings = {
41
- slashingExecutionDelayInRounds: Number(slashingExecutionDelayInRounds),
42
- slashingPayloadLifetimeInRounds: Number(slashingPayloadLifetimeInRounds),
43
- slashingRoundSize: Number(slashingRoundSize),
44
- slashingQuorumSize: Number(slashingQuorumSize),
45
- epochDuration: Number(epochDuration),
46
- proofSubmissionEpochs: Number(proofSubmissionEpochs),
47
- l1GenesisTime: l1GenesisTime,
48
- slotDuration: Number(slotDuration),
49
- l1StartBlock,
50
- ethereumSlotDuration: config.ethereumSlotDuration,
51
- slashingAmounts: undefined
16
+ ...await getSlasherSettings(rollup, slashingProposer),
17
+ rollupRegisteredAtL2Slot
52
18
  };
53
- const payloadsStore = new SlasherPayloadsStore(kvStore, {
54
- slashingPayloadLifetimeInRounds: settings.slashingPayloadLifetimeInRounds
55
- });
56
- const offensesStore = new SlasherOffensesStore(kvStore, {
57
- ...settings,
58
- slashOffenseExpirationRounds: config.slashOffenseExpirationRounds
59
- });
60
- return new EmpireSlasherClient(config, settings, slashFactoryContract, slashingProposer, slasher, rollup, watchers, dateProvider, offensesStore, payloadsStore, logger);
61
- }
62
- async function createTallySlasher(config, rollup, slashingProposer, watchers, dateProvider, epochCache, kvStore, logger = createLogger('slasher')) {
63
- if (slashingProposer.type !== 'tally') {
64
- throw new Error('Slashing proposer contract is not of type tally');
65
- }
66
- const settings = await getTallySlasherSettings(rollup, slashingProposer);
67
19
  const slasher = await rollup.getSlasherContract();
68
20
  const offensesStore = new SlasherOffensesStore(kvStore, {
69
21
  ...settings,
70
22
  slashOffenseExpirationRounds: config.slashOffenseExpirationRounds
71
23
  });
72
- return new TallySlasherClient(config, settings, slashingProposer, slasher, rollup, watchers, epochCache, dateProvider, offensesStore, logger);
24
+ return new SlasherClient(config, settings, slashingProposer, slasher, rollup, watchers, epochCache, dateProvider, offensesStore, logger);
73
25
  }
@@ -1,4 +1,4 @@
1
- import type { RollupContract, TallySlashingProposerContract } from '@aztec/ethereum/contracts';
2
- import type { TallySlasherSettings } from '../tally_slasher_client.js';
3
- export declare function getTallySlasherSettings(rollup: RollupContract, slashingProposer?: TallySlashingProposerContract): Promise<TallySlasherSettings>;
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3NldHRpbmdzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmFjdG9yeS9nZXRfc2V0dGluZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFL0YsT0FBTyxLQUFLLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUV2RSx3QkFBc0IsdUJBQXVCLENBQzNDLE1BQU0sRUFBRSxjQUFjLEVBQ3RCLGdCQUFnQixDQUFDLEVBQUUsNkJBQTZCLEdBQy9DLE9BQU8sQ0FBQyxvQkFBb0IsQ0FBQyxDQWtEL0IifQ==
1
+ import type { RollupContract, SlashingProposerContract } from '@aztec/ethereum/contracts';
2
+ import type { SlasherSettings } from '../slasher_client.js';
3
+ export declare function getSlasherSettings(rollup: RollupContract, slashingProposer?: SlashingProposerContract): Promise<Omit<SlasherSettings, 'rollupRegisteredAtL2Slot'>>;
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3NldHRpbmdzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmFjdG9yeS9nZXRfc2V0dGluZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFMUYsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFNUQsd0JBQXNCLGtCQUFrQixDQUN0QyxNQUFNLEVBQUUsY0FBYyxFQUN0QixnQkFBZ0IsQ0FBQyxFQUFFLHdCQUF3QixHQUMxQyxPQUFPLENBQUMsSUFBSSxDQUFDLGVBQWUsRUFBRSwwQkFBMEIsQ0FBQyxDQUFDLENBa0Q1RCJ9