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

rm signing root (fixes #1487) #1491

Merged
merged 2 commits into from
Dec 5, 2019
Merged

rm signing root (fixes #1487) #1491

merged 2 commits into from
Dec 5, 2019

Conversation

protolambda
Copy link
Contributor

The reasoning for the signing-root removal can be found in #1487

This is a proposal. So far there was reasonable support expressed, but more discussion/suggestions are welcome.

Changelog:

  • Introduce signed containers:
    • DepositData already uses "data". And since we sign over a message, I think I like "msg" as general field name for the (msg, signature) type wrappers.
    • May generalize it to SignedContainer[MsgType] helper type construction. Just want to see it working first.
  • Update containers/state to use new signed and bare container types.
    • No empty zeroed signature in the state anymore
    • Operations (and things like proposer slashings) use the new signed containers.
  • DepositData is an edge case: I made a DepositMsg type to sign the contents over, replicating the exact old signature of signing root. I don't think this is much of a problem, as DepositData is not a message anyway, and within Deposit it is indeed more like data (with a proof) than a message (with a signature).
  • Improve transition function for proposers: to verify the signature apart from the bare header contents (which don't contain a signature anymore). Blocks and headers are still transparent, but can now both be wrapped in Signed variants to (block/header into msg field, and add the signature field)
    • Validator API doc is improved with this now: a minimal working function to produce a valid block state root.
    • Split previous test case into an invalid-sig and zeroed sig case, just to be sure.
    • Changed the validate_state_root to just "checked": the signature signs over the state root. It makes no sense to ignore the state root, but then enforce it partially with the signature check (testing infra previously signed twice: one dummy signature for missing state root, then the real one once the state root could be computed).
      • Also note that process_blockheader is now so clean it could have been a BeaconBlockHeader as input type. But kept it as block, as scoping it to just the header data only requires the spec to convert from normal block to header. Clients can abstract/interface this nicely how they like it (or nearly keep it as is).
  • Updated validator and network docs to account for this removal of signing root. Verbosely again to make it clear: SignedBeaconBlock.msg is a BeaconBlock, and the hash_tree_root of this BeaconBlock msg is signed over to create signature signature.
  • Testing infra improved:
    • Use new signed container types
    • always clearly state "signed_block" when it's a (msg, signature) pair.
    • hash_tree_root everywhere
    • fix signature problems with fork-choice pyspec tests (Ran full test suite with BLS forced on to catch problems, and noticed these got in, since we don't output them as vectors, and CI didn't check the BLS part of these tests)
    • No more double signature hack or just-in-time randao signature creation. Clear bare data is passed around and when signed wrapped in the appropriate signed container type.
  • no signingroot 🎉

Note: left old Phase 1 use of signing root as-is, it's changing anyway with the new PR (see #1483 )

We may want to squash this PR when merging. Or I can rebase and split the test work from the spec changes.

Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

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

  1. IMHO It’s a bit annoying to see msg/Msg instead of message/Message in the spec.
    • Reason: msg is usually coming with sig, but we use signature in the spec.
    • However, the longer name may be verbose. I'd like to hear what other people's taste is.
  2. I think the complexity of implementing this change won't be too scary and painful. Mostly many search and replace commands.

(editted)

specs/validator/0_beacon-chain-validator.md Outdated Show resolved Hide resolved
specs/validator/0_beacon-chain-validator.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_fork-choice.md Outdated Show resolved Hide resolved
@protolambda
Copy link
Contributor Author

@hwwhww renamed checked to validate_result. Two things to consider here:

  • I think it should absolutely be True by default, even if overruled elsewhere. Verification of the block signature and state root are probably the two most important things to eth2 phase0...
  • Added an unsigned-transition method in the testing machinery. Which is a clean call to process_slots, process_blocks, and done. Same thing in the validator spec for proposers to build their block. But for spec purposes, I think it's useful to highlight the option as part of the beacon chain spec itself, or alternatively we link to the validator spec which describes the transition for a proposer building its block.

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

Although I'm resistant to change, this is very good

specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
@@ -360,6 +372,13 @@ class BeaconBlockHeader(Container):
parent_root: Root
state_root: Root
body_root: Root
```

#### `SignedBeaconBlockHeader`
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's group all signed containers in a sub-section below the declaration of other containers. Let's put a brief explanatory text at the top of the sub-section

Copy link
Contributor

Choose a reason for hiding this comment

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

bump, still prefer this method. The spec building fixes topological ordering so that's fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See afb9a1d, you can change the wording if you like.

specs/validator/0_beacon-chain-validator.md Outdated Show resolved Hide resolved
specs/validator/0_beacon-chain-validator.md Outdated Show resolved Hide resolved
specs/validator/0_beacon-chain-validator.md Outdated Show resolved Hide resolved
@protolambda
Copy link
Contributor Author

Changed msg -> message and DepositMsg -> DepositMessage, and squashed the PR commits.

@arnetheduck
Copy link
Contributor

LGTM - generally, naming has been brought up as a potential area of improvement and I'd generally agree that it would be good to do a holistic rename round once something like this is merged so that there is structure to the naming (DepositMessage for example looks a bit odd)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:SSZ Simple Serialize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants