-
Notifications
You must be signed in to change notification settings - Fork 521
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
Allow 0 premined reward wallet #1776
Allow 0 premined reward wallet #1776
Conversation
76f4d92
to
317dd2d
Compare
317dd2d
to
b41ef9a
Compare
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 added a comment that needs to be fixed.
Also, one more thing that should be fixed, while I was looking at this PR, which is not directly affected by this PR, but it should be fixed since it is in regards to the reward wallet. It is the validateRewardWallet
function in command/genesis/params.go
. It doesn't validate the reward wallet flag correctly. It should do parsePremineInfo
before checking if reward wallet address is zero address.
The function should look like this:
// validateRewardWallet validates reward wallet flag
func (p *genesisParams) validateRewardWallet() error {
if p.rewardWallet == "" {
return errors.New("reward wallet address must be defined")
}
premineInfo, err := parsePremineInfo(p.rewardWallet)
if err != nil {
return err
}
if premineInfo.address == types.ZeroAddress {
return errors.New("reward wallet address must not be zero address")
}
if premineInfo.amount.Cmp(big.NewInt(0)) < 1 {
return errRewardWalletAmountZero
}
return nil
}
Or check if the epochReward
is 0 and rewardTokenCode
is an empty string, then just don't validate the reward wallet at all.
@goran-ethernal Thanks - for the latter comment I went with leaving the epoch reward check after zero addr check to be safe |
Description
Update logic that prevents 0 premine for reward wallet. Allow 0 premine if epoch rewards are also 0.
Changes include
Checklist
Testing
Manual tests
Ran local cluster against Sepolia rootchain. Verified that bridging works. Verified that legacy and EIP1559 L2 functionality works.