Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: "Build binaries"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.17
go-version: 1.21
- name: "Run lint"
uses: golangci/golangci-lint-action@v3
with:
Expand Down
32 changes: 32 additions & 0 deletions bridge/setu/processor/troncheckpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ func (cp *CheckpointProcessor) nextExpectedTronCheckpoint(checkpointContext *Che
"end", end,
)
}

// Check cross-chain transactions for Tron dynamic checkpoint feature
if !cp.checkCrossChainForTron(start, end, checkpointParams.MaxCheckpointLength) {
end = start
}

// Handle when block producers go down
if end == 0 || end == start || (0 < diff && diff < checkpointParams.AvgCheckpointLength) {
cp.Logger.Debug("Fetching last header block to calculate time")
Expand Down Expand Up @@ -343,3 +349,29 @@ func (cp *CheckpointProcessor) resubmitTronCheckpointAck(checkpointContext *Chec

return nil
}

// checkCrossChainForTron checks if checkpoint should be submitted based on Tron dynamic checkpoint feature
// This method implements the same logic as checkCrossChain but specifically for Tron chain
func (cp *CheckpointProcessor) checkCrossChainForTron(start uint64, end uint64, maxCheckpointLengthParam uint64) bool {
// Get Tron dynamic checkpoint feature configuration
isOpen, maxLength, err := cp.getTronDynamicCheckpointProposalWithErr()
if err != nil || !isOpen {
// If feature is not enabled or error occurred, allow checkpoint submission
return true
}

// Validate maxLength parameter
if maxCheckpointLengthParam < uint64(maxLength) {
cp.Logger.Error("proposal feature-tron-dynamic-checkpoint maxlength is too long",
"maxLength", maxLength, "MaxCheckpointLength", maxCheckpointLengthParam)
return true
}

// If checkpoint length already reached maxLength, allow submission
if end-start+1 >= uint64(maxLength) {
return true
}

// Check if there are cross-chain transactions for Tron
return cp.hasCrossChainTx(start, end, hmTypes.RootChainTypeTron)
}
Loading