-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add tests #1448
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
base: develop
Are you sure you want to change the base?
feat: add tests #1448
Changes from all commits
38c00a1
e9834af
003112a
c3dbef4
928cf5f
c72e102
aea7e8f
6ae4adb
b2dccc5
aa2cd0c
a9c7035
44774fa
275aed8
4d4d220
ecc3ded
f98e350
a74ca6e
b2035c2
38f1fbe
752f986
7c941ab
7ffebfd
2b1ce28
ba08508
e4c8f62
3600cd6
dba8654
c900f0a
2e39f39
72fa419
a6ac3d8
39c37b3
4b8235f
04f3b2e
e8dc5e0
d24339d
b093169
3d9814f
3eeb0b9
60e78cc
5ffbd31
c40e7ac
a7390c2
8eae344
1f4efd4
2289565
96c5bce
02a966d
cfcd7eb
243cead
75f7c5d
935dda1
37f4c01
e6ec119
45aed70
2bde87b
318e673
faf64b8
f86ed29
4bbb46e
d314b70
a99a644
dd35682
360f5ac
169f914
78e7dbc
7065643
d45d26a
49c68b3
9102012
933f3cc
afca6a5
82b9c89
65a195a
b7600ba
3b3aa60
dc758c7
1e64edb
825293b
ccd81db
aabeb3b
7ff6314
d700fd8
0656fbb
bd49e83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -1405,12 +1405,12 @@ func (p *processor) restoreBackwardLETBridges(tx dbtypes.Txer, backwardLETs []*B | |||||||
| ` | ||||||||
|
|
||||||||
| for _, backwardLET := range backwardLETs { | ||||||||
| prev, err := aggkitcommon.SafeUint64(backwardLET.PreviousDepositCount) | ||||||||
| prev, err := aggkitcommon.SafeUint64(new(big.Int).Sub(backwardLET.PreviousDepositCount, big.NewInt(1))) | ||||||||
| if err != nil { | ||||||||
| return fmt.Errorf("invalid previous deposit count: %w", err) | ||||||||
| } | ||||||||
|
|
||||||||
| next, err := aggkitcommon.SafeUint64(backwardLET.NewDepositCount) | ||||||||
| next, err := aggkitcommon.SafeUint64(new(big.Int).Sub(backwardLET.NewDepositCount, big.NewInt(1))) | ||||||||
| if err != nil { | ||||||||
| return fmt.Errorf("invalid new deposit count: %w", err) | ||||||||
| } | ||||||||
|
|
@@ -1590,7 +1590,8 @@ func (p *processor) ProcessBlock(ctx context.Context, block sync.Block) error { | |||||||
| return err | ||||||||
| } | ||||||||
|
|
||||||||
| newDepositCount, leafIndex, err := normalizeDepositCount(event.BackwardLET.NewDepositCount) | ||||||||
| adjustedCount := new(big.Int).Sub(event.BackwardLET.NewDepositCount, big.NewInt(1)) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the If that's the case, would it make more sense if we would delete all the nodes that has the index greater than or equal to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so basically what smart contract emits is deposit count which is 1 indexed (starts from 1 and not 0) |
||||||||
| newDepositCount, leafIndex, err := normalizeDepositCount(adjustedCount) | ||||||||
|
Comment on lines
+1593
to
+1594
|
||||||||
| adjustedCount := new(big.Int).Sub(event.BackwardLET.NewDepositCount, big.NewInt(1)) | |
| newDepositCount, leafIndex, err := normalizeDepositCount(adjustedCount) | |
| newDepositCount, leafIndex, err := normalizeDepositCount(event.BackwardLET.NewDepositCount) |
Copilot
AI
Jan 10, 2026
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.
The change from uint32(event.PreviousDepositCount.Uint64()) + 1 to uint32(event.PreviousDepositCount.Uint64()) appears to change the semantics of how deposit counts are interpreted. This is a critical change that affects how bridges are indexed. The PreviousDepositCount now directly becomes the newDepositCount, rather than being incremented. Ensure this is the correct interpretation according to the contract's event semantics and that all consumers of this field are aware of this change in behavior.
| newDepositCount := uint32(event.PreviousDepositCount.Uint64()) | |
| newDepositCount := uint32(event.PreviousDepositCount.Uint64()) + 1 |
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.
The subtraction of 1 from both PreviousDepositCount and NewDepositCount in BackwardLET processing represents a significant semantic change. The adjustment is applied before converting to uint64 and storing in the database. This appears to change the interpretation of deposit counts from the contract events. Verify that this adjustment correctly aligns with the updated contract specification and that the query
deposit_count > $1 AND deposit_count <= $2in the restore logic still works correctly with the adjusted values.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.
Can you explain why we are decreasing the (previous and next) deposit counts by one? I fail to understand the logic.