-
Notifications
You must be signed in to change notification settings - Fork 4
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
Simple ImmutableBeaconProxy implementation #19
base: main
Are you sure you want to change the base?
Conversation
Foundry report forge 0.2.0 (1caa0fa 2023-05-30T00:03:46.380409943Z) Build logCompiling 51 files with 0.8.14
Solc 0.8.14 finished in 3.89s
Compiler run �[32msuccessful!�[0m
| Contract | Size (kB) | Margin (kB) |
|-----------------------------|-----------|-------------|
| Address | 0.086 | 24.49 |
| BeaconMock | 0.145 | 24.431 |
| ERC1967Proxy | 0.711 | 23.865 |
| ImmutableBeaconProxy | 0.331 | 24.245 |
| ImmutableBeaconProxyMock | 0.424 | 24.152 |
| ImplOwnableWithGuardian | 0.807 | 23.769 |
| ImplementationMock | 0.063 | 24.513 |
| MockImpl | 0.476 | 24.1 |
| ProxyAdmin | 1.69 | 22.886 |
| SafeCast | 0.086 | 24.49 |
| SafeERC20 | 0.086 | 24.49 |
| StorageSlot | 0.086 | 24.49 |
| TransparentProxyFactory | 7.541 | 17.035 |
| TransparentUpgradeableProxy | 2.104 | 22.472 |
| UpgradeableBeacon | 0.852 | 23.724 |
| console | 0.086 | 24.49 |
| console2 | 0.086 | 24.49 |
| stdError | 0.598 | 23.978 |
| stdJson | 0.086 | 24.49 |
| stdMath | 0.086 | 24.49 |
| stdStorage | 0.086 | 24.49 |
| stdStorageSafe | 0.086 | 24.49 | Test success 🌈No files changed, compilation skipped
Running 3 tests for test/OwnableWithGuardian.t.sol:TestOfOwnableWithGuardian
�[32m[PASS]�[0m testConstructorLogic() (gas: 10594)
�[32m[PASS]�[0m testGuardianUpdate(address) (runs: 256, μ: 12259, ~: 12270)
�[32m[PASS]�[0m testGuardianUpdateNoAccess(address) (runs: 256, μ: 11501, ~: 11501)
Test result: �[32mok�[0m. 3 passed; 0 failed; finished in 40.95ms
Running 5 tests for test/EmergencyConsumer.t.sol:EmergencyConsumerTest
�[32m[PASS]�[0m testEmergency(int256,uint256) (runs: 256, μ: 33586, ~: 33586)
�[32m[PASS]�[0m testGetChainlinkEmergencyOracle() (gas: 2414)
�[32m[PASS]�[0m testGetEmergencyCount() (gas: 2339)
�[32m[PASS]�[0m testRevertIfNotInEmergency(int256,uint256) (runs: 256, μ: 30904, ~: 31221)
�[32m[PASS]�[0m testUpdateCLEmergencyOracleInternal(address) (runs: 256, μ: 10841, ~: 10863)
Test result: �[32mok�[0m. 5 passed; 0 failed; finished in 98.70ms
Running 3 tests for test/ImmutableBeaconProxy.t.sol:ImmutableBeaconProxyTest
�[32m[PASS]�[0m testBeaconNotAContract() (gas: 36193)
�[32m[PASS]�[0m testImplementationNotAContract() (gas: 120667)
�[32m[PASS]�[0m testResolvesImplementationCorrectly() (gas: 253716)
Test result: �[32mok�[0m. 3 passed; 0 failed; finished in 644.63µs
Running 4 tests for test/TransparentProxyFactory.t.sol:TestTransparentProxyFactory
�[32m[PASS]�[0m testCreateDeterministic(address,bytes32) (runs: 256, μ: 579900, ~: 579900)
�[32m[PASS]�[0m testCreateDeterministicProxyAdmin(address,bytes32) (runs: 256, μ: 413164, ~: 413164)
�[32m[PASS]�[0m testCreateDeterministicWithDeterministicProxy(bytes32,bytes32) (runs: 256, μ: 586673, ~: 586673)
�[32m[PASS]�[0m testCreateProxyAdmin(address,bytes32) (runs: 256, μ: 406237, ~: 406237)
Test result: �[32mok�[0m. 4 passed; 0 failed; finished in 233.55ms |
* because it will not be accessible via delegatecall, and will not work as expected | ||
*/ | ||
contract ImmutableBeaconProxy is Proxy { | ||
address internal immutable _beacon; |
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.
address internal immutable _beacon; | |
address public immutable BEACON; |
/** | ||
* @dev Returns the current implementation address of the associated beacon. | ||
*/ | ||
function _implementation() internal view virtual override returns (address) { |
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.
Why internal?
|
||
pragma solidity ^0.8.0; | ||
|
||
import './interfaces/IBeacon.sol'; |
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.
Why this import this way?
To avoid uncontrolled upgrades. Because in general code looks quite static
for us
Best regards,
Andrei
…On Fri, 26 May 2023, 16:50 Ernesto Boado, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/contracts/immutable-beacon-proxy/UpgradeableBeacon.sol
<#19 (comment)>
:
> @@ -0,0 +1,68 @@
+// SPDX-License-Identifier: MIT
+// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)
+
+pragma solidity ^0.8.0;
+
+import './interfaces/IBeacon.sol';
Why this import this way?
—
Reply to this email directly, view it on GitHub
<#19 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEFXTWTNLKCTWS3MWTYQ3FLXICYJPANCNFSM6AAAAAAYOVLTME>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
No description provided.