Transaction not identical after serialize/deserialize
jbencin opened this issue · 0 comments
jbencin commented
What version of Stacks.js are you using?
4.3.8
Describe the bug
Serializing and the deserializing a transaction does not quite result in the same transaction. For example, this following vitest
unit test will fail:
test('StacksTransaction serialize/deserialize', async () => {
const options = { /* ... */ };
const tx = await makeUnsignedSTXTokenTransfer(options);
const tx_encoded = tx.serialize();
const tx_decoded = deserializeTransaction(tx_encoded);
expect(tx_decoded).toEqual(tx);
})
The reason it fails is that the memo.content
field will have a large array of null bytes:
content: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
When it should be an empty string:
content: ''
How to reproduce
See example unit test above
Expected behavior
memo.content
should deserialize to en empty string, and the deserialized StacksTransaction
should deep equal the initial StacksTransaction
Additional context
This is using NodeJS 20.7.0