-
Notifications
You must be signed in to change notification settings - Fork 199
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
bugFix/change reward address #1749
Conversation
@@ -183,13 +183,15 @@ func (s *stakingAuctionSC) changeRewardAddress(args *vmcommon.ContractCallInput) | |||
return vmcommon.UserError | |||
} | |||
|
|||
txData := "changeRewardAddress@" + hex.EncodeToString(registrationData.RewardAddress) |
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.
for this, I have used something like this in genesis package
arguments := make([]string, 0, len(registrationData.BlsPubKeys) + 2)
arguments = append(arguments, changeRewardAddressFunction)
arguments = append(arguments, hex.EncodeToString(registrationData.RewardAddress))
for _, blsKey := range registrationData.BlsPubKeys {
arguments = append(arguments, hex.EncodeToString(blsKey))
}
txData := strings.Join(arguments, "@")
As can be seen, "changeRewardAddress" might be a const for this.
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 leave it like this. it is the same.
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 know, just it was clearer what you add to the arguments list.
vmOutput, err := s.executeOnStakingSC([]byte(txData)) | ||
isError := err != nil || vmOutput.ReturnCode != vmcommon.Ok | ||
if isError { | ||
log.LogIfError(err) |
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.
maybe log at debug level the original error from vmOutput
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.
vmOutput cannot is only userError.
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.
yeah, could have used vmOutput.ReturnMessage but I'm guessing the system SC does not write that.
@@ -276,8 +276,7 @@ func (r *stakingSC) changeRewardAddress(args *vmcommon.ContractCallInput) vmcomm | |||
return vmcommon.UserError | |||
} | |||
|
|||
for i := 1; i < len(args.Arguments); i++ { | |||
blsKey := args.Arguments[i] | |||
for _, blsKey := range args.Arguments[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.
🥇
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.
System tests passed.
Change reward address fix - auction smart contract was calling in the wrong order the staking smart contract.