Skip to content

Commit

Permalink
Merge branch 'main' into CNS-769-make-payment-e-2-e-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Yarom Swisa authored and Yarom Swisa committed Jan 24, 2024
2 parents 0335c58 + 5f2d89e commit 4aadd98
Show file tree
Hide file tree
Showing 16 changed files with 289 additions and 100 deletions.
60 changes: 51 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import (

"github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/runtime"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
"github.com/lavanet/lava/x/fixationstore"
fixationkeeper "github.com/lavanet/lava/x/fixationstore/keeper"
fixationtypes "github.com/lavanet/lava/x/fixationstore/types"
"github.com/lavanet/lava/x/timerstore"
timerstorekeeper "github.com/lavanet/lava/x/timerstore/keeper"
timerstoretypes "github.com/lavanet/lava/x/timerstore/types"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"

dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
Expand Down Expand Up @@ -84,6 +84,12 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
Expand All @@ -94,6 +100,7 @@ import (
ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/lavanet/lava/app/keepers"
appparams "github.com/lavanet/lava/app/params"
"github.com/lavanet/lava/app/upgrades"
Expand Down Expand Up @@ -166,6 +173,7 @@ var Upgrades = []upgrades.Upgrade{
upgrades.Upgrade_0_32_0,
upgrades.Upgrade_0_32_3,
upgrades.Upgrade_0_33_0,
upgrades.Upgrade_0_34_0,
}

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
Expand Down Expand Up @@ -212,6 +220,8 @@ var (
slashing.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
ica.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
Expand All @@ -237,7 +247,8 @@ var (
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
icatypes.ModuleName: nil,
subscriptionmoduletypes.ModuleName: {authtypes.Burner, authtypes.Staking},
string(rewardsmoduletypes.ValidatorsRewardsAllocationPoolName): {authtypes.Minter, authtypes.Staking},
string(rewardsmoduletypes.ValidatorsRewardsDistributionPoolName): {authtypes.Burner, authtypes.Staking},
Expand Down Expand Up @@ -319,7 +330,10 @@ func New(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, crisistypes.StoreKey, ibctransfertypes.StoreKey, ibcexported.StoreKey, capabilitytypes.StoreKey,
evidencetypes.StoreKey, crisistypes.StoreKey, ibctransfertypes.StoreKey, ibcexported.StoreKey,
icahosttypes.StoreKey,
icacontrollertypes.StoreKey,
capabilitytypes.StoreKey,
specmoduletypes.StoreKey,
epochstoragemoduletypes.StoreKey,
dualstakingmoduletypes.StoreKey,
Expand Down Expand Up @@ -359,6 +373,8 @@ func New(
// grant capabilities for the ibc and ibc-transfer modules
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
// this line is used by starport scaffolding # stargate/app/scopedKeeper

// add keepers
Expand Down Expand Up @@ -556,6 +572,7 @@ func New(
// TODO: Check alternatives to this
// AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.UpgradeKeeper)).
// AddRoute(ibcexported.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))

// Create Transfer Keepers
Expand All @@ -567,6 +584,26 @@ func New(
transferModule := transfer.NewAppModule(app.TransferKeeper)
transferIBCModule := transfer.NewIBCModule(app.TransferKeeper)

app.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec, keys[icahosttypes.StoreKey],
app.GetSubspace(icahosttypes.SubModuleName),
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
scopedICAHostKeeper,
app.MsgServiceRouter(),
)
icaControllerKeeper := icacontrollerkeeper.NewKeeper(
appCodec, keys[icacontrollertypes.StoreKey],
app.GetSubspace(icacontrollertypes.SubModuleName),
app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
scopedICAControllerKeeper, app.MsgServiceRouter(),
)
icaModule := ica.NewAppModule(&icaControllerKeeper, &app.ICAHostKeeper)
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)

// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
evidenceKeeper := evidencekeeper.NewKeeper(
appCodec, keys[evidencetypes.StoreKey], app.StakingKeeper, app.SlashingKeeper,
Expand Down Expand Up @@ -612,8 +649,8 @@ func New(

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := ibcporttypes.NewRouter()
// ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferModule)
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
// this line is used by starport scaffolding # ibc/app/router
app.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -663,7 +700,7 @@ func New(
protocolModule,
downtimeModule,
rewardsModule,

icaModule,
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
// this line is used by starport scaffolding # stargate/app/appModule
)
Expand All @@ -689,6 +726,7 @@ func New(
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
specmoduletypes.ModuleName,
epochstoragemoduletypes.ModuleName,
dualstakingmoduletypes.ModuleName,
Expand Down Expand Up @@ -716,6 +754,7 @@ func New(
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
specmoduletypes.ModuleName,
epochstoragemoduletypes.ModuleName,
dualstakingmoduletypes.ModuleName,
Expand Down Expand Up @@ -755,6 +794,7 @@ func New(
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
specmoduletypes.ModuleName,
subscriptionmoduletypes.ModuleName,
downtimemoduletypes.ModuleName,
Expand Down Expand Up @@ -1019,6 +1059,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(specmoduletypes.ModuleName)
paramsKeeper.Subspace(epochstoragemoduletypes.ModuleName)
paramsKeeper.Subspace(dualstakingmoduletypes.ModuleName)
Expand Down
2 changes: 2 additions & 0 deletions app/keepers/lavaKeepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
conflictmodulekeeper "github.com/lavanet/lava/x/conflict/keeper"
Expand Down Expand Up @@ -68,4 +69,5 @@ type LavaKeepers struct {
DowntimeKeeper downtimemodulekeeper.Keeper
RewardsKeeper rewardsmodulekeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
}
10 changes: 10 additions & 0 deletions app/upgrades/empty_upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
"github.com/lavanet/lava/app/keepers"
v1 "github.com/lavanet/lava/x/downtime/v1"
dualstakingtypes "github.com/lavanet/lava/x/dualstaking/types"
Expand Down Expand Up @@ -193,3 +195,11 @@ var Upgrade_0_33_0 = Upgrade{
CreateUpgradeHandler: defaultUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}

var Upgrade_0_34_0 = Upgrade{
UpgradeName: "v0.34.0",
CreateUpgradeHandler: defaultUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{icahosttypes.StoreKey, icacontrollertypes.StoreKey},
},
}
2 changes: 1 addition & 1 deletion proto/lavanet/lava/dualstaking/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
lavanet.lava.fixationstore.GenesisState delegationsFS = 2 [(gogoproto.nullable) = false];
lavanet.lava.fixationstore.GenesisState delegatorsFS = 3 [(gogoproto.nullable) = false];
lavanet.lava.timerstore.GenesisState unbondingsTS = 4 [(gogoproto.nullable) = false];
reserved 4;
repeated DelegatorReward delegator_reward_list = 5 [(gogoproto.nullable) = false];
}
3 changes: 3 additions & 0 deletions protocol/chainlib/chain_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ func (cf *ChainFetcher) Verify(ctx context.Context, verification VerificationCon
{Key: "parsedResult", Value: parsedResult},
{Key: "verification.Value", Value: verification.Value},
{Key: "Method", Value: parsing.GetApiName()},
{Key: "Extension", Value: verification.Extension},
{Key: "Addon", Value: verification.Addon},
{Key: "Verification", Value: verification.Name},
}...)
}
}
Expand Down
9 changes: 7 additions & 2 deletions protocol/rpcconsumer/rpcconsumer_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,13 @@ func (rpccs *RPCConsumerServer) sendRelayToProvider(
if cacheError == nil && reply != nil {
// Info was fetched from cache, so we don't need to change the state
// so we can return here, no need to update anything and calculate as this info was fetched from the cache
relayResult = &common.RelayResult{Reply: reply, Request: &pairingtypes.RelayRequest{RelayData: relayRequestData}}
lavaprotocol.SetRequestedBlockNotApplicable(relayResult.Request.RelayData)
relayResult = &common.RelayResult{
Reply: reply,
Request: &pairingtypes.RelayRequest{
RelayData: relayRequestData,
},
Finalized: false, // set false to skip data reliability
}
return relayResult, nil
}
// cache failed, move on to regular relay
Expand Down
2 changes: 1 addition & 1 deletion protocol/rpcprovider/spec_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (

var (
SpecValidationInterval = 3 * time.Hour
SpecValidationIntervalDisabledChains = 10 * time.Minute
SpecValidationIntervalDisabledChains = 3 * time.Minute
)

type SpecValidator struct {
Expand Down
5 changes: 3 additions & 2 deletions scripts/init_chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if ! command_exists jq; then
fi

rm -rf ~/.lava
lavad init validator --chain-id lava
chainID="lava"
lavad init validator --chain-id $chainID
lavad config broadcast-mode sync
lavad config keyring-backend test

Expand Down Expand Up @@ -112,6 +113,6 @@ if [ "$1" == "debug" ]; then
else
lavad add-genesis-account providers_rewards_allocation_pool 30000000000000ulava --module-account
fi
lavad gentx alice 10000000000000ulava --chain-id lava
lavad gentx alice 10000000000000ulava --chain-id $chainID
lavad collect-gentxs
lavad start --pruning=nothing
2 changes: 1 addition & 1 deletion scripts/init_chain_commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ echo; echo "#### Voting on plans del proposal ####"
lavad tx gov vote $(latest_vote) yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE

echo; echo "#### Sending proposal for plans del ####"
lavad tx subscription buy DefaultPlan $(lavad keys show user1 -a) -y --from user1 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
lavad tx subscription buy DefaultPlan $(lavad keys show user1 -a) --enable-auto-renewal -y --from user1 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
# lavad tx project set-policy $(lavad keys show user1 -a)-admin ./cookbook/projects/policy_all_chains_with_addon.yml -y --from user1 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE

# MANTLE
Expand Down
Loading

0 comments on commit 4aadd98

Please sign in to comment.