mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 04:55:18 +00:00
* -----start------
* [cherrypicked] state: panic on ResponsePrepareProposal validation error (#8145)
* state: panic on ResponsePrepareProposal validation error
* lint++
Co-authored-by: Sam Kleinman <garen@tychoish.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* [cherrypicked] abci++: remove CheckTx call from PrepareProposal flow (#8176)
* [cherrypicked] abci++: correct max-size check to only operate on added and unmodified (#8242)
* [cherrypicked] Remove `ModifiedTxStatus` from the spec and the code (#8210)
* Outstanding abci-gen changes to 'pb.go' files
* Removed modified_tx_status from spec and protobufs
* Fix sed for OSX
* Regenerated abci protobufs with 'abci-proto-gen'
* Code changes. UTs e2e tests passing
* Recovered UT: TestPrepareProposalModifiedTxStatusFalse
* Adapted UT
* Fixed UT
* Revert "Fix sed for OSX"
This reverts commit e576708c61.
* Update internal/state/execution_test.go
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
* Update abci/example/kvstore/kvstore.go
Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
* Update internal/state/execution_test.go
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
* Update spec/abci++/abci++_tmint_expected_behavior_002_draft.md
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
* Addressed some comments
* Added one test that tests error at the ABCI client + Fixed some mock calls
* Addressed remaining comments
* Update abci/example/kvstore/kvstore.go
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
* Update abci/example/kvstore/kvstore.go
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
* Update abci/example/kvstore/kvstore.go
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
* Update spec/abci++/abci++_tmint_expected_behavior_002_draft.md
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
* Addressed William's latest comments
* Adressed Michael's comment
* Fixed UT
* Some md fixes
* More md fixes
* gofmt
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
* make proto-gen
* Fixed testcase on PrepareProposal error
* mockery
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
Co-authored-by: Sam Kleinman <garen@tychoish.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
76 lines
1.7 KiB
Go
76 lines
1.7 KiB
Go
package factory
|
|
|
|
import (
|
|
"time"
|
|
|
|
sm "github.com/tendermint/tendermint/state"
|
|
"github.com/tendermint/tendermint/test/factory"
|
|
"github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
func MakeBlocks(n int, state *sm.State, privVal types.PrivValidator) ([]*types.Block, error) {
|
|
blocks := make([]*types.Block, n)
|
|
|
|
var (
|
|
prevBlock *types.Block
|
|
prevBlockMeta *types.BlockMeta
|
|
)
|
|
|
|
appHeight := byte(0x01)
|
|
for i := 0; i < n; i++ {
|
|
height := int64(i + 1)
|
|
|
|
block, parts, err := makeBlockAndPartSet(*state, prevBlock, prevBlockMeta, privVal, height)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
blocks[i] = block
|
|
|
|
prevBlock = block
|
|
prevBlockMeta = types.NewBlockMeta(block, parts)
|
|
|
|
// update state
|
|
state.AppHash = []byte{appHeight}
|
|
appHeight++
|
|
state.LastBlockHeight = height
|
|
}
|
|
|
|
return blocks, nil
|
|
}
|
|
|
|
func MakeBlock(state sm.State, height int64, c *types.Commit) *types.Block {
|
|
return state.MakeBlock(
|
|
height,
|
|
factory.MakeNTxs(state.LastBlockHeight, 10),
|
|
c,
|
|
nil,
|
|
state.Validators.GetProposer().Address,
|
|
)
|
|
}
|
|
|
|
func makeBlockAndPartSet(
|
|
state sm.State,
|
|
lastBlock *types.Block,
|
|
lastBlockMeta *types.BlockMeta,
|
|
privVal types.PrivValidator,
|
|
height int64,
|
|
) (*types.Block, *types.PartSet, error) {
|
|
lastCommit := types.NewCommit(height-1, 0, types.BlockID{}, nil)
|
|
if height > 1 {
|
|
vote, _ := types.MakeVote(
|
|
lastBlock.Header.Height,
|
|
lastBlockMeta.BlockID,
|
|
state.Validators,
|
|
privVal,
|
|
lastBlock.Header.ChainID,
|
|
time.Now())
|
|
lastCommit = types.NewCommit(vote.Height, vote.Round,
|
|
lastBlockMeta.BlockID, []types.CommitSig{vote.CommitSig()})
|
|
}
|
|
|
|
block := state.MakeBlock(height, []types.Tx{}, lastCommit, nil, state.Validators.GetProposer().Address)
|
|
partSet, err := block.MakePartSet(types.BlockPartSizeBytes)
|
|
return block, partSet, err
|
|
}
|