Skip to content

Commit

Permalink
Merge pull request #6406 from onflow/fxamacker/add-cap-tag-domain-to-…
Browse files Browse the repository at this point in the history
…check-storage

Add support for `cap_tag` domain in `check-storage` command of `util` program
  • Loading branch information
fxamacker authored Aug 27, 2024
2 parents e211841 + 8a1fa44 commit 6a80b88
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/util/cmd/check-storage/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/onflow/cadence/runtime"
"github.com/onflow/cadence/runtime/common"

"github.com/onflow/flow-go/cmd/util/ledger/migrations"
"github.com/onflow/flow-go/cmd/util/ledger/reporters"
"github.com/onflow/flow-go/cmd/util/ledger/util"
"github.com/onflow/flow-go/cmd/util/ledger/util/registers"
Expand Down Expand Up @@ -282,6 +281,9 @@ func checkStorageHealth(

err = registersByAccount.ForEachAccount(
func(accountRegisters *registers.AccountRegisters) error {
if slices.Contains(acctsToSkip, accountRegisters.Owner()) {
return nil
}
jobs <- job{accountRegisters: accountRegisters}
return nil
})
Expand Down Expand Up @@ -323,7 +325,7 @@ func checkAccountStorageHealth(accountRegisters *registers.AccountRegisters, nWo
ledger := &registers.ReadOnlyLedger{Registers: accountRegisters}
storage := runtime.NewStorage(ledger, nil)

err = util.CheckStorageHealth(address, storage, accountRegisters, migrations.AllStorageMapDomains, nWorkers)
err = util.CheckStorageHealth(address, storage, accountRegisters, util.StorageMapDomains, nWorkers)
if err != nil {
issues = append(
issues,
Expand Down
14 changes: 14 additions & 0 deletions cmd/util/ledger/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
"strings"

"github.com/onflow/atree"
"github.com/onflow/cadence/runtime"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/stdlib"

"github.com/onflow/flow-go/fvm/environment"
"github.com/onflow/flow-go/ledger"
Expand Down Expand Up @@ -245,3 +247,15 @@ func (p *PayloadsLedger) AllocateSlabIndex(owner []byte) (atree.SlabIndex, error

panic("AllocateSlabIndex not expected to be called")
}

var StorageMapDomains = []string{
common.PathDomainStorage.Identifier(),
common.PathDomainPrivate.Identifier(),
common.PathDomainPublic.Identifier(),
runtime.StorageDomainContract,
stdlib.InboxStorageDomain,
stdlib.CapabilityControllerStorageDomain,
stdlib.CapabilityControllerTagStorageDomain,
stdlib.PathCapabilityStorageDomain,
stdlib.AccountCapabilityStorageDomain,
}

0 comments on commit 6a80b88

Please sign in to comment.