-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathconfig_defaults.go
108 lines (100 loc) · 2.95 KB
/
config_defaults.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package config
import (
"github.com/crytic/medusa/compilation/types"
"math/big"
testChainConfig "github.com/crytic/medusa/chain/config"
"github.com/crytic/medusa/compilation"
"github.com/rs/zerolog"
)
// GetDefaultProjectConfig obtains a default configuration for a project. It populates a default compilation config
// based on the provided platform, or a nil one if an empty string is provided.
func GetDefaultProjectConfig(platform string) (*ProjectConfig, error) {
var (
compilationConfig *compilation.CompilationConfig
chainConfig *testChainConfig.TestChainConfig
err error
)
// Try to obtain a default compilation config for this platform.
if platform != "" {
compilationConfig, err = compilation.NewCompilationConfig(platform)
if err != nil {
return nil, err
}
}
// Try to obtain a default chain config.
chainConfig, err = testChainConfig.DefaultTestChainConfig()
if err != nil {
return nil, err
}
// Obtain a default slither configuration
slitherConfig, err := types.NewDefaultSlitherConfig()
if err != nil {
return nil, err
}
// Create a project configuration
projectConfig := &ProjectConfig{
Fuzzing: FuzzingConfig{
Workers: 10,
WorkerResetLimit: 50,
Timeout: 0,
TestLimit: 0,
ShrinkLimit: 5_000,
CallSequenceLength: 100,
TargetContracts: []string{},
TargetContractsBalances: []*big.Int{},
PredeployedContracts: map[string]string{},
ConstructorArgs: map[string]map[string]any{},
CorpusDirectory: "",
CoverageEnabled: true,
CoverageFormats: []string{"html", "lcov"},
SenderAddresses: []string{
"0x10000",
"0x20000",
"0x30000",
},
DeployerAddress: "0x30000",
MaxBlockNumberDelay: 60480,
MaxBlockTimestampDelay: 604800,
BlockGasLimit: 125_000_000,
TransactionGasLimit: 12_500_000,
Testing: TestingConfig{
StopOnFailedTest: true,
StopOnFailedContractMatching: false,
StopOnNoTests: true,
TestAllContracts: false,
TraceAll: false,
TargetFunctionSignatures: []string{},
ExcludeFunctionSignatures: []string{},
AssertionTesting: AssertionTestingConfig{
Enabled: true,
TestViewMethods: false,
PanicCodeConfig: PanicCodeConfig{
FailOnAssertion: true,
},
},
PropertyTesting: PropertyTestingConfig{
Enabled: true,
TestPrefixes: []string{
"property_",
},
},
OptimizationTesting: OptimizationTestingConfig{
Enabled: true,
TestPrefixes: []string{
"optimize_",
},
},
},
TestChainConfig: *chainConfig,
},
Compilation: compilationConfig,
Slither: slitherConfig,
Logging: LoggingConfig{
Level: zerolog.InfoLevel,
LogDirectory: "",
NoColor: false,
},
}
// Return the project configuration
return projectConfig, nil
}