Skip to content

Commit

Permalink
feat(DRS): Added DRS 7 support (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
omritoptix authored Jan 1, 2025
1 parent e3754ee commit ed5c69b
Show file tree
Hide file tree
Showing 6 changed files with 681 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROJECT_NAME=rollapp-wasm
DA_LAYER=mock
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
DRS_VERSION = 6
DRS_VERSION = 7

LEDGER_ENABLED ?= true

Expand Down
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ import (
drs4 "github.com/dymensionxyz/rollapp-wasm/app/upgrades/drs-4"
drs5 "github.com/dymensionxyz/rollapp-wasm/app/upgrades/drs-5"
drs6 "github.com/dymensionxyz/rollapp-wasm/app/upgrades/drs-6"
drs7 "github.com/dymensionxyz/rollapp-wasm/app/upgrades/drs-7"
)

const (
Expand All @@ -194,7 +195,7 @@ var (
rollappparamstypes.StoreKey,
}
// Upgrades contains the upgrade handlers for the application
Upgrades = []upgrades.Upgrade{drs2.Upgrade, drs3.Upgrade, drs4.Upgrade, drs5.Upgrade, drs6.Upgrade}
Upgrades = []upgrades.Upgrade{drs2.Upgrade, drs3.Upgrade, drs4.Upgrade, drs5.Upgrade, drs6.Upgrade, drs7.Upgrade}
)

func getGovProposalHandlers() []govclient.ProposalHandler {
Expand Down
17 changes: 17 additions & 0 deletions app/upgrades/drs-7/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package drs7

import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"

"github.com/dymensionxyz/rollapp-wasm/app/upgrades"
)

const (
UpgradeName = "drs-7"
)

var Upgrade = upgrades.Upgrade{
Name: UpgradeName,
CreateHandler: CreateUpgradeHandler,
StoreUpgrades: storetypes.StoreUpgrades{},
}
37 changes: 37 additions & 0 deletions app/upgrades/drs-7/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package drs7

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
rollappparamskeeper "github.com/dymensionxyz/dymension-rdk/x/rollappparams/keeper"

drs6 "github.com/dymensionxyz/rollapp-wasm/app/upgrades/drs-6"
)

func CreateUpgradeHandler(
rpKeeper rollappparamskeeper.Keeper,
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
if err := HandleUpgrade(ctx, rpKeeper); err != nil {
return nil, err
}
return mm.RunMigrations(ctx, configurator, fromVM)
}
}

func HandleUpgrade(ctx sdk.Context, rpKeeper rollappparamskeeper.Keeper) error {
if rpKeeper.Version(ctx) < 6 {
// first run drs-6 migration
if err := drs6.HandleUpgrade(ctx, rpKeeper); err != nil {
return err
}
}
// upgrade drs to 7
if err := rpKeeper.SetVersion(ctx, uint32(7)); err != nil {
return err
}
return nil
}
312 changes: 312 additions & 0 deletions genesis-templates/DRS/7/genesis-mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
{
"genesis_time": "2025-01-01T13:35:21.448033Z",
"chain_id": "rollappwasm_1234-1",
"initial_height": "1",
"consensus_params": {
"block": {
"max_bytes": "500000",
"max_gas": "400000000",
"time_iota_ms": "1000"
},
"evidence": {
"max_age_num_blocks": "100000",
"max_age_duration": "172800000000000",
"max_bytes": "500000"
},
"validator": {
"pub_key_types": [
"ed25519"
]
},
"version": {}
},
"app_hash": "",
"app_state": {
"auth": {
"params": {
"max_memo_characters": "256",
"tx_sig_limit": "7",
"tx_size_cost_per_byte": "10",
"sig_verify_cost_ed25519": "590",
"sig_verify_cost_secp256k1": "1000"
},
"accounts": []
},
"authz": {
"authorization": []
},
"bank": {
"params": {
"send_enabled": [],
"default_send_enabled": true
},
"balances": [],
"supply": [],
"denom_metadata": []
},
"callback": {
"params": {
"callback_gas_limit": "1000000",
"max_block_reservation_limit": "3",
"max_future_reservation_limit": "10000",
"block_reservation_fee_multiplier": "0.000000000000000000",
"future_reservation_fee_multiplier": "0.000000000000000000",
"min_price_of_gas": {
"denom": "stake",
"amount": "0"
}
},
"callbacks": []
},
"capability": {
"index": "1",
"owners": []
},
"cwerrors": {
"params": {
"error_stored_time": "302400",
"subscription_fee": {
"denom": "stake",
"amount": "0"
},
"subscription_period": "302400"
},
"errors": []
},
"distribution": {
"params": {
"community_tax": "0.00002",
"base_proposer_reward": "0.8",
"bonus_proposer_reward": "0.000000000000000000",
"withdraw_addr_enabled": true
},
"fee_pool": {
"community_pool": []
},
"delegator_withdraw_infos": [],
"previous_proposer": "",
"outstanding_rewards": [],
"validator_accumulated_commissions": [],
"validator_historical_rewards": [],
"validator_current_rewards": [],
"delegator_starting_infos": [],
"validator_slash_events": []
},
"epochs": {
"epochs": [
{
"identifier": "minute",
"start_time": "0001-01-01T00:00:00Z",
"duration": "60s",
"current_epoch": "0",
"current_epoch_start_time": "0001-01-01T00:00:00Z",
"epoch_counting_started": false,
"current_epoch_start_height": "0"
},
{
"identifier": "hour",
"start_time": "0001-01-01T00:00:00Z",
"duration": "3600s",
"current_epoch": "0",
"current_epoch_start_time": "0001-01-01T00:00:00Z",
"epoch_counting_started": false,
"current_epoch_start_height": "0"
},
{
"identifier": "day",
"start_time": "0001-01-01T00:00:00Z",
"duration": "86400s",
"current_epoch": "0",
"current_epoch_start_time": "0001-01-01T00:00:00Z",
"epoch_counting_started": false,
"current_epoch_start_height": "0"
},
{
"identifier": "week",
"start_time": "0001-01-01T00:00:00Z",
"duration": "604800s",
"current_epoch": "0",
"current_epoch_start_time": "0001-01-01T00:00:00Z",
"epoch_counting_started": false,
"current_epoch_start_height": "0"
},
{
"identifier": "year",
"start_time": "0001-01-01T00:00:00Z",
"duration": "31536000s",
"current_epoch": "0",
"current_epoch_start_time": "0001-01-01T00:00:00Z",
"epoch_counting_started": false,
"current_epoch_start_height": "0"
}
]
},
"feegrant": {
"allowances": []
},
"gasless": {
"params": {
"minimum_gas_deposit": [
{
"denom": "stake",
"amount": "10000000000000000000"
}
]
},
"usage_identifier_to_gastank_ids": [],
"last_gas_tank_id": "0",
"gas_tanks": [],
"gas_consumers": []
},
"genutil": {
"gen_txs": []
},
"gov": {
"starting_proposal_id": "1",
"deposits": [],
"votes": [],
"proposals": [],
"deposit_params": {
"min_deposit": [
{
"denom": "stake",
"amount": "1000000000000000000000"
}
],
"max_deposit_period": "172800s"
},
"voting_params": {
"voting_period": "432000s"
},
"tally_params": {
"quorum": "0.334000000000000000",
"threshold": "0.500000000000000000",
"veto_threshold": "0.334000000000000000"
}
},
"hubgenesis": {
"params": {},
"genesis_accounts": []
},
"hubs": {
"state": {
"hub": {
"registered_denoms": []
}
}
},
"ibc": {
"client_genesis": {
"clients": [],
"clients_consensus": [],
"clients_metadata": [],
"params": {
"allowed_clients": [
"06-solomachine",
"07-tendermint"
]
},
"create_localhost": false,
"next_client_sequence": "0"
},
"connection_genesis": {
"connections": [],
"client_connection_paths": [],
"next_connection_sequence": "0",
"params": {
"max_expected_time_per_block": "30000000000"
}
},
"channel_genesis": {
"channels": [],
"acknowledgements": [],
"commitments": [],
"receipts": [],
"send_sequences": [],
"recv_sequences": [],
"ack_sequences": [],
"next_channel_sequence": "0"
}
},
"mint": {
"minter": {
"current_inflation_rate": "0.080000000000000000"
},
"params": {
"mint_denom": "stake",
"mint_epoch_identifier": "hour",
"mint_start_epoch": "1",
"inflation_change_epoch_identifier": "year",
"inflation_rate_change": "0.010000000000000000",
"target_inflation_rate": "0.020000000000000000"
}
},
"params": null,
"rollappparams": {
"params": {
"da": "celestia",
"drs_version": 7,
"min_gas_prices": []
}
},
"sequencers": {
"params": {
"unbonding_time": "1814400s",
"historical_entries": 10000
},
"sequencers": []
},
"staking": {
"params": {
"unbonding_time": "604800s",
"max_validators": 100,
"max_entries": 7,
"historical_entries": 10000,
"bond_denom": "stake",
"min_commission_rate": "0.000000000000000000"
},
"last_total_power": "0",
"last_validator_powers": [],
"validators": [],
"delegations": [],
"unbonding_delegations": [],
"redelegations": [],
"exported": false
},
"timeupgrade": null,
"tokenfactory": {
"params": {
"denom_creation_fee": [
{
"denom": "stake",
"amount": "10000000000000000000"
}
]
},
"factory_denoms": []
},
"transfer": {
"port_id": "transfer",
"denom_traces": [],
"params": {
"send_enabled": true,
"receive_enabled": true
}
},
"upgrade": {},
"vesting": {},
"wasm": {
"params": {
"code_upload_access": {
"permission": "Everybody",
"address": "",
"addresses": []
},
"instantiate_default_permission": "Everybody"
},
"codes": [],
"contracts": [],
"sequences": []
}
}
}
Loading

0 comments on commit ed5c69b

Please sign in to comment.