factorydeploytx

package
v1.1.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 16 Imported by: 0

README

FactoryDeployTx Scenario

Deploy contracts using CREATE2 factory for deterministic address calculation.

Description

This scenario deploys a CREATE2 factory contract and then uses it to deploy multiple contracts with deterministic addresses. It's designed to work with the AttackController to enable efficient random read testing.

Configuration

Basic Options
  • total_count: Total number of contracts to deploy
  • throughput: Number of deployment transactions per slot
  • max_pending: Maximum pending transactions
  • max_wallets: Maximum child wallets to use
  • gas_limit: Gas limit for transactions (default: 2000000)
Factory Options
  • factory_address: Address of existing CREATE2 factory (optional)
  • init_code: Hex-encoded init code of contract to deploy (required)
  • start_salt: Starting salt value for deployments (default: 0)
  • well_known_factory: Use well-known factory deployer wallet (default: true)
Example Configuration
- scenario: factorydeploytx
  name: "Deploy Large Contracts"
  config:
    seed: factory-deploy-001
    total_count: 1000
    throughput: 50
    gas_limit: 2000000
    well_known_factory: true
    init_code: "0x608060405234801561001057600080fd5b50......" # Large contract bytecode
    start_salt: 0

Usage with AttackController

  1. First run this scenario to deploy contracts via CREATE2 factory
  2. Then use the calltx scenario with AttackController to perform random reads
  3. The factory address and init code hash are used to calculate deployed contract addresses

Contract Address Calculation

Deployed contracts can be predicted using:

address = keccak256(0xff, factory_address, salt, keccak256(init_code))

Where salt starts from start_salt and increments for each deployment.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ScenarioDefaultOptions = ScenarioOptions{
	TotalCount:        0,
	Throughput:        50,
	MaxPending:        0,
	MaxWallets:        0,
	Rebroadcast:       1,
	BaseFee:           20,
	TipFee:            2,
	GasLimit:          2000000,
	FactoryAddress:    "",
	InitCode:          "",
	StartSalt:         0,
	WellKnownFactory:  true,
	Timeout:           "",
	ClientGroup:       "",
	DeployClientGroup: "",
	LogTxs:            false,
}
View Source
var ScenarioDescriptor = scenario.Descriptor{
	Name:           ScenarioName,
	Description:    "Deploy contracts using CREATE2 factory",
	DefaultOptions: ScenarioDefaultOptions,
	NewScenario:    newScenario,
}
View Source
var ScenarioName = "factorydeploytx"

Functions

This section is empty.

Types

type Scenario

type Scenario struct {
	// contains filtered or unexported fields
}

func (*Scenario) Flags

func (s *Scenario) Flags(flags *pflag.FlagSet) error

func (*Scenario) Init

func (s *Scenario) Init(options *scenario.Options) error

func (*Scenario) Run

func (s *Scenario) Run(ctx context.Context) error

type ScenarioOptions

type ScenarioOptions struct {
	TotalCount        uint64  `yaml:"total_count"`
	Throughput        uint64  `yaml:"throughput"`
	MaxPending        uint64  `yaml:"max_pending"`
	MaxWallets        uint64  `yaml:"max_wallets"`
	Rebroadcast       uint64  `yaml:"rebroadcast"`
	BaseFee           float64 `yaml:"base_fee"`
	TipFee            float64 `yaml:"tip_fee"`
	GasLimit          uint64  `yaml:"gas_limit"`
	FactoryAddress    string  `yaml:"factory_address"`
	InitCode          string  `yaml:"init_code"`
	StartSalt         uint64  `yaml:"start_salt"`
	WellKnownFactory  bool    `yaml:"well_known_factory"`
	Timeout           string  `yaml:"timeout"`
	ClientGroup       string  `yaml:"client_group"`
	DeployClientGroup string  `yaml:"deploy_client_group"`
	LogTxs            bool    `yaml:"log_txs"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL