Skip to content

fix(builders): count signers only for required native scripts - #600

Open
penielgold-hub wants to merge 1 commit into
IntersectMBO:mainfrom
penielgold-hub:fix/596-native-script-signers
Open

penielgold-hub wants to merge 1 commit into
IntersectMBO:mainfrom
penielgold-hub:fix/596-native-script-signers

Conversation

@penielgold-hub

Copy link
Copy Markdown

Summary

Fix fee estimation so fake signer witnesses are added only for native scripts the transaction actually requires.

Previously, buildFakeWitnessSet counted required signers for every native script carried by reference inputs or spent inputs, even when the transaction did not use those scripts. That could overestimate the transaction size and fee.

This change:

  • collects script hashes required by spending, minting, certificates, withdrawals, voting, and proposals
  • counts native-script signers only for those required hashes
  • deduplicates required script hashes
  • preserves attached native scripts in the fake witness set for transaction-size estimation
  • keeps existing native-script signer counting for genuinely required scripts

Tests

  • added regression coverage for unrelated native scripts carried by spent inputs
  • added regression coverage for unrelated native scripts carried by reference inputs
  • added certificate signer-estimation coverage
  • tightened the proposal guardrail signer assertion

Verified locally:

  • new signer-estimation tests: 3 passed
  • ProposeGuardrail tests: 18 passed
  • related native-script builder tests: 22 passed
  • type-check: passed
  • lint: passed
  • git diff --check: passed

Closes #596

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(builders): count signers only for native scripts the transaction needs

1 participant