-
Notifications
You must be signed in to change notification settings - Fork 367
fix!: retrieve transactions from the mempool async, ignore irelevant rounds, and don't start processing messages until switching from blocksync to consensus #1695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
dc2f928
Revert "fix: mempool locking mechanism in v1 and cat (#1582)"
evan-forbes b043c0a
Revert "fix: remove go routines for RecheckTx (#1553)"
evan-forbes 7df519a
hack: remove
evan-forbes 491df09
hack: random optimizations
evan-forbes cdb4268
fix: async retrieve transactions from the mempool
evan-forbes 82a8868
Merge branch 'feature/recovery' into evan/recovery/debug-mamo
evan-forbes 14bacd7
chore: cleanup
evan-forbes ee6dffd
chore: minor cleanup
evan-forbes 5725c16
fix: only decode once
evan-forbes 7e485d6
fix!: catchup
evan-forbes 56d85cd
chore: clean up
evan-forbes 1a59bc3
chore: modify tracing for recovered parts
evan-forbes 5f6d9eb
fix: non-gap catchup only request once
evan-forbes 44c4679
feat: broadcast haves after recoverying txs from the mempool
evan-forbes 59ae259
fix!: only gossip data from the latest round except during catchup
evan-forbes 8f03228
fix: don't download block parts messages until switching from blocksy…
evan-forbes 5dc0034
chore!: move tracing tables to the schema package
evan-forbes f3cc92a
chore: linter
evan-forbes 2b51b41
chore: linter
evan-forbes 9fc18b1
fix: weird nil
evan-forbes c475011
fix: overflow
evan-forbes 5634e6b
chore: fix tests
evan-forbes 0e38447
chore: linter
evan-forbes c82a179
feat: force pebbleDB for the blockstore only
evan-forbes f61fe49
fix: use the db dir
evan-forbes 4ea2f23
docs: comment
evan-forbes c673402
fix: data race
evan-forbes 2d3c9eb
hack: disable mempool broadcast test
evan-forbes 4f57ce2
chore: linter
evan-forbes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,75 +1,76 @@ | ||
| package propagation | ||
|
|
||
| // TODO(rachid): fix test | ||
| // func TestCatchup(t *testing.T) { | ||
| // reactors, _ := testBlockPropReactors(3) | ||
| // reactor1 := reactors[0] | ||
| // reactor2 := reactors[1] | ||
| // reactor3 := reactors[2] | ||
|
|
||
| // // setting the proposal for height 8 round 1 | ||
| // compactBlock := createCompactBlock(8, 1) | ||
| // reactor1.AddProposal(compactBlock) | ||
| // reactor2.AddProposal(compactBlock) | ||
| // reactor3.AddProposal(compactBlock) | ||
|
|
||
| // // setting the proposal for height 9 round 0 | ||
| // compactBlock = createCompactBlock(9, 1) | ||
| // reactor1.AddProposal(compactBlock) | ||
| // reactor2.AddProposal(compactBlock) | ||
| // reactor3.AddProposal(compactBlock) | ||
|
|
||
| // // setting the proposal for height 10 round 0 | ||
| // compactBlock = createCompactBlock(10, 0) | ||
| // reactor1.AddProposal(compactBlock) | ||
| // reactor2.AddProposal(compactBlock) | ||
| // reactor3.AddProposal(compactBlock) | ||
|
|
||
| // // setting the proposal for height 10 round 1 | ||
| // compactBlock = createCompactBlock(10, 1) | ||
| // reactor1.AddProposal(compactBlock) | ||
| // reactor2.AddProposal(compactBlock) | ||
| // reactor3.AddProposal(compactBlock) | ||
|
|
||
| // // setting the first reactor current height and round | ||
| // reactor1.currentHeight = 8 | ||
| // reactor1.currentRound = 0 | ||
|
|
||
| // // handle the compact block | ||
| // reactor1.handleCompactBlock(compactBlock, reactor1.self) | ||
|
|
||
| // time.Sleep(200 * time.Millisecond) | ||
|
|
||
| // // check if reactor 1 sent wants to all the connected peers | ||
| // _, has := reactor2.getPeer(reactor1.self).GetWants(9, 1) | ||
| // require.True(t, has) | ||
|
|
||
| // _, has = reactor2.getPeer(reactor1.self).GetWants(10, 0) | ||
| // require.True(t, has) | ||
|
|
||
| // _, has = reactor3.getPeer(reactor1.self).GetWants(9, 1) | ||
| // require.True(t, has) | ||
|
|
||
| // _, has = reactor3.getPeer(reactor1.self).GetWants(10, 0) | ||
| // require.True(t, has) | ||
| // } | ||
|
|
||
| // func createCompactBlock(height int64, round int32) *proptypes.CompactBlock { | ||
| // return &proptypes.CompactBlock{ | ||
| // BpHash: cmtrand.Bytes(32), | ||
| // Signature: cmtrand.Bytes(64), | ||
| // LastLen: 0, | ||
| // Blobs: []proptypes.TxMetaData{ | ||
| // {Hash: cmtrand.Bytes(32)}, | ||
| // {Hash: cmtrand.Bytes(32)}, | ||
| // }, | ||
| // Proposal: types.Proposal{ | ||
| // BlockID: types.BlockID{ | ||
| // Hash: nil, | ||
| // PartSetHeader: types.PartSetHeader{Total: 30}, | ||
| // }, | ||
| // Height: height, | ||
| // Round: round, | ||
| // }, | ||
| // } | ||
| // } | ||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| cfg "github.com/tendermint/tendermint/config" | ||
| proptypes "github.com/tendermint/tendermint/consensus/propagation/types" | ||
| cmtrand "github.com/tendermint/tendermint/libs/rand" | ||
| "github.com/tendermint/tendermint/state" | ||
| "github.com/tendermint/tendermint/types" | ||
| ) | ||
|
|
||
| func TestGapCatchup(t *testing.T) { | ||
| p2pCfg := cfg.DefaultP2PConfig() | ||
| p2pCfg.SendRate = 100000000 | ||
| p2pCfg.RecvRate = 100000000 | ||
| nodes := 2 | ||
|
|
||
| reactors, _ := createTestReactors(nodes, p2pCfg, false, "/home/evan/data/experiments/celestia/fast-recovery/debug") | ||
| cleanup, _, sm := state.SetupTestCase(t) | ||
| t.Cleanup(func() { | ||
| cleanup(t) | ||
| }) | ||
|
|
||
| prop, ps, _, metaData := createTestProposal(sm, 1, 2, 1000000) | ||
|
|
||
| // set the commitment and the data on the first node so that it can respond | ||
| // to the catchup request | ||
| n1 := reactors[0] | ||
| parityBlock, lastLen, err := types.Encode(ps, types.BlockPartSizeBytes) | ||
| require.NoError(t, err) | ||
|
|
||
| partHashes := extractHashes(ps, parityBlock) | ||
| proofs := extractProofs(ps, parityBlock) | ||
|
|
||
| cb := &proptypes.CompactBlock{ | ||
| Proposal: *prop, | ||
| LastLen: uint32(lastLen), | ||
| Signature: cmtrand.Bytes(64), // todo: sign the proposal with a real signature | ||
| BpHash: parityBlock.Hash(), | ||
| Blobs: metaData, | ||
| PartsHashes: partHashes, | ||
| } | ||
|
|
||
| cb.SetProofCache(proofs) | ||
|
|
||
| added := n1.AddProposal(cb) | ||
| require.True(t, added) | ||
|
|
||
| _, parts, _, has := n1.getAllState(prop.Height, prop.Round) | ||
| require.True(t, has) | ||
|
|
||
| parts.SetProposalData(ps, parityBlock) | ||
|
|
||
| // add the partset header to the second node and trigger the call to retry | ||
| // wants | ||
| n2 := reactors[1] | ||
|
|
||
| _, _, has = n2.GetProposal(prop.Height, prop.Round) | ||
| require.False(t, has) | ||
|
|
||
| psh := ps.Header() | ||
| n2.AddCommitment(prop.Height, prop.Round, &psh) | ||
|
|
||
| // this call simulates getting a commitment for a proposal of a higher | ||
| // height | ||
| n2.retryWants(2, 0) | ||
|
|
||
| time.Sleep(800 * time.Millisecond) | ||
|
|
||
| _, caughtUp, has := n2.GetProposal(prop.Height, prop.Round) | ||
| require.True(t, has) | ||
| require.True(t, caughtUp.IsComplete()) | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we don't have the compact block or the partset, shouldn't we stop at this point?