refactor(js tests): remove redunant and fix sig
MODIFY
examples/wasm_node/test/tests_basic.js
examples/wasm_node/test/tests_basic.js
@@ -380,22 +380,16 @@ describe("verifySignature", function() {
if (process.env.PURE_JS) { itCall = it.skip }
itCall("verify BLS signature (1)", function() {
- const message = dataTxs[3].transaction
- const sig = dataTxs[3].sig
-
- const tx = filecoin_signer.transactionSerialize(message)
- const v = filecoin_signer.verifySignature(sig, tx)
-
- assert.strictEqual(v, true);
- })
-
- itCall("verify BLS signature (2)", function() {
const tc = dataTxs[4]
const signed_tx = filecoin_signer.transactionSign(tc.message, Buffer.from(tc.sk, "hex").toString("base64"));
console.log(signed_tx);
const raw_signature = filecoin_signer.transactionSignRaw(tc.message, Buffer.from(tc.sk, "hex").toString("base64"));
- console.log(Buffer.from(raw_signature).toString('hex'));
+
+ const hex_sig = Buffer.from(raw_signature).toString('hex');
+ console.log(hex_sig);
+ assert.strictEqual(hex_sig, tc.sig);
+
const signature = Buffer.from(signed_tx.signature.data, 'base64');
console.log(signature.toString('hex'));
const tx = filecoin_signer.transactionSerialize(tc.message)

MODIFY
test_vectors/txs.json
test_vectors/txs.json
"testnet": true,
"pk": "af2f1d46d7f618997f43fbc3b7e4d4fb6ca8bc290e161e1f8643f0d894509814da5a5ff8729fc8935086a334469a3702",
"sk": "9c26a653e3f6feed763fee9e163a4863252fd3ca38bfeeaa83dab2799b5cf10c",
- "sig": "b6b660b9557b722f2b20770511aa1761836c4352313002030ab4229273eb3f9ea09ca8490176f361dabec4c64cc62e130ce1bb2d0a9fe143b4e844de20e311b842b465900f4c3f861d46755c2dcca5f2effb97c0da379fbf7a4e046f909a0fa5",
+ "sig": "8fb31ca2f2c5fa211f1be32709bd269bb96500789ee71283c7d63d933a139c678414f546ba096a44183580ecfa2f326e19cd1f7613e06539208359f0ae22b51a94b766b8531ecff071e152d9bde3f3d4bd679e89224102c667f0193b9259e726",
"message": {
"to": "t17uoq6tp427uzv7fztkbsnn64iwotfrristwpryy",
"from": "t3v4xr2rwx6ymjs72d7pb3pzgu7nwkrpbjbylb4h4gipynrfcqtaknuws77bzj7setkcdkgncgti3qfa4n7seq",

refactor(js tests): remove redunant and fix sig