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

L2 bridge: safer callhook interface #719

Merged
merged 5 commits into from
Sep 29, 2022

Conversation

pcarranzav
Copy link
Member

  • Make the L2 gateway functions non-reentrant for additional safety
  • Change the callhooks to only call an onTokenTransfer function, to limit the potential impact of a compromised whitelisted L1 sender

@codecov
Copy link

codecov bot commented Sep 28, 2022

Codecov Report

Base: 91.51% // Head: 91.53% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (394458d) compared to base (105b4f0).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 394458d differs from pull request most recent head 8aa3bd6. Consider uploading reports for the commit 8aa3bd6 to get more accurate results

Additional details and impacted files
@@                Coverage Diff                @@
##           pcv/l2-bridge     #719      +/-   ##
=================================================
+ Coverage          91.51%   91.53%   +0.01%     
=================================================
  Files                 41       42       +1     
  Lines               1980     1984       +4     
  Branches             346      346              
=================================================
+ Hits                1812     1816       +4     
  Misses               168      168              
Flag Coverage Δ
unittests 91.53% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
contracts/l2/gateway/L2GraphTokenGateway.sol 100.00% <100.00%> (ø)
contracts/tests/CallhookReceiverMock.sol 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@tmigone tmigone left a comment

Choose a reason for hiding this comment

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

Nice!

It might be overkill but how about adding another mock contract that doesn't implement the callhook interface and then adding a test to verify the callhook execution fails?

@pcarranzav
Copy link
Member Author

Good idea on the additional test @tmigone - we can use any contract so I just used RewardsManager rather than adding a new mock

@pcarranzav pcarranzav merged commit 8aa3bd6 into pcv/l2-bridge Sep 29, 2022
@pcarranzav pcarranzav deleted the pcv/l2-bridge-callhook-interface branch November 10, 2022 12:39
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