Skip to content

Support uniform and zipfian gas distribution in workload modeler - #70

Open
ayaanoncrypto wants to merge 1 commit into
sei-protocol:mainfrom
ayaanoncrypto:contrib/issue-35
Open

Support uniform and zipfian gas distribution in workload modeler#70
ayaanoncrypto wants to merge 1 commit into
sei-protocol:mainfrom
ayaanoncrypto:contrib/issue-35

Conversation

@ayaanoncrypto

Copy link
Copy Markdown

No description provided.

@cursor

cursor Bot commented Aug 27, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes only affect load-test gas value generation in config; no auth, networking, or persistence paths.

Overview
Extends gas workload modeling so configs can pick gas values with the same distribution styles already used for keys: explicit uniform sampling and zipfian (YCSB-style) skew.

GasPicker now unmarshals Name: "uniform" (and keeps random as an alias) into a new UniformGasGenerator; RandomGasGenerator delegates to that type so existing random JSON stays behavior-compatible. A new zipfian name maps to ZipfianGasGenerator, which samples an index via the shared ZipfianDistribution and offsets by Min/Max, with theta validated at unmarshal time.

Tests cover uniform/zipfian picker wiring, zipfian seed reproducibility, and bounded draws over [Min, Max].

Reviewed by Cursor Bugbot for commit c9adbb0. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c9adbb0. Configure here.

Comment thread config/gas.go
return err
}
if err := zipfian.dist.validate(); err != nil {
return err

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zipfian gas skips theta validation

High Severity

UnmarshalJSON calls validate on the zero-value dist rather than the unmarshaled theta, so every zipfian gas config passes. GenerateGas then copies the unchecked theta onto dist and samples. An out-of-range value, including 1.0 where alpha diverges, yields a numerically broken gas distribution instead of a parse error.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c9adbb0. Configure here.

Comment thread config/gas.go
}
z.dist.Theta = z.Theta
n := z.Max - z.Min + 1
idx, err := z.dist.SampleIndex(rng, n)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zipfian gas range is uncapped

High Severity

GenerateGas passes Max - Min + 1 to the zipfian sampler, which precomputes zeta in O(n) with no upper bound, and Validate does not cap this span. The same picker type is used for gasFeeCapPicker and gasTipCapPicker, where a typical wei range is billions of values and stalls the first draw with nothing logged.

Fix in Cursor Fix in Web

Triggered by learned rule: config/: Validate() must reject silently-degrading misconfigurations

Reviewed by Cursor Bugbot for commit c9adbb0. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant