diff --git a/node/nodeRunner.go b/node/nodeRunner.go index 54ffe84b4e3..dcbcc7415a6 100644 --- a/node/nodeRunner.go +++ b/node/nodeRunner.go @@ -162,54 +162,94 @@ func printEnableEpochs(configs *config.Configs) { log.Debug(readEpochFor("delegation smart contract"), "epoch", enableEpochs.DelegationSmartContractEnableEpoch) log.Debug(readEpochFor("correct last unjailed"), "epoch", enableEpochs.CorrectLastUnjailedEnableEpoch) log.Debug(readEpochFor("balance waiting lists"), "epoch", enableEpochs.BalanceWaitingListsEnableEpoch) + log.Debug(readEpochFor("return data to last transfer"), "epoch", enableEpochs.ReturnDataToLastTransferEnableEpoch) + log.Debug(readEpochFor("sender in out"), "epoch", enableEpochs.SenderInOutTransferEnableEpoch) log.Debug(readEpochFor("relayed transactions v2"), "epoch", enableEpochs.RelayedTransactionsV2EnableEpoch) log.Debug(readEpochFor("unbond tokens v2"), "epoch", enableEpochs.UnbondTokensV2EnableEpoch) log.Debug(readEpochFor("save jailed always"), "epoch", enableEpochs.SaveJailedAlwaysEnableEpoch) log.Debug(readEpochFor("validator to delegation"), "epoch", enableEpochs.ValidatorToDelegationEnableEpoch) log.Debug(readEpochFor("re-delegate below minimum check"), "epoch", enableEpochs.ReDelegateBelowMinCheckEnableEpoch) log.Debug(readEpochFor("increment SCR nonce in multi transfer"), "epoch", enableEpochs.IncrementSCRNonceInMultiTransferEnableEpoch) + log.Debug(readEpochFor("scheduled mini blocks"), "epoch", enableEpochs.ScheduledMiniBlocksEnableEpoch) log.Debug(readEpochFor("esdt and NFT multi transfer"), "epoch", enableEpochs.ESDTMultiTransferEnableEpoch) log.Debug(readEpochFor("contract global mint and burn"), "epoch", enableEpochs.GlobalMintBurnDisableEpoch) log.Debug(readEpochFor("contract transfer role"), "epoch", enableEpochs.ESDTTransferRoleEnableEpoch) log.Debug(readEpochFor("compute rewards checkpoint on delegation"), "epoch", enableEpochs.ComputeRewardCheckpointEnableEpoch) - log.Debug(readEpochFor("esdt NFT create on multiple shards"), "epoch", enableEpochs.ESDTNFTCreateOnMultiShardEnableEpoch) log.Debug(readEpochFor("SCR size invariant check"), "epoch", enableEpochs.SCRSizeInvariantCheckEnableEpoch) log.Debug(readEpochFor("backward compatibility flag for save key value"), "epoch", enableEpochs.BackwardCompSaveKeyValueEnableEpoch) + log.Debug(readEpochFor("esdt NFT create on multiple shards"), "epoch", enableEpochs.ESDTNFTCreateOnMultiShardEnableEpoch) log.Debug(readEpochFor("meta ESDT, financial SFT"), "epoch", enableEpochs.MetaESDTSetEnableEpoch) log.Debug(readEpochFor("add tokens to delegation"), "epoch", enableEpochs.AddTokensToDelegationEnableEpoch) log.Debug(readEpochFor("multi ESDT transfer on callback"), "epoch", enableEpochs.MultiESDTTransferFixOnCallBackOnEnableEpoch) log.Debug(readEpochFor("optimize gas used in cross mini blocks"), "epoch", enableEpochs.OptimizeGasUsedInCrossMiniBlocksEnableEpoch) log.Debug(readEpochFor("correct first queued"), "epoch", enableEpochs.CorrectFirstQueuedEpoch) + log.Debug(readEpochFor("correct jailed not unstaked if empty queue"), "epoch", enableEpochs.CorrectJailedNotUnstakedEmptyQueueEpoch) log.Debug(readEpochFor("fix out of gas return code"), "epoch", enableEpochs.FixOOGReturnCodeEnableEpoch) log.Debug(readEpochFor("remove non updated storage"), "epoch", enableEpochs.RemoveNonUpdatedStorageEnableEpoch) log.Debug(readEpochFor("delete delegator data after claim rewards"), "epoch", enableEpochs.DeleteDelegatorAfterClaimRewardsEnableEpoch) log.Debug(readEpochFor("optimize nft metadata store"), "epoch", enableEpochs.OptimizeNFTStoreEnableEpoch) log.Debug(readEpochFor("create nft through execute on destination by caller"), "epoch", enableEpochs.CreateNFTThroughExecByCallerEnableEpoch) + log.Debug(readEpochFor("stop decreasing validator rating"), "epoch", enableEpochs.StopDecreasingValidatorRatingWhenStuckEnableEpoch) + log.Debug(readEpochFor("is payable by sc"), "epoch", enableEpochs.IsPayableBySCEnableEpoch) log.Debug(readEpochFor("payable by smart contract"), "epoch", enableEpochs.IsPayableBySCEnableEpoch) log.Debug(readEpochFor("cleanup informative only SCRs"), "epoch", enableEpochs.CleanUpInformativeSCRsEnableEpoch) log.Debug(readEpochFor("storage API cost optimization"), "epoch", enableEpochs.StorageAPICostOptimizationEnableEpoch) log.Debug(readEpochFor("transform to multi shard create on esdt"), "epoch", enableEpochs.TransformToMultiShardCreateEnableEpoch) log.Debug(readEpochFor("esdt: enable epoch for esdt register and set all roles function"), "epoch", enableEpochs.ESDTRegisterAndSetAllRolesEnableEpoch) - log.Debug(readEpochFor("scheduled mini blocks"), "epoch", enableEpochs.ScheduledMiniBlocksEnableEpoch) - log.Debug(readEpochFor("correct jailed not unstaked if empty queue"), "epoch", enableEpochs.CorrectJailedNotUnstakedEmptyQueueEpoch) log.Debug(readEpochFor("do not return old block in blockchain hook"), "epoch", enableEpochs.DoNotReturnOldBlockInBlockchainHookEnableEpoch) + log.Debug(readEpochFor("add failed relayed tx to invalid mb"), "epoch", enableEpochs.AddFailedRelayedTxToInvalidMBsDisableEpoch) log.Debug(readEpochFor("scr size invariant check on built in"), "epoch", enableEpochs.SCRSizeInvariantOnBuiltInResultEnableEpoch) log.Debug(readEpochFor("correct check on tokenID for transfer role"), "epoch", enableEpochs.CheckCorrectTokenIDForTransferRoleEnableEpoch) log.Debug(readEpochFor("disable check value on exec by caller"), "epoch", enableEpochs.DisableExecByCallerEnableEpoch) log.Debug(readEpochFor("fail execution on every wrong API call"), "epoch", enableEpochs.FailExecutionOnEveryAPIErrorEnableEpoch) log.Debug(readEpochFor("managed crypto API in wasm vm"), "epoch", enableEpochs.ManagedCryptoAPIsEnableEpoch) log.Debug(readEpochFor("refactor contexts"), "epoch", enableEpochs.RefactorContextEnableEpoch) + log.Debug(readEpochFor("check function argument"), "epoch", enableEpochs.CheckFunctionArgumentEnableEpoch) + log.Debug(readEpochFor("check execute on readonly"), "epoch", enableEpochs.CheckExecuteOnReadOnlyEnableEpoch) log.Debug(readEpochFor("mini block partial execution"), "epoch", enableEpochs.MiniBlockPartialExecutionEnableEpoch) + log.Debug(readEpochFor("esdt metadata continuous cleanup"), "epoch", enableEpochs.ESDTMetadataContinuousCleanupEnableEpoch) log.Debug(readEpochFor("fix async callback arguments list"), "epoch", enableEpochs.FixAsyncCallBackArgsListEnableEpoch) log.Debug(readEpochFor("fix old token liquidity"), "epoch", enableEpochs.FixOldTokenLiquidityEnableEpoch) + log.Debug(readEpochFor("runtime memstore limit"), "epoch", enableEpochs.RuntimeMemStoreLimitEnableEpoch) + log.Debug(readEpochFor("runtime code size fix"), "epoch", enableEpochs.RuntimeCodeSizeFixEnableEpoch) log.Debug(readEpochFor("set sender in eei output transfer"), "epoch", enableEpochs.SetSenderInEeiOutputTransferEnableEpoch) log.Debug(readEpochFor("refactor peers mini blocks"), "epoch", enableEpochs.RefactorPeersMiniBlocksEnableEpoch) - log.Debug(readEpochFor("runtime memstore limit"), "epoch", enableEpochs.RuntimeMemStoreLimitEnableEpoch) + log.Debug(readEpochFor("sc processor v2"), "epoch", enableEpochs.SCProcessorV2EnableEpoch) log.Debug(readEpochFor("max blockchainhook counters"), "epoch", enableEpochs.MaxBlockchainHookCountersEnableEpoch) + log.Debug(readEpochFor("wipe single nft liquidity"), "epoch", enableEpochs.WipeSingleNFTLiquidityDecreaseEnableEpoch) + log.Debug(readEpochFor("always save token metadata"), "epoch", enableEpochs.AlwaysSaveTokenMetaDataEnableEpoch) + log.Debug(readEpochFor("set guardian"), "epoch", enableEpochs.SetGuardianEnableEpoch) + log.Debug(readEpochFor("sc to sc log event"), "epoch", enableEpochs.ScToScLogEventEnableEpoch) + log.Debug(readEpochFor("relayed nonce fix"), "epoch", enableEpochs.RelayedNonceFixEnableEpoch) + log.Debug(readEpochFor("deterministic sort on validators info"), "epoch", enableEpochs.DeterministicSortOnValidatorsInfoEnableEpoch) + log.Debug(readEpochFor("keep exec order on created scr"), "epoch", enableEpochs.KeepExecOrderOnCreatedSCRsEnableEpoch) + log.Debug(readEpochFor("multi claim on delegation"), "epoch", enableEpochs.MultiClaimOnDelegationEnableEpoch) + log.Debug(readEpochFor("change username enable epoch"), "epoch", enableEpochs.ChangeUsernameEnableEpoch) + log.Debug(readEpochFor("auto balance data tries"), "epoch", enableEpochs.AutoBalanceDataTriesEnableEpoch) + log.Debug(readEpochFor("migrate data trie"), "epoch", enableEpochs.MigrateDataTrieEnableEpoch) + log.Debug(readEpochFor("consistent token values length check"), "epoch", enableEpochs.ConsistentTokensValuesLengthCheckEnableEpoch) + log.Debug(readEpochFor("fix delegation change owner on account"), "epoch", enableEpochs.FixDelegationChangeOwnerOnAccountEnableEpoch) + log.Debug(readEpochFor("dynamic gas cost"), "epoch", enableEpochs.DynamicGasCostForDataTrieStorageLoadEnableEpoch) + log.Debug(readEpochFor("nft stop create"), "epoch", enableEpochs.NFTStopCreateEnableEpoch) + log.Debug(readEpochFor("change owner address cross shard"), "epoch", enableEpochs.ChangeOwnerAddressCrossShardThroughSCEnableEpoch) + log.Debug(readEpochFor("fix gas remaining for save key value built in"), "epoch", enableEpochs.FixGasRemainingForSaveKeyValueBuiltinFunctionEnableEpoch) + log.Debug(readEpochFor("current randomness on sorting"), "epoch", enableEpochs.CurrentRandomnessOnSortingEnableEpoch) log.Debug(readEpochFor("limit validators"), "epoch", enableEpochs.StakeLimitsEnableEpoch) log.Debug(readEpochFor("staking v4 step 1"), "epoch", enableEpochs.StakingV4Step1EnableEpoch) log.Debug(readEpochFor("staking v4 step 2"), "epoch", enableEpochs.StakingV4Step2EnableEpoch) log.Debug(readEpochFor("staking v4 step 3"), "epoch", enableEpochs.StakingV4Step3EnableEpoch) + log.Debug(readEpochFor("cleanup auction on low waiting"), "epoch", enableEpochs.CleanupAuctionOnLowWaitingListEnableEpoch) + log.Debug(readEpochFor("always merge contexts in eei"), "epoch", enableEpochs.AlwaysMergeContextsInEEIEnableEpoch) + //log.Debug(readEpochFor("use gas bounded should fail"), "epoch", enableEpochs.UseGasBoundedShouldFailExecutionEnableEpoch) + log.Debug(readEpochFor("dynamic esdt"), "epoch", enableEpochs.DynamicESDTEnableEpoch) + log.Debug(readEpochFor("egld in multi transfer"), "epoch", enableEpochs.EGLDInMultiTransferEnableEpoch) + log.Debug(readEpochFor("crypto opcodes v2"), "epoch", enableEpochs.CryptoOpcodesV2EnableEpoch) + log.Debug(readEpochFor("unjail cleanup"), "epoch", enableEpochs.UnJailCleanupEnableEpoch) + log.Debug(readEpochFor("relayed v3"), "epoch", enableEpochs.RelayedTransactionsV3EnableEpoch) + log.Debug(readEpochFor("fix relayed base cost"), "epoch", enableEpochs.FixRelayedBaseCostEnableEpoch) + log.Debug(readEpochFor("multi esdt nft transfer and execute by user"), "epoch", enableEpochs.MultiESDTNFTTransferAndExecuteByUserEnableEpoch) + //log.Debug(readEpochFor("fix relayed move balance to non payable sc"), "epoch", enableEpochs.FixRelayedMoveBalanceToNonPayableSCEnableEpoch) + log.Debug(readEpochFor("bls multi signer"), "epoch", enableEpochs.BLSMultiSignerEnableEpoch) gasSchedule := configs.EpochConfig.GasSchedule diff --git a/node/nodeRunner_test.go b/node/nodeRunner_test.go index 5d0e9a7666c..4f0f92e8518 100644 --- a/node/nodeRunner_test.go +++ b/node/nodeRunner_test.go @@ -1,20 +1,25 @@ package node import ( + "bytes" "os" "path" + "reflect" + "strings" "syscall" "testing" "time" "github.com/multiversx/mx-chain-core-go/data/endProcess" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/multiversx/mx-chain-go/common" + "github.com/multiversx/mx-chain-go/config" "github.com/multiversx/mx-chain-go/node/mock" "github.com/multiversx/mx-chain-go/testscommon" "github.com/multiversx/mx-chain-go/testscommon/api" - logger "github.com/multiversx/mx-chain-logger-go" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const originalConfigsPath = "../cmd/node/config" @@ -330,6 +335,32 @@ func TestWaitForSignal(t *testing.T) { }) } +func TestPrintEnableEpochs(t *testing.T) { + configs := &config.Configs{ + EpochConfig: &config.EpochConfig{ + EnableEpochs: config.EnableEpochs{}, + }, + } + enableEpochs := configs.EpochConfig.EnableEpochs + + assert.Equal(t, reflect.Struct, reflect.ValueOf(enableEpochs).Kind()) + v := reflect.ValueOf(enableEpochs) + expectedNrFields := v.NumField() + // the gasSchedule.GasScheduleByEpochs is also logged + expectedNrFields++ + + log.SetLevel(logger.LogDebug) + buff := &bytes.Buffer{} + _ = logger.AddLogObserver(buff, &logger.PlainFormatter{}) + + printEnableEpochs(configs) + + _ = logger.RemoveLogObserver(buff) + buffString := strings.TrimSpace(buff.String()) + loggedFields := strings.Split(buffString, "\n") + assert.Equal(t, expectedNrFields, len(loggedFields), "add newly added enable epochs to the printEnableEpochs method") +} + func checkCloseCalledMap(tb testing.TB, closedCalled map[string]struct{}, exceptions ...string) { allKeys := []string{"healthService", "facade", "http", "node closable component 1", "node closable component 2"} numKeys := 0