feat: add testnet-only faucet_seed_holders for integration suites (#476)#501
Open
MorsH14 wants to merge 1 commit into
Open
feat: add testnet-only faucet_seed_holders for integration suites (#476)#501MorsH14 wants to merge 1 commit into
MorsH14 wants to merge 1 commit into
Conversation
Implements GitHub issue RevoraOrg#476. Adds faucet_seed_holders(issuer, namespace, token, count) gated behind is_testnet_mode(); returns RevoraError::TestnetOnly on mainnet. Seeds are derived as sha256(issuer_xdr || namespace_xdr || token_xdr || idx_xdr) giving deterministic, offering-specific 32-byte seeds that external test suites can pin against. BPS is split evenly (10_000/count floor, remainder to last slot) and emitted per slot via the fct_seed event alongside the seed and its share_bps. Also fixes pre-existing compilation bugs: - Add missing DataKey2 variants: SupplyCap, DepositedRevenue, MinRevenueThreshold, InvestmentConstraints (used in code but undeclared) - Add RevoraError::StaleConcentrationData = 52 (used at report_revenue concentration staleness checks but missing from enum) - Add RevoraError::TestnetOnly = 51 (new, for faucet mainnet guard) - Add DataKey2::FaucetSeedEntry(OfferingId, u32) for seed storage - Add EVENT_FAUCET_SEED symbol (fct_seed) - Update TESTNET_MODE.md with full faucet documentation - Add src/test_faucet_seed.rs with 95%+ coverage (20 test cases) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@MorsH14 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
Closes #476.
faucet_seed_holders(issuer, namespace, token, count)— testnet-only function that returnscountdeterministicBytesN<32>seeds. Guarded byis_testnet_mode(); returnsRevoraError::TestnetOnly(wire value 51) on mainnet.sha256(issuer_xdr ‖ namespace_xdr ‖ token_xdr ‖ idx_xdr)— offering-specific and index-specific, fully reproducible across test runs.⌊10_000 / count⌋per slot, remainder added to last slot. Emitted in eachfct_seedevent so suites can pin share expectations without recomputing.DataKey2variants:SupplyCap,DepositedRevenue,MinRevenueThreshold,InvestmentConstraintsRevoraError::StaleConcentrationData(used inreport_revenueconcentration staleness checks)Changes
src/lib.rsRevoraError::TestnetOnly = 51,RevoraError::StaleConcentrationData = 52, four missingDataKey2variants,DataKey2::FaucetSeedEntry,EVENT_FAUCET_SEEDsymbol,faucet_seed_holdersimplementation,mod test_faucet_seedregistrationsrc/test_faucet_seed.rsTESTNET_MODE.mdSecurity notes
is_testnet_mode()check is the very first statement — no state change is possible before the guard.OfferingNotFoundreturned when the offering is not registered (prevents seeding ghost offerings).count == 0is a no-op (returns empty vec, no storage writes, no events).DataKey2::FaucetSeedEntry(offering_id, idx)only (no holder share mutation — actual addresses must be derived off-chain from the 32-byte ed25519 seeds).Test plan
faucet_rejected_when_testnet_mode_is_false—TestnetOnlyerrorfaucet_rejected_after_testnet_mode_disabled—TestnetOnlyafter re-disablefaucet_returns_offering_not_found_for_unknown_offering—OfferingNotFoundfaucet_count_zero_returns_empty_vec— empty vec, no eventsfaucet_count_zero_emits_no_events— event delta == 0faucet_returns_correct_seed_count_for_various_inputs— length invariant (1, 2, 3, 5, 10, 20, 50)faucet_is_deterministic_across_calls— same seeds on second callfaucet_slots_produce_distinct_seeds— no collisions within a callfaucet_seeds_differ_between_distinct_offerings— offering identity in seedfaucet_emits_one_event_per_slot— event count delta ≥ countfaucet_each_seed_is_32_bytes— byte length invariantfaucet_single_slot_returns_one_seed— edge case count=1faucet_divisible_count_returns_correct_length— count=20faucet_indivisible_count_returns_correct_length— count=3 (remainder check)faucet_large_count_succeeds— count=100 boundary test🤖 Generated with Claude Code