-
Notifications
You must be signed in to change notification settings - Fork 33
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
+dynamic_gas_unit_add_percentage flag #3494
base: feat/relayer-arb-call
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request introduces a new configuration parameter Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/relayer-arb-call #3494 +/- ##
===============================================================
+ Coverage 21.97606% 22.00538% +0.02931%
===============================================================
Files 502 502
Lines 41932 42017 +85
===============================================================
+ Hits 9215 9246 +31
- Misses 31779 31834 +55
+ Partials 938 937 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Bundle ReportChanges will increase total bundle size by 19.37MB (204.78%) ⬆️
Affected Assets, Files, and Routes:view changes for bundle: synapse-interface-client-array-pushAssets Changed:
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (9)
ethergo/submitter/config/iconfig_generated.go (1)
44-45
: Ensure this method is covered in tests.
The new methodGetDynamicGasUnitAddPercentage
looks appropriate for retrieving the configured percentage. Confirm that test cases adequately cover both a default value scenario and a chain-specific override scenario.ethergo/submitter/util_test.go (1)
201-208
: Add assertions or remove unneeded whitespace.
TestOpStackGas only prints the gas limit for a mock transaction and does not perform assertions. Consider adding actual validations for the transaction’s gas to ensure meaningful test coverage. Also, note that the static analysis flagged unnecessary newlines at lines 201 and 207.-func (s *SubmitterSuite) TestOpStackGas() { - mockTx := mocks.GetMockTxes(s.GetTestContext(), s.T(), 1, types.LegacyTxType)[0] - fmt.Printf("Original Transaction Gas Limit: %d\n", mockTx.Gas()) -} +func (s *SubmitterSuite) TestOpStackGas() { + mockTx := mocks.GetMockTxes(s.GetTestContext(), s.T(), 1, types.LegacyTxType)[0] + fmt.Printf("Original Transaction Gas Limit: %d\n", mockTx.Gas()) + // e.g., assert that the gas limit is above 0 or matches an expected range +}🧰 Tools
🪛 golangci-lint (1.62.2)
201-201: unnecessary leading newline
(whitespace)
207-207: unnecessary trailing newline
(whitespace)
🪛 GitHub Check: Lint (ethergo)
[failure] 201-201:
unnecessary leading newline (whitespace)
[failure] 207-207:
unnecessary trailing newline (whitespace)ethergo/submitter/config/config.go (5)
52-54
: Add clarity on potential edge cases.
This new fieldDynamicGasUnitAddPercentage
is effective only if dynamic gas estimation is enabled. Document any interactions with other fields, such asGasEstimate
, to avoid confusion for maintainers.
71-72
: Confirm default aligns with usage patterns.
DefaultDynamicGasUnitAddPercentage
is set to 5, which might be too high or too low depending on real-world chain usage. Ensure the default works well with typical chain conditions.
197-213
: Add a period to end the doc comment.
Per lint guidelines, the comment on line 197 should end with a period. Also consider describing how this method interacts withGetDynamicGasEstimate
for better clarity.-// GetDynamicGasUnitAddPercentage returns the percentage to bump the gas limit by +// GetDynamicGasUnitAddPercentage returns the percentage to bump the gas limit by.🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 197-197:
Comment should end in a period (godot)
222-222
: Inform test coverage or finalize TODO.
This comment clarifies that gasEstimate flows from chain to global. Confirm if any additional test coverage is needed or if you have a related TODO to finalize.
227-227
: Keep comment and logic in sync.
The comment references the default fallback forgasEstimate
. If updating defaults or logic in the future, remember to keep these explanatory comments aligned to prevent stale documentation.ethergo/submitter/submitter.go (2)
681-692
: Validate dynamic gas unit percentage range.You are retrieving
dynamic_gas_unit_add_percentage
viaGetDynamicGasUnitAddPercentage
but there's no apparent validation for extremely large or negative values. Consider enforcing a reasonable range to avoid unexpected behavior or overflow when applying the percentage.If needed, add a guard check in the config loading or here:
if gasUnitAddPercentage < 0 || gasUnitAddPercentage > someMax { // handle invalid config }
720-721
: Use the shorthand assignment operator and guard against overflow.Replace the repeated addition with the shorthand operator to follow idiomatic Go conventions. Also consider monitoring for potential overflow if
gasEstimate
orgasUnitAddPercentage
is unexpectedly large.- gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) + gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)🧰 Tools
🪛 golangci-lint (1.62.2)
720-720: assignOp: replace
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 720-720:
assignOp: replacegasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
docs/bridge/docs/06-Services/04-Submitter.md
(1 hunks)ethergo/submitter/config/config.go
(3 hunks)ethergo/submitter/config/config_test.go
(1 hunks)ethergo/submitter/config/iconfig_generated.go
(1 hunks)ethergo/submitter/submitter.go
(3 hunks)ethergo/submitter/util_test.go
(1 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/util_test.go
201-201: unnecessary leading newline
(whitespace)
207-207: unnecessary trailing newline
(whitespace)
ethergo/submitter/submitter.go
720-720: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/util_test.go
[failure] 201-201:
unnecessary leading newline (whitespace)
[failure] 207-207:
unnecessary trailing newline (whitespace)
ethergo/submitter/config/config.go
[failure] 197-197:
Comment should end in a period (godot)
ethergo/submitter/submitter.go
[failure] 396-396:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 720-720:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Generate (Module Changes) (services/omnirpc)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Deploy to Vercel (docs)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
ethergo/submitter/config/config_test.go (2)
80-80
: Inconsistent YAML parameter vs. assertion.
You've setdynamic_gas_unit_add_percentage: 20
in the YAML, yet the test subsequently checks for a value of 5. If this is intentional (e.g., you are validating fallback logic), please clarify; otherwise, consider aligning them to avoid confusion.
88-88
: Confirm the expected parameter value.
Here, the test expects a value of 5, but the YAML sets it to 20. Confirm that the fallback or override mechanism is working as intended. If not, consider adjusting the YAML or the test to ensure consistency.ethergo/submitter/submitter.go (1)
395-398
: Potential integer overflow risk when converting uint64 to int.Line 396 converts
chainID.Uint64()
toint
, which could overflow ifchainID
is larger than the maximum integer value. Consider updatinggetGasEstimate
and related config methods to accept auint64
to avoid potential overflow issues.Here's a possible fix if your
getGasEstimate
function is updated accordingly:- gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), nil) + gasEstimate, err := t.getGasEstimate(ctx, chainClient, chainID.Uint64(), nil)🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 396-396:
G115: integer overflow conversion uint64 -> int (gosec)docs/bridge/docs/06-Services/04-Submitter.md (1)
62-64
: Documentation is well-explained.Thank you for adding this configuration example. It clearly communicates the purpose of
dynamic_gas_unit_add_percentage
.
func TestBox(t *testing.T) { | ||
const testTxCount = 10 | ||
mockTx := mocks.GetMockTxes(context.Background(), t, testTxCount, 0) | ||
|
||
fmt.Printf("Original Transaction Gas Limit: %d\n", mockTx[0].Gas()) | ||
} |
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.
🛠️ Refactor suggestion
Enhance test with assertions.
TestBox prints the gas limit of the first mock transaction but includes no checks. For completeness, consider verifying that the gas limit is within expected bounds.
Deploying sanguine-fe with Cloudflare Pages
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ethergo/submitter/config/config_test.go
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Coverage (1.22.x, ethergo)
- GitHub Check: Deploy to Vercel (docs)
🔇 Additional comments (1)
ethergo/submitter/config/config_test.go (1)
80-80
: LGTM! The new configuration parameter is properly integrated.The YAML configuration addition follows the established format and uses a reasonable test value.
supports_eip_1559: true` | ||
var cfg config.Config | ||
err := yaml.Unmarshal([]byte(cfgStr), &cfg) | ||
assert.NoError(t, err) | ||
assert.Equal(t, big.NewInt(250000000000), cfg.MaxGasPrice) | ||
assert.Equal(t, 60, cfg.BumpIntervalSeconds) | ||
assert.Equal(t, 10, cfg.GasBumpPercentage) | ||
assert.Equal(t, 20, cfg.DynamicGasUnitAddPercentage) |
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.
🛠️ Refactor suggestion
Enhance test coverage for the new configuration parameter.
While the basic YAML parsing test is good, consider adding the following test cases:
- Add a test case in
TestGetters
forGetDynamicGasUnitAddPercentage
- Test the default value (5%)
- Add validation tests for edge cases (negative values, zero, etc.)
Here's a suggested implementation:
func TestGetters(t *testing.T) {
cfg := config.Config{
ChainConfig: config.ChainConfig{
MaxBatchSize: 5,
DoNotBatch: false,
MaxGasPrice: big.NewInt(250 * params.GWei),
+ DynamicGasUnitAddPercentage: 15,
},
Chains: map[int]config.ChainConfig{
MaxBatchSize: 8,
DoNotBatch: true,
MaxGasPrice: big.NewInt(300 * params.GWei),
+ DynamicGasUnitAddPercentage: 25,
},
MaxBatchSize: 0, // Should use global config value
},
},
}
// ... existing test cases ...
+ t.Run("GetDynamicGasUnitAddPercentage", func(t *testing.T) {
+ // Test chain-specific value
+ assert.Equal(t, 25, cfg.GetDynamicGasUnitAddPercentage(1))
+ // Test fallback to global value
+ assert.Equal(t, 15, cfg.GetDynamicGasUnitAddPercentage(2))
+ // Test nonexistent chain
+ assert.Equal(t, 15, cfg.GetDynamicGasUnitAddPercentage(999))
+
+ // Test default value
+ emptyCfg := config.Config{}
+ assert.Equal(t, config.DefaultDynamicGasUnitAddPercentage,
+ emptyCfg.GetDynamicGasUnitAddPercentage(1))
+
+ // Test validation (if implemented)
+ invalidCfg := config.Config{
+ ChainConfig: config.ChainConfig{
+ DynamicGasUnitAddPercentage: -1,
+ },
+ }
+ assert.Equal(t, config.DefaultDynamicGasUnitAddPercentage,
+ invalidCfg.GetDynamicGasUnitAddPercentage(1))
+ })
}
Committable suggestion skipped: line range outside the PR's diff.
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.
Actionable comments posted: 4
🔭 Outside diff range comments (2)
ethergo/submitter/submitter.go (2)
Line range hint
716-717
: Remove debug print statementsDebug print statements should be removed before merging.
- // tmpdebug - fmt.Printf("Debug Calling EstimateGas")🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 424-424:
var-naming: don't use underscores in Go names; var tx_forEstimate should be txForEstimate (revive)
Line range hint
723-724
: Remove debug print statementsDebug print statements should be removed before merging.
- // tmpdebug - fmt.Printf("Debug Default Gas Estimate: %d\n", t.config.GetGasEstimate(chainID))🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 424-424:
var-naming: don't use underscores in Go names; var tx_forEstimate should be txForEstimate (revive)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ethergo/submitter/submitter.go
(3 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 424-424:
var-naming: don't use underscores in Go names; var tx_forEstimate should be txForEstimate (revive)
[failure] 731-731:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 698-699: ethergo/submitter/submitter.go#L698-L699
Added lines #L698 - L699 were not covered by tests
[warning] 703-703: ethergo/submitter/submitter.go#L703
Added line #L703 was not covered by tests
[warning] 731-732: ethergo/submitter/submitter.go#L731-L732
Added lines #L731 - L732 were not covered by tests
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
731-731: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Generate (Module Changes) (tools)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Generate (Module Changes) (services/omnirpc)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Coverage (1.22.x, ethergo)
- GitHub Check: Go Generate (Module Changes) (services/cctp-relayer)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Generate (Module Changes) (contrib/opbot)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Deploy to Vercel (docs)
- GitHub Check: Cloudflare Pages
ethergo/submitter/submitter.go
Outdated
|
||
transactor.NoSend = true | ||
|
||
tx_forEstimate, err := call(transactor) |
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.
🛠️ Refactor suggestion
Follow Go naming conventions
The variable name tx_forEstimate
uses underscores which is against Go naming conventions.
- tx_forEstimate, err := call(transactor)
+ txForEstimate, err := call(transactor)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
tx_forEstimate, err := call(transactor) | |
txForEstimate, err := call(transactor) |
🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 424-424:
var-naming: don't use underscores in Go names; var tx_forEstimate should be txForEstimate (revive)
ethergo/submitter/submitter.go
Outdated
|
||
tx_forEstimate, err := call(transactor) | ||
|
||
gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forEstimate) |
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.
Prevent potential integer overflow
The conversion of chainID.Uint64()
to int
could potentially overflow on 32-bit systems.
- gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forEstimate)
+ chainIDInt := chainID.Int64()
+ if chainIDInt > math.MaxInt32 {
+ return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt)
+ }
+ gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainIDInt), txForEstimate)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forEstimate) | |
chainIDInt := chainID.Int64() | |
if chainIDInt > math.MaxInt32 { | |
return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt) | |
} | |
gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainIDInt), tx_forEstimate) |
🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
ethergo/submitter/submitter.go
Outdated
// Modify the gasEstimate by the configured percentage | ||
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) | ||
|
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.
🛠️ Refactor suggestion
Optimize gas estimate calculation
The gas estimate calculation could be improved in several ways:
- Use the
+=
operator for more idiomatic Go code - Add overflow protection for the percentage calculation
- gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
+ if gasUnitAddPercentage > 0 {
+ increase := new(big.Int).Mul(new(big.Int).SetUint64(gasEstimate), big.NewInt(int64(gasUnitAddPercentage)))
+ increase.Div(increase, big.NewInt(100))
+ if increase.IsUint64() {
+ gasEstimate += increase.Uint64()
+ } else {
+ return 0, fmt.Errorf("gas estimate increase exceeds uint64 max value")
+ }
+ }
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// Modify the gasEstimate by the configured percentage | |
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) | |
// Modify the gasEstimate by the configured percentage | |
if gasUnitAddPercentage > 0 { | |
increase := new(big.Int).Mul(new(big.Int).SetUint64(gasEstimate), big.NewInt(int64(gasUnitAddPercentage))) | |
increase.Div(increase, big.NewInt(100)) | |
if increase.IsUint64() { | |
gasEstimate += increase.Uint64() | |
} else { | |
return 0, fmt.Errorf("gas estimate increase exceeds uint64 max value") | |
} | |
} |
🧰 Tools
🪛 golangci-lint (1.62.2)
731-731: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
[warning] 731-732: ethergo/submitter/submitter.go#L731-L732
Added lines #L731 - L732 were not covered by tests
🪛 GitHub Check: Lint (ethergo)
[failure] 731-731:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
ethergo/submitter/submitter.go
Outdated
gasUnitAddPercentage := t.config.GetDynamicGasUnitAddPercentage(chainID) | ||
|
||
ctx, span := t.metrics.Tracer().Start(ctx, "submitter.getGasEstimate", trace.WithAttributes( | ||
attribute.Int(metrics.ChainID, chainID), | ||
attribute.String(metrics.TxHash, tx.Hash().String()), | ||
attribute.Int("gasUnitAddPercentage", gasUnitAddPercentage), |
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.
💡 Codebase verification
Add test coverage for dynamic gas unit percentage adjustment
The codebase lacks test coverage for the dynamic gas unit percentage feature. Critical areas requiring tests:
- Implementation in
config.GetDynamicGasUnitAddPercentage
- Integration with gas estimation in
submitter.getGasEstimate
- Edge cases for different chain IDs and percentage values
🔗 Analysis chain
Add test coverage for dynamic gas unit percentage
The new code for dynamic gas unit percentage adjustment lacks test coverage.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check test coverage for the new gas estimation logic
go test -coverprofile=coverage.out ./ethergo/submitter/
go tool cover -func=coverage.out | grep -A 2 "getGasEstimate"
Length of output: 305
Script:
#!/bin/bash
# Search for test files and implementation related to gas estimation
rg -g "**/*_test.go" "getGasEstimate|gasUnitAddPercentage" -A 5 -B 5
rg -g "**/*.go" "GetDynamicGasUnitAddPercentage" -A 2 -B 2
Length of output: 1437
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 698-699: ethergo/submitter/submitter.go#L698-L699
Added lines #L698 - L699 were not covered by tests
[warning] 703-703: ethergo/submitter/submitter.go#L703
Added line #L703 was not covered by tests
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.
Actionable comments posted: 0
🧹 Nitpick comments (6)
ethergo/submitter/submitter.go (3)
421-423
: No issues found regarding repeated NoSend assignment.
The logic of settingtransactor.NoSend
to true here is consistent, and no immediate problem is evident. However, you may consider consolidating it if it's already set totrue
above to ensure clarity.
701-702
: Add test coverage for dynamic gas unit percentage retrieval.
The static analyzer indicates these lines are not tested. Consider adding a dedicated test to verify different percentage values.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 701-702: ethergo/submitter/submitter.go#L701-L702
Added lines #L701 - L702 were not covered by tests
705-708
: Instrument logs with test coverage.
The newly added tracer attributes, especially around the dynamic gas unit percentage, can be validated through unit or integration tests to ensure logs match expected values.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 708-708: ethergo/submitter/submitter.go#L708
Added line #L708 was not covered by testsservices/rfq/relayer/chain/chain.go (3)
77-79
: Remove or adjust debug statements for production.
The//tmpdebug
comment andfmt.Println
are typically not recommended in production. If needed, add a space after//
. For better logging, consider using a logger with an appropriate level.🧰 Tools
🪛 golangci-lint (1.62.2)
77-77: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 77-77:
commentFormatting: put a space between//
and comment text (gocritic)
92-94
: Standardize debug logs.
Similar note here: either remove these prints or convert them into structured logs. If comments remain, add a space after//
.🧰 Tools
🪛 golangci-lint (1.62.2)
92-92: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 92-92:
commentFormatting: put a space between//
and comment text (gocritic)
98-100
: Use a logger instead of raw prints.
Again, consider using a structured logging library. If you keep commented debug lines, ensure a space after//
.🧰 Tools
🪛 golangci-lint (1.62.2)
98-98: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 98-98:
commentFormatting: put a space between//
and comment text (gocritic)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
ethergo/submitter/submitter.go
(3 hunks)services/rfq/relayer/chain/chain.go
(2 hunks)services/rfq/relayer/quoter/quoter.go
(0 hunks)services/rfq/relayer/service/handlers.go
(2 hunks)
💤 Files with no reviewable changes (1)
- services/rfq/relayer/quoter/quoter.go
✅ Files skipped from review due to trivial changes (1)
- services/rfq/relayer/service/handlers.go
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
[high] 429-429: G115: integer overflow conversion uint64 -> int
(gosec)
[warning] 424-424: var-naming: don't use underscores in Go names; var tx_forEstimate should be txForEstimate
(revive)
731-731: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
services/rfq/relayer/chain/chain.go
77-77: commentFormatting: put a space between //
and comment text
(gocritic)
92-92: commentFormatting: put a space between //
and comment text
(gocritic)
98-98: commentFormatting: put a space between //
and comment text
(gocritic)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 429-429:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 424-424:
var-naming: don't use underscores in Go names; var tx_forEstimate should be txForEstimate (revive)
[failure] 731-731:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 701-702: ethergo/submitter/submitter.go#L701-L702
Added lines #L701 - L702 were not covered by tests
[warning] 708-708: ethergo/submitter/submitter.go#L708
Added line #L708 was not covered by tests
[warning] 731-732: ethergo/submitter/submitter.go#L731-L732
Added lines #L731 - L732 were not covered by tests
🪛 GitHub Check: Lint (services/rfq)
services/rfq/relayer/chain/chain.go
[failure] 77-77:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 92-92:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 98-98:
commentFormatting: put a space between //
and comment text (gocritic)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Go Coverage (1.22.x, services/omnirpc)
- GitHub Check: Go Coverage (1.22.x, services/cctp-relayer)
- GitHub Check: Go Coverage (1.22.x, ethergo)
🔇 Additional comments (7)
ethergo/submitter/submitter.go (7)
424-428
: Use Go naming conventions fortx_forEstimate
.
This issue was flagged in a prior review as well.- tx_forEstimate, err := call(transactor) + txForEstimate, err := call(transactor)🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 424-424: var-naming: don't use underscores in Go names; var tx_forEstimate should be txForEstimate
(revive)
🪛 GitHub Check: Lint (ethergo)
[failure] 424-424:
var-naming: don't use underscores in Go names; var tx_forEstimate should be txForEstimate (revive)
429-433
: Potential integer overflow conversion when castingchainID.Uint64()
toint
.
This was also mentioned in a past review. Consider checking for overflow or using a larger integer type to avoid issues on 32-bit systems.🧰 Tools
🪛 golangci-lint (1.62.2)
[high] 429-429: G115: integer overflow conversion uint64 -> int
(gosec)
🪛 GitHub Check: Lint (ethergo)
[failure] 429-429:
G115: integer overflow conversion uint64 -> int (gosec)
434-437
: Gas limit assignment logic check.
Assigningtransactor.GasLimit
to the newly estimated value and then togglingNoSend = false
is consistent. No new concerns here.
439-439
: No additional feedback on this line.
No immediate improvements or concerns stand out.
441-441
: Error handling logic is appropriate.
Returning a clear wrapped error for contract call execution aligns with good practices.
695-696
: Fallback to static gas estimate.
Usingt.config.GetGasEstimate(chainID)
upon disabling dynamic gas estimation is straightforward. No further issues.
730-732
: Use compound assignment for clarity.
This was identified previously. Consider usinggasEstimate += gasEstimate * ...
for more idiomatic Go code.🧰 Tools
🪛 golangci-lint (1.62.2)
731-731: assignOp: replace
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
[warning] 731-732: ethergo/submitter/submitter.go#L731-L732
Added lines #L731 - L732 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 731-731:
assignOp: replacegasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
services/rfq/relayer/chain/chain.go
(2 hunks)services/rfq/relayer/service/handlers.go
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- services/rfq/relayer/service/handlers.go
🧰 Additional context used
🪛 golangci-lint (1.62.2)
services/rfq/relayer/chain/chain.go
77-77: commentFormatting: put a space between //
and comment text
(gocritic)
92-92: commentFormatting: put a space between //
and comment text
(gocritic)
98-98: commentFormatting: put a space between //
and comment text
(gocritic)
🪛 GitHub Check: Lint (services/rfq)
services/rfq/relayer/chain/chain.go
[failure] 77-77:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 92-92:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 98-98:
commentFormatting: put a space between //
and comment text (gocritic)
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Generate (Module Changes) (services/omnirpc)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Coverage (1.22.x, services/cctp-relayer)
- GitHub Check: Go Coverage (1.22.x, ethergo)
- GitHub Check: Deploy to Vercel (docs)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
services/rfq/relayer/chain/chain.go (2)
Line range hint
77-115
: Verify alignment with PR objectives.The PR's objective is to implement dynamic gas unit adjustment functionality, but this file only contains debug logging changes. Consider whether:
- The gas adjustment logic should be implemented in this file
- These debug statements are essential for the gas adjustment feature
- The changes are complete for this PR's scope
Let's check for any gas-related implementations:
✅ Verification successful
Debug statements support gas adjustment monitoring.
The debug statements in this file are essential for the gas adjustment feature as they provide visibility into:
- Transaction relay flow
- Gas amount tracking
- Transaction submission status
These logs will help monitor and debug the dynamic gas unit adjustment functionality implemented in the submitter package.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for gas adjustment related code rg -g '!{vendor,node_modules}/**' -i 'dynamic.*gas.*percentage|gas.*adjustment'Length of output: 67636
🧰 Tools
🪛 golangci-lint (1.62.2)
92-92: commentFormatting: put a space between
//
and comment text(gocritic)
98-98: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 92-92:
commentFormatting: put a space between//
and comment text (gocritic)
[failure] 98-98:
commentFormatting: put a space between//
and comment text (gocritic)
77-79
:⚠️ Potential issueReplace debug print statements with structured logging.
The current implementation uses temporary
fmt.Println
statements for debugging. In a production service, we should use structured logging instead.Apply this diff to implement proper logging:
- //tmpdebug - fmt.Println("SubmitRelay>start: ", request.OriginTxHash) + logger := c.submitter.Logger().With(). + Str("origin_tx_hash", request.OriginTxHash). + Logger() + logger.Debug().Msg("starting relay submission") - //tmpdebug - fmt.Println("SubmitRelay>SubmitTransaction: ", request.OriginTxHash) + logger.Debug().Msg("submitting transaction") - //tmpdebug - fmt.Println("SubmitTransaction>RelayV2: ", request.OriginTxHash) + logger.Debug().Msg("executing relay v2") - //tmpdebug - fmt.Println("RelayV2 hash: ", tx.Hash()) + logger.Debug(). + Str("tx_hash", tx.Hash().String()). + Msg("relay v2 transaction submitted") - //tmpdebug - fmt.Println("SubmitRelay nonce:", nonce, "gas amount:", gasAmount) + logger.Debug(). + Uint64("nonce", nonce). + Str("gas_amount", gasAmount.String()). + Msg("relay submission completed")This change:
- Uses structured logging instead of print statements
- Adds proper context through logging fields
- Uses appropriate log levels
- Maintains better traceability
Let's verify the logger availability in the submitter interface:
Also applies to: 92-94, 98-100, 106-108, 114-115
✅ Verification successful
Replace temporary debug prints with structured logging
The review comment is correct. The codebase has an established structured logging pattern using
ipfs/go-log
. The temporary debug print statements should be replaced with proper structured logging to maintain consistency and provide better observability.Evidence found in the codebase:
- Multiple components already use structured logging with proper logger initialization
- Consistent logging patterns with appropriate log levels (Debug, Warn, Error)
- Contextual information is included in log messages
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if the submitter interface includes logging capabilities ast-grep --pattern 'type TransactionSubmitter interface { $$$ Logger() $$$ $$$ }'Length of output: 89
Script:
#!/bin/bash # Find TransactionSubmitter interface definition ast-grep --pattern 'type TransactionSubmitter interface' # Find logging-related imports rg 'import.*".*log.*"' -A 5 # Find existing structured logging patterns in the codebase rg 'logger\.' -A 2Length of output: 67611
Script:
#!/bin/bash # Find logging patterns in the relayer package rg -g 'services/rfq/relayer/**' 'logger\.' -A 2 # Find logger initialization in relayer package rg -g 'services/rfq/relayer/**' 'var logger' -A 2 # Find any logging related imports in relayer package rg -g 'services/rfq/relayer/**' 'import.*".*log.*"'Length of output: 10632
🧰 Tools
🪛 golangci-lint (1.62.2)
77-77: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 77-77:
commentFormatting: put a space between//
and comment text (gocritic)
@@ -74,6 +74,9 @@ | |||
gasAmount := big.NewInt(0) | |||
var err error | |||
|
|||
//tmpdebug |
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.
Fix comment formatting to follow Go standards.
The comments don't follow Go formatting standards. There should be a space between //
and the comment text.
Apply this diff to fix the formatting:
- //tmpdebug
+ // tmpdebug
Also applies to: 92-92, 98-98
🧰 Tools
🪛 golangci-lint (1.62.2)
77-77: commentFormatting: put a space between //
and comment text
(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 77-77:
commentFormatting: put a space between //
and comment text (gocritic)
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.
Actionable comments posted: 0
🧹 Nitpick comments (11)
ethergo/submitter/submitter.go (6)
391-393
: Remove or convert leftover debug statements and fix comment style
It’s generally best practice to remove or replace debug statements like//tmpdebug
with structured logs. Also, add a space after//
to match Go comment guidelines.- //tmpdebug + // tmpdebug fmt.Printf("SubmitTransaction>setGasPrice")🧰 Tools
🪛 golangci-lint (1.62.2)
391-391: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 391-391:
commentFormatting: put a space between//
and comment text (gocritic)
425-427
: Remove or convert leftover debug statements and fix comment style
Same note as above: consider removing or adapting debug prints and use a space after//
.- //tmpdebug + // tmpdebug fmt.Printf("SubmitTransaction>call")🧰 Tools
🪛 golangci-lint (1.62.2)
425-425: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 425-425:
commentFormatting: put a space between//
and comment text (gocritic)
435-437
: Remove or convert leftover debug statements and fix comment style
Again, these debugging logs can be switched to structured logging or removed.- //tmpdebug + // tmpdebug fmt.Printf("Gas estimate: %d\n", gasEstimate)🧰 Tools
🪛 golangci-lint (1.62.2)
435-435: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 435-435:
commentFormatting: put a space between//
and comment text (gocritic)
457-459
: Remove or convert leftover debug statements and fix comment style
Same debug/logging considerations as previous comments.- //tmpdebug + // tmpdebug fmt.Printf("SubmitTransaction>tx.Nonce: %d\n", tx.Nonce())
707-708
: Add test coverage for dynamic gas unit percentage
Lines setting thegasUnitAddPercentage
aren’t tested according to coverage reports. Add a small unit or integration test to confirm correct handling under different configurations.// Example test snippet func TestDynamicGasUnitAddPercentage(t *testing.T) { // ... }🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 707-708: ethergo/submitter/submitter.go#L707-L708
Added lines #L707 - L708 were not covered by tests
736-738
: Use+=
operator and consider overflow checks
Replace the verbose addition expression with+=
. Also consider adding a guard for potential overflow ifgasEstimate
is large.- gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) + gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)🧰 Tools
🪛 golangci-lint (1.62.2)
737-737: assignOp: replace
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
[warning] 737-738: ethergo/submitter/submitter.go#L737-L738
Added lines #L737 - L738 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 737-737:
assignOp: replacegasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)services/rfq/relayer/chain/chain.go (5)
77-79
: Refine debug statements and fix comment style
Consider removing or converting this to structured logs. Also, ensure a space after//
for Go style.- //tmpdebug + // tmpdebug fmt.Println("SubmitRelay>start: ", request.OriginTxHash)🧰 Tools
🪛 golangci-lint (1.62.2)
77-77: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 77-77:
commentFormatting: put a space between//
and comment text (gocritic)🪛 GitHub Actions: Go Workflows
[error] 77-77: commentFormatting: put a space between
//
and comment text (gocritic)
92-94
: Refine debug statements and fix comment style
Same as above. Apply the same approach to unify comment formatting.- //tmpdebug + // tmpdebug fmt.Println("SubmitRelay>SubmitTransaction: ", request.OriginTxHash)🧰 Tools
🪛 golangci-lint (1.62.2)
92-92: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 92-92:
commentFormatting: put a space between//
and comment text (gocritic)
98-100
: Refine debug statements and fix comment style
Similarly, remove or update the debug prints and correct the comment spacing.- //tmpdebug + // tmpdebug fmt.Println("SubmitTransaction>RelayV2: ", request.OriginTxHash)🧰 Tools
🪛 golangci-lint (1.62.2)
98-98: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 98-98:
commentFormatting: put a space between//
and comment text (gocritic)
106-108
: Refine debug statements and fix comment style
Again, consider removing temporary debug lines and standardizing the comment format.- //tmpdebug + // tmpdebug fmt.Printf("RelayV2 transaction: %+v\n", tx)
114-115
: Refine debug statements and fix comment style
As with previous segments, convert this debug usage to a more permanent logging approach or remove if no longer needed.- //tmpdebug + // tmpdebug fmt.Println("SubmitRelay nonce:", nonce, "gas amount:", gasAmount)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
ethergo/submitter/submitter.go
(5 hunks)services/rfq/relayer/chain/chain.go
(2 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
425-425: commentFormatting: put a space between //
and comment text
(gocritic)
435-435: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
737-737: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
services/rfq/relayer/chain/chain.go
77-77: commentFormatting: put a space between //
and comment text
(gocritic)
92-92: commentFormatting: put a space between //
and comment text
(gocritic)
98-98: commentFormatting: put a space between //
and comment text
(gocritic)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 425-425:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 435-435:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 737-737:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 707-708: ethergo/submitter/submitter.go#L707-L708
Added lines #L707 - L708 were not covered by tests
[warning] 714-714: ethergo/submitter/submitter.go#L714
Added line #L714 was not covered by tests
[warning] 737-738: ethergo/submitter/submitter.go#L737-L738
Added lines #L737 - L738 were not covered by tests
🪛 GitHub Actions: Go Workflows
ethergo/submitter/submitter.go
[error] 443-443: Nil pointer dereference in txSubmitterImpl.SubmitTransaction method
services/rfq/relayer/chain/chain.go
[error] 77-77: commentFormatting: put a space between //
and comment text (gocritic)
🪛 GitHub Check: Lint (services/rfq)
services/rfq/relayer/chain/chain.go
[failure] 77-77:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 92-92:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 98-98:
commentFormatting: put a space between //
and comment text (gocritic)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: run-goreleaser (tools)
- GitHub Check: run-goreleaser (ethergo)
- GitHub Check: run-goreleaser (agents)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
ethergo/submitter/submitter.go (5)
438-441
: Confirm error handling logic post gas limit assignment
After settingtransactor.GasLimit
, theif err != nil
check uses the sameerr
variable without additional changes in between. Consider ensuring correct error validation from any subsequent call or clarifying the logic to avoid confusion.
701-702
: No issues found
This comment line seems fine.
711-714
: Good logging addition
StoringgasUnitAddPercentage
in trace attributes helps debugging. This is a good addition.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 714-714: ethergo/submitter/submitter.go#L714
Added line #L714 was not covered by tests
445-447
:⚠️ Potential issueAvoid nil pointer dereference when unlocking
If the signer is never invoked,locker
remains nil. This causes a nil pointer dereference atlocker.Unlock()
. Confirm that the contract call always triggers the signer, or defensively check iflocker
is nil.defer func() { - locker.Unlock() + if locker != nil { + locker.Unlock() + } }()Likely invalid or redundant comment.
430-433
:⚠️ Potential issuePrevent potential integer overflow
ConvertingchainID.Uint64()
directly toint
can overflow on 32-bit systems if the value exceedsmath.MaxInt32
.- gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx) + chainIDInt := chainID.Int64() + if chainIDInt > math.MaxInt32 { + return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt) + } + gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainIDInt), tx)Likely invalid or redundant comment.
🧰 Tools
🪛 golangci-lint (1.62.2)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
🪛 GitHub Check: Lint (ethergo)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
ethergo/submitter/submitter.go (1)
754-754
: Optimize gas estimate calculation.The gas estimate calculation could be improved using the
+=
operator for more idiomatic Go code.- gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) + gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)🧰 Tools
🪛 golangci-lint (1.62.2)
754-754: assignOp: replace
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
[warning] 754-755: ethergo/submitter/submitter.go#L754-L755
Added lines #L754 - L755 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 754-754:
assignOp: replacegasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ethergo/submitter/submitter.go
(5 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
428-428: commentFormatting: put a space between //
and comment text
(gocritic)
434-434: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 426-426: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 443-443: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 431-431: G115: integer overflow conversion uint64 -> int
(gosec)
[warning] 437-437: var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate
(revive)
432-432: unnecessary leading newline
(whitespace)
450-450: unnecessary trailing newline
(whitespace)
754-754: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 428-428:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 434-434:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 443-443:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 431-431:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 437-437:
var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)
[failure] 432-432:
unnecessary leading newline (whitespace)
[failure] 754-754:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 450-450: ethergo/submitter/submitter.go#L450
Added line #L450 was not covered by tests
[warning] 724-725: ethergo/submitter/submitter.go#L724-L725
Added lines #L724 - L725 were not covered by tests
[warning] 728-728: ethergo/submitter/submitter.go#L728
Added line #L728 was not covered by tests
[warning] 730-731: ethergo/submitter/submitter.go#L730-L731
Added lines #L730 - L731 were not covered by tests
[warning] 754-755: ethergo/submitter/submitter.go#L754-L755
Added lines #L754 - L755 were not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Coverage (1.22.x, ethergo)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: run-goreleaser (services/explorer)
- GitHub Check: run-goreleaser (services/cctp-relayer)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Deploy to Vercel (docs)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
ethergo/submitter/submitter.go (3)
437-437
: Follow Go naming conventions.The variable name
tx_forGasEstimate
uses underscores which is against Go naming conventions.- tx_forGasEstimate, err := call(transactor) + txForGasEstimate, err := call(transactor)🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 437-437: var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate
(revive)
🪛 GitHub Check: Lint (ethergo)
[failure] 437-437:
var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)
753-755
: 🛠️ Refactor suggestionPrevent potential overflow in gas estimate calculation.
The gas estimate percentage calculation should be protected against overflow.
- gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) + increase := new(big.Int).Mul(new(big.Int).SetUint64(gasEstimate), big.NewInt(int64(gasUnitAddPercentage))) + increase.Div(increase, big.NewInt(100)) + if !increase.IsUint64() { + return 0, fmt.Errorf("gas estimate increase exceeds uint64 max value") + } + gasEstimate += increase.Uint64()Likely invalid or redundant comment.
🧰 Tools
🪛 golangci-lint (1.62.2)
754-754: assignOp: replace
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
[warning] 754-755: ethergo/submitter/submitter.go#L754-L755
Added lines #L754 - L755 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 754-754:
assignOp: replacegasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
724-725
: Add test coverage for gas unit percentage adjustment.The new gas unit percentage adjustment feature lacks test coverage.
Run the following script to verify test coverage:
Also applies to: 728-728, 730-731, 754-755
✅ Verification successful
Test coverage missing for gas unit percentage adjustment confirmed
The codebase search confirms that while there are some gas-related tests (
TestSetGasPrice
,TestGetGasBlock
), there is no test coverage for thegasUnitAddPercentage
functionality. The feature is only implemented insubmitter.go
without corresponding test cases.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check test coverage for gas estimation logic go test -coverprofile=coverage.out ./ethergo/submitter/ go tool cover -func=coverage.out | grep -A 2 "getGasEstimate"Length of output: 12925
Script:
#!/bin/bash # Search for test files containing gas estimation tests rg -l "Test.*Gas" --type go rg -l "gasUnitAddPercentage" --type goLength of output: 1178
Script:
#!/bin/bash # Check content of submitter test files for gas-related tests rg -A 5 "func.*Test.*Gas" ethergo/submitter/submitter_test.go rg -B 5 -A 10 "gasUnitAddPercentage" ethergo/submitter/submitter_test.goLength of output: 457
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 724-725: ethergo/submitter/submitter.go#L724-L725
Added lines #L724 - L725 were not covered by tests
ethergo/submitter/submitter.go
Outdated
//tmpdebug | ||
fmt.Printf("SubmitTransaction>setGasPrice") |
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.
🛠️ Refactor suggestion
Replace debug prints with proper logging.
Replace temporary debug print statements with structured logging using the existing logger
instance.
- //tmpdebug
- fmt.Printf("SubmitTransaction>setGasPrice")
+ logger.Debugf("submitting transaction: setting gas price")
- //tmpdebug
- fmt.Printf("Using Default")
+ logger.Debugf("using default gas estimate: %d", t.config.GetGasEstimate(int(chainID.Uint64())))
- //tmpdebug
- fmt.Printf("SubmitTransaction>forGasEst call")
+ logger.Debugf("submitting transaction: estimating gas")
- //tmpdebug
- fmt.Printf("transactor.GasLimit: %d\n", transactor.GasLimit)
+ logger.Debugf("gas limit set to: %d", transactor.GasLimit)
- //tmpdebug
- fmt.Printf("SubmitTransaction>storeTX")
+ logger.Debugf("submitting transaction: storing tx")
- //tmpdebug
- fmt.Printf("SubmitTransaction>tx.Nonce: %d\n", tx.Nonce())
+ logger.Debugf("transaction nonce: %d", tx.Nonce())
Also applies to: 428-429, 434-435, 452-453, 462-463, 474-475
🧰 Tools
🪛 golangci-lint (1.62.2)
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
@@ -421,12 +421,47 @@ | |||
//nolint: wrapcheck | |||
return parentTransactor.Signer(address, transaction) | |||
} | |||
// if dynamic gas estimation is not enabled, use cfg var gas_estimate as a gas limit default and do not run a pre-flight simulation | |||
// since we do not need it to determine proper gas units | |||
if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) { |
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.
Prevent potential integer overflow in chain ID conversion.
The conversion of chainID.Uint64()
to int
could overflow on 32-bit systems.
- if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) {
+ chainIDInt := chainID.Int64()
+ if chainIDInt > math.MaxInt32 {
+ return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt)
+ }
+ if !t.config.GetDynamicGasEstimate(int(chainIDInt)) {
Also applies to: 431-431, 443-443
🧰 Tools
🪛 golangci-lint (1.62.2)
[high] 426-426: G115: integer overflow conversion uint64 -> int
(gosec)
🪛 GitHub Check: Lint (ethergo)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
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.
Actionable comments posted: 2
♻️ Duplicate comments (5)
services/rfq/relayer/chain/chain.go (4)
77-78
: 🛠️ Refactor suggestionReplace debug prints with structured logging.
Use the existing
logger
instance for structured logging instead offmt.Println
.Apply this diff to improve the logging:
- //tmpdebug - fmt.Println("SubmitRelay>start: ", request.OriginTxHash) + logger.Debugf("starting relay submission for origin tx hash: %s", request.OriginTxHash)The comment formatting doesn't follow Go standards. There should be a space between
//
and the comment text.🧰 Tools
🪛 golangci-lint (1.62.2)
77-77: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 77-77:
commentFormatting: put a space between//
and comment text (gocritic)
92-93
: 🛠️ Refactor suggestionReplace debug prints with structured logging.
Use the existing
logger
instance for structured logging instead offmt.Println
.Apply this diff to improve the logging:
- //tmpdebug - fmt.Println("SubmitRelay>SubmitTransaction: ", request.OriginTxHash) + logger.Debugf("submitting transaction for origin tx hash: %s", request.OriginTxHash)The comment formatting doesn't follow Go standards. There should be a space between
//
and the comment text.🧰 Tools
🪛 golangci-lint (1.62.2)
92-92: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 92-92:
commentFormatting: put a space between//
and comment text (gocritic)
98-102
: 🛠️ Refactor suggestionReplace debug prints with structured logging.
Use the existing
logger
instance for structured logging instead offmt.Println
andfmt.Printf
.Apply this diff to improve the logging:
- //tmpdebug - fmt.Println("SubmitTransaction>RelayV2: ", request.OriginTxHash) - fmt.Printf("RelayV2 transactor with origin hash %v: %+v\n", request.OriginTxHash, transactor) - fmt.Printf("RelayV2 gas limit: %v\n", transactor.GasLimit) + logger.Debugw("relaying transaction", + "origin_tx_hash", request.OriginTxHash, + "transactor", transactor, + "gas_limit", transactor.GasLimit)The comment formatting doesn't follow Go standards. There should be a space between
//
and the comment text.🧰 Tools
🪛 golangci-lint (1.62.2)
98-98: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 98-98:
commentFormatting: put a space between//
and comment text (gocritic)
110-113
: 🛠️ Refactor suggestionReplace debug prints with structured logging.
Use the existing
logger
instance for structured logging instead offmt.Printf
.Apply this diff to improve the logging:
- //tmpdebug - fmt.Printf("RelayV2 transaction: %+v\n", tx) - fmt.Printf("RelayV2 call exiting: %v\n", request.OriginTxHash) + logger.Debugw("relay transaction completed", + "transaction", tx, + "origin_tx_hash", request.OriginTxHash)The comment formatting doesn't follow Go standards. There should be a space between
//
and the comment text.ethergo/submitter/submitter.go (1)
391-392
: 🛠️ Refactor suggestionReplace debug prints with structured logging.
Use the existing
logger
instance for structured logging instead offmt.Printf
.Apply this diff to improve the logging:
- //tmpdebug - fmt.Printf("SubmitTransaction>setGasPrice") + logger.Debug("setting gas price for transaction")The comment formatting doesn't follow Go standards. There should be a space between
//
and the comment text.🧰 Tools
🪛 golangci-lint (1.62.2)
391-391: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 391-391:
commentFormatting: put a space between//
and comment text (gocritic)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
ethergo/submitter/submitter.go
(5 hunks)services/rfq/relayer/chain/chain.go
(2 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
428-428: commentFormatting: put a space between //
and comment text
(gocritic)
434-434: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 426-426: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 446-446: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 431-431: G115: integer overflow conversion uint64 -> int
(gosec)
[warning] 437-437: var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate
(revive)
[warning] 440-440: var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate
(revive)
432-432: unnecessary leading newline
(whitespace)
453-453: unnecessary trailing newline
(whitespace)
760-760: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
services/rfq/relayer/chain/chain.go
77-77: commentFormatting: put a space between //
and comment text
(gocritic)
92-92: commentFormatting: put a space between //
and comment text
(gocritic)
98-98: commentFormatting: put a space between //
and comment text
(gocritic)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 428-428:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 434-434:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 446-446:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 431-431:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 437-437:
var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate (revive)
[failure] 440-440:
var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)
[failure] 760-760:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 433-444: ethergo/submitter/submitter.go#L433-L444
Added lines #L433 - L444 were not covered by tests
[warning] 446-449: ethergo/submitter/submitter.go#L446-L449
Added lines #L446 - L449 were not covered by tests
[warning] 451-451: ethergo/submitter/submitter.go#L451
Added line #L451 was not covered by tests
[warning] 463-463: ethergo/submitter/submitter.go#L463
Added line #L463 was not covered by tests
[warning] 724-725: ethergo/submitter/submitter.go#L724-L725
Added lines #L724 - L725 were not covered by tests
[warning] 730-731: ethergo/submitter/submitter.go#L730-L731
Added lines #L730 - L731 were not covered by tests
[warning] 734-734: ethergo/submitter/submitter.go#L734
Added line #L734 was not covered by tests
[warning] 736-737: ethergo/submitter/submitter.go#L736-L737
Added lines #L736 - L737 were not covered by tests
[warning] 760-761: ethergo/submitter/submitter.go#L760-L761
Added lines #L760 - L761 were not covered by tests
🪛 GitHub Check: Lint (services/rfq)
services/rfq/relayer/chain/chain.go
[failure] 77-77:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 92-92:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 98-98:
commentFormatting: put a space between //
and comment text (gocritic)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Generate (Module Changes) (services/cctp-relayer)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Deploy to Vercel (docs)
🔇 Additional comments (2)
ethergo/submitter/submitter.go (2)
759-761
: 🛠️ Refactor suggestionOptimize gas estimate calculation.
The gas estimate calculation could be improved in several ways:
- Use the
+=
operator for more idiomatic Go code- Add overflow protection for the percentage calculation
Apply this diff to improve the calculation:
- gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) + if gasUnitAddPercentage > 0 { + increase := new(big.Int).Mul(new(big.Int).SetUint64(gasEstimate), big.NewInt(int64(gasUnitAddPercentage))) + increase.Div(increase, big.NewInt(100)) + if increase.IsUint64() { + gasEstimate += increase.Uint64() + } else { + return 0, fmt.Errorf("gas estimate increase exceeds uint64 max value") + } + }Likely invalid or redundant comment.
🧰 Tools
🪛 golangci-lint (1.62.2)
760-760: assignOp: replace
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
[warning] 760-761: ethergo/submitter/submitter.go#L760-L761
Added lines #L760 - L761 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 760-760:
assignOp: replacegasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
724-737
: Add test coverage for the dynamic gas unit percentage feature.The new gas unit percentage functionality lacks test coverage. Critical areas requiring tests:
- Implementation in
config.GetDynamicGasUnitAddPercentage
- Integration with gas estimation in
submitter.getGasEstimate
- Edge cases for different chain IDs and percentage values
Run this script to verify the test coverage:
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 724-725: ethergo/submitter/submitter.go#L724-L725
Added lines #L724 - L725 were not covered by tests
[warning] 730-731: ethergo/submitter/submitter.go#L730-L731
Added lines #L730 - L731 were not covered by tests
[warning] 734-734: ethergo/submitter/submitter.go#L734
Added line #L734 was not covered by tests
[warning] 736-737: ethergo/submitter/submitter.go#L736-L737
Added lines #L736 - L737 were not covered by tests
services/rfq/relayer/chain/chain.go
Outdated
fmt.Println("SubmitTransaction>RelayV2 after call", request.OriginTxHash) | ||
if err != nil { | ||
fmt.Printf("Error relayV2: %v (origin hash %v)\n", err, request.OriginTxHash) |
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.
🛠️ Refactor suggestion
Replace debug prints with proper error logging.
Use the existing logger
instance for error logging instead of fmt.Println
and fmt.Printf
.
Apply this diff to improve the error logging:
- fmt.Println("SubmitTransaction>RelayV2 after call", request.OriginTxHash)
if err != nil {
- fmt.Printf("Error relayV2: %v (origin hash %v)\n", err, request.OriginTxHash)
+ logger.Errorw("failed to relay transaction",
+ "error", err,
+ "origin_tx_hash", request.OriginTxHash)
return nil, fmt.Errorf("could not relay: %w", err)
}
Committable suggestion skipped: line range outside the PR's diff.
ethergo/submitter/submitter.go
Outdated
// if dynamic gas estimation is not enabled, use cfg var gas_estimate as a gas limit default and do not run a pre-flight simulation | ||
// since we do not need it to determine proper gas units | ||
if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) { | ||
|
||
//tmpdebug | ||
fmt.Printf("Using Default") | ||
|
||
transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64())) | ||
} else { | ||
|
||
//tmpdebug | ||
fmt.Printf("SubmitTransaction>forGasEst call") | ||
|
||
transactor_forGasEstimate := new(bind.TransactOpts) | ||
*transactor_forGasEstimate = *transactor | ||
|
||
tx_forGasEstimate, err := call(transactor_forGasEstimate) | ||
|
||
if err != nil { | ||
return 0, fmt.Errorf("err contract call for gas est: %w", err) | ||
} | ||
|
||
gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate) | ||
if err != nil { | ||
return 0, fmt.Errorf("err getGasEstimate: %w", err) | ||
} | ||
|
||
transactor.GasLimit = gasEstimate | ||
|
||
} |
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.
💡 Codebase verification
🛠️ Refactor suggestion
Review comment is correct: gas estimation logic needs test coverage
The codebase inspection confirms that the new gas estimation logic lacks proper test coverage. Specifically:
- No tests for dynamic gas estimation functionality
- No tests for gas estimation error handling
- No tests for config-based gas estimation fallback
🔗 Analysis chain
Fix multiple issues in the gas estimation logic.
- Variable names should follow Go naming conventions
- Add integer overflow protection for chainID conversion
- Replace debug prints with structured logging
- Add test coverage for the new gas estimation logic
Apply this diff to fix the issues:
- if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) {
+ chainIDInt := chainID.Int64()
+ if chainIDInt > math.MaxInt32 {
+ return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt)
+ }
+ if !t.config.GetDynamicGasEstimate(int(chainIDInt)) {
- //tmpdebug
- fmt.Printf("Using Default")
+ logger.Debugf("using default gas estimate for chain %d", chainIDInt)
- transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64()))
+ transactor.GasLimit = t.config.GetGasEstimate(int(chainIDInt))
} else {
- //tmpdebug
- fmt.Printf("SubmitTransaction>forGasEst call")
+ logger.Debug("estimating gas for transaction")
- transactor_forGasEstimate := new(bind.TransactOpts)
+ transactorForGasEstimate := new(bind.TransactOpts)
- *transactor_forGasEstimate = *transactor
+ *transactorForGasEstimate = *transactor
- tx_forGasEstimate, err := call(transactor_forGasEstimate)
+ txForGasEstimate, err := call(transactorForGasEstimate)
if err != nil {
return 0, fmt.Errorf("err contract call for gas est: %w", err)
}
- gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate)
+ gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainIDInt), txForGasEstimate)
if err != nil {
return 0, fmt.Errorf("err getGasEstimate: %w", err)
}
transactor.GasLimit = gasEstimate
}
The new gas estimation logic lacks test coverage. Run this script to verify:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check test coverage for the new gas estimation logic
go test -coverprofile=coverage.out ./ethergo/submitter/
go tool cover -func=coverage.out | grep -A 2 "getGasEstimate"
Length of output: 12925
Script:
#!/bin/bash
# Search for test files containing gas estimation tests
echo "=== Searching for gas estimation test files ==="
rg -l "gasEstimate|GasEstimate" --type go --glob "*_test.go"
echo -e "\n=== Checking test file contents ==="
ast-grep --pattern 'func Test$_($$$) {
$$$
gasEstimate
$$$
}'
Length of output: 664
Script:
#!/bin/bash
echo "=== Checking config test content ==="
cat ethergo/submitter/config/config_test.go
echo -e "\n=== Checking submitter test content ==="
cat ethergo/submitter/submitter_test.go
Length of output: 19364
🧰 Tools
🪛 golangci-lint (1.62.2)
428-428: commentFormatting: put a space between //
and comment text
(gocritic)
434-434: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 426-426: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 446-446: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 431-431: G115: integer overflow conversion uint64 -> int
(gosec)
[warning] 437-437: var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate
(revive)
[warning] 440-440: var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate
(revive)
432-432: unnecessary leading newline
(whitespace)
453-453: unnecessary trailing newline
(whitespace)
🪛 GitHub Check: codecov/patch
[warning] 433-444: ethergo/submitter/submitter.go#L433-L444
Added lines #L433 - L444 were not covered by tests
[warning] 446-449: ethergo/submitter/submitter.go#L446-L449
Added lines #L446 - L449 were not covered by tests
[warning] 451-451: ethergo/submitter/submitter.go#L451
Added line #L451 was not covered by tests
🪛 GitHub Check: Lint (ethergo)
[failure] 428-428:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 434-434:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 446-446:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 431-431:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 437-437:
var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate (revive)
[failure] 440-440:
var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)
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.
Actionable comments posted: 2
♻️ Duplicate comments (5)
services/rfq/relayer/chain/chain.go (4)
92-93
: 🛠️ Refactor suggestionReplace debug print with structured logging.
Replace temporary debug print with proper logging using the existing
logger
instance.Apply this diff to improve the code:
- //tmpdebug - fmt.Println("SubmitRelay>SubmitTransaction: ", request.OriginTxHash) + logger.Debugw("submitting relay transaction", + "origin_tx_hash", request.OriginTxHash)🧰 Tools
🪛 golangci-lint (1.62.2)
92-92: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 92-92:
commentFormatting: put a space between//
and comment text (gocritic)
98-99
: 🛠️ Refactor suggestionReplace debug print with structured logging.
Replace temporary debug print with proper logging using the existing
logger
instance.Apply this diff to improve the code:
- //tmpdebug - fmt.Println("SubmitTransaction>RelayV2: ", request.OriginTxHash) + logger.Debugw("calling RelayV2", + "origin_tx_hash", request.OriginTxHash)🧰 Tools
🪛 golangci-lint (1.62.2)
98-98: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 98-98:
commentFormatting: put a space between//
and comment text (gocritic)
106-108
: 🛠️ Refactor suggestionReplace debug prints with structured logging and limit transaction data exposure.
Replace temporary debug prints with proper logging and only log essential transaction fields.
Apply this diff to improve the code:
- //tmpdebug - fmt.Println("RelayV2 OriginTxHash:", request.OriginTxHash) - fmt.Printf("RelayV2 transaction: %+v\n", tx) + logger.Debugw("RelayV2 transaction created", + "origin_tx_hash", request.OriginTxHash, + "tx_hash", tx.Hash(), + "nonce", tx.Nonce(), + "gas_limit", tx.Gas())
115-116
: 🛠️ Refactor suggestionReplace debug print with structured logging.
Replace temporary debug print with proper logging using the existing
logger
instance.Apply this diff to improve the code:
- //tmpdebug - fmt.Println("SubmitRelay nonce:", nonce, "gas amount:", gasAmount) + logger.Debugw("relay submission completed", + "nonce", nonce, + "gas_amount", gasAmount)ethergo/submitter/submitter.go (1)
391-392
: 🛠️ Refactor suggestionReplace debug print with structured logging.
Replace temporary debug print with proper logging using the existing
logger
instance.Apply this diff to improve the code:
- //tmpdebug - fmt.Printf("SubmitTransaction>setGasPrice") + logger.Debug("setting gas price for transaction")🧰 Tools
🪛 golangci-lint (1.62.2)
391-391: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 391-391:
commentFormatting: put a space between//
and comment text (gocritic)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
ethergo/submitter/submitter.go
(5 hunks)services/rfq/relayer/chain/chain.go
(2 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
428-428: commentFormatting: put a space between //
and comment text
(gocritic)
434-434: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 426-426: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 445-445: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 431-431: G115: integer overflow conversion uint64 -> int
(gosec)
[warning] 437-437: var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate
(revive)
[warning] 439-439: var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate
(revive)
432-432: unnecessary leading newline
(whitespace)
452-452: unnecessary trailing newline
(whitespace)
756-756: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
services/rfq/relayer/chain/chain.go
77-77: commentFormatting: put a space between //
and comment text
(gocritic)
92-92: commentFormatting: put a space between //
and comment text
(gocritic)
98-98: commentFormatting: put a space between //
and comment text
(gocritic)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 428-428:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 434-434:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 445-445:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 431-431:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 437-437:
var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate (revive)
[failure] 439-439:
var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)
[failure] 756-756:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 433-443: ethergo/submitter/submitter.go#L433-L443
Added lines #L433 - L443 were not covered by tests
[warning] 445-448: ethergo/submitter/submitter.go#L445-L448
Added lines #L445 - L448 were not covered by tests
[warning] 450-450: ethergo/submitter/submitter.go#L450
Added line #L450 was not covered by tests
[warning] 460-460: ethergo/submitter/submitter.go#L460
Added line #L460 was not covered by tests
[warning] 720-721: ethergo/submitter/submitter.go#L720-L721
Added lines #L720 - L721 were not covered by tests
[warning] 726-727: ethergo/submitter/submitter.go#L726-L727
Added lines #L726 - L727 were not covered by tests
[warning] 730-730: ethergo/submitter/submitter.go#L730
Added line #L730 was not covered by tests
[warning] 732-733: ethergo/submitter/submitter.go#L732-L733
Added lines #L732 - L733 were not covered by tests
[warning] 756-757: ethergo/submitter/submitter.go#L756-L757
Added lines #L756 - L757 were not covered by tests
🪛 GitHub Check: Lint (services/rfq)
services/rfq/relayer/chain/chain.go
[failure] 77-77:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 92-92:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 98-98:
commentFormatting: put a space between //
and comment text (gocritic)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
ethergo/submitter/submitter.go (3)
755-757
: 🛠️ Refactor suggestion
⚠️ Potential issueAdd overflow protection and improve code style.
The gas estimate percentage calculation needs overflow protection and style improvements.
Apply this diff to fix the issues:
- // Modify the gasEstimate by the configured percentage - gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) + // Calculate gas estimate increase with overflow protection + if gasUnitAddPercentage > 0 { + increase := new(big.Int).Mul( + new(big.Int).SetUint64(gasEstimate), + big.NewInt(int64(gasUnitAddPercentage))) + increase.Div(increase, big.NewInt(100)) + if !increase.IsUint64() { + return 0, fmt.Errorf("gas estimate increase exceeds uint64 max value") + } + gasEstimate += increase.Uint64() + }Likely invalid or redundant comment.
🧰 Tools
🪛 golangci-lint (1.62.2)
756-756: assignOp: replace
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
[warning] 756-757: ethergo/submitter/submitter.go#L756-L757
Added lines #L756 - L757 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 756-756:
assignOp: replacegasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
720-727
: Add test coverage for dynamic gas unit percentage feature.The new dynamic gas unit percentage feature lacks test coverage. This is critical functionality that should be thoroughly tested.
Please add tests to cover:
- Dynamic gas estimation disabled case
- Different gas unit percentage values
- Edge cases (0%, 100%, etc.)
Run this script to verify the current test coverage:
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 720-721: ethergo/submitter/submitter.go#L720-L721
Added lines #L720 - L721 were not covered by tests
[warning] 726-727: ethergo/submitter/submitter.go#L726-L727
Added lines #L726 - L727 were not covered by tests
433-449
: 🛠️ Refactor suggestionFix naming conventions and improve logging.
The code has several issues:
- Variable names use underscores which violates Go naming conventions
- Debug print should use structured logging
- Critical gas estimation logic lacks test coverage
Apply this diff to fix the style issues:
- //tmpdebug - fmt.Printf("SubmitTransaction>forGasEst call ") - - transactor_forGasEstimate := copyTransactOpts(transactor) - - tx_forGasEstimate, err := call(transactor_forGasEstimate) + logger.Debug("estimating gas for transaction") + transactorForGasEstimate := copyTransactOpts(transactor) + txForGasEstimate, err := call(transactorForGasEstimate)Run this script to verify test coverage:
🧰 Tools
🪛 golangci-lint (1.62.2)
434-434: commentFormatting: put a space between
//
and comment text(gocritic)
[high] 445-445: G115: integer overflow conversion uint64 -> int
(gosec)
[warning] 437-437: var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate
(revive)
[warning] 439-439: var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate
(revive)
🪛 GitHub Check: codecov/patch
[warning] 433-443: ethergo/submitter/submitter.go#L433-L443
Added lines #L433 - L443 were not covered by tests
[warning] 445-448: ethergo/submitter/submitter.go#L445-L448
Added lines #L445 - L448 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 434-434:
commentFormatting: put a space between//
and comment text (gocritic)
[failure] 445-445:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 437-437:
var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate (revive)
[failure] 439-439:
var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)
//tmpdebug | ||
fmt.Println("SubmitRelay>start: ", request.OriginTxHash) |
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.
🛠️ Refactor suggestion
Replace debug print with structured logging.
Replace temporary debug print with proper logging using the existing logger
instance.
Apply this diff to improve the code:
- //tmpdebug
- fmt.Println("SubmitRelay>start: ", request.OriginTxHash)
+ logger.Debugw("starting relay submission",
+ "origin_tx_hash", request.OriginTxHash)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
//tmpdebug | |
fmt.Println("SubmitRelay>start: ", request.OriginTxHash) | |
logger.Debugw("starting relay submission", | |
"origin_tx_hash", request.OriginTxHash) |
🧰 Tools
🪛 golangci-lint (1.62.2)
77-77: commentFormatting: put a space between //
and comment text
(gocritic)
🪛 GitHub Check: Lint (services/rfq)
[failure] 77-77:
commentFormatting: put a space between //
and comment text (gocritic)
ethergo/submitter/submitter.go
Outdated
// if dynamic gas estimation is not enabled, use cfg var gas_estimate as a gas limit default and do not run a pre-flight simulation | ||
// since we do not need it to determine proper gas units | ||
if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) { | ||
|
||
//tmpdebug | ||
fmt.Printf("Using Default ") | ||
|
||
transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64())) | ||
} else { |
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.
🛠️ Refactor suggestion
Fix integer overflow risk and improve code style.
The code has several issues:
- Potential integer overflow in chainID conversion
- Debug print should use structured logging
- Unnecessary newlines
Apply this diff to fix the issues:
+ chainIDInt := chainID.Int64()
+ if chainIDInt > math.MaxInt32 {
+ return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt)
+ }
- if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) {
-
- //tmpdebug
- fmt.Printf("Using Default ")
-
- transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64()))
+ if !t.config.GetDynamicGasEstimate(int(chainIDInt)) {
+ logger.Debugw("using default gas estimate",
+ "chain_id", chainIDInt,
+ "gas_limit", t.config.GetGasEstimate(int(chainIDInt)))
+ transactor.GasLimit = t.config.GetGasEstimate(int(chainIDInt))
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// if dynamic gas estimation is not enabled, use cfg var gas_estimate as a gas limit default and do not run a pre-flight simulation | |
// since we do not need it to determine proper gas units | |
if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) { | |
//tmpdebug | |
fmt.Printf("Using Default ") | |
transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64())) | |
} else { | |
// if dynamic gas estimation is not enabled, use cfg var gas_estimate as a gas limit default and do not run a pre-flight simulation | |
// since we do not need it to determine proper gas units | |
chainIDInt := chainID.Int64() | |
if chainIDInt > math.MaxInt32 { | |
return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt) | |
} | |
if !t.config.GetDynamicGasEstimate(int(chainIDInt)) { | |
logger.Debugw("using default gas estimate", | |
"chain_id", chainIDInt, | |
"gas_limit", t.config.GetGasEstimate(int(chainIDInt))) | |
transactor.GasLimit = t.config.GetGasEstimate(int(chainIDInt)) | |
} else { |
🧰 Tools
🪛 golangci-lint (1.62.2)
428-428: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 426-426: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 431-431: G115: integer overflow conversion uint64 -> int
(gosec)
432-432: unnecessary leading newline
(whitespace)
🪛 GitHub Check: Lint (ethergo)
[failure] 428-428:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 426-426:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 431-431:
G115: integer overflow conversion uint64 -> int (gosec)
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.
Actionable comments posted: 1
♻️ Duplicate comments (3)
ethergo/submitter/submitter.go (3)
391-392
: 🛠️ Refactor suggestionReplace debug prints with structured logging.
Replace temporary debug print statements with structured logging using the existing
logger
instance.Apply this diff to use structured logging:
- //tmpdebug - fmt.Printf("SubmitTransaction>setGasPrice\n") + logger.Debug("submitting transaction: setting gas price") - //tmpdebug - fmt.Printf("test ver 1\n") + logger.Debug("starting transaction submission") - //tmpdebug - fmt.Printf("Using Default \n") + logger.Debug("using default gas estimate") - //tmpdebug - fmt.Printf("SubmitTransaction>forGasEst call \n") + logger.Debug("estimating gas for transaction") - //tmpdebug - fmt.Printf("transactor.GasLimit: %d\n", transactor.GasLimit) + logger.Debugf("gas limit set to: %d", transactor.GasLimit) - //tmpdebug - fmt.Printf("SubmitTransaction>storeTX\n") + logger.Debug("storing transaction") - //tmpdebug - fmt.Printf("SubmitTransaction>tx.Nonce: %d\n", tx.Nonce()) + logger.Debugf("transaction nonce: %d", tx.Nonce())Also applies to: 425-426, 432-433, 438-439, 460-461, 470-471, 482-483
🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 391-391:
commentFormatting: put a space between//
and comment text (gocritic)🪛 golangci-lint (1.62.2)
391-391: commentFormatting: put a space between
//
and comment text(gocritic)
441-443
: 🛠️ Refactor suggestionFollow Go naming conventions.
Variable names use underscores which is against Go naming conventions.
Apply this diff to fix variable names:
- transactor_forGasEstimate := copyTransactOpts(transactor) - tx_forGasEstimate, err := call(transactor_forGasEstimate) + transactorForGasEstimate := copyTransactOpts(transactor) + txForGasEstimate, err := call(transactorForGasEstimate)🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 441-441:
var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate (revive)
[failure] 443-443:
var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)🪛 golangci-lint (1.62.2)
[warning] 441-441: var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate
(revive)
[warning] 443-443: var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate
(revive)
430-435
:⚠️ Potential issuePrevent integer overflow in chain ID conversion.
Converting
chainID.Uint64()
toint
could overflow on 32-bit systems.Apply this diff to prevent overflow:
+ chainIDInt := chainID.Int64() + if chainIDInt > math.MaxInt32 { + return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt) + } - if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) { - transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64())) + if !t.config.GetDynamicGasEstimate(int(chainIDInt)) { + transactor.GasLimit = t.config.GetGasEstimate(int(chainIDInt))🧰 Tools
🪛 GitHub Check: Lint (ethergo)
[failure] 432-432:
commentFormatting: put a space between//
and comment text (gocritic)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 435-435:
G115: integer overflow conversion uint64 -> int (gosec)🪛 golangci-lint (1.62.2)
432-432: commentFormatting: put a space between
//
and comment text(gocritic)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 435-435: G115: integer overflow conversion uint64 -> int
(gosec)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ethergo/submitter/submitter.go
(5 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 425-425:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 432-432:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 435-435:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 441-441:
var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate (revive)
[failure] 443-443:
var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)
[failure] 436-436:
unnecessary leading newline (whitespace)
[failure] 762-762:
assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
425-425: commentFormatting: put a space between //
and comment text
(gocritic)
432-432: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 435-435: G115: integer overflow conversion uint64 -> int
(gosec)
[warning] 441-441: var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate
(revive)
[warning] 443-443: var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate
(revive)
436-436: unnecessary leading newline
(whitespace)
458-458: unnecessary trailing newline
(whitespace)
762-762: assignOp: replace gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
with gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 437-438: ethergo/submitter/submitter.go#L437-L438
Added lines #L437 - L438 were not covered by tests
[warning] 440-444: ethergo/submitter/submitter.go#L440-L444
Added lines #L440 - L444 were not covered by tests
[warning] 447-449: ethergo/submitter/submitter.go#L447-L449
Added lines #L447 - L449 were not covered by tests
[warning] 466-466: ethergo/submitter/submitter.go#L466
Added line #L466 was not covered by tests
[warning] 726-727: ethergo/submitter/submitter.go#L726-L727
Added lines #L726 - L727 were not covered by tests
[warning] 732-733: ethergo/submitter/submitter.go#L732-L733
Added lines #L732 - L733 were not covered by tests
[warning] 736-736: ethergo/submitter/submitter.go#L736
Added line #L736 was not covered by tests
[warning] 738-739: ethergo/submitter/submitter.go#L738-L739
Added lines #L738 - L739 were not covered by tests
[warning] 762-763: ethergo/submitter/submitter.go#L762-L763
Added lines #L762 - L763 were not covered by tests
🔇 Additional comments (2)
ethergo/submitter/submitter.go (2)
Line range hint
726-763
: Add test coverage for dynamic gas estimation.The new gas estimation logic, including the dynamic gas unit percentage feature, lacks test coverage.
Key areas requiring tests:
- Dynamic gas estimation toggle
- Gas unit percentage adjustment
- Error handling and fallback logic
Run this script to verify test coverage:
#!/bin/bash # Check test coverage for the new gas estimation logic go test -coverprofile=coverage.out ./ethergo/submitter/ go tool cover -func=coverage.out | grep -A 2 "getGasEstimate"🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 726-727: ethergo/submitter/submitter.go#L726-L727
Added lines #L726 - L727 were not covered by tests
[warning] 732-733: ethergo/submitter/submitter.go#L732-L733
Added lines #L732 - L733 were not covered by tests
[warning] 736-736: ethergo/submitter/submitter.go#L736
Added line #L736 was not covered by tests
[warning] 738-739: ethergo/submitter/submitter.go#L738-L739
Added lines #L738 - L739 were not covered by tests
761-763
: 🛠️ Refactor suggestionPrevent gas estimate overflow.
The gas estimate calculation could overflow when adding the percentage increase.
Apply this diff to prevent overflow:
- gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) + increase := new(big.Int).SetUint64(gasEstimate) + increase.Mul(increase, big.NewInt(int64(gasUnitAddPercentage))) + increase.Div(increase, big.NewInt(100)) + if !increase.IsUint64() { + return 0, fmt.Errorf("gas estimate increase exceeds uint64 max value") + } + gasEstimate += increase.Uint64()Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 762-763: ethergo/submitter/submitter.go#L762-L763
Added lines #L762 - L763 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 762-762:
assignOp: replacegasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)🪛 golangci-lint (1.62.2)
762-762: assignOp: replace
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)
withgasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)
(gocritic)
ethergo/submitter/submitter.go
Outdated
// gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate) | ||
// if err != nil { | ||
// return 0, fmt.Errorf("err getGasEstimate: %w", err) | ||
// } | ||
|
||
transactor.GasLimit = 1405050 | ||
|
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.
Restore gas estimation logic and remove hard-coded gas limit.
The gas estimation logic is commented out and replaced with a hard-coded value. This is dangerous as it:
- Bypasses dynamic gas estimation
- May lead to transaction failures if the actual required gas is higher
- Wastes gas if the actual required gas is lower
Apply this diff to restore the gas estimation logic:
- // gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate)
- // if err != nil {
- // return 0, fmt.Errorf("err getGasEstimate: %w", err)
- // }
-
- transactor.GasLimit = 1405050
+ gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate)
+ if err != nil {
+ return 0, fmt.Errorf("err getGasEstimate: %w", err)
+ }
+ transactor.GasLimit = gasEstimate
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate) | |
// if err != nil { | |
// return 0, fmt.Errorf("err getGasEstimate: %w", err) | |
// } | |
transactor.GasLimit = 1405050 | |
gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainIDInt), txForEstimate) | |
if err != nil { | |
return 0, fmt.Errorf("err getGasEstimate: %w", err) | |
} | |
transactor.GasLimit = gasEstimate |
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.
Actionable comments posted: 1
♻️ Duplicate comments (2)
ethergo/submitter/submitter.go (2)
767-769
:⚠️ Potential issuePrevent integer overflow in gas calculation.
The gas estimate calculation could overflow when adding the percentage increase.
Use
big.Int
for safe calculations:- gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100) + if gasUnitAddPercentage > 0 { + increase := new(big.Int).Mul(new(big.Int).SetUint64(gasEstimate), big.NewInt(int64(gasUnitAddPercentage))) + increase.Div(increase, big.NewInt(100)) + if increase.IsUint64() { + gasEstimate += increase.Uint64() + } else { + return 0, fmt.Errorf("gas estimate increase exceeds uint64 max value") + } + }
430-430
:⚠️ Potential issuePrevent integer overflow in chainID conversions.
Multiple unsafe conversions of chainID from uint64 to int could overflow on 32-bit systems.
Add overflow protection:
+ chainIDInt := chainID.Int64() + if chainIDInt > math.MaxInt32 { + return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt) + } - if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) { + if !t.config.GetDynamicGasEstimate(int(chainIDInt)) {Also applies to: 738-738
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ethergo/submitter/submitter.go
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (29)
- GitHub Check: Go Coverage (1.22.x, tools)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Generate (Module Changes) (tools)
- GitHub Check: Go Coverage (1.22.x, services/rfq)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Coverage (1.22.x, services/omnirpc)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Generate (Module Changes) (services/omnirpc)
- GitHub Check: Go Coverage (1.22.x, services/cctp-relayer)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Coverage (1.22.x, ethergo)
- GitHub Check: Go Generate (Module Changes) (services/cctp-relayer)
- GitHub Check: Go Coverage (1.22.x, contrib/promexporter)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Coverage (1.22.x, contrib/opbot)
- GitHub Check: Go Generate (Module Changes) (contrib/opbot)
- GitHub Check: Lint (services/rfq)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Lint (ethergo)
- GitHub Check: Build (1.22.x)
- GitHub Check: Deploy to Vercel (docs)
- GitHub Check: run-goreleaser (services/rfq)
- GitHub Check: run-goreleaser (services/omnirpc)
- GitHub Check: run-goreleaser (services/cctp-relayer)
- GitHub Check: run-goreleaser (contrib/opbot)
- GitHub Check: run-goreleaser (agents)
- GitHub Check: SonarCloud
🔇 Additional comments (1)
ethergo/submitter/submitter.go (1)
391-392
: Replace debug prints with structured logging.Multiple debug print statements should be replaced with proper structured logging using the existing
logger
instance.Also applies to: 425-426, 432-433, 460-461, 465-466, 473-474, 485-486, 735-736
ethergo/submitter/submitter.go
Outdated
// // //tmpdebug | ||
// // fmt.Printf("SubmitTransaction>forGasEst call \n") | ||
|
||
// // transactor_forGasEstimate := copyTransactOpts(transactor) | ||
|
||
// // tx_forGasEstimate, err := call(transactor_forGasEstimate) | ||
|
||
// // fmt.Printf("tx_forGasEstimate: %v\n", tx_forGasEstimate) | ||
|
||
// // if err != nil { | ||
// // return 0, fmt.Errorf("err contract call for gas est: %w", err) | ||
// // } | ||
|
||
// gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate) | ||
// if err != nil { | ||
// return 0, fmt.Errorf("err getGasEstimate: %w", err) | ||
// } | ||
|
||
transactor.GasLimit = 0 | ||
|
||
} |
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.
Critical: Restore gas estimation logic.
The gas estimation logic is commented out and replaced with a hardcoded value of 0. This is dangerous because:
- Setting gas limit to 0 will likely cause transaction failures
- Dynamic gas estimation is disabled without proper fallback
- The commented code suggests this might be temporary
Uncomment and restore the gas estimation logic:
- // // //tmpdebug
- // // fmt.Printf("SubmitTransaction>forGasEst call \n")
-
- // // transactor_forGasEstimate := copyTransactOpts(transactor)
-
- // // tx_forGasEstimate, err := call(transactor_forGasEstimate)
-
- // // fmt.Printf("tx_forGasEstimate: %v\n", tx_forGasEstimate)
-
- // // if err != nil {
- // // return 0, fmt.Errorf("err contract call for gas est: %w", err)
- // // }
-
- // gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate)
- // if err != nil {
- // return 0, fmt.Errorf("err getGasEstimate: %w", err)
- // }
-
- transactor.GasLimit = 0
+ transactorForGasEstimate := copyTransactOpts(transactor)
+ txForGasEstimate, err := call(transactorForGasEstimate)
+ if err != nil {
+ return 0, fmt.Errorf("err contract call for gas est: %w", err)
+ }
+
+ gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), txForGasEstimate)
+ if err != nil {
+ return 0, fmt.Errorf("err getGasEstimate: %w", err)
+ }
+ transactor.GasLimit = gasEstimate
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// // //tmpdebug | |
// // fmt.Printf("SubmitTransaction>forGasEst call \n") | |
// // transactor_forGasEstimate := copyTransactOpts(transactor) | |
// // tx_forGasEstimate, err := call(transactor_forGasEstimate) | |
// // fmt.Printf("tx_forGasEstimate: %v\n", tx_forGasEstimate) | |
// // if err != nil { | |
// // return 0, fmt.Errorf("err contract call for gas est: %w", err) | |
// // } | |
// gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate) | |
// if err != nil { | |
// return 0, fmt.Errorf("err getGasEstimate: %w", err) | |
// } | |
transactor.GasLimit = 0 | |
} | |
transactorForGasEstimate := copyTransactOpts(transactor) | |
txForGasEstimate, err := call(transactorForGasEstimate) | |
if err != nil { | |
return 0, fmt.Errorf("err contract call for gas est: %w", err) | |
} | |
gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), txForGasEstimate) | |
if err != nil { | |
return 0, fmt.Errorf("err getGasEstimate: %w", err) | |
} | |
transactor.GasLimit = gasEstimate | |
} |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
ethergo/submitter/submitter.go (1)
453-456
: Remove or document commented code.Large blocks of commented code should either be:
- Removed if they are no longer needed
- Documented if they represent alternative implementations that might be needed later
Also applies to: 470-486
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ethergo/submitter/submitter.go
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (32)
- GitHub Check: Go Coverage (1.22.x, tools)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Coverage (1.22.x, services/rfq)
- GitHub Check: Go Coverage (1.22.x, services/omnirpc)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Coverage (1.22.x, services/cctp-relayer)
- GitHub Check: Go Coverage (1.22.x, ethergo)
- GitHub Check: Go Coverage (1.22.x, contrib/promexporter)
- GitHub Check: Go Coverage (1.22.x, contrib/opbot)
- GitHub Check: Go Generate (Module Changes) (tools)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Lint (services/rfq)
- GitHub Check: Go Generate (Module Changes) (services/omnirpc)
- GitHub Check: Lint (ethergo)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Build (1.22.x)
- GitHub Check: Go Generate (Module Changes) (services/cctp-relayer)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Generate (Module Changes) (contrib/opbot)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: run-goreleaser (services/scribe)
- GitHub Check: run-goreleaser (services/rfq)
- GitHub Check: run-goreleaser (services/omnirpc)
- GitHub Check: run-goreleaser (services/explorer)
- GitHub Check: run-goreleaser (services/cctp-relayer)
- GitHub Check: run-goreleaser (ethergo)
- GitHub Check: run-goreleaser (contrib/opbot)
- GitHub Check: run-goreleaser (agents)
- GitHub Check: Deploy to Vercel (docs)
- GitHub Check: SonarCloud
🔇 Additional comments (3)
ethergo/submitter/submitter.go (3)
391-392
: Replace debug prints with structured logging.Multiple debug print statements should be replaced with proper structured logging using the existing
logger
instance.Also applies to: 425-426, 432-433, 438-439, 462-463, 472-473, 476-477, 484-485, 488-489, 493-494, 505-506, 755-756
430-430
: Fix potential integer overflow and naming convention issues.
- The chainID conversion from uint64 to int could overflow on 32-bit systems.
- Variable names use underscores which is against Go naming conventions.
Also applies to: 435-435, 441-444
787-789
: Prevent potential overflow in gas estimate calculation.The gas estimate percentage calculation could overflow for large values. Use
big.Int
for safer arithmetic operations.
ethergo/submitter/submitter.go
Outdated
// return 0, fmt.Errorf("err getGasEstimate: %w", err) | ||
// } | ||
|
||
transactor.GasLimit = tx_forGasEstimate.Gas() + 555 |
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.
🛠️ Refactor suggestion
Remove magic number and document gas buffer.
The hard-coded value of 555 is added to the gas estimate without explanation. This magic number should be:
- Moved to a named constant with a clear purpose
- Made configurable if it represents a buffer percentage
- Documented to explain its significance
- transactor.GasLimit = tx_forGasEstimate.Gas() + 555
+ const gasBuffer = 555 // TODO: Document why this specific value is used
+ transactor.GasLimit = tx_forGasEstimate.Gas() + gasBuffer
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
transactor.GasLimit = tx_forGasEstimate.Gas() + 555 | |
const gasBuffer = 555 // TODO: Document why this specific value is used | |
transactor.GasLimit = tx_forGasEstimate.Gas() + gasBuffer |
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.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
ethergo/submitter/submitter.go (1)
Fix gas calculation overflow risk and follow consistent naming
The review identified two valid concerns:
- The gas limit calculation
gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
is susceptible to overflow since it uses uint64 arithmetic without checks- Variable names with underscores don't follow the codebase's utility code convention of using camelCase
The suggestion to use big.Int is appropriate as it matches the pattern seen in other gas-related calculations throughout the codebase.
🔗 Analysis chain
Line range hint
730-791
: Fix variable naming and add overflow protection.The gas estimation function has several issues:
- Variable names use underscores against Go conventions
- Potential integer overflow in gas limit calculations
- Missing test coverage for critical functionality
Apply this diff to fix the issues:
-func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimit_new uint64, err error) { +func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimitNew uint64, err error) { - gasLimit_fromPrior := tx.Gas() - gasLimit_fromEstimate, err := chainClient.EstimateGas(ctx, *call) + gasLimitFromPrior := tx.Gas() + gasLimitFromEstimate, err := chainClient.EstimateGas(ctx, *call) - gasLimit_new = max(gasLimit_fromPrior, gasLimit_fromEstimate) + gasLimitNew = max(gasLimitFromPrior, gasLimitFromEstimate) - gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100) + // Protect against overflow in gas limit calculation + increase := new(big.Int).SetUint64(gasLimitNew) + increase.Mul(increase, big.NewInt(int64(gasUnitAddPercentage))) + increase.Div(increase, big.NewInt(100)) + if !increase.IsUint64() { + return 0, fmt.Errorf("gas limit increase exceeds uint64 max value") + } + gasLimitNew += increase.Uint64()Run this script to verify test coverage:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check test coverage for gas estimation go test -coverprofile=coverage.out ./ethergo/submitter/ go tool cover -func=coverage.out | grep getGasEstimateLength of output: 12924
Script:
#!/bin/bash # Check variable naming patterns and gas calculations echo "=== Variable naming patterns ===" rg "gasLimit[A-Z]" --type go echo -e "\n=== Gas calculation patterns ===" rg "gas.*\*.*\/\s*100" --type go -A 2 -B 2 echo -e "\n=== Gas estimation function implementations ===" ast-grep --pattern 'func $$$getGasEstimate$$$'Length of output: 968
Script:
#!/bin/bash # Search with corrected patterns echo "=== Gas calculations ===" rg "gasLimit.*\+" --type go -A 2 -B 2 echo -e "\n=== Big.Int usage in gas calculations ===" rg "big\.Int.*gas" --type go -A 2 -B 2 echo -e "\n=== Gas estimation implementations ===" rg "func.*getGasEstimate" --type go -A 5Length of output: 124755
🧰 Tools
🪛 golangci-lint (1.62.2)
784-784: assignOp: replace
gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
withgasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[high] 786-786: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 787-787: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 788-788: G115: integer overflow conversion uint64 -> int64
(gosec)
[warning] 765-765: var-naming: don't use underscores in Go names; var gasLimit_fromPrior should be gasLimitFromPrior
(revive)
[warning] 767-767: var-naming: don't use underscores in Go names; var gasLimit_fromEstimate should be gasLimitFromEstimate
(revive)
🪛 GitHub Check: codecov/patch
[warning] 771-772: ethergo/submitter/submitter.go#L771-L772
Added lines #L771 - L772 were not covered by tests
[warning] 774-775: ethergo/submitter/submitter.go#L774-L775
Added lines #L774 - L775 were not covered by tests
[warning] 782-782: ethergo/submitter/submitter.go#L782
Added line #L782 was not covered by tests
[warning] 790-790: ethergo/submitter/submitter.go#L790
Added line #L790 was not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 784-784:
assignOp: replacegasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
withgasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[failure] 786-786:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 787-787:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 788-788:
G115: integer overflow conversion uint64 -> int64 (gosec)
♻️ Duplicate comments (3)
ethergo/submitter/submitter.go (3)
391-392
: 🛠️ Refactor suggestionReplace debug prints with structured logging.
Replace temporary debug print statements with structured logging using the existing
logger
instance for better observability and consistency.Apply this diff to improve logging:
- //tmpdebug - fmt.Printf("SubmitTransaction>setGasPrice\n") + logger.Debug("submitting transaction: setting gas price") - //tmpdebug - fmt.Printf("test ver 7\n") + logger.Debug("submitting transaction: version 7") - //tmpdebug - fmt.Printf("Using Default \n") + logger.Debug("using default gas estimate") - //tmpdebug - fmt.Printf("transactor.GasLimit: %d\n", transactor.GasLimit) + logger.Debugw("gas limit set", "limit", transactor.GasLimit) - //tmpdebug - fmt.Printf("tx.Gas: %d\n", tx.Gas()) + logger.Debugw("transaction gas", "gas", tx.Gas()) - //tmpdebug - fmt.Printf("SubmitTransaction>storeTX\n") + logger.Debug("submitting transaction: storing tx") - //tmpdebug - fmt.Printf("SubmitTransaction>tx.Nonce: %d\n", tx.Nonce()) + logger.Debugw("transaction nonce", "nonce", tx.Nonce()) - //tmpdebug - fmt.Println("getGasEstimate>start") + logger.Debug("starting gas estimation") - //tmpdebug - fmt.Println("getGasEstimate>gasUnitAddPercentage", gasUnitAddPercentage) + logger.Debugw("gas unit add percentage", "percentage", gasUnitAddPercentage) - //tmpdebug - fmt.Printf("getGasEstimate> Error estimating gas: %v\n", err) + logger.Errorw("failed to estimate gas", "error", err)Also applies to: 425-426, 432-433, 462-463, 470-471, 475-476, 487-488, 737-738, 742-743, 771-772
🧰 Tools
🪛 golangci-lint (1.62.2)
391-391: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 391-391:
commentFormatting: put a space between//
and comment text (gocritic)
438-449
:⚠️ Potential issueRestore gas estimation logic.
The gas estimation logic is commented out, which is critical for proper transaction handling. This code should either be restored or safely removed if it's no longer needed.
Uncomment and restore the gas estimation logic if it's still needed:
- // //tmpdebug - // fmt.Printf("SubmitTransaction>forGasEst call \n") - - // transactor_forGasEstimate := copyTransactOpts(transactor) - - // transactor_forGasEstimate.Nonce.Add(transactor_forGasEstimate.Nonce, big.NewInt(1)) - - // tx_forGasEstimate, err := call(transactor_forGasEstimate) - // if err != nil { - // return 0, fmt.Errorf("err contract call for gas est: %w", err) - // } + transactorForGasEstimate := copyTransactOpts(transactor) + txForGasEstimate, err := call(transactorForGasEstimate) + if err != nil { + return 0, fmt.Errorf("err contract call for gas est: %w", err) + }🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 440-440: ethergo/submitter/submitter.go#L440
Added line #L440 was not covered by tests
[warning] 442-442: ethergo/submitter/submitter.go#L442
Added line #L442 was not covered by tests
[warning] 444-444: ethergo/submitter/submitter.go#L444
Added line #L444 was not covered by tests
430-430
:⚠️ Potential issuePrevent potential integer overflow in chain ID conversion.
The conversion of
chainID.Uint64()
toint
could overflow on 32-bit systems.Apply this diff to fix the issue:
+ chainIDInt := chainID.Int64() + if chainIDInt > math.MaxInt32 { + return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt) + } - if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) { + if !t.config.GetDynamicGasEstimate(int(chainIDInt)) { - transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64())) + transactor.GasLimit = t.config.GetGasEstimate(int(chainIDInt))Also applies to: 435-435
🧰 Tools
🪛 golangci-lint (1.62.2)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
🪛 GitHub Check: Lint (ethergo)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ethergo/submitter/submitter.go
(5 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
425-425: commentFormatting: put a space between //
and comment text
(gocritic)
432-432: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 435-435: G115: integer overflow conversion uint64 -> int
(gosec)
436-436: unnecessary leading newline
(whitespace)
[warning] 730-730: var-naming: don't use underscores in Go names; method result gasLimit_new should be gasLimitNew
(revive)
784-784: assignOp: replace gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
with gasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[high] 786-786: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 787-787: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 788-788: G115: integer overflow conversion uint64 -> int64
(gosec)
[warning] 765-765: var-naming: don't use underscores in Go names; var gasLimit_fromPrior should be gasLimitFromPrior
(revive)
[warning] 767-767: var-naming: don't use underscores in Go names; var gasLimit_fromEstimate should be gasLimitFromEstimate
(revive)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 425-425:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 432-432:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 435-435:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 784-784:
assignOp: replace gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
with gasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[failure] 786-786:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 787-787:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 788-788:
G115: integer overflow conversion uint64 -> int64 (gosec)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 437-437: ethergo/submitter/submitter.go#L437
Added line #L437 was not covered by tests
[warning] 440-440: ethergo/submitter/submitter.go#L440
Added line #L440 was not covered by tests
[warning] 442-442: ethergo/submitter/submitter.go#L442
Added line #L442 was not covered by tests
[warning] 444-444: ethergo/submitter/submitter.go#L444
Added line #L444 was not covered by tests
[warning] 451-451: ethergo/submitter/submitter.go#L451
Added line #L451 was not covered by tests
[warning] 467-467: ethergo/submitter/submitter.go#L467
Added line #L467 was not covered by tests
[warning] 731-732: ethergo/submitter/submitter.go#L731-L732
Added lines #L731 - L732 were not covered by tests
[warning] 738-744: ethergo/submitter/submitter.go#L738-L744
Added lines #L738 - L744 were not covered by tests
[warning] 747-747: ethergo/submitter/submitter.go#L747
Added line #L747 was not covered by tests
[warning] 749-750: ethergo/submitter/submitter.go#L749-L750
Added lines #L749 - L750 were not covered by tests
[warning] 771-772: ethergo/submitter/submitter.go#L771-L772
Added lines #L771 - L772 were not covered by tests
[warning] 774-775: ethergo/submitter/submitter.go#L774-L775
Added lines #L774 - L775 were not covered by tests
[warning] 782-782: ethergo/submitter/submitter.go#L782
Added line #L782 was not covered by tests
[warning] 790-790: ethergo/submitter/submitter.go#L790
Added line #L790 was not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (16)
- GitHub Check: Go Generate (Module Changes) (tools)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Generate (Module Changes) (services/omnirpc)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Generate (Module Changes) (services/cctp-relayer)
- GitHub Check: Go Coverage (1.22.x, ethergo)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Generate (Module Changes) (contrib/opbot)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Build (1.22.x)
- GitHub Check: Deploy to Vercel (docs)
- GitHub Check: Cloudflare Pages
ethergo/submitter/submitter.go
Outdated
// spoof some low gas units to induce bump tests | ||
if chainID.Uint64() == 10 { | ||
transactor.GasLimit = 25000 | ||
} else if chainID.Uint64() == 42161 { | ||
transactor.GasLimit = 150000 | ||
} | ||
} |
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.
Remove hardcoded gas limits used for testing.
The code contains hardcoded gas limits for specific chain IDs (10 and 42161) with the comment "spoof some low gas units to induce bump tests". This is dangerous in production as:
- Low gas limits can cause transaction failures
- Different transactions require different gas limits
- Gas requirements can change over time
Either:
- Remove the hardcoded values and use proper gas estimation, or
- Move this testing logic behind a configuration flag
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ethergo/submitter/submitter.go
(5 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
425-425: commentFormatting: put a space between //
and comment text
(gocritic)
432-432: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 435-435: G115: integer overflow conversion uint64 -> int
(gosec)
436-436: unnecessary leading newline
(whitespace)
[warning] 730-730: var-naming: don't use underscores in Go names; method result gasLimit_new should be gasLimitNew
(revive)
784-784: assignOp: replace gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
with gasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[high] 786-786: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 787-787: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 788-788: G115: integer overflow conversion uint64 -> int64
(gosec)
[warning] 765-765: var-naming: don't use underscores in Go names; var gasLimit_fromPrior should be gasLimitFromPrior
(revive)
[warning] 767-767: var-naming: don't use underscores in Go names; var gasLimit_fromEstimate should be gasLimitFromEstimate
(revive)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 425-425:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 432-432:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 435-435:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 784-784:
assignOp: replace gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
with gasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[failure] 786-786:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 787-787:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 788-788:
G115: integer overflow conversion uint64 -> int64 (gosec)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 437-453: ethergo/submitter/submitter.go#L437-L453
Added lines #L437 - L453 were not covered by tests
[warning] 455-455: ethergo/submitter/submitter.go#L455
Added line #L455 was not covered by tests
[warning] 457-457: ethergo/submitter/submitter.go#L457
Added line #L457 was not covered by tests
[warning] 459-459: ethergo/submitter/submitter.go#L459
Added line #L459 was not covered by tests
[warning] 467-467: ethergo/submitter/submitter.go#L467
Added line #L467 was not covered by tests
[warning] 730-732: ethergo/submitter/submitter.go#L730-L732
Added lines #L730 - L732 were not covered by tests
[warning] 738-744: ethergo/submitter/submitter.go#L738-L744
Added lines #L738 - L744 were not covered by tests
[warning] 747-747: ethergo/submitter/submitter.go#L747
Added line #L747 was not covered by tests
[warning] 749-750: ethergo/submitter/submitter.go#L749-L750
Added lines #L749 - L750 were not covered by tests
[warning] 754-754: ethergo/submitter/submitter.go#L754
Added line #L754 was not covered by tests
[warning] 765-768: ethergo/submitter/submitter.go#L765-L768
Added lines #L765 - L768 were not covered by tests
[warning] 771-772: ethergo/submitter/submitter.go#L771-L772
Added lines #L771 - L772 were not covered by tests
[warning] 774-777: ethergo/submitter/submitter.go#L774-L777
Added lines #L774 - L777 were not covered by tests
[warning] 781-791: ethergo/submitter/submitter.go#L781-L791
Added lines #L781 - L791 were not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Coverage (1.22.x, contrib/opbot)
- GitHub Check: Go Generate (Module Changes) (services/omnirpc)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/opbot)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Deploy to Vercel (docs)
🔇 Additional comments (5)
ethergo/submitter/submitter.go (5)
391-392
: Replace debug prints with structured logging.Replace temporary debug print statements with structured logging using the existing
logger
instance.Apply this diff to improve logging:
- //tmpdebug - fmt.Printf("SubmitTransaction>setGasPrice\n") + logger.Debug("submitting transaction: setting gas price") - //tmpdebug - fmt.Printf("test ver 7\n") + logger.Debug("processing transaction v7") - //tmpdebug - fmt.Printf("Using Default \n") + logger.Debug("using default gas estimate") - //tmpdebug - fmt.Printf("transactor.GasLimit: %d\n", transactor.GasLimit) + logger.Debugf("gas limit set to: %d", transactor.GasLimit) - //tmpdebug - fmt.Printf("tx.Gas: %d\n", tx.Gas()) + logger.Debugf("transaction gas: %d", tx.Gas()) - //tmpdebug - fmt.Printf("SubmitTransaction>storeTX\n") + logger.Debug("storing transaction") - //tmpdebug - fmt.Printf("SubmitTransaction>tx.Nonce: %d\n", tx.Nonce()) + logger.Debugf("transaction nonce: %d", tx.Nonce()) - //tmpdebug - fmt.Println("getGasEstimate>start") + logger.Debug("starting gas estimation") - //tmpdebug - fmt.Println("getGasEstimate>gasUnitAddPercentage", gasUnitAddPercentage) + logger.Debugf("gas unit add percentage: %d", gasUnitAddPercentage) - //tmpdebug - fmt.Printf("getGasEstimate> Error estimating gas: %v\n", err) + logger.Errorf("failed to estimate gas: %v", err)Also applies to: 425-426, 432-433, 462-463, 470-471, 475-476, 487-488, 737-738, 742-743, 771-772
🧰 Tools
🪛 golangci-lint (1.62.2)
391-391: commentFormatting: put a space between
//
and comment text(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 391-391:
commentFormatting: put a space between//
and comment text (gocritic)
730-730
: Follow Go naming conventions.Several variables use underscores which is against Go naming conventions:
gasLimit_new
gasLimit_fromPrior
gasLimit_fromEstimate
Apply this diff to fix the naming:
-func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimit_new uint64, err error) { +func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimitNew uint64, err error) { - gasLimit_fromPrior := tx.Gas() + gasLimitFromPrior := tx.Gas() - gasLimit_fromEstimate, err := chainClient.EstimateGas(ctx, *call) + gasLimitFromEstimate, err := chainClient.EstimateGas(ctx, *call) - gasLimit_new = max(gasLimit_fromPrior, gasLimit_fromEstimate) + gasLimitNew = max(gasLimitFromPrior, gasLimitFromEstimate) - gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100) + gasLimitNew += gasLimitNew * uint64(gasUnitAddPercentage) / 100Also applies to: 765-765, 767-767, 781-781, 784-784
🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 730-730: var-naming: don't use underscores in Go names; method result gasLimit_new should be gasLimitNew
(revive)
🪛 GitHub Check: codecov/patch
[warning] 730-732: ethergo/submitter/submitter.go#L730-L732
Added lines #L730 - L732 were not covered by tests
430-430
: Prevent potential integer overflow.Several uint64 to int/int64 conversions could potentially overflow:
- Chain ID conversions in
GetDynamicGasEstimate
andGetGasEstimate
calls- Gas limit conversions in trace attributes
Apply this diff to add overflow protection:
+ chainIDInt := chainID.Int64() + if chainIDInt > math.MaxInt32 { + return 0, fmt.Errorf("chain ID %d exceeds maximum supported value", chainIDInt) + } - if !t.config.GetDynamicGasEstimate(int(chainID.Uint64())) { - transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64())) + if !t.config.GetDynamicGasEstimate(int(chainIDInt)) { + transactor.GasLimit = t.config.GetGasEstimate(int(chainIDInt)) - attribute.Int64("gas_limit", int64(gasLimit_new)), - attribute.Int64("gas_limit_from_prior", int64(gasLimit_fromPrior)), - attribute.Int64("gas_limit_from_estimate", int64(gasLimit_fromEstimate)), + attribute.Uint64("gas_limit", gasLimitNew), + attribute.Uint64("gas_limit_from_prior", gasLimitFromPrior), + attribute.Uint64("gas_limit_from_estimate", gasLimitFromEstimate),Also applies to: 435-435, 786-789
🧰 Tools
🪛 golangci-lint (1.62.2)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
🪛 GitHub Check: Lint (ethergo)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
Line range hint
730-791
: Add test coverage for dynamic gas unit percentage adjustment.The new gas estimation logic lacks test coverage, particularly:
- Dynamic gas unit percentage calculation
- Gas limit adjustment based on prior and estimated values
- Error handling in gas estimation
Run this script to verify test coverage:
#!/bin/bash # Check test coverage for the new gas estimation logic go test -coverprofile=coverage.out ./ethergo/submitter/ go tool cover -func=coverage.out | grep -A 2 "getGasEstimate"🧰 Tools
🪛 golangci-lint (1.62.2)
784-784: assignOp: replace
gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
withgasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[high] 786-786: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 787-787: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 788-788: G115: integer overflow conversion uint64 -> int64
(gosec)
[warning] 765-765: var-naming: don't use underscores in Go names; var gasLimit_fromPrior should be gasLimitFromPrior
(revive)
[warning] 767-767: var-naming: don't use underscores in Go names; var gasLimit_fromEstimate should be gasLimitFromEstimate
(revive)
🪛 GitHub Check: codecov/patch
[warning] 765-768: ethergo/submitter/submitter.go#L765-L768
Added lines #L765 - L768 were not covered by tests
[warning] 771-772: ethergo/submitter/submitter.go#L771-L772
Added lines #L771 - L772 were not covered by tests
[warning] 774-777: ethergo/submitter/submitter.go#L774-L777
Added lines #L774 - L777 were not covered by tests
[warning] 781-791: ethergo/submitter/submitter.go#L781-L791
Added lines #L781 - L791 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 784-784:
assignOp: replacegasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
withgasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[failure] 786-786:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 787-787:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 788-788:
G115: integer overflow conversion uint64 -> int64 (gosec)
437-453
:⚠️ Potential issueRestore commented-out gas estimation logic.
The gas estimation logic is commented out, which could lead to incorrect gas limits being used.
Uncomment and restore the gas estimation logic:
- // //tmpdebug - // fmt.Printf("SubmitTransaction>forGasEst call \n") - - // transactor_forGasEstimate := copyTransactOpts(transactor) - - // transactor_forGasEstimate.Nonce.Add(transactor_forGasEstimate.Nonce, big.NewInt(1)) - - // tx_forGasEstimate, err := call(transactor_forGasEstimate) - // if err != nil { - // return 0, fmt.Errorf("err contract call for gas est: %w", err) - // } - - // fmt.Printf("tx_forGasEstimate: %v\n", tx_forGasEstimate.Gas()) - - //transactor.GasLimit = tx_forGasEstimate.Gas() + 555 + transactorForGasEstimate := copyTransactOpts(transactor) + txForGasEstimate, err := call(transactorForGasEstimate) + if err != nil { + return 0, fmt.Errorf("err contract call for gas est: %w", err) + } + + gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), txForGasEstimate) + if err != nil { + return 0, fmt.Errorf("err getGasEstimate: %w", err) + } + transactor.GasLimit = gasEstimateLikely invalid or redundant comment.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 437-453: ethergo/submitter/submitter.go#L437-L453
Added lines #L437 - L453 were not covered by tests
// if arbitrum, spoof some low gas units to induce bump tests | ||
if chainID.Uint64() == 10 { | ||
transactor.GasLimit = 0 | ||
} else if chainID.Uint64() == 42161 { | ||
transactor.GasLimit = 200000 | ||
} | ||
} |
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.
Remove hard-coded gas limits for specific chains.
Using hard-coded gas limits (0 for chain ID 10 and 200000 for chain ID 42161) is dangerous as it:
- Will cause transaction failures with zero gas limit
- May lead to out-of-gas errors with insufficient gas limit
- Wastes gas if the limit is too high
Remove the hard-coded values and use proper gas estimation:
- // if arbitrum, spoof some low gas units to induce bump tests
- if chainID.Uint64() == 10 {
- transactor.GasLimit = 0
- } else if chainID.Uint64() == 42161 {
- transactor.GasLimit = 200000
- }
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// if arbitrum, spoof some low gas units to induce bump tests | |
if chainID.Uint64() == 10 { | |
transactor.GasLimit = 0 | |
} else if chainID.Uint64() == 42161 { | |
transactor.GasLimit = 200000 | |
} | |
} | |
} |
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 455-455: ethergo/submitter/submitter.go#L455
Added line #L455 was not covered by tests
[warning] 457-457: ethergo/submitter/submitter.go#L457
Added line #L457 was not covered by tests
[warning] 459-459: ethergo/submitter/submitter.go#L459
Added line #L459 was not covered by tests
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.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
ethergo/submitter/submitter.go (1)
Add test coverage for gas estimation logic
The review comment is valid. The codebase lacks test coverage for the gas estimation functionality. Critical paths that need test coverage:
- Dynamic gas estimation toggle behavior
- Error handling with fallback to default gas
- Gas limit percentage adjustments
- Integration with metrics/tracing
The implementation in
getGasEstimate
handles complex scenarios and configuration options, making test coverage essential for reliability and maintainability.🔗 Analysis chain
Line range hint
735-796
: Add test coverage for gas estimation logic.The new gas estimation logic lacks test coverage, particularly:
- Dynamic gas estimation functionality
- Gas estimation error handling
- Gas limit percentage adjustment
Run this script to verify test coverage:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check test coverage for the new gas estimation logic go test -coverprofile=coverage.out ./ethergo/submitter/ go tool cover -func=coverage.out | grep -A 2 "getGasEstimate"Length of output: 13647
Script:
#!/bin/bash # Search for test files and gas estimation related tests echo "=== Test files in submitter directory ===" fd ".*_test\.go$" ethergo/submitter/ echo -e "\n=== Gas estimation related test cases ===" rg -A 5 "Test.*Gas.*Estimate" ethergo/submitter/ rg -A 5 "getGasEstimate" ethergo/submitter/ --type goLength of output: 3148
🧰 Tools
🪛 golangci-lint (1.62.2)
789-789: assignOp: replace
gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
withgasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[high] 791-791: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 792-792: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 793-793: G115: integer overflow conversion uint64 -> int64
(gosec)
[warning] 770-770: var-naming: don't use underscores in Go names; var gasLimit_fromPrior should be gasLimitFromPrior
(revive)
[warning] 772-772: var-naming: don't use underscores in Go names; var gasLimit_fromEstimate should be gasLimitFromEstimate
(revive)
🪛 GitHub Check: codecov/patch
[warning] 770-773: ethergo/submitter/submitter.go#L770-L773
Added lines #L770 - L773 were not covered by tests
[warning] 776-777: ethergo/submitter/submitter.go#L776-L777
Added lines #L776 - L777 were not covered by tests
[warning] 779-782: ethergo/submitter/submitter.go#L779-L782
Added lines #L779 - L782 were not covered by tests
[warning] 786-796: ethergo/submitter/submitter.go#L786-L796
Added lines #L786 - L796 were not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 789-789:
assignOp: replacegasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
withgasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[failure] 791-791:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 792-792:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 793-793:
G115: integer overflow conversion uint64 -> int64 (gosec)
🧹 Nitpick comments (1)
.gitignore (1)
138-138
: Consider documenting the config structure.Adding
config-stage.yaml
to .gitignore is appropriate for environment-specific configurations. However, consider adding aconfig-stage.yaml.example
template to the repository to document the expected structure and required fields, including the newdynamic_gas_unit_add_percentage
parameter.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.gitignore
(1 hunks)ethergo/submitter/submitter.go
(5 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
ethergo/submitter/submitter.go
391-391: commentFormatting: put a space between //
and comment text
(gocritic)
425-425: commentFormatting: put a space between //
and comment text
(gocritic)
432-432: commentFormatting: put a space between //
and comment text
(gocritic)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 435-435: G115: integer overflow conversion uint64 -> int
(gosec)
436-436: unnecessary leading newline
(whitespace)
[warning] 735-735: var-naming: don't use underscores in Go names; method result gasLimit_new should be gasLimitNew
(revive)
789-789: assignOp: replace gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
with gasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[high] 791-791: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 792-792: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 793-793: G115: integer overflow conversion uint64 -> int64
(gosec)
[warning] 770-770: var-naming: don't use underscores in Go names; var gasLimit_fromPrior should be gasLimitFromPrior
(revive)
[warning] 772-772: var-naming: don't use underscores in Go names; var gasLimit_fromEstimate should be gasLimitFromEstimate
(revive)
🪛 GitHub Check: Lint (ethergo)
ethergo/submitter/submitter.go
[failure] 391-391:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 425-425:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 432-432:
commentFormatting: put a space between //
and comment text (gocritic)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 435-435:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 789-789:
assignOp: replace gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
with gasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
[failure] 791-791:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 792-792:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 793-793:
G115: integer overflow conversion uint64 -> int64 (gosec)
🪛 GitHub Check: codecov/patch
ethergo/submitter/submitter.go
[warning] 437-459: ethergo/submitter/submitter.go#L437-L459
Added lines #L437 - L459 were not covered by tests
[warning] 472-472: ethergo/submitter/submitter.go#L472
Added line #L472 was not covered by tests
[warning] 735-737: ethergo/submitter/submitter.go#L735-L737
Added lines #L735 - L737 were not covered by tests
[warning] 743-749: ethergo/submitter/submitter.go#L743-L749
Added lines #L743 - L749 were not covered by tests
[warning] 752-752: ethergo/submitter/submitter.go#L752
Added line #L752 was not covered by tests
[warning] 754-755: ethergo/submitter/submitter.go#L754-L755
Added lines #L754 - L755 were not covered by tests
[warning] 759-759: ethergo/submitter/submitter.go#L759
Added line #L759 was not covered by tests
[warning] 770-773: ethergo/submitter/submitter.go#L770-L773
Added lines #L770 - L773 were not covered by tests
[warning] 776-777: ethergo/submitter/submitter.go#L776-L777
Added lines #L776 - L777 were not covered by tests
[warning] 779-782: ethergo/submitter/submitter.go#L779-L782
Added lines #L779 - L782 were not covered by tests
[warning] 786-796: ethergo/submitter/submitter.go#L786-L796
Added lines #L786 - L796 were not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (14)
- GitHub Check: Go Generate (Module Changes) (tools)
- GitHub Check: Go Generate (Module Changes) (services/scribe)
- GitHub Check: Go Generate (Module Changes) (services/rfq)
- GitHub Check: Go Generate (Module Changes) (services/omnirpc)
- GitHub Check: Go Generate (Module Changes) (services/explorer)
- GitHub Check: Go Generate (Module Changes) (services/cctp-relayer)
- GitHub Check: Go Coverage (1.22.x, services/scribe)
- GitHub Check: Go Generate (Module Changes) (ethergo)
- GitHub Check: Go Generate (Module Changes) (contrib/promexporter)
- GitHub Check: Go Generate (Module Changes) (contrib/opbot)
- GitHub Check: Go Coverage (1.22.x, services/explorer)
- GitHub Check: Go Generate (Module Changes) (agents)
- GitHub Check: Deploy to Vercel (docs)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
.gitignore (1)
137-137
: LGTM! Good security practice.Adding
*signer*.txt
to .gitignore is a good security practice to prevent accidentally committing files that might contain sensitive signer-related information.ethergo/submitter/submitter.go (2)
Line range hint
391-494
: Replace debug prints with structured logging.Replace temporary debug print statements with structured logging using the existing
logger
instance.🧰 Tools
🪛 golangci-lint (1.62.2)
425-425: commentFormatting: put a space between
//
and comment text(gocritic)
432-432: commentFormatting: put a space between
//
and comment text(gocritic)
[high] 430-430: G115: integer overflow conversion uint64 -> int
(gosec)
[high] 435-435: G115: integer overflow conversion uint64 -> int
(gosec)
436-436: unnecessary leading newline
(whitespace)
🪛 GitHub Check: codecov/patch
[warning] 437-459: ethergo/submitter/submitter.go#L437-L459
Added lines #L437 - L459 were not covered by tests
[warning] 472-472: ethergo/submitter/submitter.go#L472
Added line #L472 was not covered by tests🪛 GitHub Check: Lint (ethergo)
[failure] 425-425:
commentFormatting: put a space between//
and comment text (gocritic)
[failure] 432-432:
commentFormatting: put a space between//
and comment text (gocritic)
[failure] 430-430:
G115: integer overflow conversion uint64 -> int (gosec)
[failure] 435-435:
G115: integer overflow conversion uint64 -> int (gosec)
454-460
: Remove hard-coded gas limits for specific chains.Using hard-coded gas limits (0 for chain ID 10 and 200000 for chain ID 42161) is dangerous as it:
- Will cause transaction failures with zero gas limit
- May lead to out-of-gas errors with insufficient gas limit
- Wastes gas if the limit is too high
func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimit_new uint64, err error) { | ||
|
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.
🛠️ Refactor suggestion
Follow Go naming conventions.
The variable name gasLimit_new
should follow Go naming conventions.
Apply this diff:
-func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimit_new uint64, err error) {
+func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimitNew uint64, err error) {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimit_new uint64, err error) { | |
func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client.EVM, chainID int, tx *types.Transaction) (gasLimitNew uint64, err error) { |
🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 735-735: var-naming: don't use underscores in Go names; method result gasLimit_new should be gasLimitNew
(revive)
🪛 GitHub Check: codecov/patch
[warning] 735-737: ethergo/submitter/submitter.go#L735-L737
Added lines #L735 - L737 were not covered by tests
gasLimit_fromPrior := tx.Gas() | ||
|
||
gasLimit_fromEstimate, err := chainClient.EstimateGas(ctx, *call) | ||
|
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.
🛠️ Refactor suggestion
Follow Go naming conventions for variables.
Variable names should follow Go naming conventions.
Apply this diff:
- gasLimit_fromPrior := tx.Gas()
- gasLimit_fromEstimate, err := chainClient.EstimateGas(ctx, *call)
+ gasLimitFromPrior := tx.Gas()
+ gasLimitFromEstimate, err := chainClient.EstimateGas(ctx, *call)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
gasLimit_fromPrior := tx.Gas() | |
gasLimit_fromEstimate, err := chainClient.EstimateGas(ctx, *call) | |
gasLimitFromPrior := tx.Gas() | |
gasLimitFromEstimate, err := chainClient.EstimateGas(ctx, *call) | |
🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 770-770: var-naming: don't use underscores in Go names; var gasLimit_fromPrior should be gasLimitFromPrior
(revive)
[warning] 772-772: var-naming: don't use underscores in Go names; var gasLimit_fromEstimate should be gasLimitFromEstimate
(revive)
🪛 GitHub Check: codecov/patch
[warning] 770-773: ethergo/submitter/submitter.go#L770-L773
Added lines #L770 - L773 were not covered by tests
span.AddEvent("new gas limit", trace.WithAttributes( | ||
attribute.Int64("gas_limit", int64(gasLimit_new)), | ||
attribute.Int64("gas_limit_from_prior", int64(gasLimit_fromPrior)), | ||
attribute.Int64("gas_limit_from_estimate", int64(gasLimit_fromEstimate)), | ||
)) |
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.
Protect against integer overflow in trace attributes.
The conversion from uint64 to int64 could overflow.
Apply this diff:
- attribute.Int64("gas_limit", int64(gasLimit_new)),
- attribute.Int64("gas_limit_from_prior", int64(gasLimit_fromPrior)),
- attribute.Int64("gas_limit_from_estimate", int64(gasLimit_fromEstimate)),
+ attribute.String("gas_limit", fmt.Sprintf("%d", gasLimitNew)),
+ attribute.String("gas_limit_from_prior", fmt.Sprintf("%d", gasLimitFromPrior)),
+ attribute.String("gas_limit_from_estimate", fmt.Sprintf("%d", gasLimitFromEstimate)),
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
span.AddEvent("new gas limit", trace.WithAttributes( | |
attribute.Int64("gas_limit", int64(gasLimit_new)), | |
attribute.Int64("gas_limit_from_prior", int64(gasLimit_fromPrior)), | |
attribute.Int64("gas_limit_from_estimate", int64(gasLimit_fromEstimate)), | |
)) | |
span.AddEvent("new gas limit", trace.WithAttributes( | |
attribute.String("gas_limit", fmt.Sprintf("%d", gasLimitNew)), | |
attribute.String("gas_limit_from_prior", fmt.Sprintf("%d", gasLimitFromPrior)), | |
attribute.String("gas_limit_from_estimate", fmt.Sprintf("%d", gasLimitFromEstimate)), | |
)) |
🧰 Tools
🪛 golangci-lint (1.62.2)
[high] 791-791: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 792-792: G115: integer overflow conversion uint64 -> int64
(gosec)
[high] 793-793: G115: integer overflow conversion uint64 -> int64
(gosec)
🪛 GitHub Check: Lint (ethergo)
[failure] 791-791:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 792-792:
G115: integer overflow conversion uint64 -> int64 (gosec)
[failure] 793-793:
G115: integer overflow conversion uint64 -> int64 (gosec)
// whichever source is used as the base, multiply it by the configured gas unit add percentage | ||
gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100) |
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.
Protect against integer overflow in gas limit calculation.
The gas limit calculation could overflow when multiplying by the percentage.
Apply this diff to use big.Int for safe calculation:
- gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
+ increase := new(big.Int).SetUint64(gasLimitNew)
+ increase.Mul(increase, big.NewInt(int64(gasUnitAddPercentage)))
+ increase.Div(increase, big.NewInt(100))
+ if !increase.IsUint64() {
+ return 0, fmt.Errorf("gas limit increase exceeds uint64 max value")
+ }
+ gasLimitNew += increase.Uint64()
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 golangci-lint (1.62.2)
789-789: assignOp: replace gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
with gasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
🪛 GitHub Check: Lint (ethergo)
[failure] 789-789:
assignOp: replace gasLimit_new = gasLimit_new + (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
with gasLimit_new += (gasLimit_new * uint64(gasUnitAddPercentage) / 100)
(gocritic)
allows gas units/limit to be increased by X% beyond the value returned by estimateGas
Summary by CodeRabbit
Release Notes
New Features
dynamic_gas_unit_add_percentage
for more flexible gas estimation in the Ethergo Submitter module.Improvements
Bug Fixes
Technical Updates
95798a8: docs preview link
995e2b7: docs preview link
1f734dd: docs preview link
d01551c: docs preview link
fda62d9: docs preview link
d5e3394: docs preview link
2020bcd: docs preview link
e55e7c1: docs preview link
7704c18: docs preview link
9a2579e: docs preview link
78e9503: docs preview link
09bb89f: docs preview link
fe184df: docs preview link
8fcf948: docs preview link
af569f7: docs preview link
cd68b39: docs preview link
0e9cd9c: docs preview link
1280b83: docs preview link
c22a87c: docs preview link
087a545: docs preview link
8b3507e: docs preview link
6c1586b: docs preview link
cdcd69e: docs preview link
9af9a2c: docs preview link
96af4f6: docs preview link
e93dce8: docs preview link
6f21782: docs preview link
c22edab: docs preview link
a2a905e: docs preview link
ecdefa9: docs preview link
fc66c45: docs preview link
7a472dd: docs preview link
03ec0e4: docs preview link