Conversation
|
🤖 Claude Code Review Status: Complete Critical Issues Found:
Design Concerns:
Other Changes:
|
| mainP2PClient p2p.ClientI | ||
| mainSubtreeStore blob.Store | ||
| mainBlockchainStore blockchainstore.Store | ||
| mainBlockchainStoreCache map[url.URL]blockchainstore.Store |
There was a problem hiding this comment.
Using url.URL as a map key is problematic. URLs are structs with pointers and slices internally, which means two URLs with identical string representations may not be equal as map keys. This could lead to cache misses where the same URL creates multiple store instances.
Consider using the URL string representation as the map key instead:
mainBlockchainStoreCache map[string]blockchainstore.Store
// Then use: blockchainStoreURL.String() as the key| // P2P gRPC | ||
| // Just set the port from the settings override function | ||
| if opts.EnableP2P { | ||
| var tmpSettings settings.Settings |
There was a problem hiding this comment.
This code creates a temporary settings.Settings struct just to extract the P2P port from the override function. This is fragile because:
- The temporary settings will not have the full configuration context
- The override function may expect a properly initialized settings object
- If the override function has side effects or checks other fields, this could fail silently
Consider either:
- Calling the override function after all port assignments
- Adding the P2P port to
TestOptionsas an explicit field - Documenting that
SettingsOverrideFuncshould set P2P.Port and reading it after the override is applied to the real appSettings
|
|
||
| // ========== Simulate pruning by deleting txB from UTXO store ========== | ||
| // This simulates the scenario where: | ||
| // - txB UTXOs reach DeleteAtHeight and are pruned |
There was a problem hiding this comment.
The comment on line 30 says "Delete txB" but the code deletes txA. This appears to be a critical logic error.
At this point in the test:
- txA is on the winning chain (4a)
- txB is on the losing chain (4b)
- The test comment says "Delete txB from UTXO store"
But the code deletes txA instead. This fundamentally changes what the test validates. Based on the scenario description (simulating pruning before a reorg), it seems txB should be deleted, not txA.
| // The counter ensures uniqueness even when tests run in quick succession. | ||
| uniqueID := atomic.AddUint64(&testDaemonCounter, 1) | ||
| appSettings.Context = fmt.Sprintf("%s-testdaemon-%d", appSettings.Context, uniqueID) | ||
| // uniqueID := atomic.AddUint64(&testDaemonCounter, 1) |
There was a problem hiding this comment.
These commented-out lines that modify appSettings.Context appear to be important for test isolation. The comment explains they ensure unique listeners for each TestDaemon instance.
Without this code, multiple TestDaemons running concurrently might share cached listeners from util.GetListener, potentially causing port conflicts or cross-test interference.
Was this intentionally removed? If so, how is test isolation now ensured?
No description provided.