Skip to content

Commit fcc322b

Browse files
author
Ulfat
committed
Merge remote-tracking branch 'upstream/master' into revert_pr_267
2 parents 33e6837 + 2bcd611 commit fcc322b

File tree

4 files changed

+1
-109
lines changed

4 files changed

+1
-109
lines changed

integration_tests/cli/auth-demo.sh

-11
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,6 @@ check_response "$result" "\"productName\": \"$productName\""
184184

185185
test_divider
186186

187-
echo "Get $user account and confirm that alice and jack are set still present as approvers, also the sequence number should be 3 as we executed 3 txs"
188-
result=$(dcld query auth account --address=$user_address)
189-
check_response_and_report "$result" $user_address "json"
190-
check_response_and_report "$result" $jack_address "json"
191-
check_response_and_report "$result" $alice_address "json"
192-
check_response_and_report "$result" '"info": "Alice is approving this account"' "json"
193-
check_response_and_report "$result" '"info": "Jack is proposing this account"' "json"
194-
check_response_and_report "$result" '"sequence": "3"' "json"
195-
196-
test_divider
197-
198187
echo "Alice proposes to revoke account for $user"
199188
result=$(echo $passphrase | dcld tx auth propose-revoke-account --address="$user_address" --info="Alice proposes to revoke account" --from alice --yes)
200189
check_response "$result" "\"code\": 0"

x/dclauth/keeper/account.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (k Keeper) SetAccount(ctx sdk.Context, account authtypes.AccountI) {
2929
dclAcc.GetAddress(), dclAcc.GetPubKey(),
3030
dclAcc.GetAccountNumber(), dclAcc.GetSequence(),
3131
)
32-
dclAccO := types.NewAccount(ba, dclAcc.GetRoles(), dclAcc.GetApprovals(), dclAcc.GetVendorID())
32+
dclAccO := types.NewAccount(ba, dclAcc.GetRoles(), nil, dclAcc.GetVendorID())
3333

3434
k.SetAccountO(ctx, *dclAccO)
3535
}

x/dclauth/types/account.go

-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ type DCLAccountI interface {
6262

6363
GetRoles() []AccountRole
6464
GetVendorID() int32
65-
GetApprovals() []*Grant
6665
}
6766

6867
// NewAccount creates a new Account object.
@@ -100,10 +99,6 @@ func (acc Account) GetRoles() []AccountRole {
10099
return acc.Roles
101100
}
102101

103-
func (acc Account) GetApprovals() []*Grant {
104-
return acc.Approvals
105-
}
106-
107102
func (acc Account) GetVendorID() int32 {
108103
return acc.VendorID
109104
}

x/dclauth/types/account_test.go

-92
Original file line numberDiff line numberDiff line change
@@ -369,95 +369,3 @@ func TestPendingAccount_HasApprovalFrom(t *testing.T) {
369369
})
370370
}
371371
}
372-
373-
func TestAccount_GetApprovals(t *testing.T) {
374-
type fields struct {
375-
BaseAccount *types.BaseAccount
376-
Roles []AccountRole
377-
Approvals []*Grant
378-
VendorID int32
379-
}
380-
tests := []struct {
381-
name string
382-
fields fields
383-
want []*Grant
384-
}{
385-
{
386-
name: `account having 2 approvals`,
387-
fields: fields{
388-
BaseAccount: &types.BaseAccount{},
389-
Roles: []AccountRole{Vendor},
390-
Approvals: []*Grant{
391-
{
392-
Address: "address1",
393-
Info: "info1",
394-
Time: 123,
395-
},
396-
{
397-
Address: "address2",
398-
Info: "",
399-
Time: 456,
400-
},
401-
},
402-
VendorID: 1,
403-
},
404-
want: []*Grant{
405-
{
406-
Address: "address1",
407-
Info: "info1",
408-
Time: 123,
409-
},
410-
{
411-
Address: "address2",
412-
Info: "",
413-
Time: 456,
414-
},
415-
},
416-
},
417-
{
418-
name: `account having 1 approval`,
419-
fields: fields{
420-
BaseAccount: &types.BaseAccount{},
421-
Roles: []AccountRole{Vendor},
422-
Approvals: []*Grant{
423-
{
424-
Address: "address1",
425-
Info: "info1",
426-
Time: 123,
427-
},
428-
},
429-
VendorID: 1,
430-
},
431-
want: []*Grant{
432-
{
433-
Address: "address1",
434-
Info: "info1",
435-
Time: 123,
436-
},
437-
},
438-
},
439-
{
440-
name: `account having 0 approvals`,
441-
fields: fields{
442-
BaseAccount: &types.BaseAccount{},
443-
Roles: []AccountRole{Vendor},
444-
VendorID: 1,
445-
Approvals: []*Grant{},
446-
},
447-
want: []*Grant{},
448-
},
449-
}
450-
for _, tt := range tests {
451-
t.Run(tt.name, func(t *testing.T) {
452-
acc := Account{
453-
BaseAccount: tt.fields.BaseAccount,
454-
Roles: tt.fields.Roles,
455-
Approvals: tt.fields.Approvals,
456-
VendorID: tt.fields.VendorID,
457-
}
458-
if got := acc.GetApprovals(); !reflect.DeepEqual(got, tt.want) {
459-
t.Errorf("Account.GetApprovals() = %v, want %v", got, tt.want)
460-
}
461-
})
462-
}
463-
}

0 commit comments

Comments
 (0)