Skip to content

Revert 2 tsukimarf patch 2 - #402

Open
Tsukimarf wants to merge 20 commits into
PiNetwork:mainfrom
Tsukimarf:revert-2-Tsukimarf-patch-2
Open

Revert 2 tsukimarf patch 2#402
Tsukimarf wants to merge 20 commits into
PiNetwork:mainfrom
Tsukimarf:revert-2-Tsukimarf-patch-2

Conversation

@Tsukimarf

Copy link
Copy Markdown

No description provided.

Tsukimarf and others added 20 commits April 12, 2026 17:31
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
What it does: This PR adds a new JavaScript file (PiRC1/4-allocation/pirc_allocation_design2.js) implementing PiRC Allocation Design Option 2 — a model for liquidity pool (LP) formation using participant deposits and swaps on the Pi Network.
Key additions:

PIRC_ALLOCATION_DB — a static configuration object encoding allocation parameters: token/Pi splits, LP fees, engagement-based discount-to-lockup policy, process steps, and reference price points.
PiRCAllocationCalculator — a class that computes listing prices, AMM (constant-product) pool invariants, swap prices, effective blended prices (harmonic mean), discount percentages, and per-participant allocations.
A runDemo() function that logs pool summaries and price curves to the console.

Issues flagged by automated reviewers (Sourcery & Cubic):

Weak input validation in the constructor — T <= 0 || C <= 0 doesn't catch NaN, Infinity, or non-numeric strings. The fix is to use Number.isFinite(T) && Number.isFinite(C).
No bounds checking in participantSummary / discountPercent — values of s outside [0, C/2] can produce nonsensical or negative outputs without any error.
Redundant pEff(s) call in effectivePriceCurve — it's computed twice per iteration; storing it in a local variable is cleaner and more efficient.
runDemo() runs unconditionally on import — this causes side effects (console output) whenever the module is imported. It should be gated with if (require.main === module).

The author co-authored follow-up commits with Sourcery's suggestions, so some of these may already be addressed in the latest commit (75d0287).

2. Common Encryption Techniques
Encryption is the process of transforming readable data (plaintext) into an unreadable form (ciphertext) using an algorithm and a key. Here are the major categories:
Symmetric Encryption uses the same key to both encrypt and decrypt. It's fast and well-suited for large data. Common algorithms include AES (Advanced Encryption Standard, the current gold standard), DES (now obsolete), and 3DES. The main challenge is securely sharing the key between parties.
Asymmetric Encryption uses a mathematically linked key pair — a public key to encrypt and a private key to decrypt. This solves the key-distribution problem. RSA is the classic example; Elliptic Curve Cryptography (ECC) achieves similar security with much smaller key sizes, making it popular on mobile devices. Asymmetric encryption is slower than symmetric, so it's typically used to exchange keys rather than encrypt bulk data.
Hybrid Encryption combines both: asymmetric encryption is used to securely exchange a symmetric session key, then symmetric encryption handles the actual data. TLS (the "S" in HTTPS) works this way.
Hashing is technically a one-way transformation, not reversible encryption, but is closely related. Algorithms like SHA-256 and bcrypt produce a fixed-size digest of data. Hashing is used for password storage, data integrity checks, and digital signatures. It's worth noting that hashing is not encryption — you cannot recover the original data from a hash.
End-to-End Encryption (E2EE) is an application of asymmetric + symmetric techniques (like the Signal Protocol) ensuring only the communicating parties can read the messages — not even the service provider.
Common use cases by technique:
TechniqueExamplesUse CaseSymmetricAES, ChaCha20File encryption, disk encryptionAsymmetricRSA, ECCKey exchange, digital signatures, TLS handshakeHashingSHA-256, bcryptPasswords, integrity checksHybridTLS/HTTPS, PGPSecure communication
Let me know if you'd like a deeper dive into any of these, or a more specific review of the PR code itself!
Added a new JSON file containing the allocation period details for PiRC, including versioning, design options, and supported chains.
Added SQL schema and seed data for allocation period v2.0.0.
This file implements the PiRC allocation model with two design options: a deposit-only model and a deposit plus swap model. It includes classes for calculating allocations and provides a demo for each design option.
Implement PiRC Allocation Period calculations and demo.
This file implements two allocation calculators for different design options, including functionality for participant summaries and effective price calculations.
@Tsukimarf
Tsukimarf changed the base branch from main to optimal-fairness August 29, 2026 04:53
@Tsukimarf
Tsukimarf changed the base branch from optimal-fairness to main August 29, 2026 04:54
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