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

[Interop] get_compact_committees_root / get_crosslink_committee issue #378

Closed
mratsim opened this issue Sep 4, 2019 · 2 comments · Fixed by #380
Closed

[Interop] get_compact_committees_root / get_crosslink_committee issue #378

mratsim opened this issue Sep 4, 2019 · 2 comments · Fixed by #380

Comments

@mratsim
Copy link
Contributor

mratsim commented Sep 4, 2019

While investing active_index_root and compact_committee_root SSZ issue (#373 (comment)), I found an issue beyond SSZ serialization on get_compat_committees_root or get_crosslink_committees.

Reproduction

Setup

Python

Instruction at https://github.com/ethereum/eth2.0-specs/tree/db34ee17b63d2856f15f9182a803eeca5495c9f1/test_libs/pyspec
I suggest the venv.

Assuming you are at the root of eth2.0-specs directory
Once in the env, edit ./test_libs/pyspec/eth2spec/spec.py witht he desired debug information

Comment out all irrelevant tests in ./test_libs/test/phase_0/epoch_processing/test_process_final_updates.py. Only keep the last one

@with_all_phases
@spec_state_test
def test_compact_committees_root(spec, state):
    assert spec.SLOTS_PER_ETH1_VOTING_PERIOD > spec.SLOTS_PER_EPOCH
    # skip ahead to the end of the epoch
    state.slot = spec.SLOTS_PER_EPOCH - 1

    next_epoch = spec.get_current_epoch(state) + 1

    # ensure that order in which items are processed in final_updates
    # does not alter the expected_root
    expected_root = spec.get_compact_committees_root(state, next_epoch)
    yield from run_process_final_updates(spec, state)

    assert state.compact_committees_roots[next_epoch % spec.EPOCHS_PER_HISTORICAL_VECTOR] == expected_root

Run

python -m pytest -s --config=minimal eth2spec/test/phase_0/epoch_processing/test_process_final_updates.py

Nim

In ./tests/official create a file myfile.nim with an accompanying myfile.nim.cfg, the cfg contains -d:ssz_testing which is necessary as the EF provided signatures are not on the BLS curve

The Nim file is a simple modification of test_fixture_state_transition_epoch.nim to focus on SszTestsDir/const_preset/"phase0"/"epoch_processing"/"final_updates"/"pyspec_tests"/"compact_committees_root" unittest.

import
  # Standard library
  os, unittest, strutils,
  # Beacon chain internals
  ../../beacon_chain/spec/[datatypes, validator, state_transition_epoch],
  # Test utilities
  ../testutil,
  ./fixtures_utils,
  ../helpers/debug_state

import ../../beacon_chain/spec/[beaconstate, digest]
const FinalUpdatesDir = SszTestsDir/const_preset/"phase0"/"epoch_processing"/"final_updates"/"pyspec_tests"
var stateRef, postRef: ref BeaconState
new stateRef
# new postRef
stateRef[] = parseTest(FinalUpdatesDir/"compact_committees_root"/"pre.ssz", SSZ, BeaconState)
# postRef[] = parseTest(FinalUpdatesDir/"compact_committees_root"/"post.ssz", SSZ, BeaconState)

echo "compact_committee_root: ", get_compact_committees_root(stateRef[], Epoch(1))

Run

nim c -r -o:build/myfile tests/official/myfile.nim

Debug code

I've added the following code to get_compact_committees_root() for debugging

Python

./test_libs/pyspec/eth2spec/spec.py line 619

def get_compact_committees_root(state: BeaconState, epoch: Epoch) -> Hash:
    """
    Return the compact committee root at ``epoch``.
    """
    print(f'state.hash_tree_root() at beginning of get_compact_committees_root: {hash_tree_root(state).hex()}')
    print(f'Epoch: {epoch}')
    committees = [CompactCommittee() for _ in range(SHARD_COUNT)]
    start_shard = get_start_shard(state, epoch)
    print(f'start_shard: {start_shard}')
    print(f'committees_count: {get_committee_count(state, epoch)}')
    for committee_number in range(get_committee_count(state, epoch)):
        shard = Shard((start_shard + committee_number) % SHARD_COUNT)
        for index in get_crosslink_committee(state, epoch, shard):
            validator = state.validators[index]
            committees[shard].pubkeys.append(validator.pubkey)
            compact_balance = validator.effective_balance // EFFECTIVE_BALANCE_INCREMENT
            # `index` (top 6 bytes) + `slashed` (16th bit) + `compact_balance` (bottom 15 bits)
            compact_validator = uint64((index << 16) + (validator.slashed << 15) + compact_balance)
            committees[shard].compact_validators.append(compact_validator)
            print(f'index: {index}, compact_validator: {compact_validator}, pubkey: {validator.pubkey.hex()}')

    vec_committees = Vector[CompactCommittee, SHARD_COUNT](committees)
    result = hash_tree_root(vec_committees)
    # print(f'\nstate hash_tree_root before compact_committee: {hash_tree_root(state).hex()}')
    # print(f'vec_committees: {vec_committees}')
    # print(f'vec_committees hash: {result.hex()}')
    print('\n')
    return result

Nim

./beacon_chain/spec/beaconstate line 179

func get_compact_committees_root*(state: BeaconState, epoch: Epoch): Eth2Digest =
  # Return the compact committee root at ``epoch``.
  debugEcho "state.hash_tree_root() at the beginning of get_compact_committeees_root: ", hash_tree_root(state)
  debugEcho "epoch: ", epoch

  # TODO if profiling shows this as expensive, plumb through properly
  var cache = get_empty_per_epoch_cache()

  var committees : array[SHARD_COUNT, CompactCommittee]
  let start_shard = get_start_shard(state, epoch)
  debugEcho "start_shard: ", start_shard
  debugEcho "committees_count: ", get_committee_count(state, epoch)
  for committee_number in 0'u64 ..< get_committee_count(state, epoch):
    let shard = (start_shard + committee_number) mod SHARD_COUNT
    for index in get_crosslink_committee(state, epoch, shard, cache):
      let validator = state.validators[index]
      committees[shard.int].pubkeys.add(validator.pubkey)
      let
        compact_balance =
          validator.effective_balance div EFFECTIVE_BALANCE_INCREMENT

        # `index` (top 6 bytes) + `slashed` (16th bit) + `compact_balance`
        # (bottom 15 bits)
        compact_validator =
          uint64((index.uint64 shl 16) + (validator.slashed.uint64 shl 15) +
            compact_balance)
      committees[shard.int].compact_validators.add(compact_validator)
      debugEcho "index: ", index, ", compact_validator: ", compact_validator, ", pubkey: ", validator.pubkey

  debugEcho "\n"
  hash_tree_root(committees)

Traces

Python

Note that there are 2 invocations in python, one is because it's saving the expected result of get_compact_committees_root before the full epoch transition, only look at the second.

state.hash_tree_root() at beginning of process_final_updates: e219017c5d2f6b6bcccdc71f6583c38640c7275218dec0ec586bed43ec5bc6c0
state.hash_tree_root() at beginning of get_compact_committees_root: e219017c5d2f6b6bcccdc71f6583c38640c7275218dec0ec586bed43ec5bc6c0
Epoch: 1
start_shard: 7
committees_count: 8
index: 9, compact_validator: 589856, pubkey: af81da25ecf1c84b577fefbedd61077a81dc43b00304015b2b596ab67f00e41c86bb00ebd0f90d4b125eb0539891aeed
index: 48, compact_validator: 3145760, pubkey: a3caedb9c2a5d8e922359ef69f9c35b8c819bcb081610343148dc3a2c50255c9caa6090f49f890ca31d853384fc80d00
index: 53, compact_validator: 3473440, pubkey: 8f021f52cbd6c46979619100350a397154df00cae2efe72b22ad0dd66747d7de4beecd9b194d0f7016e4df460a63a8ea
index: 40, compact_validator: 2621472, pubkey: ae5163dc807af48bc827d2fd86b7c37de5a364d0d504c2c29a1b0a243601016b21c0fda5d0a446b9cb2a333f0c08ab20
index: 39, compact_validator: 2555936, pubkey: 96413b2d61a9fc6a545b40e5c2e0064c53418f491a25994f270af1b79c59d5cf21d2e8c58785a8df09e7265ac975cb28
index: 43, compact_validator: 2818080, pubkey: 95fa3538b8379ff2423656ab436df1632b74311aaef49bc9a3cbd70b1b01febaf2f869b4127d0e8e6d18d7d919f1f6d8
index: 51, compact_validator: 3342368, pubkey: 8fbdab59d6171f31107ff330af9f2c1a8078bb630abe379868670c61f8fa5f05a27c78f6a1fd80cde658417ef5d6a951
index: 27, compact_validator: 1769504, pubkey: b6ad11e5d15f77c1143b1697344911b9c590110fdd8dd09df2e58bfd757269169deefe8be3544d4e049fb3776fb0bcfb
index: 28, compact_validator: 1835040, pubkey: 8515e7f61ca0470e165a44d247a23f17f24bf6e37185467bedb7981c1003ea70bbec875703f793dd8d11e56afa7f74ba
index: 33, compact_validator: 2162720, pubkey: 9446407bcd8e5efe9f2ac0efbfa9e07d136e68b03c5ebc5bde43db3b94773de8605c30419eb2596513707e4e7448bb50
index: 37, compact_validator: 2424864, pubkey: 82d333a47c24d4958e5b07be4abe85234c5ad1b685719a1f02131a612022ce0c726e58d52a53cf80b4a8afb21667dee1
index: 41, compact_validator: 2687008, pubkey: 8ce3b57b791798433fd323753489cac9bca43b98deaafaed91f4cb010730ae1e38b186ccd37a09b8aed62ce23b699c48
index: 35, compact_validator: 2293792, pubkey: 90c0c1f774e77d9fad044aa06009a15e33941477b4b9a79fa43f327608a0a54524b3fcef0a896cb0df790e9995b6ebf1
index: 36, compact_validator: 2359328, pubkey: 8f207bd83dad262dd9de867748094f7141dade78704eca74a71fd9cfc9136b5278d934db83f4f3908d7a3de84d583fc9
index: 52, compact_validator: 3407904, pubkey: 83798f4dcc27c08dcd23315bee084a9821f39eed4c35ef45ba5079de93e7cf49633eea6d0f30b20c252c941f615f6ccb
index: 31, compact_validator: 2031648, pubkey: a72841987e4f219d54f2b6a9eac5fe6e78704644753c3579e776a3691bc123743f8c63770ed0f72a71e9e964dbf58f43
index: 32, compact_validator: 2097184, pubkey: aed3e9f4bb4553952b687ba7bcac3a5324f0cceecc83458dcb45d73073fb20cef4f9f0c64558a527ec26bad9a42e6c4c
index: 34, compact_validator: 2228256, pubkey: a60d5589316a5e16e1d9bb03db45136afb9a3d6e97d350256129ee32a8e33396907dc44d2211762967d88d3e2840f71b
index: 61, compact_validator: 3997728, pubkey: 8d8be92bde8af1b9df13d5a8ed8a3a01eab6ee4cf883d7987c1d78c0d7d9b53a8630541fddf5e324b6cf4900435b1df8
index: 10, compact_validator: 655392, pubkey: 80fd75ebcc0a21649e3177bcce15426da0e4f25d6828fbf4038d4d7ed3bd4421de3ef61d70f794687b12b2d571971a55
index: 20, compact_validator: 1310752, pubkey: 9780e853f8ce7eda772c6691d25e220ca1d2ab0db51a7824b700620f7ac94c06639e91c98bb6abd78128f0ec845df8ef
index: 54, compact_validator: 3538976, pubkey: 89db41a6183c2fe47cf54d1e00c3cfaae53df634a32cccd5cf0c0a73e95ee0450fc3d060bb6878780fbf5f30d9e29aac
index: 44, compact_validator: 2883616, pubkey: a65a82f7b291d33e28dd59d614657ac5871c3c60d1fb89c41dd873e41c30e0a7bc8d57b91fe50a4c96490ebf5769cb6b
index: 23, compact_validator: 1507360, pubkey: 9717182463fbe215168e6762abcbb55c5c65290f2b5a2af616f8a6f50d625b46164178a11622d21913efdfa4b800648d
index: 14, compact_validator: 917536, pubkey: 8d9e19b3f4c7c233a6112e5397309f9812a4f61f754f11dd3dcb8b07d55a7b1dfea65f19a1488a14fef9a41495083582
index: 8, compact_validator: 524320, pubkey: 99cdf3807146e68e041314ca93e1fee0991224ec2a74beb2866816fd0826ce7b6263ee31e953a86d1b72cc2215a57793
index: 56, compact_validator: 3670048, pubkey: b57520f5150ed646e8c26a01bf0bd15a324cc66fa8903f33fa26c3b4dd16b9a7c5118fdac9ee3eceba5ff2138cdce8f0
index: 15, compact_validator: 983072, pubkey: a73eb991aa22cdb794da6fcde55a427f0a4df5a4a70de23a988b5e5fc8c4d844f66d990273267a54dd21579b7ba6a086
index: 58, compact_validator: 3801120, pubkey: 98536b398e5b7f1276f7cb426fba0ec2b8b0b64fba7785ea528bebed6ae56c0dee59f5d295fa4c97a1c621ecacfc4ec3
index: 5, compact_validator: 327712, pubkey: a6e82f6da4520f85c5d27d8f329eccfa05944fd1096b20734c894966d12a9e2a9a9744529d7212d33883113a0cadb909
index: 6, compact_validator: 393248, pubkey: b928f3beb93519eecf0145da903b40a4c97dca00b21f12ac0df3be9116ef2ef27b2ae6bcd4c5bc2d54ef5a70627efcb7
index: 49, compact_validator: 3211296, pubkey: af3dc44695d2a7f45dbe8b21939d5b4015ed1697131184ce19fc6bb8ff6bbc23882348b4c86278282dddf7d718e72e2b
index: 42, compact_validator: 2752544, pubkey: 8f81b19ee2e4d4d0ff6384c63bacb785bc05c4fc22e6f553079cc4ff7e0270d458951533458a01d160b22d59a8bd9ab5
index: 26, compact_validator: 1703968, pubkey: ab83dfefb120fab7665a607d749ef1765fbb3cc0ba5827a20a135402c09d987c701ddb5b60f0f5495026817e8ab6ea2e
index: 25, compact_validator: 1638432, pubkey: 81ccc19e3b938ec2405099e90022a4218baa5082a3ca0974b24be0bc8b07e5fffaed64bef0d02c4dbfb6a307829afc5c
index: 17, compact_validator: 1114144, pubkey: 9252a4ac3529f8b2b6e8189b95a60b8865f07f9a9b73f98d5df708511d3f68632c4c7d1e2b03e6b1d1e2c01839752ada
index: 7, compact_validator: 458784, pubkey: a85ae765588126f5e860d019c0e26235f567a9c0c0b2d8ff30f3e8d436b1082596e5e7462d20f5be3764fd473e57f9cf
index: 22, compact_validator: 1441824, pubkey: 8c8b694b04d98a749a0763c72fc020ef61b2bb3f63ebb182cb2e568f6a8b9ca3ae013ae78317599e7e7ba2a528ec754a
index: 59, compact_validator: 3866656, pubkey: b783a70a1cf9f53e7d2ddf386bea81a947e5360c5f1e0bf004fceedb2073e4dd180ef3d2d91bee7b1c5a88d1afd11c49
index: 16, compact_validator: 1048608, pubkey: b098f178f84fc753a76bb63709e9be91eec3ff5f7f3a5f4836f34fe8a1a6d6c5578d8fd820573cef3a01e2bfef3eaf3a
index: 11, compact_validator: 720928, pubkey: 8345dd80ffef0eaec8920e39ebb7f5e9ae9c1d6179e9129b705923df7830c67f3690cbc48649d4079eadf5397339580c
index: 38, compact_validator: 2490400, pubkey: 8e04ad5641cc0c949935785184c0b0237977e2282742bc0f81e58a7aa9bfee694027b60de0db0de0539a63d72fd57760
index: 13, compact_validator: 852000, pubkey: 99bef05aaba1ea467fcbc9c420f5e3153c9d2b5f9bf2c7e2e7f6946f854043627b45b008607b9a9108bb96f3c1c089d3
index: 63, compact_validator: 4128800, pubkey: 911bb496153aa457e3302ea8e74427962c6eb57e97096f65cafe45a238f739b86d4b790debd5c7359f18f3642d7d774c
index: 21, compact_validator: 1376288, pubkey: ab48aa2cc6f4a0bb63b5d67be54ac3aed10326dda304c5aeb9e942b40d6e7610478377680ab90e092ef1895e62786008
index: 60, compact_validator: 3932192, pubkey: 912b440c4d3c8177a012cea1cc58115cbc6795afc389363c7769bf419b9451bcde764586cf26c15e9906ea54837d031a
index: 62, compact_validator: 4063264, pubkey: 86d386aaf3dff5b9331ace79f6e24cff8759e7e002bbe9af91c6de91ab693f6477551e7ee0a1e675d0fc614814d8a8aa
index: 19, compact_validator: 1245216, pubkey: a272e9d1d50a4aea7d8f0583948090d0888be5777f2846800b8281139cd4aa9eee05f89b069857a3e77ccfaae1615f9c
index: 55, compact_validator: 3604512, pubkey: 951f3707389db5012848b67ab77b63da2a73118b7df60f087fa9972d8f7fef33ed93e5f25268d4237c2987f032cd613f
index: 46, compact_validator: 3014688, pubkey: 8fc502abb5d8bdd747f8faf599b0f62b1c41145d30ee3b6ff1e52f9370240758eac4fdb6d7fb45ed258a43edebf63e96
index: 24, compact_validator: 1572896, pubkey: acb58c81ae0cae2e9d4d446b730922239923c345744eee58efaadb36e9a0925545b18a987acf0bad469035b291e37269
index: 45, compact_validator: 2949152, pubkey: b2a3cedd685176071a98ab100494628c989d65e4578eec9c5919f2c0321c3fc3f573b71ef81a76501d88ed9ed6c68e13
index: 4, compact_validator: 262176, pubkey: b0e7791fb972fe014159aa33a98622da3cdc98ff707965e536d8636b5fcc5ac7a91a8c46e59a00dca575af0f18fb13dc
index: 50, compact_validator: 3276832, pubkey: 8aea7d8eb22063bcfe882e2b7efc0b3713e1a48dd8343bed523b1ab4546114be84d00f896d33c605d1f67456e8e2ed93
index: 57, compact_validator: 3735584, pubkey: aa14e001d092db9dc99746fcfc22cd84a74adaa8fc483e6abf697bd8a93bda2ee9a075aca303f97f59615ed4e8709583
index: 47, compact_validator: 3080224, pubkey: 931bea4bc76fad23ba9c339622ddc0e7d28904a71353c715363aa9e038f64e990ef6ef76fc1fc431b9c73036dd07b86c
index: 2, compact_validator: 131104, pubkey: 89ece308f9d1f0131765212deca99697b112d61f9be9a5f1f3780a51335b3ff981747a0b2ca2179b96d2c0c9024e5224
index: 30, compact_validator: 1966112, pubkey: b29043a7273d0a2dbc2b747dcf6a5eccbd7ccb44b2d72e985537b117929bc3fd3a99001481327788ad040b4077c47c0d
index: 1, compact_validator: 65568, pubkey: a572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e
index: 18, compact_validator: 1179680, pubkey: b271205227c7aa27f45f20b3ba380dfea8b51efae91fd32e552774c99e2a1237aa59c0c43f52aad99bba3783ea2f36a4
index: 0, compact_validator: 32, pubkey: 97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb
index: 29, compact_validator: 1900576, pubkey: ad84464b3966ec5bede84aa487facfca7823af383715078da03b387cc2f5d5597cdd7d025aa07db00a38b953bdeb6e3f
index: 3, compact_validator: 196640, pubkey: ac9b60d5afcbd5663a8a44b7c5a02f19e9a77ab0a35bd65809bb5c67ec582c897feb04decc694b13e08587f3ff9b5b60
index: 12, compact_validator: 786464, pubkey: 851f8a0b82a6d86202a61cbc3b0f3db7d19650b914587bde4715ccd372e1e40cab95517779d840416e1679c84a6db24e


.

Nim

state.hash_tree_root() at the beginning of get_compact_committeees_root: E219017C5D2F6B6BCCCDC71F6583C38640C7275218DEC0EC586BED43EC5BC6C0
epoch: 1
start_shard: 7
committees_count: 8
index: 25, compact_validator: 1638432, pubkey: r:81ccc19e3b938ec2405099e90022a4218baa5082a3ca0974b24be0bc8b07e5fffaed64bef0d02c4dbfb6a307829afc5c
index: 11, compact_validator: 720928, pubkey: r:8345dd80ffef0eaec8920e39ebb7f5e9ae9c1d6179e9129b705923df7830c67f3690cbc48649d4079eadf5397339580c
index: 15, compact_validator: 983072, pubkey: r:a73eb991aa22cdb794da6fcde55a427f0a4df5a4a70de23a988b5e5fc8c4d844f66d990273267a54dd21579b7ba6a086
index: 44, compact_validator: 2883616, pubkey: r:a65a82f7b291d33e28dd59d614657ac5871c3c60d1fb89c41dd873e41c30e0a7bc8d57b91fe50a4c96490ebf5769cb6b
index: 18, compact_validator: 1179680, pubkey: r:b271205227c7aa27f45f20b3ba380dfea8b51efae91fd32e552774c99e2a1237aa59c0c43f52aad99bba3783ea2f36a4
index: 30, compact_validator: 1966112, pubkey: r:b29043a7273d0a2dbc2b747dcf6a5eccbd7ccb44b2d72e985537b117929bc3fd3a99001481327788ad040b4077c47c0d
index: 41, compact_validator: 2687008, pubkey: r:8ce3b57b791798433fd323753489cac9bca43b98deaafaed91f4cb010730ae1e38b186ccd37a09b8aed62ce23b699c48
index: 54, compact_validator: 3538976, pubkey: r:89db41a6183c2fe47cf54d1e00c3cfaae53df634a32cccd5cf0c0a73e95ee0450fc3d060bb6878780fbf5f30d9e29aac
index: 3, compact_validator: 196640, pubkey: r:ac9b60d5afcbd5663a8a44b7c5a02f19e9a77ab0a35bd65809bb5c67ec582c897feb04decc694b13e08587f3ff9b5b60
index: 34, compact_validator: 2228256, pubkey: r:a60d5589316a5e16e1d9bb03db45136afb9a3d6e97d350256129ee32a8e33396907dc44d2211762967d88d3e2840f71b
index: 57, compact_validator: 3735584, pubkey: r:aa14e001d092db9dc99746fcfc22cd84a74adaa8fc483e6abf697bd8a93bda2ee9a075aca303f97f59615ed4e8709583
index: 21, compact_validator: 1376288, pubkey: r:ab48aa2cc6f4a0bb63b5d67be54ac3aed10326dda304c5aeb9e942b40d6e7610478377680ab90e092ef1895e62786008
index: 49, compact_validator: 3211296, pubkey: r:af3dc44695d2a7f45dbe8b21939d5b4015ed1697131184ce19fc6bb8ff6bbc23882348b4c86278282dddf7d718e72e2b
index: 28, compact_validator: 1835040, pubkey: r:8515e7f61ca0470e165a44d247a23f17f24bf6e37185467bedb7981c1003ea70bbec875703f793dd8d11e56afa7f74ba
index: 5, compact_validator: 327712, pubkey: r:a6e82f6da4520f85c5d27d8f329eccfa05944fd1096b20734c894966d12a9e2a9a9744529d7212d33883113a0cadb909
index: 55, compact_validator: 3604512, pubkey: r:951f3707389db5012848b67ab77b63da2a73118b7df60f087fa9972d8f7fef33ed93e5f25268d4237c2987f032cd613f
index: 19, compact_validator: 1245216, pubkey: r:a272e9d1d50a4aea7d8f0583948090d0888be5777f2846800b8281139cd4aa9eee05f89b069857a3e77ccfaae1615f9c
index: 43, compact_validator: 2818080, pubkey: r:95fa3538b8379ff2423656ab436df1632b74311aaef49bc9a3cbd70b1b01febaf2f869b4127d0e8e6d18d7d919f1f6d8
index: 12, compact_validator: 786464, pubkey: r:851f8a0b82a6d86202a61cbc3b0f3db7d19650b914587bde4715ccd372e1e40cab95517779d840416e1679c84a6db24e
index: 35, compact_validator: 2293792, pubkey: r:90c0c1f774e77d9fad044aa06009a15e33941477b4b9a79fa43f327608a0a54524b3fcef0a896cb0df790e9995b6ebf1
index: 45, compact_validator: 2949152, pubkey: r:b2a3cedd685176071a98ab100494628c989d65e4578eec9c5919f2c0321c3fc3f573b71ef81a76501d88ed9ed6c68e13
index: 31, compact_validator: 2031648, pubkey: r:a72841987e4f219d54f2b6a9eac5fe6e78704644753c3579e776a3691bc123743f8c63770ed0f72a71e9e964dbf58f43
index: 52, compact_validator: 3407904, pubkey: r:83798f4dcc27c08dcd23315bee084a9821f39eed4c35ef45ba5079de93e7cf49633eea6d0f30b20c252c941f615f6ccb
index: 2, compact_validator: 131104, pubkey: r:89ece308f9d1f0131765212deca99697b112d61f9be9a5f1f3780a51335b3ff981747a0b2ca2179b96d2c0c9024e5224
index: 50, compact_validator: 3276832, pubkey: r:8aea7d8eb22063bcfe882e2b7efc0b3713e1a48dd8343bed523b1ab4546114be84d00f896d33c605d1f67456e8e2ed93
index: 24, compact_validator: 1572896, pubkey: r:acb58c81ae0cae2e9d4d446b730922239923c345744eee58efaadb36e9a0925545b18a987acf0bad469035b291e37269
index: 14, compact_validator: 917536, pubkey: r:8d9e19b3f4c7c233a6112e5397309f9812a4f61f754f11dd3dcb8b07d55a7b1dfea65f19a1488a14fef9a41495083582
index: 56, compact_validator: 3670048, pubkey: r:b57520f5150ed646e8c26a01bf0bd15a324cc66fa8903f33fa26c3b4dd16b9a7c5118fdac9ee3eceba5ff2138cdce8f0
index: 27, compact_validator: 1769504, pubkey: r:b6ad11e5d15f77c1143b1697344911b9c590110fdd8dd09df2e58bfd757269169deefe8be3544d4e049fb3776fb0bcfb
index: 42, compact_validator: 2752544, pubkey: r:8f81b19ee2e4d4d0ff6384c63bacb785bc05c4fc22e6f553079cc4ff7e0270d458951533458a01d160b22d59a8bd9ab5
index: 37, compact_validator: 2424864, pubkey: r:82d333a47c24d4958e5b07be4abe85234c5ad1b685719a1f02131a612022ce0c726e58d52a53cf80b4a8afb21667dee1
index: 32, compact_validator: 2097184, pubkey: r:aed3e9f4bb4553952b687ba7bcac3a5324f0cceecc83458dcb45d73073fb20cef4f9f0c64558a527ec26bad9a42e6c4c
index: 29, compact_validator: 1900576, pubkey: r:ad84464b3966ec5bede84aa487facfca7823af383715078da03b387cc2f5d5597cdd7d025aa07db00a38b953bdeb6e3f
index: 16, compact_validator: 1048608, pubkey: r:b098f178f84fc753a76bb63709e9be91eec3ff5f7f3a5f4836f34fe8a1a6d6c5578d8fd820573cef3a01e2bfef3eaf3a
index: 38, compact_validator: 2490400, pubkey: r:8e04ad5641cc0c949935785184c0b0237977e2282742bc0f81e58a7aa9bfee694027b60de0db0de0539a63d72fd57760
index: 4, compact_validator: 262176, pubkey: r:b0e7791fb972fe014159aa33a98622da3cdc98ff707965e536d8636b5fcc5ac7a91a8c46e59a00dca575af0f18fb13dc
index: 36, compact_validator: 2359328, pubkey: r:8f207bd83dad262dd9de867748094f7141dade78704eca74a71fd9cfc9136b5278d934db83f4f3908d7a3de84d583fc9
index: 7, compact_validator: 458784, pubkey: r:a85ae765588126f5e860d019c0e26235f567a9c0c0b2d8ff30f3e8d436b1082596e5e7462d20f5be3764fd473e57f9cf
index: 8, compact_validator: 524320, pubkey: r:99cdf3807146e68e041314ca93e1fee0991224ec2a74beb2866816fd0826ce7b6263ee31e953a86d1b72cc2215a57793
index: 23, compact_validator: 1507360, pubkey: r:9717182463fbe215168e6762abcbb55c5c65290f2b5a2af616f8a6f50d625b46164178a11622d21913efdfa4b800648d
index: 61, compact_validator: 3997728, pubkey: r:8d8be92bde8af1b9df13d5a8ed8a3a01eab6ee4cf883d7987c1d78c0d7d9b53a8630541fddf5e324b6cf4900435b1df8
index: 63, compact_validator: 4128800, pubkey: r:911bb496153aa457e3302ea8e74427962c6eb57e97096f65cafe45a238f739b86d4b790debd5c7359f18f3642d7d774c
index: 53, compact_validator: 3473440, pubkey: r:8f021f52cbd6c46979619100350a397154df00cae2efe72b22ad0dd66747d7de4beecd9b194d0f7016e4df460a63a8ea
index: 33, compact_validator: 2162720, pubkey: r:9446407bcd8e5efe9f2ac0efbfa9e07d136e68b03c5ebc5bde43db3b94773de8605c30419eb2596513707e4e7448bb50
index: 6, compact_validator: 393248, pubkey: r:b928f3beb93519eecf0145da903b40a4c97dca00b21f12ac0df3be9116ef2ef27b2ae6bcd4c5bc2d54ef5a70627efcb7
index: 10, compact_validator: 655392, pubkey: r:80fd75ebcc0a21649e3177bcce15426da0e4f25d6828fbf4038d4d7ed3bd4421de3ef61d70f794687b12b2d571971a55
index: 1, compact_validator: 65568, pubkey: r:a572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e
index: 47, compact_validator: 3080224, pubkey: r:931bea4bc76fad23ba9c339622ddc0e7d28904a71353c715363aa9e038f64e990ef6ef76fc1fc431b9c73036dd07b86c
index: 60, compact_validator: 3932192, pubkey: r:912b440c4d3c8177a012cea1cc58115cbc6795afc389363c7769bf419b9451bcde764586cf26c15e9906ea54837d031a
index: 13, compact_validator: 852000, pubkey: r:99bef05aaba1ea467fcbc9c420f5e3153c9d2b5f9bf2c7e2e7f6946f854043627b45b008607b9a9108bb96f3c1c089d3
index: 17, compact_validator: 1114144, pubkey: r:9252a4ac3529f8b2b6e8189b95a60b8865f07f9a9b73f98d5df708511d3f68632c4c7d1e2b03e6b1d1e2c01839752ada
index: 51, compact_validator: 3342368, pubkey: r:8fbdab59d6171f31107ff330af9f2c1a8078bb630abe379868670c61f8fa5f05a27c78f6a1fd80cde658417ef5d6a951
index: 59, compact_validator: 3866656, pubkey: r:b783a70a1cf9f53e7d2ddf386bea81a947e5360c5f1e0bf004fceedb2073e4dd180ef3d2d91bee7b1c5a88d1afd11c49
index: 22, compact_validator: 1441824, pubkey: r:8c8b694b04d98a749a0763c72fc020ef61b2bb3f63ebb182cb2e568f6a8b9ca3ae013ae78317599e7e7ba2a528ec754a
index: 9, compact_validator: 589856, pubkey: r:af81da25ecf1c84b577fefbedd61077a81dc43b00304015b2b596ab67f00e41c86bb00ebd0f90d4b125eb0539891aeed
index: 39, compact_validator: 2555936, pubkey: r:96413b2d61a9fc6a545b40e5c2e0064c53418f491a25994f270af1b79c59d5cf21d2e8c58785a8df09e7265ac975cb28
index: 62, compact_validator: 4063264, pubkey: r:86d386aaf3dff5b9331ace79f6e24cff8759e7e002bbe9af91c6de91ab693f6477551e7ee0a1e675d0fc614814d8a8aa
index: 40, compact_validator: 2621472, pubkey: r:ae5163dc807af48bc827d2fd86b7c37de5a364d0d504c2c29a1b0a243601016b21c0fda5d0a446b9cb2a333f0c08ab20
index: 26, compact_validator: 1703968, pubkey: r:ab83dfefb120fab7665a607d749ef1765fbb3cc0ba5827a20a135402c09d987c701ddb5b60f0f5495026817e8ab6ea2e
index: 46, compact_validator: 3014688, pubkey: r:8fc502abb5d8bdd747f8faf599b0f62b1c41145d30ee3b6ff1e52f9370240758eac4fdb6d7fb45ed258a43edebf63e96
index: 0, compact_validator: 32, pubkey: r:97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb
index: 58, compact_validator: 3801120, pubkey: r:98536b398e5b7f1276f7cb426fba0ec2b8b0b64fba7785ea528bebed6ae56c0dee59f5d295fa4c97a1c621ecacfc4ec3
index: 48, compact_validator: 3145760, pubkey: r:a3caedb9c2a5d8e922359ef69f9c35b8c819bcb081610343148dc3a2c50255c9caa6090f49f890ca31d853384fc80d00
index: 20, compact_validator: 1310752, pubkey: r:9780e853f8ce7eda772c6691d25e220ca1d2ab0db51a7824b700620f7ac94c06639e91c98bb6abd78128f0ec845df8ef


compact_committee_root: 556B867FF8012FD5B4B476C6CDC32703752EBE421033CA00A944CDAD303BC49D
@mratsim
Copy link
Contributor Author

mratsim commented Sep 4, 2019

Diving deeper into get_crosslink_committee / get_compute_committee it seems like we have a get_seed issue:

Python

state.hash_tree_root() at beginning of process_final_updates: e219017c5d2f6b6bcccdc71f6583c38640c7275218dec0ec586bed43ec5bc6c0
state.hash_tree_root() at beginning of get_compact_committees_root: e219017c5d2f6b6bcccdc71f6583c38640c7275218dec0ec586bed43ec5bc6c0
Epoch: 1
start_shard: 7
committees_count: 8
compute_committee(indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=Hash[32]: bfaf8b3f24c3e361137815d6414bfeb83e501c77552ce858a6f0e6a29c44ffa6, index=0, count=8
compute_committee: [9, 48, 53, 40, 39, 43, 51, 27]
compute_committee(indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=Hash[32]: bfaf8b3f24c3e361137815d6414bfeb83e501c77552ce858a6f0e6a29c44ffa6, index=1, count=8
compute_committee: [28, 33, 37, 41, 35, 36, 52, 31]
compute_committee(indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=Hash[32]: bfaf8b3f24c3e361137815d6414bfeb83e501c77552ce858a6f0e6a29c44ffa6, index=2, count=8
compute_committee: [32, 34, 61, 10, 20, 54, 44, 23]
compute_committee(indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=Hash[32]: bfaf8b3f24c3e361137815d6414bfeb83e501c77552ce858a6f0e6a29c44ffa6, index=3, count=8
compute_committee: [14, 8, 56, 15, 58, 5, 6, 49]
compute_committee(indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=Hash[32]: bfaf8b3f24c3e361137815d6414bfeb83e501c77552ce858a6f0e6a29c44ffa6, index=4, count=8
compute_committee: [42, 26, 25, 17, 7, 22, 59, 16]
compute_committee(indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=Hash[32]: bfaf8b3f24c3e361137815d6414bfeb83e501c77552ce858a6f0e6a29c44ffa6, index=5, count=8
compute_committee: [11, 38, 13, 63, 21, 60, 62, 19]
compute_committee(indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=Hash[32]: bfaf8b3f24c3e361137815d6414bfeb83e501c77552ce858a6f0e6a29c44ffa6, index=6, count=8
compute_committee: [55, 46, 24, 45, 4, 50, 57, 47]
compute_committee(indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=Hash[32]: bfaf8b3f24c3e361137815d6414bfeb83e501c77552ce858a6f0e6a29c44ffa6, index=7, count=8
compute_committee: [2, 30, 1, 18, 0, 29, 3, 12]

Nim

state.hash_tree_root() at the beginning of get_compact_committeees_root: E219017C5D2F6B6BCCCDC71F6583C38640C7275218DEC0EC586BED43EC5BC6C0
epoch: 1
start_shard: 7
committees_count: 8
compute_committee(indices=@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=EE8247BEBA192A2705ADE19CE757909D9AB41AC6D7CDFA9D9E625B40FFD4E9B7, index=0, count=8)
compute_committee result: @[25, 11, 15, 44, 18, 30, 41, 54]
compute_committee(indices=@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=EE8247BEBA192A2705ADE19CE757909D9AB41AC6D7CDFA9D9E625B40FFD4E9B7, index=1, count=8)
compute_committee result: @[3, 34, 57, 21, 49, 28, 5, 55]
compute_committee(indices=@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=EE8247BEBA192A2705ADE19CE757909D9AB41AC6D7CDFA9D9E625B40FFD4E9B7, index=2, count=8)
compute_committee result: @[19, 43, 12, 35, 45, 31, 52, 2]
compute_committee(indices=@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=EE8247BEBA192A2705ADE19CE757909D9AB41AC6D7CDFA9D9E625B40FFD4E9B7, index=3, count=8)
compute_committee result: @[50, 24, 14, 56, 27, 42, 37, 32]
compute_committee(indices=@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=EE8247BEBA192A2705ADE19CE757909D9AB41AC6D7CDFA9D9E625B40FFD4E9B7, index=4, count=8)
compute_committee result: @[29, 16, 38, 4, 36, 7, 8, 23]
compute_committee(indices=@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=EE8247BEBA192A2705ADE19CE757909D9AB41AC6D7CDFA9D9E625B40FFD4E9B7, index=5, count=8)
compute_committee result: @[61, 63, 53, 33, 6, 10, 1, 47]
compute_committee(indices=@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=EE8247BEBA192A2705ADE19CE757909D9AB41AC6D7CDFA9D9E625B40FFD4E9B7, index=6, count=8)
compute_committee result: @[60, 13, 17, 51, 59, 22, 9, 39]
compute_committee(indices=@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], seed=EE8247BEBA192A2705ADE19CE757909D9AB41AC6D7CDFA9D9E625B40FFD4E9B7, index=7, count=8)
compute_committee result: @[62, 40, 26, 46, 0, 58, 48, 20]


compact_committee_root: 556B867FF8012FD5B4B476C6CDC32703752EBE421033CA00A944CDAD303BC49D

@tersec
Copy link
Contributor

tersec commented Sep 4, 2019

This is tied into remaining LATEST_RANDAO_MIXES_LENGTH vs EPOCHS_PER_HISTORICAL_VECTOR issues. get_seed(...)/get_randao_mix(...)/ etc all need to be switched over from LATEST_RANDAO_MIXES_LENGTH to EPOCHS_PER_HISTORICAL_VECTOR, but that seems to create some issues.

mratsim added a commit that referenced this issue Sep 4, 2019
tersec pushed a commit that referenced this issue Sep 4, 2019
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 a pull request may close this issue.

2 participants