Skip to content

Instantly share code, notes, and snippets.

@cassc
cassc / selfdestruct-gas-and-stack.json
Created May 16, 2024 07:47
selfdestruct gas and stack value mismatches
{
"00000014-mixed-4": {
"env": {
"currentCoinbase": "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"currentDifficulty": "0x200000",
"currentRandom": "0x0000000000000000000000000000000000000000000000000000000000200000",
"currentGasLimit": "0x26e1f476fe1e22",
"currentNumber": "0x1",
"currentTimestamp": "0x3e8",
"previousHash": "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d",
@cassc
cassc / sstore-gas.json
Created May 16, 2024 07:41
sstore gas
{
"00000007-mixed-4": {
"env": {
"currentCoinbase": "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"currentDifficulty": "0x200000",
"currentRandom": "0x0000000000000000000000000000000000000000000000000000000000200000",
"currentGasLimit": "0x26e1f476fe1e22",
"currentNumber": "0x1",
"currentTimestamp": "0x3e8",
"previousHash": "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d",
@cassc
cassc / create2-gas.json
Created May 16, 2024 07:37
create2-gas-mismatch
{
"00000001-mixed-9": {
"env": {
"currentCoinbase": "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"currentDifficulty": "0x200000",
"currentRandom": "0x0000000000000000000000000000000000000000000000000000000000200000",
"currentGasLimit": "0x26e1f476fe1e22",
"currentNumber": "0x1",
"currentTimestamp": "0x3e8",
"previousHash": "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d",
@cassc
cassc / ecrecover-call-gas-mismatch.json
Created May 16, 2024 07:36
ecrecover call gas mismatch
// cuevm --input xxx.json
// geth --json --noreturndata --nomemory statetest xxx.json
{
"00000004-mixed-1": {
"env": {
"currentCoinbase": "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"currentDifficulty": "0x200000",
"currentRandom": "0x0000000000000000000000000000000000000000000000000000000000200000",
"currentGasLimit": "0x26e1f476fe1e22",
@cassc
cassc / cast-json-example.py
Created May 15, 2024 06:25
Use cast run to get traces as json
# ❯ CAST_BIN=[optional-cast-binary-full-path] python cast-json-example.py
import subprocess
import json
import os
import tempfile
cast_bin = os.environ.get('CAST_BIN', 'cast')
def cast_run(rpc_url, txhash):
@cassc
cassc / trace_transaction_response.json
Created May 10, 2024 03:08
trace_transaction response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"action": {
"callType": "call",
"from": "0x6438b5009a81b85800511f12a3d15f61fb553f53",
"gas": "0x12f44",
"input": "0xa9059cbb0000000000000000000000007154980e9be95eab4eef2269650d4c7e17f156b80000000000000000000000000000000000000000000000000000000033721c51",
@cassc
cassc / standard-input.json
Created April 29, 2024 07:37
sample standard json input with only one input
{
"language": "Solidity",
"settings": {
"optimizer": {
"enabled": false
},
"outputSelection": {
"*": {
"": [
"ast"
@cassc
cassc / MyTestContract.sol
Created April 29, 2024 05:42
reentrancy bug test
// SPDX-License-Identifier: MIT
pragma solidity >0.8.0;
contract MyTestContract {
mapping(address => uint) public balances;
address public owner ;
constructor() payable {
owner = msg.sender;
balances[msg.sender] = msg.value;
@cassc
cassc / AlienCodexTest.sol
Created April 11, 2024 09:46
AlienCodexTest
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Test.sol";
interface AlienCodex{
function owner() external view returns (address);
function makeContact() external;
function retract() external;
function revise(uint i, bytes32 _content) external;
}
@cassc
cassc / MagicNumTest.sol
Created April 11, 2024 09:38
MagicNumTest
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Test.sol";
contract Minimum{
address public addr;
constructor(){
// init code
// prepare CODECOPY
// PUSH1 0x0a // size of code, 10 bytes