Skip to content

Commit

Permalink
chore: resolved merge conflicts with v0.50.0-upgrade branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthishvitwit committed Dec 15, 2023
2 parents 7b64d43 + 1721649 commit 7143904
Show file tree
Hide file tree
Showing 28 changed files with 398 additions and 354 deletions.
59 changes: 29 additions & 30 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ import (
palomamempool "github.com/palomachain/paloma/app/mempool"
appparams "github.com/palomachain/paloma/app/params"

// xchain "github.com/palomachain/paloma/internal/x-chain"
// consensusmodule "github.com/palomachain/paloma/x/consensus"
// consensusmodulekeeper "github.com/palomachain/paloma/x/consensus/keeper"
// consensusmoduletypes "github.com/palomachain/paloma/x/consensus/types"
consensusmodule "github.com/palomachain/paloma/x/consensus"
consensusmodulekeeper "github.com/palomachain/paloma/x/consensus/keeper"
consensusmoduletypes "github.com/palomachain/paloma/x/consensus/types"

gravitymodule "github.com/palomachain/paloma/x/gravity"
gravityclient "github.com/palomachain/paloma/x/gravity/client"
gravitymodulekeeper "github.com/palomachain/paloma/x/gravity/keeper"
Expand Down Expand Up @@ -198,14 +198,14 @@ var (
evidence.AppModuleBasic{},
vesting.AppModuleBasic{},
schedulermodule.AppModuleBasic{},
// consensusmodule.AppModuleBasic{},
consensusmodule.AppModuleBasic{},
// valsetmodule.AppModuleBasic{},
wasm.AppModuleBasic{},
evm.AppModuleBasic{},
gravitymodule.AppModuleBasic{},
// palomamodule.AppModuleBasic{},
// treasurymodule.AppModuleBasic{},
// consensus.AppModuleBasic{},
consensus.AppModuleBasic{},
transfer.AppModuleBasic{},
ibc.AppModuleBasic{},
ica.AppModuleBasic{},
Expand Down Expand Up @@ -285,15 +285,15 @@ type App struct {
TransferKeeper ibctransferkeeper.Keeper

SchedulerKeeper schedulermodulekeeper.Keeper
// ConsensusKeeper consensusmodulekeeper.Keeper
ConsensusKeeper consensusmodulekeeper.Keeper
// ValsetKeeper valsetmodulekeeper.Keeper
// PalomaKeeper palomamodulekeeper.Keeper
// TreasuryKeeper treasurymodulekeeper.Keeper
GravityKeeper gravitymodulekeeper.Keeper
wasmKeeper wasmkeeper.Keeper
EvmKeeper evmmodulekeeper.Keeper

// mm is the module manager
// ModuleManager is the module manager
ModuleManager *module.Manager
BasicModuleManager module.BasicManager

Expand Down Expand Up @@ -363,7 +363,7 @@ func New(
icacontrollertypes.StoreKey,
capabilitytypes.StoreKey,
schedulermoduletypes.StoreKey,
// consensusmoduletypes.StoreKey,
consensusmoduletypes.StoreKey,
// valsetmoduletypes.StoreKey,
// treasurymoduletypes.StoreKey,
evmmoduletypes.StoreKey,
Expand All @@ -376,7 +376,7 @@ func New(
memKeys := storetypes.NewMemoryStoreKeys(
capabilitytypes.MemStoreKey,
// valsetmoduletypes.MemStoreKey,
// consensusmoduletypes.MemStoreKey,
consensusmoduletypes.MemStoreKey,
evmmoduletypes.MemStoreKey,
schedulermoduletypes.MemStoreKey,
// treasurymoduletypes.MemStoreKey,
Expand Down Expand Up @@ -415,7 +415,7 @@ func New(
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName)
// scopedConsensusKeeper := app.CapabilityKeeper.ScopeToModule(consensusmoduletypes.ModuleName)
scopedConsensusKeeper := app.CapabilityKeeper.ScopeToModule(consensusmoduletypes.ModuleName)

app.CapabilityKeeper.Seal()

Expand Down Expand Up @@ -575,16 +575,15 @@ func New(
// sdk.DefaultPowerReduction,
// )

// consensusRegistry := consensusmodulekeeper.NewRegistry()
consensusRegistry := consensusmodulekeeper.NewRegistry()

// app.ConsensusKeeper = *consensusmodulekeeper.NewKeeper(
// appCodec,
// keys[consensusmoduletypes.StoreKey],
// memKeys[consensusmoduletypes.MemStoreKey],
// app.GetSubspace(consensusmoduletypes.ModuleName),
// app.ValsetKeeper,
// consensusRegistry,
// )
app.ConsensusKeeper = *consensusmodulekeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[consensusmoduletypes.StoreKey]),
app.GetSubspace(consensusmoduletypes.ModuleName),
nil, // TODO: pass valset keeper
consensusRegistry,
)

app.EvmKeeper = *evmmodulekeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -657,7 +656,7 @@ func New(
// nil, // app.SchedulerKeeper,
// )

// app.ScopedConsensusKeeper = scopedConsensusKeeper
app.ScopedConsensusKeeper = scopedConsensusKeeper

govRouter := govv1beta1.NewRouter()
govRouter.
Expand Down Expand Up @@ -772,7 +771,7 @@ func New(
// must be passed by reference here.

evmModule := evm.NewAppModule(appCodec, app.EvmKeeper, app.AccountKeeper, app.BankKeeper)
// consensusModule := consensusmodule.NewAppModule(appCodec, app.ConsensusKeeper, app.AccountKeeper, app.BankKeeper)
consensusModule := consensusmodule.NewAppModule(appCodec, app.ConsensusKeeper, app.AccountKeeper, app.BankKeeper)
// valsetModule := valsetmodule.NewAppModule(appCodec, app.ValsetKeeper, app.AccountKeeper, app.BankKeeper)
schedulerModule := schedulermodule.NewAppModule(appCodec, app.SchedulerKeeper, app.AccountKeeper, app.BankKeeper)
// palomaModule := palomamodule.NewAppModule(appCodec, app.PalomaKeeper, app.AccountKeeper, app.BankKeeper)
Expand Down Expand Up @@ -800,7 +799,7 @@ func New(
evidence.NewAppModule(app.EvidenceKeeper),
params.NewAppModule(app.ParamsKeeper),
schedulerModule,
// consensusModule,
consensusModule,
// valsetModule,
evmModule,
gravityModule,
Expand Down Expand Up @@ -840,7 +839,7 @@ func New(
stakingtypes.ModuleName,
feegrant.ModuleName,
schedulermoduletypes.ModuleName,
// consensusmoduletypes.ModuleName,
consensusmoduletypes.ModuleName,
govtypes.ModuleName,
crisistypes.ModuleName,
banktypes.ModuleName,
Expand Down Expand Up @@ -873,7 +872,7 @@ func New(
slashingtypes.ModuleName,
evidencetypes.ModuleName,
feegrant.ModuleName,
// consensusmoduletypes.ModuleName,
consensusmoduletypes.ModuleName,
crisistypes.ModuleName,
banktypes.ModuleName,
paramstypes.ModuleName,
Expand Down Expand Up @@ -916,7 +915,7 @@ func New(
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
schedulermoduletypes.ModuleName,
// consensusmoduletypes.ModuleName,
consensusmoduletypes.ModuleName,
// valsetmoduletypes.ModuleName,
// palomamoduletypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -1009,9 +1008,9 @@ func New(
}
}

// consensusRegistry.Add(
// app.EvmKeeper,
// )
consensusRegistry.Add(
app.EvmKeeper,
)

return app
}
Expand Down Expand Up @@ -1170,7 +1169,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(schedulermoduletypes.ModuleName)
// paramsKeeper.Subspace(consensusmoduletypes.ModuleName)
paramsKeeper.Subspace(consensusmoduletypes.ModuleName)
// paramsKeeper.Subspace(valsetmoduletypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
paramsKeeper.Subspace(evmmoduletypes.ModuleName)
Expand Down
13 changes: 13 additions & 0 deletions cmd/palomad/conifg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import tmcfg "github.com/cometbft/cometbft/config"

func initCometBFTConfig() *tmcfg.Config {
cfg := tmcfg.DefaultConfig()

// these values put a higher strain on node memory
// cfg.P2P.MaxNumInboundPeers = 100
// cfg.P2P.MaxNumOutboundPeers = 40

return cfg
}
26 changes: 24 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,30 @@ require (
)

require (
// cloud.google.com/go v0.110.10 // indirect
// cloud.google.com/go/compute v1.23.3 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

require (
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

require (
cloud.google.com/go v0.110.10 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
// cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
Expand Down
7 changes: 4 additions & 3 deletions x/consensus/genesis.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package consensus

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"context"

"github.com/palomachain/paloma/x/consensus/keeper"
"github.com/palomachain/paloma/x/consensus/types"
)

// InitGenesis initializes the capability module's state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) {
k.SetParams(ctx, genState.Params)
}

// ExportGenesis returns the capability module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState {
genesis := types.DefaultGenesis()
genesis.Params = k.GetParams(ctx)

Expand Down
21 changes: 11 additions & 10 deletions x/consensus/keeper/attest.go
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
package keeper

import (
"context"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/palomachain/paloma/util/liblog"
)

// CheckAndProcessAttestedMessages is supposed to be used within the
// EndBlocker. It will get messages for the attestators that have reached a
// consensus and process them.
func (k Keeper) CheckAndProcessAttestedMessages(ctx sdk.Context) error {
func (k Keeper) CheckAndProcessAttestedMessages(ctx context.Context) error {
sdkCtx := sdk.UnwrapSDKContext(ctx)
for _, supportedConsensusQueue := range k.registry.slice {
opts, err := supportedConsensusQueue.SupportedQueues(ctx)
opts, err := supportedConsensusQueue.SupportedQueues(sdkCtx)
if err != nil {
return err
}
for _, opt := range opts {
msgs, err := k.GetMessagesFromQueue(ctx, opt.QueueTypeName, 0)
msgs, err := k.GetMessagesFromQueue(sdkCtx, opt.QueueTypeName, 0)
if err != nil {
return err
}

for _, msg := range msgs {
k.Logger(ctx).Debug(
"check-and-process-attested-messages-queue",
"id", msg.GetId(),
"nonce", msg.Nonce(),
)
cq, err := k.getConsensusQueue(ctx, opt.QueueTypeName)
liblog.FromSDKLogger(k.Logger(sdkCtx)).WithFields("id", msg.GetId(), "nonce", msg.Nonce()).Debug(
"check-and-process-attested-messages-queue.")
cq, err := k.getConsensusQueue(sdkCtx, opt.QueueTypeName)
if err != nil {
return err
}
if err := opt.ProcessMessageForAttestation(ctx, cq, msg); err != nil {
if err := opt.ProcessMessageForAttestation(sdkCtx, cq, msg); err != nil {
return err
}
}
Expand Down
13 changes: 8 additions & 5 deletions x/consensus/keeper/cleanup.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
package keeper

import (
"context"

sdk "github.com/cosmos/cosmos-sdk/types"
)

func (k Keeper) DeleteOldMessages(ctx sdk.Context, blocksAgo int64) error {
func (k Keeper) DeleteOldMessages(ctx context.Context, blocksAgo int64) error {
sdkCtx := sdk.UnwrapSDKContext(ctx)
for _, supportedConsensusQueue := range k.registry.slice {
opts, err := supportedConsensusQueue.SupportedQueues(ctx)
opts, err := supportedConsensusQueue.SupportedQueues(sdkCtx)
if err != nil {
return err
}
for _, opt := range opts {
msgs, err := k.GetMessagesFromQueue(ctx, opt.QueueTypeName, 9999)
msgs, err := k.GetMessagesFromQueue(sdkCtx, opt.QueueTypeName, 9999)
if err != nil {
return err
}

for _, msg := range msgs {
if ctx.BlockHeight()-msg.GetAddedAtBlockHeight() > blocksAgo {
err = k.DeleteJob(ctx, opt.QueueTypeName, msg.GetId())
if sdkCtx.BlockHeight()-msg.GetAddedAtBlockHeight() > blocksAgo {
err = k.DeleteJob(sdkCtx, opt.QueueTypeName, msg.GetId())
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 7143904

Please sign in to comment.