-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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(server): in-place testnet creator #19280
Changes from 1 commit
6518cc1
684ca39
37e66ae
cc49b1f
b295d92
a9f0a01
f0bcce0
087a29f
bad2345
56f6542
4e191a1
ec35474
7d0e17e
66355b3
25bee82
0c0b744
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -597,7 +597,7 @@ | |
} | ||
|
||
if isTestnet, ok := svrCtx.Viper.Get(KeyIsTestnet).(bool); ok && isTestnet { | ||
app, err = testnetify(svrCtx, home, appCreator, db) | ||
app, err = testnetify(svrCtx, home, appCreator, db, traceWriter) | ||
if err != nil { | ||
return app, traceCleanupFn, err | ||
} | ||
|
@@ -633,8 +633,8 @@ | |
|
||
Additionally, the first block may take up to one minute to be committed, depending | ||
on how old the block is. For instance, if a snapshot was taken weeks ago and we want | ||
to turn this into a testnet, it is possible lots of pending state needs to be commited | ||
Check failure on line 636 in server/start.go GitHub Actions / golangci-lint
|
||
(expiring locks, etc.). It is recommended that you should wait for this block to be commited | ||
Check failure on line 637 in server/start.go GitHub Actions / golangci-lint
|
||
before stopping the daemon. | ||
`, | ||
Example: "in-place-testnet localosmosis osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj", | ||
|
@@ -665,7 +665,7 @@ | |
text, _ := reader.ReadString('\n') | ||
response := strings.TrimSpace(strings.ToLower(text)) | ||
if response != "y" && response != "yes" { | ||
fmt.Println("Operation cancelled.") | ||
Check failure on line 668 in server/start.go GitHub Actions / golangci-lint
|
||
return nil | ||
} | ||
|
||
|
@@ -697,20 +697,14 @@ | |
|
||
// testnetify modifies both state and blockStore, allowing the provided operator address and local validator key to control the network | ||
// that the state in the data folder represents. The chainID of the local genesis file is modified to match the provided chainID. | ||
func testnetify(ctx *Context, home string, testnetAppCreator types.AppCreator, db dbm.DB) (types.Application, error) { | ||
func testnetify(ctx *Context, home string, testnetAppCreator types.AppCreator, db dbm.DB, traceWriter io.WriteCloser) (types.Application, error) { | ||
config := ctx.Config | ||
|
||
newChainID, ok := ctx.Viper.Get(KeyNewChainID).(string) | ||
if !ok { | ||
return nil, fmt.Errorf("expected string for key %s", KeyNewChainID) | ||
} | ||
|
||
traceWriterFile := ctx.Viper.GetString(flagTraceStore) | ||
traceWriter, err := openTraceWriter(traceWriterFile) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
genDocProvider := node.DefaultGenesisDocProviderFunc(config) | ||
|
||
// Initialize blockStore and stateDB. | ||
|
@@ -758,7 +752,7 @@ | |
} | ||
|
||
// There are times when a user stops their node between commits, resulting in a mismatch between the | ||
// blockStore and state. For convenience, we just discard the uncommited blockStore block and operate on | ||
Check failure on line 755 in server/start.go GitHub Actions / golangci-lint
|
||
// the lastBlockHeight in state. | ||
if blockStore.Height() != state.LastBlockHeight { | ||
err = blockStore.DeleteLatestBlock() | ||
|
@@ -781,7 +775,7 @@ | |
Height: state.LastBlockHeight, | ||
Round: 0, | ||
BlockID: state.LastBlockID, | ||
Timestamp: time.Now(), | ||
|
||
ValidatorAddress: validatorAddress, | ||
ValidatorIndex: 0, | ||
Signature: []byte{}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what is the relationship between the
start
command, which checksKeyIsTestnet
, and the new testnet command?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The testnet command and the start command are essentially identical except:
I am not sure if this answers your question, please lmk if you wanted clarification on something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not sure this needs to exist. I may be missing something but this tool should only modify the underlying db.