-
Notifications
You must be signed in to change notification settings - Fork 204
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
[chain_simulator] Enable http server option #5699
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## feat/test-only-processor-node #5699 +/- ##
=================================================================
- Coverage 79.06% 78.89% -0.18%
=================================================================
Files 728 729 +1
Lines 95517 95721 +204
=================================================================
- Hits 75519 75516 -3
- Misses 14638 14846 +208
+ Partials 5360 5359 -1 ☔ View full report in Codecov by Sentry. |
@@ -38,7 +38,7 @@ type bootstrapComponentsHolder struct { | |||
} | |||
|
|||
// CreateBootstrapComponentHolder will create a new instance of bootstrap components holder | |||
func CreateBootstrapComponentHolder(args ArgsBootstrapComponentsHolder) (factory.BootstrapComponentsHolder, error) { | |||
func CreateBootstrapComponentHolder(args ArgsBootstrapComponentsHolder) (factory.BootstrapComponentsHandler, error) { |
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.
Please rename to CreateBootstrapComponents
and remove the inner closeHandler
declaration & usage
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.
renamed
@@ -46,7 +46,7 @@ type cryptoComponentsHolder struct { | |||
} | |||
|
|||
// CreateCryptoComponentsHolder will create a new instance of cryptoComponentsHolder | |||
func CreateCryptoComponentsHolder(args ArgsCryptoComponentsHolder) (factory.CryptoComponentsHolder, error) { | |||
func CreateCryptoComponentsHolder(args ArgsCryptoComponentsHolder) (factory.CryptoComponentsHandler, error) { |
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.
Please rename to CreateCryptoComponents
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.
renamed
@@ -25,7 +25,7 @@ type dataComponentsHolder struct { | |||
} | |||
|
|||
// CreateDataComponentsHolder will create the data components holder | |||
func CreateDataComponentsHolder(args ArgsDataComponentsHolder) (factory.DataComponentsHolder, error) { | |||
func CreateDataComponentsHolder(args ArgsDataComponentsHolder) (factory.DataComponentsHandler, error) { |
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.
Please rename to CreateDataComponents
and remove the inner closeHandler declaration & usage
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.
renamed
@@ -27,7 +27,7 @@ type networkComponentsHolder struct { | |||
} | |||
|
|||
// CreateNetworkComponentsHolder creates a new networkComponentsHolder instance | |||
func CreateNetworkComponentsHolder(network SyncedBroadcastNetworkHandler) (*networkComponentsHolder, error) { | |||
func CreateNetworkComponentsHolder(network SyncedBroadcastNetworkHandler) (factory.NetworkComponentsHandler, error) { |
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.
Please rename to CreateNetworkComponents
and remove the inner closeHandler declaration & usage
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.
done
@@ -31,7 +31,7 @@ type stateComponentsHolder struct { | |||
} | |||
|
|||
// CreateStateComponents will create the state components holder | |||
func CreateStateComponents(args ArgsStateComponents) (factory.StateComponentsHolder, error) { | |||
func CreateStateComponents(args ArgsStateComponents) (factory.StateComponentsHandler, error) { |
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.
Please rename to CreateStateComponents
and remove the inner closeHandler declaration & usage
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.
done
@@ -24,25 +19,41 @@ type statusCoreComponentsHolder struct { | |||
} | |||
|
|||
// CreateStatusCoreComponentsHolder will create a new instance of factory.StatusCoreComponentsHolder | |||
func CreateStatusCoreComponentsHolder(cfg config.Config, coreComponents factory.CoreComponentsHolder) (factory.StatusCoreComponentsHolder, error) { | |||
func CreateStatusCoreComponentsHolder(configs config.Configs, coreComponents factory.CoreComponentsHolder) (factory.StatusCoreComponentsHandler, error) { |
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.
Please rename to CreateStatusCoreComponents
and remove the inner closeHandler declaration & usage
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.
renamed
@@ -22,6 +23,8 @@ import ( | |||
|
|||
// ArgsTestOnlyProcessingNode represents the DTO struct for the NewTestOnlyProcessingNode constructor function | |||
type ArgsTestOnlyProcessingNode struct { | |||
Configs config.Configs | |||
// TODO remove the rest of configs because configs contains all of them |
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.
implement TODO now or in the next PR?
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.
done.
@@ -326,7 +342,11 @@ func (node *testOnlyProcessingNode) GetStateComponents() factory.StateComponents | |||
return node.StateComponentsHolder | |||
} | |||
|
|||
func (node *testOnlyProcessingNode) collectClosableComponents() { | |||
func (node *testOnlyProcessingNode) GetFacadeHandler() shared.FacadeHandler { |
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.
missing comment
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.
done
@@ -335,6 +355,10 @@ func (node *testOnlyProcessingNode) collectClosableComponents() { | |||
node.closeHandler.AddComponent(node.NetworkComponentsHolder) | |||
node.closeHandler.AddComponent(node.StatusCoreComponents) | |||
node.closeHandler.AddComponent(node.CoreComponentsHolder) | |||
node.closeHandler.AddComponent(node.facadeHandler) | |||
if enableHTTPServer { |
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.
instead of this ugly if, the createHttpServer can return a mock http server if the chain simulator is run without APIs
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.
removed
@@ -31,6 +31,7 @@ func NewChainSimulator( | |||
genesisTimestamp int64, | |||
roundDurationInMillis uint64, | |||
roundsPerEpoch core.OptionalUint64, | |||
apiInterface components.APIConfigurator, // interface |
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.
remove // interface
?
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.
done
@@ -11,3 +11,7 @@ type SyncedBroadcastNetworkHandler interface { | |||
GetConnectedPeersOnTopic(topic string) []core.PeerID | |||
IsInterfaceNil() bool | |||
} | |||
|
|||
type APIConfigurator interface { |
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.
missing comments
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.
done
|
||
// RestApiInterface will return the api interface for the provided shard | ||
func (f *fixedPortAPIConfigurator) RestApiInterface(shardID uint32) string { | ||
return fmt.Sprintf("%s:%d", f.restAPIInterface, f.restAPIInterface[shardID]) |
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.
return fmt.Sprintf("%s:%d", f.restAPIInterface, f.restAPIInterface[shardID]) | |
return fmt.Sprintf("%s:%d", f.restAPIInterface, f.mapShardPort[shardID]) |
?
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.
fixed
|
||
// StartPolling will do nothing | ||
func (s *statusComponentsHolder) StartPolling() error { | ||
// todo check if this method |
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.
solve or update this todo message
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.
removed todo for the monent
@@ -23,26 +18,45 @@ type statusCoreComponentsHolder struct { | |||
persistentStatusHandler factory.PersistentStatusHandler | |||
} | |||
|
|||
// CreateStatusCoreComponentsHolder will create a new instance of factory.StatusCoreComponentsHolder | |||
func CreateStatusCoreComponentsHolder(cfg config.Config, coreComponents factory.CoreComponentsHolder) (factory.StatusCoreComponentsHolder, error) { | |||
// CreateStatusCoreComponents will create a new instance of factory.StatusCoreComponentsHolder |
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.
// CreateStatusCoreComponents will create a new instance of factory.StatusCoreComponentsHolder | |
// CreateStatusCoreComponents will create a new instance of factory.StatusCoreComponentsHandler |
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.
fixed
@@ -17,5 +17,5 @@ func NewFixedPortAPIConfigurator(restAPIInterface string, mapShardPort map[uint3 | |||
|
|||
// RestApiInterface will return the api interface for the provided shard | |||
func (f *fixedPortAPIConfigurator) RestApiInterface(shardID uint32) string { | |||
return fmt.Sprintf("%s:%d", f.restAPIInterface, f.restAPIInterface[shardID]) | |||
return fmt.Sprintf("%s:%d", f.restAPIInterface, f.mapShardPort[shardID]) |
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.
👍
Reasoning behind the pull request
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?