@aztec/slasher 2.1.0-rc.9 → 2.1.2
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.
|
@@ -95,6 +95,7 @@ export declare class TallySlasherClient implements ProposerSlashActionProvider,
|
|
|
95
95
|
/**
|
|
96
96
|
* Checks if a given round is executable and returns an execute-slash action for it if so.
|
|
97
97
|
* Assumes round number has already been checked against lifetime and execution delay.
|
|
98
|
+
* @param executableRound - The round to check for execution
|
|
98
99
|
*/
|
|
99
100
|
private tryGetRoundExecuteAction;
|
|
100
101
|
/** Returns a vote action based on offenses from the target round (with offset applied) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tally_slasher_client.d.ts","sourceRoot":"","sources":["../src/tally_slasher_client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAK3G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EAGvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,EACL,sBAAsB,EACtB,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACpC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KA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OG;IACH,OAAO,CAAC,eAAe;CAIxB"}
|
|
@@ -129,7 +129,13 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
129
129
|
const slashingExecutionDelayInRounds = BigInt(this.settings.slashingExecutionDelayInRounds);
|
|
130
130
|
const executableRound = currentRound - slashingExecutionDelayInRounds - 1n;
|
|
131
131
|
const lookBack = BigInt(this.config.slashExecuteRoundsLookBack);
|
|
132
|
-
const
|
|
132
|
+
const slashingLifetimeInRounds = BigInt(this.settings.slashingLifetimeInRounds);
|
|
133
|
+
// Compute the oldest executable round considering both lookBack and lifetimeInRounds
|
|
134
|
+
// A round is only executable if currentRound <= round + lifetimeInRounds
|
|
135
|
+
// So the oldest round we can execute is: currentRound - lifetimeInRounds
|
|
136
|
+
const oldestByLifetime = maxBigint(0n, currentRound - slashingLifetimeInRounds);
|
|
137
|
+
const oldestByLookBack = maxBigint(0n, executableRound - lookBack);
|
|
138
|
+
const oldestExecutableRound = maxBigint(oldestByLifetime, oldestByLookBack);
|
|
133
139
|
// Check if slashing is enabled at all
|
|
134
140
|
if (!await this.slasher.isSlashingEnabled()) {
|
|
135
141
|
this.log.warn(`Slashing is disabled in the Slasher contract (skipping execution)`);
|
|
@@ -139,10 +145,12 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
139
145
|
slotNumber,
|
|
140
146
|
currentRound,
|
|
141
147
|
oldestExecutableRound,
|
|
148
|
+
oldestByLifetime,
|
|
149
|
+
oldestByLookBack,
|
|
142
150
|
executableRound,
|
|
143
151
|
slashingExecutionDelayInRounds,
|
|
144
152
|
lookBack,
|
|
145
|
-
slashingLifetimeInRounds
|
|
153
|
+
slashingLifetimeInRounds
|
|
146
154
|
});
|
|
147
155
|
// Iterate over all rounds, starting from the oldest, until we find one that is executable
|
|
148
156
|
for(let roundToCheck = oldestExecutableRound; roundToCheck <= executableRound; roundToCheck++){
|
|
@@ -157,6 +165,7 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
157
165
|
/**
|
|
158
166
|
* Checks if a given round is executable and returns an execute-slash action for it if so.
|
|
159
167
|
* Assumes round number has already been checked against lifetime and execution delay.
|
|
168
|
+
* @param executableRound - The round to check for execution
|
|
160
169
|
*/ async tryGetRoundExecuteAction(executableRound) {
|
|
161
170
|
let logData = {
|
|
162
171
|
executableRound
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/slasher",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@aztec/epoch-cache": "2.1.
|
|
58
|
-
"@aztec/ethereum": "2.1.
|
|
59
|
-
"@aztec/foundation": "2.1.
|
|
60
|
-
"@aztec/kv-store": "2.1.
|
|
61
|
-
"@aztec/l1-artifacts": "2.1.
|
|
62
|
-
"@aztec/stdlib": "2.1.
|
|
63
|
-
"@aztec/telemetry-client": "2.1.
|
|
57
|
+
"@aztec/epoch-cache": "2.1.2",
|
|
58
|
+
"@aztec/ethereum": "2.1.2",
|
|
59
|
+
"@aztec/foundation": "2.1.2",
|
|
60
|
+
"@aztec/kv-store": "2.1.2",
|
|
61
|
+
"@aztec/l1-artifacts": "2.1.2",
|
|
62
|
+
"@aztec/stdlib": "2.1.2",
|
|
63
|
+
"@aztec/telemetry-client": "2.1.2",
|
|
64
64
|
"source-map-support": "^0.5.21",
|
|
65
65
|
"tslib": "^2.4.0",
|
|
66
|
-
"viem": "2.
|
|
66
|
+
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0",
|
|
67
67
|
"zod": "^3.23.8"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@aztec/aztec.js": "2.1.
|
|
70
|
+
"@aztec/aztec.js": "2.1.2",
|
|
71
71
|
"@jest/globals": "^30.0.0",
|
|
72
72
|
"@types/jest": "^30.0.0",
|
|
73
73
|
"@types/node": "^22.15.17",
|
|
@@ -187,7 +187,14 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
|
|
|
187
187
|
const slashingExecutionDelayInRounds = BigInt(this.settings.slashingExecutionDelayInRounds);
|
|
188
188
|
const executableRound = currentRound - slashingExecutionDelayInRounds - 1n;
|
|
189
189
|
const lookBack = BigInt(this.config.slashExecuteRoundsLookBack);
|
|
190
|
-
const
|
|
190
|
+
const slashingLifetimeInRounds = BigInt(this.settings.slashingLifetimeInRounds);
|
|
191
|
+
|
|
192
|
+
// Compute the oldest executable round considering both lookBack and lifetimeInRounds
|
|
193
|
+
// A round is only executable if currentRound <= round + lifetimeInRounds
|
|
194
|
+
// So the oldest round we can execute is: currentRound - lifetimeInRounds
|
|
195
|
+
const oldestByLifetime = maxBigint(0n, currentRound - slashingLifetimeInRounds);
|
|
196
|
+
const oldestByLookBack = maxBigint(0n, executableRound - lookBack);
|
|
197
|
+
const oldestExecutableRound = maxBigint(oldestByLifetime, oldestByLookBack);
|
|
191
198
|
|
|
192
199
|
// Check if slashing is enabled at all
|
|
193
200
|
if (!(await this.slasher.isSlashingEnabled())) {
|
|
@@ -199,10 +206,12 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
|
|
|
199
206
|
slotNumber,
|
|
200
207
|
currentRound,
|
|
201
208
|
oldestExecutableRound,
|
|
209
|
+
oldestByLifetime,
|
|
210
|
+
oldestByLookBack,
|
|
202
211
|
executableRound,
|
|
203
212
|
slashingExecutionDelayInRounds,
|
|
204
213
|
lookBack,
|
|
205
|
-
slashingLifetimeInRounds
|
|
214
|
+
slashingLifetimeInRounds,
|
|
206
215
|
});
|
|
207
216
|
|
|
208
217
|
// Iterate over all rounds, starting from the oldest, until we find one that is executable
|
|
@@ -220,6 +229,7 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
|
|
|
220
229
|
/**
|
|
221
230
|
* Checks if a given round is executable and returns an execute-slash action for it if so.
|
|
222
231
|
* Assumes round number has already been checked against lifetime and execution delay.
|
|
232
|
+
* @param executableRound - The round to check for execution
|
|
223
233
|
*/
|
|
224
234
|
private async tryGetRoundExecuteAction(executableRound: bigint): Promise<ProposerSlashAction | undefined> {
|
|
225
235
|
let logData: Record<string, unknown> = { executableRound };
|