contract deploy somewhat working

Former-commit-id: 2bccce337d29f12b7a96d5d79be6528c1ddfe6e6 [formerly 853da49db264a445f955c21294909909c59b56f7]
Former-commit-id: d67aece06f67fc24d0a7036646ded876218ce84f
This commit is contained in:
Preston Van Loon 2018-01-15 16:39:00 -05:00
parent 50e92a018e
commit 7e09ed395b
4 changed files with 99 additions and 7 deletions

View File

@ -13,6 +13,7 @@ var (
Name: "shard",
Usage: "Start a sharding client",
ArgsUsage: "[endpoint]",
Flags: append(consoleFlags, utils.DataDirFlag),
Category: "SHARDING COMMANDS",
Description: "TODO(prestonvanloon)- Add sharding client description",
}

View File

@ -1,7 +1,9 @@
package sharding
import (
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
@ -15,7 +17,8 @@ const (
type Client struct {
endpoint string
client *rpc.Client
client *ethclient.Client
keystore *keystore.KeyStore // Keystore containing the single signer
}
func MakeShardingClient(ctx *cli.Context) *Client {
@ -24,8 +27,19 @@ func MakeShardingClient(ctx *cli.Context) *Client {
endpoint = ctx.GlobalString(utils.DataDirFlag.Name)
}
config := &node.Config{
DataDir: "/tmp/ethereum",
}
scryptN, scryptP, keydir, err := config.AccountConfig()
if err != nil {
panic(err) // TODO: handle this
}
ks := keystore.NewKeyStore(keydir, scryptN, scryptP)
return &Client{
endpoint: endpoint,
keystore: ks,
}
}
@ -35,8 +49,8 @@ func (c *Client) Start() error {
if err != nil {
return err
}
c.client = rpcClient
defer c.client.Close()
c.client = ethclient.NewClient(rpcClient)
defer rpcClient.Close()
if err := c.verifyVMC(); err != nil {
return err
}

View File

@ -1,12 +1,16 @@
package sharding
import "math/big"
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
)
var (
// Number of network shards
shardCount = 100
// Address of the validator management contract
validatorManagerAddress = "" // TODO
validatorManagerAddress = common.StringToAddress("0x315e4c3c34e27Dd28c7dCC27eC233618e76adcAc") // TODO
// Gas limit for verifying signatures
sigGasLimit = 40000
// Number of blocks in a period
@ -15,4 +19,8 @@ var (
lookaheadPeriods = 4
// Required deposit size in wei
depositSize = new(big.Int).Exp(big.NewInt(10), big.NewInt(20), nil) // 100 ETH
// Gas limit to create contract
contractGasLimit = uint64(4700000) // Max is 4712388
// Gas price for contract creation
contractGasPrice = new(big.Int).SetInt64(18000000000)
)

File diff suppressed because one or more lines are too long