Skip to content

Commit

Permalink
Pass all KeymanagerRestApiServerOpts to RestApiServer (#4761)
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Nov 18, 2022
1 parent e92cffc commit c960269
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cli/src/cmds/validator/keymanager/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class KeymanagerRestApiServer extends RestApiServer {
writeFile600Perm(apiTokenPath, bearerToken, {encoding: "utf8"});
}

super({address: opts.address, port: opts.port, cors: opts.cors, bearerToken}, modules);
super({...opts, bearerToken}, modules);

// Instantiate and register the keymanager routes
registerRoutes(this.server, modules.config, modules.api);
Expand Down
15 changes: 15 additions & 0 deletions packages/cli/test/e2e/importKeystoresFromApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ describeCliTest("import keystores from api", function ({spawnCli}) {
},
data: [],
};

/** From multiple tries, 20_000 results in a JSON of ~ 3MB */
const SLASHING_PROTECTION_ENTRIES = 20_000;
for (let i = 0; i < SLASHING_PROTECTION_ENTRIES; i++) {
slashingProtection.data.push({
pubkey: "0x" + String(i).padStart(96, "0"),
signed_blocks: [],
signed_attestations: [],
});
// // Uncomment to test if size is correct
// if (i % 100 === 0) {
// console.log(i, Buffer.from(JSON.stringify(slashingProtection), "utf8").length / 1e6);
// }
}

const slashingProtectionStr = JSON.stringify(slashingProtection);

itKeymanagerStep("run 'validator' and import remote keys from API", async function (keymanagerClient) {
Expand Down

0 comments on commit c960269

Please sign in to comment.