sharding: align sharding config with minimal sharding protocol

Former-commit-id: bd55dd6746c11c47f8744ca3b2e59c04ad07bb0f [formerly c9b46314489a2e53df4926557fe80075a89ec4e3]
Former-commit-id: 149bf1150a922005b33cb91b622aaef05569f160
This commit is contained in:
Terence Tsao
2018-04-11 08:13:53 -07:00
parent 6618c12ef7
commit f5e3c1c6b9
2 changed files with 19 additions and 19 deletions

View File

@@ -6,33 +6,33 @@ import (
"github.com/ethereum/go-ethereum/common"
)
//go:generate abigen --sol contracts/sharding_manager.sol --pkg contracts --out contracts/sharding_manager.go
var (
// Number of network shards
ShardCount = int64(1)
ShardCount = int64(100)
// Address of the sharding manager contract
ShardingManagerAddress = common.HexToAddress("0x0") // TODO
// Gas limit for verifying signatures
SigGasLimit = 40000
// Number of blocks in a period
PeriodLength = int64(5)
// Number of periods ahead of current period which the contract is able to return the collator of that period.
// Number of periods ahead of current period which the contract is able to return the notary of that period.
LookaheadPeriods = 4
// Required deposit size in wei for collator
CollatorDeposit = new(big.Int).Exp(big.NewInt(10), big.NewInt(21), nil) // 1000 ETH
// Required deposit size in wei for notary
NotaryDeposit = new(big.Int).Exp(big.NewInt(10), big.NewInt(21), nil) // 1000 ETH
// Required deposit size in wei for proposer
ProposerDeposit = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil) // 1 ETH
// Minimum Balance of proposer where bids are decuted
// Minimum Balance of proposer where bids are deducted
MinProposerBalance = new(big.Int).Exp(big.NewInt(10), big.NewInt(17), nil) // 0.1 ETH
// Gas limit to create contract
ContractGasLimit = uint64(4700000) // Max is 4712388
// Number of collations collators need to check to apply fork choice rule
WindbackLength = int64(25)
// Number of periods to lockup collator deposit from time of deregistration
CollatorLockupLength = int64(16128)
// Number of periods to lockup notary deposit from time of deregistration
NotaryLockupLength = int64(16128)
// Number of periods to lockup proposer deposit from time of deregistration
ProposerLockupLength = int64(48)
// Number of vETH awarded to collators after collation included in canonical chain
CollatorSubsidy = new(big.Int).Exp(big.NewInt(10), big.NewInt(15), nil) // 0.001 ETH
// Number of ETH awarded to notary after collation included in canonical chain
NotarySubsidy = new(big.Int).Exp(big.NewInt(10), big.NewInt(15), nil) // 0.001 ETH
// Number of notaries sampled per block from the notaries pool per period per shard
NotaryCommitSize = int64(135)
// Number of notary votes the collation needs to get accepted to the canonical chain
NotaryQuorumSize = int64(90)
)

View File

@@ -5,13 +5,13 @@ import (
"testing"
)
func TestCollatorDeposit(t *testing.T) {
func TestNotaryDeposit(t *testing.T) {
want, err := new(big.Int).SetString("1000000000000000000000", 10) // 1000 ETH
if !err {
t.Fatalf("Failed to setup test")
}
if CollatorDeposit.Cmp(want) != 0 {
t.Errorf("Collator deposit size incorrect. Wanted %d, got %d", want, CollatorDeposit)
if NotaryDeposit.Cmp(want) != 0 {
t.Errorf("Notary deposit size incorrect. Wanted %d, got %d", want, NotaryDeposit)
}
}
@@ -35,12 +35,12 @@ func TestMinProposerBalance(t *testing.T) {
}
}
func TestCollatorSubsidy(t *testing.T) {
func TestNotarySubsidy(t *testing.T) {
want, err := new(big.Int).SetString("1000000000000000", 10) // 0.001 ETH
if !err {
t.Fatalf("Failed to setup test")
}
if CollatorSubsidy.Cmp(want) != 0 {
t.Errorf("Collator subsidy size incorrect. Wanted %d, got %d", want, CollatorSubsidy)
if NotarySubsidy.Cmp(want) != 0 {
t.Errorf("Notary subsidy size incorrect. Wanted %d, got %d", want, NotarySubsidy)
}
}