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

common: set the default hard fork to merge #2087

Merged
merged 4 commits into from
Aug 1, 2022
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
2 changes: 1 addition & 1 deletion packages/block/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface BlockOptions {
* Default: {@link Common} object set to `mainnet` and the HF currently defined as the default
* hardfork in the {@link Common} class.
*
* Current default hardfork: `london`
* Current default hardfork: `merge`
*/
common?: Common
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/integration/merge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tape('[Integration:Merge]', async (t) => {
},
],
},
{ baseChain: ChainCommon.Goerli }
{ baseChain: ChainCommon.Goerli, hardfork: Hardfork.London }
)
const commonPoW = Common.custom(
{
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/integration/miner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tape('[Integration:Miner]', async (t) => {
},
},
},
{ baseChain: ChainCommon.Goerli }
{ baseChain: ChainCommon.Goerli, hardfork: Hardfork.London }
)
const accounts: [Address, Buffer][] = [
[
Expand Down
6 changes: 3 additions & 3 deletions packages/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const common = new Common({ chain: 'mainnet', hardfork: 'london' })

If no hardfork is provided, the common is initialized with the default hardfork.

Current `DEFAULT_HARDFORK`: `Hardfork.London`
Current `DEFAULT_HARDFORK`: `Hardfork.Merge`

Here are some simple usage examples:

Expand Down Expand Up @@ -214,8 +214,8 @@ library supported:
- `istanbul` (`Hardfork.Instanbul`)
- `muirGlacier` (`Hardfork.MuirGlacier`)
- `berlin` (`Hardfork.Berlin`) (since `v2.2.0`)
- `london` (`Hardfork.London`) (`DEFAULT_HARDFORK`) (since `v2.4.0`)
- `merge` (`Hardfork.Merge`) (since `v2.5.0`)
- `london` (`Hardfork.London`) (since `v2.4.0`)
- `merge` (`Hardfork.Merge`) (`DEFAULT_HARDFORK`) (since `v2.5.0`)

### Future Hardforks

Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/chains/goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "goerli",
"chainId": 5,
"networkId": 5,
"defaultHardfork": "london",
"defaultHardfork": "merge",
"consensus": {
"type": "poa",
"algorithm": "clique",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/chains/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ropsten",
"chainId": 3,
"networkId": 3,
"defaultHardfork": "london",
"defaultHardfork": "merge",
"consensus": {
"type": "pow",
"algorithm": "ethash",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/chains/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sepolia",
"chainId": 11155111,
"networkId": 11155111,
"defaultHardfork": "london",
"defaultHardfork": "merge",
"consensus": {
"type": "pow",
"algorithm": "ethash",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class Common extends EventEmitter {
super()
this._customChains = opts.customChains ?? []
this._chainParams = this.setChain(opts.chain)
this.DEFAULT_HARDFORK = this._chainParams.defaultHardfork ?? Hardfork.London
this.DEFAULT_HARDFORK = this._chainParams.defaultHardfork ?? Hardfork.Merge
this._hardfork = this.DEFAULT_HARDFORK
if (isTruthy(opts.hardfork)) {
this.setHardfork(opts.hardfork)
Expand Down
3 changes: 2 additions & 1 deletion packages/evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ Currently the following hardfork rules are supported:
- `berlin` (`v5.2.0`+)
- `london` (`v5.4.0`+)
- `arrowGlacier` (only `mainnet`) (`v5.6.0`+)
- `merge` (only `goerli`, `ropsten` and soon `mainnet`)

Default: `london` (taken from `Common.DEFAULT_HARDFORK`)
Default: `merge` (taken from `Common.DEFAULT_HARDFORK`)

A specific hardfork EVM ruleset can be activated by passing in the hardfork
along the `Common` instance to the outer `@ethereumjs/vm` instance.
Expand Down
2 changes: 1 addition & 1 deletion packages/tx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ All types of transaction objects are frozen with `Object.freeze()` which gives y

The `Transaction` constructor receives a parameter of an [`@ethereumjs/common`](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common) object that lets you specify the chain and hardfork to be used. If there is no `Common` provided the chain ID provided as a paramter on typed tx or the chain ID derived from the `v` value on signed EIP-155 conforming legacy txs will be taken (introduced in `v3.2.1`). In other cases the chain defaults to `mainnet`.

Base default HF (determined by `Common`): `london`
Base default HF (determined by `Common`): `merge`

Starting with `v3.2.1` the tx library now deviates from the default HF for typed tx using the following rule: "The default HF is the default HF from `Common` if the tx type is active on that HF. Otherwise it is set to the first greater HF where the tx is active."

Expand Down
2 changes: 1 addition & 1 deletion packages/tx/src/baseTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export abstract class BaseTransaction<TransactionObject> {
*
* @hidden
*/
protected DEFAULT_HARDFORK: string | Hardfork = Hardfork.London
protected DEFAULT_HARDFORK: string | Hardfork = Hardfork.Merge

constructor(txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData, opts: TxOptions) {
const { nonce, gasLimit, to, value, data, v, r, s, type } = txData
Expand Down
4 changes: 2 additions & 2 deletions packages/vm/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface VMOpts {
* ### Possible Values
*
* - `chain`: all chains supported by `Common` or a custom chain
* - `hardfork`: `mainnet` hardforks up to the `London` hardfork
* - `hardfork`: `mainnet` hardforks up to the `Merge` hardfork
* - `eips`: `2537` (usage e.g. `eips: [ 2537, ]`)
*
* Note: check the associated `@ethereumjs/evm` instance options
Expand All @@ -77,7 +77,7 @@ export interface VMOpts {
* Default setup if no `Common` instance is provided:
*
* - `chain`: `mainnet`
* - `hardfork`: `london`
* - `hardfork`: `merge`
* - `eips`: `[]`
*/
common?: Common
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/tests/tester/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const DEFAULT_TESTS_PATH = path.resolve('../ethereum-tests')
/**
* Default hardfork rules to run tests against
*/
export const DEFAULT_FORK_CONFIG = 'London'
export const DEFAULT_FORK_CONFIG = 'Merge'

/**
* Tests which should be fixed
Expand Down