@@ -45,6 +45,59 @@ func CommandServe(cfg *config.Config) *cli.Command {
4545 Value : time .Second ,
4646 },
4747
48+ & cli.BoolFlag { // --chaos-xxx-enabled
49+ Category : strings .ToUpper (categoryChaos ),
50+ Destination : & cfg .Chaos .Enabled ,
51+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos + "_" + category ) + "_ENABLED" },
52+ Name : categoryChaos + "-" + category + "-enabled" ,
53+ Usage : "whether " + category + " proxy should be injecting artificial error conditions" ,
54+ Value : false ,
55+ },
56+
57+ & cli.Float64Flag { // --chaos-xxx-injected-http-error-probability
58+ Category : strings .ToUpper (categoryChaos ),
59+ Destination : & cfg .Chaos .InjectedHttpErrorProbability ,
60+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos + "_" + category ) + "_INJECTED_HTTP_ERROR_PROBABILITY" },
61+ Name : categoryChaos + "-" + category + "-injected-http-error-probability" ,
62+ Usage : "probability in `percent` at which to randomly inject http errors into responses processed by " + category + " proxy" ,
63+ Value : 0 ,
64+ },
65+
66+ & cli.Float64Flag { // --chaos-xxx-injected-jrpc-error-probability
67+ Category : strings .ToUpper (categoryChaos ),
68+ Destination : & cfg .Chaos .InjectedJrpcErrorProbability ,
69+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos + "_" + category ) + "_INJECTED_JRPC_ERROR_PROBABILITY" },
70+ Name : categoryChaos + "-" + category + "-injected-jrpc-error-probability" ,
71+ Usage : "probability in `percent` at which to randomly inject jrpc errors into responses processed by " + category + " proxy" ,
72+ Value : 0 ,
73+ },
74+
75+ & cli.Float64Flag { // --chaos-xxx-injected-invalid-jrpc-response-probability
76+ Category : strings .ToUpper (categoryChaos ),
77+ Destination : & cfg .Chaos .InjectedInvalidJrpcResponseProbability ,
78+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos + "_" + category ) + "_INJECTED_INVALID_JRPC_RESPONSE_PROBABILITY" },
79+ Name : categoryChaos + "-" + category + "-injected-invalid-jrpc-response-probability" ,
80+ Usage : "probability in `percent` at which to randomly inject invalid jrpc into responses processed by " + category + " proxy" ,
81+ Value : 0 ,
82+ },
83+
84+ & cli.DurationFlag { // --chaos-xxx-min-injected-latency
85+ Category : strings .ToUpper (categoryChaos ),
86+ Destination : & cfg .Chaos .MinInjectedLatency ,
87+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos + "_" + category ) + "_MIN_INJECTED_LATENCY" },
88+ Name : categoryChaos + "-" + category + "-min-injected-latency" ,
89+ Usage : "min `latency` to enforce on every response processed by " + category + " proxy" ,
90+ Value : 100 * time .Millisecond ,
91+ },
92+
93+ & cli.DurationFlag { // --chaos-xxx-max-injected-latency
94+ Category : strings .ToUpper (categoryChaos ),
95+ Destination : & cfg .Chaos .MaxInjectedLatency ,
96+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos + "_" + category ) + "_MAX_INJECTED_LATENCY" },
97+ Name : categoryChaos + "-" + category + "-max-injected-latency" ,
98+ Usage : "max `latency` to randomly enforce on every response processed by " + category + " proxy" ,
99+ },
100+
48101 & cli.DurationFlag { // --xxx-client-idle-connection-timeout
49102 Category : strings .ToUpper (category ),
50103 Destination : & cfg .ClientIdleConnectionTimeout ,
@@ -268,78 +321,76 @@ func CommandServe(cfg *config.Config) *cli.Command {
268321 },
269322 )
270323
271- chaosFlags := []cli.Flag { // --chaos -xxx
272- & cli.BoolFlag { // --chaos-enabled
273- Category : strings .ToUpper (categoryChaos ),
274- Destination : & cfg .Chaos . Enabled ,
275- EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_ENABLED " },
276- Name : categoryChaos + "-enabled " ,
277- Usage : "whether bproxy should be injecting artificial error conditions " ,
278- Value : false ,
324+ flashblocksFlags := []cli.Flag { // --flashblocks -xxx
325+ & cli.StringFlag { // --flashblocks-backend
326+ Category : strings .ToUpper (categoryFlashblocks ),
327+ Destination : & cfg .Flashblocks . BackendURL ,
328+ EnvVars : []string {envPrefix + strings .ToUpper (categoryFlashblocks ) + "_BACKEND " },
329+ Name : categoryFlashblocks + "-backend " ,
330+ Usage : "`url` of flashblocks backend " ,
331+ Value : "ws://127.0.0.1:11111" ,
279332 },
280333
281- & cli.Float64Flag { // --chaos-injected-http-error-probability
282- Category : strings .ToUpper (categoryChaos ),
283- Destination : & cfg .Chaos . InjectedHttpErrorProbability ,
284- EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_INJECTED_HTTP_ERROR_PROBABILITY " },
285- Name : categoryChaos + "-injected-http-error-probability " ,
286- Usage : "probability in `percent` at which to randomly inject http errors into proxied responses " ,
287- Value : 20 ,
334+ & cli.DurationFlag { // --flashblocks-backward-timeout
335+ Category : strings .ToUpper (categoryFlashblocks ),
336+ Destination : & cfg .Flashblocks . BackwardTimeout ,
337+ EnvVars : []string {envPrefix + strings .ToUpper (categoryFlashblocks ) + "_BACKWARD_TIMEOUT " },
338+ Name : categoryFlashblocks + "-backward-timeout " ,
339+ Usage : "max `duration` for flashblocks frontend reads and backend writes (0s means no timeout) " ,
340+ Value : 0 ,
288341 },
289342
290- & cli.Float64Flag { // --chaos-injected-jrpc-error -probability
343+ & cli.Float64Flag { // --chaos-flashblocks-dropped-message -probability
291344 Category : strings .ToUpper (categoryChaos ),
292- Destination : & cfg .Chaos .InjectedJrpcErrorProbability ,
293- EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_INJECTED_JRPC_ERROR_PROBABILITY " },
294- Name : categoryChaos + "-injected-jrpc-error -probability" ,
295- Usage : "probability in `percent` at which to randomly inject jrpc errors into proxied responses " ,
296- Value : 20 ,
345+ Destination : & cfg .Flashblocks . Chaos .DroppedMessageProbability ,
346+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_FLASHBLOCKS_DROPPED_MESSAGE_PROBABILITY " },
347+ Name : categoryChaos + "-flashblocks-dropped-message -probability" ,
348+ Usage : "probability in `percent` at which to randomly drop messages processed by flashblocks proxy " ,
349+ Value : 0 ,
297350 },
298351
299- & cli.Float64Flag { // --chaos-injected-invalid-jrpc-response-probability
352+ & cli.BoolFlag { // --chaos-flashblocks-enabled
300353 Category : strings .ToUpper (categoryChaos ),
301- Destination : & cfg .Chaos .InjectedInvalidJrpcResponseProbability ,
302- EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_INJECTED_INVALID_JRPC_RESPONSE_PROBABILITY " },
303- Name : categoryChaos + "-injected-invalid-jrpc-response-probability " ,
304- Usage : "probability in `percent` at which to randomly inject invalid jrpc into proxied responses " ,
305- Value : 20 ,
354+ Destination : & cfg .Flashblocks . Chaos .Enabled ,
355+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_FLASHBLOCKS_ENABLED " },
356+ Name : categoryChaos + "-flashblocks-enabled " ,
357+ Usage : "whether flashblocks proxy should be injecting artificial error conditions " ,
358+ Value : false ,
306359 },
307360
308- & cli.DurationFlag { // --chaos-min -injected-latency
361+ & cli.Float64Flag { // --chaos-flashblocks -injected-invalid-flashblock-payload-probability
309362 Category : strings .ToUpper (categoryChaos ),
310- Destination : & cfg .Chaos .MinInjectedLatency ,
311- EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_MIN_INJECTED_LATENCY " },
312- Name : categoryChaos + "-min -injected-latency " ,
313- Usage : "min `latency` to enforce on every proxied response " ,
314- Value : 50 * time . Millisecond ,
363+ Destination : & cfg .Flashblocks . Chaos .InjectedInvalidFlashblockPayloadProbability ,
364+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_FLASHBLOCKS_INJECTED_INVALID_FLASHBLOCK_PAYLOAD_PROBABILITY " },
365+ Name : categoryChaos + "-flashblocks -injected-invalid-flashblock-payload-probability " ,
366+ Usage : "probability in `percent` at which to randomly inject an invalid flashblock " ,
367+ Value : 0 ,
315368 },
316369
317- & cli.DurationFlag { // --chaos-max -injected-latency
370+ & cli.Float64Flag { // --chaos-flashblocks -injected-malformed-json-message-probability
318371 Category : strings .ToUpper (categoryChaos ),
319- Destination : & cfg .Chaos .MaxInjectedLatency ,
320- EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_MAX_INJECTED_LATENCY" },
321- Name : categoryChaos + "-max-injected-latency" ,
322- Usage : "max `latency` to randomly enforce on every proxied response" ,
372+ Destination : & cfg .Flashblocks .Chaos .InjectedMalformedJsonMessageProbability ,
373+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_FLASHBLOCKS_INJECTED_MALFORMED_JSON_MESSAGE_PROBABILITY" },
374+ Name : categoryChaos + "-flashblocks-injected-malformed-json-message-probability" ,
375+ Usage : "probability in `percent` at which to randomly inject a malformed json message" ,
376+ Value : 0 ,
323377 },
324- }
325378
326- flashblocksFlags := []cli.Flag { // --flashblocks-xxx
327- & cli.StringFlag { // --flashblocks-backend
328- Category : strings .ToUpper (categoryFlashblocks ),
329- Destination : & cfg .Flashblocks .BackendURL ,
330- EnvVars : []string {envPrefix + strings .ToUpper (categoryFlashblocks ) + "_BACKEND" },
331- Name : categoryFlashblocks + "-backend" ,
332- Usage : "`url` of flashblocks backend" ,
333- Value : "ws://127.0.0.1:11111" ,
379+ & cli.DurationFlag { // --chaos-flashblocks-min-injected-latency
380+ Category : strings .ToUpper (categoryChaos ),
381+ Destination : & cfg .Flashblocks .Chaos .MinInjectedLatency ,
382+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_FLASHBLOCKS_MIN_INJECTED_LATENCY" },
383+ Name : categoryChaos + "-flashblocks-min-injected-latency" ,
384+ Usage : "min `latency` to enforce on every response processed by flashblocks proxy" ,
385+ Value : 100 * time .Millisecond ,
334386 },
335387
336- & cli.DurationFlag { // --flashblocks-backward-timeout
337- Category : strings .ToUpper (categoryFlashblocks ),
338- Destination : & cfg .Flashblocks .BackwardTimeout ,
339- EnvVars : []string {envPrefix + strings .ToUpper (categoryFlashblocks ) + "_BACKWARD_TIMEOUT" },
340- Name : categoryFlashblocks + "-backward-timeout" ,
341- Usage : "max `duration` for flashblocks frontend reads and backend writes (0s means no timeout)" ,
342- Value : 0 ,
388+ & cli.DurationFlag { // --chaos-flashblocks-max-injected-latency
389+ Category : strings .ToUpper (categoryChaos ),
390+ Destination : & cfg .Flashblocks .Chaos .MaxInjectedLatency ,
391+ EnvVars : []string {envPrefix + strings .ToUpper (categoryChaos ) + "_FLASHBLOCKS_MAX_INJECTED_LATENCY" },
392+ Name : categoryChaos + "-flashblocks-max-injected-latency" ,
393+ Usage : "max `latency` to randomly enforce on every response processed by flashblocks proxy" ,
343394 },
344395
345396 & cli.DurationFlag { // --flashblocks-control-timeout
@@ -489,7 +540,6 @@ func CommandServe(cfg *config.Config) *cli.Command {
489540 authrpcFlags ,
490541 flashblocksFlags ,
491542 rpcFlags ,
492- chaosFlags ,
493543 metricsFlags ,
494544 )
495545
0 commit comments