-
Notifications
You must be signed in to change notification settings - Fork 197
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
sovereign extra header verifier in runtype components #6140
Changes from 9 commits
5646b5d
5957136
678786d
d52308b
c865bd1
c8bfccc
d91e5e0
8a7a9e1
86d389d
ea22298
24e8879
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,12 @@ import ( | |
"github.com/multiversx/mx-chain-go/genesis" | ||
"github.com/multiversx/mx-chain-go/genesis/parsing" | ||
processComp "github.com/multiversx/mx-chain-go/genesis/process" | ||
"github.com/multiversx/mx-chain-go/process" | ||
"github.com/multiversx/mx-chain-go/process/block" | ||
"github.com/multiversx/mx-chain-go/process/block/preprocess" | ||
"github.com/multiversx/mx-chain-go/process/block/sovereign" | ||
"github.com/multiversx/mx-chain-go/process/coordinator" | ||
"github.com/multiversx/mx-chain-go/process/factory/interceptorscontainer" | ||
"github.com/multiversx/mx-chain-go/process/headerCheck" | ||
"github.com/multiversx/mx-chain-go/process/peer" | ||
"github.com/multiversx/mx-chain-go/process/smartContract/hooks" | ||
"github.com/multiversx/mx-chain-go/process/smartContract/processorV2" | ||
|
@@ -42,15 +42,13 @@ type ArgsSovereignRunTypeComponents struct { | |
Config config.SovereignConfig | ||
DataCodec sovereign.DataCodecHandler | ||
TopicsChecker sovereign.TopicsCheckerHandler | ||
ExtraVerifier process.ExtraHeaderSigVerifierHandler | ||
} | ||
|
||
type sovereignRunTypeComponentsFactory struct { | ||
*runTypeComponentsFactory | ||
sovConfig config.SovereignConfig | ||
dataCodec sovereign.DataCodecHandler | ||
topicsChecker sovereign.TopicsCheckerHandler | ||
extraVerifier process.ExtraHeaderSigVerifierHandler | ||
} | ||
|
||
// NewSovereignRunTypeComponentsFactory will return a new instance of runTypeComponentsFactory | ||
|
@@ -64,16 +62,12 @@ func NewSovereignRunTypeComponentsFactory(args ArgsSovereignRunTypeComponents) ( | |
if check.IfNil(args.TopicsChecker) { | ||
return nil, errors.ErrNilTopicsChecker | ||
} | ||
if check.IfNil(args.ExtraVerifier) { | ||
return nil, errors.ErrNilExtraSubRoundSigner | ||
} | ||
|
||
return &sovereignRunTypeComponentsFactory{ | ||
runTypeComponentsFactory: args.RunTypeComponentsFactory, | ||
sovConfig: args.Config, | ||
dataCodec: args.DataCodec, | ||
topicsChecker: args.TopicsChecker, | ||
extraVerifier: args.ExtraVerifier, | ||
}, nil | ||
} | ||
|
||
|
@@ -212,7 +206,11 @@ func (rcf *sovereignRunTypeComponentsFactory) Create() (*runTypeComponents, erro | |
|
||
expiryTime := time.Second * time.Duration(rcf.sovConfig.OutgoingSubscribedEvents.TimeToWaitForUnconfirmedOutGoingOperationInSeconds) | ||
|
||
err = rtc.extraHeaderSigVerifierHandler.RegisterExtraHeaderSigVerifier(rcf.extraVerifier) | ||
sovHeaderSigVerifier, err := headerCheck.NewSovereignHeaderSigVerifier(rcf.cryptoComponents.BlockSigner()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this also removed from normal run type ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normal RunType doesn't use an extra header sig verifier, it's just: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name of the variable was wrong and confused me; |
||
if err != nil { | ||
return nil, fmt.Errorf("sovereignRunTypeComponentsFactory - NewSovereignHeaderSigVerifier failed: %w", err) | ||
} | ||
err = rtc.extraHeaderSigVerifierHolder.RegisterExtraHeaderSigVerifier(sovHeaderSigVerifier) | ||
if err != nil { | ||
return nil, fmt.Errorf("sovereignRunTypeComponentsFactory - RegisterExtraHeaderSigVerifier failed: %w", err) | ||
} | ||
|
@@ -247,7 +245,7 @@ func (rcf *sovereignRunTypeComponentsFactory) Create() (*runTypeComponents, erro | |
interceptorsContainerFactoryCreator: interceptorscontainer.NewSovereignShardInterceptorsContainerFactoryCreator(), | ||
shardResolversContainerFactoryCreator: resolverscontainer.NewSovereignShardResolversContainerFactoryCreator(), | ||
txPreProcessorCreator: preprocess.NewSovereignTxPreProcessorCreator(), | ||
extraHeaderSigVerifierHandler: rtc.extraHeaderSigVerifierHandler, | ||
extraHeaderSigVerifierHolder: rtc.extraHeaderSigVerifierHolder, | ||
genesisBlockCreatorFactory: processComp.NewSovereignGenesisBlockCreatorFactory(), | ||
genesisMetaBlockCheckerCreator: processComp.NewSovereignGenesisMetaBlockChecker(), | ||
}, nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.