This repository has been archived on 2023-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
chainsafe-bls/test/spec/aggregate_sigs.test.ts

28 lines
751 B
TypeScript

import path from "path";
import bls from "../../src";
import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
interface AggregateSigsTestCase {
data: {
input: string[];
output: string;
};
}
describeDirectorySpecTest<AggregateSigsTestCase, string>(
"aggregate sigs",
path.join(__dirname, "../../../spec-test-cases/tests/general/phase0/bls/aggregate_sigs/small"),
(testCase => {
const result = bls.aggregateSignatures(testCase.data.input.map(pubKey => {
return Buffer.from(pubKey.replace("0x", ""), "hex");
}));
return `0x${result.toString('hex')}`;
}),
{
inputTypes: {
data: InputType.YAML,
},
getExpected: (testCase => testCase.data.output)
}
);