clabby / op-kompressor

A suite of contracts and utilities that enable cheaper transactions on Optimism (and other EVM-equivalent L2s)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

op-kompressortests license

Note
This project has potential to reduce the costs of swaps and other transactions with large calldata payloads on L2s by a significant amount. It is intended to be used with ERC-4337 and other account abstraction methods, such as Gnosis Safes that allow for delegatecalling the CallKompressor contract.

op-kompressor is a suite of contracts that allows for relaying compressed abi-encoded payloads to L2 chains (like Optimism) where calldata is an expensive resource.

CallKompressor

The CallKompressor.huff (@ commit c2cff9c) is deployed on Optimism @ 0xf6fd99599d7121cbbc5e7c95d2ba83aa273d89c8

Deprecated Versions

The CallKompressor (@ commit b9f2394) is deployed on Optimism @ 0x6C56659A3EBE86394bF67889d860Fc74F404B867

Results

Transaction L1 Gas Usage ZeroKompressed?
Direct ID Uniswap Payload 8,828 No
ZeroKompressed ID Uniswap Payload 6,440 Yes

Compression Schemes

  • Run Length Encoding - RLE is great for Ethereum calldata because it's often the case that there are many repeated values in a given payload. The downside of RLE is that space efficiency for payloads with many unique values is poor. This is why op-kompressor supports a hybrid scheme that uses RLE for zero bytes (the most commonly repeated byte in calldata). For certain niche use cases, RLE may be a better choice than the hybrid scheme.

About

A suite of contracts and utilities that enable cheaper transactions on Optimism (and other EVM-equivalent L2s)

License:MIT License


Languages

Language:Solidity 79.5%Language:Rust 20.5%