forked from aragon/aragonOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Split proxies in Depositable and NonDepositable
and combine them wiht Pinned/Upgradeable. Gas comparison. Interestingly enough, contract size increase but tx gas cost is decreasing. Before: | Contract | Method | Min | Max | Avg | # calls | usd (avg) |-------------------------|------------------------|-----------|-----------|-----------|---------------|-------------- | Kernel | initialize | - | - | 470206 | 2 | 0.25 | Kernel | newAppInstance | 321213 | 388578 | 348802 | 7 | 0.19 | Kernel | newPinnedAppInstance | 320402 | 343397 | 338798 | 5 | 0.18 | Kernel | setApp | 45406 | 61253 | 57948 | 15 | 0.03 | KernelDepositableMock | enableDeposits | - | - | 42110 | 1 | 0.02 | KernelDepositableMock | initialize | - | - | 364058 | 3 | 0.20 | KernelOverloadMock | newAppInstance | 334494 | 366437 | 356214 | 8 | 0.19 | KernelOverloadMock | newPinnedAppInstance | 314022 | 390551 | 355616 | 8 | 0.19 | Deployments | Min | Max | Avg | % of limit | usd (avg) |--------------------------------------------------|-----------|-----------|-----------|---------------|------------- | ACL | - | - | 3197196 | 6.4 % | 1.73 | ERCProxyMock | - | - | 129445 | 0.3 % | 0.07 | Kernel | 3217572 | 3238629 | 3220854 | 6.4 % | 1.74 | KernelDepositableMock | 3224984 | 3246041 | 3230248 | 6.5 % | 1.75 | KernelOverloadMock | 346334 | 346398 | 346387 | 0.7 % | 0.19 | KernelProxy | - | - | 337198 | 0.7 % | 0.18 After: | Contract | Method | Min | Max | Avg | # calls | usd (avg) |----------------------|------------------------|-----------|-----------|-----------|---------------|-------------- | Kernel | initialize | - | - | 431538 | 2 | 0.23 | Kernel | newAppInstance | 292794 | 315853 | 306642 | 5 | 0.17 | Kernel | newPinnedAppInstance | 281976 | 304971 | 300372 | 5 | 0.16 | Kernel | setApp | 45483 | 61330 | 58025 | 15 | 0.03 | KernelOverloadMock | newAppInstance | 295991 | 327846 | 317667 | 8 | 0.17 | KernelOverloadMock | newPinnedAppInstance | 285131 | 319201 | 302166 | 4 | 0.16 | Deployments | Min | Max | Avg | % of limit | usd (avg) |-----------------------------------------------|-----------|-----------|-----------|---------------|------------- | ACL | - | - | 3197196 | 6.4 % | 1.74 | ERCProxyMock | - | - | 129445 | 0.3 % | 0.07 | Kernel | 4341612 | 4362669 | 4345073 | 8.7 % | 2.37 | KernelOverloadMock | - | - | 260168 | 0.5 % | 0.14 | KernelProxy | 281819 | 281883 | 281875 | 0.6 % | 0.15
- Loading branch information
ßingen
committed
Sep 3, 2019
1 parent
c350823
commit ac3116c
Showing
30 changed files
with
267 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./AppProxyBase.sol"; | ||
import "../common/DepositableDelegateProxy.sol"; | ||
|
||
|
||
contract AppProxyDepositable is AppProxyBase, DepositableDelegateProxy { | ||
/** | ||
* @dev Initialize AppProxyDepositable | ||
* @param _kernel Reference to organization kernel for the app | ||
* @param _appId Identifier for app | ||
* @param _initializePayload Payload for call to be made after setup to initialize | ||
*/ | ||
constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) | ||
AppProxyBase(_kernel, _appId, _initializePayload) | ||
public | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./AppProxyBase.sol"; | ||
import "../common/NonDepositableDelegateProxy.sol"; | ||
|
||
|
||
contract AppProxyNonDepositable is AppProxyBase, NonDepositableDelegateProxy { | ||
/** | ||
* @dev Initialize AppProxyNonDepositable | ||
* @param _kernel Reference to organization kernel for the app | ||
* @param _appId Identifier for app | ||
* @param _initializePayload Payload for call to be made after setup to initialize | ||
*/ | ||
constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) | ||
AppProxyBase(_kernel, _appId, _initializePayload) | ||
public | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./AppProxyPinnedBase.sol"; | ||
import "./AppProxyDepositable.sol"; | ||
|
||
|
||
contract AppProxyPinnedDepositable is AppProxyPinnedBase, AppProxyDepositable { | ||
/** | ||
* @dev Initialize AppProxyPinned (makes it an un-upgradeable Aragon app) | ||
* @param _kernel Reference to organization kernel for the app | ||
* @param _appId Identifier for app | ||
* @param _initializePayload Payload for call to be made after setup to initialize | ||
*/ | ||
constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) | ||
AppProxyDepositable(_kernel, _appId, _initializePayload) | ||
public // solium-disable-line visibility-first | ||
{ | ||
setPinnedCode(getAppBase(_appId)); | ||
require(isContract(pinnedCode())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./AppProxyPinnedBase.sol"; | ||
import "./AppProxyNonDepositable.sol"; | ||
|
||
|
||
contract AppProxyPinnedNonDepositable is AppProxyPinnedBase, AppProxyNonDepositable { | ||
/** | ||
* @dev Initialize AppProxyPinned (makes it an un-upgradeable Aragon app) | ||
* @param _kernel Reference to organization kernel for the app | ||
* @param _appId Identifier for app | ||
* @param _initializePayload Payload for call to be made after setup to initialize | ||
*/ | ||
constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) | ||
AppProxyNonDepositable(_kernel, _appId, _initializePayload) | ||
public // solium-disable-line visibility-first | ||
{ | ||
setPinnedCode(getAppBase(_appId)); | ||
require(isContract(pinnedCode())); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./AppProxyBase.sol"; | ||
|
||
contract AppProxyUpgradeableBase is AppProxyBase { | ||
/** | ||
* @dev ERC897, the address the proxy would delegate calls to | ||
*/ | ||
function implementation() public view returns (address) { | ||
return getAppBase(appId()); | ||
} | ||
|
||
/** | ||
* @dev ERC897, whether it is a forwarding (1) or an upgradeable (2) proxy | ||
*/ | ||
function proxyType() public pure returns (uint256 proxyTypeId) { | ||
return UPGRADEABLE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./AppProxyUpgradeableBase.sol"; | ||
import "./AppProxyDepositable.sol"; | ||
|
||
|
||
contract AppProxyUpgradeableDepositable is AppProxyUpgradeableBase, AppProxyDepositable { | ||
/** | ||
* @dev Initialize AppProxyUpgradeable (makes it an upgradeable Aragon app) | ||
* @param _kernel Reference to organization kernel for the app | ||
* @param _appId Identifier for app | ||
* @param _initializePayload Payload for call to be made after setup to initialize | ||
*/ | ||
constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) | ||
AppProxyDepositable(_kernel, _appId, _initializePayload) | ||
public // solium-disable-line visibility-first | ||
{ | ||
// solium-disable-previous-line no-empty-blocks | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./AppProxyUpgradeableBase.sol"; | ||
import "./AppProxyNonDepositable.sol"; | ||
|
||
|
||
contract AppProxyUpgradeableNonDepositable is AppProxyUpgradeableBase, AppProxyNonDepositable { | ||
/** | ||
* @dev Initialize AppProxyUpgradeable (makes it an upgradeable Aragon app) | ||
* @param _kernel Reference to organization kernel for the app | ||
* @param _appId Identifier for app | ||
* @param _initializePayload Payload for call to be made after setup to initialize | ||
*/ | ||
constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) | ||
AppProxyNonDepositable(_kernel, _appId, _initializePayload) | ||
public // solium-disable-line visibility-first | ||
{ | ||
// solium-disable-previous-line no-empty-blocks | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./DelegateProxy.sol"; | ||
|
||
|
||
contract NonDepositableDelegateProxy is DelegateProxy { | ||
function () external payable { | ||
// send / transfer | ||
if (gasleft() < FWD_GAS_LIMIT) { | ||
revert(); | ||
} else { // all calls except for send or transfer | ||
address target = implementation(); | ||
delegatedFwd(target, msg.data); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.