Skip to content

Commit 1853702

Browse files
committed
document memory/storage insonsistency has beeing the result of gas comparison
1 parent d2e54af commit 1853702

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

contracts/governance/extensions/GovernorStorage.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ abstract contract GovernorStorage is Governor {
5151
* @dev Version of {IGovernorTimelock-queue} with only `proposalId` as an argument.
5252
*/
5353
function queue(uint256 proposalId) public virtual {
54+
// here, using storage is more efficient than memory
5455
ProposalDetails storage details = _proposalDetails[proposalId];
5556
queue(details.targets, details.values, details.calldatas, details.descriptionHash);
5657
}
@@ -59,6 +60,7 @@ abstract contract GovernorStorage is Governor {
5960
* @dev Version of {IGovernor-execute} with only `proposalId` as an argument.
6061
*/
6162
function execute(uint256 proposalId) public payable virtual {
63+
// here, using storage is more efficient than memory
6264
ProposalDetails storage details = _proposalDetails[proposalId];
6365
execute(details.targets, details.values, details.calldatas, details.descriptionHash);
6466
}
@@ -67,6 +69,7 @@ abstract contract GovernorStorage is Governor {
6769
* @dev ProposalId version of {IGovernor-cancel}.
6870
*/
6971
function cancel(uint256 proposalId) public virtual {
72+
// here, using storage is more efficient than memory
7073
ProposalDetails storage details = _proposalDetails[proposalId];
7174
cancel(details.targets, details.values, details.calldatas, details.descriptionHash);
7275
}
@@ -84,6 +87,7 @@ abstract contract GovernorStorage is Governor {
8487
function proposalDetails(
8588
uint256 proposalId
8689
) public view virtual returns (address[] memory, uint256[] memory, bytes[] memory, bytes32) {
90+
// here, using memory is more efficient than storage
8791
ProposalDetails memory details = _proposalDetails[proposalId];
8892
if (details.descriptionHash == 0) {
8993
revert GovernorNonexistentProposal(proposalId);

0 commit comments

Comments
 (0)