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

Add explicit bounds for ssz decoding in rpc #1250

Merged
merged 12 commits into from
Jun 12, 2020

Conversation

pawanjay176
Copy link
Member

@pawanjay176 pawanjay176 commented Jun 5, 2020

Issue Addressed

ethereum/consensus-specs#1800
Also contains spec updates from #1244 to avoid double work.

Proposed Changes

  • Computes ssz size bounds for variable sized ssz containers used in RPC (SignedBeaconBlock and BlocksByRootRequest)
  • Check size bounds before ssz decoding

Note: The spec also mentions the following validation check

The unsigned protobuf varint used for the length-prefix MUST not be longer than 10 bytes, which is sufficient for any uint64.

This PR does not contain this check as any length prefix > 10 bytes would error at the Uvi codec length decoding anyway. Adding this check explicitly will simply complicate the logic.

* Update milagro_bls to new release

Signed-off-by: Kirk Baird <baird.k@outlook.com>

* Tidy up fake cryptos

Signed-off-by: Kirk Baird <baird.k@outlook.com>

* move SecretHash to bls and put plaintext back

Signed-off-by: Kirk Baird <baird.k@outlook.com>
@pawanjay176 pawanjay176 added the ready-for-review The code is ready for review label Jun 9, 2020
@AgeManning AgeManning changed the base branch from network-v0.12 to spec-v0.12 June 11, 2020 02:04
Copy link
Member

@AgeManning AgeManning left a comment

Choose a reason for hiding this comment

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

This seems to build on top of #1837. I will wait for this to merge before reviewing

@AgeManning AgeManning changed the base branch from spec-v0.12 to network-v0.12 June 12, 2020 00:08
@AgeManning AgeManning changed the base branch from network-v0.12 to spec-v0.12 June 12, 2020 00:09
@AgeManning AgeManning removed blocked ready-for-review The code is ready for review labels Jun 12, 2020
use types::{BeaconBlock, EthSpec, Hash256, MainnetEthSpec, Signature, SignedBeaconBlock};

lazy_static! {
pub static ref SIGNED_BEACON_BLOCK_MIN: usize = SignedBeaconBlock::<MainnetEthSpec> {
Copy link
Member Author

Choose a reason for hiding this comment

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

@AgeManning is it okay here that I'm sorta hardcoding MainnetEthSpec? I couldn't figure out how to keep it generic over EthSpec.

Copy link
Member

Choose a reason for hiding this comment

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

This looks fine to me.
Add a comment indicating we are doing this and that the MAX/MIN values are the same across each spec type

@AgeManning AgeManning merged commit 1a4de89 into sigp:spec-v0.12 Jun 12, 2020
@paulhauner paulhauner mentioned this pull request Jun 16, 2020
22 tasks
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.

None yet

4 participants