paritytech / txwrapper-core

Tools for FRAME chain builders to publish chain specific offline transaction generation libraries.
https://paritytech.github.io/txwrapper-core/
Apache License 2.0
77 stars 28 forks source link

fix(bug): updated `SigningPayload` #381

Closed bee344 closed 4 months ago

bee344 commented 4 months ago

When constructing the SigningPayload neither mode nor metadataHash were taken into account, which in turn caused those to be defaulted to mode = 0 and metadataHash = 0x00. This wasn't detected at first because most txs don't use those fields, but it will cause troubles eventually.

IkerAlus commented 4 months ago

aren't some tests going to fail since they are not considering the new inputs?

For example, this one: https://github.com/paritytech/txwrapper-core/blob/6c96ef9b1f60ba54de5b017cc8c386d841ab4fe0/packages/txwrapper-dev/src/jest-helpers/itHasCorrectBaseTxInfo.ts#L9

bee344 commented 4 months ago

itHasCorrectBaseTxInfo

@IkerAlus I didn't change the TEST_BASE_TX_INFO, just added the mode and metadataHash for the createSigningPayload test, so it won't affect the others. And that helper wasn't used in those test to begin with, so it's fine. If you consider it should be added, it can be done, but as both mode and metadataHash are optional, I don't see the value in checking those fields for every case.