Skip to content

Commit

Permalink
Enable permissioned keys by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jayy04 committed Dec 11, 2024
1 parent 1b03acb commit 1f6c0ca
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion protocol/app/testdata/default_genesis_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
"dydxaccountplus": {
"accounts": [],
"params": {
"is_smart_account_active": false
"is_smart_account_active": true
},
"next_authenticator_id": "0",
"authenticator_data": []
Expand Down
2 changes: 2 additions & 0 deletions protocol/app/upgrades/v8.0/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ func CreateUpgradeHandler(

MigrateAccountplusAccountState(sdkCtx, accountplusKeeper)

accountplusKeeper.SetActiveState(sdkCtx, true)

// Set market, perpetual, and clob ids to a set number
setMarketListingBaseIds(sdkCtx, pricesKeeper, perpetualsKeeper, clobKeeper)

Expand Down
19 changes: 19 additions & 0 deletions protocol/app/upgrades/v8.0/upgrade_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

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

aptypes "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"
perptypes "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types"
pricetypes "github.com/dydxprotocol/v4-chain/protocol/x/prices/types"

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

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

func postUpgradeSmartAccountActiveCheck(node *containertest.Node, t *testing.T) {
// query the smart account active
resp, err := containertest.Query(
node,
aptypes.NewQueryClient,
aptypes.QueryClient.Params,
&aptypes.QueryParamsRequest{},
)
require.NoError(t, err)
require.NotNil(t, resp)

queryResponse := aptypes.QueryParamsResponse{}
err = proto.UnmarshalText(resp.String(), &queryResponse)
require.NoError(t, err)
require.Equal(t, true, queryResponse.Params.IsSmartAccountActive)
}

func postUpgradeMarketIdsCheck(node *containertest.Node, t *testing.T) {
// query the next market id
resp, err := containertest.Query(
Expand Down
2 changes: 1 addition & 1 deletion protocol/scripts/genesis/sample_pregenesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@
"authenticator_data": [],
"next_authenticator_id": "0",
"params": {
"is_smart_account_active": false
"is_smart_account_active": true
}
},
"epochs": {
Expand Down
2 changes: 1 addition & 1 deletion protocol/testing/containertest/preupgrade_genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
"dydxaccountplus": {
"accounts": [],
"params": {
"is_smart_account_active": false
"is_smart_account_active": true
},
"next_authenticator_id": "0",
"authenticator_data": []
Expand Down
4 changes: 3 additions & 1 deletion protocol/testing/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ function edit_genesis() {
# Consensus params
dasel put -t string -f "$GENESIS" '.consensus.params.block.max_bytes' -v '4194304'
dasel put -t string -f "$GENESIS" '.consensus.params.block.max_gas' -v '-1'
dasel put -t string -f "$GENESIS" '.consensus.params.abci.vote_extensions_enable_height' -v '1'

# Update crisis module.
dasel put -t string -f "$GENESIS" '.app_state.crisis.constant_fee.denom' -v "$NATIVE_TOKEN"
Expand Down Expand Up @@ -2152,6 +2151,9 @@ function edit_genesis() {
dasel put -t string -f "$GENESIS" ".app_state.vault.vaults.[${vault_idx}].vault_params.status" -v 'VAULT_STATUS_QUOTING'
vault_idx=$(($vault_idx + 1))
done

# Update accountplus module.
dasel put -t bool -f "$GENESIS" '.app_state.dydxaccountplus.params.is_smart_account_active' -v 'true'
}

function add_subaccount() {
Expand Down
2 changes: 1 addition & 1 deletion protocol/testutil/constants/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ const GenesisState = `{
"dydxaccountplus": {
"accounts": [],
"params": {
"is_smart_account_active": false
"is_smart_account_active": true
},
"next_authenticator_id": "0",
"authenticator_data": []
Expand Down

0 comments on commit 1f6c0ca

Please sign in to comment.