sharding: feedback changes

Former-commit-id: 3251e6a3a13984b154dfb82ffae68ec214177829 [formerly 0bc330ae3445a0d88d014afa412dd4e21bdb5208]
Former-commit-id: 3c3938127ccc1f56ced09496038fa0d72ed32ae7
This commit is contained in:
Terence Tsao 2018-04-24 08:47:08 -07:00
parent f32a80a911
commit b923b9e101
3 changed files with 275 additions and 364 deletions

File diff suppressed because one or more lines are too long

View File

@ -87,7 +87,8 @@ contract SMC {
// Get the most recent block number before the period started
uint latestBlock = period * PERIOD_LENGTH - 1;
uint index = uint(keccak256(block.blockhash(latestBlock), _index, shardId)) % sampleSize;
uint latestBlockHash = uint(block.blockhash(latestBlock));
uint index = uint(keccak256(latestBlockHash, _index, shardId)) % sampleSize;
return notaryPool[index];
}

View File

@ -56,6 +56,7 @@ func TestNotaryRegister(t *testing.T) {
var txOpts [notaryCount]*bind.TransactOpts
genesis := make(core.GenesisAlloc)
// initializes back end with 3 accounts and each with 2000 eth balances
for i := 0; i < notaryCount; i++ {
key, _ := crypto.GenerateKey()
notaryPoolPrivKeys[i] = key
@ -420,6 +421,7 @@ func TestCommitteeListsAreDifferent(t *testing.T) {
var txOpts [notaryCount]*bind.TransactOpts
genesis := make(core.GenesisAlloc)
// initializes back end with 1000 accounts and each with 2000 eth balances
for i := 0; i < notaryCount; i++ {
key, _ := crypto.GenerateKey()
notaryPoolPrivKeys[i] = key
@ -469,6 +471,7 @@ func TestGetCommitteeWithNonMember(t *testing.T) {
var txOpts [notaryCount]*bind.TransactOpts
genesis := make(core.GenesisAlloc)
// initializes back end with 11 accounts and each with 2000 eth balances
for i := 0; i < notaryCount; i++ {
key, _ := crypto.GenerateKey()
notaryPoolPrivKeys[i] = key
@ -511,6 +514,7 @@ func TestGetCommitteeAfterDeregisters(t *testing.T) {
var txOpts [notaryCount]*bind.TransactOpts
genesis := make(core.GenesisAlloc)
// initializes back end with 10 accounts and each with 2000 eth balances
for i := 0; i < notaryCount; i++ {
key, _ := crypto.GenerateKey()
notaryPoolPrivKeys[i] = key