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

EIP-2294: Explicit bound to Chain ID size #2294

Open
fubuloubu opened this issue Sep 20, 2019 · 0 comments

Comments

@fubuloubu
Copy link
Member

commented Sep 20, 2019

eip: 2294
title: Explicit bound to Chain ID size
author: Bryant Eisenbach (@fubuloubu), Alex Beregszaszi (@axic)
discussions-to: <URL>
status: Draft
type: Standards Track
category: Core
created: 2019-09-19
requires: EIP-155

Simple Summary

Adds a maximum value to the EIP-155 Chain ID parameter to avoid potential encoding issues that may occur when using large values of the parameter.

Abstract

This EIP restricts the size of EIP-155 Chain ID parameter to a particular maximum value, 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 EIP-1344 (comment) 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.

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.

Test Cases

Aleth PR

Implementation

TBD

Copyright

Copyright and related rights waived via CC0.

@fubuloubu fubuloubu changed the title EIP-XXX: Explicit bound to Chain ID size EIP-2294: Explicit bound to Chain ID size Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.