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

check and update two slots #87

Merged
merged 6 commits into from
Jun 2, 2024

Conversation

livingrockrises
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented May 30, 2024

Changes to gas cost

Generated at commit: 6237221c848312631e0ab25c39b08a5094f08a03, compared to commit: 4bd26591fb80fd717595be1611c2e8c516d494c5

🧾 Summary (5% most significant diffs)

Contract Method Avg (+/-) %
Nexus accountId
uninstallModule
+45 ❌
-22 ✅
+7.98%
-0.22%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
Nexus 4,374,237 (+75,712) accountId
execute
initializeAccount
installModule
uninstallModule
609 (+45)
6,368 (0)
81,887 (-22)
27,921 (-22)
7,972 (-22)
+7.98%
0.00%
-0.03%
-0.08%
-0.28%
609 (+45)
47,626 (-8)
101,666 (-22)
33,119 (-22)
10,019 (-22)
+7.98%
-0.02%
-0.02%
-0.07%
-0.22%
609 (+45)
36,232 (0)
101,787 (-22)
34,715 (-22)
9,609 (-22)
+7.98%
0.00%
-0.02%
-0.06%
-0.23%
609 (+45)
143,146 (0)
101,787 (-22)
38,844 (-22)
12,478 (-22)
+7.98%
0.00%
-0.02%
-0.06%
-0.18%
8 (0)
76 (0)
329 (0)
23 (0)
6 (0)
NexusAccountFactory 728,450 (0) createAccount 182,103 (-22) -0.01% 199,724 (-22) -0.01% 202,243 (-22) -0.01% 202,243 (-22) -0.01% 16 (0)

Copy link

codecov bot commented May 30, 2024

Codecov Report

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

Project coverage is 81.01%. Comparing base (abc6109) to head (3a2a610).
Report is 1 commits behind head on dev.

Current head 3a2a610 differs from pull request most recent head 2fc766e

Please upload reports for the commit 2fc766e to get more accurate results.

Files Patch % Lines
contracts/Nexus.sol 69.23% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #87      +/-   ##
==========================================
- Coverage   81.10%   81.01%   -0.10%     
==========================================
  Files          35       35              
  Lines         757      769      +12     
  Branches      120      107      -13     
==========================================
+ Hits          614      623       +9     
- Misses        132      135       +3     
  Partials       11       11              
Flag Coverage Δ
foundry 76.35% <100.00%> (+0.12%) ⬆️
hardhat 81.01% <69.23%> (-0.10%) ⬇️

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.

@@ -285,9 +299,20 @@ contract Nexus is INexus, EIP712, BaseAccount, ExecutionHelper, ModuleManager, U
}

/// Upgrades the contract to a new implementation and calls a function on the new contract.
/// @notice Updates two slots 1. 1967 slot and 2. address() slot in case if it's upgraded earlier from Biconomy V2 account.
Copy link
Collaborator

Choose a reason for hiding this comment

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

...as Biconomy v2 Account (proxy) reads implementation from the slot that is defined by its address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

}
if(implementation == address(0)) {
assembly {
implementation := sload(address())
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this magic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which line?

Copy link
Collaborator

Choose a reason for hiding this comment

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

address() opcode returns the same as address(this)
so the contract's address is used as number of the storage slot (it is converted to bytes32) to store the address of the implementation

so this line loads it from storage using the opcode to obtain the slot where the implementation address is stored.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@Aboudjem Aboudjem left a comment

Choose a reason for hiding this comment

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

LGTM only UpgradeToAndCall negative tests are missing

Copy link

openzeppelin-code bot commented Jun 1, 2024

check and update two slots

Generated at commit: 2fc766e50332159619316620bf93bbe134c0af6c

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
2
0
6
23
31

For more details view the full report in OpenZeppelin Code Inspector

Copy link

github-actions bot commented Jun 2, 2024

🤖 Slither Analysis Report 🔎

Slither report

# Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary

_This comment was automatically generated by the GitHub Actions workflow._

@livingrockrises livingrockrises merged commit e07b273 into dev Jun 2, 2024
13 checks passed
@livingrockrises livingrockrises deleted the feat/manage-multiple-implementation-slots branch June 2, 2024 13:29
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.

3 participants