Skip to content

follow up to removing some consensus params#2427

Merged
xla merged 12 commits intodevelopfrom
2382-cs-params-follow-up
Sep 21, 2018
Merged

follow up to removing some consensus params#2427
xla merged 12 commits intodevelopfrom
2382-cs-params-follow-up

Conversation

@melekes
Copy link
Contributor

@melekes melekes commented Sep 18, 2018

Refs #2382

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG_PENDING.md

@melekes melekes changed the title [WIPfollow up to removing some consensus params [WIP] follow up to removing some consensus params Sep 18, 2018

// TxFilter returns a function to filter transactions. The function limits the
// size of a transaction to the maximum block's data size.
func TxFilter(state State) func(tx types.Tx) bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test

types/block.go Outdated

// MaxDataBytes returns the maximum size of block's data.
func MaxDataBytes(maxBytes, valsCount, evidenceCount int) int {
func MaxDataBytes(maxBytes, valsCount, evidenceCount int64) int64 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valsCount and evidenceCount should probably remain ints

@xla xla added C:consensus Component: Consensus C:abci Component: Application Blockchain Interface T:breaking Type: Breaking Change labels Sep 18, 2018
@melekes melekes requested a review from zramsay as a code owner September 19, 2018 10:11
@codecov-io
Copy link

codecov-io commented Sep 19, 2018

Codecov Report

Merging #2427 into develop will increase coverage by 0.01%.
The diff coverage is 84.61%.

@@            Coverage Diff             @@
##           develop   #2427      +/-   ##
==========================================
+ Coverage    60.99%     61%   +0.01%     
==========================================
  Files          197     198       +1     
  Lines        16202   16200       -2     
==========================================
+ Hits          9882    9883       +1     
+ Misses        5482    5481       -1     
+ Partials       838     836       -2
Impacted Files Coverage Δ
state/services.go 38.46% <0%> (ø) ⬆️
state/execution.go 75.51% <0%> (-0.12%) ⬇️
consensus/state.go 77.14% <100%> (+0.58%) ⬆️
evidence/pool.go 56.14% <100%> (ø) ⬆️
node/node.go 66.24% <100%> (-0.01%) ⬇️
mempool/mempool.go 76% <100%> (-0.1%) ⬇️
state/tx_filter.go 100% <100%> (ø)
evidence/store.go 90.36% <80%> (ø) ⬆️
libs/clist/clist.go 62.43% <0%> (-5.59%) ⬇️
privval/socket.go 68.27% <0%> (-3.22%) ⬇️
... and 7 more

@melekes melekes changed the title [WIP] follow up to removing some consensus params follow up to removing some consensus params Sep 19, 2018
Copy link
Contributor

@xla xla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 :octocat: :shipit: 🍡

Very clean addition for the tx filtering!

}
}

func randomGenesisDoc() *types.GenesisDoc {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we indicate that this function is used for testing with a prefix maybe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't being in the _test.go suffice?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They share the same namespace during testing, maybe I'm overly paranoid but usually like to flag it explicitely to not get tempted to use it in other contexts.

// amino.UvarintSize is not used here because it won't be possible to reuse buf
aminoOverhead := binary.PutUvarint(buf[:], uint64(len(memTx.tx)))
if maxBytes > -1 && totalBytes+len(memTx.tx)+aminoOverhead > maxBytes {
aminoOverhead := int64(binary.PutUvarint(buf[:], uint64(len(memTx.tx))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is having to do this everywhere a code smell for our code, or for Go itself, or for neither?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for our code

}
}

func randomGenesisDoc() *types.GenesisDoc {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't being in the _test.go suffice?

types/block.go Outdated
const (
// MaxHeaderBytes is a maximum header size (including amino overhead).
MaxHeaderBytes = 511
MaxHeaderBytes = int64(511)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would MaxHeaderBytes int64 = 511 be better for these?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@melekes
Copy link
Contributor Author

melekes commented Sep 20, 2018

Thanks @xla amd @ebuchman for the reviews! PTAL

@xla
Copy link
Contributor

xla commented Sep 20, 2018

@melekes Looks like we have a cyclic dependency: https://circleci.com/gh/tendermint/tendermint/24992#tests/containers/1

@ebuchman
Copy link
Contributor

Still a cyclic dep issue?


// RandomGenesisDoc returns a random genesis document with one validator.
// Genesis time is set to now().
func RandomGenesisDoc() *types.GenesisDoc {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do folks think this is a good idea? maybe we should just export the same method from types package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't totally understand why this happened.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to reuse RandomGenesisDoc() function.

@xla xla merged commit 8d50bb9 into develop Sep 21, 2018
@xla xla deleted the 2382-cs-params-follow-up branch September 21, 2018 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C:abci Component: Application Blockchain Interface C:consensus Component: Consensus T:breaking Type: Breaking Change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants