Conversation
this mirrors ReapMaxBytes behavior See #2184 (comment)
tested with:
```
func TestMaxAminoOverheadForBlock(t *testing.T) {
maxChainID := ""
for i := 0; i < MaxChainIDLen; i++ {
maxChainID += "𠜎"
}
h := Header{
ChainID: maxChainID,
Height: 10,
Time: time.Now().UTC(),
NumTxs: 100,
TotalTxs: 200,
LastBlockID: makeBlockID(make([]byte, 20), 300, make([]byte, 20)),
LastCommitHash: tmhash.Sum([]byte("last_commit_hash")),
DataHash: tmhash.Sum([]byte("data_hash")),
ValidatorsHash: tmhash.Sum([]byte("validators_hash")),
NextValidatorsHash: tmhash.Sum([]byte("next_validators_hash")),
ConsensusHash: tmhash.Sum([]byte("consensus_hash")),
AppHash: tmhash.Sum([]byte("app_hash")),
LastResultsHash: tmhash.Sum([]byte("last_results_hash")),
EvidenceHash: tmhash.Sum([]byte("evidence_hash")),
ProposerAddress: tmhash.Sum([]byte("proposer_address")),
}
b := Block{
Header: h,
Data: Data{Txs: makeTxs(10000, 100)},
Evidence: EvidenceData{},
LastCommit: &Commit{},
}
bz, err := cdc.MarshalBinary(b)
require.NoError(t, err)
assert.Equal(t, MaxHeaderBytes+MaxAminoOverheadForBlock-2, len(bz)-1000000-20000-1)
}
```
by using math.MaxInt64 See #2184 (comment)
fef6ab6 to
4da659d
Compare
Codecov Report
@@ Coverage Diff @@
## develop #2318 +/- ##
==========================================
+ Coverage 60.88% 60.9% +0.01%
==========================================
Files 197 197
Lines 16283 16273 -10
==========================================
- Hits 9914 9911 -3
+ Misses 5502 5497 -5
+ Partials 867 865 -2
|
Closed
ValarDragon
reviewed
Sep 3, 2018
types/block_test.go
Outdated
| LastBlockID: makeBlockID(make([]byte, 20), 300, make([]byte, 20)), | ||
| NumTxs: math.MaxInt64, | ||
| TotalTxs: math.MaxInt64, | ||
| LastBlockID: makeBlockID(make([]byte, 20), math.MaxInt64, make([]byte, 20)), |
Contributor
There was a problem hiding this comment.
Can the 20 be changed to tmhash.Size?
ValarDragon
reviewed
Sep 3, 2018
mempool/mempool.go
Outdated
| mem.proxyMtx.Unlock() | ||
| // Filter sets a filter for mempool to only accept txs for which f(tx) returns | ||
| // true. | ||
| func Filter(f func(types.Tx) bool) MempoolOption { |
Contributor
There was a problem hiding this comment.
(Sorry for the bikeshed) Can this still be named SetFilter? I feel like that was clearer, since this isn't the actual filter.
Contributor
Author
There was a problem hiding this comment.
https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
I don't think SetFilter is a good name for an option (see the usage). Maybe WithFilter or FilterFunc?
Contributor
There was a problem hiding this comment.
WithFilter sounds better to me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.