Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 276
test: Add back missing node integration tests#2280
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4c50a93
Add initial tests
Manav-Aggarwal eb39a56
Fix TxGossipAndAggregationTest
Manav-Aggarwal 6843af2
Fix proxy_test
Manav-Aggarwal b252edb
Fix MaxPendingHeaders
Manav-Aggarwal cbf01d9
Add TestDAFastSync
Manav-Aggarwal 3c39ffb
Separate tests into diff files
Manav-Aggarwal 23687e1
Refactor tests to use more helpers
Manav-Aggarwal a66ed64
Add more tests
Manav-Aggarwal d09aab7
Add testTwoChainsInOneNamespace
Manav-Aggarwal 24ea43f
Fix DA Includer test
Manav-Aggarwal 5d71ce6
fix go mod tidy
Manav-Aggarwal 1496c1c
Add TestTxGoMultipleDAIncluded
Manav-Aggarwal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
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 |
|---|---|---|
| @@ -4,6 +4,7 @@ import ( | ||
| "context" | ||
| "crypto/sha256" | ||
| "errors" | ||
| "fmt" | ||
| "sync" | ||
| "time" | ||
| ) | ||
| @@ -19,10 +20,17 @@ type DummyDA struct { | ||
| maxBlobSize uint64 | ||
| gasPrice float64 | ||
| gasMultiplier float64 | ||
| // DA height simulation | ||
| currentHeight uint64 | ||
| blockTime time.Duration | ||
| stopCh chan struct{} | ||
| } | ||
| // NewDummyDA creates a new instance of DummyDA with the specified maximum blob size. | ||
| func NewDummyDA(maxBlobSize uint64, gasPrice float64, gasMultiplier float64) *DummyDA { | ||
| var ErrHeightFromFutureStr = fmt.Errorf("given height is from the future") | ||
| // NewDummyDA creates a new instance of DummyDA with the specified maximum blob size and block time. | ||
| func NewDummyDA(maxBlobSize uint64, gasPrice float64, gasMultiplier float64, blockTime time.Duration) *DummyDA { | ||
| return &DummyDA{ | ||
| blobs: make(map[string]Blob), | ||
| commitments: make(map[string]Commitment), | ||
| @@ -32,9 +40,34 @@ func NewDummyDA(maxBlobSize uint64, gasPrice float64, gasMultiplier float64) *Du | ||
| maxBlobSize: maxBlobSize, | ||
| gasPrice: gasPrice, | ||
| gasMultiplier: gasMultiplier, | ||
| blockTime: blockTime, | ||
| stopCh: make(chan struct{}), | ||
| } | ||
| } | ||
| // StartHeightTicker starts a goroutine that increments currentHeight every blockTime. | ||
| func (d *DummyDA) StartHeightTicker() { | ||
| go func() { | ||
| ticker := time.NewTicker(d.blockTime) | ||
| defer ticker.Stop() | ||
| for { | ||
| select { | ||
| case <-ticker.C: | ||
| d.mu.Lock() | ||
| d.currentHeight++ | ||
| d.mu.Unlock() | ||
| case <-d.stopCh: | ||
| return | ||
| } | ||
| } | ||
| }() | ||
| } | ||
| // StopHeightTicker stops the height ticker goroutine. | ||
| func (d *DummyDA) StopHeightTicker() { | ||
| close(d.stopCh) | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // MaxBlobSize returns the maximum blob size. | ||
| func (d *DummyDA) MaxBlobSize(ctx context.Context) (uint64, error) { | ||
| return d.maxBlobSize, nil | ||
| @@ -71,6 +104,10 @@ func (d *DummyDA) GetIDs(ctx context.Context, height uint64, namespace []byte) ( | ||
| d.mu.RLock() | ||
| defer d.mu.RUnlock() | ||
| if height > d.currentHeight { | ||
| return nil, fmt.Errorf("%w: requested %d, current %d", ErrHeightFromFutureStr, height, d.currentHeight) | ||
| } | ||
| ids, exists := d.blobsByHeight[height] | ||
| if !exists { | ||
| return &GetIDsResult{ | ||
| @@ -125,7 +162,7 @@ func (d *DummyDA) SubmitWithOptions(ctx context.Context, blobs []Blob, gasPrice | ||
| d.mu.Lock() | ||
| defer d.mu.Unlock() | ||
| height := uint64(len(d.blobsByHeight)) | ||
| height := d.currentHeight + 1 | ||
| ids := make([]ID, 0, len(blobs)) | ||
| var currentSize uint64 | ||
| @@ -164,7 +201,12 @@ func (d *DummyDA) SubmitWithOptions(ctx context.Context, blobs []Blob, gasPrice | ||
| ids = append(ids, id) | ||
| } | ||
| d.blobsByHeight[height] = ids | ||
| // Add the IDs to the blobsByHeight map if they don't already exist | ||
| if existingIDs, exists := d.blobsByHeight[height]; exists { | ||
| d.blobsByHeight[height] = append(existingIDs, ids...) | ||
| } else { | ||
| d.blobsByHeight[height] = ids | ||
| } | ||
| d.timestampsByHeight[height] = time.Now() | ||
| return ids, nil | ||
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.