Skip to content

Commit

Permalink
chore: use tuple for sec and ns
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Sep 3, 2023
1 parent 4d4486f commit 12b6772
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
14 changes: 4 additions & 10 deletions packages/beacon-node/src/chain/bls/multithread/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,10 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
const [jobStartSec, jobStartNs] = process.hrtime();
const workResult = await workerApi.verifyManySignatureSets(workReqs);
const [jobEndSec, jobEndNs] = process.hrtime();
const {
workerId,
batchRetries,
batchSigsSuccess,
workerStartSec,
workerStartNs,
workerEndSec,
workerEndNs,
results,
} = workResult;
const {workerId, batchRetries, batchSigsSuccess, workerStartTime, workerEndTime, results} = workResult;

const [workerStartSec, workerStartNs] = workerStartTime;
const [workerEndSec, workerEndNs] = workerEndTime;

let successCount = 0;
let errorCount = 0;
Expand Down
6 changes: 2 additions & 4 deletions packages/beacon-node/src/chain/bls/multithread/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ export type BlsWorkResult = {
/** Total num of sigs that have been successfully verified with batching */
batchSigsSuccess: number;
/** Time worker function starts - UNIX timestamp in seconds and nanoseconds */
workerStartNs: number;
workerStartSec: number;
workerStartTime: [number, number];
/** Time worker function ends - UNIX timestamp in seconds and nanoseconds */
workerEndSec: number;
workerEndNs: number;
workerEndTime: [number, number];
results: WorkResult<boolean>[];
};
6 changes: 2 additions & 4 deletions packages/beacon-node/src/chain/bls/multithread/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ function verifyManySignatureSets(workReqArr: BlsWorkReq[]): BlsWorkResult {
workerId,
batchRetries,
batchSigsSuccess,
workerStartSec: startSec,
workerStartNs: startNs,
workerEndSec,
workerEndNs,
workerStartTime: [startSec, startNs],
workerEndTime: [workerEndSec, workerEndNs],
results,
};
}
Expand Down

0 comments on commit 12b6772

Please sign in to comment.