You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add embedme dev dependency to root package.json
* Rebuild package-lock.json
* Add examples:build script to package.json (Block)
* Integrate first exemplary Block example
* Replace typescript marker for markdown code embeds with ts (working alternative + embedme compatible)
* Add missing examples for block
* Add Util package examples, expand README with dedicated module sections and examples
* Flesh out 4844 example
Copy file name to clipboardExpand all lines: packages/block/CHANGELOG.md
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -58,14 +58,14 @@ The Shanghai hardfork is now the default HF in `@ethereumjs/common` and therefor
58
58
59
59
Also the Merge HF has been renamed to Paris (`Hardfork.Paris`) which is the correct HF name on the execution side, see [#2652](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2652). To set the HF to Paris in Common you can do:
const common =newCommon({ chain: Chain.Mainnet, hardfork: Hardfork.Paris })
64
64
```
65
65
66
66
And third on hardforks 🙂: the upcoming Cancun hardfork is now fully supported and all EIPs are included (see PRs [#2659](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2659) and [#2892](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2892)). The Cancun HF can be activated with:
const common =newCommon({ chain: Chain.Mainnet, hardfork: Hardfork.Cancun })
71
71
```
@@ -78,7 +78,7 @@ Our APIs to (re-)set a a hardfork within a library had grown old over all change
78
78
79
79
We therefore removed the outdated `getHardforkByBlockNumber()` and `setHardforkByBlockNumber()` methods in `@ethereumjs/common` (artificially expanded with the option to also pass a `TD` or `timestamp`) with a more adequate `hardforkBy()` method flexibly taking in the adequate value type for a HF change, see PR [#2798](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2798):
80
80
81
-
```typescript
81
+
```ts
82
82
common.setHardforkBy({ blockNumber: 5000000n }) // Setting a mainnet common to a Block from `Byzantium` (and so: to `Byzantium` HF)
83
83
common.setHardforkBy({ timestamp: 1681340000n }) // Setting a mainnet common to a post-Shanghai timestamp
84
84
common.setHardforkBy({ blockNumber, timestamp }) // Setting a common with to a not pre-known HF using both block number and timestamp
@@ -94,14 +94,14 @@ We have cleaned up and unified the validation methods in the `Block` library, se
94
94
95
95
The `Block.validateTransactions()` method, previously overloaded with different return types depending on the input, has been split up into:
96
96
97
-
```typescript
97
+
```ts
98
98
Block.transactionsAreValid(): boolean
99
99
Block.getTransactionsValidationErrors(): string[]
100
100
```
101
101
102
102
Other renamings:
103
103
104
-
```typescript
104
+
```ts
105
105
Block.validateTransactionsTrie(): Promise<boolean>// old
106
106
Block.transactionsTrieIsValid(): Promise<boolean>// new
107
107
@@ -124,7 +124,7 @@ The global initialization method for the KZG setup has been moved to a dedicated
124
124
125
125
The `initKZG()` method can be used as follows:
126
126
127
-
```typescript
127
+
```ts
128
128
// Make the kzg library available globally
129
129
import*askzgfrom'c-kzg'
130
130
import { initKZG } from'@ethereumjs/util'
@@ -141,7 +141,7 @@ For the Block library the most significant change is that there is now a new hea
141
141
142
142
Additionally there are the following three `dataGasUsed`/`excessDataGas` related new helper methods:
143
143
144
-
```typescript
144
+
```ts
145
145
BlockHeader.getDataGasPrice(): bigint
146
146
BlockHeader.calcDataFee(numBlobs: number): bigint
147
147
BlockHeader.calcNextExcessDataGas(): bigint
@@ -157,7 +157,7 @@ Two new handy constructors have been added to the `Block` class to bring the con
157
157
158
158
`Block.fromBeaconPayloadJson()` allows to initialize an Ethereum execution layer (EL) block with a payload received from the beacon chain (consensus layer (CL)) via an RPC call. 🤩 The new constructor can be used as follows:
159
159
160
-
```typescript
160
+
```ts
161
161
const block =awaitBlock.fromBeaconPayloadJson(payload, { common })
162
162
```
163
163
@@ -173,14 +173,14 @@ Both builds have respective separate entrypoints in the distributed `package.jso
173
173
174
174
A CommonJS import of our libraries can then be done like this:
175
175
176
-
```typescript
176
+
```ts
177
177
const { Chain, Common } =require('@ethereumjs/common')
178
178
const common =newCommon({ chain: Chain.Mainnet })
179
179
```
180
180
181
181
And this is how an ESM import looks like:
182
182
183
-
```typescript
183
+
```ts
184
184
import { Chain, Common } from'@ethereumjs/common'
185
185
const common =newCommon({ chain: Chain.Mainnet })
186
186
```
@@ -199,7 +199,7 @@ We nevertheless think this is very much worth it and we tried to make transition
199
199
200
200
For this library you should check if you use one of the following constructors, methods, constants or types and do a search and update input and/or output values or general usages and add conversion methods if necessary:
const common =newCommon({ chain: Chain.Mainnet, hardfork: Hardfork.Shanghai, eips: [4844] })
@@ -304,7 +304,7 @@ This release comes with experimental [EIP-4895](https://eips.ethereum.org/EIPS/e
304
304
305
305
Withdrawals support can be activated by initializing a respective `Common` object, here is an example for a `Block` object initialization:
306
306
307
-
```typescript
307
+
```ts
308
308
import { Block } from'@ethereumjs/block'
309
309
import { Common, Chain } from'@ethereumjs/common'
310
310
import { Address } from'@ethereumjs/util'
@@ -351,7 +351,7 @@ For lots of custom chains (for e.g. devnets and testnets), you might come across
351
351
352
352
`Common` now has a new constructor `Common.fromGethGenesis()` - see PRs [#2300](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2300) and [#2319](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2319) - which can be used in following manner to instantiate for example a VM run or a tx with a `genesis.json` based Common:
353
353
354
-
```typescript
354
+
```ts
355
355
import { Common } from'@ethereumjs/common'
356
356
// Load geth genesis json file into lets say `genesisJson` and optional `chain` and `genesisHash`
357
357
const common =Common.fromGethGenesis(genesisJson, { chain: 'customChain', genesisHash })
@@ -410,7 +410,7 @@ This means that if this library is instantiated without providing an explicit `C
410
410
411
411
If you want to prevent these kind of implicit HF switches in the future it is likely a good practice to just always do your upper-level library instantiations with a `Common` instance setting an explicit HF, e.g.:
const common =newCommon({ chain: Chain.Mainnet, hardfork: Hardfork.Merge })
@@ -489,7 +489,7 @@ This means that a Block object instantiated without providing an explicit `Commo
489
489
490
490
If you want to prevent these kind of implicit HF switches in the future it is likely a good practice to just always do your upper-level library instantiations with a `Common` instance setting an explicit HF, e.g.:
const common =newCommon({ chain: Chain.Mainnet, hardfork: Hardfork.Merge })
@@ -719,7 +719,7 @@ Source files from the `src` folder are now included in the distribution build, s
719
719
720
720
This `Block` release comes with full functional support for the `london` hardfork (all EIPs are finalized and integrated and `london` HF can be activated, there are no final block numbers for the HF integrated though yet). Please note that the default HF is still set to `istanbul`. You therefore need to explicitly set the `hardfork` parameter for instantiating a `Common` instance with a `london` HF activated:
721
721
722
-
```typescript
722
+
```ts
723
723
import { BN } from'ethereumjs-util'
724
724
import { Block } from'@ethereumjs/block'
725
725
importCommonfrom'@ethereumjs/common'
@@ -767,7 +767,7 @@ This release gets the `Block` library ready for the `berlin` HF by adding suppor
767
767
768
768
Please note that the default HF is still set to `istanbul`. You therefore need to explicitly set the `hardfork` parameter for instantiating a `Block` instance with a `berlin` HF activated:
769
769
770
-
```typescript
770
+
```ts
771
771
import { Block } from'ethereumjs-block'
772
772
importCommonfrom'@ethereumjs/common'
773
773
const common =newCommon({ chain: 'mainnet', hardfork: 'berlin' })
@@ -797,7 +797,7 @@ This release introduces Clique/PoA support for the `Block` library, see the main
797
797
798
798
For sealing a block on instantiation there is a new `cliqueSigner` constructor option:
0 commit comments