You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we don't have to unmarshal the whole proposal each time(consider the case where a TextProposal has a very long description).
The inactive and active proposal queues in governance currently unmarshal and marshal the entire queue of proposals. These queues should be updated to use a more advanced queue such as the ones used in staking unbonding and redelegation queues.
The text was updated successfully, but these errors were encountered:
Essentially, the current queue in governance just puts all of the ProposalIDs in a slice that is []ProposalID. In every EndBlocker, it unmarshals the entire slice, gets the first element, Gets the Proposal, checks if the Proposal is expired, and if so Pops it from the queue and executes.
The iterator based queue, makes clever use of the sdk.Iterator in order to only get the list of ProposalIDs that expire by the current BlockTime. This way, you're not unmarshaling the entire queue ([]ProposalID) and first Proposal every endblocker, just to see if needs to be popped.
Also, another benefit is that this queue makes it easier to insert elements into the middle of the queue, rather that just at the end. This will be useful in the case where we want DepositPeriod or VotingPeriod to have a potential range (like maybe there is a minimum voting period and a maximum, but the proposal creator can choose the length within those bounds).
As noticed by @mossid in #2613
The inactive and active proposal queues in governance currently unmarshal and marshal the entire queue of proposals. These queues should be updated to use a more advanced queue such as the ones used in staking unbonding and redelegation queues.
The text was updated successfully, but these errors were encountered: