Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable permissioned keys by default #2645

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading