Skip to content

Commit

Permalink
Merge branch 'master' into block-consensus-methods-refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
scorbajio authored Aug 7, 2024
2 parents 37fea1f + 12eb962 commit 1187d33
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
5 changes: 4 additions & 1 deletion packages/block/test/eip4844block.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ describe('blob gas tests', () => {
blobGasPerBlob = common.param('blobGasPerBlob')
})
it('should work', () => {
const preShardingHeader = createBlockHeader({})
const preShardingHeader = createBlockHeader(
{},
{ common: new Common({ chain: Mainnet, hardfork: Hardfork.Shanghai }) },
)

let excessBlobGas = preShardingHeader.calcNextExcessBlobGas()
assert.equal(
Expand Down
4 changes: 3 additions & 1 deletion packages/client/test/execution/vmexecution.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ describe('[VMExecution]', () => {
engine: true,
})

const block = await createBlockFromExecutionPayload(shanghaiPayload as ExecutionPayload)
const block = await createBlockFromExecutionPayload(shanghaiPayload as ExecutionPayload, {
common: new Common({ chain: Mainnet, hardfork: Hardfork.Shanghai }),
})
const oldHead = await blockchain.getIteratorHead()

const parentStateRoot = oldHead.header.stateRoot
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ChainConfig } from './types.js'
export const Mainnet: ChainConfig = {
name: 'mainnet',
chainId: 1,
defaultHardfork: 'shanghai',
defaultHardfork: 'cancun',
consensus: {
type: 'pow',
algorithm: 'ethash',
Expand Down Expand Up @@ -156,7 +156,7 @@ export const Mainnet: ChainConfig = {
export const Goerli: ChainConfig = {
name: 'goerli',
chainId: 5,
defaultHardfork: 'shanghai',
defaultHardfork: 'cancun',
consensus: {
type: 'poa',
algorithm: 'clique',
Expand Down Expand Up @@ -317,7 +317,7 @@ export const Goerli: ChainConfig = {
export const Sepolia: ChainConfig = {
name: 'sepolia',
chainId: 11155111,
defaultHardfork: 'shanghai',
defaultHardfork: 'cancun',
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 @@ -61,7 +61,7 @@ export class Common {
this.events = new EventEmitter()

this._chainParams = opts.chain
this.DEFAULT_HARDFORK = this._chainParams.defaultHardfork ?? Hardfork.Shanghai
this.DEFAULT_HARDFORK = this._chainParams.defaultHardfork ?? Hardfork.Cancun
// Assign hardfork changes in the sequence of the applied hardforks
this.HARDFORK_CHANGES = this.hardforks().map((hf) => [
hf.name,
Expand Down
2 changes: 1 addition & 1 deletion packages/common/test/chains.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('[Common/Chains]: Initialization / Chain params', () => {
const c = new Common({ chain: Mainnet })
assert.equal(c.chainName(), 'mainnet', 'should initialize with chain name')
assert.equal(c.chainId(), BigInt(1), 'should return correct chain Id')
assert.equal(c.hardfork(), Hardfork.Shanghai, 'should set hardfork to current default hardfork')
assert.equal(c.hardfork(), Hardfork.Cancun, 'should set hardfork to current default hardfork')
assert.equal(
c.hardfork(),
c.DEFAULT_HARDFORK,
Expand Down
4 changes: 2 additions & 2 deletions packages/common/test/customChains.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ describe('[Common]: Custom chains', () => {
},
Mainnet,
)
// Note: default HF of Common is currently Shanghai
// Note: default HF of Common is currently Cancun
// Did not pass any "hardfork" param
assert.equal(c.hardfork(), Hardfork.Shanghai)
assert.equal(c.hardfork(), Hardfork.Cancun)
c.setHardforkBy({
blockNumber: 0,
})
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/test/api/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('VM -> basic instantiation / boolean switches', () => {
KECCAK256_RLP,
'it has default trie',
)
assert.equal(vm.common.hardfork(), Hardfork.Shanghai, 'it has correct default HF')
assert.equal(vm.common.hardfork(), Hardfork.Cancun, 'it has correct default HF')
})

it('should be able to activate precompiles', async () => {
Expand Down

0 comments on commit 1187d33

Please sign in to comment.