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

[crash] unhandled exception IndexError when parsing ProposerSlashing #1323

Closed
pventuzelo opened this issue Jul 14, 2020 · 2 comments
Closed

Comments

@pventuzelo
Copy link

pventuzelo commented Jul 14, 2020

This bug has been found by the community using beacon-fuzz and reported in our repository here.

Kudos to @Daft-Wullie for the finding !!

Please, find some extra information below for debugging ;)

Download: crash_index_numbus.zip

Crash

Traceback (most recent call last, using override)
/home/scop/Documents/consulting/sigmaprime/nim-beacon-chain/vendor/nim-confutils/confutils.nim(1020) confutils
/home/scop/Documents/consulting/sigmaprime/nim-beacon-chain/ncli/ncli_query.nim(24) CLI
/home/scop/Documents/consulting/sigmaprime/nim-beacon-chain/vendor/nimbus-build-system/vendor/Nim/lib/system/excpt.nim(407) reportUnhandledError
/home/scop/Documents/consulting/sigmaprime/nim-beacon-chain/vendor/nimbus-build-system/vendor/Nim/lib/system/excpt.nim(358) reportUnhandledErrorAux
Error: unhandled exception: index -4703124616608923521 not in 0 .. 255 [IndexError]

Reproducing code:

import
  confutils, os, strutils, chronicles, json_serialization,
  ../beacon_chain/spec/crypto,
  ../beacon_chain/spec/datatypes,
  ../beacon_chain/spec/digest,
  ../beacon_chain/spec/validator,
  ../beacon_chain/spec/beaconstate,
  ../beacon_chain/spec/state_transition_block,
  ../beacon_chain/ssz,
  ../beacon_chain/extras,
  ../beacon_chain/spec/state_transition,
  ../beacon_chain/eth2_discovery

cli do(beacon: string, container: string):
  try :
    var b = SSZ.loadFile(beacon, BeaconState)
    var c = SSZ.loadFile(container, ProposerSlashing)
    var cache = get_empty_per_epoch_cache()
    discard process_proposer_slashing(b, c, {}, cache)
  except SSZError:
    quit 1
  quit 0

Compilation:

./env.sh nim c -r -d:release -d:ETH2_SPEC="v0.12.1" -d:BLS_ETH2_SPEC="v0.12.x" -d:preset=mainnet debug.nim

Run:

./debug --beacon=beacon.ssz  --container=propo.ssz

branch: "devel"
commit: a82c38d

@tersec
Copy link
Contributor

tersec commented Jul 14, 2020

As a small note,

-d:ETH2_SPEC="v0.12.1" -d:BLS_ETH2_SPEC="v0.12.x"

Isn't necessary anymore since we've switched to being v0.12.1-only. It's harmless, so feel free to include it if you'd prefer, but arguably excluding it makes it clearer that one is, in fact, dealing with the default configuration, and not some exotic/untested combinatoin.

@tersec
Copy link
Contributor

tersec commented Jul 15, 2020

Fixed by #1325

@tersec tersec closed this as completed Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants