heimdall-stake: stake function and splitting-gain report (Rust, zero deps) #9

Merged
libby merged 2 commits from libby/heimdall-stake into main 2026-11-06 04:34:33 +00:00
Member

New package packages/heimdall-stake, beside heimdall-delegation. weight = 1 + log_b(amount/unit) per Meta, in integer cents and integer micro-weights (1,000,000 = 1.0) with an integer-only logarithm (deterministic across platforms), plus Heimdall's floor, per-identity cap and minimum amount per identity, and a splitting-gain report (splitting_gain, splitting_curve, most_profitable_split). README: first call, formula with Meta's example (100 EUR is 3, 10,000 EUR is 5, both tested exactly), prior art (quadratic voting, Lalley-Weyl, Sybil; cited from background, marked as not re-fetched), and the note that the estate rule normalizes above and the sybil rate is a harness adversary. All parameters are placeholders until the estates rule.

Tests: 11 property/behaviour tests pass (cargo test in the package; 0 unit tests, 0 doctests): Meta's example, exact powers for other bases and units, integer log vs f64 within 2 micro-weights over 20,000 draws, monotone, concave above the unit, zero at and below the floor, cap never exceeded and binds, deterministic and total over i64::MIN..MAX, bad parameters are errors, the split report equals a hand sum, and the minimum makes splitting stop paying.

Choices to confirm: floor is exclusive (an amount at or below it weighs 0; the brief said both "below" and "at/below"); per_identity_cap caps weight, not amount; floor and minimum both zero a weight and may want to be one parameter; base is an integer of at least 2.

A finding worth Heimdall's eyes: the log formula's +1 rewards splitting (100 EUR as ten identities of 10 EUR weighs 20 against 3), and the minimum prices it as a cliff, not a slope. With a 50 EUR minimum, 100 EUR in two identities still gains (5.40 vs 3.00); in three it weighs 0. The minimum has to sit near a typical budget to deter splitting.

Not merged.

🤖 Generated with Claude Code

New package `packages/heimdall-stake`, beside `heimdall-delegation`. `weight = 1 + log_b(amount/unit)` per Meta, in integer cents and integer micro-weights (1,000,000 = 1.0) with an integer-only logarithm (deterministic across platforms), plus Heimdall's floor, per-identity cap and minimum amount per identity, and a splitting-gain report (`splitting_gain`, `splitting_curve`, `most_profitable_split`). README: first call, formula with Meta's example (100 EUR is 3, 10,000 EUR is 5, both tested exactly), prior art (quadratic voting, Lalley-Weyl, Sybil; cited from background, marked as not re-fetched), and the note that the estate rule normalizes above and the sybil rate is a harness adversary. All parameters are placeholders until the estates rule. Tests: 11 property/behaviour tests pass (`cargo test` in the package; 0 unit tests, 0 doctests): Meta's example, exact powers for other bases and units, integer log vs f64 within 2 micro-weights over 20,000 draws, monotone, concave above the unit, zero at and below the floor, cap never exceeded and binds, deterministic and total over i64::MIN..MAX, bad parameters are errors, the split report equals a hand sum, and the minimum makes splitting stop paying. Choices to confirm: floor is exclusive (an amount at or below it weighs 0; the brief said both "below" and "at/below"); `per_identity_cap` caps weight, not amount; floor and minimum both zero a weight and may want to be one parameter; base is an integer of at least 2. A finding worth Heimdall's eyes: the log formula's +1 rewards splitting (100 EUR as ten identities of 10 EUR weighs 20 against 3), and the minimum prices it as a cliff, not a slope. With a 50 EUR minimum, 100 EUR in two identities still gains (5.40 vs 3.00); in three it weighs 0. The minimum has to sit near a typical budget to deter splitting. Not merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
heimdall-stake: stake function and splitting-gain report (Rust, zero deps)
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
9adee90499
weight = 1 + log_b(amount/unit) in integer cents and micro-weights with an integer-only
log, plus floor, per-identity cap and minimum amount per identity; splitting_gain/curve
report what splitting a budget over k identities does. 11 property tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Member

Maintainer sanity run at head 9adee904: cargo test --offline in packages/heimdall-stake, 11 pass, 0 fail (0 unit, 0 doc). Forge CI: 6 pending, 3 skipped (workflows waiting for a runner; none has ever started on this repo). Not merged, Heimdall to review.

Maintainer sanity run at head 9adee904: `cargo test --offline` in packages/heimdall-stake, 11 pass, 0 fail (0 unit, 0 doc). Forge CI: 6 pending, 3 skipped (workflows waiting for a runner; none has ever started on this repo). Not merged, Heimdall to review.
heimdall-stake: sybil note and golden vectors
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
6f68341edd
README: the constant 1 in weight = 1 + log_b(amount/unit) is paid once per identity, so splitting
always pays until the log goes negative and no base fixes it; the defence lives outside the function.
Golden vectors (single and split k=1,2,10,100, three bases) computed with 60-digit decimal ln,
pinned by tests/golden.rs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
libby force-pushed libby/heimdall-stake from 6f68341edd
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
to 84f932ec50
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
2026-11-06 02:31:09 +00:00
Compare
libby merged commit b88beddecb into main 2026-11-06 04:34:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/CultLib!9
No description provided.