Skip to content

Commit 06c5dac

Browse files
authored
pkg/settings/cresettings: refactor Consensus fields (#1615)
1 parent 9362b18 commit 06c5dac

3 files changed

Lines changed: 54 additions & 33 deletions

File tree

pkg/settings/cresettings/defaults.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@
4848
"FilterAddressLimit": "5",
4949
"FilterTopicsPerSlotLimit": "10"
5050
},
51-
"HTTPAction": {
52-
"CallLimit": "3",
53-
"ResponseSizeLimit": "10kb",
54-
"ConnectionTimeout": "10s",
55-
"RequestSizeLimit": "100kb",
56-
"CacheAgeLimit": "10m0s"
57-
},
5851
"ChainWrite": {
5952
"TargetsLimit": "3",
6053
"ReportSizeLimit": "1kb",
@@ -66,6 +59,17 @@
6659
"CallLimit": "3",
6760
"LogQueryBlockLimit": "100",
6861
"PayloadSizeLimit": "5kb"
62+
},
63+
"Consensus": {
64+
"ObservationSizeLimit": "10kb",
65+
"CallLimit": "2"
66+
},
67+
"HTTPAction": {
68+
"CallLimit": "3",
69+
"ResponseSizeLimit": "10kb",
70+
"ConnectionTimeout": "10s",
71+
"RequestSizeLimit": "100kb",
72+
"CacheAgeLimit": "10m0s"
6973
}
7074
}
7175
}

pkg/settings/cresettings/defaults.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ EventSizeLimit = '5kb'
4949
FilterAddressLimit = '5'
5050
FilterTopicsPerSlotLimit = '10'
5151

52-
[PerWorkflow.HTTPAction]
53-
CallLimit = '3'
54-
ResponseSizeLimit = '10kb'
55-
ConnectionTimeout = '10s'
56-
RequestSizeLimit = '100kb'
57-
CacheAgeLimit = '10m0s'
58-
5952
[PerWorkflow.ChainWrite]
6053
TargetsLimit = '3'
6154
ReportSizeLimit = '1kb'
@@ -67,3 +60,14 @@ TransactionGasLimit = '5000000'
6760
CallLimit = '3'
6861
LogQueryBlockLimit = '100'
6962
PayloadSizeLimit = '5kb'
63+
64+
[PerWorkflow.Consensus]
65+
ObservationSizeLimit = '10kb'
66+
CallLimit = '2'
67+
68+
[PerWorkflow.HTTPAction]
69+
CallLimit = '3'
70+
ResponseSizeLimit = '10kb'
71+
ConnectionTimeout = '10s'
72+
RequestSizeLimit = '100kb'
73+
CacheAgeLimit = '10m0s'

pkg/settings/cresettings/settings.go

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ var Default = Schema{
6868
ConsensusCallsLimit: Int(2),
6969
LogLineLimit: Size(config.KByte),
7070
LogEventLimit: Int(1_000),
71+
7172
CRONTrigger: cronTrigger{
7273
RateLimit: Rate(rate.Every(30*time.Second), 1),
7374
},
@@ -81,13 +82,7 @@ var Default = Schema{
8182
FilterTopicsPerSlotLimit: Int(10),
8283
EventSizeLimit: Size(5 * config.KByte),
8384
},
84-
HTTPAction: httpAction{
85-
CallLimit: Int(3),
86-
ResponseSizeLimit: Size(10 * config.KByte),
87-
ConnectionTimeout: Duration(10 * time.Second),
88-
RequestSizeLimit: Size(100 * config.KByte),
89-
CacheAgeLimit: Duration(10 * time.Minute),
90-
},
85+
9186
ChainWrite: chainWrite{
9287
TargetsLimit: Int(3),
9388
ReportSizeLimit: Size(config.KByte),
@@ -100,6 +95,17 @@ var Default = Schema{
10095
LogQueryBlockLimit: Uint64(100),
10196
PayloadSizeLimit: Size(5 * config.KByte),
10297
},
98+
Consensus: consensus{
99+
ObservationSizeLimit: Size(10 * config.KByte),
100+
CallLimit: Int(2),
101+
},
102+
HTTPAction: httpAction{
103+
CallLimit: Int(3),
104+
ResponseSizeLimit: Size(10 * config.KByte),
105+
ConnectionTimeout: Duration(10 * time.Second),
106+
RequestSizeLimit: Size(100 * config.KByte),
107+
CacheAgeLimit: Duration(10 * time.Minute),
108+
},
103109
},
104110
}
105111

@@ -148,18 +154,22 @@ type Workflows struct {
148154
WASMMemoryLimit Setting[config.Size]
149155
WASMBinarySizeLimit Setting[config.Size]
150156

157+
// Deprecated: use Consensus.ObservationSizeLimit
151158
ConsensusObservationSizeLimit Setting[config.Size]
152-
ConsensusCallsLimit Setting[int] `unit:"{call}"`
159+
// Deprecated: use Consensus.CallLimit
160+
ConsensusCallsLimit Setting[int] `unit:"{call}"`
153161

154162
LogLineLimit Setting[config.Size]
155163
LogEventLimit Setting[int] `unit:"{log}"`
156164

157165
CRONTrigger cronTrigger
158166
HTTPTrigger httpTrigger
159167
LogTrigger logTrigger
160-
HTTPAction httpAction
161-
ChainWrite chainWrite
162-
ChainRead chainRead
168+
169+
ChainWrite chainWrite
170+
ChainRead chainRead
171+
Consensus consensus
172+
HTTPAction httpAction
163173
}
164174

165175
type cronTrigger struct {
@@ -175,13 +185,6 @@ type logTrigger struct {
175185
FilterAddressLimit Setting[int] `unit:"{address}"`
176186
FilterTopicsPerSlotLimit Setting[int] `unit:"{topic}"`
177187
}
178-
type httpAction struct {
179-
CallLimit Setting[int] `unit:"{call}"`
180-
ResponseSizeLimit Setting[config.Size]
181-
ConnectionTimeout Setting[time.Duration]
182-
RequestSizeLimit Setting[config.Size]
183-
CacheAgeLimit Setting[time.Duration]
184-
}
185188
type chainWrite struct {
186189
TargetsLimit Setting[int] `unit:"{target}"`
187190
ReportSizeLimit Setting[config.Size]
@@ -191,9 +194,19 @@ type chainWrite struct {
191194
type evmChainWrite struct {
192195
TransactionGasLimit Setting[uint64] `unit:"{gas}"`
193196
}
194-
195197
type chainRead struct {
196198
CallLimit Setting[int] `unit:"{call}"`
197199
LogQueryBlockLimit Setting[uint64] `unit:"{block}"`
198200
PayloadSizeLimit Setting[config.Size]
199201
}
202+
type httpAction struct {
203+
CallLimit Setting[int] `unit:"{call}"`
204+
ResponseSizeLimit Setting[config.Size]
205+
ConnectionTimeout Setting[time.Duration]
206+
RequestSizeLimit Setting[config.Size]
207+
CacheAgeLimit Setting[time.Duration]
208+
}
209+
type consensus struct {
210+
ObservationSizeLimit Setting[config.Size]
211+
CallLimit Setting[int] `unit:"{call}"`
212+
}

0 commit comments

Comments
 (0)