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.
2019-09-05 13:06:46 +00:00
|
|
|
import path from "path";
|
2019-08-05 15:48:26 +00:00
|
|
|
import bls from "../../src";
|
2019-09-05 13:06:46 +00:00
|
|
|
import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
|
2019-08-05 15:48:26 +00:00
|
|
|
|
2019-09-05 13:06:46 +00:00
|
|
|
interface AggregateSigsTestCase {
|
|
|
|
data: {
|
|
|
|
input: string[];
|
|
|
|
output: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
describeDirectorySpecTest<AggregateSigsTestCase, string>(
|
|
|
|
"aggregate sigs",
|
2019-09-29 08:47:17 +00:00
|
|
|
path.join(
|
|
|
|
__dirname,
|
|
|
|
"../../../../node_modules/@chainsafe/eth2-spec-tests/tests/general/phase0/bls/aggregate_sigs/small"
|
|
|
|
),
|
2019-09-05 13:06:46 +00:00
|
|
|
(testCase => {
|
|
|
|
const result = bls.aggregateSignatures(testCase.data.input.map(pubKey => {
|
|
|
|
return Buffer.from(pubKey.replace("0x", ""), "hex");
|
|
|
|
}));
|
2019-09-29 08:47:17 +00:00
|
|
|
return `0x${result.toString("hex")}`;
|
2019-09-05 13:06:46 +00:00
|
|
|
}),
|
|
|
|
{
|
|
|
|
inputTypes: {
|
|
|
|
data: InputType.YAML,
|
|
|
|
},
|
|
|
|
getExpected: (testCase => testCase.data.output)
|
|
|
|
}
|
2019-08-05 15:48:26 +00:00
|
|
|
);
|