Skip to content

Instantly share code, notes, and snippets.

@roninjin10
roninjin10 / blockprompt.md
Created August 20, 2025 19:11
block-prompt.md

Block-Based EVM Optimization with BLOCK_START Instructions

Overview

This prompt outlines the implementation of a comprehensive block-based optimization system for the Guillotine EVM that introduces BLOCK_START pseudo-instructions to enable advanced optimizations including stack validation, gas pre-calculation, and intelligent prefetching.

Core Philosophy

Instead of validating stack depth and calculating gas costs instruction-by-instruction during execution, we pre-analyze bytecode into basic blocks and aggregate requirements at the block level. This enables:

/// Frame represents the entire execution state of the EVM as it executes opcodes
/// Layout designed around actual opcode access patterns and data correlations
pub const Frame = struct {
// ULTRA HOT - Accessed by virtually every opcode
stack: Stack, // 33,536 bytes - accessed by every opcode (PUSH/POP/DUP/SWAP/arithmetic/etc)
gas_remaining: u64, // 8 bytes - checked/consumed by every opcode for gas accounting
// HOT - Accessed by major opcode categories
memory: *Memory, // 8 bytes - hot for memory ops (MLOAD/MSTORE/MSIZE/MCOPY/LOG*/KECCAK256)
analysis: *const CodeAnalysis, // 8 bytes - hot for control flow (JUMP/JUMPI validation)
// Hot execution flags (only the bits that are actually checked frequently)
@roninjin10
roninjin10 / high-effort-prompt.md
Created July 28, 2025 02:49
High effort prompt

Implement Secure Git Command Execution Wrapper

<task_definition> Create a secure, high-performance Git command execution wrapper in Zig that provides a safe interface for running Git operations. This wrapper will be the foundation for all Git functionality in Plue, supporting both local operations and Git smart HTTP protocol for remote operations. </task_definition>

<context_and_constraints>

<technical_requirements>

@roninjin10
roninjin10 / unicode.chatgptanswer.md
Created July 17, 2025 00:20
Dumb unicode question

Not a dumb question at all — Unicode is one of those things that feels invisible and magical until you peek under the hood. Let’s break this down:

🧠 How do machines know what Unicode characters mean?

Machines don’t intrinsically know what Unicode is. They just deal with numbers (code points). What gives those numbers meaning is: 1. The Unicode Standard (the global agreement). 2. Fonts and rendering engines (to visually represent them). 3. Software libraries and operating systems (to parse, encode, and decode).

@roninjin10
roninjin10 / fuzz-test-ens-normalize.zig
Last active July 15, 2025 16:42
Ens normalize fuzz test example
const std = @import("std");
const ens_normalize = @import("ens_normalize");
const tokenizer = ens_normalize.tokenizer;
const code_points = ens_normalize.code_points;
const testing = std.testing;
// Main fuzz testing function that should never crash
pub fn fuzz_tokenization(input: []const u8) !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();

Consensus Engine Analysis Agent

You are an expert blockchain engineer specializing in Ethereum consensus mechanisms, block validation, and state transitions. You have deep knowledge of Ethereum's consensus rules, fork choice algorithms, and the transition from PoW to PoS. Your task is to analyze Reth's consensus engine and create an implementation plan for Zig. Analyze the Reth consensus engine codebase and create a detailed breakdown of subtasks required to implement the consensus layer in Zig. Focus on validation rules, fork handling, and integration with the execution engine.
@roninjin10
roninjin10 / opencode.md
Created June 30, 2025 07:07
OpenCode Product Specification (with Source Annotations)

OpenCode Product Specification (with Source Annotations)

Overview

OpenCode is a command-line AI coding assistant that provides an interactive terminal-based interface for AI-powered software development. It supports multiple AI providers, offers extensive customization options, and includes advanced features like language server integration, file monitoring, and session sharing.

Installation and Setup

Installation Methods

Source: packages/opencode/src/installation/index.ts

@roninjin10
roninjin10 / wasm-report.txt
Last active June 21, 2025 04:29
Tevm wasm report
=== WASM Size Analysis Tool ===
## File Size Comparison
Debug build: 1,451,592 bytes (1.38 MB)
Stripped build: 136,695 bytes (133.49 KB)
Debug overhead: 1,314,897 bytes (1.25 MB) (90.6% of debug build)
## Detailed Analysis of Stripped Build
@roninjin10
roninjin10 / revm-ethjs-precompiiles.md
Created June 14, 2025 20:01
Revm and ethereumjs browser friendly precompiles

Below is a detailed breakdown of how Ethereum’s built-in precompiled contracts are handled in two major EVM implementations—EthereumJS (TypeScript/JavaScript) and Revm (Rust)—including where the code lives, what libraries it leverages, how it’s compiled (or not) to WebAssembly, and illustrative code snippets.


1. Ethereum Precompile Specification

Ethereum precompiled contracts are “native” contracts at fixed addresses that perform complex operations more efficiently than EVM bytecode. The original set at addresses 0x010x09 is defined in Appendix E of the Yellow Paper, and subsequent EIPs have added more:

  1. 0x01 ECRECOVER: ECDSA public‐key recovery
  2. 0x02 SHA256: 256-bit SHA-2 hash
import { readdirSync } from "node:fs";
import { readFile, writeFile } from "node:fs/promises";
import { join, basename } from "node:path";
import { execSync } from "node:child_process";
import { GoogleGenerativeAI } from "@google/generative-ai";
import "dotenv";
const GEMINI_API_KEY = process.env.GEMINI_API_KEY;
const MODEL = "gemini-2.5-pro-preview-06-05 ";