Skip to content

Instantly share code, notes, and snippets.

@stong
stong / cast_example.txt
Last active August 22, 2022 23:53
EVM universal constructor
cast rpc eth_sendTransaction '{"data": "'$(cat constructor_bytecode.txt)$(cat bytecode.txt)'"}'
@sambacha
sambacha / foundry.yaml
Created August 4, 2022 19:35
Foundry CI example
on:
push:
paths:
- 'contracts/**/*.sol'
- 'interfaces/**/*.sol'
- '.github/workflows/*.yaml'
- '.github/workflows/*.yml'
name: Foundry tests
# --- evm quine ---
# ⬜ => ⬜
# --- stack ---
# immediate value for push15
# is the compiled bytecode for part 2
push15 0x8060781b173d52386001606e8153f3 # c
# --- part 2 ---
dup1 # c c
@nadaepeu
nadaepeu / V6.4 NFT Bot Rewards Scheme Proposal.md
Last active November 6, 2022 06:26
V6.4 NFT Bot Rewards Scheme Proposal

Issues with V6 approach

  • Each NFT should appear only once in the winning block
  • Rewards pool exploitation with the immediate LIMIT orders
  • Current scheme has led to gas wars
    • We need data to show the percentage of the gns rewards that are sold for matic fees (the same also for the paid LINK)
  • Bad actors are front/back running successful bots
  • NFTs are losing value since they can not be profitable in the bot arena for most people
  • Generally, create a new scheme that will stop being the playground for bad / greedy actors

NFT Bot Ecosystem Focus

@yorickdowne
yorickdowne / HallOfBlame.md
Last active April 10, 2025 02:54
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

name: Test contracts (foundry)
on:
push:
branches:
- master
- foundry
tags:
- "*"
pull_request:
pragma solidity =0.8.13;
contract Test {
struct MyStruct{
uint num;
bytes32 info;
}
MyStruct[] myStruct;
function add(uint a, bytes32 b) external {
myStruct.push(MyStruct({num: a, info: b}));
}
"anvil_stopImpersonatingAccount",
"anvil_setBalance", "params": ["0xd84de507f3fada7df80908082d3239466db55a71", "0x0"],
"anvil_setBalance", "params": ["0xd84de507f3fada7df80908082d3239466db55a71", 1337],
"anvil_setCode", "params": ["0xd84de507f3fada7df80908082d3239466db55a71", "0x0123456789abcdef"],
"anvil_setNonce", "params": ["0xd84de507f3fada7df80908082d3239466db55a71", "0x0"],
"anvil_setStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "0x00"],
"anvil_setCoinbase", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251"],
"anvil_setLoggingEnabled", "params": [false],
"anvil_setMinGasPrice", "params": ["0x0"],
@hrkrshnn
hrkrshnn / BribeContract.yul
Last active October 10, 2022 14:42
Run by `solc --strict-assembly --optimize --ir-optimized`. Context: https://twitter.com/NoahZinsmeister/status/1499845282598731782 Need to use Yul, since there is no `verbatim` in Solidity's inline assembly.
// UNTESTED!
object "BribeContract" {
code {
let size := datasize("BribeRuntime")
codecopy(0, dataoffset("BribeRuntime"), size)
return(0, size)
}
object "BribeRuntime" {
code {
// Bribe by sending ETH. To try and claim, send a tx without ETH. Assumes that a tx with
CREATE TEMP FUNCTION
hex64ToInt64(hex STRING)
RETURNS INT64 AS (
IF(hex < "8000000000000000",
cast(concat("0x", hex) AS INT64),
(SELECT (((ms32 & 0x7fffffff) << 32) | ls32) - 0x7fffffffffffffff - 1
FROM (SELECT cast(concat("0x", substr(hex, 1, 8)) AS INT64) AS ms32,
cast(concat("0x", substr(hex, 9, 8)) AS INT64) AS ls32))));
CREATE TEMP FUNCTION
KECCAK(data STRING)