-
Notifications
You must be signed in to change notification settings - Fork 30
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
4-13-2024 FE Releaes #2495
4-13-2024 FE Releaes #2495
Conversation
* [goreleaser] casing on rfq * adding hot fix for eth and token price discovery --------- Co-authored-by: defi-moses <jakedinero@protonmail.com>
* WIP: HasSufficientGas checks one chain * Fix: tests * Feat: add clause to TestHasSufficientGas with nonzero gasValue * Cleanup: lint * Fix: bool condition
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
WalkthroughThis update enhances security and efficiency in Ethereum-related services. A new address was blacklisted to improve security measures. Updates in various service modules include refactoring for case-insensitive string comparisons, adjusting methods to use new parameter types, and enhancing gas sufficiency checks across multiple chains to ensure smoother transactions and better resource management. Changes
Poem
Recent Review DetailsConfiguration used: .coderabbit.yaml Files selected for processing (9)
Files skipped from review due to trivial changes (1)
Additional comments not posted (11)
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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
// HasSufficientGas provides a mock function with given fields: ctx, chainID, gasValue | ||
func (_m *Manager) HasSufficientGas(ctx context.Context, chainID int, gasValue *big.Int) (bool, error) { | ||
ret := _m.Called(ctx, chainID, gasValue) | ||
|
||
var r0 bool | ||
if rf, ok := ret.Get(0).(func(context.Context, int, int) bool); ok { | ||
r0 = rf(ctx, origin, dest) | ||
if rf, ok := ret.Get(0).(func(context.Context, int, *big.Int) bool); ok { | ||
r0 = rf(ctx, chainID, gasValue) | ||
} else { | ||
r0 = ret.Get(0).(bool) | ||
} | ||
|
||
var r1 error | ||
if rf, ok := ret.Get(1).(func(context.Context, int, int) error); ok { | ||
r1 = rf(ctx, origin, dest) | ||
if rf, ok := ret.Get(1).(func(context.Context, int, *big.Int) error); ok { | ||
r1 = rf(ctx, chainID, gasValue) |
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.
Consider adding unit tests for the HasSufficientGas
method in the mock to verify that it behaves as expected when called with various chainID
and gasValue
combinations. This will help ensure the reliability of the mock in unit tests.
Would you like me to help by adding these unit tests or opening a GitHub issue to track this task?
sufficient, err := im.HasSufficientGas(i.GetTestContext(), origin, nil) | ||
i.NoError(err) | ||
i.True(sufficient) | ||
sufficient, err = im.HasSufficientGas(i.GetTestContext(), dest, nil) | ||
i.NoError(err) | ||
i.True(sufficient) | ||
|
||
// test with nonzero gasValue | ||
gasValue := new(big.Int).Mul(big.NewInt(params.Ether), big.NewInt(10)) | ||
sufficient, err = im.HasSufficientGas(i.GetTestContext(), origin, gasValue) | ||
i.NoError(err) | ||
i.False(sufficient) | ||
|
||
// multiply big int to avoid overflow | ||
largeBalance := new(big.Int).Mul(big.NewInt(params.Ether), big.NewInt(100)) | ||
im = getManager([]*big.Int{largeBalance, big.NewInt(params.Ether)}) | ||
sufficient, err = im.HasSufficientGas(i.GetTestContext(), origin, dest) | ||
sufficient, err = im.HasSufficientGas(i.GetTestContext(), origin, nil) | ||
i.NoError(err) | ||
i.False(sufficient) | ||
sufficient, err = im.HasSufficientGas(i.GetTestContext(), dest, nil) | ||
i.NoError(err) | ||
i.True(sufficient) | ||
|
||
im = getManager([]*big.Int{big.NewInt(params.Ether), largeBalance}) | ||
sufficient, err = im.HasSufficientGas(i.GetTestContext(), origin, dest) | ||
sufficient, err = im.HasSufficientGas(i.GetTestContext(), origin, nil) | ||
i.NoError(err) | ||
i.True(sufficient) | ||
sufficient, err = im.HasSufficientGas(i.GetTestContext(), dest, nil) |
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.
Consider adding more comprehensive tests that cover additional edge cases, such as extremely high or low gasValue
, and scenarios where the chainID
might be invalid. This will further ensure the robustness of the HasSufficientGas
method.
Would you like me to help by adding these tests or opening a GitHub issue to track this task?
Description
Release for #2494
Summary by CodeRabbit
4ad1061d0db8361d2e9962b3f6c3f001ebde4037: synapse-interface preview link