Skip to content
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

refactor(protocol): check if amount > 0 inside sendEther #13390

Merged
merged 5 commits into from
Mar 23, 2023

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Mar 22, 2023

It's quite weird that checking amount>0 inside the sendEther function is actually cheaper...how come

@dantaik dantaik requested a review from Brechtpd March 22, 2023 04:57
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #13390 (16eb81a) into major_protocol_upgrade_rebase (6a13380) will increase coverage by 0.10%.
The diff coverage is 0.00%.

@@                        Coverage Diff                        @@
##           major_protocol_upgrade_rebase   #13390      +/-   ##
=================================================================
+ Coverage                          39.81%   39.92%   +0.10%     
=================================================================
  Files                                112      112              
  Lines                               3403     3394       -9     
  Branches                             416      407       -9     
=================================================================
  Hits                                1355     1355              
+ Misses                              1960     1951       -9     
  Partials                              88       88              
Flag Coverage Δ *Carryforward flag
bridge-ui 94.22% <ø> (ø) Carriedforward from 9754f69
protocol 0.00% <0.00%> (ø)
relayer 62.30% <ø> (ø) Carriedforward from 9754f69
ui 100.00% <ø> (ø) Carriedforward from 9754f69

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
packages/protocol/contracts/bridge/EtherVault.sol 0.00% <0.00%> (ø)
...rotocol/contracts/bridge/libs/LibBridgeProcess.sol 0.00% <0.00%> (ø)
.../protocol/contracts/bridge/libs/LibBridgeRetry.sol 0.00% <0.00%> (ø)
...s/protocol/contracts/bridge/libs/LibBridgeSend.sol 0.00% <0.00%> (ø)
packages/protocol/contracts/libs/LibAddress.sol 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@Brechtpd Brechtpd left a comment

Choose a reason for hiding this comment

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

It's quite weird that checking amount>0 inside the sendEther function is actually cheaper...how come

Was not expecting that, I thought it would be the same at best. :) The only possible explanation I can think of is that the function call is inlined, and so the compiler can do some extra tiny optimizations because of that.

@dantaik dantaik merged commit 177f41b into major_protocol_upgrade_rebase Mar 23, 2023
@dantaik dantaik deleted the check_amount_inside branch March 23, 2023 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants