Skip to content

Commit

Permalink
fix to pass ci
Browse files Browse the repository at this point in the history
  • Loading branch information
minaminao committed Jun 25, 2024
1 parent e324260 commit 280733f
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .env

This file was deleted.

1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RPC_MAINNET=https://rpc.ankr.com/eth
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ storage
*.gz

attachments/

.env
5 changes: 1 addition & 4 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ ignored_error_codes = [
9302, # Warning (9302): Return value of low-level calls not used.
]

# For Huff & Vyper
# For Huff
ffi = true
fs_permissions = [{ access = "read", path = "./out" }]

# For CREATE2
bytecode_hash = "none"
cbor_metadata = false

[profile.default.rpc_endpoints]
mainnet = "https://rpc.ankr.com/eth"

# See more config options https://github.com/foundry-rs/foundry/tree/master/crates/config
5 changes: 1 addition & 4 deletions src/Ethernaut/CoinFlip/CoinFlipExploit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.13;
import {Test, console2} from "forge-std/Test.sol";
import {playerScript, CoinFlipExploit} from "./CoinFlipExploit.sol";
import {CoinFlipFactory} from "./CoinFlipFactory.sol";
import {VyperUtils} from "src/utils/VyperUtils.sol";

contract CoinFlipExploitTest is Test {
address playerAddr = makeAddr("player");
Expand All @@ -30,9 +29,7 @@ contract CoinFlipExploitTest is Test {
}

function testExploitVyper() public solveChecker {
VyperUtils vyperUtils = new VyperUtils();
vm.allowCheatcodes(address(vyperUtils));
address exploitAddr = vyperUtils.deploy("src/Ethernaut/CoinFlip/CoinFlipExploit.vy");
address exploitAddr = deployCode("src/Ethernaut/CoinFlip/CoinFlipExploit.vy");
for (uint256 i = 0; i < 10; i++) {
vm.roll(i + 10);
(bool success,) = exploitAddr.call(abi.encodeWithSignature("exploit(address)", instanceAddr));
Expand Down
4 changes: 2 additions & 2 deletions src/Ethernaut/CoinFlip/CoinFlipExploit.vy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ interface ICoinFlip:
def exploit(instanceAddress: address):
instance: ICoinFlip = ICoinFlip(instanceAddress)
blockValue: uint256 = convert(blockhash(block.number - 1), uint256)
coinFlip: uint256 = blockValue / FACTOR
coinFlip: uint256 = blockValue // FACTOR
side: bool = coinFlip == 1
instance.flip(side)
extcall instance.flip(side)
2 changes: 1 addition & 1 deletion src/HuffChallenge/challenge5/Challenge5.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract Challenge5Test is Test {

function setUp() public {
// Fork mainnet
vm.createSelectFork(vm.envString("RPC_ANKR_MAINNET"));
vm.createSelectFork(vm.envString("RPC_MAINNET"));
solver = HuffDeployer.config().deploy("HuffChallenge/challenge5/Challenge5");
}

Expand Down
2 changes: 1 addition & 1 deletion src/ParadigmCTF2021/Farmer/FarmerExploit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contract FarmerExploitTest is Test {
address playerAddress = makeAddr("player");

function setUp() public {
vm.createSelectFork(vm.envString("RPC_ANKR_MAINNET"));
vm.createSelectFork(vm.envString("RPC_MAINNET"));
vm.deal(playerAddress, 10 ether);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ParadigmCTF2021/Secure/SecureExploit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contract SecureExploitTest is Test {
address playerAddress = makeAddr("player");

function setUp() public {
vm.createSelectFork(vm.envString("RPC_ANKR_MAINNET"));
vm.createSelectFork(vm.envString("RPC_MAINNET"));
vm.deal(playerAddress, 50 ether);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ParadigmCTF2023/GrainsOfSand/Exploit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract ExploitTest is Test {
IToken token;

function setUp() public {
vm.createSelectFork("mainnet", 18437825);
vm.createSelectFork(vm.envString("RPC_MAINNET"), 18437825);
vm.deal(playerAddr, 1000 ether);
challenge = new Challenge();
tokenStore = ITokenStore(0x1cE7AE555139c5EF5A57CC8d814a867ee6Ee33D8);
Expand Down
2 changes: 1 addition & 1 deletion src/ParadigmCTF2023/SkillBasedGame/Exploit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract ExploitTest is Test {
Challenge challenge;

function setUp() public {
vm.createSelectFork("mainnet");
vm.createSelectFork(vm.envString("RPC_MAINNET"));
vm.deal(playerAddr, 1000 ether);

payable(BLACKJACK).transfer(50 ether);
Expand Down

0 comments on commit 280733f

Please sign in to comment.