Skip to content

Conversation

JayT106
Copy link
Contributor

@JayT106 JayT106 commented Oct 9, 2025

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

@JayT106 JayT106 self-assigned this Oct 9, 2025
@JayT106 JayT106 requested a review from a team as a code owner October 9, 2025 21:09
@JayT106 JayT106 requested review from calvinaco and songgaoye and removed request for a team October 9, 2025 21:09
@JayT106 JayT106 marked this pull request as draft October 9, 2025 21:09
Copy link

github-actions bot commented Oct 9, 2025

@JayT106 your pull request is missing a changelog!

Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

socket-security bot commented Oct 9, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgolang/​github.com/​jayt106/​ethermint@​v0.4.2-0.20251009173213-ea3c6b3c59407510010010070

View full report

Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 49.57687% with 715 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.28%. Comparing base (a3c2f70) to head (b237796).
⚠️ Report is 113 commits behind head on main.

Files with missing lines Patch % Lines
preconfer/whitelist_grpc.go 0.00% 206 Missing ⚠️
preconfer/cli.go 0.00% 194 Missing ⚠️
preconfer/priority_tx_grpc.go 0.00% 191 Missing ⚠️
preconfer/priority_tx_service.go 84.74% 39 Missing and 6 partials ⚠️
preconfer/ethereum_priority.go 73.40% 21 Missing and 4 partials ⚠️
preconfer/preconfer_mempool.go 88.78% 20 Missing and 3 partials ⚠️
preconfer/priority_tx_selector.go 81.69% 9 Missing and 4 partials ⚠️
preconfer/mempool_verification.go 90.90% 5 Missing and 2 partials ⚠️
x/cronos/rpc/api.go 0.00% 5 Missing ⚠️
preconfer/priority_helpers.go 96.05% 2 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1883       +/-   ##
===========================================
+ Coverage   16.87%   33.28%   +16.40%     
===========================================
  Files          72      132       +60     
  Lines        6163    13049     +6886     
===========================================
+ Hits         1040     4343     +3303     
- Misses       5000     8358     +3358     
- Partials      123      348      +225     
Files with missing lines Coverage Δ
x/e2ee/client/cli/encrypt.go 0.00% <0.00%> (-56.53%) ⬇️
x/cronos/keeper/keeper.go 65.26% <33.33%> (+58.19%) ⬆️
preconfer/priority_helpers.go 96.05% <96.05%> (ø)
x/cronos/rpc/api.go 0.36% <0.00%> (ø)
preconfer/mempool_verification.go 90.90% <90.90%> (ø)
preconfer/priority_tx_selector.go 81.69% <81.69%> (ø)
preconfer/preconfer_mempool.go 88.78% <88.78%> (ø)
preconfer/ethereum_priority.go 73.40% <73.40%> (ø)
preconfer/priority_tx_service.go 84.74% <84.74%> (ø)
preconfer/priority_tx_grpc.go 0.00% <0.00%> (ø)
... and 2 more

... and 106 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

// Start cleanup goroutine
go service.cleanupExpiredPreconfirmations()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
Comment on lines +211 to +222
for _, info := range s.txTracker {
if info.InMempool {
if info.Preconfirmation != nil {
priorityCount++
totalPriorityLevel += info.Preconfirmation.PriorityLevel

if info.Status == TxStatusPreconfirmed {
preconfirmedCount++
}
}
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
stats.PreconfirmedTxs = preconfirmedCount

if priorityCount > 0 {
stats.AvgPriorityLevel = float32(totalPriorityLevel) / float32(priorityCount)

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
Comment on lines +243 to +259
for _, info := range s.txTracker {
if info.InMempool && info.Preconfirmation != nil {
results = append(results, &PriorityTxInfoResult{
TxHash: info.TxHash,
PriorityLevel: info.Preconfirmation.PriorityLevel,
Timestamp: info.Timestamp.Unix(),
SizeBytes: uint32(len(info.TxBytes)),
Preconfirmation: info.Preconfirmation,
Position: info.MempoolPosition,
})

count++
if limit > 0 && count >= limit {
break
}
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism

// createPreconfirmation creates a preconfirmation for a transaction
func (s *PriorityTxService) createPreconfirmation(txHash string, priorityLevel uint32) *PreconfirmationInfo {
now := time.Now()

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
Status: TxStatusPreconfirmed,
InMempool: true,
Preconfirmation: preconf,
Timestamp: time.Now(),

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
@JayT106 JayT106 changed the title feat: add preconfirmation tx feature (WIP)feat: add preconfirmation tx feature Oct 13, 2025
@JayT106 JayT106 changed the title (WIP)feat: add preconfirmation tx feature feat: add preconfirmation tx feature (WIP) Oct 15, 2025
Comment on lines +263 to +275
for whitelistAddr := range epm.whitelist {
// Check if it's an Ethereum address format (0x...)
if strings.HasPrefix(strings.ToLower(whitelistAddr), "0x") {
if strings.EqualFold(whitelistAddr, ethAddr) {
return true
}
} else {
// Bech32 format comparison
if whitelistAddr == bech32Addr {
return true
}
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +310 to +323
for whitelistAddr := range epm.whitelist {
// Check if it's an Ethereum address format (0x...)
if strings.HasPrefix(strings.ToLower(whitelistAddr), "0x") {
// Case-insensitive comparison for Ethereum addresses
if strings.HasPrefix(strings.ToLower(address), "0x") && strings.EqualFold(whitelistAddr, address) {
return true
}
} else {
// Exact comparison for bech32 format
if whitelistAddr == address {
return true
}
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +334 to +336
for addr := range epm.whitelist {
addresses = append(addresses, addr)
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
}

// Update status in the copy if preconfirmation expired
if infoCopy.Preconfirmation != nil && time.Now().After(infoCopy.Preconfirmation.ExpiresAt) {

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
Comment on lines +411 to +415
for _, info := range s.txTracker {
if info.InMempool && info.Preconfirmation != nil {
count++
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
s.txTrackerLock.Lock()
s.preconfirmationMutex.Lock()

now := time.Now()

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
Comment on lines +446 to +456
for txHash, preconf := range s.preconfirmations {
if now.After(preconf.ExpiresAt) {
delete(s.preconfirmations, txHash)

if info, exists := s.txTracker[txHash]; exists && info.Status == TxStatusPreconfirmed {
info.Status = TxStatusExpired
}

s.logger.Debug("cleaned up expired preconfirmation", "tx_hash", txHash)
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant