@aztec/slasher 0.0.1-commit.f504929 → 0.0.1-commit.f650c0a5c
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.
- package/README.md +28 -52
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +0 -12
- package/dest/factory/create_facade.d.ts +3 -3
- package/dest/factory/create_facade.d.ts.map +1 -1
- package/dest/factory/create_facade.js +1 -1
- package/dest/factory/create_implementation.d.ts +5 -7
- package/dest/factory/create_implementation.d.ts.map +1 -1
- package/dest/factory/create_implementation.js +7 -59
- package/dest/factory/get_settings.d.ts +4 -4
- package/dest/factory/get_settings.d.ts.map +1 -1
- package/dest/factory/get_settings.js +3 -3
- package/dest/factory/index.d.ts +2 -2
- package/dest/factory/index.d.ts.map +1 -1
- package/dest/factory/index.js +1 -1
- package/dest/generated/slasher-defaults.d.ts +1 -3
- package/dest/generated/slasher-defaults.d.ts.map +1 -1
- package/dest/generated/slasher-defaults.js +0 -2
- package/dest/index.d.ts +2 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/null_slasher_client.d.ts +3 -4
- package/dest/null_slasher_client.d.ts.map +1 -1
- package/dest/null_slasher_client.js +1 -4
- package/dest/slash_offenses_collector.d.ts +1 -7
- package/dest/slash_offenses_collector.d.ts.map +1 -1
- package/dest/slash_offenses_collector.js +7 -16
- package/dest/slasher_client.d.ts +112 -0
- package/dest/slasher_client.d.ts.map +1 -0
- package/dest/{tally_slasher_client.js → slasher_client.js} +22 -43
- package/dest/slasher_client_facade.d.ts +5 -8
- package/dest/slasher_client_facade.d.ts.map +1 -1
- package/dest/slasher_client_facade.js +4 -9
- package/dest/slasher_client_interface.d.ts +7 -21
- package/dest/slasher_client_interface.d.ts.map +1 -1
- package/dest/slasher_client_interface.js +1 -4
- package/dest/stores/offenses_store.d.ts +6 -12
- package/dest/stores/offenses_store.d.ts.map +1 -1
- package/dest/stores/offenses_store.js +5 -24
- package/dest/watchers/epoch_prune_watcher.d.ts +1 -1
- package/dest/watchers/epoch_prune_watcher.d.ts.map +1 -1
- package/dest/watchers/epoch_prune_watcher.js +4 -1
- package/package.json +9 -9
- package/src/config.ts +0 -12
- package/src/factory/create_facade.ts +2 -3
- package/src/factory/create_implementation.ts +12 -118
- package/src/factory/get_settings.ts +8 -8
- package/src/factory/index.ts +1 -1
- package/src/generated/slasher-defaults.ts +0 -2
- package/src/index.ts +1 -2
- package/src/null_slasher_client.ts +2 -6
- package/src/slash_offenses_collector.ts +8 -17
- package/src/{tally_slasher_client.ts → slasher_client.ts} +27 -49
- package/src/slasher_client_facade.ts +4 -11
- package/src/slasher_client_interface.ts +6 -21
- package/src/stores/offenses_store.ts +8 -33
- package/src/watchers/epoch_prune_watcher.ts +4 -1
- package/dest/empire_slasher_client.d.ts +0 -190
- package/dest/empire_slasher_client.d.ts.map +0 -1
- package/dest/empire_slasher_client.js +0 -564
- package/dest/stores/payloads_store.d.ts +0 -29
- package/dest/stores/payloads_store.d.ts.map +0 -1
- package/dest/stores/payloads_store.js +0 -128
- package/dest/tally_slasher_client.d.ts +0 -125
- package/dest/tally_slasher_client.d.ts.map +0 -1
- package/src/empire_slasher_client.ts +0 -649
- package/src/stores/payloads_store.ts +0 -149
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
|
|
19
|
+
## Slashing Model
|
|
20
20
|
|
|
21
|
-
The
|
|
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
|
-
|
|
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
|
|
77
|
-
- `execute-slash`: Execute slashing for a round that reached quorum
|
|
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,39 +81,39 @@ 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.
|
|
84
|
+
**Description**: The data required for proving an epoch was not made publicly available.
|
|
85
|
+
**Detection**: EpochPruneWatcher detects when an epoch cannot be proven due to missing data.
|
|
86
|
+
**Target**: Committee members of the affected epoch.
|
|
107
87
|
**Time Unit**: Epoch-based offense.
|
|
108
88
|
|
|
109
89
|
### 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.
|
|
90
|
+
**Description**: An epoch was not successfully proven within the proof submission window.
|
|
91
|
+
**Detection**: EpochPruneWatcher monitors epochs that expire without valid proofs.
|
|
92
|
+
**Target**: Committee members of the unpruned epoch.
|
|
113
93
|
**Time Unit**: Epoch-based offense.
|
|
114
94
|
|
|
115
95
|
### 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.
|
|
96
|
+
**Description**: A proposer failed to attest or propose blocks during their assigned slots.
|
|
97
|
+
**Detection**: Sentinel tracks validator performance and identifies validators who miss attestations beyond threshold.
|
|
98
|
+
**Target**: Individual inactive validator.
|
|
119
99
|
**Time Unit**: Epoch-based offense.
|
|
120
100
|
|
|
121
101
|
### 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.
|
|
102
|
+
**Description**: A proposer broadcast an invalid block proposal over the p2p network.
|
|
103
|
+
**Detection**: Validators detect invalid proposals during attestation validation.
|
|
104
|
+
**Target**: Proposer who broadcast the invalid block.
|
|
105
|
+
**Time Unit**: Slot-based offense.
|
|
126
106
|
|
|
127
107
|
### 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.
|
|
108
|
+
**Description**: A proposer submitted a block to L1 without sufficient committee attestations.
|
|
109
|
+
**Detection**: AttestationsBlockWatcher checks L1 blocks for attestation count.
|
|
110
|
+
**Target**: Block proposer.
|
|
131
111
|
**Time Unit**: Slot-based offense.
|
|
132
112
|
|
|
133
113
|
### 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.
|
|
114
|
+
**Description**: A proposer submitted a block to L1 with signatures from non-committee members.
|
|
115
|
+
**Detection**: AttestationsBlockWatcher validates attestation signatures against committee membership.
|
|
116
|
+
**Target**: Block proposer.
|
|
137
117
|
**Time Unit**: Slot-based offense.
|
|
138
118
|
|
|
139
119
|
### ATTESTED_DESCENDANT_OF_INVALID
|
|
@@ -155,15 +135,15 @@ These settings are deployed with the L1 contracts and apply system-wide to the p
|
|
|
155
135
|
|
|
156
136
|
- `slashingQuorumSize`: Votes required to slash (defaults to half the validators in a round, plus one)
|
|
157
137
|
- `slashingRoundSizeInEpochs`: Number of epochs per slashing round
|
|
158
|
-
- `slashingOffsetInRounds`: How many rounds to look back for offenses
|
|
138
|
+
- `slashingOffsetInRounds`: How many rounds to look back for offenses
|
|
159
139
|
- `slashingExecutionDelayInRounds`: Rounds to wait before execution
|
|
160
140
|
- `slashingLifetimeInRounds`: Maximum age of executable rounds
|
|
161
|
-
- `slashingAmounts`: Valid values for each individual slash
|
|
141
|
+
- `slashingAmounts`: Valid values for each individual slash
|
|
162
142
|
|
|
163
143
|
Considerations:
|
|
164
144
|
|
|
165
145
|
- 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
|
|
146
|
+
- 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.
|
|
167
147
|
- 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.
|
|
168
148
|
- 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
149
|
|
|
@@ -185,9 +165,7 @@ These settings are configured locally on each validator node:
|
|
|
185
165
|
- `slashProposeInvalidAttestationsPenalty`: Penalty for PROPOSED_INSUFFICIENT_ATTESTATIONS and PROPOSED_INCORRECT_ATTESTATIONS
|
|
186
166
|
- `slashAttestDescendantOfInvalidPenalty`: Penalty for ATTESTED_DESCENDANT_OF_INVALID
|
|
187
167
|
- `slashUnknownPenalty`: Default penalty for unknown offense types
|
|
188
|
-
- `slashMaxPayloadSize`:
|
|
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)
|
|
168
|
+
- `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
169
|
|
|
192
170
|
Considerations:
|
|
193
171
|
|
|
@@ -224,5 +202,3 @@ total_failures / total >= slash_inactivity_target_percentage
|
|
|
224
202
|
```
|
|
225
203
|
|
|
226
204
|
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
|
-
|
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,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFRbkUsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFJckUsWUFBWSxFQUFFLGFBQWEsRUFBRSxDQUFDO0FBRTlCLGVBQU8sTUFBTSxvQkFBb0IsRUFBRSxhQW9CbEMsQ0FBQztBQUVGLGVBQU8sTUFBTSxxQkFBcUIsRUFBRSxrQkFBa0IsQ0FBQyxhQUFhLENBMkhuRSxDQUFDIn0=
|
package/dest/config.d.ts.map
CHANGED
|
@@ -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,
|
|
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,aAoBlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,kBAAkB,CAAC,aAAa,CA2HnE,CAAC"}
|
package/dest/config.js
CHANGED
|
@@ -3,8 +3,6 @@ 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
8
|
slashPrunePenalty: BigInt(slasherDefaultEnv.SLASH_PRUNE_PENALTY),
|
|
@@ -31,16 +29,6 @@ export const slasherConfigMappings = {
|
|
|
31
29
|
parseEnv: (val)=>val ? EthAddress.fromString(val) : undefined,
|
|
32
30
|
defaultValue: DefaultSlasherConfig.slashOverridePayload
|
|
33
31
|
},
|
|
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
32
|
slashValidatorsAlways: {
|
|
45
33
|
env: 'SLASH_VALIDATORS_ALWAYS',
|
|
46
34
|
description: 'Comma-separated list of validator addresses that should always be slashed.',
|
|
@@ -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' | '
|
|
13
|
+
}, l1Contracts: Pick<L1ReaderConfig['l1Contracts'], '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,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX2ZhY2FkZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZhY3RvcnkvY3JlYXRlX2ZhY2FkZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFaEQsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHeEQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRTNELE9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AE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
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,CAAC,aAAa,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAAC,EACrF,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"}
|
|
@@ -42,5 +42,5 @@ import { SCHEMA_VERSION } from '../stores/schema_version.js';
|
|
|
42
42
|
...config,
|
|
43
43
|
slashValidatorsNever
|
|
44
44
|
};
|
|
45
|
-
return new SlasherClientFacade(updatedConfig, rollup, l1Client,
|
|
45
|
+
return new SlasherClientFacade(updatedConfig, rollup, l1Client, watchers, epochCache, dateProvider, kvStore, rollupRegisteredAtL2Slot, logger);
|
|
46
46
|
}
|
|
@@ -2,17 +2,15 @@ import { EpochCache } from '@aztec/epoch-cache';
|
|
|
2
2
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
3
3
|
import type { ViemClient } from '@aztec/ethereum/types';
|
|
4
4
|
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
5
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
5
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
7
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
8
6
|
import { AztecLMDBStoreV2 } from '@aztec/kv-store/lmdb-v2';
|
|
9
7
|
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import {
|
|
8
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
11
9
|
import { NullSlasherClient } from '../null_slasher_client.js';
|
|
12
|
-
import {
|
|
10
|
+
import { SlasherClient } from '../slasher_client.js';
|
|
13
11
|
import type { Watcher } from '../watcher.js';
|
|
14
|
-
/** Creates a slasher client implementation
|
|
12
|
+
/** Creates a slasher client implementation based on the slasher proposer type in the rollup */
|
|
15
13
|
export declare function createSlasherImplementation(config: SlasherConfig & DataStoreConfig & {
|
|
16
14
|
ethereumSlotDuration: number;
|
|
17
|
-
}, rollup: RollupContract, l1Client: ViemClient,
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX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BQ25CLFVBQVUsRUFBRSxVQUFVLEVBQ3RCLFlBQVksRUFBRSxZQUFZLEVBQzFCLE9BQU8sRUFBRSxnQkFBZ0IsRUFDekIsd0JBQXdCLEVBQUUsVUFBVSxFQUNwQyxNQUFNLHlDQUEwQiw4Q0FrQmpDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_implementation.d.ts","sourceRoot":"","sources":["../../src/factory/create_implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"create_implementation.d.ts","sourceRoot":"","sources":["../../src/factory/create_implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAA4B,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,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,71 +1,19 @@
|
|
|
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 {
|
|
8
|
-
|
|
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, rollupRegisteredAtL2Slot, 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, rollupRegisteredAtL2Slot, logger);
|
|
16
10
|
} else {
|
|
17
|
-
|
|
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, rollupRegisteredAtL2Slot, logger);
|
|
11
|
+
return createSlasher(config, rollup, proposer, watchers, dateProvider, epochCache, kvStore, rollupRegisteredAtL2Slot, logger);
|
|
22
12
|
}
|
|
23
13
|
}
|
|
24
|
-
async function
|
|
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
|
-
]);
|
|
40
|
-
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,
|
|
52
|
-
rollupRegisteredAtL2Slot
|
|
53
|
-
};
|
|
54
|
-
const payloadsStore = new SlasherPayloadsStore(kvStore, {
|
|
55
|
-
slashingPayloadLifetimeInRounds: settings.slashingPayloadLifetimeInRounds
|
|
56
|
-
});
|
|
57
|
-
const offensesStore = new SlasherOffensesStore(kvStore, {
|
|
58
|
-
...settings,
|
|
59
|
-
slashOffenseExpirationRounds: config.slashOffenseExpirationRounds
|
|
60
|
-
});
|
|
61
|
-
return new EmpireSlasherClient(config, settings, slashFactoryContract, slashingProposer, slasher, rollup, watchers, dateProvider, offensesStore, payloadsStore, logger);
|
|
62
|
-
}
|
|
63
|
-
async function createTallySlasher(config, rollup, slashingProposer, watchers, dateProvider, epochCache, kvStore, rollupRegisteredAtL2Slot, logger = createLogger('slasher')) {
|
|
64
|
-
if (slashingProposer.type !== 'tally') {
|
|
65
|
-
throw new Error('Slashing proposer contract is not of type tally');
|
|
66
|
-
}
|
|
14
|
+
async function createSlasher(config, rollup, slashingProposer, watchers, dateProvider, epochCache, kvStore, rollupRegisteredAtL2Slot, logger = createLogger('slasher')) {
|
|
67
15
|
const settings = {
|
|
68
|
-
...await
|
|
16
|
+
...await getSlasherSettings(rollup, slashingProposer),
|
|
69
17
|
rollupRegisteredAtL2Slot
|
|
70
18
|
};
|
|
71
19
|
const slasher = await rollup.getSlasherContract();
|
|
@@ -73,5 +21,5 @@ async function createTallySlasher(config, rollup, slashingProposer, watchers, da
|
|
|
73
21
|
...settings,
|
|
74
22
|
slashOffenseExpirationRounds: config.slashOffenseExpirationRounds
|
|
75
23
|
});
|
|
76
|
-
return new
|
|
24
|
+
return new SlasherClient(config, settings, slashingProposer, slasher, rollup, watchers, epochCache, dateProvider, offensesStore, logger);
|
|
77
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RollupContract,
|
|
2
|
-
import type {
|
|
3
|
-
export declare function
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_settings.d.ts","sourceRoot":"","sources":["../../src/factory/get_settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"get_settings.d.ts","sourceRoot":"","sources":["../../src/factory/get_settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,cAAc,EACtB,gBAAgB,CAAC,EAAE,wBAAwB,GAC1C,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,0BAA0B,CAAC,CAAC,CAkD5D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export async function
|
|
1
|
+
export async function getSlasherSettings(rollup, slashingProposer) {
|
|
2
2
|
if (!slashingProposer) {
|
|
3
3
|
const rollupSlashingProposer = await rollup.getSlashingProposer();
|
|
4
|
-
if (!rollupSlashingProposer
|
|
5
|
-
throw new Error('Rollup slashing proposer
|
|
4
|
+
if (!rollupSlashingProposer) {
|
|
5
|
+
throw new Error('Rollup slashing proposer not found');
|
|
6
6
|
}
|
|
7
7
|
slashingProposer = rollupSlashingProposer;
|
|
8
8
|
}
|
package/dest/factory/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createSlasherFacade as createSlasher } from './create_facade.js';
|
|
2
|
-
export {
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
export { getSlasherSettings } from './get_settings.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9mYWN0b3J5L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxtQkFBbUIsSUFBSSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUMxRSxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dest/factory/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { createSlasherFacade as createSlasher } from './create_facade.js';
|
|
2
|
-
export {
|
|
2
|
+
export { getSlasherSettings } from './get_settings.js';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/** Default slasher configuration values from network-defaults.yml */
|
|
2
2
|
export declare const slasherDefaultEnv: {
|
|
3
|
-
readonly SLASH_MIN_PENALTY_PERCENTAGE: 0.5;
|
|
4
|
-
readonly SLASH_MAX_PENALTY_PERCENTAGE: 2;
|
|
5
3
|
readonly SLASH_OFFENSE_EXPIRATION_ROUNDS: 4;
|
|
6
4
|
readonly SLASH_MAX_PAYLOAD_SIZE: 80;
|
|
7
5
|
readonly SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4;
|
|
@@ -18,4 +16,4 @@ export declare const slasherDefaultEnv: {
|
|
|
18
16
|
readonly SLASH_INVALID_BLOCK_PENALTY: 10000000000000000000;
|
|
19
17
|
readonly SLASH_GRACE_PERIOD_L2_SLOTS: 0;
|
|
20
18
|
};
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xhc2hlci1kZWZhdWx0cy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2dlbmVyYXRlZC9zbGFzaGVyLWRlZmF1bHRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLHFFQUFxRTtBQUNyRSxlQUFPLE1BQU0saUJBQWlCOzs7Ozs7Ozs7Ozs7Ozs7O0NBZ0JwQixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slasher-defaults.d.ts","sourceRoot":"","sources":["../../src/generated/slasher-defaults.ts"],"names":[],"mappings":"AAGA,qEAAqE;AACrE,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"slasher-defaults.d.ts","sourceRoot":"","sources":["../../src/generated/slasher-defaults.ts"],"names":[],"mappings":"AAGA,qEAAqE;AACrE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;CAgBpB,CAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Auto-generated from spartan/environments/network-defaults.yml
|
|
2
2
|
// Do not edit manually - run yarn generate to regenerate
|
|
3
3
|
/** Default slasher configuration values from network-defaults.yml */ export const slasherDefaultEnv = {
|
|
4
|
-
SLASH_MIN_PENALTY_PERCENTAGE: 0.5,
|
|
5
|
-
SLASH_MAX_PENALTY_PERCENTAGE: 2,
|
|
6
4
|
SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
|
|
7
5
|
SLASH_MAX_PAYLOAD_SIZE: 80,
|
|
8
6
|
SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
|
package/dest/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export * from './config.js';
|
|
2
2
|
export * from './watchers/epoch_prune_watcher.js';
|
|
3
3
|
export * from './watchers/attestations_block_watcher.js';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './tally_slasher_client.js';
|
|
4
|
+
export * from './slasher_client.js';
|
|
6
5
|
export * from './slash_offenses_collector.js';
|
|
7
6
|
export * from './slasher_client_interface.js';
|
|
8
7
|
export * from './factory/index.js';
|
|
9
8
|
export * from './watcher.js';
|
|
10
9
|
export * from '@aztec/stdlib/slashing';
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLG1DQUFtQyxDQUFDO0FBQ2xELGNBQWMsMENBQTBDLENBQUM7QUFDekQsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLCtCQUErQixDQUFDO0FBQzlDLGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLHdCQUF3QixDQUFDIn0=
|
package/dest/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
|
package/dest/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export * from './config.js';
|
|
2
2
|
export * from './watchers/epoch_prune_watcher.js';
|
|
3
3
|
export * from './watchers/attestations_block_watcher.js';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './tally_slasher_client.js';
|
|
4
|
+
export * from './slasher_client.js';
|
|
6
5
|
export * from './slash_offenses_collector.js';
|
|
7
6
|
export * from './slasher_client_interface.js';
|
|
8
7
|
export * from './factory/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type { Offense, ProposerSlashAction
|
|
2
|
+
import type { Offense, ProposerSlashAction } from '@aztec/stdlib/slashing';
|
|
3
3
|
import type { SlasherConfig } from './config.js';
|
|
4
4
|
import type { SlasherClientInterface } from './slasher_client_interface.js';
|
|
5
5
|
export declare class NullSlasherClient implements SlasherClientInterface {
|
|
@@ -7,11 +7,10 @@ export declare class NullSlasherClient implements SlasherClientInterface {
|
|
|
7
7
|
constructor(config: SlasherConfig);
|
|
8
8
|
start(): Promise<void>;
|
|
9
9
|
stop(): Promise<void>;
|
|
10
|
-
getSlashPayloads(): Promise<SlashPayloadRound[]>;
|
|
11
10
|
gatherOffensesForRound(_round?: bigint): Promise<Offense[]>;
|
|
12
|
-
|
|
11
|
+
getOffenses(): Promise<Offense[]>;
|
|
13
12
|
updateConfig(config: Partial<SlasherConfig>): void;
|
|
14
13
|
getProposerActions(_slotNumber: SlotNumber): Promise<ProposerSlashAction[]>;
|
|
15
14
|
getConfig(): SlasherConfig;
|
|
16
15
|
}
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVsbF9zbGFzaGVyX2NsaWVudC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL251bGxfc2xhc2hlcl9jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFM0UsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQ2pELE9BQU8sS0FBSyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFNUUscUJBQWEsaUJBQWtCLFlBQVcsc0JBQXNCO0lBQ2xELE9BQU8sQ0FBQyxNQUFNO0lBQTFCLFlBQW9CLE1BQU0sRUFBRSxhQUFhLEVBQUk7SUFFdEMsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFNUI7SUFFTSxJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUzQjtJQUVNLHNCQUFzQixDQUFDLE1BQU0sQ0FBQyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FFakU7SUFFTSxXQUFXLElBQUksT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDLENBRXZDO0lBRU0sWUFBWSxDQUFDLE1BQU0sRUFBRSxPQUFPLENBQUMsYUFBYSxDQUFDLEdBQUcsSUFBSSxDQUV4RDtJQUVNLGtCQUFrQixDQUFDLFdBQVcsRUFBRSxVQUFVLEdBQUcsT0FBTyxDQUFDLG1CQUFtQixFQUFFLENBQUMsQ0FFakY7SUFFTSxTQUFTLElBQUksYUFBYSxDQUVoQztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"null_slasher_client.d.ts","sourceRoot":"","sources":["../src/null_slasher_client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"null_slasher_client.d.ts","sourceRoot":"","sources":["../src/null_slasher_client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,qBAAa,iBAAkB,YAAW,sBAAsB;IAClD,OAAO,CAAC,MAAM;IAA1B,YAAoB,MAAM,EAAE,aAAa,EAAI;IAEtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;IAEM,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAEM,sBAAsB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEjE;IAEM,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAEvC;IAEM,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAExD;IAEM,kBAAkB,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAEjF;IAEM,SAAS,IAAI,aAAa,CAEhC;CACF"}
|
|
@@ -9,13 +9,10 @@ export class NullSlasherClient {
|
|
|
9
9
|
stop() {
|
|
10
10
|
return Promise.resolve();
|
|
11
11
|
}
|
|
12
|
-
getSlashPayloads() {
|
|
13
|
-
return Promise.resolve([]);
|
|
14
|
-
}
|
|
15
12
|
gatherOffensesForRound(_round) {
|
|
16
13
|
return Promise.resolve([]);
|
|
17
14
|
}
|
|
18
|
-
|
|
15
|
+
getOffenses() {
|
|
19
16
|
return Promise.resolve([]);
|
|
20
17
|
}
|
|
21
18
|
updateConfig(config) {
|
|
@@ -2,7 +2,6 @@ import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
import type { Prettify } from '@aztec/foundation/types';
|
|
3
3
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
4
4
|
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
5
|
-
import { type OffenseIdentifier } from '@aztec/stdlib/slashing';
|
|
6
5
|
import type { SlasherOffensesStore } from './stores/offenses_store.js';
|
|
7
6
|
import { type WantToSlashArgs, type Watcher } from './watcher.js';
|
|
8
7
|
export type SlashOffensesCollectorConfig = Prettify<Pick<SlasherConfig, 'slashGracePeriodL2Slots'>>;
|
|
@@ -37,12 +36,7 @@ export declare class SlashOffensesCollector {
|
|
|
37
36
|
* Clears expired offenses from stores.
|
|
38
37
|
*/
|
|
39
38
|
handleNewRound(round: bigint): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Marks offenses as slashed (no longer pending)
|
|
42
|
-
* @param offenses - The offenses to mark as slashed
|
|
43
|
-
*/
|
|
44
|
-
markAsSlashed(offenses: OffenseIdentifier[]): Promise<void>;
|
|
45
39
|
/** Returns whether to skip an offense if it happened during the grace period after the network upgrade */
|
|
46
40
|
private shouldSkipOffense;
|
|
47
41
|
}
|
|
48
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xhc2hfb2ZmZW5zZXNfY29sbGVjdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc2xhc2hfb2ZmZW5zZXNfY29sbGVjdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRWxFLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3hELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDckUsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFHckUsT0FBTyxLQUFLLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUN2RSxPQUFPLEVBQXVCLEtBQUssZUFBZSxFQUFFLEtBQUssT0FBTyxFQUFFLE1BQU0sY0FBYyxDQUFDO0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MEdBQTBHO0lBQzFHLE9BQU8sQ0FBQyxpQkFBaUI7Q0FJMUIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash_offenses_collector.d.ts","sourceRoot":"","sources":["../src/slash_offenses_collector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"slash_offenses_collector.d.ts","sourceRoot":"","sources":["../src/slash_offenses_collector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAuB,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvF,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC,CAAC;AACpG,MAAM,MAAM,8BAA8B,GAAG,QAAQ,CACnD,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAAG;IACzC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACtD,sHAAsH;IACtH,wBAAwB,EAAE,UAAU,CAAC;CACtC,CACF,CAAC;AAEF;;;;GAIG;AACH,qBAAa,sBAAsB;IA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