Skip to content

Commit

Permalink
update from 3 byte to 4 byte optimized account vanity address
Browse files Browse the repository at this point in the history
  • Loading branch information
mikec committed Dec 17, 2021
1 parent 9db6993 commit 8669934
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion __snapshots__/Account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ exports['Account externalCall() gas cost 1'] = 28277

exports['Account delegateCall() gas cost 1'] = 28106

exports['Account metaDelegateCall() gas cost 1'] = 34784
exports['Account metaDelegateCall() gas cost 1'] = 34801

exports['Account metaDelegateCall_EIP1271() gas cost 1'] = 46884
2 changes: 1 addition & 1 deletion __snapshots__/AccountFactory.test.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
exports['AccountFactory deployAccount() gas cost 1'] = 66150
exports['AccountFactory deployAccount() gas cost 1'] = 65950
2 changes: 1 addition & 1 deletion __snapshots__/DeployAndCall.test.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
exports['DeployAndCall deployAndCall() with callData that does not revert gas cost 1'] = 94055
exports['DeployAndCall deployAndCall() with callData that does not revert gas cost 1'] = 93884
2 changes: 1 addition & 1 deletion __snapshots__/Proxy.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
exports['Proxy (deployed by AccountFactory.sol) when proxy is deployed gas cost 1'] = 66150
exports['Proxy (deployed by AccountFactory.sol) when proxy is deployed gas cost 1'] = 65950

exports['Proxy (deployed by AccountFactory.sol) when Proxy account receives ETH gas cost 1'] = 23708
8 changes: 4 additions & 4 deletions __snapshots__/deterministicAddresses.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
exports['Account.sol deterministic address check 1'] = `
0x00000077efe7d0b63912C990FD6586087240E09e
0x00000000AfCbce78c080F96032a5C1cB1b832D7B
`

exports['AccountFactory.sol deterministic address check 1'] = `
0xB6f7042F749B1Ae4b6Dac23714AfC4F20CdEc67e
0xe925f84cA9Dd5b3844fC424861D7bDf9485761B6
`

exports['DeployAndCall.sol deterministic address check 1'] = `
0xf4529B4Ebcd0BE3174A3fC871F1282fBEb64E946
0x452C31d60883F0CB51744Ab9fd01685d7443CA6f
`

exports['SaltedDeployer.sol deterministic address check 1'] = `
0x32F5DAE188e47a70b452c920E84Fb47b401623EE
0xDA120C17d9DE1c2BbC5F3ddc80D2324bEeBfe84d
`
10 changes: 5 additions & 5 deletions constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
ACCOUNT: '0x00000077efe7d0b63912C990FD6586087240E09e',
ACCOUNT_FACTORY: '0xB6f7042F749B1Ae4b6Dac23714AfC4F20CdEc67e',
DEPLOY_AND_CALL: '0xf4529B4Ebcd0BE3174A3fC871F1282fBEb64E946',
CONTRACT_DEPLOY_SALT: '0xa3b2206dd3658148df4d3bc5b6afafe4ca9f211e2b9321123027d89cc86a0e8a',
SALTED_DEPLOYER: '0x32F5DAE188e47a70b452c920E84Fb47b401623EE',
ACCOUNT: '0x00000000AfCbce78c080F96032a5C1cB1b832D7B',
ACCOUNT_FACTORY: '0xe925f84cA9Dd5b3844fC424861D7bDf9485761B6',
DEPLOY_AND_CALL: '0x452C31d60883F0CB51744Ab9fd01685d7443CA6f',
CONTRACT_DEPLOY_SALT: '0xd2a5b1e84cb7a6df481438c61ec4144631172d3d29b2a30fe7c5f0fbf4e51735',
SALTED_DEPLOYER: '0xDA120C17d9DE1c2BbC5F3ddc80D2324bEeBfe84d',
SINGLETON_FACTORY: '0xce0042B868300000d44A59004Da54A005ffdcf9f'
}
2 changes: 1 addition & 1 deletion contracts/Account/Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ contract Account is EIP712SignerRecovery, EIP1271Validator {
function proxyOwner() internal view returns (address _proxyOwner) {
assembly {
// copies to "scratch space" 0 memory pointer
extcodecopy(address(), 0, 0x29, 0x14)
extcodecopy(address(), 0, 0x28, 0x14)
_proxyOwner := shr(0x60, mload(0))
}
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/Account/AccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ contract AccountFactory {
/// utilizes the "vanity address optimization" from EIP 1167
function deployAccount(address owner) external returns (address account) {
bytes memory initCode = abi.encodePacked(
// [* constructor **] [** minimal proxy ***] [******** implementation ********] [**** minimal proxy *****]
hex'603d3d8160093d39f3_3d3d3d3d363d3d37363d70_77efe7d0b63912c990fd6586087240e09e_5af43d3d93803e602757fd5bf3',
// [* constructor **] [** minimal proxy ***] [******* implementation *******] [**** minimal proxy *****]
hex'603c3d8160093d39f3_3d3d3d3d363d3d37363d6f_afcbce78c080f96032a5c1cb1b832d7b_5af43d3d93803e602657fd5bf3',
owner
);
assembly {
Expand Down
2 changes: 1 addition & 1 deletion contracts/Batched/DeployAndCall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "../Account/AccountFactory.sol";
/// @notice This contract contains a function to batch account deploy and call into one transaction
contract DeployAndCall {
/// @dev The AccountFactory to use for account deployments
AccountFactory constant ACCOUNT_FACTORY = AccountFactory(0xB6f7042F749B1Ae4b6Dac23714AfC4F20CdEc67e);
AccountFactory constant ACCOUNT_FACTORY = AccountFactory(0xe925f84cA9Dd5b3844fC424861D7bDf9485761B6);

/// @dev Deploys an account for the given owner and executes callData on the account
/// @param owner Address of the account owner
Expand Down
2 changes: 1 addition & 1 deletion contracts/Deployers/SaltedDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract SaltedDeployer {
error DeploymentExists();

/// @dev Salt used for salted deployments
bytes32 constant SALT = 0xa3b2206dd3658148df4d3bc5b6afafe4ca9f211e2b9321123027d89cc86a0e8a;
bytes32 constant SALT = 0xd2a5b1e84cb7a6df481438c61ec4144631172d3d29b2a30fe7c5f0fbf4e51735;

/// @dev Canonical SingletonFactory address
/// @notice https://eips.ethereum.org/EIPS/eip-2470
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/proxyBytecode.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { ACCOUNT } = require('../../constants')

async function proxyBytecode (proxyOwnerAddress) {
return '603d3d8160093d39f33d3d3d3d363d3d37363d70'
return '603c3d8160093d39f33d3d3d3d363d3d37363d6f'
+ removeLeadingZeros(ACCOUNT.slice(2)).toLowerCase()
+ '5af43d3d93803e602757fd5bf3'
+ '5af43d3d93803e602657fd5bf3'
+ proxyOwnerAddress.slice(2).toLowerCase()
}

Expand Down

0 comments on commit 8669934

Please sign in to comment.