Skip to content

Commit 929bc63

Browse files
davd-gzlmoul
andauthored
revert: namespace requirement for govdao (#5186)
fix: #5176 ref: #4717 There's one file diff due to a blank line modification in `examples/gno.land/r/sys/names/verifier_test.gno` Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
1 parent e54979a commit 929bc63

25 files changed

+23
-292
lines changed

examples/gno.land/r/gnoland/users/v1/z_0_prop1_filetest.gno

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,8 @@ import (
1616
// Test updating a name via GovDAO
1717
var c address = runtime.OriginCaller()
1818

19-
const gUsersV1Path = "gno.land/r/gnoland/users/v1"
20-
21-
// Register a namespace for every addresses
22-
// Necessary to test GovDAO Vote
23-
func registerTestUser(addrs ...address) {
24-
// Set realm to users admin to register test user
25-
testing.SetRealm(testing.NewCodeRealm(gUsersV1Path))
26-
for _, addr := range addrs {
27-
err := susers.RegisterUser(cross, addr.String()[1:], addr)
28-
if err != nil {
29-
panic(err.Error() + " : " + addr.String())
30-
}
31-
}
32-
}
33-
3419
func init() {
3520
daov3init.InitWithUsers(c)
36-
registerTestUser(c)
3721

3822
alice := testutils.TestAddress("alice")
3923

@@ -83,7 +67,7 @@ func main() {
8367
// [> Go to Memberstore <](/r/gov/dao/v3/memberstore)
8468
// ## Proposals
8569
// ### [Prop #0 - User Registry V1: Rename user `alice123` to `alice_new123`](/r/gov/dao:0)
86-
// Author: [@1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm](/u/1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
70+
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
8771
//
8872
// Status: ACTIVE
8973
//
@@ -94,7 +78,7 @@ func main() {
9478
//
9579
// --
9680
// ## Prop #0 - User Registry V1: Rename user `alice123` to `alice_new123`
97-
// Author: [@1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm](/u/1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
81+
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
9882
//
9983
//
10084
//
@@ -116,12 +100,10 @@ func main() {
116100
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
117101
//
118102
// WARNING: Please double check transaction data before voting.
119-
//
120-
// **New**: Members **must** have a namespace to vote to enforce simpler tracking.
121103
// --
122104
// --
123105
// ## Prop #0 - User Registry V1: Rename user `alice123` to `alice_new123`
124-
// Author: [@1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm](/u/1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
106+
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
125107
//
126108
//
127109
//
@@ -143,12 +125,10 @@ func main() {
143125
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
144126
//
145127
// WARNING: Please double check transaction data before voting.
146-
//
147-
// **New**: Members **must** have a namespace to vote to enforce simpler tracking.
148128
// --
149129
// --
150130
// ## Prop #0 - User Registry V1: Rename user `alice123` to `alice_new123`
151-
// Author: [@1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm](/u/1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
131+
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
152132
//
153133
//
154134
//
@@ -170,6 +150,4 @@ func main() {
170150
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
171151
//
172152
// WARNING: Please double check transaction data before voting.
173-
//
174-
// **New**: Members **must** have a namespace to vote to enforce simpler tracking.
175153
// g1v9kxjcm9ta047h6lta047h6lta047h6lzd40gh

examples/gno.land/r/gnoland/users/v1/z_1_prop2_filetest.gno

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,8 @@ import (
1616
// Test updating a name via GovDAO
1717
var c address = runtime.OriginCaller()
1818

19-
const gUsersV1Path = "gno.land/r/gnoland/users/v1"
20-
21-
// Register a namespace for every addresses
22-
// Necessary to test GovDAO Vote
23-
func registerTestUser(addrs ...address) {
24-
// Set realm to users admin to register test user
25-
testing.SetRealm(testing.NewCodeRealm(gUsersV1Path))
26-
for _, addr := range addrs {
27-
err := susers.RegisterUser(cross, addr.String()[1:], addr)
28-
if err != nil {
29-
panic(err.Error() + " : " + addr.String())
30-
}
31-
}
32-
}
33-
3419
func init() {
3520
daov3init.InitWithUsers(c)
36-
registerTestUser(c)
3721

3822
alice := testutils.TestAddress("alice")
3923

@@ -85,7 +69,7 @@ func main() {
8569
// [> Go to Memberstore <](/r/gov/dao/v3/memberstore)
8670
// ## Proposals
8771
// ### [Prop #0 - User Registry V1: Delete user `alice123`](/r/gov/dao:0)
88-
// Author: [@1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm](/u/1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
72+
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
8973
//
9074
// Status: ACTIVE
9175
//
@@ -96,7 +80,7 @@ func main() {
9680
//
9781
// --
9882
// ## Prop #0 - User Registry V1: Delete user `alice123`
99-
// Author: [@1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm](/u/1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
83+
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
10084
//
10185
// delete user test
10286
//
@@ -118,12 +102,10 @@ func main() {
118102
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
119103
//
120104
// WARNING: Please double check transaction data before voting.
121-
//
122-
// **New**: Members **must** have a namespace to vote to enforce simpler tracking.
123105
// --
124106
// --
125107
// ## Prop #0 - User Registry V1: Delete user `alice123`
126-
// Author: [@1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm](/u/1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
108+
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
127109
//
128110
// delete user test
129111
//
@@ -145,12 +127,10 @@ func main() {
145127
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
146128
//
147129
// WARNING: Please double check transaction data before voting.
148-
//
149-
// **New**: Members **must** have a namespace to vote to enforce simpler tracking.
150130
// --
151131
// --
152132
// ## Prop #0 - User Registry V1: Delete user `alice123`
153-
// Author: [@1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm](/u/1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
133+
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
154134
//
155135
// delete user test
156136
//
@@ -172,6 +152,4 @@ func main() {
172152
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
173153
//
174154
// WARNING: Please double check transaction data before voting.
175-
//
176-
// **New**: Members **must** have a namespace to vote to enforce simpler tracking.
177155
// Successfully deleted alice

examples/gno.land/r/gnoland/users/z_0_filetest.gno

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"gno.land/r/gnoland/users"
99
"gno.land/r/gov/dao"
1010
ini "gno.land/r/gov/dao/v3/init"
11-
susers "gno.land/r/sys/users"
1211
)
1312

1413
var alice = testutils.TestAddress("g1alice")
@@ -17,28 +16,12 @@ func init() {
1716
testing.SetRealm(testing.NewUserRealm(alice))
1817
c := runtime.OriginCaller()
1918
ini.InitWithUsers(c)
20-
registerTestUsers(c)
2119

2220
pReq := users.ProposeNewRelease("gno.land/r/gnoland/users/v2", "This is a note!")
2321

2422
dao.MustCreateProposal(cross, pReq)
2523
}
2624

27-
const gUsersV1Path = "gno.land/r/gnoland/users/v1"
28-
29-
// Register a namespace for every addresses
30-
// Necessary to test GovDAO Vote
31-
func registerTestUsers(addrs ...address) {
32-
// Set realm to users admin to register test user
33-
testing.SetRealm(testing.NewCodeRealm(gUsersV1Path))
34-
for _, addr := range addrs {
35-
err := susers.RegisterUser(cross, addr.String()[1:], addr)
36-
if err != nil {
37-
panic(err.Error() + " : " + addr.String())
38-
}
39-
}
40-
}
41-
4225
func main() {
4326
testing.SetRealm(testing.NewUserRealm(alice))
4427

examples/gno.land/r/gnops/valopers/proposal/proposal_test.gno

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,12 @@ import (
1010
"gno.land/r/gnops/valopers"
1111
"gno.land/r/gov/dao"
1212
daoinit "gno.land/r/gov/dao/v3/init" // so that the govdao initializer is executed
13-
susers "gno.land/r/sys/users"
1413
)
1514

1615
var g1user = testutils.TestAddress("g1user")
1716

1817
func init() {
1918
daoinit.InitWithUsers(g1user)
20-
registerTestUsers(g1user)
21-
}
22-
23-
const gUsersV1Path = "gno.land/r/gnoland/users/v1"
24-
25-
// Register a namespace for every addresses
26-
// Necessary to test GovDAO Vote
27-
func registerTestUsers(addrs ...address) {
28-
// Set realm to users admin to register test user
29-
testing.SetRealm(testing.NewCodeRealm(gUsersV1Path))
30-
for _, addr := range addrs {
31-
err := susers.RegisterUser(cross, addr.String()[1:], addr)
32-
if err != nil {
33-
panic(err.Error() + " : " + addr.String())
34-
}
35-
}
3619
}
3720

3821
func TestValopers_ProposeNewValidator(t *testing.T) {

examples/gno.land/r/gnops/valopers/proposal/z_0_a_filetest.gno

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"gno.land/r/gnops/valopers/proposal"
1212
"gno.land/r/gov/dao"
1313
daoinit "gno.land/r/gov/dao/v3/init"
14-
susers "gno.land/r/sys/users"
1514
)
1615

1716
var g1user = testutils.TestAddress("g1user")
@@ -28,22 +27,6 @@ const (
2827
func init() {
2928
testing.SetOriginCaller(g1user)
3029
daoinit.InitWithUsers(g1user)
31-
registerTestUsers(g1user)
32-
}
33-
34-
const gUsersV1Path = "gno.land/r/gnoland/users/v1"
35-
36-
// Register a namespace for every addresses
37-
// Necessary to test GovDAO Vote
38-
func registerTestUsers(addrs ...address) {
39-
// Set realm to users admin to register test user
40-
testing.SetRealm(testing.NewCodeRealm(gUsersV1Path))
41-
for _, addr := range addrs {
42-
err := susers.RegisterUser(cross, addr.String()[1:], addr)
43-
if err != nil {
44-
panic(err.Error() + " : " + addr.String())
45-
}
46-
}
4730
}
4831

4932
func main() {

examples/gno.land/r/gnops/valopers/proposal/z_1_filetest.gno

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"gno.land/r/gnops/valopers/proposal"
1212
"gno.land/r/gov/dao"
1313
daoinit "gno.land/r/gov/dao/v3/init" // so that the govdao initializer is executed
14-
susers "gno.land/r/sys/users"
1514
)
1615

1716
var g1user = testutils.TestAddress("g1user") // g1vuch2um9wf047h6lta047h6lta047h6l2ewm6w
@@ -26,9 +25,7 @@ const (
2625

2726
func init() {
2827
testing.SetOriginCaller(g1user)
29-
3028
daoinit.InitWithUsers(g1user)
31-
registerTestUsers(g1user)
3229

3330
// Register a validator and add the proposal
3431
valopers.Register(cross, validMoniker, validDescription, validServerType, validAddress, validPubKey)
@@ -43,21 +40,6 @@ func init() {
4340
}
4441
}
4542

46-
const gUsersV1Path = "gno.land/r/gnoland/users/v1"
47-
48-
// Register a namespace for every addresses
49-
// Necessary to test GovDAO Vote
50-
func registerTestUsers(addrs ...address) {
51-
// Set realm to users admin to register test user
52-
testing.SetRealm(testing.NewCodeRealm(gUsersV1Path))
53-
for _, addr := range addrs {
54-
err := susers.RegisterUser(cross, addr.String()[1:], addr)
55-
if err != nil {
56-
panic(err.Error() + " : " + addr.String())
57-
}
58-
}
59-
}
60-
6143
func main() {
6244
println(dao.Render(""))
6345
}
@@ -69,7 +51,7 @@ func main() {
6951
// [> Go to Memberstore <](/r/gov/dao/v3/memberstore)
7052
// ## Proposals
7153
// ### [Prop #0 - Add valoper test-1 to the valset](/r/gov/dao:0)
72-
// Author: [@1vuch2um9wf047h6lta047h6lta047h6l2ewm6w](/u/1vuch2um9wf047h6lta047h6lta047h6l2ewm6w)
54+
// Author: g1vuch2um9wf047h6lta047h6lta047h6l2ewm6w
7355
//
7456
// Status: ACTIVE
7557
//

examples/gno.land/r/gov/dao/v3/impl/govdao.gno

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"gno.land/p/nt/ufmt"
99
"gno.land/r/gov/dao"
1010
"gno.land/r/gov/dao/v3/memberstore"
11-
"gno.land/r/sys/users"
1211
)
1312

1413
var ErrMemberNotFound = errors.New("member not found")
@@ -91,7 +90,6 @@ func (g *GovDAO) PostCreateProposal(r dao.ProposalRequest, pid dao.ProposalID) {
9190
g.pss.Set(pid.String(), newProposalStatus(tatv))
9291
}
9392

94-
// Members **must** have a namespace to vote to enforce simpler tracking.
9593
func (g *GovDAO) VoteOnProposal(r dao.VoteRequest) error {
9694
if !g.isValidCall() {
9795
return errors.New("proposal voting must be done directly by a user")
@@ -103,10 +101,6 @@ func (g *GovDAO) VoteOnProposal(r dao.VoteRequest) error {
103101
return ErrMemberNotFound
104102
}
105103

106-
if users.ResolveAddress(caller) == nil {
107-
return errors.New("voter should have a namespace")
108-
}
109-
110104
status := g.pss.GetStatus(r.ProposalID)
111105
if status == nil {
112106
return errors.New("proposal not found")

examples/gno.land/r/gov/dao/v3/impl/govdao_test.gno

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ import (
99
"gno.land/p/nt/urequire"
1010
"gno.land/r/gov/dao"
1111
"gno.land/r/gov/dao/v3/memberstore"
12-
susers "gno.land/r/sys/users"
1312
)
1413

1514
func init() {
1615
loadMembers()
17-
registerTestUser(m1, m11, m111, m1111, m2, m3, m4, m5, m6, noMember)
1816

1917
dao.UpdateImpl(cross, dao.UpdateRequest{
2018
DAO: govDAO,
@@ -36,21 +34,6 @@ var (
3634
noMember = testutils.TestAddress("nm1")
3735
)
3836

39-
const gUsersV1Path = "gno.land/r/gnoland/users/v1"
40-
41-
// Register a namespace for every addresses
42-
// Necessary to test GovDAO Vote
43-
func registerTestUser(addrs ...address) {
44-
// Set realm to users admin to register test user
45-
testing.SetRealm(testing.NewCodeRealm(gUsersV1Path))
46-
for _, addr := range addrs {
47-
err := susers.RegisterUser(cross, addr.String()[1:], addr)
48-
if err != nil {
49-
panic(err.Error() + " : " + addr.String())
50-
}
51-
}
52-
}
53-
5437
func loadMembers() {
5538
// This is needed because state is saved between unit tests,
5639
// and we want to avoid having real members used on tests

examples/gno.land/r/gov/dao/v3/impl/impl.gno

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"chain/runtime"
55

66
"gno.land/r/gov/dao/v3/memberstore"
7-
"gno.land/r/sys/users"
87
)
98

109
var (
@@ -34,10 +33,6 @@ func AddMember(cur realm, addr address) {
3433
panic("caller is not a member")
3534
}
3635

37-
if users.ResolveAddress(caller.Address()) == nil {
38-
panic("caller should have a namespace")
39-
}
40-
4136
if t != memberstore.T1 && t != memberstore.T2 {
4237
panic("caller is not on T1 or T2. To add members, propose them through proposals")
4338
}

examples/gno.land/r/gov/dao/v3/impl/render.gno

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ func renderActionBar(sPid string) string {
177177
out += proxy.Func("Vote ABSTAIN", "MustVoteOnProposalSimple", "pid", sPid, "option", "ABSTAIN")
178178

179179
out += "\n\n"
180-
out += "WARNING: Please double check transaction data before voting.\n\n"
181-
out += "**New**: Members **must** have a namespace to vote to enforce simpler tracking."
180+
out += "WARNING: Please double check transaction data before voting."
182181
return out
183182
}
184183

0 commit comments

Comments
 (0)