cashscript icon indicating copy to clipboard operation
cashscript copied to clipboard

Incorrect fee calculation when using `SignatureAlgorithm.ECDSA`

Open khirvy019 opened this issue 1 year ago • 0 comments

When using SignatureAlgorithm.ECDSA in SignatureTemplate as a parameter in a smart contract, the resulting signature length is 71 bytes.

However when calculating the fees internally the transaction it replaces a placeholder of 65 bytes length only here

// Replace all SignatureTemplate with 65-length placeholder Uint8Arrays
const placeholderArgs = this.encodedFunctionArgs.map((arg) => (
    arg instanceof SignatureTemplate ? placeholder(65) : arg
));

This causes a min relay fee error when validating the resulting transaction since the change output to be off by 6 bytes for each signature parameter

Would it be possible to check the signature algorithm to determine the placeholder length instead of using a fixed 65bytes?

khirvy019 avatar Oct 16 '24 06:10 khirvy019