Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
03f5b7e
add: README for statebloat scenarios
CPerezz May 7, 2025
b50c785
add: Add first iteration over contract-deploy
CPerezz May 7, 2025
372feec
refactor(contract-deploy): simplify deployment rate control
CPerezz May 7, 2025
b9ac6eb
fix: use correct contract metadata fields for bytecode and ABI packing
CPerezz May 7, 2025
76840e6
chore: rename gas constant to uppercase for better visibility
CPerezz May 7, 2025
dbf118d
feat(contract-deploy): add block gas limit validation
CPerezz May 7, 2025
5438bdd
add: Basic testing for contract deploying
CPerezz May 8, 2025
af640f2
feat(contract-deploy): enhance contract deployment scenarios
CPerezz May 12, 2025
5433718
fix(contract-deploy): Use 1559 fee config
CPerezz May 12, 2025
02affa8
feat(contract-deploy): setup-teardown for tests
CPerezz May 12, 2025
0924182
feat(contract-deploy): add dummy functions to increase bytecode size …
CPerezz May 13, 2025
e292669
feat(contract-deploy): enhance contract deployment scenario and logging
CPerezz May 23, 2025
2ab46fd
feat(contract-deploy): implement batch deployment strategy and transa…
CPerezz May 24, 2025
2c73f64
feat(contract-deploy): implement deployment mapping and final summary…
CPerezz May 24, 2025
bdf6528
refactor(contract-deploy): streamline contract deployment logic and i…
CPerezz May 24, 2025
bdbaa83
feat(contract-deploy): enhance transaction handling and dynamic fee a…
CPerezz May 25, 2025
8213808
chore: update readme
CPerezz May 25, 2025
891a0b4
chore: Clarify running instructions in contract_deploy readme
CPerezz May 25, 2025
c2d4313
update: Contract bytecode reduction to account for extra costs
CPerezz Jun 4, 2025
3132162
feat(contract-deploy): improve bytecode size ratio & auto-adapt to ga…
CPerezz Jun 7, 2025
94fc764
feat(contract-deploy): improve transaction handling with timestamp an…
CPerezz Jun 12, 2025
139b18e
chore: gitignore update to remoive .bin & .abi
CPerezz Jun 18, 2025
6db8db1
Merge branch 'master' into add/state_growth_worst_cases
CPerezz Jun 18, 2025
a5a17b0
fix(contract-deploy): resolve transaction stalling and improve block-…
CPerezz Jun 18, 2025
8f679d7
fix(contract-deploy): resolve compilation errors in contract deployme…
CPerezz Jun 18, 2025
56be866
Merge branch 'master' into add/state_growth_worst_cases
pk910 Jul 14, 2025
60cbc2f
feat(state-bloat): cold balance + warm extcodesize
weiihann Aug 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ bin
spamoor.db*
go.lib.mod
go.lib.sum
*.abi
*.bin
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ spamoor eoatx --privkey="0x..." \

Spamoor provides a comprehensive suite of transaction scenarios for different testing needs:


| Scenario | Description |
|----------|-------------|
| [`eoatx`](./scenarios/eoatx/README.md) | **EOA Transactions** - Send standard ETH transfers with configurable amounts |
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
github.com/prometheus/client_golang v1.22.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.10.0
github.com/swaggo/http-swagger v1.3.4
github.com/swaggo/swag v1.16.4
github.com/tdewolff/minify v2.3.6+incompatible
Expand All @@ -34,6 +35,7 @@ require (
github.com/consensys/bavard v0.1.27 // indirect
github.com/consensys/gnark-crypto v0.16.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand All @@ -54,6 +56,7 @@ require (
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions scenarios/scenarios.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"github.com/ethpandaops/spamoor/scenarios/gasburnertx"
"github.com/ethpandaops/spamoor/scenarios/geastx"
"github.com/ethpandaops/spamoor/scenarios/setcodetx"
contractdeploy "github.com/ethpandaops/spamoor/scenarios/statebloat/contract_deploy"
warmextcodesize "github.com/ethpandaops/spamoor/scenarios/statebloat/warm-extcodesize"
"github.com/ethpandaops/spamoor/scenarios/storagespam"
"github.com/ethpandaops/spamoor/scenarios/taskrunner"
uniswapswaps "github.com/ethpandaops/spamoor/scenarios/uniswap-swaps"
Expand Down Expand Up @@ -44,6 +46,8 @@ var ScenarioDescriptors = []*scenario.Descriptor{
&taskrunner.ScenarioDescriptor,
&uniswapswaps.ScenarioDescriptor,
&wallets.ScenarioDescriptor,
&contractdeploy.ScenarioDescriptor,
&warmextcodesize.ScenarioDescriptor,
&xentoken.ScenarioDescriptor,
}

Expand Down
35 changes: 35 additions & 0 deletions scenarios/statebloat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# State Bloat Scenarios

This directory contains scenarios designed to test different vectors of state growth on Ethereum. Each scenario focuses on a specific method of increasing the state size while minimizing ETH cost.

## Available Scenarios

1. `contract-deploy` - Deploys 24kB contracts (EIP-170 limit)
2. `delegate-flag` - Adds delegate flags to funded EOAs (EIP-7702)
3. `fund-eoa` - Funds fresh EOAs with minimal ETH
4. `empty-auth` - Creates EIP-7702 authorizations for empty addresses
5. `storage-slots` - Fills new storage slots in contracts

## Testing

These scenarios can be tested using Anvil (Foundry's local Ethereum node) or any other EVM-compatible testnet. For local testing:

```bash
# Start Anvil
anvil

# Run a scenario (example)
spamoor statebloat/contract-deploy [flags]
```

Each scenario directory contains its own README with specific configuration options and testing instructions.

## Gas Efficiency Comparison

| Rank | Scenario | Gas/Byte | Max Units in 30M Gas Block |
| ---- | --------------- | -------- | -------------------------- |
| 1 | Contract Deploy | ~202 | 6 deployments |
| 2 | Delegate Flag | ~232 | 960 tuples |
| 3 | Fund EOA | ~267 | 1000 accounts |
| 4 | Empty Auth | ~289 | 767 tuples |
| 5 | Storage Slots | 625 | 1500 slots |
58 changes: 58 additions & 0 deletions scenarios/statebloat/contract_deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 🏭 Contract Deployment State Bloat

This scenario deploys contracts that are exactly 24kB in size (EIP-170 limit) to maximize state growth while minimizing gas cost.

## How it Works

1. Generates a contract with exactly 24,576 bytes of runtime code
2. Deploys the contract using CREATE with a salt that makes the bytecode unique
3. Uses batch-based deployment:
- Calculates how many contracts fit in one block based on gas limits
- Sends a batch of transactions that fit within the block gas limit
- Waits for a new block to be mined
- Repeats the process ("bombards" the RPC after each block)
4. Each deployment adds:
- 24,576 bytes of runtime code
- Account trie node
- Total state growth: ~24.7kB per deployment

## ⛽ Gas Cost Breakdown

- 32,000 gas for CREATE
- 20,000 gas for new account
- 200 gas per byte for code deposit (24,576 bytes)
- **Total: 4,967,200 gas per deployment**

## Batch Strategy

The scenario automatically calculates how many contracts can fit in one block:
- Default block gas limit: 30,000,000 gas
- Gas per contract: 4,967,200 gas
- Contracts per batch: ~6 contracts per block

This ensures optimal utilization of block space while maintaining predictable transaction inclusion patterns.

## 🚀 Usage

### Build
```bash
go build -o bin/spamoor cmd/spamoor/main.go
```

### Run
```bash
./bin/spamoor --privkey <PRIVATE_KEY> --rpchost http://localhost:8545 contract-deploy [flags]
```

#### Key Flags
- `--max-transactions` - Total number of contracts to deploy (0 = infinite, default: 0)
- `--max-wallets` - Max child wallets to use (0 = root wallet only, default: 0)
- `--basefee` - Base fee per gas in gwei (default: 10)
- `--tipfee` - Tip fee per gas in gwei (default: 2)

#### Example with Anvil node
```bash
./bin/spamoor --privkey ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--rpchost http://localhost:8545 contract-deploy \
--max-transactions 0
```
35 changes: 35 additions & 0 deletions scenarios/statebloat/contract_deploy/contract/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contract Compilation

This directory contains the Solidity contract and its compiled artifacts. To compile the contract and generate Go bindings:

1. Install solc (Solidity compiler):
```bash
# On macOS
brew install solidity

# On Ubuntu/Debian
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc
```

2. Install abigen (ABI generator):
```bash
go install github.com/ethereum/go-ethereum/cmd/abigen@latest
```

3. Compile the contract:
```bash
solc --abi StateBloatToken.sol -o . --overwrite
solc --bin StateBloatToken.sol -o . --overwrite
```

4. Generate Go bindings:
```bash
abigen --bin=StateBloatToken.bin --abi=StateBloatToken.abi --pkg=contract --out=StateBloatToken.go
```

The generated files will be:
- `StateBloatToken.abi` - Contract ABI
- `StateBloatToken.bin` - Contract bytecode
- `StateBloatToken.go` - Go bindings

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3,205 changes: 3,205 additions & 0 deletions scenarios/statebloat/contract_deploy/contract/StateBloatToken.go

Large diffs are not rendered by default.

Loading