Skip to content

Commit

Permalink
Upgrade ethereum-cryptography / Remove Direct EVM @noble/curves Usage (
Browse files Browse the repository at this point in the history
…#3668)

* mororepo: upgrade to ethereum-cryptography v3

* wallet: remove await from non-Promise

* Direct ethereum-cryptography usage for BLS precompile in EVM

* Direct ethereum-cryptography usage for BN254 precompile in EVM

* Fix some docs, some code optimizations (EVM BLS/BN254 precompiles)

* Remove direct EVM @noble/curves dependency

* Rebuild package-lock.json

---------

Co-authored-by: Holger Drewes <[email protected]>
  • Loading branch information
ScottyPoi and holgerd77 authored Sep 16, 2024
1 parent ffc2c24 commit 47f388b
Showing 20 changed files with 102 additions and 104 deletions.
123 changes: 58 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/block/package.json
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@
"@ethereumjs/trie": "^6.2.1",
"@ethereumjs/tx": "^5.4.0",
"@ethereumjs/util": "^9.1.0",
"ethereum-cryptography": "^2.2.1"
"ethereum-cryptography": "^3.0.0"
},
"devDependencies": {
"kzg-wasm": "^0.4.0"
2 changes: 1 addition & 1 deletion packages/blockchain/package.json
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@
"@ethereumjs/tx": "^5.4.0",
"@ethereumjs/util": "^9.1.0",
"debug": "^4.3.3",
"ethereum-cryptography": "^2.2.1",
"ethereum-cryptography": "^3.0.0",
"lru-cache": "10.1.0"
},
"devDependencies": {
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@
"connect": "^3.7.0",
"cors": "^2.8.5",
"debug": "^4.3.3",
"ethereum-cryptography": "^2.2.1",
"ethereum-cryptography": "^3.0.0",
"it-pipe": "^1.1.0",
"jayson": "^4.0.0",
"kzg-wasm": "^0.4.0",
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@
},
"dependencies": {
"@ethereumjs/util": "^9.1.0",
"ethereum-cryptography": "^2.2.1"
"ethereum-cryptography": "^3.0.0"
},
"devDependencies": {
"@polkadot/util": "^12.6.2",
2 changes: 1 addition & 1 deletion packages/devp2p/package.json
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@
"@ethereumjs/util": "^9.1.0",
"@scure/base": "^1.1.7",
"debug": "^4.3.3",
"ethereum-cryptography": "^2.2.1",
"ethereum-cryptography": "^3.0.0",
"lru-cache": "10.1.0",
"scanf": "1.1.2",
"snappyjs": "^0.6.1"
2 changes: 1 addition & 1 deletion packages/ethash/package.json
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@
"@ethereumjs/rlp": "^5.0.2",
"@ethereumjs/util": "^9.1.0",
"bigint-crypto-utils": "^3.2.2",
"ethereum-cryptography": "^2.2.1"
"ethereum-cryptography": "^3.0.0"
},
"devDependencies": {
"@ethereumjs/common": "^4.4.0"
3 changes: 1 addition & 2 deletions packages/evm/package.json
Original file line number Diff line number Diff line change
@@ -60,10 +60,9 @@
"@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",
"ethereum-cryptography": "^2.2.1"
"ethereum-cryptography": "^3.0.0"
},
"devDependencies": {
"@ethersproject/abi": "^5.0.12",
4 changes: 2 additions & 2 deletions packages/evm/src/opcodes/functions.ts
Original file line number Diff line number Diff line change
@@ -23,10 +23,10 @@ import {
bytesToHex,
bytesToInt,
concatBytes,
equalsBytes,
getVerkleTreeIndicesForStorageSlot,
setLengthLeft,
} from '@ethereumjs/util'
import { equalBytes } from '@noble/curves/abstract/utils'
import { keccak256 } from 'ethereum-cryptography/keccak.js'

import { EOFContainer, EOFContainerMode } from '../eof/container.js'
@@ -62,7 +62,7 @@ export interface AsyncOpHandler {
export type OpHandler = SyncOpHandler | AsyncOpHandler

function getEIP7702DelegatedAddress(code: Uint8Array) {
if (equalBytes(code.slice(0, 3), DELEGATION_7702_FLAG)) {
if (equalsBytes(code.slice(0, 3), DELEGATION_7702_FLAG)) {
return new Address(code.slice(3, 24))
}
}
Loading

0 comments on commit 47f388b

Please sign in to comment.