Skip to content

Commit

Permalink
fix some duplicate to get passing
Browse files Browse the repository at this point in the history
  • Loading branch information
rigelrozanski committed Nov 7, 2018
1 parent b8c6075 commit 4970754
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
8 changes: 5 additions & 3 deletions x/mock/simulation/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ type Params struct {
// - and empty blocks, with no txs / only txs scheduled from the past.
func getBlockSize(r *rand.Rand, params Params,
lastBlockSizeState, avgBlockSize int) (state, blocksize int) {

// TODO: Make default blocksize transition matrix actually make the average
// blocksize equal to avgBlockSize.
state = params.BlockSizeTransitionMatrix.NextState(r, lastBlockSizeState)
if state == 0 {
switch state {
case 0:
blocksize = r.Intn(avgBlockSize * 4)
} else if state == 1 {
case 1:
blocksize = r.Intn(avgBlockSize * 2)
} else {
default:
blocksize = 0
}
return state, blocksize
Expand Down
23 changes: 0 additions & 23 deletions x/mock/simulation/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,29 +289,6 @@ func createBlockSimulator(testingMode bool, tb testing.TB, t *testing.T, params
}
}

// getBlockSize returns a block size as determined from the transition matrix.
// It targets making average block size the provided parameter. The three
// states it moves between are:
// - "over stuffed" blocks with average size of 2 * avgblocksize,
// - normal sized blocks, hitting avgBlocksize on average,
// - and empty blocks, with no txs / only txs scheduled from the past.
func getBlockSize(r *rand.Rand, params Params,
lastBlockSizeState, avgBlockSize int) (state, blocksize int) {

// TODO: Make default blocksize transition matrix actually make the average
// blocksize equal to avgBlockSize.
state = params.BlockSizeTransitionMatrix.NextState(r, lastBlockSizeState)
switch state {
case 0:
blocksize = r.Intn(avgBlockSize * 4)
case 1:
blocksize = r.Intn(avgBlockSize * 2)
default:
blocksize = 0
}
return state, blocksize
}

// adds all future operations into the operation queue.
func queueOperations(queuedOperations map[int][]Operation,
queuedTimeOperations []FutureOperation,
Expand Down

0 comments on commit 4970754

Please sign in to comment.