question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reduce max length of signature in vote message

See original GitHub issue

Issue

Vote messages must be less that or equal 1024 bytes, defined by the type in the vote method signature. When parsing the signature of the vote from the vote message, we currently only enforce that the signature too is less than or equal to 1024 bytes.

https://github.com/ethereum/casper/blob/d5aed932634e28ab90d31facc6d9944be1a5d426/casper/contracts/simple_casper.v.py#L402

Due to the variable amount of bytes required to encode the other elements in the list, there is a range on the maximum length of a signature depending on the epoch or even the validator_index. To enforce more strict requirements, we propose restricting sig to length less than or equal to 934 bytes. This number assumes the other elements of the vote message take their maximal length to encode.

1024 bytes available 3 to encode the whole list 17 worst case to encode an int128 33 to encode the bytes32 hash 3 to encode the signature bytes

1024 - 3 - 17*3 - 33 - 3 == 934 bytes max for signature

Sanity checked with the following python code

import rlp
validator_index = target_epoch = source_epoch = 2**128 - 1
sig = b'\xff' * 934
target_hash = b'\xff' * 32
len(rlp.encode([validator_index, target_hash, target_epoch, source_epoch, sig])) == 1024

Note, the logout message has fewer elements so the signature could theoretically be larger than 934 for this action, but to reduce complexity, 934 should be used for logout messages as well.

Proposed Implementation

  • Define MAX_SIGNATURE_LENGTH as 934
  • Enforce sig as <= MAX_SIGNATURE_LENGTH in vote, slash, and logout
  • tests.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:29 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
djrtwocommented, May 24, 2018

Cool I just saw that the VIP got approved. Congrats!

1reaction
vs77bbcommented, May 25, 2018

@mkeen @djrtwo Just 10-day-snoozed Gitcoin Bot, appreciate the request and patience as we work out the kinks 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Asked Questions - California Secretary of State
In order to change your political party preference, you must re-register to vote. You can re-register to vote by completing a voter registration...
Read more >
Voting Outside the Polling Place: Absentee, All-Mail and other ...
Most states offer at least one method for any eligible voter to cast a ballot before Election Day. While some states provide early...
Read more >
Two of These Mail Ballot Signatures Are by the Same Person ...
How election officials vet voter signatures based on slants, sizes and loops.
Read more >
SIGNATURE VERIFICATION GUIDE - Arizona Secretary of State
of voting by mail. This Guide will help those reviewing ballot affidavit signatures determine whether the ballot affidavit signature and the voter's ...
Read more >
Gmail email signature too long message
Please try a shorter signature. Here's what we suggest you do. Count the number of characters in your email signature's HTML code. If ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found