-
Notifications
You must be signed in to change notification settings - Fork 198
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
RegisterNonce for waiting and view function #2305
Conversation
return vmcommon.UserError | ||
} | ||
|
||
stakedData, err := r.getOrCreateRegisteredData(element.BLSPublicKey) |
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.
getOrCreate? Shouldn't have been just get?
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 is ok. it shouldn't happen to create here - only bad programming
func (stp *stakingToPeer) getStorageFromAccount(userAcc state.UserAccountHandler, key []byte) []byte { | ||
value, err := userAcc.DataTrieTracker().RetrieveValue(key) | ||
if err != nil { | ||
return nil |
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.
log.Trace the 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.
it is log traced in retrievevalue.
nextKey := make([]byte, len(waitingElementKey)) | ||
copy(nextKey, prevElement.NextKey) | ||
for len(nextKey) != 0 { | ||
for len(nextKey) != 0 && index <= waitingListHead.Length { |
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.
index < waitingListHead.Length ?
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.
Index starts from 1
index := uint32(1) | ||
nextKey := make([]byte, len(waitingListHead.FirstKey)) | ||
copy(nextKey, waitingListHead.FirstKey) | ||
for len(nextKey) != 0 && index <= waitingListHead.Length { |
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.
index < waitingListHead.Length ?
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.
Index starts from 1
@@ -1255,7 +1255,7 @@ func (r *stakingSC) getBLSKeyStatus(args *vmcommon.ContractCallInput) vmcommon.R | |||
return vmcommon.Ok | |||
} | |||
if stakedData.Waiting { | |||
r.eei.Finish([]byte("waiting")) | |||
r.eei.Finish([]byte("queued")) |
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 test passed.
RegisterNonce for waiting and view function.
This code is backward compatible if stake was not enabled - after that it is not. Should be merged before enabling staking.