-
Notifications
You must be signed in to change notification settings - Fork 284
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
fix non-determistic fakenet validator key with Go 1.20 #428
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b0b8dc7
fix non-determistic fakenet validator key with Go 1.20
hadv 7e568dc
verify fakenet flag in all places
hadv 0c13c10
generate 100 deterministic keys for fakenet from old version of golang
hadv 7ead489
move gnerated keys into the function
hadv 37a3601
better index
hadv cb9dcd7
panic if n is too large
hadv 58accb3
Revert "forbid building with go1.20 or newer"
hadv 7108f72
polish the error messgae
hadv ac4a50b
small refactor as per review comment
hadv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change the type of
n
touint
to satisfy your condition at L211 asn
can not be negative. I think, there is an idiomatic way to declare multiple variables insideFakeKey
like that:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I write code to generate this code segment so didn't notice this
idx.ValidatorID
type actually isuint32
to I changed the type ofn
touint32
as wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if these will work:
var seed = []byte("163f5f0f9a621d72fedd85ffca3d08d131ab4e812181e0d30ffd1c885d20aac73144c0aa4ced56dc15c79b045bc5559a5ac9");
.......
// FakeKey gets n-th fake private key.
func FakeKey(n uint32) *ecdsa.PrivateKey {
if n == 0 || n > 100 {
panic(errors.New("validator num is out of range"))
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it might work but we want to keep the fakekey as same as when running below code on old version of golang. So we pre-generated all the first 100 keys from old version of golang and hardcode into the source like that.