-
Notifications
You must be signed in to change notification settings - Fork 364
erigon storage optimization for candidates and reward #4754
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
base: master
Are you sure you want to change the base?
Conversation
|
| defer func() { | ||
| err = p.putStateV1(sm, key, &rewardHistory{}, protocol.ErigonStoreOnlyOption()) | ||
| if err != nil && !errors.Is(err, state.ErrErigonStoreNotSupported) { | ||
| log.L().Panic("failed to put block reward history in Erigon store", zap.Error(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.
why defer?
| data, err := l.Serialize() | ||
| if err != nil { | ||
| return systemcontracts.GenericValue{}, errors.Wrap(err, "failed to serialize candidate list") | ||
| } | ||
| return systemcontracts.GenericValue{ | ||
| PrimaryData: data, | ||
| }, 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.
return error?
|
|
||
| // Decode decodes a GenericValue into CandidateList | ||
| func (l *CandidateList) Decode(gv systemcontracts.GenericValue) error { | ||
| return l.Deserialize(gv.PrimaryData) |
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.
return error?
| // if ch := as.backend.intraBlockState.GetCodeHash(addr); !accounts.IsEmptyCodeHash(ch) { | ||
| // pbAcc.CodeHash = ch.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.
delete
|
|
||
| func (rhs *keySplitContractStorage) matchStorage(key []byte) ObjectStorage { | ||
| for prefix, os := range rhs.keyPrefixStorage { | ||
| sk := string(key) |
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.
move out of for loop
| // pollPrefix := [][]byte{ | ||
| // []byte(state.PollCandidatesPrefix), | ||
| // } |
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.
delete
| if height > ds.height { | ||
| return errors.Wrapf(state.ErrStateNotExist, "key: %x at height %d", key, height) | ||
| } |
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.
what's the purpose of the height check?
| }() | ||
| g := genesis.TestDefault() | ||
|
|
||
| fmt.Printf("block: %d -----------------------\n", 0) |
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.
t.Log



Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: