Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ jobs:
const exitCode = process.env.PYTEST_EXIT_CODE;

const simulatorCommitHash = process.env.SIMULATOR_COMMIT_HASH || 'N/A';
const testingSuiteCommitHash = process.env.CURRENT_COMMIT_HASH || 'N/A';
const r2Url = process.env.R2_REPORT_URL || 'N/A';

const issue_number = context.issue.number;
Expand Down Expand Up @@ -465,8 +466,9 @@ jobs:
- **Current Branch:** \`${currentBranch}\`
- **mx-chain-go Target Branch:** \`${goTargetBranch}\`
- **mx-chain-simulator-go Target Branch:** \`${simulatorTargetBranch}\`
- **mx-chain-testing-suite Target Branch:** \`${testingSuiteTargetBranch}\`
- **mx-chain-simulator-go Commit Hash:** \`${simulatorCommitHash}\`
- **mx-chain-testing-suite Target Branch:** \`${testingSuiteTargetBranch}\`
- **mx-chain-testing-suite Commit Hash:** \`${testingSuiteCommitHash}\`

🚀 **Environment Variables:**
- **TIMESTAMP:** \`${ts}\`
Expand Down
3 changes: 3 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,9 @@ const (
// MetricRelayedTransactionsV1V2DisableEpoch represents the epoch when relayed transactions v1 and v2 are disabled
MetricRelayedTransactionsV1V2DisableEpoch = "erd_relayed_transactions_v1_v2_disable_epoch"

// MetricTailInflationEnableEpoch represents the epoch when tail inflation is enabled
MetricTailInflationEnableEpoch = "erd_tail_inflation_enable_epoch"

// MetricEpochEnable represents the epoch when the max nodes change configuration is applied
MetricEpochEnable = "erd_epoch_enable"

Expand Down
2 changes: 2 additions & 0 deletions node/chainSimulator/chainSimulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type transactionWithResult struct {
// ArgsChainSimulator holds the arguments needed to create a new instance of simulator
type ArgsChainSimulator struct {
BypassTxSignatureCheck bool
BypassBlockSignatureCheck bool
TempDir string
PathToInitialConfig string
NumOfShards uint32
Expand Down Expand Up @@ -278,6 +279,7 @@ func (s *simulator) createTestNode(
ShardIDStr: shardIDStr,
APIInterface: args.ApiInterface,
BypassTxSignatureCheck: args.BypassTxSignatureCheck,
BypassBlockSignatureCheck: args.BypassBlockSignatureCheck,
InitialRound: args.InitialRound,
InitialNonce: args.InitialNonce,
MinNodesPerShard: args.MinNodesPerShard,
Expand Down
4 changes: 4 additions & 0 deletions node/chainSimulator/chainSimulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
"github.com/multiversx/mx-chain-core-go/core"
apiBlock "github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/stretchr/testify/assert"

Check failure on line 13 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / Build

other declaration of assert

Check failure on line 13 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / golangci linter

other declaration of assert
"github.com/stretchr/testify/require"

Check failure on line 14 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / Build

other declaration of require

Check failure on line 14 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / golangci linter

other declaration of require

"github.com/multiversx/mx-chain-go/common"
"github.com/stretchr/testify/assert"

Check failure on line 17 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / Build

"github.com/stretchr/testify/assert" imported and not used

Check failure on line 17 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / Build

assert redeclared in this block

Check failure on line 17 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / golangci linter

"github.com/stretchr/testify/assert" imported and not used

Check failure on line 17 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / golangci linter

assert redeclared in this block
"github.com/stretchr/testify/require"

Check failure on line 18 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / Build

"github.com/stretchr/testify/require" imported and not used

Check failure on line 18 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / Build

require redeclared in this block

Check failure on line 18 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / golangci linter

"github.com/stretchr/testify/require" imported and not used (typecheck)

Check failure on line 18 in node/chainSimulator/chainSimulator_test.go

View workflow job for this annotation

GitHub Actions / golangci linter

require redeclared in this block

"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/errors"
Expand Down Expand Up @@ -138,6 +141,7 @@

chainSimulator, err := NewChainSimulator(ArgsChainSimulator{
BypassTxSignatureCheck: true,
BypassBlockSignatureCheck: true,
TempDir: t.TempDir(),
PathToInitialConfig: defaultPathToInitialConfig,
NumOfShards: defaultNumOfShards,
Expand Down
8 changes: 7 additions & 1 deletion node/chainSimulator/components/cryptoComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/multiversx/mx-chain-core-go/core"
crypto "github.com/multiversx/mx-chain-crypto-go"
"github.com/multiversx/mx-chain-crypto-go/signing/disabled/singlesig"

"github.com/multiversx/mx-chain-go/common"
cryptoCommon "github.com/multiversx/mx-chain-go/common/crypto"
"github.com/multiversx/mx-chain-go/config"
Expand All @@ -24,6 +25,7 @@ type ArgsCryptoComponentsHolder struct {
CoreComponentsHolder factory.CoreComponentsHolder
AllValidatorKeysPemFileName string
BypassTxSignatureCheck bool
BypassBlockSignatureCheck bool
}

type cryptoComponentsHolder struct {
Expand Down Expand Up @@ -95,7 +97,11 @@ func CreateCryptoComponents(args ArgsCryptoComponentsHolder) (*cryptoComponentsH
instance.p2pPublicKey = managedCryptoComponents.P2pPublicKey()
instance.p2pPrivateKey = managedCryptoComponents.P2pPrivateKey()
instance.p2pSingleSigner = managedCryptoComponents.P2pSingleSigner()
instance.blockSigner = managedCryptoComponents.BlockSigner()
if args.BypassBlockSignatureCheck {
instance.blockSigner = &singlesig.DisabledSingleSig{}
} else {
instance.blockSigner = managedCryptoComponents.BlockSigner()
}

instance.multiSignerContainer = managedCryptoComponents.MultiSignerContainer()
instance.peerSignatureHandler = managedCryptoComponents.PeerSignatureHandler()
Expand Down
18 changes: 17 additions & 1 deletion node/chainSimulator/components/cryptoComponents_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package components

import (
"fmt"
"testing"

"github.com/multiversx/mx-chain-core-go/core"
"github.com/stretchr/testify/require"

"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/testscommon"
"github.com/multiversx/mx-chain-go/testscommon/factory"
"github.com/stretchr/testify/require"
)

func createArgsCryptoComponentsHolder() ArgsCryptoComponentsHolder {
Expand Down Expand Up @@ -48,6 +50,7 @@ func createArgsCryptoComponentsHolder() ArgsCryptoComponentsHolder {
},
AllValidatorKeysPemFileName: "allValidatorKeys.pem",
BypassTxSignatureCheck: true,
BypassBlockSignatureCheck: false,
}
}

Expand Down Expand Up @@ -76,6 +79,19 @@ func TestCreateCryptoComponents(t *testing.T) {
require.Nil(t, comp.Create())
require.Nil(t, comp.Close())
})
t.Run("should work with bypass blocks sig check", func(t *testing.T) {
t.Parallel()

args := createArgsCryptoComponentsHolder()
args.BypassBlockSignatureCheck = true
comp, err := CreateCryptoComponents(args)
require.NoError(t, err)
require.NotNil(t, comp)
require.Equal(t, "*singlesig.DisabledSingleSig", fmt.Sprintf("%T", comp.blockSigner))

require.Nil(t, comp.Create())
require.Nil(t, comp.Close())
})
t.Run("NewCryptoComponentsFactory failure should error", func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 2 additions & 0 deletions node/chainSimulator/components/testOnlyProcessingNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type ArgsTestOnlyProcessingNode struct {
NumShards uint32
ShardIDStr string
BypassTxSignatureCheck bool
BypassBlockSignatureCheck bool
MinNodesPerShard uint32
ConsensusGroupSize uint32
MinNodesMeta uint32
Expand Down Expand Up @@ -129,6 +130,7 @@ func NewTestOnlyProcessingNode(args ArgsTestOnlyProcessingNode) (*testOnlyProces
Preferences: *args.Configs.PreferencesConfig,
CoreComponentsHolder: instance.CoreComponentsHolder,
BypassTxSignatureCheck: args.BypassTxSignatureCheck,
BypassBlockSignatureCheck: args.BypassBlockSignatureCheck,
AllValidatorKeysPemFileName: args.Configs.ConfigurationPathsHolder.AllValidatorKeys,
})
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions node/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func InitConfigMetrics(
appStatusHandler.SetUInt64Value(common.MetricAutomaticActivationOfNodesDisableEpoch, uint64(enableEpochs.AutomaticActivationOfNodesDisableEpoch))
appStatusHandler.SetUInt64Value(common.MetricFixGetBalanceEnableEpoch, uint64(enableEpochs.FixGetBalanceEnableEpoch))
appStatusHandler.SetUInt64Value(common.MetricRelayedTransactionsV1V2DisableEpoch, uint64(enableEpochs.RelayedTransactionsV1V2DisableEpoch))
appStatusHandler.SetUInt64Value(common.MetricTailInflationEnableEpoch, uint64(economicsConfig.GlobalSettings.TailInflation.EnableEpoch))

for i, nodesChangeConfig := range enableEpochs.MaxNodesChangeEnableEpoch {
epochEnable := fmt.Sprintf("%s%d%s", common.MetricMaxNodesChangeEnableEpoch, i, common.EpochEnableSuffix)
Expand Down
4 changes: 4 additions & 0 deletions node/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ func TestInitConfigMetrics(t *testing.T) {
"erd_automatic_activation_of_nodes_disable_epoch": uint32(114),
"erd_fix_get_balance_enable_epoch": uint32(115),
"erd_relayed_transactions_v1_v2_disable_epoch": uint32(116),
"erd_tail_inflation_enable_epoch": uint32(117),
"erd_max_nodes_change_enable_epoch": nil,
"erd_total_supply": "12345",
"erd_hysteresis": "0.100000",
Expand All @@ -366,6 +367,9 @@ func TestInitConfigMetrics(t *testing.T) {
economicsConfig := config.EconomicsConfig{
GlobalSettings: config.GlobalSettings{
GenesisTotalSupply: "12345",
TailInflation: config.TailInflationSettings{
EnableEpoch: 117,
},
},
}

Expand Down
1 change: 1 addition & 0 deletions statusHandler/statusMetricsProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ func (sm *statusMetrics) EnableEpochsMetrics() (map[string]interface{}, error) {
enableEpochsMetrics[common.MetricBarnardOpcodesEnableEpoch] = sm.uint64Metrics[common.MetricBarnardOpcodesEnableEpoch]
enableEpochsMetrics[common.MetricAutomaticActivationOfNodesDisableEpoch] = sm.uint64Metrics[common.MetricAutomaticActivationOfNodesDisableEpoch]
enableEpochsMetrics[common.MetricFixGetBalanceEnableEpoch] = sm.uint64Metrics[common.MetricFixGetBalanceEnableEpoch]
enableEpochsMetrics[common.MetricTailInflationEnableEpoch] = sm.uint64Metrics[common.MetricTailInflationEnableEpoch]

numNodesChangeConfig := sm.uint64Metrics[common.MetricMaxNodesChangeEnableEpoch+"_count"]

Expand Down
3 changes: 2 additions & 1 deletion statusHandler/statusMetricsProvider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func TestStatusMetrics_EnableEpochMetrics(t *testing.T) {
sm.SetUInt64Value(common.MetricBarnardOpcodesEnableEpoch, uint64(4))
sm.SetUInt64Value(common.MetricAutomaticActivationOfNodesDisableEpoch, uint64(4))
sm.SetUInt64Value(common.MetricFixGetBalanceEnableEpoch, uint64(4))

sm.SetUInt64Value(common.MetricTailInflationEnableEpoch, uint64(4))
maxNodesChangeConfig := []map[string]uint64{
{
"EpochEnable": 0,
Expand Down Expand Up @@ -558,6 +558,7 @@ func TestStatusMetrics_EnableEpochMetrics(t *testing.T) {
common.MetricBarnardOpcodesEnableEpoch: uint64(4),
common.MetricAutomaticActivationOfNodesDisableEpoch: uint64(4),
common.MetricFixGetBalanceEnableEpoch: uint64(4),
common.MetricTailInflationEnableEpoch: uint64(4),
common.MetricMaxNodesChangeEnableEpoch: []map[string]interface{}{
{
common.MetricEpochEnable: uint64(0),
Expand Down
Loading