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

Added versioning #35

Merged
merged 5 commits into from
Oct 5, 2018
Merged

Added versioning #35

merged 5 commits into from
Oct 5, 2018

Conversation

vbuterin
Copy link
Contributor

@vbuterin vbuterin commented Oct 3, 2018

No description provided.

@@ -455,7 +460,7 @@ For each one of these attestations:
* Let `attestation_indices` be `get_shards_and_committees_for_slot(crystallized_state, slot)[x]`, choosing `x` so that `attestation_indices.shard_id` equals the `shard_id` value provided to find the set of validators that is creating this attestation record.
* Verify that `len(attester_bitfield) == ceil_div8(len(attestation_indices))`, where `ceil_div8 = (x + 7) // 8`. Verify that bits `len(attestation_indices)....` and higher, if present (i.e. `len(attestation_indices)` is not a multiple of 8), are all zero
* Derive a group public key by adding the public keys of all of the attesters in `attestation_indices` for whom the corresponding bit in `attester_bitfield` (the ith bit is `(attester_bitfield[i // 8] >> (7 - (i %8))) % 2`) equals 1
* Verify that `aggregate_sig` verifies using the group pubkey generated and `hash(slot.to_bytes(8, 'big') + parent_hashes + shard_id + shard_block_hash + justified_slot.to_bytes(8, 'big'))` as the message.
* Let `version = pre_fork_version if slot < fork_slot_number else post_fork_version`. Verify that `aggregate_sig` verifies using the group pubkey generated and `hash(slot.to_bytes(8, 'big') + parent_hashes + shard_id + shard_block_hash + justified_slot.to_bytes(8, 'big'))` as the message.
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to add version to the msg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry! Just fixed.

@djrtwo
Copy link
Contributor

djrtwo commented Oct 3, 2018

@vbuterin There has been a discussion around defining the attestation message as an SSZ datastructure so we can remove any ambiguities in the generation of this message (big vs little endian, data type sizes, etc).

I think this is a good idea.

Thoughts?

@vbuterin
Copy link
Contributor Author

vbuterin commented Oct 4, 2018

Sounds good to me.

@vbuterin
Copy link
Contributor Author

vbuterin commented Oct 4, 2018

@djrtwo
Copy link
Contributor

djrtwo commented Oct 4, 2018

@paulhauner -- we are going with SSZ for serializing attestation signed data. Thanks for the suggestion

@@ -455,7 +474,8 @@ For each one of these attestations:
* Let `attestation_indices` be `get_shards_and_committees_for_slot(crystallized_state, slot)[x]`, choosing `x` so that `attestation_indices.shard_id` equals the `shard_id` value provided to find the set of validators that is creating this attestation record.
* Verify that `len(attester_bitfield) == ceil_div8(len(attestation_indices))`, where `ceil_div8 = (x + 7) // 8`. Verify that bits `len(attestation_indices)....` and higher, if present (i.e. `len(attestation_indices)` is not a multiple of 8), are all zero
* Derive a group public key by adding the public keys of all of the attesters in `attestation_indices` for whom the corresponding bit in `attester_bitfield` (the ith bit is `(attester_bitfield[i // 8] >> (7 - (i %8))) % 2`) equals 1
* Verify that `aggregate_sig` verifies using the group pubkey generated and `hash(slot.to_bytes(8, 'big') + parent_hashes + shard_id + shard_block_hash + justified_slot.to_bytes(8, 'big'))` as the message.
* Let `version = pre_fork_version if slot < fork_slot_number else post_fork_version`.
* Verify that `aggregate_sig` verifies using the group pubkey generated and the serialized form of `AttestationSignedData(version, slot, parent_hashes, shard_id, shard_block_hash, crystallized_state.last_justified_slot)` as the message.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be attestation.justified_slot not crystallized_state.last_justified_slot. We've already checked to see that the attestation.justified_slot < crystallized_state.last_justified_slot so we are good to just pass in the attestation.justified_slot.

So we can just right justified_slot here

@djrtwo
Copy link
Contributor

djrtwo commented Oct 4, 2018

One more correction @vbuterin

@hwwhww
Copy link
Contributor

hwwhww commented Oct 4, 2018

link: #5

@djrtwo
Copy link
Contributor

djrtwo commented Oct 4, 2018

Should be attestation.justified_slot.
I'm going to fix and handle merge conflict

@djrtwo djrtwo merged commit 0304e5f into master Oct 5, 2018
@djrtwo djrtwo deleted the vitalik3 branch October 5, 2018 00:02
Copy link

@pegahcarter pegahcarter left a comment

Choose a reason for hiding this comment

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

@vbuterin ,

I wanted to reach out to you in an unconventional way. I'm a passionate programmer in the Consensys bootcamp and I want to learn the mathematical approach. How can a programmer escape the repetitive conditional statements of code to learn the complex computations that shape code?

Sincerely,
Carter

hwwhww pushed a commit that referenced this pull request Jul 23, 2020
hwwhww pushed a commit that referenced this pull request Jul 23, 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

Successfully merging this pull request may close these issues.

4 participants