You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

602 lines
18 KiB

7 years ago
  1. package evidence
  2. import (
  3. "os"
  4. "testing"
  5. "time"
  6. "github.com/gogo/protobuf/proto"
  7. "github.com/stretchr/testify/assert"
  8. "github.com/stretchr/testify/mock"
  9. "github.com/stretchr/testify/require"
  10. dbm "github.com/tendermint/tm-db"
  11. "github.com/tendermint/tendermint/crypto/tmhash"
  12. "github.com/tendermint/tendermint/evidence/mocks"
  13. "github.com/tendermint/tendermint/libs/bytes"
  14. "github.com/tendermint/tendermint/libs/log"
  15. tmrand "github.com/tendermint/tendermint/libs/rand"
  16. tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
  17. sm "github.com/tendermint/tendermint/state"
  18. "github.com/tendermint/tendermint/store"
  19. "github.com/tendermint/tendermint/types"
  20. )
  21. func TestMain(m *testing.M) {
  22. code := m.Run()
  23. os.Exit(code)
  24. }
  25. const evidenceChainID = "test_chain"
  26. var defaultEvidenceTime = time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)
  27. func TestEvidencePoolBasic(t *testing.T) {
  28. var (
  29. val = types.NewMockPV()
  30. height = int64(1)
  31. stateStore = initializeValidatorState(val, height)
  32. evidenceDB = dbm.NewMemDB()
  33. blockStore = &mocks.BlockStore{}
  34. )
  35. blockStore.On("LoadBlockMeta", mock.AnythingOfType("int64")).Return(
  36. &types.BlockMeta{Header: types.Header{Time: defaultEvidenceTime}},
  37. )
  38. pool, err := NewPool(evidenceDB, stateStore, blockStore)
  39. require.NoError(t, err)
  40. // evidence not seen yet:
  41. evidence := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultEvidenceTime, val, evidenceChainID)
  42. assert.False(t, pool.IsCommitted(evidence))
  43. // good evidence
  44. evAdded := make(chan struct{})
  45. go func() {
  46. <-pool.EvidenceWaitChan()
  47. close(evAdded)
  48. }()
  49. // evidence seen but not yet committed:
  50. assert.NoError(t, pool.AddEvidence(evidence))
  51. select {
  52. case <-evAdded:
  53. case <-time.After(5 * time.Second):
  54. t.Fatal("evidence was not added to list after 5s")
  55. }
  56. assert.Equal(t, 1, pool.evidenceList.Len())
  57. assert.False(t, pool.IsCommitted(evidence))
  58. assert.True(t, pool.IsPending(evidence))
  59. // test evidence is proposed
  60. proposedEvidence := pool.AllPendingEvidence()
  61. assert.Equal(t, proposedEvidence[0], evidence)
  62. proposedEvidence = pool.PendingEvidence(1)
  63. assert.Equal(t, proposedEvidence[0], evidence)
  64. // evidence seen and committed:
  65. pool.MarkEvidenceAsCommitted(height, proposedEvidence)
  66. assert.True(t, pool.IsCommitted(evidence))
  67. assert.False(t, pool.IsPending(evidence))
  68. assert.Equal(t, 0, pool.evidenceList.Len())
  69. // no evidence should be pending
  70. proposedEvidence = pool.PendingEvidence(1)
  71. assert.Empty(t, proposedEvidence)
  72. }
  73. // Tests inbound evidence for the right time and height
  74. func TestAddExpiredEvidence(t *testing.T) {
  75. var (
  76. val = types.NewMockPV()
  77. height = int64(30)
  78. stateStore = initializeValidatorState(val, height)
  79. evidenceDB = dbm.NewMemDB()
  80. blockStore = &mocks.BlockStore{}
  81. expiredEvidenceTime = time.Date(2018, 1, 1, 0, 0, 0, 0, time.UTC)
  82. expiredHeight = int64(2)
  83. )
  84. blockStore.On("LoadBlockMeta", mock.AnythingOfType("int64")).Return(func(h int64) *types.BlockMeta {
  85. if h == height || h == expiredHeight {
  86. return &types.BlockMeta{Header: types.Header{Time: defaultEvidenceTime}}
  87. }
  88. return &types.BlockMeta{Header: types.Header{Time: expiredEvidenceTime}}
  89. })
  90. pool, err := NewPool(evidenceDB, stateStore, blockStore)
  91. require.NoError(t, err)
  92. testCases := []struct {
  93. evHeight int64
  94. evTime time.Time
  95. expErr bool
  96. evDescription string
  97. }{
  98. {height, defaultEvidenceTime, false, "valid evidence"},
  99. {expiredHeight, defaultEvidenceTime, false, "valid evidence (despite old height)"},
  100. {height - 1, expiredEvidenceTime, false, "valid evidence (despite old time)"},
  101. {expiredHeight - 1, expiredEvidenceTime, true,
  102. "evidence from height 1 (created at: 2019-01-01 00:00:00 +0000 UTC) is too old"},
  103. }
  104. for _, tc := range testCases {
  105. tc := tc
  106. t.Run(tc.evDescription, func(t *testing.T) {
  107. ev := types.NewMockDuplicateVoteEvidenceWithValidator(tc.evHeight, tc.evTime, val, evidenceChainID)
  108. err := pool.AddEvidence(ev)
  109. if tc.expErr {
  110. assert.Error(t, err)
  111. } else {
  112. assert.NoError(t, err)
  113. }
  114. })
  115. }
  116. }
  117. func TestEvidencePoolUpdate(t *testing.T) {
  118. height := int64(21)
  119. pool, val := defaultTestPool(height)
  120. state := pool.State()
  121. // create new block (no need to save it to blockStore)
  122. evidence := types.NewMockDuplicateVoteEvidence(height, time.Now(), evidenceChainID)
  123. lastCommit := makeCommit(height, val.PrivKey.PubKey().Address())
  124. block := types.MakeBlock(height+1, []types.Tx{}, lastCommit, []types.Evidence{evidence})
  125. // update state (partially)
  126. state.LastBlockHeight = height + 1
  127. pool.Update(block, state)
  128. // a) Update marks evidence as committed
  129. assert.True(t, pool.IsCommitted(evidence))
  130. }
  131. func TestAddingAndPruningPOLC(t *testing.T) {
  132. var (
  133. val = types.NewMockPV()
  134. expiredHeight = int64(1)
  135. firstBlockID = types.BlockID{
  136. Hash: tmrand.Bytes(tmhash.Size),
  137. PartSetHeader: types.PartSetHeader{
  138. Total: 1,
  139. Hash: tmrand.Bytes(tmhash.Size),
  140. },
  141. }
  142. stateStore = initializeValidatorState(val, expiredHeight)
  143. blockStore = &mocks.BlockStore{}
  144. expiredEvidenceTime = time.Date(2018, 1, 1, 0, 0, 0, 0, time.UTC)
  145. )
  146. pool, err := NewPool(dbm.NewMemDB(), stateStore, blockStore)
  147. require.NoError(t, err)
  148. pool.SetLogger(log.TestingLogger())
  149. state := pool.State()
  150. height := state.ConsensusParams.Evidence.MaxAgeNumBlocks * 2
  151. blockStore.On("LoadBlockMeta", mock.AnythingOfType("int64")).Return(
  152. &types.BlockMeta{Header: types.Header{Time: expiredEvidenceTime}},
  153. )
  154. voteA := makeVote(1, 1, 0, val.PrivKey.PubKey().Address(), firstBlockID, expiredEvidenceTime)
  155. vA := voteA.ToProto()
  156. err = val.SignVote(evidenceChainID, vA)
  157. require.NoError(t, err)
  158. voteA.Signature = vA.Signature
  159. pubKey, _ := types.NewMockPV().GetPubKey()
  160. polc := &types.ProofOfLockChange{
  161. Votes: []*types.Vote{voteA},
  162. PubKey: pubKey,
  163. }
  164. err = pool.AddPOLC(polc)
  165. assert.NoError(t, err)
  166. // should be able to retrieve polc
  167. newPolc, err := pool.RetrievePOLC(1, 1)
  168. assert.NoError(t, err)
  169. assert.True(t, polc.Equal(newPolc))
  170. // should not be able to retrieve because it doesn't exist
  171. emptyPolc, err := pool.RetrievePOLC(2, 1)
  172. assert.NoError(t, err)
  173. assert.Nil(t, emptyPolc)
  174. lastCommit := makeCommit(height-1, val.PrivKey.PubKey().Address())
  175. block := types.MakeBlock(height, []types.Tx{}, lastCommit, []types.Evidence{})
  176. // update state (partially)
  177. state.LastBlockHeight = height
  178. pool.state.LastBlockHeight = height
  179. // update should prune the polc
  180. pool.Update(block, state)
  181. emptyPolc, err = pool.RetrievePOLC(1, 1)
  182. assert.NoError(t, err)
  183. assert.Nil(t, emptyPolc)
  184. }
  185. func TestVerifyEvidenceCommittedEvidenceFails(t *testing.T) {
  186. height := int64(1)
  187. pool, _ := defaultTestPool(height)
  188. committedEvidence := types.NewMockDuplicateVoteEvidence(height, time.Now(), evidenceChainID)
  189. pool.MarkEvidenceAsCommitted(height, []types.Evidence{committedEvidence})
  190. err := pool.Verify(committedEvidence)
  191. if assert.Error(t, err) {
  192. assert.Equal(t, "evidence was already committed", err.Error())
  193. }
  194. }
  195. func TestVeriyEvidencePendingEvidencePasses(t *testing.T) {
  196. var (
  197. val = types.NewMockPV()
  198. height = int64(1)
  199. stateStore = initializeValidatorState(val, height)
  200. blockStore = &mocks.BlockStore{}
  201. )
  202. blockStore.On("LoadBlockMeta", mock.AnythingOfType("int64")).Return(
  203. &types.BlockMeta{Header: types.Header{Time: defaultEvidenceTime}},
  204. )
  205. pool, err := NewPool(dbm.NewMemDB(), stateStore, blockStore)
  206. require.NoError(t, err)
  207. evidence := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultEvidenceTime, val, evidenceChainID)
  208. err = pool.AddEvidence(evidence)
  209. require.NoError(t, err)
  210. err = pool.Verify(evidence)
  211. assert.NoError(t, err)
  212. }
  213. func TestRecoverPendingEvidence(t *testing.T) {
  214. var (
  215. val = types.NewMockPV()
  216. valAddr = val.PrivKey.PubKey().Address()
  217. height = int64(30)
  218. stateStore = initializeValidatorState(val, height)
  219. evidenceDB = dbm.NewMemDB()
  220. blockStoreDB = dbm.NewMemDB()
  221. state = stateStore.LoadState()
  222. blockStore = initializeBlockStore(blockStoreDB, state, valAddr)
  223. expiredEvidenceTime = time.Date(2018, 1, 1, 0, 0, 0, 0, time.UTC)
  224. goodEvidence = types.NewMockDuplicateVoteEvidenceWithValidator(height,
  225. defaultEvidenceTime, val, evidenceChainID)
  226. expiredEvidence = types.NewMockDuplicateVoteEvidenceWithValidator(int64(1),
  227. expiredEvidenceTime, val, evidenceChainID)
  228. )
  229. // load good evidence
  230. goodKey := keyPending(goodEvidence)
  231. evi, err := types.EvidenceToProto(goodEvidence)
  232. require.NoError(t, err)
  233. goodEvidenceBytes, err := proto.Marshal(evi)
  234. require.NoError(t, err)
  235. _ = evidenceDB.Set(goodKey, goodEvidenceBytes)
  236. // load expired evidence
  237. expiredKey := keyPending(expiredEvidence)
  238. eevi, err := types.EvidenceToProto(expiredEvidence)
  239. require.NoError(t, err)
  240. expiredEvidenceBytes, err := proto.Marshal(eevi)
  241. require.NoError(t, err)
  242. _ = evidenceDB.Set(expiredKey, expiredEvidenceBytes)
  243. pool, err := NewPool(evidenceDB, stateStore, blockStore)
  244. require.NoError(t, err)
  245. assert.Equal(t, 1, pool.evidenceList.Len())
  246. assert.True(t, pool.IsPending(goodEvidence))
  247. assert.False(t, pool.Has(expiredEvidence))
  248. }
  249. // Comprehensive set of test cases relating to the adding, upgrading and overall
  250. // processing of PotentialAmnesiaEvidence and AmnesiaEvidence
  251. func TestAmnesiaEvidence(t *testing.T) {
  252. var (
  253. val = types.NewMockPV()
  254. val2 = types.NewMockPV()
  255. pubKey = val.PrivKey.PubKey()
  256. pubKey2 = val2.PrivKey.PubKey()
  257. valSet = &types.ValidatorSet{
  258. Validators: []*types.Validator{
  259. val.ExtractIntoValidator(1),
  260. val2.ExtractIntoValidator(3),
  261. },
  262. Proposer: val.ExtractIntoValidator(1),
  263. }
  264. height = int64(30)
  265. stateStore = initializeStateFromValidatorSet(valSet, height)
  266. evidenceDB = dbm.NewMemDB()
  267. state = stateStore.LoadState()
  268. blockStore = &mocks.BlockStore{}
  269. //evidenceTime = time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)
  270. firstBlockID = types.BlockID{
  271. Hash: tmrand.Bytes(tmhash.Size),
  272. PartSetHeader: types.PartSetHeader{
  273. Total: 1,
  274. Hash: tmrand.Bytes(tmhash.Size),
  275. },
  276. }
  277. secondBlockID = types.BlockID{
  278. Hash: tmrand.Bytes(tmhash.Size),
  279. PartSetHeader: types.PartSetHeader{
  280. Total: 1,
  281. Hash: tmrand.Bytes(tmhash.Size),
  282. },
  283. }
  284. evidenceTime = time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)
  285. )
  286. blockStore.On("LoadBlockMeta", mock.AnythingOfType("int64")).Return(
  287. &types.BlockMeta{Header: types.Header{Time: evidenceTime}},
  288. )
  289. // TEST SETUP
  290. pool, err := NewPool(evidenceDB, stateStore, blockStore)
  291. require.NoError(t, err)
  292. pool.SetLogger(log.TestingLogger())
  293. voteA := makeVote(height, 0, 0, pubKey.Address(), firstBlockID, evidenceTime)
  294. vA := voteA.ToProto()
  295. err = val.SignVote(evidenceChainID, vA)
  296. voteA.Signature = vA.Signature
  297. require.NoError(t, err)
  298. voteB := makeVote(height, 1, 0, pubKey.Address(), secondBlockID, evidenceTime.Add(3*time.Second))
  299. vB := voteB.ToProto()
  300. err = val.SignVote(evidenceChainID, vB)
  301. voteB.Signature = vB.Signature
  302. require.NoError(t, err)
  303. voteC := makeVote(height, 2, 0, pubKey.Address(), firstBlockID, evidenceTime.Add(2*time.Second))
  304. vC := voteC.ToProto()
  305. err = val.SignVote(evidenceChainID, vC)
  306. voteC.Signature = vC.Signature
  307. require.NoError(t, err)
  308. ev := &types.PotentialAmnesiaEvidence{
  309. VoteA: voteA,
  310. VoteB: voteB,
  311. Timestamp: evidenceTime,
  312. }
  313. polc := &types.ProofOfLockChange{
  314. Votes: []*types.Vote{voteB},
  315. PubKey: pubKey2,
  316. }
  317. err = pool.AddPOLC(polc)
  318. require.NoError(t, err)
  319. polc, err = pool.RetrievePOLC(height, 1)
  320. require.NoError(t, err)
  321. require.NotEmpty(t, polc)
  322. secondValVote := makeVote(height, 1, 0, pubKey2.Address(), secondBlockID, evidenceTime.Add(1*time.Second))
  323. vv2 := secondValVote.ToProto()
  324. err = val2.SignVote(evidenceChainID, vv2)
  325. require.NoError(t, err)
  326. secondValVote.Signature = vv2.Signature
  327. validPolc := &types.ProofOfLockChange{
  328. Votes: []*types.Vote{secondValVote},
  329. PubKey: pubKey,
  330. }
  331. // CASE A
  332. pool.logger.Info("CASE A")
  333. // we expect the evidence pool to find the polc but log an error as the polc is not valid -> vote was
  334. // not from a validator in this set. However, an error isn't thrown because the evidence pool
  335. // should still be able to save the regular potential amnesia evidence.
  336. err = pool.AddEvidence(ev)
  337. assert.NoError(t, err)
  338. // evidence requires trial period until it is available -> we expect no evidence to be returned
  339. assert.Equal(t, 0, len(pool.PendingEvidence(1)))
  340. assert.True(t, pool.IsOnTrial(ev))
  341. nextHeight := pool.nextEvidenceTrialEndedHeight
  342. assert.Greater(t, nextHeight, int64(0))
  343. // CASE B
  344. pool.logger.Info("CASE B")
  345. // evidence is not ready to be upgraded so we return the height we expect the evidence to be.
  346. nextHeight = pool.upgradePotentialAmnesiaEvidence()
  347. assert.Equal(t, height+pool.state.ConsensusParams.Evidence.ProofTrialPeriod, nextHeight)
  348. // CASE C
  349. pool.logger.Info("CASE C")
  350. // now evidence is ready to be upgraded to amnesia evidence -> we expect -1 to be the next height as their is
  351. // no more pending potential amnesia evidence left
  352. lastCommit := makeCommit(height+1, pubKey.Address())
  353. block := types.MakeBlock(height+2, []types.Tx{}, lastCommit, []types.Evidence{})
  354. state.LastBlockHeight = height + 2
  355. pool.Update(block, state)
  356. assert.Equal(t, int64(-1), pool.nextEvidenceTrialEndedHeight)
  357. assert.Equal(t, 1, len(pool.PendingEvidence(1)))
  358. // CASE D
  359. pool.logger.Info("CASE D")
  360. // evidence of voting back in the past which is instantly punishable -> amnesia evidence is made directly
  361. ev2 := &types.PotentialAmnesiaEvidence{
  362. VoteA: voteC,
  363. VoteB: voteB,
  364. Timestamp: evidenceTime,
  365. }
  366. err = pool.AddEvidence(ev2)
  367. assert.NoError(t, err)
  368. expectedAe := &types.AmnesiaEvidence{
  369. PotentialAmnesiaEvidence: ev2,
  370. Polc: types.NewEmptyPOLC(),
  371. }
  372. assert.True(t, pool.IsPending(expectedAe))
  373. assert.Equal(t, 2, len(pool.AllPendingEvidence()))
  374. // CASE E
  375. pool.logger.Info("CASE E")
  376. // test for receiving amnesia evidence
  377. ae := types.NewAmnesiaEvidence(ev, types.NewEmptyPOLC())
  378. // we need to run the trial period ourselves so amnesia evidence should not be added, instead
  379. // we should extract out the potential amnesia evidence and trying to add that before realising
  380. // that we already have it -> no error
  381. err = pool.AddEvidence(ae)
  382. assert.NoError(t, err)
  383. assert.Equal(t, 2, len(pool.AllPendingEvidence()))
  384. voteD := makeVote(height, 2, 0, pubKey.Address(), firstBlockID, evidenceTime.Add(4*time.Second))
  385. vD := voteD.ToProto()
  386. err = val.SignVote(evidenceChainID, vD)
  387. require.NoError(t, err)
  388. voteD.Signature = vD.Signature
  389. // CASE F
  390. pool.logger.Info("CASE F")
  391. // a new amnesia evidence is seen. It has an empty polc so we should extract the potential amnesia evidence
  392. // and start our own trial
  393. newPe := &types.PotentialAmnesiaEvidence{
  394. VoteA: voteB,
  395. VoteB: voteD,
  396. Timestamp: evidenceTime,
  397. }
  398. newAe := &types.AmnesiaEvidence{
  399. PotentialAmnesiaEvidence: newPe,
  400. Polc: types.NewEmptyPOLC(),
  401. }
  402. err = pool.AddEvidence(newAe)
  403. assert.NoError(t, err)
  404. assert.Equal(t, 2, len(pool.AllPendingEvidence()))
  405. assert.True(t, pool.IsOnTrial(newPe))
  406. // CASE G
  407. pool.logger.Info("CASE G")
  408. // Finally, we receive an amnesia evidence containing a valid polc for an earlier potential amnesia evidence
  409. // that we have already upgraded to. We should ad this new amnesia evidence in replace of the prior
  410. // amnesia evidence with an empty polc that we have
  411. aeWithPolc := &types.AmnesiaEvidence{
  412. PotentialAmnesiaEvidence: ev,
  413. Polc: validPolc,
  414. }
  415. err = pool.AddEvidence(aeWithPolc)
  416. assert.NoError(t, err)
  417. assert.True(t, pool.IsPending(aeWithPolc))
  418. assert.Equal(t, 2, len(pool.AllPendingEvidence()))
  419. t.Log(pool.AllPendingEvidence())
  420. }
  421. func initializeStateFromValidatorSet(valSet *types.ValidatorSet, height int64) StateStore {
  422. stateDB := dbm.NewMemDB()
  423. state := sm.State{
  424. ChainID: evidenceChainID,
  425. InitialHeight: 1,
  426. LastBlockHeight: height,
  427. LastBlockTime: defaultEvidenceTime,
  428. Validators: valSet,
  429. NextValidators: valSet.CopyIncrementProposerPriority(1),
  430. LastValidators: valSet,
  431. LastHeightValidatorsChanged: 1,
  432. ConsensusParams: tmproto.ConsensusParams{
  433. Block: tmproto.BlockParams{
  434. MaxBytes: 22020096,
  435. MaxGas: -1,
  436. },
  437. Evidence: tmproto.EvidenceParams{
  438. MaxAgeNumBlocks: 20,
  439. MaxAgeDuration: 48 * time.Hour,
  440. MaxNum: 50,
  441. ProofTrialPeriod: 1,
  442. },
  443. },
  444. }
  445. // save all states up to height
  446. for i := int64(0); i <= height; i++ {
  447. state.LastBlockHeight = i
  448. sm.SaveState(stateDB, state)
  449. }
  450. return &stateStore{db: stateDB}
  451. }
  452. func initializeValidatorState(privVal types.PrivValidator, height int64) StateStore {
  453. pubKey, _ := privVal.GetPubKey()
  454. validator := &types.Validator{Address: pubKey.Address(), VotingPower: 0, PubKey: pubKey}
  455. // create validator set and state
  456. valSet := &types.ValidatorSet{
  457. Validators: []*types.Validator{validator},
  458. Proposer: validator,
  459. }
  460. return initializeStateFromValidatorSet(valSet, height)
  461. }
  462. // initializeBlockStore creates a block storage and populates it w/ a dummy
  463. // block at +height+.
  464. func initializeBlockStore(db dbm.DB, state sm.State, valAddr []byte) *store.BlockStore {
  465. blockStore := store.NewBlockStore(db)
  466. for i := int64(1); i <= state.LastBlockHeight; i++ {
  467. lastCommit := makeCommit(i-1, valAddr)
  468. block, _ := state.MakeBlock(i, []types.Tx{}, lastCommit, nil,
  469. state.Validators.GetProposer().Address)
  470. const parts = 1
  471. partSet := block.MakePartSet(parts)
  472. seenCommit := makeCommit(i, valAddr)
  473. blockStore.SaveBlock(block, partSet, seenCommit)
  474. }
  475. return blockStore
  476. }
  477. func makeCommit(height int64, valAddr []byte) *types.Commit {
  478. commitSigs := []types.CommitSig{{
  479. BlockIDFlag: types.BlockIDFlagCommit,
  480. ValidatorAddress: valAddr,
  481. Timestamp: time.Now(),
  482. Signature: []byte("Signature"),
  483. }}
  484. return types.NewCommit(height, 0, types.BlockID{}, commitSigs)
  485. }
  486. func makeVote(height int64, round, index int32, addr bytes.HexBytes,
  487. blockID types.BlockID, time time.Time) *types.Vote {
  488. return &types.Vote{
  489. Type: tmproto.SignedMsgType(2),
  490. Height: height,
  491. Round: round,
  492. BlockID: blockID,
  493. Timestamp: time,
  494. ValidatorAddress: addr,
  495. ValidatorIndex: index,
  496. }
  497. }
  498. func defaultTestPool(height int64) (*Pool, types.MockPV) {
  499. val := types.NewMockPV()
  500. valAddress := val.PrivKey.PubKey().Address()
  501. evidenceDB := dbm.NewMemDB()
  502. stateStore := initializeValidatorState(val, height)
  503. blockStore := initializeBlockStore(dbm.NewMemDB(), stateStore.LoadState(), valAddress)
  504. pool, err := NewPool(evidenceDB, stateStore, blockStore)
  505. if err != nil {
  506. panic("test evidence pool could not be created")
  507. }
  508. return pool, val
  509. }