Skip to content
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

rc/barnard #6625

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
892749f
add max gas higher factory accepted to economics toml
sasurobert Jun 18, 2024
9382c6c
adding tests
sasurobert Jun 18, 2024
ec0edab
adding tests
sasurobert Jun 18, 2024
e6f8894
adding tests
sasurobert Jun 18, 2024
df3f271
Merge branch 'feat/economics-gas-improve-v2' into change-penaliseGas
sasurobert Jun 20, 2024
716d67d
activate in new epoch
sasurobert Jun 20, 2024
edfc0a0
fix linter issue
ssd04 Aug 12, 2024
e608d64
Merge pull request #6384 from multiversx/merge-rc-1.7.next1-to-rc-1.8.0
ssd04 Aug 14, 2024
e67616d
Optimize GitHub workflows.
andreibancioiu Oct 3, 2024
cff3c01
Merge pull request #6518 from multiversx/optimize-workflows-barnard
AdoAdoAdo Oct 4, 2024
6c49ad4
Merge branch 'rc/v1.7.next1' into spica-to-barnard-23-okt
sasurobert Oct 23, 2024
8e999de
Merge branch 'rc/v1.7.next1' into spica-to-barnard-23-okt
sasurobert Oct 28, 2024
7979558
Merge pull request #6553 from multiversx/spica-to-barnard-23-okt
sasurobert Nov 4, 2024
3dc3d84
Merge branch 'rc/barnard' into change-penaliseGas
sasurobert Nov 4, 2024
35bfe14
merges
sasurobert Nov 4, 2024
93a8198
fixing tests
sasurobert Nov 11, 2024
0b6485b
fixing tests
sasurobert Nov 11, 2024
f293c96
Merge pull request #6264 from multiversx/change-penaliseGas
sasurobert Nov 14, 2024
065db18
heart beats in chain simulator
miiu96 Nov 15, 2024
38d41ac
fix imports
miiu96 Nov 15, 2024
c1bcc7e
index validators chain simulator
miiu96 Nov 15, 2024
2c33cdf
imports
miiu96 Nov 15, 2024
860f20d
fix linter
miiu96 Nov 15, 2024
89d8c01
Merge branch 'master' of https://github.com/multiversx/mx-chain-go in…
sstanculeanu Nov 15, 2024
c22ee81
Merge pull request #6614 from multiversx/merge_master_into_rc_barnard…
sstanculeanu Nov 15, 2024
327f631
Merge branch 'rc/barnard' into heartbeats-chain-simulator
miiu96 Nov 18, 2024
a97147f
chain simulator heartbeat
miiu96 Nov 19, 2024
4df347c
Merge remote-tracking branch 'origin/heartbeats-chain-simulator' into…
miiu96 Nov 19, 2024
ba15dcb
fixes
miiu96 Nov 19, 2024
5e01a06
fixes after review
miiu96 Nov 20, 2024
3094bb0
Merge pull request #6612 from multiversx/heartbeats-chain-simulator
miiu96 Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmd/node/config/economics.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@

[FeeSettings]
GasLimitSettings = [
{EnableEpoch = 0, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "1500000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "15000000000", MaxGasLimitPerTx = "1500000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000"},
{EnableEpoch = 1, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000"},
{EnableEpoch = 2, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000"},
{EnableEpoch = 0, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "1500000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "15000000000", MaxGasLimitPerTx = "1500000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "10"},
{EnableEpoch = 1, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "10"},
{EnableEpoch = 2, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "10"},
{EnableEpoch = 3, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "2"},
]
MinGasPrice = "1000000000" #will yield min tx fee of 0.00005 eGLD
GasPriceModifier = 0.01
Expand Down
4 changes: 2 additions & 2 deletions cmd/node/config/external.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
Username = ""
Password = ""
# EnabledIndexes represents a slice of indexes that will be enabled for indexing. Full list is:
# ["rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators", "operations", "esdts"]
EnabledIndexes = ["rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators", "operations", "esdts"]
# ["rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators", "operations", "esdts", "events"]
EnabledIndexes = ["rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators", "operations", "esdts", "events"]

# EventNotifierConnector defines settings needed to configure and launch the event notifier component
# HTTP event notifier connector integration will be DEPRECATED in the following iterations
Expand Down
1 change: 1 addition & 0 deletions config/economicsConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type GasLimitSetting struct {
MaxGasLimitPerTx string
MinGasLimit string
ExtraGasLimitGuardedTx string
MaxGasHigherFactorAccepted string
}

// FeeSettings will hold economics fee settings
Expand Down
11 changes: 7 additions & 4 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ func TestTomlEconomicsParser(t *testing.T) {
minGasLimit := "18446744073709551615"
extraGasLimitGuardedTx := "50000"
maxGasPriceSetGuardian := "1234567"
maxGasHigherFactorAccepted := "10"
protocolSustainabilityAddress := "erd1932eft30w753xyvme8d49qejgkjc09n5e49w4mwdjtm0neld797su0dlxp"

denomination := 18

cfgEconomicsExpected := EconomicsConfig{
Expand Down Expand Up @@ -299,9 +301,10 @@ func TestTomlEconomicsParser(t *testing.T) {
FeeSettings: FeeSettings{
GasLimitSettings: []GasLimitSetting{
{
MaxGasLimitPerBlock: maxGasLimitPerBlock,
MinGasLimit: minGasLimit,
ExtraGasLimitGuardedTx: extraGasLimitGuardedTx,
MaxGasLimitPerBlock: maxGasLimitPerBlock,
MinGasLimit: minGasLimit,
ExtraGasLimitGuardedTx: extraGasLimitGuardedTx,
MaxGasHigherFactorAccepted: maxGasHigherFactorAccepted,
},
},
MinGasPrice: minGasPrice,
Expand All @@ -328,7 +331,7 @@ func TestTomlEconomicsParser(t *testing.T) {
ProtocolSustainabilityAddress = "` + protocolSustainabilityAddress + `"

[FeeSettings]
GasLimitSettings = [{EnableEpoch = 0, MaxGasLimitPerBlock = "` + maxGasLimitPerBlock + `", MaxGasLimitPerMiniBlock = "", MaxGasLimitPerMetaBlock = "", MaxGasLimitPerMetaMiniBlock = "", MaxGasLimitPerTx = "", MinGasLimit = "` + minGasLimit + `", ExtraGasLimitGuardedTx = "` + extraGasLimitGuardedTx + `"}]
GasLimitSettings = [{EnableEpoch = 0, MaxGasLimitPerBlock = "` + maxGasLimitPerBlock + `", MaxGasLimitPerMiniBlock = "", MaxGasLimitPerMetaBlock = "", MaxGasLimitPerMetaMiniBlock = "", MaxGasLimitPerTx = "", MinGasLimit = "` + minGasLimit + `", ExtraGasLimitGuardedTx = "` + extraGasLimitGuardedTx + `", MaxGasHigherFactorAccepted = "` + maxGasHigherFactorAccepted + `"}]
MinGasPrice = "` + minGasPrice + `"
MaxGasPriceSetGuardian = "` + maxGasPriceSetGuardian + `"
`
Expand Down
13 changes: 9 additions & 4 deletions genesis/process/disabled/feeHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ func (fh *FeeHandler) MaxGasLimitPerMiniBlockForSafeCrossShard() uint64 {
return math.MaxUint64
}

// MaxGasHigherFactorAccepted returns 10
func (fh *FeeHandler) MaxGasHigherFactorAccepted() uint64 {
return 10
}

// MaxGasLimitPerTx returns max uint64
func (fh *FeeHandler) MaxGasLimitPerTx() uint64 {
return math.MaxUint64
Expand Down Expand Up @@ -164,22 +169,22 @@ func (fh *FeeHandler) ComputeTxFeeBasedOnGasUsed(_ data.TransactionWithFeeHandle
}

// ComputeTxFeeInEpoch returns 0
func (fh *FeeHandler) ComputeTxFeeInEpoch(tx data.TransactionWithFeeHandler, epoch uint32) *big.Int {
func (fh *FeeHandler) ComputeTxFeeInEpoch(_ data.TransactionWithFeeHandler, _ uint32) *big.Int {
return big.NewInt(0)
}

// ComputeGasLimitInEpoch returns 0
func (fh *FeeHandler) ComputeGasLimitInEpoch(tx data.TransactionWithFeeHandler, epoch uint32) uint64 {
func (fh *FeeHandler) ComputeGasLimitInEpoch(_ data.TransactionWithFeeHandler, _ uint32) uint64 {
return 0
}

// ComputeGasUsedAndFeeBasedOnRefundValueInEpoch returns 0
func (fh *FeeHandler) ComputeGasUsedAndFeeBasedOnRefundValueInEpoch(tx data.TransactionWithFeeHandler, refundValue *big.Int, epoch uint32) (uint64, *big.Int) {
func (fh *FeeHandler) ComputeGasUsedAndFeeBasedOnRefundValueInEpoch(_ data.TransactionWithFeeHandler, _ *big.Int, _ uint32) (uint64, *big.Int) {
return 0, big.NewInt(0)
}

// ComputeTxFeeBasedOnGasUsedInEpoch returns 0
func (fh *FeeHandler) ComputeTxFeeBasedOnGasUsedInEpoch(tx data.TransactionWithFeeHandler, gasUsed uint64, epoch uint32) *big.Int {
func (fh *FeeHandler) ComputeTxFeeBasedOnGasUsedInEpoch(_ data.TransactionWithFeeHandler, _ uint64, _ uint32) *big.Int {
return big.NewInt(0)
}

Expand Down
4 changes: 2 additions & 2 deletions integrationTests/chainSimulator/relayedTx/relayedTx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func testFixRelayedMoveBalanceWithChainSimulatorScCall(
require.NoError(t, err)

// send relayed tx, fix still not active
innerTx = generateTransaction(owner.Bytes, 2, scAddressBytes, big.NewInt(0), txDataAdd, 3000000)
innerTx = generateTransaction(owner.Bytes, 2, scAddressBytes, big.NewInt(0), txDataAdd, 1230000)
marshalledTx, err = json.Marshal(innerTx)
require.NoError(t, err)
txData = []byte("relayedTx@" + hex.EncodeToString(marshalledTx))
Expand All @@ -119,7 +119,7 @@ func testFixRelayedMoveBalanceWithChainSimulatorScCall(
require.NoError(t, err)

// send relayed tx after fix
innerTx = generateTransaction(owner.Bytes, 3, scAddressBytes, big.NewInt(0), txDataAdd, 3000000)
innerTx = generateTransaction(owner.Bytes, 3, scAddressBytes, big.NewInt(0), txDataAdd, 1500000)
marshalledTx, err = json.Marshal(innerTx)
require.NoError(t, err)
txData = []byte("relayedTx@" + hex.EncodeToString(marshalledTx))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ func testChainSimulatorDirectStakedWithdrawUnstakedFundsInBatches(t *testing.T,
require.Nil(t, err)
require.NotNil(t, unStakeTx)

unStakeTxFee, _ := big.NewInt(0).SetString(unStakeTx.Fee, 10)
unStakeTxFee1, _ := big.NewInt(0).SetString(unStakeTx.Fee, 10)

testEpoch := targetEpoch + 1
err = cs.GenerateBlocksUntilEpochIsReached(testEpoch)
Expand All @@ -1898,6 +1898,8 @@ func testChainSimulatorDirectStakedWithdrawUnstakedFundsInBatches(t *testing.T,
require.Nil(t, err)
require.NotNil(t, unStakeTx)

unStakeTxFee2, _ := big.NewInt(0).SetString(unStakeTx.Fee, 10)

testEpoch++
err = cs.GenerateBlocksUntilEpochIsReached(testEpoch)
require.Nil(t, err)
Expand All @@ -1910,6 +1912,8 @@ func testChainSimulatorDirectStakedWithdrawUnstakedFundsInBatches(t *testing.T,
require.Nil(t, err)
require.NotNil(t, unStakeTx)

unStakeTxFee3, _ := big.NewInt(0).SetString(unStakeTx.Fee, 10)

testEpoch++
err = cs.GenerateBlocksUntilEpochIsReached(testEpoch)
require.Nil(t, err)
Expand Down Expand Up @@ -1977,9 +1981,9 @@ func testChainSimulatorDirectStakedWithdrawUnstakedFundsInBatches(t *testing.T,

txsFee.Add(txsFee, stakeTxFee)
txsFee.Add(txsFee, unBondTxFee)
txsFee.Add(txsFee, unStakeTxFee)
txsFee.Add(txsFee, unStakeTxFee)
txsFee.Add(txsFee, unStakeTxFee)
txsFee.Add(txsFee, unStakeTxFee1)
txsFee.Add(txsFee, unStakeTxFee2)
txsFee.Add(txsFee, unStakeTxFee3)

balanceAfterUnbonding.Add(balanceAfterUnbonding, txsFee)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
var log = logger.GetOrCreate("stakingProvider")

const gasLimitForConvertOperation = 510_000_000
const gasLimitForDelegationContractCreationOperation = 500_000_000
const gasLimitForDelegationContractCreationOperation = 100_000_000
const gasLimitForAddNodesOperation = 500_000_000
const gasLimitForUndelegateOperation = 500_000_000
const gasLimitForMergeOperation = 600_000_000
Expand Down
20 changes: 15 additions & 5 deletions integrationTests/chainSimulator/vm/esdtImprovements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3868,7 +3868,9 @@ func TestChainSimulator_CheckRolesWhichHasToBeSingular(t *testing.T) {
}

func TestChainSimulator_metaESDT_mergeMetaDataFromMultipleUpdates(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

baseIssuingCost := "1000"
cs, _ := getTestChainSimulatorWithDynamicNFTEnabled(t, baseIssuingCost)
Expand Down Expand Up @@ -4237,7 +4239,9 @@ func transferSpecialRoleToAddr(
}

func TestChainSimulator_dynamicNFT_mergeMetaDataFromMultipleUpdates(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

baseIssuingCost := "1000"
cs, _ := getTestChainSimulatorWithDynamicNFTEnabled(t, baseIssuingCost)
Expand Down Expand Up @@ -4385,7 +4389,9 @@ func TestChainSimulator_dynamicNFT_mergeMetaDataFromMultipleUpdates(t *testing.T
}

func TestChainSimulator_dynamicNFT_changeMetaDataForOneNFTShouldNotChangeOtherNonces(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

baseIssuingCost := "1000"
cs, _ := getTestChainSimulatorWithDynamicNFTEnabled(t, baseIssuingCost)
Expand Down Expand Up @@ -4498,7 +4504,9 @@ func TestChainSimulator_dynamicNFT_changeMetaDataForOneNFTShouldNotChangeOtherNo
}

func TestChainSimulator_dynamicNFT_updateBeforeCreateOnSameAccountShouldOverwrite(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

baseIssuingCost := "1000"
cs, _ := getTestChainSimulatorWithDynamicNFTEnabled(t, baseIssuingCost)
Expand Down Expand Up @@ -4595,7 +4603,9 @@ func TestChainSimulator_dynamicNFT_updateBeforeCreateOnSameAccountShouldOverwrit
}

func TestChainSimulator_dynamicNFT_updateBeforeCreateOnDifferentAccountsShouldMergeMetaDataWhenTransferred(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

baseIssuingCost := "1000"
cs, _ := getTestChainSimulatorWithDynamicNFTEnabled(t, baseIssuingCost)
Expand Down
1 change: 1 addition & 0 deletions integrationTests/testProcessorNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@ func createDefaultEconomicsConfig() *config.EconomicsConfig {
MaxGasLimitPerTx: maxGasLimitPerBlock,
MinGasLimit: minGasLimit,
ExtraGasLimitGuardedTx: "50000",
MaxGasHigherFactorAccepted: "10",
},
},
MinGasPrice: minGasPrice,
Expand Down
1 change: 1 addition & 0 deletions integrationTests/vm/testInitializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ func createEconomicsData(enableEpochsConfig config.EnableEpochs, gasPriceModifie
MaxGasLimitPerTx: maxGasLimitPerBlock,
MinGasLimit: minGasLimit,
ExtraGasLimitGuardedTx: "50000",
MaxGasHigherFactorAccepted: "10",
},
},
MinGasPrice: minGasPrice,
Expand Down
1 change: 1 addition & 0 deletions integrationTests/vm/wasm/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ func (context *TestContext) initFeeHandlers() {
MaxGasLimitPerTx: maxGasLimitPerBlock,
MinGasLimit: minGasLimit,
ExtraGasLimitGuardedTx: "50000",
MaxGasHigherFactorAccepted: "10",
},
},
MinGasPrice: minGasPrice,
Expand Down
11 changes: 8 additions & 3 deletions node/chainSimulator/chainSimulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
"time"

"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/factory"
"github.com/multiversx/mx-chain-go/node/chainSimulator/components"
"github.com/multiversx/mx-chain-go/node/chainSimulator/components/heartbeat"
"github.com/multiversx/mx-chain-go/node/chainSimulator/configs"
"github.com/multiversx/mx-chain-go/node/chainSimulator/dtos"
chainSimulatorErrors "github.com/multiversx/mx-chain-go/node/chainSimulator/errors"
Expand Down Expand Up @@ -130,18 +132,20 @@ func (s *simulator) createChainHandlers(args ArgsBaseChainSimulator) error {
return err
}

monitor := heartbeat.NewHeartbeatMonitor()

for idx := -1; idx < int(args.NumOfShards); idx++ {
shardIDStr := fmt.Sprintf("%d", idx)
if idx == -1 {
shardIDStr = "metachain"
}

node, errCreate := s.createTestNode(*outputConfigs, args, shardIDStr)
node, errCreate := s.createTestNode(*outputConfigs, args, shardIDStr, monitor)
if errCreate != nil {
return errCreate
}

chainHandler, errCreate := process.NewBlocksCreator(node)
chainHandler, errCreate := process.NewBlocksCreator(node, monitor)
if errCreate != nil {
return errCreate
}
Expand Down Expand Up @@ -195,7 +199,7 @@ func computeStartTimeBaseOnInitialRound(args ArgsChainSimulator) int64 {
}

func (s *simulator) createTestNode(
outputConfigs configs.ArgsConfigsSimulator, args ArgsBaseChainSimulator, shardIDStr string,
outputConfigs configs.ArgsConfigsSimulator, args ArgsBaseChainSimulator, shardIDStr string, monitor factory.HeartbeatV2Monitor,
) (process.NodeHandler, error) {
argsTestOnlyProcessorNode := components.ArgsTestOnlyProcessingNode{
Configs: outputConfigs.Configs,
Expand All @@ -214,6 +218,7 @@ func (s *simulator) createTestNode(
MetaChainConsensusGroupSize: args.MetaChainConsensusGroupSize,
RoundDurationInMillis: args.RoundDurationInMillis,
VmQueryDelayAfterStartInMs: args.VmQueryDelayAfterStartInMs,
Monitor: monitor,
}

return components.NewTestOnlyProcessingNode(argsTestOnlyProcessorNode)
Expand Down
6 changes: 5 additions & 1 deletion node/chainSimulator/chainSimulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ func TestChainSimulator_GenerateBlocksShouldWork(t *testing.T) {
})
require.Nil(t, err)
require.NotNil(t, chainSimulator)

defer chainSimulator.Close()

time.Sleep(time.Second)

err = chainSimulator.GenerateBlocks(50)
require.Nil(t, err)

heartBeats, err := chainSimulator.GetNodeHandler(0).GetFacadeHandler().GetHeartbeats()
require.Nil(t, err)
require.Equal(t, 4, len(heartBeats))

}

func TestChainSimulator_GenerateBlocksAndEpochChangeShouldWork(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions node/chainSimulator/components/coreComponents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func createArgsCoreComponentsHolder() ArgsCoreComponentsHolder {
MaxGasLimitPerTx: "10000000000",
MinGasLimit: "10",
ExtraGasLimitGuardedTx: "50000",
MaxGasHigherFactorAccepted: "10",
},
},
GasPriceModifier: 0.01,
Expand Down
52 changes: 52 additions & 0 deletions node/chainSimulator/components/heartbeat/heartBeat.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package heartbeat

import (
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-go/factory"
"github.com/multiversx/mx-chain-go/heartbeat"
)

type heartBeatComponents struct {
monitor factory.HeartbeatV2Monitor
}

// NewSyncedHeartbeatComponents will create a new instance of heartbeat components
func NewSyncedHeartbeatComponents(monitor factory.HeartbeatV2Monitor) (factory.HeartbeatV2ComponentsHandler, error) {
if check.IfNil(monitor) {
return nil, heartbeat.ErrNilHeartbeatMonitor
}

return &heartBeatComponents{
monitor: monitor,
}, nil
}

// Create will do nothing
func (h *heartBeatComponents) Create() error {
return nil
}

// Close will do nothing
func (h *heartBeatComponents) Close() error {
return nil
}

// CheckSubcomponents will do nothing
func (h *heartBeatComponents) CheckSubcomponents() error {
return nil
}

// String will return a string
func (h *heartBeatComponents) String() string {
return "heartBeat"
}

// Monitor will return the monitor
func (h *heartBeatComponents) Monitor() factory.HeartbeatV2Monitor {
return h.monitor
}

// IsInterfaceNil returns true if there is no value under the interface
func (h *heartBeatComponents) IsInterfaceNil() bool {
return h == nil
}
Loading
Loading