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

WIP: overrides the timeout_commit and timeout_propose in v3 #3882

Draft
wants to merge 73 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 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
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
13 changes: 11 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
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)
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)

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)
return res
}

Expand Down Expand Up @@ -798,6 +806,7 @@ func (app *App) InitializeAppVersion(ctx sdk.Context) {

// OfferSnapshot is a wrapper around the baseapp's OfferSnapshot method. It is
// needed to mount stores for the appropriate app version.
// TODO [Q]: How about taking care of v3 version in this call?
func (app *App) OfferSnapshot(req abci.RequestOfferSnapshot) abci.ResponseOfferSnapshot {
if app.IsSealed() {
// If the app is sealed, keys have already been mounted so this can
Expand Down
4 changes: 2 additions & 2 deletions app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ func DefaultConsensusConfig() *tmcfg.Config {
cfg.Mempool.MaxTxsBytes = int64(upperBoundBytes) * cfg.Mempool.TTLNumBlocks
Copy link
Member

Choose a reason for hiding this comment

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

Should line 146 have this?

	// time. The expected block time is 6 seconds, therefore this value is 30

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
1 change: 0 additions & 1 deletion app/test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ func (s *IntegrationTestSuite) TestMaxBlockSize() {
require.NoError(t, s.cctx.WaitForNextBlock())
}
}

func (s *IntegrationTestSuite) TestUnwrappedPFBRejection() {
t := s.T()

Expand Down
92 changes: 92 additions & 0 deletions app/test/timeouts_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package app_test

import (
"testing"
"time"

"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
"github.com/celestiaorg/celestia-app/v3/test/util/testfactory"
"github.com/celestiaorg/celestia-app/v3/test/util/testnode"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/stretchr/testify/suite"

"github.com/celestiaorg/celestia-app/v3/app"
"github.com/celestiaorg/celestia-app/v3/app/encoding"
"github.com/celestiaorg/celestia-app/v3/pkg/user"
)

func TestTimeoutTestSuite(t *testing.T) {
if testing.Short() {
t.Skip("skipping app/test/timeouts_test in short mode.")
}
suite.Run(t, &TimeoutTestSuite{})
}

type TimeoutTestSuite struct {
suite.Suite

ecfg encoding.Config
accounts []string
cctx testnode.Context
}

const (
timeoutPropose = 7 * time.Second
timeoutCommit = 8 * time.Second
)

func (s *TimeoutTestSuite) SetupSuite() {
t := s.T()
s.accounts = testnode.RandomAccounts(142)

cfg := testnode.DefaultConfig().WithFundedAccounts(s.accounts...)
cfg.TmConfig.Consensus.TimeoutPropose = timeoutPropose
cfg.TmConfig.Consensus.TimeoutCommit = timeoutCommit

cctx, _, _ := testnode.NewNetwork(t, cfg)

s.cctx = cctx
s.ecfg = encoding.MakeConfig(app.ModuleEncodingRegisters...)

require.NoError(t, cctx.WaitForNextBlock())

for _, acc := range s.accounts {
addr := testfactory.GetAddress(s.cctx.Keyring, acc)
_, _, err := user.QueryAccount(s.cctx.GoContext(), s.cctx.GRPCClient, s.cctx.InterfaceRegistry, addr)
require.NoError(t, err)
}
}

// TestConfigTimeoutsOverride verifies that the timeouts specified in the
// configs are not used,
// and instead the timeouts are overridden by the ABCI InitChain response
// depending on the genesis app version.
func (s *TimeoutTestSuite) TestConfigTimeoutsOverride() {
t := s.T()

require.NoError(t, s.cctx.WaitForBlocks(1))

tmNode := s.cctx.GetTMNode()
configTimeoutPropose := tmNode.Config().Consensus.TimeoutPropose.Seconds()
configTimeoutCommit := tmNode.Config().Consensus.TimeoutCommit.Seconds()

// double-check the config timeouts are the same as the ones we set
assert.Equal(t, timeoutPropose.Seconds(), configTimeoutPropose)
assert.Equal(t, timeoutCommit.Seconds(), configTimeoutCommit)

// read the timeouts from the state at height 1 i.e.,
//the state after applying the genesis file

Check failure on line 80 in app/test/timeouts_test.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

commentFormatting: put a space between `//` and comment text (gocritic)
state1, err := s.cctx.GetTMNode().ConsensusStateTimeoutsByHeight(1)
require.NoError(t, err)

// state timeouts should NOT match the timeouts of the config
assert.True(t, configTimeoutPropose != state1.TimeoutPropose.Seconds())
assert.True(t, configTimeoutCommit != state1.TimeoutCommit.Seconds())

// state timeouts should match the timeouts of the latest version of the app
assert.Equal(t, appconsts.GetTimeoutCommit(appconsts.LatestVersion), state1.TimeoutCommit)
assert.Equal(t, appconsts.GetTimeoutPropose(appconsts.LatestVersion), state1.TimeoutPropose)

}
27 changes: 23 additions & 4 deletions app/test/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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 @@ -99,17 +103,21 @@ func TestAppUpgradeV3(t *testing.T) {
// brace yourselfs, this part may take a while
initialHeight := int64(4)
for height := initialHeight; height < initialHeight+appconsts.DefaultUpgradeHeightDelay; 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,
})

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 Down Expand Up @@ -139,7 +147,11 @@ 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.DefaultUpgradeHeightDelay})
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 +283,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 +301,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: 2 additions & 0 deletions cmd/celestia-appd/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ is performed. Note, when enabled, gRPC will also be automatically enabled.
}

serverCtx := server.GetServerContextFromCmd(cmd)
serverCtx.Logger.Info("starting node with timeout_propose: ",
serverCtx.Config.Consensus.TimeoutPropose.Seconds())
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,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.42.0-tm-v0.34.35.0.20241009184011-66f3f21155f4
)
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.42.0-tm-v0.34.35.0.20241009184011-66f3f21155f4 h1:8dLww6fU7CQqV0GNoiqakidhYk5kEpdHqE7MOYEHcJ8=
github.com/celestiaorg/celestia-core v1.42.0-tm-v0.34.35.0.20241009184011-66f3f21155f4/go.mod h1:/fK0n3ps09t5uErBQe1QZbrE81L81MNUzWpFyWQLDT0=
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
2 changes: 1 addition & 1 deletion pkg/appconsts/global_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
// 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.
DefaultUpgradeHeightDelay = 3 // int64( 7 * 24 * 60 * 60 / 12) // 7 days * 24 hours * 60 minutes * 60 seconds / 12 seconds per block = 50,400 blocks.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
DefaultUpgradeHeightDelay = 3 // int64( 7 * 24 * 60 * 60 / 12) // 7 days * 24 hours * 60 minutes * 60 seconds / 12 seconds per block = 50,400 blocks.
DefaultUpgradeHeightDelay = 3 // int64( 7 * 24 * 60 * 60 / 6) // 7 days * 24 hours * 60 minutes * 60 seconds / 6 seconds per block = 100,800 blocks.

)

var (
Expand Down
4 changes: 4 additions & 0 deletions pkg/appconsts/v3/app_consts.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package v3

import "time"

const (
Version uint64 = 3
SquareSizeUpperBound int = 128
SubtreeRootThreshold int = 64
TxSizeCostPerByte uint64 = 10
GasPerBlobByte uint32 = 8
TimeoutPropose = time.Second * 3
TimeoutCommit = time.Second * 1
)
19 changes: 19 additions & 0 deletions pkg/appconsts/versioned_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package appconsts

import (
"strconv"
"time"

v3 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v3"
)
Expand Down Expand Up @@ -48,3 +49,21 @@ var (
DefaultTxSizeCostPerByte = TxSizeCostPerByte(LatestVersion)
DefaultGasPerBlobByte = GasPerBlobByte(LatestVersion)
)

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

func GetTimeoutCommit(v uint64) time.Duration {
switch v {
case v3.Version:
return v3.TimeoutCommit
default:
return TimeoutCommit
}
}
8 changes: 7 additions & 1 deletion scripts/single-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Stop script execution if an error is encountered
set -o errexit
# Stop script execution if an undefined variable is used
# Stop scyript execution if an undefined variable is used
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Stop scyript execution if an undefined variable is used
# Stop script execution if an undefined variable is used

set -o nounset

if ! [ -x "$(command -v celestia-appd)" ]
Expand Down Expand Up @@ -89,6 +89,12 @@ createGenesis() {
trace_push_batch_size=1000
sed -i.bak -e "s/^trace_push_batch_size *=.*/trace_push_batch_size = \"$trace_push_batch_size\"/" ${CELESTIA_APP_HOME}/config/config.toml

timeout_propose="100s"
sed -i.bak -e "s/^timeout_propose *=.*/timeout_propose = \"$timeout_propose\"/" ${CELESTIA_APP_HOME}/config/config.toml

timeout_commit="900s"
sed -i.bak -e "s/^timeout_commit *=.*/timeout_commit = \"$timeout_commit\"/" ${CELESTIA_APP_HOME}/config/config.toml

echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1${trace_pull_address}"
}

Expand Down
5 changes: 4 additions & 1 deletion test/e2e/benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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) {
// create a new testnet
testNet, err := testnet.New(context.Background(), name, seed,
Expand All @@ -28,12 +30,13 @@ func NewBenchmarkTest(name string, manifest *Manifest) (*BenchmarkTest, error) {
return nil, err
}

// modify the consensus parameters based on the manifest
testNet.SetConsensusParams(manifest.GetConsensusParams())
return &BenchmarkTest{Testnet: testNet, manifest: manifest}, nil
}

// 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
1 change: 1 addition & 0 deletions test/e2e/benchmark/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func main() {
{"LargeNetworkBigBlock8MB", LargeNetworkBigBlock8MB},
{"LargeNetworkBigBlock32MB", LargeNetworkBigBlock32MB},
{"LargeNetworkBigBlock64MB", LargeNetworkBigBlock64MB},
{"TwoNodeBigBlock8MBV3", TwoNodeBigBlock8MBV3},
}

// check the test name passed as an argument and run it
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/benchmark/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ type Manifest struct {
GovMaxSquareSize int64

DisableBBR bool

GenesisAppVersion uint64
}

func (m *Manifest) GetGenesisModifiers() []genesis.Modifier {
Expand All @@ -88,6 +90,7 @@ func (m *Manifest) GetGenesisModifiers() []genesis.Modifier {

blobParams := blobtypes.DefaultParams()
blobParams.GovMaxSquareSize = uint64(m.GovMaxSquareSize)

modifiers = append(modifiers, genesis.SetBlobParams(ecfg.Codec, blobParams))

return modifiers
Expand All @@ -96,6 +99,7 @@ func (m *Manifest) GetGenesisModifiers() []genesis.Modifier {
func (m *Manifest) GetConsensusParams() *tmproto.ConsensusParams {
cparams := app.DefaultConsensusParams()
cparams.Block.MaxBytes = m.MaxBlockBytes
cparams.Version.AppVersion = m.GenesisAppVersion
return cparams
}

Expand Down
Loading
Loading