Skip to content

Instantly share code, notes, and snippets.

View pcaversaccio's full-sized avatar
๐Ÿ’ฏ
Percent Commitment

sudo rm -rf --no-preserve-root / pcaversaccio

๐Ÿ’ฏ
Percent Commitment
View GitHub Profile
# add this to your hardhat config
# compilers: [
# {
# version: "0.8.13",
# settings: {
# viaIR: true,
# outputSelection: {
# "*": {
# "*": ["irOptimized"],
# },
@emo-eth
emo-eth / chain_funcs.sh
Last active June 22, 2023 14:43
Helper functions for interacting with chains and Foundry tests. Source from .zshrc etc
###########
# Imports #
###########
# the RPCs file should include RPC URLs and Etherscan API Keys for relevant networks
# (in a separate file so they don't get committed)
source "$(dirname "$0")/rpcs.sh"
# any useful addresses for various networks for easy reference
source "$(dirname "$0")/addresses.sh"
# any useful functions and definitions for interacting with Seaport
@yorickdowne
yorickdowne / HallOfBlame.md
Last active May 15, 2025 09:30
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on latency and IOPS, I/O Per Second, of the storage. Budget SSDs will struggle to an extent, and some won't be able to sync at all. IOPS can roughly be used as proxy of / predictor for latency. Measuring latency directly is arguably better.

This document aims to snapshot some known good and known bad models.

The drive lists are ordered by interface and then by capacity and alphabetically by vendor name, not by preference. The lists are not exhaustive at all. @mwpastore linked a filterable spreadsheet in comments that has a far greater variety of drives and their characteristics. Filter it by DRAM yes, NAND Type TLC, Form Factor M.2, and desired capacity.

For size, 4TB is a very conservative choice. The smaller 2TB drive should last an Ethereum full node until at least sometime 2026, with the [pre-merge history expiry](https://hackmd.io/@hBXHLw_9Qq2va4pRt

@Amxx
Amxx / UniversalWrapper.sol
Last active August 9, 2023 08:08
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC20.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
import "@openzeppelin/contracts/interfaces/IERC721Receiver.sol";
import "@openzeppelin/contracts/interfaces/IERC1155.sol";
import "@openzeppelin/contracts/interfaces/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
@cwhinfrey
cwhinfrey / bridge_hacks.md
Last active March 10, 2025 13:06
Bridge Hack List
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
// Used in the `name()` function
// "Yul Token"
bytes32 constant nameLength = 0x0000000000000000000000000000000000000000000000000000000000000009;
bytes32 constant nameData = 0x59756c20546f6b656e0000000000000000000000000000000000000000000000;
// Used in the `symbol()` function
// "YUL"
@devanoneth
devanoneth / pre-commit
Created November 11, 2022 04:11
Pre-commit hook for Foundry
#!/bin/bash
BWHITE='\033[1;37m'
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
printf "Running ${BWHITE}forge fmt${NC}... \n"
if forge fmt &>/dev/null; then
printf "${GREEN}Formatted!${NC} \n"
@ItsCuzzo
ItsCuzzo / disassembler.py
Created December 24, 2022 06:08
EVM Bytecode Disassembler
opcodes = {
0x00: 'STOP',
0x01: 'ADD',
0x02: 'MUL',
0x03: 'SUB',
0x04: 'DIV',
0x05: 'SDIV',
0x06: 'MOD',
0x07: 'SMOD',
0x08: 'ADDMOD',
โ–ถforge test --match-test testFuzzDistributeTokenMultipleAddressesSuccess -vvvvv
[โ ข] Compiling...
[โ Š] Compiling 86 files with 0.8.17
[โ ˜] Solc 0.8.17 finished in 27.91s
Compiler run successful
Running 1 test for test/utils/BatchDistributor.t.sol:BatchDistributorTest
[FAIL. Reason: Assertion failed. Counterexample: calldata=0xcc173d850000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000054a0000000000000000000000001804c8ab1f12e6bbf3894d4083f33e07309d1f3800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000026a0000000000000000000000000000000000000000000000000000000000000371000000000000000000000000000000000000000000000000000000000065737300000000000000000000000000000000000000000000000000000000000014b800000000000000000000000000000000000000000000000000000000000016a60000000000000000000000000000000000000000000000000