prysmaticlabs / prysm

Go implementation of Ethereum proof of stake
https://www.offchainlabs.com/
GNU General Public License v3.0
3.4k stars 954 forks source link

TestStore_NoViableHead_Liveness Test Setup is Broken #13664

Open nisdas opened 4 months ago

nisdas commented 4 months ago

Describe the bug

TestStore_NoViableHead_Liveness no longer passes on develop and fails:

=== RUN   TestStore_NoViableHead_Liveness
    assertions.go:37: process_block_test.go:1709 Values are not equal, want: [213 22 225 129 1 18 226 25 79 68 143 221 214 65 77 248 255 141 14 123 148 221 139 14 239 228 161 66 200 230 161 231] ([32]uint8), got: [181 252 111 34 208 147 200 24 18 11 249 188 101 219 23 102 171 125 115 227 61 242 232 100 193 161 222 136 86 86 140 91] ([32]uint8)
--- FAIL: TestStore_NoViableHead_Liveness (1.51s)

Has this worked before in a previous version?

This has worked before this PR:
https://github.com/prysmaticlabs/prysm/pull/13464

🔬 Minimal Reproduction

bazel test --test_filter=^TestStore_NoViableHead_Liveness$ -- //beacon-chain/blockchain:go_default_test

Error

=== RUN   TestStore_NoViableHead_Liveness
    assertions.go:37: process_block_test.go:1709 Values are not equal, want: [213 22 225 129 1 18 226 25 79 68 143 221 214 65 77 248 255 141 14 123 148 221 139 14 239 228 161 66 200 230 161 231] ([32]uint8), got: [181 252 111 34 208 147 200 24 18 11 249 188 101 219 23 102 171 125 115 227 61 242 232 100 193 161 222 136 86 86 140 91] ([32]uint8)
--- FAIL: TestStore_NoViableHead_Liveness (1.51s)

### Platform(s)

_No response_

### What version of Prysm are you running? (Which release)

ddb321e0ce2736455ec38ac8be365f007851ef4b

### Anything else relevant (validator index / public key)?

_No response_
prestonvanloon commented 4 months ago

This test also fails race detection.

bazel test //beacon-chain/blockchain:go_default_test --@io_bazel_rules_go//go/config:race

...

==================
--- FAIL: TestStore_NoViableHead_Liveness (5.31s)
    testing.go:1465: race detected during execution of test
==================
WARNING: DATA RACE
Write at 0x00c05e9898e0 by goroutine 579902:
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).SetGenesisTime()
      beacon-chain/blockchain/chain_info.go:530 +0x12c
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.driftGenesisTime()
      beacon-chain/blockchain/process_block_test.go:2050 +0x113
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.TestNoViableHead_Reboot()
      beacon-chain/blockchain/process_block_test.go:1798 +0xd24
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44

Previous read at 0x00c05e9898e0 by goroutine 585218:
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).CurrentSlot()
      beacon-chain/blockchain/process_block_helpers.go:32 +0x3c
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).IsOptimistic()
      beacon-chain/blockchain/chain_info.go:346 +0x4c
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).notifyNewHeadEvent()
      beacon-chain/blockchain/head.go:358 +0x204
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).saveHead.func1()
      beacon-chain/blockchain/head.go:174 +0xe7

Goroutine 579902 (running) created at:
  testing.(*T).Run()
      GOROOT/src/testing/testing.go:1648 +0x845
  testing.runTests.func1()
      GOROOT/src/testing/testing.go:2054 +0x84
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.runTests()
      GOROOT/src/testing/testing.go:2052 +0x8ad
  testing.(*M).Run()
      GOROOT/src/testing/testing.go:1925 +0xcd7
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.TestMain()
      beacon-chain/blockchain/blockchain_test.go:14 +0x98
  main.main()
      bazel-out/k8-fastbuild-ST-706e0ec5d234/bin/beacon-chain/blockchain/go_default_test_/testmain.go:459 +0x5cb

Goroutine 585218 (running) created at:
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).saveHead()
      beacon-chain/blockchain/head.go:173 +0x244a
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).forkchoiceUpdateWithExecution()
      beacon-chain/blockchain/forkchoice_update_execution.go:101 +0x284
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).sendFCU()
      beacon-chain/blockchain/forkchoice_update_execution.go:67 +0x1a8
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).postBlockProcess()
      beacon-chain/blockchain/process_block.go:106 +0xea4
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.TestNoViableHead_Reboot()
      beacon-chain/blockchain/process_block_test.go:1812 +0xc51
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44

Example: test.log