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

Rename 'slot' to 'slot_number' #544

Closed
wants to merge 1 commit into from
Closed

Conversation

tarasbob
Copy link
Contributor

@tarasbob tarasbob commented Feb 1, 2019

I think this makes it clearer and explicit. The word "slot" alone intuitively feels like we are referring to some kind of object instead of a number.

@hwwhww
Copy link
Contributor

hwwhww commented Feb 1, 2019

@tarasbob could you change to against dev branch?

I remember that we discussed it when we renamed GENESIS_SLOT_NUMBER to GENESIS_SLOT. (/cc @JustinDrake) Personally, I'm fine with slot. 😅

@tarasbob tarasbob changed the base branch from master to dev February 1, 2019 07:57
@tarasbob
Copy link
Contributor Author

tarasbob commented Feb 1, 2019

I was just reading the spec and trying to understand it. It feels to me that adding the explicit word "number" makes it easier to understand for people who are not familiar with the spec. (For example, it reminds the reader that there are many slots, one after another. Especially since "slot" is a new term, I don't think it's used in Eth 1.0 or other blockchains afaik.)

The same reasoning could apply to renaming shard to shard_number.

@paulhauner
Copy link
Contributor

paulhauner commented Feb 1, 2019

I respectfully disagree with this change:

  1. It's overly verbose. The definition of slot in BeaconChain states clearly it is a uint64. I think it's fair to assume that a uint64 is a number, unless it's being used as a bitfield (see justification_bitfield).
  2. It's a slippery slope. One could start to argue that total_balance should be total_balance_number to ensure you're not refering to a TotalBalance struct. Futhermore, beacon_block_root could become beacon_block_root_bytes.
  3. It's going to require 8+ implementation teams to refactor their code bases.

With regards to shard, I find it unlikely that there's going to be an object called Shard.

@JustinDrake
Copy link
Collaborator

JustinDrake commented Feb 1, 2019

We're going the other direction 😂and removing Number from the SlotNumber, EpochNumber, ShardNumber types #534

It's going to require 8+ implementation teams to refactor their code bases.

The good news is that naming is not technically part of the spec. The spec merely tries to make a sane suggestion. Implementers can use slot_number internally if they want!

@paulhauner
Copy link
Contributor

paulhauner commented Feb 1, 2019

The good news is that naming is not technically part of the spec. The spec merely tries to make a sane suggestion. Implementers can use slot_number internally if they want!

Is the ordering of fields in the SSZ list still lexicographic? If so, spec name changes can potentially affect implementations.

EDIT: Additionally, keeping naming the same as the spec really helps with cross-referencing whenever the spec changes. Personally, I would change our variable names to match the spec. I speak from experience because my first beacon chain impl used different function names and it was very difficult to track changes. But you're right, 8+ teams aren't "required" to refactor.

@djrtwo
Copy link
Contributor

djrtwo commented Feb 2, 2019

@paulhauner Ordering of ssz fields is based upon ordering in defined datastructure rather than lexicographical. Implementations can name whatever they want (although following spec a decent amount will aid in readability).

@paulhauner
Copy link
Contributor

@paulhauner Ordering of ssz fields is based upon ordering in defined datastructure rather than lexicographical. Implementations can name whatever they want (although following spec a decent amount will aid in readability).

Great, I think this is a good call. I remember it being lexicographic at one stage, but I might be making that up. Lighthouse is using the order they're defined.

@djrtwo
Copy link
Contributor

djrtwo commented Feb 2, 2019

It did use to be lexicographic!
New way is better for sure.

@djrtwo
Copy link
Contributor

djrtwo commented Feb 2, 2019

Closing. I think using Slot as one of the custom types (seed #534) will make this clear enough and not add verbosity.

@djrtwo djrtwo closed this Feb 2, 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 this pull request may close these issues.

5 participants