feat: add --limits flag to cre workflow simulate#293
Open
Conversation
timothyF95
reviewed
Mar 5, 2026
tarcisiozf
previously approved these changes
Mar 9, 2026
# Conflicts: # cmd/root.go # cmd/workflow/simulate/simulate.go # cmd/workflow/workflow.go
24c07be to
33f71d1
Compare
timothyF95
reviewed
Mar 19, 2026
| "github.com/smartcontractkit/cre-cli/internal/runtime" | ||
| ) | ||
|
|
||
| func New(runtimeContext *runtime.Context) *cobra.Command { |
Contributor
There was a problem hiding this comment.
Is the runtimeContext used in this command?
| compressedLimit := simLimits.WASMCompressedBinarySize() | ||
| if compressedLimit > 0 { | ||
| var buf bytes.Buffer | ||
| gz := gzip.NewWriter(&buf) |
Contributor
There was a problem hiding this comment.
The actual deploy path uses brotli compression but this uses gzip. This will lead to quite drastically inaccurate results?
| // ResolveLimits resolves a --limits flag value to SimulationLimits. | ||
| // Returns nil if limitsFlag is "none" (no limits enforcement). | ||
| func ResolveLimits(limitsFlag string) (*SimulationLimits, error) { | ||
| if limitsFlag == "" || limitsFlag == "none" { |
Contributor
There was a problem hiding this comment.
I think there is an edge case here where if you call --limits flag with an empty space it silently vanishes?
| @@ -0,0 +1,284 @@ | |||
| package simulate | |||
Contributor
There was a problem hiding this comment.
Could we add some unit tests for this?
| @@ -0,0 +1,176 @@ | |||
| package simulate | |||
| // Apply simulation limits to engine-level settings when --limits is set | ||
| if simLimits != nil { | ||
| applyEngineLimits(cfg, simLimits) | ||
| // Re-apply allow-all chains since applyEngineLimits does not touch ChainAllowed |
Contributor
There was a problem hiding this comment.
I'm not sure I understand what we are reapplying here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan