Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dsainati1 committed Jan 24, 2024
1 parent 9d4dd9e commit f961da1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions runtime/stdlib/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -1586,8 +1586,11 @@ func changeAccountContracts(
oldCode, err := handler.GetAccountContractCode(location)
handleContractUpdateError(err)

memoryGauge := invocation.Interpreter.SharedState.Config.MemoryGauge
legacyUpgradeEnabled := invocation.Interpreter.SharedState.Config.LegacyContractUpgradeEnabled

oldProgram, err := parser.ParseProgram(
invocation.Interpreter.SharedState.Config.MemoryGauge,
memoryGauge,
oldCode,
parser.Config{
IgnoreLeadingIdentifierEnabled: true,
Expand All @@ -1596,10 +1599,10 @@ func changeAccountContracts(

var legacyContractUpgrade bool
// if we are allowing legacy contract upgrades, fall back to the old parser when the new one fails
if !ignoreUpdatedProgramParserError(err) && invocation.Interpreter.SharedState.Config.LegacyContractUpgradeEnabled {
if !ignoreUpdatedProgramParserError(err) && legacyUpgradeEnabled {
legacyContractUpgrade = true
oldProgram, err = old_parser.ParseProgram(
invocation.Interpreter.SharedState.Config.MemoryGauge,
memoryGauge,
oldCode,
old_parser.Config{},
)
Expand Down

0 comments on commit f961da1

Please sign in to comment.