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

[chain_simulator] Enable http server option #5699

Merged
merged 8 commits into from
Nov 14, 2023
Merged
Changes from 5 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
2 changes: 1 addition & 1 deletion node/chainSimulator/chainSimulator.go
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ func NewChainSimulator(
genesisTimestamp int64,
roundDurationInMillis uint64,
roundsPerEpoch core.OptionalUint64,
apiInterface components.APIConfigurator, // interface
apiInterface components.APIConfigurator,
) (*simulator, error) {
syncedBroadcastNetwork := components.NewSyncedBroadcastNetwork()

2 changes: 1 addition & 1 deletion node/chainSimulator/components/api/fixedAPIInterface.go
Original file line number Diff line number Diff line change
@@ -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])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
1 change: 1 addition & 0 deletions node/chainSimulator/components/interface.go
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ type SyncedBroadcastNetworkHandler interface {
IsInterfaceNil() bool
}

// APIConfigurator defines what an api configurator should be able to do
type APIConfigurator interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

RestApiInterface(shardID uint32) string
}
1 change: 0 additions & 1 deletion node/chainSimulator/components/statusComponents.go
Original file line number Diff line number Diff line change
@@ -94,6 +94,5 @@ func (s *statusComponentsHolder) SetForkDetector(_ process.ForkDetector) error {

// StartPolling will do nothing
func (s *statusComponentsHolder) StartPolling() error {
// todo check if this method
return nil
}
5 changes: 4 additions & 1 deletion node/chainSimulator/components/statusCoreComponents.go
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ type statusCoreComponentsHolder struct {
persistentStatusHandler factory.PersistentStatusHandler
}

// CreateStatusCoreComponents will create a new instance of factory.StatusCoreComponentsHolder
// CreateStatusCoreComponents will create a new instance of factory.StatusCoreComponentsHandler
func CreateStatusCoreComponents(configs config.Configs, coreComponents factory.CoreComponentsHolder) (factory.StatusCoreComponentsHandler, error) {
var err error

@@ -44,6 +44,9 @@ func CreateStatusCoreComponents(configs config.Configs, coreComponents factory.C
return nil, err
}

// stop resource monitor
_ = managedStatusCoreComponents.ResourceMonitor().Close()

instance := &statusCoreComponentsHolder{
closeHandler: NewCloseHandler(),
resourceMonitor: managedStatusCoreComponents.ResourceMonitor(),
3 changes: 2 additions & 1 deletion node/chainSimulator/testdata/addresses.go
Original file line number Diff line number Diff line change
@@ -9,5 +9,6 @@ const (
// GenesisAddressWithBalance holds the initial address that has balance
GenesisAddressWithBalance = "erd1rhrm20mmf2pugzxc3twlu3fa264hxeefnglsy4ads4dpccs9s3jsg6qdrz"

//GenesisAddressWithBalanceSK = "ad1136a125fd3f1cfb154159442e4bc6a3b5c3095943029958ac464da7ce13eb"
// GenesisAddressWithBalanceSK holds the secret key of the initial address
GenesisAddressWithBalanceSK = "ad1136a125fd3f1cfb154159442e4bc6a3b5c3095943029958ac464da7ce13eb"
)