-
Notifications
You must be signed in to change notification settings - Fork 682
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
P-Chain merkledb -- remove caches #2392
Conversation
@@ -674,31 +542,23 @@ func (s *state) GetSubnets() ([]*txs.Tx, error) { | |||
|
|||
func (s *state) AddSubnet(createSubnetTx *txs.Tx) { | |||
s.addedPermissionedSubnets = append(s.addedPermissionedSubnets, createSubnetTx) | |||
if s.permissionedSubnetCache != nil { | |||
s.permissionedSubnetCache = append(s.permissionedSubnetCache, createSubnetTx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s.permissionedSubnetCache
has to be updated, or else GetSubnets
may return a stale result after the first call.
|
||
// UTXOs section | ||
modifiedUTXOs map[ids.ID]*avax.UTXO // map of UTXO ID -> *UTXO | ||
utxoCache cache.Cacher[ids.ID, *avax.UTXO] // UTXO ID -> *UTXO. If the *UTXO is nil the UTXO doesn't exist | ||
modifiedUTXOs map[ids.ID]*avax.UTXO // map of UTXO ID -> *UTXO | ||
|
||
// Metadata section | ||
chainTime, latestComittedChainTime time.Time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danlaine do we really need latestComittedChainTime and latestCommittedLastAcceptedBlkID? I can't recall if we do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can save us from doing unnecessary writes but they'll probably be removed in a subsequent PR as we change how we commit this data to merkledb (i.e. with views)
Why this should be merged
merkledb does its own caching. Instead of caching in both
state
andmerkledb
, we can just rely on merkledb to cache bytes and parse those bytes.How this works
CTRL + X
How this was tested
Existing UT