Skip to content
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

Add the Data Availability Header to BlockID #312

Closed
wants to merge 108 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
31c996a
include DAH in block ID proto files, add QoL methods, and fix all ./t…
evan-forbes May 3, 2021
1522ee8
Merge branch 'master' into evan/add-dah-to-block-id
evan-forbes May 4, 2021
052bdbe
linter and bug
evan-forbes May 4, 2021
f9b9629
fix all evidence package bugs
evan-forbes May 4, 2021
760d371
don't use nil dah when creating a new blockchain reactor
evan-forbes May 4, 2021
e49a6ed
fix TestValidateBlockHeader
evan-forbes May 4, 2021
8243b27
fix TestLoadBaseMeta
evan-forbes May 4, 2021
8dd6964
fix TestLoadBlockMeta
evan-forbes May 4, 2021
24153f7
fix TestBlockFetchAtHeight
evan-forbes May 4, 2021
61969de
fix TestSignProposal
evan-forbes May 4, 2021
563e94e
fix TestMock
evan-forbes May 5, 2021
235da5b
fix TestCreateProposalBlock
evan-forbes May 5, 2021
300e0fb
Fix TestBlockchainMessageVectors
evan-forbes May 5, 2021
98c9f13
use EmptyBlockID func and use block in vote
evan-forbes May 5, 2021
4dcd7a8
Fix TestBlockHash
evan-forbes May 5, 2021
e8e50fc
go mod tidy
evan-forbes May 5, 2021
672ce3b
Fix TestBlockMakePartSet
evan-forbes May 5, 2021
76bae0c
Fix more nil commit Tests
evan-forbes May 5, 2021
5956145
fix more nil commit tests
evan-forbes May 5, 2021
39b5c75
get rid of the BlockID method
evan-forbes May 5, 2021
330e9dd
Fix TestBeginBlockByzantineValidators
evan-forbes May 5, 2021
0d9509a
fill in more of the blockIDs
evan-forbes May 6, 2021
d4a3bf8
Fix TestLightBlockProtobuf
evan-forbes May 6, 2021
1256a42
fix TestLightBlockValidateBasic
evan-forbes May 6, 2021
edc26f4
fix TestEvidenceProto
evan-forbes May 6, 2021
f80f731
fix TestHeader_ValidateBasic
evan-forbes May 6, 2021
80f6d75
fix TestProposalString
evan-forbes May 6, 2021
7847b9d
fix TestProposalValidateBasic
evan-forbes May 6, 2021
d7aa886
fix TestHeaderHash
evan-forbes May 6, 2021
d0034ec
update MaxHeaderBytes to fix TestMaxHeaderBytes
evan-forbes May 6, 2021
48a8305
fix TestProposalProtoBuf
evan-forbes May 6, 2021
03a4329
fix TestCommitValidateBasic
evan-forbes May 6, 2021
24681e6
tons of test fixes
evan-forbes May 7, 2021
df5b458
cleanup
evan-forbes May 7, 2021
d11f9d4
more fixes
evan-forbes May 8, 2021
9d53b41
don't return a nil for a non nil data availability header
evan-forbes May 10, 2021
bc81eff
Merge branch 'master' into evan/add-dah-to-block-id
evan-forbes May 10, 2021
3e5f077
Merge branch 'master' into evan/add-dah-to-block-id
evan-forbes May 10, 2021
5918bc0
fix more bugs
evan-forbes May 11, 2021
9dbf03a
linter
evan-forbes May 11, 2021
d865cc7
linter
evan-forbes May 11, 2021
8acce6b
remove unreachable code
evan-forbes May 11, 2021
a127447
linter
evan-forbes May 11, 2021
5c39da7
increase timeouts for CI
evan-forbes May 11, 2021
a6c85fc
remove unused nolint directive
evan-forbes May 11, 2021
304537f
add more docs to comptueshares
evan-forbes May 11, 2021
717ffd0
revert linter changes
evan-forbes May 11, 2021
2a33518
increase consensus timeouts
evan-forbes May 11, 2021
4c4bad0
increase timeout for RetrieveBlockData
evan-forbes May 11, 2021
74795bf
remove uneccessary hash call
evan-forbes May 11, 2021
ee766c7
add TxFilter test back in
evan-forbes May 11, 2021
51d9e95
revert uneccessary changes
evan-forbes May 11, 2021
912a067
increase timeouts for problem tests
evan-forbes May 11, 2021
d5dbe9a
hardcode bytes for min dah
evan-forbes May 12, 2021
cc5fd2d
fix accidental linter error
evan-forbes May 12, 2021
10c3334
slight timing adjustment
evan-forbes May 12, 2021
3bc1510
revert commented out test
evan-forbes May 13, 2021
8301d52
use less than or equal too instead of requiring equal
evan-forbes May 13, 2021
93adad9
add details to panic
evan-forbes May 13, 2021
a3f1101
typo
evan-forbes May 13, 2021
371684e
clean up
evan-forbes May 13, 2021
b28f6cb
use random blockID during proto test
evan-forbes May 13, 2021
17055a6
remove uneeded line
evan-forbes May 13, 2021
10366d2
add the hash back into the dah only when coming from proto
evan-forbes May 15, 2021
9fd4f9f
revert timeout increases
evan-forbes May 15, 2021
d40de7e
Merge branch 'master' into evan/add-dah-to-block-id
evan-forbes May 20, 2021
a6b08fc
Merge branch 'master' into evan/add-dah-to-block-id
evan-forbes May 21, 2021
5f88f6e
add a dah to test data
evan-forbes May 21, 2021
3f1c2f2
don't pass the block while making test commits
evan-forbes May 21, 2021
a8a81ee
add error for blockIDFromProto
evan-forbes May 21, 2021
62e4f8e
double e2e timeout
evan-forbes May 21, 2021
6da14b3
try longer progress e2e timeout
evan-forbes May 21, 2021
7074695
try even higher timeout
evan-forbes May 21, 2021
f39d6f9
what is time anyways
evan-forbes May 21, 2021
a9048c2
increase the rpc config timeout
evan-forbes May 21, 2021
fe0647c
disable reading limit check
evan-forbes May 21, 2021
4990c0a
comment out tests that check for message length
evan-forbes May 21, 2021
e83b8bd
Revert "comment out tests that check for message length"
evan-forbes May 21, 2021
860ba0a
crank the node info msg size
evan-forbes May 21, 2021
6cff6aa
add the type to see which proto message are getting so messed up
evan-forbes May 21, 2021
0931465
find the type of the fialing readers
evan-forbes May 21, 2021
098e39f
log the type of the reader
evan-forbes May 21, 2021
4e58a5c
log the number of time each is read
evan-forbes May 21, 2021
15f8e99
Revert "log the number of time each is read"
evan-forbes May 21, 2021
9673461
increase the timeout for the privval secret connection
evan-forbes May 21, 2021
c861186
lol
evan-forbes May 21, 2021
edfb5c1
revert some timeouts
evan-forbes May 21, 2021
b0165bb
revert another
evan-forbes May 21, 2021
0f70204
Merge branch 'master' into evan/add-dah-to-block-id
evan-forbes May 24, 2021
90828bb
Merge branch 'master' into evan/add-dah-to-block-id3
evan-forbes May 24, 2021
ad7f96f
increase timeout and add additional hash len check
evan-forbes May 24, 2021
039a9c7
revert later: try to figure out why test fails in CI only
evan-forbes May 24, 2021
4b91915
very large timeout per each node
evan-forbes May 24, 2021
26f6087
add additional condition to run fillDataAvailabilityHeader
evan-forbes May 24, 2021
4c82b57
Merge branch 'evan/add-dah-to-block-id3' into evan/add-dah-to-block-id
evan-forbes May 24, 2021
359a83f
Revert "TestStateLockPOLSafety1 times out on CI: increase threshold"
evan-forbes May 24, 2021
475de23
increase consensus test config timeouts again
evan-forbes May 24, 2021
4cbf0ef
increase signer endpoint timeout
evan-forbes May 24, 2021
156a597
increase TestRetrieveBlockData timeout
evan-forbes May 24, 2021
3e1dc41
just directly use the size of the message
evan-forbes May 24, 2021
722593f
Revert "just directly use the size of the message"
evan-forbes May 24, 2021
dfeb971
increase some other privval timeouts
evan-forbes May 24, 2021
1fac653
some other random timeouts
evan-forbes May 24, 2021
3a48ee9
double the mempool timeout
evan-forbes May 24, 2021
950595d
Merge branch 'master' into evan/add-dah-to-block-id
evan-forbes May 26, 2021
dca6828
Merge branch 'master' into evan/add-dah-to-block-id
evan-forbes Jun 24, 2021
73b0fa2
minor conflict fixes
evan-forbes Jun 24, 2021
54e1719
use more reasonable e2e timeout
evan-forbes Jun 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion blockchain/v0/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,17 @@ FOR_LOOP:
didProcessCh <- struct{}{}
}

first.DataHash = nil
first.Hash()
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved

var (
firstParts = first.MakePartSet(types.BlockPartSizeBytes)
firstPartSetHeader = firstParts.Header()
firstID = types.BlockID{Hash: first.Hash(), PartSetHeader: firstPartSetHeader}
firstID = types.BlockID{
Hash: first.Hash(),
PartSetHeader: firstPartSetHeader,
DataAvailabilityHeader: &first.DataAvailabilityHeader,
}
)

// Finally, verify the first block using the second's commit
Expand Down
22 changes: 15 additions & 7 deletions blockchain/v0/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func newBlockchainReactor(
lastCommit := types.NewCommit(
blockHeight-1,
0,
types.BlockID{DataAvailabilityHeader: types.MinDataAvailabilityHeader()},
types.EmptyBlockID(),
nil,
)
if blockHeight > 1 {
Expand Down Expand Up @@ -162,8 +162,6 @@ func TestNoBlockResponse(t *testing.T) {

}, p2p.Connect2Switches)

fmt.Println("after make conns", len(reactorPairs[0].reactor.pool.peers), len(reactorPairs[1].reactor.pool.peers))

defer func() {
for _, r := range reactorPairs {
err := r.reactor.Stop()
Expand All @@ -184,19 +182,29 @@ func TestNoBlockResponse(t *testing.T) {
}

for {
fmt.Println("is caught up?")
if reactorPairs[1].reactor.pool.IsCaughtUp() {
break
}

time.Sleep(1000 * time.Millisecond)
// The mutex is getting hit now, I don't know why

// fmt.Println(
// "ahead reactor peer count",
// // "is running", reactorPairs[0].reactor.pool.IsRunning(),
// len(reactorPairs[0].reactor.pool.peers),
// "behind reactor peer count",
// // "is running", reactorPairs[1].reactor.pool.IsRunning(),
// len(reactorPairs[1].reactor.pool.peers),
// )

time.Sleep(100 * time.Millisecond)
}

assert.Equal(t, maxBlockHeight, reactorPairs[0].reactor.store.Height())

for i, tt := range tests {
fmt.Println("test", i, "loading block")
for _, tt := range tests {
block := reactorPairs[1].reactor.store.LoadBlock(tt.height)
fmt.Println("finished loading block")
if tt.existent {
assert.True(t, block != nil)
} else {
Expand Down
16 changes: 12 additions & 4 deletions consensus/byzantine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,12 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St

// Create a new proposal block from state/txs from the mempool.
block1, blockParts1 := cs.createProposalBlock()
polRound, propBlockID := cs.ValidRound, types.BlockID{Hash: block1.Hash(), PartSetHeader: blockParts1.Header()}
proposal1 := types.NewProposal(height, round, polRound, propBlockID, &block1.DataAvailabilityHeader)
polRound, propBlockID := cs.ValidRound, types.BlockID{
Hash: block1.Hash(),
PartSetHeader: blockParts1.Header(),
DataAvailabilityHeader: &block1.DataAvailabilityHeader,
}
proposal1 := types.NewProposal(height, round, polRound, propBlockID)
p1, err := proposal1.ToProto()
require.NoError(t, err)
if err := cs.privValidator.SignProposal(cs.state.ChainID, p1); err != nil {
Expand All @@ -398,8 +402,12 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St

// Create a new proposal block from state/txs from the mempool.
block2, blockParts2 := cs.createProposalBlock()
polRound, propBlockID = cs.ValidRound, types.BlockID{Hash: block2.Hash(), PartSetHeader: blockParts2.Header()}
proposal2 := types.NewProposal(height, round, polRound, propBlockID, &block2.DataAvailabilityHeader)
polRound, propBlockID = cs.ValidRound, types.BlockID{
Hash: block2.Hash(),
PartSetHeader: blockParts2.Header(),
DataAvailabilityHeader: &block2.DataAvailabilityHeader,
}
proposal2 := types.NewProposal(height, round, polRound, propBlockID)
p2, err := proposal2.ToProto()
require.NoError(t, err)
if err := cs.privValidator.SignProposal(cs.state.ChainID, p2); err != nil {
Expand Down
29 changes: 14 additions & 15 deletions consensus/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ func newValidatorStub(privValidator types.PrivValidator, valIndex int32) *valida
}
}

func (vs *validatorStub) signVote(
voteType tmproto.SignedMsgType,
hash []byte,
header types.PartSetHeader) (*types.Vote, error) {
func (vs *validatorStub) signVote(voteType tmproto.SignedMsgType, blockID types.BlockID) (*types.Vote, error) {

pubKey, err := vs.PrivValidator.GetPubKey()
if err != nil {
Expand All @@ -103,7 +100,7 @@ func (vs *validatorStub) signVote(
Round: vs.Round,
Timestamp: tmtime.Now(),
Type: voteType,
BlockID: types.BlockID{Hash: hash, PartSetHeader: header},
BlockID: blockID,
}
v := vote.ToProto()
err = vs.PrivValidator.SignVote(config.ChainID(), v)
Expand All @@ -113,8 +110,8 @@ func (vs *validatorStub) signVote(
}

// Sign vote for type/hash/header
func signVote(vs *validatorStub, voteType tmproto.SignedMsgType, hash []byte, header types.PartSetHeader) *types.Vote {
v, err := vs.signVote(voteType, hash, header)
func signVote(vs *validatorStub, voteType tmproto.SignedMsgType, blockID types.BlockID) *types.Vote {
v, err := vs.signVote(voteType, blockID)
if err != nil {
panic(fmt.Errorf("failed to sign vote: %v", err))
}
Expand All @@ -123,12 +120,11 @@ func signVote(vs *validatorStub, voteType tmproto.SignedMsgType, hash []byte, he

func signVotes(
voteType tmproto.SignedMsgType,
hash []byte,
header types.PartSetHeader,
blockID types.BlockID,
vss ...*validatorStub) []*types.Vote {
votes := make([]*types.Vote, len(vss))
for i, vs := range vss {
votes[i] = signVote(vs, voteType, hash, header)
votes[i] = signVote(vs, voteType, blockID)
}
return votes
}
Expand Down Expand Up @@ -200,8 +196,12 @@ func decideProposal(
}

// Make proposal
polRound, propBlockID := validRound, types.BlockID{Hash: block.Hash(), PartSetHeader: blockParts.Header()}
proposal = types.NewProposal(height, round, polRound, propBlockID, &block.DataAvailabilityHeader)
polRound, propBlockID := validRound, types.BlockID{
Hash: block.Hash(),
PartSetHeader: blockParts.Header(),
DataAvailabilityHeader: &block.DataAvailabilityHeader,
}
proposal = types.NewProposal(height, round, polRound, propBlockID)
p, err := proposal.ToProto()
if err != nil {
panic(err)
Expand All @@ -224,11 +224,10 @@ func addVotes(to *State, votes ...*types.Vote) {
func signAddVotes(
to *State,
voteType tmproto.SignedMsgType,
hash []byte,
header types.PartSetHeader,
blockID types.BlockID,
vss ...*validatorStub,
) {
votes := signVotes(voteType, hash, header, vss...)
votes := signVotes(voteType, blockID, vss...)
addVotes(to, votes...)
}

Expand Down
94 changes: 76 additions & 18 deletions consensus/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,12 @@ func TestSimulateValidatorsChange(t *testing.T) {
ensureNewRound(newRoundCh, height, 0)
ensureNewProposal(proposalCh, height, round)
rs := css[0].GetRoundState()
signAddVotes(css[0], tmproto.PrecommitType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), vss[1:nVals]...)
propBlockID := types.BlockID{
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
DataAvailabilityHeader: &rs.ProposalBlock.DataAvailabilityHeader,
}
signAddVotes(css[0], tmproto.PrecommitType, propBlockID, vss[1:nVals]...)
ensureNewRound(newRoundCh, height+1, 0)

// HEIGHT 2
Expand All @@ -366,9 +371,13 @@ func TestSimulateValidatorsChange(t *testing.T) {
assert.Nil(t, err)
propBlock, _ := css[0].createProposalBlock() // changeProposer(t, cs1, vs2)
propBlockParts := propBlock.MakePartSet(partSize)
blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()}
blockID := types.BlockID{
Hash: propBlock.Hash(),
PartSetHeader: propBlockParts.Header(),
DataAvailabilityHeader: &propBlock.DataAvailabilityHeader,
}

proposal := types.NewProposal(vss[1].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader)
proposal := types.NewProposal(vss[1].Height, round, -1, blockID)
p, err := proposal.ToProto()
require.NoError(t, err)
if err := vss[1].SignProposal(config.ChainID(), p); err != nil {
Expand All @@ -382,7 +391,14 @@ func TestSimulateValidatorsChange(t *testing.T) {
}
ensureNewProposal(proposalCh, height, round)
rs = css[0].GetRoundState()
signAddVotes(css[0], tmproto.PrecommitType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), vss[1:nVals]...)

propBlockID = types.BlockID{
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
DataAvailabilityHeader: &rs.ProposalBlock.DataAvailabilityHeader,
}

signAddVotes(css[0], tmproto.PrecommitType, propBlockID, vss[1:nVals]...)
ensureNewRound(newRoundCh, height+1, 0)

// HEIGHT 3
Expand All @@ -397,9 +413,13 @@ func TestSimulateValidatorsChange(t *testing.T) {
assert.Nil(t, err)
propBlock, _ = css[0].createProposalBlock() // changeProposer(t, cs1, vs2)
propBlockParts = propBlock.MakePartSet(partSize)
blockID = types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()}
blockID = types.BlockID{
Hash: propBlock.Hash(),
PartSetHeader: propBlockParts.Header(),
DataAvailabilityHeader: &propBlock.DataAvailabilityHeader,
}

proposal = types.NewProposal(vss[2].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader)
proposal = types.NewProposal(vss[2].Height, round, -1, blockID)
p, err = proposal.ToProto()
require.NoError(t, err)
if err := vss[2].SignProposal(config.ChainID(), p); err != nil {
Expand All @@ -413,7 +433,14 @@ func TestSimulateValidatorsChange(t *testing.T) {
}
ensureNewProposal(proposalCh, height, round)
rs = css[0].GetRoundState()
signAddVotes(css[0], tmproto.PrecommitType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), vss[1:nVals]...)

propBlockID = types.BlockID{
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
DataAvailabilityHeader: &rs.ProposalBlock.DataAvailabilityHeader,
}

signAddVotes(css[0], tmproto.PrecommitType, propBlockID, vss[1:nVals]...)
ensureNewRound(newRoundCh, height+1, 0)

// HEIGHT 4
Expand All @@ -435,7 +462,11 @@ func TestSimulateValidatorsChange(t *testing.T) {
assert.Nil(t, err)
propBlock, _ = css[0].createProposalBlock() // changeProposer(t, cs1, vs2)
propBlockParts = propBlock.MakePartSet(partSize)
blockID = types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()}
blockID = types.BlockID{
Hash: propBlock.Hash(),
PartSetHeader: propBlockParts.Header(),
DataAvailabilityHeader: &propBlock.DataAvailabilityHeader,
}
newVss := make([]*validatorStub, nVals+1)
copy(newVss, vss[:nVals+1])
sort.Sort(ValidatorStubsByPower(newVss))
Expand All @@ -457,7 +488,7 @@ func TestSimulateValidatorsChange(t *testing.T) {

selfIndex := valIndexFn(0)

proposal = types.NewProposal(vss[3].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader)
proposal = types.NewProposal(vss[3].Height, round, -1, blockID)
p, err = proposal.ToProto()
require.NoError(t, err)
if err := vss[3].SignProposal(config.ChainID(), p); err != nil {
Expand All @@ -476,11 +507,16 @@ func TestSimulateValidatorsChange(t *testing.T) {
assert.Nil(t, err)

rs = css[0].GetRoundState()
blockID = types.BlockID{
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
DataAvailabilityHeader: &rs.ProposalBlock.DataAvailabilityHeader,
}
for i := 0; i < nVals+1; i++ {
if i == selfIndex {
continue
}
signAddVotes(css[0], tmproto.PrecommitType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), newVss[i])
signAddVotes(css[0], tmproto.PrecommitType, blockID, newVss[i])
}

ensureNewRound(newRoundCh, height+1, 0)
Expand All @@ -495,11 +531,16 @@ func TestSimulateValidatorsChange(t *testing.T) {
selfIndex = valIndexFn(0)
ensureNewProposal(proposalCh, height, round)
rs = css[0].GetRoundState()
blockID = types.BlockID{
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
DataAvailabilityHeader: &rs.ProposalBlock.DataAvailabilityHeader,
}
for i := 0; i < nVals+1; i++ {
if i == selfIndex {
continue
}
signAddVotes(css[0], tmproto.PrecommitType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), newVss[i])
signAddVotes(css[0], tmproto.PrecommitType, blockID, newVss[i])
}
ensureNewRound(newRoundCh, height+1, 0)

Expand All @@ -511,13 +552,17 @@ func TestSimulateValidatorsChange(t *testing.T) {
assert.Nil(t, err)
propBlock, _ = css[0].createProposalBlock() // changeProposer(t, cs1, vs2)
propBlockParts = propBlock.MakePartSet(partSize)
blockID = types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()}
blockID = types.BlockID{
Hash: propBlock.Hash(),
PartSetHeader: propBlockParts.Header(),
DataAvailabilityHeader: &propBlock.DataAvailabilityHeader,
}
newVss = make([]*validatorStub, nVals+3)
copy(newVss, vss[:nVals+3])
sort.Sort(ValidatorStubsByPower(newVss))

selfIndex = valIndexFn(0)
proposal = types.NewProposal(vss[1].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader)
proposal = types.NewProposal(vss[1].Height, round, -1, blockID)
p, err = proposal.ToProto()
require.NoError(t, err)
if err := vss[1].SignProposal(config.ChainID(), p); err != nil {
Expand All @@ -531,11 +576,16 @@ func TestSimulateValidatorsChange(t *testing.T) {
}
ensureNewProposal(proposalCh, height, round)
rs = css[0].GetRoundState()
blockID = types.BlockID{
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
DataAvailabilityHeader: &rs.ProposalBlock.DataAvailabilityHeader,
}
for i := 0; i < nVals+3; i++ {
if i == selfIndex {
continue
}
signAddVotes(css[0], tmproto.PrecommitType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), newVss[i])
signAddVotes(css[0], tmproto.PrecommitType, blockID, newVss[i])
}
ensureNewRound(newRoundCh, height+1, 0)

Expand Down Expand Up @@ -785,7 +835,11 @@ func applyBlock(stateStore sm.Store, st sm.State, blk *types.Block, proxyApp pro
testPartSize := types.BlockPartSizeBytes
blockExec := sm.NewBlockExecutor(stateStore, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool)

blkID := types.BlockID{Hash: blk.Hash(), PartSetHeader: blk.MakePartSet(testPartSize).Header()}
blkID := types.BlockID{
Hash: blk.Hash(),
PartSetHeader: blk.MakePartSet(testPartSize).Header(),
DataAvailabilityHeader: &blk.DataAvailabilityHeader,
}
newState, _, err := blockExec.ApplyBlock(st, blkID, blk)
if err != nil {
panic(err)
Expand Down Expand Up @@ -983,7 +1037,7 @@ func makeBlocks(n int, state *sm.State, privVal types.PrivValidator) []*types.Bl
func makeBlock(state sm.State, lastBlock *types.Block, lastBlockMeta *types.BlockMeta,
privVal types.PrivValidator, height int64) (*types.Block, *types.PartSet) {

lastCommit := types.NewCommit(height-1, 0, types.BlockID{}, nil)
lastCommit := types.NewCommit(height-1, 0, types.EmptyBlockID(), nil)
if height > 1 {
vote, _ := types.MakeVote(
lastBlock.Header.Height,
Expand Down Expand Up @@ -1199,8 +1253,12 @@ func (bs *mockBlockStore) LoadBlockByHash(hash []byte) *types.Block {
func (bs *mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta {
block := bs.chain[height-1]
return &types.BlockMeta{
BlockID: types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(types.BlockPartSizeBytes).Header()},
Header: block.Header,
BlockID: types.BlockID{
Hash: block.Hash(),
PartSetHeader: block.MakePartSet(types.BlockPartSizeBytes).Header(),
DataAvailabilityHeader: &block.DataAvailabilityHeader,
},
Header: block.Header,
}
}
func (bs *mockBlockStore) LoadBlockPart(height int64, index int) *types.Part { return nil }
Expand Down
Loading