Skip to content

Commit

Permalink
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-into-feat-esdt-pr…
Browse files Browse the repository at this point in the history
…efix

# Conflicts:
#	errors/errors.go
  • Loading branch information
mariusmihaic committed May 15, 2024
2 parents f010ba4 + 70087e2 commit 733cceb
Show file tree
Hide file tree
Showing 119 changed files with 3,096 additions and 1,310 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, macos-13-xlarge]
runs-on: [ubuntu-latest, macos-13-xlarge]
runs-on: ${{ matrix.runs-on }}
name: Build
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, macos-13-xlarge]
runs-on: [ubuntu-latest, macos-13-xlarge]
runs-on: ${{ matrix.runs-on }}
name: Build
steps:
Expand Down
9 changes: 9 additions & 0 deletions api/groups/addressGroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
urlParamBlockHash = "blockHash"
urlParamBlockRootHash = "blockRootHash"
urlParamHintEpoch = "hintEpoch"
urlParamWithKeys = "withKeys"
)

// addressFacadeHandler defines the methods to be implemented by a facade for handling address requests
Expand Down Expand Up @@ -185,6 +186,14 @@ func (ag *addressGroup) getAccount(c *gin.Context) {
return
}

withKeys, err := parseBoolUrlParam(c, urlParamWithKeys)
if err != nil {
shared.RespondWithValidationError(c, errors.ErrCouldNotGetAccount, err)
return

Check warning on line 192 in api/groups/addressGroup.go

View check run for this annotation

Codecov / codecov/patch

api/groups/addressGroup.go#L191-L192

Added lines #L191 - L192 were not covered by tests
}

options.WithKeys = withKeys

accountResponse, blockInfo, err := ag.getFacade().GetAccount(addr, options)
if err != nil {
shared.RespondWithInternalError(c, errors.ErrCouldNotGetAccount, err)
Expand Down
6 changes: 6 additions & 0 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@
{ StartEpoch = 0, Version = "v1.4" },
{ StartEpoch = 1, Version = "v1.5" }, # TODO: set also the RoundActivations.DisableAsyncCallV1 accordingly
]
TransferAndExecuteByUserAddresses = [ # TODO: set real contract addresses for all shards
"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe3", #shard 0
]

[VirtualMachine.Querying]
NumConcurrentVMs = 1
Expand All @@ -684,6 +687,9 @@
{ StartEpoch = 0, Version = "v1.4" },
{ StartEpoch = 1, Version = "v1.5" }, # TODO: set also the RoundActivations.DisableAsyncCallV1 accordingly
]
TransferAndExecuteByUserAddresses = [ # TODO: set real contract addresses for all shards
"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe3",
]

[VirtualMachine.GasConfig]
# The following values define the maximum amount of gas to be allocated for VM Queries coming from API
Expand Down
6 changes: 6 additions & 0 deletions cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@
# DynamicESDTEnableEpoch represents the epoch when dynamic NFT feature is enabled
DynamicESDTEnableEpoch = 4

# EGLDInMultiTransferEnableEpoch represents the epoch when EGLD in multitransfer is enabled
EGLDInMultiTransferEnableEpoch = 4

# CryptoOpcodesV2EnableEpoch represents the epoch when BLSMultiSig, Secp256r1 and other opcodes are enabled
CryptoOpcodesV2EnableEpoch = 4

# BLSMultiSignerEnableEpoch represents the activation epoch for different types of BLS multi-signers
BLSMultiSignerEnableEpoch = [
{ EnableEpoch = 0, Type = "no-KOSK" },
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
UnmarshalCompressedECC = 270000
GenerateKeyECC = 7000000
EncodeDERSig = 10000000
VerifySecp256r1 = 2000000
VerifyBLSSignatureShare = 2000000
VerifyBLSMultiSig = 2000000

[ManagedBufferAPICost]
MBufferNew = 2000
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
UnmarshalCompressedECC = 270000
GenerateKeyECC = 7000000
EncodeDERSig = 10000000
VerifySecp256r1 = 2000000
VerifyBLSSignatureShare = 2000000
VerifyBLSMultiSig = 2000000

[ManagedBufferAPICost]
MBufferNew = 2000
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
UnmarshalCompressedECC = 270000
GenerateKeyECC = 7000000
EncodeDERSig = 10000000
VerifySecp256r1 = 2000000
VerifyBLSSignatureShare = 2000000
VerifyBLSMultiSig = 2000000

[ManagedBufferAPICost]
MBufferNew = 2000
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV4.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
UnmarshalCompressedECC = 270000
GenerateKeyECC = 7000000
EncodeDERSig = 10000000
VerifySecp256r1 = 2000000
VerifyBLSSignatureShare = 2000000
VerifyBLSMultiSig = 2000000

[ManagedBufferAPICost]
MBufferNew = 2000
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV5.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
UnmarshalCompressedECC = 270000
GenerateKeyECC = 7000000
EncodeDERSig = 10000000
VerifySecp256r1 = 2000000
VerifyBLSSignatureShare = 2000000
VerifyBLSMultiSig = 2000000

[ManagedBufferAPICost]
MBufferNew = 2000
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV6.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
UnmarshalCompressedECC = 270000
GenerateKeyECC = 7000000
EncodeDERSig = 10000000
VerifySecp256r1 = 2000000
VerifyBLSSignatureShare = 2000000
VerifyBLSMultiSig = 2000000

[ManagedBufferAPICost]
MBufferNew = 2000
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV7.toml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@
UnmarshalCompressedECC = 270000
GenerateKeyECC = 7000000
EncodeDERSig = 10000000
VerifySecp256r1 = 2000000
VerifyBLSSignatureShare = 2000000
VerifyBLSMultiSig = 2000000

[ManagedBufferAPICost]
MBufferNew = 2000
Expand Down
3 changes: 2 additions & 1 deletion common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -1011,9 +1011,10 @@ const (
StakingV4Step1Flag core.EnableEpochFlag = "StakingV4Step1Flag"
StakingV4Step2Flag core.EnableEpochFlag = "StakingV4Step2Flag"
StakingV4Step3Flag core.EnableEpochFlag = "StakingV4Step3Flag"
StakingQueueFlag core.EnableEpochFlag = "StakingQueueFlag"
StakingV4StartedFlag core.EnableEpochFlag = "StakingV4StartedFlag"
AlwaysMergeContextsInEEIFlag core.EnableEpochFlag = "AlwaysMergeContextsInEEIFlag"
DynamicESDTFlag core.EnableEpochFlag = "DynamicEsdtFlag"
EGLDInESDTMultiTransferFlag core.EnableEpochFlag = "EGLDInESDTMultiTransferFlag"
CryptoOpcodesV2Flag core.EnableEpochFlag = "CryptoOpcodesV2Flag"
// all new flags must be added to createAllFlagsMap method, as part of enableEpochsHandler allFlagsDefined
)
18 changes: 12 additions & 6 deletions common/enablers/enableEpochsHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,12 +713,6 @@ func (handler *enableEpochsHandler) createAllFlagsMap() {
},
activationEpoch: handler.enableEpochsConfig.StakingV4Step3EnableEpoch,
},
common.StakingQueueFlag: {
isActiveInEpoch: func(epoch uint32) bool {
return epoch < handler.enableEpochsConfig.StakingV4Step1EnableEpoch
},
activationEpoch: handler.enableEpochsConfig.StakingV4Step1EnableEpoch,
},
common.StakingV4StartedFlag: {
isActiveInEpoch: func(epoch uint32) bool {
return epoch >= handler.enableEpochsConfig.StakingV4Step1EnableEpoch
Expand All @@ -737,6 +731,18 @@ func (handler *enableEpochsHandler) createAllFlagsMap() {
},
activationEpoch: handler.enableEpochsConfig.DynamicESDTEnableEpoch,
},
common.EGLDInESDTMultiTransferFlag: {
isActiveInEpoch: func(epoch uint32) bool {
return epoch >= handler.enableEpochsConfig.EGLDInMultiTransferEnableEpoch
},

Check warning on line 737 in common/enablers/enableEpochsHandler.go

View check run for this annotation

Codecov / codecov/patch

common/enablers/enableEpochsHandler.go#L735-L737

Added lines #L735 - L737 were not covered by tests
activationEpoch: handler.enableEpochsConfig.EGLDInMultiTransferEnableEpoch,
},
common.CryptoOpcodesV2Flag: {
isActiveInEpoch: func(epoch uint32) bool {
return epoch >= handler.enableEpochsConfig.CryptoOpcodesV2EnableEpoch
},

Check warning on line 743 in common/enablers/enableEpochsHandler.go

View check run for this annotation

Codecov / codecov/patch

common/enablers/enableEpochsHandler.go#L741-L743

Added lines #L741 - L743 were not covered by tests
activationEpoch: handler.enableEpochsConfig.CryptoOpcodesV2EnableEpoch,
},
}
}

Expand Down
13 changes: 4 additions & 9 deletions common/enablers/enableEpochsHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ func createEnableEpochsConfig() config.EnableEpochs {
StakingV4Step3EnableEpoch: 99,
AlwaysMergeContextsInEEIEnableEpoch: 100,
DynamicESDTEnableEpoch: 101,
EGLDInMultiTransferEnableEpoch: 102,
CryptoOpcodesV2EnableEpoch: 103,
}
}

Expand Down Expand Up @@ -193,13 +195,6 @@ func TestEnableEpochsHandler_IsFlagEnabled(t *testing.T) {
handler.EpochConfirmed(cfg.SetGuardianEnableEpoch+1, 0)
require.True(t, handler.IsFlagEnabled(common.SetGuardianFlag))

handler.EpochConfirmed(cfg.StakingV4Step1EnableEpoch-1, 0)
require.True(t, handler.IsFlagEnabled(common.StakingQueueFlag))
handler.EpochConfirmed(cfg.StakingV4Step1EnableEpoch, 0)
require.False(t, handler.IsFlagEnabled(common.StakingQueueFlag))
handler.EpochConfirmed(cfg.StakingV4Step1EnableEpoch+1, 0)
require.False(t, handler.IsFlagEnabled(common.StakingQueueFlag))

handler.EpochConfirmed(cfg.StakingV4Step1EnableEpoch-1, 0)
require.False(t, handler.IsFlagEnabled(common.StakingV4StartedFlag))
handler.EpochConfirmed(cfg.StakingV4Step1EnableEpoch, 0)
Expand Down Expand Up @@ -319,7 +314,6 @@ func TestEnableEpochsHandler_IsFlagEnabled(t *testing.T) {
require.False(t, handler.IsFlagEnabled(common.StakingV4Step1Flag))
require.True(t, handler.IsFlagEnabled(common.StakingV4Step2Flag))
require.True(t, handler.IsFlagEnabled(common.StakingV4Step3Flag))
require.False(t, handler.IsFlagEnabled(common.StakingQueueFlag))
require.True(t, handler.IsFlagEnabled(common.StakingV4StartedFlag))
require.True(t, handler.IsFlagEnabled(common.AlwaysMergeContextsInEEIFlag))
require.True(t, handler.IsFlagEnabled(common.DynamicESDTFlag))
Expand Down Expand Up @@ -436,10 +430,11 @@ func TestEnableEpochsHandler_GetActivationEpoch(t *testing.T) {
require.Equal(t, cfg.StakingV4Step1EnableEpoch, handler.GetActivationEpoch(common.StakingV4Step1Flag))
require.Equal(t, cfg.StakingV4Step2EnableEpoch, handler.GetActivationEpoch(common.StakingV4Step2Flag))
require.Equal(t, cfg.StakingV4Step3EnableEpoch, handler.GetActivationEpoch(common.StakingV4Step3Flag))
require.Equal(t, cfg.StakingV4Step1EnableEpoch, handler.GetActivationEpoch(common.StakingQueueFlag))
require.Equal(t, cfg.StakingV4Step1EnableEpoch, handler.GetActivationEpoch(common.StakingV4StartedFlag))
require.Equal(t, cfg.AlwaysMergeContextsInEEIEnableEpoch, handler.GetActivationEpoch(common.AlwaysMergeContextsInEEIFlag))
require.Equal(t, cfg.DynamicESDTEnableEpoch, handler.GetActivationEpoch(common.DynamicESDTFlag))
require.Equal(t, cfg.EGLDInMultiTransferEnableEpoch, handler.GetActivationEpoch(common.EGLDInESDTMultiTransferFlag))
require.Equal(t, cfg.CryptoOpcodesV2EnableEpoch, handler.GetActivationEpoch(common.CryptoOpcodesV2Flag))
}

func TestEnableEpochsHandler_IsInterfaceNil(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ type VirtualMachineConfig struct {
WasmVMVersions []WasmVMVersionByEpoch
TimeOutForSCExecutionInMilliseconds uint32
WasmerSIGSEGVPassthrough bool
TransferAndExecuteByUserAddresses []string
}

// WasmVMVersionByEpoch represents the Wasm VM version to be used starting with an epoch
Expand Down
2 changes: 2 additions & 0 deletions config/epochConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ type EnableEpochs struct {
StakingV4Step3EnableEpoch uint32
AlwaysMergeContextsInEEIEnableEpoch uint32
DynamicESDTEnableEpoch uint32
EGLDInMultiTransferEnableEpoch uint32
CryptoOpcodesV2EnableEpoch uint32
BLSMultiSignerEnableEpoch []MultiSignerConfig
}

Expand Down
17 changes: 17 additions & 0 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ func TestTomlParser(t *testing.T) {
WasmVMVersions: wasmVMVersions,
TimeOutForSCExecutionInMilliseconds: 10000,
WasmerSIGSEGVPassthrough: true,
TransferAndExecuteByUserAddresses: []string{
"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe0",
"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe1",
"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe2"},
},
Querying: QueryVirtualMachineConfig{
NumConcurrentVMs: 16,
Expand Down Expand Up @@ -199,6 +203,11 @@ func TestTomlParser(t *testing.T) {
{ StartEpoch = 12, Version = "v0.3" },
{ StartEpoch = 88, Version = "v1.2" },
]
TransferAndExecuteByUserAddresses = [
"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe0", #shard 0
"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe1", #shard 1
"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe2", #shard 2
]
[VirtualMachine.Querying]
NumConcurrentVMs = 16
Expand Down Expand Up @@ -853,6 +862,12 @@ func TestEnableEpochConfig(t *testing.T) {
# DynamicESDTEnableEpoch represents the epoch when dynamic NFT feature is enabled
DynamicESDTEnableEpoch = 95
# EGLDInMultiTransferEnableEpoch represents the epoch when EGLD in MultiTransfer is enabled
EGLDInMultiTransferEnableEpoch = 96
# CryptoOpcodesV2EnableEpoch represents the epoch when BLSMultiSig, Secp256r1 and other opcodes are enabled
CryptoOpcodesV2EnableEpoch = 97
# MaxNodesChangeEnableEpoch holds configuration for changing the maximum number of nodes and the enabling epoch
MaxNodesChangeEnableEpoch = [
{ EpochEnable = 44, MaxNumNodes = 2169, NodesToShufflePerShard = 80 },
Expand Down Expand Up @@ -966,6 +981,8 @@ func TestEnableEpochConfig(t *testing.T) {
CurrentRandomnessOnSortingEnableEpoch: 93,
AlwaysMergeContextsInEEIEnableEpoch: 94,
DynamicESDTEnableEpoch: 95,
EGLDInMultiTransferEnableEpoch: 96,
CryptoOpcodesV2EnableEpoch: 97,
MaxNodesChangeEnableEpoch: []MaxNodesChangeConfig{
{
EpochEnable: 44,
Expand Down
7 changes: 7 additions & 0 deletions epochStart/dtos.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ type OwnerData struct {
AuctionList []state.ValidatorInfoHandler
Qualified bool
}

// ValidatorStatsInEpoch holds validator stats in an epoch
type ValidatorStatsInEpoch struct {
Eligible map[uint32]int
Waiting map[uint32]int
Leaving map[uint32]int
}
1 change: 1 addition & 0 deletions epochStart/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ type StakingDataProvider interface {
ComputeUnQualifiedNodes(validatorInfos state.ShardValidatorsInfoMapHandler) ([][]byte, map[string][][]byte, error)
GetBlsKeyOwner(blsKey []byte) (string, error)
GetNumOfValidatorsInCurrentEpoch() uint32
GetCurrentEpochValidatorStats() ValidatorStatsInEpoch
GetOwnersData() map[string]*OwnerData
Clean()
IsInterfaceNil() bool
Expand Down

0 comments on commit 733cceb

Please sign in to comment.