Skip to content
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

Remove Union from ExecutionPayload transaction type #2684

Merged
merged 2 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion presets/mainnet/merge.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Mainnet preset - The Merge

# No presets here.
# Execution
# ---------------------------------------------------------------
# 2**20 (= 1,048,576)
MAX_BYTES_PER_TRANSACTION: 1048576
# 2**14 (= 16,384)
MAX_TRANSACTIONS_PER_PAYLOAD: 16384
# 2**8 (= 256)
BYTES_PER_LOGS_BLOOM: 256
# 2**10 (= 1,024)
GAS_LIMIT_DENOMINATOR: 1024
# 5,000
MIN_GAS_LIMIT: 5000
# 2**5 (= 32)
MAX_EXTRA_DATA_BYTES: 32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't BYTES_PER_LOGS_BLOOM and MAX_EXTRA_DATA_BYTES be constant values disregarding the network, i.e. out of the scope of any configuration, even the preset one?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine. Presets offer compile-time configuration for clients that want to optimize usage of these and/or use static typing. They are not configurable per network, unless the testnet warrants a customized preset and clients compile with that. Flexible enough if we ever need a network that changes them, but not part of the default runtime config. See config/preset docs for more info.

15 changes: 14 additions & 1 deletion presets/minimal/merge.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Minimal preset - The Merge

# No presets here.
# Execution
# ---------------------------------------------------------------
# 2**20 (= 1,048,576)
MAX_BYTES_PER_TRANSACTION: 1048576
# 2**14 (= 16,384)
MAX_TRANSACTIONS_PER_PAYLOAD: 16384
# 2**8 (= 256)
BYTES_PER_LOGS_BLOOM: 256
# 2**10 (= 1,024)
GAS_LIMIT_DENOMINATOR: 1024
# 5,000
MIN_GAS_LIMIT: 5000
# 2**5 (= 32)
MAX_EXTRA_DATA_BYTES: 32
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def imports(cls, preset_name: str):
return super().imports(preset_name) + f'''
from typing import Protocol
from eth2spec.altair import {preset_name} as altair
from eth2spec.utils.ssz.ssz_typing import Bytes8, Bytes20, ByteList, ByteVector, uint256, Union
from eth2spec.utils.ssz.ssz_typing import Bytes8, Bytes20, ByteList, ByteVector, uint256
'''

@classmethod
Expand Down Expand Up @@ -543,7 +543,7 @@ def get_payload(self: ExecutionEngine, payload_id: PayloadId) -> ExecutionPayloa
@classmethod
def hardcoded_custom_type_dep_constants(cls) -> str:
constants = {
'MAX_BYTES_PER_OPAQUE_TRANSACTION': 'uint64(2**20)',
'MAX_BYTES_PER_TRANSACTION': 'uint64(2**20)',
}
return {**super().hardcoded_custom_type_dep_constants(), **constants}

Expand Down
5 changes: 2 additions & 3 deletions specs/merge/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ This patch adds transaction execution to the beacon chain as part of the Merge f

| Name | SSZ equivalent | Description |
| - | - | - |
| `OpaqueTransaction` | `ByteList[MAX_BYTES_PER_OPAQUE_TRANSACTION]` | a [typed transaction envelope](https://eips.ethereum.org/EIPS/eip-2718#opaque-byte-array-rather-than-an-rlp-array) structured as `TransactionType \|\| TransactionPayload` |
| `Transaction` | `Union[OpaqueTransaction]` | a transaction |
| `Transaction` | `ByteList[MAX_BYTES_PER_TRANSACTION]` | either a [typed transaction envelope](https://eips.ethereum.org/EIPS/eip-2718#opaque-byte-array-rather-than-an-rlp-array) or a legacy transaction|
| `ExecutionAddress` | `Bytes20` | Address of account on the execution layer |

## Constants
Expand All @@ -60,7 +59,7 @@ This patch adds transaction execution to the beacon chain as part of the Merge f

| Name | Value |
| - | - |
| `MAX_BYTES_PER_OPAQUE_TRANSACTION` | `uint64(2**20)` (= 1,048,576) |
| `MAX_BYTES_PER_TRANSACTION` | `uint64(2**20)` (= 1,048,576) |
| `MAX_TRANSACTIONS_PER_PAYLOAD` | `uint64(2**14)` (= 16,384) |
| `BYTES_PER_LOGS_BLOOM` | `uint64(2**8)` (= 256) |
| `GAS_LIMIT_DENOMINATOR` | `uint64(2**10)` (= 1,024) |
Expand Down