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
Initial wallet keys #5709
Initial wallet keys #5709
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## feat/test-only-processor-node #5709 +/- ##
=================================================================
- Coverage 78.89% 78.88% -0.01%
=================================================================
Files 729 729
Lines 95721 95769 +48
=================================================================
+ Hits 75516 75551 +35
- Misses 14846 14859 +13
Partials 5359 5359 ☔ View full report in Codecov by Sentry. |
ShardWallets: make(map[uint32]*dtos.WalletKey), | ||
} | ||
|
||
initialAddressWithStake, err := generateWalletKeyForShard(0, args.NumOfShards, addressConverter) |
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.
might extract the 0 into a const. Something like: walletShardIdForStake
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.
added
} | ||
|
||
balanceForAddress := big.NewInt(0).Set(walletBalance) | ||
if shardID == args.NumOfShards-1 { |
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.
this can be taken out of the for loop and moved after the for finishes:
firstShardBalance := initialWalletKeys.ShardWallets[0].Balance
firstShardBalance.Add(firstShardBalance, remainder)
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.
refactored
|
||
return &dtos.WalletKey{ | ||
Address: address, | ||
PrivateKeyHex: hex.EncodeToString(privateKeyBytes[:32]), |
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.
is the trim really necessary?
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, because the part[32:len(privateKeyBytes]
contains the public key bytes
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.
but it doesn't matter, anyway
} | ||
|
||
// InitialWalletKeys holds the initial wallet keys | ||
type InitialWalletKeys struct { |
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.
👍
}) | ||
|
||
initialWalletKeys.ShardWallets[shardID] = walletKey | ||
} | ||
|
||
addresses[1].Balance.Add(walletBalance, remainder) | ||
addresses[1].Supply.Add(walletBalance, remainder) |
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.
👍
Reasoning behind the pull request
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?