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.
2020-02-26 08:19:15 +00:00
|
|
|
import path from "path";
|
2020-11-05 20:55:25 +00:00
|
|
|
import {describeDirectorySpecTest, InputType} from "@chainsafe/lodestar-spec-test-util";
|
2020-11-19 13:22:41 +00:00
|
|
|
import {hexToBytes} from "../../src/helpers/utils";
|
|
|
|
import {SPEC_TESTS_DIR} from "../params";
|
|
|
|
import {forEachImplementation} from "../switch";
|
2020-02-26 08:19:15 +00:00
|
|
|
|
|
|
|
interface IVerifyTestCase {
|
|
|
|
data: {
|
|
|
|
input: {
|
|
|
|
pubkey: string;
|
|
|
|
message: string;
|
|
|
|
signature: string;
|
|
|
|
};
|
|
|
|
output: boolean;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-11-19 13:22:41 +00:00
|
|
|
forEachImplementation((bls, implementation) => {
|
|
|
|
describeDirectorySpecTest<IVerifyTestCase, boolean>(
|
|
|
|
`${implementation} - bls/verify/small`,
|
|
|
|
path.join(SPEC_TESTS_DIR, "general/phase0/bls/verify/small"),
|
|
|
|
(testCase) => {
|
|
|
|
const {pubkey, message, signature} = testCase.data.input;
|
|
|
|
return bls.verify(hexToBytes(pubkey), hexToBytes(message), hexToBytes(signature));
|
2020-02-26 08:19:15 +00:00
|
|
|
},
|
2020-11-19 13:22:41 +00:00
|
|
|
{
|
|
|
|
inputTypes: {data: InputType.YAML},
|
|
|
|
getExpected: (testCase) => testCase.data.output,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|