Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tm2): add sdk/params module #2920

Merged
merged 31 commits into from
Oct 23, 2024
Merged

Conversation

moul
Copy link
Member

@moul moul commented Oct 7, 2024

  • port x/params -> sdk/params b930513
  • inject in vmkeeper + add std.SetConfig 602245d
  • implement in gnoland 783a044
    • appchain
    • rpc query
    • txtar
  • implement or add comment where we should use it in the existing codebase
    • namespace's realm target
  • questions
    • do we want a std.GetConfig from the contract part? -> No, it allows unsafe, complex, and implicit patterns. If you want to get a value from another contract, you can either import it or use a registry pattern. This approach preserves type safety and other GNOVM protections.
    • do we want to restrict the realms able to call SetConfig (only r/sys), or maybe set an expensive gas price?
  • after discussion with jae
    • Rename Config -> Param for consistency
    • Remove interface{} from the setters and use specific types, including in the tm2 implementation (string, uint64, int64, bool, bytes)
    • Remove the .<type> suffix addition, but ensure that the type is explicitly defined by the user; and remove the table.
    • Remove the types table from the tm2 implementation

Related #1418
Related #1856

@moul moul self-assigned this Oct 7, 2024
@moul moul marked this pull request as ready for review October 7, 2024 13:35
@moul moul requested review from a team, jaekwon, piux2 and zivkovicmilos as code owners October 7, 2024 13:35
@github-actions github-actions bot added the 📦 🌐 tendermint v2 Issues or PRs tm2 related label Oct 7, 2024
@moul moul marked this pull request as draft October 7, 2024 13:35
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 71.57360% with 56 lines in your changes missing coverage. Please review.

Project coverage is 63.02%. Comparing base (5c876f3) to head (060a3be).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
gnovm/stdlibs/std/params.go 0.00% 34 Missing ⚠️
tm2/pkg/sdk/params/handler.go 81.57% 4 Missing and 3 partials ⚠️
tm2/pkg/sdk/params/keeper.go 91.66% 4 Missing and 2 partials ⚠️
gno.land/pkg/sdk/vm/builtins.go 63.63% 4 Missing ⚠️
gno.land/pkg/sdk/vm/keeper.go 66.66% 3 Missing ⚠️
tm2/pkg/sdk/auth/keeper.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2920      +/-   ##
==========================================
- Coverage   63.18%   63.02%   -0.17%     
==========================================
  Files         561      565       +4     
  Lines       78636    81124    +2488     
==========================================
+ Hits        49690    51125    +1435     
- Misses      25569    26545     +976     
- Partials     3377     3454      +77     
Flag Coverage Δ
contribs/gnodev 59.94% <ø> (ø)
contribs/gnofaucet 14.82% <ø> (ø)
gno.land 67.37% <70.83%> (-0.01%) ⬇️
gnovm 67.86% <0.00%> (+0.26%) ⬆️
misc/genstd 79.72% <ø> (ø)
tm2 62.53% <89.20%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@moul moul force-pushed the dev/moul/mod-params branch 2 times, most recently from e31c026 to c177c69 Compare October 8, 2024 10:42
@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Oct 9, 2024
@moul moul force-pushed the dev/moul/mod-params branch 4 times, most recently from df1da8c to 2a5b678 Compare October 10, 2024 18:07
Signed-off-by: moul <94029+moul@users.noreply.github.com>
@moul moul force-pushed the dev/moul/mod-params branch 2 times, most recently from 4c04221 to 95ab0bd Compare October 11, 2024 19:05
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
@moul moul marked this pull request as ready for review October 22, 2024 03:05
@moul moul requested review from thehowl, gfanton and a team as code owners October 22, 2024 03:05
Signed-off-by: moul <94029+moul@users.noreply.github.com>
@moul moul requested a review from a team as a code owner October 22, 2024 14:15
Signed-off-by: moul <94029+moul@users.noreply.github.com>
thehowl pushed a commit that referenced this pull request Oct 22, 2024
The change does not appear to be applied to my PR #2920, so I am opening
a dedicated PR to make Codecov aware.

Signed-off-by: moul <94029+moul@users.noreply.github.com>
@albttx
Copy link
Member

albttx commented Oct 22, 2024

do we want a std.GetConfig from the contract part? -> nope

Could you elaborate on why this decision ?

Edit(@moul): udpated the OC

gnovm/stdlibs/std/params.go Outdated Show resolved Hide resolved
gnovm/stdlibs/std/params.go Outdated Show resolved Hide resolved
misc/genstd/Makefile Outdated Show resolved Hide resolved
tm2/pkg/sdk/params/keeper.go Show resolved Hide resolved
tm2/pkg/sdk/params/handler.go Outdated Show resolved Hide resolved
tm2/pkg/sdk/params/handler.go Outdated Show resolved Hide resolved
tm2/pkg/sdk/params/handler.go Show resolved Hide resolved
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

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

overall lgtm

Copy link
Contributor

@jaekwon jaekwon left a comment

Choose a reason for hiding this comment

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

added 2 more change requests but approving beforehand

gnovm/stdlibs/std/params.gno Outdated Show resolved Hide resolved
tm2/pkg/sdk/params/keeper.go Outdated Show resolved Hide resolved
tm2/pkg/sdk/params/keeper.go Show resolved Hide resolved
gnovm/stdlibs/std/params.gno Outdated Show resolved Hide resolved
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
@moul moul merged commit 43dd3f3 into gnolang:master Oct 23, 2024
118 checks passed
@moul moul deleted the dev/moul/mod-params branch October 23, 2024 04:28
zivkovicmilos pushed a commit that referenced this pull request Nov 12, 2024
- [x] add `r/sys/params`
- [x] add `genesis/genesis_params.toml`
- [x] port some existing configurations
- [x] open issue: add LRU lazy caching with instant invalidation using a
transient store (#3023)

Depends on #2920 
Depends on #3003 (cherry-picked)
Blocking #2911

---------

Signed-off-by: moul <94029+moul@users.noreply.github.com>
Co-authored-by: Morgan <morgan@morganbaz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants