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
Fixed backwards compatibility issues on genesis #2612
Fixed backwards compatibility issues on genesis #2612
Conversation
- fixed the situation when the genesis process constructs the system SC container that will lead into creating more accounts than expected
- turned off the consensus watchdog when running in import-db mode
…s consumption of a transaction
func createGenesisConfig() config.GeneralSettingsConfig { | ||
return config.GeneralSettingsConfig{ | ||
BuiltInFunctionsEnableEpoch: 0, | ||
SCDeployEnableEpoch: unreachableEpoch, |
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.
So, scDeployEnableEpoch was modified from 0 to unreachableEpoch because was introduced also the genesisProcessing condition ?
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.
Exactly. This was done as to not activate the gas computation changes that now depend on the same flag.
log.LogIfError(err) | ||
} | ||
|
||
//TODO remove functions initDelegationManager, processSCOutputAccounts, getUserAccount when TODO from L1368 is done |
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.
Maybe you should replace "L1368" with "initMetaInnerProcessors" as this line is already L1370 :)
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.
yes - this could be moved inside initMetaInnerProcessors.
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.
done
node/node.go
Outdated
@@ -237,6 +238,11 @@ func (n *Node) StartConsensus() error { | |||
"it is incompatible with the indexing process.") | |||
n.watchdog = &watchdog.DisabledWatchdog{} | |||
} | |||
if !n.isInImportMode { |
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.
if n.isInImportMode instead if !n.isInImportMode
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.
right, changed
@@ -128,7 +128,7 @@ func (v *validatorSC) saveRegistrationData(key []byte, validator *ValidatorDataV | |||
} | |||
|
|||
func (v *validatorSC) saveRegistrationDataV1(key []byte, validator *ValidatorDataV2) error { | |||
validatorDataV1 := &ValidatorDataV2{ | |||
validatorDataV1 := &ValidatorDataV1{ |
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.
👍
…sis' into fix-backwards-compatibility-genesis
log.LogIfError(err) | ||
} | ||
|
||
//TODO remove functions initDelegationManager, processSCOutputAccounts, getUserAccount when TODO from L1368 is done |
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.
yes - this could be moved inside initMetaInnerProcessors.
@@ -127,7 +127,24 @@ func (vmf *vmContainerFactory) Create() (process.VirtualMachinesContainer, error | |||
return container, nil | |||
} | |||
|
|||
func (vmf *vmContainerFactory) createSystemVM() (vmcommon.VMExecutionHandler, error) { | |||
// CreateForGenesis sets up all the needed virtual machines returning a container of all the VMs to be used in the genesis process |
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.
add comment that genesis contains only a,b,c and d contracts
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.
done
process/smartContract/process.go
Outdated
} | ||
err = sc.updateDeveloperRewardsProxy(tx, vmOutput, builtInFuncGasUsed) | ||
if err != nil { | ||
log.Error("updateDeveloper rewards error", "error", err.Error()) |
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.
To avoid printing twice the word "error" you can replace this line with:
log.Error("updateDeveloperRewardsProxy", "error", err.Error())
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.
done
process/smartContract/process.go
Outdated
} | ||
err = sc.updateDeveloperRewardsProxy(tx, vmOutput, 0) | ||
if err != nil { | ||
log.Debug("updateDeveloper rewards error", "error", err.Error()) |
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.
To avoid printing twice the word "error" you can replace this line with:
log.Error("updateDeveloperRewardsProxy", "error", err.Error())
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.
done
process/smartContract/process.go
Outdated
) error { | ||
if !sc.flagDeploy.IsSet() { | ||
return sc.updateDeveloperRewardsV1(tx, vmOutput, builtInFuncGasUsed) | ||
} else { |
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.
You can remove else branch and return directly V2
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.
right, done
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.
Import-DB passed ✅
Testing procedures: start the import-db process, should sync every block produced on the mainnet.