@aztec/slasher 2.0.0-rc.21 → 2.0.0-rc.23
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/dest/empire_slasher_client.d.ts +3 -2
- package/dest/empire_slasher_client.d.ts.map +1 -1
- package/dest/empire_slasher_client.js +4 -3
- package/dest/factory/create_implementation.js +6 -4
- package/dest/tally_slasher_client.d.ts +3 -2
- package/dest/tally_slasher_client.d.ts.map +1 -1
- package/dest/tally_slasher_client.js +4 -3
- package/package.json +9 -9
- package/src/empire_slasher_client.ts +3 -3
- package/src/factory/create_implementation.ts +5 -0
- package/src/tally_slasher_client.ts +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmpireSlashingProposerContract, RollupContract } from '@aztec/ethereum';
|
|
1
|
+
import { EmpireSlashingProposerContract, RollupContract, SlasherContract } from '@aztec/ethereum';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
4
4
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
@@ -84,6 +84,7 @@ export declare class EmpireSlasherClient implements ProposerSlashActionProvider,
|
|
|
84
84
|
private settings;
|
|
85
85
|
private slashFactoryContract;
|
|
86
86
|
private slashingProposer;
|
|
87
|
+
private slasher;
|
|
87
88
|
private rollup;
|
|
88
89
|
private dateProvider;
|
|
89
90
|
private offensesStore;
|
|
@@ -94,7 +95,7 @@ export declare class EmpireSlasherClient implements ProposerSlashActionProvider,
|
|
|
94
95
|
private overridePayloadActive;
|
|
95
96
|
private offensesCollector;
|
|
96
97
|
private roundMonitor;
|
|
97
|
-
constructor(config: EmpireSlasherConfig, settings: EmpireSlasherSettings, slashFactoryContract: SlashFactoryContract, slashingProposer: EmpireSlashingProposerContract, rollup: RollupContract, watchers: Watcher[], dateProvider: DateProvider, offensesStore: SlasherOffensesStore, payloadsStore: SlasherPayloadsStore, log?: import("@aztec/foundation/log").Logger);
|
|
98
|
+
constructor(config: EmpireSlasherConfig, settings: EmpireSlasherSettings, slashFactoryContract: SlashFactoryContract, slashingProposer: EmpireSlashingProposerContract, slasher: SlasherContract, rollup: RollupContract, watchers: Watcher[], dateProvider: DateProvider, offensesStore: SlasherOffensesStore, payloadsStore: SlasherPayloadsStore, log?: import("@aztec/foundation/log").Logger);
|
|
98
99
|
start(): Promise<void>;
|
|
99
100
|
/**
|
|
100
101
|
* Allows consumers to stop the instance of the slasher client.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empire_slasher_client.d.ts","sourceRoot":"","sources":["../src/empire_slasher_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"empire_slasher_client.d.ts","sourceRoot":"","sources":["../src/empire_slasher_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlG,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAQvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAA0B,KAAK,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAE5G,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAA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,mBAAmB,EAAE,CAAC;IASnF,uFAAuF;cACvE,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IA4CrG,uEAAuE;cACvD,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAqG5F;;;;;;OAMG;cACa,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,EACb,6BAA6B,CAAC,EAAE,OAAO,EAAE,GACxC,OAAO,CAAC,OAAO,CAAC;IAkEnB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAUzB;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAK/B,6EAA6E;IAC7E,OAAO,CAAC,wBAAwB;IAShC,wDAAwD;IACxD,OAAO,CAAC,sBAAsB;IAI9B,wDAAwD;IACxD,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -65,6 +65,7 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
65
65
|
settings;
|
|
66
66
|
slashFactoryContract;
|
|
67
67
|
slashingProposer;
|
|
68
|
+
slasher;
|
|
68
69
|
rollup;
|
|
69
70
|
dateProvider;
|
|
70
71
|
offensesStore;
|
|
@@ -75,11 +76,12 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
75
76
|
overridePayloadActive;
|
|
76
77
|
offensesCollector;
|
|
77
78
|
roundMonitor;
|
|
78
|
-
constructor(config, settings, slashFactoryContract, slashingProposer, rollup, watchers, dateProvider, offensesStore, payloadsStore, log = createLogger('slasher:empire')){
|
|
79
|
+
constructor(config, settings, slashFactoryContract, slashingProposer, slasher, rollup, watchers, dateProvider, offensesStore, payloadsStore, log = createLogger('slasher:empire')){
|
|
79
80
|
this.config = config;
|
|
80
81
|
this.settings = settings;
|
|
81
82
|
this.slashFactoryContract = slashFactoryContract;
|
|
82
83
|
this.slashingProposer = slashingProposer;
|
|
84
|
+
this.slasher = slasher;
|
|
83
85
|
this.rollup = rollup;
|
|
84
86
|
this.dateProvider = dateProvider;
|
|
85
87
|
this.offensesStore = offensesStore;
|
|
@@ -310,8 +312,7 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
310
312
|
continue;
|
|
311
313
|
}
|
|
312
314
|
// Check if the slash payload is vetoed
|
|
313
|
-
const
|
|
314
|
-
const isVetoed = await slasherContract.isPayloadVetoed(payload.payload);
|
|
315
|
+
const isVetoed = await this.slasher.isPayloadVetoed(payload.payload);
|
|
315
316
|
if (isVetoed) {
|
|
316
317
|
this.log.info(`Payload ${payload.payload} from round ${payload.round} is vetoed, skipping execution`);
|
|
317
318
|
toRemove.push(payload);
|
|
@@ -25,7 +25,7 @@ async function createEmpireSlasher(config, rollup, slashingProposer, slashFactor
|
|
|
25
25
|
if (slashingProposer.type !== 'empire') {
|
|
26
26
|
throw new Error('Slashing proposer contract is not of type Empire');
|
|
27
27
|
}
|
|
28
|
-
const [slashingExecutionDelayInRounds, slashingPayloadLifetimeInRounds, slashingRoundSize, slashingQuorumSize, epochDuration, proofSubmissionEpochs, l1GenesisTime, slotDuration, l1StartBlock] = await Promise.all([
|
|
28
|
+
const [slashingExecutionDelayInRounds, slashingPayloadLifetimeInRounds, slashingRoundSize, slashingQuorumSize, epochDuration, proofSubmissionEpochs, l1GenesisTime, slotDuration, l1StartBlock, slasher] = await Promise.all([
|
|
29
29
|
slashingProposer.getExecutionDelayInRounds(),
|
|
30
30
|
slashingProposer.getLifetimeInRounds(),
|
|
31
31
|
slashingProposer.getRoundSize(),
|
|
@@ -34,7 +34,8 @@ async function createEmpireSlasher(config, rollup, slashingProposer, slashFactor
|
|
|
34
34
|
rollup.getProofSubmissionEpochs(),
|
|
35
35
|
rollup.getL1GenesisTime(),
|
|
36
36
|
rollup.getSlotDuration(),
|
|
37
|
-
rollup.getL1StartBlock()
|
|
37
|
+
rollup.getL1StartBlock(),
|
|
38
|
+
rollup.getSlasherContract()
|
|
38
39
|
]);
|
|
39
40
|
const settings = {
|
|
40
41
|
slashingExecutionDelayInRounds: Number(slashingExecutionDelayInRounds),
|
|
@@ -56,16 +57,17 @@ async function createEmpireSlasher(config, rollup, slashingProposer, slashFactor
|
|
|
56
57
|
...settings,
|
|
57
58
|
slashOffenseExpirationRounds: config.slashOffenseExpirationRounds
|
|
58
59
|
});
|
|
59
|
-
return new EmpireSlasherClient(config, settings, slashFactoryContract, slashingProposer, rollup, watchers, dateProvider, offensesStore, payloadsStore, logger);
|
|
60
|
+
return new EmpireSlasherClient(config, settings, slashFactoryContract, slashingProposer, slasher, rollup, watchers, dateProvider, offensesStore, payloadsStore, logger);
|
|
60
61
|
}
|
|
61
62
|
async function createTallySlasher(config, rollup, slashingProposer, watchers, dateProvider, epochCache, kvStore, logger = createLogger('slasher')) {
|
|
62
63
|
if (slashingProposer.type !== 'tally') {
|
|
63
64
|
throw new Error('Slashing proposer contract is not of type tally');
|
|
64
65
|
}
|
|
65
66
|
const settings = await getTallySlasherSettings(rollup, slashingProposer);
|
|
67
|
+
const slasher = await rollup.getSlasherContract();
|
|
66
68
|
const offensesStore = new SlasherOffensesStore(kvStore, {
|
|
67
69
|
...settings,
|
|
68
70
|
slashOffenseExpirationRounds: config.slashOffenseExpirationRounds
|
|
69
71
|
});
|
|
70
|
-
return new TallySlasherClient(config, settings, slashingProposer, rollup, watchers, epochCache, dateProvider, offensesStore, logger);
|
|
72
|
+
return new TallySlasherClient(config, settings, slashingProposer, slasher, rollup, watchers, epochCache, dateProvider, offensesStore, logger);
|
|
71
73
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
2
|
-
import { RollupContract, TallySlashingProposerContract } from '@aztec/ethereum/contracts';
|
|
2
|
+
import { RollupContract, SlasherContract, TallySlashingProposerContract } from '@aztec/ethereum/contracts';
|
|
3
3
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
4
4
|
import type { Prettify } from '@aztec/foundation/types';
|
|
5
5
|
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
@@ -58,6 +58,7 @@ export declare class TallySlasherClient implements ProposerSlashActionProvider,
|
|
|
58
58
|
private config;
|
|
59
59
|
private settings;
|
|
60
60
|
private tallySlashingProposer;
|
|
61
|
+
private slasher;
|
|
61
62
|
private rollup;
|
|
62
63
|
private epochCache;
|
|
63
64
|
private dateProvider;
|
|
@@ -66,7 +67,7 @@ export declare class TallySlasherClient implements ProposerSlashActionProvider,
|
|
|
66
67
|
protected unwatchCallbacks: (() => void)[];
|
|
67
68
|
protected roundMonitor: SlashRoundMonitor;
|
|
68
69
|
protected offensesCollector: SlashOffensesCollector;
|
|
69
|
-
constructor(config: TallySlasherClientConfig, settings: TallySlasherSettings, tallySlashingProposer: TallySlashingProposerContract, rollup: RollupContract, watchers: Watcher[], epochCache: EpochCache, dateProvider: DateProvider, offensesStore: SlasherOffensesStore, log?: import("@aztec/aztec.js").Logger);
|
|
70
|
+
constructor(config: TallySlasherClientConfig, settings: TallySlasherSettings, tallySlashingProposer: TallySlashingProposerContract, slasher: SlasherContract, rollup: RollupContract, watchers: Watcher[], epochCache: EpochCache, dateProvider: DateProvider, offensesStore: SlasherOffensesStore, log?: import("@aztec/aztec.js").Logger);
|
|
70
71
|
start(): Promise<void>;
|
|
71
72
|
/**
|
|
72
73
|
* Stop the tally slasher client
|
|
@@ -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,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;
|
|
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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AC,mBAAmB,GAAG,SAAS,CAAC;IAkEnG,0FAA0F;cAC1E,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAkFnG,mFAAmF;IACnF,OAAO,CAAC,kCAAkC;IAQ1C;;;OAGG;IACI,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAIvD;;;;;OAKG;IACU,sBAAsB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IASvE,0CAA0C;IACnC,kBAAkB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAI/C;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;CAIxB"}
|
|
@@ -40,6 +40,7 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
40
40
|
config;
|
|
41
41
|
settings;
|
|
42
42
|
tallySlashingProposer;
|
|
43
|
+
slasher;
|
|
43
44
|
rollup;
|
|
44
45
|
epochCache;
|
|
45
46
|
dateProvider;
|
|
@@ -48,10 +49,11 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
48
49
|
unwatchCallbacks;
|
|
49
50
|
roundMonitor;
|
|
50
51
|
offensesCollector;
|
|
51
|
-
constructor(config, settings, tallySlashingProposer, rollup, watchers, epochCache, dateProvider, offensesStore, log = createLogger('slasher:consensus')){
|
|
52
|
+
constructor(config, settings, tallySlashingProposer, slasher, rollup, watchers, epochCache, dateProvider, offensesStore, log = createLogger('slasher:consensus')){
|
|
52
53
|
this.config = config;
|
|
53
54
|
this.settings = settings;
|
|
54
55
|
this.tallySlashingProposer = tallySlashingProposer;
|
|
56
|
+
this.slasher = slasher;
|
|
55
57
|
this.rollup = rollup;
|
|
56
58
|
this.epochCache = epochCache;
|
|
57
59
|
this.dateProvider = dateProvider;
|
|
@@ -156,8 +158,7 @@ import { SlashRoundMonitor } from './slash_round_monitor.js';
|
|
|
156
158
|
}
|
|
157
159
|
// Check if the slash payload is vetoed
|
|
158
160
|
const payload = await this.tallySlashingProposer.getPayload(executableRound);
|
|
159
|
-
const
|
|
160
|
-
const isVetoed = await slasherContract.isPayloadVetoed(payload.address);
|
|
161
|
+
const isVetoed = await this.slasher.isPayloadVetoed(payload.address);
|
|
161
162
|
if (isVetoed) {
|
|
162
163
|
this.log.warn(`Round ${executableRound} payload is vetoed (skipping execution)`, {
|
|
163
164
|
payloadAddress: payload.address.toString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/slasher",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.23",
|
|
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.0.0-rc.
|
|
58
|
-
"@aztec/ethereum": "2.0.0-rc.
|
|
59
|
-
"@aztec/foundation": "2.0.0-rc.
|
|
60
|
-
"@aztec/kv-store": "2.0.0-rc.
|
|
61
|
-
"@aztec/l1-artifacts": "2.0.0-rc.
|
|
62
|
-
"@aztec/stdlib": "2.0.0-rc.
|
|
63
|
-
"@aztec/telemetry-client": "2.0.0-rc.
|
|
57
|
+
"@aztec/epoch-cache": "2.0.0-rc.23",
|
|
58
|
+
"@aztec/ethereum": "2.0.0-rc.23",
|
|
59
|
+
"@aztec/foundation": "2.0.0-rc.23",
|
|
60
|
+
"@aztec/kv-store": "2.0.0-rc.23",
|
|
61
|
+
"@aztec/l1-artifacts": "2.0.0-rc.23",
|
|
62
|
+
"@aztec/stdlib": "2.0.0-rc.23",
|
|
63
|
+
"@aztec/telemetry-client": "2.0.0-rc.23",
|
|
64
64
|
"source-map-support": "^0.5.21",
|
|
65
65
|
"tslib": "^2.4.0",
|
|
66
66
|
"viem": "2.23.7",
|
|
67
67
|
"zod": "^3.23.8"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@aztec/aztec.js": "2.0.0-rc.
|
|
70
|
+
"@aztec/aztec.js": "2.0.0-rc.23",
|
|
71
71
|
"@jest/globals": "^30.0.0",
|
|
72
72
|
"@types/jest": "^30.0.0",
|
|
73
73
|
"@types/node": "^22.15.17",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmpireSlashingProposerContract, RollupContract } from '@aztec/ethereum';
|
|
1
|
+
import { EmpireSlashingProposerContract, RollupContract, SlasherContract } from '@aztec/ethereum';
|
|
2
2
|
import { sumBigint } from '@aztec/foundation/bigint';
|
|
3
3
|
import { compactArray, filterAsync, maxBy, pick } from '@aztec/foundation/collection';
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -121,6 +121,7 @@ export class EmpireSlasherClient implements ProposerSlashActionProvider, Slasher
|
|
|
121
121
|
private settings: EmpireSlasherSettings,
|
|
122
122
|
private slashFactoryContract: SlashFactoryContract,
|
|
123
123
|
private slashingProposer: EmpireSlashingProposerContract,
|
|
124
|
+
private slasher: SlasherContract,
|
|
124
125
|
private rollup: RollupContract,
|
|
125
126
|
watchers: Watcher[],
|
|
126
127
|
private dateProvider: DateProvider,
|
|
@@ -404,8 +405,7 @@ export class EmpireSlasherClient implements ProposerSlashActionProvider, Slasher
|
|
|
404
405
|
}
|
|
405
406
|
|
|
406
407
|
// Check if the slash payload is vetoed
|
|
407
|
-
const
|
|
408
|
-
const isVetoed = await slasherContract.isPayloadVetoed(payload.payload);
|
|
408
|
+
const isVetoed = await this.slasher.isPayloadVetoed(payload.payload);
|
|
409
409
|
|
|
410
410
|
if (isVetoed) {
|
|
411
411
|
this.log.info(`Payload ${payload.payload} from round ${payload.round} is vetoed, skipping execution`);
|
|
@@ -71,6 +71,7 @@ async function createEmpireSlasher(
|
|
|
71
71
|
l1GenesisTime,
|
|
72
72
|
slotDuration,
|
|
73
73
|
l1StartBlock,
|
|
74
|
+
slasher,
|
|
74
75
|
] = await Promise.all([
|
|
75
76
|
slashingProposer.getExecutionDelayInRounds(),
|
|
76
77
|
slashingProposer.getLifetimeInRounds(),
|
|
@@ -81,6 +82,7 @@ async function createEmpireSlasher(
|
|
|
81
82
|
rollup.getL1GenesisTime(),
|
|
82
83
|
rollup.getSlotDuration(),
|
|
83
84
|
rollup.getL1StartBlock(),
|
|
85
|
+
rollup.getSlasherContract(),
|
|
84
86
|
]);
|
|
85
87
|
|
|
86
88
|
const settings: EmpireSlasherSettings = {
|
|
@@ -110,6 +112,7 @@ async function createEmpireSlasher(
|
|
|
110
112
|
settings,
|
|
111
113
|
slashFactoryContract,
|
|
112
114
|
slashingProposer,
|
|
115
|
+
slasher!,
|
|
113
116
|
rollup,
|
|
114
117
|
watchers,
|
|
115
118
|
dateProvider,
|
|
@@ -134,6 +137,7 @@ async function createTallySlasher(
|
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
const settings = await getTallySlasherSettings(rollup, slashingProposer);
|
|
140
|
+
const slasher = await rollup.getSlasherContract();
|
|
137
141
|
|
|
138
142
|
const offensesStore = new SlasherOffensesStore(kvStore, {
|
|
139
143
|
...settings,
|
|
@@ -144,6 +148,7 @@ async function createTallySlasher(
|
|
|
144
148
|
config,
|
|
145
149
|
settings,
|
|
146
150
|
slashingProposer,
|
|
151
|
+
slasher!,
|
|
147
152
|
rollup,
|
|
148
153
|
watchers,
|
|
149
154
|
epochCache,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js';
|
|
2
2
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
3
|
-
import { RollupContract, TallySlashingProposerContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import { RollupContract, SlasherContract, TallySlashingProposerContract } from '@aztec/ethereum/contracts';
|
|
4
4
|
import { compactArray, partition, times } from '@aztec/foundation/collection';
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
6
|
import { sleep } from '@aztec/foundation/sleep';
|
|
@@ -88,6 +88,7 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
|
|
|
88
88
|
private config: TallySlasherClientConfig,
|
|
89
89
|
private settings: TallySlasherSettings,
|
|
90
90
|
private tallySlashingProposer: TallySlashingProposerContract,
|
|
91
|
+
private slasher: SlasherContract,
|
|
91
92
|
private rollup: RollupContract,
|
|
92
93
|
watchers: Watcher[],
|
|
93
94
|
private epochCache: EpochCache,
|
|
@@ -212,8 +213,7 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
|
|
|
212
213
|
|
|
213
214
|
// Check if the slash payload is vetoed
|
|
214
215
|
const payload = await this.tallySlashingProposer.getPayload(executableRound);
|
|
215
|
-
const
|
|
216
|
-
const isVetoed = await slasherContract.isPayloadVetoed(payload.address);
|
|
216
|
+
const isVetoed = await this.slasher.isPayloadVetoed(payload.address);
|
|
217
217
|
if (isVetoed) {
|
|
218
218
|
this.log.warn(`Round ${executableRound} payload is vetoed (skipping execution)`, {
|
|
219
219
|
payloadAddress: payload.address.toString(),
|