Merge remote-tracking branch 'origin/master' into mpetrunic/chore/dep-updates
This commit is contained in:
commit
1154be87ac
|
@ -38,7 +38,7 @@
|
||||||
"benchmark": "node -r ./.babel-register test/benchmarks"
|
"benchmark": "node -r ./.babel-register test/benchmarks"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chainsafe/eth2-bls-wasm": "^0.1.0",
|
"@chainsafe/eth2-bls-wasm": "^0.2.0",
|
||||||
"@chainsafe/eth2.0-types": "^0.1.0",
|
"@chainsafe/eth2.0-types": "^0.1.0",
|
||||||
"assert": "^1.4.1",
|
"assert": "^1.4.1",
|
||||||
"bls-wasm": "^0.2.7"
|
"bls-wasm": "^0.2.7"
|
||||||
|
|
|
@ -1,36 +1,38 @@
|
||||||
// import path from "path";
|
import path from "path";
|
||||||
// import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
|
import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
|
||||||
//
|
import {PrivateKey} from "../../src";
|
||||||
// interface IMsgHHashCOmpressed {
|
import {padLeft} from "../../src/helpers/utils";
|
||||||
// data: {
|
|
||||||
// input: {
|
interface IMsgHHashCOmpressed {
|
||||||
// message: string;
|
data: {
|
||||||
// domain: string;
|
input: {
|
||||||
// };
|
message: string;
|
||||||
// output: string[];
|
domain: string;
|
||||||
// };
|
};
|
||||||
// }
|
output: string[];
|
||||||
//
|
};
|
||||||
// describeDirectorySpecTest<IMsgHHashCOmpressed, string>(
|
}
|
||||||
// "msg_hash_compressed",
|
|
||||||
// path.join(
|
describeDirectorySpecTest<IMsgHHashCOmpressed, string>(
|
||||||
// __dirname,
|
"msg_hash_compressed",
|
||||||
// "../../../../node_modules/@chainsafe/eth2-spec-tests/tests/general/phase0/bls/msg_hash_compressed/small"
|
path.join(
|
||||||
// ),
|
__dirname,
|
||||||
// (testCase => {
|
"../../../../node_modules/@chainsafe/eth2-spec-tests/tests/general/phase0/bls/msg_hash_compressed/small"
|
||||||
// const domain = Buffer.from(testCase.data.input.domain.replace("0x", ""), "hex");
|
),
|
||||||
// const input = Buffer.from(testCase.data.input.message.replace("0x", ""), "hex");
|
(testCase => {
|
||||||
// const result = G2point.hashToG2(input, domain);
|
const domain = Buffer.from(testCase.data.input.domain.replace("0x", ""), "hex");
|
||||||
// return `0x${result.toBytesCompressed().toString("hex")}`;
|
const input = Buffer.from(testCase.data.input.message.replace("0x", ""), "hex");
|
||||||
// }),
|
const result = PrivateKey.fromInt(1).signMessage(input, domain).toBytesCompressed().toString("hex");
|
||||||
// {
|
return `0x${result}`;
|
||||||
// inputTypes: {
|
}),
|
||||||
// data: InputType.YAML,
|
{
|
||||||
// },
|
inputTypes: {
|
||||||
// getExpected: (testCase => {
|
data: InputType.YAML,
|
||||||
// const xReExpected = padLeft(Buffer.from(testCase.data.output[0].replace("0x", ""), "hex"), 48);
|
},
|
||||||
// const xImExpected = padLeft(Buffer.from(testCase.data.output[1].replace("0x", ""), "hex"), 48);
|
getExpected: (testCase => {
|
||||||
// return "0x" + Buffer.concat([xReExpected, xImExpected]).toString("hex");
|
const xReExpected = padLeft(Buffer.from(testCase.data.output[0].replace("0x", ""), "hex"), 48);
|
||||||
// })
|
const xImExpected = padLeft(Buffer.from(testCase.data.output[1].replace("0x", ""), "hex"), 48);
|
||||||
// }
|
return "0x" + Buffer.concat([xReExpected, xImExpected]).toString("hex");
|
||||||
// );
|
})
|
||||||
|
}
|
||||||
|
);
|
Reference in New Issue