Skip to content
Snippets Groups Projects
Commit e174fb6d authored by Bartek Wrona's avatar Bartek Wrona
Browse files

TS proto/protocol tests adjusted to transaction binary serialization interface changes.

parent 87861fa3
No related branches found
No related tags found
No related merge requests found
Pipeline #116558 failed
This commit is part of merge request !282. Comments created here will be created in the context of that merge request.
......@@ -33,7 +33,7 @@ test.describe('WASM Proto Protocol', () => {
test('Should be able to serialize the transaction', async ({ wasmTest }) => {
const retVal = await wasmTest(({ proto_protocol }, transaction) => {
return proto_protocol.cpp_serialize_transaction(transaction);
return proto_protocol.cpp_serialize_transaction(transaction, false);
}, protoTx);
expect(retVal.exception_message).toHaveLength(0);
......
......@@ -35,7 +35,7 @@ test.describe('WASM Protocol', () => {
});
test('Should be able to generate binary metadata information - tx with vote operation', async ({ wasmTest }) => {
const retVal = await wasmTest.dynamic(({ protocol }, transaction, parseChildrenFn) => {
const values = protocol.cpp_generate_binary_transaction_metadata(transaction, true);
const values = protocol.cpp_generate_binary_transaction_metadata(transaction, true, false);
const parseBinaryChildren = eval(parseChildrenFn);
......@@ -50,7 +50,7 @@ test.describe('WASM Protocol', () => {
});
test('Should be able to generate binary metadata information using hf26 pack type - tx with transfer', async ({ wasmTest }) => {
const retVal = await wasmTest.dynamic(({ protocol }, transaction, parseChildrenFn) => {
const values = protocol.cpp_generate_binary_transaction_metadata(transaction, true);
const values = protocol.cpp_generate_binary_transaction_metadata(transaction, true, false);
const parseBinaryChildren = eval(parseChildrenFn);
......@@ -66,7 +66,7 @@ test.describe('WASM Protocol', () => {
test('Should be able to generate binary metadata information using legacy pack type - tx with transfer', async ({ wasmTest }) => {
const retVal = await wasmTest.dynamic(({ protocol }, transaction, parseChildrenFn) => {
const values = protocol.cpp_generate_binary_transaction_metadata(transaction, false);
const values = protocol.cpp_generate_binary_transaction_metadata(transaction, false, false);
const parseBinaryChildren = eval(parseChildrenFn);
......@@ -168,13 +168,24 @@ test.describe('WASM Protocol', () => {
test('Should be able to serialize the transaction', async ({ wasmTest }) => {
const retVal = await wasmTest(({ protocol }, transaction) => {
return protocol.cpp_serialize_transaction(transaction);
return protocol.cpp_serialize_transaction(transaction, false);
}, transaction);
expect(retVal.exception_message).toHaveLength(0);
expect(retVal.content).toBe("ff86c404c24b152fb7610100046f746f6d076330666633336108657778686e6a626a98080000");
});
test('Should be able to serialize the (stripped) transaction', async ({ wasmTest }) => {
const retVal = await wasmTest(({ protocol }, transaction) => {
/// Even transaction is unsigned, we can strip the signature container to preserve original binary form
// of the transaction i.e. specific to calculate its id
return protocol.cpp_serialize_transaction(transaction, true);
}, transaction);
expect(retVal.exception_message).toHaveLength(0);
expect(retVal.content).toBe("ff86c404c24b152fb7610100046f746f6d076330666633336108657778686e6a626a980800");
});
test('Should be able to calculate sig digest of the transaction', async ({ wasmTest }) => {
const retVal = await wasmTest(({ protocol }, transaction) => {
return protocol.cpp_calculate_sig_digest(transaction, "beeab0de00000000000000000000000000000000000000000000000000000000");
......
......@@ -111,7 +111,7 @@ test.describe('WASM Protocol benchmarks', () => {
utilFunctionTest('Serialize transaction', 7_500, () => {
for(let i = 0; i < 7_500; ++i)
noDiscard += (protocol.cpp_serialize_transaction(transaction).content as string).length % 10 + i;
noDiscard += (protocol.cpp_serialize_transaction(transaction, false).content as string).length % 10 + i;
return noDiscard;
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment