Skip to content

Commit

Permalink
Merge branch 'master' into feat/rework-mutators
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush committed Sep 5, 2024
2 parents 7260ca1 + 4e56d69 commit a77fc25
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions chain/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ type TestChainConfig struct {
// CheatCodeConfig indicates the configuration for EVM cheat codes to use.
CheatCodeConfig CheatCodeConfig `json:"cheatCodes"`

// SkipAccountChecks skips account pre-checks like nonce validation and disallowing non-EOA tx senders (this is done in eth_call, for instance).
SkipAccountChecks bool `json:"skipAccountChecks"`

// ContractAddressOverrides describes contracts that are going to be deployed at deterministic addresses
ContractAddressOverrides map[common.Hash]common.Address `json:"contractAddressOverrides,omitempty"`
}
Expand Down
1 change: 1 addition & 0 deletions chain/config/config_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ func DefaultTestChainConfig() (*TestChainConfig, error) {
CheatCodesEnabled: true,
EnableFFI: false,
},
SkipAccountChecks: true,
}

// Return the generated configuration.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/project_configuration/chain_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ The chain configuration defines the parameters for setting up `medusa`'s underly
- > 🚩 Setting `codeSizeCheckDisabled` to `false` is not recommended since it complicates the fuzz testing process.
- **Default**: `true`

### `skipAccountChecks`

- **Type**: Boolean
- **Description**: If `true`, account-related checks (nonce validation, transaction origin must be an EOA) are disabled in `go-ethereum`.
- **Default**: `true`

## Cheatcode Configuration

### `cheatCodesEnabled`
Expand Down
9 changes: 7 additions & 2 deletions docs/src/static/medusa.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
"workerResetLimit": 50,
"timeout": 0,
"testLimit": 0,
"shrinkLimit": 5000,
"callSequenceLength": 100,
"corpusDirectory": "",
"coverageEnabled": true,
"targetContracts": [],
"predeployedContracts": {},
"targetContractsBalances": [],
"constructorArgs": {},
"deployerAddress": "0x30000",
Expand Down Expand Up @@ -45,14 +47,17 @@
"optimizationTesting": {
"enabled": true,
"testPrefixes": ["optimize_"]
}
},
"targetFunctionSignatures": [],
"excludeFunctionSignatures": []
},
"chainConfig": {
"codeSizeCheckDisabled": true,
"cheatCodes": {
"cheatCodesEnabled": true,
"enableFFI": false
}
},
"skipAccountChecks": true
}
},
"compilation": {
Expand Down
5 changes: 5 additions & 0 deletions fuzzing/sequence_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ func (g *CallSequenceGenerator) generateNewElement() (*calls.CallSequenceElement
InputValues: args,
})

if g.worker.fuzzer.config.Fuzzing.TestChainConfig.SkipAccountChecks {
msg.SkipAccountChecks = true
}

// Determine our delay values for this element
blockNumberDelay := uint64(0)
blockTimestampDelay := uint64(0)
Expand Down Expand Up @@ -467,6 +471,7 @@ func callSeqGenFuncSpliceAtRandom(provider *rand.Rand, sequenceGenerator func()
// Obtain two corpus call sequence entries
headSequence, err := sequenceGenerator()
if err != nil {
return fmt.Errorf("could not obtain tail corpus call sequence for splice-at-random corpus mutation: %v", err)
}
tailSequence, err := sequenceGenerator()
if err != nil {
Expand Down

0 comments on commit a77fc25

Please sign in to comment.