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

Feat/sovereign mainchain header sync #6558

Merged
merged 141 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
f37a7ef
FEAT: Move incomingHeaderProcessor package from sovereign to node
mariusmihaic Oct 18, 2024
efcd1d5
FEAT: RunTypeComponentsHolder for incoming header processor
mariusmihaic Oct 18, 2024
be649c7
CLN: Interfaces
mariusmihaic Oct 18, 2024
97a9409
CLN: incomingHeaderHandlerFactory_test.go + refactor factory params
mariusmihaic Oct 18, 2024
956b391
FIX: Build
mariusmihaic Oct 18, 2024
678b1ec
FEAT: Create epoch start data cross chain
mariusmihaic Oct 21, 2024
9d34c74
FEAT: receivedGenesisMainChainHeaderWithoutPreGenesis
mariusmihaic Oct 21, 2024
d2ca6b8
FEAT: displayLastCrossChainNotarizedHeader
mariusmihaic Oct 21, 2024
dcedab1
FEAT: displayLastCrossChainNotarizedHeader
mariusmihaic Oct 21, 2024
a54a40c
FEAT: Test displayLastCrossChainNotarizedHeader
mariusmihaic Oct 21, 2024
d3790ca
FEAT: Index pre-genesis incoming header
mariusmihaic Oct 21, 2024
4855cb0
FIX: Tests + cleanup
mariusmihaic Oct 22, 2024
961cb20
CLN: More cleanup + fix tests
mariusmihaic Oct 22, 2024
e83c3d1
FEAT: Save last cross chain notarized headers + bootstrap
mariusmihaic Oct 22, 2024
d096d9c
CLN: General cleanup
mariusmihaic Oct 23, 2024
e4c4cb1
FEAT: Tests + fixes bootStrapSovereignShardProcessor_test.go
mariusmihaic Oct 23, 2024
8e40044
FEAT: Test SaveDataToStorageCheckLastCrossChainNotarizedDataIsSaved
mariusmihaic Oct 23, 2024
afae722
FEAT: TestGetExtendedSharHeaderFromStorage + TestGetExtendedHeaderFro…
mariusmihaic Oct 23, 2024
5254e62
CLN: Remove get extended hdr from storage code
mariusmihaic Oct 23, 2024
83a9722
CLN: Line
mariusmihaic Oct 23, 2024
f597c3e
Merge branch 'MX-15948-bootstrap-cross-chain-header' into MX-15950-ge…
mariusmihaic Oct 23, 2024
6015cca
FEAT: Get extended header from storage
mariusmihaic Oct 23, 2024
2f9c51d
FIX: Import cycle
mariusmihaic Oct 23, 2024
8389d15
Merge branch 'MX-15948-bootstrap-cross-chain-header' into MX-15950-ge…
mariusmihaic Oct 23, 2024
ddb52bd
CLN: Unit tests
mariusmihaic Oct 23, 2024
48246b6
FIX: Race condition failing tests
mariusmihaic Oct 23, 2024
6599e4d
Merge branch 'MX-15948-bootstrap-cross-chain-header' into MX-15950-ge…
mariusmihaic Oct 23, 2024
e668733
FEAT: Start updating mock notifier
mariusmihaic Oct 23, 2024
9cd7ced
logs update in mock notifier
axenteoctavian Oct 24, 2024
db13b46
Merge pull request #6545 from multiversx/MX-15936-move-incoming-heade…
mariusmihaic Oct 24, 2024
6337d02
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15944-cre…
mariusmihaic Oct 24, 2024
da32bf2
FIX: After review
mariusmihaic Oct 24, 2024
4b813d4
FIX: isGenesisHeaderWithNoPreviousTracking
mariusmihaic Oct 24, 2024
bef4499
Merge pull request #6549 from multiversx/MX-15944-create-epoch-start-…
mariusmihaic Oct 24, 2024
8b242b1
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15948-boo…
mariusmihaic Oct 24, 2024
6cffdc5
FEAT: Cross header requester meta/extended
mariusmihaic Oct 24, 2024
164e0b3
FEAT: Cross header requester integrated in syncHeadersByHash.go
mariusmihaic Oct 24, 2024
9d1095f
FEAT: createHeadersSyncer in bootStrapProcessor
mariusmihaic Oct 24, 2024
da8af9e
FEAT: Add unit tests
mariusmihaic Oct 24, 2024
1caf0a5
CLN: createCrossHeaderRequester -> createCrossHeaderRequester
mariusmihaic Oct 24, 2024
de11bd5
fix request incoming SCRs
axenteoctavian Oct 24, 2024
7d9e597
FEAT: Test errNilCrossHeaderRequester
mariusmihaic Oct 24, 2024
d7d54b8
grpc enabled flag
axenteoctavian Oct 24, 2024
ae66230
Merge pull request #6557 from multiversx/mock-notifier-logs-update
axenteoctavian Oct 24, 2024
f0c3fb6
FEAT: Ugly modified version on shardStorageBootstrapper.go
mariusmihaic Oct 25, 2024
89ce0ae
FEAT: Add code in sovereignChainShardStorageBootstrapper.go
mariusmihaic Oct 25, 2024
bb91d78
FEAT: First sov bootStrap test for applyCrossNotarizedHeaders
mariusmihaic Oct 25, 2024
1e0b915
FEAT: testCleanupNotarizedStorageForHigherNoncesIfExist + refactor
mariusmihaic Oct 25, 2024
5770a3d
FEAT: Test sov cleanupNotarizedStorage
mariusmihaic Oct 25, 2024
3d1706a
CLN: After self review
mariusmihaic Oct 25, 2024
ae64696
Merge pull request #6561 from multiversx/fix-request-incoming-scrs
axenteoctavian Oct 25, 2024
3b7ebfa
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15948-boo…
mariusmihaic Oct 28, 2024
b1f754b
FEAT: Easy solution getBlockFinality for extended headers
mariusmihaic Oct 28, 2024
5caafce
FIX: Unit tests
mariusmihaic Oct 28, 2024
1549191
Merge pull request #6552 from multiversx/MX-15948-bootstrap-cross-cha…
mariusmihaic Oct 28, 2024
c026fc5
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15950-get…
mariusmihaic Oct 28, 2024
aefaae5
Merge pull request #6554 from multiversx/MX-15950-get-extended-header…
mariusmihaic Oct 28, 2024
fb7e571
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15952-syn…
mariusmihaic Oct 28, 2024
87f00bc
FIX: After review
mariusmihaic Oct 28, 2024
fa6a353
FIX: Linter
mariusmihaic Oct 28, 2024
c32c3b3
FEAT: First version chain sim test incoming header 0 finality
mariusmihaic Oct 29, 2024
dfb32cb
FEAT: Second chain sim test case
mariusmihaic Oct 29, 2024
969aa87
Merge pull request #6559 from multiversx/MX-15952-sync-extended-heade…
mariusmihaic Oct 29, 2024
da1da54
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15953-cro…
mariusmihaic Oct 29, 2024
22be259
FEAT: Third use case test
mariusmihaic Oct 29, 2024
3e29079
CLN: Lots of cleanup for test case 1 + extended use cases
mariusmihaic Oct 29, 2024
6c46440
CLN: General tests cleanup + utility funcs
mariusmihaic Oct 29, 2024
3a79eb6
CLN: Utility func GetCurrentSovereignHeader
mariusmihaic Oct 29, 2024
aaa4f8d
CLN: sovChainBlockTracer
mariusmihaic Oct 29, 2024
b5decf5
FIX: Typo
mariusmihaic Oct 30, 2024
85a5064
FEAT: Add first version notifierBootstrapper.go
mariusmihaic Oct 30, 2024
55e7569
FEAT: Integrate notifierBootstrapper into sovereignNodeRunner.go
mariusmihaic Oct 30, 2024
f7ab872
FIX: getLastCrossNotarizedHeaders
mariusmihaic Oct 30, 2024
b439c1c
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15951-upd…
axenteoctavian Oct 30, 2024
d5f3114
CLN: checkNodeState
mariusmihaic Oct 31, 2024
fa21b21
FEAT: First unit tests notifierBootstrapper.go
mariusmihaic Oct 31, 2024
0f972f5
FEAT: Extend unit tests notifier bootstrapper
mariusmihaic Oct 31, 2024
d9d349a
FIX: Unit test + small cleanup
mariusmihaic Oct 31, 2024
5f3f42e
FEAT: Trust mode: createNotifierWSReceiverServicesIfNeeded
mariusmihaic Nov 1, 2024
a54a94c
FEAT: Add info log when notifier is disabled
mariusmihaic Nov 4, 2024
41d7623
fixes after review
axenteoctavian Nov 5, 2024
ebc3fb1
fixes after review 2
axenteoctavian Nov 5, 2024
dbae082
fixes after review 3
axenteoctavian Nov 5, 2024
f4ba6ae
FIX: Do not request incoming headers upon receiving
mariusmihaic Nov 5, 2024
feac147
FEAT: Extend test case 3 for incoming header to not request other hea…
mariusmihaic Nov 5, 2024
bedd104
FIX: Unit test
mariusmihaic Nov 5, 2024
e6c4f53
Merge pull request #6555 from multiversx/MX-15951-update-mock-notifier
axenteoctavian Nov 6, 2024
9018342
FIX: After review
mariusmihaic Nov 6, 2024
fa4053f
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15953-cro…
mariusmihaic Nov 6, 2024
ab4e1ac
Merge pull request #6562 from multiversx/MX-15953-cross-chain-header-…
mariusmihaic Nov 6, 2024
a8ac19e
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15959-ext…
mariusmihaic Nov 6, 2024
9e65486
Merge branch 'MX-15959-extended-header-block-finality-to-zero' into M…
mariusmihaic Nov 6, 2024
9537851
Merge branch 'MX-15962-chain-sim-test-incoming-header-finality' into …
mariusmihaic Nov 6, 2024
88c0d33
Merge branch 'MX-15963-disable-notifier-until-synced' into MX-15961-s…
mariusmihaic Nov 6, 2024
47378d2
Merge branch 'MX-15961-sov-node-trust-mode' into MX-15984-fix-request…
mariusmihaic Nov 6, 2024
148a4f4
FIX: Quick and dirty fix resync cross chain mbs
mariusmihaic Nov 7, 2024
1ba8b22
FIX: Delete getBlockFinalityFunc and set variable to 0
mariusmihaic Nov 7, 2024
ff232c0
FIX: Delete getBlockFinalityFunc and set variable to 0
mariusmihaic Nov 7, 2024
db6d194
Merge pull request #6568 from multiversx/MX-15959-extended-header-blo…
mariusmihaic Nov 7, 2024
fbc7ac7
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15962-cha…
mariusmihaic Nov 7, 2024
49c93d9
Merge pull request #6569 from multiversx/MX-15962-chain-sim-test-inco…
mariusmihaic Nov 7, 2024
3e62c38
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15963-dis…
mariusmihaic Nov 7, 2024
cc78eb4
FEAT: Stop node on channel if notifier bootstrapper fails
mariusmihaic Nov 7, 2024
deaafbd
Merge pull request #6571 from multiversx/MX-15963-disable-notifier-un…
mariusmihaic Nov 8, 2024
f2e7047
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15961-sov…
mariusmihaic Nov 8, 2024
5bdc041
FIX: After merge
mariusmihaic Nov 8, 2024
536725b
Merge pull request #6578 from multiversx/MX-15961-sov-node-trust-mode
mariusmihaic Nov 8, 2024
d477412
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-15984-fix…
mariusmihaic Nov 8, 2024
b95eff1
Merge branch 'MX-15984-fix-request-incoming-header' into MX-16008-fix…
mariusmihaic Nov 8, 2024
a9dcce7
Merge pull request #6585 from multiversx/MX-15984-fix-request-incomin…
mariusmihaic Nov 8, 2024
c5f11d7
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-16008-fix…
mariusmihaic Nov 8, 2024
cd563fb
FEAT: Intercepted sovereign block header with mb headers checker
mariusmihaic Nov 8, 2024
6b411cb
FEAT: interceptedShardSovereignHeaderDataFactory.go and integrate it
mariusmihaic Nov 8, 2024
9491d19
FEAT: interceptedMiniBlockSovereignDataFactory.go and integrate it
mariusmihaic Nov 8, 2024
0a7dbad
FIX: Intercepted miniblock check with interface
mariusmihaic Nov 11, 2024
7c52836
FEAT: Unit tests intercepted sov header + mbs
mariusmihaic Nov 11, 2024
97aeea7
FEAT: Unit tests intercepted data factory for sov header + mbs
mariusmihaic Nov 11, 2024
a47a8a3
FIX: Revert RoundsPerEpoch config
mariusmihaic Nov 11, 2024
465e77d
FEAT: Quick solution to not request peer miniblocks on epoch change
mariusmihaic Nov 13, 2024
1fd14c1
CLN: Create and save epoch change mbs
mariusmihaic Nov 13, 2024
e58efe9
FEAT: Unity test sov validator create mbs
mariusmihaic Nov 14, 2024
f5018fb
CLN: General cleanup + extend epoch change test
mariusmihaic Nov 14, 2024
5974d1c
CLN: General cleanup + extend epoch change test
mariusmihaic Nov 14, 2024
86fcc75
Merge pull request #6587 from multiversx/MX-16008-fix-resync-cross-ch…
mariusmihaic Nov 18, 2024
5c55f17
Merge branch 'feat/sovereign-mainchain-header-sync' into MX-16089-opt…
mariusmihaic Nov 18, 2024
4caf94b
FIX: Go imports
mariusmihaic Nov 18, 2024
23c73cd
Merge pull request #6600 from multiversx/MX-16089-optimize-epoch-chan…
mariusmihaic Nov 18, 2024
19d8ad2
FIX: Comment
mariusmihaic Nov 18, 2024
a729faa
Merge pull request #6618 from multiversx/fix-missed-review-comm
mariusmihaic Nov 18, 2024
e2fbfb1
Merge branch 'feat/chain-go-sdk' into merge-feat-sovereign-into-sov-m…
mariusmihaic Nov 18, 2024
af28d99
CLN: Update go mod in mock notifier
mariusmihaic Nov 18, 2024
67d5584
Merge pull request #6619 from multiversx/merge-feat-sovereign-into-so…
mariusmihaic Nov 19, 2024
b923d41
FIX: Quick fix in isHeaderReceivedTooLate blockFinality to 0
mariusmihaic Nov 19, 2024
6c2d5cc
FEAT: Push bunch of changes to check if it works
mariusmihaic Nov 19, 2024
a26cba4
CLN: General cleanup, clean solution clean tracked headers
mariusmihaic Nov 20, 2024
5e680c8
FEAT: Refactor notifier bootstrap to work with confidence threshold t…
mariusmihaic Nov 20, 2024
a4ad7f5
CLN: Logs + test for sov shard tracker
mariusmihaic Nov 20, 2024
dac0d27
FIX: After review
mariusmihaic Nov 25, 2024
624ae44
Merge pull request #6622 from multiversx/MX-16147-fix-sync-process-bl…
mariusmihaic Nov 25, 2024
397fa02
Merge branch 'feat/chain-go-sdk' into merge-feat-sovereign-into-feat-…
mariusmihaic Nov 25, 2024
910d464
Merge pull request #6630 from multiversx/merge-feat-sovereign-into-fe…
mariusmihaic Nov 25, 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
39 changes: 39 additions & 0 deletions cmd/sovereignnode/chainSimulator/common/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package common

import (
"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/factory"
"github.com/multiversx/mx-chain-go/factory/runType"
"github.com/multiversx/mx-chain-go/node/chainSimulator/process"
sovRunType "github.com/multiversx/mx-chain-go/sovereignnode/runType"
)

// GetCurrentSovereignHeader returns current sovereign chain block handler from blockchain hook
func GetCurrentSovereignHeader(nodeHandler process.NodeHandler) data.SovereignChainHeaderHandler {
return nodeHandler.GetChainHandler().GetCurrentBlockHeader().(data.SovereignChainHeaderHandler)
}

// CreateSovereignRunTypeComponents will create sovereign run type components
func CreateSovereignRunTypeComponents(args runType.ArgsRunTypeComponents, sovereignExtraConfig config.SovereignConfig) (factory.RunTypeComponentsHolder, error) {
argsSovRunType, err := sovRunType.CreateSovereignArgsRunTypeComponents(args, sovereignExtraConfig)
if err != nil {
return nil, err
}

sovereignComponentsFactory, err := runType.NewSovereignRunTypeComponentsFactory(*argsSovRunType)
if err != nil {
return nil, err
}

managedRunTypeComponents, err := runType.NewManagedRunTypeComponents(sovereignComponentsFactory)
if err != nil {
return nil, err
}
err = managedRunTypeComponents.Create()
if err != nil {
return nil, err
}

return managedRunTypeComponents, nil
}
35 changes: 7 additions & 28 deletions cmd/sovereignnode/chainSimulator/sovereignChainSimulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/multiversx/mx-chain-go/node"
"github.com/multiversx/mx-chain-go/node/chainSimulator"
"github.com/multiversx/mx-chain-go/process"
"github.com/multiversx/mx-chain-go/process/block/sovereign/incomingHeader"
sovCommon "github.com/multiversx/mx-chain-go/sovereignnode/chainSimulator/common"
sovereignConfig "github.com/multiversx/mx-chain-go/sovereignnode/config"
"github.com/multiversx/mx-chain-go/sovereignnode/incomingHeader"
sovRunType "github.com/multiversx/mx-chain-go/sovereignnode/runType"
)

const (
Expand Down Expand Up @@ -54,11 +54,13 @@ func NewSovereignChainSimulator(args ArgsSovereignChainSimulator) (chainSimulato
args.CreateRunTypeCoreComponents = func() (factory.RunTypeCoreComponentsHolder, error) {
return createSovereignRunTypeCoreComponents()
}
args.CreateIncomingHeaderSubscriber = func(config *config.NotifierConfig, dataPool dataRetriever.PoolsHolder, mainChainNotarizationStartRound uint64, runTypeComponents factory.RunTypeComponentsHolder) (process.IncomingHeaderSubscriber, error) {
args.CreateIncomingHeaderSubscriber = func(config config.WebSocketConfig, dataPool dataRetriever.PoolsHolder, mainChainNotarizationStartRound uint64, runTypeComponents factory.RunTypeComponentsHolder) (process.IncomingHeaderSubscriber, error) {
return incomingHeader.CreateIncomingHeaderProcessor(config, dataPool, mainChainNotarizationStartRound, runTypeComponents)
}
args.CreateRunTypeComponents = func(argsRunType runType.ArgsRunTypeComponents) (factory.RunTypeComponentsHolder, error) {
return createSovereignRunTypeComponents(argsRunType, *configs.SovereignExtraConfig)
if args.CreateRunTypeComponents == nil {
args.CreateRunTypeComponents = func(args runType.ArgsRunTypeComponents) (factory.RunTypeComponentsHolder, error) {
return sovCommon.CreateSovereignRunTypeComponents(args, *configs.SovereignExtraConfig)
}
}
args.NodeFactory = node.NewSovereignNodeFactory(configs.SovereignExtraConfig.GenesisConfig.NativeESDT)
args.ChainProcessorFactory = NewSovereignChainHandlerFactory()
Expand Down Expand Up @@ -105,26 +107,3 @@ func createSovereignRunTypeCoreComponents() (factory.RunTypeCoreComponentsHolder

return managedRunTypeCoreComponents, nil
}

func createSovereignRunTypeComponents(args runType.ArgsRunTypeComponents, sovereignExtraConfig config.SovereignConfig) (factory.RunTypeComponentsHolder, error) {
argsSovRunType, err := sovRunType.CreateSovereignArgsRunTypeComponents(args, sovereignExtraConfig)
if err != nil {
return nil, err
}

sovereignComponentsFactory, err := runType.NewSovereignRunTypeComponentsFactory(*argsSovRunType)
if err != nil {
return nil, err
}

managedRunTypeComponents, err := runType.NewManagedRunTypeComponents(sovereignComponentsFactory)
if err != nil {
return nil, err
}
err = managedRunTypeComponents.Create()
if err != nil {
return nil, err
}

return managedRunTypeComponents, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ import (

"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/dataRetriever"
"github.com/multiversx/mx-chain-go/dataRetriever/requestHandlers"
"github.com/multiversx/mx-chain-go/factory"
"github.com/multiversx/mx-chain-go/factory/runType"
chainSim "github.com/multiversx/mx-chain-go/integrationTests/chainSimulator"
"github.com/multiversx/mx-chain-go/integrationTests/chainSimulator/staking"
"github.com/multiversx/mx-chain-go/node/chainSimulator"
"github.com/multiversx/mx-chain-go/node/chainSimulator/components/api"
"github.com/multiversx/mx-chain-go/node/chainSimulator/process"
proc "github.com/multiversx/mx-chain-go/process"
"github.com/multiversx/mx-chain-go/process/headerCheck"
sovereignChainSimulator "github.com/multiversx/mx-chain-go/sovereignnode/chainSimulator"
"github.com/multiversx/mx-chain-go/sovereignnode/chainSimulator/common"
"github.com/multiversx/mx-chain-go/testscommon"
"github.com/multiversx/mx-chain-go/testscommon/components"
testsFactory "github.com/multiversx/mx-chain-go/testscommon/factory"
)

const (
Expand All @@ -41,6 +49,27 @@ func TestSovereignChainSimulator_EpochChange(t *testing.T) {
Value: 50, // do not lower this value so that each validator can participate in consensus as leader to get rewards
}

sovConfig := config.SovereignConfig{}

sovRequestHandler := &testscommon.ExtendedShardHeaderRequestHandlerStub{
RequestHandlerStub: testscommon.RequestHandlerStub{
RequestMiniBlockHandlerCalled: func(destShardID uint32, miniblockHash []byte) {
require.Fail(t, "should not request miniBlock")
},
RequestMiniBlocksHandlerCalled: func(destShardID uint32, miniblocksHashes [][]byte) {
require.Fail(t, "should not request miniBlocks")
},
RequestRewardTxHandlerCalled: func(destShardID uint32, txHashes [][]byte) {
require.Fail(t, "should not request reward txs")
},
},
}
sovRequestHandlerFactory := &testsFactory.RequestHandlerFactoryMock{
CreateRequestHandlerCalled: func(args requestHandlers.RequestHandlerArgs) (proc.RequestHandler, error) {
return sovRequestHandler, nil
},
}

var protocolSustainabilityAddress string
cs, err := sovereignChainSimulator.NewSovereignChainSimulator(sovereignChainSimulator.ArgsSovereignChainSimulator{
SovereignConfigPath: sovereignConfigPath,
Expand Down Expand Up @@ -68,6 +97,16 @@ func TestSovereignChainSimulator_EpochChange(t *testing.T) {

protocolSustainabilityAddress = cfg.EconomicsConfig.RewardsSettings.RewardsConfigByEpoch[0].ProtocolSustainabilityAddress
cfg.EpochConfig.EnableEpochs = newCfg
sovConfig = cfg.GeneralConfig.SovereignConfig
},
CreateRunTypeComponents: func(args runType.ArgsRunTypeComponents) (factory.RunTypeComponentsHolder, error) {
runTypeComps, err := common.CreateSovereignRunTypeComponents(args, sovConfig)
require.Nil(t, err)

runTypeCompsHolder := components.GetRunTypeComponentsStub(runTypeComps)
runTypeCompsHolder.RequestHandlerFactory = sovRequestHandlerFactory

return runTypeCompsHolder, nil
},
},
})
Expand Down Expand Up @@ -235,15 +274,11 @@ func checkProtocolSustainabilityAddressBalanceIncreased(
}

func getAllFeesInEpoch(nodeHandler process.NodeHandler) (*big.Int, *big.Int) {
sovHdr := getCurrSovHdr(nodeHandler)
sovHdr := common.GetCurrentSovereignHeader(nodeHandler)
return sovHdr.GetAccumulatedFeesInEpoch(), sovHdr.GetDevFeesInEpoch()
}

func getAllFees(nodeHandler process.NodeHandler) (*big.Int, *big.Int) {
sovHdr := getCurrSovHdr(nodeHandler)
sovHdr := common.GetCurrentSovereignHeader(nodeHandler)
return sovHdr.GetAccumulatedFees(), sovHdr.GetDeveloperFees()
}

func getCurrSovHdr(nodeHandler process.NodeHandler) data.SovereignChainHeaderHandler {
return nodeHandler.GetChainHandler().GetCurrentBlockHeader().(data.SovereignChainHeaderHandler)
}
13 changes: 8 additions & 5 deletions cmd/sovereignnode/chainSimulator/tests/esdt/issueSc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ func TestSovereignChainSimulator_SmartContract_IssueToken(t *testing.T) {
PathToInitialConfig: defaultPathToInitialConfig,
GenesisTimestamp: time.Now().Unix(),
RoundDurationInMillis: uint64(6000),
RoundsPerEpoch: core.OptionalUint64{},
ApiInterface: api.NewNoApiInterface(),
MinNodesPerShard: 2,
RoundsPerEpoch: core.OptionalUint64{
HasValue: true,
Value: 25,
},
ApiInterface: api.NewNoApiInterface(),
MinNodesPerShard: 2,
AlterConfigsFunction: func(cfg *config.Configs) {
cfg.SystemSCConfig.ESDTSystemSCConfig.BaseIssuingCost = issuePrice
},
Expand All @@ -59,10 +62,10 @@ func TestSovereignChainSimulator_SmartContract_IssueToken(t *testing.T) {

defer cs.Close()

time.Sleep(time.Second) // wait for VM to be ready for processing queries
err = cs.GenerateBlocksUntilEpochIsReached(6)
require.Nil(t, err)

nodeHandler := cs.GetNodeHandler(core.SovereignChainShardId)

systemScAddress := chainSim.GetSysAccBytesAddress(t, nodeHandler)

wallet, err := cs.GenerateAndMintWalletAddress(core.SovereignChainShardId, big.NewInt(0).Mul(chainSim.OneEGLD, big.NewInt(100)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ func checkCrossNotarizedHeader(t *testing.T, round int, crossNotarizedHeader dat

if round == 1 { // first cross header is dummy with nonce 0
require.Equal(t, uint64(0), crossNotarizedHeader.GetNonce())
} else if round == 2 { // first cross notarized header is 10000000
} else { // cross header with nonce is notarized
require.Equal(t, headerNonce, crossNotarizedHeader.GetNonce())
} else { // cross header with nonce-1 is notarized
require.Equal(t, headerNonce-1, crossNotarizedHeader.GetNonce())
}
}
Loading
Loading