Skip to content

Commit

Permalink
Add in-place-testnet command (#561)
Browse files Browse the repository at this point in the history
## Describe your changes and provide context
(sei-chain PR: sei-protocol/sei-chain#2063)
To use:
1. modify `~/.sei/config/config.toml`: change `mode` to `validator` and
turn off statesync
2. run `seid in-place-testnet <some new chain id name e.g. localsei>
## Testing performed to validate your change
  • Loading branch information
codchen authored Jan 31, 2025
1 parent faf3ee3 commit 9fa6181
Show file tree
Hide file tree
Showing 10 changed files with 413 additions and 12 deletions.
22 changes: 14 additions & 8 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"sync"
"time"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
Expand Down Expand Up @@ -87,14 +88,15 @@ type BaseApp struct { //nolint: maligned
interfaceRegistry types.InterfaceRegistry
txDecoder sdk.TxDecoder // unmarshal []byte into sdk.Tx

anteDepGenerator sdk.AnteDepGenerator // ante dep generator for parallelization
prepareProposalHandler sdk.PrepareProposalHandler
processProposalHandler sdk.ProcessProposalHandler
finalizeBlocker sdk.FinalizeBlocker
anteHandler sdk.AnteHandler // ante handler for fee and auth
loadVersionHandler sdk.LoadVersionHandler
preCommitHandler sdk.PreCommitHandler
closeHandler sdk.CloseHandler
anteDepGenerator sdk.AnteDepGenerator // ante dep generator for parallelization
prepareProposalHandler sdk.PrepareProposalHandler
processProposalHandler sdk.ProcessProposalHandler
finalizeBlocker sdk.FinalizeBlocker
anteHandler sdk.AnteHandler // ante handler for fee and auth
loadVersionHandler sdk.LoadVersionHandler
preCommitHandler sdk.PreCommitHandler
closeHandler sdk.CloseHandler
inplaceTestnetInitializer sdk.InplaceTestnetInitializer

appStore
baseappVersions
Expand Down Expand Up @@ -1251,3 +1253,7 @@ func (app *BaseApp) GetCheckCtx() sdk.Context {
func (app *BaseApp) RegisterDeliverTxHook(hook DeliverTxHook) {
app.deliverTxHooks = append(app.deliverTxHooks, hook)
}

func (app *BaseApp) InplaceTestnetInitialize(pk cryptotypes.PubKey) {
app.inplaceTestnetInitializer(pk)
}
8 changes: 8 additions & 0 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@ func (app *BaseApp) SetLoadVersionHandler(loadVersionHandler sdk.LoadVersionHand
app.loadVersionHandler = loadVersionHandler
}

func (app *BaseApp) SetInplaceTestnetInitializer(inplaceTestnetInitializer sdk.InplaceTestnetInitializer) {
if app.sealed {
panic("SetInplaceTestnetInitializer() on sealed BaseApp")
}

app.inplaceTestnetInitializer = inplaceTestnetInitializer
}

func (app *BaseApp) SetAnteHandler(ah sdk.AnteHandler) {
if app.sealed {
panic("SetAnteHandler() on sealed BaseApp")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ replace (
github.com/sei-protocol/sei-db => github.com/sei-protocol/sei-db v0.0.46
// Latest goleveldb is broken, we have to stick to this version
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.4.5
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.4.7
// latest grpc doesn't work with with our modified proto compiler, so we need to enforce
// the following version across all dependencies.
google.golang.org/grpc => google.golang.org/grpc v1.33.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,8 @@ github.com/sei-protocol/sei-db v0.0.46 h1:naXfSp1I3UgJJm/iSvXpdFzr9nofEOxp/EekcA
github.com/sei-protocol/sei-db v0.0.46/go.mod h1:m5g7p0QeAS3dNJHIl28zQpzOgxQmvYqPb7t4hwgIOCA=
github.com/sei-protocol/sei-iavl v0.1.9 h1:y4mVYftxLNRs6533zl7N0/Ch+CzRQc04JDfHolIxgBE=
github.com/sei-protocol/sei-iavl v0.1.9/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk=
github.com/sei-protocol/sei-tendermint v0.4.5 h1:vdibojcaBb+OCNeoGmU8daL41U+Sc7AHCBkDqSS7knQ=
github.com/sei-protocol/sei-tendermint v0.4.5/go.mod h1:4LSlJdhl3nf3OmohliwRNUFLOB1XWlrmSodrIP7fLh4=
github.com/sei-protocol/sei-tendermint v0.4.7 h1:mQ9tnZE240a0lE+8CYDqbIfBEv13ud5vJMs0EV4FVLw=
github.com/sei-protocol/sei-tendermint v0.4.7/go.mod h1:4LSlJdhl3nf3OmohliwRNUFLOB1XWlrmSodrIP7fLh4=
github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY=
github.com/sei-protocol/sei-tm-db v0.0.5/go.mod h1:Cpa6rGyczgthq7/0pI31jys2Fw0Nfrc+/jKdP1prVqY=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
Expand Down
Loading

0 comments on commit 9fa6181

Please sign in to comment.