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: Chain Refactor #3545

Merged
merged 47 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a088bd5
Reduce Common chain option to ChainDict, remove all conversion functi…
holgerd77 Jul 26, 2024
c5e696f
Adjust tx, remove chain ID infering, fix a lot of tests
holgerd77 Jul 26, 2024
6cb429b
Merge branch 'master' into common-chain-refactor
holgerd77 Jul 26, 2024
aafc37c
Merge remote-tracking branch 'origin/master' into common-chain-refactor
acolytec3 Jul 29, 2024
a2950d1
replace chain.Mainnet with Mainnet [no ci]
acolytec3 Jul 29, 2024
8fab9c7
add preconfig chain util
acolytec3 Jul 29, 2024
3793b55
various fixes
acolytec3 Jul 29, 2024
dc486c4
Lots of client test fixes [no ci]
acolytec3 Jul 29, 2024
ff16012
Remove edits [no ci]
acolytec3 Jul 29, 2024
1408f16
Always add trace to tests
acolytec3 Jul 29, 2024
002e3a9
remove console log
acolytec3 Jul 29, 2024
ba190e2
more test fixes [no ci]
acolytec3 Jul 29, 2024
b4493bd
Fix blockchain tests
acolytec3 Jul 29, 2024
30580dc
fix block tests
acolytec3 Jul 29, 2024
b3e676f
fix devp2p tests
acolytec3 Jul 29, 2024
d082f31
fix ethash tests
acolytec3 Jul 29, 2024
3163201
fix evm tests
acolytec3 Jul 29, 2024
851f3d8
some sm fixes
acolytec3 Jul 29, 2024
6ca851a
lots o vm test fixes [no ci]
acolytec3 Jul 29, 2024
7f59280
fix verkle tests
acolytec3 Jul 29, 2024
350a034
many client test fixes
acolytec3 Jul 29, 2024
e0344be
more client test fixes [no ci]
acolytec3 Jul 29, 2024
177645e
half fixed
acolytec3 Jul 29, 2024
beaa077
yet more fixes
acolytec3 Jul 30, 2024
3c605b4
fix benchmarks
acolytec3 Jul 30, 2024
0be16fa
add defaults
acolytec3 Jul 30, 2024
c4beeea
remove unnecessary parsing
acolytec3 Jul 30, 2024
6ea208f
fix vmexecution test
acolytec3 Jul 30, 2024
fe8f45e
activate all sendRawTransaction tests
acolytec3 Jul 30, 2024
333a097
fix examples [no ci]
acolytec3 Jul 31, 2024
b287bdc
Merge remote-tracking branch 'origin/master' into common-chain-refactor
acolytec3 Jul 31, 2024
9e90c2d
lint [no ci]
acolytec3 Jul 31, 2024
b34511d
Merge branch 'master' into common-chain-refactor
jochem-brouwer Jul 31, 2024
e216820
block: fix header tests
jochem-brouwer Jul 31, 2024
475be17
client: fix some sendRawTx tests
jochem-brouwer Jul 31, 2024
6e24613
tx: partial 4844 fix
jochem-brouwer Jul 31, 2024
507b85b
client: eth: fix param reads from tx
jochem-brouwer Jul 31, 2024
d5eed95
client/tests: cli remove it.only
jochem-brouwer Jul 31, 2024
c4bdcb2
fix param parsing
acolytec3 Jul 31, 2024
f09809d
lint
acolytec3 Jul 31, 2024
3df0520
fix custom chain ops
acolytec3 Jul 31, 2024
4525142
fix test
acolytec3 Jul 31, 2024
341fad3
one more
acolytec3 Jul 31, 2024
e301f04
update createCustomCommon docs
acolytec3 Jul 31, 2024
1a38eb2
really fix test
acolytec3 Jul 31, 2024
729846c
test fix
acolytec3 Jul 31, 2024
ab09903
change kill to sigterm
acolytec3 Jul 31, 2024
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
13 changes: 5 additions & 8 deletions packages/common/examples/common.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import { Chain, Common, Hardfork, createCustomCommon } from '@ethereumjs/common'
import { Common, Hardfork, Mainnet, createCustomCommon } from '@ethereumjs/common'

// With enums:
const commonWithEnums = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.London })

// (also possible with directly passing in strings:)
const commonWithStrings = new Common({ chain: 'mainnet', hardfork: 'london' })
const commonWithEnums = new Common({ chain: Mainnet, hardfork: Hardfork.London })

// Instantiate with the chain (and the default hardfork)
let c = new Common({ chain: Chain.Mainnet })
let c = new Common({ chain: Mainnet })

// Get bootstrap nodes for chain/network
console.log('Below are the known bootstrap nodes')
console.log(c.bootstrapNodes()) // Array with current nodes

// Instantiate with an EIP activated
c = new Common({ chain: Chain.Mainnet, eips: [4844] })
c = new Common({ chain: Mainnet, eips: [4844] })
console.log(`EIP 4844 is active -- ${c.isActivatedEIP(4844)}`)

// Instantiate common with custom chainID
const commonWithCustomChainId = createCustomCommon({ chainId: 1234 })
const commonWithCustomChainId = createCustomCommon({ chainId: 1234 }, Mainnet)
console.log(`The current chain ID is ${commonWithCustomChainId.chainId}`)
4 changes: 2 additions & 2 deletions packages/common/examples/customCrypto.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createBlockFromBlockData } from '@ethereumjs/block'
import { Chain, Common } from '@ethereumjs/common'
import { Common, Mainnet } from '@ethereumjs/common'
import { keccak256, waitReady } from '@polkadot/wasm-crypto'

const main = async () => {
// @polkadot/wasm-crypto specific initialization
await waitReady()

const common = new Common({ chain: Chain.Mainnet, customCrypto: { keccak256 } })
const common = new Common({ chain: Mainnet, customCrypto: { keccak256 } })
const block = createBlockFromBlockData({}, { common })

// Method invocations within EthereumJS library instantiations where the common
Expand Down
4 changes: 2 additions & 2 deletions packages/common/examples/initKzg.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Chain, Common, Hardfork } from '@ethereumjs/common'
import { Common, Hardfork, Mainnet } from '@ethereumjs/common'
import { loadKZG } from 'kzg-wasm'

const main = async () => {
const kzg = await loadKZG()
const common = new Common({
chain: Chain.Mainnet,
chain: Mainnet,
hardfork: Hardfork.Cancun,
customCrypto: { kzg },
})
Expand Down
Loading
Loading