Skip to content

Instantly share code, notes, and snippets.

View sandybradley's full-sized avatar

Sandy Bradley sandybradley

View GitHub Profile

Private mempool - reth patch

Reth Private Mempool Implementation Plan

Architecture Overview

We'll extend reth's transaction pool to support a segregated private mempool with access controls, while ensuring private transactions don't leak to the public network.

Core Infrastructure

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "forge-std/Test.sol";
import "forge-std/console.sol";
interface IBEXVault {
enum UserBalanceOpKind { DEPOSIT_INTERNAL, WITHDRAW_INTERNAL, TRANSFER_INTERNAL }
struct UserBalanceOp { UserBalanceOpKind kind; address asset; uint256 amount; address sender; address payable recipient; }
struct BatchSwapStep { bytes32 poolId; uint256 assetInIndex; uint256 assetOutIndex; uint256 amount; bytes userData; }
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.26;
import {ERC20} from "@solmate/tokens/ERC20.sol";
import {ERC4626} from "@solmate/tokens/ERC4626.sol";
import {SafeTransferLib} from "@solmate/utils/SafeTransferLib.sol";
import {ReentrancyGuard} from "@solmate/utils/ReentrancyGuard.sol";
import {Errors} from "src/utils/Errors.sol";
import {Infrared} from "src/core/Infrared.sol";