Skip to content

Commit

Permalink
fixup struct
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink committed Mar 29, 2024
1 parent f30c506 commit 1a952cc
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions internal/migrate/staging_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ var chainIdMap = map[string]flow.ChainID{

func newStagingValidator(flow flowkit.Services, state *flowkit.State) *stagingValidator {
return &stagingValidator{
flow: flow,
state: state,
contracts: make(map[common.Location][]byte),
elaborations: make(map[common.Location]*sema.Elaboration),
flow: flow,
state: state,
contracts: make(map[common.Location][]byte),
elaborations: make(map[common.Location]*sema.Elaboration),
accountContractNames: make(map[common.Address][]string),
}
}

Expand All @@ -112,7 +113,7 @@ func (v *stagingValidator) ValidateContractUpdate(
contractName := location.Name
contractCode, ok := account.Contracts[contractName]
if !ok {
return fmt.Errorf("old contract code not found")
return fmt.Errorf("old contract code not found for contract: %s", contractName)
}

// Parse the old contract code
Expand All @@ -121,9 +122,6 @@ func (v *stagingValidator) ValidateContractUpdate(
return fmt.Errorf("failed to parse old contract code: %w", err)
}

// Reset the missing contract dependencies
v.missingDependencies = nil

// Store contract code for error pretty printing
v.contracts[sourceCodeLocation] = updatedCode

Expand Down Expand Up @@ -377,10 +375,6 @@ func (v *stagingValidator) resolveLocation(
}

func (v *stagingValidator) resolveAddressContractNames(address common.Address) ([]string, error) {
if v.accountContractNames == nil {
v.accountContractNames = make(map[common.Address][]string)
}

// Check if the contract names are already cached
if names, ok := v.accountContractNames[address]; ok {
return names, nil
Expand Down

0 comments on commit 1a952cc

Please sign in to comment.