Repository navigation
feat: create blockFoundCh in RetrieveLoop to enable syncing faster than the DA block time #1302
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 all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6584781
feat: create blockFoundCh in RetrieveLoop to enable syncing faster th…
MSevey 139ce2e
fix: fix deadlock in blockFoundCh
MSevey 003bb0b
ci: add test for fast DA layer syncing
MSevey e59dec9
Update node/full_node_integration_test.go
MSevey 9980ddf
Update block/block_cache.go
MSevey 8caba75
ci: add unit tests for block cache
MSevey 81cae13
ci: add unit test for manager hard confirmed
MSevey 74bd7fb
ci: fix lint errors
MSevey 8b47a96
Update block/manager.go
Manav-Aggarwal 2a55231
Apply suggestions from code review
MSevey f68ed4a
Reuse GetRandomBlock from types package
Manav-Aggarwal 38850e1
Fix typo
Manav-Aggarwal b59fe7b
Address comments and apply goimports
Manav-Aggarwal e5ba7c2
Modify timer in test to be lower
Manav-Aggarwal 9756030
Update node/full_node_integration_test.go
Manav-Aggarwal 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package block | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
|
|
||
| "github.com/rollkit/rollkit/types" | ||
| ) | ||
|
|
||
| func TestBlockCache(t *testing.T) { | ||
| require := require.New(t) | ||
| // Create new BlockCache and verify not nil | ||
| bc := NewBlockCache() | ||
| require.NotNil(bc) | ||
|
|
||
| // Test setBlock and getBlock | ||
| height, nTxs := uint64(1), 2 | ||
| block := types.GetRandomBlock(height, nTxs) | ||
| bc.setBlock(height, block) | ||
| gotBlock, ok := bc.getBlock(height) | ||
| require.True(ok, "getBlock should return true after setBlock") | ||
| require.Equal(block, gotBlock) | ||
|
|
||
| // Test overwriting a block | ||
| block1 := types.GetRandomBlock(height, nTxs) | ||
| bc.setBlock(height, block1) | ||
| gotBlock1, ok1 := bc.getBlock(height) | ||
| require.True(ok1, "getBlock should return true after overwriting a block") | ||
| require.Equal(block1, gotBlock1) | ||
|
|
||
| // Test deleteBlock | ||
| bc.deleteBlock(height) | ||
| _, ok = bc.getBlock(height) | ||
| require.False(ok, "getBlock should return false after deleteBlock") | ||
|
|
||
| // Test isSeen and setSeen | ||
| require.False(bc.isSeen("hash"), "isSeen should return false for unseen hash") | ||
| bc.setSeen("hash") | ||
| require.True(bc.isSeen("hash"), "isSeen should return true for seen hash") | ||
|
|
||
| // Test setHardConfirmed | ||
| require.False(bc.isHardConfirmed("hash"), "hardConfirmations should be false for unseen hash") | ||
| bc.setHardConfirmed("hash") | ||
| require.True(bc.isHardConfirmed("hash"), "hardConfirmations should be true for seen hash") | ||
|
Manav-Aggarwal marked this conversation as resolved.
Resolved
|
||
| } | ||
|
Manav-Aggarwal marked this conversation as resolved.
Resolved
|
||
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
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
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
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.