Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
68 changes: 57 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
"fmt"
"io"
"os"
"time"

"cosmossdk.io/client/v2/autocli"
Expand Down Expand Up @@ -45,6 +46,7 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/types/msgservice"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
Expand Down Expand Up @@ -78,6 +80,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/gogoproto/proto"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"
Expand Down Expand Up @@ -486,6 +489,20 @@ func New(
app.GovParamFilters(),
))

protoFiles, err := proto.MergedRegistry()
if err != nil {
panic(err)
}
err = msgservice.ValidateProtoAnnotations(protoFiles)
if err != nil {
// Once we switch to using protoreflect-based antehandlers, we might
// want to panic here instead of logging a warning.
_, err := fmt.Fprintln(os.Stderr, err.Error())
if err != nil {
fmt.Println("could not write to stderr")
}
}

app.encodingConfig = encodingConfig
if err := app.LoadLatestVersion(); err != nil {
panic(err)
Expand All @@ -497,6 +514,20 @@ func New(
// Name returns the name of the App
func (app *App) Name() string { return app.BaseApp.Name() }

// Info implements the abci interface. It overrides baseapp's Info method, essentially becoming a decorator
// in order to assign TimeoutInfo values in the response.
func (app *App) Info(req *abci.RequestInfo) (*abci.ResponseInfo, error) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julienrbrt can you confirm that any of the old diffs from here aren't needed anymore? https://github.com/celestiaorg/celestia-app/blob/main/app/app.go#L558

res, err := app.BaseApp.Info(req)
if err != nil {
return nil, err
}

res.TimeoutInfo.TimeoutCommit = app.TimeoutCommit()
res.TimeoutInfo.TimeoutPropose = app.TimeoutPropose()

return res, nil
}

// PreBlocker application updates every pre block
func (app *App) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) {
return app.ModuleManager.PreBlock(ctx)
Expand All @@ -513,6 +544,7 @@ func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) {
if err != nil {
return sdk.EndBlock{}, err
}

currentVersion, err := app.AppVersion(ctx)
if err != nil {
return sdk.EndBlock{}, err
Expand Down Expand Up @@ -546,9 +578,9 @@ func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) {
}
}

// TODO: check if needed, it is no more there
// res.Timeouts.TimeoutCommit = app.getTimeoutCommit(currentVersion)
// res.Timeouts.TimeoutPropose = appconsts.GetTimeoutPropose(currentVersion)
res.TimeoutInfo.TimeoutCommit = app.TimeoutCommit()
res.TimeoutInfo.TimeoutPropose = app.TimeoutPropose()

return res, nil
}

Expand All @@ -558,12 +590,21 @@ func (app *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.
if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
return nil, err
}

versionMap := app.ModuleManager.GetVersionMap()
if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, versionMap); err != nil {
return nil, err
}

return app.ModuleManager.InitGenesis(ctx, app.AppCodec(), genesisState)
res, err := app.ModuleManager.InitGenesis(ctx, app.AppCodec(), genesisState)
if err != nil {
return nil, err
}

res.TimeoutInfo.TimeoutCommit = app.TimeoutCommit()
res.TimeoutInfo.TimeoutPropose = app.TimeoutPropose()

return res, nil
}

// DefaultGenesis returns the default genesis state
Expand Down Expand Up @@ -759,14 +800,19 @@ func (app *App) NewProposalContext(header tmproto.Header) sdk.Context {
return ctx
}

// getTimeoutCommit returns the timeoutCommit if a user has overridden it via the
// --timeout-commit flag. Otherwise, it returns the default timeout commit based
// on the app version.
// TODO: is this still needed?
// nolint:unused
func (app *App) getTimeoutCommit(_ uint64) time.Duration {
// TimeoutCommit returns the timeout commit duration to be used on the next block.
// It returns the user specified value as overridden by the --timeout-commit flag, otherwise
// the default timeout commit value for the current app version.
func (app *App) TimeoutCommit() time.Duration {
if app.timeoutCommit != 0 {
return app.timeoutCommit
}
return appconsts.DefaultTimeoutCommit

return appconsts.TimeoutCommit
}

// TimeoutPropose returns the timeout propose duration to be used on the next block.
// It returns the default timeout propose value for the current app version.
func (app *App) TimeoutPropose() time.Duration {
return appconsts.TimeoutPropose
}
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,12 @@ require (
)

replace (
cosmossdk.io/x/upgrade => github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250320145042-6d8b2a52fbb2
github.com/cometbft/cometbft => github.com/celestiaorg/celestia-core v0.38.11-0.20250321105625-57e36546e8a3 // marko/core_changes_v3
// github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v0.50.0-beta.0.0.20250320145042-6d8b2a52fbb2 // release/v0.50.x-celestia
// TODO: temporarily pinned to https://github.com/celestiaorg/cosmos-sdk/pull/435
github.com/cosmos/cosmos-sdk => github.com/01builders/cosmos-sdk v0.0.0-20250326090942-c30caa50cbee
// x/upgrade: release/v0.50.x-celestia
cosmossdk.io/x/upgrade => github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250402072731-9d04f7ac424a
// celestia-core: release/v0.38.x-celestia
github.com/cometbft/cometbft => github.com/celestiaorg/celestia-core v0.38.11-0.20250331172655-bbd3b9bdd1ee
// cosmos-sdk: release/v0.50.x-celestia
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v0.50.0-beta.0.0.20250402072731-9d04f7ac424a
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.45.0-tm-v0.34.35
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ cosmossdk.io/x/tx v0.13.8/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/01builders/cosmos-sdk v0.0.0-20250326090942-c30caa50cbee h1:D1hCSbu4VvrmjLEpyH/QuxDaMvbIDKd/kGGVz+nXB+E=
github.com/01builders/cosmos-sdk v0.0.0-20250326090942-c30caa50cbee/go.mod h1:GxSHuTXWmqEDevUwKZjOXMn7tQteyAueJtEWXUtTlws=
github.com/01builders/nova v0.0.0-20250326081858-46ef7ddcb5c6 h1:ZA5LyV5zG3FWibjit2EfLNJQGq6Tj8FJpfXaORJ0Pq0=
github.com/01builders/nova v0.0.0-20250326081858-46ef7ddcb5c6/go.mod h1:BDQ0uO2y0Y7ohX6XQOIi32EtfqlcqNOdJIdacFVdXOU=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
Expand Down Expand Up @@ -356,12 +354,14 @@ github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFos
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7 h1:nxplQi8wrLMjhu260RuigXylC3pWoDu4OVumPHeojnk=
github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7/go.mod h1:1EF5MfOxVf0WC51Gb7pJ6bcZxnXKNAf9pqWtjgPBAYc=
github.com/celestiaorg/celestia-core v0.38.11-0.20250321105625-57e36546e8a3 h1:Mmnos7MeeEwfv2ebffp9VfXQ5NyOqopsfhUwniCNRBo=
github.com/celestiaorg/celestia-core v0.38.11-0.20250321105625-57e36546e8a3/go.mod h1:o2x5x8cXRuJOdx4PfzF6lbxjq5/VbK0PnRDWRLsMLNM=
github.com/celestiaorg/celestia-core v0.38.11-0.20250331172655-bbd3b9bdd1ee h1:3GKW72AzYooZD7pzikSQeI9VUDw3qD5y4gWFXVZbkvg=
github.com/celestiaorg/celestia-core v0.38.11-0.20250331172655-bbd3b9bdd1ee/go.mod h1:PiU80T/t0z8FPlz7DRZgvrBux0jJiqxFi9lNBFdGUps=
github.com/celestiaorg/celestia-core v1.45.0-tm-v0.34.35 h1:T21AhezjcByAlWDHmiVbpg743Uqk/dqBzJkQsAnbQf8=
github.com/celestiaorg/celestia-core v1.45.0-tm-v0.34.35/go.mod h1:fQ46s1hYFTGFBsHsuGsbxDZ720ZPQow5Iyqw+yErZSo=
github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250320145042-6d8b2a52fbb2 h1:o+cQNLd5GQJdtlD8k7YofVIOJB9wkPX9cIEJz0E3FFg=
github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250320145042-6d8b2a52fbb2/go.mod h1:GdR2F3YQhICk8j5cEHOoSBdsIkKBDUcznPfjgnDHg5U=
github.com/celestiaorg/cosmos-sdk v0.50.0-beta.0.0.20250402072731-9d04f7ac424a h1:18hxmk72O7Pwu/ADTopXFrYPDmCgT3e63KupO8XSoCE=
github.com/celestiaorg/cosmos-sdk v0.50.0-beta.0.0.20250402072731-9d04f7ac424a/go.mod h1:dBrR8kP1lYEf0E8F5xAnnCRxOewwm+8ceSq+nWPeu/U=
github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250402072731-9d04f7ac424a h1:15Q4O8EMqPtqn7d24SyG1z/1MAXznBfIpyn2M48EWlw=
github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250402072731-9d04f7ac424a/go.mod h1:R0bq8esgfPxsVm1q0k7p9nhg1fEpcUeXp5+6AcftGLQ=
github.com/celestiaorg/go-square/v2 v2.1.0 h1:ECIvYEeHIWiIJGDCJxQNtzqm5DmnBly7XGhSpLsl+Lw=
github.com/celestiaorg/go-square/v2 v2.1.0/go.mod h1:n3ztrh8CBjWOD6iWYMo3pPOlQIgzLK9yrnqMPcNo6g8=
github.com/celestiaorg/knuu v0.16.3 h1:ORmcBoSW+67iPKF0yIGKwWMefphk5hvy08KklmCT0aw=
Expand Down
3 changes: 2 additions & 1 deletion pkg/appconsts/versioned_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ var (
DefaultTxSizeCostPerByte = v4.TxSizeCostPerByte
DefaultGasPerBlobByte = v4.GasPerBlobByte
DefaultVersion = v4.Version
DefaultTimeoutCommit = v4.TimeoutCommit
DefaultUpgradeHeightDelay = v4.UpgradeHeightDelay
DefaultMaxTxSize = v4.MaxTxSize
SubtreeRootThreshold = v4.SubtreeRootThreshold
TimeoutCommit = v4.TimeoutCommit
TimeoutPropose = v4.TimeoutPropose
)

func GetTimeoutCommit(_ uint64) time.Duration {
Expand Down
1 change: 1 addition & 0 deletions test/util/testnode/comet_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewCometNode(baseDir string, config *UniversalTestingConfig) (*node.Node, s
}

config.AppOptions.Set(flags.FlagHome, baseDir)
config.AppOptions.Set(TimeoutCommitFlag, config.TmConfig.Consensus.TimeoutCommit)
app := config.AppCreator(logger, db, nil, config.AppOptions)

nodeKey, err := p2p.LoadOrGenNodeKey(config.TmConfig.NodeKeyFile())
Expand Down
4 changes: 3 additions & 1 deletion test/util/testnode/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const (
mebibyte = 1_048_576 // bytes
DefaultValidatorAccountName = "validator"
DefaultInitialBalance = genesis.DefaultInitialBalance
// TimeoutCommit is a flag that can be used to override the timeout_commit.
TimeoutCommitFlag = "timeout-commit"
)

type UniversalTestingConfig struct {
Expand Down Expand Up @@ -171,7 +173,7 @@ func DefaultAppCreator(opts ...AppCreationOptions) srvtypes.AppCreator {
log.NewNopLogger(),
dbm.NewMemDB(),
nil, // trace store
0, // timeout commit
appOptions.Get(TimeoutCommitFlag).(time.Duration), // timeout commit
simtestutil.EmptyAppOptions{},
baseAppOptions...,
)
Expand Down
Loading