mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
Quick fixes (#141)
Sharding: * Sharding: add actor flag to sharding group for app help * Sharding: ensure rpcClient is not nil before calling Close() * Sharding: revert shardingcmd.go comments * Sharding: more address Str() fixes Former-commit-id: 0b3d8b73ac1b20eb5c018a71be1d935a1fb860ef [formerly 6cd1df472713e95f6b9f8a0a7b6bbd88a5dd2ca2] Former-commit-id: 90c7e1a70d46c1f889576a7f2f253a02414c3654
This commit is contained in:
parent
25eb11f30e
commit
689800d065
@ -86,6 +86,7 @@ var AppHelpFlagGroups = []flagGroup{
|
|||||||
{
|
{
|
||||||
Name: "SHARDING",
|
Name: "SHARDING",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
utils.ActorFlag,
|
||||||
utils.DepositFlag,
|
utils.DepositFlag,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -162,7 +162,10 @@ func (n *shardingNode) Register(constructor sharding.ServiceConstructor) error {
|
|||||||
|
|
||||||
// Close the RPC client connection.
|
// Close the RPC client connection.
|
||||||
func (n *shardingNode) Close() {
|
func (n *shardingNode) Close() {
|
||||||
n.rpcClient.Close()
|
// rpcClient could be nil if the connection failed.
|
||||||
|
if n.rpcClient != nil {
|
||||||
|
n.rpcClient.Close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTXOpts creates a *TransactOpts with a signer using the default account on the keystore.
|
// CreateTXOpts creates a *TransactOpts with a signer using the default account on the keystore.
|
||||||
|
@ -26,14 +26,14 @@ func dialRPC(endpoint string) (*rpc.Client, error) {
|
|||||||
func initSMC(n *shardingNode) (*contracts.SMC, error) {
|
func initSMC(n *shardingNode) (*contracts.SMC, error) {
|
||||||
b, err := n.client.CodeAt(context.Background(), sharding.ShardingManagerAddress, nil)
|
b, err := n.client.CodeAt(context.Background(), sharding.ShardingManagerAddress, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get contract code at %s: %v", sharding.ShardingManagerAddress, err)
|
return nil, fmt.Errorf("unable to get contract code at %s: %v", sharding.ShardingManagerAddress.Str(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deploy SMC for development only.
|
// Deploy SMC for development only.
|
||||||
// TODO: Separate contract deployment from the sharding node. It would only need to be deployed
|
// TODO: Separate contract deployment from the sharding node. It would only need to be deployed
|
||||||
// once on the mainnet, so this code would not need to ship with the node.
|
// once on the mainnet, so this code would not need to ship with the node.
|
||||||
if len(b) == 0 {
|
if len(b) == 0 {
|
||||||
log.Info(fmt.Sprintf("No sharding manager contract found at %s. Deploying new contract.", sharding.ShardingManagerAddress))
|
log.Info(fmt.Sprintf("No sharding manager contract found at %s. Deploying new contract.", sharding.ShardingManagerAddress.Str()))
|
||||||
|
|
||||||
txOps, err := n.CreateTXOpts(big.NewInt(0))
|
txOps, err := n.CreateTXOpts(big.NewInt(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -52,7 +52,7 @@ func initSMC(n *shardingNode) (*contracts.SMC, error) {
|
|||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info(fmt.Sprintf("New contract deployed at %s", addr))
|
log.Info(fmt.Sprintf("New contract deployed at %s", addr.Str()))
|
||||||
return contract, nil
|
return contract, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user