Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 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
2b21a11
add(eao-delegation): Create eoa-delegation scenario oriented to bloating
CPerezz Jun 10, 2025
e36c0c2
feat(rand_sstore_bloater): add SSTOREStorageBloater contract and scen…
CPerezz Jun 13, 2025
94117b4
feat(erc20_max_transfers): add ERC20 Max Transfers scenario and imple…
CPerezz Jun 18, 2025
6db8db1
Merge branch 'master' into add/state_growth_worst_cases
CPerezz Jun 18, 2025
1a33861
Merge branch 'master' into feat/eoa-delegation
CPerezz Jun 18, 2025
d559344
Merge branch 'master' into feat/rand_sstore_bloating
CPerezz Jun 18, 2025
183e3a7
chore(erc20_max_transfers):
CPerezz Jun 18, 2025
ecfc17a
Merge branch 'master' into feat/erc20_max_transfers
CPerezz Jun 18, 2025
eb03b45
various fixes & improvements for `statebloat-eoa-delegation` scenario
pk910 Jun 18, 2025
2c0ffdc
Merge remote-tracking branch 'cperezz/feat/rand_sstore_bloating' into…
pk910 Jun 18, 2025
26b8bad
various fixes for `statebloat-rand-sstore` scenario
pk910 Jun 18, 2025
985ae2f
small fixes for `statebloat-rand-sstore`
pk910 Jun 19, 2025
4b9eded
fix nil pointer panic
pk910 Jun 19, 2025
585eaaa
Merge branch 'master' into pk910/statebloat-scenarios
pk910 Jun 19, 2025
a59fd69
deduplicate gas calculation
pk910 Jun 19, 2025
d035eb4
Merge remote-tracking branch 'cperezz/add/state_growth_worst_cases' i…
pk910 Jun 19, 2025
a95cfe1
streamline `statebloat-contract-deploy` scenario
pk910 Jun 19, 2025
660c0ff
Merge remote-tracking branch 'cperezz/feat/erc20_max_transfers' into …
pk910 Jun 19, 2025
977b885
fixes for `statebloat-erc20-max-transfers` scenario
pk910 Jun 19, 2025
d309e2c
Merge branch 'master' into pk910/statebloat-scenarios
pk910 Jun 19, 2025
e36dcef
update for latest master changes
pk910 Jun 19, 2025
aacb43e
small fix
pk910 Jun 19, 2025
e0bf3d3
Merge branch 'master' into pk910/statebloat-scenarios
pk910 Jun 20, 2025
1282168
`go mod tidy`
pk910 Jun 20, 2025
b88a08f
add external wallets to wallet pool
pk910 Jun 20, 2025
49c68e8
fix missing logger
pk910 Jun 21, 2025
3abd2ed
fix for external wallet initialization
pk910 Jun 21, 2025
8a36be1
Merge branch 'master' into pk910/statebloat-scenarios
pk910 Jun 21, 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 @@ -53,6 +53,7 @@ RPC hosts support additional configuration parameters through URL prefixes:

Spamoor provides multiple scenarios for different transaction types:


| Scenario | Description |
|----------|-------------|
| [`eoatx`](./scenarios/eoatx/README.md) | **EOA Transactions**<br>Send standard EOA transactions with configurable amounts and targets |
Expand Down
8 changes: 8 additions & 0 deletions scenarios/scenarios.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import (
"github.com/ethpandaops/spamoor/scenarios/gasburnertx"
"github.com/ethpandaops/spamoor/scenarios/geastx"
"github.com/ethpandaops/spamoor/scenarios/setcodetx"
sbcontractdeploy "github.com/ethpandaops/spamoor/scenarios/statebloat/contract_deploy"
sbeoadelegation "github.com/ethpandaops/spamoor/scenarios/statebloat/eoa_delegation"
sberc20maxtransfers "github.com/ethpandaops/spamoor/scenarios/statebloat/erc20_max_transfers"
sbrandsstore "github.com/ethpandaops/spamoor/scenarios/statebloat/rand_sstore"
"github.com/ethpandaops/spamoor/scenarios/storagespam"
uniswapswaps "github.com/ethpandaops/spamoor/scenarios/uniswap-swaps"
"github.com/ethpandaops/spamoor/scenarios/wallets"
Expand All @@ -39,6 +43,10 @@ var ScenarioDescriptors = []*scenario.Descriptor{
&gasburnertx.ScenarioDescriptor,
&geastx.ScenarioDescriptor,
&setcodetx.ScenarioDescriptor,
&sbcontractdeploy.ScenarioDescriptor,
&sbeoadelegation.ScenarioDescriptor,
&sberc20maxtransfers.ScenarioDescriptor,
&sbrandsstore.ScenarioDescriptor,
&storagespam.ScenarioDescriptor,
&uniswapswaps.ScenarioDescriptor,
&wallets.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
```
3 changes: 3 additions & 0 deletions scenarios/statebloat/contract_deploy/contract/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.output.json
*.bin
*.abi
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
3,360 changes: 3,360 additions & 0 deletions scenarios/statebloat/contract_deploy/contract/StateBloatToken.go

Large diffs are not rendered by default.

Loading