diff --git a/package-lock.json b/package-lock.json index f60e95c3e6..e5ac9976fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16596,14 +16596,14 @@ }, "packages/block": { "name": "@ethereumjs/block", - "version": "5.2.0", + "version": "5.3.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { @@ -16615,15 +16615,15 @@ }, "packages/blockchain": { "name": "@ethereumjs/blockchain", - "version": "7.2.0", + "version": "7.3.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", "lru-cache": "10.1.0" @@ -16637,24 +16637,24 @@ }, "packages/client": { "name": "@ethereumjs/client", - "version": "0.10.1", + "version": "0.10.2", "hasInstallScript": true, "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "5.2.0", - "@ethereumjs/blockchain": "7.2.0", - "@ethereumjs/common": "4.3.0", - "@ethereumjs/devp2p": "6.1.2", - "@ethereumjs/ethash": "3.0.3", - "@ethereumjs/evm": "3.0.0", - "@ethereumjs/genesis": "0.2.2", + "@ethereumjs/block": "5.3.0", + "@ethereumjs/blockchain": "7.3.0", + "@ethereumjs/common": "4.4.0", + "@ethereumjs/devp2p": "6.1.3", + "@ethereumjs/ethash": "3.0.4", + "@ethereumjs/evm": "3.1.0", + "@ethereumjs/genesis": "0.2.3", "@ethereumjs/rlp": "5.0.2", - "@ethereumjs/statemanager": "2.3.0", - "@ethereumjs/trie": "6.2.0", - "@ethereumjs/tx": "5.3.0", - "@ethereumjs/util": "9.0.3", - "@ethereumjs/verkle": "^0.0.2", - "@ethereumjs/vm": "8.0.0", + "@ethereumjs/statemanager": "2.4.0", + "@ethereumjs/trie": "6.2.1", + "@ethereumjs/tx": "5.4.0", + "@ethereumjs/util": "9.1.0", + "@ethereumjs/verkle": "^0.1.0", + "@ethereumjs/vm": "8.1.0", "@js-sdsl/ordered-map": "^4.4.2", "@multiformats/multiaddr": "^12.2.1", "@polkadot/util": "^12.6.2", @@ -16768,10 +16768,10 @@ }, "packages/common": { "name": "@ethereumjs/common", - "version": "4.3.0", + "version": "4.4.0", "license": "MIT", "dependencies": { - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { @@ -16781,12 +16781,12 @@ }, "packages/devp2p": { "name": "@ethereumjs/devp2p", - "version": "6.1.2", + "version": "6.1.3", "license": "MIT", "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@scure/base": "^1.1.7", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", @@ -16795,8 +16795,8 @@ "snappyjs": "^0.6.1" }, "devDependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/tx": "^5.3.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/tx": "^5.4.0", "@types/debug": "^4.1.9", "@types/k-bucket": "^5.0.0", "chalk": "^4.1.2", @@ -16808,17 +16808,17 @@ }, "packages/ethash": { "name": "@ethereumjs/ethash", - "version": "3.0.3", + "version": "3.0.4", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "^5.2.0", + "@ethereumjs/block": "^5.3.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "bigint-crypto-utils": "^3.2.2", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { - "@ethereumjs/common": "^4.3.0" + "@ethereumjs/common": "^4.4.0" }, "engines": { "node": ">=18" @@ -16826,13 +16826,13 @@ }, "packages/evm": { "name": "@ethereumjs/evm", - "version": "3.0.0", + "version": "3.1.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/statemanager": "^2.3.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/statemanager": "^2.4.0", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "@noble/curves": "^1.5.0", "@types/debug": "^4.1.9", "debug": "^4.3.3", @@ -16874,14 +16874,14 @@ }, "packages/genesis": { "name": "@ethereumjs/genesis", - "version": "0.2.2", + "version": "0.2.3", "license": "MIT", "dependencies": { - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/util": "^9.0.3" + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/util": "^9.1.0" }, "devDependencies": { - "@ethereumjs/trie": "^6.2.0" + "@ethereumjs/trie": "^6.2.1" }, "engines": { "node": ">=18" @@ -16903,21 +16903,21 @@ }, "packages/statemanager": { "name": "@ethereumjs/statemanager", - "version": "2.3.0", + "version": "2.4.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/util": "^9.1.0", "@js-sdsl/ordered-map": "^4.4.2", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", "lru-cache": "10.1.0" }, "devDependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/genesis": "^0.2.2", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/genesis": "^0.2.3", "@types/debug": "^4.1.9", "rustbn-wasm": "^0.4.0", "verkle-cryptography-wasm": "^0.4.5" @@ -16925,18 +16925,18 @@ }, "packages/trie": { "name": "@ethereumjs/trie", - "version": "6.2.0", + "version": "6.2.1", "license": "MPL-2.0", "dependencies": { "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@types/readable-stream": "^2.3.13", "debug": "^4.3.4", "ethereum-cryptography": "^2.2.1", "lru-cache": "10.1.0" }, "devDependencies": { - "@ethereumjs/genesis": "^0.2.2", + "@ethereumjs/genesis": "^0.2.3", "@types/benchmark": "^1.0.33", "abstract-level": "^1.0.3", "level": "^8.0.0", @@ -16953,12 +16953,12 @@ }, "packages/tx": { "name": "@ethereumjs/tx", - "version": "5.3.0", + "version": "5.4.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { @@ -16974,7 +16974,7 @@ }, "packages/util": { "name": "@ethereumjs/util", - "version": "9.0.3", + "version": "9.1.0", "license": "MPL-2.0", "dependencies": { "@ethereumjs/rlp": "^5.0.2", @@ -16989,12 +16989,12 @@ }, "packages/verkle": { "name": "@ethereumjs/verkle", - "version": "0.0.2", + "version": "0.1.0", "license": "MIT", "dependencies": { - "@ethereumjs/block": "^5.2.0", + "@ethereumjs/block": "^5.3.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.4", "lru-cache": "10.1.0", "verkle-cryptography-wasm": "^0.4.5" @@ -17005,18 +17005,18 @@ }, "packages/vm": { "name": "@ethereumjs/vm", - "version": "8.0.0", + "version": "8.1.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/blockchain": "^7.2.0", - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/evm": "^3.0.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/blockchain": "^7.3.0", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/evm": "^3.1.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/statemanager": "^2.3.0", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/statemanager": "^2.4.0", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1" }, @@ -17041,10 +17041,10 @@ }, "packages/wallet": { "name": "@ethereumjs/wallet", - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "dependencies": { - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@scure/base": "^1.1.7", "ethereum-cryptography": "^2.2.1", "js-md5": "^0.8.3", diff --git a/packages/block/CHANGELOG.md b/packages/block/CHANGELOG.md index 24392469be..f2dc4d8ec0 100644 --- a/packages/block/CHANGELOG.md +++ b/packages/block/CHANGELOG.md @@ -6,7 +6,188 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 5.2.0 - 2024-03-05 +## 5.3.0 - 2024-08-15 + +### Blocks with EIP-7685 Consensus Layer Requests + +Starting with this release this library supports requests to the consensus layer (see PRs [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372) and [#3393](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3393)) which have been introduced with [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) and will come into play for deposit and withdrawal requests along the upcoming [Prague](https://eips.ethereum.org/EIPS/eip-7600) hardfork. + +#### EIP-6110 Deposit Requests + +[EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) introduces deposit requests allowing beacon chain deposits being triggered from the execution layer, see PRs [#3390](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3390) and [#3397](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3397). Starting with this release this library supports deposit requests and a containing block can be instantiated as follows: + +```ts +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + DepositRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const depositRequestData = { + pubkey: randomBytes(48), + withdrawalCredentials: randomBytes(32), + amount: bytesToBigInt(randomBytes(8)), + signature: randomBytes(96), + index: bytesToBigInt(randomBytes(8)), + } + const request = DepositRequest.fromRequestData(depositRequestData) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various deposit request parameters. + +#### EIP-7002 Withdrawal Requests + +[EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) introduces the possibility for validators to trigger exits and partial withdrawals via the execution layer, see PR [#3385](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3385). Starting with this release this library supports withdrawal requests and a containing block can be instantiated as follows: + +```ts +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + randomBytes, + WithdrawalRequest, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const withdrawalRequestData = { + sourceAddress: randomBytes(20), + validatorPubkey: randomBytes(48), + amount: bytesToBigInt(randomBytes(8)), + } + const request = WithdrawalRequest.fromRequestData( + withdrawalRequestData, + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } withdrawal request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various withdrawal request parameters. + +#### EIP-7251 Consolidation Requests + +[EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) introduces consolidation requests allowing staked ETH from more than one validator on the beacon chain to be consolidated into one validator, triggered from the execution layer, see PR [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477). Starting with this release this library supports consolidation requests and a containing block can be instantiated as follows: + +```ts +// ./examples/7251Requests.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + ConsolidationRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const consolidationRequestData = { + sourceAddress: randomBytes(20), + sourcePubkey: randomBytes(48), + targetPubkey: randomBytes(48), + } + const request = ConsolidationRequest.fromRequestData( + consolidationRequestData, + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } consolidation request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various deposit request parameters. + +### Verkle Updates + +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) +- Fix the block body parsing as well as save/load from blockchain, PR [#3392](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3392) +- Verkle type/interface refactoring (moved to Common package), PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) + +### Other Features + +- New `Block.toExecutionPayload()` method to map to the execution payload structure from the beacon chain, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Make EIP-4895 withdrawals trie check consistent with tx trie, PR [#3338](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3338) +- Rename deposit receipt to deposit request, PR [#3408](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3408) +- Enhances typing of CL requests, PR [#3398](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3398) +- Rename withdrawal request's `validatorPublicKey` to `validatorPubkey`, PR [#3474](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3474) + +## 5.2.0 - 2024-03-18 ### Full 4844 Browser Readiness @@ -417,14 +598,14 @@ const block = Block.fromBlockData( header: { withdrawalsRoot: Buffer.from( '69f28913c562b0d38f8dc81e72eb0d99052444d301bf8158dc1f3f94a4526357', - 'hex' + 'hex', ), }, withdrawals: [withdrawal], }, { common, - } + }, ) ``` @@ -511,7 +692,7 @@ const block = Block.fromBlockData( { // Provide your block data here or use default values }, - { common } + { common }, ) ``` @@ -590,7 +771,7 @@ const block = Block.fromBlockData( { // Provide your block data here or use default values }, - { common } + { common }, ) ``` @@ -720,7 +901,7 @@ const block = Block.fromBlockData( { // Provide your block data here or use default values }, - { common } + { common }, ) ``` @@ -775,7 +956,7 @@ const block = Block.fromBlockData( { // Provide your block data here or use default values }, - { common } + { common }, ) ``` @@ -826,7 +1007,7 @@ const block = Block.fromBlockData( gasUsed: new BN(60), }, }, - { common } + { common }, ) // Base fee will increase for next block since the @@ -983,7 +1164,7 @@ const header = BlockHeader.fromHeaderData(headerData) ```ts const serialized = Buffer.from( 'f901f7a06bfee7294bf44572b7266358e627f3c35105e1c3851f3de09e6d646f955725a7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200000f837a120080845d20ab8080a00000000000000000000000000000000000000000000000000000000000000000880000000000000000', - 'hex' + 'hex', ) const header = BlockHeader.fromRLPSerializedHeader(serialized) ``` @@ -1191,7 +1372,7 @@ const header = BlockHeader.fromHeaderData(headerData) ```ts const serialized = Buffer.from( 'f901f7a06bfee7294bf44572b7266358e627f3c35105e1c3851f3de09e6d646f955725a7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200000f837a120080845d20ab8080a00000000000000000000000000000000000000000000000000000000000000000880000000000000000', - 'hex' + 'hex', ) const header = BlockHeader.fromRLPSerializedHeader(serialized) ``` diff --git a/packages/block/README.md b/packages/block/README.md index 9d05978685..c78a8be8ac 100644 --- a/packages/block/README.md +++ b/packages/block/README.md @@ -89,7 +89,7 @@ const block = Block.fromBlockData( gasUsed: BigInt(60), }, }, - { common } + { common }, ) // Base fee will increase for next block since the @@ -106,7 +106,7 @@ const blockWithMatchingBaseFee = Block.fromBlockData( gasUsed: BigInt(60), }, }, - { common } + { common }, ) console.log(Number(blockWithMatchingBaseFee.header.baseFeePerGas)) // 11 @@ -139,14 +139,14 @@ const block = Block.fromBlockData( { header: { withdrawalsRoot: hexToBytes( - '0x69f28913c562b0d38f8dc81e72eb0d99052444d301bf8158dc1f3f94a4526357' + '0x69f28913c562b0d38f8dc81e72eb0d99052444d301bf8158dc1f3f94a4526357', ), }, withdrawals: [withdrawal], }, { common, - } + }, ) console.log(`Block with ${block.withdrawals!.length} withdrawal(s) created`) @@ -184,7 +184,7 @@ const main = async () => { }) const blobTx = BlobEIP4844Transaction.fromTxData( { blobsData: ['myFirstBlob'], to: Address.fromPrivateKey(randomBytes(32)) }, - { common } + { common }, ) const block = Block.fromBlockData( @@ -197,13 +197,13 @@ const main = async () => { { common, skipConsensusFormatValidation: true, - } + }, ) console.log( `4844 block header with excessBlobGas=${block.header.excessBlobGas} created and ${ block.transactions.filter((tx) => tx.type === 3).length - } blob transactions` + } blob transactions`, ) } @@ -212,6 +212,168 @@ main() **Note:** Working with blob transactions needs a manual KZG library installation and global initialization, see [KZG Setup](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) for instructions. +### Blocks with EIP-7685 Consensus Layer Requests + +Starting with v5.3.0 this library supports requests to the consensus layer which have been introduced with [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) and will come into play for deposit and withdrawal requests along the upcoming [Prague](https://eips.ethereum.org/EIPS/eip-7600) hardfork. + +#### EIP-6110 Deposit Requests + +[EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) introduces deposit requests allowing beacon chain deposits being triggered from the execution layer. Starting with v5.3.0 this library supports deposit requests and a containing block can be instantiated as follows: + +```ts +// ./examples/6110Requests.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + DepositRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Cancun, + eips: [7685, 4788], + }) + + const depositRequestData = { + pubkey: randomBytes(48), + withdrawalCredentials: randomBytes(32), + amount: bytesToBigInt(randomBytes(8)), + signature: randomBytes(96), + index: bytesToBigInt(randomBytes(8)), + } + const request = DepositRequest.fromRequestData(depositRequestData) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various deposit request parameters. + +#### EIP-7002 Withdrawal Requests + +[EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) introduces the possibility for validators to trigger exits and partial withdrawals via the execution layer. Starting with v5.3.0 this library supports withdrawal requests and a containing block can be instantiated as follows: + +```ts +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + randomBytes, + WithdrawalRequest, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const withdrawalRequestData = { + sourceAddress: randomBytes(20), + validatorPubkey: randomBytes(48), + amount: bytesToBigInt(randomBytes(8)), + } + const request = WithdrawalRequest.fromRequestData( + withdrawalRequestData, + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } withdrawal request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various withdrawal request parameters. + +#### EIP-7251 Consolidation Requests + +[EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) introduces consolidation requests allowing staked ETH from more than one validator on the beacon chain to be consolidated into one validator, triggered from the execution layer. Starting with v5.3.0 this library supports consolidation requests and a containing block can be instantiated as follows: + +```ts +// ./examples/7251Requests.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + ConsolidationRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const consolidationRequestData = { + sourceAddress: randomBytes(20), + sourcePubkey: randomBytes(48), + targetPubkey: randomBytes(48), + } + const request = ConsolidationRequest.fromRequestData( + consolidationRequestData, + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } consolidation request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various deposit request parameters. + ### Consensus Types The block library supports the creation as well as consensus format validation of PoW `ethash` and PoA `clique` blocks (so e.g. do specific `extraData` checks on Clique/PoA blocks). @@ -297,7 +459,7 @@ const block = Block.fromBlockData( { // Provide your block data here or use default values }, - { common } + { common }, ) console.log(`Proof-of-Stake (default) block created with hardfork=${block.common.hardfork()}`) diff --git a/packages/block/examples/6110Requests.ts b/packages/block/examples/6110Requests.ts new file mode 100644 index 0000000000..ff7019b676 --- /dev/null +++ b/packages/block/examples/6110Requests.ts @@ -0,0 +1,42 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + DepositRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const depositRequestData = { + pubkey: randomBytes(48), + withdrawalCredentials: randomBytes(32), + amount: bytesToBigInt(randomBytes(8)), + signature: randomBytes(96), + index: bytesToBigInt(randomBytes(8)), + } + const request = DepositRequest.fromRequestData(depositRequestData) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } deposit request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() diff --git a/packages/block/examples/7002Requests.ts b/packages/block/examples/7002Requests.ts new file mode 100644 index 0000000000..07886c1579 --- /dev/null +++ b/packages/block/examples/7002Requests.ts @@ -0,0 +1,42 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + randomBytes, + WithdrawalRequest, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const withdrawalRequestData = { + sourceAddress: randomBytes(20), + validatorPubkey: randomBytes(48), + amount: bytesToBigInt(randomBytes(8)), + } + const request = WithdrawalRequest.fromRequestData( + withdrawalRequestData, + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } withdrawal request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() diff --git a/packages/block/examples/7251Requests.ts b/packages/block/examples/7251Requests.ts new file mode 100644 index 0000000000..e4ecb97d85 --- /dev/null +++ b/packages/block/examples/7251Requests.ts @@ -0,0 +1,42 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + ConsolidationRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const consolidationRequestData = { + sourceAddress: randomBytes(20), + sourcePubkey: randomBytes(48), + targetPubkey: randomBytes(48), + } + const request = ConsolidationRequest.fromRequestData( + consolidationRequestData, + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common }, + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } consolidation request, requestTrieValid=${await block.requestsTrieIsValid()}`, + ) +} + +main() diff --git a/packages/block/package.json b/packages/block/package.json index 4591a64184..1674ce9c57 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/block", - "version": "5.2.0", + "version": "5.3.0", "description": "Provides Block serialization and help functions", "keywords": [ "ethereum", @@ -47,11 +47,11 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { diff --git a/packages/block/src/block/block.ts b/packages/block/src/block/block.ts index a5521a7d35..eeefa59cd6 100644 --- a/packages/block/src/block/block.ts +++ b/packages/block/src/block/block.ts @@ -536,6 +536,12 @@ export class Block { } } + /** + * Maps the block properties to the execution payload structure from the beacon chain, + * see https://github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/beacon-chain.md#ExecutionPayload + * + * @returns dict with the execution payload parameters with camel case naming + */ toExecutionPayload(): ExecutionPayload { const blockJson = this.toJSON() const header = blockJson.header! diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index c5c5d84484..78dde08dc6 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -6,7 +6,25 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 7.2.0 - 2024-03-05 +## 7.3.0 - 2024-08-15 + +### EIP-7685 Requests: EIP-6110 (Deposits) / EIP-7002 (Withdrawals) / EIP-7251 (Consolidations) + +This library now supports `EIP-6110` deposit requests, see PR [#3390](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3390), `EIP-7002` withdrawal requests, see PR [#3385](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3385) and `EIP-7251` consolidation requests, see PR [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477) as well as the underlying generic execution layer request logic introduced with `EIP-7685` (PR [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372)). + +These new request types will be activated with the `Prague` hardfork, see [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) README for detailed documentation. + +### Verkle Updates + +- Fix the block body parsing as well as save/load from blockchain, PR [#3392](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3392) +- Handle nil block bodies for backwards compatibility, PR [#3394](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3394) + +### Other Features + +- Support for EIP-7685 blocks containing withdrawal and/or deposit requests (see @ethereumjs/block for main documentation), PR [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +## 7.2.0 - 2024-03-18 ### Full 4844 Browser Readiness diff --git a/packages/blockchain/README.md b/packages/blockchain/README.md index 8fbd1a09d6..1bae18a2b3 100644 --- a/packages/blockchain/README.md +++ b/packages/blockchain/README.md @@ -61,7 +61,7 @@ const main = async () => { difficulty: blockchain.genesisBlock.header.difficulty + 1n, }, }, - { common, setHardfork: true } + { common, setHardfork: true }, ) const block2 = Block.fromBlockData( { @@ -71,7 +71,7 @@ const main = async () => { difficulty: block.header.difficulty + 1n, }, }, - { common, setHardfork: true } + { common, setHardfork: true }, ) // See @ethereumjs/block for more details on how to create a block await blockchain.putBlock(block) @@ -157,7 +157,7 @@ const main = async () => { const genesisBlockHash = blockchain.genesisBlock.hash() common.setForkHashes(genesisBlockHash) console.log( - `Genesis hash from geth genesis parameters - ${bytesToHex(blockchain.genesisBlock.hash())}` + `Genesis hash from geth genesis parameters - ${bytesToHex(blockchain.genesisBlock.hash())}`, ) } @@ -180,6 +180,14 @@ The blockchain library now allows for blob transactions to be validated and incl **Note:** Working with blob transactions needs a manual KZG library installation and global initialization, see [KZG Setup](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) for instructions. +### EIP-7685 Requests Support + +This libary supports blocks including the following [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) requests: + +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Deposit Requests (`v7.3.0`+) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Withdrawal Requests (`v7.3.0`+) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Consolidation Requests (`v7.3.0`+) + ## Browser With the breaking release round in Summer 2023 we have added hybrid ESM/CJS builds for all our libraries (see section below) and have eliminated many of the caveats which had previously prevented a frictionless browser usage. diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index 05478ccba1..ed2b367178 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/blockchain", - "version": "7.2.0", + "version": "7.3.0", "description": "A module to store and interact with blocks", "keywords": [ "ethereum", @@ -47,12 +47,12 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", "lru-cache": "10.1.0" diff --git a/packages/client/CHANGELOG.md b/packages/client/CHANGELOG.md index 4af9204427..7c6ceff4d8 100644 --- a/packages/client/CHANGELOG.md +++ b/packages/client/CHANGELOG.md @@ -6,7 +6,50 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 0.10.1 - 2024-03-05 +## 0.10.2 - 2024-08-15 + +This release comes with some RPC improvements as well as various updates to catch up for testnets preparing for the Prague hardfork as well as the Verkle tree integration. Note that for running/participating in the latest Prague and Verkle testnets it is still needed to join with a build from `master` since testnets are evolving so quickly that it is not practical to catch up with official client releases! + +### Verkle Updates + +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- CLI option `--ignoreStatelessInvalidExecs` for Verkle debugging, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) +- Simplify `--ignoreStatelessInvalidExecs` to just a boolean flag, PR [#3395](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3395) +- Add verkle execution support to `executeBlocks()`, PR [#3406](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3406) +- Verkle decoupling in underlying libraries, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) + +### Other Features + +- Integrates support for [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions (outdated) (see tx library for full documentation), see PR [#3470](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3470) +- New `--startExectionFrom` and `--startExecution` CLI options, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Add `eth_blobBaseFee` RPC endpoint, PR [#3436](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3436) +- Add support for `pending` in `eth_getTransactionCount` RPC method, PR [#3415](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3415) +- Add support for multiple sources of rlp blocks when loading with `--loadBlocksFromRlp`, PR [#3442](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3442) +- Basic Prometheus metrics support (not many metrics yet), PR [#3287](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3287) + +### Other Changes + +- ESM-only client build, PRs [#3359](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3359) and [#3414](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3414) +- Add execution api v4 handling to engine, PR [#3399](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3399) +- New mechanism to keep latest block from peers updated, PR [#3354](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3354) +- Better `--execution` flag guard, PR [#3363](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3363) +- Stricter prefixed hex typing, PR [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348) +- Update `multiaddress` dependency, PR [#3384](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3384) +- Internalize `QHeap` dependency, PR [#3451](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3451) +- Internalize `jwt-simple` dependency, PR [#3458](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3458) + +### Bugfixes + +- Fixes for the `eth_estimateGas` RPC endpoint, PR [#3416](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3416) +- Fixes tx status in `eth_getTransactionReceipt` RPC method, PR [#3435](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3435) +- Fixes the "block to payload" serialization for `getPayloadV4`, PR [#3409](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3409) +- Fix the `getPayloadV4` with a deposit tx and expected deposit requests, PR [#3410](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3410) + +## 0.10.1 - 2024-03-18 This is mainly a maintenance release coming with a few internal changes and minor bug fixes, single user-focused addition is the support for the `eth_feeHistory` RPC call. diff --git a/packages/client/README.md b/packages/client/README.md index 42465bb9ba..0557861cd0 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -307,7 +307,7 @@ dist/bin/cli.js --d ## Metrics -The client can optionally collect metrics using the Prometheus metrics platform and expose them via an HTTP endpoint with the following CLI flags. +The client can optionally collect metrics using the [Prometheus](https://github.com/prometheus/prometheus) metrics platform and expose them via an HTTP endpoint with the following CLI flags. The current metrics that are reported by the client can be found at the default port and route: `localhost:8000/metrics`. ```sh diff --git a/packages/client/package.json b/packages/client/package.json index 96a12eff64..7ce4024f63 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/client", - "version": "0.10.1", + "version": "0.10.2", "description": "EthereumJS Execution Layer (EL) Client Implementation", "keywords": [ "ethereum", @@ -55,20 +55,20 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "5.2.0", - "@ethereumjs/blockchain": "7.2.0", - "@ethereumjs/common": "4.3.0", - "@ethereumjs/devp2p": "6.1.2", - "@ethereumjs/ethash": "3.0.3", - "@ethereumjs/evm": "3.0.0", - "@ethereumjs/genesis": "0.2.2", + "@ethereumjs/block": "5.3.0", + "@ethereumjs/blockchain": "7.3.0", + "@ethereumjs/common": "4.4.0", + "@ethereumjs/devp2p": "6.1.3", + "@ethereumjs/ethash": "3.0.4", + "@ethereumjs/evm": "3.1.0", + "@ethereumjs/genesis": "0.2.3", "@ethereumjs/rlp": "5.0.2", - "@ethereumjs/statemanager": "2.3.0", - "@ethereumjs/trie": "6.2.0", - "@ethereumjs/tx": "5.3.0", - "@ethereumjs/util": "9.0.3", - "@ethereumjs/verkle": "^0.0.2", - "@ethereumjs/vm": "8.0.0", + "@ethereumjs/statemanager": "2.4.0", + "@ethereumjs/trie": "6.2.1", + "@ethereumjs/tx": "5.4.0", + "@ethereumjs/util": "9.1.0", + "@ethereumjs/verkle": "^0.1.0", + "@ethereumjs/vm": "8.1.0", "@js-sdsl/ordered-map": "^4.4.2", "@multiformats/multiaddr": "^12.2.1", "@polkadot/util": "^12.6.2", diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 617fc94dea..9f62741271 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -6,7 +6,39 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 4.3.0 - 2024-03-05 +## 4.4.0 - 2024-08-15 + +### EIP-7685 Requests: EIP-6110 (Deposits) / EIP-7002 (Withdrawals) / EIP-7251 (Consolidations) + +This library now supports `EIP-6110` deposit requests, see PR [#3390](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3390), `EIP-7002` withdrawal requests, see PR [#3385](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3385) and `EIP-7251` consolidation requests, see PR [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477) as well as the underlying generic execution layer request logic introduced with `EIP-7685` (PR [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372)). + +These new request types will be activated with the `Prague` hardfork, see [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) README for detailed documentation. + +### Verkle Updates + +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Verkle decoupling, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) + +### Other Features + +- Adds support for [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions (outdated) (see tx library for full documentation), see PR [#3470](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3470) +- Adds support for [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) Serve Historical Block Hashes from State (Prague) (see EVM for full docs) as well as the related [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709), PR [#3475](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3475) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Removes support for [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) simple subroutines for EVM (deprecated with an alternative version integrated into EOF), PR [#3342](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3342) +- Clean up access to deposit address, PR [#3411](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3411) +- Add spec test for 2935 contract code and update history storage address, PR [#3373](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3373) +- Parse deposit contract address from geth genesis for chain config, PR [#3422](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3422) + +### Bugfixes + +- BLS gas prices fixes, PR [#3400](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3400) + +## 4.3.0 - 2024-03-18 ### Full 4844 Browser Readiness diff --git a/packages/common/README.md b/packages/common/README.md index 1124468ef7..d0cad1bd89 100644 --- a/packages/common/README.md +++ b/packages/common/README.md @@ -405,11 +405,10 @@ The following EIPs are currently supported: - [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) - Transient storage opcodes (Cancun) - [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Fee market change for ETH 1.0 chain -- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) - Simple subroutines for the EVM (`outdated`) - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) - Transaction Types -- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Save historical block hashes in state (`experimental`) +- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague) - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type - [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) - AUTH and AUTHCALL opcodes @@ -431,8 +430,14 @@ The following EIPs are currently supported: - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai) - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier) - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun) +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Supply validator deposits on chain (Prague) - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable withdrawals (Prague) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Execution layer triggerable validator consolidations (Prague) +- [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - EOA code transactions (Prague) (`outdated`) +- [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Osaka) - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) +- [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) ### Bootstrap Nodes diff --git a/packages/common/package.json b/packages/common/package.json index 7e817c1f8d..bc9fc72af1 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/common", - "version": "4.3.0", + "version": "4.4.0", "description": "Resources common to all Ethereum implementations", "keywords": [ "ethereum", @@ -57,7 +57,7 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { diff --git a/packages/devp2p/CHANGELOG.md b/packages/devp2p/CHANGELOG.md index 17ffa2d4e5..0d87820eda 100644 --- a/packages/devp2p/CHANGELOG.md +++ b/packages/devp2p/CHANGELOG.md @@ -6,7 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 6.1.2 - 2024-03-05 +## 6.1.3 - 2024-08-15 + +Maintenance release with downstream dependency updates, see PR [#3527](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3527) + +## 6.1.2 - 2024-03-18 - Fix a type error related to the `lru-cache` dependency, PR [#3285](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3285) - Downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/devp2p/package.json b/packages/devp2p/package.json index 2665112bf0..88c2e2afe8 100644 --- a/packages/devp2p/package.json +++ b/packages/devp2p/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/devp2p", - "version": "6.1.2", + "version": "6.1.3", "description": "A JavaScript implementation of ÐΞVp2p", "keywords": [ "ethereum", @@ -59,9 +59,9 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@scure/base": "^1.1.7", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", @@ -70,8 +70,8 @@ "snappyjs": "^0.6.1" }, "devDependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/tx": "^5.3.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/tx": "^5.4.0", "@types/debug": "^4.1.9", "@types/k-bucket": "^5.0.0", "chalk": "^4.1.2", diff --git a/packages/ethash/CHANGELOG.md b/packages/ethash/CHANGELOG.md index e6e3a6159c..464f316b23 100644 --- a/packages/ethash/CHANGELOG.md +++ b/packages/ethash/CHANGELOG.md @@ -6,7 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 3.0.3 - 2024-03-05 +## 3.0.4 - 2024-08-15 + +Maintenance release with downstream dependency updates, see PR [#3527](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3527) + +## 3.0.3 - 2024-03-18 Maintenance release with downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/ethash/package.json b/packages/ethash/package.json index df473dcc59..1e51df3b78 100644 --- a/packages/ethash/package.json +++ b/packages/ethash/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/ethash", - "version": "3.0.3", + "version": "3.0.4", "description": "An implementation of the Ethash consensus algorithm in JavaScript", "keywords": [ "ethash", @@ -46,14 +46,14 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "^5.2.0", + "@ethereumjs/block": "^5.3.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "bigint-crypto-utils": "^3.2.2", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { - "@ethereumjs/common": "^4.3.0" + "@ethereumjs/common": "^4.4.0" }, "engines": { "node": ">=18" diff --git a/packages/evm/CHANGELOG.md b/packages/evm/CHANGELOG.md index d88163ffa6..d24c8d91a4 100644 --- a/packages/evm/CHANGELOG.md +++ b/packages/evm/CHANGELOG.md @@ -6,7 +6,58 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 3.0.0 - 2024-03-05 +## 3.1.0 - 2024-08-15 + +### EIP-2537 BLS Precompiles (Prague) + +Starting with this release the EVM support the BLS precompiles introduced with [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537). These precompiles run natively using the [@noble/curves](https://github.com/paulmillr/noble-curves) library (❤️ to `@paulmillr`!), see PRs [#3350](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3350) and [#3471](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3471). + +An alternative WASM implementation (using [bls-wasm](https://github.com/herumi/bls-wasm)) can be optionally used like this if needed for performance reasons: + +```ts +import { EVM, MCLBLS } from '@ethereumjs/evm' + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Prague }) +await mcl.init(mcl.BLS12_381) +const mclbls = new MCLBLS(mcl) +const evm = await EVM.create({ common, bls }) +``` + +### Verkle Dependency Decoupling + +We have relatively light-heartedly added a new `@ethereumjs/verkle` main dependency to the VM/EVM stack in the `v7.2.1` release, which added an additional burden to the bundle size by several hundred KB and additionally draws in unnecessary WASM code. Coupling with Verkle has been refactored in PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) and the direct dependency has been removed again. + +An update to this release is therefore strongly recommended even if other fixes or features are not that relevant for you right now. + +### Verkle Updates + +- Adds ability to run [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions (see tx library for full documentation), see PR [#3470](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3470) +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) +- Fix `accessWitness` passing, PR [#3405](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3405) +- Remove the hacks to prevent account cleanups of system contracts, PR [#3418](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3418) +- Fix EIP-2935 address conversion issues, PR [#3447](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3447) + +### Other Features + +- Add support for retroactive [EIP-7610](https://eips.ethereum.org/EIPS/eip-7610), PR [#3480](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3480) +- Adds bundle visualizer (to be used with `npm run visualize:bundle`), PR [#3463](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3463) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Removes support for [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) simple subroutines for EVM (deprecated with an alternative version integrated into EOF), PR [#3342](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3342) +- Update `mcl-wasm` Dependency (Esbuild Issue), PR [#3461](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3461) + +### Bugfixes + +- BLS precompile fixes, PR [#3400](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3400) +- Ignore precompile addresses for some target access events, PR [#3366](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3366) + +## 3.0.0 - 2024-03-18 ### New EVM.create() Async Static Constructor @@ -2015,7 +2066,7 @@ vm.runTx( // Handle errors appropriately } // Do something with the result - } + }, ) ``` diff --git a/packages/evm/README.md b/packages/evm/README.md index 1537ecde9b..3045606161 100644 --- a/packages/evm/README.md +++ b/packages/evm/README.md @@ -97,6 +97,59 @@ void main() Additionally this usage example shows the use of events to listen on the inner workings and procedural updates (`step` event) of the EVM. +### Precompiles + +This library support all EVM precompiles up to the `Prague` hardfork. + +The following code allows to run precompiles in isolation, e.g. for testing purposes: + +```ts +// ./examples/precompile.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EVM, getActivePrecompiles } from '@ethereumjs/evm' +import { bytesToHex, hexToBytes } from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Prague }) + + // Taken from test/eips/precompiles/bls/add_G1_bls.json + const data = hexToBytes( + '0x0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21', + ) + const gasLimit = BigInt(5000000) + + const evm = await EVM.create({ common }) + const precompile = getActivePrecompiles(common).get('000000000000000000000000000000000000000b')! + + const callData = { + data, + gasLimit, + common, + _EVM: evm, + } + const result = await precompile(callData) + console.log(`Precompile result:${bytesToHex(result.returnValue)}`) +} + +main() +``` + +### EIP-2537 BLS Precompiles (Prague) + +Starting with `v3.1.0` the EVM support the BLS precompiles introduced with [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537). These precompiles run natively using the [@noble/curves](https://github.com/paulmillr/noble-curves) library (❤️ to `@paulmillr`!). + +An alternative WASM implementation (using [bls-wasm](https://github.com/herumi/bls-wasm)) can be optionally used like this if needed for performance reasons: + +```ts +import { EVM, MCLBLS } from '@ethereumjs/evm' + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Prague }) +await mcl.init(mcl.BLS12_381) +const mclbls = new MCLBLS(mcl) +const evm = await EVM.create({ common, bls }) +``` + ## Examples This projects contain the following examples: @@ -218,11 +271,10 @@ Currently supported EIPs: - [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) - Transient storage opcodes (Cancun) - [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Fee market change for ETH 1.0 chain -- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) - Simple subroutines for the EVM (`outdated`) - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) - Transaction Types -- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Save historical block hashes in state (`experimental`) +- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague) - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type - [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) - AUTH and AUTHCALL opcodes @@ -244,8 +296,14 @@ Currently supported EIPs: - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai) - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier) - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun) +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Supply validator deposits on chain (Prague) - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable withdrawals (Prague) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Execution layer triggerable validator consolidations (Prague) +- [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - EOA code transactions (Prague) (`outdated`) +- [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Osaka) - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) +- [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) ### WASM Crypto Support diff --git a/packages/evm/docs/interfaces/EVMOpts.md b/packages/evm/docs/interfaces/EVMOpts.md index dacab84ccd..8ae2b12c6b 100644 --- a/packages/evm/docs/interfaces/EVMOpts.md +++ b/packages/evm/docs/interfaces/EVMOpts.md @@ -67,11 +67,10 @@ Use a Common instance for EVM instantiation. - [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) - Transient storage opcodes (Cancun) - [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Fee market change for ETH 1.0 chain -- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) - Simple subroutines for the EVM (`outdated`) - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2565) - Transaction Types -- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Save historical block hashes in state (`experimental`) +- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague) - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type - [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) - AUTH and AUTHCALL opcodes @@ -93,8 +92,14 @@ Use a Common instance for EVM instantiation. - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai) - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier) - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun) +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-5656) - Supply validator deposits on chain (Prague) - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable withdrawals (Prague) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Execution layer triggerable validator consolidations (Prague) +- [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - EOA code transactions (Prague) (`outdated`) +- [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Osaka) - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) +- [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) *Annotations:* diff --git a/packages/evm/examples/precompile.ts b/packages/evm/examples/precompile.ts new file mode 100644 index 0000000000..dc81bee8b5 --- /dev/null +++ b/packages/evm/examples/precompile.ts @@ -0,0 +1,27 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EVM, getActivePrecompiles } from '@ethereumjs/evm' +import { bytesToHex, hexToBytes } from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Prague }) + + // Taken from test/eips/precompiles/bls/add_G1_bls.json + const data = hexToBytes( + '0x0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21', + ) + const gasLimit = BigInt(5000000) + + const evm = await EVM.create({ common }) + const precompile = getActivePrecompiles(common).get('000000000000000000000000000000000000000b')! + + const callData = { + data, + gasLimit, + common, + _EVM: evm, + } + const result = await precompile(callData) + console.log(`Precompile result:${bytesToHex(result.returnValue)}`) +} + +main() diff --git a/packages/evm/package.json b/packages/evm/package.json index a6cc3f5d97..793af7a204 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/evm", - "version": "3.0.0", + "version": "3.1.0", "description": "JavaScript Ethereum Virtual Machine (EVM) implementation", "keywords": [ "ethereum", @@ -56,10 +56,10 @@ "visualize:bundle": "npx vite build --config=./vite.config.bundler.ts --emptyOutDir=false --outDir ." }, "dependencies": { - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/statemanager": "^2.3.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/statemanager": "^2.4.0", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "@noble/curves": "^1.5.0", "@types/debug": "^4.1.9", "debug": "^4.3.3", diff --git a/packages/evm/src/types.ts b/packages/evm/src/types.ts index b5c0dac660..b359d1c69f 100644 --- a/packages/evm/src/types.ts +++ b/packages/evm/src/types.ts @@ -188,7 +188,7 @@ export interface EVMOpts { * - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) * - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost * - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2565) - Transaction Types - * - [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Save historical block hashes in state (`experimental`) + * - [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague) * - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes * - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type * - [EIP-3198](https://eips.ethereum.org/EIPS/eip-3198) - Base fee Opcode @@ -206,11 +206,17 @@ export interface EVMOpts { * - [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399) - Supplant DIFFICULTY opcode with PREVRANDAO (Merge) * - [EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) - Beacon block root in the EVM (Cancun) * - [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) - Shard Blob Transactions (Cancun) + * - [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - EOA code transactions (Prague) (`outdated`) + * - [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Osaka) * - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai) * - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier) * - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun) + * - [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Supply validator deposits on chain (Prague) * - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun) + * - [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable withdrawals (Prague) + * - [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Execution layer triggerable validator consolidations (Prague) * - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) + * - [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) * * *Annotations:* * @@ -281,7 +287,7 @@ export interface EVMOpts { customPrecompiles?: CustomPrecompile[] /** - * For the EIP-2935 BLS precompiles, the native JS `@noble/curves` + * For the EIP-2537 BLS Precompiles, the native JS `@noble/curves` * https://github.com/paulmillr/noble-curves BLS12-381 curve implementation * is used (see `noble.ts` file in the `precompiles/bls12_381/` folder). * diff --git a/packages/genesis/CHANGELOG.md b/packages/genesis/CHANGELOG.md index cdd07f8f6f..c76dfeebcc 100644 --- a/packages/genesis/CHANGELOG.md +++ b/packages/genesis/CHANGELOG.md @@ -6,7 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 0.2.2 - 2024-03-05 +## 0.2.3 - 2024-08-15 + +Maintenance release with downstream dependency updates, see PR [#3527](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3527) + +## 0.2.2 - 2024-03-18 Maintenance release with downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/genesis/package.json b/packages/genesis/package.json index 804470346b..e77e8d9a14 100644 --- a/packages/genesis/package.json +++ b/packages/genesis/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/genesis", - "version": "0.2.2", + "version": "0.2.3", "description": "A module to provide genesis states of well known networks", "keywords": [ "ethereum", @@ -59,13 +59,13 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/util": "^9.0.3" + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/util": "^9.1.0" }, "engines": { "node": ">=18" }, "devDependencies": { - "@ethereumjs/trie": "^6.2.0" + "@ethereumjs/trie": "^6.2.1" } } diff --git a/packages/statemanager/CHANGELOG.md b/packages/statemanager/CHANGELOG.md index 9d0c5069cc..64d53faf01 100644 --- a/packages/statemanager/CHANGELOG.md +++ b/packages/statemanager/CHANGELOG.md @@ -6,7 +6,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 2.3.0 - 2024-03-05 +## 2.4.0 - 2024-08-15 + +### Verkle Updates + +- Various fixes for Kaustinen4 support (partial account integration, `getContractCodeSize()`, other), PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Missing beaconroot account verkle fix, PR [#3421](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3421) +- Verkle decoupling, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) + +### Other Features + +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Modify RPCStateManager `getAccount()`, PR [#3345](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3345) + +### Bugfixes + +- Fixes an issue where under certain deployment conditions wrong storage values could be provided, PR [#3434](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3434) +- Fixes statemanager empty code bug, PR [#3483](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3483) + +## 2.3.0 - 2024-03-18 ### Full 4844 Browser Readiness diff --git a/packages/statemanager/package.json b/packages/statemanager/package.json index 3a1318c323..11f5aa9b53 100644 --- a/packages/statemanager/package.json +++ b/packages/statemanager/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/statemanager", - "version": "2.3.0", + "version": "2.4.0", "description": "An Ethereum statemanager implementation", "keywords": [ "ethereum", @@ -50,18 +50,18 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/util": "^9.1.0", "@js-sdsl/ordered-map": "^4.4.2", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", "lru-cache": "10.1.0" }, "devDependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/genesis": "^0.2.2", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/genesis": "^0.2.3", "@types/debug": "^4.1.9", "rustbn-wasm": "^0.4.0", "verkle-cryptography-wasm": "^0.4.5" diff --git a/packages/trie/CHANGELOG.md b/packages/trie/CHANGELOG.md index f6d0ea01c0..d7544fb9b9 100644 --- a/packages/trie/CHANGELOG.md +++ b/packages/trie/CHANGELOG.md @@ -6,7 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 6.2.0 - 2024-03-05 +## 6.2.1 - 2024-08-15 + +### Other Features + +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Bugfixes + +- Fixes an issue in the delete operation used for unhashed tries and pruning activated which resulted in a wrong state root (bad!), PR [#3333](https://github.com/ethereumjs/ethereumjs-monorepo/issues/3333) + +## 6.2.0 - 2024-03-18 In the hope that you do not have yet integrated: we needed to remove the new more modern async trie iteration with web streams functionality (new `createAsyncReadStream()` method) introduced with the `v6.1.0` release - see PR [#3231](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3231) for context - since the related Node.js web streams API import caused relatively severe problems for all upstream libraries when being used in the browser. diff --git a/packages/trie/package.json b/packages/trie/package.json index 3eed919db0..ded5cc1a92 100644 --- a/packages/trie/package.json +++ b/packages/trie/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/trie", - "version": "6.2.0", + "version": "6.2.1", "description": "Implementation of the modified merkle patricia tree as specified in Ethereum's yellow paper.", "keywords": [ "merkle", @@ -55,14 +55,14 @@ }, "dependencies": { "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@types/readable-stream": "^2.3.13", "debug": "^4.3.4", "lru-cache": "10.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { - "@ethereumjs/genesis": "^0.2.2", + "@ethereumjs/genesis": "^0.2.3", "@types/benchmark": "^1.0.33", "abstract-level": "^1.0.3", "level": "^8.0.0", diff --git a/packages/tx/CHANGELOG.md b/packages/tx/CHANGELOG.md index de7c0520f6..1f9b942c87 100644 --- a/packages/tx/CHANGELOG.md +++ b/packages/tx/CHANGELOG.md @@ -6,7 +6,62 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 5.3.0 - 2024-03-05 +## 5.4.0 - 2024-08-15 + +#### EOA Code Transaction (EIP-7702) (outdated) + +This release introduces support for a non-final version of [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions, see PR [#3470](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3470). This tx type allows to run code in the context of an EOA and therefore extend the functionality which can be "reached" from respectively integrated into the scope of an otherwise limited EOA account. + +The following is a simple example how to use an `EOACodeEIP7702Transaction` with one autorization list item: + +```ts +// ./examples/EOACodeTx.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EOACodeEIP7702Transaction } from '@ethereumjs/tx' +import type { PrefixedHexString } from '@ethereumjs/util' + +const ones32 = `0x${'01'.repeat(32)}` as PrefixedHexString + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) +const tx = EOACodeEIP7702Transaction.fromTxData( + { + authorizationList: [ + { + chainId: '0x1', + address: `0x${'20'.repeat(20)}`, + nonce: ['0x1'], + yParity: '0x1', + r: ones32, + s: ones32, + }, + ], + }, + { common }, +) + +console.log( + `EIP-7702 EOA code tx created with ${tx.authorizationList.length} authorization list item(s).`, +) +``` + +Note: Things move fast with `EIP-7702` and the released implementation is based on [this](https://github.com/ethereum/EIPs/blob/14400434e1199c57d912082127b1d22643788d11/EIPS/eip-7702.md) commit and therefore already outdated. An up-to-date version will be released along our breaking release round planned for early September 2024. + +### Verkle Updates + +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) + +### Other Features + +- Extend `BlobEIP4844Transaction.networkWrapperToJson()` to also include the 4844 fields, PR [#3365](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3365) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Bugfixes + +- Fix bug in generic error message regarding chain ID reporting, PR [#3386](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3386) + +## 5.3.0 - 2024-03-18 ### Full 4844 Browser Readiness @@ -241,7 +296,7 @@ const simpleBlobTx = BlobEIP4844Transaction.fromTxData( gasLimit: 0xffffffn, to: 0x1122334455667788991011121314151617181920, }, - { common } + { common }, ) ``` @@ -525,7 +580,7 @@ const tx = LegacyTransaction.fromTxData( { // Provide your tx data here or use default values }, - { common } + { common }, ) ``` @@ -597,7 +652,7 @@ const tx = LegacyTransaction.fromTxData( { // Provide your tx data here or use default values }, - { common } + { common }, ) ``` diff --git a/packages/tx/README.md b/packages/tx/README.md index f205171237..8d683e6199 100644 --- a/packages/tx/README.md +++ b/packages/tx/README.md @@ -102,6 +102,7 @@ This library supports the following transaction types ([EIP-2718](https://eips.e - `BlobEIP4844Transaction` ([EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), proto-danksharding) - `FeeMarketEIP1559Transaction` ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559), gas fee market) +- `EOACodeEIP7702Transaction` (experimental) ([EIP-7702](https://eips.ethereum.org/EIPS/eip-7702), EOA code delegation) - `AccessListEIP2930Transaction` ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930), optional access lists) - `BlobEIP4844Transaction` ([EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), blob transactions) - `LegacyTransaction`, the Ethereum standard tx up to `berlin`, now referred to as legacy txs with the introduction of tx types @@ -207,6 +208,49 @@ const tx = FeeMarketEIP1559Transaction.fromTxData(txData, { common }) console.log(bytesToHex(tx.hash())) // 0x6f9ef69ccb1de1aea64e511efd6542541008ced321887937c95b03779358ec8a ``` +#### EOA Code Transaction (EIP-7702) (outdated) + +- Class: `EOACodeEIP7702Transaction` +- Activation: `prague` (or per EIP setting) +- Type: `4` + +This library suppports a non-final version of [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) starting with `v5.4.0`. This tx type allows to run code in the context of an EOA and therefore extend the functionality which can be "reached" from respectively integrated into the scope of an otherwise limited EOA account. + +The following is a simple example how to use an `EOACodeEIP7702Transaction` with one autorization list item: + +```ts +// ./examples/EOACodeTx.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EOACodeEIP7702Transaction } from '@ethereumjs/tx' +import type { PrefixedHexString } from '@ethereumjs/util' + +const ones32 = `0x${'01'.repeat(32)}` as PrefixedHexString + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) +const tx = EOACodeEIP7702Transaction.fromTxData( + { + authorizationList: [ + { + chainId: '0x1', + address: `0x${'20'.repeat(20)}`, + nonce: ['0x1'], + yParity: '0x1', + r: ones32, + s: ones32, + }, + ], + }, + { common }, +) + +console.log( + `EIP-7702 EOA code tx created with ${tx.authorizationList.length} authorization list item(s).`, +) +``` + +Note: Things move fast with `EIP-7702` and the currently released implementation is based on [this](https://github.com/ethereum/EIPs/blob/14400434e1199c57d912082127b1d22643788d11/EIPS/eip-7702.md) commit and therefore already outdated. An up-to-date version will be released along our breaking release round planned for early September 2024. + #### Access List Transactions (EIP-2930) - Class: `AccessListEIP2930Transaction` @@ -284,7 +328,7 @@ const tx = LegacyTransaction.fromTxData(txParams, { common }) const privateKey = Buffer.from( 'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', - 'hex' + 'hex', ) const signedTx = tx.sign(privateKey) @@ -310,7 +354,7 @@ const tx = TransactionFactory.fromTxData(txData, { common }) if (tx.supports(Capability.EIP1559FeeMarket)) { console.log( - `The max fee per gas for this transaction is ${(tx as EIP1559CompatibleTx).maxFeePerGas}` + `The max fee per gas for this transaction is ${(tx as EIP1559CompatibleTx).maxFeePerGas}`, ) } ``` diff --git a/packages/tx/examples/EOACodeTx.ts b/packages/tx/examples/EOACodeTx.ts new file mode 100644 index 0000000000..4d8217f805 --- /dev/null +++ b/packages/tx/examples/EOACodeTx.ts @@ -0,0 +1,26 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EOACodeEIP7702Transaction } from '@ethereumjs/tx' +import type { PrefixedHexString } from '@ethereumjs/util' + +const ones32 = `0x${'01'.repeat(32)}` as PrefixedHexString + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) +const tx = EOACodeEIP7702Transaction.fromTxData( + { + authorizationList: [ + { + chainId: '0x2', + address: `0x${'20'.repeat(20)}`, + nonce: ['0x1'], + yParity: '0x1', + r: ones32, + s: ones32, + }, + ], + }, + { common }, +) + +console.log( + `EIP-7702 EOA code tx created with ${tx.authorizationList.length} authorization list item(s).`, +) diff --git a/packages/tx/package.json b/packages/tx/package.json index 2ca85c6749..66c02acdd2 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/tx", - "version": "5.3.0", + "version": "5.4.0", "description": "Implementation of the various Ethereum Transaction Types", "keywords": [ "ethereum", @@ -20,11 +20,7 @@ { "name": "Alex Beregszaszi", "email": "alex@rtfs.hu", - "url": "https://github.com/axic", - "additions": 27562, - "contributions": 22, - "deletions": 42613, - "hireable": true + "url": "https://github.com/axic" } ], "type": "module", @@ -58,9 +54,9 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { diff --git a/packages/util/CHANGELOG.md b/packages/util/CHANGELOG.md index 2e4fb43ece..8c521fe337 100644 --- a/packages/util/CHANGELOG.md +++ b/packages/util/CHANGELOG.md @@ -6,7 +6,52 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 9.0.3 - 2024-03-05 +## 9.1.0 - 2024-08-15 + +### Support for Partial Accounts + +For Verkle or other contexts it can be useful to create partial accounts not containing all the account parameters. This is now supported starting with this release, see PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269): + +```ts +import { Account } from '@ethereumjs/util' + +const account = Account.fromPartialAccountData({ + nonce: '0x02', + balance: '0x0384', +}) +console.log(`Partial account with nonce=${account.nonce} and balance=${account.balance} created`) +``` + +### New `requests` Module + +This release introduces a new `requests` module (see PRs [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372), [#3393](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3393), [#3398](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3398) and [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477)) with various type and an abstract base class for [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) general purpose execution layer requests to the CL (Prague hardfork) as well as concrete implementations for the currently supported request types: + +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110): `DepositRequest` (Prague Hardfork) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002): `WithdrawawlRequest` (Prague Hardfork) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): `ConsolidationRequest` (Prague Hardfork) + +These request types are mainly used within the [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) library where applied usage instructions are provided in the README. + +### Verkle Updates + +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) +- New `verkle` module with utility methods and interfaces, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) +- Rename verkle utils and refactor, PR [#3468](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3468) + +### Other Features + +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Adjust `Account.isContract()` (in Verkle context work), PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Rename deposit receipt to deposit request, PR [#3408](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3408) +- Adjust `Account.isEmpty()` to also work for partial accounts, PR [#3405](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3405) +- Enhances typing of CL requests, PR [#3398](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3398) +- Rename withdrawal request's `validatorPublicKey` to `validatorPubkey`, PR [#3474](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3474) + +## 9.0.3 - 2024-03-18 - Allow optional `trustedSetupPath` for the `initKZG()` method, PR [#3296](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3296) @@ -477,7 +522,7 @@ const account = new Account( new BN(0), // nonce, default: 0 new BN(10).pow(new BN(18)), // balance, default: 0 undefined, // stateRoot, default: KECCAK256_RLP (hash of RLP of null) - undefined // codeHash, default: KECCAK256_NULL (hash of null) + undefined, // codeHash, default: KECCAK256_NULL (hash of null) ) ``` @@ -515,7 +560,7 @@ import { Address } from 'ethereumjs-util' const pubKey = Buffer.from( '3a443d8381a6798a70c6ff9304bdc8cb0163c23211d11628fae52ef9e0dca11a001cf066d56a8156fc201cd5df8a36ef694eecd258903fca7086c1fae7441e1d', - 'hex' + 'hex', ) const address = Address.fromPublicKey(pubKey) ``` diff --git a/packages/util/README.md b/packages/util/README.md index c493df976b..467aa8341d 100644 --- a/packages/util/README.md +++ b/packages/util/README.md @@ -45,6 +45,20 @@ const account = Account.fromAccountData({ console.log(`Account with nonce=${account.nonce} and balance=${account.balance} created`) ``` +For Verkle or other contexts it can be useful to create partial accounts not containing all the account parameters. This is supported starting with v9.1.0: + +```ts +// ./examples/accountPartial.ts + +import { Account } from '@ethereumjs/util' + +const account = Account.fromPartialAccountData({ + nonce: '0x02', + balance: '0x0384', +}) +console.log(`Partial account with nonce=${account.nonce} and balance=${account.balance} created`) +``` + ### Module: [address](src/address.ts) Class representing an Ethereum `Address` with instantiation helpers and validation methods. @@ -127,6 +141,16 @@ KZG interface (used for 4844 blob txs), see [@ethereumjs/tx](https://github.com/ Simple map DB implementation using the `DB` interface (see above). +### Module: [requests](src/requests.ts) + +Module with various type and an abstract base class for [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) general purpose execution layer requests to the CL (Prague hardfork) as well as concrete implementations for the currently supported request types: + +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110): `DepositRequest` (Prague Harfork) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002): `WithdrawawlRequest` (Prague Hardfork) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): `ConsolidationRequest` (Prague Hardfork) + +These request types are mainly used within the [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) library where applied usage instructions are provided in the README. + ### Module: [signature](src/signature.ts) Functionality for signing, signature validation, conversion, recovery. diff --git a/packages/util/examples/accountPartial.ts b/packages/util/examples/accountPartial.ts new file mode 100644 index 0000000000..93aa9c7256 --- /dev/null +++ b/packages/util/examples/accountPartial.ts @@ -0,0 +1,7 @@ +import { Account } from '@ethereumjs/util' + +const account = Account.fromPartialAccountData({ + nonce: '0x02', + balance: '0x0384', +}) +console.log(`Partial account with nonce=${account.nonce} and balance=${account.balance} created`) diff --git a/packages/util/package.json b/packages/util/package.json index 785eb9a4d7..eac3280c82 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/util", - "version": "9.0.3", + "version": "9.1.0", "description": "A collection of utility functions for Ethereum", "keywords": [ "ethereum", diff --git a/packages/verkle/CHANGELOG.md b/packages/verkle/CHANGELOG.md index 536f107d59..c52c3915fd 100644 --- a/packages/verkle/CHANGELOG.md +++ b/packages/verkle/CHANGELOG.md @@ -6,7 +6,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 0.0.2 - 2024-03-05 +## 0.1.0 - 2024-08-15 + +This is the first (still experimental) Verkle library release with some basic `put()` and `get()` functionality working! 🎉 Still highly moving and evolving parts, but early experiments and feedback welcome! + +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Move tree key computation to verkle and simplify, PR [#3420](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3420) +- Rename code keccak, PR [#3426](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3426) +- Add tests for verkle bytes helper, PR [#3441](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3441) +- Verkle decoupling, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) +- Rename verkle utils and refactor, PR [#3468](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3468) +- Optimize storage of default values in VerkleNode, PR [#3476](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3476) +- Build out trie processing, PR [#3430](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3430) +- Implement `trie.put()`, PR [#3473](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3473) +- Add `trie.del()`, PR [#3486](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3486) + +## 0.0.2 - 2024-03-18 - Fix a type error related to the `lru-cache` dependency, PR [#3285](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3285) - Downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/verkle/package.json b/packages/verkle/package.json index e97a1a9baf..243ad6544e 100644 --- a/packages/verkle/package.json +++ b/packages/verkle/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/verkle", - "version": "0.0.2", + "version": "0.1.0", "description": "Implementation of verkle trees as used in Ethereum.", "keywords": [ "verkle", @@ -56,9 +56,9 @@ "debug": "^4.3.4", "lru-cache": "10.1.0", "verkle-cryptography-wasm": "^0.4.5", - "@ethereumjs/block": "^5.2.0", + "@ethereumjs/block": "^5.3.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3" + "@ethereumjs/util": "^9.1.0" }, "engines": { "node": ">=18" diff --git a/packages/vm/CHANGELOG.md b/packages/vm/CHANGELOG.md index 6877c0d6aa..cf444f8344 100644 --- a/packages/vm/CHANGELOG.md +++ b/packages/vm/CHANGELOG.md @@ -6,7 +6,54 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 8.0.0 - 2024-03-05 +## 8.1.0 - 2024-08-15 + +### EIP-7685 Requests: EIP-6110 (Deposits) / EIP-7002 (Withdrawals) / EIP-7251 (Consolidations) + +This library now supports `EIP-6110` deposit requests, see PR [#3390](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3390), `EIP-7002` withdrawal requests, see PR [#3385](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3385) and `EIP-7251` consolidation requests, see PR [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477) as well as the underlying generic execution layer request logic introduced with `EIP-7685` (PR [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372)). + +These new request types will be activated with the `Prague` hardfork, see [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) README for detailed documentation. + +### EIP-2935 Serve Historical Block Hashes from State (Prague) + +Starting with this release the VM supports [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) which stores the latest 256 block hashes in the storage of a system contract, see PR [#3475](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3475) as the major integrational PR (while work on this has already been done in previous PRs). + +This EIP will be activated along the Prague hardfork. Note that this EIP has no effect on the resolution of the `BLOCKHASH` opcode, which will be a separate activation taking place by the integration of [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) in the following Osaka hardfork. + +### Verkle Dependency Decoupling + +We have relatively light-heartedly added a new `@ethereumjs/verkle` main dependency to the VM/EVM stack in the `v7.2.1` release, which added an additional burden to the bundle size by several hundred KB and additionally draws in unnecessary WASM code. Coupling with Verkle has been refactored in PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) and the direct dependency has been removed again. + +An update to this release is therefore strongly recommended even if other fixes or features are not that relevant for you right now. + +### Verkle Updates + +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Missing beaconroot account verkle fix, PR [#3421](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3421) +- Remove the hacks to prevent account cleanups of system contracts, PR [#3418](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3418) +- Updates EIP-2935 tests with the new proposed bytecode and corresponding config, PR [#3438](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3438) +- Fix EIP-2935 address conversion issues, PR [#3447](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3447) +- Remove backfill of block hashes on EIP-2935 activation, PR [#3478](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3478) + +### Other Features + +- Add `evmOpts` to the VM opts to allow for options chaining to the underlying EVM, PR [#3481](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3481) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Removes support for [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) simple subroutines for EVM (deprecated with an alternative version integrated into EOF), PR [#3342](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3342) +- Small clean-up to `VM._emit()`, PR [#3396](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3396) +- Update `mcl-wasm` Dependency (Esbuild Issue), PR [#3461](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3461) + +### Bugfixes + +- Fix block building with blocks including CL requests, PR [#3413](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3413) +- Ensure system address is not created if it is empty, PR [#3400](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3400) + +## 8.0.0 - 2024-03-18 ### New EVM.create() Async Static Constructor / Mandatory VM.create() Constructor @@ -2034,7 +2081,7 @@ vm.runTx( // Handle errors appropriately } // Do something with the result - } + }, ) ``` diff --git a/packages/vm/README.md b/packages/vm/README.md index 814a0422c4..7cca9d89b3 100644 --- a/packages/vm/README.md +++ b/packages/vm/README.md @@ -85,7 +85,7 @@ const main = async () => { const parentBlock = Block.fromBlockData( { header: { number: 1n } }, - { skipConsensusFormatValidation: true } + { skipConsensusFormatValidation: true }, ) const headerData = { number: 2n, @@ -274,12 +274,12 @@ const main = async () => { const blockchain = await Blockchain.create({ genesisState }) const vm = await VM.create({ blockchain, genesisState }) const account = await vm.stateManager.getAccount( - Address.fromString('0x000d836201318ec6899a67540690382780743280') + Address.fromString('0x000d836201318ec6899a67540690382780743280'), ) console.log( `This balance for account 0x000d836201318ec6899a67540690382780743280 in this chain's genesis state is ${Number( - account?.balance - )}` + account?.balance, + )}`, ) } main() @@ -318,6 +318,26 @@ For a list with supported EIPs see the [@ethereumjs/evm](https://github.com/ethe This library supports the blob transaction type introduced with [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844). +### EIP-7702 EAO Code Transactions Support (outdated) + +This library support the execution of [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions (see tx library for full documentation) with `runTx()` or the wrapping `runBlock()` execution methods starting with `v3.1.0`, see [this test setup](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/test/api/EIPs/eip-7702.spec.ts) for a more complete example setup on how to run code from an EOA. + +Note: Things move fast with `EIP-7702` and the currently released implementation is based on [this](https://github.com/ethereum/EIPs/blob/14400434e1199c57d912082127b1d22643788d11/EIPS/eip-7702.md) commit and therefore already outdated. An up-to-date version will be released along our breaking release round planned for early September 2024. + +### EIP-7685 Requests Support + +This libary supports blocks including the following [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) requests: + +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Deposit Requests (`v7.3.0`+) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Withdrawal Requests (`v7.3.0`+) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Consolidation Requests (`v7.3.0`+) + +### EIP-2935 Serve Historical Block Hashes from State (Prague) + +Starting with `v8.1.0` the VM supports [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) which stores the latest 8192 block hashes in the storage of a system contract, see PR [#3475](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3475) as the major integrational PR (while work on this has already been done in previous PRs). + +This EIP will be activated along the Prague hardfork. Note that this EIP has no effect on the resolution of the `BLOCKHASH` opcode, which will be a separate activation taking place by the integration of [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) in the following Osaka hardfork. + #### Initialization To run VM/EVM related EIP-4844 functionality you have to activate the EIP in the associated `@ethereumjs/common` library: diff --git a/packages/vm/package.json b/packages/vm/package.json index b862d625d1..0bef3ed56c 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/vm", - "version": "8.0.0", + "version": "8.1.0", "description": "An Ethereum VM implementation", "keywords": [ "ethereum", @@ -64,15 +64,15 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/blockchain": "^7.2.0", - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/evm": "^3.0.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/blockchain": "^7.3.0", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/evm": "^3.1.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/statemanager": "^2.3.0", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/statemanager": "^2.4.0", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1" }, diff --git a/packages/wallet/CHANGELOG.md b/packages/wallet/CHANGELOG.md index 43e273a626..d155728a9b 100644 --- a/packages/wallet/CHANGELOG.md +++ b/packages/wallet/CHANGELOG.md @@ -6,7 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## 2.0.3 - 2024-03-05 +## 2.0.4 - 2024-08-15 + +Maintenance release with downstream dependency updates, see PR [#3527](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3527) + +## 2.0.3 - 2024-03-18 Maintenance release with downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/wallet/package.json b/packages/wallet/package.json index ee4a11d329..173b37aa6f 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/wallet", - "version": "2.0.3", + "version": "2.0.4", "description": "Utilities for handling Ethereum keys", "keywords": [ "ethereum", @@ -48,7 +48,7 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@scure/base": "^1.1.7", "ethereum-cryptography": "^2.2.1", "js-md5": "^0.8.3",