forked from ethereum/EIPs
-
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.
Add EIP-2294: Explicit bound to Chain ID size (ethereum#5728)
* init chainidsize EIP pr * Recover the content from ethereum#2294 * EIP formating * EIP formatting * Update authost list and add credt * Move to Review * Update EIPS/eip-2294.md Co-authored-by: Pandapip1 <[email protected]> * Update EIPS/eip-2294.md Co-authored-by: Pandapip1 <[email protected]> * Update EIPS/eip-2294.md Co-authored-by: Pandapip1 <[email protected]> * Update eip-2294.md * Update eip-2294.md Co-authored-by: Pandapip1 <[email protected]>
- Loading branch information
1 parent
bfe7e95
commit fa10891
Showing
1 changed file
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
eip: 2294 | ||
title: Explicit bound to Chain ID size | ||
description: Adds a maximum value to the Chain ID parameter to avoid potential encoding issues that may occur when using large values of the parameter. | ||
author: Zainan Victor Zhou (@xinbenlv), Alex Beregszaszi (@axic) | ||
discussions-to: https://ethereum-magicians.org/t/eip-2294-explicit-bound-to-chain-id/11090 | ||
status: Draft | ||
type: Standards Track | ||
category: Core | ||
created: 2019-09-19 | ||
requires: 155 | ||
--- | ||
|
||
## Abstract | ||
This EIP restricts the size of the [EIP-155](./eip-155.md) Chain ID parameter to a particular maximum value `floor(MAX_UINT64 / 2) - 36`, in order to ensure that there is a standard around how this parameter is to be used between different projects. | ||
|
||
## Motivation | ||
EIP-155 introduces the Chain ID parameter, which is an important parameter used for domain separation (replay protection) of Ethereum protocol signed messages. However, it does not specify any properties about the size that this parameter takes. @axic mentions this concern in the 109th comment of [EIP-1344](./eip-1344.md)'s `discussion-to` | ||
|
||
> Allowing it to be 256-bit wide means that the RLP encoding of a transaction must use >256-bit arithmetic to calculate the v field. | ||
<-- | ||
TODO(xinbenlv): clean up motivation by splitting rationale of design decisions from motivation above. | ||
--> | ||
|
||
and suggests a reasonable maximum enforced size in order to ensure that there are no issues when encoding this parameter. This would allow a sufficient amount of different values for this parameter, which is typically chosen by community consensus as a genesis parameter for a given chain and thus does not change often. | ||
|
||
There have been suggestions of using a hash-based identifier in place on Chain ID to allow the value to adapt over time to different contentious forks and other scenarios. This proposal does not describe this behavior, but ~63 bits of entropy should be enough to ensure that no collisions are likely for reasonable (e.g. non-malicious) uses of this feature for that purpose. | ||
|
||
Originally, this EIP was created by Bryant Eisenbach (@fubuloubu) and Alex Beregszaszi (@axic). | ||
|
||
## Specification | ||
The maximum value of Chain ID is `9,223,372,036,854,775,771` (`MAX_CHAIN_ID`). This value is `floor(MAX_UINT64 / 2) - 36`, and is chosen to avoid overflow when performing uint64 math. For reference, a value of 0 or less is also disallowed. | ||
|
||
A client should reject a value outside of this range in a provided transaction, and disallow a genesis configuration with a value for Chain ID outside of this limit. Due to how the calculation for chain ID is performed, the maximum value seen during the arithmetic is `CHAIN_ID * 2 + 36`, so clients must test to ensure no overflow conditions are encountered when the highest value is used. No underflow is possible. | ||
|
||
## Rationale | ||
Without a well-chosen value of Chain ID, there could be differences in the implementation of EIP-155 (and EIP-1344 by derivative) in both client codebase and external tooling that could lead to consensus-critical vulnerabilities being introduced to the network. By making this limit explicit, we avoid this scenario for Ethereum and any project which uses the Ethereum codebase. | ||
|
||
## Backwards Compatibility | ||
This EIP introduces a change that affects previous implementations of this feature. However, since no known chain makes use of a value outside of the suggested bounds, there should not be an issue in adopting this limit on the size of this parameter, therefore the impact should be non-existent. | ||
|
||
## Security Considerations | ||
Needs discussion. | ||
|
||
## Copyright | ||
Copyright and related rights waived via [CC0](../LICENSE.md). |