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

Bls v0.10.1 #780

Merged
merged 13 commits into from
Mar 13, 2020
Merged

Bls v0.10.1 #780

merged 13 commits into from
Mar 13, 2020

Conversation

mratsim
Copy link
Contributor

@mratsim mratsim commented Mar 4, 2020

This updates the BLS implementation to the Eth2 spec v0.10.1 and should unblock the remaining work on naive aggregation #497 and honest validator #758.

At the moment:

  • it updates crypto.nim and all call to bls.Sign, bls.Verify. In particular the API changed, we don't pass privkey + hash_tree_root(data) + domain, we compute the domain, then derive the signing root from data + domain and then sign with privkey+signing root.
    This was made mechanically for the block pool / validator pool and the mocking procedures in testing and checked against v0.10.1 for the spec parts (i.e. part of the validator_pool got specced out in the honest validator document, proc name to be updated)
  • BLS test vectors against the EF are not present, it would just be copy-pasting this file (possibly with the crypto.nim wrappers): https://github.com/status-im/nim-blscurve/blob/master/tests/eth2_vectors.nim. This can be done at the same time as the v0.10.2 test vectors that will have fixes for [Ready for review - Pending fix of upstream vectors] Update BLS signature scheme to draft standard nim-blscurve#36 (comment)
  • The test_interop.nim files has been deactivated from testing since there is no updated interop state for v0.10 (either the mocked start https://github.com/ethereum/eth2.0-pm/tree/master/interop/mocked_start or Zcli/Zrnt) and the deposit signatures after this PR are incompatible with v0.9.x deposit signatures.
  • Domain is now defined in nim-beacon-chain and not in blscurve repo
  • The BLS bench update is left as a future TODO

TODO:

@mratsim mratsim requested a review from tersec March 4, 2020 21:56
@mratsim
Copy link
Contributor Author

mratsim commented Mar 4, 2020

Jenkins has a different error instead of a stack smashing: https://ci.status.im/blue/organizations/jenkins/nimbus%2Fnim-beacon-chain%2Fprs/detail/PR-780/2/pipeline/68

image

if skipValidation notin flags and
not blsFastAggregateVerify(
pubkeys, signing_root.data, indexed_attestation.signature
):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the possible apparent cause of a couple of EF test vector failures. Hopefully, it improves things.

)
let signing_root = compute_signing_root(msg, domain)

return bls_sign(privkey, signing_root.data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could omit return to get better warnings from Nim, perhaps.

Copy link
Contributor

@tersec tersec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some mostly cosmetic/TODO-type quibbles, but definitely an improvement on the status quo, and worth merging once it passes CI, and generally works (finalizes in make eth2_network_simulation, etc which I've not yet tried on this branch).

y = init(ValidatorSig, x.getBytes())

# Silly serialization check that fails without the right import
check: x == y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely no idea, but I removed getBytes (and init but quickly reintroduced it).

It may have been related to the generic sandwich or init template ordering: status-im/nim-stew#9

result.point.inf()
# TODO: remove fully if the comment below is not true anymore and
# and we don't need this workaround
# # TODO bls_verify_multiple(...) used to have this workaround, and now it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in theory the way this is called, we shouldn't -- when I last checked all this a couple weeks ago, the way the new BLS code is called is explicit in listing the key pairs, pre-aggregation, so doesn't need evidently fragile/high-assumption tricks like this.

# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/bls_signature.md#bls_aggregate_pubkeys
func bls_aggregate_pubkeys*(keys: openArray[ValidatorPubKey]): ValidatorPubKey =
keys.combine()
func shortLog*(x: BlsValue): string =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there value in adding the equivalent https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/ or so spec references (or, IETF spec references, as appropriate), maybe? That's always a tradeoff, since when it's either otherwise adequately tested, or quite static once written, sometimes it's a net loss in code maintainability to have a URL that just needs to be updated with no real ROI. It can still be useful to catch stray outdated code easily.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -15,24 +15,19 @@ func get_eth1data_stub*(deposit_count: uint64, current_epoch: Epoch): Eth1Data =
block_hash: hash_tree_root(hash_tree_root(voting_period).data),
)

when ValidatorPrivKey is BlsValue:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is related to the local private key storage, this might be an instance of what @zah discussed as excessive specialization on a design which should be regardless decoupled. If so, maybe note as such.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was when we were hesitating between using the raw private keys and being able to handle fake blobs, especially due to testing faking the BLS stuff.

@mratsim
Copy link
Contributor Author

mratsim commented Mar 10, 2020

So the stack smashing happens in GCC but not with Clang.

backtrace:

image

This is when compiling mock_validator_keys even when forcing heap alloc via

proc genMockPrivKeys(privkeys: var array[MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, ValidatorPrivKey]) =
  for pk in privkeys.mitems():
    let pair = newKeyPair()
    pk = pair.priv

proc genMockPubKeys(
       pubkeys: var array[MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, ValidatorPubKey],
       privkeys: array[MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, ValidatorPrivKey]
     ) =
  for idx, privkey in privkeys:
    pubkeys[idx] = pubkey(privkey)

# TODO: Ref array necessary to use a proc to avoid stack smashing in ECP_BLS381_mul (see gdb)
var MockPrivKeys*: ref array[MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, ValidatorPrivKey]
new MockPrivKeys
genMockPrivKeys(MockPrivKeys[])

var MockPubKeys*: ref array[MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, ValidatorPubKey]
new MockPubKeys
genMockPubKeys(MockPubKeys[], MockPrivKeys[])

From https://github.com/status-im/nim-beacon-chain/blob/ca3db46caaefed5d3f4c4d3b3b1c96363ff0431d/tests/mocking/mock_validator_keys.nim#L11-L33

@mratsim
Copy link
Contributor Author

mratsim commented Mar 10, 2020

Changing to indexing doesn't work either

let MockPrivKeys* = block:
  var privkeys: array[MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, ValidatorPrivKey]
  for i in 0 ..< privkeys.len:
    let pair = newKeyPair()
    privkeys[i] = pair.priv
  privkeys

let MockPubKeys* = block:
  var pubkeys: array[MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, ValidatorPubKey]
  for i in 0 ..< MockPrivKeys.len:
    pubkeys[i] = pubkey(MockPrivKeys[i])
  pubkeys

So it doesn't like an instance of: nim-lang/Nim#12747

Furthermore while I thought clang doesn't have issue, I get several invalid keys generated
Edit: unrelated, was editing in/out too many sources
(r: 0xc pubkeys are the zero pubkeys when input is invalid)
image

@mratsim
Copy link
Contributor Author

mratsim commented Mar 12, 2020

The Jenkins failure is due to a serialization problem, either import issue or a missing save/write/encode to make the BLS objects serialize as Milagro instead of as hex

image

@mratsim
Copy link
Contributor Author

mratsim commented Mar 12, 2020

Don't merge, yet another stack smashing issue.

@mratsim
Copy link
Contributor Author

mratsim commented Mar 12, 2020

Repro: This only happens with GCC even with Clang ASAN.
(This assumes that you have local testnet data initialized)

nim c --verbosity:0 --hints:off --warnings:off --passC:-fsanitize=address --passL:"-fsanitize=address" -o:build/beacon_node_asan beacon_chain/beacon_node
build/beacon_node_asan --nat:extip:127.0.0.1 --data-dir=local_testnet_data/node0 --state-snapshot=local_testnet_data/network_dir/genesis.ssz
DBG 2020-03-12 15:54:34+01:00 Launching beacon node                      topics="beacnde" tid=425847 file=beacon_node.nim:1067 cmdParams="@[\"--nat:extip:127.0.0.1\", \"--data-dir=local_testnet_data/node0\", \"--state-snapshot=local_testnet_data/network_dir/genesis.ssz\"]" config="(logLevel: DEBUG, eth1Network: goerli, quickStart: false, dataDir: ..., depositWeb3Url: \"\", depositContractAddress: \"\", statusBarEnabled: true, statusBarContents: \"peers: $connected_peers; epoch: $epoch, slot: $epoch_slot/$slots_per_epoch ($slot); finalized epoch: $last_finalized_epoch |ETH: $attached_validators_balance\", cmd: noCommand, bootstrapNodes: @[], bootstrapNodesFile: ..., tcpPort: 9000, udpPort: 9000, maxPeers: 10, nat: \"extip:127.0.0.1\", validators: ..., stateSnapshot: ..., nodeName: \"\", verifyFinalization: false, stopAtEpoch: 0, metricsServer: false, metricsServerAddress: \"0.0.0.0\", metricsServerPort: 8008, dump: false)" version="0.3.0 (b2faac7, libp2p_daemon)"
=================================================================
==425847==ERROR: AddressSanitizer: unknown-crash on address 0x7ffffedbff34 at pc 0x56551f1fe7bb bp 0x7ffffedbf610 sp 0x7ffffedbf600
READ of size 8 at 0x7ffffedbff34 thread T0
    #0 0x56551f1fe7ba in markStackAndRegisters__U6T7JWtDLrWhtmhXSoy9a6g /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc_common.nim:384
    #1 0x56551f1d6627 in collectCTBody__XHio9cMpnLoH7GyCj1Z9besg_2 /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc.nim:761
    #2 0x56551f1d7301 in collectCT__XHio9cMpnLoH7GyCj1Z9besg /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc.nim:791
    #3 0x56551f1d7301 in collectCT__XHio9cMpnLoH7GyCj1Z9besg /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc.nim:783
    #4 0x56551f1d7301 in rawNewObj__ehkAaLROrd0Hc9aLROWt1nQ /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc.nim:410
    #5 0x56551f1d7d48 in newObj /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc.nim:439
    #6 0x56551f20ca82 in newSeq /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc.nim:446
    #7 0x56551f22c030 in X5BX5D___Kyr39aNcnXyqz84UZKlCSJw /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system.nim:4035
    #8 0x56551fb0fd8e in readSszValue__w9aS9aE8BVplkv1tC8lBQL6w /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/ssz/bytes_reader.nim:179
    #9 0x56551fb12065 in readSszValue__rSpCWKBALjLzIa5owySR2g /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/ssz/bytes_reader.nim:173
    #10 0x56551fb4b9ad in readValue__Dnt4a4Q6T9b0g0bHpux2EQg /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/ssz.nim:271
    #11 0x56551f73c945 in readValue__pp7RseE3YPW7yjdpxp5fBw /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-serialization/serialization.nim:46
    #12 0x56551fc15343 in colonanonymous___HLyxqEyZBgpXzMNB9aOgTZg /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-serialization/serialization.nim:84
    #13 0x56551f8e789f in get__2orZGoWx1FV9aZ2Y7pc8stw /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/kvstore_sqlite3.nim:41
    #14 0x56551f8e04ae in getImpl__pkLE4RhJEI2lUXcD0TP0jw /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/kvstore.nim:75
    #15 0x56551fc1e75f in get__LvgDxgZdCspOdIxiGGiIww /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/beacon_chain_db.nim:103
    #16 0x56551fc1f74d in getBlock__IRmGPemCFxe9cjYlQRZXBqg /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/beacon_chain_db.nim:117
    #17 0x56551fc50733 in isInitialized__GJGHDeG79bLYCU6BOuX7ffg /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/block_pool.nim:895
    #18 0x56552051755a in init__LOpexeSSOxNbrTjyAhR0Ug /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/beacon_node.nim:138
    #19 0x5655205012a7 in init_continue__qaUgwi9ac1c3nQ4kFVQx6iA /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-chronos/chronos/asyncmacro2.nim:36
    #20 0x565520524233 in init__RL3oocYUW6UZZfuNc8BkSA /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-chronos/chronos/asyncmacro2.nim:65
    #21 0x56552056fe57 in NimMainModule /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/beacon_node.nim:1158
    #22 0x56552057714e in NimMain /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-eth/eth/common/eth_types.nim:594
    #23 0x56551ed92c3c in main /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-eth/eth/common/eth_types.nim:601
    #24 0x7fef5567d022 in __libc_start_main (/usr/lib/libc.so.6+0x27022)
    #25 0x56551ed92ccd in _start (/home/beta/Programming/Status/nim-beacon-chain/build/beacon_node_asan+0x166ccd)

Address 0x7ffffedbff34 is located in stack of thread T0 at offset 2228 in frame
    #0 0x56551f1fa83f in markStackAndRegisters__U6T7JWtDLrWhtmhXSoy9a6g /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc.nim:683

  This frame has 26 object(s):
    [32, 72) 'FR_'
    [112, 152) 'FR_'
    [192, 232) 'FR_'
    [272, 312) 'FR_'
    [352, 392) 'FR_'
    [432, 472) 'FR_'
    [512, 552) 'FR_'
    [592, 632) 'FR_'
    [672, 712) 'FR_'
    [752, 792) 'FR_'
    [832, 872) 'FR_'
    [912, 952) 'FR_'
    [992, 1032) 'FR_'
    [1072, 1112) 'FR_'
    [1152, 1192) 'FR_'
    [1232, 1272) 'FR_'
    [1312, 1352) 'FR_'
    [1392, 1432) 'FR_'
    [1472, 1512) 'FR_'
    [1552, 1592) 'FR_'
    [1632, 1672) 'FR_'
    [1712, 1752) 'FR_'
    [1792, 1832) 'FR_'
    [1872, 1912) 'FR_'
    [1952, 1992) 'FR_'
    [2032, 2232) 'registers' (line 683) <== Memory access at offset 2228 partially overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: unknown-crash /home/beta/.choosenim/toolchains/nim-1.0.6/lib/system/gc_common.nim:384 in markStackAndRegisters__U6T7JWtDLrWhtmhXSoy9a6g
Shadow bytes around the buggy address:
  0x10007fdaff90: f2 f2 00 00 00 00 00 f2 f2 f2 f2 f2 00 00 00 00
  0x10007fdaffa0: 00 f2 f2 f2 f2 f2 00 00 00 00 00 f2 f2 f2 f2 f2
  0x10007fdaffb0: 00 00 00 00 00 f2 f2 f2 f2 f2 00 00 00 00 00 f2
  0x10007fdaffc0: f2 f2 f2 f2 00 00 00 00 00 f2 f2 f2 f2 f2 00 00
  0x10007fdaffd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x10007fdaffe0: 00 00 00 00 00 00[00]f3 f3 f3 f3 f3 f3 f3 f3 f3
  0x10007fdafff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fdb0000: 00 00 00 00 00 00 f1 f1 f1 f1 f8 f8 f8 f8 f8 f2
  0x10007fdb0010: f2 f2 f2 f2 f8 f8 f8 f8 f8 f2 f2 f2 f2 f2 f8 f8
  0x10007fdb0020: f8 f8 f8 f2 f2 f2 f2 f2 00 00 00 00 00 f2 f2 f2
  0x10007fdb0030: f2 f2 00 00 00 00 00 f2 f2 f2 f2 f2 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==425847==ABORTING

image
image

@mratsim
Copy link
Contributor Author

mratsim commented Mar 12, 2020

Previous repro was missing some env variables from env.sh

Here is one with Clang that should be more relevant, it's once again an issue in ECP_mul however the seckey here should be lesser than the curve order:

image

beta ~/Programming/Status/nim-beacon-chain [bls-v0.10.1] $   [Nimbus env]$ nim c --cc:clang -d:release --import:libbacktrace --verbosity:0 --hints:off --warnings:off --passC:-fsanitize=address --passL:"-fsanitize=address" -o:build/beacon_node_asan beacon_chain/beacon_node
beta ~/Programming/Status/nim-beacon-chain [bls-v0.10.1] $   [Nimbus env]$ build/beacon_node_asan --nat:extip:127.0.0.1 --data-dir=local_testnet_data/node0 --state-snapshot=local_testnet_data/network_dir/genesis.ssz INF 2020-03-12 17:01:34+01:00 Initializing networking                    tid=455949 file=eth2_network.nim:148 announcedAddresses=@[/ip4/127.0.0.1/tcp/9000] bootstrapNodes=@[] hostAddress=/ip4/0.0.0.0/tcp/9000
Control socket: /unix/tmp/nim-p2pd-455949-1.sock
Peer ID: 16Uiu2HAm6wkfwKLZor7HvwGbR14n6b7GH7ZjwUj385XpvUHBQmmS
Peer Addrs:
/ip4/127.0.0.1/tcp/9000
INF 2020-03-12 17:01:34+01:00 LibP2P daemon started                      tid=455949 file=eth2_network.nim:179 addresses=@[/ip4/127.0.0.1/tcp/9000] peer=16Uiu2HAm6wkfwKLZor7HvwGbR14n6b7GH7ZjwUj385XpvUHBQmmS
INF 2020-03-12 17:01:34+01:00 Waiting for connections                    topics="beacnde" tid=455949 file=beacon_node.nim:252
INF 2020-03-12 17:01:34+01:00 Starting beacon node                       topics="beacnde" tid=455949 file=beacon_node.nim:909 SECONDS_PER_SLOT=6 SLOTS_PER_EPOCH=8 SPEC_VERSION=0.10.1 cat=init dataDir=local_testnet_data/node0 finalizedRoot=5668f217 finalizedSlot=0 headRoot=5668f217 headSlot=0 pcs=start_beacon_node timeSinceFinalization=-697 version="0.3.0 (b2faac7, libp2p_daemon)"
 peers: 0 ❯ epoch: 14, slot: 4/8 (116) ❯ finalized epoch: 0 (5668f217)                                                                                                                                                       ETH: 0 Entering privToPub
  seckey: 000000000000000000000000000000005b136035599c4233c2de3ed4e2eb78f1e3bf40cd550b333dc050695878b49075
  pubkey: 8a8ce89d5ae099ca6d86c8a25d6f1dc8b5c1d455cd5483699910ada7c9607f568bf5b6971495a99325fe73dc3dd17c6e
Exiting privToPub
WRN 2020-03-12 17:01:34+01:00 Validator not in registry (yet?)           topics="beacnde" tid=455949 file=beacon_node.nim:273 pubKey="real: 0x8a8ce89d5ae099ca6d86c8a25d6f1dc8b5c1d455cd5483699910ada7c9607f568bf5b6971495a99325fe73dc3dd17c6e"
INF 2020-03-12 17:01:34+01:00 Local validator attached                   tid=455949 file=validator_pool.nim:21 pubKey="real: 0x8a8ce89d5ae099ca6d86c8a25d6f1dc8b5c1d455cd5483699910ada7c9607f568bf5b6971495a99325fe73dc3dd17c6e" validator="real: 0x"
 peers: 0 ❯ epoch: 14, slot: 4/8 (116) ❯ finalized epoch: 0 (5668f217)                                                                                                                                                       ETH: 0 Entering privToPub
  seckey: 00000000000000000000000000000000292bcd8b78ffc85782ed9c1052f581cca2c96d80a3c46c2bc1527b3cf188022b
=================================================================
==455949==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffee6397547 at pc 0x5599be05e791 bp 0x7ffee6396a70 sp 0x7ffee6396a68
WRITE of size 1 at 0x7ffee6397547 thread T0
    #0 0x5599be05e790 in ECP_BLS381_mul /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-blscurve/blscurve/csources/64/ecp_BLS381.c:1105:13
    #1 0x5599be450163 in mul__8dasrHsBDivosc1xoLwN9aQcommon /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-blscurve/blscurve/common.nim:297:2
    #2 0x5599be450163 in privToPub__SbUVL7n9atErGXu7gDCy72Q /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-blscurve/blscurve/bls_signature_scheme.nim:99:2
    #3 0x5599be452cae in pubKey__HCx9cqWY5g0ZVsIUBYuD9cVA /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/spec/crypto.nim:101:20
    #4 0x5599be71bcab in addLocalValidator__cSSHpZxKVcAbxlaA9bLXQsQ /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/beacon_node.nim:267:11
    #5 0x5599be71da3e in addLocalValidators__l9bqvDlqEn0zFromo2S35YQ /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/beacon_node.nim:279:13
    #6 0x5599be73047d in start__ZJSNFUSOl2Ftt60X6ooHFQ_2 /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/beacon_node.nim:929:2
    #7 0x5599be73a26e in NimMainModule /home/beta/Programming/Status/nim-beacon-chain/beacon_chain/beacon_node.nim:1172:4
    #8 0x5599be73c63a in NimMain /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-eth/eth/common/eth_types.nim:595:2
    #9 0x5599be73c63a in main /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-eth/eth/common/eth_types.nim:602:2
    #10 0x7faa19960022 in __libc_start_main (/usr/lib/libc.so.6+0x27022)
    #11 0x5599bdaf25fd in _start (/home/beta/Programming/Status/nim-beacon-chain/build/beacon_node_asan+0x15f5fd)

Address 0x7ffee6397547 is located in stack of thread T0 at offset 2759 in frame
    #0 0x5599be05e0bf in ECP_BLS381_mul /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-blscurve/blscurve/csources/64/ecp_BLS381.c:1022

  This frame has 7 object(s):
    [32, 224) 'NQ.i' (line 985)
    [288, 344) 'mt' (line 1059)
    [384, 440) 't' (line 1059)
    [480, 672) 'Q' (line 1060)
    [736, 2272) 'W' (line 1060)
    [2400, 2592) 'C' (line 1060)
    [2656, 2759) 'w' (line 1061) <== Memory access at offset 2759 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /home/beta/Programming/Status/nim-beacon-chain/vendor/nim-blscurve/blscurve/csources/64/ecp_BLS381.c:1105:13 in ECP_BLS381_mul
Shadow bytes around the buggy address:
  0x10005cc6ae50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10005cc6ae60: 00 00 00 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2
  0x10005cc6ae70: f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 00 00 00 00
  0x10005cc6ae80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10005cc6ae90: 00 00 00 00 f2 f2 f2 f2 f2 f2 f2 f2 00 00 00 00
=>0x10005cc6aea0: 00 00 00 00 00 00 00 00[07]f3 f3 f3 f3 f3 f3 f3
  0x10005cc6aeb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10005cc6aec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10005cc6aed0: f1 f1 f1 f1 f8 f8 f8 f8 f8 f8 f2 f2 f2 f2 00 00
  0x10005cc6aee0: f2 f2 00 00 f2 f2 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
  0x10005cc6aef0: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f3 f3
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==455949==ABORTING

@tersec tersec merged commit 04234bf into devel Mar 13, 2020
@delete-merged-branch delete-merged-branch bot deleted the bls-v0.10.1 branch March 13, 2020 12:20
@mratsim mratsim added this to the Mar 2020 milestone Apr 1, 2020
etan-status added a commit to etan-status/nimbus-eth2 that referenced this pull request Dec 9, 2021
In status-im#780 a test was disabled that verified that an attestation with
empty `aggregation_bits` completes successfully. The test was never
re-introduced, and as of the current consensus spec v1.1.6, such
attestations are not considered valid, as they fail the check in
`is_valid_indexed_attestation`. This patch fully removes that outdated
test, and moves it to the list of pending invalid attestation tests.
arnetheduck pushed a commit that referenced this pull request Dec 9, 2021
In #780 a test was disabled that verified that an attestation with
empty `aggregation_bits` completes successfully. The test was never
re-introduced, and as of the current consensus spec v1.1.6, such
attestations are not considered valid, as they fail the check in
`is_valid_indexed_attestation`. This patch fully removes that outdated
test, and moves it to the list of pending invalid attestation tests.
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

Successfully merging this pull request may close these issues.

2 participants