Skip to content

Commit

Permalink
feat: add r/sys/params + params genesis support (#3003)
Browse files Browse the repository at this point in the history
- [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 <[email protected]>
Co-authored-by: Morgan <[email protected]>
  • Loading branch information
moul and thehowl authored Nov 12, 2024
1 parent 60304df commit 36cdadb
Show file tree
Hide file tree
Showing 25 changed files with 833 additions and 40 deletions.
16 changes: 7 additions & 9 deletions examples/gno.land/r/gov/dao/v2/dao.gno
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ var (
)

func init() {
var (
// Example initial member set (just test addresses)
set = []membstore.Member{
{
Address: std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"),
VotingPower: 10,
},
}
)
// Example initial member set (just test addresses)
set := []membstore.Member{
{
Address: std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"),
VotingPower: 10,
},
}

// Set the member store
members = membstore.NewMembStore(membstore.WithInitialMembers(set))
Expand Down
82 changes: 82 additions & 0 deletions examples/gno.land/r/gov/dao/v2/prop1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,85 @@ func main() {
// - #123: g12345678 (10)
// - #123: g000000000 (10)
// - #123: g000000000 (0)

// Events:
// [
// {
// "type": "ProposalAdded",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "proposal-author",
// "value": "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitProposalAdded"
// },
// {
// "type": "VoteAdded",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "author",
// "value": "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"
// },
// {
// "key": "option",
// "value": "YES"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitVoteAdded"
// },
// {
// "type": "ProposalAccepted",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitProposalAccepted"
// },
// {
// "type": "ValidatorAdded",
// "attrs": [],
// "pkg_path": "gno.land/r/sys/validators/v2",
// "func": "addValidator"
// },
// {
// "type": "ValidatorAdded",
// "attrs": [],
// "pkg_path": "gno.land/r/sys/validators/v2",
// "func": "addValidator"
// },
// {
// "type": "ValidatorRemoved",
// "attrs": [],
// "pkg_path": "gno.land/r/sys/validators/v2",
// "func": "removeValidator"
// },
// {
// "type": "ProposalExecuted",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "exec-status",
// "value": "accepted"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "ExecuteProposal"
// }
// ]
64 changes: 64 additions & 0 deletions examples/gno.land/r/gov/dao/v2/prop2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,67 @@ func main() {
// ### [Hello from GovDAO!](/r/gnoland/blog:p/hello-from-govdao)
// 13 Feb 2009
// </div></div>

// Events:
// [
// {
// "type": "ProposalAdded",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "proposal-author",
// "value": "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitProposalAdded"
// },
// {
// "type": "VoteAdded",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "author",
// "value": "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"
// },
// {
// "key": "option",
// "value": "YES"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitVoteAdded"
// },
// {
// "type": "ProposalAccepted",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitProposalAccepted"
// },
// {
// "type": "ProposalExecuted",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "exec-status",
// "value": "accepted"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "ExecuteProposal"
// }
// ]
67 changes: 66 additions & 1 deletion examples/gno.land/r/gov/dao/v2/prop3_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"gno.land/p/demo/dao"
"gno.land/p/demo/membstore"
"gno.land/r/gov/dao/bridge"
govdao "gno.land/r/gov/dao/v2"
)

Expand Down Expand Up @@ -34,7 +35,7 @@ func init() {
Executor: govdao.NewMemberPropExecutor(memberFn),
}

govdao.Propose(prop)
bridge.GovDAO().Propose(prop)
}

func main() {
Expand Down Expand Up @@ -118,3 +119,67 @@ func main() {
//
// --
// 4

// Events:
// [
// {
// "type": "ProposalAdded",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "proposal-author",
// "value": "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitProposalAdded"
// },
// {
// "type": "VoteAdded",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "author",
// "value": "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"
// },
// {
// "key": "option",
// "value": "YES"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitVoteAdded"
// },
// {
// "type": "ProposalAccepted",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "EmitProposalAccepted"
// },
// {
// "type": "ProposalExecuted",
// "attrs": [
// {
// "key": "proposal-id",
// "value": "0"
// },
// {
// "key": "exec-status",
// "value": "accepted"
// }
// ],
// "pkg_path": "gno.land/r/gov/dao/v2",
// "func": "ExecuteProposal"
// }
// ]
Loading

0 comments on commit 36cdadb

Please sign in to comment.