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
@MerlinEgalite
MerlinEgalite / CreateSelfdestruct.sol
Last active May 26, 2023 06:24
Tornado Cash Governance Hack
pragma solidity >=0.8.0;
import "forge-std/Test.sol";
import "forge-std/console2.sol";
contract ContractA {
function destroy() public {
selfdestruct(payable(0));
}
@metachris
metachris / README.md
Last active July 18, 2024 02:59
Docs for running mev-boost relay + builder in devnets
@devtooligan
devtooligan / pureConsole.sol
Last active January 21, 2024 14:25
console.log from pure functions h/t @z0age
// @author original POC by @z0age
library pureConsole {
/*********************
* string + uint256
********************/
function log(string memory errorMessage, uint256 value) internal pure {

Do you write smart contracts? Want them to be safe and efficient? Read on!

The state of smart contract languages could historically be categorized as lacking constructs that drive programmers to write safe code and being inefficient due to poor optimizations. Oftentimes, programmers write lower level code riddled with footguns in pursuit of gas savings. What if safety and efficiency weren’t at odds?

Here’s how we can eliminate an entire class of bugs without spending an exorbitant amount of gas on safety checks thanks to EIP-1153!

For example, take the following smart contract (Figure 1) which exhibits “read-only reentrancy”. Currently, nothing prevents the following call sequence from succeeding despite there being ambiguity about what value will be returned by DataRace.price during call sequence, X.

Callstack [DataRace.withdraw, msg.sender, X, token.transfer]

@kalaspuff
kalaspuff / readme.md
Last active June 21, 2023 11:37
Validating Ledger signatures relayed via MetaMask by implementing a simple function that corrects the {v} value of an invalid vrs signature

Validating Ledger signatures relayed via MetaMask

Find the full article at https://mirror.xyz/coa.eth/mvPbLPXvy375CXi1_XwMTzG84lwlSKYUBHDx_R1TIgU, which includes some additional context, descriptions of symptoms, etc.

"Ledger devices produces vrs signatures with a canonical {v} value of 0 or 1."

This write-up goes through some brief details on vrs signatures, what makes signature validation fail on some web apps when signing using a Ledger device connected through MetaMask extension, followed by what to do about it.

- "I'm in hurry and just want things to work."
- "Reasonable. Scroll down some for the fix. It's just four rows of JS + comments."

@denguir
denguir / cuda_install.md
Last active May 8, 2025 16:23
Installation procedure for CUDA / cuDNN / TensorRT

How to install CUDA / cuDNN / TensorRT on Ubuntu

Install NVIDIA drivers

Update & upgrade

sudo apt update && sudo apt upgrade

Remove previous NVIDIA installation

@hrkrshnn
hrkrshnn / Readme.md
Last active April 4, 2023 08:11
Instructions to see raw SMTLib queries generated by SMTChecker from solc

Compile solc locally after applying the below patch (solc.patch).Build instructions.

./solc example.sol --model-checker-engine bmc
Call to check. Solver state:
(declare-datatypes ((bytes_tuple 0)) (((bytes_tuple (bytes_tuple_accessor_array (Array Int Int)) (bytes_tuple_accessor_length Int)))))
(declare-datatypes ((tx_type 0)) (((tx_type (block.basefee Int) (block.chainid Int) (block.coinbase Int) (block.difficulty Int) (block.gaslimit Int) (block.number Int) (block.timestamp Int) (blockhash (Array Int Int)) (msg.data bytes_tuple) (msg.sender Int) (msg.sig Int) (msg.value Int) (tx.gasprice Int) (tx.origin Int)))))
@cleanunicorn
cleanunicorn / remove_node_modules.sh
Created March 28, 2023 08:33
Remove node_modules for infinite new space
#!/bin/bash
echo "Searching for node_modules directories..."
find . -type d -name "node_modules" -prune -exec echo "Removing {}" \; -exec rm -rf {} \;
echo "All node_modules directories have been removed."
#!/bin/bash
alias c='code .'
alias cdh='cd $HOME'
alias ls='ls -la'
alias sl="ls"
alias cls='clear'
alias g='git status'
alias gap='git add -p'
alias gl='git log'
@DanielVF
DanielVF / erc20.sol
Last active February 7, 2023 21:25
Event Only Cursed ERC20
pragma solidity >=0.8.17;
// Cursed ERC20 that does everything in events.
// by @danielvf, based solmate by @transmissions11
abstract contract ERC20 {
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
string public name;