Skip to content

wallet: build RingCT output distribution on short chains (fakechain/regtest)#67

Open
Notsosmartt-cmd wants to merge 1 commit into
ZephyrProtocol:masterfrom
Notsosmartt-cmd:fix/rct-distribution-fakechain
Open

wallet: build RingCT output distribution on short chains (fakechain/regtest)#67
Notsosmartt-cmd wants to merge 1 commit into
ZephyrProtocol:masterfrom
Notsosmartt-cmd:fix/rct-distribution-fakechain

Conversation

@Notsosmartt-cmd

Copy link
Copy Markdown

get_rct_distribution floors the per-asset output-distribution query's from_height
at the mainnet fork heights (AUDIT_FORK_HEIGHT for ZPH/ZSD/ZRS/ZYS,
YIELD_FORK_HEIGHT for ZYIELD). On a chain shorter than that floor - a fakechain or
regtest network - from_height exceeds the chain tip, the daemon's
get_output_distribution returns false ("failed to get output distribution"), and no
RingCT transaction can be built (an isolated self-transfer, or any spend, fails).

This clamps from_height to genesis when it is at or past the current blockchain
height: a strict no-op on mainnet (height is far past the fork floors), and on a short
chain it counts from genesis, which already contains enough coinbase-derived amount=0
RingCT outputs to satisfy the ring size. It unblocks RingCT on private chains - which
downstream regtest/CI tooling needs (e.g. atomic-swap test harnesses driving ZEPH on a
private chain) - without changing mainnet behaviour.

The change is one branch in wallet2::get_rct_distribution, right after the existing
per-asset from_height assignment. Verified functionally: the daemon's
get_output_distribution succeeds at from_height=0 on a short regtest chain (and
still fails at AUDIT_FORK_HEIGHT, as before), and ZEPH RingCT spends build on a short
chain after this change.

…egtest)

get_rct_distribution floors the per-asset output-distribution query's from_height
at the mainnet fork heights (AUDIT_FORK_HEIGHT for ZPH/ZSD/ZRS/ZYS,
YIELD_FORK_HEIGHT for ZYIELD). On a chain shorter than that floor - a fakechain or
regtest network - from_height exceeds the chain tip, the daemon's
get_output_distribution returns false ("failed to get output distribution"), and no
RingCT transaction can be built (an isolated self-transfer, or any spend, fails).

Clamp from_height to genesis when it is at or past the current blockchain height.
This is a strict no-op on mainnet (height is far past the fork floors); on a short
chain it counts the distribution from genesis, which already contains enough
coinbase-derived amount=0 RingCT outputs to satisfy the ring size.

This unblocks RingCT on private chains, which downstream regtest/CI tooling (e.g.
atomic-swap test harnesses) needs, without affecting mainnet behaviour.
@Notsosmartt-cmd

Copy link
Copy Markdown
Author

Note: this is a standalone improvement (RingCT on regtest/fakechain for any Zephyr dev or CI tooling), not tied to any specific downstream. Happy to add a test or adjust the framing if that helps review.

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.

1 participant