Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: versioned timeouts #3882

Merged
merged 117 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
8ef416b
introduces timeout propose and commit consts
staheri14 Sep 17, 2024
0cd25d3
sets tiemouts in EndBlocker based on the updated version
staheri14 Sep 19, 2024
a878a20
sets timeout propose of v3 to 10
staheri14 Sep 19, 2024
20b62ef
retrieves timeouts based on the app version
staheri14 Sep 19, 2024
14abdab
points to a new version of core
staheri14 Sep 19, 2024
33b2f7f
adds a todo
staheri14 Sep 19, 2024
dc127da
displaying the timeout propose in the logs
staheri14 Sep 19, 2024
7efde46
minor correction on a comment
staheri14 Sep 19, 2024
3eca59d
sets the initial values of timeouts according to the latest version s…
staheri14 Sep 19, 2024
861309f
adds a todo
staheri14 Sep 19, 2024
789bc23
gets timeouts in info
staheri14 Sep 20, 2024
3158757
bumps core
staheri14 Sep 20, 2024
75a5016
return timouts in the Info call
staheri14 Sep 20, 2024
539d4d6
refactors the code based on the new core
staheri14 Sep 20, 2024
c64caa3
Merge remote-tracking branch 'origin/main' into sanaz/modify-timeouts
staheri14 Sep 24, 2024
a6d5c1d
updates the core version with new InitChain
staheri14 Sep 24, 2024
81e7f9b
sends back timeouts in the InitChainResponse
staheri14 Sep 24, 2024
0dbe35c
adds a reminder
staheri14 Sep 27, 2024
1984704
Merge remote-tracking branch 'origin/main' into sanaz/modify-timeouts
staheri14 Sep 27, 2024
be3bf26
adding a todo
staheri14 Sep 27, 2024
76eb2fb
deletes stale comment
staheri14 Sep 27, 2024
bc2e04c
indicates that the long form of the flags are used using double hypen
staheri14 Oct 1, 2024
07daa0b
passes the key-path
staheri14 Oct 1, 2024
8ac82fe
modifies a godoc
staheri14 Oct 1, 2024
76fd45d
fixes a typo
staheri14 Oct 1, 2024
da8c5e4
wip test
staheri14 Oct 2, 2024
31a7f36
sets the timeouts according to the app version in the current block h…
staheri14 Oct 2, 2024
6b2f58e
adds checks for timeouts in the V3Upgrade tests
staheri14 Oct 2, 2024
eb2dab5
bumps core
staheri14 Oct 2, 2024
345ecc0
updates test for new timeout logic at pre-upgrade height
staheri14 Oct 2, 2024
cdef177
extends timeout checks to the initChain calls
staheri14 Oct 2, 2024
510fb4c
reverts major upgrade e2e tests back to its initial version
staheri14 Oct 2, 2024
67e702b
bumps core
staheri14 Oct 2, 2024
d67a2fe
changes default configs for testing purposes
staheri14 Oct 2, 2024
ebadbd8
fixes test name
staheri14 Oct 2, 2024
c2a804f
adds a test file
staheri14 Oct 2, 2024
759e650
adds some checks over the abci responses
staheri14 Oct 2, 2024
ac4e88e
Merge remote-tracking branch 'origin/main' into sanaz/fix-txclient-flags
staheri14 Oct 2, 2024
71fb648
logs txclient args for visibility and debugging
staheri14 Oct 2, 2024
f15e64e
Merge branch 'main' into sanaz/modify-timeouts
staheri14 Oct 3, 2024
6794d0f
Merge branch 'sanaz/fix-txclient-flags' into sanaz/modify-timeouts
staheri14 Oct 3, 2024
a184376
updates e2e benchmark test branch to the current branch
staheri14 Oct 3, 2024
6027fb3
bumps core
staheri14 Oct 3, 2024
05ebaa7
reduces timeouts to the total of 6 s
staheri14 Oct 3, 2024
ba95e0b
bumps core
staheri14 Oct 4, 2024
ab41d7b
Merge remote-tracking branch 'origin/main' into sanaz/modify-timeouts
staheri14 Oct 4, 2024
c1abf94
allows changing app version in the genesis
staheri14 Oct 4, 2024
d9d5231
adds some utilities to calculate block time stats
staheri14 Oct 4, 2024
721910d
bumps core
staheri14 Oct 4, 2024
072d17d
bumps core
staheri14 Oct 4, 2024
0e20204
bumps core
staheri14 Oct 4, 2024
4ac2c73
fixes godocs
staheri14 Oct 4, 2024
0e3c631
adds a test for v3 in biglbokcs
staheri14 Oct 4, 2024
cdba0b7
allows access to the cometbft node in testnode
staheri14 Oct 4, 2024
e160793
updates Timeouts test
staheri14 Oct 4, 2024
f10dd3b
adds util to get genesis app version in e2e tests
staheri14 Oct 4, 2024
2d818d6
includes timeouts test in the main
staheri14 Oct 4, 2024
2497800
updates testnet to delay the start of some of the genesis nodes
staheri14 Oct 4, 2024
7280b4f
fixes an issue with starting a subset of nodes
staheri14 Oct 4, 2024
1fddc7b
starts tx clients seletively
staheri14 Oct 4, 2024
6c6f247
delays one of the validators
staheri14 Oct 4, 2024
853abb7
adds a log message to indicate the remainder of validators could not …
staheri14 Oct 7, 2024
910e2df
bumps core to a version with a fix to the start time after the genesi…
staheri14 Oct 8, 2024
8fa70a3
adds an integration test for timeouts
staheri14 Oct 8, 2024
b86606c
clarifies some comments
staheri14 Oct 8, 2024
409d834
Merge remote-tracking branch 'origin/main' into sanaz/modify-timeouts
staheri14 Oct 9, 2024
6bb63ba
bumps core to the version with new endpoints for timeouts
staheri14 Oct 9, 2024
104740d
fixes timeouts e2e test
staheri14 Oct 9, 2024
e7d990b
verifies timeouts at the end of v3 upgrade tests
staheri14 Oct 9, 2024
fb2fdab
adds further logs and checks the initial timeouts
staheri14 Oct 9, 2024
81d8415
reduces upgrade delay
staheri14 Oct 9, 2024
75d7a9a
reorganizes the test to check timeouts after upgrade is complete
staheri14 Oct 9, 2024
79595cd
creates one client for all the height checks
staheri14 Oct 9, 2024
aaa1b63
bumps core
staheri14 Oct 11, 2024
6610962
fixes comments
staheri14 Oct 11, 2024
bcd9cae
deletes stale todo
staheri14 Oct 11, 2024
b0f614c
restores the original version of the script
staheri14 Oct 11, 2024
be5d05a
renames Timeouts to VersionedTimeouts
staheri14 Oct 11, 2024
cd066e6
bumps core
staheri14 Oct 11, 2024
e12ab20
Merge remote-tracking branch 'origin/main' into sanaz/modify-timeouts
staheri14 Oct 11, 2024
b2b6baa
adds reminder to change hardcoded versions
staheri14 Oct 11, 2024
ae4fbc3
removes ABCI info check
staheri14 Oct 11, 2024
7a993f1
removes a new line
staheri14 Oct 11, 2024
1be795a
adds a newline
staheri14 Oct 11, 2024
4621a6b
pass upgrade schedule flag only if one is available
staheri14 Oct 11, 2024
3ea0ca5
deletes a comment
staheri14 Oct 11, 2024
e8affab
fix: tests using app wrapper in testnode
evan-forbes Oct 14, 2024
403aa1d
Merge branch 'main' into sanaz/modify-timeouts
evan-forbes Oct 14, 2024
3762a2d
chore: linter
evan-forbes Oct 14, 2024
3ceae06
chore: linter
evan-forbes Oct 14, 2024
bdcf68e
fix: block until the first block is created in testnode
evan-forbes Oct 15, 2024
955a658
chore: review feedback
evan-forbes Oct 15, 2024
3fc1c5a
chore: linter
evan-forbes Oct 15, 2024
558802c
Update test/e2e/major_upgrade_v3.go
evan-forbes Oct 15, 2024
4f220d3
chore: silly coderabit
evan-forbes Oct 15, 2024
0bfab8e
chore: test
evan-forbes Oct 15, 2024
5a71dd7
chore: test
evan-forbes Oct 15, 2024
8f57f47
fix: test
evan-forbes Oct 15, 2024
c9ece2a
chore: update version
evan-forbes Oct 15, 2024
7845569
Update test/e2e/benchmark/benchmark.go
evan-forbes Oct 15, 2024
8a0c432
Update cmd/celestia-appd/cmd/start.go
evan-forbes Oct 15, 2024
fc6a897
fix: use official release of core and correct height delay
evan-forbes Oct 15, 2024
9e6f713
Merge branch 'sanaz/modify-timeouts' of github.com:celestiaorg/celest…
evan-forbes Oct 15, 2024
b9b1df8
chore: try to unflake blobstream test
evan-forbes Oct 15, 2024
8c019af
chore: reduce lieklyhood of flakes and be explicit about a flake failure
evan-forbes Oct 16, 2024
e13b96c
chore: correct error
evan-forbes Oct 16, 2024
899ad7c
Merge branch 'main' into sanaz/modify-timeouts
evan-forbes Oct 16, 2024
b9aca24
fix: whoops don't change the upgrade height delay
evan-forbes Oct 16, 2024
6c70dac
chore: remove unused method
evan-forbes Oct 16, 2024
61a747b
chore: removed indice filtering step
evan-forbes Oct 16, 2024
07c1fc9
refactor: test
evan-forbes Oct 16, 2024
d969f68
feat!: version `UpgradeHeightDelay` (#3980)
evan-forbes Oct 16, 2024
528fa8c
chore: delete appconsts.Timeouts
evan-forbes Oct 16, 2024
9669f8c
fix: MajorUpgradeToV3
evan-forbes Oct 16, 2024
7383fa0
use latest version instead of a commit
evan-forbes Oct 16, 2024
bcf4223
fix: check e2e for decrease in time
evan-forbes Oct 16, 2024
fbbd9e6
fix: don't update the goal block time for now
evan-forbes Oct 16, 2024
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
14 changes: 11 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func New(
),
)

app.SignalKeeper = signal.NewKeeper(appCodec, keys[signaltypes.StoreKey], app.StakingKeeper, appconsts.UpgradeHeightDelay())
app.SignalKeeper = signal.NewKeeper(appCodec, keys[signaltypes.StoreKey], app.StakingKeeper)

app.IBCKeeper = ibckeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -458,7 +458,7 @@ func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.R
func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
res := app.manager.EndBlock(ctx, req)
currentVersion := app.AppVersion()
// For v1 only we upgrade using a agreed upon height known ahead of time
// For v1 only we upgrade using an agreed upon height known ahead of time
if currentVersion == v1 {
// check that we are at the height before the upgrade
if req.Height == app.upgradeHeightV2-1 {
Expand All @@ -480,6 +480,8 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo
app.SignalKeeper.ResetTally(ctx)
}
}
res.Timeouts.TimeoutCommit = appconsts.GetTimeoutCommit(currentVersion)
res.Timeouts.TimeoutPropose = appconsts.GetTimeoutPropose(currentVersion)
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved
return res
}

Expand Down Expand Up @@ -535,11 +537,15 @@ func (app *App) Info(req abci.RequestInfo) abci.ResponseInfo {
if resp.AppVersion > 0 && !app.IsSealed() {
app.mountKeysAndInit(resp.AppVersion)
}

resp.Timeouts.TimeoutPropose = appconsts.GetTimeoutPropose(resp.AppVersion)
resp.Timeouts.TimeoutCommit = appconsts.GetTimeoutCommit(resp.AppVersion)
Comment on lines +541 to +542
Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI: If this is called the first time a node starts up. The version may be 0


return resp
}

// InitChain implements the ABCI interface. This method is a wrapper around
// baseapp's InitChain so we can take the app version and setup the multicommit
// baseapp's InitChain so that we can take the app version and setup the multicommit
// store.
//
// Side-effect: calls baseapp.Init()
Expand All @@ -558,6 +564,8 @@ func (app *App) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain
app.SetInitialAppVersionInConsensusParams(ctx, appVersion)
app.SetAppVersion(ctx, appVersion)
}
res.Timeouts.TimeoutCommit = appconsts.GetTimeoutCommit(appVersion)
res.Timeouts.TimeoutPropose = appconsts.GetTimeoutPropose(appVersion)
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved
return res
}

Expand Down
4 changes: 2 additions & 2 deletions app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ func DefaultConsensusConfig() *tmcfg.Config {
cfg.Mempool.MaxTxsBytes = 39_485_440
cfg.Mempool.Version = "v1" // prioritized mempool

cfg.Consensus.TimeoutPropose = appconsts.TimeoutPropose
cfg.Consensus.TimeoutCommit = appconsts.TimeoutCommit
cfg.Consensus.TimeoutPropose = appconsts.GetTimeoutPropose(appconsts.LatestVersion)
cfg.Consensus.TimeoutCommit = appconsts.GetTimeoutCommit(appconsts.LatestVersion)
cfg.Consensus.SkipTimeoutCommit = false

cfg.TxIndex.Indexer = "null"
Expand Down
2 changes: 1 addition & 1 deletion app/module/configurator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestConfigurator(t *testing.T) {
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
require.NoError(t, stateStore.LoadLatestVersion())

keeper := signal.NewKeeper(config.Codec, storeKey, nil, 0)
keeper := signal.NewKeeper(config.Codec, storeKey, nil)
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved
require.NotNil(t, keeper)
upgradeModule := signal.NewAppModule(keeper)
manager, err := module.NewManager([]module.VersionedModule{
Expand Down
36 changes: 29 additions & 7 deletions app/test/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func TestAppUpgradeV3(t *testing.T) {
if testing.Short() {
t.Skip("skipping TestAppUpgradeV3 in short mode")
}

appconsts.OverrideUpgradeHeightDelayStr = "1"
defer func() { appconsts.OverrideUpgradeHeightDelayStr = "" }()

testApp, genesis := SetupTestAppWithUpgradeHeight(t, 3)
upgradeFromV1ToV2(t, testApp)

Expand Down Expand Up @@ -88,6 +92,10 @@ func TestAppUpgradeV3(t *testing.T) {
Height: 3,
})
require.Equal(t, v2.Version, endBlockResp.ConsensusParamUpdates.Version.AppVersion)
require.Equal(t, appconsts.GetTimeoutCommit(v2.Version),
endBlockResp.Timeouts.TimeoutCommit)
require.Equal(t, appconsts.GetTimeoutPropose(v2.Version),
endBlockResp.Timeouts.TimeoutPropose)
testApp.Commit()
require.NoError(t, signer.IncrementSequence(testnode.DefaultValidatorAccountName))

Expand All @@ -98,18 +106,22 @@ func TestAppUpgradeV3(t *testing.T) {

// brace yourselfs, this part may take a while
initialHeight := int64(4)
for height := initialHeight; height < initialHeight+appconsts.DefaultUpgradeHeightDelay; height++ {
for height := initialHeight; height < initialHeight+appconsts.UpgradeHeightDelay(v2.Version); height++ {
appVersion := v2.Version
_ = testApp.BeginBlock(abci.RequestBeginBlock{
Header: tmproto.Header{
Height: height,
Version: tmversion.Consensus{App: 2},
Version: tmversion.Consensus{App: appVersion},
},
})

endBlockResp = testApp.EndBlock(abci.RequestEndBlock{
Height: 3 + appconsts.DefaultUpgradeHeightDelay,
Height: 3 + appconsts.UpgradeHeightDelay(v2.Version),
})

require.Equal(t, appconsts.GetTimeoutCommit(appVersion), endBlockResp.Timeouts.TimeoutCommit)
require.Equal(t, appconsts.GetTimeoutPropose(appVersion), endBlockResp.Timeouts.TimeoutPropose)

_ = testApp.Commit()
}
require.Equal(t, v3.Version, endBlockResp.ConsensusParamUpdates.Version.AppVersion)
Expand All @@ -129,7 +141,7 @@ func TestAppUpgradeV3(t *testing.T) {
_ = testApp.BeginBlock(abci.RequestBeginBlock{
Header: tmproto.Header{
ChainID: genesis.ChainID,
Height: initialHeight + appconsts.DefaultUpgradeHeightDelay,
Height: initialHeight + appconsts.UpgradeHeightDelay(v3.Version),
Version: tmversion.Consensus{App: 3},
},
})
Expand All @@ -139,7 +151,10 @@ func TestAppUpgradeV3(t *testing.T) {
})
require.Equal(t, abci.CodeTypeOK, deliverTxResp.Code, deliverTxResp.Log)

_ = testApp.EndBlock(abci.RequestEndBlock{})
respEndBlock := testApp.EndBlock(abci.
RequestEndBlock{Height: initialHeight + appconsts.UpgradeHeightDelay(v3.Version)})
require.Equal(t, appconsts.GetTimeoutCommit(v3.Version), respEndBlock.Timeouts.TimeoutCommit)
require.Equal(t, appconsts.GetTimeoutPropose(v3.Version), respEndBlock.Timeouts.TimeoutPropose)
}

// TestAppUpgradeV2 verifies that the all module's params are overridden during an
Expand Down Expand Up @@ -271,7 +286,10 @@ func SetupTestAppWithUpgradeHeight(t *testing.T, upgradeHeight int64) (*app.App,

// assert that the chain starts with version provided in genesis
infoResp := testApp.Info(abci.RequestInfo{})
require.EqualValues(t, app.DefaultInitialConsensusParams().Version.AppVersion, infoResp.AppVersion)
appVersion := app.DefaultInitialConsensusParams().Version.AppVersion
require.EqualValues(t, appVersion, infoResp.AppVersion)
require.EqualValues(t, appconsts.GetTimeoutCommit(appVersion), infoResp.Timeouts.TimeoutCommit)
require.EqualValues(t, appconsts.GetTimeoutPropose(appVersion), infoResp.Timeouts.TimeoutPropose)

supportedVersions := []uint64{v1.Version, v2.Version, v3.Version}
require.Equal(t, supportedVersions, testApp.SupportedVersions())
Expand All @@ -286,7 +304,11 @@ func upgradeFromV1ToV2(t *testing.T, testApp *app.App) {
Height: 2,
Version: tmversion.Consensus{App: 1},
}})
testApp.EndBlock(abci.RequestEndBlock{Height: 2})
endBlockResp := testApp.EndBlock(abci.RequestEndBlock{Height: 2})
require.Equal(t, appconsts.GetTimeoutCommit(v1.Version),
endBlockResp.Timeouts.TimeoutCommit)
require.Equal(t, appconsts.GetTimeoutPropose(v1.Version),
endBlockResp.Timeouts.TimeoutPropose)
testApp.Commit()
require.EqualValues(t, 2, testApp.AppVersion())
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,5 @@ replace (
github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.12.4
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.42.0-tm-v0.34.35
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.43.0-tm-v0.34.35
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7 h1:nxplQi8w
github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7/go.mod h1:1EF5MfOxVf0WC51Gb7pJ6bcZxnXKNAf9pqWtjgPBAYc=
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 h1:h1Y4V3EMQ2mFmNtWt2sIhZIuyASInj1a9ExI8xOsTOw=
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0/go.mod h1:x4DKyfKOSv1ZJM9NwV+Pw01kH2CD7N5zTFclXIVJ6GQ=
github.com/celestiaorg/celestia-core v1.42.0-tm-v0.34.35 h1:bWy5XOgeuuSLe0Lc/htL9/QLEURBjA1JTvEko6bEBhg=
github.com/celestiaorg/celestia-core v1.42.0-tm-v0.34.35/go.mod h1:/fK0n3ps09t5uErBQe1QZbrE81L81MNUzWpFyWQLDT0=
github.com/celestiaorg/celestia-core v1.43.0-tm-v0.34.35 h1:L4GTm+JUXhB0a/nGPMq6jEqqe6THuYSQ8m2kUCtZYqw=
github.com/celestiaorg/celestia-core v1.43.0-tm-v0.34.35/go.mod h1:bFr0lAGwaJ0mOHSBmib5/ca5pbBf1yKWGPs93Td0HPw=
github.com/celestiaorg/cosmos-sdk v1.25.0-sdk-v0.46.16 h1:f+fTe7GGk0/qgdzyqB8kk8EcDf9d6MC22khBTQiDXsU=
github.com/celestiaorg/cosmos-sdk v1.25.0-sdk-v0.46.16/go.mod h1:07Z8HJqS8Rw4XlZ+ok3D3NM/X/in8mvcGLvl0Zb5wrA=
github.com/celestiaorg/go-square v1.1.1 h1:Cy3p8WVspVcyOqHM8BWFuuYPwMitO1pYGe+ImILFZRA=
Expand Down
4 changes: 4 additions & 0 deletions local_devnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
container_name: core0
build:
context: ..
dockerfile: ./docker/Dockerfile
expose:
- "26660" # for prometheus
ports:
Expand All @@ -31,6 +32,7 @@ services:
container_name: core1
build:
context: ..
dockerfile: ./docker/Dockerfile
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved
expose:
- "26660" # for prometheus
depends_on:
Expand Down Expand Up @@ -59,6 +61,7 @@ services:
container_name: core2
build:
context: ..
dockerfile: ./docker/Dockerfile
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved
expose:
- "26660" # for prometheus
depends_on:
Expand Down Expand Up @@ -87,6 +90,7 @@ services:
container_name: core3
build:
context: ..
dockerfile: ./docker/Dockerfile
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved
expose:
- "26660" # for prometheus
depends_on:
Expand Down
2 changes: 0 additions & 2 deletions pkg/appconsts/consensus_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package appconsts
import "time"

const (
TimeoutPropose = time.Second * 10
TimeoutCommit = time.Second * 11
// GoalBlockTime is the target time interval between blocks. Since the block
// interval isn't enforced at consensus, the real block interval isn't
// guaranteed to exactly match GoalBlockTime. GoalBlockTime is currently targeted
Expand Down
19 changes: 0 additions & 19 deletions pkg/appconsts/global_consts.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package appconsts

import (
"strconv"

"github.com/celestiaorg/go-square/v2/share"
"github.com/celestiaorg/rsmt2d"
"github.com/tendermint/tendermint/pkg/consts"
Expand All @@ -26,11 +24,6 @@ const (

// BondDenom defines the native staking denomination
BondDenom = "utia"

// DefaultUpgradeHeightDelay is the number of blocks after a quorum has been
// reached that the chain should upgrade to the new version. Assuming a block
// interval of 12 seconds, this is 7 days.
DefaultUpgradeHeightDelay = int64(7 * 24 * 60 * 60 / 12) // 7 days * 24 hours * 60 minutes * 60 seconds / 12 seconds per block = 50,400 blocks.
)

var (
Expand All @@ -51,18 +44,6 @@ var (
SupportedShareVersions = share.SupportedShareVersions
)

// UpgradeHeightDelay returns the delay in blocks after a quorum has been reached that the chain should upgrade to the new version.
func UpgradeHeightDelay() int64 {
if OverrideUpgradeHeightDelayStr != "" {
parsedValue, err := strconv.ParseInt(OverrideUpgradeHeightDelayStr, 10, 64)
if err != nil {
panic("Invalid OverrideUpgradeHeightDelayStr value")
}
return parsedValue
}
return DefaultUpgradeHeightDelay
}

// HashLength returns the length of a hash in bytes.
func HashLength() int {
return hashLength
Expand Down
8 changes: 8 additions & 0 deletions pkg/appconsts/v1/app_consts.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package v1

import "time"

const (
Version uint64 = 1
SquareSizeUpperBound int = 128
SubtreeRootThreshold int = 64
TimeoutPropose = time.Second * 10
TimeoutCommit = time.Second * 11
// UpgradeHeightDelay is the number of blocks after a quorum has been
// reached that the chain should upgrade to the new version. Assuming a block
// interval of 12 seconds, this is 7 days.
UpgradeHeightDelay = int64(7 * 24 * 60 * 60 / 12) // 7 days * 24 hours * 60 minutes * 60 seconds / 12 seconds per block = 50,400 blocks.
)
8 changes: 8 additions & 0 deletions pkg/appconsts/v2/app_consts.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package v2

import "time"

const (
Version uint64 = 2
SquareSizeUpperBound int = 128
SubtreeRootThreshold int = 64
TimeoutPropose = time.Second * 10
TimeoutCommit = time.Second * 11
// UpgradeHeightDelay is the number of blocks after a quorum has been
// reached that the chain should upgrade to the new version. Assuming a block
// interval of 12 seconds, this is 7 days.
UpgradeHeightDelay = int64(7 * 24 * 60 * 60 / 12) // 7 days * 24 hours * 60 minutes * 60 seconds / 12 seconds per block = 50,400 blocks.
)
8 changes: 8 additions & 0 deletions pkg/appconsts/v3/app_consts.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
package v3

import "time"

const (
Version uint64 = 3
SquareSizeUpperBound int = 128
SubtreeRootThreshold int = 64
TxSizeCostPerByte uint64 = 10
GasPerBlobByte uint32 = 8
MaxTxSize int = 2097152 // 2 MiB in bytes
TimeoutPropose = time.Millisecond * 3500
TimeoutCommit = time.Millisecond * 4200
// UpgradeHeightDelay is the number of blocks after a quorum has been
// reached that the chain should upgrade to the new version. Assuming a block
// interval of 12 seconds, this is 7 days.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// interval of 12 seconds, this is 7 days.
// interval of 6 seconds, this is 7 days.

UpgradeHeightDelay = int64(7 * 24 * 60 * 60 / 6) // 7 days * 24 hours * 60 minutes * 60 seconds / 6 seconds per block = 100,800 blocks.
)
45 changes: 45 additions & 0 deletions pkg/appconsts/versioned_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package appconsts

import (
"strconv"
"time"

v1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1"
v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2"
v3 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v3"
)

Expand Down Expand Up @@ -52,3 +55,45 @@ var (
DefaultTxSizeCostPerByte = TxSizeCostPerByte(LatestVersion)
DefaultGasPerBlobByte = GasPerBlobByte(LatestVersion)
)

func GetTimeoutPropose(v uint64) time.Duration {
switch v {
case v1.Version:
return v1.TimeoutPropose
case v2.Version:
return v2.TimeoutPropose
default:
return v3.TimeoutPropose
}
}

func GetTimeoutCommit(v uint64) time.Duration {
switch v {
case v1.Version:
return v1.TimeoutCommit
case v2.Version:
return v2.TimeoutCommit
default:
return v3.TimeoutCommit
}
}

// UpgradeHeightDelay returns the delay in blocks after a quorum has been reached that the chain should upgrade to the new version.
func UpgradeHeightDelay(v uint64) int64 {
if OverrideUpgradeHeightDelayStr != "" {
parsedValue, err := strconv.ParseInt(OverrideUpgradeHeightDelayStr, 10, 64)
if err != nil {
panic("Invalid OverrideUpgradeHeightDelayStr value")
}
return parsedValue
}
switch v {
case v1.Version:
return v1.UpgradeHeightDelay
case v2.Version:
return v2.UpgradeHeightDelay
default:
return v3.UpgradeHeightDelay

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change

}
}
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion test/e2e/benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type BenchmarkTest struct {
manifest *Manifest
}

// NewBenchmarkTest wraps around testnet.New to create a new benchmark test.
// It may modify genesis consensus parameters based on manifest.
func NewBenchmarkTest(name string, manifest *Manifest) (*BenchmarkTest, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down Expand Up @@ -52,7 +54,7 @@ func NewBenchmarkTest(name string, manifest *Manifest) (*BenchmarkTest, error) {
}

// SetupNodes creates genesis nodes and tx clients based on the manifest.
// There will be manifest.Validators validators and manifest.TxClients tx clients.
// There will be manifest.Validators many validators and manifest.TxClients many tx clients.
// Each tx client connects to one validator. If TxClients are fewer than Validators, some validators will not have a tx client.
func (b *BenchmarkTest) SetupNodes() error {
ctx := context.Background()
Expand Down
Loading
Loading