Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
38c00a1
remove unused var
Stefan-Ethernal Dec 4, 2025
e9834af
backward let event indexing scaffolding
Stefan-Ethernal Dec 6, 2025
003112a
introduce new migration and refactor migrations resolution to be generic
Stefan-Ethernal Dec 8, 2025
c3dbef4
TestBuildAppender increase coverage
Stefan-Ethernal Dec 8, 2025
928cf5f
delete bridges on backward let
Stefan-Ethernal Dec 8, 2025
c72e102
feat: backwards on merkle tree (#1378)
goran-ethernal Dec 8, 2025
aea7e8f
update exit tree on backward LET
Stefan-Ethernal Dec 8, 2025
6ae4adb
formatting
Stefan-Ethernal Dec 9, 2025
b2dccc5
remove bridges whose deposit count is greater than new deposit count
Stefan-Ethernal Dec 9, 2025
aa2cd0c
remove InvalidClaim struct
Stefan-Ethernal Dec 9, 2025
a9c7035
correctly determine leaf index
Stefan-Ethernal Dec 10, 2025
44774fa
archive bridges to bridge_archive table and handle reorgs
Stefan-Ethernal Dec 11, 2025
275aed8
increase code coverage, ignore double insertions to bridge_archive table
Stefan-Ethernal Dec 12, 2025
4d4d220
Merge branch 'develop' into feat/index-backward-let
Stefan-Ethernal Dec 12, 2025
ecc3ded
address 1st round of comments
Stefan-Ethernal Dec 12, 2025
f98e350
reverse the steps, first delete the bridges and then update the exit …
Stefan-Ethernal Dec 12, 2025
a74ca6e
Apply suggestions from code review
Stefan-Ethernal Dec 12, 2025
b2035c2
fix sql syntax error
Stefan-Ethernal Dec 12, 2025
38f1fbe
leaf index is the same as deposit count
Stefan-Ethernal Dec 12, 2025
752f986
invoke BackwardLET string function
Stefan-Ethernal Dec 12, 2025
7c941ab
remove redundant check
Stefan-Ethernal Dec 12, 2025
7ffebfd
fix sql syntax in migration file (2nd part)
Stefan-Ethernal Dec 12, 2025
2b1ce28
reinsert exit tree leaves on reorg of backward let event
Stefan-Ethernal Dec 15, 2025
ba08508
add bridge source column and add ordering by deposit_count
Stefan-Ethernal Dec 15, 2025
e4c8f62
move the new sql migrations to bridgesync0012 migration file
Stefan-Ethernal Dec 15, 2025
3600cd6
formatting
Stefan-Ethernal Dec 15, 2025
dba8654
Merge branch 'develop' into feat/index-backward-let
Stefan-Ethernal Dec 16, 2025
c900f0a
TestProcessor_BackwardLET
Stefan-Ethernal Dec 16, 2025
2e39f39
increase code coverage in common pkg
Stefan-Ethernal Dec 16, 2025
72fa419
TestProcessor_BackwardLET, backward LET on empty bridge table
Stefan-Ethernal Dec 16, 2025
a6ac3d8
add source column to bridge_archive table and copy the value on delet…
Stefan-Ethernal Dec 16, 2025
39c37b3
log the deleted bridges by deposit counts
Stefan-Ethernal Dec 17, 2025
4b8235f
backward let in between of bridges
Stefan-Ethernal Dec 17, 2025
04f3b2e
Merge branch 'develop' into feat/index-backward-let
Stefan-Ethernal Dec 17, 2025
e8dc5e0
fix: lint
Stefan-Ethernal Dec 17, 2025
d24339d
fix unit tests
Stefan-Ethernal Dec 17, 2025
b093169
refactor processing of backward let event
Stefan-Ethernal Dec 17, 2025
3d9814f
remove bridges and leafs from exit tree, and then restore only the su…
Stefan-Ethernal Dec 18, 2025
3eeb0b9
Merge branch 'develop' into feat/index-backward-let
Stefan-Ethernal Dec 18, 2025
60e78cc
address copilot's comments
Stefan-Ethernal Dec 18, 2025
5ffbd31
small optimization
Stefan-Ethernal Dec 18, 2025
c40e7ac
Merge branch 'develop' into feat/index-backward-let
Stefan-Ethernal Dec 18, 2025
a7390c2
drop the bridge archive trigger and do it programatically, tweak test
Stefan-Ethernal Dec 19, 2025
8eae344
Merge branch 'develop' into feat/index-backward-let
Stefan-Ethernal Dec 19, 2025
1f4efd4
Merge branch 'develop' into feat/index-backward-let
Stefan-Ethernal Dec 23, 2025
2289565
rename constant for unique constraint error code
Stefan-Ethernal Dec 29, 2025
96c5bce
Merge branch 'develop' into feat/index-backward-let
Stefan-Ethernal Dec 31, 2025
02a966d
fix migration file
Stefan-Ethernal Dec 31, 2025
cfcd7eb
feat: forward LET indexing
goran-ethernal Dec 12, 2025
243cead
feat: increment blockPos based on forwardLET events
goran-ethernal Dec 15, 2025
75f7c5d
feat: UT
goran-ethernal Dec 15, 2025
935dda1
fix: copilot comments
goran-ethernal Dec 16, 2025
37f4c01
fix: add appender test
goran-ethernal Dec 16, 2025
e6ec119
feat: new tests
goran-ethernal Dec 16, 2025
45aed70
fix: rebase
goran-ethernal Dec 18, 2025
2bde87b
fix: tests
goran-ethernal Dec 18, 2025
318e673
fix: rebase
goran-ethernal Dec 23, 2025
faf64b8
fix: comments
goran-ethernal Dec 26, 2025
f86ed29
fix: lint
goran-ethernal Dec 26, 2025
4bbb46e
feat: new UTs
goran-ethernal Dec 26, 2025
d314b70
fix: rebase
goran-ethernal Dec 31, 2025
a99a644
merge develop
temaniarpit27 Jan 6, 2026
dd35682
fix run local
temaniarpit27 Jan 7, 2026
360f5ac
update ref
temaniarpit27 Jan 7, 2026
169f914
Merge branch 'develop' into arpit/1447
temaniarpit27 Jan 7, 2026
78e7dbc
update ref
temaniarpit27 Jan 8, 2026
7065643
Merge branch 'arpit/1447' of github.com:agglayer/aggkit into arpit/1447
temaniarpit27 Jan 8, 2026
d45d26a
update config
temaniarpit27 Jan 8, 2026
49c68b3
fix
temaniarpit27 Jan 8, 2026
9102012
fix err related to deposit count
temaniarpit27 Jan 8, 2026
933f3cc
update ref
temaniarpit27 Jan 8, 2026
afca6a5
Merge branch 'develop' into arpit/1447
temaniarpit27 Jan 8, 2026
82b9c89
update tests
temaniarpit27 Jan 8, 2026
65a195a
update tests
temaniarpit27 Jan 8, 2026
b7600ba
update ref
temaniarpit27 Jan 8, 2026
3b3aa60
update ref
temaniarpit27 Jan 9, 2026
dc758c7
update ref
temaniarpit27 Jan 9, 2026
1e64edb
update ref
temaniarpit27 Jan 9, 2026
825293b
update ref
temaniarpit27 Jan 10, 2026
ccd81db
update ref
temaniarpit27 Jan 10, 2026
aabeb3b
update ref
temaniarpit27 Jan 13, 2026
7ff6314
update ref
temaniarpit27 Jan 15, 2026
d700fd8
update ref
temaniarpit27 Jan 15, 2026
0656fbb
update ref
temaniarpit27 Jan 15, 2026
bd49e83
update ref
temaniarpit27 Jan 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/test_e2e_cdk_erigon_args_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"deployment_stages": {
"deploy_l2_contracts": true,
"deploy_op_succinct": false,
"deploy_cdk_bridge_infra": false
"deploy_zkevm_bridge_service": false
},
"args": {
"consensus_contract_type": "ecdsa-multisig",
"use_agg_sender_validator": false,
"agg_sender_multisig_threshold": 1,
"agg_sender_validator_total_number": 0,
"binary_name": "aggkit",
"log_level": "debug",
"log_level": "info",
"aggkit_components": "aggsender",
"aggkit_image": "aggkit:local",
"agglayer_prover_primary_prover": "mock-prover",
Expand Down
4 changes: 2 additions & 2 deletions .github/test_e2e_op_args_base.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"deployment_stages": {
"deploy_op_succinct": false,
"deploy_cdk_bridge_infra": false
"deploy_zkevm_bridge_service": true
},
"args": {
"aggkit_image": "aggkit:local",
"consensus_contract_type": "ecdsa-multisig",
"use_agg_sender_validator": true,
"agg_sender_multisig_threshold": 2,
"agg_sender_validator_total_number": 3,
"log_level": "debug",
"log_level": "info",
"additional_services": [],
"binary_name": "aggkit",
"aggkit_components": "aggsender,aggoracle",
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:

env:
AGGKIT_REPORT_CHANNEL: "C092K6Z0EUT"
KURTOSIS_CDK_COMMIT: "507e4e8e6581ab5ecbb44444f9b7f1d05e3dcd1c"
KURTOSIS_CDK_COMMIT: "a19cb8a3038112bd459a938e2972d43dbac325ed"

permissions:
packages: write
Expand Down Expand Up @@ -173,11 +173,11 @@ jobs:
- build-tools
- read-aggkit-args
- get-kurtosis-cdk-commit
uses: agglayer/e2e/.github/workflows/aggkit-e2e-single-chain.yml@76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f
uses: agglayer/e2e/.github/workflows/aggkit-e2e-single-chain.yml@55457421ba75b421cc611022db81bbeefd3e1f60
secrets: inherit
with:
kurtosis-cdk-ref: ${{ needs.get-kurtosis-cdk-commit.outputs.kurtosis-commit }}
agglayer-e2e-ref: 76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f # main
agglayer-e2e-ref: 55457421ba75b421cc611022db81bbeefd3e1f60
kurtosis-cdk-enclave-name: op
kurtosis-cdk-args: ${{ needs.read-aggkit-args.outputs.kurtosis-cdk-args-single-op-pessimistic }}
test-name: "test-single-l2-network-op-pessimistic"
Expand All @@ -201,11 +201,11 @@ jobs:
- build-tools
- read-aggkit-args
- get-kurtosis-cdk-commit
uses: agglayer/e2e/.github/workflows/aggkit-e2e-single-chain.yml@76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f
uses: agglayer/e2e/.github/workflows/aggkit-e2e-single-chain.yml@55457421ba75b421cc611022db81bbeefd3e1f60
secrets: inherit
with:
kurtosis-cdk-ref: ${{ needs.get-kurtosis-cdk-commit.outputs.kurtosis-commit }}
agglayer-e2e-ref: 76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f # main
agglayer-e2e-ref: 55457421ba75b421cc611022db81bbeefd3e1f60
kurtosis-cdk-enclave-name: op
kurtosis-cdk-args: ${{ needs.read-aggkit-args.outputs.kurtosis-cdk-args-single-op-succinct }}
aggsender-find-imported-bridge-artifact: aggsender_find_imported_bridge
Expand All @@ -229,12 +229,12 @@ jobs:
- build-tools
- read-aggkit-args
- get-kurtosis-cdk-commit
uses: agglayer/e2e/.github/workflows/aggkit-e2e-single-chain.yml@76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f
uses: agglayer/e2e/.github/workflows/aggkit-e2e-single-chain.yml@55457421ba75b421cc611022db81bbeefd3e1f60
if: always() && github.event_name == 'schedule' && github.ref == 'refs/heads/develop'
secrets: inherit
with:
kurtosis-cdk-ref: ${{ needs.get-kurtosis-cdk-commit.outputs.kurtosis-commit }}
agglayer-e2e-ref: 76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f # main
agglayer-e2e-ref: 55457421ba75b421cc611022db81bbeefd3e1f60
kurtosis-cdk-enclave-name: op
kurtosis-cdk-args: ${{ needs.read-aggkit-args.outputs.kurtosis-cdk-args-single-op-succinct-aggoracle-committee }}
test-name: "test-single-l2-network-op-succinct-aggoracle-committee"
Expand All @@ -258,11 +258,11 @@ jobs:
- build-tools
- read-aggkit-args
- get-kurtosis-cdk-commit
uses: agglayer/e2e/.github/workflows/aggkit-e2e-multi-chains.yml@76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f
uses: agglayer/e2e/.github/workflows/aggkit-e2e-multi-chains.yml@55457421ba75b421cc611022db81bbeefd3e1f60
secrets: inherit
with:
kurtosis-cdk-ref: ${{ needs.get-kurtosis-cdk-commit.outputs.kurtosis-commit }}
agglayer-e2e-ref: 76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f # main
agglayer-e2e-ref: 55457421ba75b421cc611022db81bbeefd3e1f60
kurtosis-cdk-enclave-name: op
aggsender-find-imported-bridge-artifact: aggsender_find_imported_bridge
kurtosis-cdk-args-1: ${{ needs.read-aggkit-args.outputs.kurtosis-cdk-args-1 }}
Expand All @@ -284,11 +284,11 @@ jobs:
- build-tools
- read-aggkit-args
- get-kurtosis-cdk-commit
uses: agglayer/e2e/.github/workflows/aggkit-e2e-multi-chains.yml@76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f
uses: agglayer/e2e/.github/workflows/aggkit-e2e-multi-chains.yml@55457421ba75b421cc611022db81bbeefd3e1f60
secrets: inherit
with:
kurtosis-cdk-ref: ${{ needs.get-kurtosis-cdk-commit.outputs.kurtosis-commit }}
agglayer-e2e-ref: 76b1ff29e2ab38697aa2fb8d51fd8563bca2bb5f # main
agglayer-e2e-ref: 55457421ba75b421cc611022db81bbeefd3e1f60
kurtosis-cdk-enclave-name: aggkit
aggsender-find-imported-bridge-artifact: aggsender_find_imported_bridge
kurtosis-cdk-args-1: ${{ needs.read-aggkit-args.outputs.kurtosis-cdk-args-3 }}
Expand Down
9 changes: 5 additions & 4 deletions bridgesync/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Comment on lines +1408 to +1413
Copy link

Copilot AI Jan 10, 2026

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 <= $2 in the restore logic still works correctly with the adjusted values.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

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.

if err != nil {
return fmt.Errorf("invalid new deposit count: %w", err)
}
Expand Down Expand Up @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the NewDepositCount get decremented by 1, because leaf with the index NewDepositCount gets rollbacked from the tree as well?

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 NewDepositCount (also adjust the comments of the functions), instead of decrementing. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)
we here consider deposit count related to bridges which is 0 indexed (starts from 0)
so we need to manage accordingly here

newDepositCount, leafIndex, err := normalizeDepositCount(adjustedCount)
Comment on lines +1593 to +1594
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The adjustment of NewDepositCount by subtracting 1 before calling normalizeDepositCount changes the interpretation of BackwardLET events. This adjustment will affect which bridges are archived and deleted, as it changes the threshold value passed to archiveAndDeleteBridgesAbove. Ensure this aligns with the contract's actual behavior and that the corresponding forward LET handling has been updated consistently.

Suggested change
adjustedCount := new(big.Int).Sub(event.BackwardLET.NewDepositCount, big.NewInt(1))
newDepositCount, leafIndex, err := normalizeDepositCount(adjustedCount)
newDepositCount, leafIndex, err := normalizeDepositCount(event.BackwardLET.NewDepositCount)

Copilot uses AI. Check for mistakes.
if err != nil {
return err
}
Expand Down Expand Up @@ -1754,7 +1755,7 @@ func (p *processor) handleForwardLETEvent(tx dbtypes.Txer, event *ForwardLET, bl
return 0, fmt.Errorf("failed to decode new leaves in forward LET: %w", err)
}

newDepositCount := uint32(event.PreviousDepositCount.Uint64()) + 1
newDepositCount := uint32(event.PreviousDepositCount.Uint64())
Copy link

Copilot AI Jan 10, 2026

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.

Suggested change
newDepositCount := uint32(event.PreviousDepositCount.Uint64())
newDepositCount := uint32(event.PreviousDepositCount.Uint64()) + 1

Copilot uses AI. Check for mistakes.
newBlockPos := event.BlockPos
if blockPos != nil {
newBlockPos = *blockPos
Expand Down
Loading
Loading