Cyfrin Updraft.

Expert Q&A

Ask Cyfrin Updraft community experts

Posts

189
  • thegreatfeez.
    Jan 04, 2025
    Expert Q&A

    Foundry Solidity Test

    What could wrong in my code? function testFundUpdatesFundedDataStructure() public { fundMe.fund{value: 10e18}(); uint256 amountFunded = fundMe.getAddressToAmountFunded(address(this)); assertEq(amountFunded, 10e18); } getting this error: [14658] FundMeTest::testFundUpdatesFundedDataStructure() ├─ [2658] FundMe::fund{value: 1000000000000000000}() │ ├─ [0] 0x0000000000000000000000000000000000000000::latestRoundData() [staticcall] │ │ └─ ← [Stop] │ └─ ← [Revert] EvmError: Revert └─ ← [Revert] EvmError: Revert

    • Cyfrin Updraft
    • Foundry
    • Solidity
    1
    3
  • thegreatfeez.
    Dec 19, 2024
    Expert Q&A

    Zksync Foundry Install

    seems the zksync foundry installation, isn't in the github repo anymore, i tried to type the command line into my terminal "permission denied, could not read from remote repository"

    • Cyfrin Updraft
    • Foundry
    • Solidity
    1
    2
  • thegreatfeez.
    Dec 14, 2024
    Expert Q&A

    Setting up SimpleStorage Deployer

    Why do i keep getting this error when trying to deploy my code in VS code, asked AI and it's still the same. Here is the error: [⠊] Compiling... [⠢] Compiling 14 files with Solc 0.8.18 [⠆] Solc 0.8.18 finished in 149.20ms Error: Compiler run failed: Error (2314): Expected ';' but got identifier --> script/DeploySimpleStorage.s.sol:11:9: | 11 | vm.stopBroadcast(); | ^^ And here is my code. solidity ''' // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {Script} from "forge-std/Script.sol"; import {SimpleStorage} from "../src/SimpleStorage.sol"; contract DeploySimpleStorage is Script { function run() external returns (SimpleStorage) { vm.startBroadcast(); SimpleStorage simpleStorage = new SimpleStorage(); vm.stopBroadcast(); return simpleStorage; } } '''

    • Cyfrin Updraft
    • Foundry
    • Solidity
    1
    1
  • thegreatfeez.
    Dec 12, 2024
    Expert Q&A

    Setting Foundry

    While trying to set my foundry after installing using the "forge init" command, i got this error: Error: failed to commit (code=Some(128), stdout="", stderr="Author identity unknown\n\n* Please tell me who you are.\n\nRun\n\n git config --global user.email \"you@example.com\"\n git config --global user.name \"Your Name\"\n\nto set your account's default identity.\nOmit --global to set the identity only in this repository.\n\nfatal: unable to auto-detect email address (got 'user@MACs-MBP.(none)')") Though I was able to get all the folder I needed, except from "lib" and ".gitmodules" hope this won't affect me in future. And i also try using the "forge init --force" still the same

    • Cyfrin Updraft
    • Foundry
    • Solidity
    1
    2
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    Expert Q&A

    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
    Official Answer
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    Expert Q&A

    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
    Official Answer
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    Expert Q&A

    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
    Official Answer
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    Expert Q&A

    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
    Official Answer
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    Expert Q&A

    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
    Official Answer
  • Cyfrin Moderator Pst.
    Mar 29, 2024
    Expert Q&A

    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
    Official Answer
We use cookies to ensure you get the best experience on our website.
More info