Homepage

Crypto Log

Categories

 

Recent Blogs

  • Data Structure –Map

    both Rust and C++ basically give you two big “map families”: What an ordered map actually is BTreeMap (Rust) and std::map (C++) are not arrays. They are balanced trees (B-tree in Rust, red-black tree in C++).Conceptually they look like this: Ordered maps/sets (tree-based) Differences Searching cost in Ordered Map, memory killer Searching in Ordered Map…


  • Queue related data structure

    1) FIFO Queue (the classic queue) Rule:First In → First Out append back, pop from front Like people waiting for coffee. Operations: Rust implementation Use: Why VecDeque?Because a queue needs: exactly the operations a ring buffer optimizes. Typical uses: 2) Double-Ended Queue (Deque) This is actually what VecDeque really is. You can add/remove from both…


  • Think as an architect

    The architects are to convert a vague business need → technical system structure. The process has 6 phases: 1) Clarify the Real Problem (MOST important step) Architects don’t start with databases or APIs. They start with questions. Because most initial requirements are wrong, incomplete, or actually describing a symptom. Example request: “We need real-time notifications.”…


  • A piece of parallel computing code

    What can you learn from this piece of code? Send and Sync Send: a value of this type can be moved to another thread safely. Sync: a value of this type can be shared between threads by reference safely.Formally: T: Sync means &T: Send. Send A type can be safely transferred (moved) from one thread…


  • Parallel Computing in Rust and C++ part 1

    Parallelism in Rust usually means one of three things: When making things go parallel, there are following things to consider. Safe parallel code comes from being explicit about what is shared, who owns it, and how threads/tasks coordinate. Here’s a practical checklist programmers should run through. Safe Parallel Computing Check-list: 1) Identify shared state and…


  • Procedural macro

     What a procedural macro is (in one sentence) A procedural macro is Rust code that runs at compile time and generates Rust code by programmatically transforming syntax trees. Normal Rust code runs at runtime Procedural macros run while the compiler is compiling How to use procedural macro TokenStream A TokenStream is: A sequence of Rust tokens,…


  • Transpiler, Interpreter, Runtime

    A transpiler: Classic examples: What an interpreter is An interpreter is a program that executes another program directly, instruction by instruction, without first translating it into a different executable form. In one line: Interpreter = “read instruction → perform its meaning → repeat.” The core execution loop (the essence) Almost every interpreter boils down to…


  • Ownership in Rust

    Every value in Rust has exactly one owner at a time, and when the owner goes away, the value is automatically cleaned up. Let’s build this step by step. 1️⃣ The three ownership rules Rust enforces these at compile time: That’s it—but these rules have powerful consequences. 2️⃣ What is an “owner”? The owner is…


  • Rust dynamic and static dispatch

    Static Dispatch What it is How it works Properties example: Use when Rayon: almost always static dispatch Dynamic Dispatch What it is How it works Properties Use when Important clarifications what is function call site: the code where the function is called.how the compiler handle generics?This is called monomorphization. For a function call, the compiler…


  • Sumcheck optimization 2: Quasilinear Time and Square-Root Space old implementation

    explanation for this equation: \(\underbrace{p(r_1, …, r_i, x’)}_{x’\in\{0,1\}^{i-l}}= \sum\limits_{y\in \{0,1\}^l}\widetilde{eq}(r_1, …, r_i, x’,y)\cdot p(y)\) \(=\sum\limits_{y\in \{0,1\}^l}\underbrace{\widetilde{eq}(r_1, …, r_i, y)}_{y\in \{0,1\}^{i}}\underbrace{\widetilde{eq}(x’,y)}_{y\in \{0,1\}^{l-i}}\cdot \underbrace{p(y)}_{y\in \{0,1\}^l}\) \(=\sum\limits_{y\in \{0,1\}^i}\underbrace{\widetilde{eq}(r_1, …, r_i, y)}_{y\in \{0,1\}^{i}}\underbrace{\cdot p(y, x’)}_{y\in \{0,1\}^{i}}\)


  • Stream prover

    what stream prover exactly means? find definition here (page 5): So the “streaming” means that the witness of the sumcheck protocol, i.e., the evaluations of a multilinear polynomial, is not counted in the RAM of the prover, prover doesn’t need to store this information, but only re-generated it when every time prover needs to access…


  • Debugging Rust in VS code

    follow the instruction in this video