Skip to content

Commit

Permalink
Merge pull request #5842 from multiversx/update-master-rc-sirius-patc…
Browse files Browse the repository at this point in the history
…h-2-2023.01.17

Update master rc sirius patch 2 2023.01.17
  • Loading branch information
iulianpascalau authored Jan 22, 2024
2 parents 9d88539 + 6e6d2cb commit dbf6d2e
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 12 deletions.
3 changes: 3 additions & 0 deletions cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@
# AutoBalanceDataTriesEnableEpoch represents the epoch when the data tries are automatically balanced by inserting at the hashed key instead of the normal key
AutoBalanceDataTriesEnableEpoch = 1

# MigrateDataTrieEnableEpoch represents the epoch when the data tries migration is enabled
MigrateDataTrieEnableEpoch = 999999

# KeepExecOrderOnCreatedSCRsEnableEpoch represents the epoch when the execution order of created SCRs is ensured
KeepExecOrderOnCreatedSCRsEnableEpoch = 1

Expand Down
1 change: 1 addition & 0 deletions common/enablers/enableEpochsHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (handler *enableEpochsHandler) EpochConfirmed(epoch uint32, _ uint64) {
handler.setFlagValue(epoch >= handler.enableEpochsConfig.NFTStopCreateEnableEpoch, handler.nftStopCreateFlag, "nftStopCreateFlag", epoch, handler.enableEpochsConfig.NFTStopCreateEnableEpoch)
handler.setFlagValue(epoch >= handler.enableEpochsConfig.ChangeOwnerAddressCrossShardThroughSCEnableEpoch, handler.changeOwnerAddressCrossShardThroughSCFlag, "changeOwnerAddressCrossShardThroughSCFlag", epoch, handler.enableEpochsConfig.ChangeOwnerAddressCrossShardThroughSCEnableEpoch)
handler.setFlagValue(epoch >= handler.enableEpochsConfig.FixGasRemainingForSaveKeyValueBuiltinFunctionEnableEpoch, handler.fixGasRemainingForSaveKeyValueFlag, "fixGasRemainingForSaveKeyValueFlag", epoch, handler.enableEpochsConfig.FixGasRemainingForSaveKeyValueBuiltinFunctionEnableEpoch)
handler.setFlagValue(epoch >= handler.enableEpochsConfig.MigrateDataTrieEnableEpoch, handler.migrateDataTrieFlag, "migrateDataTrieFlag", epoch, handler.enableEpochsConfig.MigrateDataTrieEnableEpoch)
}

func (handler *enableEpochsHandler) setFlagValue(value bool, flag *atomic.Flag, flagName string, epoch uint32, flagEpoch uint32) {
Expand Down
16 changes: 16 additions & 0 deletions common/enablers/enableEpochsHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func createEnableEpochsConfig() config.EnableEpochs {
ScToScLogEventEnableEpoch: 88,
NFTStopCreateEnableEpoch: 89,
FixGasRemainingForSaveKeyValueBuiltinFunctionEnableEpoch: 90,
MigrateDataTrieEnableEpoch: 91,
}
}

Expand Down Expand Up @@ -251,6 +252,7 @@ func TestNewEnableEpochsHandler_EpochConfirmed(t *testing.T) {
assert.True(t, handler.FixDelegationChangeOwnerOnAccountEnabled())
assert.True(t, handler.NFTStopCreateEnabled())
assert.True(t, handler.FixGasRemainingForSaveKeyValueBuiltinFunctionEnabled())
assert.True(t, handler.IsMigrateDataTrieEnabled())
})
t.Run("flags with == condition should not be set, the ones with >= should be set", func(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -372,6 +374,7 @@ func TestNewEnableEpochsHandler_EpochConfirmed(t *testing.T) {
assert.True(t, handler.FixDelegationChangeOwnerOnAccountEnabled())
assert.True(t, handler.NFTStopCreateEnabled())
assert.True(t, handler.FixGasRemainingForSaveKeyValueBuiltinFunctionEnabled())
assert.True(t, handler.IsMigrateDataTrieEnabled())
})
t.Run("flags with < should be set", func(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -488,6 +491,19 @@ func TestNewEnableEpochsHandler_EpochConfirmed(t *testing.T) {
assert.False(t, handler.FixDelegationChangeOwnerOnAccountEnabled())
assert.False(t, handler.NFTStopCreateEnabled())
assert.False(t, handler.FixGasRemainingForSaveKeyValueBuiltinFunctionEnabled())
assert.False(t, handler.IsMigrateDataTrieEnabled())
})
t.Run("test for migrate data tries", func(t *testing.T) {
t.Parallel()

epoch := uint32(90)
cfg := createEnableEpochsConfig()
handler, _ := NewEnableEpochsHandler(cfg, &epochNotifier.EpochNotifierStub{})

handler.EpochConfirmed(epoch, 0)

assert.True(t, handler.IsAutoBalanceDataTriesEnabled())
assert.False(t, handler.IsMigrateDataTrieEnabled())
})
}

Expand Down
7 changes: 7 additions & 0 deletions common/enablers/epochFlags.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ type epochFlagsHolder struct {
changeUsernameFlag *atomic.Flag
consistentTokensValuesCheckFlag *atomic.Flag
autoBalanceDataTriesFlag *atomic.Flag
migrateDataTrieFlag *atomic.Flag
fixDelegationChangeOwnerOnAccountFlag *atomic.Flag
dynamicGasCostForDataTrieStorageLoadFlag *atomic.Flag
nftStopCreateFlag *atomic.Flag
Expand Down Expand Up @@ -209,6 +210,7 @@ func newEpochFlagsHolder() *epochFlagsHolder {
nftStopCreateFlag: &atomic.Flag{},
changeOwnerAddressCrossShardThroughSCFlag: &atomic.Flag{},
fixGasRemainingForSaveKeyValueFlag: &atomic.Flag{},
migrateDataTrieFlag: &atomic.Flag{},
}
}

Expand Down Expand Up @@ -740,6 +742,11 @@ func (holder *epochFlagsHolder) IsAutoBalanceDataTriesEnabled() bool {
return holder.autoBalanceDataTriesFlag.IsSet()
}

// IsMigrateDataTrieEnabled returns true if the migrateDataTrieFlag is enabled
func (holder *epochFlagsHolder) IsMigrateDataTrieEnabled() bool {
return holder.migrateDataTrieFlag.IsSet()
}

// FixDelegationChangeOwnerOnAccountEnabled returns true if the fix for the delegation change owner on account is enabled
func (holder *epochFlagsHolder) FixDelegationChangeOwnerOnAccountEnabled() bool {
return holder.fixDelegationChangeOwnerOnAccountFlag.IsSet()
Expand Down
1 change: 1 addition & 0 deletions common/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ type EnableEpochsHandler interface {
IsChangeUsernameEnabled() bool
IsConsistentTokensValuesLengthCheckEnabled() bool
IsAutoBalanceDataTriesEnabled() bool
IsMigrateDataTrieEnabled() bool
IsDynamicGasCostForDataTrieStorageLoadEnabled() bool
FixDelegationChangeOwnerOnAccountEnabled() bool
NFTStopCreateEnabled() bool
Expand Down
1 change: 1 addition & 0 deletions config/epochConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type EnableEpochs struct {
MultiClaimOnDelegationEnableEpoch uint32
ChangeUsernameEnableEpoch uint32
AutoBalanceDataTriesEnableEpoch uint32
MigrateDataTrieEnableEpoch uint32
ConsistentTokensValuesLengthCheckEnableEpoch uint32
FixDelegationChangeOwnerOnAccountEnableEpoch uint32
DynamicGasCostForDataTrieStorageLoadEnableEpoch uint32
Expand Down
4 changes: 4 additions & 0 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,9 @@ func TestEnableEpochConfig(t *testing.T) {
# FixGasRemainingForSaveKeyValueBuiltinFunctionEnableEpoch represents the epoch when the fix for the remaining gas in the SaveKeyValue builtin function is enabled
FixGasRemainingForSaveKeyValueBuiltinFunctionEnableEpoch = 91
# MigrateDataTrieEnableEpoch represents the epoch when the data tries migration is enabled
MigrateDataTrieEnableEpoch = 92
# MaxNodesChangeEnableEpoch holds configuration for changing the maximum number of nodes and the enabling epoch
MaxNodesChangeEnableEpoch = [
Expand Down Expand Up @@ -954,6 +957,7 @@ func TestEnableEpochConfig(t *testing.T) {
NFTStopCreateEnableEpoch: 89,
ChangeOwnerAddressCrossShardThroughSCEnableEpoch: 90,
FixGasRemainingForSaveKeyValueBuiltinFunctionEnableEpoch: 91,
MigrateDataTrieEnableEpoch: 92,
MaxNodesChangeEnableEpoch: []MaxNodesChangeConfig{
{
EpochEnable: 44,
Expand Down
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ require (
github.com/multiversx/mx-chain-logger-go v1.0.13
github.com/multiversx/mx-chain-scenario-go v1.2.1
github.com/multiversx/mx-chain-storage-go v1.0.14
github.com/multiversx/mx-chain-vm-common-go v1.5.9
github.com/multiversx/mx-chain-vm-go v1.5.23
github.com/multiversx/mx-chain-vm-common-go v1.5.10
github.com/multiversx/mx-chain-vm-go v1.5.24
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.64
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.65
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.92
Expand All @@ -47,7 +47,7 @@ require (
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/denisbrodbeck/machineid v1.0.1 // indirect
Expand Down Expand Up @@ -150,8 +150,7 @@ require (
github.com/quic-go/quic-go v0.33.0 // indirect
github.com/quic-go/webtransport-go v0.5.3 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/smartystreets/assertions v1.13.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
Expand Down
15 changes: 8 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -398,10 +399,10 @@ github.com/multiversx/mx-chain-scenario-go v1.2.1 h1:9eC6VcOEAKRRKZ7EbSWPLzCdNIM
github.com/multiversx/mx-chain-scenario-go v1.2.1/go.mod h1:EuZY7DpNFHVNSxJR8dKE1z2I8gBYfEFFPSwNUOXptqE=
github.com/multiversx/mx-chain-storage-go v1.0.14 h1:h0acoqPS3FKJ4S3cKBEriTU0OabSQnpxai5WKhi1YCs=
github.com/multiversx/mx-chain-storage-go v1.0.14/go.mod h1:sJ2q49tgjxNpMpsHysjABqCAB0FLBmDblbjBkQ8XfmA=
github.com/multiversx/mx-chain-vm-common-go v1.5.9 h1:PnGimbMScV5WXFjumzAmcAcnWrw5e9PQABuIcKKUgZw=
github.com/multiversx/mx-chain-vm-common-go v1.5.9/go.mod h1:sqkKMCnwkWl8DURdb9q7pctK8IANghdHY1KJLE0ox2c=
github.com/multiversx/mx-chain-vm-go v1.5.23 h1:FNkEstebRtQWQNlyQbR2yGSpgGTpiwCMnl4MYVYEy2Q=
github.com/multiversx/mx-chain-vm-go v1.5.23/go.mod h1:T03t+in5jqeTuFZKDt2wH/Sl9MSRczvWhmG+tQEIfec=
github.com/multiversx/mx-chain-vm-common-go v1.5.10 h1:VoqVt9yX1nQUa0ZujMpdT3J3pKSnQcB6WCQLvIW4sqw=
github.com/multiversx/mx-chain-vm-common-go v1.5.10/go.mod h1:sqkKMCnwkWl8DURdb9q7pctK8IANghdHY1KJLE0ox2c=
github.com/multiversx/mx-chain-vm-go v1.5.24 h1:6RhMvf84Ys8DksDovms+su7w6j9TWz3Rtm/PpgV12Yw=
github.com/multiversx/mx-chain-vm-go v1.5.24/go.mod h1:T03t+in5jqeTuFZKDt2wH/Sl9MSRczvWhmG+tQEIfec=
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.64 h1:3BEpSxEQibMMi4LXBjpo2y5vUa1LS7olDC2eDkmUfFQ=
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.64/go.mod h1:MUO2E4aEIu3siDkvjraO/WaBh/FxVeQyPWfsrZE+MTU=
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.65 h1:H0Duuoz6lR6KapqLqMspWTojaVtQRiLA5lIm6XV9H04=
Expand Down Expand Up @@ -486,8 +487,9 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
Expand All @@ -512,7 +514,6 @@ github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b
github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ=
github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk=
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
Expand Down
5 changes: 5 additions & 0 deletions sharding/mock/enableEpochsHandlerMock.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,11 @@ func (mock *EnableEpochsHandlerMock) IsAutoBalanceDataTriesEnabled() bool {
return false
}

// IsMigrateDataTrieEnabled -
func (mock *EnableEpochsHandlerMock) IsMigrateDataTrieEnabled() bool {
return false
}

// FixDelegationChangeOwnerOnAccountEnabled -
func (mock *EnableEpochsHandlerMock) FixDelegationChangeOwnerOnAccountEnabled() bool {
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ type EnableEpochsHandlerStub struct {
IsChangeUsernameEnabledField bool
IsConsistentTokensValuesLengthCheckEnabledField bool
IsAutoBalanceDataTriesEnabledField bool
IsMigrateDataTrieEnabledField bool
FixDelegationChangeOwnerOnAccountEnabledField bool
IsDynamicGasCostForDataTrieStorageLoadEnabledField bool
IsNFTStopCreateEnabledField bool
Expand Down Expand Up @@ -1119,6 +1120,14 @@ func (stub *EnableEpochsHandlerStub) IsAutoBalanceDataTriesEnabled() bool {
return stub.IsAutoBalanceDataTriesEnabledField
}

// IsMigrateDataTrieEnabled -
func (stub *EnableEpochsHandlerStub) IsMigrateDataTrieEnabled() bool {
stub.RLock()
defer stub.RUnlock()

return stub.IsMigrateDataTrieEnabledField
}

// FixDelegationChangeOwnerOnAccountEnabled -
func (stub *EnableEpochsHandlerStub) FixDelegationChangeOwnerOnAccountEnabled() bool {
stub.RLock()
Expand Down

0 comments on commit dbf6d2e

Please sign in to comment.