-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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] parity warp-like state sync #3594
Conversation
app: app, | ||
config: config, | ||
pool: pool, | ||
stateSync: config.StateSync, |
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.
config.StateSync undefined (type *config.Config has no field or method StateSync) (from typecheck
)
} | ||
|
||
func (mgr *SnapshotManager) restoreBlock(block *types.Block, seenCommit *types.Commit) { | ||
mgr.blockStore.SetHeight(block.Height - 1) |
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.
mgr.blockStore.SetHeight undefined (type *blockchain.BlockStore has no field or method SetHeight) (from typecheck
)
} | ||
|
||
func (mgr *SnapshotManager) snapshotTMState() error { | ||
if state := sm.LoadStateForHeight(mgr.stateDB, mgr.height); state != nil { |
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.
LoadStateForHeight not declared by package state (from typecheck
)
node/node.go
Outdated
@@ -351,6 +354,26 @@ func NewNode(config *cfg.Config, | |||
evidenceReactor := evidence.NewEvidenceReactor(evidencePool) | |||
evidenceReactor.SetLogger(evidenceLogger) | |||
|
|||
if state.Validators.Size() == 1 { | |||
addr, _ := state.Validators.GetByIndex(0) | |||
if bytes.Equal(privValidator.GetAddress(), addr) { |
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.
privValidator.GetAddress undefined (type types.PrivValidator has no field or method GetAddress) (from typecheck
)
if state.Validators.Size() == 1 { | ||
addr, _ := state.Validators.GetByIndex(0) | ||
if bytes.Equal(privValidator.GetAddress(), addr) { | ||
config.StateSync = false |
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.
config.StateSync undefined (type *config.Config has no field or method StateSync) (from typecheck
)
// numPending=0 total=0 outbound=1 inbound=0 height=6601 blocksSynced=0 poolHeight=6601 poolstarttime=2019-02-22T09:02:07.881888662Z poolMaxPeerHeight=6437 poolHeight=6601 | ||
// we need make sure blockstore has a block because when switch to consensus, it will verify the commit between block and state | ||
// refer to `cs.blockStore.LoadSeenCommit(state.LastBlockHeight)` | ||
if bcR.pool.IsCaughtUp() && (height == bcR.pool.initHeight || blocksSynced > 0) { |
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.
bcR.pool.initHeight undefined (type *BlockPool has no field or method initHeight) (from typecheck
)
if state != nil { | ||
bcR.initialState = *state | ||
bcR.pool.height = state.LastBlockHeight + 1 | ||
bcR.store.SetHeight(state.LastBlockHeight) |
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.
bcR.store.SetHeight undefined (type *BlockStore has no field or method SetHeight) (from typecheck
)
StateSyncChannel = byte(0x35) | ||
|
||
// ====== move to config ====== | ||
stateSyncPriority = 10 // channel priority of state sync |
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.
File is not gofmt
-ed with -s
(from gofmt
)
@@ -37,6 +37,7 @@ import ( | |||
grpccore "github.com/tendermint/tendermint/rpc/grpc" | |||
rpcserver "github.com/tendermint/tendermint/rpc/lib/server" | |||
sm "github.com/tendermint/tendermint/state" | |||
"github.com/tendermint/tendermint/snapshot" |
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.
File is not gofmt
-ed with -s
(from gofmt
)
"crypto/sha256" | ||
"errors" | ||
"fmt" | ||
"github.com/golang/snappy" |
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.
File is not goimports
-ed (from goimports
)
ad416ca
to
1eb5484
Compare
|
||
func (mgr *SnapshotManager) snapshotTMState() error { | ||
if state := sm.LoadStateForHeight(mgr.stateDB, mgr.height); state != nil { | ||
stateChunk := &abci.StateChunk{ |
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.
composites: github.com/tendermint/tendermint/abci/types.StateChunk
composite literal uses unkeyed fields (from govet
)
return fmt.Errorf("block %d to be snapshoted is not expected %d", block.Height, mgr.height) | ||
} | ||
seenCommit := mgr.blockStore.LoadSeenCommit(mgr.height) | ||
blockChunk := &abci.BlockChunk{ |
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.
composites: github.com/tendermint/tendermint/abci/types.BlockChunk
composite literal uses unkeyed fields (from govet
)
snapshot/pool.go
Outdated
if manifest.Version == abci.ManifestVersion { | ||
return hash, &manifest, nil | ||
} else { | ||
return hash, nil, fmt.Errorf("snapshot manifest version mismatch", "expected", abci.ManifestVersion, "actual", manifest.Version) |
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.
printf: Errorf call has arguments but no formatting directives (from govet
)
const latestStateToKeep int64 = 1 << 20 | ||
|
||
func calcStateKey(height int64) []byte { | ||
return []byte(fmt.Sprintf("stateKey:%v", height % latestStateToKeep)) |
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.
File is not gofmt
-ed with -s
(from gofmt
)
1eb5484
to
ddf0316
Compare
mtx sync.Mutex | ||
manifest *abci.Manifest | ||
manifestHash abci.SHA256Sum | ||
dummyHash abci.SHA256Sum |
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.
File is not gofmt
-ed with -s
(from gofmt
)
ecd10ba
to
ffa7978
Compare
) | ||
|
||
const ( | ||
ManifestVersion int32 = 0 |
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.
File is not gofmt
-ed with -s
(from gofmt
)
ffa7978
to
1e649bf
Compare
1e649bf
to
40771ea
Compare
It's my honor. But I still prefer to open this PR for people's reference. If you think this PR is kind of broken, I can rebase the latest develop branch. Or you would like to accept PR until discussion in #3769 reaches a conclusion? |
follow up of #3243
A new state sync proposal: https://docs.google.com/document/d/1npGTAa1qxe8EQZ1wG0a0Sip9t5oX2vYZNUDwr_LVRR4/edit?usp=sharing