neo_solidity/runtime/runtime_parts/runtime_impl/
config.rs1impl Default for RuntimeConfig {
2 fn default() -> Self {
3 Self {
4 gas_limit: 10_000_000,
5 call_stack_limit: 1024,
6 memory_limit: 1024 * 1024, storage_limit: 10 * 1024 * 1024, network_magic: 0x4F454E, enable_debugging: false,
10 enable_tracing: false,
11 strict_mode: true,
12 neo_version: "3.5.0".to_string(),
13 contract_account: "0x0000000000000000000000000000000000000000".to_string(),
14 default_block_height: 0,
15 default_timestamp: 0,
16 }
17 }
18}
19
20impl RuntimeConfig {
21 pub fn builder() -> RuntimeConfigBuilder {
23 RuntimeConfigBuilder::default()
24 }
25
26 pub fn for_testing() -> Self {
28 Self {
29 enable_debugging: true,
30 enable_tracing: true,
31 strict_mode: false,
32 ..Default::default()
33 }
34 }
35}
36
37#[derive(Debug, Clone, Default)]
39pub struct RuntimeConfigBuilder {
40 config: RuntimeConfig,
41}
42
43impl RuntimeConfigBuilder {
44 pub fn gas_limit(mut self, limit: u64) -> Self {
45 self.config.gas_limit = limit;
46 self
47 }
48
49 pub fn debugging(mut self, enabled: bool) -> Self {
50 self.config.enable_debugging = enabled;
51 self
52 }
53
54 pub fn tracing(mut self, enabled: bool) -> Self {
55 self.config.enable_tracing = enabled;
56 self
57 }
58
59 pub fn build(self) -> RuntimeConfig {
60 self.config
61 }
62}
63