Repository navigation
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4847 +/- ##
==========================================
- Coverage 61.62% 61.62% -0.01%
==========================================
Files 2080 2080
Lines 162041 162041
==========================================
- Hits 99865 99860 -5
- Misses 62171 62176 +5
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@seidroid review |
There was a problem hiding this comment.
Blocksync now runs the full VerifyCommit on second.LastCommit before saving it as the seen commit of first, so nil votes and the signatures beyond the 2/3 mark are checked too, which matches the check ValidateBlock already applies to LastCommit; the new test catches both cases the light check let through, and NewReactor now accepts the sm.BlockStore interface, which *store.BlockStore still satisfies. I found nothing that blocks after reviewing against the merge tree at 0660c94 (not built or run, because the sandbox has no Go toolchain); I dropped codex's one finding because ed25519.Signature.Bytes() has a value receiver and returns a copy, so flipping a byte in withBadLastSignature cannot change correct[2].commit.
seidroid review · decision approve · session 9ba7e82a3cf54db8aaa6ed953ee78289 · turn resp_claude_3770df9649c63430cfdfa9cc940d8519 · item 97c9d415fda55c7d884681a0b9062e29
Findings: 0 blocking | 0 non-blocking | 0 posted inline
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 9d37be5. Bugbot is set up for automated code reviews on this repo. Configure here. |
| sm "github.com/sei-protocol/sei-chain/sei-tendermint/internal/state" | ||
| "github.com/sei-protocol/sei-chain/sei-tendermint/internal/test/factory" | ||
| "github.com/sei-protocol/sei-chain/sei-tendermint/libs/utils" | ||
| utilsrequire "github.com/sei-protocol/sei-chain/sei-tendermint/libs/utils/require" |
There was a problem hiding this comment.
nit: alias is not needed, now that you replaced testify/require
There was a problem hiding this comment.
Dropped the alias, the file imports utils/require as require now.
39eea39
| require.NoError(t, err) | ||
| server.store.SaveBlock(block, partSet, seenCommit) | ||
| lastCommit = seenCommit | ||
| blockStore.SaveBlock(b.block, b.parts, b.commit) |
There was a problem hiding this comment.
nit: is there any particular reason why server.store.SaveBlock won't do?
| @@ -28,6 +28,7 @@ import ( | |||
| "github.com/sei-protocol/sei-chain/sei-tendermint/libs/utils" | |||
| utilsrequire "github.com/sei-protocol/sei-chain/sei-tendermint/libs/utils/require" | |||
There was a problem hiding this comment.
nit: while you are at it, can you migrate all assertions in this file to utils/require? It is kind of annoying to have both testify/require and utils/require in the same file.
There was a problem hiding this comment.
Done. Every assertion in the file goes through utils/require, and the testify require and assert imports are gone. testify/mock stays for MockBlockStore.
e12a807
| // WaitForDisconnect panics with the context error. | ||
| defer func() { | ||
| if r := recover(); r != nil { | ||
| ctxErr, ok := r.(error) |
There was a problem hiding this comment.
nit: err = r.(error) would also panic on bad cast
There was a problem hiding this comment.
Good point, simplified to err = r.(error). The helper later went away entirely with the change for the disconnect comment below.
8e02cd9
| } { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| // After every other cleanup, no goroutine of the nodes is left running. | ||
| t.Cleanup(leaktest.Check(t)) |
There was a problem hiding this comment.
fyi: we do not consider leaktest very useful in our codebase, and other occurrences that you see are mostly leftovers from the original fork.
There was a problem hiding this comment.
Thanks, removed the leaktest check and its import from the new test.
d5400e9
| err = scope.Run(ctx, func(ctx context.Context, s scope.Scope) error { | ||
| // Report the end of the first connection to the invalid-commit node. | ||
| s.SpawnBgNamed("wait for disconnection", func() error { | ||
| if err := waitForDisconnect(ctx, syncNode, invalidCommitConn); err != nil { |
There was a problem hiding this comment.
nit: imo you can just wait for disconnect directly in the main task, rather than going though the syncEvent channel.
There was a problem hiding this comment.
Done. The main task calls WaitForDisconnect directly, so the background task, the scope.Run block, the disconnect event and the waitForDisconnect wrapper are gone.
04d96c3
| }) | ||
|
|
||
| // Block 1 is saved with its correct seen commit. | ||
| if err := observer.expectSaved(ctx, correct[0].block, correct[0].commit); err != nil { |
There was a problem hiding this comment.
nit: these assertions are rather strong and require a very specific order of events. How about just waiting for disconnect and then assert the db content afterwards (i.e. blocks 0,1 and missing block 2)?
There was a problem hiding this comment.
Agreed. After the disconnect the test checks the syncing node's store: height 2, block 2, and the seen commit of block 2. For block 3 from the correct node, the store wrapper publishes the saved height on an AtomicSend and the test waits on that, then checks block 3 and its seen commit.
d434138
pompon0
left a comment
There was a problem hiding this comment.
lgtm, please consider "nit" comments as non-blocking
|
@seidroid review |
There was a problem hiding this comment.
The fix is unchanged: blocksync still runs the full VerifyCommit before saving a commit as the seen commit. Since my last review only the tests moved: TestReactor_RejectsInvalidCommitFromPeer now uses a store that records the height of each saved block, instead of the event channel and the panic-recovering helper, and the files switched to the libs/utils/require wrappers. I checked this against the merge tree at 7071aec and found nothing new and nothing left open from before, so I approve; codex also found nothing, so it added no findings. Nothing was built or run, because the sandbox has no Go toolchain.
seidroid review · decision approve · session 9ba7e82a3cf54db8aaa6ed953ee78289 · turn resp_claude_dbef8dfa2ce8adf08861616983210d1f · item 2624295bf1a857a286edcb80f3b9d7cd
Findings: 0 blocking | 0 non-blocking | 0 posted inline
6bf4e3d to
5c37d91
Compare
…in the blocksync validation test
|
@seidroid review |
There was a problem hiding this comment.
Only the tests moved since my last review: the new test now also checks that the syncing node stored the correct block 2 before it dropped the peer, and the status test reads its block store through server.store; the fix itself, the full VerifyCommit before saving the seen commit, is unchanged. I checked this against the merge tree at 952ad9d, found no new issue and had none open from before, so I approve; codex also found nothing, so it added no findings, and nothing was built or run.
seidroid review · decision approve · session 9ba7e82a3cf54db8aaa6ed953ee78289 · turn resp_claude_04d16c33a1058f4e5342f596f484530f · item 195d6e09210955beb1159b9a04ab9f78
Findings: 0 blocking | 0 non-blocking | 0 posted inline
Blocksync now verifies every signature of a commit before it saves the commit with a block, the same check that block validation already applies. The new test
TestReactor_RejectsInvalidCommitFromPeercovers this.