Refactor access to Checkpoint struct without using memory (#4512)
This commit is contained in:
committed by
GitHub
parent
b2e7bab920
commit
a5ed318634
@ -49,9 +49,11 @@ abstract contract GovernorVotesQuorumFraction is GovernorVotes {
|
||||
uint256 length = _quorumNumeratorHistory._checkpoints.length;
|
||||
|
||||
// Optimistic search, check the latest checkpoint
|
||||
Checkpoints.Checkpoint224 memory latest = _quorumNumeratorHistory._checkpoints[length - 1];
|
||||
if (latest._key <= timepoint) {
|
||||
return latest._value;
|
||||
Checkpoints.Checkpoint224 storage latest = _quorumNumeratorHistory._checkpoints[length - 1];
|
||||
uint32 latestKey = latest._key;
|
||||
uint224 latestValue = latest._value;
|
||||
if (latestKey <= timepoint) {
|
||||
return latestValue;
|
||||
}
|
||||
|
||||
// Otherwise, do the binary search
|
||||
|
||||
Reference in New Issue
Block a user