找到约 13 条结果

文章 Rust的面向对象特性

... } fn introduce(&self) { println!("Hello, my name is {} and I am {} years old.", self.name, self.age); } } fn main() { let person = Person::new(String::from("Alice"), 30); person.introduce(); } ``` ### Trait 对象 **定义 Trait** 定义 Trait:使用...

文章 Solidity 中的私有变量不私有

...docs.soliditylang.org/en/v0.8.10/internals/layout_in_storage.html#mappings-and-dynamic-arrays getStorageAt 需要传入两个参数,第一个参数是合约地址,第二个参数是要读取的状态变量的存储位置,只要我们知道的变量的位置,就能读取到所存储的值...

文章 AAVE V2 学习笔记

...amount) external override onlyLendingPool { // Since the total supply and each single user debt accrue separately, // there might be accumulation errors so that the last borrower repaying // mght actually try to repay more than the available debt supply. // In this case we simply...

文章 我们的密码学专家解答 10 个关键问题

...ps://www.semanticscholar.org/paper/Benchmarking-the-Plonk%2C-TurboPlonk%2C-and-UltraPlonk-Derei-Geren/e82bb576b3fc7e6704e909fc2381a1801591a836) 表明,在 32 核 Intel Xeon Platinum CPU 上生成 128K Pedersen 哈希的 UltraPLONK 证明的生成速度相当快,仅需约三秒钟;但是,内...

文章 Mapping 数据结构 | 用 Rust 写智能合约(二)

... in Rust are normally defined within such a `#[cfg(test)]` /// module and test functions are marked with a `#[test]` attribute. /// The below code is technically just normal Rust code. #[cfg(test)] mod tests { /// Imports all the definitions from the outer scope so we ca...

文章 工厂模式 - 智能合约如何部署其他合约

.../ 在此调用之后,带有每个发布事件的主题的预期日志 // and there you will find the contract addresses // 在那里你会找到合约地址 ``` ### 总结 工厂将合约创建变成一个可重复的过程。 你无需手动部署每个实例,而是获得一个受信任的...

文章 指南:用 Anchor 构建 Solana 程序

...结构和算法的存储库](https://github.com/0xIchigo/Data-Structures-and-Algorithms-in-Rust) 。 本文专注于 Anchor 开发,*仅限*Anchor 开发。我们不会涉及如何开发原生 Rust 程序,本文也不假设读者了解该方面的知识。此外,本文也不涉及使用 Anch...

文章 现代 DeFi: Uniswap V3

...概念,我们使用 Tick 标记价格区间的上限和下限。 ![Tick And Range](https://img.learnblockchain.cn/2025/12/31/ticks_and_ranges.png) 在 Uniswap V3 内,我们使用 $p(i) = 1.0001^i$ 来计算第 i 个 Tick 对应的具体价格。在上文的代码内出现了 `_tickSpacing` 的...

文章 测量SNARK性能:前端与后端

...关更多细节,请参见我的教科书草稿,**_Proofs, Arguments, and Zero Knowledge_** [link](https://people.cs.georgetown.edu/jthaler/ProofsArgsAndZK.pdf)。有关 SNARK 的介绍,请查看 Sarah Meicklejohn 在 a16z crypto **[夏季研究系列](https://www.youtube.com/channel/UCTHq3W46B...

文章 CosmWasm allocate 栈溢出

...rce_ptr: u32) -> u32; +} + /// Creates a memory region of capacity `size` and length 0. Returns a pointer to the Region. /// This is the same as the `allocate` export, but designed to be called internally. pub fn alloc(size: usize) -> *mut Region { + + let source = build_region("".as_bytes());...

文章 从零打造Solana空投工具库:Rust开发实战指南

...g library `solana-airdrop-utils` package note: see more `Cargo.toml` keys and their definitions at ******************************************************* cd solana-airdrop-utils ``` ### 列出当前目录下的文件和文件夹 ```bash ls # 列出当前目录下的文件和文件夹(...

文章 以太坊兼容链性能测试2—性能数据统计

...on/)里面,所以只能先用目前这种笨办法。 不断监控commands.txt文件的变化执行不同的函数,直到执行完`successRate`会结束ethStats服务。 为什么要用`eth_blockNumber`不断查询,而不是用区块时间戳? 1. Layer2链的区块时间戳有不同...

文章 关于Jolt初始实施的常见问题解答

_Today, a16z crypto research and engineering teams released an initial_ [_implementation_](https://github.com/a16z/jolt) _of_ [_Jolt_](https://learnblockchain.cn/article/13070/) _, a new approach to SNARK design that is already up to 2x faster than the state of the art, with more improvements still ...