• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created about 2 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Minimal bytecode peephole optimizer

Bytepeep β€’ License Crates.io

Bytecode in, optimized bytecode out.

About

Bytepeep is a minimal bytecode peephole optimizer. Like any other peephole optimizer, it works by passing pairs of opcodes, peepholes, through a pattern matching algorithm to be checked against a set of rules and optimized if possible.

diagram

This is not intended as a replacement for solidity's built-in optimizers. Rather it should serve as a quick and easy tool for low-level smart contract development.

Installation

Install Rust & Cargo: curl https://sh.rustup.rs -sSf | sh

Install bytepeep: cargo install bytepeep

Run: bytepeep <bytecode>

Todo

Contributions welcome!

  • Handle multi-variable rules, (stack/memory dependent)
  • Reassign jumps
  • Handle different inputs
    • Mnemonics
    • Huff
  • Return tips along with optimized bytecode

Disclaimer

This is experimental software and is provided on an "as is" and "as available" basis. We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

More Repositories

1

smart-contract-vulnerabilities

A collection of smart contract vulnerabilities along with prevention methods
1,650
star
2

gas-optimizations

List of smart contract optimizations in solidity
614
star
3

function-selector-miner

Blazingly fast function selector miner written in Rust.
Rust
77
star
4

bit-packed-map

On-chain 8x8 bitmap svg packed into a single 32 byte storage slot.
Solidity
64
star
5

ERC721K

Maximally efficient (WIP), minimalist ERC-721 implementation. Inspired by solmate/ERC721's minimalist architecture and forked from ERC721A.
Solidity
61
star
6

uni-lbp

A capital-efficient Uniswap v4 liquidity bootstrapping pool (LBP) hooks contract
Solidity
55
star
7

yul-721

ERC721 contract written entirely in assembly, with custom storage mappings.
Solidity
23
star
8

veLP

Curve style voting escrow (ve) Uniswap v4 hook contract
Solidity
22
star
9

huff-tools

A set of tools for use with the huff language.
Solidity
21
star
10

hourglass

Solidity
20
star
11

labyrinth

Curta CTF #12
Rust
20
star
12

evm-golf

EVM gas golfing challenges
Solidity
9
star
13

audit-portfolio

Publicly available audits and bug reports
9
star
14

ape-staking

Rust
7
star
15

mint-150-huff

Winning solution to https://twitter.com/RareSkills_io/status/1585456440206295041
Solidity
6
star
16

max-mint-exploit

reentrancy exploit on maxMintPerUser nft contracts using _safeMint
JavaScript
5
star
17

gen-721-template

A template for creating art blocks-style generative nft's complete with smart contract and p5js environments
JavaScript
2
star
18

bitpacklib

Solidity
2
star
19

report-template

Audit report template
TeX
2
star
20

storage-locator

library to locate storage slots of arrays and mappings
Solidity
2
star
21

compound-governance

The first (unofficial) governance portal for compound.finance
JavaScript
1
star
22

putin-poopy-pants

TypeScript
1
star