Skip to content

Commit

Permalink
Merge pull request #1 from danyalprout/specify-upgrade-txns
Browse files Browse the repository at this point in the history
Update specs for deposit transactions
  • Loading branch information
mdehoog committed Feb 23, 2024
2 parents d31f8f6 + 2fedca2 commit 059f74d
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 5 deletions.
160 changes: 155 additions & 5 deletions specs/protocol/derivation.md
Original file line number Diff line number Diff line change
Expand Up @@ -1363,23 +1363,173 @@ transactions by setting `noTxPool: true`.

##### L1Block Deployment - Fjord

TODO
The `L1Block` contract is upgraded to store the new Fjord Fast LZ parameters.

To perform this upgrade, a deposit transaction is derived with the following attributes:

- `from`: `0x4210000000000000000000000000000000000002`
- `to`: `null`
- `mint`: `0`
- `value`: `0`
- `gasLimit`: `420,000`
- `data`: `0x60806040523...` ([full bytecode](../static/bytecode/fjord-l1-block-deployment.txt))
- `sourceHash`: `0x402f75bf100f605f36c2e2b8d5544a483159e26f467a9a555c87c125e7ab09f3`,
computed with the "Upgrade-deposited" type, with `intent = "Fjord: L1 Block Deployment"

This results in the Fjord L1Block contract being deployed to `0xa919894851548179A0750865e7974DA599C0Fac7`, to verify:

```bash
cast compute-address --nonce=0 0x4210000000000000000000000000000000000002
Computed Address: 0xa919894851548179A0750865e7974DA599C0Fac7
```

Verify `sourceHash`:

```bash
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Fjord: L1 Block Deployment"))
# 0x402f75bf100f605f36c2e2b8d5544a483159e26f467a9a555c87c125e7ab09f3
```

Verify `data`:

```bash
git checkout TODO (update once merged)
pnpm clean && pnpm install && pnpm build
jq -r ".bytecode.object" packages/contracts-bedrock/forge-artifacts/L1Block.sol/L1Block.json
```

This transaction MUST deploy a contract with the following code hash
`0x12e89c50902af815d85608f9a2a35579a74e9491077b94211c96f79ef265bf9c`.

##### GasPriceOracle Deployment - Fjord

TODO
The `GasPriceOracle` contract is upgraded to support the new Fjord L1 data fee computation. Post fork this contract
will use FastLZ to compute the L1 data fee.

To perform this upgrade, a deposit transaction is derived with the following attributes:

- `from`: `0x4210000000000000000000000000000000000003`
- `to`: `null`,
- `mint`: `0`
- `value`: `0`
- `gasLimit`: `1,450,000`
- `data`: `0x60806040523...` ([full bytecode](../static/bytecode/fjord-gas-price-oracle-deployment.txt))
- `sourceHash`: `0x86122c533fdcb89b16d8713174625e44578a89751d96c098ec19ab40a51a8ea3`
computed with the "Upgrade-deposited" type, with `intent = "Fjord: Gas Price Oracle Deployment"

This results in the Fjord GasPriceOracle contract being deployed to `0xFf256497D61dcd71a9e9Ff43967C13fdE1F72D12`,
to verify:

```bash
cast compute-address --nonce=0 0x4210000000000000000000000000000000000003
Computed Address: 0xFf256497D61dcd71a9e9Ff43967C13fdE1F72D12
```

Verify `sourceHash`:

```bash
❯ cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Fjord: Gas Price Oracle Deployment"))
# 0x86122c533fdcb89b16d8713174625e44578a89751d96c098ec19ab40a51a8ea3
```

Verify `data`:

```bash
git checkout TODO (update once merged)
pnpm clean && pnpm install && pnpm build
jq -r ".bytecode.object" packages/contracts-bedrock/forge-artifacts/GasPriceOracle.sol/GasPriceOracle.json
```

This transaction MUST deploy a contract with the following code hash
`0xcb82de8a527fee307214950192bf0ff5b2701c6b6eda2fbd025cf6d4075fbe38`.

##### L1Block Proxy Update - Fjord

TODO
This transaction updates the L1Block Proxy ERC-1967 implementation slot to point to the new L1Block deployment.

A deposit transaction is derived with the following attributes:

- `from`: `0x0000000000000000000000000000000000000000`
- `to`: `0x4200000000000000000000000000000000000015` (L1Block Proxy)
- `mint`: `0`
- `value`: `0`
- `gasLimit`: `50,000`
- `data`: `0x3659cfe6000000000000000000000000a919894851548179a0750865e7974da599c0fac7`
- `sourceHash`: `0x0fefb8cb7f44b866e21a59f647424cee3096de3475e252eb3b79fa3f733cee2d`
computed with the "Upgrade-deposited" type, with `intent = "Fjord: L1 Block Proxy Update"

Verify data:

```bash
cast concat-hex $(cast sig "upgradeTo(address)") $(cast abi-encode "upgradeTo(address)" 0xa919894851548179A0750865e7974DA599C0Fac7)
0x3659cfe6000000000000000000000000a919894851548179a0750865e7974da599c0fac7
```

Verify `sourceHash`:

```bash
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Fjord: L1 Block Proxy Update"))
# 0x0fefb8cb7f44b866e21a59f647424cee3096de3475e252eb3b79fa3f733cee2d
```

##### GasPriceOracle Proxy Update - Fjord

TODO
This transaction updates the GasPriceOracle Proxy ERC-1967 implementation slot to point to the new GasPriceOracle
deployment.

A deposit transaction is derived with the following attributes:

- `from`: `0x0000000000000000000000000000000000000000`
- `to`: `0x420000000000000000000000000000000000000F` (Gas Price Oracle Proxy)
- `mint`: `0`
- `value`: `0`
- `gasLimit`: `50,000`
- `data`: `0x3659cfe6000000000000000000000000ff256497d61dcd71a9e9ff43967c13fde1f72d12`
- `sourceHash`: `0x1e6bb0c28bfab3dc9b36ffb0f721f00d6937f33577606325692db0965a7d58c6`
computed with the "Upgrade-deposited" type, with `intent = "Fjord: Gas Price Oracle Proxy Update"`

Verify data:

```bash
cast concat-hex $(cast sig "upgradeTo(address)") $(cast abi-encode "upgradeTo(address)" 0xFf256497D61dcd71a9e9Ff43967C13fdE1F72D12)
0x3659cfe6000000000000000000000000ff256497d61dcd71a9e9ff43967c13fde1f72d12
```

Verify `sourceHash`:

```bash
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Fjord: Gas Price Oracle Proxy Update"))
# 0x1e6bb0c28bfab3dc9b36ffb0f721f00d6937f33577606325692db0965a7d58c6
```

##### GasPriceOracle Enable Fjord

TODO
This transaction informs the GasPriceOracle to start using the Fjord gas calculation formula.

A deposit transaction is derived with the following attributes:

- `from`: `0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001` (Depositer Account)
- `to`: `0x420000000000000000000000000000000000000F` (Gas Price Oracle Proxy)
- `mint`: `0`
- `value`: `0`
- `gasLimit`: `80,000`
- `data`: `0x8e98b106`
- `sourceHash`: `0xbac7bb0d5961cad209a345408b0280a0d4686b1b20665e1b0f9cdafd73b19b6b`,
computed with the "Upgrade-deposited" type, with `intent = "Fjord: Gas Price Oracle Set Fjord"

Verify data:

```bash
cast sig "setFjord()"
0x8e98b106
```

Verify `sourceHash`:

```bash
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Fjord: Gas Price Oracle Set Fjord"))
# 0xbac7bb0d5961cad209a345408b0280a0d4686b1b20665e1b0f9cdafd73b19b6b
```

## Building Individual Payload Attributes

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x608060405234801561001057600080fd5b5061194f806100206000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80636ef25c3a116100cd578063c598591811610081578063f45e65d811610066578063f45e65d8146102a9578063f8206140146102b1578063fe173b971461025e57600080fd5b8063c59859181461028e578063de26c4a11461029657600080fd5b8063960e3a23116100b2578063960e3a231461026c578063b0062d051461027e578063bde31f7a1461028657600080fd5b80636ef25c3a1461025e5780638e98b1061461026457600080fd5b806349948e0e11610124578063519b4bd311610109578063519b4bd3146101f057806354fd4d50146101f857806368d5dca61461024157600080fd5b806349948e0e146101c05780634ef6e224146101d357600080fd5b806322b90ab31161015557806322b90ab3146101a75780632e0f2625146101b1578063313ce567146101b957600080fd5b80630c18c162146101715780631bb590241461018c575b600080fd5b6101796102b9565b6040519081526020015b60405180910390f35b6101946103da565b60405160039190910b8152602001610183565b6101af61045f565b005b610179600681565b6006610179565b6101796101ce3660046113ba565b610682565b6000546101e09060ff1681565b6040519015158152602001610183565b6101796106bf565b6102346040518060400160405280600581526020017f312e332e3000000000000000000000000000000000000000000000000000000081525081565b6040516101839190611489565b610249610720565b60405163ffffffff9091168152602001610183565b48610179565b6101af6107a5565b6000546101e090610100900460ff1681565b6101946109a7565b610194610a08565b610249610a69565b6101796102a43660046113ba565b610aca565b610179610b7e565b610179610c71565b6000805460ff1615610352576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f47617350726963654f7261636c653a206f76657268656164282920697320646560448201527f707265636174656400000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d591906114fc565b905090565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16631bb590246040518163ffffffff1660e01b8152600401602060405180830381865afa15801561043b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d59190611515565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663e591b2826040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e29190611538565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604160248201527f47617350726963654f7261636c653a206f6e6c7920746865206465706f73697460448201527f6f72206163636f756e742063616e2073657420697345636f746f6e6520666c6160648201527f6700000000000000000000000000000000000000000000000000000000000000608482015260a401610349565b60005460ff1615610655576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a2045636f746f6e6520616c72656164792060448201527f61637469766500000000000000000000000000000000000000000000000000006064820152608401610349565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60008054610100900460ff16156106a25761069c82610cd2565b92915050565b60005460ff16156106b65761069c82610de8565b61069c82610e82565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16635cf249696040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b1573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff166368d5dca66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610781573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d5919061156e565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663e591b2826040518163ffffffff1660e01b8152600401602060405180830381865afa158015610804573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108289190611538565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603f60248201527f47617350726963654f7261636c653a206f6e6c7920746865206465706f73697460448201527f6f72206163636f756e742063616e20736574206973466a6f726420666c6167006064820152608401610349565b600054610100900460ff1615610979576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f47617350726963654f7261636c653a20466a6f726420616c726561647920616360448201527f74697665000000000000000000000000000000000000000000000000000000006064820152608401610349565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663b0062d056040518163ffffffff1660e01b8152600401602060405180830381865afa15801561043b573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663bde31f7a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561043b573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663c59859186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610781573d6000803e3d6000fd5b600080610ad683610fde565b60005490915060ff1615610aea5792915050565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6d91906114fc565b610b7790826115c3565b9392505050565b6000805460ff1615610c12576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a207363616c61722829206973206465707260448201527f65636174656400000000000000000000000000000000000000000000000000006064820152608401610349565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b1573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663f82061406040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b1573d6000803e3d6000fd5b600080610cdd610c71565b610ce5610720565b63ffffffff16610cf591906115db565b610cfd6106bf565b610d05610a69565b610d10906010611618565b63ffffffff16610d2091906115db565b610d2a91906115c3565b90506000610d378461106e565b51610d439060446115c3565b9050600084516044610d5591906115c3565b9050600081610d626109a7565b60030b610d6f9190611644565b83610d78610a08565b60030b610d859190611644565b610d8d6103da565b60030b610d9a9190611700565b610da49190611700565b90506000811215610db3575060005b610dbf600660026115db565b610dca90600a611894565b610dd485836115db565b610dde91906118a0565b9695505050505050565b600080610df483610fde565b90506000610e006106bf565b610e08610a69565b610e13906010611618565b63ffffffff16610e2391906115db565b90506000610e2f610c71565b610e37610720565b63ffffffff16610e4791906115db565b90506000610e5582846115c3565b610e5f90856115db565b9050610e6d6006600a611894565b610e789060106115db565b610dde90826118a0565b600080610e8e83610fde565b9050600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1591906114fc565b610f1d6106bf565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa091906114fc565b610faa90856115c3565b610fb491906115db565b610fbe91906115db565b9050610fcc6006600a611894565b610fd690826118a0565b949350505050565b80516000908190815b8181101561106157848181518110611001576110016118db565b01602001517fff00000000000000000000000000000000000000000000000000000000000000166000036110415761103a6004846115c3565b925061104f565b61104c6010846115c3565b92505b806110598161190a565b915050610fe7565b50610fd6826104406115c3565b60606111fd565b818153600101919050565b600082840393505b83811015610b775782810151828201511860001a1590930292600101611088565b825b602082106110f55782516110c0601f83611075565b52602092909201917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909101906021016110ab565b8115610b7757825161110a6001840383611075565b520160010192915050565b60006001830392505b6101078210611156576111488360ff1661114360fd6111438760081c60e00189611075565b611075565b93506101068203915061111e565b600782106111835761117c8360ff16611143600785036111438760081c60e00189611075565b9050610b77565b610fd68360ff166111438560081c8560051b0187611075565b6111f58282036111d96111c984600081518060001a8160011a60081b178160021a60101b17915050919050565b639e3779b90260131c611fff1690565b8060021b6040510182815160e01c1860e01b8151188152505050565b600101919050565b6180003860405139618000604051016020830180600d8551820103826002015b81811015611330576000805b50508051604051600082901a600183901a60081b1760029290921a60101b91909117639e3779b9810260111c617ffc16909101805160e081811c878603811890911b9091189091528401908183039084841061128557506112c0565b600184019350611fff82116112ba578251600081901a600182901a60081b1760029190911a60101b1781036112ba57506112c0565b50611229565b8383106112ce575050611330565b600183039250858311156112ec576112e987878886036110a9565b96505b611300600985016003850160038501611080565b915061130d878284611115565b965050611325846113208684860161119c565b61119c565b91505080935061121d565b505061134283838488518501036110a9565b925050506040519150618000820180820391508183526020830160005b8381101561137757828101518282015260200161135f565b506000920191825250602001604052919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156113cc57600080fd5b813567ffffffffffffffff808211156113e457600080fd5b818401915084601f8301126113f857600080fd5b81358181111561140a5761140a61138b565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156114505761145061138b565b8160405282815287602084870101111561146957600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b818110156114b65785810183015185820160400152820161149a565b818111156114c8576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561150e57600080fd5b5051919050565b60006020828403121561152757600080fd5b81518060030b8114610b7757600080fd5b60006020828403121561154a57600080fd5b815173ffffffffffffffffffffffffffffffffffffffff81168114610b7757600080fd5b60006020828403121561158057600080fd5b815163ffffffff81168114610b7757600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156115d6576115d6611594565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561161357611613611594565b500290565b600063ffffffff8083168185168183048111821515161561163b5761163b611594565b02949350505050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60008413600084138583048511828216161561168557611685611594565b7f800000000000000000000000000000000000000000000000000000000000000060008712868205881281841616156116c0576116c0611594565b600087129250878205871284841616156116dc576116dc611594565b878505871281841616156116f2576116f2611594565b505050929093029392505050565b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0384138115161561173a5761173a611594565b827f800000000000000000000000000000000000000000000000000000000000000003841281161561176e5761176e611594565b50500190565b600181815b808511156117cd57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156117b3576117b3611594565b808516156117c057918102915b93841c9390800290611779565b509250929050565b6000826117e45750600161069c565b816117f15750600061069c565b816001811461180757600281146118115761182d565b600191505061069c565b60ff84111561182257611822611594565b50506001821b61069c565b5060208310610133831016604e8410600b8410161715611850575081810a61069c565b61185a8383611774565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561188c5761188c611594565b029392505050565b6000610b7783836117d5565b6000826118d6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361193b5761193b611594565b506001019056fea164736f6c634300080f000a
Loading

0 comments on commit 059f74d

Please sign in to comment.