Cyfrin Updraft.

专家问答

向Cyfrin Updraft社区的专家提问

帖子

189
  • thegreatfeez.
    Jan 04, 2025
    专家问答

    铸造厂坚固性测试

    我的代码可能出什么问题? function testFundUpdatesFundedDataStructure() public { fundMe.fund{value: 10e18}(); uint256 amountFunded = fundMe.getAddressToAmountFunded(address(this)); assertEq(amountFunded, 10e18); } 出现这个错误: [14658] FundMeTest:: testfundUpdatesFundedDatesFundedDatesFundedD ├─ [2658] FundMe:: fund {价值:100000000000000000} () │ ├─ [0] 0x000000000000000000000000000000000000000000:: latestRoundData () [静态调用] │ │ └─ ← [停止] │ └─ ← [还原] evmError:还原 └─ ← [还原] evmError:还原

    • Cyfrin Updraft
    • Foundry
    • Solidity
    1
    3
  • thegreatfeez.
    Dec 19, 2024
    专家问答

    zksync 铸造厂安装

    看来安装了 zksync foundry 的,已经不在 github 存储库里了,我试着在终端中键入命令行 “权限被拒绝,无法从远程存储库读取”

    • Cyfrin Updraft
    • Foundry
    • Solidity
    1
    2
  • thegreatfeez.
    Dec 14, 2024
    专家问答

    设置 SimpleStorage 部署器

    AI 问道,为什么我在尝试在 VS 代码中部署我的代码时一直遇到这个错误,但还是一样. 这是错误: [] 正在编译... [] 使用 Solc 0.8.18 编译 14 个文件 [] Solc 0.8.18 在 149.20 毫秒内完成 错误:编译器运行失败: 错误 (2314):预期为 ';' 但得到了标识符 --> 脚本/deploySimpleStorage.sol: 11:9: | 11 | vm.stopBroadcast (); | ^^ 这是我的代码. solidity “' //SPDX 许可证标识符:麻省理工学院 pragma solidity ^0.8.18; 从 “forge-std/Script.sol” 导入 {脚本}; 从 “...” 导入 {simpleStorage}/src/SimpleStorage.sol “; 合约部署��单存储是脚本 { 函数 run () 外部返回 (simpleStorage) { vm.startBroadcast (); SimpleStorage SimpleStorage = new SimpleStorage ( vm.stopbroadcast (); 返回 SimpleStorage; } } “'

    • Cyfrin Updraft
    • Foundry
    • Solidity
    1
    1
  • thegreatfeez.
    Dec 12, 2024
    专家问答

    设置铸造厂

    在使用 “forge init” 命令安装后尝试设置我的铸造厂时,我遇到了这个错误: 错误:提交失败 (code=some (128)、stdout= "”、stderr= "作者身份未知\n\n* 请告诉我你是谁. \n\n 运行\n git config--global user.email\” you@example.com\”\n git config--global user.name\ “你的名字\”\n\n 来设置账户的默认身份. \n 省略--global 以仅在此存储库中设置身份. \n\n 致命:无法自动检测电子邮件地址(收到 “用户 @MACs-MBP”. (无)')”) 尽管我能够获得除了 “lib” 和 “.gitmodules” 之外的所有我需要的文件夹,但希望将来这不会影响我. 而且我还试着用 “forge init--force” 还是一样

    • Cyfrin Updraft
    • Foundry
    • Solidity
    1
    2
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    专家问答

    What are the recommended protocols for smart contract audit?

    I am looking to conduct a smart contract audit and would like to know the best protocols to follow. Can anyone suggest a wide range of protocols that are commonly used in competitive audits? Any insights or recommendations would be greatly appreciated. Thank you.

    • Foundry
    • Security
    • Blockchain
    0
    1
    官方答案
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    专家问答

    Error `make deploy` in VS Code - `bash: make: command not found`

    I am encountering an issue while trying to deploy using make deploy in VS Code with Foundry and Anvil. Despite Anvil launching properly without any errors, when I attempt to deploy using the command make deploy, I consistently receive the error message bash: make: command not found. Has anyone faced a similar problem or can provide guidance on resolving this issue? Any assistance would be greatly valued as I have been unable to progress since yesterday. Thank you.

    • Foundry
    0
    1
    官方答案
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    专家问答

    Which function selector and input data should be used in solveChallenge?

    I am working on the solveChallenge function which requires a function selector and input data to be passed. I am unsure about which function I should get the function selector for, and what the input data should be that needs to be turned into bytes. Any guidance on this would be greatly appreciated. Thank you in advance for your help. function solveChallenge(bytes4 selectorOne, bytes memory inputData, string memory yourTwitterHandle) external { (bool successOne, bytes memory responseDataOne) = i_helperContract.call(abi.encodeWithSelector(selectorOne)); if (!successOne || uint256(bytes32((responseDataOne))) != 1) { revert S1__WrongSelector(); } (bool successTwo, bytes memory responseDataTwo) = i_helperContract.call(inputData); if (!successTwo || uint256(bytes32((responseDataTwo))) != 1) { revert S1__WrongData(); } _updateAndRewardSolver(yourTwitterHandle); } I am motivated to understand how to find the solution, not just for obtaining the NFT. Thank you for your assistance.

    • Transaction
    • Solidity
    • Smart Contract
    0
    1
    官方答案
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    专家问答

    How to Report Multiple Instances of an Attack Vector in Base Code?

    I have encountered the same attack vector multiple times in a base code. Should I include each instance separately in my report or consolidate them into a single entry? For instance, if I identify a Denial of Service (DOS) attack in three different functions, should I classify these findings as three distinct high-severity issues in my report, or combine them into a single report entry for efficiency and clarity? Any insights on the best approach for reporting such repeated vulnerabilities would be greatly appreciated. Thank you.

    • Security
    0
    1
    官方答案
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    专家问答

    Seeking Small LaTeX Package for Linux Installation

    I attempted to install LaTeX on my Linux machine using sudo apt-get install texlive-full, which consumed over 7 GB of storage, causing my 120 GB SSD system to run out of space. As a result, I had to remove it. Could someone provide a link to a smaller LaTeX package (less than 1 GB) that is sufficient for my needs? Any guidance or recommendations would be greatly appreciated. Thank you.

    • Foundry
    • Course
    0
    1
    官方答案
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    专家问答

    Does mitigation of DoS in Section 4 Lesson 15 work correctly?

    I am currently working on Section 4 Lesson 15 and addressing the PuppyRaffle::enterRaffle function. I have identified a potential issue with the second recommended mitigation of DoS. function enterRaffle(address[] memory newPlayers) public payable { require(msg.value == entranceFee * newPlayers.length, 'PuppyRaffle: Must send enough to enter raffle'); for (uint256 i = 0; i < newPlayers.length; i++) { players.push(newPlayers[i]); addressToRaffleId[newPlayers[i]] = raffleId; } for (uint256 i = 0; i < newPlayers.length ; i++) { require(addressToRaffleId[newPlayers[i]] != raffleId, 'PuppyRaffle: Duplicate player'); } } The concern is that the duplicate check in the function will always fail due to the way addressToRaffleId[newPlayers[i]] is being set to raffleId for each new player. This results in the condition addressToRaffleId[newPlayers[i]] != raffleId never being true for new players, rendering the duplicate check ineffective. I would like to confirm if my understanding of this issue is correct. Any insights or feedback on this matter would be greatly appreciated.

    • Security
    • Solidity
    • Smart Contract
    0
    1
    官方答案
我们使用 cookie 确保您在我们的网站上获得最佳体验。
更多信息