Skip to content

Commit 8641f54

Browse files
committed
fix: Getter/submitter workers configured with 'undefined' incentive addresses
1 parent 73b3b36 commit 8641f54

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

src/getter/getter.controller.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ export class GetterController implements OnModuleInit {
5353
const chainId = chainConfig.chainId;
5454
const workerData = this.loadWorkerData(chainConfig, globalGetterConfig);
5555

56+
if (workerData.incentivesAddresses.length == 0) {
57+
this.loggerService.info(
58+
{ chainId },
59+
'Skipping getter worker creation: no incentive address to listen for found.',
60+
);
61+
return;
62+
}
63+
5664
const worker = new Worker(join(__dirname, 'getter.service.js'), {
5765
workerData,
5866
});
@@ -98,7 +106,9 @@ export class GetterController implements OnModuleInit {
98106

99107
const incentivesAddresses = Array.from(
100108
this.configService.ambsConfig.values(),
101-
).map((amb) => amb.getIncentivesAddress(chainId));
109+
)
110+
.map((amb) => amb.getIncentivesAddress(chainId))
111+
.filter((address) => address != undefined);
102112

103113
return {
104114
chainId,

src/submitter/submitter.service.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,15 @@ export class SubmitterService {
178178
const relayerPrivateKey = this.configService.globalConfig.privateKey;
179179

180180
const incentivesAddresses = new Map<string, string>();
181-
this.configService.ambsConfig.forEach((amb) =>
182-
incentivesAddresses.set(
183-
amb.name,
184-
amb.getIncentivesAddress(chainConfig.chainId),
185-
),
186-
);
181+
this.configService.ambsConfig.forEach((amb) => {
182+
const incentiveAddress = amb.getIncentivesAddress(chainConfig.chainId);
183+
if (incentiveAddress != undefined) {
184+
incentivesAddresses.set(
185+
amb.name,
186+
amb.getIncentivesAddress(chainConfig.chainId),
187+
);
188+
}
189+
});
187190

188191
return {
189192
chainId,

0 commit comments

Comments
 (0)