> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Derivation

> Derivation changes in the Jovian upgrade, specifying activation block rules and gas computation behavior at hardfork activation.

## Activation Block Rules

The first block with a timestamp at or after the Jovian activation time is considered the *Jovian activation block*.

To not modify or interrupt the system behavior regarding gas computations, the activation block must not include any
non-deposit transactions. Sequencer must enforce this by setting `noTxPool` to `true` in the payload attributes. This
rule must be checked during derivation at the batch verification stage, and if the batch for the activation block
contains any transactions, it must be `DROP`ped.

On the Jovian activation block, in addition to the L1 attributes deposit and potentially any user deposits from L1, a
set of deposit transaction-based upgrade transactions are deterministically generated by the derivation pipeline in the
following order:

* L1 Attributes Transaction (still calling the old `L1Block.setL1BlockValuesIsthmus()`)
* User deposits from L1 (if any)
* Network Upgrade Transactions
  * L1Block deployment
  * Update L1Block Proxy ERC-1967 Implementation
  * GasPriceOracle deployment
  * Update GasPriceOracle Proxy ERC-1967 Implementation
  * GasPriceOracle Enable Jovian call

The network upgrade transactions are specified in the next section.

## Network Upgrade Transactions

The upgrade transaction details below are based on the monorepo at commit hash
`b3299e0ddb55442e6496512084d16c439ea2da77`, and will be updated once a contracts release is made.

### L1Block Deployment

The `L1Block` contract is deployed.

A deposit transaction is derived with the following attributes:

* `from`: `0x4210000000000000000000000000000000000006`
* `to`: `null`
* `mint`: `0`
* `value`: `0`
* `nonce`: `0`
* `gasLimit`: `447315`
* `data`: `0x0x608060405234801561001057600080...`
* `sourceHash`: `0x98faf23b9795967bc0b1c543144739d50dba3ea40420e77ad6ca9848dbfb62e8`,
  computed with the "Upgrade-deposited" type, with `intent = "Jovian: L1Block Deployment"`

This results in the Jovian L1Block contract being deployed to
`0x3Ba4007f5C922FBb33C454B41ea7a1f11E83df2C`, to verify:

```bash theme={null}
cast compute-address --nonce=0 0x4210000000000000000000000000000000000006
Computed Address: 0x3Ba4007f5C922FBb33C454B41ea7a1f11E83df2C
```

Verify `sourceHash`:

```bash theme={null}
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Jovian: L1Block Deployment"))
# 0x98faf23b9795967bc0b1c543144739d50dba3ea40420e77ad6ca9848dbfb62e8
```

Verify `data`:

```bash theme={null}
git checkout 773798a67678ab28c3ef7ee3405f25c04616af19
make build-contracts
jq -r ".bytecode.object" packages/contracts-bedrock/forge-artifacts/L1Block.sol/L1Block.json
```

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

To verify the code hash:

```bash theme={null}
git checkout 773798a67678ab28c3ef7ee3405f25c04616af19
make build-contracts
cast k $(jq -r ".deployedBytecode.object" packages/contracts-bedrock/forge-artifacts/L1Block.sol/L1Block.json)
```

### L1Block Proxy Update

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`: `0x3659cfe60000000000000000000000003ba4007f5c922fbb33c454b41ea7a1f11e83df2c`
* `sourceHash`: `0x08447273a4fbce97bc8c515f97ac74efc461f6a4001553712f31ebc11288bad2`
  computed with the "Upgrade-deposited" type, with `intent = "Jovian: L1Block Proxy Update"`

Verify data:

```bash theme={null}
cast concat-hex $(cast sig "upgradeTo(address)") $(cast abi-encode "upgradeTo(address)" 0x3Ba4007f5C922FBb33C454B41ea7a1f11E83df2C)
# 0x3659cfe60000000000000000000000003ba4007f5c922fbb33c454b41ea7a1f11e83df2c
```

Verify `sourceHash`:

```bash theme={null}
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Jovian: L1Block Proxy Update"))
# 0x08447273a4fbce97bc8c515f97ac74efc461f6a4001553712f31ebc11288bad2
```

### GasPriceOracle Deployment

The `GasPriceOracle` contract is deployed.

A deposit transaction is derived with the following attributes:

* `from`: `0x4210000000000000000000000000000000000007`
* `to`: `null`
* `mint`: `0`
* `value`: `0`
* `nonce`: `0`
* `gasLimit`: `1750714`
* `data`: `0x0x608060405234801561001057600080...`
* `sourceHash`: `0xd939cca6eca7bd0ee0c7e89f7e5b5cf7bf6f7afe7b6966bb45dfb95344b31545`,
  computed with the "Upgrade-deposited" type, with `intent = "Jovian: GasPriceOracle Deployment"`

This results in the Jovian GasPriceOracle contract being deployed to
`0x4f1db3c6AbD250ba86E0928471A8F7DB3AFd88F1`, to verify:

```bash theme={null}
cast compute-address --nonce=0 0x4210000000000000000000000000000000000007
Computed Address: 0x4f1db3c6AbD250ba86E0928471A8F7DB3AFd88F1
```

Verify `sourceHash`:

```bash theme={null}
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Jovian: GasPriceOracle Deployment"))
# 0xd939cca6eca7bd0ee0c7e89f7e5b5cf7bf6f7afe7b6966bb45dfb95344b31545
```

Verify `data`:

```bash theme={null}
git checkout 773798a67678ab28c3ef7ee3405f25c04616af19
make build-contracts
jq -r ".bytecode.object" packages/contracts-bedrock/forge-artifacts/GasPriceOracle.sol/GasPriceOracle.json
```

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

To verify the code hash:

```bash theme={null}
git checkout 773798a67678ab28c3ef7ee3405f25c04616af19
make build-contracts
cast k $(jq -r ".deployedBytecode.object" packages/contracts-bedrock/forge-artifacts/GasPriceOracle.sol/GasPriceOracle.json)
```

### GasPriceOracle Proxy Update

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` (GasPriceOracle Proxy)
* `mint`: `0`
* `value`: `0`
* `gasLimit`: `50,000`
* `data`: `0x3659cfe60000000000000000000000004f1db3c6abd250ba86e0928471a8f7db3afd88f1`
* `sourceHash`: `0x46b597e2d8346ed7749b46734074361e0b41a0ab9af7afda5bb4e367e072bcb8`
  computed with the "Upgrade-deposited" type, with `intent = "Jovian: GasPriceOracle Proxy Update"`

Verify data:

```bash theme={null}
cast concat-hex $(cast sig "upgradeTo(address)") $(cast abi-encode "upgradeTo(address)" 0x4f1db3c6AbD250ba86E0928471A8F7DB3AFd88F1)
# 0x3659cfe60000000000000000000000004f1db3c6abd250ba86e0928471a8f7db3afd88f1
```

Verify `sourceHash`:

```bash theme={null}
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Jovian: GasPriceOracle Proxy Update"))
# 0x46b597e2d8346ed7749b46734074361e0b41a0ab9af7afda5bb4e367e072bcb8
```

### GasPriceOracle Enable Jovian

This transaction informs the GasPriceOracle to start using the Jovian operator fee 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`: `90,000`
* `data`: `0xb3d72079`
* `sourceHash`: `0xe836db6a959371756f8941be3e962d000f7e12a32e49e2c9ca42ba177a92716c`,\
  computed with the "Upgrade-deposited" type, with `intent = "Jovian: Gas Price Oracle Set Jovian"`

Verify data:

```bash theme={null}
cast sig "setJovian()"
# 0xb3d72079
```

Verify `sourceHash`:

```bash theme={null}
cast keccak $(cast concat-hex 0x0000000000000000000000000000000000000000000000000000000000000002 $(cast keccak "Jovian: Gas Price Oracle Set Jovian"))
# 0xe836db6a959371756f8941be3e962d000f7e12a32e49e2c9ca42ba177a92716c
```
