fix: some fixes and refactoring for stabilizing same-block execution#451
Conversation
…execution-stabilizing
…execution-stabilizing
|
|
||
| target.NextValidatorsHash = candidate.NextValidators.Hash() | ||
| if candidate.NextValidators != nil { | ||
| target.NextValidatorsHash = candidate.NextValidators.Hash() |
There was a problem hiding this comment.
The idea here was that all fields of Candidate contain final values and already apply reasonable defaults.
It means this if should be handled somehow in populateValsetUpdates.
Maybe the issue is that populateValsetUpdates() was not called at all? Otherwise NextValidators should be derived from current state.
internal/consensus/reactor_test.go
Outdated
| count int, | ||
| ) (*quorumData, error) { | ||
| switch operation { | ||
| case "add": |
…node has proposal block for the height
Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com>
…' into same-block-execution-stabilizing
…execution-stabilizing
shotonoff
left a comment
There was a problem hiding this comment.
feedback work done
abci/example/kvstore/kvstore_test.go
Outdated
|
|
||
| kvVals, err = kvstore.ValidatorSet() | ||
| require.Equal(t, initVals.QuorumHash, resp.ValidatorSetUpdate.QuorumHash) | ||
| _, err = kvstore.FinalizeBlock(ctx, &types.RequestFinalizeBlock{Height: 1, AppHash: resp.AppHash}) |
There was a problem hiding this comment.
I didn't use makeApplyBlock because of I need a process proposal response to check a quorum-hash.
I a bit refactored makeApplyBlock to return responses of process-proposal and finalize-block
internal/consensus/replay_test.go
Outdated
| cfg: cfg, | ||
| nPeers: nPeers, | ||
| nVals: nVals, | ||
| testName: "replay_test", |
There was a problem hiding this comment.
I removed testName field, instead I use t.Name() inside generate method
| logger: logger.With("module", "kvstore"), | ||
| lastCommittedState: loadState(db), | ||
| roundStates: map[string]State{}, | ||
| validatorSetUpdates: make(map[int64]types.ValidatorSetUpdate), |
There was a problem hiding this comment.
as I see storing validator-set-updates in memory is enough to pass tests (so far), let's postpone it until it will be necessary, wdyt?
| target.LastResultsHash = candidate.ResultsHash | ||
|
|
||
| target.ConsensusParams = candidate.NextConsensusParams | ||
| if !candidate.NextConsensusParams.IsZero() { |
There was a problem hiding this comment.
good thoughts for investigation
| status := ResponseVerifyVoteExtension_REJECT | ||
| if ok { | ||
| status = ResponseVerifyVoteExtension_ACCEPT | ||
| func (m *ValidatorSetUpdate) MarshalJSON() ([]byte, error) { |
There was a problem hiding this comment.
Maybe for m==nil, we should return json.Marshal(nil) ?
There was a problem hiding this comment.
not necessary, if a pointer is nill then a result of marshalling will be nil as well
There was a problem hiding this comment.
got "marshaling error: json: error calling MarshalJSON for type *types.ValidatorSetUpdate: fromproto: key is nil"
| NodeAddress string `json:"node_address"` | ||
| } | ||
|
|
||
| func (m *ValidatorUpdate) MarshalJSON() ([]byte, error) { |
There was a problem hiding this comment.
Maybe for m==nil, we should return json.Marshal(nil) ?
internal/consensus/helper_test.go
Outdated
| func (g *nodeGen) initApp(ctx context.Context, t *testing.T) { | ||
| if g.app == nil { | ||
| g.app = kvstore.NewApplication() | ||
| g.app = kvstore.NewApplication(kvstore.WithLogger(log.NewNopLogger())) |
There was a problem hiding this comment.
NewNopLogger should be a default value, no need to use WithLogger in this case.
And, I think it should be NewTestLogger()
Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com>
* refactor: decouple dash parameters from a MakeBlock function to a Block.SetDashParams method * feat: add node's pro-rtx-hash into a context * feat: add proTxHash into context for consensus/reactor_test.go * feat: some modifications for PoC same-block execution * feat: change an updated struct from round state on uncommitted-state * feat: support next-validators as for next-block execution mode * feat: support next-validators for same-block execution mode * feat: some modifications for next-core-lock * chore: same block execution state/state_test.go (WIP) * test(state): fix TestManyValidatorChangesSaveLoad() * fix(state): panic on empty consensus params load * chore(state): remove state.NextValidators * chore(proto/abci): same block execution protobuf changes * refactor(types): centralize generation of ResultsHash * refactor(state): consolidate redundant code in block execution * chore(state) execution fix for new data structures * test(state): adapt TestProposerPriorityProposerAlternates for same block exec * test(state): same block exec TestFourAddFourMinusOneGenesisValidators * test(state): same block exec TestStoreLoadValidatorsIncrementsProposerPriority * test(state): same block exec for TestManyValidatorChangesSaveLoad * fix(state): same block exec TestConsensusParamsChangesSaveLoad * test(state): fix TestProcessProposal * chore(state): correct handling of ApplyBlock etc * test(mempool): builds but fails * refactor(state): UncommittedState now holds final values instead of updates This was needed for clean implementation of NextValidatorsHash * refactor(state): rename UncommittedChanges to Changeset * chore: same block exec - block * chore(state): state ID - start of work * chore: SBE - block fields (WIP) * chore: SBE chainlocks and proposed app version (WIP) * test(state): SBE green (execution|state|validation)_test * chore(abci): improve validation of prepare/process proposal responses * chore(state): apphash defaults to array containing zeros * test(state): TestStoreLoadValidators fixed for SBE * chore(state): AppHash defaults to slice of 0s instead of nil * chore(state): fix invalid state.LastStateID * test(state): SBE TestPruneStates * test(state): fix rollback_test * fix(abci): correct handling of AppHash in Application * test(store): update for SBE * chore(types): rename stateID.LastAppHash to AppHash * refactor(statesync): state provider returns AppHash as HexBytes * test(statesync): fix for SBE * test(consensus): show test logs on console * test(consensus): fix byzantine test * test(blocksync): update for SBE * fix(state): events fired twice * fix(consensus): proposal contains invalid chainlock height * test(consensus): correct chainlock in initial block in SBE * Update abci/example/kvstore/kvstore.go Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com> * Update abci/example/kvstore/kvstore.go Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com> * fix(state): double commits during replay * test(consensus): fix replay handshake* tests (WIP) * fix: evidence package * fix: validator_conn_executor_test.go * refactor: executing kvstore * feat!(kvstore): same-block-execution KV store (#447) * feat!(kvstore): same-block-execution KV store * fix(kvstore): dstIter not closed correctly * fix(kvstore): AppHash at genesis should be zero * fix(kvstore): SBE support for persistent KV store (#452) * test(proxy): fix test of Info() * fix: some fixes and refactoring for stabilizing same-block execution (#451) * fix: some fixes and refactoring for stabilizing same-block execution * refactor: merge kvstore.App with kvstore.Application and remove kvstore_v2.go * fix: kvstore_test.go * fix: TestValUpdates * fix: TestValUpdates * fix: TestKVStore * fix: rpc/client tests * fix: make stable some tests affected by kvstore refactoring * fix: update uncommitted state if a validator out of quorum set and a node has proposal block for the height * Update internal/consensus/replay_test.go Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com> * refactor: changes according to PR feedback * fix: blocking wal_test.go because of default context * fix: code style issues * fix: abci-cli test * fix: typo in struct name CurentRoundState => CurrentRoundState * fix: a few data race issues * fix: TestHandshakeReplayNone * fix: ValidatorUpdate.MarshalJSON * fix: ValidatorUpdate.UnmarshalJSON * chore(e2e): prototype e2e test app for same-block execution * fix(consensus): state is nil on genesis * fix(state): invalid stateID height on genesis * chore: improve logging * Update abci/tests/server/client.go Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com> * Update abci/tests/server/client.go Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com> * Update internal/proxy/client_test.go Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com> * refactor: changes according to PR feedback Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com> * fix: stabilize codebase after merge / resolve conflicts Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Issue being fixed or feature implemented
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
For repository code-owners and collaborators only