Skip to content
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

Get CometFlexVoting under the size limit #47

Closed
davidlaprade opened this issue May 16, 2023 · 1 comment
Closed

Get CometFlexVoting under the size limit #47

davidlaprade opened this issue May 16, 2023 · 1 comment

Comments

@davidlaprade
Copy link
Contributor

davidlaprade commented May 16, 2023

It's currently ~8kB over the limit1. As part of this, let's also bring back the size check in CI which as removed in #46 (comment)

To fix we probably want to:

  • extend Comet to redefine updateBasePrincipal, note that this function will need to call internal functions that we do not have the space to include in Comet -- namely FlexVotingClient._checkpointRawBalanceOf! Need to figure out how to do this (e.g. maybe make the function external but with a modifier that only allows the Comet instance to call it?)
  • create a new Comet constructor that stores the governor address
  • extend Comet to add the storage vars in FlexVotingClient. This might be a little tricky because some of them reference types in libraries like OZ's Checkpoints and we cannot afford to import them:
    mapping(uint256 => mapping(address => bool)) private proposalVotersHasVoted;
    
    /// @notice Map proposalId to vote totals expressed on this proposal.
    mapping(uint256 => ProposalVote) public proposalVotes;
    
    /// @notice Mapping from address to stored (not rebased) balance checkpoint history.
    mapping(address => Checkpoints.History) private balanceCheckpoints;
    
    /// @notice History of total stored (not rebased) balances.
    Checkpoints.History internal totalDepositCheckpoints;
  • extend CometExt with the remaining logic we need

Footnotes

  1. image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants