-
Notifications
You must be signed in to change notification settings - Fork 140
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
Use upstream account packages #678
Conversation
e102e7c
to
79bcc2d
Compare
79bcc2d
to
1635994
Compare
@@ -426,7 +426,7 @@ type syncVMSetup struct { | |||
serverAppSender *enginetest.Sender | |||
|
|||
includedAtomicTxs []*Tx | |||
fundedAccounts map[*keystore.Key]*types.StateAccount | |||
fundedAccounts map[*utils.Key]*types.StateAccount |
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.
Since one of the fields in utils.Key
is a pointer, this doesn't guarantee uniqueness. Is that ok?
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.
It seems okay as randomly generated keys would likely not be duplicate and this change does not modify this part of the behavior
@@ -116,7 +116,7 @@ func fillAccountsWithStorage(t *testing.T, serverDB ethdb.Database, serverTrieDB | |||
// returns the new trie root and a map of funded keys to StateAccount structs. | |||
func FillAccountsWithOverlappingStorage( | |||
t *testing.T, trieDB *triedb.Database, root common.Hash, numAccounts int, numOverlappingStorageRoots int, | |||
) (common.Hash, map[*keystore.Key]*types.StateAccount) { | |||
) (common.Hash, map[*utils.Key]*types.StateAccount) { |
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.
See earlier re unique keys.
PrivateKey *ecdsa.PrivateKey | ||
} | ||
|
||
func NewKey(rand io.Reader) (*Key, error) { |
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.
Why accept the reader if it's always crypto/rand.Reader
(at least in the code I can see)? I understand wanting stable keys in tests, but it doesn't look like that's being done and this risks someone may accidentally pass a non-secure source.
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 think this is fine since it's the same in the existing code it was adapted from and also in ecdsa.GenerateKey
Additionally it's recommended to receive interfaces in golang as opposed to concrete types
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.
receive interfaces in golang as opposed to concrete types
I mean not receive anything at all and just use crypto/rand.Reader
inside the function. I'm happy with whatever you decide here—consider my original question as just a prompt to spur thinking.
Why this should be merged
Less code to maintain.
How this works
Since we took types.Transaction, some more interfaces can be unified, and we can drop this code from our codebase.
How this was tested
CI