Skip to content

Add last_will.simf example in examples - #167

Open
schoen wants to merge 6 commits into
BlockstreamResearch:devfrom
schoen:feat/last-will-demo
Open

schoen wants to merge 6 commits into
BlockstreamResearch:devfrom
schoen:feat/last-will-demo

Conversation

@schoen

@schoen schoen commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

This uses the old Either style instead of the experimental enum version, because enum currently doesn't work under Simplex.

The tests add some detailed information about what they're trying to accomplish and what happened, visible when they're run with

simplex test -v

In addition to learning more about Simplex, new users will understand a little more about Simplicity covenants.

  • This PR suggests a bug fix and I've added the necessary tests.
  • This PR introduces a new feature and I've discussed the update in an Issue or with the team.
  • This PR is just a minor change like a typo fix.

@schoen
schoen requested a review from Arvolear as a code owner September 28, 2026 21:36
@Arvolear

Copy link
Copy Markdown
Member

This is too complicated and overengineered for a public example. It doesn't show Simplex in the best light. A lot of complexity can be removed by making covenant public keys as arguments (instead of hardcoding them to G, 2G, 3G), and following the regular Signer signing flow.

@schoen
schoen force-pushed the feat/last-will-demo branch from 57a5e5d to 5cd0789 Compare October 1, 2026 01:46
@schoen

schoen commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Hi @Arvolear, I've attempted to do that here. Could you have another look at this version?

@schoen

schoen commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@Arvolear Hopefully now somewhat better idiomaticity and use of the SDK throughout these tests.

@schoen
schoen force-pushed the feat/last-will-demo branch 2 times, most recently from 9458406 to 7d6c0c8 Compare October 11, 2026 06:14
@schoen

schoen commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Some fixes for the upstream 0.1.0 release (API change and a merge conflict), and also proptest's upstream release being incompatible (#181). Everything seems to pass again.

Note that this still adds a public wasm wrapper for signTransaction.

[dependencies]
smplx-std = { path = "../../crates/simplex" }

anyhow = { version = "1.0.101" }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
anyhow = { version = "1.0.101" }
anyhow = { version = "1.0.104" }

smplx-std = { path = "../../crates/simplex" }

anyhow = { version = "1.0.101" }
bitcoin_hashes = { version = "0.14" }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is probably not needed anymore.

Comment thread crates/wasm/src/lib.rs Outdated
/// Returns an error if the transaction cannot be blinded or signed, if a witness cannot be injected
/// at the requested path, or if a covenant input does not execute.
#[wasm_bindgen(js_name = signTransaction)]
pub fn sign_transaction(&self, builder: &TransactionBuilder) -> Result<SignedTransaction, JsError> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this change in a separate PR. Otherwise, this one has to go in the dev branch.

Comment thread CHANGELOG.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this one too.

Comment thread examples/last_will/README.md Outdated
the fee and continuation outputs swapped. A change target cannot produce
those shapes, because Simplex always appends change first and fee second,
so those tests list their outputs directly and sign with `Signer::sign_tx`,
which appends nothing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
which appends nothing.
which doesn't append anything.

schoen and others added 5 commits November 12, 2026 12:33
This uses the old `Either` style instead of the experimental `enum`
version, because `enum` currently doesn't work under Simplex.

The tests add some detailed information about what they're trying to
accomplish and what happened, visible when they're run with

`simplex test -v`

In addition to learning more about Simplex, new users will understand a
little more about Simplicity covenants.
Instead of hard-coding privkeys 1, 2, 3 and writing new signer
logic, use proper wallet mnemonics and Simplex's built-in tools
for this.

Also tighten comments and narration.
- Program inputs take an Option<ProgramSignature>, so the spend path builds
  ProgramSignature::new("INHERIT_OR_NOT").at_path(..) in place of
  RequiredSignature::witness_with_path.
- A program that rejects a spend now surfaces as
  SignerError::Program(ProgramError::ProgramExecution { .. }), which the
  local-rejection tests match on.
- UTXO::amount() returns a Result, so the lifecycle test propagates it.
- Signed transactions are extracted with .extract_tx().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Derived from examples/basic/Cargo.lock, so the example resolves to the same
dependency versions as the rest of the workspace, including the pinned
proptest 1.12.0. Only the root package entry differs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schoen
schoen force-pushed the feat/last-will-demo branch from 7d6c0c8 to bc4982a Compare November 12, 2026 20:34
@schoen
schoen changed the base branch from master to dev November 12, 2026 21:01
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.

2 participants