Summary
Move the storage of marker permissions out of the marker account and into its own key/value storage in the module.
Problem Definition
The MarkerAccount has an access_control field that stores account addresses associated with permissions lists. We don't always need that information when looking up a marker, though. But because it's in the marker account, it gets read/parsed every time we look up the marker. This can be a significant amount of data as the list can grow as big as needed. Conversely, there are times where we are retrieving the entire marker just to look up marker permissions.
Proposal
Store the access_control data on its own and stop storing it in the marker itself.
- Choose a new type byte and store the permissions using this scheme:
<type byte><marker addr length><marker addr><addr length><addr> = <proto([]Access)>.
- Create a module migration that will move these permissions out of each marker and into the new storage place.
- Refactor the keeper methods accordingly. Leave
GetMarkerByDenom and GetMarker as they are so that calling them does NOT look up permissions. Instead, create ...withPerms versions that look up both the marker and permissions. Create new keeper methods for checking account permissions.
- Find places that use the
MarkerAccount methods like .HasAccess, .ValidateHasAccess etc. Update them to look up the least amount of data possible to do what they need to do.
For Admin Use
Summary
Move the storage of marker permissions out of the marker account and into its own key/value storage in the module.
Problem Definition
The
MarkerAccounthas anaccess_controlfield that stores account addresses associated with permissions lists. We don't always need that information when looking up a marker, though. But because it's in the marker account, it gets read/parsed every time we look up the marker. This can be a significant amount of data as the list can grow as big as needed. Conversely, there are times where we are retrieving the entire marker just to look up marker permissions.Proposal
Store the
access_controldata on its own and stop storing it in the marker itself.<type byte><marker addr length><marker addr><addr length><addr> = <proto([]Access)>.GetMarkerByDenomandGetMarkeras they are so that calling them does NOT look up permissions. Instead, create...withPermsversions that look up both the marker and permissions. Create new keeper methods for checking account permissions.MarkerAccountmethods like.HasAccess,.ValidateHasAccessetc. Update them to look up the least amount of data possible to do what they need to do.For Admin Use