mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
using password file, some method comments, working getCode for contract
Former-commit-id: 087f9d471291ba6361c8d8e905935227849d57ea [formerly 79568804120e8aa8914977967e3233ba5397b26c] Former-commit-id: aeabcb2d2ca2622defd3f04420cde73df42be53f
This commit is contained in:
parent
0194e1cc0c
commit
f877297737
@ -13,7 +13,7 @@ var (
|
||||
Name: "shard",
|
||||
Usage: "Start a sharding client",
|
||||
ArgsUsage: "[endpoint]",
|
||||
Flags: append(consoleFlags, utils.DataDirFlag),
|
||||
Flags: append(append(consoleFlags, utils.DataDirFlag), utils.PasswordFileFlag),
|
||||
Category: "SHARDING COMMANDS",
|
||||
Description: "TODO(prestonvanloon)- Add sharding client description",
|
||||
}
|
||||
|
@ -13,16 +13,19 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// TODO: Can this be referenced from main.clientIdentifier?
|
||||
// TODO(prestonvanloon): Can this be referenced from main.clientIdentifier?
|
||||
clientIdentifier = "geth" // Client identifier to advertise over the network
|
||||
)
|
||||
|
||||
// Client for sharding. Communicates to geth node via JSON RPC.
|
||||
type Client struct {
|
||||
endpoint string
|
||||
client *ethclient.Client
|
||||
endpoint string // Endpoint to JSON RPC
|
||||
client *ethclient.Client // Ethereum RPC client.
|
||||
keystore *keystore.KeyStore // Keystore containing the single signer
|
||||
ctx *cli.Context // Command line context
|
||||
}
|
||||
|
||||
// MakeShardingClient for interfacing with geth full node.
|
||||
func MakeShardingClient(ctx *cli.Context) *Client {
|
||||
path := node.DefaultDataDir()
|
||||
if ctx.GlobalIsSet(utils.DataDirFlag.Name) {
|
||||
@ -35,7 +38,7 @@ func MakeShardingClient(ctx *cli.Context) *Client {
|
||||
}
|
||||
scryptN, scryptP, keydir, err := config.AccountConfig()
|
||||
if err != nil {
|
||||
panic(err) // TODO: handle this
|
||||
panic(err) // TODO(prestonvanloon): handle this
|
||||
}
|
||||
|
||||
ks := keystore.NewKeyStore(keydir, scryptN, scryptP)
|
||||
@ -43,9 +46,13 @@ func MakeShardingClient(ctx *cli.Context) *Client {
|
||||
return &Client{
|
||||
endpoint: endpoint,
|
||||
keystore: ks,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Start the sharding client.
|
||||
// * Connects to node.
|
||||
// * Verifies the validator management contract.
|
||||
func (c *Client) Start() error {
|
||||
log.Info("Starting sharding client")
|
||||
rpcClient, err := dialRPC(c.endpoint)
|
||||
@ -58,15 +65,17 @@ func (c *Client) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO: Wait to be selected?
|
||||
// TODO: Wait to be selected in goroutine?
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Wait until sharding client is shutdown.
|
||||
func (c *Client) Wait() {
|
||||
// TODO: Blocking lock
|
||||
}
|
||||
|
||||
// dialRPC endpoint to node.
|
||||
func dialRPC(endpoint string) (*rpc.Client, error) {
|
||||
if endpoint == "" {
|
||||
endpoint = node.DefaultIPCEndpoint(clientIdentifier)
|
||||
|
@ -10,7 +10,7 @@ var (
|
||||
// Number of network shards
|
||||
shardCount = 100
|
||||
// Address of the validator management contract
|
||||
validatorManagerAddress = common.StringToAddress("0x315e4c3c34e27Dd28c7dCC27eC233618e76adcAc") // TODO
|
||||
validatorManagerAddress = common.HexToAddress("0xd76b5bf01b55d75733de3997f54a7becc2be3f4a") // TODO
|
||||
// Gas limit for verifying signatures
|
||||
sigGasLimit = 40000
|
||||
// Number of blocks in a period
|
||||
|
118
sharding/vmc.go
118
sharding/vmc.go
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user