Skip to content

Commit

Permalink
Merge branch 'master' into tmpnet-disjoint-validator-sets
Browse files Browse the repository at this point in the history
  • Loading branch information
marun committed Jun 20, 2024
2 parents c0666b9 + a0741de commit 4a90260
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
10 changes: 4 additions & 6 deletions chains/atomic/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,7 @@ func (s *state) SetValue(e *Element) error {
// current engine state.
func (s *state) RemoveValue(key []byte) error {
value, err := s.loadValue(key)
if err != nil {
if err != database.ErrNotFound {
// An unexpected error occurred, so we should propagate that error
return err
}

if err == database.ErrNotFound {
// The value doesn't exist, so we should optimistically delete it
dbElem := dbElement{Present: false}
valueBytes, err := Codec.Marshal(CodecVersion, &dbElem)
Expand All @@ -161,6 +156,9 @@ func (s *state) RemoveValue(key []byte) error {
}
return s.valueDB.Put(key, valueBytes)
}
if err != nil {
return err
}

// Don't allow the removal of something that was already removed.
if !value.Present {
Expand Down
17 changes: 8 additions & 9 deletions vms/platformvm/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ type state struct {
currentHeight uint64

addedBlockIDs map[uint64]ids.ID // map of height -> blockID
blockIDCache cache.Cacher[uint64, ids.ID] // cache of height -> blockID. If the entry is ids.Empty, it is not in the database
blockIDCache cache.Cacher[uint64, ids.ID] // cache of height -> blockID; if the entry is ids.Empty, it is not in the database
blockIDDB database.Database

addedBlocks map[ids.ID]block.Block // map of blockID -> Block
blockCache cache.Cacher[ids.ID, block.Block] // cache of blockID -> Block. If the entry is nil, it is not in the database
blockCache cache.Cacher[ids.ID, block.Block] // cache of blockID -> Block; if the entry is nil, it is not in the database
blockDB database.Database

validatorsDB database.Database
Expand All @@ -319,14 +319,14 @@ type state struct {
validatorPublicKeyDiffsDB database.Database

addedTxs map[ids.ID]*txAndStatus // map of txID -> {*txs.Tx, Status}
txCache cache.Cacher[ids.ID, *txAndStatus] // txID -> {*txs.Tx, Status}. If the entry is nil, it isn't in the database
txCache cache.Cacher[ids.ID, *txAndStatus] // txID -> {*txs.Tx, Status}; if the entry is nil, it is not in the database
txDB database.Database

addedRewardUTXOs map[ids.ID][]*avax.UTXO // map of txID -> []*UTXO
rewardUTXOsCache cache.Cacher[ids.ID, []*avax.UTXO] // txID -> []*UTXO
rewardUTXODB database.Database

modifiedUTXOs map[ids.ID]*avax.UTXO // map of modified UTXOID -> *UTXO if the UTXO is nil, it has been removed
modifiedUTXOs map[ids.ID]*avax.UTXO // map of modified UTXOID -> *UTXO; if the UTXO is nil, it has been removed
utxoDB database.Database
utxoState avax.UTXOState

Expand All @@ -335,17 +335,16 @@ type state struct {
subnetBaseDB database.Database
subnetDB linkeddb.LinkedDB

// Subnet ID --> Owner of the subnet
subnetOwners map[ids.ID]fx.Owner
subnetOwnerCache cache.Cacher[ids.ID, fxOwnerAndSize] // cache of subnetID -> owner if the entry is nil, it is not in the database
subnetOwners map[ids.ID]fx.Owner // map of subnetID -> owner
subnetOwnerCache cache.Cacher[ids.ID, fxOwnerAndSize] // cache of subnetID -> owner; if the entry is nil, it is not in the database
subnetOwnerDB database.Database

transformedSubnets map[ids.ID]*txs.Tx // map of subnetID -> transformSubnetTx
transformedSubnetCache cache.Cacher[ids.ID, *txs.Tx] // cache of subnetID -> transformSubnetTx if the entry is nil, it is not in the database
transformedSubnetCache cache.Cacher[ids.ID, *txs.Tx] // cache of subnetID -> transformSubnetTx; if the entry is nil, it is not in the database
transformedSubnetDB database.Database

modifiedSupplies map[ids.ID]uint64 // map of subnetID -> current supply
supplyCache cache.Cacher[ids.ID, *uint64] // cache of subnetID -> current supply if the entry is nil, it is not in the database
supplyCache cache.Cacher[ids.ID, *uint64] // cache of subnetID -> current supply; if the entry is nil, it is not in the database
supplyDB database.Database

addedChains map[ids.ID][]*txs.Tx // maps subnetID -> the newly added chains to the subnet
Expand Down

0 comments on commit 4a90260

Please sign in to comment.