wallet: build RingCT output distribution on short chains (fakechain/regtest)#67
Open
Notsosmartt-cmd wants to merge 1 commit into
Open
Conversation
…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.
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. |
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.
get_rct_distributionfloors the per-asset output-distribution query'sfrom_heightat the mainnet fork heights (
AUDIT_FORK_HEIGHTfor ZPH/ZSD/ZRS/ZYS,YIELD_FORK_HEIGHTfor ZYIELD). On a chain shorter than that floor - a fakechain orregtest network -
from_heightexceeds the chain tip, the daemon'sget_output_distributionreturns false ("failed to get output distribution"), and noRingCT transaction can be built (an isolated self-transfer, or any spend, fails).
This clamps
from_heightto genesis when it is at or past the current blockchainheight: 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=0RingCT 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 existingper-asset
from_heightassignment. Verified functionally: the daemon'sget_output_distributionsucceeds atfrom_height=0on a short regtest chain (andstill fails at
AUDIT_FORK_HEIGHT, as before), and ZEPH RingCT spends build on a shortchain after this change.