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 proxy with diamond pattern #1162

Closed

Conversation

yrong
Copy link
Contributor

@yrong yrong commented Mar 25, 2024

Context

When implementing transfer polkadot assets it seems the Gateway code size exceeds 24576 bytes.

Contract Size (kB) Margin (kB)
Gateway 24.759 -0.183
... ... ...

Considering more features(e.g. Transacts) will be added soon, a single Gateway with all interfaces may not be ideal. So in this PR we change the proxy pattern from the previous EIP-1967 to EIP-2535(the diamond way) and split outbound interfaces to a separate contract(facet).

Though it solves the issue of the contract size limit it's not perfect, it costs more gas and is more complicated.

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 47.43590% with 82 lines in your changes are missing coverage. Please review.

Project coverage is 66.08%. Comparing base (6212597) to head (24787df).

Files Patch % Lines
contracts/src/storage/DiamondStorage.sol 23.91% 63 Missing and 7 partials ⚠️
contracts/src/Gateway.sol 73.91% 4 Missing and 2 partials ⚠️
contracts/src/GatewayOutbound.sol 90.90% 2 Missing and 1 partial ⚠️
contracts/src/GatewayProxy.sol 50.00% 1 Missing and 1 partial ⚠️
contracts/src/DeployGatewayLogic.sol 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                         @@
##           ron/polkadot-assets-on-ethereum    #1162      +/-   ##
===================================================================
- Coverage                            72.79%   66.08%   -6.72%     
===================================================================
  Files                                   15       17       +2     
  Lines                                  522      625     +103     
  Branches                                98      125      +27     
===================================================================
+ Hits                                   380      413      +33     
- Misses                                 115      174      +59     
- Partials                                27       38      +11     
Flag Coverage Δ
solidity 66.08% <47.43%> (-6.72%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yrong yrong closed this Mar 25, 2024
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.

1 participant