Skip to content

proper support for ECDSA sigs as contract unlocker arguments #355

@mr-zwets

Description

@mr-zwets

Currently Argument.ts has these comments about Schnorr-only support:

export function encodeFunctionArgument(argument: FunctionArgument, typeStr: string): EncodedFunctionArgument {
   ...

  // Redefine SIG as a bytes65 so it is included in the size checks below
  // Note that ONLY Schnorr signatures are accepted
  if (type === PrimitiveType.SIG && argument.byteLength !== 0) {
    type = new BytesType(65);
  }

  // Redefine DATASIG as a bytes64 so it is included in the size checks below
  // Note that ONLY Schnorr signatures are accepted
  if (type === PrimitiveType.DATASIG && argument.byteLength !== 0) {
    type = new BytesType(64);
  }

which means that for provided signatures ECDSA does not work currently

@mainnet-pat ran into this issue and created a PR for this 🙏
I did notice however that the PR's test is using SignatureTemplate which is different from testing providing a signature as argument directly

Metadata

Metadata

Assignees

No one assigned

    Labels

    javascript-sdkRelates to the CashScript JavaScript SDK

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions