Skip to content

Issue with traiiling bytes ( RPC error -26 Trailing bytes after final byte of witness) after #389

Closed

Description

@ikripaka

When I was migrating the simplicityhl-std repo to an up-to-date version of Simplex to implement fuzz tests, I encountered this error

    Error: Broadcast failed with HTTP 400 for http://127.0.0.1:52982/tx: sendrawtransaction RPC error -26: non-mandatory-script-verify-flag (Trailing bytes after final byte of witness)

Nearly all tests with a running local node fail, while in the previous version everything was fine.
After some investigation, I found that SimplicityHL 0.8.0 bumped simplicity-lang to version 0.9.0.
This PR introduced this bug: #379.

This bug can be reproduced in version 0.1.0 of Simplex, and error was introduced in BlockstreamResearch/smplx#166 after the SimplicityHL version bump to 0.8.0 a2d0c4e.

Here is a minimal working example that can be reproduced in the simplicity-std BlockstreamResearch/simplicityhl-std@2cff7de version and via these paths.

Simplex - 0.1.0 version
proptest - 0.11.0 version

dev-witness-reproduction.patch - directly applies to the dev branch

witness-encoding-regression.patch is a minimal example with a test (this path is included in a previous one. It just requires changes in the Simplex API to reproduce it).

git apply dev-witness-reproduction.patch
simplex clean
simplex build
cargo test --test assert_eq_128_witness_encoding_roundtrip -- --nocapture

The problem occurs before Elements validates the transaction.
Pruning retains unused witness data, producing extra bytes in the serialised witness.
The reproducer executes and prunes the actual stdlib assertion contract, serialises the result, then confirms that Rust’s own RedeemNode::decode rejects it.
No Elements or electrs process is needed to reproduce the failure.

Pruning conversion Program bytes Witness bytes Rust decode result
MaxSharing<Redeem> (released 0.9.0) 980 129 bitstream had trailing bytes 0x00...
InternalSharing (with revert) 980 34 Success

Activity

  1. apoelstra commented on Oct 13, 2026

    @apoelstra
    Collaborator

    Why is this issue on rust-simplicity? This crate has no HTTP support.

  2. apoelstra commented on Oct 13, 2026

    @apoelstra
    Collaborator

    If there is some issue with pruning then please describe the actual bug and ideally provide some sort of reproduction. Also, please do not post LLM-generated textwalls.

  3. ikripaka commented on Oct 13, 2026

    @ikripaka
    Author

    Ok, I'll redo it soon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions