types: read the deposit address a deposit carries - #142
Open
octobocto wants to merge 1 commit into
Open
Conversation
octobocto
force-pushed
the
2026-08-31-deposit-address
branch
from
August 31, 2026 08:45
98e12d4 to
cdc6e5f
Compare
Coinelius
pushed a commit
to Coinelius/plain-bitassets
that referenced
this pull request
Sep 1, 2026
The enforcer hands the node a deposit address as UTF-8 in the form `s4_<address>_<checksum>`. proto.rs called `Address::from_str` on that whole string, which base58 decodes it and fails, and the code then took `Address::ALL_ZEROS` with only a warning — so every deposit credited `11111111111111111111` and was unspendable. The node could already write that format with `format_for_deposit` but could never read it back. `from_deposit_address` reverses it, and the deposit path still accepts a bare address. The silent ALL_ZEROS fallback stays, because failing there could stop a node mid-sync. Ported from LayerTwo-Labs/thunder-rust#142 by @octobocto, which fixes the same bug in Thunder (slot 9), adapted to this crate's layout and `AddressParseError`. Tests cover the round trip, a longer checksum, a wrong checksum, a wrong sidechain number, and a bare address. This changes which address a deposit credits, so every node on a chain must run the same side of it. Do not mix patched and unpatched nodes on eCash alphanet slot 4. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i7HNfwdUXvoHEzp6MCmBE
octobocto
force-pushed
the
2026-08-31-deposit-address
branch
from
September 5, 2026 06:10
cdc6e5f to
f7b0bdd
Compare
octobocto
force-pushed
the
2026-08-31-deposit-address
branch
from
September 5, 2026 06:21
f7b0bdd to
290f56d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A deposit credits the all-zeros address, so the coins are unspendable. The enforcer sends the address as
s9_<address>_<checksum>, andproto.rspassed that whole string toAddress::from_str, which fails.from_deposit_addressreads that format, so a deposit credits the address it carries. This changes which address a deposit credits, so every node must upgrade together.