Skip to content

Commit

Permalink
Merge pull request #29 from rarimo/feature/rootupdater-migration
Browse files Browse the repository at this point in the history
rootupdater module
  • Loading branch information
olegfomenko authored Aug 29, 2024
2 parents 8665a4e + 27cf3ba commit a6f3d9b
Show file tree
Hide file tree
Showing 49 changed files with 4,887 additions and 96 deletions.
58 changes: 57 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ import (
rarimocoremodule "github.com/rarimo/rarimo-core/x/rarimocore"
rarimocoremodulekeeper "github.com/rarimo/rarimo-core/x/rarimocore/keeper"
rarimocoremoduletypes "github.com/rarimo/rarimo-core/x/rarimocore/types"
rootupdatermodule "github.com/rarimo/rarimo-core/x/rootupdater"
rootupdatermodulekeeper "github.com/rarimo/rarimo-core/x/rootupdater/keeper"
rootupdatermoduletypes "github.com/rarimo/rarimo-core/x/rootupdater/types"
tokenmanagermodule "github.com/rarimo/rarimo-core/x/tokenmanager"
tokenmanagermodulekeeper "github.com/rarimo/rarimo-core/x/tokenmanager/keeper"
tokenmanagermoduletypes "github.com/rarimo/rarimo-core/x/tokenmanager/types"
Expand Down Expand Up @@ -207,6 +210,8 @@ var (
vestingmintmodule.AppModuleBasic{},
identitymodule.AppModuleBasic{},
cscalistmodule.AppModuleBasic{},
rootupdatermodule.AppModuleBasic{},

// this line is used by starport scaffolding # stargate/app/moduleBasic
)

Expand Down Expand Up @@ -289,6 +294,9 @@ type App struct {
VestingmintKeeper vestingmintmodulekeeper.Keeper
IdentityKeeper identitymodulekeeper.Keeper
CSCAListKeeper cscalistkeeper.Keeper

RootupdaterKeeper rootupdatermodulekeeper.Keeper

// this line is used by starport scaffolding # stargate/app/keeperDeclaration
RarimocoreKeeper rarimocoremodulekeeper.Keeper

Expand Down Expand Up @@ -353,6 +361,8 @@ func New(
vestingmintmoduletypes.StoreKey,
identitymoduletypes.StoreKey,
cscalisttypes.StoreKey,
rootupdatermoduletypes.StoreKey,

// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
Expand Down Expand Up @@ -645,14 +655,27 @@ func New(
)
feeMarketModule := feemarket.NewAppModule(app.FeeMarketKeeper, feeMarketSs) // <- ACTUAL module creation in app.go that you need

app.RootupdaterKeeper = *rootupdatermodulekeeper.NewKeeper(
appCodec,
keys[rootupdatermoduletypes.StoreKey],
keys[rootupdatermoduletypes.MemStoreKey],
app.GetSubspace(rootupdatermoduletypes.ModuleName),
app.RarimocoreKeeper,
)
rootupdaterModule := rootupdatermodule.NewAppModule(appCodec, app.RootupdaterKeeper)

// Set authority to x/gov module account to only expect the module account to update params
evmSs := app.GetSubspace(evmtypes.ModuleName)
app.EvmKeeper = evmkeeper.NewKeeper(
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.FeeMarketKeeper,
nil, geth.NewEVM, cast.ToString(appOpts.Get(srvflags.EVMTracer)), evmSs,
)
app.EvmKeeper = app.EvmKeeper.SetHooks(app.IdentityKeeper)
app.EvmKeeper = app.EvmKeeper.SetHooks(evmkeeper.NewMultiEvmHooks(
app.IdentityKeeper,
app.RootupdaterKeeper,
))

evmModule := evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, evmSs) // <- ACTUAL module creation in app.go that you need

app.VestingmintKeeper = *vestingmintmodulekeeper.NewKeeper(
Expand Down Expand Up @@ -738,6 +761,8 @@ func New(
vestingmintModule,
identityModule,
cscaListModule,
rootupdaterModule,

// this line is used by starport scaffolding # stargate/app/appModule
)

Expand Down Expand Up @@ -777,6 +802,8 @@ func New(
vestingmintmoduletypes.ModuleName,
identitymoduletypes.ModuleName,
cscalisttypes.ModuleName,
rootupdatermoduletypes.ModuleName,

// this line is used by starport scaffolding # stargate/app/beginBlockers
)

Expand Down Expand Up @@ -811,6 +838,8 @@ func New(
vestingmintmoduletypes.ModuleName,
identitymoduletypes.ModuleName,
cscalisttypes.ModuleName,
rootupdatermoduletypes.ModuleName,

// this line is used by starport scaffolding # stargate/app/endBlockers
)

Expand Down Expand Up @@ -855,6 +884,7 @@ func New(
identitymoduletypes.ModuleName,
cscalisttypes.ModuleName,

rootupdatermoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
)

Expand Down Expand Up @@ -891,6 +921,8 @@ func New(
multisigModule,
evmModule,
feeMarketModule,
rootupdaterModule,

// this line is used by starport scaffolding # stargate/app/appModule
)
app.sm.RegisterStoreDecoders()
Expand Down Expand Up @@ -1068,6 +1100,29 @@ func New(
},
)

if upgradeInfo.Name == "v1.1.4-rc1" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storetypes.StoreUpgrades{
Added: []string{rootupdatermoduletypes.ModuleName},
}))
}

app.UpgradeKeeper.SetUpgradeHandler(
"v1.1.4-rc1",
func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
app.RootupdaterKeeper.SetParams(ctx, rootupdatermoduletypes.Params{
ContractAddress: "0xBF926a23B4A0bcA301F97Ccd27358b55Dc4C7D3C",
Root: "0x00",
LastSignedRoot: "0x00",
LastSignedRootIndex: "0x00",
EventName: "RootUpdated",
RootTimestamp: 1724316208,
})
fromVM[rootupdatermoduletypes.ModuleName] = rootupdatermodule.AppModule{}.ConsensusVersion()

return app.mm.RunMigrations(ctx, app.configurator, fromVM)
},
)

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(err.Error())
Expand Down Expand Up @@ -1280,6 +1335,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
//paramsKeeper.Subspace(monitoringptypes.ModuleName)
paramsKeeper.Subspace(evmtypes.ModuleName)
paramsKeeper.Subspace(feemarkettypes.ModuleName)
paramsKeeper.Subspace(rootupdatermoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
25 changes: 25 additions & 0 deletions docs/common/mainnet/002-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ title: Mainnet upgrades

# Mainnet upgrades

## V1.1.3

Core binary: (
alpine-linux/amd64): "<https://github.com/rarimo/rarimo-core/releases/download/v1.1.3/rarimo-core-alpine-linux-amd64>".

Also, you can build core from sources by yourself: use "<https://github.com/rarimo/rarimo-core/releases/tag/v1.1.3>"
release information.

Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

If you are using `cosmovisor` the upgrade will be done automatically.

### What's new?

Upgrade v1.1.3 introduces the new Arbitrary proposal in terms of `rarimocore` module that can be used to sign any
specified byte data in body.

## V1.1.2

Core binary: (
Expand All @@ -18,6 +36,7 @@ use Alpine binary on your machine.

If you are using `cosmovisor` the upgrade will be done automatically.

### What's new?
Upgrade v1.1.2 changes the parameters of [feemarket](../../../x/feemarket) module, in particular `BaseFee`
and `NoBaseFee` that should be `0` and `true` while we are using zero commissions on production.

Expand All @@ -32,6 +51,7 @@ release information.
Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

### What's new?
Upgrade v1.1.1 introduces a new module to store and manage [CSCA Master List](https://pkddownloadsg.icao.int/). More
information can be found in [module docs](../../../x/cscalist/README.md).

Expand All @@ -48,6 +68,7 @@ Upgrade will perform automatically if you are using `cosmovisor` under Alpine li
Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

### What's new?
Upgrade v1.1.0 introduces a couple of features for identity transfers:

- New WorldCoin identity transfer
Expand All @@ -65,6 +86,7 @@ Upgrade will perform automatically if you are using `cosmovisor` under Alpine li
Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

### What's new?
Upgrade v1.0.7 introduces fixes to the `rarimocore` module:

- Adding feature to clear old TSS violation reports.
Expand All @@ -78,6 +100,7 @@ Upgrade will perform automatically if you are using `cosmovisor` under Alpine li
Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

### What's new?
Upgrade V1.0.6 introduces:

- Adding message for operation resign by Threshold signature producers.
Expand All @@ -93,6 +116,7 @@ Upgrade will perform automatically if you are using `cosmovisor` under Alpine li
Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

### What's new?
Upgrade v1.0.5 introduces several fixes:

- Adding `createdAtBlock` field to `StateInfo` entry in `identity` module.
Expand All @@ -106,6 +130,7 @@ Upgrade will perform automatically if you are using `cosmovisor` under Alpine li
Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

### What's new?
Upgrade v1.0.4 introduces `identity` core module that is responsible for storing aggregated information about
identity state transitions published into Rarimo chain. It uses deployed into Rarimo EVM original Iden3 state
smart-contracts.
Expand Down
Loading

0 comments on commit a6f3d9b

Please sign in to comment.