Giter Site home page Giter Site logo

Comments (7)

vbuterin avatar vbuterin commented on July 20, 2024 2

Sorry accidentally fat fingered as a commit instead of a PR, but here's a simple solution: fe74c7e

from consensus-specs.

terencechain avatar terencechain commented on July 20, 2024 1

Sgtm!

from consensus-specs.

djrtwo avatar djrtwo commented on July 20, 2024

Proposed implementation --

  • move randao_mix to CrystallizedState
  • store array of size CYCLE_LENGTH in active_state. These values are each initialized to 0x00 * 32 . Call it pending_randao_reveals
  • when processing a block, check the validity of the reveal.
  • during state recalc, for each slot in (last_state_recalc, last_state_recalc + CYCLE_LENGTH - 1)
    • if active_state.pending_randao_reveals[slot] != 0x00 *32
      • let proposer_index be the proposer index from the shuffling related to the slot
      • `crystallized_state.randao_mix = xor(crystallized_state.randao_mix, active_state.pending_randao_reveals[slot])
      • crystallized_state.validators[proposer_index].randao_commitment = active_state.pending_randao_reveals[slot]
  • after a state recalc, set active_state.pending_randao_reveals to be CYCLE_LENGTH 0x00 hashes
  • after doing all state recalcs, set active_state.pending_randao_reveals[block.slot % CYCLE_LENGTH] = block.randao_reveal

Note that setting the pending_randao_reveals for the current block happens after state recalcs. This is to handle the case when a block is at (or after) the slot that triggers a state recalc. If we want too keep the size of pending_randao_reveals fix, then we have to do this trick.

There is an alternative method that would do appends and truncates like recent_block_hashes where we fill in missing slots with 0x00 whenever slots are skipped. Need to consider which I prefer..

from consensus-specs.

djrtwo avatar djrtwo commented on July 20, 2024

cc: @JustinDrake

from consensus-specs.

terencechain avatar terencechain commented on July 20, 2024

Do we need randao_mix? or can we just use dynasty_seed?

Also during dynasty transition, we should do the following:
crystallized_state.dynasty_seed = crystallized_state.randao_mix
shard_and_committee_for_slots[CYCLE_LENGTH:] = get_new_shuffling(crystallized_state.randao_mix, validators, next_start_shard)

from consensus-specs.

vbuterin avatar vbuterin commented on July 20, 2024

I'd say use the term randao_mix instead of dynasty_seed. #61 removes all references of the word "dynasty" entirely.

from consensus-specs.

hwwhww avatar hwwhww commented on July 20, 2024

@terenc3t @vbuterin is it okay to close this issue by fe74c7e?

from consensus-specs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.