Skip to content

Commit 3d59131

Browse files
authored
Enable permissioned keys by default (#2645)
1 parent 03c53ce commit 3d59131

File tree

9 files changed

+44
-6
lines changed

9 files changed

+44
-6
lines changed

protocol/app/testdata/default_genesis_state.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
"dydxaccountplus": {
157157
"accounts": [],
158158
"params": {
159-
"is_smart_account_active": false
159+
"is_smart_account_active": true
160160
},
161161
"next_authenticator_id": "0",
162162
"authenticator_data": []

protocol/app/upgrades/v8.0/migrate_accountplus_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package v_8_0_test
33
import (
44
"testing"
55

6+
"github.com/cometbft/cometbft/types"
67
v_8_0 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v8.0"
78

89
"cosmossdk.io/store/prefix"
@@ -24,7 +25,16 @@ func TestMigrateAccountplusAccountState(t *testing.T) {
2425
}
2526

2627
func (s *UpgradeTestSuite) SetupTest() {
27-
s.tApp = testapp.NewTestAppBuilder(s.T()).Build()
28+
s.tApp = testapp.NewTestAppBuilder(s.T()).WithGenesisDocFn(func() (genesis types.GenesisDoc) {
29+
genesis = testapp.DefaultGenesis()
30+
testapp.UpdateGenesisDocWithAppStateForModule(
31+
&genesis,
32+
func(genesisState *accountplustypes.GenesisState) {
33+
genesisState.Params.IsSmartAccountActive = false
34+
},
35+
)
36+
return genesis
37+
}).Build()
2838
s.Ctx = s.tApp.InitChain()
2939
}
3040

protocol/app/upgrades/v8.0/upgrade.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ func CreateUpgradeHandler(
102102

103103
MigrateAccountplusAccountState(sdkCtx, accountplusKeeper)
104104

105+
accountplusKeeper.SetActiveState(sdkCtx, true)
106+
105107
// Set market, perpetual, and clob ids to a set number
106108
setMarketListingBaseIds(sdkCtx, pricesKeeper, perpetualsKeeper, clobKeeper)
107109

protocol/app/upgrades/v8.0/upgrade_container_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types"
1313

14+
aptypes "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"
1415
perptypes "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types"
1516
pricetypes "github.com/dydxprotocol/v4-chain/protocol/x/prices/types"
1617

@@ -45,9 +46,27 @@ func preUpgradeChecks(node *containertest.Node, t *testing.T) {
4546

4647
func postUpgradeChecks(node *containertest.Node, t *testing.T) {
4748
// Check that the listing module state has been initialized with the hard cap and default deposit params.
49+
postUpgradeSmartAccountActiveCheck(node, t)
4850
postUpgradeMarketIdsCheck(node, t)
4951
}
5052

53+
func postUpgradeSmartAccountActiveCheck(node *containertest.Node, t *testing.T) {
54+
// query the smart account active
55+
resp, err := containertest.Query(
56+
node,
57+
aptypes.NewQueryClient,
58+
aptypes.QueryClient.Params,
59+
&aptypes.QueryParamsRequest{},
60+
)
61+
require.NoError(t, err)
62+
require.NotNil(t, resp)
63+
64+
queryResponse := aptypes.QueryParamsResponse{}
65+
err = proto.UnmarshalText(resp.String(), &queryResponse)
66+
require.NoError(t, err)
67+
require.Equal(t, true, queryResponse.Params.IsSmartAccountActive)
68+
}
69+
5170
func postUpgradeMarketIdsCheck(node *containertest.Node, t *testing.T) {
5271
// query the next market id
5372
resp, err := containertest.Query(

protocol/scripts/genesis/sample_pregenesis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@
667667
"authenticator_data": [],
668668
"next_authenticator_id": "0",
669669
"params": {
670-
"is_smart_account_active": false
670+
"is_smart_account_active": true
671671
}
672672
},
673673
"epochs": {

protocol/testing/containertest/preupgrade_genesis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@
823823
"dydxaccountplus": {
824824
"accounts": [],
825825
"params": {
826-
"is_smart_account_active": false
826+
"is_smart_account_active": true
827827
},
828828
"next_authenticator_id": "0",
829829
"authenticator_data": []

protocol/testing/genesis.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,6 +2152,9 @@ function edit_genesis() {
21522152
dasel put -t string -f "$GENESIS" ".app_state.vault.vaults.[${vault_idx}].vault_params.status" -v 'VAULT_STATUS_QUOTING'
21532153
vault_idx=$(($vault_idx + 1))
21542154
done
2155+
2156+
# Update accountplus module.
2157+
dasel put -t bool -f "$GENESIS" '.app_state.dydxaccountplus.params.is_smart_account_active' -v 'true'
21552158
}
21562159

21572160
function add_subaccount() {

protocol/testutil/constants/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ const GenesisState = `{
445445
"dydxaccountplus": {
446446
"accounts": [],
447447
"params": {
448-
"is_smart_account_active": false
448+
"is_smart_account_active": true
449449
},
450450
"next_authenticator_id": "0",
451451
"authenticator_data": []

protocol/x/accountplus/types/genesis.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ package types
22

33
// DefaultGenesis returns the default genesis state
44
func DefaultGenesis() *GenesisState {
5-
return &GenesisState{}
5+
return &GenesisState{
6+
Params: Params{
7+
IsSmartAccountActive: true,
8+
},
9+
}
610
}
711

812
// Validate performs basic genesis state validation returning an error upon any

0 commit comments

Comments
 (0)