Skip to content

Commit

Permalink
incoming header handler rollback/cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
axenteoctavian committed May 16, 2024
1 parent c64ce4e commit 612d5b2
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 42 deletions.
1 change: 0 additions & 1 deletion factory/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ type ProcessComponentsHolder interface {
ReceiptsRepository() ReceiptsRepository
SentSignaturesTracker() process.SentSignaturesTracker
EpochSystemSCProcessor() process.EpochStartSystemSCProcessor
IncomingHeaderHandler() process.IncomingHeaderSubscriber
IsInterfaceNil() bool
}

Expand Down
6 changes: 0 additions & 6 deletions factory/mock/processComponentsStub.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ type ProcessComponentsMock struct {
ReceiptsRepositoryInternal factory.ReceiptsRepository
SentSignaturesTrackerInternal process.SentSignaturesTracker
EpochSystemSCProcessorInternal process.EpochStartSystemSCProcessor
IncomingHeadersHandler process.IncomingHeaderSubscriber
}

// Create -
Expand Down Expand Up @@ -292,11 +291,6 @@ func (pcm *ProcessComponentsMock) EpochSystemSCProcessor() process.EpochStartSys
return pcm.EpochSystemSCProcessorInternal
}

// IncomingHeaderHandler -
func (pcs *ProcessComponentsMock) IncomingHeaderHandler() process.IncomingHeaderSubscriber {
return pcs.IncomingHeadersHandler
}

// IsInterfaceNil -
func (pcm *ProcessComponentsMock) IsInterfaceNil() bool {
return pcm == nil
Expand Down
2 changes: 0 additions & 2 deletions factory/processing/processComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ type processComponents struct {
receiptsRepository factory.ReceiptsRepository
sentSignaturesTracker process.SentSignaturesTracker
epochSystemSCProcessor process.EpochStartSystemSCProcessor
incomingHeaderHandler process.IncomingHeaderSubscriber
}

// ProcessComponentsFactoryArgs holds the arguments needed to create a process components factory
Expand Down Expand Up @@ -738,7 +737,6 @@ func (pcf *processComponentsFactory) Create() (*processComponents, error) {
accountsParser: pcf.runTypeComponents.AccountsParser(),
receiptsRepository: receiptsRepository,
sentSignaturesTracker: sentSignaturesTracker,
incomingHeaderHandler: pcf.incomingHeaderSubscriber,
}, nil
}

Expand Down
12 changes: 0 additions & 12 deletions factory/processing/processComponentsHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,18 +689,6 @@ func (m *managedProcessComponents) EpochSystemSCProcessor() process.EpochStartSy
return m.processComponents.epochSystemSCProcessor
}

// IncomingHeaderHandler returns the incoming header handler
func (m *managedProcessComponents) IncomingHeaderHandler() process.IncomingHeaderSubscriber {
m.mutProcessComponents.RLock()
defer m.mutProcessComponents.RUnlock()

if m.processComponents == nil {
return nil
}

return m.processComponents.incomingHeaderHandler
}

// IsInterfaceNil returns true if the interface is nil
func (mpc *managedProcessComponents) IsInterfaceNil() bool {
return mpc == nil
Expand Down
2 changes: 0 additions & 2 deletions factory/processing/processComponentsHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func testManagedProcessComponentsCreateShouldWork(t *testing.T, shardID uint32,
require.True(t, check.IfNil(managedProcessComponents.FullArchiveInterceptorsContainer()))
require.True(t, check.IfNil(managedProcessComponents.SentSignaturesTracker()))
require.True(t, check.IfNil(managedProcessComponents.EpochSystemSCProcessor()))
require.True(t, check.IfNil(managedProcessComponents.IncomingHeaderHandler()))

err := managedProcessComponents.Create()
require.NoError(t, err)
Expand Down Expand Up @@ -154,7 +153,6 @@ func testManagedProcessComponentsCreateShouldWork(t *testing.T, shardID uint32,
require.False(t, check.IfNil(managedProcessComponents.FullArchiveInterceptorsContainer()))
require.False(t, check.IfNil(managedProcessComponents.SentSignaturesTracker()))
require.False(t, check.IfNil(managedProcessComponents.EpochSystemSCProcessor()))
require.False(t, check.IfNil(managedProcessComponents.IncomingHeaderHandler()))

}

Expand Down
10 changes: 2 additions & 8 deletions integrationTests/mock/processComponentsStub.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mock

import (
vmcommon "github.com/multiversx/mx-chain-vm-common-go"

"github.com/multiversx/mx-chain-go/consensus"
"github.com/multiversx/mx-chain-go/dataRetriever"
"github.com/multiversx/mx-chain-go/dblookupext"
Expand All @@ -11,8 +13,6 @@ import (
"github.com/multiversx/mx-chain-go/sharding"
"github.com/multiversx/mx-chain-go/sharding/nodesCoordinator"
"github.com/multiversx/mx-chain-go/update"

vmcommon "github.com/multiversx/mx-chain-vm-common-go"
)

// ProcessComponentsStub -
Expand Down Expand Up @@ -62,7 +62,6 @@ type ProcessComponentsStub struct {
ESDTDataStorageHandlerForAPIInternal vmcommon.ESDTNFTStorageHandler
SentSignaturesTrackerInternal process.SentSignaturesTracker
EpochSystemSCProcessorInternal process.EpochStartSystemSCProcessor
IncomingHeadersHandler process.IncomingHeaderSubscriber
}

// Create -
Expand Down Expand Up @@ -304,11 +303,6 @@ func (pcs *ProcessComponentsStub) EpochSystemSCProcessor() process.EpochStartSys
return pcs.EpochSystemSCProcessorInternal
}

// IncomingHeaderHandler -
func (pcs *ProcessComponentsStub) IncomingHeaderHandler() process.IncomingHeaderSubscriber {
return pcs.IncomingHeadersHandler
}

// IsInterfaceNil -
func (pcs *ProcessComponentsStub) IsInterfaceNil() bool {
return pcs == nil
Expand Down
6 changes: 3 additions & 3 deletions node/chainSimulator/components/dataComponents.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package components

import (
"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-core-go/marshal"

"github.com/multiversx/mx-chain-go/dataRetriever"
"github.com/multiversx/mx-chain-go/dataRetriever/provider"
"github.com/multiversx/mx-chain-go/factory"

"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-core-go/marshal"
)

// ArgsDataComponentsHolder will hold the components needed for data components
Expand Down
4 changes: 2 additions & 2 deletions node/chainSimulator/components/dataComponents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package components
import (
"testing"

"github.com/stretchr/testify/require"

retriever "github.com/multiversx/mx-chain-go/dataRetriever"
chainStorage "github.com/multiversx/mx-chain-go/storage"
"github.com/multiversx/mx-chain-go/testscommon"
"github.com/multiversx/mx-chain-go/testscommon/dataRetriever"
"github.com/multiversx/mx-chain-go/testscommon/storage"

"github.com/stretchr/testify/require"
)

func createArgsDataComponentsHolder() ArgsDataComponentsHolder {
Expand Down
6 changes: 0 additions & 6 deletions node/chainSimulator/components/processComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ type processComponentsHolder struct {
sentSignatureTracker process.SentSignaturesTracker
epochStartSystemSCProcessor process.EpochStartSystemSCProcessor
managedProcessComponentsCloser io.Closer
incomingHeaderHandler process.IncomingHeaderSubscriber
}

// CreateProcessComponents will create the process components holder
Expand Down Expand Up @@ -246,7 +245,6 @@ func CreateProcessComponents(args ArgsProcessComponentsHolder) (*processComponen
accountsParser: managedProcessComponents.AccountsParser(),
sentSignatureTracker: managedProcessComponents.SentSignaturesTracker(),
epochStartSystemSCProcessor: managedProcessComponents.EpochSystemSCProcessor(),
incomingHeaderHandler: managedProcessComponents.IncomingHeaderHandler(),
managedProcessComponentsCloser: managedProcessComponents,
}

Expand Down Expand Up @@ -463,10 +461,6 @@ func (p *processComponentsHolder) EpochSystemSCProcessor() process.EpochStartSys
return p.epochStartSystemSCProcessor
}

func (p *processComponentsHolder) IncomingHeaderHandler() process.IncomingHeaderSubscriber {
return p.incomingHeaderHandler
}

// Close will call the Close methods on all inner components
func (p *processComponentsHolder) Close() error {
return p.managedProcessComponentsCloser.Close()
Expand Down

0 comments on commit 612d5b2

Please sign in to comment.