Giter Club home page Giter Club logo

bulk's Introduction

Bulk

Make compressed 4337 bundles swole again.

Bulk makes 4337 on L2 cheaper. Bundlers can pass compressed bundles to BundleBulker, which decompresses them before calling the 4337 EntryPoint contract. This reduces L1 data usage, the dominant cost of rollup transactions.

For example, here's a single USDC transfer executed as as a one-op bundle.

Before: 1.6kb

After: 353b

Details

Decompression happens via arbitrary contracts that implement IInflator. This lets bundlers or individual applications can define their own templates or decompression algorithms. Inflators can be stateful for greater savings.

A bundler supports compression as follows:

  • client submits compressed op
  • bundler inflates, validates as usual
  • bundler submits compressed

Compression is independent from the security of the contract account being called. The same userops go to the EntryPoint either way, validation and execution identical--this is just an optimization to use less calldata.

Bulk is intended for use directly by bundlers, eg with API keys--so griefing can be mitigated offchain. The userop mempool remains important for censorship resistance, and apps can continue to submit uncompressed ops to mempool as a fallback if a direct bundler API is unavailable.

Deployment Details

The deployment address of BundleBulker is 0x000000000091A1F34f51CE866bEd8983dB51a97E. (deployed using create2 with salt 7cf7a0f0060e1519d0ee3e12e0ee57890f69d7aa693404299a3a779e90cd7921)

Mainnets

Chain Name Deployment
Ethereum 0x000000000091A1F34f51CE866bEd8983dB51a97E
Base 0x000000000091A1F34f51CE866bEd8983dB51a97E
OP Mainnet 0x000000000091A1F34f51CE866bEd8983dB51a97E
Polygon 0x000000000091A1F34f51CE866bEd8983dB51a97E
Gnosis 0x000000000091A1F34f51CE866bEd8983dB51a97E
Arbitrum One 0x000000000091A1F34f51CE866bEd8983dB51a97E
BSC 0x000000000091A1F34f51CE866bEd8983dB51a97E
opBNB 0x000000000091A1F34f51CE866bEd8983dB51a97E
Avalanche 0x000000000091A1F34f51CE866bEd8983dB51a97E
Linea Mainnet 0x000000000091A1F34f51CE866bEd8983dB51a97E
lyra 0x000000000091A1F34f51CE866bEd8983dB51a97E
Scroll 0x000000000091A1F34f51CE866bEd8983dB51a97E
Klaytn 0x000000000091A1F34f51CE866bEd8983dB51a97E
DFK Chain 0x000000000091A1F34f51CE866bEd8983dB51a97E
Celo 0x000000000091A1F34f51CE866bEd8983dB51a97E

Testnets

Chain Name Deployment
Sepolia 0x000000000091A1F34f51CE866bEd8983dB51a97E
Goerli 0x000000000091A1F34f51CE866bEd8983dB51a97E
Base Sepolia 0x000000000091A1F34f51CE866bEd8983dB51a97E
Base Goerli 0x000000000091A1F34f51CE866bEd8983dB51a97E
Optimism Goerli 0x000000000091A1F34f51CE866bEd8983dB51a97E
Polygon Mumbai 0x000000000091A1F34f51CE866bEd8983dB51a97E
Arbitrum Sepolia 0x000000000091A1F34f51CE866bEd8983dB51a97E
Arbitrum Goerli 0x000000000091A1F34f51CE866bEd8983dB51a97E
BSC Testnet 0x000000000091A1F34f51CE866bEd8983dB51a97E
Avalanche Fuji 0x000000000091A1F34f51CE866bEd8983dB51a97E
Scroll Sepolia 0x000000000091A1F34f51CE866bEd8983dB51a97E
Gnosis Chiado 0x000000000091A1F34f51CE866bEd8983dB51a97E
Linea Goerli Testnet 0x000000000091A1F34f51CE866bEd8983dB51a97E
Celo Alfajores 0x000000000091A1F34f51CE866bEd8983dB51a97E

Quick start

Proof of concept. In active development.

git clone [email protected]:daimo-eth/bulk --recurse-submodules
foundryup
forge test

bulk's People

Contributors

dcposch avatar nalinbhardwaj avatar mouseless-eth avatar kopy-kat avatar

Stargazers

Timur Badretdinov avatar Anton Cheng avatar João Veiga avatar Isaac Almanza avatar Michael Demarais avatar  avatar  avatar B avatar cawfree avatar jpgonzalezra avatar Shebin John avatar lakshmi kanth avatar longcpp avatar  avatar Jorge Izquierdo avatar Oren avatar  avatar  avatar Charles avatar saurav verma avatar xiaodao avatar Richard avatar thedewer avatar Dylan avatar Dan Cline avatar HAOYUatHZ avatar Doug Binder avatar Georgios Konstantopoulos avatar  avatar vanbeethoven.eth avatar John Johnson avatar Mason Hall avatar Joaquim Verges avatar Sam avatar Vivek avatar  avatar Paul Cowgill avatar Shun Kakinoki avatar Liam Horne avatar Jake C-T avatar Adam Hodges avatar Valentin Mihov avatar Markus Haas avatar sudo rm -rf --no-preserve-root / avatar

Watchers

 avatar  avatar

bulk's Issues

Implement `submitBatch` in the BundleBulker

Currently you can only submit 1 userop in the BundleBulker

It would be useful to be able to submit multiple userops, each with its own specified inflator (which can differ for ops in the same batch)

Maybe could also have another one for the case when all the ops in the batch have the same inflator, so you don't need to specify the inflator for each and you can save some calldata

Bundler support

Goal

Make it easy for any app or wallet to use bundle compression.

Prototypes

Prototyping with Pimlico. If all goes well, this new API endpoint would eventually become an eth_... endpoint proposed via ERC.

V0

pimlico_sendCompressedUserOperations. Takes a complete compressed bundle, passes to BundleBulker

(So the bundler is not bundling, just forwarding--but useful to test integration.)

V1 / Option A

This lets you bundle compressed ops from multiple users into a single compressed bundle.

  • pimlico_sendCompressedUserOperations
    • input: CompressedOp[], where each op is {"opInflatorAddr":"0x...", "compressedOp":"0x..."}
    • output: op hashes, + optionally the containing bundle tx hash
    • suggested semantics...
      • loop thru ops
        • inflate each one calling the provided opInflatorAddr.
        • validate op using normal op validation
        • get inflator ID from Pimlico's PerOpInflator by calling inflatorToID(opInflatorAddr)
        • ...if inflatorID is 0, register the op inflator on your PerOpInflator first
      • finally, submit a bundle to BundleBulker

Whenever you want to change your beneficiary address, set the beneficiary on your PerOpInflator.

If you ever observe a submitted bundle revert (and rule out bundler errors such as not passing enough gas), it means one of the inflators changed its behavior between (validation offchain call to inflate) and (onchain submit) a second or two later.

Could temporarily flag/block API users that do this.

V1 / Option B

Same as above, but with a pimlico_sendCompressedUserOp singular. (If sending multiple ops, user just calls more than once.)

Separately, as an optimization, it's possible to do the inflator-registering and bundle-submitting in a single atomic multicall.

V1 / Option C

User is responsible for registering their own IOpInflator with bundler's PerOpInflator ahead of time. Then,

  • pimlico_sendCompressedUserOp(uint256 opInflatorId, byte[] compressedOp)
    • as above, but skip the steps related to registering an op inflator
    • instead, just look up an existing op inflator via idToInflator(opInflatorID), then use its inflate(), then validate the resulting UserOp

Test Bulk with Daimo

Goal

  • Compress our common-case Daimo 4337 bundle from ~1.5kb to ~350bytes
  • See how much we save on fees

Steps

  • Deploy to Base Goerli. Done. Generic BundleBulker, example DaimoTransferInflator
  • Manual testnet integration. Submit compressed bundles from sendUserOp in daimo-api.
  • Pimlico testnet integration.
  • Pimlico mainnet
  • Live

Idea: Make a compress view function for each inflator

it might be a nice affordance to put the compress function in a solidity view function

  • as a bundler you can then simulate the corresponding compress function yourself for a userop without any custom code from developer
    • can add bundle compression without any developer involvement
  • can unit/fuzz test compress and inflate against each other in solidity

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.