diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 4d4b850e719..054378fe9e9 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -39,11 +39,10 @@ jobs: - run: npm i working-directory: ${{ github.workspace }} - - - name: Build & Push + - name: Build & Push uses: docker/build-push-action@v5 with: context: . push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - tags: ghcr.io/${{ github.repository_owner }}/ethereumjs-monorepo:latest - provenance: false \ No newline at end of file + tags: ghcr.io/dargon789/ethereumjs-monorepo:latest + provenance: false diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml new file mode 100644 index 00000000000..0ebd768bf2a --- /dev/null +++ b/.github/workflows/jekyll-gh-pages.yml @@ -0,0 +1,51 @@ +# Sample workflow for building and deploying a Jekyll site to GitHub Pages +name: Deploy Jekyll with GitHub Pages dependencies preinstalled + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./ + destination: ./_site + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/noCompile.yml b/.github/workflows/noCompile.yml index e8f32d0dc21..8512bebde44 100644 --- a/.github/workflows/noCompile.yml +++ b/.github/workflows/noCompile.yml @@ -21,16 +21,17 @@ jobs: # Set default values for cache keys when triggered by push env: DEP_CACHE_KEY: ${{ github.event_name == 'push' && 'none' || inputs.dep-cache-key }} - + steps: + - uses: actions/checkout@v4 # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) - - if: env.DEP_CACHE_KEY != 'none' + - if: env.DEP_CACHE_KEY != 'none' uses: actions/cache/restore@v4 id: dep-cache with: path: ${{github.workspace}} key: ${{ env.DEP_CACHE_KEY }} - + - name: Use Node.js 22 uses: actions/setup-node@v4 with: @@ -39,8 +40,8 @@ jobs: - name: Install Dependencies (if not restored from cache) if: steps.dep-cache.outputs.cache-hit != 'true' - run: npm i --ignore-scripts + run: npm i --ignore-scripts working-directory: ${{ github.workspace }} - + - run: node --conditions=typescript --experimental-strip-types scripts/inlineClient.ts - working-directory: ${{ github.workspace }}/packages/client \ No newline at end of file + working-directory: ${{ github.workspace }}/packages/client diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000000..58172ab353f --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d454d0e153b..2d0fa2e1778 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ COPY packages/blockchain/dist packages/blockchain/dist COPY packages/client/dist packages/client/dist COPY packages/common/dist packages/common/dist COPY packages/devp2p/dist packages/devp2p/dist -COPY packages/era/dist packages/era/dist +COPY packages/e2store/dist packages/e2store/dist COPY packages/ethash/dist packages/ethash/dist COPY packages/evm/dist packages/evm/dist COPY packages/genesis/dist packages/genesis/dist @@ -33,7 +33,7 @@ COPY packages/blockchain/package.json packages/blockchain/package.json COPY packages/client/package.json packages/client/package.json COPY packages/common/package.json packages/common/package.json COPY packages/devp2p/package.json packages/devp2p/package.json -COPY packages/era/package.json packages/era/package.json +COPY packages/e2store/package.json packages/e2store/package.json COPY packages/ethash/package.json packages/ethash/package.json COPY packages/evm/package.json packages/evm/package.json COPY packages/genesis/package.json packages/genesis/package.json diff --git a/config/cspell-ts.json b/config/cspell-ts.json index 0212689cc31..e6c01169485 100644 --- a/config/cspell-ts.json +++ b/config/cspell-ts.json @@ -24,6 +24,7 @@ } ], "words": [ + "immediates", "unerasable", "bytelist", "bytestring", diff --git a/config/typedoc.cjs b/config/typedoc.mjs similarity index 89% rename from config/typedoc.cjs rename to config/typedoc.mjs index d8ebbfd5b9a..85130f1ac60 100644 --- a/config/typedoc.cjs +++ b/config/typedoc.mjs @@ -1,4 +1,4 @@ -module.exports = { +export default { plugin: 'typedoc-plugin-markdown', readme: 'none', gitRevision: 'master', diff --git a/package-lock.json b/package-lock.json index d38f9d49ec0..d79199607ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,8 +30,8 @@ "sort-package-json": "3.0.0", "tape": "5.9.0", "tsx": "^4.19.3", - "typedoc": "^0.28.0", - "typedoc-plugin-markdown": "^4.5.0", + "typedoc": "^0.28.3", + "typedoc-plugin-markdown": "^4.6.3", "typescript": "^5.8.2", "typescript-eslint": "^8.26.1", "vite-plugin-top-level-await": "^1.5.0", @@ -1865,8 +1865,8 @@ "resolved": "packages/devp2p", "link": true }, - "node_modules/@ethereumjs/era": { - "resolved": "packages/era", + "node_modules/@ethereumjs/e2store": { + "resolved": "packages/e2store", "link": true }, "node_modules/@ethereumjs/ethash": { @@ -1918,14 +1918,16 @@ "link": true }, "node_modules/@gerrit0/mini-shiki": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.2.1.tgz", - "integrity": "sha512-HbzRC6MKB6U8kQhczz0APKPIzFHTrcqhaC7es2EXInq1SpjPVnpVSIsBe6hNoLWqqCx1n5VKiPXq6PfXnHZKOQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.3.0.tgz", + "integrity": "sha512-frvArO0+s5Viq68uSod5SieLPVM2cLpXoQ1e07lURwgADXpL/MOypM7jPz9otks0g2DIe2YedDAeVrDyYJZRxA==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/engine-oniguruma": "^3.2.1", - "@shikijs/types": "^3.2.1", + "@shikijs/engine-oniguruma": "^3.3.0", + "@shikijs/langs": "^3.3.0", + "@shikijs/themes": "^3.3.0", + "@shikijs/types": "^3.3.0", "@shikijs/vscode-textmate": "^10.0.2" } }, @@ -2674,9 +2676,9 @@ } }, "node_modules/@noble/ciphers": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.2.1.tgz", - "integrity": "sha512-rONPWMC7PeExE077uLE4oqWrZ1IvAfz3oH9LibVAcVCopJiA9R62uavnbEzdkVmJYI6M6Zgkbeb07+tWjlq2XA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -3604,56 +3606,115 @@ "license": "MIT" }, "node_modules/@scure/base": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.4.tgz", - "integrity": "sha512-5Yy9czTO47mqz+/J8GM6GIId4umdCk1wc1q8rKERQulIoc8VP9pzDcghv10Tl2E7R96ZUx/PhND3ESYUQX8NuQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.5.tgz", + "integrity": "sha512-9rE6EOVeIQzt5TSu4v+K523F8u6DhBsoZWPGKlnCshhlDhy0kJzUX4V+tr2dWmzF1GdekvThABoEQBGBQI7xZw==", "license": "MIT", "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip32": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.6.2.tgz", - "integrity": "sha512-t96EPDMbtGgtb7onKKqxRLfE5g05k7uHnHRM2xdE6BP/ZmxaLtPek4J4KfVn/90IQNrU1IOAqMgiDtUdtbe3nw==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", "license": "MIT", "dependencies": { - "@noble/curves": "~1.8.1", - "@noble/hashes": "~1.7.1", - "@scure/base": "~1.2.2" + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/curves": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.0.tgz", + "integrity": "sha512-7YDlXiNMdO1YZeH6t/kvopHHbIZzlxrCV9WLqCY6QhcXOoXiNCMDqJIglZ9Yjx5+w7Dz30TITFrlTjnRg7sKEg==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip39": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.5.4.tgz", - "integrity": "sha512-TFM4ni0vKvCfBpohoh+/lY05i9gRbSwXWngAsF4CABQxoaOHijxuaZ2R6cStDQ5CHtHO9aGJTr4ksVJASRRyMA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", "license": "MIT", "dependencies": { - "@noble/hashes": "~1.7.1", - "@scure/base": "~1.2.4" + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.2.1.tgz", - "integrity": "sha512-wZZAkayEn6qu2+YjenEoFqj0OyQI64EWsNR6/71d1EkG4sxEOFooowKivsWPpaWNBu3sxAG+zPz5kzBL/SsreQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.3.0.tgz", + "integrity": "sha512-l0vIw+GxeNU7uGnsu6B+Crpeqf+WTQ2Va71cHb5ZYWEVEPdfYwY5kXwYqRJwHrxz9WH+pjSpXQz+TJgAsrkA5A==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "3.2.1", + "@shikijs/types": "3.3.0", "@shikijs/vscode-textmate": "^10.0.2" } }, + "node_modules/@shikijs/langs": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.3.0.tgz", + "integrity": "sha512-zt6Kf/7XpBQKSI9eqku+arLkAcDQ3NHJO6zFjiChI8w0Oz6Jjjay7pToottjQGjSDCFk++R85643WbyINcuL+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.3.0" + } + }, + "node_modules/@shikijs/themes": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.3.0.tgz", + "integrity": "sha512-tXeCvLXBnqq34B0YZUEaAD1lD4lmN6TOHAhnHacj4Owh7Ptb/rf5XCDeROZt2rEOk5yuka3OOW2zLqClV7/SOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.3.0" + } + }, "node_modules/@shikijs/types": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.2.1.tgz", - "integrity": "sha512-/NTWAk4KE2M8uac0RhOsIhYQf4pdU0OywQuYDGIGAJ6Mjunxl2cGiuLkvu4HLCMn+OTTLRWkjZITp+aYJv60yA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.3.0.tgz", + "integrity": "sha512-KPCGnHG6k06QG/2pnYGbFtFvpVJmC3uIpXrAiPrawETifujPBv0Se2oUxm5qYgjCvGJS9InKvjytOdN+bGuX+Q==", "dev": true, "license": "MIT", "dependencies": { @@ -8284,22 +8345,49 @@ } }, "node_modules/ethereum-cryptography": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-3.1.0.tgz", - "integrity": "sha512-ZqHd92eOIH9RExpBUOgzpAgflyFv9/+Ca39G8V+oCjJPGjJUihQcG/Gl67I/Xn2HGS87dgnrCG3kb1jNClLi6g==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-3.2.0.tgz", + "integrity": "sha512-Urr5YVsalH+Jo0sYkTkv1MyI9bLYZwW8BENZCeE1QYaTHETEYx0Nv/SVsWkSqpYrzweg6d8KMY1wTjH/1m/BIg==", "license": "MIT", "dependencies": { - "@noble/ciphers": "1.2.1", - "@noble/curves": "1.8.1", - "@noble/hashes": "1.7.1", - "@scure/bip32": "1.6.2", - "@scure/bip39": "1.5.4" + "@noble/ciphers": "1.3.0", + "@noble/curves": "1.9.0", + "@noble/hashes": "1.8.0", + "@scure/bip32": "1.7.0", + "@scure/bip39": "1.6.0" }, "engines": { "node": "^14.21.3 || >=16", "npm": ">=9" } }, + "node_modules/ethereum-cryptography/node_modules/@noble/curves": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.0.tgz", + "integrity": "sha512-7YDlXiNMdO1YZeH6t/kvopHHbIZzlxrCV9WLqCY6QhcXOoXiNCMDqJIglZ9Yjx5+w7Dz30TITFrlTjnRg7sKEg==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethereum-cryptography/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/ethers": { "version": "6.13.5", "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.5.tgz", @@ -16052,17 +16140,17 @@ } }, "node_modules/typedoc": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.1.tgz", - "integrity": "sha512-Mn2VPNMaxoe/hlBiLriG4U55oyAa3Xo+8HbtEwV7F5WEOPXqtxzGuMZhJYHaqFJpajeQ6ZDUC2c990NAtTbdgw==", + "version": "0.28.3", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.3.tgz", + "integrity": "sha512-5svOCTfXvVSh6zbZKSQluZhR8yN2tKpTeHZxlmWpE6N5vc3R8k/jhg9nnD6n5tN9/ObuQTojkONrOxFdUFUG9w==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@gerrit0/mini-shiki": "^3.2.1", + "@gerrit0/mini-shiki": "^3.2.2", "lunr": "^2.3.9", "markdown-it": "^14.1.0", "minimatch": "^9.0.5", - "yaml": "^2.7.0 " + "yaml": "^2.7.1" }, "bin": { "typedoc": "bin/typedoc" @@ -16076,9 +16164,9 @@ } }, "node_modules/typedoc-plugin-markdown": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.5.2.tgz", - "integrity": "sha512-n0wfkCQU4nts13v8RSWMzIGNMbDo4P+oumHW6JudriknJLJSzx7p19OKJP8rKXvBkA+SFFuT7mW8lkMZZROz4g==", + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.6.3.tgz", + "integrity": "sha512-86oODyM2zajXwLs4Wok2mwVEfCwCnp756QyhLGX2IfsdRYr1DXLCgJgnLndaMUjJD7FBhnLk2okbNE9PdLxYRw==", "dev": true, "license": "MIT", "engines": { @@ -17220,9 +17308,9 @@ "license": "ISC" }, "node_modules/yaml": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz", - "integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz", + "integrity": "sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ==", "dev": true, "license": "ISC", "bin": { @@ -17401,7 +17489,7 @@ "@ethereumjs/util": "^10.0.0-rc.1", "@noble/hashes": "^1.7.2", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "lru-cache": "11.0.2" }, "engines": { @@ -17430,7 +17518,7 @@ "@ethereumjs/rlp": "^10.0.0-rc.1", "@ethereumjs/tx": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@ethereumjs/testdata": "1.0.0", @@ -17492,7 +17580,7 @@ "connect": "^3.7.0", "cors": "^2.8.5", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "eventemitter3": "^5.0.1", "jayson": "^4.1.3", "level": "^9.0.0", @@ -17566,7 +17654,7 @@ "@ethereumjs/util": "^10.0.0-rc.1", "@scure/base": "^1.2.4", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "eventemitter3": "^5.0.1", "lru-cache": "11.0.2", "scanf": "1.2.0", @@ -17598,9 +17686,27 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "packages/e2store": { + "name": "@ethereumjs/e2store", + "version": "10.0.0-dev-rc.1", + "license": "MIT", + "dependencies": { + "@chainsafe/snappy-stream": "^5.1.2", + "@ethereumjs/block": "^10.0.0-rc.1", + "@ethereumjs/blockchain": "^10.0.0-rc.1", + "@ethereumjs/rlp": "^10.0.0-rc.1", + "@ethereumjs/util": "^10.0.0-rc.1", + "level": "^9.0.0", + "micro-eth-signer": "^0.14.0" + }, + "engines": { + "node": ">=18" + } + }, "packages/era": { "name": "@ethereumjs/era", "version": "10.0.0-dev-rc.1", + "extraneous": true, "license": "MIT", "dependencies": { "@chainsafe/snappy-stream": "^5.1.2", @@ -17624,7 +17730,7 @@ "@ethereumjs/rlp": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", "bigint-crypto-utils": "^3.3.0", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@ethereumjs/common": "^10.0.0-rc.1" @@ -17643,10 +17749,10 @@ "@ethereumjs/statemanager": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", "@ethereumjs/verkle": "^10.0.0-dev-rc.1", - "@noble/curves": "^1.8.2", + "@noble/curves": "^1.9.0", "@types/debug": "^4.1.12", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "eventemitter3": "^5.0.1" }, "devDependencies": { @@ -17672,12 +17778,12 @@ } }, "packages/evm/node_modules/@noble/curves": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.2.tgz", - "integrity": "sha512-vnI7V6lFNe0tLAuJMu+2sX+FcL14TaCWy1qiczg1VwRmPrpQCdq5ESXQMqUc2tluRNf6irBXrWbl1mGN8uaU/g==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.0.tgz", + "integrity": "sha512-7YDlXiNMdO1YZeH6t/kvopHHbIZzlxrCV9WLqCY6QhcXOoXiNCMDqJIglZ9Yjx5+w7Dz30TITFrlTjnRg7sKEg==", "license": "MIT", "dependencies": { - "@noble/hashes": "1.7.2" + "@noble/hashes": "1.8.0" }, "engines": { "node": "^14.21.3 || >=16" @@ -17687,9 +17793,9 @@ } }, "packages/evm/node_modules/@noble/hashes": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.2.tgz", - "integrity": "sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -17718,7 +17824,7 @@ "@ethereumjs/rlp": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "lru-cache": "11.0.2" }, "devDependencies": { @@ -17762,7 +17868,7 @@ "@js-sdsl/ordered-map": "^4.4.2", "@noble/hashes": "^1.7.2", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "lru-cache": "11.0.2" }, "devDependencies": { @@ -17799,7 +17905,7 @@ "@ethereumjs/common": "^10.0.0-rc.1", "@ethereumjs/rlp": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@ethereumjs/testdata": "1.0.0", @@ -17821,7 +17927,7 @@ "license": "MPL-2.0", "dependencies": { "@ethereumjs/rlp": "^10.0.0-rc.1", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@paulmillr/trusted-setups": "^0.1.2", @@ -17862,7 +17968,7 @@ "@ethereumjs/util": "^10.0.0-rc.1", "@ethereumjs/verkle": "^10.0.0-dev-rc.1", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "eventemitter3": "^5.0.1" }, "devDependencies": { @@ -17896,7 +18002,7 @@ "dependencies": { "@ethereumjs/util": "^10.0.0-rc.1", "@scure/base": "^1.2.4", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "js-md5": "^0.8.3", "uuid": "^11.1.0" }, diff --git a/package.json b/package.json index 64d9df48d41..5721c57126b 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,8 @@ "sort-package-json": "3.0.0", "tape": "5.9.0", "tsx": "^4.19.3", - "typedoc": "^0.28.0", - "typedoc-plugin-markdown": "^4.5.0", + "typedoc": "^0.28.3", + "typedoc-plugin-markdown": "^4.6.3", "typescript": "^5.8.2", "typescript-eslint": "^8.26.1", "vite-plugin-top-level-await": "^1.5.0", diff --git a/packages/binarytree/README.md b/packages/binarytree/README.md index 46c5fcaec20..22156e4d323 100644 --- a/packages/binarytree/README.md +++ b/packages/binarytree/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/binarytree +# @ethereumjs/binarytree `v10` [![NPM Package][binarytree-npm-badge]][binarytree-npm-link] [![GitHub Issues][binarytree-issues-badge]][binarytree-issues-link] @@ -13,6 +13,12 @@ This package is currently in early alpha and is a work in progress. It is not intended for use in production environments, but rather for research and development purposes. Any help in improving the package is very much welcome. +## Table of Contents + +- [Installation](#installation) +- [EthereumJS](#ethereumjs) +- [License](#license) + ## Installation To obtain the latest version, simply install the project using `npm`: diff --git a/packages/binarytree/docs/README.md b/packages/binarytree/docs/README.md new file mode 100644 index 00000000000..d554a2d18cb --- /dev/null +++ b/packages/binarytree/docs/README.md @@ -0,0 +1,42 @@ +**@ethereumjs/binarytree** + +*** + +# @ethereumjs/binarytree + +## Classes + +- [BinaryTree](classes/BinaryTree.md) +- [CheckpointDB](classes/CheckpointDB.md) +- [InternalBinaryNode](classes/InternalBinaryNode.md) + +## Interfaces + +- [BinaryNodeOptions](interfaces/BinaryNodeOptions.md) +- [BinaryTreeOpts](interfaces/BinaryTreeOpts.md) +- [CheckpointDBOpts](interfaces/CheckpointDBOpts.md) +- [TypedBinaryNode](interfaces/TypedBinaryNode.md) + +## Type Aliases + +- [BinaryNode](type-aliases/BinaryNode.md) +- [BinaryNodeType](type-aliases/BinaryNodeType.md) +- [Checkpoint](type-aliases/Checkpoint.md) +- [ChildBinaryNode](type-aliases/ChildBinaryNode.md) + +## Variables + +- [BinaryNodeType](variables/BinaryNodeType.md) +- [NODE\_WIDTH](variables/NODE_WIDTH.md) +- [ROOT\_DB\_KEY](variables/ROOT_DB_KEY.md) + +## Functions + +- [binaryTreeFromProof](functions/binaryTreeFromProof.md) +- [createBinaryTree](functions/createBinaryTree.md) +- [decodeBinaryNode](functions/decodeBinaryNode.md) +- [decodeRawBinaryNode](functions/decodeRawBinaryNode.md) +- [isInternalBinaryNode](functions/isInternalBinaryNode.md) +- [isRawBinaryNode](functions/isRawBinaryNode.md) +- [isStemBinaryNode](functions/isStemBinaryNode.md) +- [verifyBinaryProof](functions/verifyBinaryProof.md) diff --git a/packages/binarytree/docs/classes/BinaryTree.md b/packages/binarytree/docs/classes/BinaryTree.md new file mode 100644 index 00000000000..5d01982ff90 --- /dev/null +++ b/packages/binarytree/docs/classes/BinaryTree.md @@ -0,0 +1,449 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / BinaryTree + +# Class: BinaryTree + +Defined in: [binaryTree.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L34) + +The basic binary tree interface, use with `import { BinaryTree } from '@ethereumjs/binarytree'`. + +## Constructors + +### Constructor + +> **new BinaryTree**(`opts`): `BinaryTree` + +Defined in: [binaryTree.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L55) + +Creates a new binary tree. + +#### Parameters + +##### opts + +[`BinaryTreeOpts`](../interfaces/BinaryTreeOpts.md) + +Options for instantiating the binary tree + +Note: in most cases, the static [createBinaryTree](../functions/createBinaryTree.md) constructor should be used. It uses the same API but provides sensible defaults + +#### Returns + +`BinaryTree` + +## Properties + +### EMPTY\_TREE\_ROOT + +> **EMPTY\_TREE\_ROOT**: `Uint8Array` + +Defined in: [binaryTree.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L39) + +The root for an empty tree + +## Methods + +### checkpoint() + +> **checkpoint**(): `void` + +Defined in: [binaryTree.ts:648](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L648) + +Creates a checkpoint that can later be reverted to or committed. +After this is called, all changes can be reverted until `commit` is called. + +#### Returns + +`void` + +*** + +### checkRoot() + +> **checkRoot**(`root`): `Promise`\<`boolean`\> + +Defined in: [binaryTree.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L113) + +Checks if a given root exists. + +#### Parameters + +##### root + +`Uint8Array` + +#### Returns + +`Promise`\<`boolean`\> + +*** + +### commit() + +> **commit**(): `Promise`\<`void`\> + +Defined in: [binaryTree.ts:657](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L657) + +Commits a checkpoint to disk, if current checkpoint is not nested. +If nested, only sets the parent checkpoint as current checkpoint. + +#### Returns + +`Promise`\<`void`\> + +#### Throws + +If not during a checkpoint phase + +*** + +### createBinaryProof() + +> **createBinaryProof**(`key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>[]\> + +Defined in: [binaryTree.ts:581](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L581) + +Creates a proof from a tree and key that can be verified using BinaryTree.verifyBinaryProof. + +#### Parameters + +##### key + +`Uint8Array` + +a 32 byte binary tree key (31 byte stem + 1 byte suffix) + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>[]\> + +*** + +### createReadStream() + +> **createReadStream**(): `any` + +Defined in: [binaryTree.ts:599](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L599) + +The `data` event is given an `Object` that has two properties; the `key` and the `value`. Both should be Uint8Arrays. + +#### Returns + +`any` + +Returns a [stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_class_stream_readable) of the contents of the `tree` + +*** + +### createRootNode() + +> **createRootNode**(): `Promise`\<`void`\> + +Defined in: [binaryTree.ts:534](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L534) + +Create empty root node for initializing an empty tree. + +#### Returns + +`Promise`\<`void`\> + +*** + +### del() + +> **del**(`stem`, `suffixes`): `Promise`\<`void`\> + +Defined in: [binaryTree.ts:526](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L526) + +Deletes a given `key` from the tree. + +#### Parameters + +##### stem + +`Uint8Array` + +the stem of the stem node to delete from + +##### suffixes + +`number`[] + +the suffixes to delete + +#### Returns + +`Promise`\<`void`\> + +A Promise that resolves once the key is deleted. + +*** + +### findPath() + +> **findPath**(`keyInBytes`): `Promise`\<`Path`\> + +Defined in: [binaryTree.ts:413](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L413) + +Tries to find a path to the node for the given key. +It returns a `Path` object containing: + - `node`: the found node (if any), + - `stack`: an array of tuples [node, path] representing the nodes encountered, + - `remaining`: the bits of the key that were not matched. + +#### Parameters + +##### keyInBytes + +`Uint8Array` + +the search key as a byte array. + +#### Returns + +`Promise`\<`Path`\> + +A Promise that resolves to a Path object. + +*** + +### flushCheckpoints() + +> **flushCheckpoints**(): `void` + +Defined in: [binaryTree.ts:687](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L687) + +Flushes all checkpoints, restoring the initial checkpoint state. + +#### Returns + +`void` + +*** + +### get() + +> **get**(`stem`, `suffixes`): `Promise`\<(`null` \| `Uint8Array`\<`ArrayBufferLike`\>)[]\> + +Defined in: [binaryTree.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L133) + +Gets values at a given binary tree `stem` and set of suffixes + +#### Parameters + +##### stem + +`Uint8Array` + +the stem of the stem node where we're seeking values + +##### suffixes + +`number`[] + +an array of suffixes corresponding to the values desired + +#### Returns + +`Promise`\<(`null` \| `Uint8Array`\<`ArrayBufferLike`\>)[]\> + +A Promise that resolves to an array of `Uint8Array`s or `null` depending on if values were found. +If the stem is not found, will return an empty array. + +*** + +### hasCheckpoints() + +> **hasCheckpoints**(): `boolean` + +Defined in: [binaryTree.ts:640](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L640) + +Is the tree during a checkpoint phase? + +#### Returns + +`boolean` + +*** + +### persistRoot() + +> **persistRoot**(): `Promise`\<`void`\> + +Defined in: [binaryTree.ts:631](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L631) + +Persists the root hash in the underlying database + +#### Returns + +`Promise`\<`void`\> + +*** + +### put() + +> **put**(`stem`, `suffixes`, `values`): `Promise`\<`void`\> + +Defined in: [binaryTree.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L163) + +Stores a given `value` at the given `key` or performs a deletion if `value` is null. + +#### Parameters + +##### stem + +`Uint8Array` + +the stem (must be 31 bytes) to store the value at. + +##### suffixes + +`number`[] + +array of suffixes at which to store individual values. + +##### values + +(`null` \| `Uint8Array`\<`ArrayBufferLike`\>)[] + +the value(s) to store (or null for deletion). + +#### Returns + +`Promise`\<`void`\> + +A Promise that resolves once the value is stored. + +*** + +### revert() + +> **revert**(): `Promise`\<`void`\> + +Defined in: [binaryTree.ts:673](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L673) + +Reverts the tree to the state it was at when `checkpoint` was first called. +If during a nested checkpoint, sets root to most recent checkpoint, and sets +parent checkpoint as current. + +#### Returns + +`Promise`\<`void`\> + +*** + +### root() + +> **root**(`value?`): `Uint8Array` + +Defined in: [binaryTree.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L94) + +Gets and/or Sets the current root of the `tree` + +#### Parameters + +##### value? + +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`Uint8Array` + +*** + +### saveStack() + +> **saveStack**(`putStack`): `Promise`\<`void`\> + +Defined in: [binaryTree.ts:566](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L566) + +Saves a stack of nodes to the database. + +#### Parameters + +##### putStack + +\[`Uint8Array`\<`ArrayBufferLike`\>, `null` \| [`BinaryNode`](../type-aliases/BinaryNode.md)\][] + +an array of tuples of keys (the partial path of the node in the trie) and nodes (BinaryNodes) + +#### Returns + +`Promise`\<`void`\> + +*** + +### shallowCopy() + +> **shallowCopy**(`includeCheckpoints`): `BinaryTree` + +Defined in: [binaryTree.ts:615](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L615) + +Returns a copy of the underlying tree. + +Note on db: the copy will create a reference to the +same underlying database. + +Note on cache: for memory reasons a copy will not +recreate a new LRU cache but initialize with cache +being deactivated. + +#### Parameters + +##### includeCheckpoints + +`boolean` = `true` + +If true and during a checkpoint, the copy will contain the checkpointing metadata and will use the same scratch as underlying db. + +#### Returns + +`BinaryTree` + +*** + +### updateBranch() + +> **updateBranch**(`stemNode`, `nearestNode`, `pathToNode`, `pathToParent`): `undefined` \| `object`[] + +Defined in: [binaryTree.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/binaryTree.ts#L349) + +Helper method for updating or creating the parent internal node for a given stem node. +If the nearest node is a stem node with a different stem, a new internal node is created +to branch at the first differing bit. +If the nearest node is an internal node, its child reference is updated. + +#### Parameters + +##### stemNode + +`StemBinaryNode` + +The child stem node that will be referenced by the new/updated internal node. + +##### nearestNode + +[`BinaryNode`](../type-aliases/BinaryNode.md) + +The nearest node to the new stem node. + +##### pathToNode + +`number`[] + +The path (in bits) to `nearestNode` as known from the trie. + +##### pathToParent + +`number`[] + +#### Returns + +`undefined` \| `object`[] + +An array of nodes and their partial paths from the new stem node to the branch parent node + or `undefined` if no changes were made. diff --git a/packages/binarytree/docs/classes/CheckpointDB.md b/packages/binarytree/docs/classes/CheckpointDB.md new file mode 100644 index 00000000000..55150617b8c --- /dev/null +++ b/packages/binarytree/docs/classes/CheckpointDB.md @@ -0,0 +1,372 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / CheckpointDB + +# Class: CheckpointDB + +Defined in: [db/checkpoint.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L16) + +DB is a thin wrapper around the underlying levelup db, +which validates inputs and sets encoding type. + +## Implements + +- `DB` + +## Constructors + +### Constructor + +> **new CheckpointDB**(`opts`): `CheckpointDB` + +Defined in: [db/checkpoint.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L50) + +Initialize a DB instance. + +#### Parameters + +##### opts + +[`CheckpointDBOpts`](../interfaces/CheckpointDBOpts.md) + +#### Returns + +`CheckpointDB` + +## Properties + +### \_stats + +> **\_stats**: `object` + +Defined in: [db/checkpoint.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L34) + +#### cache + +> **cache**: `object` + +##### cache.hits + +> **hits**: `number` = `0` + +##### cache.reads + +> **reads**: `number` = `0` + +##### cache.writes + +> **writes**: `number` = `0` + +#### db + +> **db**: `object` + +##### db.hits + +> **hits**: `number` = `0` + +##### db.reads + +> **reads**: `number` = `0` + +##### db.writes + +> **writes**: `number` = `0` + +*** + +### cacheSize + +> `readonly` **cacheSize**: `number` + +Defined in: [db/checkpoint.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L19) + +*** + +### checkpoints + +> **checkpoints**: [`Checkpoint`](../type-aliases/Checkpoint.md)[] + +Defined in: [db/checkpoint.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L17) + +*** + +### db + +> **db**: `DB`\<`string`, `string` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [db/checkpoint.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L18) + +## Methods + +### batch() + +> **batch**(`opStack`): `Promise`\<`void`\> + +Defined in: [db/checkpoint.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L229) + +#### Parameters + +##### opStack + +`BatchDBOp`[] + +#### Returns + +`Promise`\<`void`\> + +#### Inherit Doc + +#### Implementation of + +`DB.batch` + +*** + +### checkpoint() + +> **checkpoint**(`root`): `void` + +Defined in: [db/checkpoint.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L91) + +Adds a new checkpoint to the stack + +#### Parameters + +##### root + +`Uint8Array` + +#### Returns + +`void` + +*** + +### commit() + +> **commit**(): `Promise`\<`void`\> + +Defined in: [db/checkpoint.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L98) + +Commits the latest checkpoint + +#### Returns + +`Promise`\<`void`\> + +*** + +### del() + +> **del**(`key`): `Promise`\<`void`\> + +Defined in: [db/checkpoint.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L207) + +#### Parameters + +##### key + +`Uint8Array` + +#### Returns + +`Promise`\<`void`\> + +#### Inherit Doc + +#### Implementation of + +`DB.del` + +*** + +### get() + +> **get**(`key`): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [db/checkpoint.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L138) + +#### Parameters + +##### key + +`Uint8Array` + +#### Returns + +`Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +#### Inherit Doc + +#### Implementation of + +`DB.get` + +*** + +### hasCheckpoints() + +> **hasCheckpoints**(): `boolean` + +Defined in: [db/checkpoint.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L83) + +Is the DB during a checkpoint phase? + +#### Returns + +`boolean` + +*** + +### open() + +> **open**(): `Promise`\<`void`\> + +Defined in: [db/checkpoint.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L291) + +Opens the database -- if applicable + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`DB.open` + +*** + +### put() + +> **put**(`key`, `value`): `Promise`\<`void`\> + +Defined in: [db/checkpoint.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L183) + +#### Parameters + +##### key + +`Uint8Array` + +##### value + +`Uint8Array` + +#### Returns + +`Promise`\<`void`\> + +#### Inherit Doc + +#### Implementation of + +`DB.put` + +*** + +### revert() + +> **revert**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [db/checkpoint.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L130) + +Reverts the latest checkpoint + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +*** + +### setCheckpoints() + +> **setCheckpoints**(`checkpoints`): `void` + +Defined in: [db/checkpoint.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L69) + +Flush the checkpoints and use the given checkpoints instead. + +#### Parameters + +##### checkpoints + +[`Checkpoint`](../type-aliases/Checkpoint.md)[] + +#### Returns + +`void` + +*** + +### shallowCopy() + +> **shallowCopy**(): `CheckpointDB` + +Defined in: [db/checkpoint.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L283) + +#### Returns + +`CheckpointDB` + +#### Inherit Doc + +#### Implementation of + +`DB.shallowCopy` + +*** + +### stats() + +> **stats**(`reset`): `object` + +Defined in: [db/checkpoint.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/db/checkpoint.ts#L261) + +#### Parameters + +##### reset + +`boolean` = `true` + +#### Returns + +`object` + +##### cache + +> **cache**: `object` + +###### cache.hits + +> **hits**: `number` = `0` + +###### cache.reads + +> **reads**: `number` = `0` + +###### cache.writes + +> **writes**: `number` = `0` + +##### db + +> **db**: `object` + +###### db.hits + +> **hits**: `number` = `0` + +###### db.reads + +> **reads**: `number` = `0` + +###### db.writes + +> **writes**: `number` = `0` + +##### size + +> **size**: `number` diff --git a/packages/binarytree/docs/classes/InternalBinaryNode.md b/packages/binarytree/docs/classes/InternalBinaryNode.md new file mode 100644 index 00000000000..a577a3d209e --- /dev/null +++ b/packages/binarytree/docs/classes/InternalBinaryNode.md @@ -0,0 +1,168 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / InternalBinaryNode + +# Class: InternalBinaryNode + +Defined in: [node/internalNode.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L8) + +## Constructors + +### Constructor + +> **new InternalBinaryNode**(`options`): `InternalBinaryNode` + +Defined in: [node/internalNode.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L13) + +#### Parameters + +##### options + +`InternalBinaryNodeOptions` + +#### Returns + +`InternalBinaryNode` + +## Properties + +### children + +> **children**: (`null` \| [`ChildBinaryNode`](../type-aliases/ChildBinaryNode.md))[] + +Defined in: [node/internalNode.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L9) + +*** + +### type + +> **type**: `0` = `BinaryNodeType.Internal` + +Defined in: [node/internalNode.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L11) + +## Methods + +### getChild() + +> **getChild**(`index`): `null` \| [`ChildBinaryNode`](../type-aliases/ChildBinaryNode.md) + +Defined in: [node/internalNode.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L70) + +#### Parameters + +##### index + +`number` + +#### Returns + +`null` \| [`ChildBinaryNode`](../type-aliases/ChildBinaryNode.md) + +*** + +### raw() + +> **raw**(): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [node/internalNode.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L101) + +Returns the raw serialized representation of this internal node as an array of Uint8Arrays. + +The returned array contains: +1. A single-byte Uint8Array indicating the node type (BinaryNodeType.Internal). +2. For each child (left then right): + - The child’s hash, or an empty Uint8Array if the child is null. +3. For each child (left then right): + - An RLP-encoded tuple [pathLength, packedPathBytes] where: + - `pathLength` is a one-byte Uint8Array representing the number of meaningful bits in the child’s path. + - `packedPathBytes` is the packed byte representation of the child's bit path (as produced by `bitsToBytes`). + +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] + +An array of Uint8Arrays representing the node's serialized internal data. + +#### Dev + +When decoding, the stored child path (an RLP-encoded tuple) must be converted back into the original bit array. + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [node/internalNode.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L81) + +#### Returns + +`Uint8Array` + +the RLP serialized node + +*** + +### setChild() + +> **setChild**(`index`, `child`): `void` + +Defined in: [node/internalNode.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L74) + +#### Parameters + +##### index + +`number` + +##### child + +`null` | [`ChildBinaryNode`](../type-aliases/ChildBinaryNode.md) + +#### Returns + +`void` + +*** + +### create() + +> `static` **create**(`children?`): `InternalBinaryNode` + +Defined in: [node/internalNode.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L63) + +Generates a new Internal node + +#### Parameters + +##### children? + +(`null` \| [`ChildBinaryNode`](../type-aliases/ChildBinaryNode.md))[] + +the children nodes + +#### Returns + +`InternalBinaryNode` + +a new Internal node + +*** + +### fromRawNode() + +> `static` **fromRawNode**(`rawNode`): `InternalBinaryNode` + +Defined in: [node/internalNode.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/internalNode.ts#L17) + +#### Parameters + +##### rawNode + +`Uint8Array`\<`ArrayBufferLike`\>[] + +#### Returns + +`InternalBinaryNode` diff --git a/packages/binarytree/docs/functions/binaryTreeFromProof.md b/packages/binarytree/docs/functions/binaryTreeFromProof.md new file mode 100644 index 00000000000..138639fcccb --- /dev/null +++ b/packages/binarytree/docs/functions/binaryTreeFromProof.md @@ -0,0 +1,23 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / binaryTreeFromProof + +# Function: binaryTreeFromProof() + +> **binaryTreeFromProof**(`proof`): `Promise`\<[`BinaryTree`](../classes/BinaryTree.md)\> + +Defined in: [proof.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/proof.ts#L14) + +Saves the nodes from a proof into the tree. + +## Parameters + +### proof + +`Uint8Array`\<`ArrayBufferLike`\>[] + +## Returns + +`Promise`\<[`BinaryTree`](../classes/BinaryTree.md)\> diff --git a/packages/binarytree/docs/functions/createBinaryTree.md b/packages/binarytree/docs/functions/createBinaryTree.md new file mode 100644 index 00000000000..de0e6cc3ccb --- /dev/null +++ b/packages/binarytree/docs/functions/createBinaryTree.md @@ -0,0 +1,21 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / createBinaryTree + +# Function: createBinaryTree() + +> **createBinaryTree**(`opts?`): `Promise`\<[`BinaryTree`](../classes/BinaryTree.md)\> + +Defined in: [constructors.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/constructors.ts#L15) + +## Parameters + +### opts? + +`Partial`\<[`BinaryTreeOpts`](../interfaces/BinaryTreeOpts.md)\> + +## Returns + +`Promise`\<[`BinaryTree`](../classes/BinaryTree.md)\> diff --git a/packages/binarytree/docs/functions/decodeBinaryNode.md b/packages/binarytree/docs/functions/decodeBinaryNode.md new file mode 100644 index 00000000000..c47b5ef5db2 --- /dev/null +++ b/packages/binarytree/docs/functions/decodeBinaryNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / decodeBinaryNode + +# Function: decodeBinaryNode() + +> **decodeBinaryNode**(`raw`): [`BinaryNode`](../type-aliases/BinaryNode.md) + +Defined in: [node/util.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/util.ts#L20) + +## Parameters + +### raw + +`Uint8Array` + +## Returns + +[`BinaryNode`](../type-aliases/BinaryNode.md) diff --git a/packages/binarytree/docs/functions/decodeRawBinaryNode.md b/packages/binarytree/docs/functions/decodeRawBinaryNode.md new file mode 100644 index 00000000000..095f6c02a0b --- /dev/null +++ b/packages/binarytree/docs/functions/decodeRawBinaryNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / decodeRawBinaryNode + +# Function: decodeRawBinaryNode() + +> **decodeRawBinaryNode**(`raw`): [`BinaryNode`](../type-aliases/BinaryNode.md) + +Defined in: [node/util.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/util.ts#L8) + +## Parameters + +### raw + +`Uint8Array`\<`ArrayBufferLike`\>[] + +## Returns + +[`BinaryNode`](../type-aliases/BinaryNode.md) diff --git a/packages/binarytree/docs/functions/isInternalBinaryNode.md b/packages/binarytree/docs/functions/isInternalBinaryNode.md new file mode 100644 index 00000000000..8a7e0698f27 --- /dev/null +++ b/packages/binarytree/docs/functions/isInternalBinaryNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / isInternalBinaryNode + +# Function: isInternalBinaryNode() + +> **isInternalBinaryNode**(`node`): `node is InternalBinaryNode` + +Defined in: [node/util.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/util.ts#L32) + +## Parameters + +### node + +[`BinaryNode`](../type-aliases/BinaryNode.md) + +## Returns + +`node is InternalBinaryNode` diff --git a/packages/binarytree/docs/functions/isRawBinaryNode.md b/packages/binarytree/docs/functions/isRawBinaryNode.md new file mode 100644 index 00000000000..5ada9eb00fd --- /dev/null +++ b/packages/binarytree/docs/functions/isRawBinaryNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / isRawBinaryNode + +# Function: isRawBinaryNode() + +> **isRawBinaryNode**(`node`): `node is Uint8Array[]` + +Defined in: [node/util.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/util.ts#L28) + +## Parameters + +### node + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +## Returns + +`node is Uint8Array[]` diff --git a/packages/binarytree/docs/functions/isStemBinaryNode.md b/packages/binarytree/docs/functions/isStemBinaryNode.md new file mode 100644 index 00000000000..a090c2f27a5 --- /dev/null +++ b/packages/binarytree/docs/functions/isStemBinaryNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / isStemBinaryNode + +# Function: isStemBinaryNode() + +> **isStemBinaryNode**(`node`): `node is StemBinaryNode` + +Defined in: [node/util.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/util.ts#L36) + +## Parameters + +### node + +[`BinaryNode`](../type-aliases/BinaryNode.md) + +## Returns + +`node is StemBinaryNode` diff --git a/packages/binarytree/docs/functions/verifyBinaryProof.md b/packages/binarytree/docs/functions/verifyBinaryProof.md new file mode 100644 index 00000000000..afed331a94d --- /dev/null +++ b/packages/binarytree/docs/functions/verifyBinaryProof.md @@ -0,0 +1,37 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / verifyBinaryProof + +# Function: verifyBinaryProof() + +> **verifyBinaryProof**(`rootHash`, `key`, `proof`): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [proof.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/proof.ts#L34) + +Verifies a proof. + +## Parameters + +### rootHash + +`Uint8Array` + +### key + +`Uint8Array` + +### proof + +`Uint8Array`\<`ArrayBufferLike`\>[] + +## Returns + +`Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +The value from the key, or null if valid proof of non-existence. + +## Throws + +If proof is found to be invalid. diff --git a/packages/binarytree/docs/interfaces/BinaryNodeOptions.md b/packages/binarytree/docs/interfaces/BinaryNodeOptions.md new file mode 100644 index 00000000000..bc54b393f20 --- /dev/null +++ b/packages/binarytree/docs/interfaces/BinaryNodeOptions.md @@ -0,0 +1,25 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / BinaryNodeOptions + +# Interface: BinaryNodeOptions + +Defined in: [node/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L36) + +## Properties + +### 0 + +> **0**: `InternalBinaryNodeOptions` + +Defined in: [node/types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L37) + +*** + +### 1 + +> **1**: `StemBinaryNodeOptions` + +Defined in: [node/types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L38) diff --git a/packages/binarytree/docs/interfaces/BinaryTreeOpts.md b/packages/binarytree/docs/interfaces/BinaryTreeOpts.md new file mode 100644 index 00000000000..f10512e7bcd --- /dev/null +++ b/packages/binarytree/docs/interfaces/BinaryTreeOpts.md @@ -0,0 +1,71 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / BinaryTreeOpts + +# Interface: BinaryTreeOpts + +Defined in: [types.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L5) + +## Properties + +### cacheSize + +> **cacheSize**: `number` + +Defined in: [types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L26) + +LRU cache for tree nodes to allow for faster node retrieval. + +Default: 0 (deactivated) + +*** + +### db + +> **db**: `DB`\<`string`, `string` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [types.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L9) + +A database instance. + +*** + +### hashFunction() + +> **hashFunction**: (`msg`) => `Uint8Array` + +Defined in: [types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L31) + +Hash function used for hashing the tree nodes. + +#### Parameters + +##### msg + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### root? + +> `optional` **root**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L14) + +A `Uint8Array` for the root of a previously stored tree + +*** + +### useRootPersistence + +> **useRootPersistence**: `boolean` + +Defined in: [types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L19) + +Store the root inside the database after every `write` operation diff --git a/packages/binarytree/docs/interfaces/CheckpointDBOpts.md b/packages/binarytree/docs/interfaces/CheckpointDBOpts.md new file mode 100644 index 00000000000..dcd145331e9 --- /dev/null +++ b/packages/binarytree/docs/interfaces/CheckpointDBOpts.md @@ -0,0 +1,39 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / CheckpointDBOpts + +# Interface: CheckpointDBOpts + +Defined in: [types.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L34) + +## Properties + +### cacheSize? + +> `optional` **cacheSize**: `number` + +Defined in: [types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L48) + +Cache size (default: 0) + +*** + +### db + +> **db**: `DB`\<`string`, `string` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L38) + +A database instance. + +*** + +### valueEncoding? + +> `optional` **valueEncoding**: `ValueEncoding` + +Defined in: [types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L43) + +ValueEncoding of the database (the values which are `put`/`get` in the db are of this type). Defaults to `string` diff --git a/packages/binarytree/docs/interfaces/TypedBinaryNode.md b/packages/binarytree/docs/interfaces/TypedBinaryNode.md new file mode 100644 index 00000000000..1230ade0ae1 --- /dev/null +++ b/packages/binarytree/docs/interfaces/TypedBinaryNode.md @@ -0,0 +1,25 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / TypedBinaryNode + +# Interface: TypedBinaryNode + +Defined in: [node/types.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L10) + +## Properties + +### 0 + +> **0**: [`InternalBinaryNode`](../classes/InternalBinaryNode.md) + +Defined in: [node/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L11) + +*** + +### 1 + +> **1**: `StemBinaryNode` + +Defined in: [node/types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L12) diff --git a/packages/binarytree/docs/type-aliases/BinaryNode.md b/packages/binarytree/docs/type-aliases/BinaryNode.md new file mode 100644 index 00000000000..05b23eb8721 --- /dev/null +++ b/packages/binarytree/docs/type-aliases/BinaryNode.md @@ -0,0 +1,11 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / BinaryNode + +# Type Alias: BinaryNode + +> **BinaryNode** = [`TypedBinaryNode`](../interfaces/TypedBinaryNode.md)\[[`BinaryNodeType`](BinaryNodeType.md)\] + +Defined in: [node/types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L15) diff --git a/packages/binarytree/docs/type-aliases/BinaryNodeType.md b/packages/binarytree/docs/type-aliases/BinaryNodeType.md new file mode 100644 index 00000000000..cdd815ddf2a --- /dev/null +++ b/packages/binarytree/docs/type-aliases/BinaryNodeType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / BinaryNodeType + +# Type Alias: BinaryNodeType + +> **BinaryNodeType** = *typeof* [`BinaryNodeType`](../variables/BinaryNodeType.md)\[keyof *typeof* [`BinaryNodeType`](../variables/BinaryNodeType.md)\] + +Defined in: [node/types.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L4) diff --git a/packages/binarytree/docs/type-aliases/Checkpoint.md b/packages/binarytree/docs/type-aliases/Checkpoint.md new file mode 100644 index 00000000000..473d4361fd8 --- /dev/null +++ b/packages/binarytree/docs/type-aliases/Checkpoint.md @@ -0,0 +1,27 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / Checkpoint + +# Type Alias: Checkpoint + +> **Checkpoint** = `object` + +Defined in: [types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L51) + +## Properties + +### keyValueMap + +> **keyValueMap**: `Map`\<`string`, `Uint8Array` \| `undefined`\> + +Defined in: [types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L54) + +*** + +### root + +> **root**: `Uint8Array` + +Defined in: [types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L55) diff --git a/packages/binarytree/docs/type-aliases/ChildBinaryNode.md b/packages/binarytree/docs/type-aliases/ChildBinaryNode.md new file mode 100644 index 00000000000..e6d1b6e6f5b --- /dev/null +++ b/packages/binarytree/docs/type-aliases/ChildBinaryNode.md @@ -0,0 +1,39 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / ChildBinaryNode + +# Type Alias: ChildBinaryNode + +> **ChildBinaryNode** = `object` + +Defined in: [node/types.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L22) + +## Dev + +A child node in a binary tree internal node. + +## Param + +The hash of the child node. + +## Param + +The path to the child node, in bits. + +## Properties + +### hash + +> **hash**: `Uint8Array` + +Defined in: [node/types.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L23) + +*** + +### path + +> **path**: `number`[] + +Defined in: [node/types.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L24) diff --git a/packages/binarytree/docs/variables/BinaryNodeType.md b/packages/binarytree/docs/variables/BinaryNodeType.md new file mode 100644 index 00000000000..cf41519d676 --- /dev/null +++ b/packages/binarytree/docs/variables/BinaryNodeType.md @@ -0,0 +1,21 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / BinaryNodeType + +# Variable: BinaryNodeType + +> **BinaryNodeType**: `object` + +Defined in: [node/types.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L4) + +## Type declaration + +### Internal + +> `readonly` **Internal**: `0` = `0` + +### Stem + +> `readonly` **Stem**: `1` = `1` diff --git a/packages/binarytree/docs/variables/NODE_WIDTH.md b/packages/binarytree/docs/variables/NODE_WIDTH.md new file mode 100644 index 00000000000..b16f40c7c6a --- /dev/null +++ b/packages/binarytree/docs/variables/NODE_WIDTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / NODE\_WIDTH + +# Variable: NODE\_WIDTH + +> `const` **NODE\_WIDTH**: `256` = `256` + +Defined in: [node/types.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/node/types.ts#L41) diff --git a/packages/binarytree/docs/variables/ROOT_DB_KEY.md b/packages/binarytree/docs/variables/ROOT_DB_KEY.md new file mode 100644 index 00000000000..424fe78325b --- /dev/null +++ b/packages/binarytree/docs/variables/ROOT_DB_KEY.md @@ -0,0 +1,11 @@ +[**@ethereumjs/binarytree**](../README.md) + +*** + +[@ethereumjs/binarytree](../README.md) / ROOT\_DB\_KEY + +# Variable: ROOT\_DB\_KEY + +> `const` **ROOT\_DB\_KEY**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [types.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/binarytree/src/types.ts#L58) diff --git a/packages/binarytree/package.json b/packages/binarytree/package.json index c5b107aefa2..df271533594 100644 --- a/packages/binarytree/package.json +++ b/packages/binarytree/package.json @@ -40,7 +40,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", "lint:fix": "npm run biome:fix && eslint --fix --config ./eslint.config.mjs .", "prepublishOnly": "../../config/cli/prepublish.sh", @@ -58,7 +58,7 @@ "@ethereumjs/util": "^10.0.0-rc.1", "@noble/hashes": "^1.7.2", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "lru-cache": "11.0.2" }, "engines": { diff --git a/packages/binarytree/test/node/internalNode.spec.ts b/packages/binarytree/test/node/internalNode.spec.ts index 6c3e5890d51..c62d76f3601 100644 --- a/packages/binarytree/test/node/internalNode.spec.ts +++ b/packages/binarytree/test/node/internalNode.spec.ts @@ -2,17 +2,16 @@ import { equalsBytes, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' import { BinaryNodeType, InternalBinaryNode, decodeBinaryNode } from '../../src/index.ts' -import {} from '../../src/types.ts' describe('InternalBinaryNode', () => { it('should round-trip encode and decode an internal node', () => { // Create dummy child pointers: const leftCanonicalChild = { - hash: hexToBytes('0x' + '11'.repeat(32)), + hash: hexToBytes(`0x${'11'.repeat(32)}`), path: [0, 1, 1, 0, 1, 0], } const rightCanonicalChild = { - hash: hexToBytes('0x' + '22'.repeat(32)), + hash: hexToBytes(`0x${'22'.repeat(32)}`), path: [1, 1, 0, 0], } const node = InternalBinaryNode.create([leftCanonicalChild, rightCanonicalChild]) diff --git a/packages/binarytree/test/node/stemNode.spec.ts b/packages/binarytree/test/node/stemNode.spec.ts index 941ce9a6612..d55436e3744 100644 --- a/packages/binarytree/test/node/stemNode.spec.ts +++ b/packages/binarytree/test/node/stemNode.spec.ts @@ -7,14 +7,14 @@ import { StemBinaryNode } from '../../src/node/stemNode.ts' describe('StemBinaryNode', () => { it('should round-trip encode and decode a stem node', () => { // Create a 31-byte stem (for example, all 0x01 bytes) - const stem = hexToBytes('0x' + '01'.repeat(31)) + const stem = hexToBytes(`0x${'01'.repeat(31)}`) // Create an array of 256 possible values (initially all null) const values: (Uint8Array | null)[] = new Array(256).fill(null) // Set a few non-null values at specific indices - const value3 = hexToBytes('0x' + '02'.repeat(32)) - const value100 = hexToBytes('0x' + '03'.repeat(32)) - const value255 = hexToBytes('0x' + '04'.repeat(32)) + const value3 = hexToBytes(`0x${'02'.repeat(32)}`) + const value100 = hexToBytes(`0x${'03'.repeat(32)}`) + const value255 = hexToBytes(`0x${'04'.repeat(32)}`) values[3] = value3 values[100] = value100 values[255] = value255 diff --git a/packages/statemanager/typedoc.cjs b/packages/binarytree/typedoc.mjs similarity index 54% rename from packages/statemanager/typedoc.cjs rename to packages/binarytree/typedoc.mjs index 701fee055fa..4f962d06684 100644 --- a/packages/statemanager/typedoc.cjs +++ b/packages/binarytree/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts'], diff --git a/packages/block/README.md b/packages/block/README.md index 638f415f504..5b04ea69ddc 100644 --- a/packages/block/README.md +++ b/packages/block/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/block +# @ethereumjs/block `v10` [![NPM Package][block-npm-badge]][block-npm-link] [![GitHub Issues][block-issues-badge]][block-issues-link] @@ -9,6 +9,26 @@ | Implements schema and functions related to Ethereum blocks. | | ----------------------------------------------------------- | +- 🦄 All block features till **Pectra** +- 🌴 Tree-shakeable API +- 👷🏼 Controlled dependency set (4 external + `@Noble` crypto) +- 🔮 `EIP-4844` Shard Blob Txs +- 💸 `EIP-4895` Beacon Chain Withdrawals +- 📨 `EIP-7685` Consensus Layer Requests +- 🛵 324KB bundle size (81KB gzipped) +- 🏄🏾‍♂️ WASM-free default + Fully browser ready + +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [EIP Integrations](#eip-integrations) +- [Consensus Types](#consensus-types) +- [Browser](#browser) +- [API](#api) +- [Testing](#testing) +- [EthereumJS](#ethereumjs) +- [License](#license) ## Installation @@ -20,9 +40,9 @@ npm install @ethereumjs/block **Note:** If you want to work with `EIP-4844` related functionality, you will have additional initialization steps for the **KZG setup**, see related section below. -## Usage +## Getting Started -### Introduction +### Instantiation There are several standalone functions to instantiate a `Block`: @@ -82,7 +102,9 @@ try { This library by default uses JavaScript implementations for the basic standard crypto primitives like hashing or signature verification (for included txs). See `@ethereumjs/common` [README](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common) for instructions on how to replace with e.g. a more performant WASM implementation by using a shared `common` instance. -### EIP-1559 Blocks +## EIP Integrations + +### Blocks with an EIP-1559 Fee Market By default (since `Hardfork.London`) blocks created with this library are [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) compatible. @@ -141,7 +163,7 @@ try { } ``` -### EIP-4895 Beacon Chain Withdrawals Blocks +### Blocks with EIP-4895 Beacon Chain Withdrawals Starting with the `v4.1.0` release there is support for [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) beacon chain withdrawals (`Hardfork.Shanghai` or higher). To create a block containing system-level withdrawals, the `withdrawals` data option together with a matching `withdrawalsRoot` can be used: @@ -182,7 +204,7 @@ console.log(`Block with ${block.withdrawals!.length} withdrawal(s) created`) Validation of the withdrawals trie can be manually triggered with the newly introduced async `Block.withdrawalsTrieIsValid()` method. -### EIP-4844 Shard Blob Transaction Blocks +### Blocks with EIP-4844 Shard Blob Transactions This library supports the blob transaction type introduced with [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) (`Hardfork.Cancun` or higher), see the following example: @@ -240,6 +262,39 @@ void main() Starting with v10 this library supports requests to the consensus layer which have been introduced with [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) (`Hardfork.Prague` or higher). See the `@ethereumjs/util` [Request](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util#module-request) README section for an overview of current request types. +```ts +// ./examples/clrequests.ts + +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { createCLRequest, CLRequestType, hexToBytes, bytesToHex } from '@ethereumjs/util' +import { sha256 } from 'ethereum-cryptography/sha256.js' + +import { createBlock, genRequestsRoot } from '../src' + +// Enable EIP-7685 to support CLRequests +const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7685] }) + +// Create the three CLRequest types (Deposit, Withdrawal, Consolidation) +const depositData = hexToBytes('0x00...') // Deposit request data +const depositRequest = createCLRequest(depositData) + +const withdrawalData = hexToBytes('0x01...') // Withdrawal request data +const withdrawalRequest = createCLRequest(withdrawalData) + +const consolidationData = hexToBytes('0x02...') // Consolidation request data +const consolidationRequest = createCLRequest(consolidationData) + +// CLRequests must be sorted by type (Deposit=0, Withdrawal=1, Consolidation=2) +const requests = [depositRequest, withdrawalRequest, consolidationRequest] + +// Generate the requestsHash +const requestsHash = genRequestsRoot(requests, sha256) + +// Create a block with the CLRequests hash +const block = createBlock({ header: { requestsHash } }, { common }) +console.log(`Created block with CLRequests hash: 0x${bytesToHex(block.hash())}`) +``` + ### Consensus Types ### Proof-of-Stake diff --git a/packages/block/docs/README.md b/packages/block/docs/README.md index f2067e66e4b..7f88e5a05b3 100644 --- a/packages/block/docs/README.md +++ b/packages/block/docs/README.md @@ -1,188 +1,64 @@ -@ethereumjs/block +**@ethereumjs/block** -# @ethereumjs/block +*** -## Table of contents +# @ethereumjs/block -### Classes +## Classes - [Block](classes/Block.md) - [BlockHeader](classes/BlockHeader.md) -### Interfaces +## Interfaces - [BlockData](interfaces/BlockData.md) - [BlockOptions](interfaces/BlockOptions.md) - [HeaderData](interfaces/HeaderData.md) -- [JsonBlock](interfaces/JsonBlock.md) -- [JsonHeader](interfaces/JsonHeader.md) -- [JsonRpcBlock](interfaces/JsonRpcBlock.md) -- [VerkleExecutionWitness](interfaces/VerkleExecutionWitness.md) -- [VerkleProof](interfaces/VerkleProof.md) -- [VerkleStateDiff](interfaces/VerkleStateDiff.md) - -### Type Aliases - -- [BlockBodyBytes](README.md#blockbodybytes) -- [BlockBytes](README.md#blockbytes) -- [BlockHeaderBytes](README.md#blockheaderbytes) -- [ExecutionPayload](README.md#executionpayload) -- [ExecutionWitnessBytes](README.md#executionwitnessbytes) -- [TransactionsBytes](README.md#transactionsbytes) -- [UncleHeadersBytes](README.md#uncleheadersbytes) -- [WithdrawalV1](README.md#withdrawalv1) -- [WithdrawalsBytes](README.md#withdrawalsbytes) - -### Functions - -- [executionPayloadFromBeaconPayload](README.md#executionpayloadfrombeaconpayload) +- [JSONBlock](interfaces/JSONBlock.md) +- [JSONHeader](interfaces/JSONHeader.md) +- [JSONRPCBlock](interfaces/JSONRPCBlock.md) ## Type Aliases -### BlockBodyBytes - -Ƭ **BlockBodyBytes**: [[`TransactionsBytes`](README.md#transactionsbytes), [`UncleHeadersBytes`](README.md#uncleheadersbytes), WithdrawalsBytes?] - -#### Defined in - -[types.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L174) - -___ - -### BlockBytes - -Ƭ **BlockBytes**: [[`BlockHeaderBytes`](README.md#blockheaderbytes), [`TransactionsBytes`](README.md#transactionsbytes), [`UncleHeadersBytes`](README.md#uncleheadersbytes)] \| [[`BlockHeaderBytes`](README.md#blockheaderbytes), [`TransactionsBytes`](README.md#transactionsbytes), [`UncleHeadersBytes`](README.md#uncleheadersbytes), [`WithdrawalsBytes`](README.md#withdrawalsbytes)] \| [[`BlockHeaderBytes`](README.md#blockheaderbytes), [`TransactionsBytes`](README.md#transactionsbytes), [`UncleHeadersBytes`](README.md#uncleheadersbytes), [`WithdrawalsBytes`](README.md#withdrawalsbytes), [`ExecutionWitnessBytes`](README.md#executionwitnessbytes)] - -#### Defined in - -[types.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L159) - -___ - -### BlockHeaderBytes - -Ƭ **BlockHeaderBytes**: `Uint8Array`[] - -BlockHeaderBuffer is a Buffer array, except for the Verkle PreState which is an array of prestate arrays. - -#### Defined in - -[types.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L173) - -___ - -### ExecutionPayload - -Ƭ **ExecutionPayload**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `baseFeePerGas` | `PrefixedHexString` | -| `blobGasUsed?` | `PrefixedHexString` | -| `blockHash` | `PrefixedHexString` | -| `blockNumber` | `PrefixedHexString` | -| `excessBlobGas?` | `PrefixedHexString` | -| `executionWitness?` | [`VerkleExecutionWitness`](interfaces/VerkleExecutionWitness.md) \| ``null`` | -| `extraData` | `PrefixedHexString` | -| `feeRecipient` | `PrefixedHexString` | -| `gasLimit` | `PrefixedHexString` | -| `gasUsed` | `PrefixedHexString` | -| `logsBloom` | `PrefixedHexString` | -| `parentBeaconBlockRoot?` | `PrefixedHexString` | -| `parentHash` | `PrefixedHexString` | -| `prevRandao` | `PrefixedHexString` | -| `receiptsRoot` | `PrefixedHexString` | -| `stateRoot` | `PrefixedHexString` | -| `timestamp` | `PrefixedHexString` | -| `transactions` | `PrefixedHexString`[] | -| `withdrawals?` | [`WithdrawalV1`](README.md#withdrawalv1)[] | - -#### Defined in - -[types.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L263) - -___ - -### ExecutionWitnessBytes - -Ƭ **ExecutionWitnessBytes**: `Uint8Array` - -#### Defined in +- [BeaconPayloadJSON](type-aliases/BeaconPayloadJSON.md) +- [BlockBodyBytes](type-aliases/BlockBodyBytes.md) +- [BlockBytes](type-aliases/BlockBytes.md) +- [BlockHeaderBytes](type-aliases/BlockHeaderBytes.md) +- [ExecutionPayload](type-aliases/ExecutionPayload.md) +- [ExecutionWitnessBytes](type-aliases/ExecutionWitnessBytes.md) +- [TransactionsBytes](type-aliases/TransactionsBytes.md) +- [UncleHeadersBytes](type-aliases/UncleHeadersBytes.md) +- [WithdrawalsBytes](type-aliases/WithdrawalsBytes.md) +- [WithdrawalV1](type-aliases/WithdrawalV1.md) -[types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L157) +## Variables -___ - -### TransactionsBytes - -Ƭ **TransactionsBytes**: `Uint8Array`[][] \| `Uint8Array`[] - -TransactionsBytes can be an array of serialized txs for Typed Transactions or an array of Uint8Array Arrays for legacy transactions. - -#### Defined in - -[types.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L178) - -___ - -### UncleHeadersBytes - -Ƭ **UncleHeadersBytes**: `Uint8Array`[][] - -#### Defined in - -[types.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L179) - -___ - -### WithdrawalV1 - -Ƭ **WithdrawalV1**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `address` | `PrefixedHexString` | -| `amount` | `PrefixedHexString` | -| `index` | `PrefixedHexString` | -| `validatorIndex` | `PrefixedHexString` | - -#### Defined in - -[types.ts:255](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L255) - -___ - -### WithdrawalsBytes - -Ƭ **WithdrawalsBytes**: `WithdrawalBytes`[] - -#### Defined in - -[types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L156) +- [CLIQUE\_EXTRA\_SEAL](variables/CLIQUE_EXTRA_SEAL.md) +- [CLIQUE\_EXTRA\_VANITY](variables/CLIQUE_EXTRA_VANITY.md) +- [paramsBlock](variables/paramsBlock.md) ## Functions -### executionPayloadFromBeaconPayload - -▸ **executionPayloadFromBeaconPayload**(`payload`): [`ExecutionPayload`](README.md#executionpayload) - -Converts a beacon block execution payload JSON object BeaconPayloadJson to the [ExecutionPayload](README.md#executionpayload) data needed to construct a [Block](classes/Block.md). -The JSON data can be retrieved from a consensus layer (CL) client on this Beacon API `/eth/v2/beacon/blocks/[block number]` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `payload` | `BeaconPayloadJson` | - -#### Returns - -[`ExecutionPayload`](README.md#executionpayload) - -#### Defined in - -[from-beacon-payload.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L41) +- [cliqueEpochTransitionSigners](functions/cliqueEpochTransitionSigners.md) +- [cliqueExtraSeal](functions/cliqueExtraSeal.md) +- [cliqueExtraVanity](functions/cliqueExtraVanity.md) +- [cliqueIsEpochTransition](functions/cliqueIsEpochTransition.md) +- [cliqueSigHash](functions/cliqueSigHash.md) +- [cliqueSigner](functions/cliqueSigner.md) +- [cliqueVerifySignature](functions/cliqueVerifySignature.md) +- [createBlock](functions/createBlock.md) +- [createBlockFromBeaconPayloadJSON](functions/createBlockFromBeaconPayloadJSON.md) +- [createBlockFromBytesArray](functions/createBlockFromBytesArray.md) +- [createBlockFromExecutionPayload](functions/createBlockFromExecutionPayload.md) +- [createBlockFromJSONRPCProvider](functions/createBlockFromJSONRPCProvider.md) +- [createBlockFromRLP](functions/createBlockFromRLP.md) +- [createBlockFromRPC](functions/createBlockFromRPC.md) +- [createBlockHeader](functions/createBlockHeader.md) +- [createBlockHeaderFromBytesArray](functions/createBlockHeaderFromBytesArray.md) +- [createBlockHeaderFromRLP](functions/createBlockHeaderFromRLP.md) +- [createBlockHeaderFromRPC](functions/createBlockHeaderFromRPC.md) +- [createEmptyBlock](functions/createEmptyBlock.md) +- [createSealedCliqueBlock](functions/createSealedCliqueBlock.md) +- [createSealedCliqueBlockHeader](functions/createSealedCliqueBlockHeader.md) +- [ethashCanonicalDifficulty](functions/ethashCanonicalDifficulty.md) +- [executionPayloadFromBeaconPayload](functions/executionPayloadFromBeaconPayload.md) diff --git a/packages/block/docs/classes/Block.md b/packages/block/docs/classes/Block.md index 6cab4981ef3..d83bdbc7362 100644 --- a/packages/block/docs/classes/Block.md +++ b/packages/block/docs/classes/Block.md @@ -1,200 +1,160 @@ +[**@ethereumjs/block**](../README.md) + +*** + [@ethereumjs/block](../README.md) / Block # Class: Block -An object that represents the block. - -## Table of contents - -### Constructors - -- [constructor](Block.md#constructor) - -### Properties - -- [common](Block.md#common) -- [executionWitness](Block.md#executionwitness) -- [header](Block.md#header) -- [transactions](Block.md#transactions) -- [uncleHeaders](Block.md#uncleheaders) -- [withdrawals](Block.md#withdrawals) - -### Methods - -- [errorStr](Block.md#errorstr) -- [ethashCanonicalDifficulty](Block.md#ethashcanonicaldifficulty) -- [genTxTrie](Block.md#gentxtrie) -- [getTransactionsValidationErrors](Block.md#gettransactionsvalidationerrors) -- [hash](Block.md#hash) -- [isGenesis](Block.md#isgenesis) -- [raw](Block.md#raw) -- [serialize](Block.md#serialize) -- [toJSON](Block.md#tojson) -- [transactionsAreValid](Block.md#transactionsarevalid) -- [transactionsTrieIsValid](Block.md#transactionstrieisvalid) -- [uncleHashIsValid](Block.md#unclehashisvalid) -- [validateBlobTransactions](Block.md#validateblobtransactions) -- [validateData](Block.md#validatedata) -- [validateGasLimit](Block.md#validategaslimit) -- [validateUncles](Block.md#validateuncles) -- [withdrawalsTrieIsValid](Block.md#withdrawalstrieisvalid) -- [fromBeaconPayloadJson](Block.md#frombeaconpayloadjson) -- [fromBlockData](Block.md#fromblockdata) -- [fromExecutionPayload](Block.md#fromexecutionpayload) -- [fromJsonRpcProvider](Block.md#fromjsonrpcprovider) -- [fromRLPSerializedBlock](Block.md#fromrlpserializedblock) -- [fromRPC](Block.md#fromrpc) -- [fromValuesArray](Block.md#fromvaluesarray) -- [genTransactionsTrieRoot](Block.md#gentransactionstrieroot) -- [genWithdrawalsTrieRoot](Block.md#genwithdrawalstrieroot) +Defined in: [block/block.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L56) + +Class representing a block in the Ethereum network. The [BlockHeader](BlockHeader.md) has its own +class and can be used independently, for a block it is included in the form of the +[Block.header](#header) property. + +A block object can be created with one of the following constructor methods +(separate from the Block class to allow for tree shaking): + +- [createBlock](../functions/createBlock.md) +- [createBlockFromBytesArray](../functions/createBlockFromBytesArray.md) +- [createBlockFromRLP](../functions/createBlockFromRLP.md) +- [createBlockFromRPC](../functions/createBlockFromRPC.md) +- [createBlockFromJSONRPCProvider](../functions/createBlockFromJSONRPCProvider.md) +- [createBlockFromExecutionPayload](../functions/createBlockFromExecutionPayload.md) +- [createBlockFromBeaconPayloadJSON](../functions/createBlockFromBeaconPayloadJSON.md) ## Constructors -### constructor +### Constructor + +> **new Block**(`header?`, `transactions?`, `uncleHeaders?`, `withdrawals?`, `opts?`, `executionWitness?`): `Block` -• **new Block**(`header?`, `transactions?`, `uncleHeaders?`, `withdrawals?`, `opts?`, `executionWitness?`) +Defined in: [block/block.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L83) This constructor takes the values, validates them, assigns them and freezes the object. -Use the static factory methods to assist in creating a Block object from varying data types and options. #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `header?` | [`BlockHeader`](BlockHeader.md) | `undefined` | -| `transactions` | `TypedTransaction`[] | `[]` | -| `uncleHeaders` | [`BlockHeader`](BlockHeader.md)[] | `[]` | -| `withdrawals?` | `Withdrawal`[] | `undefined` | -| `opts` | [`BlockOptions`](../interfaces/BlockOptions.md) | `{}` | -| `executionWitness?` | ``null`` \| [`VerkleExecutionWitness`](../interfaces/VerkleExecutionWitness.md) | `undefined` | +##### header? -#### Defined in +[`BlockHeader`](BlockHeader.md) -[block.ts:405](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L405) +##### transactions? -## Properties - -### common +`TypedTransaction`[] = `[]` -• `Readonly` **common**: `Common` +##### uncleHeaders? -#### Defined in +[`BlockHeader`](BlockHeader.md)[] = `[]` -[block.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L53) +##### withdrawals? -___ +`Withdrawal`[] -### executionWitness +##### opts? -• `Optional` `Readonly` **executionWitness**: ``null`` \| [`VerkleExecutionWitness`](../interfaces/VerkleExecutionWitness.md) +[`BlockOptions`](../interfaces/BlockOptions.md) = `{}` -EIP-6800: Verkle Proof Data (experimental) -null implies that the non default executionWitness might exist but not available -and will not lead to execution of the block via vm with verkle stateless manager +##### executionWitness? -#### Defined in +`null` | `VerkleExecutionWitness` -[block.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L61) +#### Returns -___ +`Block` -### header +#### Deprecated -• `Readonly` **header**: [`BlockHeader`](BlockHeader.md) +Use the static factory methods (see Block for an overview) to assist in creating +a Block object from varying data types and options. -#### Defined in +## Properties -[block.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L49) +### common -___ +> `readonly` **common**: `Common` -### transactions +Defined in: [block/block.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L61) -• `Readonly` **transactions**: `TypedTransaction`[] = `[]` +*** -#### Defined in +### executionWitness? -[block.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L50) +> `readonly` `optional` **executionWitness**: `null` \| `VerkleExecutionWitness` -___ +Defined in: [block/block.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L70) -### uncleHeaders - -• `Readonly` **uncleHeaders**: [`BlockHeader`](BlockHeader.md)[] = `[]` +EIP-6800: Verkle Proof Data (experimental) +null implies that the non default executionWitness might exist but not available +and will not lead to execution of the block via vm with verkle stateless manager -#### Defined in +*** -[block.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L51) +### header -___ +> `readonly` **header**: [`BlockHeader`](BlockHeader.md) -### withdrawals +Defined in: [block/block.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L57) -• `Optional` `Readonly` **withdrawals**: `Withdrawal`[] +*** -#### Defined in +### transactions -[block.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L52) +> `readonly` **transactions**: `TypedTransaction`[] = `[]` -## Methods +Defined in: [block/block.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L58) -### errorStr +*** -▸ **errorStr**(): `string` +### uncleHeaders -Return a compact error string representation of the object +> `readonly` **uncleHeaders**: [`BlockHeader`](BlockHeader.md)[] = `[]` -#### Returns +Defined in: [block/block.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L59) -`string` +*** -#### Defined in +### withdrawals? -[block.ts:806](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L806) +> `readonly` `optional` **withdrawals**: `Withdrawal`[] -___ +Defined in: [block/block.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L60) -### ethashCanonicalDifficulty +## Methods -▸ **ethashCanonicalDifficulty**(`parentBlock`): `bigint` +### errorStr() -Returns the canonical difficulty for this block. +> **errorStr**(): `string` -#### Parameters +Defined in: [block/block.ts:538](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L538) -| Name | Type | Description | -| :------ | :------ | :------ | -| `parentBlock` | [`Block`](Block.md) | the parent of this `Block` | +Return a compact error string representation of the object #### Returns -`bigint` - -#### Defined in +`string` -[block.ts:772](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L772) +*** -___ +### genTxTrie() -### genTxTrie +> **genTxTrie**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **genTxTrie**(): `Promise`<`Uint8Array`\> +Defined in: [block/block.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L204) Generates transaction trie for validation. #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -#### Defined in +*** -[block.ts:520](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L520) +### getTransactionsValidationErrors() -___ +> **getTransactionsValidationErrors**(): `string`[] -### getTransactionsValidationErrors - -▸ **getTransactionsValidationErrors**(): `string`[] +Defined in: [block/block.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L234) Validates transaction signatures and minimum gas requirements. @@ -204,15 +164,13 @@ Validates transaction signatures and minimum gas requirements. an array of error strings -#### Defined in - -[block.ts:547](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L547) +*** -___ +### hash() -### hash +> **hash**(): `Uint8Array` -▸ **hash**(): `Uint8Array` +Defined in: [block/block.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L183) Returns the hash of the block. @@ -220,15 +178,13 @@ Returns the hash of the block. `Uint8Array` -#### Defined in - -[block.ts:499](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L499) +*** -___ +### isGenesis() -### isGenesis +> **isGenesis**(): `boolean` -▸ **isGenesis**(): `boolean` +Defined in: [block/block.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L190) Determines if this block is the genesis block. @@ -236,31 +192,27 @@ Determines if this block is the genesis block. `boolean` -#### Defined in +*** -[block.ts:506](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L506) +### raw() -___ +> **raw**(): [`BlockBytes`](../type-aliases/BlockBytes.md) -### raw - -▸ **raw**(): [`BlockBytes`](../README.md#blockbytes) +Defined in: [block/block.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L160) Returns a Array of the raw Bytes Arrays of this block, in order. #### Returns -[`BlockBytes`](../README.md#blockbytes) - -#### Defined in +[`BlockBytes`](../type-aliases/BlockBytes.md) -[block.ts:477](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L477) +*** -___ +### serialize() -### serialize +> **serialize**(): `Uint8Array` -▸ **serialize**(): `Uint8Array` +Defined in: [block/block.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L197) Returns the rlp encoding of the block. @@ -268,31 +220,44 @@ Returns the rlp encoding of the block. `Uint8Array` -#### Defined in +*** + +### toExecutionPayload() + +> **toExecutionPayload**(): [`ExecutionPayload`](../type-aliases/ExecutionPayload.md) + +Defined in: [block/block.ts:503](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L503) + +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 -[block.ts:513](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L513) +[`ExecutionPayload`](../type-aliases/ExecutionPayload.md) -___ +dict with the execution payload parameters with camel case naming -### toJSON +*** -▸ **toJSON**(): [`JsonBlock`](../interfaces/JsonBlock.md) +### toJSON() + +> **toJSON**(): [`JSONBlock`](../interfaces/JSONBlock.md) + +Defined in: [block/block.ts:483](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L483) Returns the block in JSON format. #### Returns -[`JsonBlock`](../interfaces/JsonBlock.md) - -#### Defined in +[`JSONBlock`](../interfaces/JSONBlock.md) -[block.ts:789](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L789) +*** -___ +### transactionsAreValid() -### transactionsAreValid +> **transactionsAreValid**(): `boolean` -▸ **transactionsAreValid**(): `boolean` +Defined in: [block/block.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L284) Validates transaction signatures and minimum gas requirements. @@ -302,34 +267,30 @@ Validates transaction signatures and minimum gas requirements. True if all transactions are valid, false otherwise -#### Defined in +*** -[block.ts:597](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L597) +### transactionsTrieIsValid() -___ +> **transactionsTrieIsValid**(): `Promise`\<`boolean`\> -### transactionsTrieIsValid - -▸ **transactionsTrieIsValid**(): `Promise`<`boolean`\> +Defined in: [block/block.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L216) Validates the transaction trie by generating a trie and do a check on the root hash. #### Returns -`Promise`<`boolean`\> +`Promise`\<`boolean`\> True if the transaction trie is valid, false otherwise -#### Defined in - -[block.ts:529](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L529) +*** -___ +### uncleHashIsValid() -### uncleHashIsValid +> **uncleHashIsValid**(): `boolean` -▸ **uncleHashIsValid**(): `boolean` +Defined in: [block/block.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L408) Validates the uncle's hash. @@ -339,15 +300,13 @@ Validates the uncle's hash. true if the uncle's hash is valid, false otherwise. -#### Defined in - -[block.ts:718](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L718) +*** -___ +### validateBlobTransactions() -### validateBlobTransactions +> **validateBlobTransactions**(`parentHeader`): `void` -▸ **validateBlobTransactions**(`parentHeader`): `void` +Defined in: [block/block.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L360) Validates that blob gas fee for each transaction is greater than or equal to the blobGasPrice for the block and that total blob gas in block is less than maximum @@ -355,23 +314,23 @@ blob gas per block #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `parentHeader` | [`BlockHeader`](BlockHeader.md) | header of parent block | +##### parentHeader + +[`BlockHeader`](BlockHeader.md) + +header of parent block #### Returns `void` -#### Defined in - -[block.ts:670](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L670) +*** -___ +### validateData() -### validateData +> **validateData**(`onlyHeader`, `verifyTxs`): `Promise`\<`void`\> -▸ **validateData**(`onlyHeader?`, `verifyTxs?`): `Promise`<`void`\> +Defined in: [block/block.ts:300](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L300) Validates the block data, throwing if invalid. This can be checked on the Block itself without needing access to any parent block @@ -382,47 +341,52 @@ It checks: #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `onlyHeader` | `boolean` | `false` | if only passed the header, skip validating txTrie and unclesHash (default: false) | -| `verifyTxs` | `boolean` | `true` | if set to `false`, will not check for transaction validation errors (default: true) | +##### onlyHeader -#### Returns +`boolean` = `false` + +if only passed the header, skip validating txTrie and unclesHash (default: false) -`Promise`<`void`\> +##### verifyTxs -#### Defined in +`boolean` = `true` -[block.ts:613](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L613) +if set to `false`, will not check for transaction validation errors (default: true) -___ +#### Returns + +`Promise`\<`void`\> + +*** -### validateGasLimit +### validateGasLimit() -▸ **validateGasLimit**(`parentBlock`): `void` +> **validateGasLimit**(`parentBlock`): `void` + +Defined in: [block/block.ts:476](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L476) Validates if the block gasLimit remains in the boundaries set by the protocol. Throws if invalid #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `parentBlock` | [`Block`](Block.md) | the parent of this `Block` | +##### parentBlock + +`Block` + +the parent of this `Block` #### Returns `void` -#### Defined in +*** -[block.ts:782](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L782) +### validateUncles() -___ +> **validateUncles**(): `void` -### validateUncles - -▸ **validateUncles**(): `void` +Defined in: [block/block.ts:451](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L451) Consistency checks for uncles included in the block, if any. @@ -436,239 +400,18 @@ Header does not count an uncle twice. `void` -#### Defined in - -[block.ts:748](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L748) +*** -___ +### withdrawalsTrieIsValid() -### withdrawalsTrieIsValid +> **withdrawalsTrieIsValid**(): `Promise`\<`boolean`\> -▸ **withdrawalsTrieIsValid**(): `Promise`<`boolean`\> +Defined in: [block/block.ts:421](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/block.ts#L421) Validates the withdrawal root #### Returns -`Promise`<`boolean`\> +`Promise`\<`boolean`\> true if the withdrawals trie root is valid, false otherwise - -#### Defined in - -[block.ts:728](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L728) - -___ - -### fromBeaconPayloadJson - -▸ `Static` **fromBeaconPayloadJson**(`payload`, `opts?`): `Promise`<[`Block`](Block.md)\> - -Method to retrieve a block from a beacon payload json - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `payload` | `BeaconPayloadJson` | json of a beacon beacon fetched from beacon apis | -| `opts?` | [`BlockOptions`](../interfaces/BlockOptions.md) | [BlockOptions](../interfaces/BlockOptions.md) | - -#### Returns - -`Promise`<[`Block`](Block.md)\> - -the block constructed block - -#### Defined in - -[block.ts:393](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L393) - -___ - -### fromBlockData - -▸ `Static` **fromBlockData**(`blockData?`, `opts?`): [`Block`](Block.md) - -Static constructor to create a block from a block data dictionary - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `blockData` | [`BlockData`](../interfaces/BlockData.md) | -| `opts?` | [`BlockOptions`](../interfaces/BlockOptions.md) | - -#### Returns - -[`Block`](Block.md) - -#### Defined in - -[block.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L99) - -___ - -### fromExecutionPayload - -▸ `Static` **fromExecutionPayload**(`payload`, `opts?`): `Promise`<[`Block`](Block.md)\> - -Method to retrieve a block from an execution payload - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `payload` | [`ExecutionPayload`](../README.md#executionpayload) | - | -| `opts?` | [`BlockOptions`](../interfaces/BlockOptions.md) | [BlockOptions](../interfaces/BlockOptions.md) | - -#### Returns - -`Promise`<[`Block`](Block.md)\> - -the block constructed block - -#### Defined in - -[block.ts:320](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L320) - -___ - -### fromJsonRpcProvider - -▸ `Static` **fromJsonRpcProvider**(`provider`, `blockTag`, `opts`): `Promise`<[`Block`](Block.md)\> - -Method to retrieve a block from a JSON-RPC provider and format as a [Block](Block.md) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `provider` | `string` \| `EthersProvider` | either a url for a remote provider or an Ethers JsonRpcProvider object | -| `blockTag` | `string` \| `bigint` | block hash or block number to be run | -| `opts` | [`BlockOptions`](../interfaces/BlockOptions.md) | [BlockOptions](../interfaces/BlockOptions.md) | - -#### Returns - -`Promise`<[`Block`](Block.md)\> - -the block specified by `blockTag` - -#### Defined in - -[block.ts:260](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L260) - -___ - -### fromRLPSerializedBlock - -▸ `Static` **fromRLPSerializedBlock**(`serialized`, `opts?`): [`Block`](Block.md) - -Static constructor to create a block from a RLP-serialized block - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `serialized` | `Uint8Array` | -| `opts?` | [`BlockOptions`](../interfaces/BlockOptions.md) | - -#### Returns - -[`Block`](Block.md) - -#### Defined in - -[block.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L153) - -___ - -### fromRPC - -▸ `Static` **fromRPC**(`blockData`, `uncles?`, `opts?`): [`Block`](Block.md) - -Creates a new block object from Ethereum JSON RPC. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `blockData` | [`JsonRpcBlock`](../interfaces/JsonRpcBlock.md) | - | -| `uncles?` | `any`[] | Optional list of Ethereum JSON RPC of uncles (eth_getUncleByBlockHashAndIndex) | -| `opts?` | [`BlockOptions`](../interfaces/BlockOptions.md) | An object describing the blockchain | - -#### Returns - -[`Block`](Block.md) - -#### Defined in - -[block.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L249) - -___ - -### fromValuesArray - -▸ `Static` **fromValuesArray**(`values`, `opts?`): [`Block`](Block.md) - -Static constructor to create a block from an array of Bytes values - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `values` | [`BlockBytes`](../README.md#blockbytes) | -| `opts?` | [`BlockOptions`](../interfaces/BlockOptions.md) | - -#### Returns - -[`Block`](Block.md) - -#### Defined in - -[block.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L169) - -___ - -### genTransactionsTrieRoot - -▸ `Static` **genTransactionsTrieRoot**(`txs`, `emptyTrie?`): `Promise`<`Uint8Array`\> - -Returns the txs trie root for array of TypedTransaction - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `txs` | `TypedTransaction`[] | array of TypedTransaction to compute the root of | -| `emptyTrie?` | `Trie` | - | - -#### Returns - -`Promise`<`Uint8Array`\> - -#### Defined in - -[block.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L85) - -___ - -### genWithdrawalsTrieRoot - -▸ `Static` **genWithdrawalsTrieRoot**(`wts`, `emptyTrie?`): `Promise`<`Uint8Array`\> - -Returns the withdrawals trie root for array of Withdrawal. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `wts` | `Withdrawal`[] | array of Withdrawal to compute the root of | -| `emptyTrie?` | `Trie` | - | - -#### Returns - -`Promise`<`Uint8Array`\> - -#### Defined in - -[block.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L72) diff --git a/packages/block/docs/classes/BlockHeader.md b/packages/block/docs/classes/BlockHeader.md index 1fa40afe74f..be2a63d2665 100644 --- a/packages/block/docs/classes/BlockHeader.md +++ b/packages/block/docs/classes/BlockHeader.md @@ -1,332 +1,253 @@ +[**@ethereumjs/block**](../README.md) + +*** + [@ethereumjs/block](../README.md) / BlockHeader # Class: BlockHeader -An object that represents the block header. +Defined in: [header/header.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L44) -## Table of contents - -### Constructors - -- [constructor](BlockHeader.md#constructor) - -### Properties - -- [baseFeePerGas](BlockHeader.md#basefeepergas) -- [blobGasUsed](BlockHeader.md#blobgasused) -- [coinbase](BlockHeader.md#coinbase) -- [common](BlockHeader.md#common) -- [difficulty](BlockHeader.md#difficulty) -- [excessBlobGas](BlockHeader.md#excessblobgas) -- [extraData](BlockHeader.md#extradata) -- [gasLimit](BlockHeader.md#gaslimit) -- [gasUsed](BlockHeader.md#gasused) -- [logsBloom](BlockHeader.md#logsbloom) -- [mixHash](BlockHeader.md#mixhash) -- [nonce](BlockHeader.md#nonce) -- [number](BlockHeader.md#number) -- [parentBeaconBlockRoot](BlockHeader.md#parentbeaconblockroot) -- [parentHash](BlockHeader.md#parenthash) -- [receiptTrie](BlockHeader.md#receipttrie) -- [stateRoot](BlockHeader.md#stateroot) -- [timestamp](BlockHeader.md#timestamp) -- [transactionsTrie](BlockHeader.md#transactionstrie) -- [uncleHash](BlockHeader.md#unclehash) -- [withdrawalsRoot](BlockHeader.md#withdrawalsroot) - -### Accessors - -- [prevRandao](BlockHeader.md#prevrandao) - -### Methods - -- [calcDataFee](BlockHeader.md#calcdatafee) -- [calcNextBaseFee](BlockHeader.md#calcnextbasefee) -- [calcNextBlobGasPrice](BlockHeader.md#calcnextblobgasprice) -- [calcNextExcessBlobGas](BlockHeader.md#calcnextexcessblobgas) -- [cliqueEpochTransitionSigners](BlockHeader.md#cliqueepochtransitionsigners) -- [cliqueExtraSeal](BlockHeader.md#cliqueextraseal) -- [cliqueExtraVanity](BlockHeader.md#cliqueextravanity) -- [cliqueIsEpochTransition](BlockHeader.md#cliqueisepochtransition) -- [cliqueSigHash](BlockHeader.md#cliquesighash) -- [cliqueSigner](BlockHeader.md#cliquesigner) -- [cliqueVerifySignature](BlockHeader.md#cliqueverifysignature) -- [errorStr](BlockHeader.md#errorstr) -- [ethashCanonicalDifficulty](BlockHeader.md#ethashcanonicaldifficulty) -- [getBlobGasPrice](BlockHeader.md#getblobgasprice) -- [hash](BlockHeader.md#hash) -- [isGenesis](BlockHeader.md#isgenesis) -- [raw](BlockHeader.md#raw) -- [serialize](BlockHeader.md#serialize) -- [toJSON](BlockHeader.md#tojson) -- [validateGasLimit](BlockHeader.md#validategaslimit) -- [fromHeaderData](BlockHeader.md#fromheaderdata) -- [fromRLPSerializedHeader](BlockHeader.md#fromrlpserializedheader) -- [fromValuesArray](BlockHeader.md#fromvaluesarray) +An object that represents the block header. ## Constructors -### constructor +### Constructor + +> **new BlockHeader**(`headerData`, `opts`): `BlockHeader` -• **new BlockHeader**(`headerData`, `opts?`) +Defined in: [header/header.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L95) This constructor takes the values, validates them, assigns them and freezes the object. -**`Deprecated`** +#### Parameters -Use the public static factory methods to assist in creating a Header object from -varying data types. For a default empty header, use [fromHeaderData](BlockHeader.md#fromheaderdata). +##### headerData -#### Parameters +[`HeaderData`](../interfaces/HeaderData.md) -| Name | Type | -| :------ | :------ | -| `headerData` | [`HeaderData`](../interfaces/HeaderData.md) | -| `opts` | [`BlockOptions`](../interfaces/BlockOptions.md) | +##### opts -#### Defined in +[`BlockOptions`](../interfaces/BlockOptions.md) = `{}` -[header.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L150) +#### Returns -## Properties +`BlockHeader` -### baseFeePerGas +#### Deprecated -• `Optional` `Readonly` **baseFeePerGas**: `bigint` +Use the public static factory methods to assist in creating a Header object from +varying data types. For a default empty header, use [createBlockHeader](../functions/createBlockHeader.md). -#### Defined in +## Properties -[header.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L61) +### baseFeePerGas? -___ +> `readonly` `optional` **baseFeePerGas**: `bigint` -### blobGasUsed +Defined in: [header/header.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L60) -• `Optional` `Readonly` **blobGasUsed**: `bigint` +*** -#### Defined in +### blobGasUsed? -[header.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L63) +> `readonly` `optional` **blobGasUsed**: `bigint` -___ +Defined in: [header/header.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L62) -### coinbase +*** -• `Readonly` **coinbase**: `Address` +### coinbase -#### Defined in +> `readonly` **coinbase**: `Address` -[header.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L48) +Defined in: [header/header.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L47) -___ +*** ### common -• `Readonly` **common**: `Common` +> `readonly` **common**: `Common` -#### Defined in +Defined in: [header/header.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L67) -[header.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L67) - -___ +*** ### difficulty -• `Readonly` **difficulty**: `bigint` - -#### Defined in +> `readonly` **difficulty**: `bigint` -[header.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L53) +Defined in: [header/header.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L52) -___ +*** -### excessBlobGas +### excessBlobGas? -• `Optional` `Readonly` **excessBlobGas**: `bigint` +> `readonly` `optional` **excessBlobGas**: `bigint` -#### Defined in +Defined in: [header/header.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L63) -[header.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L64) - -___ +*** ### extraData -• `Readonly` **extraData**: `Uint8Array` - -#### Defined in +> `readonly` **extraData**: `Uint8Array` -[header.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L58) +Defined in: [header/header.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L57) -___ +*** ### gasLimit -• `Readonly` **gasLimit**: `bigint` - -#### Defined in +> `readonly` **gasLimit**: `bigint` -[header.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L55) +Defined in: [header/header.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L54) -___ +*** ### gasUsed -• `Readonly` **gasUsed**: `bigint` +> `readonly` **gasUsed**: `bigint` -#### Defined in +Defined in: [header/header.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L55) -[header.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L56) - -___ +*** ### logsBloom -• `Readonly` **logsBloom**: `Uint8Array` - -#### Defined in +> `readonly` **logsBloom**: `Uint8Array` -[header.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L52) +Defined in: [header/header.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L51) -___ +*** ### mixHash -• `Readonly` **mixHash**: `Uint8Array` +> `readonly` **mixHash**: `Uint8Array` -#### Defined in +Defined in: [header/header.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L58) -[header.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L59) - -___ +*** ### nonce -• `Readonly` **nonce**: `Uint8Array` - -#### Defined in +> `readonly` **nonce**: `Uint8Array` -[header.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L60) +Defined in: [header/header.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L59) -___ +*** ### number -• `Readonly` **number**: `bigint` +> `readonly` **number**: `bigint` -#### Defined in +Defined in: [header/header.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L53) -[header.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L54) +*** -___ +### parentBeaconBlockRoot? -### parentBeaconBlockRoot +> `readonly` `optional` **parentBeaconBlockRoot**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` `Readonly` **parentBeaconBlockRoot**: `Uint8Array` +Defined in: [header/header.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L64) -#### Defined in +*** -[header.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L65) +### parentHash -___ +> `readonly` **parentHash**: `Uint8Array` -### parentHash +Defined in: [header/header.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L45) -• `Readonly` **parentHash**: `Uint8Array` +*** -#### Defined in +### receiptTrie -[header.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L46) +> `readonly` **receiptTrie**: `Uint8Array` -___ +Defined in: [header/header.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L50) -### receiptTrie +*** -• `Readonly` **receiptTrie**: `Uint8Array` +### requestsHash? -#### Defined in +> `readonly` `optional` **requestsHash**: `Uint8Array`\<`ArrayBufferLike`\> -[header.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L51) +Defined in: [header/header.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L65) -___ +*** ### stateRoot -• `Readonly` **stateRoot**: `Uint8Array` +> `readonly` **stateRoot**: `Uint8Array` -#### Defined in +Defined in: [header/header.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L48) -[header.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L49) - -___ +*** ### timestamp -• `Readonly` **timestamp**: `bigint` - -#### Defined in +> `readonly` **timestamp**: `bigint` -[header.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L57) +Defined in: [header/header.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L56) -___ +*** ### transactionsTrie -• `Readonly` **transactionsTrie**: `Uint8Array` - -#### Defined in +> `readonly` **transactionsTrie**: `Uint8Array` -[header.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L50) +Defined in: [header/header.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L49) -___ +*** ### uncleHash -• `Readonly` **uncleHash**: `Uint8Array` - -#### Defined in - -[header.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L47) +> `readonly` **uncleHash**: `Uint8Array` -___ +Defined in: [header/header.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L46) -### withdrawalsRoot +*** -• `Optional` `Readonly` **withdrawalsRoot**: `Uint8Array` +### withdrawalsRoot? -#### Defined in +> `readonly` `optional` **withdrawalsRoot**: `Uint8Array`\<`ArrayBufferLike`\> -[header.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L62) +Defined in: [header/header.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L61) ## Accessors ### prevRandao -• `get` **prevRandao**(): `Uint8Array` +#### Get Signature -EIP-4399: After merge to PoS, `mixHash` supplanted as `prevRandao` +> **get** **prevRandao**(): `Uint8Array`\<`ArrayBufferLike`\> -#### Returns +Defined in: [header/header.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L78) -`Uint8Array` +EIP-4399: After merge to PoS, `mixHash` supplanted as `prevRandao` -#### Defined in +##### Returns -[header.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L78) +`Uint8Array`\<`ArrayBufferLike`\> ## Methods -### calcDataFee +### calcDataFee() + +> **calcDataFee**(`numBlobs`): `bigint` -▸ **calcDataFee**(`numBlobs`): `bigint` +Defined in: [header/header.ts:551](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L551) Returns the total fee for blob gas spent for including blobs in block. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `numBlobs` | `number` | number of blobs in the transaction/block | +##### numBlobs + +`number` + +number of blobs in the transaction/block #### Returns @@ -334,15 +255,13 @@ Returns the total fee for blob gas spent for including blobs in block. the total blob gas fee for numBlobs blobs -#### Defined in - -[header.ts:621](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L621) +*** -___ +### calcNextBaseFee() -### calcNextBaseFee +> **calcNextBaseFee**(): `bigint` -▸ **calcNextBaseFee**(): `bigint` +Defined in: [header/header.ts:500](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L500) Calculates the base fee for a potential next block @@ -350,178 +269,55 @@ Calculates the base fee for a potential next block `bigint` -#### Defined in +*** -[header.ts:552](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L552) +### calcNextBlobGasPrice() -___ +> **calcNextBlobGasPrice**(`childCommon`): `bigint` -### calcNextBlobGasPrice - -▸ **calcNextBlobGasPrice**(): `bigint` +Defined in: [header/header.ts:578](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L578) Calculate the blob gas price of the block built on top of this one -#### Returns - -`bigint` - -The blob gas price - -#### Defined in - -[header.ts:648](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L648) - -___ +#### Parameters -### calcNextExcessBlobGas +##### childCommon -▸ **calcNextExcessBlobGas**(): `bigint` - -Calculates the excess blob gas for next (hopefully) post EIP 4844 block. +`Common` #### Returns `bigint` -#### Defined in - -[header.ts:632](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L632) - -___ - -### cliqueEpochTransitionSigners - -▸ **cliqueEpochTransitionSigners**(): `Address`[] - -Returns a list of signers -(only clique PoA, throws otherwise) - -This function throws if not called on an epoch -transition block and should therefore be used -in conjunction with [cliqueIsEpochTransition](BlockHeader.md#cliqueisepochtransition) - -#### Returns - -`Address`[] - -#### Defined in - -[header.ts:870](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L870) - -___ - -### cliqueExtraSeal - -▸ **cliqueExtraSeal**(): `Uint8Array` - -Returns extra seal data -(only clique PoA, throws otherwise) - -#### Returns - -`Uint8Array` - -#### Defined in - -[header.ts:837](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L837) - -___ - -### cliqueExtraVanity - -▸ **cliqueExtraVanity**(): `Uint8Array` - -Returns extra vanity data -(only clique PoA, throws otherwise) - -#### Returns - -`Uint8Array` - -#### Defined in - -[header.ts:828](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L828) - -___ - -### cliqueIsEpochTransition - -▸ **cliqueIsEpochTransition**(): `boolean` - -Checks if the block header is an epoch transition -header (only clique PoA, throws otherwise) - -#### Returns - -`boolean` - -#### Defined in - -[header.ts:816](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L816) - -___ - -### cliqueSigHash - -▸ **cliqueSigHash**(): `Uint8Array` - -PoA clique signature hash without the seal. - -#### Returns - -`Uint8Array` - -#### Defined in - -[header.ts:805](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L805) - -___ - -### cliqueSigner - -▸ **cliqueSigner**(): `Address` - -Returns the signer address - -#### Returns - -`Address` - -#### Defined in - -[header.ts:907](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L907) +The blob gas price -___ +*** -### cliqueVerifySignature +### calcNextExcessBlobGas() -▸ **cliqueVerifySignature**(`signerList`): `boolean` +> **calcNextExcessBlobGas**(`childCommon`): `bigint` -Verifies the signature of the block (last 65 bytes of extraData field) -(only clique PoA, throws otherwise) +Defined in: [header/header.ts:562](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L562) - Method throws if signature is invalid +Calculates the excess blob gas for next (hopefully) post EIP 4844 block. #### Parameters -| Name | Type | -| :------ | :------ | -| `signerList` | `Address`[] | +##### childCommon -#### Returns +`Common` -`boolean` +#### Returns -#### Defined in +`bigint` -[header.ts:895](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L895) +*** -___ +### errorStr() -### errorStr +> **errorStr**(): `string` -▸ **errorStr**(): `string` +Defined in: [header/header.ts:802](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L802) Return a compact error string representation of the object @@ -529,37 +325,35 @@ Return a compact error string representation of the object `string` -#### Defined in +*** -[header.ts:994](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L994) +### ethashCanonicalDifficulty() -___ +> **ethashCanonicalDifficulty**(`parentBlockHeader`): `bigint` -### ethashCanonicalDifficulty - -▸ **ethashCanonicalDifficulty**(`parentBlockHeader`): `bigint` +Defined in: [header/header.ts:658](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L658) Returns the canonical difficulty for this block. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `parentBlockHeader` | [`BlockHeader`](BlockHeader.md) | the header from the parent `Block` of this header | +##### parentBlockHeader + +`BlockHeader` + +the header from the parent `Block` of this header #### Returns `bigint` -#### Defined in - -[header.ts:734](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L734) +*** -___ +### getBlobGasPrice() -### getBlobGasPrice +> **getBlobGasPrice**(): `bigint` -▸ **getBlobGasPrice**(): `bigint` +Defined in: [header/header.ts:538](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L538) Returns the price per unit of blob gas for a blob transaction in the current/pending block @@ -569,15 +363,13 @@ Returns the price per unit of blob gas for a blob transaction in the current/pen the price in gwei per unit of blob gas spent -#### Defined in - -[header.ts:596](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L596) +*** -___ +### hash() -### hash +> **hash**(): `Uint8Array` -▸ **hash**(): `Uint8Array` +Defined in: [header/header.ts:636](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L636) Returns the hash of the block header. @@ -585,15 +377,13 @@ Returns the hash of the block header. `Uint8Array` -#### Defined in +*** -[header.ts:703](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L703) +### isGenesis() -___ +> **isGenesis**(): `boolean` -### isGenesis - -▸ **isGenesis**(): `boolean` +Defined in: [header/header.ts:649](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L649) Checks if the block header is a genesis header. @@ -601,31 +391,27 @@ Checks if the block header is a genesis header. `boolean` -#### Defined in - -[header.ts:716](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L716) +*** -___ +### raw() -### raw +> **raw**(): [`BlockHeaderBytes`](../type-aliases/BlockHeaderBytes.md) -▸ **raw**(): [`BlockHeaderBytes`](../README.md#blockheaderbytes) +Defined in: [header/header.ts:585](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L585) Returns a Uint8Array Array of the raw Bytes in this header, in order. #### Returns -[`BlockHeaderBytes`](../README.md#blockheaderbytes) +[`BlockHeaderBytes`](../type-aliases/BlockHeaderBytes.md) -#### Defined in +*** -[header.ts:655](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L655) +### serialize() -___ +> **serialize**(): `Uint8Array` -### serialize - -▸ **serialize**(): `Uint8Array` +Defined in: [header/header.ts:729](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L729) Returns the rlp encoding of the block header. @@ -633,114 +419,39 @@ Returns the rlp encoding of the block header. `Uint8Array` -#### Defined in - -[header.ts:924](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L924) +*** -___ +### toJSON() -### toJSON +> **toJSON**(): [`JSONHeader`](../interfaces/JSONHeader.md) -▸ **toJSON**(): [`JsonHeader`](../interfaces/JsonHeader.md) +Defined in: [header/header.ts:736](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L736) Returns the block header in JSON format. #### Returns -[`JsonHeader`](../interfaces/JsonHeader.md) - -#### Defined in +[`JSONHeader`](../interfaces/JSONHeader.md) -[header.ts:931](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L931) +*** -___ +### validateGasLimit() -### validateGasLimit +> **validateGasLimit**(`parentBlockHeader`): `void` -▸ **validateGasLimit**(`parentBlockHeader`): `void` +Defined in: [header/header.ts:454](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/header.ts#L454) Validates if the block gasLimit remains in the boundaries set by the protocol. Throws if out of bounds. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `parentBlockHeader` | [`BlockHeader`](BlockHeader.md) | the header from the parent `Block` of this header | - -#### Returns - -`void` - -#### Defined in - -[header.ts:505](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L505) - -___ - -### fromHeaderData +##### parentBlockHeader -▸ `Static` **fromHeaderData**(`headerData?`, `opts?`): [`BlockHeader`](BlockHeader.md) +`BlockHeader` -Static constructor to create a block header from a header data dictionary - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `headerData` | [`HeaderData`](../interfaces/HeaderData.md) | -| `opts` | [`BlockOptions`](../interfaces/BlockOptions.md) | +the header from the parent `Block` of this header #### Returns -[`BlockHeader`](BlockHeader.md) - -#### Defined in - -[header.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L94) - -___ - -### fromRLPSerializedHeader - -▸ `Static` **fromRLPSerializedHeader**(`serializedHeaderData`, `opts?`): [`BlockHeader`](BlockHeader.md) - -Static constructor to create a block header from a RLP-serialized header - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `serializedHeaderData` | `Uint8Array` | -| `opts` | [`BlockOptions`](../interfaces/BlockOptions.md) | - -#### Returns - -[`BlockHeader`](BlockHeader.md) - -#### Defined in - -[header.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L104) - -___ - -### fromValuesArray - -▸ `Static` **fromValuesArray**(`values`, `opts?`): [`BlockHeader`](BlockHeader.md) - -Static constructor to create a block header from an array of Bytes values - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `values` | [`BlockHeaderBytes`](../README.md#blockheaderbytes) | -| `opts` | [`BlockOptions`](../interfaces/BlockOptions.md) | - -#### Returns - -[`BlockHeader`](BlockHeader.md) - -#### Defined in - -[header.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L118) +`void` diff --git a/packages/block/docs/functions/cliqueEpochTransitionSigners.md b/packages/block/docs/functions/cliqueEpochTransitionSigners.md new file mode 100644 index 00000000000..e8ebcaa9fa7 --- /dev/null +++ b/packages/block/docs/functions/cliqueEpochTransitionSigners.md @@ -0,0 +1,28 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / cliqueEpochTransitionSigners + +# Function: cliqueEpochTransitionSigners() + +> **cliqueEpochTransitionSigners**(`header`): `Address`[] + +Defined in: [consensus/clique.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L86) + +Returns a list of signers +(only clique PoA, throws otherwise) + +This function throws if not called on an epoch +transition block and should therefore be used +in conjunction with BlockHeader.cliqueIsEpochTransition + +## Parameters + +### header + +[`BlockHeader`](../classes/BlockHeader.md) + +## Returns + +`Address`[] diff --git a/packages/block/docs/functions/cliqueExtraSeal.md b/packages/block/docs/functions/cliqueExtraSeal.md new file mode 100644 index 00000000000..02c55747571 --- /dev/null +++ b/packages/block/docs/functions/cliqueExtraSeal.md @@ -0,0 +1,24 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / cliqueExtraSeal + +# Function: cliqueExtraSeal() + +> **cliqueExtraSeal**(`header`): `Uint8Array` + +Defined in: [consensus/clique.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L73) + +Returns extra seal data +(only clique PoA, throws otherwise) + +## Parameters + +### header + +[`BlockHeader`](../classes/BlockHeader.md) + +## Returns + +`Uint8Array` diff --git a/packages/block/docs/functions/cliqueExtraVanity.md b/packages/block/docs/functions/cliqueExtraVanity.md new file mode 100644 index 00000000000..cba13ab1a9c --- /dev/null +++ b/packages/block/docs/functions/cliqueExtraVanity.md @@ -0,0 +1,24 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / cliqueExtraVanity + +# Function: cliqueExtraVanity() + +> **cliqueExtraVanity**(`header`): `Uint8Array` + +Defined in: [consensus/clique.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L64) + +Returns extra vanity data +(only clique PoA, throws otherwise) + +## Parameters + +### header + +[`BlockHeader`](../classes/BlockHeader.md) + +## Returns + +`Uint8Array` diff --git a/packages/block/docs/functions/cliqueIsEpochTransition.md b/packages/block/docs/functions/cliqueIsEpochTransition.md new file mode 100644 index 00000000000..4fc6aa95b35 --- /dev/null +++ b/packages/block/docs/functions/cliqueIsEpochTransition.md @@ -0,0 +1,24 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / cliqueIsEpochTransition + +# Function: cliqueIsEpochTransition() + +> **cliqueIsEpochTransition**(`header`): `boolean` + +Defined in: [consensus/clique.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L52) + +Checks if the block header is an epoch transition +header (only clique PoA, throws otherwise) + +## Parameters + +### header + +[`BlockHeader`](../classes/BlockHeader.md) + +## Returns + +`boolean` diff --git a/packages/block/docs/functions/cliqueSigHash.md b/packages/block/docs/functions/cliqueSigHash.md new file mode 100644 index 00000000000..e13e1dd8432 --- /dev/null +++ b/packages/block/docs/functions/cliqueSigHash.md @@ -0,0 +1,23 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / cliqueSigHash + +# Function: cliqueSigHash() + +> **cliqueSigHash**(`header`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [consensus/clique.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L41) + +PoA clique signature hash without the seal. + +## Parameters + +### header + +[`BlockHeader`](../classes/BlockHeader.md) + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> diff --git a/packages/block/docs/functions/cliqueSigner.md b/packages/block/docs/functions/cliqueSigner.md new file mode 100644 index 00000000000..39fcc9f7078 --- /dev/null +++ b/packages/block/docs/functions/cliqueSigner.md @@ -0,0 +1,23 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / cliqueSigner + +# Function: cliqueSigner() + +> **cliqueSigner**(`header`): `Address` + +Defined in: [consensus/clique.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L108) + +Returns the signer address + +## Parameters + +### header + +[`BlockHeader`](../classes/BlockHeader.md) + +## Returns + +`Address` diff --git a/packages/block/docs/functions/cliqueVerifySignature.md b/packages/block/docs/functions/cliqueVerifySignature.md new file mode 100644 index 00000000000..9202957db37 --- /dev/null +++ b/packages/block/docs/functions/cliqueVerifySignature.md @@ -0,0 +1,30 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / cliqueVerifySignature + +# Function: cliqueVerifySignature() + +> **cliqueVerifySignature**(`header`, `signerList`): `boolean` + +Defined in: [consensus/clique.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L128) + +Verifies the signature of the block (last 65 bytes of extraData field) +(only clique PoA, throws otherwise) + + Method throws if signature is invalid + +## Parameters + +### header + +[`BlockHeader`](../classes/BlockHeader.md) + +### signerList + +`Address`[] + +## Returns + +`boolean` diff --git a/packages/block/docs/functions/createBlock.md b/packages/block/docs/functions/createBlock.md new file mode 100644 index 00000000000..d639534753a --- /dev/null +++ b/packages/block/docs/functions/createBlock.md @@ -0,0 +1,27 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlock + +# Function: createBlock() + +> **createBlock**(`blockData`, `opts?`): [`Block`](../classes/Block.md) + +Defined in: [block/constructors.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L53) + +Static constructor to create a block from a block data dictionary + +## Parameters + +### blockData + +[`BlockData`](../interfaces/BlockData.md) = `{}` + +### opts? + +[`BlockOptions`](../interfaces/BlockOptions.md) + +## Returns + +[`Block`](../classes/Block.md) diff --git a/packages/block/docs/functions/createBlockFromBeaconPayloadJSON.md b/packages/block/docs/functions/createBlockFromBeaconPayloadJSON.md new file mode 100644 index 00000000000..cd624a68c8d --- /dev/null +++ b/packages/block/docs/functions/createBlockFromBeaconPayloadJSON.md @@ -0,0 +1,33 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockFromBeaconPayloadJSON + +# Function: createBlockFromBeaconPayloadJSON() + +> **createBlockFromBeaconPayloadJSON**(`payload`, `opts?`): `Promise`\<[`Block`](../classes/Block.md)\> + +Defined in: [block/constructors.ts:396](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L396) + +Method to retrieve a block from a beacon payload JSON + +## Parameters + +### payload + +[`BeaconPayloadJSON`](../type-aliases/BeaconPayloadJSON.md) + +JSON of a beacon beacon fetched from beacon apis + +### opts? + +[`BlockOptions`](../interfaces/BlockOptions.md) + +[BlockOptions](../interfaces/BlockOptions.md) + +## Returns + +`Promise`\<[`Block`](../classes/Block.md)\> + +the block constructed block diff --git a/packages/block/docs/functions/createBlockFromBytesArray.md b/packages/block/docs/functions/createBlockFromBytesArray.md new file mode 100644 index 00000000000..8f43b073958 --- /dev/null +++ b/packages/block/docs/functions/createBlockFromBytesArray.md @@ -0,0 +1,27 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockFromBytesArray + +# Function: createBlockFromBytesArray() + +> **createBlockFromBytesArray**(`values`, `opts?`): [`Block`](../classes/Block.md) + +Defined in: [block/constructors.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L119) + +Static constructor to create a block from an array of Bytes values + +## Parameters + +### values + +[`BlockBytes`](../type-aliases/BlockBytes.md) + +### opts? + +[`BlockOptions`](../interfaces/BlockOptions.md) + +## Returns + +[`Block`](../classes/Block.md) diff --git a/packages/block/docs/functions/createBlockFromExecutionPayload.md b/packages/block/docs/functions/createBlockFromExecutionPayload.md new file mode 100644 index 00000000000..1983ec2fe26 --- /dev/null +++ b/packages/block/docs/functions/createBlockFromExecutionPayload.md @@ -0,0 +1,31 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockFromExecutionPayload + +# Function: createBlockFromExecutionPayload() + +> **createBlockFromExecutionPayload**(`payload`, `opts?`): `Promise`\<[`Block`](../classes/Block.md)\> + +Defined in: [block/constructors.ts:325](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L325) + +Method to retrieve a block from an execution payload + +## Parameters + +### payload + +[`ExecutionPayload`](../type-aliases/ExecutionPayload.md) + +### opts? + +[`BlockOptions`](../interfaces/BlockOptions.md) + +[BlockOptions](../interfaces/BlockOptions.md) + +## Returns + +`Promise`\<[`Block`](../classes/Block.md)\> + +the block constructed block diff --git a/packages/block/docs/functions/createBlockFromJSONRPCProvider.md b/packages/block/docs/functions/createBlockFromJSONRPCProvider.md new file mode 100644 index 00000000000..cd6f5287c14 --- /dev/null +++ b/packages/block/docs/functions/createBlockFromJSONRPCProvider.md @@ -0,0 +1,39 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockFromJSONRPCProvider + +# Function: createBlockFromJSONRPCProvider() + +> **createBlockFromJSONRPCProvider**(`provider`, `blockTag`, `opts`): `Promise`\<[`Block`](../classes/Block.md)\> + +Defined in: [block/constructors.ts:265](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L265) + +Method to retrieve a block from a JSON-RPC provider and format as a [Block](../classes/Block.md) + +## Parameters + +### provider + +either a url for a remote provider or an Ethers JSONRPCProvider object + +`string` | `EthersProvider` + +### blockTag + +block hash or block number to be run + +`string` | `bigint` + +### opts + +[`BlockOptions`](../interfaces/BlockOptions.md) + +[BlockOptions](../interfaces/BlockOptions.md) + +## Returns + +`Promise`\<[`Block`](../classes/Block.md)\> + +the block specified by `blockTag` diff --git a/packages/block/docs/functions/createBlockFromRLP.md b/packages/block/docs/functions/createBlockFromRLP.md new file mode 100644 index 00000000000..25045862f2b --- /dev/null +++ b/packages/block/docs/functions/createBlockFromRLP.md @@ -0,0 +1,27 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockFromRLP + +# Function: createBlockFromRLP() + +> **createBlockFromRLP**(`serialized`, `opts?`): [`Block`](../classes/Block.md) + +Defined in: [block/constructors.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L218) + +Static constructor to create a block from a RLP-serialized block + +## Parameters + +### serialized + +`Uint8Array` + +### opts? + +[`BlockOptions`](../interfaces/BlockOptions.md) + +## Returns + +[`Block`](../classes/Block.md) diff --git a/packages/block/docs/functions/createBlockFromRPC.md b/packages/block/docs/functions/createBlockFromRPC.md new file mode 100644 index 00000000000..2a68d179cd7 --- /dev/null +++ b/packages/block/docs/functions/createBlockFromRPC.md @@ -0,0 +1,35 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockFromRPC + +# Function: createBlockFromRPC() + +> **createBlockFromRPC**(`blockParams`, `uncles`, `options?`): [`Block`](../classes/Block.md) + +Defined in: [block/constructors.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L235) + +Creates a new block object from Ethereum JSON RPC. + +## Parameters + +### blockParams + +[`JSONRPCBlock`](../interfaces/JSONRPCBlock.md) + +Ethereum JSON RPC of block (eth_getBlockByNumber) + +### uncles + +`any`[] = `[]` + +Optional list of Ethereum JSON RPC of uncles (eth_getUncleByBlockHashAndIndex) + +### options? + +[`BlockOptions`](../interfaces/BlockOptions.md) + +## Returns + +[`Block`](../classes/Block.md) diff --git a/packages/block/docs/functions/createBlockHeader.md b/packages/block/docs/functions/createBlockHeader.md new file mode 100644 index 00000000000..65f94e973fc --- /dev/null +++ b/packages/block/docs/functions/createBlockHeader.md @@ -0,0 +1,27 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockHeader + +# Function: createBlockHeader() + +> **createBlockHeader**(`headerData`, `opts`): [`BlockHeader`](../classes/BlockHeader.md) + +Defined in: [header/constructors.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/constructors.ts#L16) + +Static constructor to create a block header from a header data dictionary + +## Parameters + +### headerData + +[`HeaderData`](../interfaces/HeaderData.md) = `{}` + +### opts + +[`BlockOptions`](../interfaces/BlockOptions.md) = `{}` + +## Returns + +[`BlockHeader`](../classes/BlockHeader.md) diff --git a/packages/block/docs/functions/createBlockHeaderFromBytesArray.md b/packages/block/docs/functions/createBlockHeaderFromBytesArray.md new file mode 100644 index 00000000000..b394353d90b --- /dev/null +++ b/packages/block/docs/functions/createBlockHeaderFromBytesArray.md @@ -0,0 +1,27 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockHeaderFromBytesArray + +# Function: createBlockHeaderFromBytesArray() + +> **createBlockHeaderFromBytesArray**(`values`, `opts`): [`BlockHeader`](../classes/BlockHeader.md) + +Defined in: [header/constructors.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/constructors.ts#L26) + +Static constructor to create a block header from an array of bytes values + +## Parameters + +### values + +[`BlockHeaderBytes`](../type-aliases/BlockHeaderBytes.md) + +### opts + +[`BlockOptions`](../interfaces/BlockOptions.md) = `{}` + +## Returns + +[`BlockHeader`](../classes/BlockHeader.md) diff --git a/packages/block/docs/functions/createBlockHeaderFromRLP.md b/packages/block/docs/functions/createBlockHeaderFromRLP.md new file mode 100644 index 00000000000..5ef56ee7a6b --- /dev/null +++ b/packages/block/docs/functions/createBlockHeaderFromRLP.md @@ -0,0 +1,27 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockHeaderFromRLP + +# Function: createBlockHeaderFromRLP() + +> **createBlockHeaderFromRLP**(`serializedHeaderData`, `opts`): [`BlockHeader`](../classes/BlockHeader.md) + +Defined in: [header/constructors.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/constructors.ts#L63) + +Static constructor to create a block header from a RLP-serialized header + +## Parameters + +### serializedHeaderData + +`Uint8Array` + +### opts + +[`BlockOptions`](../interfaces/BlockOptions.md) = `{}` + +## Returns + +[`BlockHeader`](../classes/BlockHeader.md) diff --git a/packages/block/docs/functions/createBlockHeaderFromRPC.md b/packages/block/docs/functions/createBlockHeaderFromRPC.md new file mode 100644 index 00000000000..8ae5578c1dc --- /dev/null +++ b/packages/block/docs/functions/createBlockHeaderFromRPC.md @@ -0,0 +1,31 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createBlockHeaderFromRPC + +# Function: createBlockHeaderFromRPC() + +> **createBlockHeaderFromRPC**(`blockParams`, `options?`): [`BlockHeader`](../classes/BlockHeader.md) + +Defined in: [header/constructors.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/constructors.ts#L99) + +Creates a new block header object from Ethereum JSON RPC. + +## Parameters + +### blockParams + +[`JSONRPCBlock`](../interfaces/JSONRPCBlock.md) + +Ethereum JSON RPC of block (eth_getBlockByNumber) + +### options? + +[`BlockOptions`](../interfaces/BlockOptions.md) + +An object describing the blockchain + +## Returns + +[`BlockHeader`](../classes/BlockHeader.md) diff --git a/packages/block/docs/functions/createEmptyBlock.md b/packages/block/docs/functions/createEmptyBlock.md new file mode 100644 index 00000000000..013c45cec9c --- /dev/null +++ b/packages/block/docs/functions/createEmptyBlock.md @@ -0,0 +1,28 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createEmptyBlock + +# Function: createEmptyBlock() + +> **createEmptyBlock**(`headerData`, `opts?`): [`Block`](../classes/Block.md) + +Defined in: [block/constructors.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L108) + +Simple static constructor if only an empty block is needed +(tree shaking advantages since it does not draw all the tx constructors in) + +## Parameters + +### headerData + +[`HeaderData`](../interfaces/HeaderData.md) + +### opts? + +[`BlockOptions`](../interfaces/BlockOptions.md) + +## Returns + +[`Block`](../classes/Block.md) diff --git a/packages/block/docs/functions/createSealedCliqueBlock.md b/packages/block/docs/functions/createSealedCliqueBlock.md new file mode 100644 index 00000000000..143f59bebba --- /dev/null +++ b/packages/block/docs/functions/createSealedCliqueBlock.md @@ -0,0 +1,29 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createSealedCliqueBlock + +# Function: createSealedCliqueBlock() + +> **createSealedCliqueBlock**(`blockData`, `cliqueSigner`, `opts`): [`Block`](../classes/Block.md) + +Defined in: [block/constructors.ts:404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block/constructors.ts#L404) + +## Parameters + +### blockData + +[`BlockData`](../interfaces/BlockData.md) = `{}` + +### cliqueSigner + +`Uint8Array` + +### opts + +[`BlockOptions`](../interfaces/BlockOptions.md) = `{}` + +## Returns + +[`Block`](../classes/Block.md) diff --git a/packages/block/docs/functions/createSealedCliqueBlockHeader.md b/packages/block/docs/functions/createSealedCliqueBlockHeader.md new file mode 100644 index 00000000000..b9145a5dc2b --- /dev/null +++ b/packages/block/docs/functions/createSealedCliqueBlockHeader.md @@ -0,0 +1,29 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / createSealedCliqueBlockHeader + +# Function: createSealedCliqueBlockHeader() + +> **createSealedCliqueBlockHeader**(`headerData`, `cliqueSigner`, `opts`): [`BlockHeader`](../classes/BlockHeader.md) + +Defined in: [header/constructors.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header/constructors.ts#L74) + +## Parameters + +### headerData + +[`HeaderData`](../interfaces/HeaderData.md) = `{}` + +### cliqueSigner + +`Uint8Array` + +### opts + +[`BlockOptions`](../interfaces/BlockOptions.md) = `{}` + +## Returns + +[`BlockHeader`](../classes/BlockHeader.md) diff --git a/packages/block/docs/functions/ethashCanonicalDifficulty.md b/packages/block/docs/functions/ethashCanonicalDifficulty.md new file mode 100644 index 00000000000..92ba5c7c919 --- /dev/null +++ b/packages/block/docs/functions/ethashCanonicalDifficulty.md @@ -0,0 +1,29 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / ethashCanonicalDifficulty + +# Function: ethashCanonicalDifficulty() + +> **ethashCanonicalDifficulty**(`block`, `parentBlock`): `bigint` + +Defined in: [consensus/ethash.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/ethash.ts#L8) + +Returns the canonical difficulty for this block. + +## Parameters + +### block + +[`Block`](../classes/Block.md) + +### parentBlock + +[`Block`](../classes/Block.md) + +the parent of this `Block` + +## Returns + +`bigint` diff --git a/packages/block/docs/functions/executionPayloadFromBeaconPayload.md b/packages/block/docs/functions/executionPayloadFromBeaconPayload.md new file mode 100644 index 00000000000..b4a1225ab8e --- /dev/null +++ b/packages/block/docs/functions/executionPayloadFromBeaconPayload.md @@ -0,0 +1,24 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / executionPayloadFromBeaconPayload + +# Function: executionPayloadFromBeaconPayload() + +> **executionPayloadFromBeaconPayload**(`payload`): [`ExecutionPayload`](../type-aliases/ExecutionPayload.md) + +Defined in: [from-beacon-payload.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L99) + +Converts a beacon block execution payload JSON object [BeaconPayloadJSON](../type-aliases/BeaconPayloadJSON.md) to the [ExecutionPayload](../type-aliases/ExecutionPayload.md) data needed to construct a [Block](../classes/Block.md). +The JSON data can be retrieved from a consensus layer (CL) client on this Beacon API `/eth/v2/beacon/blocks/[block number]` + +## Parameters + +### payload + +[`BeaconPayloadJSON`](../type-aliases/BeaconPayloadJSON.md) + +## Returns + +[`ExecutionPayload`](../type-aliases/ExecutionPayload.md) diff --git a/packages/block/docs/interfaces/BlockData.md b/packages/block/docs/interfaces/BlockData.md index 7ab271c689a..804f8958521 100644 --- a/packages/block/docs/interfaces/BlockData.md +++ b/packages/block/docs/interfaces/BlockData.md @@ -1,69 +1,55 @@ -[@ethereumjs/block](../README.md) / BlockData +[**@ethereumjs/block**](../README.md) -# Interface: BlockData +*** -A block's data. +[@ethereumjs/block](../README.md) / BlockData -## Table of contents +# Interface: BlockData -### Properties +Defined in: [types.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L117) -- [executionWitness](BlockData.md#executionwitness) -- [header](BlockData.md#header) -- [transactions](BlockData.md#transactions) -- [uncleHeaders](BlockData.md#uncleheaders) -- [withdrawals](BlockData.md#withdrawals) +A block's data. ## Properties -### executionWitness +### executionWitness? -• `Optional` **executionWitness**: ``null`` \| [`VerkleExecutionWitness`](VerkleExecutionWitness.md) +> `optional` **executionWitness**: `null` \| `VerkleExecutionWitness` -EIP-6800: Verkle Proof Data (experimental) +Defined in: [types.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L128) -#### Defined in +EIP-6800: Verkle Proof Data (experimental) -[types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L153) +*** -___ +### header? -### header +> `optional` **header**: [`HeaderData`](HeaderData.md) -• `Optional` **header**: [`HeaderData`](HeaderData.md) +Defined in: [types.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L121) Header data for the block -#### Defined in - -[types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L146) - -___ - -### transactions - -• `Optional` **transactions**: (`AccessListEIP2930TxData` \| `BlobEIP4844TxData` \| `FeeMarketEIP1559TxData` \| `LegacyTxData`)[] - -#### Defined in +*** -[types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L147) +### transactions? -___ +> `optional` **transactions**: (`LegacyTxData` \| `AccessList2930TxData` \| `FeeMarketEIP1559TxData` \| `BlobEIP4844TxData` \| `EOACode7702TxData`)[] -### uncleHeaders +Defined in: [types.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L122) -• `Optional` **uncleHeaders**: [`HeaderData`](HeaderData.md)[] +*** -#### Defined in +### uncleHeaders? -[types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L148) +> `optional` **uncleHeaders**: [`HeaderData`](HeaderData.md)[] -___ +Defined in: [types.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L123) -### withdrawals +*** -• `Optional` **withdrawals**: `WithdrawalData`[] +### withdrawals? -#### Defined in +> `optional` **withdrawals**: `WithdrawalData`[] -[types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L149) +Defined in: [types.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L124) diff --git a/packages/block/docs/interfaces/BlockOptions.md b/packages/block/docs/interfaces/BlockOptions.md index fd2c13b88c2..4edaf5ce1a7 100644 --- a/packages/block/docs/interfaces/BlockOptions.md +++ b/packages/block/docs/interfaces/BlockOptions.md @@ -1,27 +1,24 @@ +[**@ethereumjs/block**](../README.md) + +*** + [@ethereumjs/block](../README.md) / BlockOptions # Interface: BlockOptions +Defined in: [types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L21) + An object to set to which blockchain the blocks and their headers belong. This could be specified using a Common object, or `chain` and `hardfork`. Defaults to mainnet without specifying a hardfork. -## Table of contents - -### Properties - -- [calcDifficultyFromHeader](BlockOptions.md#calcdifficultyfromheader) -- [cliqueSigner](BlockOptions.md#cliquesigner) -- [common](BlockOptions.md#common) -- [freeze](BlockOptions.md#freeze) -- [setHardfork](BlockOptions.md#sethardfork) -- [skipConsensusFormatValidation](BlockOptions.md#skipconsensusformatvalidation) - ## Properties -### calcDifficultyFromHeader +### calcDifficultyFromHeader? + +> `optional` **calcDifficultyFromHeader**: [`BlockHeader`](../classes/BlockHeader.md) -• `Optional` **calcDifficultyFromHeader**: [`BlockHeader`](../classes/BlockHeader.md) +Defined in: [types.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L66) If a preceding [BlockHeader](../classes/BlockHeader.md) (usually the parent header) is given the preceding header will be used to calculate the difficulty for this block and the calculated @@ -30,28 +27,13 @@ difficulty takes precedence over a provided static `difficulty` value. Note that this option has no effect on networks other than PoW/Ethash networks (respectively also deactivates on the Merge HF switching to PoS/Casper). -#### Defined in - -[types.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L50) - -___ - -### cliqueSigner - -• `Optional` **cliqueSigner**: `Uint8Array` - -Provide a clique signer's privateKey to seal this block. -Will throw if provided on a non-PoA chain. - -#### Defined in - -[types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L67) +*** -___ +### common? -### common +> `optional` **common**: `Common` -• `Optional` **common**: `Common` +Defined in: [types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L33) A Common object defining the chain and the hardfork a block/block header belongs to. @@ -63,15 +45,21 @@ hardfork in the Common class. Current default hardfork: `merge` -#### Defined in +*** -[types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L31) +### executionWitness? -___ +> `optional` **executionWitness**: `VerkleExecutionWitness` -### freeze +Defined in: [types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L84) -• `Optional` **freeze**: `boolean` +*** + +### freeze? + +> `optional` **freeze**: `boolean` + +Defined in: [types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L78) A block object by default gets frozen along initialization. This gives you strong additional security guarantees on the consistency of the block parameters. @@ -83,36 +71,48 @@ within your code instead. Default: true -#### Defined in +*** -[types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L62) +### params? -___ +> `optional` **params**: `ParamsDict` -### setHardfork +Defined in: [types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L57) -• `Optional` **setHardfork**: `boolean` \| `BigIntLike` +Block parameters sorted by EIP can be found in the exported `paramsBlock` dictionary, +which is internally passed to the associated `@ethereumjs/common` instance which +manages parameter selection based on the hardfork and EIP settings. -Set the hardfork either by timestamp (for HFs from Shanghai onwards) or by block number -for older Hfs. +This option allows providing a custom set of parameters. Note that parameters +get fully overwritten, so you need to extend the default parameter dict +to provide the full parameter set. -Additionally it is possible to pass in a specific TD value to support live-Merge-HF -transitions. Note that this should only be needed in very rare and specific scenarios. +It is recommended to deep-clone the params object for this to avoid side effects: -Default: `false` (HF is set to whatever default HF is set by the Common instance) +```ts +const params = JSON.parse(JSON.stringify(paramsBlock)) +params['1']['minGasLimit'] = 3000 // 5000 +``` + +*** -#### Defined in +### setHardfork? -[types.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L41) +> `optional` **setHardfork**: `boolean` -___ +Defined in: [types.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L40) -### skipConsensusFormatValidation +Set the hardfork either by timestamp (for HFs from Shanghai onwards) or by block number +for older Hfs. -• `Optional` **skipConsensusFormatValidation**: `boolean` +Default: `false` (HF is set to whatever default HF is set by the Common instance) -Skip consensus format validation checks on header if set. Defaults to false. +*** -#### Defined in +### skipConsensusFormatValidation? -[types.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L71) +> `optional` **skipConsensusFormatValidation**: `boolean` + +Defined in: [types.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L82) + +Skip consensus format validation checks on header if set. Defaults to false. diff --git a/packages/block/docs/interfaces/HeaderData.md b/packages/block/docs/interfaces/HeaderData.md index 70f584aa232..b542ea42fa8 100644 --- a/packages/block/docs/interfaces/HeaderData.md +++ b/packages/block/docs/interfaces/HeaderData.md @@ -1,230 +1,179 @@ +[**@ethereumjs/block**](../README.md) + +*** + [@ethereumjs/block](../README.md) / HeaderData # Interface: HeaderData -A block header's data. +Defined in: [types.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L90) -## Table of contents - -### Properties - -- [baseFeePerGas](HeaderData.md#basefeepergas) -- [blobGasUsed](HeaderData.md#blobgasused) -- [coinbase](HeaderData.md#coinbase) -- [difficulty](HeaderData.md#difficulty) -- [excessBlobGas](HeaderData.md#excessblobgas) -- [extraData](HeaderData.md#extradata) -- [gasLimit](HeaderData.md#gaslimit) -- [gasUsed](HeaderData.md#gasused) -- [logsBloom](HeaderData.md#logsbloom) -- [mixHash](HeaderData.md#mixhash) -- [nonce](HeaderData.md#nonce) -- [number](HeaderData.md#number) -- [parentBeaconBlockRoot](HeaderData.md#parentbeaconblockroot) -- [parentHash](HeaderData.md#parenthash) -- [receiptTrie](HeaderData.md#receipttrie) -- [stateRoot](HeaderData.md#stateroot) -- [timestamp](HeaderData.md#timestamp) -- [transactionsTrie](HeaderData.md#transactionstrie) -- [uncleHash](HeaderData.md#unclehash) -- [withdrawalsRoot](HeaderData.md#withdrawalsroot) +A block header's data. ## Properties -### baseFeePerGas - -• `Optional` **baseFeePerGas**: `BigIntLike` - -#### Defined in - -[types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L132) - -___ - -### blobGasUsed - -• `Optional` **blobGasUsed**: `BigIntLike` - -#### Defined in - -[types.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L134) - -___ - -### coinbase - -• `Optional` **coinbase**: `AddressLike` - -#### Defined in - -[types.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L119) - -___ - -### difficulty - -• `Optional` **difficulty**: `BigIntLike` +### baseFeePerGas? -#### Defined in +> `optional` **baseFeePerGas**: `BigIntLike` -[types.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L124) +Defined in: [types.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L106) -___ +*** -### excessBlobGas +### blobGasUsed? -• `Optional` **excessBlobGas**: `BigIntLike` +> `optional` **blobGasUsed**: `BigIntLike` -#### Defined in +Defined in: [types.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L108) -[types.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L135) +*** -___ +### coinbase? -### extraData +> `optional` **coinbase**: `AddressLike` -• `Optional` **extraData**: `BytesLike` +Defined in: [types.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L93) -#### Defined in +*** -[types.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L129) +### difficulty? -___ +> `optional` **difficulty**: `BigIntLike` -### gasLimit +Defined in: [types.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L98) -• `Optional` **gasLimit**: `BigIntLike` +*** -#### Defined in +### excessBlobGas? -[types.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L126) +> `optional` **excessBlobGas**: `BigIntLike` -___ +Defined in: [types.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L109) -### gasUsed +*** -• `Optional` **gasUsed**: `BigIntLike` +### extraData? -#### Defined in +> `optional` **extraData**: `BytesLike` -[types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L127) +Defined in: [types.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L103) -___ +*** -### logsBloom +### gasLimit? -• `Optional` **logsBloom**: `BytesLike` +> `optional` **gasLimit**: `BigIntLike` -#### Defined in +Defined in: [types.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L100) -[types.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L123) +*** -___ +### gasUsed? -### mixHash +> `optional` **gasUsed**: `BigIntLike` -• `Optional` **mixHash**: `BytesLike` +Defined in: [types.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L101) -#### Defined in +*** -[types.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L130) +### logsBloom? -___ +> `optional` **logsBloom**: `BytesLike` -### nonce +Defined in: [types.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L97) -• `Optional` **nonce**: `BytesLike` +*** -#### Defined in +### mixHash? -[types.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L131) +> `optional` **mixHash**: `BytesLike` -___ +Defined in: [types.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L104) -### number +*** -• `Optional` **number**: `BigIntLike` +### nonce? -#### Defined in +> `optional` **nonce**: `BytesLike` -[types.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L125) +Defined in: [types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L105) -___ +*** -### parentBeaconBlockRoot +### number? -• `Optional` **parentBeaconBlockRoot**: `BytesLike` +> `optional` **number**: `BigIntLike` -#### Defined in +Defined in: [types.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L99) -[types.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L136) +*** -___ +### parentBeaconBlockRoot? -### parentHash +> `optional` **parentBeaconBlockRoot**: `BytesLike` -• `Optional` **parentHash**: `BytesLike` +Defined in: [types.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L110) -#### Defined in +*** -[types.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L117) +### parentHash? -___ +> `optional` **parentHash**: `BytesLike` -### receiptTrie +Defined in: [types.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L91) -• `Optional` **receiptTrie**: `BytesLike` +*** -#### Defined in +### receiptTrie? -[types.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L122) +> `optional` **receiptTrie**: `BytesLike` -___ +Defined in: [types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L96) -### stateRoot +*** -• `Optional` **stateRoot**: `BytesLike` +### requestsHash? -#### Defined in +> `optional` **requestsHash**: `BytesLike` -[types.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L120) +Defined in: [types.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L111) -___ +*** -### timestamp +### stateRoot? -• `Optional` **timestamp**: `BigIntLike` +> `optional` **stateRoot**: `BytesLike` -#### Defined in +Defined in: [types.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L94) -[types.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L128) +*** -___ +### timestamp? -### transactionsTrie +> `optional` **timestamp**: `BigIntLike` -• `Optional` **transactionsTrie**: `BytesLike` +Defined in: [types.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L102) -#### Defined in +*** -[types.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L121) +### transactionsTrie? -___ +> `optional` **transactionsTrie**: `BytesLike` -### uncleHash +Defined in: [types.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L95) -• `Optional` **uncleHash**: `BytesLike` +*** -#### Defined in +### uncleHash? -[types.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L118) +> `optional` **uncleHash**: `BytesLike` -___ +Defined in: [types.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L92) -### withdrawalsRoot +*** -• `Optional` **withdrawalsRoot**: `BytesLike` +### withdrawalsRoot? -#### Defined in +> `optional` **withdrawalsRoot**: `BytesLike` -[types.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L133) +Defined in: [types.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L107) diff --git a/packages/block/docs/interfaces/JSONBlock.md b/packages/block/docs/interfaces/JSONBlock.md new file mode 100644 index 00000000000..330fe5ef08d --- /dev/null +++ b/packages/block/docs/interfaces/JSONBlock.md @@ -0,0 +1,53 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / JSONBlock + +# Interface: JSONBlock + +Defined in: [types.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L159) + +An object with the block's data represented as strings. + +## Properties + +### executionWitness? + +> `optional` **executionWitness**: `null` \| `VerkleExecutionWitness` + +Defined in: [types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L167) + +*** + +### header? + +> `optional` **header**: [`JSONHeader`](JSONHeader.md) + +Defined in: [types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L163) + +Header data for the block + +*** + +### transactions? + +> `optional` **transactions**: `JSONTx`[] + +Defined in: [types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L164) + +*** + +### uncleHeaders? + +> `optional` **uncleHeaders**: [`JSONHeader`](JSONHeader.md)[] + +Defined in: [types.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L165) + +*** + +### withdrawals? + +> `optional` **withdrawals**: `JSONRPCWithdrawal`[] + +Defined in: [types.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L166) diff --git a/packages/block/docs/interfaces/JSONHeader.md b/packages/block/docs/interfaces/JSONHeader.md new file mode 100644 index 00000000000..2ff8cfba7f6 --- /dev/null +++ b/packages/block/docs/interfaces/JSONHeader.md @@ -0,0 +1,179 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / JSONHeader + +# Interface: JSONHeader + +Defined in: [types.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L173) + +An object with the block header's data represented as 0x-prefixed hex strings. + +## Properties + +### baseFeePerGas? + +> `optional` **baseFeePerGas**: `` `0x${string}` `` + +Defined in: [types.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L189) + +*** + +### blobGasUsed? + +> `optional` **blobGasUsed**: `` `0x${string}` `` + +Defined in: [types.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L191) + +*** + +### coinbase? + +> `optional` **coinbase**: `` `0x${string}` `` + +Defined in: [types.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L176) + +*** + +### difficulty? + +> `optional` **difficulty**: `` `0x${string}` `` + +Defined in: [types.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L181) + +*** + +### excessBlobGas? + +> `optional` **excessBlobGas**: `` `0x${string}` `` + +Defined in: [types.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L192) + +*** + +### extraData? + +> `optional` **extraData**: `` `0x${string}` `` + +Defined in: [types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L186) + +*** + +### gasLimit? + +> `optional` **gasLimit**: `` `0x${string}` `` + +Defined in: [types.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L183) + +*** + +### gasUsed? + +> `optional` **gasUsed**: `` `0x${string}` `` + +Defined in: [types.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L184) + +*** + +### logsBloom? + +> `optional` **logsBloom**: `` `0x${string}` `` + +Defined in: [types.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L180) + +*** + +### mixHash? + +> `optional` **mixHash**: `` `0x${string}` `` + +Defined in: [types.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L187) + +*** + +### nonce? + +> `optional` **nonce**: `` `0x${string}` `` + +Defined in: [types.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L188) + +*** + +### number? + +> `optional` **number**: `` `0x${string}` `` + +Defined in: [types.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L182) + +*** + +### parentBeaconBlockRoot? + +> `optional` **parentBeaconBlockRoot**: `` `0x${string}` `` + +Defined in: [types.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L193) + +*** + +### parentHash? + +> `optional` **parentHash**: `` `0x${string}` `` + +Defined in: [types.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L174) + +*** + +### receiptTrie? + +> `optional` **receiptTrie**: `` `0x${string}` `` + +Defined in: [types.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L179) + +*** + +### requestsHash? + +> `optional` **requestsHash**: `` `0x${string}` `` + +Defined in: [types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L194) + +*** + +### stateRoot? + +> `optional` **stateRoot**: `` `0x${string}` `` + +Defined in: [types.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L177) + +*** + +### timestamp? + +> `optional` **timestamp**: `` `0x${string}` `` + +Defined in: [types.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L185) + +*** + +### transactionsTrie? + +> `optional` **transactionsTrie**: `` `0x${string}` `` + +Defined in: [types.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L178) + +*** + +### uncleHash? + +> `optional` **uncleHash**: `` `0x${string}` `` + +Defined in: [types.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L175) + +*** + +### withdrawalsRoot? + +> `optional` **withdrawalsRoot**: `` `0x${string}` `` + +Defined in: [types.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L190) diff --git a/packages/block/docs/interfaces/JSONRPCBlock.md b/packages/block/docs/interfaces/JSONRPCBlock.md new file mode 100644 index 00000000000..913f7ec5877 --- /dev/null +++ b/packages/block/docs/interfaces/JSONRPCBlock.md @@ -0,0 +1,233 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / JSONRPCBlock + +# Interface: JSONRPCBlock + +Defined in: [types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L200) + +## Properties + +### baseFeePerGas? + +> `optional` **baseFeePerGas**: `` `0x${string}` `` + +Defined in: [types.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L221) + +*** + +### blobGasUsed? + +> `optional` **blobGasUsed**: `` `0x${string}` `` + +Defined in: [types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L224) + +*** + +### difficulty + +> **difficulty**: `` `${number}` `` \| `` `0x${string}` `` + +Defined in: [types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L212) + +*** + +### excessBlobGas? + +> `optional` **excessBlobGas**: `` `0x${string}` `` + +Defined in: [types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L225) + +*** + +### executionWitness? + +> `optional` **executionWitness**: `null` \| `VerkleExecutionWitness` + +Defined in: [types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L227) + +*** + +### extraData + +> **extraData**: `` `0x${string}` `` + +Defined in: [types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L214) + +*** + +### gasLimit + +> **gasLimit**: `` `0x${string}` `` + +Defined in: [types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L216) + +*** + +### gasUsed + +> **gasUsed**: `` `0x${string}` `` + +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L217) + +*** + +### hash + +> **hash**: `` `0x${string}` `` + +Defined in: [types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L202) + +*** + +### logsBloom + +> **logsBloom**: `` `0x${string}` `` + +Defined in: [types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L207) + +*** + +### miner + +> **miner**: `` `0x${string}` `` + +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L211) + +*** + +### mixHash? + +> `optional` **mixHash**: `` `0x${string}` `` + +Defined in: [types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L204) + +*** + +### nonce + +> **nonce**: `` `0x${string}` `` + +Defined in: [types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L205) + +*** + +### number + +> **number**: `` `0x${string}` `` + +Defined in: [types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L201) + +*** + +### parentBeaconBlockRoot? + +> `optional` **parentBeaconBlockRoot**: `` `0x${string}` `` + +Defined in: [types.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L226) + +*** + +### parentHash + +> **parentHash**: `` `0x${string}` `` + +Defined in: [types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L203) + +*** + +### receiptsRoot + +> **receiptsRoot**: `` `0x${string}` `` + +Defined in: [types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L210) + +*** + +### requestsHash? + +> `optional` **requestsHash**: `` `0x${string}` `` + +Defined in: [types.ts:228](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L228) + +*** + +### sha3Uncles + +> **sha3Uncles**: `` `0x${string}` `` + +Defined in: [types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L206) + +*** + +### size + +> **size**: `` `0x${string}` `` + +Defined in: [types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L215) + +*** + +### stateRoot + +> **stateRoot**: `` `0x${string}` `` + +Defined in: [types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L209) + +*** + +### timestamp + +> **timestamp**: `` `0x${string}` `` + +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L218) + +*** + +### totalDifficulty? + +> `optional` **totalDifficulty**: `` `0x${string}` `` + +Defined in: [types.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L213) + +*** + +### transactions + +> **transactions**: (`` `0x${string}` `` \| `JSONRPCTx`)[] + +Defined in: [types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L219) + +*** + +### transactionsRoot + +> **transactionsRoot**: `` `0x${string}` `` + +Defined in: [types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L208) + +*** + +### uncles + +> **uncles**: `` `0x${string}` ``[] + +Defined in: [types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L220) + +*** + +### withdrawals? + +> `optional` **withdrawals**: `JSONRPCWithdrawal`[] + +Defined in: [types.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L222) + +*** + +### withdrawalsRoot? + +> `optional` **withdrawalsRoot**: `` `0x${string}` `` + +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L223) diff --git a/packages/block/docs/interfaces/JsonBlock.md b/packages/block/docs/interfaces/JsonBlock.md deleted file mode 100644 index efdd041e9cd..00000000000 --- a/packages/block/docs/interfaces/JsonBlock.md +++ /dev/null @@ -1,67 +0,0 @@ -[@ethereumjs/block](../README.md) / JsonBlock - -# Interface: JsonBlock - -An object with the block's data represented as strings. - -## Table of contents - -### Properties - -- [executionWitness](JsonBlock.md#executionwitness) -- [header](JsonBlock.md#header) -- [transactions](JsonBlock.md#transactions) -- [uncleHeaders](JsonBlock.md#uncleheaders) -- [withdrawals](JsonBlock.md#withdrawals) - -## Properties - -### executionWitness - -• `Optional` **executionWitness**: ``null`` \| [`VerkleExecutionWitness`](VerkleExecutionWitness.md) - -#### Defined in - -[types.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L192) - -___ - -### header - -• `Optional` **header**: [`JsonHeader`](JsonHeader.md) - -Header data for the block - -#### Defined in - -[types.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L188) - -___ - -### transactions - -• `Optional` **transactions**: `JsonTx`[] - -#### Defined in - -[types.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L189) - -___ - -### uncleHeaders - -• `Optional` **uncleHeaders**: [`JsonHeader`](JsonHeader.md)[] - -#### Defined in - -[types.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L190) - -___ - -### withdrawals - -• `Optional` **withdrawals**: `JsonRpcWithdrawal`[] - -#### Defined in - -[types.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L191) diff --git a/packages/block/docs/interfaces/JsonHeader.md b/packages/block/docs/interfaces/JsonHeader.md deleted file mode 100644 index 8b402b01ab7..00000000000 --- a/packages/block/docs/interfaces/JsonHeader.md +++ /dev/null @@ -1,230 +0,0 @@ -[@ethereumjs/block](../README.md) / JsonHeader - -# Interface: JsonHeader - -An object with the block header's data represented as strings. - -## Table of contents - -### Properties - -- [baseFeePerGas](JsonHeader.md#basefeepergas) -- [blobGasUsed](JsonHeader.md#blobgasused) -- [coinbase](JsonHeader.md#coinbase) -- [difficulty](JsonHeader.md#difficulty) -- [excessBlobGas](JsonHeader.md#excessblobgas) -- [extraData](JsonHeader.md#extradata) -- [gasLimit](JsonHeader.md#gaslimit) -- [gasUsed](JsonHeader.md#gasused) -- [logsBloom](JsonHeader.md#logsbloom) -- [mixHash](JsonHeader.md#mixhash) -- [nonce](JsonHeader.md#nonce) -- [number](JsonHeader.md#number) -- [parentBeaconBlockRoot](JsonHeader.md#parentbeaconblockroot) -- [parentHash](JsonHeader.md#parenthash) -- [receiptTrie](JsonHeader.md#receipttrie) -- [stateRoot](JsonHeader.md#stateroot) -- [timestamp](JsonHeader.md#timestamp) -- [transactionsTrie](JsonHeader.md#transactionstrie) -- [uncleHash](JsonHeader.md#unclehash) -- [withdrawalsRoot](JsonHeader.md#withdrawalsroot) - -## Properties - -### baseFeePerGas - -• `Optional` **baseFeePerGas**: `string` - -#### Defined in - -[types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L214) - -___ - -### blobGasUsed - -• `Optional` **blobGasUsed**: `string` - -#### Defined in - -[types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L216) - -___ - -### coinbase - -• `Optional` **coinbase**: `string` - -#### Defined in - -[types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L201) - -___ - -### difficulty - -• `Optional` **difficulty**: `string` - -#### Defined in - -[types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L206) - -___ - -### excessBlobGas - -• `Optional` **excessBlobGas**: `string` - -#### Defined in - -[types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L217) - -___ - -### extraData - -• `Optional` **extraData**: `string` - -#### Defined in - -[types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L211) - -___ - -### gasLimit - -• `Optional` **gasLimit**: `string` - -#### Defined in - -[types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L208) - -___ - -### gasUsed - -• `Optional` **gasUsed**: `string` - -#### Defined in - -[types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L209) - -___ - -### logsBloom - -• `Optional` **logsBloom**: `string` - -#### Defined in - -[types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L205) - -___ - -### mixHash - -• `Optional` **mixHash**: `string` - -#### Defined in - -[types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L212) - -___ - -### nonce - -• `Optional` **nonce**: `string` - -#### Defined in - -[types.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L213) - -___ - -### number - -• `Optional` **number**: `string` - -#### Defined in - -[types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L207) - -___ - -### parentBeaconBlockRoot - -• `Optional` **parentBeaconBlockRoot**: `string` - -#### Defined in - -[types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L218) - -___ - -### parentHash - -• `Optional` **parentHash**: `string` - -#### Defined in - -[types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L199) - -___ - -### receiptTrie - -• `Optional` **receiptTrie**: `string` - -#### Defined in - -[types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L204) - -___ - -### stateRoot - -• `Optional` **stateRoot**: `string` - -#### Defined in - -[types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L202) - -___ - -### timestamp - -• `Optional` **timestamp**: `string` - -#### Defined in - -[types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L210) - -___ - -### transactionsTrie - -• `Optional` **transactionsTrie**: `string` - -#### Defined in - -[types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L203) - -___ - -### uncleHash - -• `Optional` **uncleHash**: `string` - -#### Defined in - -[types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L200) - -___ - -### withdrawalsRoot - -• `Optional` **withdrawalsRoot**: `string` - -#### Defined in - -[types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L215) diff --git a/packages/block/docs/interfaces/JsonRpcBlock.md b/packages/block/docs/interfaces/JsonRpcBlock.md deleted file mode 100644 index a5f9b612f4d..00000000000 --- a/packages/block/docs/interfaces/JsonRpcBlock.md +++ /dev/null @@ -1,305 +0,0 @@ -[@ethereumjs/block](../README.md) / JsonRpcBlock - -# Interface: JsonRpcBlock - -## Table of contents - -### Properties - -- [baseFeePerGas](JsonRpcBlock.md#basefeepergas) -- [blobGasUsed](JsonRpcBlock.md#blobgasused) -- [difficulty](JsonRpcBlock.md#difficulty) -- [excessBlobGas](JsonRpcBlock.md#excessblobgas) -- [executionWitness](JsonRpcBlock.md#executionwitness) -- [extraData](JsonRpcBlock.md#extradata) -- [gasLimit](JsonRpcBlock.md#gaslimit) -- [gasUsed](JsonRpcBlock.md#gasused) -- [hash](JsonRpcBlock.md#hash) -- [logsBloom](JsonRpcBlock.md#logsbloom) -- [miner](JsonRpcBlock.md#miner) -- [mixHash](JsonRpcBlock.md#mixhash) -- [nonce](JsonRpcBlock.md#nonce) -- [number](JsonRpcBlock.md#number) -- [parentBeaconBlockRoot](JsonRpcBlock.md#parentbeaconblockroot) -- [parentHash](JsonRpcBlock.md#parenthash) -- [receiptsRoot](JsonRpcBlock.md#receiptsroot) -- [sha3Uncles](JsonRpcBlock.md#sha3uncles) -- [size](JsonRpcBlock.md#size) -- [stateRoot](JsonRpcBlock.md#stateroot) -- [timestamp](JsonRpcBlock.md#timestamp) -- [totalDifficulty](JsonRpcBlock.md#totaldifficulty) -- [transactions](JsonRpcBlock.md#transactions) -- [transactionsRoot](JsonRpcBlock.md#transactionsroot) -- [uncles](JsonRpcBlock.md#uncles) -- [withdrawals](JsonRpcBlock.md#withdrawals) -- [withdrawalsRoot](JsonRpcBlock.md#withdrawalsroot) - -## Properties - -### baseFeePerGas - -• `Optional` **baseFeePerGas**: `string` - -#### Defined in - -[types.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L245) - -___ - -### blobGasUsed - -• `Optional` **blobGasUsed**: `string` - -#### Defined in - -[types.ts:248](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L248) - -___ - -### difficulty - -• **difficulty**: `string` - -#### Defined in - -[types.ts:236](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L236) - -___ - -### excessBlobGas - -• `Optional` **excessBlobGas**: `string` - -#### Defined in - -[types.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L249) - -___ - -### executionWitness - -• `Optional` **executionWitness**: ``null`` \| [`VerkleExecutionWitness`](VerkleExecutionWitness.md) - -#### Defined in - -[types.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L251) - -___ - -### extraData - -• **extraData**: `string` - -#### Defined in - -[types.ts:238](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L238) - -___ - -### gasLimit - -• **gasLimit**: `string` - -#### Defined in - -[types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L240) - -___ - -### gasUsed - -• **gasUsed**: `string` - -#### Defined in - -[types.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L241) - -___ - -### hash - -• **hash**: `string` - -#### Defined in - -[types.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L226) - -___ - -### logsBloom - -• **logsBloom**: `string` - -#### Defined in - -[types.ts:231](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L231) - -___ - -### miner - -• **miner**: `string` - -#### Defined in - -[types.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L235) - -___ - -### mixHash - -• `Optional` **mixHash**: `string` - -#### Defined in - -[types.ts:228](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L228) - -___ - -### nonce - -• **nonce**: `string` - -#### Defined in - -[types.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L229) - -___ - -### number - -• **number**: `string` - -#### Defined in - -[types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L225) - -___ - -### parentBeaconBlockRoot - -• `Optional` **parentBeaconBlockRoot**: `string` - -#### Defined in - -[types.ts:250](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L250) - -___ - -### parentHash - -• **parentHash**: `string` - -#### Defined in - -[types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L227) - -___ - -### receiptsRoot - -• **receiptsRoot**: `string` - -#### Defined in - -[types.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L234) - -___ - -### sha3Uncles - -• **sha3Uncles**: `string` - -#### Defined in - -[types.ts:230](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L230) - -___ - -### size - -• **size**: `string` - -#### Defined in - -[types.ts:239](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L239) - -___ - -### stateRoot - -• **stateRoot**: `string` - -#### Defined in - -[types.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L233) - -___ - -### timestamp - -• **timestamp**: `string` - -#### Defined in - -[types.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L242) - -___ - -### totalDifficulty - -• **totalDifficulty**: `string` - -#### Defined in - -[types.ts:237](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L237) - -___ - -### transactions - -• **transactions**: (`string` \| `JsonRpcTx`)[] - -#### Defined in - -[types.ts:243](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L243) - -___ - -### transactionsRoot - -• **transactionsRoot**: `string` - -#### Defined in - -[types.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L232) - -___ - -### uncles - -• **uncles**: `string`[] - -#### Defined in - -[types.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L244) - -___ - -### withdrawals - -• `Optional` **withdrawals**: `JsonRpcWithdrawal`[] - -#### Defined in - -[types.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L246) - -___ - -### withdrawalsRoot - -• `Optional` **withdrawalsRoot**: `string` - -#### Defined in - -[types.ts:247](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L247) diff --git a/packages/block/docs/interfaces/VerkleExecutionWitness.md b/packages/block/docs/interfaces/VerkleExecutionWitness.md deleted file mode 100644 index 00fad0e8ed2..00000000000 --- a/packages/block/docs/interfaces/VerkleExecutionWitness.md +++ /dev/null @@ -1,40 +0,0 @@ -[@ethereumjs/block](../README.md) / VerkleExecutionWitness - -# Interface: VerkleExecutionWitness - -Experimental, object format could eventual change. -An object that provides the state and proof necessary for verkle stateless execution - -## Table of contents - -### Properties - -- [stateDiff](VerkleExecutionWitness.md#statediff) -- [verkleProof](VerkleExecutionWitness.md#verkleproof) - -## Properties - -### stateDiff - -• **stateDiff**: [`VerkleStateDiff`](VerkleStateDiff.md)[] - -An array of state diffs. -Each item corresponding to state accesses or state modifications of the block. -In the current design, it also contains the resulting state of the block execution (post-state). - -#### Defined in - -[types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L105) - -___ - -### verkleProof - -• **verkleProof**: [`VerkleProof`](VerkleProof.md) - -The verkle proof for the block. -Proves that the provided stateDiff belongs to the canonical verkle tree. - -#### Defined in - -[types.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L110) diff --git a/packages/block/docs/interfaces/VerkleProof.md b/packages/block/docs/interfaces/VerkleProof.md deleted file mode 100644 index 23d25192fe0..00000000000 --- a/packages/block/docs/interfaces/VerkleProof.md +++ /dev/null @@ -1,71 +0,0 @@ -[@ethereumjs/block](../README.md) / VerkleProof - -# Interface: VerkleProof - -## Table of contents - -### Properties - -- [commitmentsByPath](VerkleProof.md#commitmentsbypath) -- [d](VerkleProof.md#d) -- [depthExtensionPresent](VerkleProof.md#depthextensionpresent) -- [ipaProof](VerkleProof.md#ipaproof) -- [otherStems](VerkleProof.md#otherstems) - -## Properties - -### commitmentsByPath - -• **commitmentsByPath**: `string`[] - -#### Defined in - -[types.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L75) - -___ - -### d - -• **d**: `string` - -#### Defined in - -[types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L76) - -___ - -### depthExtensionPresent - -• **depthExtensionPresent**: `string` - -#### Defined in - -[types.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L77) - -___ - -### ipaProof - -• **ipaProof**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `cl` | `string`[] | -| `cr` | `string`[] | -| `finalEvaluation` | `string` | - -#### Defined in - -[types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L78) - -___ - -### otherStems - -• **otherStems**: `string`[] - -#### Defined in - -[types.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L83) diff --git a/packages/block/docs/interfaces/VerkleStateDiff.md b/packages/block/docs/interfaces/VerkleStateDiff.md deleted file mode 100644 index 7ec08c13295..00000000000 --- a/packages/block/docs/interfaces/VerkleStateDiff.md +++ /dev/null @@ -1,30 +0,0 @@ -[@ethereumjs/block](../README.md) / VerkleStateDiff - -# Interface: VerkleStateDiff - -## Table of contents - -### Properties - -- [stem](VerkleStateDiff.md#stem) -- [suffixDiffs](VerkleStateDiff.md#suffixdiffs) - -## Properties - -### stem - -• **stem**: `string` - -#### Defined in - -[types.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L87) - -___ - -### suffixDiffs - -• **suffixDiffs**: { `currentValue`: ``null`` \| `string` ; `newValue`: ``null`` \| `string` ; `suffix`: `string` \| `number` }[] - -#### Defined in - -[types.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L88) diff --git a/packages/block/docs/type-aliases/BeaconPayloadJSON.md b/packages/block/docs/type-aliases/BeaconPayloadJSON.md new file mode 100644 index 00000000000..9f96ea5ddf5 --- /dev/null +++ b/packages/block/docs/type-aliases/BeaconPayloadJSON.md @@ -0,0 +1,171 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / BeaconPayloadJSON + +# Type Alias: BeaconPayloadJSON + +> **BeaconPayloadJSON** = `object` + +Defined in: [from-beacon-payload.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L15) + +## Properties + +### base\_fee\_per\_gas + +> **base\_fee\_per\_gas**: `NumericString` + +Defined in: [from-beacon-payload.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L27) + +*** + +### blob\_gas\_used? + +> `optional` **blob\_gas\_used**: `NumericString` + +Defined in: [from-beacon-payload.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L31) + +*** + +### block\_hash + +> **block\_hash**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L28) + +*** + +### block\_number + +> **block\_number**: `NumericString` + +Defined in: [from-beacon-payload.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L22) + +*** + +### excess\_blob\_gas? + +> `optional` **excess\_blob\_gas**: `NumericString` + +Defined in: [from-beacon-payload.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L32) + +*** + +### execution\_witness? + +> `optional` **execution\_witness**: `VerkleExecutionWitness` + +Defined in: [from-beacon-payload.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L36) + +*** + +### extra\_data + +> **extra\_data**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L26) + +*** + +### fee\_recipient + +> **fee\_recipient**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L17) + +*** + +### gas\_limit + +> **gas\_limit**: `NumericString` + +Defined in: [from-beacon-payload.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L23) + +*** + +### gas\_used + +> **gas\_used**: `NumericString` + +Defined in: [from-beacon-payload.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L24) + +*** + +### logs\_bloom + +> **logs\_bloom**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L20) + +*** + +### parent\_beacon\_block\_root? + +> `optional` **parent\_beacon\_block\_root**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L33) + +*** + +### parent\_hash + +> **parent\_hash**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L16) + +*** + +### prev\_randao + +> **prev\_randao**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L21) + +*** + +### receipts\_root + +> **receipts\_root**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L19) + +*** + +### requests\_hash? + +> `optional` **requests\_hash**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L34) + +*** + +### state\_root + +> **state\_root**: `PrefixedHexString` + +Defined in: [from-beacon-payload.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L18) + +*** + +### timestamp + +> **timestamp**: `NumericString` + +Defined in: [from-beacon-payload.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L25) + +*** + +### transactions + +> **transactions**: `PrefixedHexString`[] + +Defined in: [from-beacon-payload.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L29) + +*** + +### withdrawals? + +> `optional` **withdrawals**: `BeaconWithdrawal`[] + +Defined in: [from-beacon-payload.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/from-beacon-payload.ts#L30) diff --git a/packages/block/docs/type-aliases/BlockBodyBytes.md b/packages/block/docs/type-aliases/BlockBodyBytes.md new file mode 100644 index 00000000000..c1589461c99 --- /dev/null +++ b/packages/block/docs/type-aliases/BlockBodyBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / BlockBodyBytes + +# Type Alias: BlockBodyBytes + +> **BlockBodyBytes** = \[[`TransactionsBytes`](TransactionsBytes.md), [`UncleHeadersBytes`](UncleHeadersBytes.md), [`WithdrawalsBytes`](WithdrawalsBytes.md)?\] + +Defined in: [types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L149) diff --git a/packages/block/docs/type-aliases/BlockBytes.md b/packages/block/docs/type-aliases/BlockBytes.md new file mode 100644 index 00000000000..814a82fd3a6 --- /dev/null +++ b/packages/block/docs/type-aliases/BlockBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / BlockBytes + +# Type Alias: BlockBytes + +> **BlockBytes** = \[[`BlockHeaderBytes`](BlockHeaderBytes.md), [`TransactionsBytes`](TransactionsBytes.md), [`UncleHeadersBytes`](UncleHeadersBytes.md)\] \| \[[`BlockHeaderBytes`](BlockHeaderBytes.md), [`TransactionsBytes`](TransactionsBytes.md), [`UncleHeadersBytes`](UncleHeadersBytes.md), [`WithdrawalsBytes`](WithdrawalsBytes.md)\] \| \[[`BlockHeaderBytes`](BlockHeaderBytes.md), [`TransactionsBytes`](TransactionsBytes.md), [`UncleHeadersBytes`](UncleHeadersBytes.md), [`WithdrawalsBytes`](WithdrawalsBytes.md), [`ExecutionWitnessBytes`](ExecutionWitnessBytes.md)\] + +Defined in: [types.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L134) diff --git a/packages/block/docs/type-aliases/BlockHeaderBytes.md b/packages/block/docs/type-aliases/BlockHeaderBytes.md new file mode 100644 index 00000000000..a3e408e021d --- /dev/null +++ b/packages/block/docs/type-aliases/BlockHeaderBytes.md @@ -0,0 +1,13 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / BlockHeaderBytes + +# Type Alias: BlockHeaderBytes + +> **BlockHeaderBytes** = `Uint8Array`[] + +Defined in: [types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L148) + +BlockHeaderBuffer is a Buffer array, except for the Verkle PreState which is an array of prestate arrays. diff --git a/packages/block/docs/type-aliases/ExecutionPayload.md b/packages/block/docs/type-aliases/ExecutionPayload.md new file mode 100644 index 00000000000..6e5f287c605 --- /dev/null +++ b/packages/block/docs/type-aliases/ExecutionPayload.md @@ -0,0 +1,171 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / ExecutionPayload + +# Type Alias: ExecutionPayload + +> **ExecutionPayload** = `object` + +Defined in: [types.ts:239](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L239) + +## Properties + +### baseFeePerGas + +> **baseFeePerGas**: `PrefixedHexString` + +Defined in: [types.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L251) + +*** + +### blobGasUsed? + +> `optional` **blobGasUsed**: `PrefixedHexString` + +Defined in: [types.ts:255](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L255) + +*** + +### blockHash + +> **blockHash**: `PrefixedHexString` + +Defined in: [types.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L252) + +*** + +### blockNumber + +> **blockNumber**: `PrefixedHexString` + +Defined in: [types.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L246) + +*** + +### excessBlobGas? + +> `optional` **excessBlobGas**: `PrefixedHexString` + +Defined in: [types.ts:256](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L256) + +*** + +### executionWitness? + +> `optional` **executionWitness**: `VerkleExecutionWitness` \| `null` + +Defined in: [types.ts:260](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L260) + +*** + +### extraData + +> **extraData**: `PrefixedHexString` + +Defined in: [types.ts:250](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L250) + +*** + +### feeRecipient + +> **feeRecipient**: `PrefixedHexString` + +Defined in: [types.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L241) + +*** + +### gasLimit + +> **gasLimit**: `PrefixedHexString` + +Defined in: [types.ts:247](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L247) + +*** + +### gasUsed + +> **gasUsed**: `PrefixedHexString` + +Defined in: [types.ts:248](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L248) + +*** + +### logsBloom + +> **logsBloom**: `PrefixedHexString` + +Defined in: [types.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L244) + +*** + +### parentBeaconBlockRoot? + +> `optional` **parentBeaconBlockRoot**: `PrefixedHexString` + +Defined in: [types.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L257) + +*** + +### parentHash + +> **parentHash**: `PrefixedHexString` + +Defined in: [types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L240) + +*** + +### prevRandao + +> **prevRandao**: `PrefixedHexString` + +Defined in: [types.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L245) + +*** + +### receiptsRoot + +> **receiptsRoot**: `PrefixedHexString` + +Defined in: [types.ts:243](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L243) + +*** + +### requestsHash? + +> `optional` **requestsHash**: `PrefixedHexString` + +Defined in: [types.ts:258](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L258) + +*** + +### stateRoot + +> **stateRoot**: `PrefixedHexString` + +Defined in: [types.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L242) + +*** + +### timestamp + +> **timestamp**: `PrefixedHexString` + +Defined in: [types.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L249) + +*** + +### transactions + +> **transactions**: `PrefixedHexString`[] + +Defined in: [types.ts:253](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L253) + +*** + +### withdrawals? + +> `optional` **withdrawals**: [`WithdrawalV1`](WithdrawalV1.md)[] + +Defined in: [types.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L254) diff --git a/packages/block/docs/type-aliases/ExecutionWitnessBytes.md b/packages/block/docs/type-aliases/ExecutionWitnessBytes.md new file mode 100644 index 00000000000..90211cd23da --- /dev/null +++ b/packages/block/docs/type-aliases/ExecutionWitnessBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / ExecutionWitnessBytes + +# Type Alias: ExecutionWitnessBytes + +> **ExecutionWitnessBytes** = `Uint8Array` + +Defined in: [types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L132) diff --git a/packages/block/docs/type-aliases/TransactionsBytes.md b/packages/block/docs/type-aliases/TransactionsBytes.md new file mode 100644 index 00000000000..a700b3070d5 --- /dev/null +++ b/packages/block/docs/type-aliases/TransactionsBytes.md @@ -0,0 +1,13 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / TransactionsBytes + +# Type Alias: TransactionsBytes + +> **TransactionsBytes** = `Uint8Array`[][] \| `Uint8Array`[] + +Defined in: [types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L153) + +TransactionsBytes can be an array of serialized txs for Typed Transactions or an array of Uint8Array Arrays for legacy transactions. diff --git a/packages/block/docs/type-aliases/UncleHeadersBytes.md b/packages/block/docs/type-aliases/UncleHeadersBytes.md new file mode 100644 index 00000000000..fc1ff37767e --- /dev/null +++ b/packages/block/docs/type-aliases/UncleHeadersBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / UncleHeadersBytes + +# Type Alias: UncleHeadersBytes + +> **UncleHeadersBytes** = `Uint8Array`[][] + +Defined in: [types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L154) diff --git a/packages/block/docs/type-aliases/WithdrawalV1.md b/packages/block/docs/type-aliases/WithdrawalV1.md new file mode 100644 index 00000000000..bbcc47ffbdc --- /dev/null +++ b/packages/block/docs/type-aliases/WithdrawalV1.md @@ -0,0 +1,43 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / WithdrawalV1 + +# Type Alias: WithdrawalV1 + +> **WithdrawalV1** = `object` + +Defined in: [types.ts:231](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L231) + +## Properties + +### address + +> **address**: `PrefixedHexString` + +Defined in: [types.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L234) + +*** + +### amount + +> **amount**: `PrefixedHexString` + +Defined in: [types.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L235) + +*** + +### index + +> **index**: `PrefixedHexString` + +Defined in: [types.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L232) + +*** + +### validatorIndex + +> **validatorIndex**: `PrefixedHexString` + +Defined in: [types.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L233) diff --git a/packages/block/docs/type-aliases/WithdrawalsBytes.md b/packages/block/docs/type-aliases/WithdrawalsBytes.md new file mode 100644 index 00000000000..d3cabe7c736 --- /dev/null +++ b/packages/block/docs/type-aliases/WithdrawalsBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / WithdrawalsBytes + +# Type Alias: WithdrawalsBytes + +> **WithdrawalsBytes** = `WithdrawalBytes`[] + +Defined in: [types.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L131) diff --git a/packages/block/docs/variables/CLIQUE_EXTRA_SEAL.md b/packages/block/docs/variables/CLIQUE_EXTRA_SEAL.md new file mode 100644 index 00000000000..5df802047c5 --- /dev/null +++ b/packages/block/docs/variables/CLIQUE_EXTRA_SEAL.md @@ -0,0 +1,11 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / CLIQUE\_EXTRA\_SEAL + +# Variable: CLIQUE\_EXTRA\_SEAL + +> `const` **CLIQUE\_EXTRA\_SEAL**: `65` = `65` + +Defined in: [consensus/clique.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L26) diff --git a/packages/block/docs/variables/CLIQUE_EXTRA_VANITY.md b/packages/block/docs/variables/CLIQUE_EXTRA_VANITY.md new file mode 100644 index 00000000000..15179774aae --- /dev/null +++ b/packages/block/docs/variables/CLIQUE_EXTRA_VANITY.md @@ -0,0 +1,11 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / CLIQUE\_EXTRA\_VANITY + +# Variable: CLIQUE\_EXTRA\_VANITY + +> `const` **CLIQUE\_EXTRA\_VANITY**: `32` = `32` + +Defined in: [consensus/clique.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/consensus/clique.ts#L24) diff --git a/packages/block/docs/variables/paramsBlock.md b/packages/block/docs/variables/paramsBlock.md new file mode 100644 index 00000000000..47695fc1db6 --- /dev/null +++ b/packages/block/docs/variables/paramsBlock.md @@ -0,0 +1,11 @@ +[**@ethereumjs/block**](../README.md) + +*** + +[@ethereumjs/block](../README.md) / paramsBlock + +# Variable: paramsBlock + +> `const` **paramsBlock**: `ParamsDict` + +Defined in: [params.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/params.ts#L3) diff --git a/packages/block/examples/1559.ts b/packages/block/examples/1559.ts index e5139a9766b..f695abcb587 100644 --- a/packages/block/examples/1559.ts +++ b/packages/block/examples/1559.ts @@ -1,5 +1,5 @@ import { createBlock } from '@ethereumjs/block' -import { Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { Common, Mainnet } from '@ethereumjs/common' import { createTx } from '@ethereumjs/tx' const common = new Common({ chain: Mainnet }) diff --git a/packages/block/examples/clrequests.ts b/packages/block/examples/clrequests.ts new file mode 100644 index 00000000000..308e4b3dd7c --- /dev/null +++ b/packages/block/examples/clrequests.ts @@ -0,0 +1,57 @@ +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { CLRequestType, bytesToHex, createCLRequest, hexToBytes } from '@ethereumjs/util' +import { sha256 } from 'ethereum-cryptography/sha256.js' + +import { createBlock, genRequestsRoot } from '../src' + +// Enable EIP-7685 to support CLRequests +const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7685] }) + +// Create examples of the three CLRequest types +const createExampleRequests = () => { + // Create a deposit request (type 0) + const depositData = hexToBytes( + '0x00ac842878bb70009552a4cfcad801d6e659c50bd50d7d03306790cb455ce7363c5b6972f0159d170f625a99b2064dbefc010000000000000000000000818ccb1c4eda80270b04d6df822b1e72dd83c3030040597307000000a747f75c72d0cf0d2b52504c7385b516f0523e2f0842416399f42b4aee5c6384a5674f6426b1cc3d0827886fa9b909e616f5c9f61f986013ed2b9bf37071cbae951136265b549f44e3c8e26233c0433e9124b7fd0dc86e82f9fedfc0a179d7690000000000000000', + ) + const depositRequest = createCLRequest(depositData) + + // Create a withdrawal request (type 1) + const withdrawalData = hexToBytes( + '0x01000000000000000000000000000000000000000001000000000000000000000de0b6b3a7640000', + ) + const withdrawalRequest = createCLRequest(withdrawalData) + + // Create a consolidation request (type 2) + const consolidationData = hexToBytes('0x020000000100000000000000000000000000000000000001') + const consolidationRequest = createCLRequest(consolidationData) + + // CLRequests must be sorted by type (Deposit=0, Withdrawal=1, Consolidation=2) + return [depositRequest, withdrawalRequest, consolidationRequest] +} + +// Generate a block with CLRequests +function createBlockWithCLRequests() { + const requests = createExampleRequests() + console.log(`Created ${requests.length} CLRequests:`) + + for (const req of requests) { + console.log( + `- Type: ${req.type} (${Object.keys(CLRequestType).find( + (k) => CLRequestType[k as keyof typeof CLRequestType] === req.type, + )})`, + ) + } + + // Generate the requestsHash by hashing all the CLRequests + const requestsHash = genRequestsRoot(requests, sha256) + console.log(`Generated requestsHash: 0x${bytesToHex(requestsHash)}`) + + // Create a block with the CLRequests hash + const block = createBlock({ header: { requestsHash } }, { common }) + console.log(`Created block hash: 0x${bytesToHex(block.hash())}`) + + return block +} + +// Execute +createBlockWithCLRequests() diff --git a/packages/block/package.json b/packages/block/package.json index f3bad315188..730bdf0cab9 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -34,7 +34,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- block", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", @@ -55,7 +55,7 @@ "@ethereumjs/mpt": "^10.0.0-rc.1", "@ethereumjs/tx": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@ethereumjs/testdata": "1.0.0", diff --git a/packages/block/src/block/constructors.ts b/packages/block/src/block/constructors.ts index 8f876eb2f51..65b23ad8007 100644 --- a/packages/block/src/block/constructors.ts +++ b/packages/block/src/block/constructors.ts @@ -31,7 +31,7 @@ import { executionPayloadFromBeaconPayload, } from '../index.ts' -import type { EthersProvider, PrefixedHexString, WithdrawalBytes } from '@ethereumjs/util' +import type { EthersProvider, WithdrawalBytes } from '@ethereumjs/util' import type { BeaconPayloadJSON } from '../from-beacon-payload.ts' import type { BlockBytes, @@ -339,7 +339,7 @@ export async function createBlockFromExecutionPayload( const txs = [] for (const [index, serializedTx] of transactions.entries()) { try { - const tx = createTxFromRLP(hexToBytes(serializedTx as PrefixedHexString), { + const tx = createTxFromRLP(hexToBytes(serializedTx), { common: opts?.common, }) txs.push(tx) @@ -377,7 +377,7 @@ export async function createBlockFromExecutionPayload( throw Error('Missing executionWitness for EIP-6800 activated executionPayload') } // Verify blockHash matches payload - if (!equalsBytes(block.hash(), hexToBytes(payload.blockHash as PrefixedHexString))) { + if (!equalsBytes(block.hash(), hexToBytes(payload.blockHash))) { const validationError = `Invalid blockHash, expected: ${ payload.blockHash }, received: ${bytesToHex(block.hash())}` diff --git a/packages/block/test/block.spec.ts b/packages/block/test/block.spec.ts index 89e25f2d3ec..c005ea44d22 100644 --- a/packages/block/test/block.spec.ts +++ b/packages/block/test/block.spec.ts @@ -2,12 +2,12 @@ import { Common, Hardfork, Mainnet, createCustomCommon } from '@ethereumjs/commo import { RLP } from '@ethereumjs/rlp' import { goerliChainConfig, - preLondonTestDataBlocks1, - preLondonTestDataBlocks2, + preLondonTestDataBlocks1RLP, + preLondonTestDataBlocks2RLP, testnetMergeChainConfig, } from '@ethereumjs/testdata' import { createLegacyTx } from '@ethereumjs/tx' -import { KECCAK256_RLP_ARRAY, bytesToHex, equalsBytes, hexToBytes, toBytes } from '@ethereumjs/util' +import { KECCAK256_RLP_ARRAY, bytesToHex, equalsBytes, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' import { genTransactionsTrieRoot } from '../src/helpers.ts' @@ -25,7 +25,7 @@ import { import { genesisHashesTestData } from './testdata/genesisHashesTest.ts' import { testdataFromRPCGoerliData } from './testdata/testdata-from-rpc-goerli.ts' -import type { NestedUint8Array, PrefixedHexString } from '@ethereumjs/util' +import type { NestedUint8Array } from '@ethereumjs/util' describe('[Block]: block functions', () => { it('should test block initialization', () => { @@ -137,7 +137,7 @@ describe('[Block]: block functions', () => { it('should test block validation on pow chain', async () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.Istanbul }) - const blockRlp = hexToBytes(preLondonTestDataBlocks1.blocks[0].rlp as PrefixedHexString) + const blockRlp = hexToBytes(preLondonTestDataBlocks1RLP.blockRLP) try { createBlockFromRLP(blockRlp, { common }) assert.isTrue(true, 'should pass') @@ -163,7 +163,7 @@ describe('[Block]: block functions', () => { } it('should test transaction validation - invalid tx trie', async () => { - const blockRlp = hexToBytes(preLondonTestDataBlocks1.blocks[0].rlp as PrefixedHexString) + const blockRlp = hexToBytes(preLondonTestDataBlocks1RLP.blockRLP) const common = new Common({ chain: Mainnet, hardfork: Hardfork.London }) const block = createBlockFromRLP(blockRlp, { common, freeze: false }) await testTransactionValidation(block) @@ -205,7 +205,7 @@ describe('[Block]: block functions', () => { it('should test transaction validation with legacy tx in london', async () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.London }) - const blockRlp = hexToBytes(preLondonTestDataBlocks1.blocks[0].rlp as PrefixedHexString) + const blockRlp = hexToBytes(preLondonTestDataBlocks1RLP.blockRLP) const block = createBlockFromRLP(blockRlp, { common, freeze: false }) await testTransactionValidation(block) // @ts-expect-error -- Assigning to read-only property @@ -219,7 +219,7 @@ describe('[Block]: block functions', () => { it('should test uncles hash validation', async () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.Istanbul }) - const blockRlp = hexToBytes(preLondonTestDataBlocks2.blocks[2].rlp as PrefixedHexString) + const blockRlp = hexToBytes(preLondonTestDataBlocks2RLP.block2RLP) const block = createBlockFromRLP(blockRlp, { common, freeze: false }) assert.equal(block.uncleHashIsValid(), true) // @ts-expect-error -- Assigning to read-only property @@ -356,31 +356,23 @@ describe('[Block]: block functions', () => { it('should return the same block data from raw()', () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.Istanbul }) - const block = createBlockFromRLP( - toBytes(preLondonTestDataBlocks2.blocks[2].rlp as PrefixedHexString), - { - common, - }, - ) + const block = createBlockFromRLP(hexToBytes(preLondonTestDataBlocks2RLP.block2RLP), { + common, + }) const createBlockFromRaw = createBlockFromBytesArray(block.raw(), { common }) assert.isTrue(equalsBytes(block.hash(), createBlockFromRaw.hash())) }) it('should test toJSON', () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.Istanbul }) - const block = createBlockFromRLP( - toBytes(preLondonTestDataBlocks2.blocks[2].rlp as PrefixedHexString), - { - common, - }, - ) + const block = createBlockFromRLP(hexToBytes(preLondonTestDataBlocks2RLP.block2RLP), { + common, + }) assert.equal(typeof block.toJSON(), 'object') }) it('DAO hardfork', () => { - const blockData = RLP.decode( - preLondonTestDataBlocks2.blocks[0].rlp as PrefixedHexString, - ) as NestedUint8Array + const blockData = RLP.decode(preLondonTestDataBlocks2RLP.block0RLP) as NestedUint8Array // Set block number from test block to mainnet DAO fork block 1920000 blockData[0][8] = hexToBytes('0x1D4C00') diff --git a/packages/block/test/clrequests.spec.ts b/packages/block/test/clrequests.spec.ts new file mode 100644 index 00000000000..d3ee90ec1c0 --- /dev/null +++ b/packages/block/test/clrequests.spec.ts @@ -0,0 +1,133 @@ +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { CLRequestType, createCLRequest, equalsBytes, hexToBytes } from '@ethereumjs/util' +import { sha256 } from 'ethereum-cryptography/sha256.js' +import { assert, describe, it } from 'vitest' + +import { createBlock, genRequestsRoot } from '../src/index.ts' + +import type { CLRequest } from '@ethereumjs/util' + +describe('[Block]: CLRequests tests', () => { + // Common with EIP-7685 enabled (CLRequests) + const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7685] }) + + function createDepositRequest(): CLRequest { + // Example deposit data + const sampleDepositRequest = hexToBytes( + '0x00ac842878bb70009552a4cfcad801d6e659c50bd50d7d03306790cb455ce7363c5b6972f0159d170f625a99b2064dbefc010000000000000000000000818ccb1c4eda80270b04d6df822b1e72dd83c3030040597307000000a747f75c72d0cf0d2b52504c7385b516f0523e2f0842416399f42b4aee5c6384a5674f6426b1cc3d0827886fa9b909e616f5c9f61f986013ed2b9bf37071cbae951136265b549f44e3c8e26233c0433e9124b7fd0dc86e82f9fedfc0a179d7690000000000000000', + ) + return createCLRequest(sampleDepositRequest) + } + + function createWithdrawalRequest(): CLRequest { + // Type 1 (Withdrawal) + example data + const withdrawalData = hexToBytes( + '0x01000000000000000000000000000000000000000001000000000000000000000de0b6b3a7640000', + ) + return createCLRequest(withdrawalData) + } + + function createConsolidationRequest(): CLRequest { + // Type 2 (Consolidation) + example data + const consolidationData = hexToBytes('0x020000000100000000000000000000000000000000000001') + return createCLRequest(consolidationData) + } + + it('should create a block with deposit request', () => { + const depositRequest = createDepositRequest() + assert.equal(depositRequest.type, CLRequestType.Deposit, 'should be a deposit request') + + const requestsHash = genRequestsRoot([depositRequest], sha256) + const block = createBlock( + { + header: { requestsHash }, + }, + { common }, + ) + + assert.isDefined(block.header.requestsHash, 'block should have requestsHash') + assert.isTrue( + equalsBytes(block.header.requestsHash!, requestsHash), + 'requestsHash should match the expected value', + ) + }) + + it('should create a block with withdrawal request', () => { + const withdrawalRequest = createWithdrawalRequest() + assert.equal(withdrawalRequest.type, CLRequestType.Withdrawal, 'should be a withdrawal request') + + const requestsHash = genRequestsRoot([withdrawalRequest], sha256) + const block = createBlock( + { + header: { requestsHash }, + }, + { common }, + ) + + assert.isDefined(block.header.requestsHash, 'block should have requestsHash') + assert.isTrue( + equalsBytes(block.header.requestsHash!, requestsHash), + 'requestsHash should match the expected value', + ) + }) + + it('should create a block with consolidation request', () => { + const consolidationRequest = createConsolidationRequest() + assert.equal( + consolidationRequest.type, + CLRequestType.Consolidation, + 'should be a consolidation request', + ) + + const requestsHash = genRequestsRoot([consolidationRequest], sha256) + const block = createBlock( + { + header: { requestsHash }, + }, + { common }, + ) + + assert.isDefined(block.header.requestsHash, 'block should have requestsHash') + assert.isTrue( + equalsBytes(block.header.requestsHash!, requestsHash), + 'requestsHash should match the expected value', + ) + }) + + it('should create a block with multiple CLRequests', () => { + const depositRequest = createDepositRequest() + const withdrawalRequest = createWithdrawalRequest() + const consolidationRequest = createConsolidationRequest() + + // Requests should be sorted by type + const requests = [depositRequest, withdrawalRequest, consolidationRequest] + const requestsHash = genRequestsRoot(requests, sha256) + + const block = createBlock( + { + header: { requestsHash }, + }, + { common }, + ) + + assert.isDefined(block.header.requestsHash, 'block should have requestsHash') + assert.isTrue( + equalsBytes(block.header.requestsHash!, requestsHash), + 'requestsHash should match the expected value', + ) + }) + + it('should validate the requests are sorted by type', () => { + const depositRequest = createDepositRequest() + const withdrawalRequest = createWithdrawalRequest() + + // Requests in wrong order should throw + const requests = [withdrawalRequest, depositRequest] + + assert.throws( + () => genRequestsRoot(requests, sha256), + 'requests are not sorted in ascending order', + 'should throw when requests are not sorted by type', + ) + }) +}) diff --git a/packages/block/test/header.spec.ts b/packages/block/test/header.spec.ts index 5c71e7c2d0a..8b4882c6fbc 100644 --- a/packages/block/test/header.spec.ts +++ b/packages/block/test/header.spec.ts @@ -320,7 +320,7 @@ describe('[Block]: Header functions', () => { const common = new Common({ chain: goerliChainConfig, hardfork: Hardfork.Istanbul }) const blockchain = new Mockchain() - const genesisRlp = toBytes(testDataPreLondon.genesisRLP) + const genesisRlp = hexToBytes(testDataPreLondon.genesisRLP) const block = createBlockFromRLP(genesisRlp, { common }) await blockchain.putBlock(block) diff --git a/packages/block/typedoc.cjs b/packages/block/typedoc.mjs similarity index 60% rename from packages/block/typedoc.cjs rename to packages/block/typedoc.mjs index e909b4e0c15..d610ce65ef5 100644 --- a/packages/block/typedoc.cjs +++ b/packages/block/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts', 'src/helpers.ts'], diff --git a/packages/blockchain/README.md b/packages/blockchain/README.md index 6e77fed5385..7fcfc98aa3a 100644 --- a/packages/blockchain/README.md +++ b/packages/blockchain/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/blockchain +# @ethereumjs/blockchain `v10` [![NPM Package][blockchain-npm-badge]][blockchain-npm-link] [![GitHub Issues][blockchain-issues-badge]][blockchain-issues-link] @@ -9,6 +9,18 @@ | A module to store and interact with blocks. | | ------------------------------------------- | +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [EIP Integrations](#eip-integrations) +- [Consensus Types](#consensus-types) +- [Browser](#browser) +- [API](#api) +- [Testing](#testing) +- [EthereumJS](#ethereumjs) +- [License](#license) + ## Installation To obtain the latest version, simply install the project using `npm`: @@ -19,7 +31,7 @@ npm install @ethereumjs/blockchain **Note:** If you want to work with `EIP-4844` related functionality, you will have additional initialization steps for the **KZG setup**, see related section below. -## Usage +## Getting Started ### Introduction @@ -29,7 +41,7 @@ New blocks can be added to the blockchain. Validation ensures that the block for The library also supports reorg scenarios e.g. by allowing to add a new block with `Blockchain.putBlock()` which follows a different canonical path to the head than given by the current canonical head block. -## Example +## Examples The following is an example to instantiate a simple Blockchain object, put blocks into the blockchain and then iterate through the blocks added: @@ -88,6 +100,10 @@ const main = async () => { void main() ``` +More examples can be found in the [examples](./examples/) folder. + +## Setup + ### Block Storage For storing blocks different backends can be used. The database needs to conform to the [DB](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts) interface provided in the `@ethereumjs/util` package (since this is used in other places as well). diff --git a/packages/blockchain/docs/README.md b/packages/blockchain/docs/README.md index e6da05e12c5..195b5c84cfc 100644 --- a/packages/blockchain/docs/README.md +++ b/packages/blockchain/docs/README.md @@ -1,17 +1,17 @@ -@ethereumjs/blockchain +**@ethereumjs/blockchain** -# @ethereumjs/blockchain +*** -## Table of contents +# @ethereumjs/blockchain -### Classes +## Classes - [Blockchain](classes/Blockchain.md) - [CasperConsensus](classes/CasperConsensus.md) - [CliqueConsensus](classes/CliqueConsensus.md) - [EthashConsensus](classes/EthashConsensus.md) -### Interfaces +## Interfaces - [BlockchainInterface](interfaces/BlockchainInterface.md) - [BlockchainOptions](interfaces/BlockchainOptions.md) @@ -19,48 +19,15 @@ - [ConsensusOptions](interfaces/ConsensusOptions.md) - [GenesisOptions](interfaces/GenesisOptions.md) -### Type Aliases - -- [BlockchainEvents](README.md#blockchainevents) -- [OnBlock](README.md#onblock) - ## Type Aliases -### BlockchainEvents - -Ƭ **BlockchainEvents**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `deletedCanonicalBlocks` | (`data`: `Block`[], `resolve?`: (`result?`: `any`) => `void`) => `void` | - -#### Defined in - -[types.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L8) - -___ - -### OnBlock - -Ƭ **OnBlock**: (`block`: `Block`, `reorg`: `boolean`) => `Promise`<`void`\> \| `void` - -#### Type declaration - -▸ (`block`, `reorg`): `Promise`<`void`\> \| `void` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `block` | `Block` | -| `reorg` | `boolean` | - -##### Returns - -`Promise`<`void`\> \| `void` +- [BlockchainEvent](type-aliases/BlockchainEvent.md) +- [ConsensusDict](type-aliases/ConsensusDict.md) +- [OnBlock](type-aliases/OnBlock.md) -#### Defined in +## Functions -[types.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L6) +- [createBlockchain](functions/createBlockchain.md) +- [createBlockchainFromBlocksData](functions/createBlockchainFromBlocksData.md) +- [genGenesisStateRoot](functions/genGenesisStateRoot.md) +- [getGenesisStateRoot](functions/getGenesisStateRoot.md) diff --git a/packages/blockchain/docs/classes/Blockchain.md b/packages/blockchain/docs/classes/Blockchain.md index e82b9b71017..2becb910185 100644 --- a/packages/blockchain/docs/classes/Blockchain.md +++ b/packages/blockchain/docs/classes/Blockchain.md @@ -1,181 +1,181 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + [@ethereumjs/blockchain](../README.md) / Blockchain # Class: Blockchain -This class stores and interacts with blocks. +Defined in: [blockchain.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L55) + +Blockchain implementation to create and maintain a valid canonical chain +of block headers or blocks with support for reorgs and the ability to provide +custom DB backends. + +By default consensus validation is not provided since with the switch to +Proof-of-Stake consensus is validated by the Ethereum consensus layer. +If consensus validation is desired for Ethash or Clique blockchains the +optional `consensusDict` option can be used to pass in validation objects. ## Implements - [`BlockchainInterface`](../interfaces/BlockchainInterface.md) -## Table of contents - -### Properties - -- [common](Blockchain.md#common) -- [consensus](Blockchain.md#consensus) -- [db](Blockchain.md#db) -- [dbManager](Blockchain.md#dbmanager) -- [events](Blockchain.md#events) - -### Accessors - -- [genesisBlock](Blockchain.md#genesisblock) - -### Methods - -- [checkAndTransitionHardForkByNumber](Blockchain.md#checkandtransitionhardforkbynumber) -- [createGenesisBlock](Blockchain.md#creategenesisblock) -- [delBlock](Blockchain.md#delblock) -- [getBlock](Blockchain.md#getblock) -- [getBlocks](Blockchain.md#getblocks) -- [getCanonicalHeadBlock](Blockchain.md#getcanonicalheadblock) -- [getCanonicalHeadHeader](Blockchain.md#getcanonicalheadheader) -- [getCanonicalHeader](Blockchain.md#getcanonicalheader) -- [getIteratorHead](Blockchain.md#getiteratorhead) -- [getIteratorHeadSafe](Blockchain.md#getiteratorheadsafe) -- [getParentTD](Blockchain.md#getparenttd) -- [getTotalDifficulty](Blockchain.md#gettotaldifficulty) -- [iterator](Blockchain.md#iterator) -- [putBlock](Blockchain.md#putblock) -- [putBlocks](Blockchain.md#putblocks) -- [putHeader](Blockchain.md#putheader) -- [putHeaders](Blockchain.md#putheaders) -- [resetCanonicalHead](Blockchain.md#resetcanonicalhead) -- [safeNumberToHash](Blockchain.md#safenumbertohash) -- [selectNeededHashes](Blockchain.md#selectneededhashes) -- [setIteratorHead](Blockchain.md#setiteratorhead) -- [shallowCopy](Blockchain.md#shallowcopy) -- [validateBlock](Blockchain.md#validateblock) -- [validateHeader](Blockchain.md#validateheader) -- [create](Blockchain.md#create) -- [fromBlocksData](Blockchain.md#fromblocksdata) +## Constructors -## Properties +### Constructor -### common +> **new Blockchain**(`opts`): `Blockchain` -• `Readonly` **common**: `Common` +Defined in: [blockchain.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L109) -#### Defined in +Creates new Blockchain object. -[blockchain.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L110) +#### Parameters -___ +##### opts -### consensus +[`BlockchainOptions`](../interfaces/BlockchainOptions.md) = `{}` -• **consensus**: [`Consensus`](../interfaces/Consensus.md) +An object with the options that this constructor takes. See +[BlockchainOptions](../interfaces/BlockchainOptions.md). -#### Implementation of +#### Returns -[BlockchainInterface](../interfaces/BlockchainInterface.md).[consensus](../interfaces/BlockchainInterface.md#consensus) +`Blockchain` -#### Defined in +#### Deprecated -[blockchain.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L82) +The direct usage of this constructor is discouraged since +non-finalized async initialization might lead to side effects. Please +use the async [createBlockchain](../functions/createBlockchain.md) constructor instead (same API). -___ +## Properties -### db +### common -• **db**: `DB`<`string` \| `Uint8Array`, `string` \| `Uint8Array` \| `DBObject`\> +> `readonly` **common**: `Common` -#### Defined in +Defined in: [blockchain.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L83) -[blockchain.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L83) +*** -___ +### db -### dbManager +> **db**: `DB`\<`string` \| `Uint8Array`\<`ArrayBufferLike`\>, `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| `DBObject`\> -• **dbManager**: `DBManager` +Defined in: [blockchain.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L56) -#### Defined in +*** -[blockchain.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L84) +### dbManager + +> **dbManager**: `DBManager` -___ +Defined in: [blockchain.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L57) + +*** ### events -• **events**: `AsyncEventEmitter`<[`BlockchainEvents`](../README.md#blockchainevents)\> +> **events**: `EventEmitter`\<[`BlockchainEvent`](../type-aliases/BlockchainEvent.md)\> + +Defined in: [blockchain.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L58) Optional events emitter #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[events](../interfaces/BlockchainInterface.md#events) +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`events`](../interfaces/BlockchainInterface.md#events) -#### Defined in +## Accessors -[blockchain.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L85) +### consensus -## Accessors +#### Get Signature + +> **get** **consensus**(): `undefined` \| [`Consensus`](../interfaces/Consensus.md) + +Defined in: [blockchain.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L165) + +Returns an eventual consensus object matching the current consensus algorithm from Common +or undefined if non available + +##### Returns + +`undefined` \| [`Consensus`](../interfaces/Consensus.md) + +#### Implementation of + +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`consensus`](../interfaces/BlockchainInterface.md#consensus) + +*** ### genesisBlock -• `get` **genesisBlock**(): `Block` +#### Get Signature -The genesis Block for the blockchain. +> **get** **genesisBlock**(): `Block` -#### Returns +Defined in: [blockchain.ts:1304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1304) -`Block` +The genesis Block for the blockchain. -#### Defined in +##### Returns -[blockchain.ts:1404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1404) +`Block` ## Methods -### checkAndTransitionHardForkByNumber +### checkAndTransitionHardForkByNumber() + +> **checkAndTransitionHardForkByNumber**(`number`, `timestamp?`): `Promise`\<`void`\> -▸ **checkAndTransitionHardForkByNumber**(`number`, `td?`, `timestamp?`): `Promise`<`void`\> +Defined in: [blockchain.ts:1265](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1265) #### Parameters -| Name | Type | -| :------ | :------ | -| `number` | `BigIntLike` | -| `td?` | `BigIntLike` | -| `timestamp?` | `BigIntLike` | +##### number -#### Returns +`BigIntLike` + +##### timestamp? -`Promise`<`void`\> +`BigIntLike` -#### Defined in +#### Returns -[blockchain.ts:1341](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1341) +`Promise`\<`void`\> -___ +*** -### createGenesisBlock +### createGenesisBlock() -▸ **createGenesisBlock**(`stateRoot`): `Block` +> **createGenesisBlock**(`stateRoot`): `Block` + +Defined in: [blockchain.ts:1314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1314) Creates a genesis Block for the blockchain with params from Common.genesis #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `stateRoot` | `Uint8Array` | The genesis stateRoot | +##### stateRoot + +`Uint8Array` + +The genesis stateRoot #### Returns `Block` -#### Defined in - -[blockchain.ts:1413](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1413) +*** -___ +### delBlock() -### delBlock +> **delBlock**(`blockHash`): `Promise`\<`void`\> -▸ **delBlock**(`blockHash`): `Promise`<`void`\> +Defined in: [blockchain.ts:832](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L832) Completely deletes a block from the blockchain including any references to this block. If this block was in the canonical chain, then also each child @@ -188,273 +188,300 @@ we can be sure it is correct). #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `blockHash` | `Uint8Array` | The hash of the block to be deleted | +##### blockHash + +`Uint8Array` + +The hash of the block to be deleted #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[delBlock](../interfaces/BlockchainInterface.md#delblock) - -#### Defined in +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`delBlock`](../interfaces/BlockchainInterface.md#delblock) -[blockchain.ts:923](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L923) +*** -___ +### getBlock() -### getBlock +> **getBlock**(`blockId`): `Promise`\<`Block`\> -▸ **getBlock**(`blockId`): `Promise`<`Block`\> +Defined in: [blockchain.ts:700](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L700) Gets a block by its hash or number. If a number is provided, the returned block will be the canonical block at that number in the chain #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `blockId` | `number` \| `bigint` \| `Uint8Array` | The block's hash or number. If a hash is provided, then this will be immediately looked up, otherwise it will wait until we have unlocked the DB | +##### blockId + +The block's hash or number. If a hash is provided, then +this will be immediately looked up, otherwise it will wait until we have +unlocked the DB + +`number` | `bigint` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns -`Promise`<`Block`\> +`Promise`\<`Block`\> #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[getBlock](../interfaces/BlockchainInterface.md#getblock) - -#### Defined in +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`getBlock`](../interfaces/BlockchainInterface.md#getblock) -[blockchain.ts:791](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L791) +*** -___ +### getBlocks() -### getBlocks +> **getBlocks**(`blockId`, `maxBlocks`, `skip`, `reverse`): `Promise`\<`Block`[]\> -▸ **getBlocks**(`blockId`, `maxBlocks`, `skip`, `reverse`): `Promise`<`Block`[]\> +Defined in: [blockchain.ts:749](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L749) Looks up many blocks relative to blockId Note: due to `GetBlockHeaders (0x03)` (ETH wire protocol) we have to support skip/reverse as well. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `blockId` | `number` \| `bigint` \| `Uint8Array` | The block's hash or number | -| `maxBlocks` | `number` | Max number of blocks to return | -| `skip` | `number` | Number of blocks to skip apart | -| `reverse` | `boolean` | Fetch blocks in reverse | +##### blockId -#### Returns +The block's hash or number -`Promise`<`Block`[]\> +`number` | `bigint` | `Uint8Array`\<`ArrayBufferLike`\> -#### Defined in +##### maxBlocks -[blockchain.ts:840](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L840) +`number` -___ +Max number of blocks to return -### getCanonicalHeadBlock +##### skip -▸ **getCanonicalHeadBlock**(): `Promise`<`Block`\> +`number` -Returns the latest full block in the canonical chain. +Number of blocks to skip apart -#### Returns +##### reverse -`Promise`<`Block`\> +`boolean` -#### Implementation of +Fetch blocks in reverse -[BlockchainInterface](../interfaces/BlockchainInterface.md).[getCanonicalHeadBlock](../interfaces/BlockchainInterface.md#getcanonicalheadblock) +#### Returns -#### Defined in +`Promise`\<`Block`[]\> -[blockchain.ts:386](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L386) +*** -___ +### getCanonicalHeadBlock() -### getCanonicalHeadHeader +> **getCanonicalHeadBlock**(): `Promise`\<`Block`\> -▸ **getCanonicalHeadHeader**(): `Promise`<`BlockHeader`\> +Defined in: [blockchain.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L257) -Returns the latest header in the canonical chain. +Returns the latest full block in the canonical chain. #### Returns -`Promise`<`BlockHeader`\> +`Promise`\<`Block`\> + +#### Implementation of -#### Defined in +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`getCanonicalHeadBlock`](../interfaces/BlockchainInterface.md#getcanonicalheadblock) -[blockchain.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L375) +*** -___ +### getCanonicalHeader() -### getCanonicalHeader +> **getCanonicalHeader**(`number`): `Promise`\<`BlockHeader`\> -▸ **getCanonicalHeader**(`number`): `Promise`<`BlockHeader`\> +Defined in: [blockchain.ts:1282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1282) Gets a header by number. Header must be in the canonical chain #### Parameters -| Name | Type | -| :------ | :------ | -| `number` | `bigint` | +##### number + +`bigint` #### Returns -`Promise`<`BlockHeader`\> +`Promise`\<`BlockHeader`\> + +*** + +### getCanonicalHeadHeader() + +> **getCanonicalHeadHeader**(): `Promise`\<`BlockHeader`\> + +Defined in: [blockchain.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L246) + +Returns the latest header in the canonical chain. + +#### Returns -#### Defined in +`Promise`\<`BlockHeader`\> -[blockchain.ts:1382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1382) +*** -___ +### getIteratorHead() -### getIteratorHead +> **getIteratorHead**(`name`): `Promise`\<`Block`\> -▸ **getIteratorHead**(`name?`): `Promise`<`Block`\> +Defined in: [blockchain.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L216) Returns the specified iterator head. This function replaces the old Blockchain.getHead() method. Note that the function deviates from the old behavior and returns the genesis hash instead of the current head block if an iterator -has not been run. This matches the behavior of [iterator](Blockchain.md#iterator). +has not been run. This matches the behavior of [Blockchain.iterator](#iterator). #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `name` | `string` | `'vm'` | Optional name of the iterator head (default: 'vm') | +##### name + +`string` = `'vm'` + +Optional name of the iterator head (default: 'vm') #### Returns -`Promise`<`Block`\> +`Promise`\<`Block`\> #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[getIteratorHead](../interfaces/BlockchainInterface.md#getiteratorhead) +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`getIteratorHead`](../interfaces/BlockchainInterface.md#getiteratorhead) -#### Defined in +*** -[blockchain.ts:345](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L345) +### getIteratorHeadSafe() -___ +> **getIteratorHeadSafe**(`name`): `Promise`\<`undefined` \| `Block`\> -### getIteratorHeadSafe - -▸ **getIteratorHeadSafe**(`name?`): `Promise`<`undefined` \| `Block`\> +Defined in: [blockchain.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L227) This method differs from `getIteratorHead`. If the head is not found, it returns `undefined`. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `name` | `string` | `'vm'` | Optional name of the iterator head (default: 'vm') | +##### name -#### Returns +`string` = `'vm'` -`Promise`<`undefined` \| `Block`\> +Optional name of the iterator head (default: 'vm') + +#### Returns -#### Defined in +`Promise`\<`undefined` \| `Block`\> -[blockchain.ts:356](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L356) +*** -___ +### getParentTD() -### getParentTD +> **getParentTD**(`header`): `Promise`\<`bigint`\> -▸ **getParentTD**(`header`): `Promise`<`bigint`\> +Defined in: [blockchain.ts:735](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L735) Gets total difficulty for a header's parent, helpful for determining terminal block #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `header` | `BlockHeader` | Block header whose parent td is desired | +##### header -#### Returns +`BlockHeader` + +Block header whose parent td is desired -`Promise`<`bigint`\> +#### Returns -#### Defined in +`Promise`\<`bigint`\> -[blockchain.ts:826](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L826) +*** -___ +### getTotalDifficulty() -### getTotalDifficulty +> **getTotalDifficulty**(`hash`, `number?`): `Promise`\<`bigint`\> -▸ **getTotalDifficulty**(`hash`, `number?`): `Promise`<`bigint`\> +Defined in: [blockchain.ts:721](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L721) Gets total difficulty for a block specified by hash and number #### Parameters -| Name | Type | -| :------ | :------ | -| `hash` | `Uint8Array` | -| `number?` | `bigint` | +##### hash + +`Uint8Array` + +##### number? + +`bigint` #### Returns -`Promise`<`bigint`\> +`Promise`\<`bigint`\> #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[getTotalDifficulty](../interfaces/BlockchainInterface.md#gettotaldifficulty) - -#### Defined in +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`getTotalDifficulty`](../interfaces/BlockchainInterface.md#gettotaldifficulty) -[blockchain.ts:812](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L812) +*** -___ +### iterator() -### iterator +> **iterator**(`name`, `onBlock`, `maxBlocks?`, `releaseLockOnCallback?`): `Promise`\<`number`\> -▸ **iterator**(`name`, `onBlock`, `maxBlocks?`, `releaseLockOnCallback?`): `Promise`<`number`\> +Defined in: [blockchain.ts:943](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L943) Iterates through blocks starting at the specified iterator head and calls the onBlock function on each block. The current location of an iterator -head can be retrieved using [getIteratorHead](Blockchain.md#getiteratorhead). +head can be retrieved using [Blockchain.getIteratorHead](#getiteratorhead). #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `name` | `string` | Name of the state root head | -| `onBlock` | [`OnBlock`](../README.md#onblock) | Function called on each block with params (block, reorg) | -| `maxBlocks?` | `number` | How many blocks to run. By default, run all unprocessed blocks in the canonical chain. | -| `releaseLockOnCallback?` | `boolean` | Do not lock the blockchain for running the callback (default: `false`) | +##### name + +`string` + +Name of the state root head + +##### onBlock + +[`OnBlock`](../type-aliases/OnBlock.md) + +Function called on each block with params (block, reorg) + +##### maxBlocks? + +`number` + +How many blocks to run. By default, run all unprocessed blocks in the canonical chain. + +##### releaseLockOnCallback? + +`boolean` + +Do not lock the blockchain for running the callback (default: `false`) #### Returns -`Promise`<`number`\> +`Promise`\<`number`\> number of blocks actually iterated #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[iterator](../interfaces/BlockchainInterface.md#iterator) - -#### Defined in +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`iterator`](../interfaces/BlockchainInterface.md#iterator) -[blockchain.ts:1029](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1029) +*** -___ +### putBlock() -### putBlock +> **putBlock**(`block`): `Promise`\<`void`\> -▸ **putBlock**(`block`): `Promise`<`void`\> +Defined in: [blockchain.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L289) Adds a block to the blockchain. @@ -464,27 +491,27 @@ heads/hashes are overwritten. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `block` | `Block` | The block to be added to the blockchain | +##### block + +`Block` + +The block to be added to the blockchain #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[putBlock](../interfaces/BlockchainInterface.md#putblock) +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`putBlock`](../interfaces/BlockchainInterface.md#putblock) -#### Defined in +*** -[blockchain.ts:416](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L416) +### putBlocks() -___ +> **putBlocks**(`blocks`): `Promise`\<`void`\> -### putBlocks - -▸ **putBlocks**(`blocks`): `Promise`<`void`\> +Defined in: [blockchain.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L273) Adds blocks to the blockchain. @@ -495,23 +522,23 @@ chain is rebuilt and any stale heads/hashes are overwritten. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `blocks` | `Block`[] | The blocks to be added to the blockchain | +##### blocks -#### Returns +`Block`[] -`Promise`<`void`\> +The blocks to be added to the blockchain -#### Defined in +#### Returns + +`Promise`\<`void`\> -[blockchain.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L402) +*** -___ +### putHeader() -### putHeader +> **putHeader**(`header`): `Promise`\<`void`\> -▸ **putHeader**(`header`): `Promise`<`void`\> +Defined in: [blockchain.ts:318](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L318) Adds a header to the blockchain. @@ -521,23 +548,23 @@ heads/hashes are overwritten. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `header` | `BlockHeader` | The header to be added to the blockchain | +##### header -#### Returns +`BlockHeader` + +The header to be added to the blockchain -`Promise`<`void`\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[blockchain.ts:443](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L443) +*** -___ +### putHeaders() -### putHeaders +> **putHeaders**(`headers`): `Promise`\<`void`\> -▸ **putHeaders**(`headers`): `Promise`<`void`\> +Defined in: [blockchain.ts:302](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L302) Adds many headers to the blockchain. @@ -548,23 +575,23 @@ chain is rebuilt and any stale heads/hashes are overwritten. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `headers` | `any`[] | The headers to be added to the blockchain | +##### headers -#### Returns +`any`[] -`Promise`<`void`\> +The headers to be added to the blockchain -#### Defined in +#### Returns -[blockchain.ts:429](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L429) +`Promise`\<`void`\> -___ +*** -### resetCanonicalHead +### resetCanonicalHead() -▸ **resetCanonicalHead**(`canonicalHead`): `Promise`<`void`\> +> **resetCanonicalHead**(`canonicalHead`): `Promise`\<`void`\> + +Defined in: [blockchain.ts:330](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L330) Resets the canonical chain to canonicalHead number @@ -573,23 +600,23 @@ canonicalHead and cleans up canonical references greater than canonicalHead #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `canonicalHead` | `bigint` | The number to which chain should be reset to | +##### canonicalHead -#### Returns +`bigint` -`Promise`<`void`\> +The number to which chain should be reset to -#### Defined in +#### Returns + +`Promise`\<`void`\> -[blockchain.ts:455](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L455) +*** -___ +### safeNumberToHash() -### safeNumberToHash +> **safeNumberToHash**(`number`): `Promise`\<`false` \| `Uint8Array`\<`ArrayBufferLike`\>\> -▸ **safeNumberToHash**(`number`): `Promise`<``false`` \| `Uint8Array`\> +Defined in: [blockchain.ts:1296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1296) This method either returns a Uint8Array if there exists one in the DB or if it does not exist then return false If DB throws @@ -597,23 +624,21 @@ any other error, this function throws. #### Parameters -| Name | Type | -| :------ | :------ | -| `number` | `bigint` | +##### number -#### Returns +`bigint` -`Promise`<``false`` \| `Uint8Array`\> +#### Returns -#### Defined in +`Promise`\<`false` \| `Uint8Array`\<`ArrayBufferLike`\>\> -[blockchain.ts:1396](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1396) +*** -___ +### selectNeededHashes() -### selectNeededHashes +> **selectNeededHashes**(`hashes`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>[]\> -▸ **selectNeededHashes**(`hashes`): `Promise`<`Uint8Array`[]\> +Defined in: [blockchain.ts:791](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L791) Given an ordered array, returns an array of hashes that are not in the blockchain yet. Uses binary search to find out what hashes are missing. @@ -621,102 +646,105 @@ Therefore, the array needs to be ordered upon number. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `hashes` | `Uint8Array`[] | Ordered array of hashes (ordered on `number`). | +##### hashes -#### Returns +`Uint8Array`\<`ArrayBufferLike`\>[] + +Ordered array of hashes (ordered on `number`). -`Promise`<`Uint8Array`[]\> +#### Returns -#### Defined in +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>[]\> -[blockchain.ts:882](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L882) +*** -___ +### setIteratorHead() -### setIteratorHead +> **setIteratorHead**(`tag`, `headHash`): `Promise`\<`void`\> -▸ **setIteratorHead**(`tag`, `headHash`): `Promise`<`void`\> +Defined in: [blockchain.ts:1026](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1026) Set header hash of a certain `tag`. When calling the iterator, the iterator will start running the first child block after the header hash currently stored. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `tag` | `string` | The tag to save the headHash to | -| `headHash` | `Uint8Array` | The head hash to save | +##### tag + +`string` + +The tag to save the headHash to + +##### headHash + +`Uint8Array` + +The head hash to save #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[setIteratorHead](../interfaces/BlockchainInterface.md#setiteratorhead) +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`setIteratorHead`](../interfaces/BlockchainInterface.md#setiteratorhead) -#### Defined in +*** -[blockchain.ts:1112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L1112) +### shallowCopy() -___ +> **shallowCopy**(): `Blockchain` -### shallowCopy +Defined in: [blockchain.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L180) -▸ **shallowCopy**(): [`Blockchain`](Blockchain.md) - -Returns a deep copy of this [Blockchain](Blockchain.md) instance. +Returns a deep copy of this Blockchain instance. Note: this does not make a copy of the underlying db since it is unknown if the source is on disk or in memory. This should not be a significant issue in most usage since the queries will only reflect the instance's known data. If you would like this copied blockchain to use another db -set the [db](Blockchain.md#db) of this returned instance to a copy of +set the [db](#db) of this returned instance to a copy of the original. #### Returns -[`Blockchain`](Blockchain.md) +`Blockchain` #### Implementation of -[BlockchainInterface](../interfaces/BlockchainInterface.md).[shallowCopy](../interfaces/BlockchainInterface.md#shallowcopy) - -#### Defined in +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`shallowCopy`](../interfaces/BlockchainInterface.md#shallowcopy) -[blockchain.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L309) +*** -___ +### validateBlock() -### validateBlock +> **validateBlock**(`block`): `Promise`\<`void`\> -▸ **validateBlock**(`block`): `Promise`<`void`\> +Defined in: [blockchain.ts:601](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L601) Validates a block, by validating the header against the current chain, any uncle headers, and then whether the block is internally consistent #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `block` | `Block` | block to be validated | +##### block -#### Returns +`Block` -`Promise`<`void`\> +block to be validated -#### Defined in +#### Returns -[blockchain.ts:694](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L694) +`Promise`\<`void`\> -___ +*** -### validateHeader +### validateHeader() -▸ **validateHeader**(`header`, `height?`): `Promise`<`void`\> +> **validateHeader**(`header`, `height?`): `Promise`\<`void`\> + +Defined in: [blockchain.ts:524](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L524) Validates a block header, throwing if invalid. It is being validated against the reported `parentHash`. It verifies the current block against the `parentHash`: @@ -733,66 +761,22 @@ It verifies the current block against the `parentHash`: #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `header` | `BlockHeader` | header to be validated | -| `height?` | `bigint` | If this is an uncle header, this is the height of the block that is including it | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of +##### header -[BlockchainInterface](../interfaces/BlockchainInterface.md).[validateHeader](../interfaces/BlockchainInterface.md#validateheader) +`BlockHeader` -#### Defined in +header to be validated -[blockchain.ts:627](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L627) +##### height? -___ +`bigint` -### create - -▸ `Static` **create**(`opts?`): `Promise`<[`Blockchain`](Blockchain.md)\> - -Safe creation of a new Blockchain object awaiting the initialization function, -encouraged method to use when creating a blockchain object. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts` | [`BlockchainOptions`](../interfaces/BlockchainOptions.md) | Constructor options, see [BlockchainOptions](../interfaces/BlockchainOptions.md) | - -#### Returns - -`Promise`<[`Blockchain`](Blockchain.md)\> - -#### Defined in - -[blockchain.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L129) - -___ - -### fromBlocksData - -▸ `Static` **fromBlocksData**(`blocksData`, `opts?`): `Promise`<[`Blockchain`](Blockchain.md)\> - -Creates a blockchain from a list of block objects, -objects must be readable by Block.fromBlockData - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `blocksData` | `BlockData`[] | - | -| `opts` | [`BlockchainOptions`](../interfaces/BlockchainOptions.md) | Constructor options, see [BlockchainOptions](../interfaces/BlockchainOptions.md) | +If this is an uncle header, this is the height of the block that is including it #### Returns -`Promise`<[`Blockchain`](Blockchain.md)\> +`Promise`\<`void`\> -#### Defined in +#### Implementation of -[blockchain.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/blockchain.ts#L211) +[`BlockchainInterface`](../interfaces/BlockchainInterface.md).[`validateHeader`](../interfaces/BlockchainInterface.md#validateheader) diff --git a/packages/blockchain/docs/classes/CasperConsensus.md b/packages/blockchain/docs/classes/CasperConsensus.md index 697b133a9a8..d50ff4fa3a5 100644 --- a/packages/blockchain/docs/classes/CasperConsensus.md +++ b/packages/blockchain/docs/classes/CasperConsensus.md @@ -1,155 +1,133 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + [@ethereumjs/blockchain](../README.md) / CasperConsensus # Class: CasperConsensus +Defined in: [consensus/casper.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L10) + This class encapsulates Casper-related consensus functionality when used with the Blockchain class. ## Implements - [`Consensus`](../interfaces/Consensus.md) -## Table of contents - -### Constructors - -- [constructor](CasperConsensus.md#constructor) - -### Properties - -- [algorithm](CasperConsensus.md#algorithm) - -### Methods - -- [genesisInit](CasperConsensus.md#genesisinit) -- [newBlock](CasperConsensus.md#newblock) -- [setup](CasperConsensus.md#setup) -- [validateConsensus](CasperConsensus.md#validateconsensus) -- [validateDifficulty](CasperConsensus.md#validatedifficulty) - ## Constructors -### constructor +### Constructor + +> **new CasperConsensus**(): `CasperConsensus` -• **new CasperConsensus**() +Defined in: [consensus/casper.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L13) -#### Defined in +#### Returns -[consensus/casper.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L13) +`CasperConsensus` ## Properties ### algorithm -• **algorithm**: `ConsensusAlgorithm` +> **algorithm**: `ConsensusAlgorithm` -#### Implementation of - -[Consensus](../interfaces/Consensus.md).[algorithm](../interfaces/Consensus.md#algorithm) +Defined in: [consensus/casper.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L11) -#### Defined in +#### Implementation of -[consensus/casper.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L11) +[`Consensus`](../interfaces/Consensus.md).[`algorithm`](../interfaces/Consensus.md#algorithm) ## Methods -### genesisInit +### genesisInit() -▸ **genesisInit**(): `Promise`<`void`\> +> **genesisInit**(): `Promise`\<`void`\> + +Defined in: [consensus/casper.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L17) Initialize genesis for consensus mechanism #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[genesisInit](../interfaces/Consensus.md#genesisinit) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`genesisInit`](../interfaces/Consensus.md#genesisinit) -[consensus/casper.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L17) +*** -___ +### newBlock() -### newBlock +> **newBlock**(): `Promise`\<`void`\> -▸ **newBlock**(): `Promise`<`void`\> +Defined in: [consensus/casper.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L32) Update consensus on new block #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[newBlock](../interfaces/Consensus.md#newblock) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`newBlock`](../interfaces/Consensus.md#newblock) -[consensus/casper.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L29) +*** -___ +### setup() -### setup +> **setup**(): `Promise`\<`void`\> -▸ **setup**(): `Promise`<`void`\> +Defined in: [consensus/casper.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L19) Set up consensus mechanism #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[setup](../interfaces/Consensus.md#setup) +[`Consensus`](../interfaces/Consensus.md).[`setup`](../interfaces/Consensus.md#setup) -#### Defined in +*** -[consensus/casper.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L19) +### validateConsensus() -___ +> **validateConsensus**(): `Promise`\<`void`\> -### validateConsensus - -▸ **validateConsensus**(): `Promise`<`void`\> +Defined in: [consensus/casper.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L21) Validate block consensus parameters #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[validateConsensus](../interfaces/Consensus.md#validateconsensus) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`validateConsensus`](../interfaces/Consensus.md#validateconsensus) -[consensus/casper.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L21) +*** -___ +### validateDifficulty() -### validateDifficulty +> **validateDifficulty**(`header`): `Promise`\<`void`\> -▸ **validateDifficulty**(`header`): `Promise`<`void`\> +Defined in: [consensus/casper.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L23) #### Parameters -| Name | Type | -| :------ | :------ | -| `header` | `BlockHeader` | +##### header + +`BlockHeader` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[validateDifficulty](../interfaces/Consensus.md#validatedifficulty) - -#### Defined in - -[consensus/casper.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/casper.ts#L23) +[`Consensus`](../interfaces/Consensus.md).[`validateDifficulty`](../interfaces/Consensus.md#validatedifficulty) diff --git a/packages/blockchain/docs/classes/CliqueConsensus.md b/packages/blockchain/docs/classes/CliqueConsensus.md index 3a53a4bbc7a..20eff480b6d 100644 --- a/packages/blockchain/docs/classes/CliqueConsensus.md +++ b/packages/blockchain/docs/classes/CliqueConsensus.md @@ -1,7 +1,13 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + [@ethereumjs/blockchain](../README.md) / CliqueConsensus # Class: CliqueConsensus +Defined in: [consensus/clique.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L68) + This class encapsulates Clique-related consensus functionality when used with the Blockchain class. Note: reorgs which happen between epoch transitions, which change the internal voting state over the reorg will result in failure and is currently not supported. @@ -12,45 +18,25 @@ Now replay all blocks on top of it. This should validate the chain up to the new - [`Consensus`](../interfaces/Consensus.md) -## Table of contents - -### Constructors - -- [constructor](CliqueConsensus.md#constructor) - -### Properties - -- [\_cliqueLatestBlockSigners](CliqueConsensus.md#_cliquelatestblocksigners) -- [\_cliqueLatestSignerStates](CliqueConsensus.md#_cliquelatestsignerstates) -- [\_cliqueLatestVotes](CliqueConsensus.md#_cliquelatestvotes) -- [algorithm](CliqueConsensus.md#algorithm) -- [blockchain](CliqueConsensus.md#blockchain) - -### Methods - -- [cliqueActiveSigners](CliqueConsensus.md#cliqueactivesigners) -- [cliqueSignerInTurn](CliqueConsensus.md#cliquesignerinturn) -- [genesisInit](CliqueConsensus.md#genesisinit) -- [newBlock](CliqueConsensus.md#newblock) -- [setup](CliqueConsensus.md#setup) -- [validateConsensus](CliqueConsensus.md#validateconsensus) -- [validateDifficulty](CliqueConsensus.md#validatedifficulty) - ## Constructors -### constructor +### Constructor -• **new CliqueConsensus**() +> **new CliqueConsensus**(): `CliqueConsensus` -#### Defined in +Defined in: [consensus/clique.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L120) -[consensus/clique.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L112) +#### Returns + +`CliqueConsensus` ## Properties ### \_cliqueLatestBlockSigners -• **\_cliqueLatestBlockSigners**: `CliqueLatestBlockSigners` = `[]` +> **\_cliqueLatestBlockSigners**: `CliqueLatestBlockSigners` = `[]` + +Defined in: [consensus/clique.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L117) List of signers for the last consecutive Blockchain.cliqueSignerLimit blocks. Kept as a snapshot for quickly checking for "recently signed" error. @@ -58,15 +44,13 @@ Format: [ [BLOCK_NUMBER, SIGNER_ADDRESS], ...] On reorgs elements from the array are removed until BLOCK_NUMBER > REORG_BLOCK. -#### Defined in - -[consensus/clique.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L110) - -___ +*** ### \_cliqueLatestSignerStates -• **\_cliqueLatestSignerStates**: `CliqueLatestSignerStates` = `[]` +> **\_cliqueLatestSignerStates**: `CliqueLatestSignerStates` = `[]` + +Defined in: [consensus/clique.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L92) List with the latest signer states checkpointed on blocks where a change (added new or removed a signer) occurred. @@ -79,15 +63,13 @@ On reorgs elements from the array are removed until BLOCK_NUMBER > REORG_BLOCK. Always keep at least one item on the stack. -#### Defined in - -[consensus/clique.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L85) - -___ +*** ### \_cliqueLatestVotes -• **\_cliqueLatestVotes**: `CliqueLatestVotes` = `[]` +> **\_cliqueLatestVotes**: `CliqueLatestVotes` = `[]` + +Defined in: [consensus/clique.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L108) List with the latest signer votes. @@ -102,202 +84,208 @@ during an epoch change) On reorgs elements from the array are removed until BLOCK_NUMBER > REORG_BLOCK. -#### Defined in - -[consensus/clique.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L101) - -___ +*** ### algorithm -• **algorithm**: `ConsensusAlgorithm` +> **algorithm**: `ConsensusAlgorithm` + +Defined in: [consensus/clique.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L70) #### Implementation of -[Consensus](../interfaces/Consensus.md).[algorithm](../interfaces/Consensus.md#algorithm) +[`Consensus`](../interfaces/Consensus.md).[`algorithm`](../interfaces/Consensus.md#algorithm) + +*** -#### Defined in +### blockchain -[consensus/clique.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L63) +> **blockchain**: `undefined` \| [`Blockchain`](Blockchain.md) -___ +Defined in: [consensus/clique.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L69) -### blockchain +*** -• **blockchain**: `undefined` \| [`Blockchain`](Blockchain.md) +### DEBUG -#### Defined in +> **DEBUG**: `boolean` -[consensus/clique.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L62) +Defined in: [consensus/clique.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L119) ## Methods -### cliqueActiveSigners +### cliqueActiveSigners() + +> **cliqueActiveSigners**(`blockNum`): `Address`[] -▸ **cliqueActiveSigners**(`blockNum`): `Address`[] +Defined in: [consensus/clique.ts:447](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L447) Returns a list with the current block signers #### Parameters -| Name | Type | -| :------ | :------ | -| `blockNum` | `bigint` | +##### blockNum + +`bigint` #### Returns `Address`[] -#### Defined in - -[consensus/clique.ts:429](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L429) +*** -___ +### cliqueSignerInTurn() -### cliqueSignerInTurn +> **cliqueSignerInTurn**(`signer`, `blockNum`): `Promise`\<`boolean`\> -▸ **cliqueSignerInTurn**(`signer`, `blockNum`): `Promise`<`boolean`\> +Defined in: [consensus/clique.ts:622](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L622) Helper to determine if a signer is in or out of turn for the next block. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `signer` | `Address` | The signer address | -| `blockNum` | `bigint` | - | +##### signer -#### Returns +`Address` + +The signer address -`Promise`<`boolean`\> +##### blockNum + +`bigint` + +#### Returns -#### Defined in +`Promise`\<`boolean`\> -[consensus/clique.ts:601](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L601) +*** -___ +### genesisInit() -### genesisInit +> **genesisInit**(`genesisBlock`): `Promise`\<`void`\> -▸ **genesisInit**(`genesisBlock`): `Promise`<`void`\> +Defined in: [consensus/clique.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L143) Initialize genesis for consensus mechanism #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `genesisBlock` | `Block` | genesis block | +##### genesisBlock + +`Block` + +genesis block #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[genesisInit](../interfaces/Consensus.md#genesisinit) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`genesisInit`](../interfaces/Consensus.md#genesisinit) -[consensus/clique.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L130) +*** -___ +### newBlock() -### newBlock +> **newBlock**(`block`, `commonAncestor`): `Promise`\<`void`\> -▸ **newBlock**(`block`, `commonAncestor`): `Promise`<`void`\> +Defined in: [consensus/clique.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L207) Update consensus on new block #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `block` | `Block` | new block | -| `commonAncestor` | `undefined` \| `BlockHeader` | common ancestor block header (optional) | +##### block + +`Block` + +new block + +##### commonAncestor + +common ancestor block header (optional) + +`undefined` | `BlockHeader` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[newBlock](../interfaces/Consensus.md#newblock) +[`Consensus`](../interfaces/Consensus.md).[`newBlock`](../interfaces/Consensus.md#newblock) -#### Defined in +*** -[consensus/clique.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L194) +### setup() -___ +> **setup**(`param`): `Promise`\<`void`\> -### setup - -▸ **setup**(`param`): `Promise`<`void`\> +Defined in: [consensus/clique.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L135) #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `param` | [`ConsensusOptions`](../interfaces/ConsensusOptions.md) | dictionary containin a [Blockchain](Blockchain.md) object Note: this method must be called before consensus checks are used or type errors will occur | +##### param + +[`ConsensusOptions`](../interfaces/ConsensusOptions.md) + +dictionary containing a [Blockchain](Blockchain.md) object + +Note: this method must be called before consensus checks are used or type errors will occur #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[setup](../interfaces/Consensus.md#setup) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`setup`](../interfaces/Consensus.md#setup) -[consensus/clique.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L122) +*** -___ +### validateConsensus() -### validateConsensus +> **validateConsensus**(`block`): `Promise`\<`void`\> -▸ **validateConsensus**(`block`): `Promise`<`void`\> +Defined in: [consensus/clique.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L147) Validate block consensus parameters #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `block` | `Block` | block to be validated | +##### block + +`Block` + +block to be validated #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[validateConsensus](../interfaces/Consensus.md#validateconsensus) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`validateConsensus`](../interfaces/Consensus.md#validateconsensus) -[consensus/clique.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L134) +*** -___ +### validateDifficulty() -### validateDifficulty +> **validateDifficulty**(`header`): `Promise`\<`void`\> -▸ **validateDifficulty**(`header`): `Promise`<`void`\> +Defined in: [consensus/clique.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L178) #### Parameters -| Name | Type | -| :------ | :------ | -| `header` | `BlockHeader` | +##### header + +`BlockHeader` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[validateDifficulty](../interfaces/Consensus.md#validatedifficulty) - -#### Defined in - -[consensus/clique.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/clique.ts#L165) +[`Consensus`](../interfaces/Consensus.md).[`validateDifficulty`](../interfaces/Consensus.md#validatedifficulty) diff --git a/packages/blockchain/docs/classes/EthashConsensus.md b/packages/blockchain/docs/classes/EthashConsensus.md index 20a2dc750cf..fa37f5a29d7 100644 --- a/packages/blockchain/docs/classes/EthashConsensus.md +++ b/packages/blockchain/docs/classes/EthashConsensus.md @@ -1,191 +1,173 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + [@ethereumjs/blockchain](../README.md) / EthashConsensus # Class: EthashConsensus +Defined in: [consensus/ethash.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L18) + This class encapsulates Ethash-related consensus functionality when used with the Blockchain class. ## Implements - [`Consensus`](../interfaces/Consensus.md) -## Table of contents - -### Constructors - -- [constructor](EthashConsensus.md#constructor) - -### Properties +## Constructors -- [\_ethash](EthashConsensus.md#_ethash) -- [algorithm](EthashConsensus.md#algorithm) -- [blockchain](EthashConsensus.md#blockchain) +### Constructor -### Methods +> **new EthashConsensus**(`ethash`): `EthashConsensus` -- [genesisInit](EthashConsensus.md#genesisinit) -- [newBlock](EthashConsensus.md#newblock) -- [setup](EthashConsensus.md#setup) -- [validateConsensus](EthashConsensus.md#validateconsensus) -- [validateDifficulty](EthashConsensus.md#validatedifficulty) +Defined in: [consensus/ethash.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L26) -## Constructors +#### Parameters -### constructor +##### ethash -• **new EthashConsensus**() +`MinimalEthashInterface` -#### Defined in +#### Returns -[consensus/ethash.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L16) +`EthashConsensus` ## Properties ### \_ethash -• **\_ethash**: `undefined` \| `Ethash` - -#### Defined in +> **\_ethash**: `MinimalEthashInterface` -[consensus/ethash.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L14) +Defined in: [consensus/ethash.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L21) -___ +*** ### algorithm -• **algorithm**: `ConsensusAlgorithm` +> **algorithm**: `ConsensusAlgorithm` -#### Implementation of - -[Consensus](../interfaces/Consensus.md).[algorithm](../interfaces/Consensus.md#algorithm) +Defined in: [consensus/ethash.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L20) -#### Defined in +#### Implementation of -[consensus/ethash.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L13) +[`Consensus`](../interfaces/Consensus.md).[`algorithm`](../interfaces/Consensus.md#algorithm) -___ +*** ### blockchain -• **blockchain**: `undefined` \| [`Blockchain`](Blockchain.md) +> **blockchain**: `undefined` \| [`Blockchain`](Blockchain.md) -#### Defined in - -[consensus/ethash.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L12) +Defined in: [consensus/ethash.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L19) ## Methods -### genesisInit +### genesisInit() + +> **genesisInit**(): `Promise`\<`void`\> -▸ **genesisInit**(): `Promise`<`void`\> +Defined in: [consensus/ethash.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L64) Initialize genesis for consensus mechanism #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[genesisInit](../interfaces/Consensus.md#genesisinit) +[`Consensus`](../interfaces/Consensus.md).[`genesisInit`](../interfaces/Consensus.md#genesisinit) -#### Defined in +*** -[consensus/ethash.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L44) +### newBlock() -___ +> **newBlock**(): `Promise`\<`void`\> -### newBlock - -▸ **newBlock**(): `Promise`<`void`\> +Defined in: [consensus/ethash.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L69) Update consensus on new block #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[newBlock](../interfaces/Consensus.md#newblock) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`newBlock`](../interfaces/Consensus.md#newblock) -[consensus/ethash.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L49) +*** -___ +### setup() -### setup +> **setup**(`__namedParameters`): `Promise`\<`void`\> -▸ **setup**(`__namedParameters`): `Promise`<`void`\> +Defined in: [consensus/ethash.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L65) Set up consensus mechanism #### Parameters -| Name | Type | -| :------ | :------ | -| `__namedParameters` | [`ConsensusOptions`](../interfaces/ConsensusOptions.md) | +##### \_\_namedParameters + +[`ConsensusOptions`](../interfaces/ConsensusOptions.md) #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[setup](../interfaces/Consensus.md#setup) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`setup`](../interfaces/Consensus.md#setup) -[consensus/ethash.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L45) +*** -___ +### validateConsensus() -### validateConsensus +> **validateConsensus**(`block`): `Promise`\<`void`\> -▸ **validateConsensus**(`block`): `Promise`<`void`\> +Defined in: [consensus/ethash.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L35) Validate block consensus parameters #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `block` | `Block` | block to be validated | +##### block + +`Block` + +block to be validated #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[Consensus](../interfaces/Consensus.md).[validateConsensus](../interfaces/Consensus.md#validateconsensus) - -#### Defined in +[`Consensus`](../interfaces/Consensus.md).[`validateConsensus`](../interfaces/Consensus.md#validateconsensus) -[consensus/ethash.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L20) +*** -___ +### validateDifficulty() -### validateDifficulty +> **validateDifficulty**(`header`): `Promise`\<`void`\> -▸ **validateDifficulty**(`header`): `Promise`<`void`\> +Defined in: [consensus/ethash.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L50) Checks that the block's `difficulty` matches the canonical difficulty of the parent header. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `header` | `BlockHeader` | header of block to be checked | +##### header -#### Returns +`BlockHeader` -`Promise`<`void`\> +header of block to be checked -#### Implementation of +#### Returns -[Consensus](../interfaces/Consensus.md).[validateDifficulty](../interfaces/Consensus.md#validatedifficulty) +`Promise`\<`void`\> -#### Defined in +#### Implementation of -[consensus/ethash.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/consensus/ethash.ts#L34) +[`Consensus`](../interfaces/Consensus.md).[`validateDifficulty`](../interfaces/Consensus.md#validatedifficulty) diff --git a/packages/blockchain/docs/functions/createBlockchain.md b/packages/blockchain/docs/functions/createBlockchain.md new file mode 100644 index 00000000000..3db2b8b151c --- /dev/null +++ b/packages/blockchain/docs/functions/createBlockchain.md @@ -0,0 +1,21 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / createBlockchain + +# Function: createBlockchain() + +> **createBlockchain**(`opts`): `Promise`\<[`Blockchain`](../classes/Blockchain.md)\> + +Defined in: [constructors.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/constructors.ts#L22) + +## Parameters + +### opts + +[`BlockchainOptions`](../interfaces/BlockchainOptions.md) = `{}` + +## Returns + +`Promise`\<[`Blockchain`](../classes/Blockchain.md)\> diff --git a/packages/blockchain/docs/functions/createBlockchainFromBlocksData.md b/packages/blockchain/docs/functions/createBlockchainFromBlocksData.md new file mode 100644 index 00000000000..c2e848f7461 --- /dev/null +++ b/packages/blockchain/docs/functions/createBlockchainFromBlocksData.md @@ -0,0 +1,30 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / createBlockchainFromBlocksData + +# Function: createBlockchainFromBlocksData() + +> **createBlockchainFromBlocksData**(`blocksData`, `opts`): `Promise`\<[`Blockchain`](../classes/Blockchain.md)\> + +Defined in: [constructors.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/constructors.ts#L101) + +Creates a blockchain from a list of block objects, +objects must be readable by createBlock + +## Parameters + +### blocksData + +`BlockData`[] + +### opts + +[`BlockchainOptions`](../interfaces/BlockchainOptions.md) = `{}` + +Constructor options, see [BlockchainOptions](../interfaces/BlockchainOptions.md) + +## Returns + +`Promise`\<[`Blockchain`](../classes/Blockchain.md)\> diff --git a/packages/blockchain/docs/functions/genGenesisStateRoot.md b/packages/blockchain/docs/functions/genGenesisStateRoot.md new file mode 100644 index 00000000000..1fbb105f7a2 --- /dev/null +++ b/packages/blockchain/docs/functions/genGenesisStateRoot.md @@ -0,0 +1,27 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / genGenesisStateRoot + +# Function: genGenesisStateRoot() + +> **genGenesisStateRoot**(`genesisState`, `common`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [helpers.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/helpers.ts#L19) + +Verkle or Merkle genesis root + +## Parameters + +### genesisState + +`GenesisState` + +### common + +`Common` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/blockchain/docs/functions/getGenesisStateRoot.md b/packages/blockchain/docs/functions/getGenesisStateRoot.md new file mode 100644 index 00000000000..06f97472c36 --- /dev/null +++ b/packages/blockchain/docs/functions/getGenesisStateRoot.md @@ -0,0 +1,27 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / getGenesisStateRoot + +# Function: getGenesisStateRoot() + +> **getGenesisStateRoot**(`chainId`, `common`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [helpers.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/helpers.ts#L38) + +Returns the genesis state root if chain is well known or an empty state's root otherwise + +## Parameters + +### chainId + +`Chain` + +### common + +`Common` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/blockchain/docs/interfaces/BlockchainInterface.md b/packages/blockchain/docs/interfaces/BlockchainInterface.md new file mode 100644 index 00000000000..3e30d58bbb6 --- /dev/null +++ b/packages/blockchain/docs/interfaces/BlockchainInterface.md @@ -0,0 +1,263 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / BlockchainInterface + +# Interface: BlockchainInterface + +Defined in: [types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L13) + +## Properties + +### consensus + +> **consensus**: `undefined` \| [`Consensus`](Consensus.md) + +Defined in: [types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L14) + +*** + +### events? + +> `optional` **events**: `EventEmitter`\<[`BlockchainEvent`](../type-aliases/BlockchainEvent.md), `any`\> + +Defined in: [types.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L91) + +Optional events emitter + +## Methods + +### delBlock() + +> **delBlock**(`blockHash`): `Promise`\<`void`\> + +Defined in: [types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L28) + +Deletes a block from the blockchain. All child blocks in the chain are +deleted and any encountered heads are set to the parent block. + +#### Parameters + +##### blockHash + +`Uint8Array` + +The hash of the block to be deleted + +#### Returns + +`Promise`\<`void`\> + +*** + +### getBlock() + +> **getBlock**(`blockId`): `Promise`\<`Block`\> + +Defined in: [types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L33) + +Returns a block by its hash or number. + +#### Parameters + +##### blockId + +`number` | `bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`Promise`\<`Block`\> + +*** + +### getCanonicalHeadBlock() + +> **getCanonicalHeadBlock**(): `Promise`\<`Block`\> + +Defined in: [types.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L86) + +Returns the latest full block in the canonical chain. + +#### Returns + +`Promise`\<`Block`\> + +*** + +### getIteratorHead() + +> **getIteratorHead**(`name?`): `Promise`\<`Block`\> + +Defined in: [types.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L68) + +Returns the specified iterator head. + +#### Parameters + +##### name? + +`string` + +Optional name of the iterator head (default: 'vm') + +#### Returns + +`Promise`\<`Block`\> + +*** + +### getTotalDifficulty()? + +> `optional` **getTotalDifficulty**(`hash`, `number?`): `Promise`\<`bigint`\> + +Defined in: [types.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L81) + +Gets total difficulty for a block specified by hash and number + +#### Parameters + +##### hash + +`Uint8Array` + +##### number? + +`bigint` + +#### Returns + +`Promise`\<`bigint`\> + +*** + +### iterator() + +> **iterator**(`name`, `onBlock`, `maxBlocks?`, `releaseLockOnCallback?`): `Promise`\<`number`\> + +Defined in: [types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L44) + +Iterates through blocks starting at the specified iterator head and calls +the onBlock function on each block. + +#### Parameters + +##### name + +`string` + +Name of the state root head + +##### onBlock + +[`OnBlock`](../type-aliases/OnBlock.md) + +Function called on each block with params (block: Block, + +##### maxBlocks? + +`number` + +optional maximum number of blocks to iterate through +reorg: boolean) + +##### releaseLockOnCallback? + +`boolean` + +#### Returns + +`Promise`\<`number`\> + +*** + +### putBlock() + +> **putBlock**(`block`): `Promise`\<`void`\> + +Defined in: [types.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L20) + +Adds a block to the blockchain. + +#### Parameters + +##### block + +`Block` + +The block to be added to the blockchain. + +#### Returns + +`Promise`\<`void`\> + +*** + +### setIteratorHead() + +> **setIteratorHead**(`tag`, `headHash`): `Promise`\<`void`\> + +Defined in: [types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L76) + +Set header hash of a certain `tag`. +When calling the iterator, the iterator will start running the first child block after the header hash currently stored. + +#### Parameters + +##### tag + +`string` + +The tag to save the headHash to + +##### headHash + +`Uint8Array` + +The head hash to save + +#### Returns + +`Promise`\<`void`\> + +*** + +### shallowCopy() + +> **shallowCopy**(): `BlockchainInterface` + +Defined in: [types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L54) + +Returns a shallow copy of the blockchain that may share state with the original + +#### Returns + +`BlockchainInterface` + +*** + +### validateHeader() + +> **validateHeader**(`header`, `height?`): `Promise`\<`void`\> + +Defined in: [types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L61) + +Validates a block header, throwing if invalid. It is being validated against the reported `parentHash`. + +#### Parameters + +##### header + +`BlockHeader` + +header to be validated + +##### height? + +`bigint` + +If this is an uncle header, this is the height of the block that is including it + +#### Returns + +`Promise`\<`void`\> diff --git a/packages/blockchain/docs/interfaces/BlockchainOptions.md b/packages/blockchain/docs/interfaces/BlockchainOptions.md new file mode 100644 index 00000000000..4b5118834e8 --- /dev/null +++ b/packages/blockchain/docs/interfaces/BlockchainOptions.md @@ -0,0 +1,179 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / BlockchainOptions + +# Interface: BlockchainOptions + +Defined in: [types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L143) + +This are the options that the Blockchain constructor can receive. + +## Extends + +- [`GenesisOptions`](GenesisOptions.md) + +## Properties + +### common? + +> `optional` **common**: `Common` + +Defined in: [types.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L150) + +Specify the chain and hardfork by passing a Common instance. + +If not provided this defaults to chain `mainnet` and hardfork `chainstart` + +*** + +### consensusDict? + +> `optional` **consensusDict**: [`ConsensusDict`](../type-aliases/ConsensusDict.md) + +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L211) + +Optional dictionary with consensus objects (adhering to the [Consensus](Consensus.md) interface) +if consensus validation is wished for certain consensus algorithms. + +Since consensus validation moved to the Ethereum consensus layer with Proof-of-Stake +consensus is not validated by default. For `ConsensusAlgorithm.Ethash` and +`ConsensusAlgorithm.Clique` consensus validation can be activated by passing in the +respective consensus validation objects `EthashConsensus` or `CliqueConsensus`. + +```ts +import { CliqueConsensus, createBlockchain } from '@ethereumjs/blockchain' +import type { ConsensusDict } from '@ethereumjs/blockchain' + +const consensusDict: ConsensusDict = {} +consensusDict[ConsensusAlgorithm.Clique] = new CliqueConsensus() +const blockchain = await createBlockchain({ common, consensusDict }) +``` + +Additionally it is possible to provide a fully custom consensus implementation. +Note that this needs a custom `Common` object passed to the blockchain where +the `ConsensusAlgorithm` string matches the string used here. + +*** + +### db? + +> `optional` **db**: `DB`\<`string` \| `number` \| `Uint8Array`\<`ArrayBufferLike`\>, `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| `DBObject`\> + +Defined in: [types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L167) + +Database to store blocks and metadata. +Can be any database implementation that adheres to the `DB` interface + +*** + +### genesisBlock? + +> `optional` **genesisBlock**: `Block` + +Defined in: [types.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L102) + +The blockchain only initializes successfully if it has a genesis block. If +there is no block available in the DB and a `genesisBlock` is provided, +then the provided `genesisBlock` will be used as genesis. If no block is +present in the DB and no block is provided, then the genesis block as +provided from the `common` will be used. + +#### Inherited from + +[`GenesisOptions`](GenesisOptions.md).[`genesisBlock`](GenesisOptions.md#genesisblock) + +*** + +### genesisState? + +> `optional` **genesisState**: `GenesisState` + +Defined in: [types.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L128) + +If you are using a custom chain Common, pass the genesis state. + +Pattern 1 (with genesis state see GenesisState for format): + +```javascript +{ + '0x0...01': '0x100', // For EoA +} +``` + +Pattern 2 (with complex genesis state, containing contract accounts and storage). +Note that in AccountState there are two +accepted types. This allows to easily insert accounts in the genesis state: + +A complex genesis state with Contract and EoA states would have the following format: + +```javascript +{ + '0x0...01': '0x100', // For EoA + '0x0...02': ['0x1', '0xRUNTIME_BYTECODE', [[storageKey1, storageValue1], [storageKey2, storageValue2]]] // For contracts +} +``` + +#### Inherited from + +[`GenesisOptions`](GenesisOptions.md).[`genesisState`](GenesisOptions.md#genesisstate) + +*** + +### genesisStateRoot? + +> `optional` **genesisStateRoot**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [types.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L133) + +State root of the genesis state + +#### Inherited from + +[`GenesisOptions`](GenesisOptions.md).[`genesisStateRoot`](GenesisOptions.md#genesisstateroot) + +*** + +### hardforkByHeadBlockNumber? + +> `optional` **hardforkByHeadBlockNumber**: `boolean` + +Defined in: [types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L161) + +Set the HF to the fork determined by the head block and update on head updates. + +Note: for HFs where the transition is also determined by a total difficulty +threshold (merge HF) the calculated TD is additionally taken into account +for HF determination. + +Default: `false` (HF is set to whatever default HF is set by the Common instance) + +*** + +### validateBlocks? + +> `optional` **validateBlocks**: `boolean` + +Defined in: [types.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L175) + +This flag indicates if protocol-given consistency checks on +block headers and included uncles and transactions should be performed, +see Block#validate for details. + +*** + +### validateConsensus? + +> `optional` **validateConsensus**: `boolean` + +Defined in: [types.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L187) + +Validate the consensus with the respective consensus implementation passed +to `consensusDict` (see respective option) `CasperConsensus` (which effectively +does nothing) is available by default. + +For the build-in validation classes the following validations take place. +- 'pow' with 'ethash' algorithm (validates the proof-of-work) +- 'poa' with 'clique' algorithm (verifies the block signatures) +Default: `false`. diff --git a/packages/blockchain/docs/interfaces/Consensus.md b/packages/blockchain/docs/interfaces/Consensus.md index ec189e76bfa..773d1b37c91 100644 --- a/packages/blockchain/docs/interfaces/Consensus.md +++ b/packages/blockchain/docs/interfaces/Consensus.md @@ -1,145 +1,135 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + [@ethereumjs/blockchain](../README.md) / Consensus # Interface: Consensus +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L217) + Interface that a consensus class needs to implement. -## Implemented by +## Properties -- [`CasperConsensus`](../classes/CasperConsensus.md) -- [`CliqueConsensus`](../classes/CliqueConsensus.md) -- [`EthashConsensus`](../classes/EthashConsensus.md) +### algorithm -## Table of contents +> **algorithm**: `string` -### Properties +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L218) -- [algorithm](Consensus.md#algorithm) +## Methods -### Methods +### genesisInit() -- [genesisInit](Consensus.md#genesisinit) -- [newBlock](Consensus.md#newblock) -- [setup](Consensus.md#setup) -- [validateConsensus](Consensus.md#validateconsensus) -- [validateDifficulty](Consensus.md#validatedifficulty) +> **genesisInit**(`genesisBlock`): `Promise`\<`void`\> -## Properties +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L223) -### algorithm +Initialize genesis for consensus mechanism -• **algorithm**: `string` +#### Parameters -#### Defined in +##### genesisBlock -[types.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L193) +`Block` -## Methods +genesis block -### genesisInit +#### Returns -▸ **genesisInit**(`genesisBlock`): `Promise`<`void`\> +`Promise`\<`void`\> -Initialize genesis for consensus mechanism +*** -#### Parameters +### newBlock() -| Name | Type | Description | -| :------ | :------ | :------ | -| `genesisBlock` | `Block` | genesis block | +> **newBlock**(`block`, `commonAncestor?`, `ancientHeaders?`): `Promise`\<`void`\> -#### Returns +Defined in: [types.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L244) -`Promise`<`void`\> +Update consensus on new block -#### Defined in +#### Parameters -[types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L198) +##### block -___ +`Block` -### newBlock +new block -▸ **newBlock**(`block`, `commonAncestor?`, `ancientHeaders?`): `Promise`<`void`\> +##### commonAncestor? -Update consensus on new block +`BlockHeader` -#### Parameters +common ancestor block header (optional) -| Name | Type | Description | -| :------ | :------ | :------ | -| `block` | `Block` | new block | -| `commonAncestor?` | `BlockHeader` | common ancestor block header (optional) | -| `ancientHeaders?` | `BlockHeader`[] | array of ancestor block headers (optional) | +##### ancientHeaders? -#### Returns +`BlockHeader`[] + +array of ancestor block headers (optional) -`Promise`<`void`\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L219) +*** -___ +### setup() -### setup +> **setup**(`__namedParameters`): `Promise`\<`void`\> -▸ **setup**(`__namedParameters`): `Promise`<`void`\> +Defined in: [types.ts:228](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L228) Set up consensus mechanism #### Parameters -| Name | Type | -| :------ | :------ | -| `__namedParameters` | [`ConsensusOptions`](ConsensusOptions.md) | +##### \_\_namedParameters -#### Returns +[`ConsensusOptions`](ConsensusOptions.md) -`Promise`<`void`\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L203) +*** -___ +### validateConsensus() -### validateConsensus +> **validateConsensus**(`block`): `Promise`\<`void`\> -▸ **validateConsensus**(`block`): `Promise`<`void`\> +Defined in: [types.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L234) Validate block consensus parameters #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `block` | `Block` | block to be validated | +##### block -#### Returns +`Block` -`Promise`<`void`\> +block to be validated -#### Defined in +#### Returns -[types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L209) +`Promise`\<`void`\> -___ +*** -### validateDifficulty +### validateDifficulty() -▸ **validateDifficulty**(`header`): `Promise`<`void`\> +> **validateDifficulty**(`header`): `Promise`\<`void`\> -#### Parameters +Defined in: [types.ts:236](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L236) -| Name | Type | -| :------ | :------ | -| `header` | `BlockHeader` | +#### Parameters -#### Returns +##### header -`Promise`<`void`\> +`BlockHeader` -#### Defined in +#### Returns -[types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L211) +`Promise`\<`void`\> diff --git a/packages/blockchain/docs/interfaces/ConsensusOptions.md b/packages/blockchain/docs/interfaces/ConsensusOptions.md index 86db6ed559a..b21e9fb9465 100644 --- a/packages/blockchain/docs/interfaces/ConsensusOptions.md +++ b/packages/blockchain/docs/interfaces/ConsensusOptions.md @@ -1,21 +1,19 @@ -[@ethereumjs/blockchain](../README.md) / ConsensusOptions +[**@ethereumjs/blockchain**](../README.md) -# Interface: ConsensusOptions +*** -Options when initializing a class that implements the Consensus interface. +[@ethereumjs/blockchain](../README.md) / ConsensusOptions -## Table of contents +# Interface: ConsensusOptions -### Properties +Defined in: [types.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L254) -- [blockchain](ConsensusOptions.md#blockchain) +Options when initializing a class that implements the Consensus interface. ## Properties ### blockchain -• **blockchain**: [`Blockchain`](../classes/Blockchain.md) - -#### Defined in +> **blockchain**: [`Blockchain`](../classes/Blockchain.md) -[types.ts:230](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L230) +Defined in: [types.ts:255](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L255) diff --git a/packages/blockchain/docs/interfaces/GenesisOptions.md b/packages/blockchain/docs/interfaces/GenesisOptions.md index 6a7edf9f326..2f0d1e4b2a6 100644 --- a/packages/blockchain/docs/interfaces/GenesisOptions.md +++ b/packages/blockchain/docs/interfaces/GenesisOptions.md @@ -1,26 +1,24 @@ -[@ethereumjs/blockchain](../README.md) / GenesisOptions - -# Interface: GenesisOptions +[**@ethereumjs/blockchain**](../README.md) -## Hierarchy +*** -- **`GenesisOptions`** +[@ethereumjs/blockchain](../README.md) / GenesisOptions - ↳ [`BlockchainOptions`](BlockchainOptions.md) +# Interface: GenesisOptions -## Table of contents +Defined in: [types.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L94) -### Properties +## Extended by -- [genesisBlock](GenesisOptions.md#genesisblock) -- [genesisState](GenesisOptions.md#genesisstate) -- [genesisStateRoot](GenesisOptions.md#genesisstateroot) +- [`BlockchainOptions`](BlockchainOptions.md) ## Properties -### genesisBlock +### genesisBlock? -• `Optional` **genesisBlock**: `Block` +> `optional` **genesisBlock**: `Block` + +Defined in: [types.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L102) The blockchain only initializes successfully if it has a genesis block. If there is no block available in the DB and a `genesisBlock` is provided, @@ -28,15 +26,13 @@ then the provided `genesisBlock` will be used as genesis. If no block is present in the DB and no block is provided, then the genesis block as provided from the `common` will be used. -#### Defined in - -[types.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L101) +*** -___ +### genesisState? -### genesisState +> `optional` **genesisState**: `GenesisState` -• `Optional` **genesisState**: `GenesisState` +Defined in: [types.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L128) If you are using a custom chain Common, pass the genesis state. @@ -61,18 +57,12 @@ A complex genesis state with Contract and EoA states would have the following fo } ``` -#### Defined in - -[types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L127) +*** -___ +### genesisStateRoot? -### genesisStateRoot +> `optional` **genesisStateRoot**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **genesisStateRoot**: `Uint8Array` +Defined in: [types.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L133) State root of the genesis state - -#### Defined in - -[types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L132) diff --git a/packages/blockchain/docs/interfaces/blockchaininterface.md b/packages/blockchain/docs/interfaces/blockchaininterface.md deleted file mode 100644 index 9fa55818d4c..00000000000 --- a/packages/blockchain/docs/interfaces/blockchaininterface.md +++ /dev/null @@ -1,266 +0,0 @@ -[@ethereumjs/blockchain](../README.md) / BlockchainInterface - -# Interface: BlockchainInterface - -## Implemented by - -- [`Blockchain`](../classes/Blockchain.md) - -## Table of contents - -### Properties - -- [consensus](BlockchainInterface.md#consensus) -- [events](BlockchainInterface.md#events) - -### Methods - -- [delBlock](BlockchainInterface.md#delblock) -- [getBlock](BlockchainInterface.md#getblock) -- [getCanonicalHeadBlock](BlockchainInterface.md#getcanonicalheadblock) -- [getIteratorHead](BlockchainInterface.md#getiteratorhead) -- [getTotalDifficulty](BlockchainInterface.md#gettotaldifficulty) -- [iterator](BlockchainInterface.md#iterator) -- [putBlock](BlockchainInterface.md#putblock) -- [setIteratorHead](BlockchainInterface.md#setiteratorhead) -- [shallowCopy](BlockchainInterface.md#shallowcopy) -- [validateHeader](BlockchainInterface.md#validateheader) - -## Properties - -### consensus - -• **consensus**: [`Consensus`](Consensus.md) - -#### Defined in - -[types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L13) - -___ - -### events - -• `Optional` **events**: `AsyncEventEmitter`<[`BlockchainEvents`](../README.md#blockchainevents)\> - -Optional events emitter - -#### Defined in - -[types.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L90) - -## Methods - -### delBlock - -▸ **delBlock**(`blockHash`): `Promise`<`void`\> - -Deletes a block from the blockchain. All child blocks in the chain are -deleted and any encountered heads are set to the parent block. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `blockHash` | `Uint8Array` | The hash of the block to be deleted | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L27) - -___ - -### getBlock - -▸ **getBlock**(`blockId`): `Promise`<`Block`\> - -Returns a block by its hash or number. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `blockId` | `number` \| `bigint` \| `Uint8Array` | - -#### Returns - -`Promise`<`Block`\> - -#### Defined in - -[types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L32) - -___ - -### getCanonicalHeadBlock - -▸ **getCanonicalHeadBlock**(): `Promise`<`Block`\> - -Returns the latest full block in the canonical chain. - -#### Returns - -`Promise`<`Block`\> - -#### Defined in - -[types.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L85) - -___ - -### getIteratorHead - -▸ **getIteratorHead**(`name?`): `Promise`<`Block`\> - -Returns the specified iterator head. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `name?` | `string` | Optional name of the iterator head (default: 'vm') | - -#### Returns - -`Promise`<`Block`\> - -#### Defined in - -[types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L67) - -___ - -### getTotalDifficulty - -▸ `Optional` **getTotalDifficulty**(`hash`, `number?`): `Promise`<`bigint`\> - -Gets total difficulty for a block specified by hash and number - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hash` | `Uint8Array` | -| `number?` | `bigint` | - -#### Returns - -`Promise`<`bigint`\> - -#### Defined in - -[types.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L80) - -___ - -### iterator - -▸ **iterator**(`name`, `onBlock`, `maxBlocks?`, `releaseLockOnCallback?`): `Promise`<`number`\> - -Iterates through blocks starting at the specified iterator head and calls -the onBlock function on each block. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `name` | `string` | Name of the state root head | -| `onBlock` | [`OnBlock`](../README.md#onblock) | Function called on each block with params (block: Block, | -| `maxBlocks?` | `number` | optional maximum number of blocks to iterate through reorg: boolean) | -| `releaseLockOnCallback?` | `boolean` | - | - -#### Returns - -`Promise`<`number`\> - -#### Defined in - -[types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L43) - -___ - -### putBlock - -▸ **putBlock**(`block`): `Promise`<`void`\> - -Adds a block to the blockchain. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `block` | `Block` | The block to be added to the blockchain. | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L19) - -___ - -### setIteratorHead - -▸ **setIteratorHead**(`tag`, `headHash`): `Promise`<`void`\> - -Set header hash of a certain `tag`. -When calling the iterator, the iterator will start running the first child block after the header hash currently stored. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tag` | `string` | The tag to save the headHash to | -| `headHash` | `Uint8Array` | The head hash to save | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[types.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L75) - -___ - -### shallowCopy - -▸ **shallowCopy**(): [`BlockchainInterface`](BlockchainInterface.md) - -Returns a shallow copy of the blockchain that may share state with the original - -#### Returns - -[`BlockchainInterface`](BlockchainInterface.md) - -#### Defined in - -[types.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L53) - -___ - -### validateHeader - -▸ **validateHeader**(`header`, `height?`): `Promise`<`void`\> - -Validates a block header, throwing if invalid. It is being validated against the reported `parentHash`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `header` | `BlockHeader` | header to be validated | -| `height?` | `bigint` | If this is an uncle header, this is the height of the block that is including it | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[types.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L60) diff --git a/packages/blockchain/docs/interfaces/blockchainoptions.md b/packages/blockchain/docs/interfaces/blockchainoptions.md deleted file mode 100644 index 71588cf8fbe..00000000000 --- a/packages/blockchain/docs/interfaces/blockchainoptions.md +++ /dev/null @@ -1,187 +0,0 @@ -[@ethereumjs/blockchain](../README.md) / BlockchainOptions - -# Interface: BlockchainOptions - -This are the options that the Blockchain constructor can receive. - -## Hierarchy - -- [`GenesisOptions`](GenesisOptions.md) - - ↳ **`BlockchainOptions`** - -## Table of contents - -### Properties - -- [common](BlockchainOptions.md#common) -- [consensus](BlockchainOptions.md#consensus) -- [db](BlockchainOptions.md#db) -- [genesisBlock](BlockchainOptions.md#genesisblock) -- [genesisState](BlockchainOptions.md#genesisstate) -- [genesisStateRoot](BlockchainOptions.md#genesisstateroot) -- [hardforkByHeadBlockNumber](BlockchainOptions.md#hardforkbyheadblocknumber) -- [validateBlocks](BlockchainOptions.md#validateblocks) -- [validateConsensus](BlockchainOptions.md#validateconsensus) - -## Properties - -### common - -• `Optional` **common**: `Common` - -Specify the chain and hardfork by passing a Common instance. - -If not provided this defaults to chain `mainnet` and hardfork `chainstart` - -#### Defined in - -[types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L145) - -___ - -### consensus - -• `Optional` **consensus**: [`Consensus`](Consensus.md) - -Optional custom consensus that implements the [Consensus](Consensus.md) class - -#### Defined in - -[types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L186) - -___ - -### db - -• `Optional` **db**: `DB`<`string` \| `number` \| `Uint8Array`, `string` \| `Uint8Array` \| `DBObject`\> - -Database to store blocks and metadata. -Can be any database implementation that adheres to the `DB` interface - -#### Defined in - -[types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L162) - -___ - -### genesisBlock - -• `Optional` **genesisBlock**: `Block` - -The blockchain only initializes successfully if it has a genesis block. If -there is no block available in the DB and a `genesisBlock` is provided, -then the provided `genesisBlock` will be used as genesis. If no block is -present in the DB and no block is provided, then the genesis block as -provided from the `common` will be used. - -#### Inherited from - -[GenesisOptions](GenesisOptions.md).[genesisBlock](GenesisOptions.md#genesisblock) - -#### Defined in - -[types.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L101) - -___ - -### genesisState - -• `Optional` **genesisState**: `GenesisState` - -If you are using a custom chain Common, pass the genesis state. - -Pattern 1 (with genesis state see GenesisState for format): - -```javascript -{ - '0x0...01': '0x100', // For EoA -} -``` - -Pattern 2 (with complex genesis state, containing contract accounts and storage). -Note that in AccountState there are two -accepted types. This allows to easily insert accounts in the genesis state: - -A complex genesis state with Contract and EoA states would have the following format: - -```javascript -{ - '0x0...01': '0x100', // For EoA - '0x0...02': ['0x1', '0xRUNTIME_BYTECODE', [[storageKey1, storageValue1], [storageKey2, storageValue2]]] // For contracts -} -``` - -#### Inherited from - -[GenesisOptions](GenesisOptions.md).[genesisState](GenesisOptions.md#genesisstate) - -#### Defined in - -[types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L127) - -___ - -### genesisStateRoot - -• `Optional` **genesisStateRoot**: `Uint8Array` - -State root of the genesis state - -#### Inherited from - -[GenesisOptions](GenesisOptions.md).[genesisStateRoot](GenesisOptions.md#genesisstateroot) - -#### Defined in - -[types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L132) - -___ - -### hardforkByHeadBlockNumber - -• `Optional` **hardforkByHeadBlockNumber**: `boolean` - -Set the HF to the fork determined by the head block and update on head updates. - -Note: for HFs where the transition is also determined by a total difficulty -threshold (merge HF) the calculated TD is additionally taken into account -for HF determination. - -Default: `false` (HF is set to whatever default HF is set by the Common instance) - -#### Defined in - -[types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L156) - -___ - -### validateBlocks - -• `Optional` **validateBlocks**: `boolean` - -This flag indicates if protocol-given consistency checks on -block headers and included uncles and transactions should be performed, -see Block#validate for details. - -#### Defined in - -[types.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L181) - -___ - -### validateConsensus - -• `Optional` **validateConsensus**: `boolean` - -This flags indicates if a block should be validated along the consensus algorithm -or protocol used by the chain, e.g. by verifying the PoW on the block. - -Supported consensus types and algorithms (taken from the `Common` instance): -- 'pow' with 'ethash' algorithm (validates the proof-of-work) -- 'poa' with 'clique' algorithm (verifies the block signatures) -Default: `true`. - -#### Defined in - -[types.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L173) diff --git a/packages/blockchain/docs/type-aliases/BlockchainEvent.md b/packages/blockchain/docs/type-aliases/BlockchainEvent.md new file mode 100644 index 00000000000..895f42abc45 --- /dev/null +++ b/packages/blockchain/docs/type-aliases/BlockchainEvent.md @@ -0,0 +1,33 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / BlockchainEvent + +# Type Alias: BlockchainEvent + +> **BlockchainEvent** = `object` + +Defined in: [types.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L9) + +## Properties + +### deletedCanonicalBlocks() + +> **deletedCanonicalBlocks**: (`data`, `resolve?`) => `void` + +Defined in: [types.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L10) + +#### Parameters + +##### data + +`Block`[] + +##### resolve? + +(`result?`) => `void` + +#### Returns + +`void` diff --git a/packages/blockchain/docs/type-aliases/ConsensusDict.md b/packages/blockchain/docs/type-aliases/ConsensusDict.md new file mode 100644 index 00000000000..5724edc4c99 --- /dev/null +++ b/packages/blockchain/docs/type-aliases/ConsensusDict.md @@ -0,0 +1,15 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / ConsensusDict + +# Type Alias: ConsensusDict + +> **ConsensusDict** = `object` + +Defined in: [types.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L136) + +## Index Signature + +\[`consensusAlgorithm`: `string`\]: [`Consensus`](../interfaces/Consensus.md) diff --git a/packages/blockchain/docs/type-aliases/OnBlock.md b/packages/blockchain/docs/type-aliases/OnBlock.md new file mode 100644 index 00000000000..dad2a622d73 --- /dev/null +++ b/packages/blockchain/docs/type-aliases/OnBlock.md @@ -0,0 +1,25 @@ +[**@ethereumjs/blockchain**](../README.md) + +*** + +[@ethereumjs/blockchain](../README.md) / OnBlock + +# Type Alias: OnBlock() + +> **OnBlock** = (`block`, `reorg`) => `Promise`\<`void`\> \| `void` + +Defined in: [types.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/blockchain/src/types.ts#L7) + +## Parameters + +### block + +`Block` + +### reorg + +`boolean` + +## Returns + +`Promise`\<`void`\> \| `void` diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index 0dd99b86b24..d9c176a7986 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -34,7 +34,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- blockchain", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", diff --git a/packages/blockchain/test/index.spec.ts b/packages/blockchain/test/index.spec.ts index 2a1c0ef784b..356b6a37552 100644 --- a/packages/blockchain/test/index.spec.ts +++ b/packages/blockchain/test/index.spec.ts @@ -5,7 +5,7 @@ import { createBlockHeaderFromBytesArray, } from '@ethereumjs/block' import { Common, Hardfork, Holesky, Mainnet, Sepolia } from '@ethereumjs/common' -import { goerliChainConfig, mainnetBlocks, preLondonTestDataBlocks1 } from '@ethereumjs/testdata' +import { goerliChainConfig, mainnetBlocks, preLondonTestDataBlocks1RLP } from '@ethereumjs/testdata' import { MapDB, bytesToHex, equalsBytes, hexToBytes, utf8ToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' @@ -14,7 +14,6 @@ import { Blockchain, createBlockchain, createBlockchainFromBlocksData } from '.. import { createTestDB, generateBlockchain, generateBlocks, isConsecutive } from './util.ts' import type { Block, BlockOptions } from '@ethereumjs/block' -import type { PrefixedHexString } from '@ethereumjs/util' describe('blockchain test', () => { it('should not crash on getting head of a blockchain without a genesis', async () => { @@ -581,7 +580,7 @@ describe('blockchain test', () => { it('should add block with body', async () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.Istanbul }) - const genesisRlp = hexToBytes(preLondonTestDataBlocks1.genesisRLP as PrefixedHexString) + const genesisRlp = hexToBytes(preLondonTestDataBlocks1RLP.genesisRLP) const genesisBlock = createBlockFromRLP(genesisRlp, { common }) const blockchain = await createBlockchain({ validateBlocks: true, @@ -589,7 +588,7 @@ describe('blockchain test', () => { genesisBlock, }) - const blockRlp = hexToBytes(preLondonTestDataBlocks1.blocks[0].rlp as PrefixedHexString) + const blockRlp = hexToBytes(preLondonTestDataBlocks1RLP.blockRLP) const block = createBlockFromRLP(blockRlp, { common }) await blockchain.putBlock(block) }) diff --git a/packages/blockchain/typedoc.cjs b/packages/blockchain/typedoc.mjs similarity index 63% rename from packages/blockchain/typedoc.cjs rename to packages/blockchain/typedoc.mjs index dc7616cfd6c..99b09698d77 100644 --- a/packages/blockchain/typedoc.cjs +++ b/packages/blockchain/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts', 'src/db/**', 'src/clique.ts'], diff --git a/packages/client/bin/utils.ts b/packages/client/bin/utils.ts index e4aca62147c..2c034967fad 100644 --- a/packages/client/bin/utils.ts +++ b/packages/client/bin/utils.ts @@ -52,7 +52,7 @@ import { Event } from '../src/types.ts' import { parseMultiaddrs } from '../src/util/index.ts' import { setupMetrics } from '../src/util/metrics.ts' -import type { CustomCrypto, GenesisState } from '@ethereumjs/common' +import type { CustomCrypto, GenesisState, GethGenesis } from '@ethereumjs/common' import type { Address, PrefixedHexString } from '@ethereumjs/util' import type { Logger } from '../src/logging.ts' import type { ClientOpts } from '../src/types.ts' @@ -495,7 +495,7 @@ async function setupDevnet(prefundAddress: Address, args: ClientOpts) { epoch: 30000, }, } - const defaultChainData = { + const defaultChainData: GethGenesis = { config: { chainId: 123456, homesteadBlock: 0, @@ -521,6 +521,7 @@ async function setupDevnet(prefundAddress: Address, args: ClientOpts) { gasUsed: '0x0', parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', baseFeePerGas: 7, + alloc: {}, } const extraData = args.dev === 'pow' ? '0x' + '0'.repeat(32) : '0x' + '0'.repeat(64) + addr + '0'.repeat(130) diff --git a/packages/client/docs/README.md b/packages/client/docs/README.md index a130c1fdd29..4ad95ba8c50 100644 --- a/packages/client/docs/README.md +++ b/packages/client/docs/README.md @@ -1,18 +1,24 @@ -@ethereumjs/client +**@ethereumjs/client** + +*** # @ethereumjs/client -## Table of contents +## Classes + +- [Config](classes/Config.md) +- [EthereumClient](classes/EthereumClient.md) -### Enumerations +## Interfaces -- [DataDirectory](enums/DataDirectory.md) -- [SyncMode](enums/SyncMode.md) +- [ConfigOptions](interfaces/ConfigOptions.md) -### Classes +## Type Aliases -- [Config](classes/Config.md) +- [DataDirectory](type-aliases/DataDirectory.md) +- [SyncMode](type-aliases/SyncMode.md) -### Interfaces +## Variables -- [ConfigOptions](interfaces/ConfigOptions.md) +- [DataDirectory](variables/DataDirectory.md) +- [SyncMode](variables/SyncMode.md) diff --git a/packages/client/docs/classes/Config.md b/packages/client/docs/classes/Config.md index c95f5605a74..83d646538b2 100644 --- a/packages/client/docs/classes/Config.md +++ b/packages/client/docs/classes/Config.md @@ -1,1113 +1,868 @@ +[**@ethereumjs/client**](../README.md) + +*** + [@ethereumjs/client](../README.md) / Config # Class: Config -## Table of contents - -### Constructors - -- [constructor](Config.md#constructor) - -### Properties - -- [accountCache](Config.md#accountcache) -- [accounts](Config.md#accounts) -- [bootnodes](Config.md#bootnodes) -- [chainCommon](Config.md#chaincommon) -- [codeCache](Config.md#codecache) -- [datadir](Config.md#datadir) -- [debugCode](Config.md#debugcode) -- [discDns](Config.md#discdns) -- [discV4](Config.md#discv4) -- [dnsAddr](Config.md#dnsaddr) -- [enableSnapSync](Config.md#enablesnapsync) -- [engineNewpayloadMaxExecute](Config.md#enginenewpayloadmaxexecute) -- [engineNewpayloadMaxTxsExecute](Config.md#enginenewpayloadmaxtxsexecute) -- [engineParentLookupMaxDepth](Config.md#engineparentlookupmaxdepth) -- [events](Config.md#events) -- [execCommon](Config.md#execcommon) -- [execution](Config.md#execution) -- [extIP](Config.md#extip) -- [isSingleNode](Config.md#issinglenode) -- [key](Config.md#key) -- [lastSyncDate](Config.md#lastsyncdate) -- [lastsyncronized](Config.md#lastsyncronized) -- [lightserv](Config.md#lightserv) -- [logger](Config.md#logger) -- [maxAccountRange](Config.md#maxaccountrange) -- [maxFetcherJobs](Config.md#maxfetcherjobs) -- [maxFetcherRequests](Config.md#maxfetcherrequests) -- [maxInvalidBlocksErrorCache](Config.md#maxinvalidblockserrorcache) -- [maxPeers](Config.md#maxpeers) -- [maxPerRequest](Config.md#maxperrequest) -- [maxRangeBytes](Config.md#maxrangebytes) -- [maxStorageRange](Config.md#maxstoragerange) -- [minPeers](Config.md#minpeers) -- [mine](Config.md#mine) -- [minerCoinbase](Config.md#minercoinbase) -- [multiaddrs](Config.md#multiaddrs) -- [numBlocksPerIteration](Config.md#numblocksperiteration) -- [port](Config.md#port) -- [prefixStorageTrieKeys](Config.md#prefixstoragetriekeys) -- [pruneEngineCache](Config.md#pruneenginecache) -- [safeReorgDistance](Config.md#safereorgdistance) -- [savePreimages](Config.md#savepreimages) -- [saveReceipts](Config.md#savereceipts) -- [server](Config.md#server) -- [shutdown](Config.md#shutdown) -- [skeletonFillCanonicalBackStep](Config.md#skeletonfillcanonicalbackstep) -- [skeletonSubchainMergeMinimum](Config.md#skeletonsubchainmergeminimum) -- [snapAvailabilityDepth](Config.md#snapavailabilitydepth) -- [snapTransitionSafeDepth](Config.md#snaptransitionsafedepth) -- [statelessVerkle](Config.md#statelessverkle) -- [storageCache](Config.md#storagecache) -- [syncTargetHeight](Config.md#synctargetheight) -- [syncedStateRemovalPeriod](Config.md#syncedstateremovalperiod) -- [synchronized](Config.md#synchronized) -- [syncmode](Config.md#syncmode) -- [trieCache](Config.md#triecache) -- [txLookupLimit](Config.md#txlookuplimit) -- [useStringValueTrieDB](Config.md#usestringvaluetriedb) -- [vm](Config.md#vm) -- [vmProfilerOpts](Config.md#vmprofileropts) -- [ACCOUNT\_CACHE](Config.md#account_cache) -- [CHAIN\_DEFAULT](Config.md#chain_default) -- [CODE\_CACHE](Config.md#code_cache) -- [DATADIR\_DEFAULT](Config.md#datadir_default) -- [DEBUGCODE\_DEFAULT](Config.md#debugcode_default) -- [DNSADDR\_DEFAULT](Config.md#dnsaddr_default) -- [ENGINE\_NEWPAYLOAD\_MAX\_EXECUTE](Config.md#engine_newpayload_max_execute) -- [ENGINE\_NEWPAYLOAD\_MAX\_TXS\_EXECUTE](Config.md#engine_newpayload_max_txs_execute) -- [ENGINE\_PARENTLOOKUP\_MAX\_DEPTH](Config.md#engine_parentlookup_max_depth) -- [EXECUTION](Config.md#execution-1) -- [LIGHTSERV\_DEFAULT](Config.md#lightserv_default) -- [MAXFETCHERJOBS\_DEFAULT](Config.md#maxfetcherjobs_default) -- [MAXFETCHERREQUESTS\_DEFAULT](Config.md#maxfetcherrequests_default) -- [MAXPEERS\_DEFAULT](Config.md#maxpeers_default) -- [MAXPERREQUEST\_DEFAULT](Config.md#maxperrequest_default) -- [MAX\_ACCOUNT\_RANGE](Config.md#max_account_range) -- [MAX\_INVALID\_BLOCKS\_ERROR\_CACHE](Config.md#max_invalid_blocks_error_cache) -- [MAX\_RANGE\_BYTES](Config.md#max_range_bytes) -- [MAX\_STORAGE\_RANGE](Config.md#max_storage_range) -- [MINPEERS\_DEFAULT](Config.md#minpeers_default) -- [NUM\_BLOCKS\_PER\_ITERATION](Config.md#num_blocks_per_iteration) -- [PORT\_DEFAULT](Config.md#port_default) -- [PRUNE\_ENGINE\_CACHE](Config.md#prune_engine_cache) -- [SAFE\_REORG\_DISTANCE](Config.md#safe_reorg_distance) -- [SKELETON\_FILL\_CANONICAL\_BACKSTEP](Config.md#skeleton_fill_canonical_backstep) -- [SKELETON\_SUBCHAIN\_MERGE\_MINIMUM](Config.md#skeleton_subchain_merge_minimum) -- [SNAP\_AVAILABILITY\_DEPTH](Config.md#snap_availability_depth) -- [SNAP\_TRANSITION\_SAFE\_DEPTH](Config.md#snap_transition_safe_depth) -- [STORAGE\_CACHE](Config.md#storage_cache) -- [SYNCED\_STATE\_REMOVAL\_PERIOD](Config.md#synced_state_removal_period) -- [SYNCMODE\_DEFAULT](Config.md#syncmode_default) -- [TRIE\_CACHE](Config.md#trie_cache) - -### Methods - -- [getDataDirectory](Config.md#getdatadirectory) -- [getDnsDiscovery](Config.md#getdnsdiscovery) -- [getNetworkDirectory](Config.md#getnetworkdirectory) -- [superMsg](Config.md#supermsg) -- [updateSynchronizedState](Config.md#updatesynchronizedstate) -- [getClientKey](Config.md#getclientkey) -- [getConfigDB](Config.md#getconfigdb) +Defined in: [config.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L350) ## Constructors -### constructor +### Constructor + +> **new Config**(`options`): `Config` -• **new Config**(`options?`) +Defined in: [config.ts:476](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L476) #### Parameters -| Name | Type | -| :------ | :------ | -| `options` | [`ConfigOptions`](../interfaces/ConfigOptions.md) | +##### options -#### Defined in +[`ConfigOptions`](../interfaces/ConfigOptions.md) = `{}` -[config.ts:460](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L460) +#### Returns + +`Config` ## Properties ### accountCache -• `Readonly` **accountCache**: `number` - -#### Defined in +> `readonly` **accountCache**: `number` -[config.ts:410](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L410) +Defined in: [config.ts:419](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L419) -___ +*** ### accounts -• `Readonly` **accounts**: [address: Address, privKey: Uint8Array][] +> `readonly` **accounts**: \[`Address`, `Uint8Array`\<`ArrayBufferLike`\>\][] -#### Defined in +Defined in: [config.ts:428](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L428) -[config.ts:419](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L419) +*** -___ +### blobsAndProofsCacheBlocks -### bootnodes +> `readonly` **blobsAndProofsCacheBlocks**: `number` -• `Optional` `Readonly` **bootnodes**: `Multiaddr`[] +Defined in: [config.ts:458](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L458) -#### Defined in +*** -[config.ts:396](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L396) +### bootnodes? -___ +> `readonly` `optional` **bootnodes**: `Multiaddr`[] -### chainCommon +Defined in: [config.ts:405](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L405) -• `Readonly` **chainCommon**: `Common` +*** -#### Defined in +### chainCommon -[config.ts:455](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L455) +> `readonly` **chainCommon**: `Common` -___ +Defined in: [config.ts:469](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L469) -### codeCache +*** -• `Readonly` **codeCache**: `number` +### codeCache -#### Defined in +> `readonly` **codeCache**: `number` -[config.ts:412](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L412) +Defined in: [config.ts:421](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L421) -___ +*** ### datadir -• `Readonly` **datadir**: `string` - -#### Defined in +> `readonly` **datadir**: `string` -[config.ts:394](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L394) +Defined in: [config.ts:403](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L403) -___ +*** ### debugCode -• `Readonly` **debugCode**: `boolean` +> `readonly` **debugCode**: `boolean` -#### Defined in +Defined in: [config.ts:423](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L423) -[config.ts:414](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L414) - -___ +*** ### discDns -• `Readonly` **discDns**: `boolean` - -#### Defined in +> `readonly` **discDns**: `boolean` -[config.ts:415](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L415) +Defined in: [config.ts:424](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L424) -___ +*** ### discV4 -• `Readonly` **discV4**: `boolean` - -#### Defined in +> `readonly` **discV4**: `boolean` -[config.ts:416](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L416) +Defined in: [config.ts:425](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L425) -___ +*** ### dnsAddr -• `Readonly` **dnsAddr**: `string` +> `readonly` **dnsAddr**: `string` -#### Defined in +Defined in: [config.ts:416](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L416) -[config.ts:407](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L407) - -___ +*** ### enableSnapSync -• `Readonly` **enableSnapSync**: `boolean` - -#### Defined in +> `readonly` **enableSnapSync**: `boolean` -[config.ts:440](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L440) +Defined in: [config.ts:449](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L449) -___ +*** ### engineNewpayloadMaxExecute -• `Readonly` **engineNewpayloadMaxExecute**: `number` +> `readonly` **engineNewpayloadMaxExecute**: `number` -#### Defined in +Defined in: [config.ts:442](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L442) -[config.ts:433](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L433) - -___ +*** ### engineNewpayloadMaxTxsExecute -• `Readonly` **engineNewpayloadMaxTxsExecute**: `number` - -#### Defined in +> `readonly` **engineNewpayloadMaxTxsExecute**: `number` -[config.ts:434](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L434) +Defined in: [config.ts:443](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L443) -___ +*** ### engineParentLookupMaxDepth -• `Readonly` **engineParentLookupMaxDepth**: `number` - -#### Defined in +> `readonly` **engineParentLookupMaxDepth**: `number` -[config.ts:432](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L432) +Defined in: [config.ts:441](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L441) -___ +*** ### events -• `Readonly` **events**: `EventBusType` +> `readonly` **events**: `EventEmitter`\<`EventParams`\> + +Defined in: [config.ts:355](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L355) Central event bus for events emitted by the different components of the client -#### Defined in - -[config.ts:346](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L346) - -___ +*** ### execCommon -• `Readonly` **execCommon**: `Common` - -#### Defined in +> `readonly` **execCommon**: `Common` -[config.ts:456](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L456) +Defined in: [config.ts:470](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L470) -___ +*** ### execution -• `Readonly` **execution**: `boolean` +> `readonly` **execution**: `boolean` -#### Defined in +Defined in: [config.ts:417](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L417) -[config.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L408) +*** -___ +### extIP? -### extIP +> `readonly` `optional` **extIP**: `string` -• `Optional` `Readonly` **extIP**: `string` +Defined in: [config.ts:407](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L407) -#### Defined in +*** -[config.ts:398](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L398) +### ignoreStatelessInvalidExecs -___ +> `readonly` **ignoreStatelessInvalidExecs**: `boolean` -### isSingleNode +Defined in: [config.ts:456](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L456) -• `Readonly` **isSingleNode**: `boolean` +*** -#### Defined in +### isSingleNode -[config.ts:418](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L418) +> `readonly` **isSingleNode**: `boolean` -___ +Defined in: [config.ts:427](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L427) -### key +*** -• `Readonly` **key**: `Uint8Array` +### key -#### Defined in +> `readonly` **key**: `Uint8Array` -[config.ts:395](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L395) +Defined in: [config.ts:404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L404) -___ +*** ### lastSyncDate -• **lastSyncDate**: `number` - -lastSyncDate in ms - -#### Defined in - -[config.ts:449](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L449) +> **lastSyncDate**: `number` -___ +Defined in: [config.ts:463](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L463) -### lastsyncronized - -• `Optional` **lastsyncronized**: `boolean` - -#### Defined in - -[config.ts:447](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L447) - -___ +lastSyncDate in ms -### lightserv +*** -• `Readonly` **lightserv**: `boolean` +### lastSynchronized? -#### Defined in +> `optional` **lastSynchronized**: `boolean` -[config.ts:393](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L393) +Defined in: [config.ts:461](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L461) -___ +*** ### logger -• `Readonly` **logger**: `Logger` +> `readonly` **logger**: `undefined` \| `Logger` -#### Defined in +Defined in: [config.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L400) -[config.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L390) - -___ +*** ### maxAccountRange -• `Readonly` **maxAccountRange**: `bigint` - -#### Defined in +> `readonly` **maxAccountRange**: `bigint` -[config.ts:427](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L427) +Defined in: [config.ts:436](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L436) -___ +*** ### maxFetcherJobs -• `Readonly` **maxFetcherJobs**: `number` - -#### Defined in +> `readonly` **maxFetcherJobs**: `number` -[config.ts:403](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L403) +Defined in: [config.ts:412](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L412) -___ +*** ### maxFetcherRequests -• `Readonly` **maxFetcherRequests**: `number` +> `readonly` **maxFetcherRequests**: `number` -#### Defined in +Defined in: [config.ts:413](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L413) -[config.ts:404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L404) - -___ +*** ### maxInvalidBlocksErrorCache -• `Readonly` **maxInvalidBlocksErrorCache**: `number` - -#### Defined in +> `readonly` **maxInvalidBlocksErrorCache**: `number` -[config.ts:429](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L429) +Defined in: [config.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L438) -___ +*** ### maxPeers -• `Readonly` **maxPeers**: `number` +> `readonly` **maxPeers**: `number` -#### Defined in +Defined in: [config.ts:415](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L415) -[config.ts:406](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L406) - -___ +*** ### maxPerRequest -• `Readonly` **maxPerRequest**: `number` - -#### Defined in +> `readonly` **maxPerRequest**: `number` -[config.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L402) +Defined in: [config.ts:411](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L411) -___ +*** ### maxRangeBytes -• `Readonly` **maxRangeBytes**: `number` - -#### Defined in +> `readonly` **maxRangeBytes**: `number` -[config.ts:426](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L426) +Defined in: [config.ts:435](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L435) -___ +*** ### maxStorageRange -• `Readonly` **maxStorageRange**: `bigint` - -#### Defined in - -[config.ts:428](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L428) +> `readonly` **maxStorageRange**: `bigint` -___ +Defined in: [config.ts:437](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L437) -### minPeers +*** -• `Readonly` **minPeers**: `number` +### metrics -#### Defined in +> `readonly` **metrics**: `undefined` \| `PrometheusMetrics` -[config.ts:405](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L405) +Defined in: [config.ts:474](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L474) -___ +*** ### mine -• `Readonly` **mine**: `boolean` +> `readonly` **mine**: `boolean` -#### Defined in +Defined in: [config.ts:426](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L426) -[config.ts:417](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L417) +*** -___ +### minerCoinbase? -### minerCoinbase +> `readonly` `optional` **minerCoinbase**: `Address` -• `Optional` `Readonly` **minerCoinbase**: `Address` +Defined in: [config.ts:429](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L429) -#### Defined in +*** -[config.ts:420](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L420) +### minPeers -___ +> `readonly` **minPeers**: `number` -### multiaddrs +Defined in: [config.ts:414](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L414) -• `Optional` `Readonly` **multiaddrs**: `Multiaddr`[] +*** -#### Defined in +### multiaddrs? -[config.ts:399](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L399) +> `readonly` `optional` **multiaddrs**: `Multiaddr`[] -___ +Defined in: [config.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L408) -### numBlocksPerIteration +*** -• `Readonly` **numBlocksPerIteration**: `number` - -#### Defined in +### numBlocksPerIteration -[config.ts:409](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L409) +> `readonly` **numBlocksPerIteration**: `number` -___ +Defined in: [config.ts:418](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L418) -### port +*** -• `Optional` `Readonly` **port**: `number` +### port? -#### Defined in +> `readonly` `optional` **port**: `number` -[config.ts:397](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L397) +Defined in: [config.ts:406](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L406) -___ +*** ### prefixStorageTrieKeys -• `Readonly` **prefixStorageTrieKeys**: `boolean` +> `readonly` **prefixStorageTrieKeys**: `boolean` -#### Defined in +Defined in: [config.ts:447](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L447) -[config.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L438) - -___ +*** ### pruneEngineCache -• `Readonly` **pruneEngineCache**: `boolean` - -#### Defined in +> `readonly` **pruneEngineCache**: `boolean` -[config.ts:430](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L430) +Defined in: [config.ts:439](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L439) -___ +*** ### safeReorgDistance -• `Readonly` **safeReorgDistance**: `number` - -#### Defined in +> `readonly` **safeReorgDistance**: `number` -[config.ts:423](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L423) +Defined in: [config.ts:432](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L432) -___ +*** ### savePreimages -• `Readonly` **savePreimages**: `boolean` +> `readonly` **savePreimages**: `boolean` -#### Defined in +Defined in: [config.ts:451](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L451) -[config.ts:442](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L442) - -___ +*** ### saveReceipts -• `Readonly` **saveReceipts**: `boolean` - -#### Defined in +> `readonly` **saveReceipts**: `boolean` -[config.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L400) +Defined in: [config.ts:409](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L409) -___ +*** ### server -• `Readonly` **server**: `undefined` \| `RlpxServer` = `undefined` +> `readonly` **server**: `undefined` \| `RlpxServer` = `undefined` -#### Defined in +Defined in: [config.ts:472](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L472) -[config.ts:458](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L458) - -___ +*** ### shutdown -• **shutdown**: `boolean` = `false` - -Client is in the process of shutting down +> **shutdown**: `boolean` = `false` -#### Defined in +Defined in: [config.ts:467](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L467) -[config.ts:453](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L453) +Client is in the process of shutting down -___ +*** ### skeletonFillCanonicalBackStep -• `Readonly` **skeletonFillCanonicalBackStep**: `number` - -#### Defined in +> `readonly` **skeletonFillCanonicalBackStep**: `number` -[config.ts:424](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L424) +Defined in: [config.ts:433](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L433) -___ +*** ### skeletonSubchainMergeMinimum -• `Readonly` **skeletonSubchainMergeMinimum**: `number` +> `readonly` **skeletonSubchainMergeMinimum**: `number` -#### Defined in +Defined in: [config.ts:434](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L434) -[config.ts:425](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L425) - -___ +*** ### snapAvailabilityDepth -• `Readonly` **snapAvailabilityDepth**: `bigint` - -#### Defined in +> `readonly` **snapAvailabilityDepth**: `bigint` -[config.ts:435](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L435) +Defined in: [config.ts:444](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L444) -___ +*** ### snapTransitionSafeDepth -• `Readonly` **snapTransitionSafeDepth**: `bigint` +> `readonly` **snapTransitionSafeDepth**: `bigint` -#### Defined in +Defined in: [config.ts:445](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L445) -[config.ts:436](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L436) +*** -___ +### startExecution -### statelessVerkle +> `readonly` **startExecution**: `boolean` -• `Readonly` **statelessVerkle**: `boolean` +Defined in: [config.ts:455](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L455) -#### Defined in +*** -[config.ts:444](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L444) +### statefulVerkle -___ - -### storageCache +> `readonly` **statefulVerkle**: `boolean` -• `Readonly` **storageCache**: `number` +Defined in: [config.ts:454](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L454) -#### Defined in +*** -[config.ts:411](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L411) +### statelessVerkle -___ +> `readonly` **statelessVerkle**: `boolean` -### syncTargetHeight +Defined in: [config.ts:453](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L453) -• `Optional` **syncTargetHeight**: `bigint` +*** -Best known block height +### storageCache -#### Defined in +> `readonly` **storageCache**: `number` -[config.ts:451](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L451) +Defined in: [config.ts:420](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L420) -___ +*** ### syncedStateRemovalPeriod -• `Readonly` **syncedStateRemovalPeriod**: `number` +> `readonly` **syncedStateRemovalPeriod**: `number` -#### Defined in +Defined in: [config.ts:440](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L440) -[config.ts:431](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L431) - -___ +*** ### synchronized -• **synchronized**: `boolean` - -#### Defined in +> **synchronized**: `boolean` -[config.ts:446](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L446) +Defined in: [config.ts:460](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L460) -___ +*** ### syncmode -• `Readonly` **syncmode**: [`SyncMode`](../enums/SyncMode.md) +> `readonly` **syncmode**: [`SyncMode`](../type-aliases/SyncMode.md) -#### Defined in +Defined in: [config.ts:401](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L401) -[config.ts:391](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L391) +*** -___ +### syncTargetHeight? -### trieCache +> `optional` **syncTargetHeight**: `bigint` -• `Readonly` **trieCache**: `number` +Defined in: [config.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L465) -#### Defined in +Best known block height -[config.ts:413](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L413) +*** -___ +### trieCache -### txLookupLimit +> `readonly` **trieCache**: `number` + +Defined in: [config.ts:422](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L422) -• `Readonly` **txLookupLimit**: `number` +*** -#### Defined in +### txLookupLimit + +> `readonly` **txLookupLimit**: `number` -[config.ts:401](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L401) +Defined in: [config.ts:410](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L410) -___ +*** ### useStringValueTrieDB -• `Readonly` **useStringValueTrieDB**: `boolean` +> `readonly` **useStringValueTrieDB**: `boolean` -#### Defined in +Defined in: [config.ts:450](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L450) -[config.ts:441](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L441) +*** -___ +### vm? -### vm +> `readonly` `optional` **vm**: `VM` -• `Optional` `Readonly` **vm**: `VM` +Defined in: [config.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L402) -#### Defined in +*** -[config.ts:392](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L392) +### vmProfilerOpts? -___ +> `readonly` `optional` **vmProfilerOpts**: `VMProfilerOpts` -### vmProfilerOpts +Defined in: [config.ts:430](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L430) -• `Optional` `Readonly` **vmProfilerOpts**: `VMProfilerOpts` +*** -#### Defined in +### ACCOUNT\_CACHE -[config.ts:421](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L421) +> `readonly` `static` **ACCOUNT\_CACHE**: `400000` = `400000` -___ +Defined in: [config.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L369) -### ACCOUNT\_CACHE +*** -▪ `Static` `Readonly` **ACCOUNT\_CACHE**: ``400000`` +### BLOBS\_AND\_PROOFS\_CACHE\_BLOCKS -#### Defined in +> `readonly` `static` **BLOBS\_AND\_PROOFS\_CACHE\_BLOCKS**: `32` = `32` -[config.ts:361](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L361) +Defined in: [config.ts:398](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L398) -___ +*** ### CHAIN\_DEFAULT -▪ `Static` `Readonly` **CHAIN\_DEFAULT**: ``"mainnet"`` - -#### Defined in +> `readonly` `static` **CHAIN\_DEFAULT**: `ChainConfig` = `Mainnet` -[config.ts:348](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L348) +Defined in: [config.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L357) -___ +*** ### CODE\_CACHE -▪ `Static` `Readonly` **CODE\_CACHE**: ``200000`` +> `readonly` `static` **CODE\_CACHE**: `200000` = `200000` -#### Defined in +Defined in: [config.ts:371](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L371) -[config.ts:363](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L363) - -___ +*** ### DATADIR\_DEFAULT -▪ `Static` `Readonly` **DATADIR\_DEFAULT**: ``"./datadir"`` - -#### Defined in +> `readonly` `static` **DATADIR\_DEFAULT**: `"./datadir"` -[config.ts:351](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L351) +Defined in: [config.ts:359](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L359) -___ +*** ### DEBUGCODE\_DEFAULT -▪ `Static` `Readonly` **DEBUGCODE\_DEFAULT**: ``false`` - -#### Defined in +> `readonly` `static` **DEBUGCODE\_DEFAULT**: `false` = `false` -[config.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L365) +Defined in: [config.ts:373](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L373) -___ +*** ### DNSADDR\_DEFAULT -▪ `Static` `Readonly` **DNSADDR\_DEFAULT**: ``"8.8.8.8"`` +> `readonly` `static` **DNSADDR\_DEFAULT**: `"8.8.8.8"` = `'8.8.8.8'` -#### Defined in +Defined in: [config.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L366) -[config.ts:358](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L358) - -___ +*** ### ENGINE\_NEWPAYLOAD\_MAX\_EXECUTE -▪ `Static` `Readonly` **ENGINE\_NEWPAYLOAD\_MAX\_EXECUTE**: ``2`` - -#### Defined in +> `readonly` `static` **ENGINE\_NEWPAYLOAD\_MAX\_EXECUTE**: `2` = `2` -[config.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L382) +Defined in: [config.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L390) -___ +*** ### ENGINE\_NEWPAYLOAD\_MAX\_TXS\_EXECUTE -▪ `Static` `Readonly` **ENGINE\_NEWPAYLOAD\_MAX\_TXS\_EXECUTE**: ``100`` +> `readonly` `static` **ENGINE\_NEWPAYLOAD\_MAX\_TXS\_EXECUTE**: `200` = `200` -#### Defined in +Defined in: [config.ts:391](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L391) -[config.ts:384](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L384) +*** -___ +### ENGINE\_PARENT\_LOOKUP\_MAX\_DEPTH -### ENGINE\_PARENTLOOKUP\_MAX\_DEPTH +> `readonly` `static` **ENGINE\_PARENT\_LOOKUP\_MAX\_DEPTH**: `128` = `128` -▪ `Static` `Readonly` **ENGINE\_PARENTLOOKUP\_MAX\_DEPTH**: ``128`` +Defined in: [config.ts:389](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L389) -#### Defined in - -[config.ts:381](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L381) - -___ +*** ### EXECUTION -▪ `Static` `Readonly` **EXECUTION**: ``true`` - -#### Defined in - -[config.ts:359](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L359) - -___ - -### LIGHTSERV\_DEFAULT - -▪ `Static` `Readonly` **LIGHTSERV\_DEFAULT**: ``false`` - -#### Defined in - -[config.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L350) - -___ - -### MAXFETCHERJOBS\_DEFAULT - -▪ `Static` `Readonly` **MAXFETCHERJOBS\_DEFAULT**: ``100`` - -#### Defined in - -[config.ts:354](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L354) +> `readonly` `static` **EXECUTION**: `true` = `true` -___ +Defined in: [config.ts:367](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L367) -### MAXFETCHERREQUESTS\_DEFAULT - -▪ `Static` `Readonly` **MAXFETCHERREQUESTS\_DEFAULT**: ``5`` - -#### Defined in +*** -[config.ts:355](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L355) +### MAX\_ACCOUNT\_RANGE -___ +> `readonly` `static` **MAX\_ACCOUNT\_RANGE**: `bigint` -### MAXPEERS\_DEFAULT +Defined in: [config.ts:380](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L380) -▪ `Static` `Readonly` **MAXPEERS\_DEFAULT**: ``25`` +*** -#### Defined in +### MAX\_INVALID\_BLOCKS\_ERROR\_CACHE -[config.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L357) +> `readonly` `static` **MAX\_INVALID\_BLOCKS\_ERROR\_CACHE**: `128` = `128` -___ +Defined in: [config.ts:384](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L384) -### MAXPERREQUEST\_DEFAULT +*** -▪ `Static` `Readonly` **MAXPERREQUEST\_DEFAULT**: ``100`` +### MAX\_RANGE\_BYTES -#### Defined in +> `readonly` `static` **MAX\_RANGE\_BYTES**: `50000` = `50000` -[config.ts:353](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L353) +Defined in: [config.ts:378](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L378) -___ +*** -### MAX\_ACCOUNT\_RANGE +### MAX\_STORAGE\_RANGE -▪ `Static` `Readonly` **MAX\_ACCOUNT\_RANGE**: `bigint` +> `readonly` `static` **MAX\_STORAGE\_RANGE**: `bigint` -#### Defined in +Defined in: [config.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L382) -[config.ts:372](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L372) +*** -___ +### MAXFETCHERJOBS\_DEFAULT -### MAX\_INVALID\_BLOCKS\_ERROR\_CACHE +> `readonly` `static` **MAXFETCHERJOBS\_DEFAULT**: `100` = `100` -▪ `Static` `Readonly` **MAX\_INVALID\_BLOCKS\_ERROR\_CACHE**: ``128`` +Defined in: [config.ts:362](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L362) -#### Defined in +*** -[config.ts:376](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L376) +### MAXFETCHERREQUESTS\_DEFAULT -___ +> `readonly` `static` **MAXFETCHERREQUESTS\_DEFAULT**: `5` = `5` -### MAX\_RANGE\_BYTES +Defined in: [config.ts:363](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L363) -▪ `Static` `Readonly` **MAX\_RANGE\_BYTES**: ``50000`` +*** -#### Defined in +### MAXPEERS\_DEFAULT -[config.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L370) +> `readonly` `static` **MAXPEERS\_DEFAULT**: `25` = `25` -___ +Defined in: [config.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L365) -### MAX\_STORAGE\_RANGE +*** -▪ `Static` `Readonly` **MAX\_STORAGE\_RANGE**: `bigint` +### MAXPERREQUEST\_DEFAULT -#### Defined in +> `readonly` `static` **MAXPERREQUEST\_DEFAULT**: `100` = `100` -[config.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L374) +Defined in: [config.ts:361](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L361) -___ +*** ### MINPEERS\_DEFAULT -▪ `Static` `Readonly` **MINPEERS\_DEFAULT**: ``1`` - -#### Defined in +> `readonly` `static` **MINPEERS\_DEFAULT**: `1` = `1` -[config.ts:356](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L356) +Defined in: [config.ts:364](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L364) -___ +*** ### NUM\_BLOCKS\_PER\_ITERATION -▪ `Static` `Readonly` **NUM\_BLOCKS\_PER\_ITERATION**: ``100`` +> `readonly` `static` **NUM\_BLOCKS\_PER\_ITERATION**: `100` = `100` -#### Defined in +Defined in: [config.ts:368](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L368) -[config.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L360) - -___ +*** ### PORT\_DEFAULT -▪ `Static` `Readonly` **PORT\_DEFAULT**: ``30303`` - -#### Defined in +> `readonly` `static` **PORT\_DEFAULT**: `30303` = `30303` -[config.ts:352](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L352) +Defined in: [config.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L360) -___ +*** ### PRUNE\_ENGINE\_CACHE -▪ `Static` `Readonly` **PRUNE\_ENGINE\_CACHE**: ``true`` +> `readonly` `static` **PRUNE\_ENGINE\_CACHE**: `true` = `true` -#### Defined in +Defined in: [config.ts:385](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L385) -[config.ts:377](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L377) - -___ +*** ### SAFE\_REORG\_DISTANCE -▪ `Static` `Readonly` **SAFE\_REORG\_DISTANCE**: ``100`` - -#### Defined in +> `readonly` `static` **SAFE\_REORG\_DISTANCE**: `100` = `100` -[config.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L366) +Defined in: [config.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L374) -___ +*** ### SKELETON\_FILL\_CANONICAL\_BACKSTEP -▪ `Static` `Readonly` **SKELETON\_FILL\_CANONICAL\_BACKSTEP**: ``100`` - -#### Defined in +> `readonly` `static` **SKELETON\_FILL\_CANONICAL\_BACKSTEP**: `100` = `100` -[config.ts:367](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L367) +Defined in: [config.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L375) -___ +*** ### SKELETON\_SUBCHAIN\_MERGE\_MINIMUM -▪ `Static` `Readonly` **SKELETON\_SUBCHAIN\_MERGE\_MINIMUM**: ``1000`` +> `readonly` `static` **SKELETON\_SUBCHAIN\_MERGE\_MINIMUM**: `1000` = `1000` -#### Defined in +Defined in: [config.ts:376](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L376) -[config.ts:368](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L368) - -___ +*** ### SNAP\_AVAILABILITY\_DEPTH -▪ `Static` `Readonly` **SNAP\_AVAILABILITY\_DEPTH**: `bigint` - -#### Defined in +> `readonly` `static` **SNAP\_AVAILABILITY\_DEPTH**: `bigint` -[config.ts:385](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L385) +Defined in: [config.ts:392](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L392) -___ +*** ### SNAP\_TRANSITION\_SAFE\_DEPTH -▪ `Static` `Readonly` **SNAP\_TRANSITION\_SAFE\_DEPTH**: `bigint` +> `readonly` `static` **SNAP\_TRANSITION\_SAFE\_DEPTH**: `bigint` -#### Defined in +Defined in: [config.ts:395](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L395) -[config.ts:388](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L388) - -___ +*** ### STORAGE\_CACHE -▪ `Static` `Readonly` **STORAGE\_CACHE**: ``200000`` - -#### Defined in +> `readonly` `static` **STORAGE\_CACHE**: `200000` = `200000` -[config.ts:362](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L362) +Defined in: [config.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L370) -___ +*** ### SYNCED\_STATE\_REMOVAL\_PERIOD -▪ `Static` `Readonly` **SYNCED\_STATE\_REMOVAL\_PERIOD**: ``60000`` - -#### Defined in +> `readonly` `static` **SYNCED\_STATE\_REMOVAL\_PERIOD**: `60000` = `60000` -[config.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L379) +Defined in: [config.ts:387](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L387) -___ +*** ### SYNCMODE\_DEFAULT -▪ `Static` `Readonly` **SYNCMODE\_DEFAULT**: [`Full`](../enums/SyncMode.md#full) = `SyncMode.Full` +> `readonly` `static` **SYNCMODE\_DEFAULT**: `"full"` = `SyncMode.Full` -#### Defined in +Defined in: [config.ts:358](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L358) -[config.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L349) - -___ +*** ### TRIE\_CACHE -▪ `Static` `Readonly` **TRIE\_CACHE**: ``200000`` - -#### Defined in +> `readonly` `static` **TRIE\_CACHE**: `200000` = `200000` -[config.ts:364](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L364) +Defined in: [config.ts:372](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L372) ## Methods -### getDataDirectory +### getDataDirectory() -▸ **getDataDirectory**(`dir`): `string` +> **getDataDirectory**(`dir`): `string` -Returns the location for each [DataDirectory](../enums/DataDirectory.md) +Defined in: [config.ts:664](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L664) + +Returns the location for each [DataDirectory](../variables/DataDirectory.md) #### Parameters -| Name | Type | -| :------ | :------ | -| `dir` | [`DataDirectory`](../enums/DataDirectory.md) | +##### dir + +[`DataDirectory`](../type-aliases/DataDirectory.md) #### Returns `string` -#### Defined in - -[config.ts:637](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L637) +*** -___ +### getDnsDiscovery() -### getDnsDiscovery +> **getDnsDiscovery**(`option`): `boolean` -▸ **getDnsDiscovery**(`option`): `boolean` +Defined in: [config.ts:725](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L725) Returns specified option or the default setting for whether DNS-based peer discovery -is enabled based on chainName. `true` for goerli +is enabled based on chainName. #### Parameters -| Name | Type | -| :------ | :------ | -| `option` | `undefined` \| `boolean` | +##### option + +`undefined` | `boolean` #### Returns `boolean` -#### Defined in +*** + +### getInvalidPayloadsDir() + +> **getInvalidPayloadsDir**(): `string` + +Defined in: [config.ts:657](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L657) + +#### Returns + +`string` -[config.ts:698](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L698) +*** -___ +### getNetworkDirectory() -### getNetworkDirectory +> **getNetworkDirectory**(): `string` -▸ **getNetworkDirectory**(): `string` +Defined in: [config.ts:652](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L652) Returns the network directory for the chain. @@ -1115,99 +870,96 @@ Returns the network directory for the chain. `string` -#### Defined in - -[config.ts:629](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L629) +*** -___ +### superMsg() -### superMsg +> **superMsg**(`msgs`, `meta?`): `void` -▸ **superMsg**(`msgs`, `meta?`): `void` +Defined in: [config.ts:706](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L706) #### Parameters -| Name | Type | -| :------ | :------ | -| `msgs` | `string` \| `string`[] | -| `meta?` | `any` | +##### msgs + +`string` | `string`[] + +##### meta? + +`any` #### Returns `void` -#### Defined in +*** -[config.ts:679](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L679) +### updateSynchronizedState() -___ +> **updateSynchronizedState**(`latest?`, `emitSyncEvent?`): `void` -### updateSynchronizedState - -▸ **updateSynchronizedState**(`latest?`, `emitSyncEvent?`): `void` +Defined in: [config.ts:593](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L593) Update the synchronized state of the chain -**`Emits`** +#### Parameters -Event.SYNC_SYNCHRONIZED +##### latest? -#### Parameters +`null` | `BlockHeader` -| Name | Type | -| :------ | :------ | -| `latest?` | ``null`` \| `BlockHeader` | -| `emitSyncEvent?` | `boolean` | +##### emitSyncEvent? + +`boolean` #### Returns `void` -#### Defined in +#### Emits -[config.ts:570](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L570) +Event.SYNC\_SYNCHRONIZED -___ +*** -### getClientKey +### getClientKey() -▸ `Static` **getClientKey**(`datadir`, `common`): `Promise`<`undefined` \| `Uint8Array`\> +> `static` **getClientKey**(`datadir`, `common`): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [config.ts:688](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L688) Gets the client private key from the config db. #### Parameters -| Name | Type | -| :------ | :------ | -| `datadir` | `string` | -| `common` | `Common` | +##### datadir -#### Returns +`string` + +##### common + +`Common` -`Promise`<`undefined` \| `Uint8Array`\> +#### Returns -#### Defined in +`Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> -[config.ts:661](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L661) +*** -___ +### getConfigDB() -### getConfigDB +> `static` **getConfigDB**(`networkDir`): `Level`\<`string` \| `Uint8Array`\<`ArrayBufferLike`\>, `Uint8Array`\<`ArrayBufferLike`\>\> -▸ `Static` **getConfigDB**(`networkDir`): `Level`<`string` \| `Uint8Array`, `Uint8Array`\> +Defined in: [config.ts:681](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L681) Returns the config level db. #### Parameters -| Name | Type | -| :------ | :------ | -| `networkDir` | `string` | - -#### Returns +##### networkDir -`Level`<`string` \| `Uint8Array`, `Uint8Array`\> +`string` -#### Defined in +#### Returns -[config.ts:654](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L654) +`Level`\<`string` \| `Uint8Array`\<`ArrayBufferLike`\>, `Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/client/docs/classes/EthereumClient.md b/packages/client/docs/classes/EthereumClient.md new file mode 100644 index 00000000000..fa4198e90ba --- /dev/null +++ b/packages/client/docs/classes/EthereumClient.md @@ -0,0 +1,135 @@ +[**@ethereumjs/client**](../README.md) + +*** + +[@ethereumjs/client](../README.md) / EthereumClient + +# Class: EthereumClient + +Defined in: [client.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L67) + +Represents the top-level ethereum node, and is responsible for managing the +lifecycle of included services. + +## Memberof + +module:node + +## Properties + +### chain + +> **chain**: `Chain` + +Defined in: [client.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L69) + +*** + +### config + +> **config**: [`Config`](Config.md) + +Defined in: [client.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L68) + +*** + +### opened + +> **opened**: `boolean` + +Defined in: [client.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L72) + +*** + +### service + +> **service**: `FullEthereumService` + +Defined in: [client.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L70) + +*** + +### started + +> **started**: `boolean` + +Defined in: [client.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L73) + +## Methods + +### open() + +> **open**(): `Promise`\<`undefined` \| `false`\> + +Defined in: [client.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L106) + +Open node. Must be called before node is started + +#### Returns + +`Promise`\<`undefined` \| `false`\> + +*** + +### server() + +> **server**(): `undefined` \| `RlpxServer` + +Defined in: [client.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L165) + +#### Returns + +`undefined` \| `RlpxServer` + +the RLPx server (if it exists) + +*** + +### start() + +> **start**(): `Promise`\<`undefined` \| `false`\> + +Defined in: [client.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L134) + +Starts node and all services and network servers. + +#### Returns + +`Promise`\<`undefined` \| `false`\> + +*** + +### stop() + +> **stop**(): `Promise`\<`undefined` \| `false`\> + +Defined in: [client.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L151) + +Stops node and all services and network servers. + +#### Returns + +`Promise`\<`undefined` \| `false`\> + +*** + +### create() + +> `static` **create**(`options`): `Promise`\<`EthereumClient`\> + +Defined in: [client.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/client.ts#L81) + +Main entrypoint for client initialization. + +Safe creation of a Chain object awaiting the initialization +of the underlying Blockchain object. + +#### Parameters + +##### options + +`EthereumClientOptions` + +#### Returns + +`Promise`\<`EthereumClient`\> diff --git a/packages/client/docs/enums/SyncMode.md b/packages/client/docs/enums/SyncMode.md deleted file mode 100644 index 1f9fac307c8..00000000000 --- a/packages/client/docs/enums/SyncMode.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/client](../README.md) / SyncMode - -# Enumeration: SyncMode - -## Table of contents - -### Enumeration Members - -- [Full](SyncMode.md#full) -- [Light](SyncMode.md#light) -- [None](SyncMode.md#none) - -## Enumeration Members - -### Full - -• **Full** = ``"full"`` - -#### Defined in - -[config.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L24) - -___ - -### Light - -• **Light** = ``"light"`` - -#### Defined in - -[config.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L25) - -___ - -### None - -• **None** = ``"none"`` - -#### Defined in - -[config.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L26) diff --git a/packages/client/docs/interfaces/ConfigOptions.md b/packages/client/docs/interfaces/ConfigOptions.md index 2c034912a90..c72c3e16c32 100644 --- a/packages/client/docs/interfaces/ConfigOptions.md +++ b/packages/client/docs/interfaces/ConfigOptions.md @@ -1,151 +1,97 @@ +[**@ethereumjs/client**](../README.md) + +*** + [@ethereumjs/client](../README.md) / ConfigOptions # Interface: ConfigOptions -## Table of contents - -### Properties - -- [accountCache](ConfigOptions.md#accountcache) -- [accounts](ConfigOptions.md#accounts) -- [bootnodes](ConfigOptions.md#bootnodes) -- [codeCache](ConfigOptions.md#codecache) -- [common](ConfigOptions.md#common) -- [datadir](ConfigOptions.md#datadir) -- [debugCode](ConfigOptions.md#debugcode) -- [discDns](ConfigOptions.md#discdns) -- [discV4](ConfigOptions.md#discv4) -- [dnsAddr](ConfigOptions.md#dnsaddr) -- [dnsNetworks](ConfigOptions.md#dnsnetworks) -- [enableSnapSync](ConfigOptions.md#enablesnapsync) -- [engineNewpayloadMaxExecute](ConfigOptions.md#enginenewpayloadmaxexecute) -- [engineNewpayloadMaxTxsExecute](ConfigOptions.md#enginenewpayloadmaxtxsexecute) -- [engineParentLookupMaxDepth](ConfigOptions.md#engineparentlookupmaxdepth) -- [execution](ConfigOptions.md#execution) -- [extIP](ConfigOptions.md#extip) -- [isSingleNode](ConfigOptions.md#issinglenode) -- [key](ConfigOptions.md#key) -- [lightserv](ConfigOptions.md#lightserv) -- [logger](ConfigOptions.md#logger) -- [maxAccountRange](ConfigOptions.md#maxaccountrange) -- [maxFetcherJobs](ConfigOptions.md#maxfetcherjobs) -- [maxFetcherRequests](ConfigOptions.md#maxfetcherrequests) -- [maxInvalidBlocksErrorCache](ConfigOptions.md#maxinvalidblockserrorcache) -- [maxPeers](ConfigOptions.md#maxpeers) -- [maxPerRequest](ConfigOptions.md#maxperrequest) -- [maxRangeBytes](ConfigOptions.md#maxrangebytes) -- [maxStorageRange](ConfigOptions.md#maxstoragerange) -- [minPeers](ConfigOptions.md#minpeers) -- [mine](ConfigOptions.md#mine) -- [minerCoinbase](ConfigOptions.md#minercoinbase) -- [multiaddrs](ConfigOptions.md#multiaddrs) -- [numBlocksPerIteration](ConfigOptions.md#numblocksperiteration) -- [port](ConfigOptions.md#port) -- [prefixStorageTrieKeys](ConfigOptions.md#prefixstoragetriekeys) -- [pruneEngineCache](ConfigOptions.md#pruneenginecache) -- [safeReorgDistance](ConfigOptions.md#safereorgdistance) -- [savePreimages](ConfigOptions.md#savepreimages) -- [saveReceipts](ConfigOptions.md#savereceipts) -- [server](ConfigOptions.md#server) -- [skeletonFillCanonicalBackStep](ConfigOptions.md#skeletonfillcanonicalbackstep) -- [skeletonSubchainMergeMinimum](ConfigOptions.md#skeletonsubchainmergeminimum) -- [snapAvailabilityDepth](ConfigOptions.md#snapavailabilitydepth) -- [snapTransitionSafeDepth](ConfigOptions.md#snaptransitionsafedepth) -- [statelessVerkle](ConfigOptions.md#statelessverkle) -- [storageCache](ConfigOptions.md#storagecache) -- [syncedStateRemovalPeriod](ConfigOptions.md#syncedstateremovalperiod) -- [syncmode](ConfigOptions.md#syncmode) -- [trieCache](ConfigOptions.md#triecache) -- [txLookupLimit](ConfigOptions.md#txlookuplimit) -- [useStringValueTrieDB](ConfigOptions.md#usestringvaluetriedb) -- [vm](ConfigOptions.md#vm) -- [vmProfileBlocks](ConfigOptions.md#vmprofileblocks) -- [vmProfileTxs](ConfigOptions.md#vmprofiletxs) +Defined in: [config.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L32) ## Properties -### accountCache +### accountCache? -• `Optional` **accountCache**: `number` +> `optional` **accountCache**: `number` -Size for the account cache (max number of accounts) +Defined in: [config.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L195) -#### Defined in +Size for the account cache (max number of accounts) -[config.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L199) +*** -___ +### accounts? -### accounts +> `optional` **accounts**: \[`Address`, `Uint8Array`\<`ArrayBufferLike`\>\][] -• `Optional` **accounts**: [address: Address, privKey: Uint8Array][] +Defined in: [config.ts:265](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L265) Unlocked accounts of form [address, privateKey] Currently only the first account is used to seal mined PoA blocks Default: [] -#### Defined in +*** + +### blobsAndProofsCacheBlocks? + +> `optional` **blobsAndProofsCacheBlocks**: `number` -[config.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L269) +Defined in: [config.ts:342](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L342) -___ +The cache for blobs and proofs to support CL import blocks -### bootnodes +*** -• `Optional` **bootnodes**: `Multiaddr`[] +### bootnodes? + +> `optional` **bootnodes**: `Multiaddr`[] + +Defined in: [config.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L92) Network bootnodes (e.g. abc@18.138.108.67 or /ip4/127.0.0.1/tcp/50505/p2p/QmABC) -#### Defined in - -[config.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L96) +*** -___ +### codeCache? -### codeCache +> `optional` **codeCache**: `number` -• `Optional` **codeCache**: `number` +Defined in: [config.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L205) Size for the code cache (max number of contracts) -#### Defined in +*** -[config.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L209) +### common? -___ +> `optional` **common**: `Common` -### common - -• `Optional` **common**: `Common` +Defined in: [config.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L39) Specify the chain by providing a Common instance, the common instance will not be modified by client Default: 'mainnet' Common -#### Defined in - -[config.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L36) +*** -___ +### datadir? -### datadir +> `optional` **datadir**: `string` -• `Optional` **datadir**: `string` +Defined in: [config.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L79) Root data directory for the blockchain -#### Defined in +*** -[config.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L83) +### debugCode? -___ +> `optional` **debugCode**: `boolean` -### debugCode - -• `Optional` **debugCode**: `boolean` +Defined in: [config.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L219) Generate code for local debugging, currently providing a code snippet which can be used to run blocks on the @@ -153,616 +99,538 @@ EthereumJS VM on execution errors (meant to be used internally for the most part) -#### Defined in - -[config.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L223) +*** -___ +### discDns? -### discDns +> `optional` **discDns**: `boolean` -• `Optional` **discDns**: `boolean` +Defined in: [config.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L226) Query EIP-1459 DNS TXT records for peer discovery Default: `true` for testnets, false for mainnet -#### Defined in - -[config.ts:230](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L230) +*** -___ +### discV4? -### discV4 +> `optional` **discV4**: `boolean` -• `Optional` **discV4**: `boolean` +Defined in: [config.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L233) Use v4 ("findneighbour" node requests) for peer discovery Default: `false` for testnets, true for mainnet -#### Defined in +*** -[config.ts:237](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L237) +### dnsAddr? -___ +> `optional` **dnsAddr**: `string` -### dnsAddr - -• `Optional` **dnsAddr**: `string` +Defined in: [config.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L175) DNS server to query DNS TXT records from for peer discovery Default `8.8.8.8` (Google) -#### Defined in - -[config.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L179) +*** -___ +### dnsNetworks? -### dnsNetworks +> `optional` **dnsNetworks**: `string`[] -• `Optional` **dnsNetworks**: `string`[] +Defined in: [config.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L180) EIP-1459 ENR Tree urls to query via DNS for peer discovery -#### Defined in - -[config.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L184) +*** -___ +### enableSnapSync? -### enableSnapSync +> `optional` **enableSnapSync**: `boolean` -• `Optional` **enableSnapSync**: `boolean` +Defined in: [config.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L53) Whether to enable and run snapSync, currently experimental Default: false -#### Defined in +*** -[config.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L50) +### engineNewpayloadMaxExecute? -___ +> `optional` **engineNewpayloadMaxExecute**: `number` -### engineNewpayloadMaxExecute - -• `Optional` **engineNewpayloadMaxExecute**: `number` +Defined in: [config.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L309) Max blocks including unexecuted parents to be executed in engine's newPayload -#### Defined in - -[config.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L313) +*** -___ +### engineNewpayloadMaxTxsExecute? -### engineNewpayloadMaxTxsExecute +> `optional` **engineNewpayloadMaxTxsExecute**: `number` -• `Optional` **engineNewpayloadMaxTxsExecute**: `number` +Defined in: [config.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L314) Limit max transactions per block to execute in engine's newPayload for responsive engine api -#### Defined in - -[config.ts:318](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L318) +*** -___ +### engineParentLookupMaxDepth? -### engineParentLookupMaxDepth +> `optional` **engineParentLookupMaxDepth**: `number` -• `Optional` **engineParentLookupMaxDepth**: `number` +Defined in: [config.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L304) Max depth for parent lookups in engine's newPayload and forkchoiceUpdated -#### Defined in +*** -[config.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L308) +### execution? -___ +> `optional` **execution**: `boolean` -### execution - -• `Optional` **execution**: `boolean` +Defined in: [config.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L185) Start continuous VM execution (pre-Merge setting) -#### Defined in - -[config.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L189) +*** -___ +### extIP? -### extIP +> `optional` **extIP**: `string` -• `Optional` **extIP**: `string` +Defined in: [config.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L104) RLPx external IP -#### Defined in +*** -[config.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L108) +### ignoreStatelessInvalidExecs? -___ +> `optional` **ignoreStatelessInvalidExecs**: `boolean` -### isSingleNode +Defined in: [config.ts:337](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L337) -• `Optional` **isSingleNode**: `boolean` +*** + +### isSingleNode? + +> `optional` **isSingleNode**: `boolean` + +Defined in: [config.ts:247](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L247) Is a single node and doesn't need peers for synchronization Default: `false` -#### Defined in +*** -[config.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L251) +### key? -___ +> `optional` **key**: `Uint8Array`\<`ArrayBufferLike`\> -### key - -• `Optional` **key**: `Uint8Array` +Defined in: [config.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L86) Private key for the client. -Use return value of [getClientKey](../classes/Config.md#getclientkey). +Use return value of [Config.getClientKey](../classes/Config.md#getclientkey). If left blank, a random key will be generated and used. -#### Defined in - -[config.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L90) - -___ - -### lightserv - -• `Optional` **lightserv**: `boolean` - -Serve light peer requests - -Default: `false` +*** -#### Defined in +### logger? -[config.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L78) +> `optional` **logger**: `Logger` -___ - -### logger - -• `Optional` **logger**: `Logger` +Defined in: [config.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L135) A custom winston logger can be provided if setting logging verbosity is not sufficient Default: Logger with loglevel 'info' -#### Defined in - -[config.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L139) +*** -___ +### maxAccountRange? -### maxAccountRange +> `optional` **maxAccountRange**: `bigint` -• `Optional` **maxAccountRange**: `bigint` +Defined in: [config.ts:295](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L295) -#### Defined in +*** -[config.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L299) +### maxFetcherJobs? -___ +> `optional` **maxFetcherJobs**: `number` -### maxFetcherJobs - -• `Optional` **maxFetcherJobs**: `number` +Defined in: [config.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L149) Max jobs to be enqueued in the fetcher at any given time Default: `100` -#### Defined in - -[config.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L153) +*** -___ +### maxFetcherRequests? -### maxFetcherRequests +> `optional` **maxFetcherRequests**: `number` -• `Optional` **maxFetcherRequests**: `number` +Defined in: [config.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L154) Max outgoing multi-peer requests by the fetcher at any given time -#### Defined in +*** -[config.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L158) +### maxInvalidBlocksErrorCache? -___ +> `optional` **maxInvalidBlocksErrorCache**: `number` -### maxInvalidBlocksErrorCache - -• `Optional` **maxInvalidBlocksErrorCache**: `number` +Defined in: [config.ts:321](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L321) Cache size of invalid block hashes and their errors -#### Defined in - -[config.ts:325](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L325) +*** -___ +### maxPeers? -### maxPeers +> `optional` **maxPeers**: `number` -• `Optional` **maxPeers**: `number` +Defined in: [config.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L168) Maximum peers allowed Default: `25` -#### Defined in - -[config.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L172) +*** -___ +### maxPerRequest? -### maxPerRequest +> `optional` **maxPerRequest**: `number` -• `Optional` **maxPerRequest**: `number` +Defined in: [config.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L142) Max items per block or header request Default: `100` -#### Defined in - -[config.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L146) - -___ +*** -### maxRangeBytes +### maxRangeBytes? -• `Optional` **maxRangeBytes**: `number` +> `optional` **maxRangeBytes**: `number` -#### Defined in +Defined in: [config.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L293) -[config.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L297) +*** -___ +### maxStorageRange? -### maxStorageRange +> `optional` **maxStorageRange**: `bigint` -• `Optional` **maxStorageRange**: `bigint` +Defined in: [config.ts:316](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L316) -#### Defined in +*** -[config.ts:320](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L320) +### mine? -___ +> `optional` **mine**: `boolean` -### minPeers +Defined in: [config.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L240) -• `Optional` **minPeers**: `number` - -Number of peers needed before syncing - -Default: `1` - -#### Defined in - -[config.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L165) +Enable mining -___ +Default: `false` -### mine +*** -• `Optional` **mine**: `boolean` +### minerCoinbase? -Enable mining +> `optional` **minerCoinbase**: `Address` -Default: `false` +Defined in: [config.ts:271](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L271) -#### Defined in +Address for mining rewards (etherbase) +If not provided, defaults to the primary account. -[config.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L244) +*** -___ +### minPeers? -### minerCoinbase +> `optional` **minPeers**: `number` -• `Optional` **minerCoinbase**: `Address` +Defined in: [config.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L161) -Address for mining rewards (etherbase) -If not provided, defaults to the primary account. +Number of peers needed before syncing -#### Defined in +Default: `1` -[config.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L275) +*** -___ +### multiaddrs? -### multiaddrs +> `optional` **multiaddrs**: `Multiaddr`[] -• `Optional` **multiaddrs**: `Multiaddr`[] +Defined in: [config.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L110) Network multiaddrs for libp2p (e.g. /ip4/127.0.0.1/tcp/50505/p2p/QmABC) -#### Defined in - -[config.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L114) +*** -___ +### numBlocksPerIteration? -### numBlocksPerIteration +> `optional` **numBlocksPerIteration**: `number` -• `Optional` **numBlocksPerIteration**: `number` +Defined in: [config.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L190) Number of blocks to execute in batch mode and logged to console -#### Defined in +*** -[config.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L194) +### port? -___ +> `optional` **port**: `number` -### port - -• `Optional` **port**: `number` +Defined in: [config.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L99) RLPx listening port Default: `30303` -#### Defined in - -[config.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L103) +*** -___ +### prefixStorageTrieKeys? -### prefixStorageTrieKeys +> `optional` **prefixStorageTrieKeys**: `boolean` -• `Optional` **prefixStorageTrieKeys**: `boolean` +Defined in: [config.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L61) A temporary option to offer backward compatibility with already-synced databases that are using non-prefixed keys for storage tries Default: true -#### Defined in +*** -[config.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L58) +### prometheusMetrics? -___ +> `optional` **prometheusMetrics**: `PrometheusMetrics` -### pruneEngineCache +Defined in: [config.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L347) -• `Optional` **pruneEngineCache**: `boolean` +Enables Prometheus Metrics that can be collected for monitoring client health -#### Defined in +*** -[config.ts:326](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L326) +### pruneEngineCache? -___ +> `optional` **pruneEngineCache**: `boolean` -### safeReorgDistance +Defined in: [config.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L322) -• `Optional` **safeReorgDistance**: `number` +*** -If there is a reorg, this is a safe distance from which -to try to refetch and refeed the blocks. +### safeReorgDistance? -#### Defined in +> `optional` **safeReorgDistance**: `number` -[config.ts:281](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L281) +Defined in: [config.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L277) -___ +If there is a reorg, this is a safe distance from which +to try to refetch and re-feed the blocks. -### savePreimages +*** -• `Optional` **savePreimages**: `boolean` +### savePreimages? -Save account keys preimages in the meta db (default: false) +> `optional` **savePreimages**: `boolean` -#### Defined in +Defined in: [config.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L329) -[config.ts:333](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L333) +Save account keys preimages in the meta db (default: false) -___ +*** -### saveReceipts +### saveReceipts? -• `Optional` **saveReceipts**: `boolean` +> `optional` **saveReceipts**: `boolean` -Save tx receipts and logs in the meta db (default: false) +Defined in: [config.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L121) -#### Defined in +Save tx receipts and logs in the meta db (default: false) -[config.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L125) +*** -___ +### server? -### server +> `optional` **server**: `RlpxServer` -• `Optional` **server**: `RlpxServer` +Defined in: [config.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L116) Transport servers (RLPx) Only used for testing purposes -#### Defined in +*** -[config.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L120) +### skeletonFillCanonicalBackStep? -___ +> `optional` **skeletonFillCanonicalBackStep**: `number` -### skeletonFillCanonicalBackStep - -• `Optional` **skeletonFillCanonicalBackStep**: `number` +Defined in: [config.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L284) If there is a skeleton fillCanonicalChain block lookup errors because of closing chain conditions, this allows skeleton to backstep and fill again using reverse block fetcher. -#### Defined in - -[config.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L288) +*** -___ +### skeletonSubchainMergeMinimum? -### skeletonSubchainMergeMinimum +> `optional` **skeletonSubchainMergeMinimum**: `number` -• `Optional` **skeletonSubchainMergeMinimum**: `number` +Defined in: [config.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L291) If skeleton subchains can be merged, what is the minimum tail gain, as subchain merge will lead to the ReverseBlockFetcher reset -#### Defined in +*** -[config.ts:295](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L295) +### snapAvailabilityDepth? -___ +> `optional` **snapAvailabilityDepth**: `bigint` -### snapAvailabilityDepth +Defined in: [config.ts:323](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L323) -• `Optional` **snapAvailabilityDepth**: `bigint` +*** -#### Defined in +### snapTransitionSafeDepth? -[config.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L327) +> `optional` **snapTransitionSafeDepth**: `bigint` -___ +Defined in: [config.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L324) -### snapTransitionSafeDepth +*** -• `Optional` **snapTransitionSafeDepth**: `bigint` +### startExecution? -#### Defined in +> `optional` **startExecution**: `boolean` -[config.ts:328](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L328) +Defined in: [config.ts:336](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L336) -___ +*** -### statelessVerkle +### statefulVerkle? -• `Optional` **statelessVerkle**: `boolean` +> `optional` **statefulVerkle**: `boolean` -Enables stateless verkle block execution (default: false) +Defined in: [config.ts:335](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L335) -#### Defined in +*** -[config.ts:338](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L338) +### statelessVerkle? -___ +> `optional` **statelessVerkle**: `boolean` -### storageCache +Defined in: [config.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L334) -• `Optional` **storageCache**: `number` +Enables stateless verkle block execution (default: false) -Size for the storage cache (max number of contracts) +*** -#### Defined in +### storageCache? -[config.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L204) +> `optional` **storageCache**: `number` -___ +Defined in: [config.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L200) -### syncedStateRemovalPeriod +Size for the storage cache (max number of contracts) -• `Optional` **syncedStateRemovalPeriod**: `number` +*** -The time after which synced state is downgraded to unsynced +### syncedStateRemovalPeriod? -#### Defined in +> `optional` **syncedStateRemovalPeriod**: `number` -[config.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L303) +Defined in: [config.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L299) -___ +The time after which synced state is downgraded to unsynced -### syncmode +*** -• `Optional` **syncmode**: [`SyncMode`](../enums/SyncMode.md) +### syncmode? -Synchronization mode ('full', 'light', 'none') +> `optional` **syncmode**: [`SyncMode`](../type-aliases/SyncMode.md) -Default: 'full' +Defined in: [config.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L46) -#### Defined in +Synchronization mode ('full', 'none') -[config.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L43) +Default: 'full' -___ +*** -### trieCache +### trieCache? -• `Optional` **trieCache**: `number` +> `optional` **trieCache**: `number` -Size for the trie cache (max number of trie nodes) +Defined in: [config.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L210) -#### Defined in +Size for the trie cache (max number of trie nodes) -[config.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L214) +*** -___ +### txLookupLimit? -### txLookupLimit +> `optional` **txLookupLimit**: `number` -• `Optional` **txLookupLimit**: `number` +Defined in: [config.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L127) Number of recent blocks to maintain transactions index for (default = 2350000 = about one year, 0 = entire chain) -#### Defined in - -[config.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L131) +*** -___ +### useStringValueTrieDB? -### useStringValueTrieDB +> `optional` **useStringValueTrieDB**: `boolean` -• `Optional` **useStringValueTrieDB**: `boolean` +Defined in: [config.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L67) A temporary option to offer backward compatibility with already-synced databases that stores trie items as `string`, instead of the more performant `Uint8Array` -#### Defined in +*** -[config.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L64) +### vm? -___ +> `optional` **vm**: `VM` -### vm - -• `Optional` **vm**: `VM` +Defined in: [config.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L74) Provide a custom VM instance to process blocks Default: VM instance created by client -#### Defined in - -[config.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L71) +*** -___ +### vmProfileBlocks? -### vmProfileBlocks +> `optional` **vmProfileBlocks**: `boolean` -• `Optional` **vmProfileBlocks**: `boolean` +Defined in: [config.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L252) Whether to profile VM blocks -#### Defined in - -[config.ts:256](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L256) +*** -___ +### vmProfileTxs? -### vmProfileTxs +> `optional` **vmProfileTxs**: `boolean` -• `Optional` **vmProfileTxs**: `boolean` +Defined in: [config.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L257) Whether to profile VM txs - -#### Defined in - -[config.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L261) diff --git a/packages/client/docs/type-aliases/DataDirectory.md b/packages/client/docs/type-aliases/DataDirectory.md new file mode 100644 index 00000000000..fd02e3bf60a --- /dev/null +++ b/packages/client/docs/type-aliases/DataDirectory.md @@ -0,0 +1,11 @@ +[**@ethereumjs/client**](../README.md) + +*** + +[@ethereumjs/client](../README.md) / DataDirectory + +# Type Alias: DataDirectory + +> **DataDirectory** = *typeof* [`DataDirectory`](../variables/DataDirectory.md)\[keyof *typeof* [`DataDirectory`](../variables/DataDirectory.md)\] + +Defined in: [config.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L17) diff --git a/packages/client/docs/type-aliases/SyncMode.md b/packages/client/docs/type-aliases/SyncMode.md new file mode 100644 index 00000000000..2aedad4d2b7 --- /dev/null +++ b/packages/client/docs/type-aliases/SyncMode.md @@ -0,0 +1,11 @@ +[**@ethereumjs/client**](../README.md) + +*** + +[@ethereumjs/client](../README.md) / SyncMode + +# Type Alias: SyncMode + +> **SyncMode** = *typeof* [`SyncMode`](../variables/SyncMode.md)\[keyof *typeof* [`SyncMode`](../variables/SyncMode.md)\] + +Defined in: [config.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L25) diff --git a/packages/client/docs/variables/DataDirectory.md b/packages/client/docs/variables/DataDirectory.md new file mode 100644 index 00000000000..7588f6f15f4 --- /dev/null +++ b/packages/client/docs/variables/DataDirectory.md @@ -0,0 +1,25 @@ +[**@ethereumjs/client**](../README.md) + +*** + +[@ethereumjs/client](../README.md) / DataDirectory + +# Variable: DataDirectory + +> **DataDirectory**: `object` + +Defined in: [config.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L17) + +## Type declaration + +### Chain + +> `readonly` **Chain**: `"chain"` = `'chain'` + +### Meta + +> `readonly` **Meta**: `"meta"` = `'meta'` + +### State + +> `readonly` **State**: `"state"` = `'state'` diff --git a/packages/client/docs/variables/SyncMode.md b/packages/client/docs/variables/SyncMode.md new file mode 100644 index 00000000000..6955af2cdc3 --- /dev/null +++ b/packages/client/docs/variables/SyncMode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/client**](../README.md) + +*** + +[@ethereumjs/client](../README.md) / SyncMode + +# Variable: SyncMode + +> **SyncMode**: `object` + +Defined in: [config.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/client/src/config.ts#L25) + +## Type declaration + +### Full + +> `readonly` **Full**: `"full"` = `'full'` + +### None + +> `readonly` **None**: `"none"` = `'none'` diff --git a/packages/client/package.json b/packages/client/package.json index e5a91994c05..d6a50302a35 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -34,7 +34,7 @@ "client:start:dev2": "npm run client:start -- --discDns=false --discV4=false --port=30304 --dataDir=datadir-dev2", "coverage": "DEBUG=ethjs npx vitest run -c ./vitest.config.coverage.ts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ./vitest.config.coverage.istanbul.ts", - "docs:build": "typedoc --options typedoc.cjs --tsconfig tsconfig.prod.cjs.json", + "docs:build": "typedoc --options typedoc.mjs --tsconfig tsconfig.prod.esm.json", "examples": "tsx ../../scripts/examples-runner.ts -- client", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", "lint:fix": "npm run biome:fix && eslint --fix --config ./eslint.config.mjs .", @@ -76,7 +76,7 @@ "connect": "^3.7.0", "cors": "^2.8.5", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "eventemitter3": "^5.0.1", "jayson": "^4.1.3", "level": "^9.0.0", diff --git a/packages/client/src/miner/pendingBlock.ts b/packages/client/src/miner/pendingBlock.ts index 47e606e0a34..5f92dae3027 100644 --- a/packages/client/src/miner/pendingBlock.ts +++ b/packages/client/src/miner/pendingBlock.ts @@ -9,7 +9,6 @@ import { concatBytes, createZeroAddress, equalsBytes, - toBytes, toType, } from '@ethereumjs/util' import { BuildStatus, buildBlock } from '@ethereumjs/vm' @@ -145,19 +144,18 @@ export class PendingBlock { const keccakFunction = this.config.chainCommon.customCrypto.keccak256 ?? keccak256 - const payloadIdBytes = toBytes( - keccakFunction( - concatBytes( - parentBlock.hash(), - mixHashBuf, - timestampBuf, - gasLimitBuf, - parentBeaconBlockRootBuf, - coinbaseBuf, - withdrawalsBuf, - ), - ).subarray(0, 8), - ) + const payloadIdBytes = keccakFunction( + concatBytes( + parentBlock.hash(), + mixHashBuf, + timestampBuf, + gasLimitBuf, + parentBeaconBlockRootBuf, + coinbaseBuf, + withdrawalsBuf, + ), + ).subarray(0, 8) + const payloadId = bytesToHex(payloadIdBytes) // If payload has already been triggered, then return the payloadid diff --git a/packages/client/src/net/peerpool.ts b/packages/client/src/net/peerpool.ts index 8921a96ccf7..30727277d44 100644 --- a/packages/client/src/net/peerpool.ts +++ b/packages/client/src/net/peerpool.ts @@ -213,7 +213,7 @@ export class PeerPool { * @emits {@link Event.POOL_PEER_ADDED} */ add(peer?: Peer) { - if (peer && peer.id && !this.pool.get(peer.id)) { + if (peer?.id !== undefined && !this.pool.get(peer.id)) { this.pool.set(peer.id, peer) peer.pooled = true this.config.events.emit(Event.POOL_PEER_ADDED, peer) diff --git a/packages/client/src/rpc/modules/admin.ts b/packages/client/src/rpc/modules/admin.ts index 3546fb1bbed..093158637dc 100644 --- a/packages/client/src/rpc/modules/admin.ts +++ b/packages/client/src/rpc/modules/admin.ts @@ -95,9 +95,10 @@ export class Admin { name: peer.rlpxPeer?.['_hello']?.clientId ?? null, protocols: { eth: { - head: peer.eth?.updatedBestHeader - ? bytesToHex(peer.eth.updatedBestHeader?.hash()) - : bytesToHex(peer.eth?.status.bestHash), + head: + peer.eth?.updatedBestHeader !== undefined + ? bytesToHex(peer.eth.updatedBestHeader.hash()) + : bytesToHex(peer.eth?.status.bestHash ?? new Uint8Array()), difficulty: peer.eth?.status.td.toString(10), version: peer.eth?.['versions'].slice(-1)[0] ?? null, }, diff --git a/packages/client/src/rpc/modules/engine/engine.ts b/packages/client/src/rpc/modules/engine/engine.ts index 9bcd21d67dc..9c9b2f9dc95 100644 --- a/packages/client/src/rpc/modules/engine/engine.ts +++ b/packages/client/src/rpc/modules/engine/engine.ts @@ -6,7 +6,6 @@ import { bytesToUnprefixedHex, equalsBytes, hexToBytes, - toBytes, } from '@ethereumjs/util' import { ExecStatus } from '../../../execution/index.ts' @@ -911,7 +910,7 @@ export class Engine { */ let headBlock: Block | undefined try { - const head = toBytes(headBlockHash) + const head = hexToBytes(headBlockHash) headBlock = this.remoteBlocks.get(headBlockHash.slice(2)) ?? (await this.skeleton.getBlockByHash(head, true)) ?? diff --git a/packages/client/src/rpc/modules/web3.ts b/packages/client/src/rpc/modules/web3.ts index 13e53b7dce1..afcf9aa3c4e 100644 --- a/packages/client/src/rpc/modules/web3.ts +++ b/packages/client/src/rpc/modules/web3.ts @@ -1,4 +1,4 @@ -import { bytesToHex, hexToBytes, toBytes } from '@ethereumjs/util' +import { bytesToHex, hexToBytes } from '@ethereumjs/util' import { keccak256 } from 'ethereum-cryptography/keccak.js' import { getClientVersion } from '../../util/index.ts' @@ -45,7 +45,7 @@ export class Web3 { * @param params The data to convert into a SHA3 hash */ sha3(params: PrefixedHexString[]): PrefixedHexString { - const hexEncodedDigest = bytesToHex(keccak256(toBytes(hexToBytes(params[0])))) + const hexEncodedDigest = bytesToHex(keccak256(hexToBytes(params[0]))) return hexEncodedDigest } } diff --git a/packages/client/src/sync/fetcher/accountfetcher.ts b/packages/client/src/sync/fetcher/accountfetcher.ts index 2ae370c7e48..431dc3822f4 100644 --- a/packages/client/src/sync/fetcher/accountfetcher.ts +++ b/packages/client/src/sync/fetcher/accountfetcher.ts @@ -337,9 +337,10 @@ export class AccountFetcher extends Fetcher const { task, partialResult } = job const { first } = task // Snap protocol will automatically pad it with 32 bytes left, so we don't need to worry - const origin = partialResult - ? bigIntToBytes(bytesToBigInt(partialResult[partialResult.length - 1].hash) + BIGINT_1) - : bigIntToBytes(first) + const origin = + partialResult !== undefined + ? bigIntToBytes(bytesToBigInt(partialResult[partialResult.length - 1].hash) + BIGINT_1) + : bigIntToBytes(first) return setLengthLeft(origin, 32) } @@ -470,9 +471,12 @@ export class AccountFetcher extends Fetcher const fullResult = (job.partialResult ?? []).concat(result) // update highest known hash - const highestReceivedhash = result.at(-1)?.hash as Uint8Array + const highestReceivedhash = result.at(-1)?.hash if (this.highestKnownHash) { - if (compareBytes(highestReceivedhash, this.highestKnownHash) > 0) { + if ( + highestReceivedhash !== undefined && + compareBytes(highestReceivedhash, this.highestKnownHash) > 0 + ) { this.highestKnownHash = highestReceivedhash } } else { diff --git a/packages/client/src/sync/fetcher/trienodefetcher.ts b/packages/client/src/sync/fetcher/trienodefetcher.ts index c37bdd76e85..429691f3fc3 100644 --- a/packages/client/src/sync/fetcher/trienodefetcher.ts +++ b/packages/client/src/sync/fetcher/trienodefetcher.ts @@ -347,7 +347,7 @@ export class TrieNodeFetcher extends Fetcher // add account node data to account trie const node = decodeMPTNode(nodeData) if (node instanceof LeafMPTNode) { - const key = bytesToUnprefixedHex(pathToHexKey(path, node.key(), 'keybyte')) + const key = bytesToHex(pathToHexKey(path, node.key(), 'keybyte')) ops.push({ type: 'put', key: hexToBytes(key), @@ -365,9 +365,7 @@ export class TrieNodeFetcher extends Fetcher for (const [path, data] of pathToStorageNode) { const storageNode = decodeMPTNode(data) if (storageNode instanceof LeafMPTNode) { - const storageKey = bytesToUnprefixedHex( - pathToHexKey(path, storageNode.key(), 'keybyte'), - ) + const storageKey = bytesToHex(pathToHexKey(path, storageNode.key(), 'keybyte')) storageTrieOps.push({ type: 'put', key: hexToBytes(storageKey), diff --git a/packages/client/src/util/vkt.ts b/packages/client/src/util/vkt.ts index eb0fda71482..5d516b51b48 100644 --- a/packages/client/src/util/vkt.ts +++ b/packages/client/src/util/vkt.ts @@ -16,9 +16,11 @@ export async function generateVKTStateRoot(genesisState: GenesisState, common: C const state = new StatefulVerkleStateManager({ common }) await state['_trie'].createRootNode() await state.checkpoint() - for (const addressStr of Object.keys(genesisState)) { + for (const addressStr of Object.keys(genesisState) as PrefixedHexString[]) { const addrState = genesisState[addressStr] - let nonce, balance, code + let nonce: PrefixedHexString | undefined + let balance: PrefixedHexString | bigint + let code: PrefixedHexString | undefined let storage: StoragePair[] | undefined if (Array.isArray(addrState)) { ;[balance, code, storage, nonce] = addrState @@ -51,8 +53,8 @@ export async function generateVKTStateRoot(genesisState: GenesisState, common: C // Put account data const account = createPartialAccount({ - nonce: nonce as PrefixedHexString, - balance: balance as PrefixedHexString, + nonce, + balance, codeHash, codeSize: codeBuf.byteLength, }) diff --git a/packages/client/test/integration/miner.spec.ts b/packages/client/test/integration/miner.spec.ts index 0a26b2525f3..d97f3a2acc0 100644 --- a/packages/client/test/integration/miner.spec.ts +++ b/packages/client/test/integration/miner.spec.ts @@ -1,4 +1,9 @@ -import { Hardfork, createCommonFromGethGenesis, parseGethGenesisState } from '@ethereumjs/common' +import { + type GethGenesis, + Hardfork, + createCommonFromGethGenesis, + parseGethGenesisState, +} from '@ethereumjs/common' import { Address, bytesToHex, concatBytes, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' @@ -12,7 +17,7 @@ import type { EthereumClient } from '../../src/index.ts' async function setupDevnet(prefundAddress: Address) { const addr = prefundAddress.toString().slice(2) - const defaultChainData = { + const defaultChainData: GethGenesis = { config: { chainId: 123456, homesteadBlock: 0, @@ -37,6 +42,7 @@ async function setupDevnet(prefundAddress: Address) { gasUsed: '0x0', parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', baseFeePerGas: 7, + alloc: {}, } const extraData = concatBytes(new Uint8Array(32), prefundAddress.toBytes(), new Uint8Array(65)) diff --git a/packages/client/test/integration/pow.spec.ts b/packages/client/test/integration/pow.spec.ts index 8c4dc444b69..ae003244e09 100644 --- a/packages/client/test/integration/pow.spec.ts +++ b/packages/client/test/integration/pow.spec.ts @@ -1,5 +1,10 @@ import { rmSync } from 'fs' -import { Hardfork, createCommonFromGethGenesis, parseGethGenesisState } from '@ethereumjs/common' +import { + type GethGenesis, + Hardfork, + createCommonFromGethGenesis, + parseGethGenesisState, +} from '@ethereumjs/common' import { assert, describe, it } from 'vitest' import { Config } from '../../src/index.ts' @@ -18,7 +23,7 @@ async function setupPowDevnet(prefundAddress: Address, cleanStart: boolean) { const addr = prefundAddress.toString().slice(2) const consensusConfig = { ethash: true } - const defaultChainData = { + const defaultChainData: GethGenesis = { config: { chainId: 123456, homesteadBlock: 0, @@ -44,9 +49,10 @@ async function setupPowDevnet(prefundAddress: Address, cleanStart: boolean) { gasUsed: '0x0', parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', baseFeePerGas: 7, + alloc: {}, } - const extraData = '0x' + '0'.repeat(32) - const chainData = { + const extraData = `0x${'0'.repeat(32)}` + const chainData: GethGenesis = { ...defaultChainData, extraData, alloc: { [addr]: { balance: '0x10000000000000000000' } }, diff --git a/packages/client/test/miner/miner.spec.ts b/packages/client/test/miner/miner.spec.ts index 18728919473..fafe1a31482 100644 --- a/packages/client/test/miner/miner.spec.ts +++ b/packages/client/test/miner/miner.spec.ts @@ -1,6 +1,7 @@ import { BlockHeader, createBlock, createBlockHeader } from '@ethereumjs/block' import { Common, + type GethGenesis, Hardfork, createCommonFromGethGenesis, createCustomCommon, @@ -101,7 +102,7 @@ const consensusConfig = { epoch: 30000, }, } -const defaultChainData = { +const defaultChainData: GethGenesis = { config: { chainId: 123456, homesteadBlock: 0, @@ -127,6 +128,7 @@ const defaultChainData = { gasUsed: '0x0', parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', baseFeePerGas: 7, + alloc: {}, } const addr = A.address.toString().slice(2) diff --git a/packages/client/test/rpc/admin/addPeer.spec.ts b/packages/client/test/rpc/admin/addPeer.spec.ts index 3a5c23cc291..c4b3184f9c4 100644 --- a/packages/client/test/rpc/admin/addPeer.spec.ts +++ b/packages/client/test/rpc/admin/addPeer.spec.ts @@ -13,7 +13,7 @@ const peerPort = 30304 // NOTE: the `privateKey` currently cannot be 0x-prefixed in `./net/server/server.ts` const privateKey = 'dc6457099f127cf0bac78de8b297df04951281909db4f58b43def7c7151e765d' -const privateKeyBytes = hexToBytes('0x' + privateKey) +const privateKeyBytes = hexToBytes(`0x${privateKey}`) describe(method, () => { it('works', async () => { diff --git a/packages/client/test/rpc/eth/getFeeHistory.spec.ts b/packages/client/test/rpc/eth/getFeeHistory.spec.ts index f3a56eb5a12..6c98400a071 100644 --- a/packages/client/test/rpc/eth/getFeeHistory.spec.ts +++ b/packages/client/test/rpc/eth/getFeeHistory.spec.ts @@ -203,9 +203,9 @@ describe(method, () => { // Expect to retrieve the blocks [2,3] const res = await rpc.request(method, ['0x2', 'latest', []]) const [firstBaseFee, previousBaseFee, nextBaseFee] = res.result.baseFeePerGas as [ - string, - string, - string, + PrefixedHexString, + PrefixedHexString, + PrefixedHexString, ] const increase = Number( @@ -244,7 +244,11 @@ describe(method, () => { const rpc = getRPCClient(server) const res = await rpc.request(method, ['0x2', 'latest', []]) - const [, previousBaseFee, nextBaseFee] = res.result.baseFeePerGas as [string, string, string] + const [, previousBaseFee, nextBaseFee] = res.result.baseFeePerGas as [ + PrefixedHexString, + PrefixedHexString, + PrefixedHexString, + ] const decrease = Number( (1000n * @@ -270,7 +274,7 @@ describe(method, () => { const res = await rpc.request(method, ['0x1', 'latest', []]) - const [baseFee] = res.result.baseFeePerGas as [string] + const [baseFee] = res.result.baseFeePerGas as [PrefixedHexString] assert.equal(bytesToBigInt(hexToBytes(baseFee)), initialBaseFee) }) @@ -285,7 +289,10 @@ describe(method, () => { const res = await rpc.request(method, ['0x1', 'latest', []]) - const [previousBaseFee, nextBaseFee] = res.result.baseFeePerGas as [string, string] + const [previousBaseFee, nextBaseFee] = res.result.baseFeePerGas as [ + PrefixedHexString, + PrefixedHexString, + ] assert.equal(previousBaseFee, '0x0') assert.equal(nextBaseFee, '0x0') diff --git a/packages/client/test/rpc/mockBlockchain.ts b/packages/client/test/rpc/mockBlockchain.ts index 5607591f9b1..7f815045c52 100644 --- a/packages/client/test/rpc/mockBlockchain.ts +++ b/packages/client/test/rpc/mockBlockchain.ts @@ -1,27 +1,33 @@ import { createBlock } from '@ethereumjs/block' import { createLegacyTx } from '@ethereumjs/tx' -import { equalsBytes, toBytes } from '@ethereumjs/util' +import { type PrefixedHexString, equalsBytes, hexToBytes } from '@ethereumjs/util' import { dummy } from './helpers.ts' -import type { LegacyTx } from '@ethereumjs/tx' +import type { JSONTx, LegacyTx, TypedTransaction } from '@ethereumjs/tx' -export function mockBlockchain(options: any = {}) { - const number = options.number ?? '0x444444' - const blockHash = +export function mockBlockchain( + options: { + number?: PrefixedHexString + hash?: PrefixedHexString + transactions?: TypedTransaction[] | JSONTx[] + } = {}, +) { + const number: PrefixedHexString = options.number ?? '0x444444' + const blockHash: PrefixedHexString = options.hash ?? '0x910abca1728c53e8d6df870dd7af5352e974357dc58205dea1676be17ba6becf' const transactions = options.transactions ?? [createLegacyTx({}).sign(dummy.privKey)] const block = { - hash: () => toBytes(blockHash), + hash: () => hexToBytes(blockHash), serialize: () => createBlock({ header: { number }, transactions }).serialize(), header: { number: BigInt(number), - hash: () => toBytes(blockHash), + hash: () => hexToBytes(blockHash), }, toJSON: () => ({ ...createBlock({ header: { number } }).toJSON(), hash: options.hash ?? blockHash, - transactions: transactions.map((t: LegacyTx) => t.toJSON()), + transactions: transactions.map((t) => (t as LegacyTx).toJSON()), }), transactions, uncleHeaders: [], diff --git a/packages/client/test/sim/snapsync.spec.ts b/packages/client/test/sim/snapsync.spec.ts index 1ed0836d47b..72bed624dac 100644 --- a/packages/client/test/sim/snapsync.spec.ts +++ b/packages/client/test/sim/snapsync.spec.ts @@ -249,7 +249,7 @@ describe('simple mainnet test run', async () => { ;(customGenesisState[sender][0] as any) = `0x${senderBalance.toString(16)}` } - for (const addressString of Object.keys(customGenesisState)) { + for (const addressString of Object.keys(customGenesisState) as PrefixedHexString[]) { const address = createAddressFromString(addressString) const account = await stateManager?.getAccount(address) assert.equal( diff --git a/packages/client/test/sync/fetcher/accountfetcher.spec.ts b/packages/client/test/sync/fetcher/accountfetcher.spec.ts index 64d71d5ce31..a4b48406923 100644 --- a/packages/client/test/sync/fetcher/accountfetcher.spec.ts +++ b/packages/client/test/sync/fetcher/accountfetcher.spec.ts @@ -188,20 +188,19 @@ describe('[AccountFetcher]', async () => { address: 'random', latest: vi.fn(), } - const partialResult: any = [ - [ - { - hash: new Uint8Array(0), - body: [new Uint8Array(0), new Uint8Array(0), new Uint8Array(0), new Uint8Array(0)], - }, - { - hash: new Uint8Array(0), - body: [new Uint8Array(0), new Uint8Array(0), new Uint8Array(0), new Uint8Array(0)], - }, - ], + const partialResult = [ + { + hash: new Uint8Array(0), + body: [new Uint8Array(0), new Uint8Array(0), new Uint8Array(0), new Uint8Array(0)], + }, + { + hash: new Uint8Array(0), + body: [new Uint8Array(0), new Uint8Array(0), new Uint8Array(0), new Uint8Array(0)], + }, ] const job = { peer, partialResult, task } - const result = (await fetcher.request(job as any)) as any + const result = await fetcher.request(job as any) + assert.isDefined(result) assert.equal( JSON.stringify(result[0]), JSON.stringify({ skipped: true }), @@ -219,17 +218,15 @@ describe('[AccountFetcher]', async () => { first: BigInt(1), count: BigInt(3), }) - const partialResult: any = [ - [ - { - hash: new Uint8Array(0), - body: [new Uint8Array(0), new Uint8Array(0), new Uint8Array(0), new Uint8Array(0)], - }, - { - hash: new Uint8Array(0), - body: [new Uint8Array(0), new Uint8Array(0), new Uint8Array(0), new Uint8Array(0)], - }, - ], + const partialResult = [ + { + hash: new Uint8Array(0), + body: [new Uint8Array(0), new Uint8Array(0), new Uint8Array(0), new Uint8Array(0)], + }, + { + hash: new Uint8Array(0), + body: [new Uint8Array(0), new Uint8Array(0), new Uint8Array(0), new Uint8Array(0)], + }, ] const task = { count: 3, first: BigInt(1) } diff --git a/packages/client/test/sync/fetcher/storagefetcher.spec.ts b/packages/client/test/sync/fetcher/storagefetcher.spec.ts index d89644123ba..672fd5d681b 100644 --- a/packages/client/test/sync/fetcher/storagefetcher.spec.ts +++ b/packages/client/test/sync/fetcher/storagefetcher.spec.ts @@ -255,10 +255,10 @@ describe('[StorageFetcher]', async () => { pool, root: utf8ToBytes(''), } as StorageFetcherOptions) - const partialResult: any = [ + const partialResult = [ [ - [{ hash: utf8ToBytes(''), body: utf8ToBytes('') }], - [{ hash: utf8ToBytes(''), body: utf8ToBytes('') }], + { hash: utf8ToBytes(''), body: utf8ToBytes('') }, + { hash: utf8ToBytes(''), body: utf8ToBytes('') }, ], ] @@ -276,7 +276,7 @@ describe('[StorageFetcher]', async () => { }, ], } - const resData = RLP.decode(hexToBytes(_storageRangesRLP)) as unknown + const resData = RLP.decode(hexToBytes(_storageRangesRLP)) const res = p.decode( p.messages.filter((message) => message.name === 'StorageRanges')[0], resData, diff --git a/packages/client/test/sync/skeleton.spec.ts b/packages/client/test/sync/skeleton.spec.ts index e00d9f81f11..b018938664e 100644 --- a/packages/client/test/sync/skeleton.spec.ts +++ b/packages/client/test/sync/skeleton.spec.ts @@ -1,6 +1,7 @@ import { createBlock } from '@ethereumjs/block' import { Common, + type GethGenesis, Mainnet, createCommonFromGethGenesis, createCustomCommon, @@ -405,7 +406,7 @@ describe('[Skeleton] / setHead', async () => { } it(`skeleton init should throw error if merge not set`, async () => { - const genesis = { + const genesis: GethGenesis = { ...postMergeGethGenesis, config: { ...postMergeGethGenesis.config, @@ -420,7 +421,8 @@ describe('[Skeleton] / setHead', async () => { const common = createCommonFromGethGenesis(genesis, { chain: 'merge-not-set' }) const config = new Config({ common }) const chain = await Chain.create({ config }) - ;(chain.blockchain['_validateBlocks'] as any) = false + // @ts-expect-error -- Assigning to read-only property + chain.blockchain['_validateBlocks'] = false try { new Skeleton({ chain, config, metaDB: new MemoryLevel() }) } catch { diff --git a/packages/client/typedoc.cjs b/packages/client/typedoc.mjs similarity index 87% rename from packages/client/typedoc.cjs rename to packages/client/typedoc.mjs index 418a57db189..8e47577fbef 100644 --- a/packages/client/typedoc.cjs +++ b/packages/client/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: [ diff --git a/packages/common/README.md b/packages/common/README.md index efd34a0632c..af39837aea3 100644 --- a/packages/common/README.md +++ b/packages/common/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/common +# @ethereumjs/common `v10` [![NPM Package][common-npm-badge]][common-npm-link] [![GitHub Issues][common-issues-badge]][common-issues-link] @@ -9,6 +9,21 @@ | Resources common to all EthereumJS implementations. | | --------------------------------------------------- | +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Custom Cryptography Primitives (WASM)](#custom-cryptography-primitives-wasm) +- [Browser](#browser) +- [API](#api) +- [Events](#events) +- [Chains and Genesis](#chains-and-genesis) +- [Working with Private/Custom Chains](#working-with-privatecustom-chains) +- [Hardfork Support and Usage](#hardfork-support-and-usage) +- [Supported EIPs](#supported-eips) +- [EthereumJS](#ethereumjs) +- [License](#license) + ## Installation To obtain the latest version, simply require the project using `npm`: @@ -17,7 +32,7 @@ To obtain the latest version, simply require the project using `npm`: npm install @ethereumjs/common ``` -## Usage +## Getting Started ### import / require @@ -71,7 +86,7 @@ const commonWithCustomChainId = createCustomCommon({ chainId: 1234 }, Mainnet) console.log(`The current chain ID is ${commonWithCustomChainId.chainId()}`) ``` -### Custom Cryptography Primitives (WASM) +## Custom Cryptography Primitives (WASM) All EthereumJS packages use cryptographic primitives from the audited `ethereum-cryptography` library by default. These primitives, including `keccak256`, `sha256`, and elliptic curve signature methods, are all written in native JavaScript and therefore have the potential downside of being less performant than alternative cryptography modules written in other languages and then compiled to WASM. If cryptography performance is a bottleneck in your usage of the EthereumJS libraries, you can provide your own primitives to the `Common` constructor and they will be used in place of the defaults. Depending on how your preferred primitives are implemented, you may need to write wrapper methods around them so they conform to the interface exposed by the [`common.customCrypto` property](./src/types.ts). @@ -170,9 +185,7 @@ The `Common` class has a public property `events` which contains an `EventEmitte | ----------------- | ---------------------------------------------------------- | | `hardforkChanged` | Emitted when a hardfork change occurs in the Common object | -## Setup - -### Chains +### Chains and Genesis The `chain` can be set in the constructor like this: @@ -255,7 +268,7 @@ common.setForkHashes(genesisHash) console.log(`The London forkhash for this custom chain is ${common.forkHash('london')}`) ``` -### Hardforks +## Hardfork Support and Usage The `hardfork` can be set in constructor like this: @@ -309,7 +322,7 @@ See one of the hardfork configurations in the `hardforks.ts` file for an overview. For consistency, the chain start (`chainstart`) is considered an own hardfork. -### EIPs +## Supported EIPs EIPs are native citizens within the library and can be activated like this: @@ -356,10 +369,6 @@ The following EIPs are currently supported: - [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - Set EOA account code (Prague) - [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Verkle) -### Bootstrap Nodes - -You can use `common.bootstrapNodes()` function to get nodes for a specific chain/network. - ## EthereumJS See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices. If you want to join for work or carry out improvements on the libraries, please review our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html) first. diff --git a/packages/common/docs/README.md b/packages/common/docs/README.md index d9498dea2a4..5409b1a9dc8 100644 --- a/packages/common/docs/README.md +++ b/packages/common/docs/README.md @@ -1,309 +1,89 @@ -@ethereumjs/common +**@ethereumjs/common** -# @ethereumjs/common - -## Table of contents +*** -### Enumerations - -- [Chain](enums/Chain.md) -- [ConsensusAlgorithm](enums/ConsensusAlgorithm.md) -- [ConsensusType](enums/ConsensusType.md) -- [CustomChain](enums/CustomChain.md) -- [Hardfork](enums/Hardfork.md) +# @ethereumjs/common -### Classes +## Classes - [Common](classes/Common.md) -### Interfaces +## Interfaces +- [BaseOpts](interfaces/BaseOpts.md) +- [BinaryTreeAccessWitnessInterface](interfaces/BinaryTreeAccessWitnessInterface.md) - [BootstrapNodeConfig](interfaces/BootstrapNodeConfig.md) - [ChainConfig](interfaces/ChainConfig.md) - [ChainName](interfaces/ChainName.md) - [ChainsConfig](interfaces/ChainsConfig.md) +- [CommonEvent](interfaces/CommonEvent.md) - [CommonOpts](interfaces/CommonOpts.md) -- [CustomCommonOpts](interfaces/CustomCommonOpts.md) +- [CreateCommonFromGethGenesisOpts](interfaces/CreateCommonFromGethGenesisOpts.md) - [CustomCrypto](interfaces/CustomCrypto.md) -- [EVMStateManagerInterface](interfaces/EVMStateManagerInterface.md) - [GenesisBlockConfig](interfaces/GenesisBlockConfig.md) +- [GenesisState](interfaces/GenesisState.md) - [GethConfigOpts](interfaces/GethConfigOpts.md) +- [GethGenesis](interfaces/GethGenesis.md) +- [GethGenesisAlloc](interfaces/GethGenesisAlloc.md) +- [GethGenesisBlobSchedule](interfaces/GethGenesisBlobSchedule.md) +- [GethGenesisConfig](interfaces/GethGenesisConfig.md) - [HardforkByOpts](interfaces/HardforkByOpts.md) - [HardforkTransitionConfig](interfaces/HardforkTransitionConfig.md) - [StateManagerInterface](interfaces/StateManagerInterface.md) - [StorageDump](interfaces/StorageDump.md) - [StorageRange](interfaces/StorageRange.md) - -### Type Aliases - -- [AccessList](README.md#accesslist) -- [AccessListBytes](README.md#accesslistbytes) -- [AccessListBytesItem](README.md#accesslistbytesitem) -- [AccessListItem](README.md#accesslistitem) -- [AccountFields](README.md#accountfields) -- [CasperConfig](README.md#casperconfig) -- [CliqueConfig](README.md#cliqueconfig) -- [EIPConfig](README.md#eipconfig) -- [EIPOrHFConfig](README.md#eiporhfconfig) -- [EthashConfig](README.md#ethashconfig) -- [HardforkConfig](README.md#hardforkconfig) -- [HardforksDict](README.md#hardforksdict) -- [Proof](README.md#proof) -- [StorageProof](README.md#storageproof) - -### Variables - -- [ChainGenesis](README.md#chaingenesis) - -### Functions - -- [parseGethGenesis](README.md#parsegethgenesis) +- [VerkleAccessWitnessInterface](interfaces/VerkleAccessWitnessInterface.md) ## Type Aliases -### AccessList - -Ƭ **AccessList**: [`AccessListItem`](README.md#accesslistitem)[] - -#### Defined in - -[interfaces.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L66) - -___ - -### AccessListBytes - -Ƭ **AccessListBytes**: [`AccessListBytesItem`](README.md#accesslistbytesitem)[] - -#### Defined in - -[interfaces.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L65) - -___ - -### AccessListBytesItem - -Ƭ **AccessListBytesItem**: [`Uint8Array`, `Uint8Array`[]] - -#### Defined in - -[interfaces.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L64) - -___ - -### AccessListItem - -Ƭ **AccessListItem**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `address` | `PrefixedHexString` | -| `storageKeys` | `PrefixedHexString`[] | - -#### Defined in - -[interfaces.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L56) - -___ - -### AccountFields - -Ƭ **AccountFields**: `Partial`<`Pick`<`Account`, ``"nonce"`` \| ``"balance"`` \| ``"storageRoot"`` \| ``"codeHash"``\>\> - -#### Defined in - -[interfaces.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L34) - -___ - -### CasperConfig - -Ƭ **CasperConfig**: `Object` - -#### Defined in - -[types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L18) - -___ - -### CliqueConfig - -Ƭ **CliqueConfig**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `epoch` | `number` | -| `period` | `number` | - -#### Defined in - -[types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L11) - -___ - -### EIPConfig - -Ƭ **EIPConfig**: { `minimumHardfork`: [`Hardfork`](enums/Hardfork.md) ; `requiredEIPs`: `number`[] } & [`EIPOrHFConfig`](README.md#eiporhfconfig) - -#### Defined in - -[types.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L188) - -___ - -### EIPOrHFConfig - -Ƭ **EIPOrHFConfig**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `comment` | `string` | -| `gasConfig?` | { `[key: string]`: `ParamDict`; } | -| `gasPrices?` | { `[key: string]`: `ParamDict`; } | -| `pow?` | { `[key: string]`: `ParamDict`; } | -| `sharding?` | { `[key: string]`: `ParamDict`; } | -| `status` | `string` | -| `url` | `string` | -| `vm?` | { `[key: string]`: `ParamDict`; } | - -#### Defined in - -[types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L167) - -___ - -### EthashConfig - -Ƭ **EthashConfig**: `Object` - -#### Defined in - -[types.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L16) - -___ - -### HardforkConfig - -Ƭ **HardforkConfig**: { `consensus?`: `ConsensusConfig` ; `eips?`: `number`[] ; `name`: `string` } & [`EIPOrHFConfig`](README.md#eiporhfconfig) - -#### Defined in - -[types.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L193) - -___ - -### HardforksDict - -Ƭ **HardforksDict**: `Object` - -#### Index signature - -▪ [key: `string`]: [`HardforkConfig`](README.md#hardforkconfig) - -#### Defined in - -[types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L199) - -___ - -### Proof - -Ƭ **Proof**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `accountProof` | `PrefixedHexString`[] | -| `address` | `PrefixedHexString` | -| `balance` | `PrefixedHexString` | -| `codeHash` | `PrefixedHexString` | -| `nonce` | `PrefixedHexString` | -| `storageHash` | `PrefixedHexString` | -| `storageProof` | [`StorageProof`](README.md#storageproof)[] | - -#### Defined in - -[interfaces.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L42) - -___ - -### StorageProof - -Ƭ **StorageProof**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `key` | `PrefixedHexString` | -| `proof` | `PrefixedHexString`[] | -| `value` | `PrefixedHexString` | - -#### Defined in - -[interfaces.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L36) +- [AccessEventFlags](type-aliases/AccessEventFlags.md) +- [AccountFields](type-aliases/AccountFields.md) +- [AccountState](type-aliases/AccountState.md) +- [BinaryTreeAccessedState](type-aliases/BinaryTreeAccessedState.md) +- [BinaryTreeAccessedStateType](type-aliases/BinaryTreeAccessedStateType.md) +- [BinaryTreeAccessedStateWithAddress](type-aliases/BinaryTreeAccessedStateWithAddress.md) +- [CasperConfig](type-aliases/CasperConfig.md) +- [Chain](type-aliases/Chain.md) +- [CliqueConfig](type-aliases/CliqueConfig.md) +- [ConsensusAlgorithm](type-aliases/ConsensusAlgorithm.md) +- [ConsensusType](type-aliases/ConsensusType.md) +- [EIPConfig](type-aliases/EIPConfig.md) +- [EIPsDict](type-aliases/EIPsDict.md) +- [EthashConfig](type-aliases/EthashConfig.md) +- [Hardfork](type-aliases/Hardfork.md) +- [HardforkConfig](type-aliases/HardforkConfig.md) +- [HardforksDict](type-aliases/HardforksDict.md) +- [ParamsConfig](type-aliases/ParamsConfig.md) +- [ParamsDict](type-aliases/ParamsDict.md) +- [Proof](type-aliases/Proof.md) +- [RawBinaryTreeAccessedState](type-aliases/RawBinaryTreeAccessedState.md) +- [RawVerkleAccessedState](type-aliases/RawVerkleAccessedState.md) +- [StoragePair](type-aliases/StoragePair.md) +- [StorageProof](type-aliases/StorageProof.md) +- [VerkleAccessedState](type-aliases/VerkleAccessedState.md) +- [VerkleAccessedStateType](type-aliases/VerkleAccessedStateType.md) +- [VerkleAccessedStateWithAddress](type-aliases/VerkleAccessedStateWithAddress.md) ## Variables -### ChainGenesis - -• `Const` **ChainGenesis**: `Record`<[`Chain`](enums/Chain.md), `GenesisState`\> - -GenesisState info about well known ethereum chains - -#### Defined in - -[enums.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L26) +- [BinaryTreeAccessedStateType](variables/BinaryTreeAccessedStateType.md) +- [Chain](variables/Chain.md) +- [ChainGenesis](variables/ChainGenesis.md) +- [ChainNameFromNumber](variables/ChainNameFromNumber.md) +- [ConsensusAlgorithm](variables/ConsensusAlgorithm.md) +- [ConsensusType](variables/ConsensusType.md) +- [Hardfork](variables/Hardfork.md) +- [Holesky](variables/Holesky.md) +- [Hoodi](variables/Hoodi.md) +- [Kaustinen6](variables/Kaustinen6.md) +- [Mainnet](variables/Mainnet.md) +- [Sepolia](variables/Sepolia.md) +- [VerkleAccessedStateType](variables/VerkleAccessedStateType.md) ## Functions -### parseGethGenesis - -▸ **parseGethGenesis**(`json`, `name?`, `mergeForkIdPostMerge?`): `Object` - -Parses a genesis.json exported from Geth into parameters for Common instance - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `json` | `any` | representing the Geth genesis file | -| `name?` | `string` | optional chain name | -| `mergeForkIdPostMerge?` | `boolean` | - | - -#### Returns - -`Object` - -parsed params - -| Name | Type | -| :------ | :------ | -| `bootstrapNodes` | `never`[] | -| `chainId` | `number` | -| `consensus` | { `algorithm`: `string` = 'clique'; `clique`: { `epoch`: `any` ; `period`: `any` } ; `ethash`: `undefined` = {}; `type`: `string` = 'poa' } \| { `algorithm`: `string` = 'ethash'; `clique`: `undefined` ; `ethash`: {} = {}; `type`: `string` = 'pow' } | -| `genesis` | { `baseFeePerGas`: `string` ; `coinbase`: `string` ; `difficulty`: `string` ; `excessBlobGas`: `string` ; `extraData`: `string` ; `gasLimit`: `string` ; `mixHash`: `string` ; `nonce`: `string` ; `timestamp`: `string` } | -| `genesis.baseFeePerGas` | `string` | -| `genesis.coinbase` | `string` | -| `genesis.difficulty` | `string` | -| `genesis.excessBlobGas` | `string` | -| `genesis.extraData` | `string` | -| `genesis.gasLimit` | `string` | -| `genesis.mixHash` | `string` | -| `genesis.nonce` | `string` | -| `genesis.timestamp` | `string` | -| `hardfork` | `undefined` \| `string` | -| `hardforks` | `ConfigHardfork`[] | -| `name` | `string` | -| `networkId` | `number` | - -#### Defined in - -[utils.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/utils.ts#L209) +- [createCommonFromGethGenesis](functions/createCommonFromGethGenesis.md) +- [createCustomCommon](functions/createCustomCommon.md) +- [getPresetChainConfig](functions/getPresetChainConfig.md) +- [parseGethGenesis](functions/parseGethGenesis.md) +- [parseGethGenesisState](functions/parseGethGenesisState.md) diff --git a/packages/common/docs/classes/Common.md b/packages/common/docs/classes/Common.md index 6af73488ec7..d2af0fa309c 100644 --- a/packages/common/docs/classes/Common.md +++ b/packages/common/docs/classes/Common.md @@ -1,128 +1,77 @@ +[**@ethereumjs/common**](../README.md) + +*** + [@ethereumjs/common](../README.md) / Common # Class: Common +Defined in: [common.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L45) + Common class to access chain and hardfork parameters and to provide a unified and shared view on the network and hardfork state. -Use the [custom](Common.md#custom) static constructor for creating simple -custom chain [Common](Common.md) objects (more complete custom chain setups -can be created via the main constructor and the [customChains](../interfaces/CommonOpts.md#customchains) parameter). - -## Table of contents - -### Constructors - -- [constructor](Common.md#constructor) - -### Properties - -- [DEFAULT\_HARDFORK](Common.md#default_hardfork) -- [customCrypto](Common.md#customcrypto) -- [events](Common.md#events) - -### Methods - -- [activeOnBlock](Common.md#activeonblock) -- [bootstrapNodes](Common.md#bootstrapnodes) -- [chainId](Common.md#chainid) -- [chainName](Common.md#chainname) -- [consensusAlgorithm](Common.md#consensusalgorithm) -- [consensusConfig](Common.md#consensusconfig) -- [consensusType](Common.md#consensustype) -- [copy](Common.md#copy) -- [dnsNetworks](Common.md#dnsnetworks) -- [eipBlock](Common.md#eipblock) -- [eipTimestamp](Common.md#eiptimestamp) -- [eips](Common.md#eips) -- [forkHash](Common.md#forkhash) -- [genesis](Common.md#genesis) -- [getHardforkBy](Common.md#gethardforkby) -- [gteHardfork](Common.md#gtehardfork) -- [hardfork](Common.md#hardfork) -- [hardforkBlock](Common.md#hardforkblock) -- [hardforkForForkHash](Common.md#hardforkforforkhash) -- [hardforkGteHardfork](Common.md#hardforkgtehardfork) -- [hardforkIsActiveOnBlock](Common.md#hardforkisactiveonblock) -- [hardforkTTD](Common.md#hardforkttd) -- [hardforkTimestamp](Common.md#hardforktimestamp) -- [hardforks](Common.md#hardforks) -- [isActivatedEIP](Common.md#isactivatedeip) -- [networkId](Common.md#networkid) -- [nextHardforkBlockOrTimestamp](Common.md#nexthardforkblockortimestamp) -- [param](Common.md#param) -- [paramByBlock](Common.md#parambyblock) -- [paramByEIP](Common.md#parambyeip) -- [paramByHardfork](Common.md#parambyhardfork) -- [setChain](Common.md#setchain) -- [setEIPs](Common.md#seteips) -- [setForkHashes](Common.md#setforkhashes) -- [setHardfork](Common.md#sethardfork) -- [setHardforkBy](Common.md#sethardforkby) -- [custom](Common.md#custom) -- [fromGethGenesis](Common.md#fromgethgenesis) -- [getInitializedChains](Common.md#getinitializedchains) -- [isSupportedChainId](Common.md#issupportedchainid) +Use the Common.custom static constructor for creating simple +custom chain Common objects (more complete custom chain setups +can be created via the main constructor). ## Constructors -### constructor +### Constructor + +> **new Common**(`opts`): `Common` -• **new Common**(`opts`) +Defined in: [common.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L62) #### Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`CommonOpts`](../interfaces/CommonOpts.md) | +##### opts -#### Defined in +[`CommonOpts`](../interfaces/CommonOpts.md) -[common.ts:237](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L237) +#### Returns -## Properties +`Common` -### DEFAULT\_HARDFORK - -• `Readonly` **DEFAULT\_HARDFORK**: `string` +## Properties -#### Defined in +### customCrypto -[common.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L55) +> `readonly` **customCrypto**: [`CustomCrypto`](../interfaces/CustomCrypto.md) -___ +Defined in: [common.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L53) -### customCrypto +*** -• `Readonly` **customCrypto**: [`CustomCrypto`](../interfaces/CustomCrypto.md) +### DEFAULT\_HARDFORK -#### Defined in +> `readonly` **DEFAULT\_HARDFORK**: `string` -[common.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L62) +Defined in: [common.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L46) -___ +*** ### events -• **events**: `EventEmitter` - -#### Defined in +> **events**: `EventEmitter`\<[`CommonEvent`](../interfaces/CommonEvent.md)\> -[common.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L69) +Defined in: [common.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L60) ## Methods -### activeOnBlock +### activeOnBlock() -▸ **activeOnBlock**(`blockNumber`): `boolean` +> **activeOnBlock**(`blockNumber`): `boolean` + +Defined in: [common.ts:472](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L472) Alias to hardforkIsActiveOnBlock when hardfork is set #### Parameters -| Name | Type | -| :------ | :------ | -| `blockNumber` | `BigIntLike` | +##### blockNumber + +`BigIntLike` #### Returns @@ -130,15 +79,13 @@ Alias to hardforkIsActiveOnBlock when hardfork is set True if HF is active on block number -#### Defined in +*** -[common.ts:703](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L703) +### bootstrapNodes() -___ +> **bootstrapNodes**(): [`BootstrapNodeConfig`](../interfaces/BootstrapNodeConfig.md)[] -### bootstrapNodes - -▸ **bootstrapNodes**(): [`BootstrapNodeConfig`](../interfaces/BootstrapNodeConfig.md)[] +Defined in: [common.ts:729](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L729) Returns bootstrap nodes for the current chain @@ -148,15 +95,13 @@ Returns bootstrap nodes for the current chain Dict with bootstrap nodes -#### Defined in - -[common.ts:975](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L975) +*** -___ +### chainId() -### chainId +> **chainId**(): `bigint` -▸ **chainId**(): `bigint` +Defined in: [common.ts:753](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L753) Returns the Id of current chain @@ -166,15 +111,13 @@ Returns the Id of current chain chain Id -#### Defined in +*** -[common.ts:999](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L999) +### chainName() -___ +> **chainName**(): `string` -### chainName - -▸ **chainName**(): `string` +Defined in: [common.ts:761](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L761) Returns the name of current chain @@ -184,15 +127,13 @@ Returns the name of current chain chain name (lower case) -#### Defined in - -[common.ts:1007](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L1007) +*** -___ +### consensusAlgorithm() -### consensusAlgorithm +> **consensusAlgorithm**(): `string` -▸ **consensusAlgorithm**(): `string` +Defined in: [common.ts:802](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L802) Returns the concrete consensus implementation algorithm or protocol for the network @@ -206,21 +147,19 @@ Note: This value can update along a Hardfork. `string` -#### Defined in - -[common.ts:1056](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L1056) +*** -___ +### consensusConfig() -### consensusConfig +> **consensusConfig**(): `object` -▸ **consensusConfig**(): `Object` +Defined in: [common.ts:828](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L828) Returns a dictionary with consensus configuration parameters based on the consensus algorithm Expected returns (parameters must be present in -the respective chain json files): +the respective chain JSON files): ethash: empty object clique: period, epoch @@ -230,17 +169,15 @@ Note: This value can update along a Hardfork. #### Returns -`Object` +`object` -#### Defined in +*** -[common.ts:1082](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L1082) +### consensusType() -___ +> **consensusType**(): `string` -### consensusType - -▸ **consensusType**(): `string` +Defined in: [common.ts:780](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L780) Returns the consensus type of the network Possible values: "pow"|"poa"|"pos" @@ -251,31 +188,27 @@ Note: This value can update along a Hardfork. `string` -#### Defined in - -[common.ts:1034](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L1034) +*** -___ +### copy() -### copy +> **copy**(): `Common` -▸ **copy**(): [`Common`](Common.md) +Defined in: [common.ts:849](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L849) -Returns a deep copy of this [Common](Common.md) instance. +Returns a deep copy of this Common instance. #### Returns -[`Common`](Common.md) - -#### Defined in +`Common` -[common.ts:1103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L1103) +*** -___ +### dnsNetworks() -### dnsNetworks +> **dnsNetworks**(): `string`[] -▸ **dnsNetworks**(): `string`[] +Defined in: [common.ts:737](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L737) Returns DNS networks for the current chain @@ -285,105 +218,106 @@ Returns DNS networks for the current chain Array of DNS ENR urls -#### Defined in +*** -[common.ts:983](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L983) +### eipBlock() -___ +> **eipBlock**(`eip`): `null` \| `bigint` -### eipBlock - -▸ **eipBlock**(`eip`): ``null`` \| `bigint` +Defined in: [common.ts:535](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L535) Returns the hardfork change block for eip #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `eip` | `number` | EIP number | +##### eip + +`number` + +EIP number #### Returns -``null`` \| `bigint` +`null` \| `bigint` Block number or null if unscheduled -#### Defined in +*** -[common.ts:766](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L766) +### eips() -___ +> **eips**(): `number`[] -### eipTimestamp +Defined in: [common.ts:770](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L770) -▸ **eipTimestamp**(`eip`): ``null`` \| `bigint` +Returns the additionally activated EIPs +(by using the `eips` constructor option) -Returns the scheduled timestamp of the EIP (if scheduled and scheduled by timestamp) +#### Returns -#### Parameters +`number`[] -| Name | Type | Description | -| :------ | :------ | :------ | -| `eip` | `number` | EIP number | +List of EIPs -#### Returns +*** -``null`` \| `bigint` +### eipTimestamp() -Scheduled timestamp. If this EIP is unscheduled, or the EIP is scheduled by block number or ttd, then it returns `null`. +> **eipTimestamp**(`eip`): `null` \| `bigint` -#### Defined in +Defined in: [common.ts:553](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L553) -[common.ts:784](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L784) +Returns the scheduled timestamp of the EIP (if scheduled and scheduled by timestamp) -___ +#### Parameters -### eips +##### eip -▸ **eips**(): `number`[] +`number` -Returns the additionally activated EIPs -(by using the `eips` constructor option) +EIP number #### Returns -`number`[] +`null` \| `bigint` -List of EIPs - -#### Defined in +Scheduled timestamp. If this EIP is unscheduled, or the EIP is scheduled by block number, then it returns `null`. -[common.ts:1024](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L1024) +*** -___ +### forkHash() -### forkHash +> **forkHash**(`hardfork?`, `genesisHash?`): `` `0x${string}` `` -▸ **forkHash**(`hardfork?`, `genesisHash?`): `string` +Defined in: [common.ts:660](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L660) Returns an eth/64 compliant fork hash (EIP-2124) #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardfork?` | `string` | Hardfork name, optional if HF set | -| `genesisHash?` | `Uint8Array` | Genesis block hash of the chain, optional if already defined and not needed to be calculated | - -#### Returns +##### hardfork? `string` -#### Defined in +Hardfork name, optional if HF set + +##### genesisHash? + +`Uint8Array`\<`ArrayBufferLike`\> -[common.ts:905](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L905) +Genesis block hash of the network, optional if already defined and not needed to be calculated -___ +#### Returns + +`` `0x${string}` `` + +*** -### genesis +### genesis() -▸ **genesis**(): [`GenesisBlockConfig`](../interfaces/GenesisBlockConfig.md) +> **genesis**(): [`GenesisBlockConfig`](../interfaces/GenesisBlockConfig.md) + +Defined in: [common.ts:709](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L709) Returns the Genesis parameters of the current chain @@ -393,28 +327,22 @@ Returns the Genesis parameters of the current chain Genesis dictionary -#### Defined in - -[common.ts:955](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L955) +*** -___ +### getHardforkBy() -### getHardforkBy +> **getHardforkBy**(`opts`): `string` -▸ **getHardforkBy**(`opts`): `string` +Defined in: [common.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L169) -Returns the hardfork either based on block numer (older HFs) or +Returns the hardfork either based on block number (older HFs) or timestamp (Shanghai upwards). -An optional TD takes precedence in case the corresponding HF block -is set to `null` or otherwise needs to match (if not an error -will be thrown). - #### Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`HardforkByOpts`](../interfaces/HardforkByOpts.md) | +##### opts + +[`HardforkByOpts`](../interfaces/HardforkByOpts.md) #### Returns @@ -422,23 +350,23 @@ will be thrown). The name of the HF -#### Defined in - -[common.ts:330](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L330) +*** -___ +### gteHardfork() -### gteHardfork +> **gteHardfork**(`hardfork`): `boolean` -▸ **gteHardfork**(`hardfork`): `boolean` +Defined in: [common.ts:503](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L503) Alias to hardforkGteHardfork when hardfork is set #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardfork` | `string` | Hardfork name | +##### hardfork + +`string` + +Hardfork name #### Returns @@ -446,15 +374,13 @@ Alias to hardforkGteHardfork when hardfork is set True if hardfork set is greater than hardfork provided -#### Defined in - -[common.ts:734](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L734) +*** -___ +### hardfork() -### hardfork +> **hardfork**(): `string` -▸ **hardfork**(): `string` +Defined in: [common.ts:745](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L745) Returns the hardfork set @@ -464,155 +390,117 @@ Returns the hardfork set Hardfork name -#### Defined in +*** -[common.ts:991](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L991) +### hardforkBlock() -___ +> **hardforkBlock**(`hardfork?`): `null` \| `bigint` -### hardforkBlock - -▸ **hardforkBlock**(`hardfork?`): ``null`` \| `bigint` +Defined in: [common.ts:512](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L512) Returns the hardfork change block for hardfork provided or set #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardfork?` | `string` | Hardfork name, optional if HF set | +##### hardfork? + +`string` + +Hardfork name, optional if HF set #### Returns -``null`` \| `bigint` +`null` \| `bigint` Block number or null if unscheduled -#### Defined in - -[common.ts:743](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L743) +*** -___ +### hardforkForForkHash() -### hardforkForForkHash +> **hardforkForForkHash**(`forkHash`): `null` \| [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md) -▸ **hardforkForForkHash**(`forkHash`): ``null`` \| [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md) +Defined in: [common.ts:680](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L680) #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `forkHash` | `string` | Fork hash as a hex string | +##### forkHash + +`string` + +Fork hash as a hex string #### Returns -``null`` \| [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md) +`null` \| [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md) Array with hardfork data (name, block, forkHash) -#### Defined in - -[common.ts:927](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L927) +*** -___ +### hardforkGteHardfork() -### hardforkGteHardfork +> **hardforkGteHardfork**(`hardfork1`, `hardfork2`): `boolean` -▸ **hardforkGteHardfork**(`hardfork1`, `hardfork2`): `boolean` +Defined in: [common.ts:483](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L483) Sequence based check if given or set HF1 is greater than or equal HF2 #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardfork1` | ``null`` \| `string` | Hardfork name or null (if set) | -| `hardfork2` | `string` | Hardfork name | - -#### Returns - -`boolean` - -True if HF1 gte HF2 - -#### Defined in - -[common.ts:714](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L714) - -___ +##### hardfork1 -### hardforkIsActiveOnBlock +Hardfork name or null (if set) -▸ **hardforkIsActiveOnBlock**(`hardfork`, `blockNumber`): `boolean` +`null` | `string` -Checks if set or provided hardfork is active on block number +##### hardfork2 -#### Parameters +`string` -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardfork` | ``null`` \| `string` | Hardfork name or null (for HF set) | -| `blockNumber` | `BigIntLike` | | +Hardfork name #### Returns `boolean` -True if HF is active on block number - -#### Defined in +True if HF1 gte HF2 -[common.ts:688](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L688) +*** -___ +### hardforkIsActiveOnBlock() -### hardforkTTD +> **hardforkIsActiveOnBlock**(`hardfork`, `blockNumber`): `boolean` -▸ **hardforkTTD**(`hardfork?`): ``null`` \| `bigint` +Defined in: [common.ts:457](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L457) -Returns the hardfork change total difficulty (Merge HF) for hardfork provided or set +Checks if set or provided hardfork is active on block number #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardfork?` | `string` | Hardfork name, optional if HF set | - -#### Returns - -``null`` \| `bigint` - -Total difficulty or null if no set - -#### Defined in +##### hardfork -[common.ts:802](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L802) +Hardfork name or null (for HF set) -___ +`null` | `string` -### hardforkTimestamp +##### blockNumber -▸ **hardforkTimestamp**(`hardfork?`): ``null`` \| `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hardfork?` | `string` | +`BigIntLike` #### Returns -``null`` \| `bigint` +`boolean` -#### Defined in +True if HF is active on block number -[common.ts:752](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L752) +*** -___ +### hardforks() -### hardforks +> **hardforks**(): [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md)[] -▸ **hardforks**(): [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md)[] +Defined in: [common.ts:717](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L717) Returns the hardforks for current chain @@ -622,84 +510,80 @@ Returns the hardforks for current chain Array with arrays of hardforks -#### Defined in - -[common.ts:963](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L963) +*** -___ +### hardforkTimestamp() -### isActivatedEIP +> **hardforkTimestamp**(`hardfork?`): `null` \| `bigint` -▸ **isActivatedEIP**(`eip`): `boolean` - -Checks if an EIP is activated by either being included in the EIPs -manually passed in with the [eips](../interfaces/CommonOpts.md#eips) or in a -hardfork currently being active - -Note: this method only works for EIPs being supported -by the [eips](../interfaces/CommonOpts.md#eips) constructor option +Defined in: [common.ts:521](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L521) #### Parameters -| Name | Type | -| :------ | :------ | -| `eip` | `number` | +##### hardfork? + +`string` #### Returns -`boolean` +`null` \| `bigint` -#### Defined in +*** -[common.ts:675](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L675) +### isActivatedEIP() -___ +> **isActivatedEIP**(`eip`): `boolean` -### networkId +Defined in: [common.ts:444](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L444) -▸ **networkId**(): `bigint` +Checks if an EIP is activated by either being included in the EIPs +manually passed in with the [CommonOpts.eips](../interfaces/BaseOpts.md#eips) or in a +hardfork currently being active -Returns the Id of current network +Note: this method only works for EIPs being supported +by the [CommonOpts.eips](../interfaces/BaseOpts.md#eips) constructor option -#### Returns +#### Parameters -`bigint` +##### eip + +`number` -network Id +#### Returns -#### Defined in +`boolean` -[common.ts:1015](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L1015) +*** -___ +### nextHardforkBlockOrTimestamp() -### nextHardforkBlockOrTimestamp +> **nextHardforkBlockOrTimestamp**(`hardfork?`): `null` \| `bigint` -▸ **nextHardforkBlockOrTimestamp**(`hardfork?`): ``null`` \| `bigint` +Defined in: [common.ts:571](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L571) Returns the change block for the next hardfork after the hardfork provided or set #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardfork?` | `string` | Hardfork name, optional if HF set | +##### hardfork? + +`string` + +Hardfork name, optional if HF set #### Returns -``null`` \| `bigint` +`null` \| `bigint` Block timestamp, number or null if not available -#### Defined in - -[common.ts:816](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L816) +*** -___ +### param() -### param +> **param**(`name`): `bigint` -▸ **param**(`topic`, `name`): `bigint` +Defined in: [common.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L360) Returns a parameter for the current chain setup @@ -709,327 +593,259 @@ a change on the respective parameter. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `topic` | `string` | Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') | -| `name` | `string` | Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) | +##### name + +`string` + +Parameter name (e.g. 'minGasLimit') #### Returns `bigint` -The value requested or `BigInt(0)` if not found - -#### Defined in +The value requested (throws if not found) -[common.ts:579](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L579) +*** -___ +### paramByBlock() -### paramByBlock +> **paramByBlock**(`name`, `blockNumber`, `timestamp?`): `bigint` -▸ **paramByBlock**(`topic`, `name`, `blockNumber`, `td?`, `timestamp?`): `bigint` +Defined in: [common.ts:430](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L430) Returns a parameter for the hardfork active on block number or optional provided total difficulty (Merge HF) #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `topic` | `string` | Parameter topic | -| `name` | `string` | Parameter name | -| `blockNumber` | `BigIntLike` | Block number | -| `td?` | `BigIntLike` | Total difficulty * | -| `timestamp?` | `BigIntLike` | - | - -#### Returns - -`bigint` - -The value requested or `BigInt(0)` if not found +##### name -#### Defined in - -[common.ts:655](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L655) +`string` -___ +Parameter name -### paramByEIP +##### blockNumber -▸ **paramByEIP**(`topic`, `name`, `eip`): `undefined` \| `bigint` +`BigIntLike` -Returns a parameter corresponding to an EIP +Block number + * -#### Parameters +##### timestamp? -| Name | Type | Description | -| :------ | :------ | :------ | -| `topic` | `string` | Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') | -| `name` | `string` | Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) | -| `eip` | `number` | Number of the EIP | +`BigIntLike` #### Returns -`undefined` \| `bigint` - -The value requested or `undefined` if not found +`bigint` -#### Defined in +The value requested or `BigInt(0)` if not found -[common.ts:630](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L630) +*** -___ +### paramByEIP() -### paramByHardfork +> **paramByEIP**(`name`, `eip`): `undefined` \| `bigint` -▸ **paramByHardfork**(`topic`, `name`, `hardfork`): `bigint` +Defined in: [common.ts:410](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L410) -Returns the parameter corresponding to a hardfork +Returns a parameter corresponding to an EIP #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `topic` | `string` | Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') | -| `name` | `string` | Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) | -| `hardfork` | `string` | Hardfork name | +##### name -#### Returns +`string` -`bigint` +Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) -The value requested or `BigInt(0)` if not found +##### eip -#### Defined in +`number` -[common.ts:599](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L599) +Number of the EIP -___ +#### Returns -### setChain +`undefined` \| `bigint` -▸ **setChain**(`chain`): [`ChainConfig`](../interfaces/ChainConfig.md) +The value requested (throws if not found) -Sets the chain +*** -#### Parameters +### paramByHardfork() -| Name | Type | Description | -| :------ | :------ | :------ | -| `chain` | `string` \| `number` \| `bigint` \| `object` | String ('mainnet') or Number (1) chain representation. Or, a Dictionary of chain parameters for a private network. | +> **paramByHardfork**(`name`, `hardfork`): `bigint` -#### Returns +Defined in: [common.ts:376](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L376) -[`ChainConfig`](../interfaces/ChainConfig.md) +Returns the parameter corresponding to a hardfork -The dictionary with parameters set as chain +#### Parameters -#### Defined in +##### name -[common.ts:270](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L270) +`string` -___ +Parameter name (e.g. 'minGasLimit') -### setEIPs +##### hardfork -▸ **setEIPs**(`eips?`): `void` +`string` -Sets the active EIPs +Hardfork name -#### Parameters +#### Returns -| Name | Type | Default value | -| :------ | :------ | :------ | -| `eips` | `number`[] | `[]` | +`bigint` -#### Returns +The value requested (throws if not found) -`void` +*** -#### Defined in +### resetParams() -[common.ts:469](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L469) +> **resetParams**(`params`): `void` -___ +Defined in: [common.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L135) -### setForkHashes +Fully resets the internal Common EIP params set with the values provided. -▸ **setForkHashes**(`genesisHash`): `void` +Example Format: -Sets any missing forkHashes on the passed-in [Common](Common.md) instance +```ts +{ + 1559: { + initialBaseFee: 1000000000, + } +} +``` #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `genesisHash` | `Uint8Array` | The genesis block hash | +##### params + +[`ParamsDict`](../type-aliases/ParamsDict.md) #### Returns `void` -#### Defined in - -[common.ts:939](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L939) +*** -___ +### setEIPs() -### setHardfork +> **setEIPs**(`eips`): `void` -▸ **setHardfork**(`hardfork`): `void` +Defined in: [common.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L275) -Sets the hardfork to get params for +Sets the active EIPs #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardfork` | `string` | String identifier (e.g. 'byzantium') or [Hardfork](../enums/Hardfork.md) enum | +##### eips + +`number`[] = `[]` #### Returns `void` -#### Defined in +*** -[common.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L301) +### setForkHashes() -___ +> **setForkHashes**(`genesisHash`): `void` -### setHardforkBy - -▸ **setHardforkBy**(`opts`): `string` - -Sets a new hardfork either based on block numer (older HFs) or -timestamp (Shanghai upwards). +Defined in: [common.ts:692](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L692) -An optional TD takes precedence in case the corresponding HF block -is set to `null` or otherwise needs to match (if not an error -will be thrown). +Sets any missing forkHashes on the passed-in Common instance #### Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`HardforkByOpts`](../interfaces/HardforkByOpts.md) | +##### genesisHash -#### Returns - -`string` - -The name of the HF set - -#### Defined in +`Uint8Array` -[common.ts:446](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L446) +The genesis block hash -___ - -### custom - -▸ `Static` **custom**(`chainParamsOrName`, `opts?`): [`Common`](Common.md) +#### Returns -Creates a [Common](Common.md) object for a custom chain, based on a standard one. +`void` -It uses all the [Chain](../enums/Chain.md) parameters from the baseChain option except the ones overridden -in a provided chainParamsOrName dictionary. Some usage example: +*** -```javascript -Common.custom({chainId: 123}) -``` +### setHardfork() -There are also selected supported custom chains which can be initialized by using one of the -CustomChains for chainParamsOrName, e.g.: +> **setHardfork**(`hardfork`): `void` -```javascript -Common.custom(CustomChains.MaticMumbai) -``` +Defined in: [common.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L144) -Note that these supported custom chains only provide some base parameters (usually the chain and -network ID and a name) and can only be used for selected use cases (e.g. sending a tx with -the `@ethereumjs/tx` library to a Layer-2 chain). +Sets the hardfork to get params for #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `chainParamsOrName` | `Partial`<[`ChainConfig`](../interfaces/ChainConfig.md)\> \| [`CustomChain`](../enums/CustomChain.md) | Custom parameter dict (`name` will default to `custom-chain`) or string with name of a supported custom chain | -| `opts` | [`CustomCommonOpts`](../interfaces/CustomCommonOpts.md) | Custom chain options to set the [baseChain](../interfaces/CustomCommonOpts.md#basechain), selected [hardfork](../interfaces/CustomCommonOpts.md#hardfork) and others | - -#### Returns - -[`Common`](Common.md) - -#### Defined in - -[common.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L95) - -___ +##### hardfork -### fromGethGenesis - -▸ `Static` **fromGethGenesis**(`genesisJson`, `to`): [`Common`](Common.md) - -Static method to load and set common from a geth genesis json - -#### Parameters +`string` -| Name | Type | Description | -| :------ | :------ | :------ | -| `genesisJson` | `any` | json of geth configuration | -| `to` | [`GethConfigOpts`](../interfaces/GethConfigOpts.md) | further configure the common instance | +String identifier (e.g. 'byzantium') or [Hardfork](../variables/Hardfork.md) enum #### Returns -[`Common`](Common.md) - -Common +`void` -#### Defined in +*** -[common.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L186) +### setHardforkBy() -___ +> **setHardforkBy**(`opts`): `string` -### getInitializedChains +Defined in: [common.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L252) -▸ `Static` **getInitializedChains**(`customChains?`): [`ChainsConfig`](../interfaces/ChainsConfig.md) +Sets a new hardfork either based on block number (older HFs) or +timestamp (Shanghai upwards). #### Parameters -| Name | Type | -| :------ | :------ | -| `customChains?` | [`ChainConfig`](../interfaces/ChainConfig.md)[] | +##### opts + +[`HardforkByOpts`](../interfaces/HardforkByOpts.md) #### Returns -[`ChainsConfig`](../interfaces/ChainsConfig.md) +`string` -#### Defined in +The name of the HF set -[common.ts:1109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L1109) +*** -___ +### updateParams() -### isSupportedChainId +> **updateParams**(`params`): `void` -▸ `Static` **isSupportedChainId**(`chainId`): `boolean` +Defined in: [common.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L108) -Static method to determine if a [chainId](Common.md#chainid) is supported as a standard chain +Update the internal Common EIP params set. Existing values +will get preserved unless there is a new value for a parameter +provided with params. -#### Parameters +Example Format: -| Name | Type | Description | -| :------ | :------ | :------ | -| `chainId` | `bigint` | bigint id (`1`) of a standard chain | +```ts +{ + 1559: { + initialBaseFee: 1000000000, + } +} +``` -#### Returns +#### Parameters -`boolean` +##### params -boolean +[`ParamsDict`](../type-aliases/ParamsDict.md) -#### Defined in +#### Returns -[common.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L209) +`void` diff --git a/packages/common/docs/enums/Chain.md b/packages/common/docs/enums/Chain.md deleted file mode 100644 index c04f0e52c0c..00000000000 --- a/packages/common/docs/enums/Chain.md +++ /dev/null @@ -1,63 +0,0 @@ -[@ethereumjs/common](../README.md) / Chain - -# Enumeration: Chain - -## Table of contents - -### Enumeration Members - -- [Goerli](Chain.md#goerli) -- [Holesky](Chain.md#holesky) -- [Kaustinen](Chain.md#kaustinen) -- [Mainnet](Chain.md#mainnet) -- [Sepolia](Chain.md#sepolia) - -## Enumeration Members - -### Goerli - -• **Goerli** = ``5`` - -#### Defined in - -[enums.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L5) - -___ - -### Holesky - -• **Holesky** = ``17000`` - -#### Defined in - -[enums.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L7) - -___ - -### Kaustinen - -• **Kaustinen** = ``69420`` - -#### Defined in - -[enums.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L8) - -___ - -### Mainnet - -• **Mainnet** = ``1`` - -#### Defined in - -[enums.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L4) - -___ - -### Sepolia - -• **Sepolia** = ``11155111`` - -#### Defined in - -[enums.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L6) diff --git a/packages/common/docs/enums/ConsensusAlgorithm.md b/packages/common/docs/enums/ConsensusAlgorithm.md deleted file mode 100644 index 78869033b45..00000000000 --- a/packages/common/docs/enums/ConsensusAlgorithm.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/common](../README.md) / ConsensusAlgorithm - -# Enumeration: ConsensusAlgorithm - -## Table of contents - -### Enumeration Members - -- [Casper](ConsensusAlgorithm.md#casper) -- [Clique](ConsensusAlgorithm.md#clique) -- [Ethash](ConsensusAlgorithm.md#ethash) - -## Enumeration Members - -### Casper - -• **Casper** = ``"casper"`` - -#### Defined in - -[enums.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L85) - -___ - -### Clique - -• **Clique** = ``"clique"`` - -#### Defined in - -[enums.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L84) - -___ - -### Ethash - -• **Ethash** = ``"ethash"`` - -#### Defined in - -[enums.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L83) diff --git a/packages/common/docs/enums/ConsensusType.md b/packages/common/docs/enums/ConsensusType.md deleted file mode 100644 index 9040a89b8dd..00000000000 --- a/packages/common/docs/enums/ConsensusType.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/common](../README.md) / ConsensusType - -# Enumeration: ConsensusType - -## Table of contents - -### Enumeration Members - -- [ProofOfAuthority](ConsensusType.md#proofofauthority) -- [ProofOfStake](ConsensusType.md#proofofstake) -- [ProofOfWork](ConsensusType.md#proofofwork) - -## Enumeration Members - -### ProofOfAuthority - -• **ProofOfAuthority** = ``"poa"`` - -#### Defined in - -[enums.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L79) - -___ - -### ProofOfStake - -• **ProofOfStake** = ``"pos"`` - -#### Defined in - -[enums.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L77) - -___ - -### ProofOfWork - -• **ProofOfWork** = ``"pow"`` - -#### Defined in - -[enums.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L78) diff --git a/packages/common/docs/enums/CustomChain.md b/packages/common/docs/enums/CustomChain.md deleted file mode 100644 index 01d4fbd5485..00000000000 --- a/packages/common/docs/enums/CustomChain.md +++ /dev/null @@ -1,98 +0,0 @@ -[@ethereumjs/common](../README.md) / CustomChain - -# Enumeration: CustomChain - -## Table of contents - -### Enumeration Members - -- [ArbitrumOne](CustomChain.md#arbitrumone) -- [OptimisticEthereum](CustomChain.md#optimisticethereum) -- [OptimisticKovan](CustomChain.md#optimistickovan) -- [PolygonMainnet](CustomChain.md#polygonmainnet) -- [PolygonMumbai](CustomChain.md#polygonmumbai) -- [xDaiChain](CustomChain.md#xdaichain) - -## Enumeration Members - -### ArbitrumOne - -• **ArbitrumOne** = ``"arbitrum-one"`` - -Arbitrum One - mainnet for Arbitrum roll-up - -- [Documentation](https://developer.offchainlabs.com/public-chains) - -#### Defined in - -[enums.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L108) - -___ - -### OptimisticEthereum - -• **OptimisticEthereum** = ``"optimistic-ethereum"`` - -Optimistic Ethereum - mainnet for Optimism roll-up - -- [Documentation](https://community.optimism.io/docs/developers/tutorials.html) - -#### Defined in - -[enums.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L129) - -___ - -### OptimisticKovan - -• **OptimisticKovan** = ``"optimistic-kovan"`` - -Optimistic Kovan - testnet for Optimism roll-up - -- [Documentation](https://community.optimism.io/docs/developers/tutorials.html) - -#### Defined in - -[enums.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L122) - -___ - -### PolygonMainnet - -• **PolygonMainnet** = ``"polygon-mainnet"`` - -Polygon (Matic) Mainnet - -- [Documentation](https://docs.matic.network/docs/develop/network-details/network) - -#### Defined in - -[enums.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L94) - -___ - -### PolygonMumbai - -• **PolygonMumbai** = ``"polygon-mumbai"`` - -Polygon (Matic) Mumbai Testnet - -- [Documentation](https://docs.matic.network/docs/develop/network-details/network) - -#### Defined in - -[enums.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L101) - -___ - -### xDaiChain - -• **xDaiChain** = ``"x-dai-chain"`` - -xDai EVM sidechain with a native stable token - -- [Documentation](https://www.xdaichain.com/) - -#### Defined in - -[enums.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L115) diff --git a/packages/common/docs/enums/Hardfork.md b/packages/common/docs/enums/Hardfork.md deleted file mode 100644 index 2500a73b519..00000000000 --- a/packages/common/docs/enums/Hardfork.md +++ /dev/null @@ -1,217 +0,0 @@ -[@ethereumjs/common](../README.md) / Hardfork - -# Enumeration: Hardfork - -## Table of contents - -### Enumeration Members - -- [ArrowGlacier](Hardfork.md#arrowglacier) -- [Berlin](Hardfork.md#berlin) -- [Byzantium](Hardfork.md#byzantium) -- [Cancun](Hardfork.md#cancun) -- [Chainstart](Hardfork.md#chainstart) -- [Constantinople](Hardfork.md#constantinople) -- [Dao](Hardfork.md#dao) -- [GrayGlacier](Hardfork.md#grayglacier) -- [Homestead](Hardfork.md#homestead) -- [Istanbul](Hardfork.md#istanbul) -- [London](Hardfork.md#london) -- [MergeForkIdTransition](Hardfork.md#mergeforkidtransition) -- [MuirGlacier](Hardfork.md#muirglacier) -- [Paris](Hardfork.md#paris) -- [Petersburg](Hardfork.md#petersburg) -- [Prague](Hardfork.md#prague) -- [Shanghai](Hardfork.md#shanghai) -- [SpuriousDragon](Hardfork.md#spuriousdragon) -- [TangerineWhistle](Hardfork.md#tangerinewhistle) - -## Enumeration Members - -### ArrowGlacier - -• **ArrowGlacier** = ``"arrowGlacier"`` - -#### Defined in - -[enums.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L67) - -___ - -### Berlin - -• **Berlin** = ``"berlin"`` - -#### Defined in - -[enums.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L65) - -___ - -### Byzantium - -• **Byzantium** = ``"byzantium"`` - -#### Defined in - -[enums.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L60) - -___ - -### Cancun - -• **Cancun** = ``"cancun"`` - -#### Defined in - -[enums.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L72) - -___ - -### Chainstart - -• **Chainstart** = ``"chainstart"`` - -#### Defined in - -[enums.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L55) - -___ - -### Constantinople - -• **Constantinople** = ``"constantinople"`` - -#### Defined in - -[enums.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L61) - -___ - -### Dao - -• **Dao** = ``"dao"`` - -#### Defined in - -[enums.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L57) - -___ - -### GrayGlacier - -• **GrayGlacier** = ``"grayGlacier"`` - -#### Defined in - -[enums.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L68) - -___ - -### Homestead - -• **Homestead** = ``"homestead"`` - -#### Defined in - -[enums.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L56) - -___ - -### Istanbul - -• **Istanbul** = ``"istanbul"`` - -#### Defined in - -[enums.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L63) - -___ - -### London - -• **London** = ``"london"`` - -#### Defined in - -[enums.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L66) - -___ - -### MergeForkIdTransition - -• **MergeForkIdTransition** = ``"mergeForkIdTransition"`` - -#### Defined in - -[enums.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L69) - -___ - -### MuirGlacier - -• **MuirGlacier** = ``"muirGlacier"`` - -#### Defined in - -[enums.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L64) - -___ - -### Paris - -• **Paris** = ``"paris"`` - -#### Defined in - -[enums.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L70) - -___ - -### Petersburg - -• **Petersburg** = ``"petersburg"`` - -#### Defined in - -[enums.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L62) - -___ - -### Prague - -• **Prague** = ``"prague"`` - -#### Defined in - -[enums.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L73) - -___ - -### Shanghai - -• **Shanghai** = ``"shanghai"`` - -#### Defined in - -[enums.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L71) - -___ - -### SpuriousDragon - -• **SpuriousDragon** = ``"spuriousDragon"`` - -#### Defined in - -[enums.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L59) - -___ - -### TangerineWhistle - -• **TangerineWhistle** = ``"tangerineWhistle"`` - -#### Defined in - -[enums.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L58) diff --git a/packages/common/docs/functions/createCommonFromGethGenesis.md b/packages/common/docs/functions/createCommonFromGethGenesis.md new file mode 100644 index 00000000000..2e7f3e6e9ea --- /dev/null +++ b/packages/common/docs/functions/createCommonFromGethGenesis.md @@ -0,0 +1,31 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / createCommonFromGethGenesis + +# Function: createCommonFromGethGenesis() + +> **createCommonFromGethGenesis**(`genesisJSON`, `opts`): [`Common`](../classes/Common.md) + +Defined in: [constructors.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/constructors.ts#L42) + +Static method to load and set common from a geth genesis object + +## Parameters + +### genesisJSON + +[`GethGenesis`](../interfaces/GethGenesis.md) + +### opts + +[`GethConfigOpts`](../interfaces/GethConfigOpts.md) + +additional [GethConfigOpts](../interfaces/GethConfigOpts.md) for configuring common + +## Returns + +[`Common`](../classes/Common.md) + +Common diff --git a/packages/common/docs/functions/createCustomCommon.md b/packages/common/docs/functions/createCustomCommon.md new file mode 100644 index 00000000000..346193303c0 --- /dev/null +++ b/packages/common/docs/functions/createCustomCommon.md @@ -0,0 +1,44 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / createCustomCommon + +# Function: createCustomCommon() + +> **createCustomCommon**(`partialConfig`, `baseChain`, `opts`): [`Common`](../classes/Common.md) + +Defined in: [constructors.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/constructors.ts#L22) + +Creates a [Common](../classes/Common.md) object for a custom chain, based on a standard one. + +It uses all the [Chain](../type-aliases/Chain.md) parameters from the [baseChain](#createcustomcommon) option except the ones overridden +in a provided chainParamsOrName dictionary. Some usage example: + +```javascript +import { createCustomCommon, Mainnet } from '@ethereumjs/common' + +createCustomCommon({chainId: 123}, Mainnet) +`` + +@param partialConfig Custom parameter dict +@param baseChain `ChainConfig` chain configuration taken as a base chain, e.g. `Mainnet` (exported at root level) +@param opts Custom chain options to set various {@link BaseOpts} + +## Parameters + +### partialConfig + +`Partial`\<[`ChainConfig`](../interfaces/ChainConfig.md)\> + +### baseChain + +[`ChainConfig`](../interfaces/ChainConfig.md) + +### opts + +[`BaseOpts`](../interfaces/BaseOpts.md) = `{}` + +## Returns + +[`Common`](../classes/Common.md) diff --git a/packages/common/docs/functions/getPresetChainConfig.md b/packages/common/docs/functions/getPresetChainConfig.md new file mode 100644 index 00000000000..87e3489d05a --- /dev/null +++ b/packages/common/docs/functions/getPresetChainConfig.md @@ -0,0 +1,27 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / getPresetChainConfig + +# Function: getPresetChainConfig() + +> **getPresetChainConfig**(`chain`): [`ChainConfig`](../interfaces/ChainConfig.md) + +Defined in: [utils.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/utils.ts#L304) + +Return the preset chain config for one of the predefined chain configurations + +## Parameters + +### chain + +the representing a network name (e.g. 'mainnet') or number representing the chain ID + +`string` | `number` + +## Returns + +[`ChainConfig`](../interfaces/ChainConfig.md) + +a [ChainConfig](../interfaces/ChainConfig.md) diff --git a/packages/common/docs/functions/parseGethGenesis.md b/packages/common/docs/functions/parseGethGenesis.md new file mode 100644 index 00000000000..c4c5e610032 --- /dev/null +++ b/packages/common/docs/functions/parseGethGenesis.md @@ -0,0 +1,109 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / parseGethGenesis + +# Function: parseGethGenesis() + +> **parseGethGenesis**(`gethGenesis`, `name?`): `object` + +Defined in: [utils.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/utils.ts#L277) + +Parses a genesis object exported from Geth into parameters for Common instance + +## Parameters + +### gethGenesis + +[`GethGenesis`](../interfaces/GethGenesis.md) + +GethGenesis object + +### name? + +`string` + +optional chain name + +## Returns + +`object` + +parsed params + +### bootstrapNodes + +> **bootstrapNodes**: `never`[] = `[]` + +### chainId + +> **chainId**: `number` + +### consensus + +> **consensus**: \{ `algorithm`: `string`; `clique`: \{ `epoch`: `undefined` \| `number`; `period`: `undefined` \| `number`; \}; `ethash?`: `undefined`; `type`: `string`; \} \| \{ `algorithm`: `string`; `clique?`: `undefined`; `ethash`: \{ \}; `type`: `string`; \} + +### customHardforks + +> **customHardforks**: `undefined` \| [`HardforksDict`](../type-aliases/HardforksDict.md) + +### depositContractAddress + +> **depositContractAddress**: `undefined` \| `string` + +### genesis + +> **genesis**: `object` + +#### genesis.baseFeePerGas + +> **baseFeePerGas**: `undefined` \| `null` \| `number` \| `` `0x${string}` `` + +#### genesis.coinbase + +> **coinbase**: `undefined` \| `` `0x${string}` `` + +#### genesis.difficulty + +> **difficulty**: `undefined` \| `` `0x${string}` `` + +#### genesis.excessBlobGas + +> **excessBlobGas**: `undefined` \| `string` + +#### genesis.extraData + +> **extraData**: `` `0x${string}` `` + +#### genesis.gasLimit + +> **gasLimit**: `` `0x${string}` `` + +#### genesis.mixHash + +> **mixHash**: `undefined` \| `` `0x${string}` `` + +#### genesis.nonce + +> **nonce**: `` `0x${string}` `` + +#### genesis.requestsHash + +> **requestsHash**: `undefined` \| `string` + +#### genesis.timestamp + +> **timestamp**: `` `0x${string}` `` + +### hardfork + +> **hardfork**: `undefined` \| `string` + +### hardforks + +> **hardforks**: `ConfigHardfork`[] + +### name + +> **name**: `undefined` \| `string` diff --git a/packages/common/docs/functions/parseGethGenesisState.md b/packages/common/docs/functions/parseGethGenesisState.md new file mode 100644 index 00000000000..2f6073d3fa7 --- /dev/null +++ b/packages/common/docs/functions/parseGethGenesisState.md @@ -0,0 +1,25 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / parseGethGenesisState + +# Function: parseGethGenesisState() + +> **parseGethGenesisState**(`gethGenesis`): [`GenesisState`](../interfaces/GenesisState.md) + +Defined in: [gethGenesis.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L151) + +Parses the geth genesis state into Blockchain [GenesisState](../interfaces/GenesisState.md) + +## Parameters + +### gethGenesis + +[`GethGenesis`](../interfaces/GethGenesis.md) + +GethGenesis object + +## Returns + +[`GenesisState`](../interfaces/GenesisState.md) diff --git a/packages/common/docs/interfaces/BaseOpts.md b/packages/common/docs/interfaces/BaseOpts.md new file mode 100644 index 00000000000..217a8872bbe --- /dev/null +++ b/packages/common/docs/interfaces/BaseOpts.md @@ -0,0 +1,82 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / BaseOpts + +# Interface: BaseOpts + +Defined in: [types.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L99) + +## Extended by + +- [`CommonOpts`](CommonOpts.md) +- [`GethConfigOpts`](GethConfigOpts.md) + +## Properties + +### customCrypto? + +> `optional` **customCrypto**: [`CustomCrypto`](CustomCrypto.md) + +Defined in: [types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L143) + +This option can be used to replace the most common crypto primitives +(keccak256 hashing e.g.) within the EthereumJS ecosystem libraries +with alternative implementations (e.g. more performant WASM libraries). + +Note: please be aware that this is adding new dependencies for your +system setup to be used for sensitive/core parts of the functionality +and a choice on the libraries to add should be handled with care +and be made with eventual security implications considered. + +*** + +### eips? + +> `optional` **eips**: `number`[] + +Defined in: [types.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L114) + +Selected EIPs which can be activated, please use an array for instantiation +(e.g. `eips: [ 2537, ]`) + +Currently supported: + +- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS12-381 precompiles + +*** + +### hardfork? + +> `optional` **hardfork**: `string` + +Defined in: [types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L105) + +String identifier ('byzantium') for hardfork or [Hardfork](../variables/Hardfork.md) enum. + +Default: Hardfork.London + +*** + +### params? + +> `optional` **params**: [`ParamsDict`](../type-aliases/ParamsDict.md) + +Defined in: [types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L132) + +Optionally pass in an EIP params dictionary, see one of the +EthereumJS library `params.ts` files for an example (e.g. tx, evm). +By default parameters are set by the respective library, so this +is only relevant if you want to use EthereumJS libraries with a +custom parameter set. + +Example Format: + +```ts +{ + 1559: { + initialBaseFee: 1000000000, + } +} +``` diff --git a/packages/common/docs/interfaces/BinaryTreeAccessWitnessInterface.md b/packages/common/docs/interfaces/BinaryTreeAccessWitnessInterface.md new file mode 100644 index 00000000000..fa7684b0e98 --- /dev/null +++ b/packages/common/docs/interfaces/BinaryTreeAccessWitnessInterface.md @@ -0,0 +1,291 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / BinaryTreeAccessWitnessInterface + +# Interface: BinaryTreeAccessWitnessInterface + +Defined in: [interfaces.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L104) + +## Methods + +### accesses() + +> **accesses**(): `Generator`\<[`BinaryTreeAccessedStateWithAddress`](../type-aliases/BinaryTreeAccessedStateWithAddress.md)\> + +Defined in: [interfaces.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L105) + +#### Returns + +`Generator`\<[`BinaryTreeAccessedStateWithAddress`](../type-aliases/BinaryTreeAccessedStateWithAddress.md)\> + +*** + +### commit() + +> **commit**(): `void` + +Defined in: [interfaces.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L119) + +#### Returns + +`void` + +*** + +### debugWitnessCost() + +> **debugWitnessCost**(): `void` + +Defined in: [interfaces.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L107) + +#### Returns + +`void` + +*** + +### merge() + +> **merge**(`accessWitness`): `void` + +Defined in: [interfaces.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L118) + +#### Parameters + +##### accessWitness + +`BinaryTreeAccessWitnessInterface` + +#### Returns + +`void` + +*** + +### rawAccesses() + +> **rawAccesses**(): `Generator`\<[`RawBinaryTreeAccessedState`](../type-aliases/RawBinaryTreeAccessedState.md)\> + +Defined in: [interfaces.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L106) + +#### Returns + +`Generator`\<[`RawBinaryTreeAccessedState`](../type-aliases/RawBinaryTreeAccessedState.md)\> + +*** + +### readAccountBasicData() + +> **readAccountBasicData**(`address`): `bigint` + +Defined in: [interfaces.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L108) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### readAccountCodeChunks() + +> **readAccountCodeChunks**(`contract`, `startPc`, `endPc`): `bigint` + +Defined in: [interfaces.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L114) + +#### Parameters + +##### contract + +`Address` + +##### startPc + +`number` + +##### endPc + +`number` + +#### Returns + +`bigint` + +*** + +### readAccountCodeHash() + +> **readAccountCodeHash**(`address`): `bigint` + +Defined in: [interfaces.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L110) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### readAccountHeader() + +> **readAccountHeader**(`address`): `bigint` + +Defined in: [interfaces.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L112) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### readAccountStorage() + +> **readAccountStorage**(`contract`, `storageSlot`): `bigint` + +Defined in: [interfaces.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L116) + +#### Parameters + +##### contract + +`Address` + +##### storageSlot + +`bigint` + +#### Returns + +`bigint` + +*** + +### revert() + +> **revert**(): `void` + +Defined in: [interfaces.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L120) + +#### Returns + +`void` + +*** + +### writeAccountBasicData() + +> **writeAccountBasicData**(`address`): `bigint` + +Defined in: [interfaces.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L109) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### writeAccountCodeChunks() + +> **writeAccountCodeChunks**(`contract`, `startPc`, `endPc`): `bigint` + +Defined in: [interfaces.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L115) + +#### Parameters + +##### contract + +`Address` + +##### startPc + +`number` + +##### endPc + +`number` + +#### Returns + +`bigint` + +*** + +### writeAccountCodeHash() + +> **writeAccountCodeHash**(`address`): `bigint` + +Defined in: [interfaces.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L111) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### writeAccountHeader() + +> **writeAccountHeader**(`address`): `bigint` + +Defined in: [interfaces.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L113) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### writeAccountStorage() + +> **writeAccountStorage**(`contract`, `storageSlot`): `bigint` + +Defined in: [interfaces.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L117) + +#### Parameters + +##### contract + +`Address` + +##### storageSlot + +`bigint` + +#### Returns + +`bigint` diff --git a/packages/common/docs/interfaces/BootstrapNodeConfig.md b/packages/common/docs/interfaces/BootstrapNodeConfig.md index e32bc589826..1630398fc98 100644 --- a/packages/common/docs/interfaces/BootstrapNodeConfig.md +++ b/packages/common/docs/interfaces/BootstrapNodeConfig.md @@ -1,85 +1,65 @@ -[@ethereumjs/common](../README.md) / BootstrapNodeConfig +[**@ethereumjs/common**](../README.md) -# Interface: BootstrapNodeConfig +*** -## Table of contents +[@ethereumjs/common](../README.md) / BootstrapNodeConfig -### Properties +# Interface: BootstrapNodeConfig -- [chainId](BootstrapNodeConfig.md#chainid) -- [comment](BootstrapNodeConfig.md#comment) -- [id](BootstrapNodeConfig.md#id) -- [ip](BootstrapNodeConfig.md#ip) -- [location](BootstrapNodeConfig.md#location) -- [network](BootstrapNodeConfig.md#network) -- [port](BootstrapNodeConfig.md#port) +Defined in: [types.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L66) ## Properties -### chainId - -• `Optional` **chainId**: `number` +### chainId? -#### Defined in +> `optional` **chainId**: `number` -[types.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L65) +Defined in: [types.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L70) -___ +*** ### comment -• **comment**: `string` - -#### Defined in +> **comment**: `string` -[types.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L68) +Defined in: [types.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L73) -___ +*** ### id -• **id**: `string` +> **id**: `string` -#### Defined in +Defined in: [types.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L71) -[types.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L66) - -___ +*** ### ip -• **ip**: `string` - -#### Defined in +> **ip**: `string` -[types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L62) +Defined in: [types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L67) -___ +*** ### location -• **location**: `string` - -#### Defined in +> **location**: `string` -[types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L67) +Defined in: [types.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L72) -___ +*** -### network +### network? -• `Optional` **network**: `string` +> `optional` **network**: `string` -#### Defined in +Defined in: [types.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L69) -[types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L64) - -___ +*** ### port -• **port**: `string` \| `number` - -#### Defined in +> **port**: `string` \| `number` -[types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L63) +Defined in: [types.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L68) diff --git a/packages/common/docs/interfaces/ChainConfig.md b/packages/common/docs/interfaces/ChainConfig.md index fca3c544c1b..a5ec0fa8c90 100644 --- a/packages/common/docs/interfaces/ChainConfig.md +++ b/packages/common/docs/interfaces/ChainConfig.md @@ -1,140 +1,105 @@ -[@ethereumjs/common](../README.md) / ChainConfig +[**@ethereumjs/common**](../README.md) -# Interface: ChainConfig +*** -## Table of contents +[@ethereumjs/common](../README.md) / ChainConfig -### Properties +# Interface: ChainConfig -- [bootstrapNodes](ChainConfig.md#bootstrapnodes) -- [chainId](ChainConfig.md#chainid) -- [comment](ChainConfig.md#comment) -- [consensus](ChainConfig.md#consensus) -- [customHardforks](ChainConfig.md#customhardforks) -- [defaultHardfork](ChainConfig.md#defaulthardfork) -- [dnsNetworks](ChainConfig.md#dnsnetworks) -- [genesis](ChainConfig.md#genesis) -- [hardforks](ChainConfig.md#hardforks) -- [name](ChainConfig.md#name) -- [networkId](ChainConfig.md#networkid) -- [url](ChainConfig.md#url) +Defined in: [types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L33) ## Properties ### bootstrapNodes -• **bootstrapNodes**: [`BootstrapNodeConfig`](BootstrapNodeConfig.md)[] +> **bootstrapNodes**: [`BootstrapNodeConfig`](BootstrapNodeConfig.md)[] -#### Defined in +Defined in: [types.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L42) -[types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L38) - -___ +*** ### chainId -• **chainId**: `number` \| `bigint` - -#### Defined in +> **chainId**: `string` \| `number` -[types.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L30) +Defined in: [types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L35) -___ +*** -### comment +### comment? -• `Optional` **comment**: `string` +> `optional` **comment**: `string` -#### Defined in +Defined in: [types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L37) -[types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L33) - -___ +*** ### consensus -• **consensus**: `ConsensusConfig` +> **consensus**: `ConsensusConfig` -#### Defined in +Defined in: [types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L44) -[types.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L40) +*** -___ +### customHardforks? -### customHardforks +> `optional` **customHardforks**: [`HardforksDict`](../type-aliases/HardforksDict.md) -• `Optional` **customHardforks**: [`HardforksDict`](../README.md#hardforksdict) +Defined in: [types.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L41) -#### Defined in +*** -[types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L37) +### defaultHardfork? -___ +> `optional` **defaultHardfork**: `string` -### defaultHardfork +Defined in: [types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L36) -• `Optional` **defaultHardfork**: `string` +*** -#### Defined in +### depositContractAddress? -[types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L32) +> `optional` **depositContractAddress**: `` `0x${string}` `` -___ +Defined in: [types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L45) -### dnsNetworks +*** -• `Optional` **dnsNetworks**: `string`[] +### dnsNetworks? -#### Defined in +> `optional` **dnsNetworks**: `string`[] -[types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L39) +Defined in: [types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L43) -___ +*** ### genesis -• **genesis**: [`GenesisBlockConfig`](GenesisBlockConfig.md) - -#### Defined in +> **genesis**: [`GenesisBlockConfig`](GenesisBlockConfig.md) -[types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L35) +Defined in: [types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L39) -___ +*** ### hardforks -• **hardforks**: [`HardforkTransitionConfig`](HardforkTransitionConfig.md)[] +> **hardforks**: [`HardforkTransitionConfig`](HardforkTransitionConfig.md)[] -#### Defined in +Defined in: [types.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L40) -[types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L36) - -___ +*** ### name -• **name**: `string` - -#### Defined in - -[types.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L29) - -___ - -### networkId - -• **networkId**: `number` \| `bigint` - -#### Defined in - -[types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L31) +> **name**: `string` -___ +Defined in: [types.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L34) -### url +*** -• `Optional` **url**: `string` +### url? -#### Defined in +> `optional` **url**: `string` -[types.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L34) +Defined in: [types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L38) diff --git a/packages/common/docs/interfaces/ChainName.md b/packages/common/docs/interfaces/ChainName.md index be2b3c1d05f..2b4616b8dc1 100644 --- a/packages/common/docs/interfaces/ChainName.md +++ b/packages/common/docs/interfaces/ChainName.md @@ -1,7 +1,13 @@ +[**@ethereumjs/common**](../README.md) + +*** + [@ethereumjs/common](../README.md) / ChainName # Interface: ChainName +Defined in: [types.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L5) + ## Indexable -▪ [chainId: `string`]: `string` +\[`chainId`: `string`\]: `string` diff --git a/packages/common/docs/interfaces/ChainsConfig.md b/packages/common/docs/interfaces/ChainsConfig.md index 792f5a4272a..3f9b42f26b2 100644 --- a/packages/common/docs/interfaces/ChainsConfig.md +++ b/packages/common/docs/interfaces/ChainsConfig.md @@ -1,7 +1,13 @@ +[**@ethereumjs/common**](../README.md) + +*** + [@ethereumjs/common](../README.md) / ChainsConfig # Interface: ChainsConfig +Defined in: [types.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L8) + ## Indexable -▪ [key: `string`]: [`ChainConfig`](ChainConfig.md) \| [`ChainName`](ChainName.md) +\[`key`: `string`\]: [`ChainName`](ChainName.md) \| [`ChainConfig`](ChainConfig.md) diff --git a/packages/common/docs/interfaces/CommonEvent.md b/packages/common/docs/interfaces/CommonEvent.md new file mode 100644 index 00000000000..13082ef37a2 --- /dev/null +++ b/packages/common/docs/interfaces/CommonEvent.md @@ -0,0 +1,17 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / CommonEvent + +# Interface: CommonEvent + +Defined in: [types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L12) + +## Properties + +### hardforkChanged + +> **hardforkChanged**: \[`string`\] + +Defined in: [types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L13) diff --git a/packages/common/docs/interfaces/CommonOpts.md b/packages/common/docs/interfaces/CommonOpts.md index 89e88f0732e..6fea744ea83 100644 --- a/packages/common/docs/interfaces/CommonOpts.md +++ b/packages/common/docs/interfaces/CommonOpts.md @@ -1,64 +1,37 @@ -[@ethereumjs/common](../README.md) / CommonOpts - -# Interface: CommonOpts +[**@ethereumjs/common**](../README.md) -Options for instantiating a [Common](../classes/Common.md) instance. +*** -## Hierarchy +[@ethereumjs/common](../README.md) / CommonOpts -- `BaseOpts` +# Interface: CommonOpts - ↳ **`CommonOpts`** +Defined in: [types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L149) -## Table of contents +Options for instantiating a [Common](../classes/Common.md) instance. -### Properties +## Extends -- [chain](CommonOpts.md#chain) -- [customChains](CommonOpts.md#customchains) -- [customCrypto](CommonOpts.md#customcrypto) -- [eips](CommonOpts.md#eips) -- [hardfork](CommonOpts.md#hardfork) +- [`BaseOpts`](BaseOpts.md) ## Properties ### chain -• **chain**: `string` \| `number` \| `bigint` \| `object` - -Chain name ('mainnet'), id (1), or [Chain](../enums/Chain.md) enum, -either from a chain directly supported or a custom chain -passed in via [customChains](CommonOpts.md#customchains). +> **chain**: [`ChainConfig`](ChainConfig.md) -#### Defined in +Defined in: [types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L154) -[types.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L124) - -___ - -### customChains - -• `Optional` **customChains**: [`ChainConfig`](ChainConfig.md)[] - -Initialize (in addition to the supported chains) with the selected -custom chains. Custom genesis state should be passed to the Blockchain class if used. - -Usage (directly with the respective chain initialization via the [chain](CommonOpts.md#chain) option): - -```javascript -import myCustomChain1 from '[PATH_TO_MY_CHAINS]/myCustomChain1.json' -const common = new Common({ chain: 'myCustomChain1', customChains: [ myCustomChain1 ]}) -``` +The chain configuration to be used. There are available configuration object for mainnet +(`Mainnet`) and the currently active testnets which can be directly used. -#### Defined in +*** -[types.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L136) +### customCrypto? -___ +> `optional` **customCrypto**: [`CustomCrypto`](CustomCrypto.md) -### customCrypto - -• `Optional` **customCrypto**: [`CustomCrypto`](CustomCrypto.md) +Defined in: [types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L143) This option can be used to replace the most common crypto primitives (keccak256 hashing e.g.) within the EthereumJS ecosystem libraries @@ -71,43 +44,67 @@ and be made with eventual security implications considered. #### Inherited from -BaseOpts.customCrypto - -#### Defined in +[`BaseOpts`](BaseOpts.md).[`customCrypto`](BaseOpts.md#customcrypto) -[types.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L112) +*** -___ +### eips? -### eips +> `optional` **eips**: `number`[] -• `Optional` **eips**: `number`[] +Defined in: [types.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L114) Selected EIPs which can be activated, please use an array for instantiation -(e.g. `eips: [ 1559, 3860 ]`) +(e.g. `eips: [ 2537, ]`) -#### Inherited from +Currently supported: -BaseOpts.eips +- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS12-381 precompiles -#### Defined in +#### Inherited from -[types.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L101) +[`BaseOpts`](BaseOpts.md).[`eips`](BaseOpts.md#eips) -___ +*** -### hardfork +### hardfork? -• `Optional` **hardfork**: `string` +> `optional` **hardfork**: `string` -String identifier ('byzantium') for hardfork or [Hardfork](../enums/Hardfork.md) enum. +Defined in: [types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L105) + +String identifier ('byzantium') for hardfork or [Hardfork](../variables/Hardfork.md) enum. Default: Hardfork.London #### Inherited from -BaseOpts.hardfork +[`BaseOpts`](BaseOpts.md).[`hardfork`](BaseOpts.md#hardfork) + +*** + +### params? -#### Defined in +> `optional` **params**: [`ParamsDict`](../type-aliases/ParamsDict.md) + +Defined in: [types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L132) + +Optionally pass in an EIP params dictionary, see one of the +EthereumJS library `params.ts` files for an example (e.g. tx, evm). +By default parameters are set by the respective library, so this +is only relevant if you want to use EthereumJS libraries with a +custom parameter set. + +Example Format: + +```ts +{ + 1559: { + initialBaseFee: 1000000000, + } +} +``` + +#### Inherited from -[types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L96) +[`BaseOpts`](BaseOpts.md).[`params`](BaseOpts.md#params) diff --git a/packages/common/docs/interfaces/CreateCommonFromGethGenesisOpts.md b/packages/common/docs/interfaces/CreateCommonFromGethGenesisOpts.md new file mode 100644 index 00000000000..f0b3203cc21 --- /dev/null +++ b/packages/common/docs/interfaces/CreateCommonFromGethGenesisOpts.md @@ -0,0 +1,35 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / CreateCommonFromGethGenesisOpts + +# Interface: CreateCommonFromGethGenesisOpts + +Defined in: [gethGenesis.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L104) + +Type for the options passed to createCommonFromGethGenesis + +## Properties + +### chain? + +> `optional` **chain**: `string` + +Defined in: [gethGenesis.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L105) + +*** + +### genesisHash? + +> `optional` **genesisHash**: `string` + +Defined in: [gethGenesis.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L106) + +*** + +### mergeForkIdPostMerge? + +> `optional` **mergeForkIdPostMerge**: `boolean` + +Defined in: [gethGenesis.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L107) diff --git a/packages/common/docs/interfaces/CustomCommonOpts.md b/packages/common/docs/interfaces/CustomCommonOpts.md deleted file mode 100644 index 9ade971dbf5..00000000000 --- a/packages/common/docs/interfaces/CustomCommonOpts.md +++ /dev/null @@ -1,91 +0,0 @@ -[@ethereumjs/common](../README.md) / CustomCommonOpts - -# Interface: CustomCommonOpts - -Options to be used with the [custom](../classes/Common.md#custom) static constructor. - -## Hierarchy - -- `BaseOpts` - - ↳ **`CustomCommonOpts`** - -## Table of contents - -### Properties - -- [baseChain](CustomCommonOpts.md#basechain) -- [customCrypto](CustomCommonOpts.md#customcrypto) -- [eips](CustomCommonOpts.md#eips) -- [hardfork](CustomCommonOpts.md#hardfork) - -## Properties - -### baseChain - -• `Optional` **baseChain**: `string` \| `number` \| `bigint` - -The name (`mainnet`), id (`1`), or [Chain](../enums/Chain.md) enum of -a standard chain used to base the custom chain params on. - -#### Defined in - -[types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L147) - -___ - -### customCrypto - -• `Optional` **customCrypto**: [`CustomCrypto`](CustomCrypto.md) - -This option can be used to replace the most common crypto primitives -(keccak256 hashing e.g.) within the EthereumJS ecosystem libraries -with alternative implementations (e.g. more performant WASM libraries). - -Note: please be aware that this is adding new dependencies for your -system setup to be used for sensitive/core parts of the functionality -and a choice on the libraries to add should be handled with care -and be made with eventual security implications considered. - -#### Inherited from - -BaseOpts.customCrypto - -#### Defined in - -[types.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L112) - -___ - -### eips - -• `Optional` **eips**: `number`[] - -Selected EIPs which can be activated, please use an array for instantiation -(e.g. `eips: [ 1559, 3860 ]`) - -#### Inherited from - -BaseOpts.eips - -#### Defined in - -[types.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L101) - -___ - -### hardfork - -• `Optional` **hardfork**: `string` - -String identifier ('byzantium') for hardfork or [Hardfork](../enums/Hardfork.md) enum. - -Default: Hardfork.London - -#### Inherited from - -BaseOpts.hardfork - -#### Defined in - -[types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L96) diff --git a/packages/common/docs/interfaces/CustomCrypto.md b/packages/common/docs/interfaces/CustomCrypto.md index e1d51018848..6447ec7e8a1 100644 --- a/packages/common/docs/interfaces/CustomCrypto.md +++ b/packages/common/docs/interfaces/CustomCrypto.md @@ -1,185 +1,151 @@ -[@ethereumjs/common](../README.md) / CustomCrypto +[**@ethereumjs/common**](../README.md) -# Interface: CustomCrypto +*** -## Table of contents +[@ethereumjs/common](../README.md) / CustomCrypto -### Properties +# Interface: CustomCrypto -- [ecdsaRecover](CustomCrypto.md#ecdsarecover) -- [ecdsaSign](CustomCrypto.md#ecdsasign) -- [ecrecover](CustomCrypto.md#ecrecover) -- [ecsign](CustomCrypto.md#ecsign) -- [keccak256](CustomCrypto.md#keccak256) -- [kzg](CustomCrypto.md#kzg) -- [sha256](CustomCrypto.md#sha256) +Defined in: [types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L76) ## Properties -### ecdsaRecover - -• `Optional` **ecdsaRecover**: (`sig`: `Uint8Array`, `recId`: `number`, `hash`: `Uint8Array`) => `Uint8Array` +### ecdsaRecover()? -#### Type declaration +> `optional` **ecdsaRecover**: (`sig`, `recId`, `hash`) => `Uint8Array` -▸ (`sig`, `recId`, `hash`): `Uint8Array` +Defined in: [types.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L94) -##### Parameters +#### Parameters -| Name | Type | -| :------ | :------ | -| `sig` | `Uint8Array` | -| `recId` | `number` | -| `hash` | `Uint8Array` | - -##### Returns +##### sig `Uint8Array` -#### Defined in +##### recId -[types.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L86) +`number` -___ +##### hash -### ecdsaSign +`Uint8Array` -• `Optional` **ecdsaSign**: (`msg`: `Uint8Array`, `pk`: `Uint8Array`) => { `recid`: `number` ; `signature`: `Uint8Array` } +#### Returns -#### Type declaration +`Uint8Array` -▸ (`msg`, `pk`): `Object` +*** -##### Parameters +### ecrecover()? -| Name | Type | -| :------ | :------ | -| `msg` | `Uint8Array` | -| `pk` | `Uint8Array` | +> `optional` **ecrecover**: (`msgHash`, `v`, `r`, `s`, `chainId?`) => `Uint8Array` -##### Returns +Defined in: [types.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L81) -`Object` +#### Parameters -| Name | Type | -| :------ | :------ | -| `recid` | `number` | -| `signature` | `Uint8Array` | +##### msgHash -#### Defined in +`Uint8Array` -[types.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L85) +##### v -___ +`bigint` -### ecrecover +##### r -• `Optional` **ecrecover**: (`msgHash`: `Uint8Array`, `v`: `bigint`, `r`: `Uint8Array`, `s`: `Uint8Array`, `chainId?`: `bigint`) => `Uint8Array` +`Uint8Array` -#### Type declaration +##### s -▸ (`msgHash`, `v`, `r`, `s`, `chainId?`): `Uint8Array` +`Uint8Array` -##### Parameters +##### chainId? -| Name | Type | -| :------ | :------ | -| `msgHash` | `Uint8Array` | -| `v` | `bigint` | -| `r` | `Uint8Array` | -| `s` | `Uint8Array` | -| `chainId?` | `bigint` | +`bigint` -##### Returns +#### Returns `Uint8Array` -#### Defined in +*** -[types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L76) +### ecsign()? -___ +> `optional` **ecsign**: (`msg`, `pk`, `ecSignOpts?`) => `Pick`\<`RecoveredSignatureType`, `"recovery"` \| `"r"` \| `"s"`\> -### ecsign +Defined in: [types.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L89) -• `Optional` **ecsign**: (`msg`: `Uint8Array`, `pk`: `Uint8Array`, `chainId?`: `bigint`) => `ECDSASignature` +#### Parameters -#### Type declaration +##### msg -▸ (`msg`, `pk`, `chainId?`): `ECDSASignature` +`Uint8Array` -##### Parameters +##### pk -| Name | Type | -| :------ | :------ | -| `msg` | `Uint8Array` | -| `pk` | `Uint8Array` | -| `chainId?` | `bigint` | +`Uint8Array` -##### Returns +##### ecSignOpts? -`ECDSASignature` +###### extraEntropy? -#### Defined in +`boolean` \| `Uint8Array`\<`ArrayBufferLike`\> -[types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L84) +#### Returns -___ +`Pick`\<`RecoveredSignatureType`, `"recovery"` \| `"r"` \| `"s"`\> -### keccak256 +*** -• `Optional` **keccak256**: (`msg`: `Uint8Array`) => `Uint8Array` +### keccak256()? -#### Type declaration +> `optional` **keccak256**: (`msg`) => `Uint8Array` -▸ (`msg`): `Uint8Array` +Defined in: [types.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L80) Interface for providing custom cryptographic primitives in place of `ethereum-cryptography` variants -##### Parameters +#### Parameters -| Name | Type | -| :------ | :------ | -| `msg` | `Uint8Array` | - -##### Returns +##### msg `Uint8Array` -#### Defined in - -[types.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L75) +#### Returns -___ +`Uint8Array` -### kzg +*** -• `Optional` **kzg**: `Kzg` +### kzg? -#### Defined in +> `optional` **kzg**: `KZG` -[types.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L87) +Defined in: [types.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L95) -___ +*** -### sha256 +### sha256()? -• `Optional` **sha256**: (`msg`: `Uint8Array`) => `Uint8Array` +> `optional` **sha256**: (`msg`) => `Uint8Array` -#### Type declaration +Defined in: [types.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L88) -▸ (`msg`): `Uint8Array` +#### Parameters -##### Parameters +##### msg -| Name | Type | -| :------ | :------ | -| `msg` | `Uint8Array` | +`Uint8Array` -##### Returns +#### Returns `Uint8Array` -#### Defined in +*** + +### verkle? + +> `optional` **verkle**: `VerkleCrypto` -[types.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L83) +Defined in: [types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L96) diff --git a/packages/common/docs/interfaces/EVMStateManagerInterface.md b/packages/common/docs/interfaces/EVMStateManagerInterface.md deleted file mode 100644 index feaca2daf2b..00000000000 --- a/packages/common/docs/interfaces/EVMStateManagerInterface.md +++ /dev/null @@ -1,534 +0,0 @@ -[@ethereumjs/common](../README.md) / EVMStateManagerInterface - -# Interface: EVMStateManagerInterface - -## Hierarchy - -- [`StateManagerInterface`](StateManagerInterface.md) - - ↳ **`EVMStateManagerInterface`** - -## Table of contents - -### Properties - -- [originalStorageCache](EVMStateManagerInterface.md#originalstoragecache) - -### Methods - -- [checkpoint](EVMStateManagerInterface.md#checkpoint) -- [clearContractStorage](EVMStateManagerInterface.md#clearcontractstorage) -- [commit](EVMStateManagerInterface.md#commit) -- [deleteAccount](EVMStateManagerInterface.md#deleteaccount) -- [dumpStorage](EVMStateManagerInterface.md#dumpstorage) -- [dumpStorageRange](EVMStateManagerInterface.md#dumpstoragerange) -- [generateCanonicalGenesis](EVMStateManagerInterface.md#generatecanonicalgenesis) -- [getAccount](EVMStateManagerInterface.md#getaccount) -- [getAppliedKey](EVMStateManagerInterface.md#getappliedkey) -- [getContractCode](EVMStateManagerInterface.md#getcontractcode) -- [getContractStorage](EVMStateManagerInterface.md#getcontractstorage) -- [getProof](EVMStateManagerInterface.md#getproof) -- [getStateRoot](EVMStateManagerInterface.md#getstateroot) -- [hasStateRoot](EVMStateManagerInterface.md#hasstateroot) -- [modifyAccountFields](EVMStateManagerInterface.md#modifyaccountfields) -- [putAccount](EVMStateManagerInterface.md#putaccount) -- [putContractCode](EVMStateManagerInterface.md#putcontractcode) -- [putContractStorage](EVMStateManagerInterface.md#putcontractstorage) -- [revert](EVMStateManagerInterface.md#revert) -- [setStateRoot](EVMStateManagerInterface.md#setstateroot) -- [shallowCopy](EVMStateManagerInterface.md#shallowcopy) - -## Properties - -### originalStorageCache - -• **originalStorageCache**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `clear` | () => `void` | -| `get` | (`address`: `Address`, `key`: `Uint8Array`) => `Promise`<`Uint8Array`\> | - -#### Defined in - -[interfaces.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L90) - -## Methods - -### checkpoint - -▸ **checkpoint**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[checkpoint](StateManagerInterface.md#checkpoint) - -#### Defined in - -[interfaces.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L78) - -___ - -### clearContractStorage - -▸ **clearContractStorage**(`address`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[clearContractStorage](StateManagerInterface.md#clearcontractstorage) - -#### Defined in - -[interfaces.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L77) - -___ - -### commit - -▸ **commit**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[commit](StateManagerInterface.md#commit) - -#### Defined in - -[interfaces.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L79) - -___ - -### deleteAccount - -▸ **deleteAccount**(`address`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[deleteAccount](StateManagerInterface.md#deleteaccount) - -#### Defined in - -[interfaces.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L71) - -___ - -### dumpStorage - -▸ **dumpStorage**(`address`): `Promise`<[`StorageDump`](StorageDump.md)\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<[`StorageDump`](StorageDump.md)\> - -#### Defined in - -[interfaces.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L95) - -___ - -### dumpStorageRange - -▸ **dumpStorageRange**(`address`, `startKey`, `limit`): `Promise`<[`StorageRange`](StorageRange.md)\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `startKey` | `bigint` | -| `limit` | `number` | - -#### Returns - -`Promise`<[`StorageRange`](StorageRange.md)\> - -#### Defined in - -[interfaces.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L96) - -___ - -### generateCanonicalGenesis - -▸ **generateCanonicalGenesis**(`initState`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `initState` | `any` | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[interfaces.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L97) - -___ - -### getAccount - -▸ **getAccount**(`address`): `Promise`<`undefined` \| `Account`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`undefined` \| `Account`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[getAccount](StateManagerInterface.md#getaccount) - -#### Defined in - -[interfaces.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L69) - -___ - -### getAppliedKey - -▸ `Optional` **getAppliedKey**(`address`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[getAppliedKey](StateManagerInterface.md#getappliedkey) - -#### Defined in - -[interfaces.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L86) - -___ - -### getContractCode - -▸ **getContractCode**(`address`): `Promise`<`Uint8Array`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`Uint8Array`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[getContractCode](StateManagerInterface.md#getcontractcode) - -#### Defined in - -[interfaces.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L74) - -___ - -### getContractStorage - -▸ **getContractStorage**(`address`, `key`): `Promise`<`Uint8Array`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Uint8Array` | - -#### Returns - -`Promise`<`Uint8Array`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[getContractStorage](StateManagerInterface.md#getcontractstorage) - -#### Defined in - -[interfaces.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L75) - -___ - -### getProof - -▸ **getProof**(`address`, `storageSlots?`): `Promise`<[`Proof`](../README.md#proof)\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `storageSlots?` | `Uint8Array`[] | - -#### Returns - -`Promise`<[`Proof`](../README.md#proof)\> - -#### Overrides - -[StateManagerInterface](StateManagerInterface.md).[getProof](StateManagerInterface.md#getproof) - -#### Defined in - -[interfaces.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L98) - -___ - -### getStateRoot - -▸ **getStateRoot**(): `Promise`<`Uint8Array`\> - -#### Returns - -`Promise`<`Uint8Array`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[getStateRoot](StateManagerInterface.md#getstateroot) - -#### Defined in - -[interfaces.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L81) - -___ - -### hasStateRoot - -▸ **hasStateRoot**(`root`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[hasStateRoot](StateManagerInterface.md#hasstateroot) - -#### Defined in - -[interfaces.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L84) - -___ - -### modifyAccountFields - -▸ **modifyAccountFields**(`address`, `accountFields`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `accountFields` | `Partial`<`Pick`<`Account`, ``"nonce"`` \| ``"balance"`` \| ``"storageRoot"`` \| ``"codeHash"``\>\> | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[modifyAccountFields](StateManagerInterface.md#modifyaccountfields) - -#### Defined in - -[interfaces.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L72) - -___ - -### putAccount - -▸ **putAccount**(`address`, `account?`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `account?` | `Account` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[putAccount](StateManagerInterface.md#putaccount) - -#### Defined in - -[interfaces.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L70) - -___ - -### putContractCode - -▸ **putContractCode**(`address`, `value`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `value` | `Uint8Array` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[putContractCode](StateManagerInterface.md#putcontractcode) - -#### Defined in - -[interfaces.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L73) - -___ - -### putContractStorage - -▸ **putContractStorage**(`address`, `key`, `value`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Uint8Array` | -| `value` | `Uint8Array` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[putContractStorage](StateManagerInterface.md#putcontractstorage) - -#### Defined in - -[interfaces.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L76) - -___ - -### revert - -▸ **revert**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[revert](StateManagerInterface.md#revert) - -#### Defined in - -[interfaces.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L80) - -___ - -### setStateRoot - -▸ **setStateRoot**(`stateRoot`, `clearCache?`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stateRoot` | `Uint8Array` | -| `clearCache?` | `boolean` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[StateManagerInterface](StateManagerInterface.md).[setStateRoot](StateManagerInterface.md#setstateroot) - -#### Defined in - -[interfaces.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L82) - -___ - -### shallowCopy - -▸ **shallowCopy**(`downlevelCaches?`): [`EVMStateManagerInterface`](EVMStateManagerInterface.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `downlevelCaches?` | `boolean` | - -#### Returns - -[`EVMStateManagerInterface`](EVMStateManagerInterface.md) - -#### Overrides - -[StateManagerInterface](StateManagerInterface.md).[shallowCopy](StateManagerInterface.md#shallowcopy) - -#### Defined in - -[interfaces.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L100) diff --git a/packages/common/docs/interfaces/GenesisBlockConfig.md b/packages/common/docs/interfaces/GenesisBlockConfig.md index 5485ce77fd1..04bb6aa4dab 100644 --- a/packages/common/docs/interfaces/GenesisBlockConfig.md +++ b/packages/common/docs/interfaces/GenesisBlockConfig.md @@ -1,85 +1,73 @@ -[@ethereumjs/common](../README.md) / GenesisBlockConfig +[**@ethereumjs/common**](../README.md) -# Interface: GenesisBlockConfig +*** -## Table of contents +[@ethereumjs/common](../README.md) / GenesisBlockConfig -### Properties +# Interface: GenesisBlockConfig -- [baseFeePerGas](GenesisBlockConfig.md#basefeepergas) -- [difficulty](GenesisBlockConfig.md#difficulty) -- [excessBlobGas](GenesisBlockConfig.md#excessblobgas) -- [extraData](GenesisBlockConfig.md#extradata) -- [gasLimit](GenesisBlockConfig.md#gaslimit) -- [nonce](GenesisBlockConfig.md#nonce) -- [timestamp](GenesisBlockConfig.md#timestamp) +Defined in: [types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L48) ## Properties -### baseFeePerGas - -• `Optional` **baseFeePerGas**: `string` +### baseFeePerGas? -#### Defined in +> `optional` **baseFeePerGas**: `` `0x${string}` `` -[types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L49) +Defined in: [types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L54) -___ +*** ### difficulty -• **difficulty**: `string` \| `number` - -#### Defined in +> **difficulty**: `number` \| `` `0x${string}` `` -[types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L46) +Defined in: [types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L51) -___ +*** -### excessBlobGas +### excessBlobGas? -• `Optional` **excessBlobGas**: `string` +> `optional` **excessBlobGas**: `` `0x${string}` `` -#### Defined in +Defined in: [types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L55) -[types.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L50) - -___ +*** ### extraData -• **extraData**: `string` - -#### Defined in +> **extraData**: `` `0x${string}` `` -[types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L48) +Defined in: [types.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L53) -___ +*** ### gasLimit -• **gasLimit**: `string` \| `number` - -#### Defined in +> **gasLimit**: `number` \| `` `0x${string}` `` -[types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L45) +Defined in: [types.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L50) -___ +*** ### nonce -• **nonce**: `string` +> **nonce**: `` `0x${string}` `` + +Defined in: [types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L52) + +*** -#### Defined in +### requestsHash? -[types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L47) +> `optional` **requestsHash**: `` `0x${string}` `` -___ +Defined in: [types.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L56) -### timestamp +*** -• `Optional` **timestamp**: `string` +### timestamp? -#### Defined in +> `optional` **timestamp**: `` `0x${string}` `` -[types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L44) +Defined in: [types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L49) diff --git a/packages/common/docs/interfaces/GenesisState.md b/packages/common/docs/interfaces/GenesisState.md new file mode 100644 index 00000000000..d44bb5b559c --- /dev/null +++ b/packages/common/docs/interfaces/GenesisState.md @@ -0,0 +1,36 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / GenesisState + +# Interface: GenesisState + +Defined in: [gethGenesis.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L143) + +If you are using a custom chain [Common](../classes/Common.md), pass the genesis state. + +Pattern 1 (with genesis state see GenesisState for format): + +```javascript +{ + '0x0...01': '0x100', // For EoA +} +``` + +Pattern 2 (with complex genesis state, containing contract accounts and storage). +Note that in [AccountState](../type-aliases/AccountState.md) there are two +accepted types. This allows to easily insert accounts in the genesis state: + +A complex genesis state with Contract and EoA states would have the following format: + +```javascript +{ + '0x0...01': '0x100', // For EoA + '0x0...02': ['0x1', '0xRUNTIME_BYTECODE', [[storageKey1, storageValue1], [storageKey2, storageValue2]]] // For contracts +} +``` + +## Indexable + +\[`key`: `` `0x${string}` ``\]: `` `0x${string}` `` \| [`AccountState`](../type-aliases/AccountState.md) diff --git a/packages/common/docs/interfaces/GethConfigOpts.md b/packages/common/docs/interfaces/GethConfigOpts.md index b6752af5212..cfdbe98ac61 100644 --- a/packages/common/docs/interfaces/GethConfigOpts.md +++ b/packages/common/docs/interfaces/GethConfigOpts.md @@ -1,39 +1,32 @@ -[@ethereumjs/common](../README.md) / GethConfigOpts - -# Interface: GethConfigOpts +[**@ethereumjs/common**](../README.md) -## Hierarchy +*** -- `BaseOpts` +[@ethereumjs/common](../README.md) / GethConfigOpts - ↳ **`GethConfigOpts`** +# Interface: GethConfigOpts -## Table of contents +Defined in: [types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L157) -### Properties +## Extends -- [chain](GethConfigOpts.md#chain) -- [customCrypto](GethConfigOpts.md#customcrypto) -- [eips](GethConfigOpts.md#eips) -- [genesisHash](GethConfigOpts.md#genesishash) -- [hardfork](GethConfigOpts.md#hardfork) -- [mergeForkIdPostMerge](GethConfigOpts.md#mergeforkidpostmerge) +- [`BaseOpts`](BaseOpts.md) ## Properties -### chain +### chain? -• `Optional` **chain**: `string` +> `optional` **chain**: `string` -#### Defined in +Defined in: [types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L158) -[types.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L151) +*** -___ +### customCrypto? -### customCrypto +> `optional` **customCrypto**: [`CustomCrypto`](CustomCrypto.md) -• `Optional` **customCrypto**: [`CustomCrypto`](CustomCrypto.md) +Defined in: [types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L143) This option can be used to replace the most common crypto primitives (keccak256 hashing e.g.) within the EthereumJS ecosystem libraries @@ -46,63 +39,75 @@ and be made with eventual security implications considered. #### Inherited from -BaseOpts.customCrypto - -#### Defined in +[`BaseOpts`](BaseOpts.md).[`customCrypto`](BaseOpts.md#customcrypto) -[types.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L112) +*** -___ +### eips? -### eips +> `optional` **eips**: `number`[] -• `Optional` **eips**: `number`[] +Defined in: [types.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L114) Selected EIPs which can be activated, please use an array for instantiation -(e.g. `eips: [ 1559, 3860 ]`) +(e.g. `eips: [ 2537, ]`) -#### Inherited from +Currently supported: -BaseOpts.eips +- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS12-381 precompiles -#### Defined in +#### Inherited from -[types.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L101) +[`BaseOpts`](BaseOpts.md).[`eips`](BaseOpts.md#eips) -___ +*** -### genesisHash +### genesisHash? -• `Optional` **genesisHash**: `Uint8Array` +> `optional` **genesisHash**: `Uint8Array`\<`ArrayBufferLike`\> -#### Defined in +Defined in: [types.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L159) -[types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L152) +*** -___ +### hardfork? -### hardfork +> `optional` **hardfork**: `string` -• `Optional` **hardfork**: `string` +Defined in: [types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L105) -String identifier ('byzantium') for hardfork or [Hardfork](../enums/Hardfork.md) enum. +String identifier ('byzantium') for hardfork or [Hardfork](../variables/Hardfork.md) enum. Default: Hardfork.London #### Inherited from -BaseOpts.hardfork +[`BaseOpts`](BaseOpts.md).[`hardfork`](BaseOpts.md#hardfork) + +*** -#### Defined in +### params? -[types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L96) +> `optional` **params**: [`ParamsDict`](../type-aliases/ParamsDict.md) -___ +Defined in: [types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L132) -### mergeForkIdPostMerge +Optionally pass in an EIP params dictionary, see one of the +EthereumJS library `params.ts` files for an example (e.g. tx, evm). +By default parameters are set by the respective library, so this +is only relevant if you want to use EthereumJS libraries with a +custom parameter set. -• `Optional` **mergeForkIdPostMerge**: `boolean` +Example Format: -#### Defined in +```ts +{ + 1559: { + initialBaseFee: 1000000000, + } +} +``` + +#### Inherited from -[types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L153) +[`BaseOpts`](BaseOpts.md).[`params`](BaseOpts.md#params) diff --git a/packages/common/docs/interfaces/GethGenesis.md b/packages/common/docs/interfaces/GethGenesis.md new file mode 100644 index 00000000000..36d2bb8d3f8 --- /dev/null +++ b/packages/common/docs/interfaces/GethGenesis.md @@ -0,0 +1,139 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / GethGenesis + +# Interface: GethGenesis + +Defined in: [gethGenesis.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L82) + +Interface for Geth Genesis object + +## Properties + +### alloc + +> **alloc**: [`GethGenesisAlloc`](GethGenesisAlloc.md) + +Defined in: [gethGenesis.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L94) + +*** + +### baseFeePerGas? + +> `optional` **baseFeePerGas**: `null` \| `number` \| `` `0x${string}` `` + +Defined in: [gethGenesis.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L98) + +*** + +### coinbase? + +> `optional` **coinbase**: `` `0x${string}` `` + +Defined in: [gethGenesis.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L93) + +*** + +### config + +> **config**: [`GethGenesisConfig`](GethGenesisConfig.md) + +Defined in: [gethGenesis.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L83) + +*** + +### difficulty? + +> `optional` **difficulty**: `` `0x${string}` `` + +Defined in: [gethGenesis.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L91) + +*** + +### excessBlobGas? + +> `optional` **excessBlobGas**: `string` + +Defined in: [gethGenesis.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L85) + +*** + +### extraData? + +> `optional` **extraData**: `string` + +Defined in: [gethGenesis.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L89) + +*** + +### gasLimit + +> **gasLimit**: `` `0x${string}` `` + +Defined in: [gethGenesis.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L90) + +*** + +### gasUsed? + +> `optional` **gasUsed**: `` `0x${string}` `` + +Defined in: [gethGenesis.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L96) + +*** + +### mixHash? + +> `optional` **mixHash**: `` `0x${string}` `` + +Defined in: [gethGenesis.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L92) + +*** + +### name? + +> `optional` **name**: `string` + +Defined in: [gethGenesis.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L84) + +*** + +### nonce + +> **nonce**: `string` + +Defined in: [gethGenesis.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L87) + +*** + +### number? + +> `optional` **number**: `` `0x${string}` `` + +Defined in: [gethGenesis.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L95) + +*** + +### parentHash? + +> `optional` **parentHash**: `` `0x${string}` `` + +Defined in: [gethGenesis.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L97) + +*** + +### requestsHash? + +> `optional` **requestsHash**: `string` + +Defined in: [gethGenesis.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L86) + +*** + +### timestamp + +> **timestamp**: `string` + +Defined in: [gethGenesis.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L88) diff --git a/packages/common/docs/interfaces/GethGenesisAlloc.md b/packages/common/docs/interfaces/GethGenesisAlloc.md new file mode 100644 index 00000000000..f86bdc032a8 --- /dev/null +++ b/packages/common/docs/interfaces/GethGenesisAlloc.md @@ -0,0 +1,15 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / GethGenesisAlloc + +# Interface: GethGenesisAlloc + +Defined in: [gethGenesis.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L59) + +Interface for account allocation in Geth Genesis + +## Indexable + +\[`address`: `string`\]: `object` diff --git a/packages/common/docs/interfaces/GethGenesisBlobSchedule.md b/packages/common/docs/interfaces/GethGenesisBlobSchedule.md new file mode 100644 index 00000000000..b6031f7ffcf --- /dev/null +++ b/packages/common/docs/interfaces/GethGenesisBlobSchedule.md @@ -0,0 +1,15 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / GethGenesisBlobSchedule + +# Interface: GethGenesisBlobSchedule + +Defined in: [gethGenesis.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L71) + +Interface for blob schedule in Geth Genesis (EIP-7840) + +## Indexable + +\[`fork`: `string`\]: `object` diff --git a/packages/common/docs/interfaces/GethGenesisConfig.md b/packages/common/docs/interfaces/GethGenesisConfig.md new file mode 100644 index 00000000000..47dd992704d --- /dev/null +++ b/packages/common/docs/interfaces/GethGenesisConfig.md @@ -0,0 +1,319 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / GethGenesisConfig + +# Interface: GethGenesisConfig + +Defined in: [gethGenesis.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L6) + +Interface for Geth Genesis Config + +## Properties + +### arrowGlacierBlock? + +> `optional` **arrowGlacierBlock**: `number` + +Defined in: [gethGenesis.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L25) + +*** + +### berlinBlock? + +> `optional` **berlinBlock**: `number` + +Defined in: [gethGenesis.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L21) + +*** + +### blobSchedule? + +> `optional` **blobSchedule**: [`GethGenesisBlobSchedule`](GethGenesisBlobSchedule.md) + +Defined in: [gethGenesis.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L52) + +*** + +### byzantiumBlock? + +> `optional` **byzantiumBlock**: `number` + +Defined in: [gethGenesis.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L16) + +*** + +### cancunBlock? + +> `optional` **cancunBlock**: `number` + +Defined in: [gethGenesis.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L24) + +*** + +### cancunTime? + +> `optional` **cancunTime**: `number` + +Defined in: [gethGenesis.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L29) + +*** + +### chainId + +> **chainId**: `number` + +Defined in: [gethGenesis.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L7) + +*** + +### clique? + +> `optional` **clique**: `object` + +Defined in: [gethGenesis.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L35) + +#### blockperiodseconds? + +> `optional` **blockperiodseconds**: `number` + +#### epoch? + +> `optional` **epoch**: `number` + +#### epochlength? + +> `optional` **epochlength**: `number` + +#### period? + +> `optional` **period**: `number` + +*** + +### constantinopleBlock? + +> `optional` **constantinopleBlock**: `number` + +Defined in: [gethGenesis.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L17) + +*** + +### daoForkBlock? + +> `optional` **daoForkBlock**: `number` + +Defined in: [gethGenesis.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L10) + +*** + +### daoForkSupport? + +> `optional` **daoForkSupport**: `boolean` + +Defined in: [gethGenesis.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L11) + +*** + +### depositContractAddress? + +> `optional` **depositContractAddress**: `string` + +Defined in: [gethGenesis.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L8) + +*** + +### eip150Block? + +> `optional` **eip150Block**: `number` + +Defined in: [gethGenesis.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L12) + +*** + +### eip150Hash? + +> `optional` **eip150Hash**: `string` + +Defined in: [gethGenesis.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L13) + +*** + +### eip155Block? + +> `optional` **eip155Block**: `number` + +Defined in: [gethGenesis.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L14) + +*** + +### eip158Block? + +> `optional` **eip158Block**: `number` + +Defined in: [gethGenesis.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L15) + +*** + +### ethash? + +> `optional` **ethash**: `object` + +Defined in: [gethGenesis.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L34) + +*** + +### grayGlacierBlock? + +> `optional` **grayGlacierBlock**: `number` + +Defined in: [gethGenesis.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L26) + +*** + +### homesteadBlock? + +> `optional` **homesteadBlock**: `number` + +Defined in: [gethGenesis.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L9) + +*** + +### istanbulBlock? + +> `optional` **istanbulBlock**: `number` + +Defined in: [gethGenesis.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L19) + +*** + +### londonBlock? + +> `optional` **londonBlock**: `number` + +Defined in: [gethGenesis.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L22) + +*** + +### mergeForkBlock? + +> `optional` **mergeForkBlock**: `number` + +Defined in: [gethGenesis.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L23) + +*** + +### mergeNetsplitBlock? + +> `optional` **mergeNetsplitBlock**: `number` + +Defined in: [gethGenesis.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L27) + +*** + +### muirGlacierBlock? + +> `optional` **muirGlacierBlock**: `number` + +Defined in: [gethGenesis.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L20) + +*** + +### petersburgBlock? + +> `optional` **petersburgBlock**: `number` + +Defined in: [gethGenesis.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L18) + +*** + +### pragueTime? + +> `optional` **pragueTime**: `number` + +Defined in: [gethGenesis.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L30) + +*** + +### proofInBlocks? + +> `optional` **proofInBlocks**: `boolean` + +Defined in: [gethGenesis.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L53) + +*** + +### shanghaiTime? + +> `optional` **shanghaiTime**: `number` + +Defined in: [gethGenesis.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L28) + +*** + +### terminalTotalDifficulty? + +> `optional` **terminalTotalDifficulty**: `number` + +Defined in: [gethGenesis.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L32) + +*** + +### terminalTotalDifficultyPassed? + +> `optional` **terminalTotalDifficultyPassed**: `boolean` + +Defined in: [gethGenesis.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L33) + +*** + +### trustedCheckpoint? + +> `optional` **trustedCheckpoint**: `object` + +Defined in: [gethGenesis.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L41) + +#### bloomRoot + +> **bloomRoot**: `string` + +#### chtRoot + +> **chtRoot**: `string` + +#### sectionHead + +> **sectionHead**: `string` + +#### sectionIndex + +> **sectionIndex**: `number` + +*** + +### trustedCheckpointOracle? + +> `optional` **trustedCheckpointOracle**: `object` + +Defined in: [gethGenesis.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L47) + +#### address + +> **address**: `string` + +#### signers + +> **signers**: `string`[] + +#### threshold + +> **threshold**: `number` + +*** + +### verkleTime? + +> `optional` **verkleTime**: `number` + +Defined in: [gethGenesis.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L31) diff --git a/packages/common/docs/interfaces/HardforkByOpts.md b/packages/common/docs/interfaces/HardforkByOpts.md index bca998a47ea..5a1b3d59466 100644 --- a/packages/common/docs/interfaces/HardforkByOpts.md +++ b/packages/common/docs/interfaces/HardforkByOpts.md @@ -1,41 +1,25 @@ -[@ethereumjs/common](../README.md) / HardforkByOpts +[**@ethereumjs/common**](../README.md) -# Interface: HardforkByOpts +*** -## Table of contents +[@ethereumjs/common](../README.md) / HardforkByOpts -### Properties +# Interface: HardforkByOpts -- [blockNumber](HardforkByOpts.md#blocknumber) -- [td](HardforkByOpts.md#td) -- [timestamp](HardforkByOpts.md#timestamp) +Defined in: [types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L162) ## Properties -### blockNumber - -• `Optional` **blockNumber**: `BigIntLike` - -#### Defined in - -[types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L157) - -___ - -### td - -• `Optional` **td**: `BigIntLike` - -#### Defined in +### blockNumber? -[types.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L159) +> `optional` **blockNumber**: `BigIntLike` -___ +Defined in: [types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L163) -### timestamp +*** -• `Optional` **timestamp**: `BigIntLike` +### timestamp? -#### Defined in +> `optional` **timestamp**: `BigIntLike` -[types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L158) +Defined in: [types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L164) diff --git a/packages/common/docs/interfaces/HardforkTransitionConfig.md b/packages/common/docs/interfaces/HardforkTransitionConfig.md index 59cdcd6eb69..4f5cbfa1701 100644 --- a/packages/common/docs/interfaces/HardforkTransitionConfig.md +++ b/packages/common/docs/interfaces/HardforkTransitionConfig.md @@ -1,63 +1,41 @@ -[@ethereumjs/common](../README.md) / HardforkTransitionConfig +[**@ethereumjs/common**](../README.md) -# Interface: HardforkTransitionConfig +*** -## Table of contents +[@ethereumjs/common](../README.md) / HardforkTransitionConfig -### Properties +# Interface: HardforkTransitionConfig -- [block](HardforkTransitionConfig.md#block) -- [forkHash](HardforkTransitionConfig.md#forkhash) -- [name](HardforkTransitionConfig.md#name) -- [timestamp](HardforkTransitionConfig.md#timestamp) -- [ttd](HardforkTransitionConfig.md#ttd) +Defined in: [types.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L59) ## Properties ### block -• **block**: ``null`` \| `number` +> **block**: `null` \| `number` -#### Defined in +Defined in: [types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L61) -[types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L55) +*** -___ +### forkHash? -### forkHash +> `optional` **forkHash**: `null` \| `` `0x${string}` `` -• `Optional` **forkHash**: ``null`` \| `string` +Defined in: [types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L63) -#### Defined in - -[types.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L58) - -___ +*** ### name -• **name**: `string` - -#### Defined in - -[types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L54) - -___ - -### timestamp - -• `Optional` **timestamp**: `string` \| `number` - -#### Defined in - -[types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L57) +> **name**: `string` -___ +Defined in: [types.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L60) -### ttd +*** -• `Optional` **ttd**: `string` \| `bigint` +### timestamp? -#### Defined in +> `optional` **timestamp**: `string` \| `number` -[types.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L56) +Defined in: [types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L62) diff --git a/packages/common/docs/interfaces/StateManagerInterface.md b/packages/common/docs/interfaces/StateManagerInterface.md index f3b51db3c21..26c4f25e710 100644 --- a/packages/common/docs/interfaces/StateManagerInterface.md +++ b/packages/common/docs/interfaces/StateManagerInterface.md @@ -1,376 +1,547 @@ +[**@ethereumjs/common**](../README.md) + +*** + [@ethereumjs/common](../README.md) / StateManagerInterface # Interface: StateManagerInterface -## Hierarchy +Defined in: [interfaces.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L177) + +## Properties + +### originalStorageCache + +> **originalStorageCache**: `object` + +Defined in: [interfaces.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L224) + +#### clear() + +> **clear**(): `void` + +##### Returns + +`void` -- **`StateManagerInterface`** +#### get() - ↳ [`EVMStateManagerInterface`](EVMStateManagerInterface.md) +> **get**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -## Table of contents +##### Parameters -### Methods +###### address -- [checkpoint](StateManagerInterface.md#checkpoint) -- [clearContractStorage](StateManagerInterface.md#clearcontractstorage) -- [commit](StateManagerInterface.md#commit) -- [deleteAccount](StateManagerInterface.md#deleteaccount) -- [getAccount](StateManagerInterface.md#getaccount) -- [getAppliedKey](StateManagerInterface.md#getappliedkey) -- [getContractCode](StateManagerInterface.md#getcontractcode) -- [getContractStorage](StateManagerInterface.md#getcontractstorage) -- [getProof](StateManagerInterface.md#getproof) -- [getStateRoot](StateManagerInterface.md#getstateroot) -- [hasStateRoot](StateManagerInterface.md#hasstateroot) -- [modifyAccountFields](StateManagerInterface.md#modifyaccountfields) -- [putAccount](StateManagerInterface.md#putaccount) -- [putContractCode](StateManagerInterface.md#putcontractcode) -- [putContractStorage](StateManagerInterface.md#putcontractstorage) -- [revert](StateManagerInterface.md#revert) -- [setStateRoot](StateManagerInterface.md#setstateroot) -- [shallowCopy](StateManagerInterface.md#shallowcopy) +`Address` + +###### key + +`Uint8Array` + +##### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> ## Methods -### checkpoint +### checkChunkWitnessPresent()? + +> `optional` **checkChunkWitnessPresent**(`contract`, `programCounter`): `Promise`\<`boolean`\> + +Defined in: [interfaces.ts:239](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L239) + +#### Parameters + +##### contract + +`Address` + +##### programCounter -▸ **checkpoint**(): `Promise`<`void`\> +`number` #### Returns -`Promise`<`void`\> +`Promise`\<`boolean`\> -#### Defined in +*** -[interfaces.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L78) +### checkpoint() -___ +> **checkpoint**(): `Promise`\<`void`\> -### clearContractStorage +Defined in: [interfaces.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L200) -▸ **clearContractStorage**(`address`): `Promise`<`void`\> +#### Returns -#### Parameters +`Promise`\<`void`\> -| Name | Type | -| :------ | :------ | -| `address` | `Address` | +*** + +### clearCaches() + +> **clearCaches**(): `void` + +Defined in: [interfaces.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L245) #### Returns -`Promise`<`void`\> +`void` -#### Defined in +*** -[interfaces.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L77) +### clearStorage() -___ +> **clearStorage**(`address`): `Promise`\<`void`\> -### commit +Defined in: [interfaces.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L195) + +#### Parameters -▸ **commit**(): `Promise`<`void`\> +##### address + +`Address` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> + +*** + +### commit() -#### Defined in +> **commit**(): `Promise`\<`void`\> -[interfaces.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L79) +Defined in: [interfaces.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L201) + +#### Returns -___ +`Promise`\<`void`\> -### deleteAccount +*** -▸ **deleteAccount**(`address`): `Promise`<`void`\> +### deleteAccount() + +> **deleteAccount**(`address`): `Promise`\<`void`\> + +Defined in: [interfaces.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L184) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | +##### address + +`Address` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> + +*** -#### Defined in +### dumpStorage()? -[interfaces.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L71) +> `optional` **dumpStorage**(`address`): `Promise`\<[`StorageDump`](StorageDump.md)\> -___ +Defined in: [interfaces.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L218) -### getAccount +#### Parameters + +##### address + +`Address` + +#### Returns -▸ **getAccount**(`address`): `Promise`<`undefined` \| `Account`\> +`Promise`\<[`StorageDump`](StorageDump.md)\> + +*** + +### dumpStorageRange()? + +> `optional` **dumpStorageRange**(`address`, `startKey`, `limit`): `Promise`\<[`StorageRange`](StorageRange.md)\> + +Defined in: [interfaces.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L219) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | +##### address + +`Address` + +##### startKey + +`bigint` + +##### limit + +`number` #### Returns -`Promise`<`undefined` \| `Account`\> +`Promise`\<[`StorageRange`](StorageRange.md)\> + +*** + +### generateCanonicalGenesis()? + +> `optional` **generateCanonicalGenesis**(`initState`): `Promise`\<`void`\> + +Defined in: [interfaces.ts:228](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L228) + +#### Parameters + +##### initState + +`any` + +#### Returns -#### Defined in +`Promise`\<`void`\> -[interfaces.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L69) +*** -___ +### getAccount() -### getAppliedKey +> **getAccount**(`address`): `Promise`\<`undefined` \| `Account`\> -▸ `Optional` **getAppliedKey**(`address`): `Uint8Array` +Defined in: [interfaces.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L182) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Uint8Array` | +##### address + +`Address` #### Returns +`Promise`\<`undefined` \| `Account`\> + +*** + +### getAppliedKey()? + +> `optional` **getAppliedKey**(`address`): `Uint8Array` + +Defined in: [interfaces.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L240) + +#### Parameters + +##### address + `Uint8Array` -#### Defined in +#### Returns -[interfaces.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L86) +`Uint8Array` + +*** -___ +### getCode() -### getContractCode +> **getCode**(`address`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **getContractCode**(`address`): `Promise`<`Uint8Array`\> +Defined in: [interfaces.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L189) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | +##### address -#### Returns +`Address` -`Promise`<`Uint8Array`\> +#### Returns -#### Defined in +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -[interfaces.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L74) +*** -___ +### getCodeSize() -### getContractStorage +> **getCodeSize**(`address`): `Promise`\<`number`\> -▸ **getContractStorage**(`address`, `key`): `Promise`<`Uint8Array`\> +Defined in: [interfaces.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L190) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Uint8Array` | +##### address + +`Address` #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`number`\> + +*** + +### getStateRoot() + +> **getStateRoot**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [interfaces.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L207) -#### Defined in +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -[interfaces.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L75) +*** -___ +### getStorage() -### getProof +> **getStorage**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ `Optional` **getProof**(`address`, `storageSlots`): `Promise`<[`Proof`](../README.md#proof)\> +Defined in: [interfaces.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L193) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `storageSlots` | `Uint8Array`[] | +##### address + +`Address` + +##### key + +`Uint8Array` #### Returns -`Promise`<[`Proof`](../README.md#proof)\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -#### Defined in +*** -[interfaces.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L83) +### hasStateRoot() -___ +> **hasStateRoot**(`root`): `Promise`\<`boolean`\> -### getStateRoot +Defined in: [interfaces.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L209) -▸ **getStateRoot**(): `Promise`<`Uint8Array`\> +#### Parameters -#### Returns +##### root -`Promise`<`Uint8Array`\> +`Uint8Array` -#### Defined in +#### Returns -[interfaces.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L81) +`Promise`\<`boolean`\> -___ +*** -### hasStateRoot +### initBinaryTreeExecutionWitness()? -▸ **hasStateRoot**(`root`): `Promise`<`boolean`\> +> `optional` **initBinaryTreeExecutionWitness**(`blockNum`, `executionWitness?`): `void` + +Defined in: [interfaces.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L234) #### Parameters -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | +##### blockNum -#### Returns +`bigint` + +##### executionWitness? + +`null` | `BinaryTreeExecutionWitness` -`Promise`<`boolean`\> +#### Returns -#### Defined in +`void` -[interfaces.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L84) +*** -___ +### initVerkleExecutionWitness()? -### modifyAccountFields +> `optional` **initVerkleExecutionWitness**(`blockNum`, `executionWitness?`): `void` -▸ **modifyAccountFields**(`address`, `accountFields`): `Promise`<`void`\> +Defined in: [interfaces.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L229) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `accountFields` | `Partial`<`Pick`<`Account`, ``"nonce"`` \| ``"balance"`` \| ``"storageRoot"`` \| ``"codeHash"``\>\> | +##### blockNum -#### Returns +`bigint` + +##### executionWitness? -`Promise`<`void`\> +`null` | `VerkleExecutionWitness` + +#### Returns -#### Defined in +`void` -[interfaces.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L72) +*** -___ +### modifyAccountFields() -### putAccount +> **modifyAccountFields**(`address`, `accountFields`): `Promise`\<`void`\> -▸ **putAccount**(`address`, `account?`): `Promise`<`void`\> +Defined in: [interfaces.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L185) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `account?` | `Account` | +##### address -#### Returns +`Address` + +##### accountFields -`Promise`<`void`\> +`Partial` -#### Defined in +#### Returns -[interfaces.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L70) +`Promise`\<`void`\> -___ +*** -### putContractCode +### putAccount() -▸ **putContractCode**(`address`, `value`): `Promise`<`void`\> +> **putAccount**(`address`, `account?`): `Promise`\<`void`\> + +Defined in: [interfaces.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L183) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `value` | `Uint8Array` | +##### address -#### Returns +`Address` -`Promise`<`void`\> +##### account? -#### Defined in +`Account` -[interfaces.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L73) +#### Returns + +`Promise`\<`void`\> + +*** -___ +### putCode() -### putContractStorage +> **putCode**(`address`, `value`): `Promise`\<`void`\> -▸ **putContractStorage**(`address`, `key`, `value`): `Promise`<`void`\> +Defined in: [interfaces.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L188) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Uint8Array` | -| `value` | `Uint8Array` | +##### address + +`Address` + +##### value + +`Uint8Array` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Defined in +*** -[interfaces.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L76) +### putStorage() -___ +> **putStorage**(`address`, `key`, `value`): `Promise`\<`void`\> -### revert +Defined in: [interfaces.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L194) + +#### Parameters -▸ **revert**(): `Promise`<`void`\> +##### address + +`Address` + +##### key + +`Uint8Array` + +##### value + +`Uint8Array` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> + +*** -#### Defined in +### revert() -[interfaces.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L80) +> **revert**(): `Promise`\<`void`\> -___ +Defined in: [interfaces.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L202) + +#### Returns -### setStateRoot +`Promise`\<`void`\> -▸ **setStateRoot**(`stateRoot`, `clearCache?`): `Promise`<`void`\> +*** + +### setStateRoot() + +> **setStateRoot**(`stateRoot`, `clearCache?`): `Promise`\<`void`\> + +Defined in: [interfaces.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L208) #### Parameters -| Name | Type | -| :------ | :------ | -| `stateRoot` | `Uint8Array` | -| `clearCache?` | `boolean` | +##### stateRoot + +`Uint8Array` + +##### clearCache? + +`boolean` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Defined in +*** -[interfaces.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L82) +### shallowCopy() -___ +> **shallowCopy**(`downlevelCaches?`): `StateManagerInterface` -### shallowCopy +Defined in: [interfaces.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L246) + +#### Parameters -▸ **shallowCopy**(`downlevelCaches?`): [`StateManagerInterface`](StateManagerInterface.md) +##### downlevelCaches? + +`boolean` + +#### Returns + +`StateManagerInterface` + +*** + +### verifyBinaryTreePostState()? + +> `optional` **verifyBinaryTreePostState**(`accessWitness`): `Promise`\<`boolean`\> + +Defined in: [interfaces.ts:238](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L238) #### Parameters -| Name | Type | -| :------ | :------ | -| `downlevelCaches?` | `boolean` | +##### accessWitness + +[`BinaryTreeAccessWitnessInterface`](BinaryTreeAccessWitnessInterface.md) #### Returns -[`StateManagerInterface`](StateManagerInterface.md) +`Promise`\<`boolean`\> -#### Defined in +*** + +### verifyVerklePostState()? + +> `optional` **verifyVerklePostState**(`accessWitness`): `Promise`\<`boolean`\> + +Defined in: [interfaces.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L233) + +#### Parameters + +##### accessWitness + +[`VerkleAccessWitnessInterface`](VerkleAccessWitnessInterface.md) + +#### Returns -[interfaces.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L85) +`Promise`\<`boolean`\> diff --git a/packages/common/docs/interfaces/StorageDump.md b/packages/common/docs/interfaces/StorageDump.md index bf607375485..0d23152ea96 100644 --- a/packages/common/docs/interfaces/StorageDump.md +++ b/packages/common/docs/interfaces/StorageDump.md @@ -1,7 +1,13 @@ +[**@ethereumjs/common**](../README.md) + +*** + [@ethereumjs/common](../README.md) / StorageDump # Interface: StorageDump +Defined in: [interfaces.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L13) + ## Indexable -▪ [key: `string`]: `string` +\[`key`: `string`\]: `string` diff --git a/packages/common/docs/interfaces/StorageRange.md b/packages/common/docs/interfaces/StorageRange.md index c6025a2a340..129d2f379f4 100644 --- a/packages/common/docs/interfaces/StorageRange.md +++ b/packages/common/docs/interfaces/StorageRange.md @@ -1,44 +1,39 @@ -[@ethereumjs/common](../README.md) / StorageRange +[**@ethereumjs/common**](../README.md) -# Interface: StorageRange +*** -Object that can contain a set of storage keys associated with an account. +[@ethereumjs/common](../README.md) / StorageRange -## Table of contents +# Interface: StorageRange -### Properties +Defined in: [interfaces.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L20) -- [nextKey](StorageRange.md#nextkey) -- [storage](StorageRange.md#storage) +Object that can contain a set of storage keys associated with an account. ## Properties ### nextKey -• **nextKey**: ``null`` \| `string` +> **nextKey**: `null` \| `string` + +Defined in: [interfaces.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L37) The next (hashed) storage key after the greatest storage key contained in `storage`. -#### Defined in - -[interfaces.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L31) - -___ +*** ### storage -• **storage**: `Object` +> **storage**: `object` + +Defined in: [interfaces.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L27) A dictionary where the keys are hashed storage keys, and the values are objects containing the preimage of the hashed key (in `key`) and the storage key (in `value`). Currently, there is no way to retrieve preimages, so they are always `null`. -#### Index signature - -▪ [key: `string`]: { `key`: `string` \| ``null`` ; `value`: `string` } - -#### Defined in +#### Index Signature -[interfaces.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L21) +\[`key`: `string`\]: `object` diff --git a/packages/common/docs/interfaces/VerkleAccessWitnessInterface.md b/packages/common/docs/interfaces/VerkleAccessWitnessInterface.md new file mode 100644 index 00000000000..0b3a19906b3 --- /dev/null +++ b/packages/common/docs/interfaces/VerkleAccessWitnessInterface.md @@ -0,0 +1,291 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / VerkleAccessWitnessInterface + +# Interface: VerkleAccessWitnessInterface + +Defined in: [interfaces.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L154) + +## Methods + +### accesses() + +> **accesses**(): `Generator`\<[`VerkleAccessedStateWithAddress`](../type-aliases/VerkleAccessedStateWithAddress.md)\> + +Defined in: [interfaces.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L155) + +#### Returns + +`Generator`\<[`VerkleAccessedStateWithAddress`](../type-aliases/VerkleAccessedStateWithAddress.md)\> + +*** + +### commit() + +> **commit**(): `void` + +Defined in: [interfaces.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L169) + +#### Returns + +`void` + +*** + +### debugWitnessCost() + +> **debugWitnessCost**(): `void` + +Defined in: [interfaces.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L157) + +#### Returns + +`void` + +*** + +### merge() + +> **merge**(`accessWitness`): `void` + +Defined in: [interfaces.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L168) + +#### Parameters + +##### accessWitness + +`VerkleAccessWitnessInterface` + +#### Returns + +`void` + +*** + +### rawAccesses() + +> **rawAccesses**(): `Generator`\<[`RawVerkleAccessedState`](../type-aliases/RawVerkleAccessedState.md)\> + +Defined in: [interfaces.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L156) + +#### Returns + +`Generator`\<[`RawVerkleAccessedState`](../type-aliases/RawVerkleAccessedState.md)\> + +*** + +### readAccountBasicData() + +> **readAccountBasicData**(`address`): `bigint` + +Defined in: [interfaces.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L158) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### readAccountCodeChunks() + +> **readAccountCodeChunks**(`contract`, `startPc`, `endPc`): `bigint` + +Defined in: [interfaces.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L164) + +#### Parameters + +##### contract + +`Address` + +##### startPc + +`number` + +##### endPc + +`number` + +#### Returns + +`bigint` + +*** + +### readAccountCodeHash() + +> **readAccountCodeHash**(`address`): `bigint` + +Defined in: [interfaces.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L160) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### readAccountHeader() + +> **readAccountHeader**(`address`): `bigint` + +Defined in: [interfaces.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L162) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### readAccountStorage() + +> **readAccountStorage**(`contract`, `storageSlot`): `bigint` + +Defined in: [interfaces.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L166) + +#### Parameters + +##### contract + +`Address` + +##### storageSlot + +`bigint` + +#### Returns + +`bigint` + +*** + +### revert() + +> **revert**(): `void` + +Defined in: [interfaces.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L170) + +#### Returns + +`void` + +*** + +### writeAccountBasicData() + +> **writeAccountBasicData**(`address`): `bigint` + +Defined in: [interfaces.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L159) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### writeAccountCodeChunks() + +> **writeAccountCodeChunks**(`contract`, `startPc`, `endPc`): `bigint` + +Defined in: [interfaces.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L165) + +#### Parameters + +##### contract + +`Address` + +##### startPc + +`number` + +##### endPc + +`number` + +#### Returns + +`bigint` + +*** + +### writeAccountCodeHash() + +> **writeAccountCodeHash**(`address`): `bigint` + +Defined in: [interfaces.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L161) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### writeAccountHeader() + +> **writeAccountHeader**(`address`): `bigint` + +Defined in: [interfaces.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L163) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +*** + +### writeAccountStorage() + +> **writeAccountStorage**(`contract`, `storageSlot`): `bigint` + +Defined in: [interfaces.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L167) + +#### Parameters + +##### contract + +`Address` + +##### storageSlot + +`bigint` + +#### Returns + +`bigint` diff --git a/packages/common/docs/type-aliases/AccessEventFlags.md b/packages/common/docs/type-aliases/AccessEventFlags.md new file mode 100644 index 00000000000..f6a714c2c1b --- /dev/null +++ b/packages/common/docs/type-aliases/AccessEventFlags.md @@ -0,0 +1,55 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / AccessEventFlags + +# Type Alias: AccessEventFlags + +> **AccessEventFlags** = `object` + +Defined in: [interfaces.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L65) + +Verkle related + +Experimental (do not implement) + +## Properties + +### chunkFill + +> **chunkFill**: `boolean` + +Defined in: [interfaces.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L70) + +*** + +### chunkRead + +> **chunkRead**: `boolean` + +Defined in: [interfaces.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L68) + +*** + +### chunkWrite + +> **chunkWrite**: `boolean` + +Defined in: [interfaces.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L69) + +*** + +### stemRead + +> **stemRead**: `boolean` + +Defined in: [interfaces.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L66) + +*** + +### stemWrite + +> **stemWrite**: `boolean` + +Defined in: [interfaces.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L67) diff --git a/packages/common/docs/type-aliases/AccountFields.md b/packages/common/docs/type-aliases/AccountFields.md new file mode 100644 index 00000000000..ed1fa83c2e0 --- /dev/null +++ b/packages/common/docs/type-aliases/AccountFields.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / AccountFields + +# Type Alias: AccountFields + +> **AccountFields** = `Partial`\<`Pick`\<`Account`, `"nonce"` \| `"balance"` \| `"storageRoot"` \| `"codeHash"` \| `"codeSize"`\>\> + +Defined in: [interfaces.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L40) diff --git a/packages/common/docs/type-aliases/AccountState.md b/packages/common/docs/type-aliases/AccountState.md new file mode 100644 index 00000000000..f03a455208a --- /dev/null +++ b/packages/common/docs/type-aliases/AccountState.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / AccountState + +# Type Alias: AccountState + +> **AccountState** = \[`PrefixedHexString`, `PrefixedHexString`, [`StoragePair`](StoragePair.md)[], `PrefixedHexString`\] + +Defined in: [gethGenesis.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L112) diff --git a/packages/common/docs/type-aliases/BinaryTreeAccessedState.md b/packages/common/docs/type-aliases/BinaryTreeAccessedState.md new file mode 100644 index 00000000000..a6b5a8ebcb3 --- /dev/null +++ b/packages/common/docs/type-aliases/BinaryTreeAccessedState.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / BinaryTreeAccessedState + +# Type Alias: BinaryTreeAccessedState + +> **BinaryTreeAccessedState** = \{ `type`: `Exclude`\<[`BinaryTreeAccessedStateType`](BinaryTreeAccessedStateType.md), *typeof* [`Code`](../variables/BinaryTreeAccessedStateType.md#code) \| *typeof* [`Storage`](../variables/BinaryTreeAccessedStateType.md#storage)\>; \} \| \{ `codeOffset`: `number`; `type`: *typeof* [`Code`](../variables/BinaryTreeAccessedStateType.md#code); \} \| \{ `slot`: `bigint`; `type`: *typeof* [`Storage`](../variables/BinaryTreeAccessedStateType.md#storage); \} + +Defined in: [interfaces.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L90) diff --git a/packages/common/docs/type-aliases/BinaryTreeAccessedStateType.md b/packages/common/docs/type-aliases/BinaryTreeAccessedStateType.md new file mode 100644 index 00000000000..8916ba9f51b --- /dev/null +++ b/packages/common/docs/type-aliases/BinaryTreeAccessedStateType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / BinaryTreeAccessedStateType + +# Type Alias: BinaryTreeAccessedStateType + +> **BinaryTreeAccessedStateType** = *typeof* [`BinaryTreeAccessedStateType`](../variables/BinaryTreeAccessedStateType.md)\[keyof *typeof* [`BinaryTreeAccessedStateType`](../variables/BinaryTreeAccessedStateType.md)\] + +Defined in: [interfaces.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L73) diff --git a/packages/common/docs/type-aliases/BinaryTreeAccessedStateWithAddress.md b/packages/common/docs/type-aliases/BinaryTreeAccessedStateWithAddress.md new file mode 100644 index 00000000000..7f0868a6c78 --- /dev/null +++ b/packages/common/docs/type-aliases/BinaryTreeAccessedStateWithAddress.md @@ -0,0 +1,21 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / BinaryTreeAccessedStateWithAddress + +# Type Alias: BinaryTreeAccessedStateWithAddress + +> **BinaryTreeAccessedStateWithAddress** = [`BinaryTreeAccessedState`](BinaryTreeAccessedState.md) & `object` + +Defined in: [interfaces.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L100) + +## Type declaration + +### address + +> **address**: `Address` + +### chunkKey + +> **chunkKey**: `PrefixedHexString` diff --git a/packages/common/docs/type-aliases/CasperConfig.md b/packages/common/docs/type-aliases/CasperConfig.md new file mode 100644 index 00000000000..d80466bc57a --- /dev/null +++ b/packages/common/docs/type-aliases/CasperConfig.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / CasperConfig + +# Type Alias: CasperConfig + +> **CasperConfig** = `object` + +Defined in: [types.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L23) diff --git a/packages/common/docs/type-aliases/Chain.md b/packages/common/docs/type-aliases/Chain.md new file mode 100644 index 00000000000..f47d2a61469 --- /dev/null +++ b/packages/common/docs/type-aliases/Chain.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Chain + +# Type Alias: Chain + +> **Chain** = *typeof* [`Chain`](../variables/Chain.md)\[keyof *typeof* [`Chain`](../variables/Chain.md)\] + +Defined in: [enums.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L3) diff --git a/packages/common/docs/type-aliases/CliqueConfig.md b/packages/common/docs/type-aliases/CliqueConfig.md new file mode 100644 index 00000000000..5bcc1d6fbe9 --- /dev/null +++ b/packages/common/docs/type-aliases/CliqueConfig.md @@ -0,0 +1,27 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / CliqueConfig + +# Type Alias: CliqueConfig + +> **CliqueConfig** = `object` + +Defined in: [types.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L16) + +## Properties + +### epoch + +> **epoch**: `number` + +Defined in: [types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L18) + +*** + +### period + +> **period**: `number` + +Defined in: [types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L17) diff --git a/packages/common/docs/type-aliases/ConsensusAlgorithm.md b/packages/common/docs/type-aliases/ConsensusAlgorithm.md new file mode 100644 index 00000000000..38b44e289bf --- /dev/null +++ b/packages/common/docs/type-aliases/ConsensusAlgorithm.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / ConsensusAlgorithm + +# Type Alias: ConsensusAlgorithm + +> **ConsensusAlgorithm** = *typeof* [`ConsensusAlgorithm`](../variables/ConsensusAlgorithm.md)\[keyof *typeof* [`ConsensusAlgorithm`](../variables/ConsensusAlgorithm.md)\] + +Defined in: [enums.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L99) diff --git a/packages/common/docs/type-aliases/ConsensusType.md b/packages/common/docs/type-aliases/ConsensusType.md new file mode 100644 index 00000000000..1e5c619639e --- /dev/null +++ b/packages/common/docs/type-aliases/ConsensusType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / ConsensusType + +# Type Alias: ConsensusType + +> **ConsensusType** = *typeof* [`ConsensusType`](../variables/ConsensusType.md)\[keyof *typeof* [`ConsensusType`](../variables/ConsensusType.md)\] + +Defined in: [enums.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L91) diff --git a/packages/common/docs/type-aliases/EIPConfig.md b/packages/common/docs/type-aliases/EIPConfig.md new file mode 100644 index 00000000000..66a9da8efc8 --- /dev/null +++ b/packages/common/docs/type-aliases/EIPConfig.md @@ -0,0 +1,27 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / EIPConfig + +# Type Alias: EIPConfig + +> **EIPConfig** = `object` + +Defined in: [types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L167) + +## Properties + +### minimumHardfork + +> **minimumHardfork**: [`Hardfork`](Hardfork.md) + +Defined in: [types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L168) + +*** + +### requiredEIPs? + +> `optional` **requiredEIPs**: `number`[] + +Defined in: [types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L169) diff --git a/packages/common/docs/type-aliases/EIPsDict.md b/packages/common/docs/type-aliases/EIPsDict.md new file mode 100644 index 00000000000..0048f2d0bb7 --- /dev/null +++ b/packages/common/docs/type-aliases/EIPsDict.md @@ -0,0 +1,15 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / EIPsDict + +# Type Alias: EIPsDict + +> **EIPsDict** = `object` + +Defined in: [types.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L182) + +## Index Signature + +\[`key`: `string`\]: [`EIPConfig`](EIPConfig.md) diff --git a/packages/common/docs/type-aliases/EthashConfig.md b/packages/common/docs/type-aliases/EthashConfig.md new file mode 100644 index 00000000000..3d2c2cedaff --- /dev/null +++ b/packages/common/docs/type-aliases/EthashConfig.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / EthashConfig + +# Type Alias: EthashConfig + +> **EthashConfig** = `object` + +Defined in: [types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L21) diff --git a/packages/common/docs/type-aliases/Hardfork.md b/packages/common/docs/type-aliases/Hardfork.md new file mode 100644 index 00000000000..caf13cf8f3f --- /dev/null +++ b/packages/common/docs/type-aliases/Hardfork.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Hardfork + +# Type Alias: Hardfork + +> **Hardfork** = *typeof* [`Hardfork`](../variables/Hardfork.md)\[keyof *typeof* [`Hardfork`](../variables/Hardfork.md)\] + +Defined in: [enums.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L65) diff --git a/packages/common/docs/type-aliases/HardforkConfig.md b/packages/common/docs/type-aliases/HardforkConfig.md new file mode 100644 index 00000000000..1db8d52a9ec --- /dev/null +++ b/packages/common/docs/type-aliases/HardforkConfig.md @@ -0,0 +1,35 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / HardforkConfig + +# Type Alias: HardforkConfig + +> **HardforkConfig** = `object` + +Defined in: [types.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L176) + +## Properties + +### consensus? + +> `optional` **consensus**: `ConsensusConfig` + +Defined in: [types.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L178) + +*** + +### eips? + +> `optional` **eips**: `number`[] + +Defined in: [types.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L177) + +*** + +### params? + +> `optional` **params**: [`ParamsConfig`](ParamsConfig.md) + +Defined in: [types.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L179) diff --git a/packages/common/docs/type-aliases/HardforksDict.md b/packages/common/docs/type-aliases/HardforksDict.md new file mode 100644 index 00000000000..fd2b9aca7b4 --- /dev/null +++ b/packages/common/docs/type-aliases/HardforksDict.md @@ -0,0 +1,15 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / HardforksDict + +# Type Alias: HardforksDict + +> **HardforksDict** = `object` + +Defined in: [types.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L190) + +## Index Signature + +\[`key`: `string`\]: [`HardforkConfig`](HardforkConfig.md) diff --git a/packages/common/docs/type-aliases/ParamsConfig.md b/packages/common/docs/type-aliases/ParamsConfig.md new file mode 100644 index 00000000000..0adab942bed --- /dev/null +++ b/packages/common/docs/type-aliases/ParamsConfig.md @@ -0,0 +1,15 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / ParamsConfig + +# Type Alias: ParamsConfig + +> **ParamsConfig** = `object` + +Defined in: [types.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L172) + +## Index Signature + +\[`key`: `string`\]: `null` \| `string` \| `number` diff --git a/packages/common/docs/type-aliases/ParamsDict.md b/packages/common/docs/type-aliases/ParamsDict.md new file mode 100644 index 00000000000..54c0248ae9e --- /dev/null +++ b/packages/common/docs/type-aliases/ParamsDict.md @@ -0,0 +1,15 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / ParamsDict + +# Type Alias: ParamsDict + +> **ParamsDict** = `object` + +Defined in: [types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L186) + +## Index Signature + +\[`key`: `string`\]: [`ParamsConfig`](ParamsConfig.md) diff --git a/packages/common/docs/type-aliases/Proof.md b/packages/common/docs/type-aliases/Proof.md new file mode 100644 index 00000000000..848cfe8d9b1 --- /dev/null +++ b/packages/common/docs/type-aliases/Proof.md @@ -0,0 +1,67 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Proof + +# Type Alias: Proof + +> **Proof** = `object` + +Defined in: [interfaces.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L50) + +## Properties + +### accountProof + +> **accountProof**: `PrefixedHexString`[] + +Defined in: [interfaces.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L56) + +*** + +### address + +> **address**: `PrefixedHexString` + +Defined in: [interfaces.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L51) + +*** + +### balance + +> **balance**: `PrefixedHexString` + +Defined in: [interfaces.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L52) + +*** + +### codeHash + +> **codeHash**: `PrefixedHexString` + +Defined in: [interfaces.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L53) + +*** + +### nonce + +> **nonce**: `PrefixedHexString` + +Defined in: [interfaces.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L54) + +*** + +### storageHash + +> **storageHash**: `PrefixedHexString` + +Defined in: [interfaces.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L55) + +*** + +### storageProof + +> **storageProof**: [`StorageProof`](StorageProof.md)[] + +Defined in: [interfaces.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L57) diff --git a/packages/common/docs/type-aliases/RawBinaryTreeAccessedState.md b/packages/common/docs/type-aliases/RawBinaryTreeAccessedState.md new file mode 100644 index 00000000000..46e150970d1 --- /dev/null +++ b/packages/common/docs/type-aliases/RawBinaryTreeAccessedState.md @@ -0,0 +1,43 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / RawBinaryTreeAccessedState + +# Type Alias: RawBinaryTreeAccessedState + +> **RawBinaryTreeAccessedState** = `object` + +Defined in: [interfaces.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L83) + +## Properties + +### address + +> **address**: `Address` + +Defined in: [interfaces.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L84) + +*** + +### chunkIndex + +> **chunkIndex**: `number` + +Defined in: [interfaces.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L86) + +*** + +### chunkKey + +> **chunkKey**: `PrefixedHexString` + +Defined in: [interfaces.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L87) + +*** + +### treeIndex + +> **treeIndex**: `number` \| `bigint` + +Defined in: [interfaces.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L85) diff --git a/packages/common/docs/type-aliases/RawVerkleAccessedState.md b/packages/common/docs/type-aliases/RawVerkleAccessedState.md new file mode 100644 index 00000000000..fea6c720747 --- /dev/null +++ b/packages/common/docs/type-aliases/RawVerkleAccessedState.md @@ -0,0 +1,43 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / RawVerkleAccessedState + +# Type Alias: RawVerkleAccessedState + +> **RawVerkleAccessedState** = `object` + +Defined in: [interfaces.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L133) + +## Properties + +### address + +> **address**: `Address` + +Defined in: [interfaces.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L134) + +*** + +### chunkIndex + +> **chunkIndex**: `number` + +Defined in: [interfaces.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L136) + +*** + +### chunkKey + +> **chunkKey**: `PrefixedHexString` + +Defined in: [interfaces.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L137) + +*** + +### treeIndex + +> **treeIndex**: `number` \| `bigint` + +Defined in: [interfaces.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L135) diff --git a/packages/common/docs/type-aliases/StoragePair.md b/packages/common/docs/type-aliases/StoragePair.md new file mode 100644 index 00000000000..9b084e8b6b5 --- /dev/null +++ b/packages/common/docs/type-aliases/StoragePair.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / StoragePair + +# Type Alias: StoragePair + +> **StoragePair** = \[`PrefixedHexString`, `PrefixedHexString`\] + +Defined in: [gethGenesis.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/gethGenesis.ts#L110) diff --git a/packages/common/docs/type-aliases/StorageProof.md b/packages/common/docs/type-aliases/StorageProof.md new file mode 100644 index 00000000000..5edec1ab9d1 --- /dev/null +++ b/packages/common/docs/type-aliases/StorageProof.md @@ -0,0 +1,35 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / StorageProof + +# Type Alias: StorageProof + +> **StorageProof** = `object` + +Defined in: [interfaces.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L44) + +## Properties + +### key + +> **key**: `PrefixedHexString` + +Defined in: [interfaces.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L45) + +*** + +### proof + +> **proof**: `PrefixedHexString`[] + +Defined in: [interfaces.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L46) + +*** + +### value + +> **value**: `PrefixedHexString` + +Defined in: [interfaces.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L47) diff --git a/packages/common/docs/type-aliases/VerkleAccessedState.md b/packages/common/docs/type-aliases/VerkleAccessedState.md new file mode 100644 index 00000000000..335fc512d4c --- /dev/null +++ b/packages/common/docs/type-aliases/VerkleAccessedState.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / VerkleAccessedState + +# Type Alias: VerkleAccessedState + +> **VerkleAccessedState** = \{ `type`: `Exclude`\<[`VerkleAccessedStateType`](VerkleAccessedStateType.md), *typeof* [`Code`](../variables/VerkleAccessedStateType.md#code) \| *typeof* [`Storage`](../variables/VerkleAccessedStateType.md#storage)\>; \} \| \{ `codeOffset`: `number`; `type`: *typeof* [`Code`](../variables/VerkleAccessedStateType.md#code); \} \| \{ `slot`: `bigint`; `type`: *typeof* [`Storage`](../variables/VerkleAccessedStateType.md#storage); \} + +Defined in: [interfaces.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L140) diff --git a/packages/common/docs/type-aliases/VerkleAccessedStateType.md b/packages/common/docs/type-aliases/VerkleAccessedStateType.md new file mode 100644 index 00000000000..8932a327ca6 --- /dev/null +++ b/packages/common/docs/type-aliases/VerkleAccessedStateType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / VerkleAccessedStateType + +# Type Alias: VerkleAccessedStateType + +> **VerkleAccessedStateType** = *typeof* [`VerkleAccessedStateType`](../variables/VerkleAccessedStateType.md)\[keyof *typeof* [`VerkleAccessedStateType`](../variables/VerkleAccessedStateType.md)\] + +Defined in: [interfaces.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L123) diff --git a/packages/common/docs/type-aliases/VerkleAccessedStateWithAddress.md b/packages/common/docs/type-aliases/VerkleAccessedStateWithAddress.md new file mode 100644 index 00000000000..4561ce429d8 --- /dev/null +++ b/packages/common/docs/type-aliases/VerkleAccessedStateWithAddress.md @@ -0,0 +1,21 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / VerkleAccessedStateWithAddress + +# Type Alias: VerkleAccessedStateWithAddress + +> **VerkleAccessedStateWithAddress** = [`VerkleAccessedState`](VerkleAccessedState.md) & `object` + +Defined in: [interfaces.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L150) + +## Type declaration + +### address + +> **address**: `Address` + +### chunkKey + +> **chunkKey**: `PrefixedHexString` diff --git a/packages/common/docs/variables/BinaryTreeAccessedStateType.md b/packages/common/docs/variables/BinaryTreeAccessedStateType.md new file mode 100644 index 00000000000..ca7c82b3ddd --- /dev/null +++ b/packages/common/docs/variables/BinaryTreeAccessedStateType.md @@ -0,0 +1,29 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / BinaryTreeAccessedStateType + +# Variable: BinaryTreeAccessedStateType + +> **BinaryTreeAccessedStateType**: `object` + +Defined in: [interfaces.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L73) + +## Type declaration + +### BasicData + +> `readonly` **BasicData**: `"basicData"` = `'basicData'` + +### Code + +> `readonly` **Code**: `"code"` = `'code'` + +### CodeHash + +> `readonly` **CodeHash**: `"codeHash"` = `'codeHash'` + +### Storage + +> `readonly` **Storage**: `"storage"` = `'storage'` diff --git a/packages/common/docs/variables/Chain.md b/packages/common/docs/variables/Chain.md new file mode 100644 index 00000000000..6edda7a9ab7 --- /dev/null +++ b/packages/common/docs/variables/Chain.md @@ -0,0 +1,33 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Chain + +# Variable: Chain + +> **Chain**: `object` + +Defined in: [enums.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L3) + +## Type declaration + +### Holesky + +> `readonly` **Holesky**: `17000` = `17000` + +### Hoodi + +> `readonly` **Hoodi**: `560048` = `560048` + +### Kaustinen6 + +> `readonly` **Kaustinen6**: `69420` = `69420` + +### Mainnet + +> `readonly` **Mainnet**: `1` = `1` + +### Sepolia + +> `readonly` **Sepolia**: `11155111` = `11155111` diff --git a/packages/common/docs/variables/ChainGenesis.md b/packages/common/docs/variables/ChainGenesis.md new file mode 100644 index 00000000000..aed6da486f5 --- /dev/null +++ b/packages/common/docs/variables/ChainGenesis.md @@ -0,0 +1,13 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / ChainGenesis + +# Variable: ChainGenesis + +> `const` **ChainGenesis**: `Record`\<[`Chain`](../type-aliases/Chain.md), `GenesisState`\> + +Defined in: [enums.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L37) + +GenesisState info about well known ethereum chains diff --git a/packages/common/docs/variables/ChainNameFromNumber.md b/packages/common/docs/variables/ChainNameFromNumber.md new file mode 100644 index 00000000000..0659b688531 --- /dev/null +++ b/packages/common/docs/variables/ChainNameFromNumber.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / ChainNameFromNumber + +# Variable: ChainNameFromNumber + +> `const` **ChainNameFromNumber**: `{ [key in Chain]: string }` + +Defined in: [enums.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L14) diff --git a/packages/common/docs/variables/ConsensusAlgorithm.md b/packages/common/docs/variables/ConsensusAlgorithm.md new file mode 100644 index 00000000000..1cee055bdf8 --- /dev/null +++ b/packages/common/docs/variables/ConsensusAlgorithm.md @@ -0,0 +1,25 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / ConsensusAlgorithm + +# Variable: ConsensusAlgorithm + +> **ConsensusAlgorithm**: `object` + +Defined in: [enums.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L99) + +## Type declaration + +### Casper + +> `readonly` **Casper**: `"casper"` = `'casper'` + +### Clique + +> `readonly` **Clique**: `"clique"` = `'clique'` + +### Ethash + +> `readonly` **Ethash**: `"ethash"` = `'ethash'` diff --git a/packages/common/docs/variables/ConsensusType.md b/packages/common/docs/variables/ConsensusType.md new file mode 100644 index 00000000000..c9e523bcd04 --- /dev/null +++ b/packages/common/docs/variables/ConsensusType.md @@ -0,0 +1,25 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / ConsensusType + +# Variable: ConsensusType + +> **ConsensusType**: `object` + +Defined in: [enums.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L91) + +## Type declaration + +### ProofOfAuthority + +> `readonly` **ProofOfAuthority**: `"poa"` = `'poa'` + +### ProofOfStake + +> `readonly` **ProofOfStake**: `"pos"` = `'pos'` + +### ProofOfWork + +> `readonly` **ProofOfWork**: `"pow"` = `'pow'` diff --git a/packages/common/docs/variables/Hardfork.md b/packages/common/docs/variables/Hardfork.md new file mode 100644 index 00000000000..d77c585f837 --- /dev/null +++ b/packages/common/docs/variables/Hardfork.md @@ -0,0 +1,97 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Hardfork + +# Variable: Hardfork + +> **Hardfork**: `object` + +Defined in: [enums.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/enums.ts#L65) + +## Type declaration + +### ArrowGlacier + +> `readonly` **ArrowGlacier**: `"arrowGlacier"` = `'arrowGlacier'` + +### Berlin + +> `readonly` **Berlin**: `"berlin"` = `'berlin'` + +### Byzantium + +> `readonly` **Byzantium**: `"byzantium"` = `'byzantium'` + +### Cancun + +> `readonly` **Cancun**: `"cancun"` = `'cancun'` + +### Chainstart + +> `readonly` **Chainstart**: `"chainstart"` = `'chainstart'` + +### Constantinople + +> `readonly` **Constantinople**: `"constantinople"` = `'constantinople'` + +### Dao + +> `readonly` **Dao**: `"dao"` = `'dao'` + +### GrayGlacier + +> `readonly` **GrayGlacier**: `"grayGlacier"` = `'grayGlacier'` + +### Homestead + +> `readonly` **Homestead**: `"homestead"` = `'homestead'` + +### Istanbul + +> `readonly` **Istanbul**: `"istanbul"` = `'istanbul'` + +### London + +> `readonly` **London**: `"london"` = `'london'` + +### MergeNetsplitBlock + +> `readonly` **MergeNetsplitBlock**: `"mergeNetsplitBlock"` = `'mergeNetsplitBlock'` + +### MuirGlacier + +> `readonly` **MuirGlacier**: `"muirGlacier"` = `'muirGlacier'` + +### Osaka + +> `readonly` **Osaka**: `"osaka"` = `'osaka'` + +### Paris + +> `readonly` **Paris**: `"paris"` = `'paris'` + +### Petersburg + +> `readonly` **Petersburg**: `"petersburg"` = `'petersburg'` + +### Prague + +> `readonly` **Prague**: `"prague"` = `'prague'` + +### Shanghai + +> `readonly` **Shanghai**: `"shanghai"` = `'shanghai'` + +### SpuriousDragon + +> `readonly` **SpuriousDragon**: `"spuriousDragon"` = `'spuriousDragon'` + +### TangerineWhistle + +> `readonly` **TangerineWhistle**: `"tangerineWhistle"` = `'tangerineWhistle'` + +### Verkle + +> `readonly` **Verkle**: `"verkle"` = `'verkle'` diff --git a/packages/common/docs/variables/Holesky.md b/packages/common/docs/variables/Holesky.md new file mode 100644 index 00000000000..3f37735d36b --- /dev/null +++ b/packages/common/docs/variables/Holesky.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Holesky + +# Variable: Holesky + +> `const` **Holesky**: [`ChainConfig`](../interfaces/ChainConfig.md) + +Defined in: [chains.ts:307](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/chains.ts#L307) diff --git a/packages/common/docs/variables/Hoodi.md b/packages/common/docs/variables/Hoodi.md new file mode 100644 index 00000000000..92061555247 --- /dev/null +++ b/packages/common/docs/variables/Hoodi.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Hoodi + +# Variable: Hoodi + +> `const` **Hoodi**: [`ChainConfig`](../interfaces/ChainConfig.md) + +Defined in: [chains.ts:432](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/chains.ts#L432) diff --git a/packages/common/docs/variables/Kaustinen6.md b/packages/common/docs/variables/Kaustinen6.md new file mode 100644 index 00000000000..0488ac3de9a --- /dev/null +++ b/packages/common/docs/variables/Kaustinen6.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Kaustinen6 + +# Variable: Kaustinen6 + +> `const` **Kaustinen6**: [`ChainConfig`](../interfaces/ChainConfig.md) + +Defined in: [chains.ts:564](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/chains.ts#L564) diff --git a/packages/common/docs/variables/Mainnet.md b/packages/common/docs/variables/Mainnet.md new file mode 100644 index 00000000000..d40aa5a55a5 --- /dev/null +++ b/packages/common/docs/variables/Mainnet.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Mainnet + +# Variable: Mainnet + +> `const` **Mainnet**: [`ChainConfig`](../interfaces/ChainConfig.md) + +Defined in: [chains.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/chains.ts#L3) diff --git a/packages/common/docs/variables/Sepolia.md b/packages/common/docs/variables/Sepolia.md new file mode 100644 index 00000000000..4b889283da8 --- /dev/null +++ b/packages/common/docs/variables/Sepolia.md @@ -0,0 +1,11 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / Sepolia + +# Variable: Sepolia + +> `const` **Sepolia**: [`ChainConfig`](../interfaces/ChainConfig.md) + +Defined in: [chains.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/chains.ts#L166) diff --git a/packages/common/docs/variables/VerkleAccessedStateType.md b/packages/common/docs/variables/VerkleAccessedStateType.md new file mode 100644 index 00000000000..3418046ac3b --- /dev/null +++ b/packages/common/docs/variables/VerkleAccessedStateType.md @@ -0,0 +1,29 @@ +[**@ethereumjs/common**](../README.md) + +*** + +[@ethereumjs/common](../README.md) / VerkleAccessedStateType + +# Variable: VerkleAccessedStateType + +> **VerkleAccessedStateType**: `object` + +Defined in: [interfaces.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L123) + +## Type declaration + +### BasicData + +> `readonly` **BasicData**: `"basicData"` = `'basicData'` + +### Code + +> `readonly` **Code**: `"code"` = `'code'` + +### CodeHash + +> `readonly` **CodeHash**: `"codeHash"` = `'codeHash'` + +### Storage + +> `readonly` **Storage**: `"storage"` = `'storage'` diff --git a/packages/common/examples/customChain.ts b/packages/common/examples/customChain.ts index b473517c1b4..8ee8af1ff7f 100644 --- a/packages/common/examples/customChain.ts +++ b/packages/common/examples/customChain.ts @@ -1,7 +1,6 @@ -import { Common, Mainnet, createCustomCommon } from '@ethereumjs/common' - -import myCustomChain1 from './genesisData/testnet.json' +import { Mainnet, createCustomCommon } from '@ethereumjs/common' +import { customChainConfig } from '@ethereumjs/testdata' // Add custom chain config -const common1 = createCustomCommon(myCustomChain1, Mainnet) +const common1 = createCustomCommon(customChainConfig, Mainnet) console.log(`Common is instantiated with custom chain parameters - ${common1.chainName()}`) diff --git a/packages/common/examples/fromGeth.ts b/packages/common/examples/fromGeth.ts index 6bad8a5f369..ad7ea992b21 100644 --- a/packages/common/examples/fromGeth.ts +++ b/packages/common/examples/fromGeth.ts @@ -1,11 +1,13 @@ import { createCommonFromGethGenesis } from '@ethereumjs/common' +import { postMergeGethGenesis } from '@ethereumjs/testdata' import { hexToBytes } from '@ethereumjs/util' -import genesisJSON from './genesisData/post-merge.json' - const genesisHash = hexToBytes('0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a') // Load geth genesis JSON file into lets say `genesisJSON` and optional `chain` and `genesisHash` -const common = createCommonFromGethGenesis(genesisJSON, { chain: 'customChain', genesisHash }) +const common = createCommonFromGethGenesis(postMergeGethGenesis, { + chain: 'customChain', + genesisHash, +}) // If you don't have `genesisHash` while initiating common, you can later configure common (for e.g. // after calculating it via `blockchain`) common.setForkHashes(genesisHash) diff --git a/packages/common/examples/genesisData/post-merge.json b/packages/common/examples/genesisData/post-merge.json deleted file mode 100644 index 32f5f093d3a..00000000000 --- a/packages/common/examples/genesisData/post-merge.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "config": { - "chainId": 1, - "homesteadBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "petersburgBlock": 0, - "istanbulBlock": 0, - "muirGlacierBlock": 0, - "berlinBlock": 0, - "londonBlock": 0, - "clique": { - "period": 5, - "epoch": 30000 - }, - "terminalTotalDifficulty": 0, - "terminalTotalDifficultyPassed": true - }, - "nonce": "0x42", - "timestamp": "0x0", - "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "gasLimit": "0x1C9C380", - "difficulty": "0x400000000", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x0000000000000000000000000000000000000000", - "alloc": { - "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { "balance": "0x6d6172697573766477000000" } - }, - "number": "0x0", - "gasUsed": "0x0", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "baseFeePerGas": "0x7" -} diff --git a/packages/common/examples/genesisData/testnet.json b/packages/common/examples/genesisData/testnet.json deleted file mode 100644 index bfb6fe4974d..00000000000 --- a/packages/common/examples/genesisData/testnet.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "testnet1", - "chainId": 22222, - "defaultHardfork": "istanbul", - "consensus": { - "type": "poa", - "algorithm": "clique", - "clique": { - "period": 15, - "epoch": 30000 - } - }, - "comment": "Private test network", - "url": "[TESTNET_URL]", - "genesis": { - "gasLimit": 1000000, - "difficulty": 1, - "nonce": "0xbb00000000000000", - "extraData": "0xcc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - }, - "hardforks": [ - { - "name": "chainstart", - "block": 0 - }, - { - "name": "homestead", - "block": 1 - }, - { - "name": "tangerineWhistle", - "block": 2 - }, - { - "name": "spuriousDragon", - "block": 3 - }, - { - "name": "istanbul", - "block": 10 - } - ], - "bootstrapNodes": [ - { - "ip": "10.0.0.1", - "port": 30303, - "id": "11000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "location": "", - "comment": "" - }, - { - "ip": "10.0.0.2", - "port": 30303, - "id": "22000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "location": "", - "comment": "" - } - ] -} diff --git a/packages/common/examples/genesisData/testnet2.json b/packages/common/examples/genesisData/testnet2.json deleted file mode 100644 index 5eec2f59ce6..00000000000 --- a/packages/common/examples/genesisData/testnet2.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "testnet2", - "chainId": 33333, - "defaultHardfork": "istanbul", - "consensus": { - "type": "poa", - "algorithm": "clique", - "clique": { - "period": 15, - "epoch": 30000 - } - }, - "comment": "Private test network", - "url": "[TESTNET_URL]", - "genesis": { - "gasLimit": 1000000, - "difficulty": 1, - "nonce": "0xbb00000000000000", - "extraData": "0xcc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - }, - "hardforks": [ - { - "name": "chainstart", - "block": 0 - }, - { - "name": "homestead", - "block": 1 - }, - { - "name": "tangerineWhistle", - "block": 2 - }, - { - "name": "spuriousDragon", - "block": 3 - }, - { - "name": "istanbul", - "block": 10 - } - ], - "bootstrapNodes": [ - { - "ip": "10.0.0.1", - "port": 30303, - "id": "11000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "location": "", - "comment": "" - }, - { - "ip": "10.0.0.2", - "port": 30303, - "id": "22000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "location": "", - "comment": "" - } - ] -} diff --git a/packages/common/package.json b/packages/common/package.json index dd3542bb9fe..625422e0330 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -47,7 +47,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- common", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", diff --git a/packages/common/src/gethGenesis.ts b/packages/common/src/gethGenesis.ts index 2ecee25dc2a..cbcceaef8f9 100644 --- a/packages/common/src/gethGenesis.ts +++ b/packages/common/src/gethGenesis.ts @@ -87,15 +87,15 @@ export interface GethGenesis { nonce: string timestamp: string extraData?: string - gasLimit: string - difficulty?: string - mixHash?: string - coinbase?: string + gasLimit: PrefixedHexString + difficulty?: PrefixedHexString + mixHash?: PrefixedHexString + coinbase?: PrefixedHexString alloc: GethGenesisAlloc - number?: string - gasUsed?: string - parentHash?: string - baseFeePerGas?: string | number | null + number?: PrefixedHexString + gasUsed?: PrefixedHexString + parentHash?: PrefixedHexString + baseFeePerGas?: PrefixedHexString | number | null } /** @@ -141,7 +141,7 @@ export type AccountState = [ * ``` */ export interface GenesisState { - [key: string]: PrefixedHexString | AccountState + [key: PrefixedHexString]: PrefixedHexString | AccountState } /** diff --git a/packages/common/test/hardforks.spec.ts b/packages/common/test/hardforks.spec.ts index de4db399f28..ba130fadd23 100644 --- a/packages/common/test/hardforks.spec.ts +++ b/packages/common/test/hardforks.spec.ts @@ -15,7 +15,7 @@ import { createCustomCommon, } from '../src/index.ts' -import type { ChainConfig } from '../src/index.ts' +import type { ChainConfig, GethGenesis, GethGenesisConfig } from '../src/index.ts' describe('[Common]: Hardfork logic', () => { it('Hardfork access', () => { @@ -283,7 +283,7 @@ describe('[Common]: Hardfork logic', () => { it('forkHash(): should not change forkHash if timestamp is at genesis timestamp', () => { // Setup default config - const defaultConfig = { + const defaultConfig: GethGenesis = { timestamp: '10', config: { ethash: {}, @@ -305,10 +305,10 @@ describe('[Common]: Hardfork logic', () => { terminalTotalDifficulty: 0, shanghaiTime: 0, cancunTime: 0, - }, - difficulty: '100', + } as GethGenesisConfig, + difficulty: '0x100', alloc: {}, - gasLimit: '5000', + gasLimit: '0x5000', nonce: '', } const gethConfig = { diff --git a/packages/common/typedoc.cjs b/packages/common/typedoc.mjs similarity index 67% rename from packages/common/typedoc.cjs rename to packages/common/typedoc.mjs index 1c6061b8d74..de9677babec 100644 --- a/packages/common/typedoc.cjs +++ b/packages/common/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/**', 'src/chains/**', 'src/eips/**', 'src/hardforks/**'], diff --git a/packages/devp2p/README.md b/packages/devp2p/README.md index 19ea07924bf..ef61e0ae9d8 100644 --- a/packages/devp2p/README.md +++ b/packages/devp2p/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/devp2p +# @ethereumjs/devp2p `v10` [![NPM Status][devp2p-npm-badge]][devp2p-npm-link] [![GitHub Issues][devp2p-issues-badge]][devp2p-issues-link] @@ -6,15 +6,27 @@ [![Coverage Status][devp2p-coverage-badge]][devp2p-coverage-link] [![Discord][discord-badge]][discord-link] -## Introduction - This library bundles different components for lower-level peer-to-peer connection and message exchange: - Distributed Peer Table (DPT) / v4 Node Discovery / DNS Discovery - RLPx Transport Protocol - Ethereum Wire Protocol (ETH/68) -## Usage +## Table of Contents + +- [Getting Started](#getting-started) +- [Examples](#examples) +- [API](#api) +- [Distributed Peer Table (DPT) / Node Discovery](#distributed-peer-table-dpt--node-discovery) +- [RLPx Transport Protocol](#rlpx-transport-protocol) +- [Ethereum Wire Protocol (ETH)](#ethereum-wire-protocol-eth) +- [Debugging](#debugging) +- [Developer](#developer) +- [General References](#general-references) +- [EthereumJS](#ethereumjs) +- [License](#license) + +## Getting Started All components of this library have a public `events` property containing an `EventEmitter` object (using [EventEmitter3](https://github.com/primus/eventemitter3)) and make heavy use of the Node.js network stack. @@ -43,7 +55,7 @@ Run an example with: DEBUG=ethjs,devp2p:* node -r tsx/register ./examples/peer-communication.cts ``` -## Docs +## API For a complete API reference see the generated [documentation](./docs). @@ -337,10 +349,6 @@ Events emitted: | message | Message received | | status | Status info received | -### Reference - -- [Light client protocol](https://ethereum.org/en/developers/docs/nodes-and-clients/#light-node) - ## Debugging ### Introduction @@ -453,11 +461,6 @@ The following is a list of major implementations of the `devp2p` stack in other - Python: [pydevp2p](https://github.com/ethereum/pydevp2p) - Go: [Go Ethereum](https://github.com/ethereum/go-ethereum/tree/master/p2p) -- Elixir: [Exthereum](https://github.com/exthereum/exth_crypto) - -### Links - -- [Blog article series](https://ocalog.com/post/10/) on implementing Ethereum protocol stack ## EthereumJS diff --git a/packages/devp2p/docs/README.md b/packages/devp2p/docs/README.md index 04fc64681d2..5ed858c6033 100644 --- a/packages/devp2p/docs/README.md +++ b/packages/devp2p/docs/README.md @@ -1,530 +1,82 @@ -@ethereumjs/devp2p +**@ethereumjs/devp2p** -# @ethereumjs/devp2p - -## Table of contents - -### Namespaces - -- [ETH](modules/ETH.md) -- [LES](modules/LES.md) -- [SNAP](modules/SNAP.md) +*** -### Enumerations - -- [DISCONNECT\_REASON](enums/DISCONNECT_REASON.md) -- [ProtocolType](enums/ProtocolType.md) +# @ethereumjs/devp2p -### Classes +## Classes - [BanList](classes/BanList.md) +- [Deferred](classes/Deferred.md) - [DNS](classes/DNS.md) - [DPT](classes/DPT.md) -- [Deferred](classes/Deferred.md) - [ECIES](classes/ECIES.md) - [ENR](classes/ENR.md) -- [ETH](classes/ETH-1.md) +- [ETH](classes/ETH.md) - [KBucket](classes/KBucket.md) -- [LES](classes/LES-1.md) - [MAC](classes/MAC.md) - [Peer](classes/Peer.md) - [RLPx](classes/RLPx.md) -- [SNAP](classes/SNAP-1.md) - [Server](classes/Server.md) +- [SNAP](classes/SNAP.md) -### Interfaces +## Interfaces - [Capabilities](interfaces/Capabilities.md) - [Contact](interfaces/Contact.md) +- [DPTEvent](interfaces/DPTEvent.md) - [DPTOptions](interfaces/DPTOptions.md) - [DPTServerOptions](interfaces/DPTServerOptions.md) +- [EthStatusMsg](interfaces/EthStatusMsg.md) +- [KBucketEvent](interfaces/KBucketEvent.md) - [KBucketOptions](interfaces/KBucketOptions.md) +- [PeerEvent](interfaces/PeerEvent.md) - [PeerInfo](interfaces/PeerInfo.md) - [PeerOptions](interfaces/PeerOptions.md) +- [ProtocolEvent](interfaces/ProtocolEvent.md) +- [RLPxEvent](interfaces/RLPxEvent.md) - [RLPxOptions](interfaces/RLPxOptions.md) - -### Type Aliases - -- [DNSOptions](README.md#dnsoptions) -- [SendMethod](README.md#sendmethod) - -### Variables - -- [DEFAULT\_ANNOUNCE\_TYPE](README.md#default_announce_type) - -### Functions - -- [assertEq](README.md#asserteq) -- [createDeferred](README.md#createdeferred) -- [decode](README.md#decode) -- [devp2pDebug](README.md#devp2pdebug) -- [encode](README.md#encode) -- [formatLogData](README.md#formatlogdata) -- [formatLogId](README.md#formatlogid) -- [genPrivateKey](README.md#genprivatekey) -- [id2pk](README.md#id2pk) -- [ipToBytes](README.md#iptobytes) -- [ipToString](README.md#iptostring) -- [isV4Format](README.md#isv4format) -- [isV6Format](README.md#isv6format) -- [keccak256](README.md#keccak256) -- [pk2id](README.md#pk2id) -- [toNewUint8Array](README.md#tonewuint8array) -- [unstrictDecode](README.md#unstrictdecode) -- [xor](README.md#xor) -- [zfill](README.md#zfill) +- [ServerEvent](interfaces/ServerEvent.md) ## Type Aliases -### DNSOptions - -Ƭ **DNSOptions**: `Object` - -#### Type declaration - -| Name | Type | Description | -| :------ | :------ | :------ | -| `dnsServerAddress?` | `string` | ipv4 or ipv6 address of server to pass to native dns.setServers() Sets the IP address of servers to be used when performing DNS resolution. | - -#### Defined in - -[packages/devp2p/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L32) - -___ - -### SendMethod - -Ƭ **SendMethod**: (`code`: `number`, `data`: `Uint8Array`) => `any` - -#### Type declaration - -▸ (`code`, `data`): `any` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `code` | `number` | -| `data` | `Uint8Array` | - -##### Returns - -`any` - -#### Defined in - -[packages/devp2p/src/types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L212) +- [DISCONNECT\_REASON](type-aliases/DISCONNECT_REASON.md) +- [DNSOptions](type-aliases/DNSOptions.md) +- [EthMessageCodes](type-aliases/EthMessageCodes.md) +- [EthStatusOpts](type-aliases/EthStatusOpts.md) +- [PREFIXES](type-aliases/PREFIXES.md) +- [ProtocolType](type-aliases/ProtocolType.md) +- [SendMethod](type-aliases/SendMethod.md) +- [SnapMessageCodes](type-aliases/SnapMessageCodes.md) ## Variables -### DEFAULT\_ANNOUNCE\_TYPE - -• `Const` **DEFAULT\_ANNOUNCE\_TYPE**: ``1`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L21) +- [devp2pDebug](variables/devp2pDebug.md) +- [DISCONNECT\_REASON](variables/DISCONNECT_REASON.md) +- [DisconnectReasonNames](variables/DisconnectReasonNames.md) +- [EthMessageCodeNames](variables/EthMessageCodeNames.md) +- [EthMessageCodes](variables/EthMessageCodes.md) +- [PREFIXES](variables/PREFIXES.md) +- [PrefixesNames](variables/PrefixesNames.md) +- [ProtocolType](variables/ProtocolType.md) +- [SnapMessageCodeNames](variables/SnapMessageCodeNames.md) +- [SnapMessageCodes](variables/SnapMessageCodes.md) ## Functions -### assertEq - -▸ **assertEq**(`expected`, `actual`, `msg`, `debug`, `messageName?`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `expected` | `assertInput` | -| `actual` | `assertInput` | -| `msg` | `string` | -| `debug` | `Function` | -| `messageName?` | `string` | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/util.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L51) - -___ - -### createDeferred - -▸ **createDeferred**<`T`\>(): [`Deferred`](classes/Deferred.md)<`T`\> - -#### Type parameters - -| Name | -| :------ | -| `T` | - -#### Returns - -[`Deferred`](classes/Deferred.md)<`T`\> - -#### Defined in - -[packages/devp2p/src/util.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L112) - -___ - -### decode - -▸ **decode**(`bytes`): `Object` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `bytes` | `Uint8Array` | - -#### Returns - -`Object` - -| Name | Type | -| :------ | :------ | -| `data` | `any` | -| `publicKey` | `Uint8Array` | -| `typename` | `string` \| `number` | - -#### Defined in - -[packages/devp2p/src/dpt/message.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/message.ts#L190) - -___ - -### devp2pDebug - -▸ **devp2pDebug**(`formatter`, ...`args`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `formatter` | `any` | -| `...args` | `any`[] | - -#### Returns - -`void` - -#### Defined in - -node_modules/@types/debug/index.d.ts:51 - -___ - -### encode - -▸ **encode**<`T`\>(`typename`, `data`, `privateKey`): `Uint8Array` - -#### Type parameters - -| Name | -| :------ | -| `T` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `typename` | `string` | -| `data` | `T` | -| `privateKey` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/dpt/message.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/message.ts#L177) - -___ - -### formatLogData - -▸ **formatLogData**(`data`, `verbose`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `data` | `string` | -| `verbose` | `boolean` | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/util.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L91) - -___ - -### formatLogId - -▸ **formatLogId**(`id`, `verbose`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `id` | `string` | -| `verbose` | `boolean` | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/util.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L82) - -___ - -### genPrivateKey - -▸ **genPrivateKey**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L19) - -___ - -### id2pk - -▸ **id2pk**(`id`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `id` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L31) - -___ - -### ipToBytes - -▸ **ipToBytes**(`ip`, `bytes?`, `offset?`): `Uint8Array` - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `ip` | `string` | `undefined` | -| `bytes?` | `Uint8Array` | `undefined` | -| `offset` | `number` | `0` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L167) - -___ - -### ipToString - -▸ **ipToString**(`bytes`, `offset?`, `length?`): `string` - -************************* *********************************************************** - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `bytes` | `Uint8Array` | -| `offset?` | `number` | -| `length?` | `number` | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/util.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L131) - -___ - -### isV4Format - -▸ **isV4Format**(`ip`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `ip` | `string` | - -#### Returns - -`boolean` - -#### Defined in - -[packages/devp2p/src/util.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L159) - -___ - -### isV6Format - -▸ **isV6Format**(`ip`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `ip` | `string` | - -#### Returns - -`boolean` - -#### Defined in - -[packages/devp2p/src/util.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L163) - -___ - -### keccak256 - -▸ **keccak256**(...`bytes`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `...bytes` | `Uint8Array`[] | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L14) - -___ - -### pk2id - -▸ **pk2id**(`pk`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `pk` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L24) - -___ - -### toNewUint8Array - -▸ **toNewUint8Array**(`buf`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `buf` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L123) - -___ - -### unstrictDecode - -▸ **unstrictDecode**(`value`): `Uint8Array` \| `NestedUint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `Uint8Array` | - -#### Returns - -`Uint8Array` \| `NestedUint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L116) - -___ - -### xor - -▸ **xor**(`a`, `b`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `a` | `Uint8Array` | -| `b` | `any` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L42) - -___ - -### zfill - -▸ **zfill**(`bytes`, `size`, `leftpad?`): `Uint8Array` - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `bytes` | `Uint8Array` | `undefined` | -| `size` | `number` | `undefined` | -| `leftpad` | `boolean` | `true` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/devp2p/src/util.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L35) +- [assertEq](functions/assertEq.md) +- [createDeferred](functions/createDeferred.md) +- [decode](functions/decode.md) +- [encode](functions/encode.md) +- [formatLogData](functions/formatLogData.md) +- [formatLogId](functions/formatLogId.md) +- [genPrivateKey](functions/genPrivateKey.md) +- [id2pk](functions/id2pk.md) +- [ipToBytes](functions/ipToBytes.md) +- [ipToString](functions/ipToString.md) +- [isV4Format](functions/isV4Format.md) +- [isV6Format](functions/isV6Format.md) +- [pk2id](functions/pk2id.md) +- [unstrictDecode](functions/unstrictDecode.md) +- [xor](functions/xor.md) +- [zfill](functions/zfill.md) diff --git a/packages/devp2p/docs/classes/BanList.md b/packages/devp2p/docs/classes/BanList.md index 1ae15e0be43..c3c24642eff 100644 --- a/packages/devp2p/docs/classes/BanList.md +++ b/packages/devp2p/docs/classes/BanList.md @@ -1,65 +1,61 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + [@ethereumjs/devp2p](../README.md) / BanList # Class: BanList -## Table of contents +Defined in: [packages/devp2p/src/dpt/ban-list.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L13) -### Constructors +## Constructors -- [constructor](BanList.md#constructor) +### Constructor -### Methods +> **new BanList**(): `BanList` -- [add](BanList.md#add) -- [has](BanList.md#has) +Defined in: [packages/devp2p/src/dpt/ban-list.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L16) -## Constructors +#### Returns -### constructor +`BanList` -• **new BanList**() +## Methods -#### Defined in +### add() -[packages/devp2p/src/dpt/ban-list.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L18) +> **add**(`obj`, `maxAge?`): `void` -## Methods +Defined in: [packages/devp2p/src/dpt/ban-list.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L22) -### add +#### Parameters -▸ **add**(`obj`, `maxAge?`): `void` +##### obj -#### Parameters +`string` | [`PeerInfo`](../interfaces/PeerInfo.md) | `Uint8Array`\<`ArrayBufferLike`\> -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | -| `maxAge?` | `number` | +##### maxAge? + +`number` #### Returns `void` -#### Defined in - -[packages/devp2p/src/dpt/ban-list.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L22) +*** -___ +### has() -### has +> **has**(`obj`): `boolean` -▸ **has**(`obj`): `boolean` +Defined in: [packages/devp2p/src/dpt/ban-list.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L31) #### Parameters -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +##### obj + +`string` | [`PeerInfo`](../interfaces/PeerInfo.md) | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `boolean` - -#### Defined in - -[packages/devp2p/src/dpt/ban-list.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L29) diff --git a/packages/devp2p/docs/classes/DNS.md b/packages/devp2p/docs/classes/DNS.md index dee6a834f6d..4301ca5f494 100644 --- a/packages/devp2p/docs/classes/DNS.md +++ b/packages/devp2p/docs/classes/DNS.md @@ -1,62 +1,61 @@ -[@ethereumjs/devp2p](../README.md) / DNS - -# Class: DNS +[**@ethereumjs/devp2p**](../README.md) -## Table of contents +*** -### Constructors - -- [constructor](DNS.md#constructor) +[@ethereumjs/devp2p](../README.md) / DNS -### Methods +# Class: DNS -- [\_\_setNativeDNSModuleResolve](DNS.md#__setnativednsmoduleresolve) -- [getPeers](DNS.md#getpeers) +Defined in: [packages/devp2p/src/dns/dns.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L18) ## Constructors -### constructor +### Constructor + +> **new DNS**(`options`): `DNS` -• **new DNS**(`options?`) +Defined in: [packages/devp2p/src/dns/dns.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L26) #### Parameters -| Name | Type | -| :------ | :------ | -| `options` | [`DNSOptions`](../README.md#dnsoptions) | +##### options -#### Defined in +[`DNSOptions`](../type-aliases/DNSOptions.md) = `{}` + +#### Returns -[packages/devp2p/src/dns/dns.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L27) +`DNS` ## Methods -### \_\_setNativeDNSModuleResolve +### \_\_setNativeDNSModuleResolve() -▸ **__setNativeDNSModuleResolve**(`mock`): `void` +> **\_\_setNativeDNSModuleResolve**(`mock`): `void` + +Defined in: [packages/devp2p/src/dns/dns.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L216) Only used for testing. A stopgap to enable successful TestDouble mocking of the native `dns` module. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `mock` | `any` | TestDouble fn | +##### mock + +`any` + +TestDouble fn #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/dns/dns.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L208) +### getPeers() -___ +> **getPeers**(`maxQuantity`, `dnsNetworks`): `Promise`\<[`PeerInfo`](../interfaces/PeerInfo.md)[]\> -### getPeers - -▸ **getPeers**(`maxQuantity`, `dnsNetworks`): `Promise`<[`PeerInfo`](../interfaces/PeerInfo.md)[]\> +Defined in: [packages/devp2p/src/dns/dns.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L49) Returns a list of verified peers listed in an EIP-1459 DNS tree. Method may return fewer peers than requested if `maxQuantity` is larger than the number @@ -65,15 +64,18 @@ search exceeds `maxQuantity` plus the `errorTolerance` factor. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `maxQuantity` | `number` | max number to get | -| `dnsNetworks` | `string`[] | enrTree strings (See EIP-1459 for format) | +##### maxQuantity -#### Returns +`number` -`Promise`<[`PeerInfo`](../interfaces/PeerInfo.md)[]\> +max number to get -#### Defined in +##### dnsNetworks + +`string`[] + +enrTree strings (See EIP-1459 for format) + +#### Returns -[packages/devp2p/src/dns/dns.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L45) +`Promise`\<[`PeerInfo`](../interfaces/PeerInfo.md)[]\> diff --git a/packages/devp2p/docs/classes/DPT.md b/packages/devp2p/docs/classes/DPT.md index 986e44b072d..777efd1727d 100644 --- a/packages/devp2p/docs/classes/DPT.md +++ b/packages/devp2p/docs/classes/DPT.md @@ -1,311 +1,308 @@ -[@ethereumjs/devp2p](../README.md) / DPT +[**@ethereumjs/devp2p**](../README.md) -# Class: DPT +*** -## Table of contents +[@ethereumjs/devp2p](../README.md) / DPT -### Constructors +# Class: DPT -- [constructor](DPT.md#constructor) +Defined in: [packages/devp2p/src/dpt/dpt.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L23) -### Properties +## Constructors -- [events](DPT.md#events) -- [id](DPT.md#id) +### Constructor -### Methods +> **new DPT**(`privateKey`, `options`): `DPT` -- [\_addPeerBatch](DPT.md#_addpeerbatch) -- [\_onKBucketPing](DPT.md#_onkbucketping) -- [addPeer](DPT.md#addpeer) -- [banPeer](DPT.md#banpeer) -- [bind](DPT.md#bind) -- [bootstrap](DPT.md#bootstrap) -- [destroy](DPT.md#destroy) -- [getClosestPeers](DPT.md#getclosestpeers) -- [getDnsPeers](DPT.md#getdnspeers) -- [getPeer](DPT.md#getpeer) -- [getPeers](DPT.md#getpeers) -- [refresh](DPT.md#refresh) -- [removePeer](DPT.md#removepeer) +Defined in: [packages/devp2p/src/dpt/dpt.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L48) -## Constructors +#### Parameters -### constructor +##### privateKey -• **new DPT**(`privateKey`, `options`) +`Uint8Array` -#### Parameters +##### options -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | -| `options` | [`DPTOptions`](../interfaces/DPTOptions.md) | +[`DPTOptions`](../interfaces/DPTOptions.md) -#### Defined in +#### Returns -[packages/devp2p/src/dpt/dpt.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L35) +`DPT` ## Properties ### events -• **events**: `EventEmitter` - -#### Defined in +> **events**: `EventEmitter`\<[`DPTEvent`](../interfaces/DPTEvent.md)\> -[packages/devp2p/src/dpt/dpt.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L18) +Defined in: [packages/devp2p/src/dpt/dpt.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L24) -___ +*** ### id -• `Readonly` **id**: `undefined` \| `Uint8Array` +> `readonly` **id**: `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L24) +Defined in: [packages/devp2p/src/dpt/dpt.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L30) ## Methods -### \_addPeerBatch +### \_addPeerBatch() + +> **\_addPeerBatch**(`peers`): `void` -▸ **_addPeerBatch**(`peers`): `void` +Defined in: [packages/devp2p/src/dpt/dpt.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L128) #### Parameters -| Name | Type | -| :------ | :------ | -| `peers` | [`PeerInfo`](../interfaces/PeerInfo.md)[] | +##### peers + +[`PeerInfo`](../interfaces/PeerInfo.md)[] #### Returns `void` -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L105) +*** -___ +### \_onKBucketPing() -### \_onKBucketPing +> **\_onKBucketPing**(`oldPeers`, `newPeer`): `void` -▸ **_onKBucketPing**(`oldPeers`, `newPeer`): `void` +Defined in: [packages/devp2p/src/dpt/dpt.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L106) #### Parameters -| Name | Type | -| :------ | :------ | -| `oldPeers` | [`PeerInfo`](../interfaces/PeerInfo.md)[] | -| `newPeer` | [`PeerInfo`](../interfaces/PeerInfo.md) | +##### oldPeers + +[`PeerInfo`](../interfaces/PeerInfo.md)[] + +##### newPeer + +[`PeerInfo`](../interfaces/PeerInfo.md) #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/dpt/dpt.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L84) +### addPeer() -___ +> **addPeer**(`obj`): `Promise`\<[`PeerInfo`](../interfaces/PeerInfo.md)\> -### addPeer - -▸ **addPeer**(`obj`): `Promise`<[`PeerInfo`](../interfaces/PeerInfo.md)\> +Defined in: [packages/devp2p/src/dpt/dpt.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L157) #### Parameters -| Name | Type | -| :------ | :------ | -| `obj` | [`PeerInfo`](../interfaces/PeerInfo.md) | +##### obj -#### Returns +[`PeerInfo`](../interfaces/PeerInfo.md) -`Promise`<[`PeerInfo`](../interfaces/PeerInfo.md)\> +#### Returns -#### Defined in +`Promise`\<[`PeerInfo`](../interfaces/PeerInfo.md)\> -[packages/devp2p/src/dpt/dpt.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L131) +*** -___ +### banPeer() -### banPeer +> **banPeer**(`obj`, `maxAge?`): `void` -▸ **banPeer**(`obj`, `maxAge?`): `void` +Defined in: [packages/devp2p/src/dpt/dpt.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L223) #### Parameters -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | -| `maxAge?` | `number` | +##### obj + +`string` | [`PeerInfo`](../interfaces/PeerInfo.md) | `Uint8Array`\<`ArrayBufferLike`\> + +##### maxAge? + +`number` #### Returns `void` -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L167) +*** -___ +### bind() -### bind +> **bind**(...`args`): `void` -▸ **bind**(...`args`): `void` +Defined in: [packages/devp2p/src/dpt/dpt.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L97) #### Parameters -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | +##### args + +...`any`[] #### Returns `void` -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L75) +*** -___ +### bootstrap() -### bootstrap +> **bootstrap**(`peer`): `Promise`\<`void`\> -▸ **bootstrap**(`peer`): `Promise`<`void`\> +Defined in: [packages/devp2p/src/dpt/dpt.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L141) #### Parameters -| Name | Type | -| :------ | :------ | -| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | +##### peer + +[`PeerInfo`](../interfaces/PeerInfo.md) #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Defined in +*** -[packages/devp2p/src/dpt/dpt.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L118) +### confirmPeer() -___ +> **confirmPeer**(`id`): `void` -### destroy +Defined in: [packages/devp2p/src/dpt/dpt.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L187) -▸ **destroy**(...`args`): `void` +Add peer to a confirmed list of peers (peers meeting some +level of quality, e.g. being on the same network) to allow +for a more selective findNeighbours request and sending +(with activated `onlyConfirmed` setting) #### Parameters -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | +##### id + +`string` + +Unprefixed hex id #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/dpt/dpt.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L79) +### destroy() -___ +> **destroy**(...`args`): `void` -### getClosestPeers - -▸ **getClosestPeers**(`id`): [`PeerInfo`](../interfaces/PeerInfo.md)[] +Defined in: [packages/devp2p/src/dpt/dpt.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L101) #### Parameters -| Name | Type | -| :------ | :------ | -| `id` | `Uint8Array` | +##### args + +...`any`[] #### Returns -[`PeerInfo`](../interfaces/PeerInfo.md)[] +`void` + +*** -#### Defined in +### getClosestPeers() -[packages/devp2p/src/dpt/dpt.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L159) +> **getClosestPeers**(`id`): [`PeerInfo`](../interfaces/PeerInfo.md)[] -___ +Defined in: [packages/devp2p/src/dpt/dpt.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L205) -### getDnsPeers +#### Parameters + +##### id -▸ **getDnsPeers**(): `Promise`<[`PeerInfo`](../interfaces/PeerInfo.md)[]\> +`Uint8Array` #### Returns -`Promise`<[`PeerInfo`](../interfaces/PeerInfo.md)[]\> +[`PeerInfo`](../interfaces/PeerInfo.md)[] + +*** + +### getDnsPeers() + +> **getDnsPeers**(): `Promise`\<[`PeerInfo`](../interfaces/PeerInfo.md)[]\> + +Defined in: [packages/devp2p/src/dpt/dpt.ts:228](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L228) -#### Defined in +#### Returns + +`Promise`\<[`PeerInfo`](../interfaces/PeerInfo.md)[]\> -[packages/devp2p/src/dpt/dpt.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L172) +*** -___ +### getPeer() -### getPeer +> **getPeer**(`obj`): `null` \| [`PeerInfo`](../interfaces/PeerInfo.md) -▸ **getPeer**(`obj`): ``null`` \| [`PeerInfo`](../interfaces/PeerInfo.md) +Defined in: [packages/devp2p/src/dpt/dpt.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L193) #### Parameters -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +##### obj -#### Returns +`string` | [`PeerInfo`](../interfaces/PeerInfo.md) | `Uint8Array`\<`ArrayBufferLike`\> -``null`` \| [`PeerInfo`](../interfaces/PeerInfo.md) +#### Returns -#### Defined in +`null` \| [`PeerInfo`](../interfaces/PeerInfo.md) -[packages/devp2p/src/dpt/dpt.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L151) +*** -___ +### getPeers() -### getPeers +> **getPeers**(): [`PeerInfo`](../interfaces/PeerInfo.md)[] -▸ **getPeers**(): [`PeerInfo`](../interfaces/PeerInfo.md)[] +Defined in: [packages/devp2p/src/dpt/dpt.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L197) #### Returns [`PeerInfo`](../interfaces/PeerInfo.md)[] -#### Defined in +*** -[packages/devp2p/src/dpt/dpt.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L155) +### numPeers() -___ +> **numPeers**(): `number` -### refresh - -▸ **refresh**(): `Promise`<`void`\> +Defined in: [packages/devp2p/src/dpt/dpt.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L201) #### Returns -`Promise`<`void`\> +`number` + +*** + +### refresh() -#### Defined in +> **refresh**(): `Promise`\<`void`\> -[packages/devp2p/src/dpt/dpt.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L176) +Defined in: [packages/devp2p/src/dpt/dpt.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L232) -___ +#### Returns + +`Promise`\<`void`\> + +*** + +### removePeer() -### removePeer +> **removePeer**(`obj`): `void` -▸ **removePeer**(`obj`): `void` +Defined in: [packages/devp2p/src/dpt/dpt.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L215) #### Parameters -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +##### obj + +`string` | [`PeerInfo`](../interfaces/PeerInfo.md) | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `void` - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L163) diff --git a/packages/devp2p/docs/classes/Deferred.md b/packages/devp2p/docs/classes/Deferred.md index f9c880472ae..7d85e0fe968 100644 --- a/packages/devp2p/docs/classes/Deferred.md +++ b/packages/devp2p/docs/classes/Deferred.md @@ -1,95 +1,71 @@ -[@ethereumjs/devp2p](../README.md) / Deferred - -# Class: Deferred +[**@ethereumjs/devp2p**](../README.md) -## Type parameters +*** -| Name | -| :------ | -| `T` | +[@ethereumjs/devp2p](../README.md) / Deferred -## Table of contents +# Class: Deferred\ -### Constructors +Defined in: [packages/devp2p/src/util.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L100) -- [constructor](Deferred.md#constructor) +## Type Parameters -### Properties +### T -- [promise](Deferred.md#promise) -- [reject](Deferred.md#reject) -- [resolve](Deferred.md#resolve) +`T` ## Constructors -### constructor +### Constructor -• **new Deferred**<`T`\>() +> **new Deferred**\<`T`\>(): `Deferred`\<`T`\> -#### Type parameters +Defined in: [packages/devp2p/src/util.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L104) -| Name | -| :------ | -| `T` | +#### Returns -#### Defined in - -[packages/devp2p/src/util.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L104) +`Deferred`\<`T`\> ## Properties ### promise -• **promise**: `Promise`<`T`\> - -#### Defined in +> **promise**: `Promise`\<`T`\> -[packages/devp2p/src/util.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L101) +Defined in: [packages/devp2p/src/util.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L101) -___ +*** -### reject +### reject() -• **reject**: (...`args`: `any`[]) => `any` +> **reject**: (...`args`) => `any` -#### Type declaration +Defined in: [packages/devp2p/src/util.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L103) -▸ (...`args`): `any` +#### Parameters -##### Parameters +##### args -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | +...`any`[] -##### Returns +#### Returns `any` -#### Defined in +*** -[packages/devp2p/src/util.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L103) +### resolve() -___ +> **resolve**: (...`args`) => `any` -### resolve +Defined in: [packages/devp2p/src/util.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L102) -• **resolve**: (...`args`: `any`[]) => `any` +#### Parameters -#### Type declaration +##### args -▸ (...`args`): `any` +...`any`[] -##### Parameters - -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | - -##### Returns +#### Returns `any` - -#### Defined in - -[packages/devp2p/src/util.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L102) diff --git a/packages/devp2p/docs/classes/ECIES.md b/packages/devp2p/docs/classes/ECIES.md index 991d4c3378c..7f887a0c980 100644 --- a/packages/devp2p/docs/classes/ECIES.md +++ b/packages/devp2p/docs/classes/ECIES.md @@ -1,326 +1,305 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + [@ethereumjs/devp2p](../README.md) / ECIES # Class: ECIES -## Table of contents +Defined in: [packages/devp2p/src/rlpx/ecies.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L61) -### Constructors +## Constructors -- [constructor](ECIES.md#constructor) +### Constructor -### Methods +> **new ECIES**(`privateKey`, `id`, `remoteId`, `common?`): `ECIES` -- [\_decryptMessage](ECIES.md#_decryptmessage) -- [\_encryptMessage](ECIES.md#_encryptmessage) -- [\_setupFrame](ECIES.md#_setupframe) -- [createAckEIP8](ECIES.md#createackeip8) -- [createAckOld](ECIES.md#createackold) -- [createAuthEIP8](ECIES.md#createautheip8) -- [createAuthNonEIP8](ECIES.md#createauthnoneip8) -- [createBody](ECIES.md#createbody) -- [createHeader](ECIES.md#createheader) -- [parseAckEIP8](ECIES.md#parseackeip8) -- [parseAckPlain](ECIES.md#parseackplain) -- [parseAuthEIP8](ECIES.md#parseautheip8) -- [parseAuthPlain](ECIES.md#parseauthplain) -- [parseBody](ECIES.md#parsebody) -- [parseHeader](ECIES.md#parseheader) +Defined in: [packages/devp2p/src/rlpx/ecies.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L90) -## Constructors +#### Parameters + +##### privateKey -### constructor +`Uint8Array` -• **new ECIES**(`privateKey`, `id`, `remoteId`) +##### id -#### Parameters +`Uint8Array` + +##### remoteId + +`Uint8Array` -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | -| `id` | `Uint8Array` | -| `remoteId` | `Uint8Array` | +##### common? -#### Defined in +`Common` -[packages/devp2p/src/rlpx/ecies.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L80) +#### Returns + +`ECIES` ## Methods -### \_decryptMessage +### \_decryptMessage() -▸ **_decryptMessage**(`data`, `sharedMacData?`): `Uint8Array` +> **\_decryptMessage**(`data`, `sharedMacData`): `Uint8Array` + +Defined in: [packages/devp2p/src/rlpx/ecies.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L133) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `data` | `Uint8Array` | `undefined` | -| `sharedMacData` | ``null`` \| `Uint8Array` | `null` | +##### data + +`Uint8Array` + +##### sharedMacData + +`null` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `Uint8Array` -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L119) +*** -___ +### \_encryptMessage() -### \_encryptMessage +> **\_encryptMessage**(`data`, `sharedMacData`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -▸ **_encryptMessage**(`data`, `sharedMacData?`): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L104) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `data` | `Uint8Array` | `undefined` | -| `sharedMacData` | ``null`` \| `Uint8Array` | `null` | +##### data -#### Returns +`Uint8Array` -`undefined` \| `Uint8Array` +##### sharedMacData -#### Defined in +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns -[packages/devp2p/src/rlpx/ecies.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L90) +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -___ +*** -### \_setupFrame +### \_setupFrame() -▸ **_setupFrame**(`remoteData`, `incoming`): `void` +> **\_setupFrame**(`remoteData`, `incoming`): `void` + +Defined in: [packages/devp2p/src/rlpx/ecies.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L168) #### Parameters -| Name | Type | -| :------ | :------ | -| `remoteData` | `Uint8Array` | -| `incoming` | `boolean` | +##### remoteData + +`Uint8Array` + +##### incoming + +`boolean` #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L154) +*** -___ +### createAckEIP8() -### createAckEIP8 +> **createAckEIP8**(): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -▸ **createAckEIP8**(): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L303) #### Returns -`undefined` \| `Uint8Array` - -#### Defined in +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/rlpx/ecies.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L284) +*** -___ +### createAckOld() -### createAckOld +> **createAckOld**(): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -▸ **createAckOld**(): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:320](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L320) #### Returns -`undefined` \| `Uint8Array` +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -#### Defined in +*** -[packages/devp2p/src/rlpx/ecies.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L301) +### createAuthEIP8() -___ +> **createAuthEIP8**(): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -### createAuthEIP8 - -▸ **createAuthEIP8**(): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L192) #### Returns -`undefined` \| `Uint8Array` - -#### Defined in +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/rlpx/ecies.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L178) +*** -___ +### createAuthNonEIP8() -### createAuthNonEIP8 +> **createAuthNonEIP8**(): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -▸ **createAuthNonEIP8**(): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L219) #### Returns -`undefined` \| `Uint8Array` +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -#### Defined in +*** -[packages/devp2p/src/rlpx/ecies.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L201) +### createBlockHeader() -___ +> **createBlockHeader**(`size`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -### createBody - -▸ **createBody**(`data`): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L366) #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `Uint8Array` | +##### size -#### Returns +`number` -`undefined` \| `Uint8Array` +#### Returns -#### Defined in +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/rlpx/ecies.ts:378](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L378) +*** -___ +### createBody() -### createHeader +> **createBody**(`data`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -▸ **createHeader**(`size`): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:397](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L397) #### Parameters -| Name | Type | -| :------ | :------ | -| `size` | `number` | +##### data -#### Returns +`Uint8Array` -`undefined` \| `Uint8Array` +#### Returns -#### Defined in +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/rlpx/ecies.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L347) +*** -___ +### parseAckEIP8() -### parseAckEIP8 +> **parseAckEIP8**(`data`): `void` -▸ **parseAckEIP8**(`data`): `void` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L360) #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `Uint8Array` | +##### data + +`Uint8Array` #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/ecies.ts:341](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L341) +### parseAckPlain() -___ +> **parseAckPlain**(`data`, `sharedMacData`): `void` -### parseAckPlain - -▸ **parseAckPlain**(`data`, `sharedMacData?`): `void` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:330](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L330) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `data` | `Uint8Array` | `undefined` | -| `sharedMacData` | ``null`` \| `Uint8Array` | `null` | +##### data + +`Uint8Array` + +##### sharedMacData + +`null` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:311](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L311) +*** -___ +### parseAuthEIP8() -### parseAuthEIP8 +> **parseAuthEIP8**(`data`): `void` -▸ **parseAuthEIP8**(`data`): `void` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L297) #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `Uint8Array` | +##### data + +`Uint8Array` #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/ecies.ts:278](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L278) +### parseAuthPlain() -___ +> **parseAuthPlain**(`data`, `sharedMacData`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -### parseAuthPlain - -▸ **parseAuthPlain**(`data`, `sharedMacData?`): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:237](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L237) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `data` | `Uint8Array` | `undefined` | -| `sharedMacData` | ``null`` \| `Uint8Array` | `null` | +##### data -#### Returns +`Uint8Array` + +##### sharedMacData -`undefined` \| `Uint8Array` +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns -#### Defined in +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/rlpx/ecies.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L218) +*** -___ +### parseBody() -### parseBody +> **parseBody**(`data`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -▸ **parseBody**(`data`): `undefined` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L408) #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `Uint8Array` | +##### data -#### Returns +`Uint8Array` -`undefined` \| `Uint8Array` +#### Returns -#### Defined in +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/rlpx/ecies.ts:389](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L389) +*** -___ +### parseHeader() -### parseHeader +> **parseHeader**(`data`): `undefined` \| `number` -▸ **parseHeader**(`data`): `undefined` \| `number` +Defined in: [packages/devp2p/src/rlpx/ecies.ts:381](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L381) #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `Uint8Array` | +##### data + +`Uint8Array` #### Returns `undefined` \| `number` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:362](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L362) diff --git a/packages/devp2p/docs/classes/ENR.md b/packages/devp2p/docs/classes/ENR.md index 1481be9d6d0..38a8642d188 100644 --- a/packages/devp2p/docs/classes/ENR.md +++ b/packages/devp2p/docs/classes/ENR.md @@ -1,101 +1,62 @@ -[@ethereumjs/devp2p](../README.md) / ENR - -# Class: ENR +[**@ethereumjs/devp2p**](../README.md) -## Table of contents +*** -### Constructors - -- [constructor](ENR.md#constructor) +[@ethereumjs/devp2p](../README.md) / ENR -### Properties +# Class: ENR -- [BRANCH\_PREFIX](ENR.md#branch_prefix) -- [RECORD\_PREFIX](ENR.md#record_prefix) -- [ROOT\_PREFIX](ENR.md#root_prefix) -- [TREE\_PREFIX](ENR.md#tree_prefix) +Defined in: [packages/devp2p/src/dns/enr.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L31) -### Methods +## Constructors -- [\_getIpProtocolConversionCodes](ENR.md#_getipprotocolconversioncodes) -- [parseAndVerifyRecord](ENR.md#parseandverifyrecord) -- [parseAndVerifyRoot](ENR.md#parseandverifyroot) -- [parseBranch](ENR.md#parsebranch) -- [parseTree](ENR.md#parsetree) +### Constructor -## Constructors +> **new ENR**(): `ENR` -### constructor +#### Returns -• **new ENR**() +`ENR` ## Properties ### BRANCH\_PREFIX -▪ `Static` `Readonly` **BRANCH\_PREFIX**: ``"enrtree-branch:"`` +> `readonly` `static` **BRANCH\_PREFIX**: `"enrtree-branch:"` = `'enrtree-branch:'` -#### Defined in +Defined in: [packages/devp2p/src/dns/enr.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L34) -[packages/devp2p/src/dns/enr.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L34) - -___ +*** ### RECORD\_PREFIX -▪ `Static` `Readonly` **RECORD\_PREFIX**: ``"enr:"`` - -#### Defined in +> `readonly` `static` **RECORD\_PREFIX**: `"enr:"` = `'enr:'` -[packages/devp2p/src/dns/enr.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L32) +Defined in: [packages/devp2p/src/dns/enr.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L32) -___ +*** ### ROOT\_PREFIX -▪ `Static` `Readonly` **ROOT\_PREFIX**: ``"enrtree-root:"`` - -#### Defined in +> `readonly` `static` **ROOT\_PREFIX**: `"enrtree-root:"` = `'enrtree-root:'` -[packages/devp2p/src/dns/enr.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L35) +Defined in: [packages/devp2p/src/dns/enr.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L35) -___ +*** ### TREE\_PREFIX -▪ `Static` `Readonly` **TREE\_PREFIX**: ``"enrtree:"`` +> `readonly` `static` **TREE\_PREFIX**: `"enrtree:"` = `'enrtree:'` -#### Defined in - -[packages/devp2p/src/dns/enr.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L33) +Defined in: [packages/devp2p/src/dns/enr.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L33) ## Methods -### \_getIpProtocolConversionCodes - -▸ `Static` **_getIpProtocolConversionCodes**(`protocolId`): `ProtocolCodes` - -Gets relevant multiaddr conversion codes for ipv4, ipv6 and tcp, udp formats - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `protocolId` | `Uint8Array` | - -#### Returns - -`ProtocolCodes` - -#### Defined in - -[packages/devp2p/src/dns/enr.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L182) +### parseAndVerifyRecord() -___ +> `static` **parseAndVerifyRecord**(`enr`, `common?`): [`PeerInfo`](../interfaces/PeerInfo.md) -### parseAndVerifyRecord - -▸ `Static` **parseAndVerifyRecord**(`enr`): [`PeerInfo`](../interfaces/PeerInfo.md) +Defined in: [packages/devp2p/src/dns/enr.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L50) Converts an Ethereum Name Record (EIP-778) string into a PeerInfo object after validating its signature component with the public key encoded in the record itself. @@ -108,23 +69,25 @@ The record components are: #### Parameters -| Name | Type | -| :------ | :------ | -| `enr` | `string` | +##### enr + +`string` + +##### common? + +`Common` #### Returns [`PeerInfo`](../interfaces/PeerInfo.md) -#### Defined in - -[packages/devp2p/src/dns/enr.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L50) +*** -___ +### parseAndVerifyRoot() -### parseAndVerifyRoot +> `static` **parseAndVerifyRoot**(`root`, `publicKey`, `common?`): `string` -▸ `Static` **parseAndVerifyRoot**(`root`, `publicKey`): `string` +Defined in: [packages/devp2p/src/dns/enr.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L99) Extracts the branch subdomain referenced by a DNS tree root string after verifying the root record signature with its base32 compressed public key. Geth's top level DNS @@ -132,10 +95,19 @@ domains and their public key can be found in: go-ethereum/params/bootnodes #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `root` | `string` | (See EIP-1459 for encoding details) | -| `publicKey` | `string` | - | +##### root + +`string` + +(See EIP-1459 for encoding details) + +##### publicKey + +`string` + +##### common? + +`Common` #### Returns @@ -143,38 +115,34 @@ domains and their public key can be found in: go-ethereum/params/bootnodes subdomain subdomain to retrieve branch records from. -#### Defined in - -[packages/devp2p/src/dns/enr.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L101) +*** -___ +### parseBranch() -### parseBranch +> `static` **parseBranch**(`branch`): `string`[] -▸ `Static` **parseBranch**(`branch`): `string`[] +Defined in: [packages/devp2p/src/dns/enr.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L178) Returns subdomains listed in an ENR branch entry. These in turn lead to either further branch entries or ENR records. #### Parameters -| Name | Type | -| :------ | :------ | -| `branch` | `string` | +##### branch + +`string` #### Returns `string`[] -#### Defined in - -[packages/devp2p/src/dns/enr.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L170) +*** -___ +### parseTree() -### parseTree +> `static` **parseTree**(`tree`): `ENRTreeValues` -▸ `Static` **parseTree**(`tree`): `ENRTreeValues` +Defined in: [packages/devp2p/src/dns/enr.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L153) Returns the public key and top level domain of an ENR tree entry. The domain is the starting point for traversing a set of linked DNS TXT records @@ -182,14 +150,12 @@ and the public key is used to verify the root entry record #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `tree` | `string` | (See EIP-1459 ) | +##### tree -#### Returns +`string` -`ENRTreeValues` +(See EIP-1459 ) -#### Defined in +#### Returns -[packages/devp2p/src/dns/enr.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L147) +`ENRTreeValues` diff --git a/packages/devp2p/docs/classes/ETH-1.md b/packages/devp2p/docs/classes/ETH-1.md deleted file mode 100644 index deb4d040a44..00000000000 --- a/packages/devp2p/docs/classes/ETH-1.md +++ /dev/null @@ -1,389 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / ETH - -# Class: ETH - -## Hierarchy - -- `Protocol` - - ↳ **`ETH`** - -## Table of contents - -### Constructors - -- [constructor](ETH-1.md#constructor) - -### Properties - -- [eth62](ETH-1.md#eth62) -- [eth63](ETH-1.md#eth63) -- [eth64](ETH-1.md#eth64) -- [eth65](ETH-1.md#eth65) -- [eth66](ETH-1.md#eth66) -- [eth67](ETH-1.md#eth67) -- [eth68](ETH-1.md#eth68) - -### Methods - -- [\_forkHashFromForkId](ETH-1.md#_forkhashfromforkid) -- [\_getStatusString](ETH-1.md#_getstatusstring) -- [\_handleMessage](ETH-1.md#_handlemessage) -- [\_handleStatus](ETH-1.md#_handlestatus) -- [\_nextForkFromForkId](ETH-1.md#_nextforkfromforkid) -- [\_validateForkId](ETH-1.md#_validateforkid) -- [getMsgPrefix](ETH-1.md#getmsgprefix) -- [getVersion](ETH-1.md#getversion) -- [sendMessage](ETH-1.md#sendmessage) -- [sendStatus](ETH-1.md#sendstatus) - -## Constructors - -### constructor - -• **new ETH**(`version`, `peer`, `send`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `version` | `number` | -| `peer` | [`Peer`](Peer.md) | -| `send` | [`SendMethod`](../README.md#sendmethod) | - -#### Overrides - -Protocol.constructor - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L34) - -## Properties - -### eth62 - -▪ `Static` **eth62**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`ETH`](ETH-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L53) - -___ - -### eth63 - -▪ `Static` **eth63**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`ETH`](ETH-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L54) - -___ - -### eth64 - -▪ `Static` **eth64**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`ETH`](ETH-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L55) - -___ - -### eth65 - -▪ `Static` **eth65**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`ETH`](ETH-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L56) - -___ - -### eth66 - -▪ `Static` **eth66**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`ETH`](ETH-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L57) - -___ - -### eth67 - -▪ `Static` **eth67**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`ETH`](ETH-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L58) - -___ - -### eth68 - -▪ `Static` **eth68**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`ETH`](ETH-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L59) - -## Methods - -### \_forkHashFromForkId - -▸ **_forkHashFromForkId**(`forkId`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `forkId` | `Uint8Array` | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L246) - -___ - -### \_getStatusString - -▸ **_getStatusString**(`status`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `status` | [`StatusMsg`](../interfaces/ETH.StatusMsg.md) | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L254) - -___ - -### \_handleMessage - -▸ **_handleMessage**(`code`, `data`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/ETH.MESSAGE_CODES.md) | -| `data` | `Uint8Array` | - -#### Returns - -`void` - -#### Overrides - -Protocol.\_handleMessage - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L61) - -___ - -### \_handleStatus - -▸ **_handleStatus**(): `void` - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L184) - -___ - -### \_nextForkFromForkId - -▸ **_nextForkFromForkId**(`forkId`): `number` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `forkId` | `Uint8Array` | - -#### Returns - -`number` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:250](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L250) - -___ - -### \_validateForkId - -▸ **_validateForkId**(`forkId`): `void` - -Eth 64 Fork ID validation (EIP-2124) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `forkId` | `Uint8Array`[] | Remote fork ID | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L141) - -___ - -### getMsgPrefix - -▸ **getMsgPrefix**(`msgCode`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `msgCode` | [`MESSAGE_CODES`](../enums/ETH.MESSAGE_CODES.md) | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:380](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L380) - -___ - -### getVersion - -▸ **getVersion**(): `number` - -#### Returns - -`number` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L242) - -___ - -### sendMessage - -▸ **sendMessage**(`code`, `payload`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/ETH.MESSAGE_CODES.md) | -| `payload` | `Input` | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:325](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L325) - -___ - -### sendStatus - -▸ **sendStatus**(`status`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `status` | [`StatusOpts`](../modules/ETH.md#statusopts) | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L274) diff --git a/packages/devp2p/docs/classes/ETH.md b/packages/devp2p/docs/classes/ETH.md new file mode 100644 index 00000000000..a6ef384d492 --- /dev/null +++ b/packages/devp2p/docs/classes/ETH.md @@ -0,0 +1,397 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / ETH + +# Class: ETH + +Defined in: [packages/devp2p/src/protocol/eth.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L70) + +## Extends + +- `Protocol` + +## Constructors + +### Constructor + +> **new ETH**(`version`, `peer`, `send`): `ETH` + +Defined in: [packages/devp2p/src/protocol/eth.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L81) + +#### Parameters + +##### version + +`number` + +##### peer + +[`Peer`](Peer.md) + +##### send + +[`SendMethod`](../type-aliases/SendMethod.md) + +#### Returns + +`ETH` + +#### Overrides + +`Protocol.constructor` + +## Properties + +### eth62 + +> `static` **eth62**: `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L100) + +#### constructor + +> **constructor**: *typeof* `ETH` = `ETH` + +#### length + +> **length**: `number` = `8` + +#### name + +> **name**: `string` = `'eth'` + +#### version + +> **version**: `number` = `62` + +*** + +### eth63 + +> `static` **eth63**: `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L101) + +#### constructor + +> **constructor**: *typeof* `ETH` = `ETH` + +#### length + +> **length**: `number` = `17` + +#### name + +> **name**: `string` = `'eth'` + +#### version + +> **version**: `number` = `63` + +*** + +### eth64 + +> `static` **eth64**: `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L102) + +#### constructor + +> **constructor**: *typeof* `ETH` = `ETH` + +#### length + +> **length**: `number` = `17` + +#### name + +> **name**: `string` = `'eth'` + +#### version + +> **version**: `number` = `64` + +*** + +### eth65 + +> `static` **eth65**: `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L103) + +#### constructor + +> **constructor**: *typeof* `ETH` = `ETH` + +#### length + +> **length**: `number` = `17` + +#### name + +> **name**: `string` = `'eth'` + +#### version + +> **version**: `number` = `65` + +*** + +### eth66 + +> `static` **eth66**: `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L104) + +#### constructor + +> **constructor**: *typeof* `ETH` = `ETH` + +#### length + +> **length**: `number` = `17` + +#### name + +> **name**: `string` = `'eth'` + +#### version + +> **version**: `number` = `66` + +*** + +### eth67 + +> `static` **eth67**: `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L105) + +#### constructor + +> **constructor**: *typeof* `ETH` = `ETH` + +#### length + +> **length**: `number` = `17` + +#### name + +> **name**: `string` = `'eth'` + +#### version + +> **version**: `number` = `67` + +*** + +### eth68 + +> `static` **eth68**: `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L106) + +#### constructor + +> **constructor**: *typeof* `ETH` = `ETH` + +#### length + +> **length**: `number` = `17` + +#### name + +> **name**: `string` = `'eth'` + +#### version + +> **version**: `number` = `68` + +## Methods + +### \_forkHashFromForkId() + +> **\_forkHashFromForkId**(`forkId`): `string` + +Defined in: [packages/devp2p/src/protocol/eth.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L288) + +#### Parameters + +##### forkId + +`Uint8Array` + +#### Returns + +`string` + +*** + +### \_getStatusString() + +> **\_getStatusString**(`status`): `string` + +Defined in: [packages/devp2p/src/protocol/eth.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L296) + +#### Parameters + +##### status + +[`EthStatusMsg`](../interfaces/EthStatusMsg.md) + +#### Returns + +`string` + +*** + +### \_handleMessage() + +> **\_handleMessage**(`code`, `data`): `void` + +Defined in: [packages/devp2p/src/protocol/eth.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L108) + +Abstract method to handle incoming messages + +#### Parameters + +##### code + +[`EthMessageCodes`](../type-aliases/EthMessageCodes.md) + +##### data + +`Uint8Array` + +#### Returns + +`void` + +#### Overrides + +`Protocol._handleMessage` + +*** + +### \_handleStatus() + +> **\_handleStatus**(): `void` + +Defined in: [packages/devp2p/src/protocol/eth.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L226) + +#### Returns + +`void` + +*** + +### \_nextForkFromForkId() + +> **\_nextForkFromForkId**(`forkId`): `number` + +Defined in: [packages/devp2p/src/protocol/eth.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L292) + +#### Parameters + +##### forkId + +`Uint8Array` + +#### Returns + +`number` + +*** + +### \_validateForkId() + +> **\_validateForkId**(`forkId`): `void` + +Defined in: [packages/devp2p/src/protocol/eth.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L182) + +Eth 64 Fork ID validation (EIP-2124) + +#### Parameters + +##### forkId + +`Uint8Array`\<`ArrayBufferLike`\>[] + +Remote fork ID + +#### Returns + +`void` + +*** + +### getMsgPrefix() + +> **getMsgPrefix**(`msgCode`): `string` + +Defined in: [packages/devp2p/src/protocol/eth.ts:419](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L419) + +#### Parameters + +##### msgCode + +[`EthMessageCodes`](../type-aliases/EthMessageCodes.md) + +#### Returns + +`string` + +*** + +### getVersion() + +> **getVersion**(): `number` + +Defined in: [packages/devp2p/src/protocol/eth.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L284) + +#### Returns + +`number` + +*** + +### sendMessage() + +> **sendMessage**(`code`, `payload`): `void` + +Defined in: [packages/devp2p/src/protocol/eth.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L366) + +#### Parameters + +##### code + +[`EthMessageCodes`](../type-aliases/EthMessageCodes.md) + +##### payload + +`Input` + +#### Returns + +`void` + +*** + +### sendStatus() + +> **sendStatus**(`status`): `void` + +Defined in: [packages/devp2p/src/protocol/eth.ts:316](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L316) + +#### Parameters + +##### status + +[`EthStatusOpts`](../type-aliases/EthStatusOpts.md) + +#### Returns + +`void` diff --git a/packages/devp2p/docs/classes/KBucket.md b/packages/devp2p/docs/classes/KBucket.md index 883972d4b9f..d9a10fad4c1 100644 --- a/packages/devp2p/docs/classes/KBucket.md +++ b/packages/devp2p/docs/classes/KBucket.md @@ -1,162 +1,137 @@ -[@ethereumjs/devp2p](../README.md) / KBucket - -# Class: KBucket - -## Table of contents +[**@ethereumjs/devp2p**](../README.md) -### Constructors +*** -- [constructor](KBucket.md#constructor) - -### Properties - -- [events](KBucket.md#events) +[@ethereumjs/devp2p](../README.md) / KBucket -### Methods +# Class: KBucket -- [add](KBucket.md#add) -- [closest](KBucket.md#closest) -- [get](KBucket.md#get) -- [getAll](KBucket.md#getall) -- [remove](KBucket.md#remove) -- [getKeys](KBucket.md#getkeys) +Defined in: [packages/devp2p/src/dpt/kbucket.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L11) ## Constructors -### constructor +### Constructor + +> **new KBucket**(`localNodeId`): `KBucket` -• **new KBucket**(`localNodeId`) +Defined in: [packages/devp2p/src/dpt/kbucket.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L15) #### Parameters -| Name | Type | -| :------ | :------ | -| `localNodeId` | `Uint8Array` | +##### localNodeId + +`Uint8Array` -#### Defined in +#### Returns -[packages/devp2p/src/dpt/kbucket.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L15) +`KBucket` ## Properties ### events -• **events**: `EventEmitter` - -#### Defined in +> **events**: `EventEmitter` -[packages/devp2p/src/dpt/kbucket.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L12) +Defined in: [packages/devp2p/src/dpt/kbucket.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L12) ## Methods -### add +### add() + +> **add**(`peer`): `void` \| `KBucket` -▸ **add**(`peer`): `void` \| `KBucket` +Defined in: [packages/devp2p/src/dpt/kbucket.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L53) #### Parameters -| Name | Type | -| :------ | :------ | -| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | +##### peer + +[`PeerInfo`](../interfaces/PeerInfo.md) #### Returns `void` \| `KBucket` -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L53) +*** -___ +### closest() -### closest +> **closest**(`id`): [`PeerInfo`](../interfaces/PeerInfo.md)[] -▸ **closest**(`id`): [`PeerInfo`](../interfaces/PeerInfo.md)[] +Defined in: [packages/devp2p/src/dpt/kbucket.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L71) #### Parameters -| Name | Type | -| :------ | :------ | -| `id` | `Uint8Array` | +##### id + +`Uint8Array` #### Returns [`PeerInfo`](../interfaces/PeerInfo.md)[] -#### Defined in +*** -[packages/devp2p/src/dpt/kbucket.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L71) +### get() -___ +> **get**(`obj`): `null` \| [`PeerInfo`](../interfaces/PeerInfo.md) -### get - -▸ **get**(`obj`): ``null`` \| [`PeerInfo`](../interfaces/PeerInfo.md) +Defined in: [packages/devp2p/src/dpt/kbucket.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L58) #### Parameters -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +##### obj -#### Returns +`string` | [`PeerInfo`](../interfaces/PeerInfo.md) | `Uint8Array`\<`ArrayBufferLike`\> -``null`` \| [`PeerInfo`](../interfaces/PeerInfo.md) +#### Returns -#### Defined in +`null` \| [`PeerInfo`](../interfaces/PeerInfo.md) -[packages/devp2p/src/dpt/kbucket.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L58) +*** -___ +### getAll() -### getAll +> **getAll**(): [`PeerInfo`](../interfaces/PeerInfo.md)[] -▸ **getAll**(): [`PeerInfo`](../interfaces/PeerInfo.md)[] +Defined in: [packages/devp2p/src/dpt/kbucket.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L67) #### Returns [`PeerInfo`](../interfaces/PeerInfo.md)[] -#### Defined in +*** -[packages/devp2p/src/dpt/kbucket.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L67) +### remove() -___ +> **remove**(`obj`): `void` -### remove - -▸ **remove**(`obj`): `void` +Defined in: [packages/devp2p/src/dpt/kbucket.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L75) #### Parameters -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +##### obj + +`string` | [`PeerInfo`](../interfaces/PeerInfo.md) | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `void` -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L75) +*** -___ +### getKeys() -### getKeys +> `static` **getKeys**(`obj`): `string`[] -▸ `Static` **getKeys**(`obj`): `string`[] +Defined in: [packages/devp2p/src/dpt/kbucket.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L42) #### Parameters -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +##### obj + +`string` | [`PeerInfo`](../interfaces/PeerInfo.md) | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `string`[] - -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L42) diff --git a/packages/devp2p/docs/classes/LES-1.md b/packages/devp2p/docs/classes/LES-1.md deleted file mode 100644 index 8894d687e9a..00000000000 --- a/packages/devp2p/docs/classes/LES-1.md +++ /dev/null @@ -1,244 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / LES - -# Class: LES - -## Hierarchy - -- `Protocol` - - ↳ **`LES`** - -## Table of contents - -### Constructors - -- [constructor](LES-1.md#constructor) - -### Properties - -- [les2](LES-1.md#les2) -- [les3](LES-1.md#les3) -- [les4](LES-1.md#les4) - -### Methods - -- [\_getStatusString](LES-1.md#_getstatusstring) -- [\_handleMessage](LES-1.md#_handlemessage) -- [\_handleStatus](LES-1.md#_handlestatus) -- [getMsgPrefix](LES-1.md#getmsgprefix) -- [getVersion](LES-1.md#getversion) -- [sendMessage](LES-1.md#sendmessage) -- [sendStatus](LES-1.md#sendstatus) - -## Constructors - -### constructor - -• **new LES**(`version`, `peer`, `send`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `version` | `number` | -| `peer` | [`Peer`](Peer.md) | -| `send` | [`SendMethod`](../README.md#sendmethod) | - -#### Overrides - -Protocol.constructor - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L27) - -## Properties - -### les2 - -▪ `Static` **les2**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`LES`](LES-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L35) - -___ - -### les3 - -▪ `Static` **les3**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`LES`](LES-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L36) - -___ - -### les4 - -▪ `Static` **les4**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`LES`](LES-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L37) - -## Methods - -### \_getStatusString - -▸ **_getStatusString**(`status`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `status` | [`Status`](../interfaces/LES.Status.md) | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L149) - -___ - -### \_handleMessage - -▸ **_handleMessage**(`code`, `data`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/LES.MESSAGE_CODES.md) | -| `data` | `Uint8Array` | - -#### Returns - -`void` - -#### Overrides - -Protocol.\_handleMessage - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L39) - -___ - -### \_handleStatus - -▸ **_handleStatus**(): `void` - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L114) - -___ - -### getMsgPrefix - -▸ **getMsgPrefix**(`msgCode`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `msgCode` | [`MESSAGE_CODES`](../enums/LES.MESSAGE_CODES.md) | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L275) - -___ - -### getVersion - -▸ **getVersion**(): `number` - -#### Returns - -`number` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L145) - -___ - -### sendMessage - -▸ **sendMessage**(`code`, `payload`): `void` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/LES.MESSAGE_CODES.md) | Message code | -| `payload` | `Input` | Payload (including reqId, e.g. `[1, [437000, 1, 0, 0]]`) | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L217) - -___ - -### sendStatus - -▸ **sendStatus**(`status`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `status` | [`Status`](../interfaces/LES.Status.md) | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L175) diff --git a/packages/devp2p/docs/classes/MAC.md b/packages/devp2p/docs/classes/MAC.md index 35c98512d78..754515735b0 100644 --- a/packages/devp2p/docs/classes/MAC.md +++ b/packages/devp2p/docs/classes/MAC.md @@ -1,106 +1,93 @@ -[@ethereumjs/devp2p](../README.md) / MAC - -# Class: MAC +[**@ethereumjs/devp2p**](../README.md) -## Table of contents +*** -### Constructors - -- [constructor](MAC.md#constructor) +[@ethereumjs/devp2p](../README.md) / MAC -### Methods +# Class: MAC -- [digest](MAC.md#digest) -- [update](MAC.md#update) -- [updateBody](MAC.md#updatebody) -- [updateHeader](MAC.md#updateheader) +Defined in: [packages/devp2p/src/rlpx/mac.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L8) ## Constructors -### constructor +### Constructor + +> **new MAC**(`secret`): `MAC` -• **new MAC**(`secret`) +Defined in: [packages/devp2p/src/rlpx/mac.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L11) #### Parameters -| Name | Type | -| :------ | :------ | -| `secret` | `Uint8Array` | +##### secret -#### Defined in +`Uint8Array` + +#### Returns -[packages/devp2p/src/rlpx/mac.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L11) +`MAC` ## Methods -### digest +### digest() -▸ **digest**(): `Uint8Array` +> **digest**(): `Uint8Array`\<`ArrayBuffer`\> -#### Returns +Defined in: [packages/devp2p/src/rlpx/mac.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L34) -`Uint8Array` +#### Returns -#### Defined in +`Uint8Array`\<`ArrayBuffer`\> -[packages/devp2p/src/rlpx/mac.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L34) +*** -___ +### update() -### update +> **update**(`data`): `void` -▸ **update**(`data`): `void` +Defined in: [packages/devp2p/src/rlpx/mac.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L16) #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `string` \| `Uint8Array` | +##### data + +`string` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/mac.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L16) +*** -___ +### updateBody() -### updateBody +> **updateBody**(`data`): `void` -▸ **updateBody**(`data`): `void` +Defined in: [packages/devp2p/src/rlpx/mac.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L26) #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `string` \| `Uint8Array` | +##### data + +`string` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/mac.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L26) +*** -___ +### updateHeader() -### updateHeader +> **updateHeader**(`data`): `void` -▸ **updateHeader**(`data`): `void` +Defined in: [packages/devp2p/src/rlpx/mac.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L20) #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `string` \| `Uint8Array` | +##### data + +`string` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `void` - -#### Defined in - -[packages/devp2p/src/rlpx/mac.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L20) diff --git a/packages/devp2p/docs/classes/Peer.md b/packages/devp2p/docs/classes/Peer.md index 4c1899a7ec5..59924f8ca13 100644 --- a/packages/devp2p/docs/classes/Peer.md +++ b/packages/devp2p/docs/classes/Peer.md @@ -1,124 +1,81 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + [@ethereumjs/devp2p](../README.md) / Peer # Class: Peer -## Table of contents - -### Constructors - -- [constructor](Peer.md#constructor) - -### Properties - -- [\_protocols](Peer.md#_protocols) -- [clientId](Peer.md#clientid) -- [common](Peer.md#common) -- [events](Peer.md#events) -- [id](Peer.md#id) - -### Methods - -- [\_addFirstPeerDebugger](Peer.md#_addfirstpeerdebugger) -- [\_getProtocol](Peer.md#_getprotocol) -- [\_handleAck](Peer.md#_handleack) -- [\_handleAuth](Peer.md#_handleauth) -- [\_handleBody](Peer.md#_handlebody) -- [\_handleDisconnect](Peer.md#_handledisconnect) -- [\_handleHeader](Peer.md#_handleheader) -- [\_handleHello](Peer.md#_handlehello) -- [\_handleMessage](Peer.md#_handlemessage) -- [\_handlePing](Peer.md#_handleping) -- [\_handlePong](Peer.md#_handlepong) -- [\_onSocketClose](Peer.md#_onsocketclose) -- [\_onSocketData](Peer.md#_onsocketdata) -- [\_sendAck](Peer.md#_sendack) -- [\_sendAuth](Peer.md#_sendauth) -- [\_sendDisconnect](Peer.md#_senddisconnect) -- [\_sendHello](Peer.md#_sendhello) -- [\_sendMessage](Peer.md#_sendmessage) -- [\_sendPing](Peer.md#_sendping) -- [\_sendPong](Peer.md#_sendpong) -- [disconnect](Peer.md#disconnect) -- [getDisconnectPrefix](Peer.md#getdisconnectprefix) -- [getHelloMessage](Peer.md#gethellomessage) -- [getId](Peer.md#getid) -- [getMsgPrefix](Peer.md#getmsgprefix) -- [getProtocols](Peer.md#getprotocols) +Defined in: [packages/devp2p/src/rlpx/peer.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L77) ## Constructors -### constructor +### Constructor -• **new Peer**(`options`) +> **new Peer**(`options`): `Peer` + +Defined in: [packages/devp2p/src/rlpx/peer.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L111) #### Parameters -| Name | Type | -| :------ | :------ | -| `options` | [`PeerOptions`](../interfaces/PeerOptions.md) | +##### options -#### Defined in +[`PeerOptions`](../interfaces/PeerOptions.md) -[packages/devp2p/src/rlpx/peer.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L98) +#### Returns + +`Peer` ## Properties ### \_protocols -• **\_protocols**: `ProtocolDescriptor`[] +> **\_protocols**: `ProtocolDescriptor`[] + +Defined in: [packages/devp2p/src/rlpx/peer.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L109) Subprotocols (e.g. `ETH`) derived from the exchange on capabilities -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L96) - -___ +*** ### clientId -• `Readonly` **clientId**: `Uint8Array` - -#### Defined in +> `readonly` **clientId**: `Uint8Array` -[packages/devp2p/src/rlpx/peer.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L68) +Defined in: [packages/devp2p/src/rlpx/peer.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L79) -___ +*** ### common -• **common**: `Common` +> **common**: `Common` -#### Defined in +Defined in: [packages/devp2p/src/rlpx/peer.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L81) -[packages/devp2p/src/rlpx/peer.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L70) - -___ +*** ### events -• **events**: `EventEmitter` - -#### Defined in +> **events**: `EventEmitter` -[packages/devp2p/src/rlpx/peer.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L67) +Defined in: [packages/devp2p/src/rlpx/peer.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L78) -___ +*** ### id -• `Readonly` **id**: `Uint8Array` +> `readonly` **id**: `Uint8Array` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L72) +Defined in: [packages/devp2p/src/rlpx/peer.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L83) ## Methods -### \_addFirstPeerDebugger +### \_addFirstPeerDebugger() + +> **\_addFirstPeerDebugger**(): `void` -▸ **_addFirstPeerDebugger**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:720](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L720) Called once from the subprotocol (e.g. `ETH`) on the peer where a first successful `STATUS` msg exchange could be achieved. @@ -129,15 +86,13 @@ Can be used together with the `devp2p:FIRST_PEER` debugger. `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:689](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L689) +*** -___ +### \_getProtocol() -### \_getProtocol +> **\_getProtocol**(`code`): `undefined` \| `ProtocolDescriptor` -▸ **_getProtocol**(`code`): `undefined` \| `ProtocolDescriptor` +Defined in: [packages/devp2p/src/rlpx/peer.ts:682](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L682) Returns either a protocol object with a `protocol` parameter reference to this Peer instance or to a subprotocol instance (e.g. `ETH`) @@ -145,23 +100,21 @@ reference to this Peer instance or to a subprotocol instance (e.g. `ETH`) #### Parameters -| Name | Type | -| :------ | :------ | -| `code` | `number` | +##### code + +`number` #### Returns `undefined` \| `ProtocolDescriptor` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:651](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L651) +*** -___ +### \_handleAck() -### \_handleAck +> **\_handleAck**(): `void` -▸ **_handleAck**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L350) ACK message received @@ -169,15 +122,13 @@ ACK message received `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:328](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L328) +### \_handleAuth() -___ +> **\_handleAuth**(): `void` -### \_handleAuth - -▸ **_handleAuth**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L327) AUTH message received @@ -185,15 +136,13 @@ AUTH message received `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L303) +*** -___ +### \_handleBody() -### \_handleBody +> **\_handleBody**(): `void` -▸ **_handleBody**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:544](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L544) Handle message body @@ -201,37 +150,33 @@ Handle message body `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:516](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L516) +### \_handleDisconnect() -___ +> **\_handleDisconnect**(`payload`): `void` -### \_handleDisconnect - -▸ **_handleDisconnect**(`payload`): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:464](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L464) DISCONNECT message received #### Parameters -| Name | Type | -| :------ | :------ | -| `payload` | `any` | +##### payload + +`any` #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:440](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L440) +*** -___ +### \_handleHeader() -### \_handleHeader +> **\_handleHeader**(): `void` -▸ **_handleHeader**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:524](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L524) Handle message header @@ -239,60 +184,57 @@ Handle message header `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:497](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L497) +### \_handleHello() -___ +> **\_handleHello**(`payload`): `void` -### \_handleHello - -▸ **_handleHello**(`payload`): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:381](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L381) HELLO message received #### Parameters -| Name | Type | -| :------ | :------ | -| `payload` | `any` | +##### payload + +`any` #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:359](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L359) +*** -___ +### \_handleMessage() -### \_handleMessage +> **\_handleMessage**(`code`, `msg`): `void` -▸ **_handleMessage**(`code`, `msg`): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:504](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L504) Message handling, called from a SubProtocol context #### Parameters -| Name | Type | -| :------ | :------ | -| `code` | `PREFIXES` | -| `msg` | `Uint8Array` | +##### code + +[`PREFIXES`](../type-aliases/PREFIXES.md) + +##### msg + +`Uint8Array` #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:477](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L477) +### \_handlePing() -___ +> **\_handlePing**(): `void` -### \_handlePing - -▸ **_handlePing**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:488](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L488) PING message received @@ -300,15 +242,13 @@ PING message received `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:461](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L461) +*** -___ +### \_handlePong() -### \_handlePong +> **\_handlePong**(): `void` -▸ **_handlePong**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:495](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L495) PONG message received @@ -316,15 +256,13 @@ PONG message received `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:468](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L468) +### \_onSocketClose() -___ +> **\_onSocketClose**(): `void` -### \_onSocketClose - -▸ **_onSocketClose**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:669](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L669) React to socket being closed @@ -332,37 +270,33 @@ React to socket being closed `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:638](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L638) +*** -___ +### \_onSocketData() -### \_onSocketData +> **\_onSocketData**(`data`): `void` -▸ **_onSocketData**(`data`): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:639](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L639) Process socket data #### Parameters -| Name | Type | -| :------ | :------ | -| `data` | `Uint8Array` | +##### data + +`Uint8Array` #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:608](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L608) +*** -___ +### \_sendAck() -### \_sendAck +> **\_sendAck**(): `void` -▸ **_sendAck**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L186) Send ACK message @@ -370,15 +304,13 @@ Send ACK message `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L170) +*** -___ +### \_sendAuth() -### \_sendAuth +> **\_sendAuth**(): `void` -▸ **_sendAuth**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L164) Send AUTH message @@ -386,37 +318,33 @@ Send AUTH message `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L149) +### \_sendDisconnect() -___ +> **\_sendDisconnect**(`reason`): `void` -### \_sendDisconnect - -▸ **_sendDisconnect**(`reason`): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:271](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L271) Send DISCONNECT message #### Parameters -| Name | Type | -| :------ | :------ | -| `reason` | [`DISCONNECT_REASON`](../enums/DISCONNECT_REASON.md) | +##### reason + +[`DISCONNECT_REASON`](../type-aliases/DISCONNECT_REASON.md) #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:253](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L253) +### \_sendHello() -___ +> **\_sendHello**(): `void` -### \_sendHello - -▸ **_sendHello**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L233) Send HELLO message @@ -424,39 +352,38 @@ Send HELLO message `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L217) +*** -___ +### \_sendMessage() -### \_sendMessage +> **\_sendMessage**(`code`, `data`): `undefined` \| `boolean` -▸ **_sendMessage**(`code`, `data`): `undefined` \| `boolean` +Defined in: [packages/devp2p/src/rlpx/peer.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L213) Create message HEADER and BODY and send to socket Also called from SubProtocol context #### Parameters -| Name | Type | -| :------ | :------ | -| `code` | `number` | -| `data` | `Uint8Array` | +##### code + +`number` + +##### data + +`Uint8Array` #### Returns `undefined` \| `boolean` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L197) +### \_sendPing() -___ +> **\_sendPing**(): `void` -### \_sendPing - -▸ **_sendPing**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L292) Send PING message @@ -464,15 +391,13 @@ Send PING message `void` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L272) +*** -___ +### \_sendPong() -### \_sendPong +> **\_sendPong**(): `void` -▸ **_sendPong**(): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L312) Send PONG message @@ -480,108 +405,92 @@ Send PONG message `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L290) +### disconnect() -___ +> **disconnect**(`reason`): `void` -### disconnect - -▸ **disconnect**(`reason?`): `void` +Defined in: [packages/devp2p/src/rlpx/peer.ts:710](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L710) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `reason` | [`DISCONNECT_REASON`](../enums/DISCONNECT_REASON.md) | `DISCONNECT_REASON.DISCONNECT_REQUESTED` | +##### reason + +[`DISCONNECT_REASON`](../type-aliases/DISCONNECT_REASON.md) = `DISCONNECT_REASON.DISCONNECT_REQUESTED` #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:679](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L679) +### getDisconnectPrefix() -___ +> **getDisconnectPrefix**(`code`): `string` -### getDisconnectPrefix - -▸ **getDisconnectPrefix**(`code`): `string` +Defined in: [packages/devp2p/src/rlpx/peer.ts:706](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L706) #### Parameters -| Name | Type | -| :------ | :------ | -| `code` | [`DISCONNECT_REASON`](../enums/DISCONNECT_REASON.md) | +##### code + +[`DISCONNECT_REASON`](../type-aliases/DISCONNECT_REASON.md) #### Returns `string` -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:675](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L675) +*** -___ +### getHelloMessage() -### getHelloMessage +> **getHelloMessage**(): `null` \| `Hello` -▸ **getHelloMessage**(): ``null`` \| `Hello` +Defined in: [packages/devp2p/src/rlpx/peer.ts:694](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L694) #### Returns -``null`` \| `Hello` +`null` \| `Hello` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:663](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L663) +### getId() -___ +> **getId**(): `null` \| `Uint8Array`\<`ArrayBufferLike`\> -### getId - -▸ **getId**(): ``null`` \| `Uint8Array` +Defined in: [packages/devp2p/src/rlpx/peer.ts:689](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L689) #### Returns -``null`` \| `Uint8Array` - -#### Defined in +`null` \| `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/rlpx/peer.ts:658](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L658) +*** -___ +### getMsgPrefix() -### getMsgPrefix +> **getMsgPrefix**(`code`): `string` -▸ **getMsgPrefix**(`code`): `string` +Defined in: [packages/devp2p/src/rlpx/peer.ts:702](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L702) #### Parameters -| Name | Type | -| :------ | :------ | -| `code` | `PREFIXES` | +##### code + +[`PREFIXES`](../type-aliases/PREFIXES.md) #### Returns `string` -#### Defined in +*** -[packages/devp2p/src/rlpx/peer.ts:671](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L671) +### getProtocols() -___ +> **getProtocols**(): `Protocol`[] -### getProtocols - -▸ **getProtocols**(): `Protocol`[] +Defined in: [packages/devp2p/src/rlpx/peer.ts:698](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L698) #### Returns `Protocol`[] - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:667](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L667) diff --git a/packages/devp2p/docs/classes/RLPx.md b/packages/devp2p/docs/classes/RLPx.md index ac6f3c34e0e..3c2a0c3ef18 100644 --- a/packages/devp2p/docs/classes/RLPx.md +++ b/packages/devp2p/docs/classes/RLPx.md @@ -1,282 +1,239 @@ -[@ethereumjs/devp2p](../README.md) / RLPx +[**@ethereumjs/devp2p**](../README.md) -# Class: RLPx +*** -## Table of contents +[@ethereumjs/devp2p](../README.md) / RLPx -### Constructors +# Class: RLPx -- [constructor](RLPx.md#constructor) +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L32) -### Properties +## Constructors -- [clientId](RLPx.md#clientid) -- [events](RLPx.md#events) -- [id](RLPx.md#id) +### Constructor -### Methods +> **new RLPx**(`privateKey`, `options`): `RLPx` -- [\_connectToPeer](RLPx.md#_connecttopeer) -- [\_getOpenQueueSlots](RLPx.md#_getopenqueueslots) -- [\_getOpenSlots](RLPx.md#_getopenslots) -- [\_isAlive](RLPx.md#_isalive) -- [\_isAliveCheck](RLPx.md#_isalivecheck) -- [\_onConnect](RLPx.md#_onconnect) -- [\_refillConnections](RLPx.md#_refillconnections) -- [connect](RLPx.md#connect) -- [destroy](RLPx.md#destroy) -- [disconnect](RLPx.md#disconnect) -- [getPeers](RLPx.md#getpeers) -- [listen](RLPx.md#listen) +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L58) -## Constructors +#### Parameters -### constructor +##### privateKey -• **new RLPx**(`privateKey`, `options`) +`Uint8Array` -#### Parameters +##### options -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | -| `options` | [`RLPxOptions`](../interfaces/RLPxOptions.md) | +[`RLPxOptions`](../interfaces/RLPxOptions.md) -#### Defined in +#### Returns -[packages/devp2p/src/rlpx/rlpx.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L55) +`RLPx` ## Properties ### clientId -• `Readonly` **clientId**: `Uint8Array` +> `readonly` **clientId**: `Uint8Array` -#### Defined in +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L39) -[packages/devp2p/src/rlpx/rlpx.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L40) - -___ +*** ### events -• **events**: `EventEmitter` - -#### Defined in +> **events**: `EventEmitter`\<[`RLPxEvent`](../interfaces/RLPxEvent.md)\> -[packages/devp2p/src/rlpx/rlpx.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L34) +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L33) -___ +*** ### id -• `Readonly` **id**: `Uint8Array` +> `readonly` **id**: `Uint8Array` -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L36) +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L35) ## Methods -### \_connectToPeer +### \_connectToPeer() + +> **\_connectToPeer**(`peer`): `void` -▸ **_connectToPeer**(`peer`): `void` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L210) #### Parameters -| Name | Type | -| :------ | :------ | -| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | +##### peer + +[`PeerInfo`](../interfaces/PeerInfo.md) #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L192) +*** -___ +### \_getOpenQueueSlots() -### \_getOpenQueueSlots +> **\_getOpenQueueSlots**(): `number` -▸ **_getOpenQueueSlots**(): `number` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L206) #### Returns `number` -#### Defined in +*** -[packages/devp2p/src/rlpx/rlpx.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L188) +### \_getOpenSlots() -___ +> **\_getOpenSlots**(): `number` -### \_getOpenSlots - -▸ **_getOpenSlots**(): `number` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L202) #### Returns `number` -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L184) +*** -___ +### \_isAlive() -### \_isAlive +> **\_isAlive**(): `boolean` -▸ **_isAlive**(): `boolean` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L194) #### Returns `boolean` -#### Defined in +*** -[packages/devp2p/src/rlpx/rlpx.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L176) +### \_isAliveCheck() -___ +> **\_isAliveCheck**(): `void` -### \_isAliveCheck - -▸ **_isAliveCheck**(): `void` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L198) #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L180) +*** -___ +### \_onConnect() -### \_onConnect +> **\_onConnect**(`socket`, `peerId`): `void` -▸ **_onConnect**(`socket`, `peerId`): `void` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L219) #### Parameters -| Name | Type | -| :------ | :------ | -| `socket` | `Socket` | -| `peerId` | ``null`` \| `Uint8Array` | +##### socket + +`Socket` + +##### peerId + +`null` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/rlpx/rlpx.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L201) +### \_refillConnections() -___ +> **\_refillConnections**(): `void` -### \_refillConnections - -▸ **_refillConnections**(): `void` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:306](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L306) #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:286](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L286) +*** -___ +### connect() -### connect +> **connect**(`peer`): `Promise`\<`void`\> -▸ **connect**(`peer`): `Promise`<`void`\> +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L148) #### Parameters -| Name | Type | -| :------ | :------ | -| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | +##### peer -#### Returns +[`PeerInfo`](../interfaces/PeerInfo.md) -`Promise`<`void`\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[packages/devp2p/src/rlpx/rlpx.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L137) +*** -___ +### destroy() -### destroy +> **destroy**(...`args`): `void` -▸ **destroy**(...`args`): `void` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L134) #### Parameters -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | +##### args + +...`any`[] #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L125) +*** -___ +### disconnect() -### disconnect +> **disconnect**(`id`): `void` -▸ **disconnect**(`id`): `void` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L187) #### Parameters -| Name | Type | -| :------ | :------ | -| `id` | `Uint8Array` | +##### id + +`Uint8Array` #### Returns `void` -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L169) +*** -___ +### getPeers() -### getPeers +> **getPeers**(): [`Peer`](Peer.md)[] -▸ **getPeers**(): (`Socket` \| [`Peer`](Peer.md))[] +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L183) #### Returns -(`Socket` \| [`Peer`](Peer.md))[] +[`Peer`](Peer.md)[] -#### Defined in +*** -[packages/devp2p/src/rlpx/rlpx.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L165) +### listen() -___ +> **listen**(...`args`): `void` -### listen - -▸ **listen**(...`args`): `void` +Defined in: [packages/devp2p/src/rlpx/rlpx.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L125) #### Parameters -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | +##### args + +...`any`[] #### Returns `void` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L118) diff --git a/packages/devp2p/docs/classes/SNAP-1.md b/packages/devp2p/docs/classes/SNAP-1.md deleted file mode 100644 index bb87f706f34..00000000000 --- a/packages/devp2p/docs/classes/SNAP-1.md +++ /dev/null @@ -1,162 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / SNAP - -# Class: SNAP - -## Hierarchy - -- `Protocol` - - ↳ **`SNAP`** - -## Table of contents - -### Constructors - -- [constructor](SNAP-1.md#constructor) - -### Properties - -- [snap](SNAP-1.md#snap) - -### Methods - -- [\_handleMessage](SNAP-1.md#_handlemessage) -- [getMsgPrefix](SNAP-1.md#getmsgprefix) -- [getVersion](SNAP-1.md#getversion) -- [sendMessage](SNAP-1.md#sendmessage) -- [sendStatus](SNAP-1.md#sendstatus) - -## Constructors - -### constructor - -• **new SNAP**(`version`, `peer`, `send`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `version` | `number` | -| `peer` | [`Peer`](Peer.md) | -| `send` | [`SendMethod`](../README.md#sendmethod) | - -#### Overrides - -Protocol.constructor - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L14) - -## Properties - -### snap - -▪ `Static` **snap**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `constructor` | typeof [`SNAP`](SNAP-1.md) | -| `length` | `number` | -| `name` | `string` | -| `version` | `number` | - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L18) - -## Methods - -### \_handleMessage - -▸ **_handleMessage**(`code`, `data`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/SNAP.MESSAGE_CODES.md) | -| `data` | `Uint8Array` | - -#### Returns - -`void` - -#### Overrides - -Protocol.\_handleMessage - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L20) - -___ - -### getMsgPrefix - -▸ **getMsgPrefix**(`msgCode`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `msgCode` | [`MESSAGE_CODES`](../enums/SNAP.MESSAGE_CODES.md) | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L95) - -___ - -### getVersion - -▸ **getVersion**(): `number` - -#### Returns - -`number` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L99) - -___ - -### sendMessage - -▸ **sendMessage**(`code`, `payload`): `void` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/SNAP.MESSAGE_CODES.md) | Message code | -| `payload` | `any` | Payload (including reqId, e.g. `[1, [437000, 1, 0, 0]]`) | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L59) - -___ - -### sendStatus - -▸ **sendStatus**(): `void` - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L50) diff --git a/packages/devp2p/docs/classes/SNAP.md b/packages/devp2p/docs/classes/SNAP.md new file mode 100644 index 00000000000..57c73bcb585 --- /dev/null +++ b/packages/devp2p/docs/classes/SNAP.md @@ -0,0 +1,163 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / SNAP + +# Class: SNAP + +Defined in: [packages/devp2p/src/protocol/snap.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L38) + +## Extends + +- `Protocol` + +## Constructors + +### Constructor + +> **new SNAP**(`version`, `peer`, `send`): `SNAP` + +Defined in: [packages/devp2p/src/protocol/snap.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L41) + +#### Parameters + +##### version + +`number` + +##### peer + +[`Peer`](Peer.md) + +##### send + +[`SendMethod`](../type-aliases/SendMethod.md) + +#### Returns + +`SNAP` + +#### Overrides + +`Protocol.constructor` + +## Properties + +### snap + +> `static` **snap**: `object` + +Defined in: [packages/devp2p/src/protocol/snap.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L47) + +#### constructor + +> **constructor**: *typeof* `SNAP` = `SNAP` + +#### length + +> **length**: `number` = `8` + +#### name + +> **name**: `string` = `'snap'` + +#### version + +> **version**: `number` = `1` + +## Methods + +### \_handleMessage() + +> **\_handleMessage**(`code`, `data`): `void` + +Defined in: [packages/devp2p/src/protocol/snap.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L49) + +Abstract method to handle incoming messages + +#### Parameters + +##### code + +[`SnapMessageCodes`](../type-aliases/SnapMessageCodes.md) + +##### data + +`Uint8Array` + +#### Returns + +`void` + +#### Overrides + +`Protocol._handleMessage` + +*** + +### getMsgPrefix() + +> **getMsgPrefix**(`msgCode`): `string` + +Defined in: [packages/devp2p/src/protocol/snap.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L123) + +#### Parameters + +##### msgCode + +[`SnapMessageCodes`](../type-aliases/SnapMessageCodes.md) + +#### Returns + +`string` + +*** + +### getVersion() + +> **getVersion**(): `number` + +Defined in: [packages/devp2p/src/protocol/snap.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L127) + +#### Returns + +`number` + +*** + +### sendMessage() + +> **sendMessage**(`code`, `payload`): `void` + +Defined in: [packages/devp2p/src/protocol/snap.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L88) + +#### Parameters + +##### code + +[`SnapMessageCodes`](../type-aliases/SnapMessageCodes.md) + +Message code + +##### payload + +`any` + +Payload (including reqId, e.g. `[1, [437000, 1, 0, 0]]`) + +#### Returns + +`void` + +*** + +### sendStatus() + +> **sendStatus**(): `void` + +Defined in: [packages/devp2p/src/protocol/snap.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L79) + +#### Returns + +`void` diff --git a/packages/devp2p/docs/classes/Server.md b/packages/devp2p/docs/classes/Server.md index d258c97ed7b..35d8f800331 100644 --- a/packages/devp2p/docs/classes/Server.md +++ b/packages/devp2p/docs/classes/Server.md @@ -1,189 +1,179 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + [@ethereumjs/devp2p](../README.md) / Server # Class: Server -## Table of contents +Defined in: [packages/devp2p/src/dpt/server.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L22) -### Constructors +## Constructors -- [constructor](Server.md#constructor) +### Constructor -### Properties +> **new Server**(`dpt`, `privateKey`, `options`): `Server` -- [events](Server.md#events) +Defined in: [packages/devp2p/src/dpt/server.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L37) -### Methods +#### Parameters -- [\_handler](Server.md#_handler) -- [\_isAliveCheck](Server.md#_isalivecheck) -- [\_send](Server.md#_send) -- [bind](Server.md#bind) -- [destroy](Server.md#destroy) -- [findneighbours](Server.md#findneighbours) -- [ping](Server.md#ping) +##### dpt -## Constructors +[`DPT`](DPT.md) -### constructor +##### privateKey -• **new Server**(`dpt`, `privateKey`, `options`) +`Uint8Array` -#### Parameters +##### options -| Name | Type | -| :------ | :------ | -| `dpt` | [`DPT`](DPT.md) | -| `privateKey` | `Uint8Array` | -| `options` | [`DPTServerOptions`](../interfaces/DPTServerOptions.md) | +[`DPTServerOptions`](../interfaces/DPTServerOptions.md) -#### Defined in +#### Returns -[packages/devp2p/src/dpt/server.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L35) +`Server` ## Properties ### events -• **events**: `EventEmitter` - -#### Defined in +> **events**: `EventEmitter`\<[`ServerEvent`](../interfaces/ServerEvent.md)\> -[packages/devp2p/src/dpt/server.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L25) +Defined in: [packages/devp2p/src/dpt/server.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L23) ## Methods -### \_handler +### \_handler() -▸ **_handler**(`msg`, `rinfo`): `void` +> **\_handler**(`msg`, `rinfo`): `void` + +Defined in: [packages/devp2p/src/dpt/server.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L156) #### Parameters -| Name | Type | -| :------ | :------ | -| `msg` | `Uint8Array` | -| `rinfo` | `RemoteInfo` | +##### msg + +`Uint8Array` + +##### rinfo + +`RemoteInfo` #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/dpt/server.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L139) +### \_isAliveCheck() -___ +> **\_isAliveCheck**(): `void` -### \_isAliveCheck - -▸ **_isAliveCheck**(): `void` +Defined in: [packages/devp2p/src/dpt/server.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L135) #### Returns `void` -#### Defined in - -[packages/devp2p/src/dpt/server.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L120) +*** -___ +### \_send() -### \_send +> **\_send**(`peer`, `typename`, `data`): `Uint8Array`\<`ArrayBufferLike`\> -▸ **_send**(`peer`, `typename`, `data`): `Uint8Array` +Defined in: [packages/devp2p/src/dpt/server.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L139) #### Parameters -| Name | Type | -| :------ | :------ | -| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | -| `typename` | `string` | -| `data` | `any` | +##### peer -#### Returns +[`PeerInfo`](../interfaces/PeerInfo.md) -`Uint8Array` +##### typename -#### Defined in +`string` -[packages/devp2p/src/dpt/server.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L124) +##### data -___ +`any` -### bind +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +*** + +### bind() + +> **bind**(...`args`): `void` -▸ **bind**(...`args`): `void` +Defined in: [packages/devp2p/src/dpt/server.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L69) #### Parameters -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | +##### args + +...`any`[] #### Returns `void` -#### Defined in - -[packages/devp2p/src/dpt/server.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L62) +*** -___ +### destroy() -### destroy +> **destroy**(...`args`): `void` -▸ **destroy**(...`args`): `void` +Defined in: [packages/devp2p/src/dpt/server.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L78) #### Parameters -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | +##### args + +...`any`[] #### Returns `void` -#### Defined in - -[packages/devp2p/src/dpt/server.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L69) +*** -___ +### findneighbours() -### findneighbours +> **findneighbours**(`peer`, `id`): `void` -▸ **findneighbours**(`peer`, `id`): `void` +Defined in: [packages/devp2p/src/dpt/server.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L130) #### Parameters -| Name | Type | -| :------ | :------ | -| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | -| `id` | `Uint8Array` | +##### peer + +[`PeerInfo`](../interfaces/PeerInfo.md) + +##### id + +`Uint8Array` #### Returns `void` -#### Defined in +*** -[packages/devp2p/src/dpt/server.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L115) +### ping() -___ +> **ping**(`peer`): `Promise`\<`any`\> -### ping - -▸ **ping**(`peer`): `Promise`<`any`\> +Defined in: [packages/devp2p/src/dpt/server.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L90) #### Parameters -| Name | Type | -| :------ | :------ | -| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | - -#### Returns +##### peer -`Promise`<`any`\> +[`PeerInfo`](../interfaces/PeerInfo.md) -#### Defined in +#### Returns -[packages/devp2p/src/dpt/server.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L79) +`Promise`\<`any`\> diff --git a/packages/devp2p/docs/enums/DISCONNECT_REASON.md b/packages/devp2p/docs/enums/DISCONNECT_REASON.md deleted file mode 100644 index 291554602e8..00000000000 --- a/packages/devp2p/docs/enums/DISCONNECT_REASON.md +++ /dev/null @@ -1,151 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / DISCONNECT\_REASON - -# Enumeration: DISCONNECT\_REASON - -## Table of contents - -### Enumeration Members - -- [ALREADY\_CONNECTED](DISCONNECT_REASON.md#already_connected) -- [CLIENT\_QUITTING](DISCONNECT_REASON.md#client_quitting) -- [DISCONNECT\_REQUESTED](DISCONNECT_REASON.md#disconnect_requested) -- [INCOMPATIBLE\_VERSION](DISCONNECT_REASON.md#incompatible_version) -- [INVALID\_IDENTITY](DISCONNECT_REASON.md#invalid_identity) -- [NETWORK\_ERROR](DISCONNECT_REASON.md#network_error) -- [PROTOCOL\_ERROR](DISCONNECT_REASON.md#protocol_error) -- [SAME\_IDENTITY](DISCONNECT_REASON.md#same_identity) -- [SUBPROTOCOL\_ERROR](DISCONNECT_REASON.md#subprotocol_error) -- [TIMEOUT](DISCONNECT_REASON.md#timeout) -- [TOO\_MANY\_PEERS](DISCONNECT_REASON.md#too_many_peers) -- [UNEXPECTED\_IDENTITY](DISCONNECT_REASON.md#unexpected_identity) -- [USELESS\_PEER](DISCONNECT_REASON.md#useless_peer) - -## Enumeration Members - -### ALREADY\_CONNECTED - -• **ALREADY\_CONNECTED** = ``5`` - -#### Defined in - -[packages/devp2p/src/types.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L23) - -___ - -### CLIENT\_QUITTING - -• **CLIENT\_QUITTING** = ``8`` - -#### Defined in - -[packages/devp2p/src/types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L26) - -___ - -### DISCONNECT\_REQUESTED - -• **DISCONNECT\_REQUESTED** = ``0`` - -#### Defined in - -[packages/devp2p/src/types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L18) - -___ - -### INCOMPATIBLE\_VERSION - -• **INCOMPATIBLE\_VERSION** = ``6`` - -#### Defined in - -[packages/devp2p/src/types.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L24) - -___ - -### INVALID\_IDENTITY - -• **INVALID\_IDENTITY** = ``7`` - -#### Defined in - -[packages/devp2p/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L25) - -___ - -### NETWORK\_ERROR - -• **NETWORK\_ERROR** = ``1`` - -#### Defined in - -[packages/devp2p/src/types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L19) - -___ - -### PROTOCOL\_ERROR - -• **PROTOCOL\_ERROR** = ``2`` - -#### Defined in - -[packages/devp2p/src/types.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L20) - -___ - -### SAME\_IDENTITY - -• **SAME\_IDENTITY** = ``10`` - -#### Defined in - -[packages/devp2p/src/types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L28) - -___ - -### SUBPROTOCOL\_ERROR - -• **SUBPROTOCOL\_ERROR** = ``16`` - -#### Defined in - -[packages/devp2p/src/types.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L30) - -___ - -### TIMEOUT - -• **TIMEOUT** = ``11`` - -#### Defined in - -[packages/devp2p/src/types.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L29) - -___ - -### TOO\_MANY\_PEERS - -• **TOO\_MANY\_PEERS** = ``4`` - -#### Defined in - -[packages/devp2p/src/types.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L22) - -___ - -### UNEXPECTED\_IDENTITY - -• **UNEXPECTED\_IDENTITY** = ``9`` - -#### Defined in - -[packages/devp2p/src/types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L27) - -___ - -### USELESS\_PEER - -• **USELESS\_PEER** = ``3`` - -#### Defined in - -[packages/devp2p/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L21) diff --git a/packages/devp2p/docs/enums/ETH.MESSAGE_CODES.md b/packages/devp2p/docs/enums/ETH.MESSAGE_CODES.md deleted file mode 100644 index 13449530587..00000000000 --- a/packages/devp2p/docs/enums/ETH.MESSAGE_CODES.md +++ /dev/null @@ -1,175 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / [ETH](../modules/ETH.md) / MESSAGE\_CODES - -# Enumeration: MESSAGE\_CODES - -[ETH](../modules/ETH.md).MESSAGE_CODES - -## Table of contents - -### Enumeration Members - -- [BLOCK\_BODIES](ETH.MESSAGE_CODES.md#block_bodies) -- [BLOCK\_HEADERS](ETH.MESSAGE_CODES.md#block_headers) -- [GET\_BLOCK\_BODIES](ETH.MESSAGE_CODES.md#get_block_bodies) -- [GET\_BLOCK\_HEADERS](ETH.MESSAGE_CODES.md#get_block_headers) -- [GET\_NODE\_DATA](ETH.MESSAGE_CODES.md#get_node_data) -- [GET\_POOLED\_TRANSACTIONS](ETH.MESSAGE_CODES.md#get_pooled_transactions) -- [GET\_RECEIPTS](ETH.MESSAGE_CODES.md#get_receipts) -- [NEW\_BLOCK](ETH.MESSAGE_CODES.md#new_block) -- [NEW\_BLOCK\_HASHES](ETH.MESSAGE_CODES.md#new_block_hashes) -- [NEW\_POOLED\_TRANSACTION\_HASHES](ETH.MESSAGE_CODES.md#new_pooled_transaction_hashes) -- [NODE\_DATA](ETH.MESSAGE_CODES.md#node_data) -- [POOLED\_TRANSACTIONS](ETH.MESSAGE_CODES.md#pooled_transactions) -- [RECEIPTS](ETH.MESSAGE_CODES.md#receipts) -- [STATUS](ETH.MESSAGE_CODES.md#status) -- [TX](ETH.MESSAGE_CODES.md#tx) - -## Enumeration Members - -### BLOCK\_BODIES - -• **BLOCK\_BODIES** = ``6`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:403](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L403) - -___ - -### BLOCK\_HEADERS - -• **BLOCK\_HEADERS** = ``4`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:401](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L401) - -___ - -### GET\_BLOCK\_BODIES - -• **GET\_BLOCK\_BODIES** = ``5`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L402) - -___ - -### GET\_BLOCK\_HEADERS - -• **GET\_BLOCK\_HEADERS** = ``3`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L400) - -___ - -### GET\_NODE\_DATA - -• **GET\_NODE\_DATA** = ``13`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:407](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L407) - -___ - -### GET\_POOLED\_TRANSACTIONS - -• **GET\_POOLED\_TRANSACTIONS** = ``9`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:414](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L414) - -___ - -### GET\_RECEIPTS - -• **GET\_RECEIPTS** = ``15`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:409](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L409) - -___ - -### NEW\_BLOCK - -• **NEW\_BLOCK** = ``7`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L404) - -___ - -### NEW\_BLOCK\_HASHES - -• **NEW\_BLOCK\_HASHES** = ``1`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:398](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L398) - -___ - -### NEW\_POOLED\_TRANSACTION\_HASHES - -• **NEW\_POOLED\_TRANSACTION\_HASHES** = ``8`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:413](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L413) - -___ - -### NODE\_DATA - -• **NODE\_DATA** = ``14`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L408) - -___ - -### POOLED\_TRANSACTIONS - -• **POOLED\_TRANSACTIONS** = ``10`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:415](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L415) - -___ - -### RECEIPTS - -• **RECEIPTS** = ``16`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:410](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L410) - -___ - -### STATUS - -• **STATUS** = ``0`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:397](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L397) - -___ - -### TX - -• **TX** = ``2`` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:399](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L399) diff --git a/packages/devp2p/docs/enums/LES.MESSAGE_CODES.md b/packages/devp2p/docs/enums/LES.MESSAGE_CODES.md deleted file mode 100644 index 4903e8a946b..00000000000 --- a/packages/devp2p/docs/enums/LES.MESSAGE_CODES.md +++ /dev/null @@ -1,274 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / [LES](../modules/LES.md) / MESSAGE\_CODES - -# Enumeration: MESSAGE\_CODES - -[LES](../modules/LES.md).MESSAGE_CODES - -## Table of contents - -### Enumeration Members - -- [ANNOUNCE](LES.MESSAGE_CODES.md#announce) -- [BLOCK\_BODIES](LES.MESSAGE_CODES.md#block_bodies) -- [BLOCK\_HEADERS](LES.MESSAGE_CODES.md#block_headers) -- [CONTRACT\_CODES](LES.MESSAGE_CODES.md#contract_codes) -- [GET\_BLOCK\_BODIES](LES.MESSAGE_CODES.md#get_block_bodies) -- [GET\_BLOCK\_HEADERS](LES.MESSAGE_CODES.md#get_block_headers) -- [GET\_CONTRACT\_CODES](LES.MESSAGE_CODES.md#get_contract_codes) -- [GET\_HEADER\_PROOFS](LES.MESSAGE_CODES.md#get_header_proofs) -- [GET\_HELPER\_TRIE\_PROOFS](LES.MESSAGE_CODES.md#get_helper_trie_proofs) -- [GET\_PROOFS](LES.MESSAGE_CODES.md#get_proofs) -- [GET\_PROOFS\_V2](LES.MESSAGE_CODES.md#get_proofs_v2) -- [GET\_RECEIPTS](LES.MESSAGE_CODES.md#get_receipts) -- [GET\_TX\_STATUS](LES.MESSAGE_CODES.md#get_tx_status) -- [HEADER\_PROOFS](LES.MESSAGE_CODES.md#header_proofs) -- [HELPER\_TRIE\_PROOFS](LES.MESSAGE_CODES.md#helper_trie_proofs) -- [PROOFS](LES.MESSAGE_CODES.md#proofs) -- [PROOFS\_V2](LES.MESSAGE_CODES.md#proofs_v2) -- [RECEIPTS](LES.MESSAGE_CODES.md#receipts) -- [RESUME\_MSG](LES.MESSAGE_CODES.md#resume_msg) -- [SEND\_TX](LES.MESSAGE_CODES.md#send_tx) -- [SEND\_TX\_V2](LES.MESSAGE_CODES.md#send_tx_v2) -- [STATUS](LES.MESSAGE_CODES.md#status) -- [STOP\_MSG](LES.MESSAGE_CODES.md#stop_msg) -- [TX\_STATUS](LES.MESSAGE_CODES.md#tx_status) - -## Enumeration Members - -### ANNOUNCE - -• **ANNOUNCE** = ``1`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L304) - -___ - -### BLOCK\_BODIES - -• **BLOCK\_BODIES** = ``5`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L308) - -___ - -### BLOCK\_HEADERS - -• **BLOCK\_HEADERS** = ``3`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:306](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L306) - -___ - -### CONTRACT\_CODES - -• **CONTRACT\_CODES** = ``11`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L314) - -___ - -### GET\_BLOCK\_BODIES - -• **GET\_BLOCK\_BODIES** = ``4`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:307](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L307) - -___ - -### GET\_BLOCK\_HEADERS - -• **GET\_BLOCK\_HEADERS** = ``2`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:305](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L305) - -___ - -### GET\_CONTRACT\_CODES - -• **GET\_CONTRACT\_CODES** = ``10`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L313) - -___ - -### GET\_HEADER\_PROOFS - -• **GET\_HEADER\_PROOFS** = ``13`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L315) - -___ - -### GET\_HELPER\_TRIE\_PROOFS - -• **GET\_HELPER\_TRIE\_PROOFS** = ``17`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L322) - -___ - -### GET\_PROOFS - -• **GET\_PROOFS** = ``8`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:311](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L311) - -___ - -### GET\_PROOFS\_V2 - -• **GET\_PROOFS\_V2** = ``15`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:320](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L320) - -___ - -### GET\_RECEIPTS - -• **GET\_RECEIPTS** = ``6`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L309) - -___ - -### GET\_TX\_STATUS - -• **GET\_TX\_STATUS** = ``20`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:325](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L325) - -___ - -### HEADER\_PROOFS - -• **HEADER\_PROOFS** = ``14`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:316](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L316) - -___ - -### HELPER\_TRIE\_PROOFS - -• **HELPER\_TRIE\_PROOFS** = ``18`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:323](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L323) - -___ - -### PROOFS - -• **PROOFS** = ``9`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L312) - -___ - -### PROOFS\_V2 - -• **PROOFS\_V2** = ``16`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:321](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L321) - -___ - -### RECEIPTS - -• **RECEIPTS** = ``7`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:310](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L310) - -___ - -### RESUME\_MSG - -• **RESUME\_MSG** = ``23`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:330](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L330) - -___ - -### SEND\_TX - -• **SEND\_TX** = ``12`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:317](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L317) - -___ - -### SEND\_TX\_V2 - -• **SEND\_TX\_V2** = ``19`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L324) - -___ - -### STATUS - -• **STATUS** = ``0`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L303) - -___ - -### STOP\_MSG - -• **STOP\_MSG** = ``22`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L329) - -___ - -### TX\_STATUS - -• **TX\_STATUS** = ``21`` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:326](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L326) diff --git a/packages/devp2p/docs/enums/ProtocolType.md b/packages/devp2p/docs/enums/ProtocolType.md deleted file mode 100644 index ac5c7d5a44b..00000000000 --- a/packages/devp2p/docs/enums/ProtocolType.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / ProtocolType - -# Enumeration: ProtocolType - -## Table of contents - -### Enumeration Members - -- [ETH](ProtocolType.md#eth) -- [LES](ProtocolType.md#les) -- [SNAP](ProtocolType.md#snap) - -## Enumeration Members - -### ETH - -• **ETH** = ``"eth"`` - -#### Defined in - -[packages/devp2p/src/types.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L131) - -___ - -### LES - -• **LES** = ``"les"`` - -#### Defined in - -[packages/devp2p/src/types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L132) - -___ - -### SNAP - -• **SNAP** = ``"snap"`` - -#### Defined in - -[packages/devp2p/src/types.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L133) diff --git a/packages/devp2p/docs/enums/SNAP.MESSAGE_CODES.md b/packages/devp2p/docs/enums/SNAP.MESSAGE_CODES.md deleted file mode 100644 index 41049cbe356..00000000000 --- a/packages/devp2p/docs/enums/SNAP.MESSAGE_CODES.md +++ /dev/null @@ -1,98 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / [SNAP](../modules/SNAP.md) / MESSAGE\_CODES - -# Enumeration: MESSAGE\_CODES - -[SNAP](../modules/SNAP.md).MESSAGE_CODES - -## Table of contents - -### Enumeration Members - -- [ACCOUNT\_RANGE](SNAP.MESSAGE_CODES.md#account_range) -- [BYTE\_CODES](SNAP.MESSAGE_CODES.md#byte_codes) -- [GET\_ACCOUNT\_RANGE](SNAP.MESSAGE_CODES.md#get_account_range) -- [GET\_BYTE\_CODES](SNAP.MESSAGE_CODES.md#get_byte_codes) -- [GET\_STORAGE\_RANGES](SNAP.MESSAGE_CODES.md#get_storage_ranges) -- [GET\_TRIE\_NODES](SNAP.MESSAGE_CODES.md#get_trie_nodes) -- [STORAGE\_RANGES](SNAP.MESSAGE_CODES.md#storage_ranges) -- [TRIE\_NODES](SNAP.MESSAGE_CODES.md#trie_nodes) - -## Enumeration Members - -### ACCOUNT\_RANGE - -• **ACCOUNT\_RANGE** = ``1`` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L108) - -___ - -### BYTE\_CODES - -• **BYTE\_CODES** = ``5`` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L112) - -___ - -### GET\_ACCOUNT\_RANGE - -• **GET\_ACCOUNT\_RANGE** = ``0`` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L107) - -___ - -### GET\_BYTE\_CODES - -• **GET\_BYTE\_CODES** = ``4`` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L111) - -___ - -### GET\_STORAGE\_RANGES - -• **GET\_STORAGE\_RANGES** = ``2`` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L109) - -___ - -### GET\_TRIE\_NODES - -• **GET\_TRIE\_NODES** = ``6`` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L113) - -___ - -### STORAGE\_RANGES - -• **STORAGE\_RANGES** = ``3`` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L110) - -___ - -### TRIE\_NODES - -• **TRIE\_NODES** = ``7`` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L114) diff --git a/packages/devp2p/docs/functions/assertEq.md b/packages/devp2p/docs/functions/assertEq.md new file mode 100644 index 00000000000..7cffe73511b --- /dev/null +++ b/packages/devp2p/docs/functions/assertEq.md @@ -0,0 +1,37 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / assertEq + +# Function: assertEq() + +> **assertEq**(`expected`, `actual`, `msg`, `debug`, `messageName?`): `void` + +Defined in: [packages/devp2p/src/util.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L51) + +## Parameters + +### expected + +`assertInput` + +### actual + +`assertInput` + +### msg + +`string` + +### debug + +`Function` + +### messageName? + +`string` + +## Returns + +`void` diff --git a/packages/devp2p/docs/functions/createDeferred.md b/packages/devp2p/docs/functions/createDeferred.md new file mode 100644 index 00000000000..0c02d2c0a8d --- /dev/null +++ b/packages/devp2p/docs/functions/createDeferred.md @@ -0,0 +1,21 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / createDeferred + +# Function: createDeferred() + +> **createDeferred**\<`T`\>(): [`Deferred`](../classes/Deferred.md)\<`T`\> + +Defined in: [packages/devp2p/src/util.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L112) + +## Type Parameters + +### T + +`T` + +## Returns + +[`Deferred`](../classes/Deferred.md)\<`T`\> diff --git a/packages/devp2p/docs/functions/decode.md b/packages/devp2p/docs/functions/decode.md new file mode 100644 index 00000000000..013326bcbb0 --- /dev/null +++ b/packages/devp2p/docs/functions/decode.md @@ -0,0 +1,37 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / decode + +# Function: decode() + +> **decode**(`bytes`, `common?`): `object` + +Defined in: [packages/devp2p/src/dpt/message.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/message.ts#L203) + +## Parameters + +### bytes + +`Uint8Array` + +### common? + +`Common` + +## Returns + +`object` + +### data + +> **data**: `any` + +### publicKey + +> **publicKey**: `Uint8Array`\<`ArrayBufferLike`\> + +### typename + +> **typename**: `string` \| `number` diff --git a/packages/devp2p/docs/functions/encode.md b/packages/devp2p/docs/functions/encode.md new file mode 100644 index 00000000000..f9eb582ddfe --- /dev/null +++ b/packages/devp2p/docs/functions/encode.md @@ -0,0 +1,39 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / encode + +# Function: encode() + +> **encode**\<`T`\>(`typename`, `data`, `privateKey`, `common?`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/devp2p/src/dpt/message.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/message.ts#L185) + +## Type Parameters + +### T + +`T` + +## Parameters + +### typename + +`string` + +### data + +`T` + +### privateKey + +`Uint8Array` + +### common? + +`Common` + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> diff --git a/packages/devp2p/docs/functions/formatLogData.md b/packages/devp2p/docs/functions/formatLogData.md new file mode 100644 index 00000000000..0a8cbc94b59 --- /dev/null +++ b/packages/devp2p/docs/functions/formatLogData.md @@ -0,0 +1,25 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / formatLogData + +# Function: formatLogData() + +> **formatLogData**(`data`, `verbose`): `string` + +Defined in: [packages/devp2p/src/util.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L91) + +## Parameters + +### data + +`string` + +### verbose + +`boolean` + +## Returns + +`string` diff --git a/packages/devp2p/docs/functions/formatLogId.md b/packages/devp2p/docs/functions/formatLogId.md new file mode 100644 index 00000000000..d2d6dda4dd4 --- /dev/null +++ b/packages/devp2p/docs/functions/formatLogId.md @@ -0,0 +1,25 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / formatLogId + +# Function: formatLogId() + +> **formatLogId**(`id`, `verbose`): `string` + +Defined in: [packages/devp2p/src/util.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L82) + +## Parameters + +### id + +`string` + +### verbose + +`boolean` + +## Returns + +`string` diff --git a/packages/devp2p/docs/functions/genPrivateKey.md b/packages/devp2p/docs/functions/genPrivateKey.md new file mode 100644 index 00000000000..a52aeecef46 --- /dev/null +++ b/packages/devp2p/docs/functions/genPrivateKey.md @@ -0,0 +1,15 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / genPrivateKey + +# Function: genPrivateKey() + +> **genPrivateKey**(): `Uint8Array` + +Defined in: [packages/devp2p/src/util.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L19) + +## Returns + +`Uint8Array` diff --git a/packages/devp2p/docs/functions/id2pk.md b/packages/devp2p/docs/functions/id2pk.md new file mode 100644 index 00000000000..9e12b2749df --- /dev/null +++ b/packages/devp2p/docs/functions/id2pk.md @@ -0,0 +1,21 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / id2pk + +# Function: id2pk() + +> **id2pk**(`id`): `Uint8Array` + +Defined in: [packages/devp2p/src/util.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L31) + +## Parameters + +### id + +`Uint8Array` + +## Returns + +`Uint8Array` diff --git a/packages/devp2p/docs/functions/ipToBytes.md b/packages/devp2p/docs/functions/ipToBytes.md new file mode 100644 index 00000000000..cbc5953c6dc --- /dev/null +++ b/packages/devp2p/docs/functions/ipToBytes.md @@ -0,0 +1,29 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / ipToBytes + +# Function: ipToBytes() + +> **ipToBytes**(`ip`, `bytes?`, `offset?`): `Uint8Array` + +Defined in: [packages/devp2p/src/util.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L161) + +## Parameters + +### ip + +`string` + +### bytes? + +`Uint8Array`\<`ArrayBufferLike`\> + +### offset? + +`number` = `0` + +## Returns + +`Uint8Array` diff --git a/packages/devp2p/docs/functions/ipToString.md b/packages/devp2p/docs/functions/ipToString.md new file mode 100644 index 00000000000..101e8be6ff8 --- /dev/null +++ b/packages/devp2p/docs/functions/ipToString.md @@ -0,0 +1,31 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / ipToString + +# Function: ipToString() + +> **ipToString**(`bytes`, `offset?`, `length?`): `string` + +Defined in: [packages/devp2p/src/util.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L125) + +************************* *********************************************************** + +## Parameters + +### bytes + +`Uint8Array` + +### offset? + +`number` + +### length? + +`number` + +## Returns + +`string` diff --git a/packages/devp2p/docs/functions/isV4Format.md b/packages/devp2p/docs/functions/isV4Format.md new file mode 100644 index 00000000000..33d7a1220d4 --- /dev/null +++ b/packages/devp2p/docs/functions/isV4Format.md @@ -0,0 +1,21 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / isV4Format + +# Function: isV4Format() + +> **isV4Format**(`ip`): `boolean` + +Defined in: [packages/devp2p/src/util.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L153) + +## Parameters + +### ip + +`string` + +## Returns + +`boolean` diff --git a/packages/devp2p/docs/functions/isV6Format.md b/packages/devp2p/docs/functions/isV6Format.md new file mode 100644 index 00000000000..546c93e60c7 --- /dev/null +++ b/packages/devp2p/docs/functions/isV6Format.md @@ -0,0 +1,21 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / isV6Format + +# Function: isV6Format() + +> **isV6Format**(`ip`): `boolean` + +Defined in: [packages/devp2p/src/util.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L157) + +## Parameters + +### ip + +`string` + +## Returns + +`boolean` diff --git a/packages/devp2p/docs/functions/pk2id.md b/packages/devp2p/docs/functions/pk2id.md new file mode 100644 index 00000000000..12070c79ce8 --- /dev/null +++ b/packages/devp2p/docs/functions/pk2id.md @@ -0,0 +1,21 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / pk2id + +# Function: pk2id() + +> **pk2id**(`pk`): `Uint8Array` + +Defined in: [packages/devp2p/src/util.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L24) + +## Parameters + +### pk + +`Uint8Array` + +## Returns + +`Uint8Array` diff --git a/packages/devp2p/docs/functions/unstrictDecode.md b/packages/devp2p/docs/functions/unstrictDecode.md new file mode 100644 index 00000000000..20a082ea107 --- /dev/null +++ b/packages/devp2p/docs/functions/unstrictDecode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / unstrictDecode + +# Function: unstrictDecode() + +> **unstrictDecode**(`value`): `Uint8Array`\<`ArrayBufferLike`\> \| `NestedUint8Array` + +Defined in: [packages/devp2p/src/util.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L116) + +## Parameters + +### value + +`Uint8Array` + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> \| `NestedUint8Array` diff --git a/packages/devp2p/docs/functions/xor.md b/packages/devp2p/docs/functions/xor.md new file mode 100644 index 00000000000..5a5268b9607 --- /dev/null +++ b/packages/devp2p/docs/functions/xor.md @@ -0,0 +1,25 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / xor + +# Function: xor() + +> **xor**(`a`, `b`): `Uint8Array` + +Defined in: [packages/devp2p/src/util.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L42) + +## Parameters + +### a + +`Uint8Array` + +### b + +`any` + +## Returns + +`Uint8Array` diff --git a/packages/devp2p/docs/functions/zfill.md b/packages/devp2p/docs/functions/zfill.md new file mode 100644 index 00000000000..c5822f48f53 --- /dev/null +++ b/packages/devp2p/docs/functions/zfill.md @@ -0,0 +1,29 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / zfill + +# Function: zfill() + +> **zfill**(`bytes`, `size`, `leftpad`): `Uint8Array` + +Defined in: [packages/devp2p/src/util.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L35) + +## Parameters + +### bytes + +`Uint8Array` + +### size + +`number` + +### leftpad + +`boolean` = `true` + +## Returns + +`Uint8Array` diff --git a/packages/devp2p/docs/interfaces/Capabilities.md b/packages/devp2p/docs/interfaces/Capabilities.md index dffac336c9f..56674ebd1d3 100644 --- a/packages/devp2p/docs/interfaces/Capabilities.md +++ b/packages/devp2p/docs/interfaces/Capabilities.md @@ -1,52 +1,41 @@ -[@ethereumjs/devp2p](../README.md) / Capabilities +[**@ethereumjs/devp2p**](../README.md) -# Interface: Capabilities +*** -## Table of contents +[@ethereumjs/devp2p](../README.md) / Capabilities -### Properties +# Interface: Capabilities -- [constructor](Capabilities.md#constructor) -- [length](Capabilities.md#length) -- [name](Capabilities.md#name) -- [version](Capabilities.md#version) +Defined in: [packages/devp2p/src/types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L62) ## Properties ### constructor -• **constructor**: `ProtocolConstructor` +> **constructor**: `ProtocolConstructor` -#### Defined in +Defined in: [packages/devp2p/src/types.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L66) -[packages/devp2p/src/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L14) - -___ +*** ### length -• **length**: `number` - -#### Defined in +> **length**: `number` -[packages/devp2p/src/types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L13) +Defined in: [packages/devp2p/src/types.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L65) -___ +*** ### name -• **name**: `string` +> **name**: `string` -#### Defined in +Defined in: [packages/devp2p/src/types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L63) -[packages/devp2p/src/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L11) - -___ +*** ### version -• **version**: `number` - -#### Defined in +> **version**: `number` -[packages/devp2p/src/types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L12) +Defined in: [packages/devp2p/src/types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L64) diff --git a/packages/devp2p/docs/interfaces/Contact.md b/packages/devp2p/docs/interfaces/Contact.md index a18e387e227..9b253160d99 100644 --- a/packages/devp2p/docs/interfaces/Contact.md +++ b/packages/devp2p/docs/interfaces/Contact.md @@ -1,89 +1,73 @@ -[@ethereumjs/devp2p](../README.md) / Contact - -# Interface: Contact +[**@ethereumjs/devp2p**](../README.md) -## Hierarchy +*** -- [`PeerInfo`](PeerInfo.md) +[@ethereumjs/devp2p](../README.md) / Contact - ↳ **`Contact`** +# Interface: Contact -## Table of contents +Defined in: [packages/devp2p/src/types.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L274) -### Properties +## Extends -- [address](Contact.md#address) -- [id](Contact.md#id) -- [tcpPort](Contact.md#tcpport) -- [udpPort](Contact.md#udpport) -- [vectorClock](Contact.md#vectorclock) +- [`PeerInfo`](PeerInfo.md) ## Properties -### address +### address? -• `Optional` **address**: `string` - -#### Inherited from +> `optional` **address**: `string` -[PeerInfo](PeerInfo.md).[address](PeerInfo.md#address) +Defined in: [packages/devp2p/src/types.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L268) -#### Defined in +#### Inherited from -[packages/devp2p/src/types.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L174) +[`PeerInfo`](PeerInfo.md).[`address`](PeerInfo.md#address) -___ +*** ### id -• **id**: `Uint8Array` +> **id**: `Uint8Array` -#### Overrides +Defined in: [packages/devp2p/src/types.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L275) -[PeerInfo](PeerInfo.md).[id](PeerInfo.md#id) +#### Overrides -#### Defined in +[`PeerInfo`](PeerInfo.md).[`id`](PeerInfo.md#id) -[packages/devp2p/src/types.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L181) +*** -___ +### tcpPort? -### tcpPort +> `optional` **tcpPort**: `null` \| `number` -• `Optional` **tcpPort**: ``null`` \| `number` +Defined in: [packages/devp2p/src/types.ts:270](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L270) #### Inherited from -[PeerInfo](PeerInfo.md).[tcpPort](PeerInfo.md#tcpport) +[`PeerInfo`](PeerInfo.md).[`tcpPort`](PeerInfo.md#tcpport) -#### Defined in +*** -[packages/devp2p/src/types.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L176) +### udpPort? -___ +> `optional` **udpPort**: `null` \| `number` -### udpPort - -• `Optional` **udpPort**: ``null`` \| `number` +Defined in: [packages/devp2p/src/types.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L269) #### Inherited from -[PeerInfo](PeerInfo.md).[udpPort](PeerInfo.md#udpport) - -#### Defined in +[`PeerInfo`](PeerInfo.md).[`udpPort`](PeerInfo.md#udpport) -[packages/devp2p/src/types.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L175) - -___ +*** ### vectorClock -• **vectorClock**: `number` - -#### Overrides +> **vectorClock**: `number` -[PeerInfo](PeerInfo.md).[vectorClock](PeerInfo.md#vectorclock) +Defined in: [packages/devp2p/src/types.ts:276](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L276) -#### Defined in +#### Overrides -[packages/devp2p/src/types.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L182) +[`PeerInfo`](PeerInfo.md).[`vectorClock`](PeerInfo.md#vectorclock) diff --git a/packages/devp2p/docs/interfaces/DPTEvent.md b/packages/devp2p/docs/interfaces/DPTEvent.md new file mode 100644 index 00000000000..a4966cf04a2 --- /dev/null +++ b/packages/devp2p/docs/interfaces/DPTEvent.md @@ -0,0 +1,57 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / DPTEvent + +# Interface: DPTEvent + +Defined in: [packages/devp2p/src/types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L43) + +## Properties + +### close + +> **close**: `undefined` + +Defined in: [packages/devp2p/src/types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L45) + +*** + +### error + +> **error**: \[`Error`\] + +Defined in: [packages/devp2p/src/types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L46) + +*** + +### listening + +> **listening**: `undefined` + +Defined in: [packages/devp2p/src/types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L44) + +*** + +### peer:added + +> **peer:added**: \[[`PeerInfo`](PeerInfo.md)\] + +Defined in: [packages/devp2p/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L47) + +*** + +### peer:new + +> **peer:new**: \[[`PeerInfo`](PeerInfo.md)\] + +Defined in: [packages/devp2p/src/types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L48) + +*** + +### peer:removed + +> **peer:removed**: \[[`PeerInfo`](PeerInfo.md)\] + +Defined in: [packages/devp2p/src/types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L49) diff --git a/packages/devp2p/docs/interfaces/DPTOptions.md b/packages/devp2p/docs/interfaces/DPTOptions.md index 27e19bb4249..29ba395e59e 100644 --- a/packages/devp2p/docs/interfaces/DPTOptions.md +++ b/packages/devp2p/docs/interfaces/DPTOptions.md @@ -1,143 +1,144 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + [@ethereumjs/devp2p](../README.md) / DPTOptions # Interface: DPTOptions -## Table of contents +Defined in: [packages/devp2p/src/types.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L113) -### Properties +## Properties -- [createSocket](DPTOptions.md#createsocket) -- [dnsAddr](DPTOptions.md#dnsaddr) -- [dnsNetworks](DPTOptions.md#dnsnetworks) -- [dnsRefreshQuantity](DPTOptions.md#dnsrefreshquantity) -- [endpoint](DPTOptions.md#endpoint) -- [refreshInterval](DPTOptions.md#refreshinterval) -- [shouldFindNeighbours](DPTOptions.md#shouldfindneighbours) -- [shouldGetDnsPeers](DPTOptions.md#shouldgetdnspeers) -- [timeout](DPTOptions.md#timeout) +### common? -## Properties +> `optional` **common**: `Common` + +Defined in: [packages/devp2p/src/types.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L192) + +Common instance to allow for crypto primitive (e.g. keccak) replacement + +*** -### createSocket +### createSocket? -• `Optional` **createSocket**: `Function` +> `optional` **createSocket**: `Function` + +Defined in: [packages/devp2p/src/types.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L133) Function for socket creation Default: dgram-created socket -#### Defined in - -[packages/devp2p/src/types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L62) +*** -___ +### dnsAddr? -### dnsAddr +> `optional` **dnsAddr**: `string` -• `Optional` **dnsAddr**: `string` +Defined in: [packages/devp2p/src/types.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L187) DNS server to query DNS TXT records from for peer discovery -#### Defined in - -[packages/devp2p/src/types.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L104) +*** -___ +### dnsNetworks? -### dnsNetworks +> `optional` **dnsNetworks**: `string`[] -• `Optional` **dnsNetworks**: `string`[] +Defined in: [packages/devp2p/src/types.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L182) EIP-1459 ENR tree urls to query for peer discovery Default: (network dependent) -#### Defined in +*** -[packages/devp2p/src/types.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L99) +### dnsRefreshQuantity? -___ +> `optional` **dnsRefreshQuantity**: `number` -### dnsRefreshQuantity - -• `Optional` **dnsRefreshQuantity**: `number` +Defined in: [packages/devp2p/src/types.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L175) Max number of candidate peers to retrieve from DNS records when attempting to discover new nodes Default: 25 -#### Defined in - -[packages/devp2p/src/types.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L92) +*** -___ +### endpoint? -### endpoint +> `optional` **endpoint**: [`PeerInfo`](PeerInfo.md) -• `Optional` **endpoint**: [`PeerInfo`](PeerInfo.md) +Defined in: [packages/devp2p/src/types.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L126) Network info to send a long a request Default: 0.0.0.0, no UDP or TCP port provided -#### Defined in +*** + +### onlyConfirmed? -[packages/devp2p/src/types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L55) +> `optional` **onlyConfirmed**: `boolean` -___ +Defined in: [packages/devp2p/src/types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L160) -### refreshInterval +Send findNeighbour requests to and only answer with respective peers +being confirmed by calling the `confirmPeer()` method -• `Optional` **refreshInterval**: `number` +(allows for a more selective and noise reduced discovery) + +Note: Bootstrap nodes are confirmed by default. + +Default: false + +*** + +### refreshInterval? + +> `optional` **refreshInterval**: `number` + +Defined in: [packages/devp2p/src/types.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L140) Interval for peer table refresh Default: 60s -#### Defined in - -[packages/devp2p/src/types.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L69) +*** -___ +### shouldFindNeighbours? -### shouldFindNeighbours +> `optional` **shouldFindNeighbours**: `boolean` -• `Optional` **shouldFindNeighbours**: `boolean` +Defined in: [packages/devp2p/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L148) Toggles whether or not peers should be queried with 'findNeighbours' to discover more peers Default: true -#### Defined in - -[packages/devp2p/src/types.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L77) +*** -___ +### shouldGetDnsPeers? -### shouldGetDnsPeers +> `optional` **shouldGetDnsPeers**: `boolean` -• `Optional` **shouldGetDnsPeers**: `boolean` +Defined in: [packages/devp2p/src/types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L167) Toggles whether or not peers should be discovered by querying EIP-1459 DNS lists Default: false -#### Defined in +*** -[packages/devp2p/src/types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L84) +### timeout? -___ +> `optional` **timeout**: `number` -### timeout - -• `Optional` **timeout**: `number` +Defined in: [packages/devp2p/src/types.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L119) Timeout for peer requests Default: 10s - -#### Defined in - -[packages/devp2p/src/types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L48) diff --git a/packages/devp2p/docs/interfaces/DPTServerOptions.md b/packages/devp2p/docs/interfaces/DPTServerOptions.md index 0975b398e41..e05ca53fdeb 100644 --- a/packages/devp2p/docs/interfaces/DPTServerOptions.md +++ b/packages/devp2p/docs/interfaces/DPTServerOptions.md @@ -1,53 +1,55 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + [@ethereumjs/devp2p](../README.md) / DPTServerOptions # Interface: DPTServerOptions -## Table of contents +Defined in: [packages/devp2p/src/types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L195) + +## Properties -### Properties +### common? -- [createSocket](DPTServerOptions.md#createsocket) -- [endpoint](DPTServerOptions.md#endpoint) -- [timeout](DPTServerOptions.md#timeout) +> `optional` **common**: `Common` -## Properties +Defined in: [packages/devp2p/src/types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L220) + +Common instance to allow for crypto primitive (e.g. keccak) replacement -### createSocket +*** -• `Optional` **createSocket**: `Function` +### createSocket? + +> `optional` **createSocket**: `Function` + +Defined in: [packages/devp2p/src/types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L215) Function for socket creation Default: dgram-created socket -#### Defined in - -[packages/devp2p/src/types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L127) +*** -___ +### endpoint? -### endpoint +> `optional` **endpoint**: [`PeerInfo`](PeerInfo.md) -• `Optional` **endpoint**: [`PeerInfo`](PeerInfo.md) +Defined in: [packages/devp2p/src/types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L208) Network info to send a long a request Default: 0.0.0.0, no UDP or TCP port provided -#### Defined in +*** -[packages/devp2p/src/types.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L120) +### timeout? -___ +> `optional` **timeout**: `number` -### timeout - -• `Optional` **timeout**: `number` +Defined in: [packages/devp2p/src/types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L201) Timeout for peer requests Default: 10s - -#### Defined in - -[packages/devp2p/src/types.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L113) diff --git a/packages/devp2p/docs/interfaces/ETH.StatusMsg.md b/packages/devp2p/docs/interfaces/ETH.StatusMsg.md deleted file mode 100644 index 472f8d52343..00000000000 --- a/packages/devp2p/docs/interfaces/ETH.StatusMsg.md +++ /dev/null @@ -1,1194 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / [ETH](../modules/ETH.md) / StatusMsg - -# Interface: StatusMsg - -[ETH](../modules/ETH.md).StatusMsg - -## Hierarchy - -- `Array`<`Uint8Array` \| `Uint8Array`[]\> - - ↳ **`StatusMsg`** - -## Table of contents - -### Properties - -- [length](ETH.StatusMsg.md#length) - -### Methods - -- [[iterator]](ETH.StatusMsg.md#[iterator]) -- [[unscopables]](ETH.StatusMsg.md#[unscopables]) -- [at](ETH.StatusMsg.md#at) -- [concat](ETH.StatusMsg.md#concat) -- [copyWithin](ETH.StatusMsg.md#copywithin) -- [entries](ETH.StatusMsg.md#entries) -- [every](ETH.StatusMsg.md#every) -- [fill](ETH.StatusMsg.md#fill) -- [filter](ETH.StatusMsg.md#filter) -- [find](ETH.StatusMsg.md#find) -- [findIndex](ETH.StatusMsg.md#findindex) -- [flat](ETH.StatusMsg.md#flat) -- [flatMap](ETH.StatusMsg.md#flatmap) -- [forEach](ETH.StatusMsg.md#foreach) -- [includes](ETH.StatusMsg.md#includes) -- [indexOf](ETH.StatusMsg.md#indexof) -- [join](ETH.StatusMsg.md#join) -- [keys](ETH.StatusMsg.md#keys) -- [lastIndexOf](ETH.StatusMsg.md#lastindexof) -- [map](ETH.StatusMsg.md#map) -- [pop](ETH.StatusMsg.md#pop) -- [push](ETH.StatusMsg.md#push) -- [reduce](ETH.StatusMsg.md#reduce) -- [reduceRight](ETH.StatusMsg.md#reduceright) -- [reverse](ETH.StatusMsg.md#reverse) -- [shift](ETH.StatusMsg.md#shift) -- [slice](ETH.StatusMsg.md#slice) -- [some](ETH.StatusMsg.md#some) -- [sort](ETH.StatusMsg.md#sort) -- [splice](ETH.StatusMsg.md#splice) -- [toLocaleString](ETH.StatusMsg.md#tolocalestring) -- [toString](ETH.StatusMsg.md#tostring) -- [unshift](ETH.StatusMsg.md#unshift) -- [values](ETH.StatusMsg.md#values) - -## Properties - -### length - -• **length**: `number` - -Gets or sets the length of the array. This is a number one higher than the highest index in the array. - -#### Inherited from - -Array.length - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1279 - -## Methods - -### [iterator] - -▸ **[iterator]**(): `IterableIterator`<`Uint8Array` \| `Uint8Array`[]\> - -Iterator - -#### Returns - -`IterableIterator`<`Uint8Array` \| `Uint8Array`[]\> - -#### Inherited from - -Array.\_\_@iterator@111 - -#### Defined in - -node_modules/typescript/lib/lib.es2015.iterable.d.ts:60 - -___ - -### [unscopables] - -▸ **[unscopables]**(): `Object` - -Returns an object whose properties have the value 'true' -when they will be absent when used in a 'with' statement. - -#### Returns - -`Object` - -| Name | Type | -| :------ | :------ | -| `copyWithin` | `boolean` | -| `entries` | `boolean` | -| `fill` | `boolean` | -| `find` | `boolean` | -| `findIndex` | `boolean` | -| `keys` | `boolean` | -| `values` | `boolean` | - -#### Inherited from - -Array.\_\_@unscopables@113 - -#### Defined in - -node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:99 - -___ - -### at - -▸ **at**(`index`): `undefined` \| `Uint8Array` \| `Uint8Array`[] - -Takes an integer value and returns the item at that index, -allowing for positive and negative integers. -Negative integers count back from the last item in the array. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `index` | `number` | - -#### Returns - -`undefined` \| `Uint8Array` \| `Uint8Array`[] - -#### Inherited from - -Array.at - -#### Defined in - -node_modules/@types/node/ts4.8/globals.d.ts:86 - -___ - -### concat - -▸ **concat**(...`items`): (`Uint8Array` \| `Uint8Array`[])[] - -Combines two or more arrays. -This method returns a new array without modifying any existing arrays. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...items` | `ConcatArray`<`Uint8Array` \| `Uint8Array`[]\>[] | Additional arrays and/or items to add to the end of the array. | - -#### Returns - -(`Uint8Array` \| `Uint8Array`[])[] - -#### Inherited from - -Array.concat - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1303 - -▸ **concat**(...`items`): (`Uint8Array` \| `Uint8Array`[])[] - -Combines two or more arrays. -This method returns a new array without modifying any existing arrays. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...items` | (`Uint8Array` \| `Uint8Array`[] \| `ConcatArray`<`Uint8Array` \| `Uint8Array`[]\>)[] | Additional arrays and/or items to add to the end of the array. | - -#### Returns - -(`Uint8Array` \| `Uint8Array`[])[] - -#### Inherited from - -Array.concat - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1309 - -___ - -### copyWithin - -▸ **copyWithin**(`target`, `start`, `end?`): [`StatusMsg`](ETH.StatusMsg.md) - -Returns the this object after copying a section of the array identified by start and end -to the same array starting at position target - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `target` | `number` | If target is negative, it is treated as length+target where length is the length of the array. | -| `start` | `number` | If start is negative, it is treated as length+start. If end is negative, it is treated as length+end. | -| `end?` | `number` | If not specified, length of the this object is used as its default value. | - -#### Returns - -[`StatusMsg`](ETH.StatusMsg.md) - -#### Inherited from - -Array.copyWithin - -#### Defined in - -node_modules/typescript/lib/lib.es2015.core.d.ts:64 - -___ - -### entries - -▸ **entries**(): `IterableIterator`<[`number`, `Uint8Array` \| `Uint8Array`[]]\> - -Returns an iterable of key, value pairs for every entry in the array - -#### Returns - -`IterableIterator`<[`number`, `Uint8Array` \| `Uint8Array`[]]\> - -#### Inherited from - -Array.entries - -#### Defined in - -node_modules/typescript/lib/lib.es2015.iterable.d.ts:65 - -___ - -### every - -▸ **every**<`S`\>(`predicate`, `thisArg?`): this is S[] - -Determines whether all the members of an array satisfy the specified test. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `S` | extends `Uint8Array` \| `Uint8Array`[] | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => value is S | A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. | -| `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | - -#### Returns - -this is S[] - -#### Inherited from - -Array.every - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1386 - -▸ **every**(`predicate`, `thisArg?`): `boolean` - -Determines whether all the members of an array satisfy the specified test. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. | -| `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | - -#### Returns - -`boolean` - -#### Inherited from - -Array.every - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1395 - -___ - -### fill - -▸ **fill**(`value`, `start?`, `end?`): [`StatusMsg`](ETH.StatusMsg.md) - -Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `Uint8Array` \| `Uint8Array`[] | value to fill array section with | -| `start?` | `number` | index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array. | -| `end?` | `number` | index to stop filling the array at. If end is negative, it is treated as length+end. | - -#### Returns - -[`StatusMsg`](ETH.StatusMsg.md) - -#### Inherited from - -Array.fill - -#### Defined in - -node_modules/typescript/lib/lib.es2015.core.d.ts:53 - -___ - -### filter - -▸ **filter**<`S`\>(`predicate`, `thisArg?`): `S`[] - -Returns the elements of an array that meet the condition specified in a callback function. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `S` | extends `Uint8Array` \| `Uint8Array`[] | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => value is S | A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. | -| `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | - -#### Returns - -`S`[] - -#### Inherited from - -Array.filter - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1422 - -▸ **filter**(`predicate`, `thisArg?`): (`Uint8Array` \| `Uint8Array`[])[] - -Returns the elements of an array that meet the condition specified in a callback function. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. | -| `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | - -#### Returns - -(`Uint8Array` \| `Uint8Array`[])[] - -#### Inherited from - -Array.filter - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1428 - -___ - -### find - -▸ **find**<`S`\>(`predicate`, `thisArg?`): `undefined` \| `S` - -Returns the value of the first element in the array where predicate is true, and undefined -otherwise. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `S` | extends `Uint8Array` \| `Uint8Array`[] | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `predicate` | (`this`: `void`, `value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `obj`: (`Uint8Array` \| `Uint8Array`[])[]) => value is S | find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. | -| `thisArg?` | `any` | If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. | - -#### Returns - -`undefined` \| `S` - -#### Inherited from - -Array.find - -#### Defined in - -node_modules/typescript/lib/lib.es2015.core.d.ts:31 - -▸ **find**(`predicate`, `thisArg?`): `undefined` \| `Uint8Array` \| `Uint8Array`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `obj`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | -| `thisArg?` | `any` | - -#### Returns - -`undefined` \| `Uint8Array` \| `Uint8Array`[] - -#### Inherited from - -Array.find - -#### Defined in - -node_modules/typescript/lib/lib.es2015.core.d.ts:32 - -___ - -### findIndex - -▸ **findIndex**(`predicate`, `thisArg?`): `number` - -Returns the index of the first element in the array where predicate is true, and -1 -otherwise. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `obj`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1. | -| `thisArg?` | `any` | If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. | - -#### Returns - -`number` - -#### Inherited from - -Array.findIndex - -#### Defined in - -node_modules/typescript/lib/lib.es2015.core.d.ts:43 - -___ - -### flat - -▸ **flat**<`A`, `D`\>(`this`, `depth?`): `FlatArray`<`A`, `D`\>[] - -Returns a new array with all sub-array elements concatenated into it recursively up to the -specified depth. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `A` | `A` | -| `D` | extends `number` = ``1`` | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `this` | `A` | - | -| `depth?` | `D` | The maximum recursion depth | - -#### Returns - -`FlatArray`<`A`, `D`\>[] - -#### Inherited from - -Array.flat - -#### Defined in - -node_modules/typescript/lib/lib.es2019.array.d.ts:81 - -___ - -### flatMap - -▸ **flatMap**<`U`, `This`\>(`callback`, `thisArg?`): `U`[] - -Calls a defined callback function on each element of an array. Then, flattens the result into -a new array. -This is identical to a map followed by flat with depth 1. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `U` | `U` | -| `This` | `undefined` | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `callback` | (`this`: `This`, `value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `U` \| readonly `U`[] | A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array. | -| `thisArg?` | `This` | An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value. | - -#### Returns - -`U`[] - -#### Inherited from - -Array.flatMap - -#### Defined in - -node_modules/typescript/lib/lib.es2019.array.d.ts:70 - -___ - -### forEach - -▸ **forEach**(`callbackfn`, `thisArg?`): `void` - -Performs the specified action for each element in an array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `callbackfn` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `void` | A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. | -| `thisArg?` | `any` | An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. | - -#### Returns - -`void` - -#### Inherited from - -Array.forEach - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1410 - -___ - -### includes - -▸ **includes**(`searchElement`, `fromIndex?`): `boolean` - -Determines whether an array includes a certain element, returning true or false as appropriate. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `searchElement` | `Uint8Array` \| `Uint8Array`[] | The element to search for. | -| `fromIndex?` | `number` | The position in this array at which to begin searching for searchElement. | - -#### Returns - -`boolean` - -#### Inherited from - -Array.includes - -#### Defined in - -node_modules/typescript/lib/lib.es2016.array.include.d.ts:27 - -___ - -### indexOf - -▸ **indexOf**(`searchElement`, `fromIndex?`): `number` - -Returns the index of the first occurrence of a value in an array, or -1 if it is not present. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `searchElement` | `Uint8Array` \| `Uint8Array`[] | The value to locate in the array. | -| `fromIndex?` | `number` | The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. | - -#### Returns - -`number` - -#### Inherited from - -Array.indexOf - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1371 - -___ - -### join - -▸ **join**(`separator?`): `string` - -Adds all the elements of an array into a string, separated by the specified separator string. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `separator?` | `string` | A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. | - -#### Returns - -`string` - -#### Inherited from - -Array.join - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1314 - -___ - -### keys - -▸ **keys**(): `IterableIterator`<`number`\> - -Returns an iterable of keys in the array - -#### Returns - -`IterableIterator`<`number`\> - -#### Inherited from - -Array.keys - -#### Defined in - -node_modules/typescript/lib/lib.es2015.iterable.d.ts:70 - -___ - -### lastIndexOf - -▸ **lastIndexOf**(`searchElement`, `fromIndex?`): `number` - -Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `searchElement` | `Uint8Array` \| `Uint8Array`[] | The value to locate in the array. | -| `fromIndex?` | `number` | The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. | - -#### Returns - -`number` - -#### Inherited from - -Array.lastIndexOf - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1377 - -___ - -### map - -▸ **map**<`U`\>(`callbackfn`, `thisArg?`): `U`[] - -Calls a defined callback function on each element of an array, and returns an array that contains the results. - -#### Type parameters - -| Name | -| :------ | -| `U` | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `callbackfn` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `U` | A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. | -| `thisArg?` | `any` | An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. | - -#### Returns - -`U`[] - -#### Inherited from - -Array.map - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1416 - -___ - -### pop - -▸ **pop**(): `undefined` \| `Uint8Array` \| `Uint8Array`[] - -Removes the last element from an array and returns it. -If the array is empty, undefined is returned and the array is not modified. - -#### Returns - -`undefined` \| `Uint8Array` \| `Uint8Array`[] - -#### Inherited from - -Array.pop - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1292 - -___ - -### push - -▸ **push**(...`items`): `number` - -Appends new elements to the end of an array, and returns the new length of the array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...items` | (`Uint8Array` \| `Uint8Array`[])[] | New elements to add to the array. | - -#### Returns - -`number` - -#### Inherited from - -Array.push - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1297 - -___ - -### reduce - -▸ **reduce**(`callbackfn`): `Uint8Array` \| `Uint8Array`[] - -Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `callbackfn` | (`previousValue`: `Uint8Array` \| `Uint8Array`[], `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `Uint8Array` \| `Uint8Array`[] | A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. | - -#### Returns - -`Uint8Array` \| `Uint8Array`[] - -#### Inherited from - -Array.reduce - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1434 - -▸ **reduce**(`callbackfn`, `initialValue`): `Uint8Array` \| `Uint8Array`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `callbackfn` | (`previousValue`: `Uint8Array` \| `Uint8Array`[], `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `Uint8Array` \| `Uint8Array`[] | -| `initialValue` | `Uint8Array` \| `Uint8Array`[] | - -#### Returns - -`Uint8Array` \| `Uint8Array`[] - -#### Inherited from - -Array.reduce - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1435 - -▸ **reduce**<`U`\>(`callbackfn`, `initialValue`): `U` - -Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - -#### Type parameters - -| Name | -| :------ | -| `U` | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `callbackfn` | (`previousValue`: `U`, `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `U` | A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. | -| `initialValue` | `U` | If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. | - -#### Returns - -`U` - -#### Inherited from - -Array.reduce - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1441 - -___ - -### reduceRight - -▸ **reduceRight**(`callbackfn`): `Uint8Array` \| `Uint8Array`[] - -Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `callbackfn` | (`previousValue`: `Uint8Array` \| `Uint8Array`[], `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `Uint8Array` \| `Uint8Array`[] | A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. | - -#### Returns - -`Uint8Array` \| `Uint8Array`[] - -#### Inherited from - -Array.reduceRight - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1447 - -▸ **reduceRight**(`callbackfn`, `initialValue`): `Uint8Array` \| `Uint8Array`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `callbackfn` | (`previousValue`: `Uint8Array` \| `Uint8Array`[], `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `Uint8Array` \| `Uint8Array`[] | -| `initialValue` | `Uint8Array` \| `Uint8Array`[] | - -#### Returns - -`Uint8Array` \| `Uint8Array`[] - -#### Inherited from - -Array.reduceRight - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1448 - -▸ **reduceRight**<`U`\>(`callbackfn`, `initialValue`): `U` - -Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - -#### Type parameters - -| Name | -| :------ | -| `U` | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `callbackfn` | (`previousValue`: `U`, `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `U` | A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. | -| `initialValue` | `U` | If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. | - -#### Returns - -`U` - -#### Inherited from - -Array.reduceRight - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1454 - -___ - -### reverse - -▸ **reverse**(): (`Uint8Array` \| `Uint8Array`[])[] - -Reverses the elements in an array in place. -This method mutates the array and returns a reference to the same array. - -#### Returns - -(`Uint8Array` \| `Uint8Array`[])[] - -#### Inherited from - -Array.reverse - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1319 - -___ - -### shift - -▸ **shift**(): `undefined` \| `Uint8Array` \| `Uint8Array`[] - -Removes the first element from an array and returns it. -If the array is empty, undefined is returned and the array is not modified. - -#### Returns - -`undefined` \| `Uint8Array` \| `Uint8Array`[] - -#### Inherited from - -Array.shift - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1324 - -___ - -### slice - -▸ **slice**(`start?`, `end?`): (`Uint8Array` \| `Uint8Array`[])[] - -Returns a copy of a section of an array. -For both start and end, a negative index can be used to indicate an offset from the end of the array. -For example, -2 refers to the second to last element of the array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `start?` | `number` | The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0. | -| `end?` | `number` | The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array. | - -#### Returns - -(`Uint8Array` \| `Uint8Array`[])[] - -#### Inherited from - -Array.slice - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1334 - -___ - -### some - -▸ **some**(`predicate`, `thisArg?`): `boolean` - -Determines whether the specified callback function returns true for any element of an array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array. | -| `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | - -#### Returns - -`boolean` - -#### Inherited from - -Array.some - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1404 - -___ - -### sort - -▸ **sort**(`compareFn?`): [`StatusMsg`](ETH.StatusMsg.md) - -Sorts an array in place. -This method mutates the array and returns a reference to the same array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `compareFn?` | (`a`: `Uint8Array` \| `Uint8Array`[], `b`: `Uint8Array` \| `Uint8Array`[]) => `number` | Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. ```ts [11,2,22,1].sort((a, b) => a - b) ``` | - -#### Returns - -[`StatusMsg`](ETH.StatusMsg.md) - -#### Inherited from - -Array.sort - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1345 - -___ - -### splice - -▸ **splice**(`start`, `deleteCount?`): (`Uint8Array` \| `Uint8Array`[])[] - -Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `start` | `number` | The zero-based location in the array from which to start removing elements. | -| `deleteCount?` | `number` | The number of elements to remove. | - -#### Returns - -(`Uint8Array` \| `Uint8Array`[])[] - -An array containing the elements that were deleted. - -#### Inherited from - -Array.splice - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1352 - -▸ **splice**(`start`, `deleteCount`, ...`items`): (`Uint8Array` \| `Uint8Array`[])[] - -Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `start` | `number` | The zero-based location in the array from which to start removing elements. | -| `deleteCount` | `number` | The number of elements to remove. | -| `...items` | (`Uint8Array` \| `Uint8Array`[])[] | Elements to insert into the array in place of the deleted elements. | - -#### Returns - -(`Uint8Array` \| `Uint8Array`[])[] - -An array containing the elements that were deleted. - -#### Inherited from - -Array.splice - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1360 - -___ - -### toLocaleString - -▸ **toLocaleString**(): `string` - -Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. - -#### Returns - -`string` - -#### Inherited from - -Array.toLocaleString - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1287 - -___ - -### toString - -▸ **toString**(): `string` - -Returns a string representation of an array. - -#### Returns - -`string` - -#### Inherited from - -Array.toString - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1283 - -___ - -### unshift - -▸ **unshift**(...`items`): `number` - -Inserts new elements at the start of an array, and returns the new length of the array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...items` | (`Uint8Array` \| `Uint8Array`[])[] | Elements to insert at the start of the array. | - -#### Returns - -`number` - -#### Inherited from - -Array.unshift - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1365 - -___ - -### values - -▸ **values**(): `IterableIterator`<`Uint8Array` \| `Uint8Array`[]\> - -Returns an iterable of values in the array - -#### Returns - -`IterableIterator`<`Uint8Array` \| `Uint8Array`[]\> - -#### Inherited from - -Array.values - -#### Defined in - -node_modules/typescript/lib/lib.es2015.iterable.d.ts:75 diff --git a/packages/devp2p/docs/interfaces/EthStatusMsg.md b/packages/devp2p/docs/interfaces/EthStatusMsg.md new file mode 100644 index 00000000000..4100c925cf5 --- /dev/null +++ b/packages/devp2p/docs/interfaces/EthStatusMsg.md @@ -0,0 +1,1575 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / EthStatusMsg + +# Interface: EthStatusMsg + +Defined in: [packages/devp2p/src/protocol/eth.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L25) + +## Extends + +- `Array`\<`Uint8Array` \| `Uint8Array`[]\> + +## Indexable + +\[`n`: `number`\]: `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +## Properties + +### \[unscopables\] + +> `readonly` **\[unscopables\]**: `object` + +Defined in: node\_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:97 + +Is an object whose properties have the value 'true' +when they will be absent when used in a 'with' statement. + +#### Index Signature + +\[`key`: `number`\]: `undefined` \| `boolean` + +#### \[iterator\]? + +> `optional` **\[iterator\]**: `boolean` + +#### \[unscopables\]? + +> `readonly` `optional` **\[unscopables\]**: `boolean` + +Is an object whose properties have the value 'true' +when they will be absent when used in a 'with' statement. + +#### at? + +> `optional` **at**: `boolean` + +#### concat? + +> `optional` **concat**: `boolean` + +#### copyWithin? + +> `optional` **copyWithin**: `boolean` + +#### entries? + +> `optional` **entries**: `boolean` + +#### every? + +> `optional` **every**: `boolean` + +#### fill? + +> `optional` **fill**: `boolean` + +#### filter? + +> `optional` **filter**: `boolean` + +#### find? + +> `optional` **find**: `boolean` + +#### findIndex? + +> `optional` **findIndex**: `boolean` + +#### flat? + +> `optional` **flat**: `boolean` + +#### flatMap? + +> `optional` **flatMap**: `boolean` + +#### forEach? + +> `optional` **forEach**: `boolean` + +#### includes? + +> `optional` **includes**: `boolean` + +#### indexOf? + +> `optional` **indexOf**: `boolean` + +#### join? + +> `optional` **join**: `boolean` + +#### keys? + +> `optional` **keys**: `boolean` + +#### lastIndex? + +> `readonly` `optional` **lastIndex**: `boolean` + +#### lastIndexOf? + +> `optional` **lastIndexOf**: `boolean` + +#### lastItem? + +> `optional` **lastItem**: `boolean` + +#### length? + +> `optional` **length**: `boolean` + +Gets or sets the length of the array. This is a number one higher than the highest index in the array. + +#### map? + +> `optional` **map**: `boolean` + +#### pop? + +> `optional` **pop**: `boolean` + +#### push? + +> `optional` **push**: `boolean` + +#### reduce? + +> `optional` **reduce**: `boolean` + +#### reduceRight? + +> `optional` **reduceRight**: `boolean` + +#### reverse? + +> `optional` **reverse**: `boolean` + +#### shift? + +> `optional` **shift**: `boolean` + +#### slice? + +> `optional` **slice**: `boolean` + +#### some? + +> `optional` **some**: `boolean` + +#### sort? + +> `optional` **sort**: `boolean` + +#### splice? + +> `optional` **splice**: `boolean` + +#### toLocaleString? + +> `optional` **toLocaleString**: `boolean` + +#### toString? + +> `optional` **toString**: `boolean` + +#### turn? + +> `optional` **turn**: `boolean` + +#### unshift? + +> `optional` **unshift**: `boolean` + +#### values? + +> `optional` **values**: `boolean` + +#### Inherited from + +`Array.[unscopables]` + +*** + +### lastIndex + +> `readonly` **lastIndex**: `number` + +Defined in: node\_modules/@types/core-js/index.d.ts:82 + +#### Inherited from + +`Array.lastIndex` + +*** + +### lastItem + +> **lastItem**: `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/@types/core-js/index.d.ts:81 + +#### Inherited from + +`Array.lastItem` + +*** + +### length + +> **length**: `number` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1326 + +Gets or sets the length of the array. This is a number one higher than the highest index in the array. + +#### Inherited from + +`Array.length` + +## Methods + +### \[iterator\]() + +> **\[iterator\]**(): `ArrayIterator`\<`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[]\> + +Defined in: node\_modules/typescript/lib/lib.es2015.iterable.d.ts:78 + +Iterator + +#### Returns + +`ArrayIterator`\<`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[]\> + +#### Inherited from + +`Array.[iterator]` + +*** + +### at() + +> **at**(`index`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/@types/node/compatibility/indexable.d.ts:7 + +#### Parameters + +##### index + +`number` + +#### Returns + +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +#### Inherited from + +`Array.at` + +*** + +### concat() + +#### Call Signature + +> **concat**(...`items`): (`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1350 + +Combines two or more arrays. +This method returns a new array without modifying any existing arrays. + +##### Parameters + +###### items + +...`ConcatArray`\<`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[]\>[] + +Additional arrays and/or items to add to the end of the array. + +##### Returns + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +##### Inherited from + +`Array.concat` + +#### Call Signature + +> **concat**(...`items`): (`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1356 + +Combines two or more arrays. +This method returns a new array without modifying any existing arrays. + +##### Parameters + +###### items + +...(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] \| `ConcatArray`\<`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[]\>)[] + +Additional arrays and/or items to add to the end of the array. + +##### Returns + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +##### Inherited from + +`Array.concat` + +*** + +### copyWithin() + +> **copyWithin**(`target`, `start`, `end?`): `this` + +Defined in: node\_modules/typescript/lib/lib.es2015.core.d.ts:62 + +Returns the this object after copying a section of the array identified by start and end +to the same array starting at position target + +#### Parameters + +##### target + +`number` + +If target is negative, it is treated as length+target where length is the +length of the array. + +##### start + +`number` + +If start is negative, it is treated as length+start. If end is negative, it +is treated as length+end. + +##### end? + +`number` + +If not specified, length of the this object is used as its default value. + +#### Returns + +`this` + +#### Inherited from + +`Array.copyWithin` + +*** + +### entries() + +> **entries**(): `ArrayIterator`\<\[`number`, `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[]\]\> + +Defined in: node\_modules/typescript/lib/lib.es2015.iterable.d.ts:83 + +Returns an iterable of key, value pairs for every entry in the array + +#### Returns + +`ArrayIterator`\<\[`number`, `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[]\]\> + +#### Inherited from + +`Array.entries` + +*** + +### every() + +#### Call Signature + +> **every**\<`S`\>(`predicate`, `thisArg?`): `this is S[]` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1433 + +Determines whether all the members of an array satisfy the specified test. + +##### Type Parameters + +###### S + +`S` *extends* `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Parameters + +###### predicate + +(`value`, `index`, `array`) => `value is S` + +A function that accepts up to three arguments. The every method calls +the predicate function for each element in the array until the predicate returns a value +which is coercible to the Boolean value false, or until the end of the array. + +###### thisArg? + +`any` + +An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value. + +##### Returns + +`this is S[]` + +##### Inherited from + +`Array.every` + +#### Call Signature + +> **every**(`predicate`, `thisArg?`): `boolean` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1442 + +Determines whether all the members of an array satisfy the specified test. + +##### Parameters + +###### predicate + +(`value`, `index`, `array`) => `unknown` + +A function that accepts up to three arguments. The every method calls +the predicate function for each element in the array until the predicate returns a value +which is coercible to the Boolean value false, or until the end of the array. + +###### thisArg? + +`any` + +An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value. + +##### Returns + +`boolean` + +##### Inherited from + +`Array.every` + +*** + +### fill() + +> **fill**(`value`, `start?`, `end?`): `this` + +Defined in: node\_modules/typescript/lib/lib.es2015.core.d.ts:51 + +Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + +#### Parameters + +##### value + +value to fill array section with + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +##### start? + +`number` + +index to start filling the array at. If start is negative, it is treated as +length+start where length is the length of the array. + +##### end? + +`number` + +index to stop filling the array at. If end is negative, it is treated as +length+end. + +#### Returns + +`this` + +#### Inherited from + +`Array.fill` + +*** + +### filter() + +#### Call Signature + +> **filter**\<`S`\>(`predicate`, `thisArg?`): `S`[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1469 + +Returns the elements of an array that meet the condition specified in a callback function. + +##### Type Parameters + +###### S + +`S` *extends* `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Parameters + +###### predicate + +(`value`, `index`, `array`) => `value is S` + +A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + +###### thisArg? + +`any` + +An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + +##### Returns + +`S`[] + +##### Inherited from + +`Array.filter` + +#### Call Signature + +> **filter**(`predicate`, `thisArg?`): (`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1475 + +Returns the elements of an array that meet the condition specified in a callback function. + +##### Parameters + +###### predicate + +(`value`, `index`, `array`) => `unknown` + +A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + +###### thisArg? + +`any` + +An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + +##### Returns + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +##### Inherited from + +`Array.filter` + +*** + +### find() + +#### Call Signature + +> **find**\<`S`\>(`predicate`, `thisArg?`): `undefined` \| `S` + +Defined in: node\_modules/typescript/lib/lib.es2015.core.d.ts:29 + +Returns the value of the first element in the array where predicate is true, and undefined +otherwise. + +##### Type Parameters + +###### S + +`S` *extends* `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Parameters + +###### predicate + +(`value`, `index`, `obj`) => `value is S` + +find calls predicate once for each element of the array, in ascending +order, until it finds one where predicate returns true. If such an element is found, find +immediately returns that element value. Otherwise, find returns undefined. + +###### thisArg? + +`any` + +If provided, it will be used as the this value for each invocation of +predicate. If it is not provided, undefined is used instead. + +##### Returns + +`undefined` \| `S` + +##### Inherited from + +`Array.find` + +#### Call Signature + +> **find**(`predicate`, `thisArg?`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/typescript/lib/lib.es2015.core.d.ts:30 + +##### Parameters + +###### predicate + +(`value`, `index`, `obj`) => `unknown` + +###### thisArg? + +`any` + +##### Returns + +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Inherited from + +`Array.find` + +*** + +### findIndex() + +> **findIndex**(`predicate`, `thisArg?`): `number` + +Defined in: node\_modules/typescript/lib/lib.es2015.core.d.ts:41 + +Returns the index of the first element in the array where predicate is true, and -1 +otherwise. + +#### Parameters + +##### predicate + +(`value`, `index`, `obj`) => `unknown` + +find calls predicate once for each element of the array, in ascending +order, until it finds one where predicate returns true. If such an element is found, +findIndex immediately returns that element index. Otherwise, findIndex returns -1. + +##### thisArg? + +`any` + +If provided, it will be used as the this value for each invocation of +predicate. If it is not provided, undefined is used instead. + +#### Returns + +`number` + +#### Inherited from + +`Array.findIndex` + +*** + +### flat() + +> **flat**\<`A`, `D`\>(`this`, `depth?`): `FlatArray`\<`A`, `D`\>[] + +Defined in: node\_modules/typescript/lib/lib.es2019.array.d.ts:75 + +Returns a new array with all sub-array elements concatenated into it recursively up to the +specified depth. + +#### Type Parameters + +##### A + +`A` + +##### D + +`D` *extends* `number` = `1` + +#### Parameters + +##### this + +`A` + +##### depth? + +`D` + +The maximum recursion depth + +#### Returns + +`FlatArray`\<`A`, `D`\>[] + +#### Inherited from + +`Array.flat` + +*** + +### flatMap() + +> **flatMap**\<`U`, `This`\>(`callback`, `thisArg?`): `U`[] + +Defined in: node\_modules/typescript/lib/lib.es2019.array.d.ts:64 + +Calls a defined callback function on each element of an array. Then, flattens the result into +a new array. +This is identical to a map followed by flat with depth 1. + +#### Type Parameters + +##### U + +`U` + +##### This + +`This` = `undefined` + +#### Parameters + +##### callback + +(`this`, `value`, `index`, `array`) => `U` \| readonly `U`[] + +A function that accepts up to three arguments. The flatMap method calls the +callback function one time for each element in the array. + +##### thisArg? + +`This` + +An object to which the this keyword can refer in the callback function. If +thisArg is omitted, undefined is used as the this value. + +#### Returns + +`U`[] + +#### Inherited from + +`Array.flatMap` + +*** + +### forEach() + +> **forEach**(`callbackfn`, `thisArg?`): `void` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1457 + +Performs the specified action for each element in an array. + +#### Parameters + +##### callbackfn + +(`value`, `index`, `array`) => `void` + +A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + +##### thisArg? + +`any` + +An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + +#### Returns + +`void` + +#### Inherited from + +`Array.forEach` + +*** + +### includes() + +> **includes**(`searchElement`, `fromIndex?`): `boolean` + +Defined in: node\_modules/typescript/lib/lib.es2016.array.include.d.ts:25 + +Determines whether an array includes a certain element, returning true or false as appropriate. + +#### Parameters + +##### searchElement + +The element to search for. + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +##### fromIndex? + +`number` + +The position in this array at which to begin searching for searchElement. + +#### Returns + +`boolean` + +#### Inherited from + +`Array.includes` + +*** + +### indexOf() + +> **indexOf**(`searchElement`, `fromIndex?`): `number` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1418 + +Returns the index of the first occurrence of a value in an array, or -1 if it is not present. + +#### Parameters + +##### searchElement + +The value to locate in the array. + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +##### fromIndex? + +`number` + +The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + +#### Returns + +`number` + +#### Inherited from + +`Array.indexOf` + +*** + +### join() + +> **join**(`separator?`): `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1361 + +Adds all the elements of an array into a string, separated by the specified separator string. + +#### Parameters + +##### separator? + +`string` + +A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. + +#### Returns + +`string` + +#### Inherited from + +`Array.join` + +*** + +### keys() + +> **keys**(): `ArrayIterator`\<`number`\> + +Defined in: node\_modules/typescript/lib/lib.es2015.iterable.d.ts:88 + +Returns an iterable of keys in the array + +#### Returns + +`ArrayIterator`\<`number`\> + +#### Inherited from + +`Array.keys` + +*** + +### lastIndexOf() + +> **lastIndexOf**(`searchElement`, `fromIndex?`): `number` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1424 + +Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. + +#### Parameters + +##### searchElement + +The value to locate in the array. + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +##### fromIndex? + +`number` + +The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. + +#### Returns + +`number` + +#### Inherited from + +`Array.lastIndexOf` + +*** + +### map() + +> **map**\<`U`\>(`callbackfn`, `thisArg?`): `U`[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1463 + +Calls a defined callback function on each element of an array, and returns an array that contains the results. + +#### Type Parameters + +##### U + +`U` + +#### Parameters + +##### callbackfn + +(`value`, `index`, `array`) => `U` + +A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + +##### thisArg? + +`any` + +An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + +#### Returns + +`U`[] + +#### Inherited from + +`Array.map` + +*** + +### pop() + +> **pop**(): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1339 + +Removes the last element from an array and returns it. +If the array is empty, undefined is returned and the array is not modified. + +#### Returns + +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +#### Inherited from + +`Array.pop` + +*** + +### push() + +> **push**(...`items`): `number` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1344 + +Appends new elements to the end of an array, and returns the new length of the array. + +#### Parameters + +##### items + +...(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +New elements to add to the array. + +#### Returns + +`number` + +#### Inherited from + +`Array.push` + +*** + +### reduce() + +#### Call Signature + +> **reduce**(`callbackfn`): `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1481 + +Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + +##### Parameters + +###### callbackfn + +(`previousValue`, `currentValue`, `currentIndex`, `array`) => `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + +##### Returns + +`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Inherited from + +`Array.reduce` + +#### Call Signature + +> **reduce**(`callbackfn`, `initialValue`): `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1482 + +##### Parameters + +###### callbackfn + +(`previousValue`, `currentValue`, `currentIndex`, `array`) => `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +###### initialValue + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Returns + +`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Inherited from + +`Array.reduce` + +#### Call Signature + +> **reduce**\<`U`\>(`callbackfn`, `initialValue`): `U` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1488 + +Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + +##### Type Parameters + +###### U + +`U` + +##### Parameters + +###### callbackfn + +(`previousValue`, `currentValue`, `currentIndex`, `array`) => `U` + +A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + +###### initialValue + +`U` + +If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + +##### Returns + +`U` + +##### Inherited from + +`Array.reduce` + +*** + +### reduceRight() + +#### Call Signature + +> **reduceRight**(`callbackfn`): `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1494 + +Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + +##### Parameters + +###### callbackfn + +(`previousValue`, `currentValue`, `currentIndex`, `array`) => `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + +##### Returns + +`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Inherited from + +`Array.reduceRight` + +#### Call Signature + +> **reduceRight**(`callbackfn`, `initialValue`): `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1495 + +##### Parameters + +###### callbackfn + +(`previousValue`, `currentValue`, `currentIndex`, `array`) => `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +###### initialValue + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Returns + +`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +##### Inherited from + +`Array.reduceRight` + +#### Call Signature + +> **reduceRight**\<`U`\>(`callbackfn`, `initialValue`): `U` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1501 + +Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + +##### Type Parameters + +###### U + +`U` + +##### Parameters + +###### callbackfn + +(`previousValue`, `currentValue`, `currentIndex`, `array`) => `U` + +A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + +###### initialValue + +`U` + +If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + +##### Returns + +`U` + +##### Inherited from + +`Array.reduceRight` + +*** + +### reverse() + +> **reverse**(): (`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1366 + +Reverses the elements in an array in place. +This method mutates the array and returns a reference to the same array. + +#### Returns + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +#### Inherited from + +`Array.reverse` + +*** + +### shift() + +> **shift**(): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1371 + +Removes the first element from an array and returns it. +If the array is empty, undefined is returned and the array is not modified. + +#### Returns + +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +#### Inherited from + +`Array.shift` + +*** + +### slice() + +> **slice**(`start?`, `end?`): (`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1381 + +Returns a copy of a section of an array. +For both start and end, a negative index can be used to indicate an offset from the end of the array. +For example, -2 refers to the second to last element of the array. + +#### Parameters + +##### start? + +`number` + +The beginning index of the specified portion of the array. +If start is undefined, then the slice begins at index 0. + +##### end? + +`number` + +The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. +If end is undefined, then the slice extends to the end of the array. + +#### Returns + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +#### Inherited from + +`Array.slice` + +*** + +### some() + +> **some**(`predicate`, `thisArg?`): `boolean` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1451 + +Determines whether the specified callback function returns true for any element of an array. + +#### Parameters + +##### predicate + +(`value`, `index`, `array`) => `unknown` + +A function that accepts up to three arguments. The some method calls +the predicate function for each element in the array until the predicate returns a value +which is coercible to the Boolean value true, or until the end of the array. + +##### thisArg? + +`any` + +An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value. + +#### Returns + +`boolean` + +#### Inherited from + +`Array.some` + +*** + +### sort() + +> **sort**(`compareFn?`): `this` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1392 + +Sorts an array in place. +This method mutates the array and returns a reference to the same array. + +#### Parameters + +##### compareFn? + +(`a`, `b`) => `number` + +Function used to determine the order of the elements. It is expected to return +a negative value if the first argument is less than the second argument, zero if they're equal, and a positive +value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order. +```ts +[11,2,22,1].sort((a, b) => a - b) +``` + +#### Returns + +`this` + +#### Inherited from + +`Array.sort` + +*** + +### splice() + +#### Call Signature + +> **splice**(`start`, `deleteCount?`): (`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1399 + +Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + +##### Parameters + +###### start + +`number` + +The zero-based location in the array from which to start removing elements. + +###### deleteCount? + +`number` + +The number of elements to remove. + +##### Returns + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +An array containing the elements that were deleted. + +##### Inherited from + +`Array.splice` + +#### Call Signature + +> **splice**(`start`, `deleteCount`, ...`items`): (`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1407 + +Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + +##### Parameters + +###### start + +`number` + +The zero-based location in the array from which to start removing elements. + +###### deleteCount + +`number` + +The number of elements to remove. + +###### items + +...(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Elements to insert into the array in place of the deleted elements. + +##### Returns + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +An array containing the elements that were deleted. + +##### Inherited from + +`Array.splice` + +*** + +### toLocaleString() + +#### Call Signature + +> **toLocaleString**(): `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1334 + +Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. + +##### Returns + +`string` + +##### Inherited from + +`Array.toLocaleString` + +#### Call Signature + +> **toLocaleString**(`locales`, `options?`): `string` + +Defined in: node\_modules/typescript/lib/lib.es2015.core.d.ts:64 + +##### Parameters + +###### locales + +`string` | `string`[] + +###### options? + +`NumberFormatOptions` & `DateTimeFormatOptions` + +##### Returns + +`string` + +##### Inherited from + +`Array.toLocaleString` + +*** + +### toString() + +> **toString**(): `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1330 + +Returns a string representation of an array. + +#### Returns + +`string` + +#### Inherited from + +`Array.toString` + +*** + +### turn() + +#### Call Signature + +> **turn**\<`U`\>(`callbackfn`, `memo?`): `U` + +Defined in: node\_modules/@types/core-js/index.d.ts:463 + +Non-standard. + +##### Type Parameters + +###### U + +`U` + +##### Parameters + +###### callbackfn + +(`memo`, `value`, `index`, `array`) => `void` + +###### memo? + +`U` + +##### Returns + +`U` + +##### Inherited from + +`Array.turn` + +#### Call Signature + +> **turn**(`callbackfn`, `memo?`): (`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Defined in: node\_modules/@types/core-js/index.d.ts:468 + +Non-standard. + +##### Parameters + +###### callbackfn + +(`memo`, `value`, `index`, `array`) => `void` + +###### memo? + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +##### Returns + +(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +##### Inherited from + +`Array.turn` + +*** + +### unshift() + +> **unshift**(...`items`): `number` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1412 + +Inserts new elements at the start of an array, and returns the new length of the array. + +#### Parameters + +##### items + +...(`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[])[] + +Elements to insert at the start of the array. + +#### Returns + +`number` + +#### Inherited from + +`Array.unshift` + +*** + +### values() + +> **values**(): `ArrayIterator`\<`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[]\> + +Defined in: node\_modules/typescript/lib/lib.es2015.iterable.d.ts:93 + +Returns an iterable of values in the array + +#### Returns + +`ArrayIterator`\<`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[]\> + +#### Inherited from + +`Array.values` diff --git a/packages/devp2p/docs/interfaces/KBucketEvent.md b/packages/devp2p/docs/interfaces/KBucketEvent.md new file mode 100644 index 00000000000..2e7daacfce5 --- /dev/null +++ b/packages/devp2p/docs/interfaces/KBucketEvent.md @@ -0,0 +1,41 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / KBucketEvent + +# Interface: KBucketEvent + +Defined in: [packages/devp2p/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L36) + +## Properties + +### added + +> **added**: \[[`PeerInfo`](PeerInfo.md)\] + +Defined in: [packages/devp2p/src/types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L39) + +*** + +### ping + +> **ping**: \[[`Contact`](Contact.md)[], [`PeerInfo`](PeerInfo.md)\] + +Defined in: [packages/devp2p/src/types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L37) + +*** + +### removed + +> **removed**: \[[`PeerInfo`](PeerInfo.md)\] + +Defined in: [packages/devp2p/src/types.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L40) + +*** + +### updated + +> **updated**: \[[`Contact`](Contact.md), [`Contact`](Contact.md)\] + +Defined in: [packages/devp2p/src/types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L38) diff --git a/packages/devp2p/docs/interfaces/KBucketOptions.md b/packages/devp2p/docs/interfaces/KBucketOptions.md index a3b2d3f79d8..1b727387ffe 100644 --- a/packages/devp2p/docs/interfaces/KBucketOptions.md +++ b/packages/devp2p/docs/interfaces/KBucketOptions.md @@ -1,125 +1,106 @@ -[@ethereumjs/devp2p](../README.md) / KBucketOptions +[**@ethereumjs/devp2p**](../README.md) -# Interface: KBucketOptions +*** -## Table of contents +[@ethereumjs/devp2p](../README.md) / KBucketOptions -### Properties +# Interface: KBucketOptions -- [arbiter](KBucketOptions.md#arbiter) -- [distance](KBucketOptions.md#distance) -- [localNodeId](KBucketOptions.md#localnodeid) -- [metadata](KBucketOptions.md#metadata) -- [numberOfNodesPerKBucket](KBucketOptions.md#numberofnodesperkbucket) -- [numberOfNodesToPing](KBucketOptions.md#numberofnodestoping) +Defined in: [packages/devp2p/src/types.ts:230](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L230) ## Properties -### arbiter - -• `Optional` **arbiter**: (`incumbent`: [`Contact`](Contact.md), `candidate`: [`Contact`](Contact.md)) => [`Contact`](Contact.md) +### arbiter()? -#### Type declaration +> `optional` **arbiter**: (`incumbent`, `candidate`) => [`Contact`](Contact.md) -▸ (`incumbent`, `candidate`): [`Contact`](Contact.md) +Defined in: [packages/devp2p/src/types.ts:256](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L256) An optional arbiter function that given two `contact` objects with the same `id`, returns the desired object to be used for updating the k-bucket. Defaults to vectorClock arbiter function. -##### Parameters +#### Parameters -| Name | Type | -| :------ | :------ | -| `incumbent` | [`Contact`](Contact.md) | -| `candidate` | [`Contact`](Contact.md) | - -##### Returns +##### incumbent [`Contact`](Contact.md) -#### Defined in +##### candidate + +[`Contact`](Contact.md) -[packages/devp2p/src/types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L162) +#### Returns -___ +[`Contact`](Contact.md) -### distance +*** -• `Optional` **distance**: (`firstId`: `Uint8Array`, `secondId`: `Uint8Array`) => `number` +### distance()? -#### Type declaration +> `optional` **distance**: (`firstId`, `secondId`) => `number` -▸ (`firstId`, `secondId`): `number` +Defined in: [packages/devp2p/src/types.ts:250](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L250) An optional distance function that gets two id Uint8Arrays and return distance between them as a number. -##### Parameters +#### Parameters -| Name | Type | -| :------ | :------ | -| `firstId` | `Uint8Array` | -| `secondId` | `Uint8Array` | +##### firstId -##### Returns +`Uint8Array` -`number` +##### secondId + +`Uint8Array` -#### Defined in +#### Returns -[packages/devp2p/src/types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L156) +`number` -___ +*** -### localNodeId +### localNodeId? -• `Optional` **localNodeId**: `Uint8Array` +> `optional` **localNodeId**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/devp2p/src/types.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L235) An optional Uint8Array representing the local node id. If not provided, a local node id will be created via `randomBytes(20)`. -#### Defined in - -[packages/devp2p/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L141) +*** -___ +### metadata? -### metadata +> `optional` **metadata**: `object` -• `Optional` **metadata**: `object` +Defined in: [packages/devp2p/src/types.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L263) Optional satellite data to include with the k-bucket. `metadata` property is guaranteed not be altered by, it is provided as an explicit container for users of k-bucket to store implementation-specific data. -#### Defined in +*** -[packages/devp2p/src/types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L169) +### numberOfNodesPerKBucket? -___ +> `optional` **numberOfNodesPerKBucket**: `number` -### numberOfNodesPerKBucket - -• `Optional` **numberOfNodesPerKBucket**: `number` +Defined in: [packages/devp2p/src/types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L240) The number of nodes that a k-bucket can contain before being full or split. Defaults to 20. -#### Defined in - -[packages/devp2p/src/types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L146) +*** -___ +### numberOfNodesToPing? -### numberOfNodesToPing +> `optional` **numberOfNodesToPing**: `number` -• `Optional` **numberOfNodesToPing**: `number` +Defined in: [packages/devp2p/src/types.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L246) The number of nodes to ping when a bucket that should not be split becomes full. KBucket will emit a `ping` event that contains `numberOfNodesToPing` nodes that have not been contacted the longest. Defaults to 3. - -#### Defined in - -[packages/devp2p/src/types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L152) diff --git a/packages/devp2p/docs/interfaces/LES.Status.md b/packages/devp2p/docs/interfaces/LES.Status.md deleted file mode 100644 index fff4cf9e959..00000000000 --- a/packages/devp2p/docs/interfaces/LES.Status.md +++ /dev/null @@ -1,190 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / [LES](../modules/LES.md) / Status - -# Interface: Status - -[LES](../modules/LES.md).Status - -## Indexable - -▪ [key: `string`]: `any` - -## Table of contents - -### Properties - -- [announceType](LES.Status.md#announcetype) -- [flowControl/BL](LES.Status.md#flowcontrol/bl) -- [flowControl/MRC](LES.Status.md#flowcontrol/mrc) -- [flowControl/MRR](LES.Status.md#flowcontrol/mrr) -- [forkID](LES.Status.md#forkid) -- [genesisHash](LES.Status.md#genesishash) -- [headHash](LES.Status.md#headhash) -- [headNum](LES.Status.md#headnum) -- [headTd](LES.Status.md#headtd) -- [networkId](LES.Status.md#networkid) -- [protocolVersion](LES.Status.md#protocolversion) -- [recentTxLookup](LES.Status.md#recenttxlookup) -- [serveChainSince](LES.Status.md#servechainsince) -- [serveHeaders](LES.Status.md#serveheaders) -- [serveStateSince](LES.Status.md#servestatesince) -- [txRelay](LES.Status.md#txrelay) - -## Properties - -### announceType - -• **announceType**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L296) - -___ - -### flowControl/BL - -• **flowControl/BL**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L293) - -___ - -### flowControl/MRC - -• **flowControl/MRC**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:295](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L295) - -___ - -### flowControl/MRR - -• **flowControl/MRR**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:294](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L294) - -___ - -### forkID - -• **forkID**: [`Uint8Array`, `Uint8Array`] - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L297) - -___ - -### genesisHash - -• **genesisHash**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L288) - -___ - -### headHash - -• **headHash**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:286](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L286) - -___ - -### headNum - -• **headNum**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L287) - -___ - -### headTd - -• **headTd**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L285) - -___ - -### networkId - -• **networkId**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L284) - -___ - -### protocolVersion - -• **protocolVersion**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L283) - -___ - -### recentTxLookup - -• **recentTxLookup**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:298](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L298) - -___ - -### serveChainSince - -• **serveChainSince**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L290) - -___ - -### serveHeaders - -• **serveHeaders**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L289) - -___ - -### serveStateSince - -• **serveStateSince**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L291) - -___ - -### txRelay - -• **txRelay**: `Uint8Array` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L292) diff --git a/packages/devp2p/docs/interfaces/PeerEvent.md b/packages/devp2p/docs/interfaces/PeerEvent.md new file mode 100644 index 00000000000..e1d3b522895 --- /dev/null +++ b/packages/devp2p/docs/interfaces/PeerEvent.md @@ -0,0 +1,33 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / PeerEvent + +# Interface: PeerEvent + +Defined in: [packages/devp2p/src/types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L19) + +## Properties + +### close + +> **close**: \[`any`, `null` \| `boolean`\] + +Defined in: [packages/devp2p/src/types.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L22) + +*** + +### connect + +> **connect**: `undefined` + +Defined in: [packages/devp2p/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L21) + +*** + +### error + +> **error**: \[`Error`\] + +Defined in: [packages/devp2p/src/types.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L20) diff --git a/packages/devp2p/docs/interfaces/PeerInfo.md b/packages/devp2p/docs/interfaces/PeerInfo.md index 0552ad84222..a293a8b84dc 100644 --- a/packages/devp2p/docs/interfaces/PeerInfo.md +++ b/packages/devp2p/docs/interfaces/PeerInfo.md @@ -1,69 +1,53 @@ -[@ethereumjs/devp2p](../README.md) / PeerInfo - -# Interface: PeerInfo +[**@ethereumjs/devp2p**](../README.md) -## Hierarchy +*** -- **`PeerInfo`** +[@ethereumjs/devp2p](../README.md) / PeerInfo - ↳ [`Contact`](Contact.md) +# Interface: PeerInfo -## Table of contents +Defined in: [packages/devp2p/src/types.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L266) -### Properties +## Extended by -- [address](PeerInfo.md#address) -- [id](PeerInfo.md#id) -- [tcpPort](PeerInfo.md#tcpport) -- [udpPort](PeerInfo.md#udpport) -- [vectorClock](PeerInfo.md#vectorclock) +- [`Contact`](Contact.md) ## Properties -### address - -• `Optional` **address**: `string` - -#### Defined in - -[packages/devp2p/src/types.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L174) - -___ - -### id +### address? -• `Optional` **id**: `Uint8Array` +> `optional` **address**: `string` -#### Defined in +Defined in: [packages/devp2p/src/types.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L268) -[packages/devp2p/src/types.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L173) +*** -___ +### id? -### tcpPort +> `optional` **id**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **tcpPort**: ``null`` \| `number` +Defined in: [packages/devp2p/src/types.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L267) -#### Defined in +*** -[packages/devp2p/src/types.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L176) +### tcpPort? -___ +> `optional` **tcpPort**: `null` \| `number` -### udpPort +Defined in: [packages/devp2p/src/types.ts:270](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L270) -• `Optional` **udpPort**: ``null`` \| `number` +*** -#### Defined in +### udpPort? -[packages/devp2p/src/types.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L175) +> `optional` **udpPort**: `null` \| `number` -___ +Defined in: [packages/devp2p/src/types.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L269) -### vectorClock +*** -• `Optional` **vectorClock**: `number` +### vectorClock? -#### Defined in +> `optional` **vectorClock**: `number` -[packages/devp2p/src/types.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L177) +Defined in: [packages/devp2p/src/types.ts:271](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L271) diff --git a/packages/devp2p/docs/interfaces/PeerOptions.md b/packages/devp2p/docs/interfaces/PeerOptions.md index aafb7e8352f..a0274d0cf1c 100644 --- a/packages/devp2p/docs/interfaces/PeerOptions.md +++ b/packages/devp2p/docs/interfaces/PeerOptions.md @@ -1,129 +1,97 @@ -[@ethereumjs/devp2p](../README.md) / PeerOptions +[**@ethereumjs/devp2p**](../README.md) -# Interface: PeerOptions +*** -## Table of contents +[@ethereumjs/devp2p](../README.md) / PeerOptions -### Properties +# Interface: PeerOptions -- [EIP8](PeerOptions.md#eip8) -- [capabilities](PeerOptions.md#capabilities) -- [clientId](PeerOptions.md#clientid) -- [common](PeerOptions.md#common) -- [id](PeerOptions.md#id) -- [port](PeerOptions.md#port) -- [privateKey](PeerOptions.md#privatekey) -- [remoteClientIdFilter](PeerOptions.md#remoteclientidfilter) -- [remoteId](PeerOptions.md#remoteid) -- [socket](PeerOptions.md#socket) -- [timeout](PeerOptions.md#timeout) +Defined in: [packages/devp2p/src/types.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L279) ## Properties -### EIP8 - -• `Optional` **EIP8**: `boolean` \| `Uint8Array` +### capabilities? -#### Defined in +> `optional` **capabilities**: [`Capabilities`](Capabilities.md)[] -[packages/devp2p/src/types.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L193) +Defined in: [packages/devp2p/src/types.ts:281](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L281) -___ +*** -### capabilities - -• `Optional` **capabilities**: [`Capabilities`](Capabilities.md)[] - -#### Defined in - -[packages/devp2p/src/types.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L187) +### clientId -___ +> **clientId**: `Uint8Array` -### clientId +Defined in: [packages/devp2p/src/types.ts:280](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L280) -• **clientId**: `Uint8Array` +*** -#### Defined in +### common -[packages/devp2p/src/types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L186) +> **common**: `Common` -___ +Defined in: [packages/devp2p/src/types.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L282) -### common +*** -• **common**: `Common` +### EIP8? -#### Defined in +> `optional` **EIP8**: `boolean` \| `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/types.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L188) +Defined in: [packages/devp2p/src/types.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L287) -___ +*** ### id -• **id**: `Uint8Array` - -#### Defined in +> **id**: `Uint8Array` -[packages/devp2p/src/types.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L190) +Defined in: [packages/devp2p/src/types.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L284) -___ +*** ### port -• **port**: `number` +> **port**: `number` -#### Defined in +Defined in: [packages/devp2p/src/types.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L283) -[packages/devp2p/src/types.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L189) - -___ +*** ### privateKey -• **privateKey**: `Uint8Array` - -#### Defined in +> **privateKey**: `Uint8Array` -[packages/devp2p/src/types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L194) +Defined in: [packages/devp2p/src/types.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L288) -___ +*** -### remoteClientIdFilter +### remoteClientIdFilter? -• `Optional` **remoteClientIdFilter**: `string`[] +> `optional` **remoteClientIdFilter**: `string`[] -#### Defined in +Defined in: [packages/devp2p/src/types.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L285) -[packages/devp2p/src/types.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L191) - -___ +*** ### remoteId -• **remoteId**: `Uint8Array` - -#### Defined in +> **remoteId**: `Uint8Array` -[packages/devp2p/src/types.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L192) +Defined in: [packages/devp2p/src/types.ts:286](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L286) -___ +*** ### socket -• **socket**: `Socket` +> **socket**: `Socket` -#### Defined in +Defined in: [packages/devp2p/src/types.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L289) -[packages/devp2p/src/types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L195) - -___ +*** ### timeout -• **timeout**: `number` - -#### Defined in +> **timeout**: `number` -[packages/devp2p/src/types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L196) +Defined in: [packages/devp2p/src/types.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L290) diff --git a/packages/devp2p/docs/interfaces/ProtocolEvent.md b/packages/devp2p/docs/interfaces/ProtocolEvent.md new file mode 100644 index 00000000000..6711805192e --- /dev/null +++ b/packages/devp2p/docs/interfaces/ProtocolEvent.md @@ -0,0 +1,45 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / ProtocolEvent + +# Interface: ProtocolEvent + +Defined in: [packages/devp2p/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L25) + +## Properties + +### message + +> **message**: \[`0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` \| `7` \| `8` \| `9` \| `10` \| `13` \| `14` \| `15` \| `16`, `Uint8Array`\<`ArrayBufferLike`\> \| `NestedUint8Array`\] + +Defined in: [packages/devp2p/src/types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L26) + +*** + +### status + +> **status**: `object` + +Defined in: [packages/devp2p/src/types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L27) + +#### bestHash + +> **bestHash**: `Uint8Array` + +#### chainId + +> **chainId**: `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +#### forkId? + +> `optional` **forkId**: `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +#### genesisHash + +> **genesisHash**: `Uint8Array` + +#### td + +> **td**: `Uint8Array` diff --git a/packages/devp2p/docs/interfaces/RLPxEvent.md b/packages/devp2p/docs/interfaces/RLPxEvent.md new file mode 100644 index 00000000000..08b691122de --- /dev/null +++ b/packages/devp2p/docs/interfaces/RLPxEvent.md @@ -0,0 +1,57 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / RLPxEvent + +# Interface: RLPxEvent + +Defined in: [packages/devp2p/src/types.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L10) + +## Properties + +### close + +> **close**: `undefined` + +Defined in: [packages/devp2p/src/types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L15) + +*** + +### error + +> **error**: \[`Error`\] + +Defined in: [packages/devp2p/src/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L14) + +*** + +### listening + +> **listening**: `undefined` + +Defined in: [packages/devp2p/src/types.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L16) + +*** + +### peer:added + +> **peer:added**: \[[`Peer`](../classes/Peer.md)\] + +Defined in: [packages/devp2p/src/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L11) + +*** + +### peer:error + +> **peer:error**: \[[`Peer`](../classes/Peer.md), `any`\] + +Defined in: [packages/devp2p/src/types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L12) + +*** + +### peer:removed + +> **peer:removed**: \[[`Peer`](../classes/Peer.md), `any`, `null` \| `boolean`\] + +Defined in: [packages/devp2p/src/types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L13) diff --git a/packages/devp2p/docs/interfaces/RLPxOptions.md b/packages/devp2p/docs/interfaces/RLPxOptions.md index e4d66eb4ccb..3aaf633d25e 100644 --- a/packages/devp2p/docs/interfaces/RLPxOptions.md +++ b/packages/devp2p/docs/interfaces/RLPxOptions.md @@ -1,96 +1,73 @@ -[@ethereumjs/devp2p](../README.md) / RLPxOptions +[**@ethereumjs/devp2p**](../README.md) -# Interface: RLPxOptions +*** -## Table of contents +[@ethereumjs/devp2p](../README.md) / RLPxOptions -### Properties +# Interface: RLPxOptions -- [capabilities](RLPxOptions.md#capabilities) -- [clientId](RLPxOptions.md#clientid) -- [common](RLPxOptions.md#common) -- [dpt](RLPxOptions.md#dpt) -- [listenPort](RLPxOptions.md#listenport) -- [maxPeers](RLPxOptions.md#maxpeers) -- [remoteClientIdFilter](RLPxOptions.md#remoteclientidfilter) -- [timeout](RLPxOptions.md#timeout) +Defined in: [packages/devp2p/src/types.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L293) ## Properties ### capabilities -• **capabilities**: [`Capabilities`](Capabilities.md)[] - -#### Defined in - -[packages/devp2p/src/types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L207) +> **capabilities**: [`Capabilities`](Capabilities.md)[] -___ +Defined in: [packages/devp2p/src/types.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L301) -### clientId +*** -• `Optional` **clientId**: `Uint8Array` +### clientId? -#### Defined in +> `optional` **clientId**: `Uint8Array`\<`ArrayBufferLike`\> -[packages/devp2p/src/types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L200) +Defined in: [packages/devp2p/src/types.ts:294](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L294) -___ +*** ### common -• **common**: `Common` - -#### Defined in - -[packages/devp2p/src/types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L208) - -___ - -### dpt - -• `Optional` **dpt**: ``null`` \| [`DPT`](../classes/DPT.md) - -#### Defined in +> **common**: `Common` -[packages/devp2p/src/types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L203) +Defined in: [packages/devp2p/src/types.ts:302](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L302) -___ +*** -### listenPort +### dpt? -• `Optional` **listenPort**: ``null`` \| `number` +> `optional` **dpt**: `null` \| [`DPT`](../classes/DPT.md) -#### Defined in +Defined in: [packages/devp2p/src/types.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L297) -[packages/devp2p/src/types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L209) +*** -___ +### listenPort? -### maxPeers +> `optional` **listenPort**: `null` \| `number` -• `Optional` **maxPeers**: `number` +Defined in: [packages/devp2p/src/types.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L303) -#### Defined in +*** -[packages/devp2p/src/types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L205) +### maxPeers? -___ +> `optional` **maxPeers**: `number` -### remoteClientIdFilter +Defined in: [packages/devp2p/src/types.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L299) -• `Optional` **remoteClientIdFilter**: `string`[] +*** -#### Defined in +### remoteClientIdFilter? -[packages/devp2p/src/types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L206) +> `optional` **remoteClientIdFilter**: `string`[] -___ +Defined in: [packages/devp2p/src/types.ts:300](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L300) -### timeout +*** -• `Optional` **timeout**: `number` +### timeout? -#### Defined in +> `optional` **timeout**: `number` -[packages/devp2p/src/types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L202) +Defined in: [packages/devp2p/src/types.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L296) diff --git a/packages/devp2p/docs/interfaces/ServerEvent.md b/packages/devp2p/docs/interfaces/ServerEvent.md new file mode 100644 index 00000000000..d2dadbfb4ed --- /dev/null +++ b/packages/devp2p/docs/interfaces/ServerEvent.md @@ -0,0 +1,41 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / ServerEvent + +# Interface: ServerEvent + +Defined in: [packages/devp2p/src/types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L52) + +## Properties + +### close + +> **close**: `undefined` + +Defined in: [packages/devp2p/src/types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L54) + +*** + +### error + +> **error**: \[`Error`\] + +Defined in: [packages/devp2p/src/types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L55) + +*** + +### listening + +> **listening**: `undefined` + +Defined in: [packages/devp2p/src/types.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L53) + +*** + +### peers + +> **peers**: `any`[] + +Defined in: [packages/devp2p/src/types.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L56) diff --git a/packages/devp2p/docs/modules/SNAP.md b/packages/devp2p/docs/modules/SNAP.md deleted file mode 100644 index 966f0bd6add..00000000000 --- a/packages/devp2p/docs/modules/SNAP.md +++ /dev/null @@ -1,9 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / SNAP - -# Namespace: SNAP - -## Table of contents - -### Enumerations - -- [MESSAGE\_CODES](../enums/SNAP.MESSAGE_CODES.md) diff --git a/packages/devp2p/docs/modules/eth.md b/packages/devp2p/docs/modules/eth.md deleted file mode 100644 index b1db41fbd3f..00000000000 --- a/packages/devp2p/docs/modules/eth.md +++ /dev/null @@ -1,36 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / ETH - -# Namespace: ETH - -## Table of contents - -### Enumerations - -- [MESSAGE\_CODES](../enums/ETH.MESSAGE_CODES.md) - -### Interfaces - -- [StatusMsg](../interfaces/ETH.StatusMsg.md) - -### Type Aliases - -- [StatusOpts](ETH.md#statusopts) - -## Type Aliases - -### StatusOpts - -Ƭ **StatusOpts**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `bestHash` | `Uint8Array` | -| `genesisHash` | `Uint8Array` | -| `latestBlock?` | `Uint8Array` | -| `td` | `Uint8Array` | - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:388](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L388) diff --git a/packages/devp2p/docs/modules/les.md b/packages/devp2p/docs/modules/les.md deleted file mode 100644 index ed2d6b5e003..00000000000 --- a/packages/devp2p/docs/modules/les.md +++ /dev/null @@ -1,13 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / LES - -# Namespace: LES - -## Table of contents - -### Enumerations - -- [MESSAGE\_CODES](../enums/LES.MESSAGE_CODES.md) - -### Interfaces - -- [Status](../interfaces/LES.Status.md) diff --git a/packages/devp2p/docs/type-aliases/DISCONNECT_REASON.md b/packages/devp2p/docs/type-aliases/DISCONNECT_REASON.md new file mode 100644 index 00000000000..4b80ab74f95 --- /dev/null +++ b/packages/devp2p/docs/type-aliases/DISCONNECT_REASON.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / DISCONNECT\_REASON + +# Type Alias: DISCONNECT\_REASON + +> **DISCONNECT\_REASON** = *typeof* [`DISCONNECT_REASON`](../variables/DISCONNECT_REASON.md)\[keyof *typeof* [`DISCONNECT_REASON`](../variables/DISCONNECT_REASON.md)\] + +Defined in: [packages/devp2p/src/types.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L69) diff --git a/packages/devp2p/docs/type-aliases/DNSOptions.md b/packages/devp2p/docs/type-aliases/DNSOptions.md new file mode 100644 index 00000000000..59e5ee1c61f --- /dev/null +++ b/packages/devp2p/docs/type-aliases/DNSOptions.md @@ -0,0 +1,33 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / DNSOptions + +# Type Alias: DNSOptions + +> **DNSOptions** = `object` + +Defined in: [packages/devp2p/src/types.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L98) + +## Properties + +### common? + +> `optional` **common**: `Common` + +Defined in: [packages/devp2p/src/types.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L110) + +Common instance to allow for crypto primitive (e.g. keccak) replacement + +*** + +### dnsServerAddress? + +> `optional` **dnsServerAddress**: `string` + +Defined in: [packages/devp2p/src/types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L105) + +ipv4 or ipv6 address of server to pass to native dns.setServers() +Sets the IP address of servers to be used when performing +DNS resolution. diff --git a/packages/devp2p/docs/type-aliases/EthMessageCodes.md b/packages/devp2p/docs/type-aliases/EthMessageCodes.md new file mode 100644 index 00000000000..87c455cfc58 --- /dev/null +++ b/packages/devp2p/docs/type-aliases/EthMessageCodes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / EthMessageCodes + +# Type Alias: EthMessageCodes + +> **EthMessageCodes** = *typeof* [`EthMessageCodes`](../variables/EthMessageCodes.md)\[keyof *typeof* [`EthMessageCodes`](../variables/EthMessageCodes.md)\] + +Defined in: [packages/devp2p/src/protocol/eth.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L34) diff --git a/packages/devp2p/docs/type-aliases/EthStatusOpts.md b/packages/devp2p/docs/type-aliases/EthStatusOpts.md new file mode 100644 index 00000000000..06e57a8ffd6 --- /dev/null +++ b/packages/devp2p/docs/type-aliases/EthStatusOpts.md @@ -0,0 +1,43 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / EthStatusOpts + +# Type Alias: EthStatusOpts + +> **EthStatusOpts** = `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L27) + +## Properties + +### bestHash + +> **bestHash**: `Uint8Array` + +Defined in: [packages/devp2p/src/protocol/eth.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L29) + +*** + +### genesisHash + +> **genesisHash**: `Uint8Array` + +Defined in: [packages/devp2p/src/protocol/eth.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L31) + +*** + +### latestBlock? + +> `optional` **latestBlock**: `Uint8Array` + +Defined in: [packages/devp2p/src/protocol/eth.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L30) + +*** + +### td + +> **td**: `Uint8Array` + +Defined in: [packages/devp2p/src/protocol/eth.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L28) diff --git a/packages/devp2p/docs/type-aliases/PREFIXES.md b/packages/devp2p/docs/type-aliases/PREFIXES.md new file mode 100644 index 00000000000..bbe03314c29 --- /dev/null +++ b/packages/devp2p/docs/type-aliases/PREFIXES.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / PREFIXES + +# Type Alias: PREFIXES + +> **PREFIXES** = *typeof* [`PREFIXES`](../variables/PREFIXES.md)\[keyof *typeof* [`PREFIXES`](../variables/PREFIXES.md)\] + +Defined in: [packages/devp2p/src/rlpx/peer.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L36) diff --git a/packages/devp2p/docs/type-aliases/ProtocolType.md b/packages/devp2p/docs/type-aliases/ProtocolType.md new file mode 100644 index 00000000000..54441958963 --- /dev/null +++ b/packages/devp2p/docs/type-aliases/ProtocolType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / ProtocolType + +# Type Alias: ProtocolType + +> **ProtocolType** = *typeof* [`ProtocolType`](../variables/ProtocolType.md)\[keyof *typeof* [`ProtocolType`](../variables/ProtocolType.md)\] + +Defined in: [packages/devp2p/src/types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L223) diff --git a/packages/devp2p/docs/type-aliases/SendMethod.md b/packages/devp2p/docs/type-aliases/SendMethod.md new file mode 100644 index 00000000000..a4fc9df5307 --- /dev/null +++ b/packages/devp2p/docs/type-aliases/SendMethod.md @@ -0,0 +1,25 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / SendMethod + +# Type Alias: SendMethod() + +> **SendMethod** = (`code`, `data`) => `any` + +Defined in: [packages/devp2p/src/types.ts:306](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L306) + +## Parameters + +### code + +`number` + +### data + +`Uint8Array` + +## Returns + +`any` diff --git a/packages/devp2p/docs/type-aliases/SnapMessageCodes.md b/packages/devp2p/docs/type-aliases/SnapMessageCodes.md new file mode 100644 index 00000000000..25b20f0a411 --- /dev/null +++ b/packages/devp2p/docs/type-aliases/SnapMessageCodes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / SnapMessageCodes + +# Type Alias: SnapMessageCodes + +> **SnapMessageCodes** = *typeof* [`SnapMessageCodes`](../variables/SnapMessageCodes.md)\[keyof *typeof* [`SnapMessageCodes`](../variables/SnapMessageCodes.md)\] + +Defined in: [packages/devp2p/src/protocol/snap.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L13) diff --git a/packages/devp2p/docs/variables/DISCONNECT_REASON.md b/packages/devp2p/docs/variables/DISCONNECT_REASON.md new file mode 100644 index 00000000000..96b26b51aa4 --- /dev/null +++ b/packages/devp2p/docs/variables/DISCONNECT_REASON.md @@ -0,0 +1,65 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / DISCONNECT\_REASON + +# Variable: DISCONNECT\_REASON + +> **DISCONNECT\_REASON**: `object` + +Defined in: [packages/devp2p/src/types.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L69) + +## Type declaration + +### ALREADY\_CONNECTED + +> `readonly` **ALREADY\_CONNECTED**: `5` = `0x05` + +### CLIENT\_QUITTING + +> `readonly` **CLIENT\_QUITTING**: `8` = `0x08` + +### DISCONNECT\_REQUESTED + +> `readonly` **DISCONNECT\_REQUESTED**: `0` = `0x00` + +### INCOMPATIBLE\_VERSION + +> `readonly` **INCOMPATIBLE\_VERSION**: `6` = `0x06` + +### INVALID\_IDENTITY + +> `readonly` **INVALID\_IDENTITY**: `7` = `0x07` + +### NETWORK\_ERROR + +> `readonly` **NETWORK\_ERROR**: `1` = `0x01` + +### PROTOCOL\_ERROR + +> `readonly` **PROTOCOL\_ERROR**: `2` = `0x02` + +### SAME\_IDENTITY + +> `readonly` **SAME\_IDENTITY**: `10` = `0x0a` + +### SUBPROTOCOL\_ERROR + +> `readonly` **SUBPROTOCOL\_ERROR**: `16` = `0x10` + +### TIMEOUT + +> `readonly` **TIMEOUT**: `11` = `0x0b` + +### TOO\_MANY\_PEERS + +> `readonly` **TOO\_MANY\_PEERS**: `4` = `0x04` + +### UNEXPECTED\_IDENTITY + +> `readonly` **UNEXPECTED\_IDENTITY**: `9` = `0x09` + +### USELESS\_PEER + +> `readonly` **USELESS\_PEER**: `3` = `0x03` diff --git a/packages/devp2p/docs/variables/DisconnectReasonNames.md b/packages/devp2p/docs/variables/DisconnectReasonNames.md new file mode 100644 index 00000000000..6b932b374ef --- /dev/null +++ b/packages/devp2p/docs/variables/DisconnectReasonNames.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / DisconnectReasonNames + +# Variable: DisconnectReasonNames + +> `const` **DisconnectReasonNames**: `{ [key in DISCONNECT_REASON]: string }` + +Defined in: [packages/devp2p/src/types.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L88) diff --git a/packages/devp2p/docs/variables/EthMessageCodeNames.md b/packages/devp2p/docs/variables/EthMessageCodeNames.md new file mode 100644 index 00000000000..8620ab6d328 --- /dev/null +++ b/packages/devp2p/docs/variables/EthMessageCodeNames.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / EthMessageCodeNames + +# Variable: EthMessageCodeNames + +> `const` **EthMessageCodeNames**: `{ [key in EthMessageCodes]: string }` + +Defined in: [packages/devp2p/src/protocol/eth.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L60) diff --git a/packages/devp2p/docs/variables/EthMessageCodes.md b/packages/devp2p/docs/variables/EthMessageCodes.md new file mode 100644 index 00000000000..b681d1b69be --- /dev/null +++ b/packages/devp2p/docs/variables/EthMessageCodes.md @@ -0,0 +1,73 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / EthMessageCodes + +# Variable: EthMessageCodes + +> `const` **EthMessageCodes**: `object` + +Defined in: [packages/devp2p/src/protocol/eth.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L34) + +## Type declaration + +### BLOCK\_BODIES + +> `readonly` **BLOCK\_BODIES**: `6` = `0x06` + +### BLOCK\_HEADERS + +> `readonly` **BLOCK\_HEADERS**: `4` = `0x04` + +### GET\_BLOCK\_BODIES + +> `readonly` **GET\_BLOCK\_BODIES**: `5` = `0x05` + +### GET\_BLOCK\_HEADERS + +> `readonly` **GET\_BLOCK\_HEADERS**: `3` = `0x03` + +### GET\_NODE\_DATA + +> `readonly` **GET\_NODE\_DATA**: `13` = `0x0d` + +### GET\_POOLED\_TRANSACTIONS + +> `readonly` **GET\_POOLED\_TRANSACTIONS**: `9` = `0x09` + +### GET\_RECEIPTS + +> `readonly` **GET\_RECEIPTS**: `15` = `0x0f` + +### NEW\_BLOCK + +> `readonly` **NEW\_BLOCK**: `7` = `0x07` + +### NEW\_BLOCK\_HASHES + +> `readonly` **NEW\_BLOCK\_HASHES**: `1` = `0x01` + +### NEW\_POOLED\_TRANSACTION\_HASHES + +> `readonly` **NEW\_POOLED\_TRANSACTION\_HASHES**: `8` = `0x08` + +### NODE\_DATA + +> `readonly` **NODE\_DATA**: `14` = `0x0e` + +### POOLED\_TRANSACTIONS + +> `readonly` **POOLED\_TRANSACTIONS**: `10` = `0x0a` + +### RECEIPTS + +> `readonly` **RECEIPTS**: `16` = `0x10` + +### STATUS + +> `readonly` **STATUS**: `0` = `0x00` + +### TX + +> `readonly` **TX**: `2` = `0x02` diff --git a/packages/devp2p/docs/variables/PREFIXES.md b/packages/devp2p/docs/variables/PREFIXES.md new file mode 100644 index 00000000000..d8c798681cf --- /dev/null +++ b/packages/devp2p/docs/variables/PREFIXES.md @@ -0,0 +1,29 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / PREFIXES + +# Variable: PREFIXES + +> **PREFIXES**: `object` + +Defined in: [packages/devp2p/src/rlpx/peer.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L36) + +## Type declaration + +### DISCONNECT + +> `readonly` **DISCONNECT**: `1` = `0x01` + +### HELLO + +> `readonly` **HELLO**: `0` = `0x00` + +### PING + +> `readonly` **PING**: `2` = `0x02` + +### PONG + +> `readonly` **PONG**: `3` = `0x03` diff --git a/packages/devp2p/docs/variables/PrefixesNames.md b/packages/devp2p/docs/variables/PrefixesNames.md new file mode 100644 index 00000000000..8cd22b9b2f4 --- /dev/null +++ b/packages/devp2p/docs/variables/PrefixesNames.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / PrefixesNames + +# Variable: PrefixesNames + +> `const` **PrefixesNames**: `{ [key in PREFIXES]: string }` + +Defined in: [packages/devp2p/src/rlpx/peer.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L46) diff --git a/packages/devp2p/docs/variables/ProtocolType.md b/packages/devp2p/docs/variables/ProtocolType.md new file mode 100644 index 00000000000..d9df0e2e413 --- /dev/null +++ b/packages/devp2p/docs/variables/ProtocolType.md @@ -0,0 +1,21 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / ProtocolType + +# Variable: ProtocolType + +> **ProtocolType**: `object` + +Defined in: [packages/devp2p/src/types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L223) + +## Type declaration + +### ETH + +> `readonly` **ETH**: `"eth"` = `'eth'` + +### SNAP + +> `readonly` **SNAP**: `"snap"` = `'snap'` diff --git a/packages/devp2p/docs/variables/SnapMessageCodeNames.md b/packages/devp2p/docs/variables/SnapMessageCodeNames.md new file mode 100644 index 00000000000..f54cb5dc97c --- /dev/null +++ b/packages/devp2p/docs/variables/SnapMessageCodeNames.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / SnapMessageCodeNames + +# Variable: SnapMessageCodeNames + +> `const` **SnapMessageCodeNames**: `{ [key in SnapMessageCodes]: string }` + +Defined in: [packages/devp2p/src/protocol/snap.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L28) diff --git a/packages/devp2p/docs/variables/SnapMessageCodes.md b/packages/devp2p/docs/variables/SnapMessageCodes.md new file mode 100644 index 00000000000..de2e5b3d909 --- /dev/null +++ b/packages/devp2p/docs/variables/SnapMessageCodes.md @@ -0,0 +1,45 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / SnapMessageCodes + +# Variable: SnapMessageCodes + +> `const` **SnapMessageCodes**: `object` + +Defined in: [packages/devp2p/src/protocol/snap.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L13) + +## Type declaration + +### ACCOUNT\_RANGE + +> `readonly` **ACCOUNT\_RANGE**: `1` = `0x01` + +### BYTE\_CODES + +> `readonly` **BYTE\_CODES**: `5` = `0x05` + +### GET\_ACCOUNT\_RANGE + +> `readonly` **GET\_ACCOUNT\_RANGE**: `0` = `0x00` + +### GET\_BYTE\_CODES + +> `readonly` **GET\_BYTE\_CODES**: `4` = `0x04` + +### GET\_STORAGE\_RANGES + +> `readonly` **GET\_STORAGE\_RANGES**: `2` = `0x02` + +### GET\_TRIE\_NODES + +> `readonly` **GET\_TRIE\_NODES**: `6` = `0x06` + +### STORAGE\_RANGES + +> `readonly` **STORAGE\_RANGES**: `3` = `0x03` + +### TRIE\_NODES + +> `readonly` **TRIE\_NODES**: `7` = `0x07` diff --git a/packages/devp2p/docs/variables/devp2pDebug.md b/packages/devp2p/docs/variables/devp2pDebug.md new file mode 100644 index 00000000000..94f5f61b887 --- /dev/null +++ b/packages/devp2p/docs/variables/devp2pDebug.md @@ -0,0 +1,11 @@ +[**@ethereumjs/devp2p**](../README.md) + +*** + +[@ethereumjs/devp2p](../README.md) / devp2pDebug + +# Variable: devp2pDebug + +> `const` **devp2pDebug**: `Debugger` + +Defined in: [packages/devp2p/src/util.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L17) diff --git a/packages/devp2p/package.json b/packages/devp2p/package.json index bff5e620455..d9328802333 100644 --- a/packages/devp2p/package.json +++ b/packages/devp2p/package.json @@ -50,7 +50,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- devp2p", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", @@ -70,7 +70,7 @@ "@ethereumjs/util": "^10.0.0-rc.1", "@scure/base": "^1.2.4", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "eventemitter3": "^5.0.1", "lru-cache": "11.0.2", "scanf": "1.2.0", diff --git a/packages/devp2p/typedoc.cjs b/packages/devp2p/typedoc.mjs similarity index 66% rename from packages/devp2p/typedoc.cjs rename to packages/devp2p/typedoc.mjs index ce80b4e71d8..55abeca25cc 100644 --- a/packages/devp2p/typedoc.cjs +++ b/packages/devp2p/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts', 'examples/*.ts', 'src/protocol/protocol.ts'], diff --git a/packages/era/.c8rc.json b/packages/e2store/.c8rc.json similarity index 100% rename from packages/era/.c8rc.json rename to packages/e2store/.c8rc.json diff --git a/packages/era/.gitignore b/packages/e2store/.gitignore similarity index 100% rename from packages/era/.gitignore rename to packages/e2store/.gitignore diff --git a/packages/era/CHANGELOG.md b/packages/e2store/CHANGELOG.md similarity index 100% rename from packages/era/CHANGELOG.md rename to packages/e2store/CHANGELOG.md diff --git a/packages/era/LICENSE b/packages/e2store/LICENSE similarity index 100% rename from packages/era/LICENSE rename to packages/e2store/LICENSE diff --git a/packages/e2store/README.md b/packages/e2store/README.md new file mode 100644 index 00000000000..a3a1ac5223b --- /dev/null +++ b/packages/e2store/README.md @@ -0,0 +1,197 @@ +# @ethereumjs/e2store `v10` + +[![NPM Package][e2store-npm-badge]][e2store-npm-link] +[![GitHub Issues][e2store-issues-badge]][e2store-issues-link] +[![Actions Status][e2store-actions-badge]][e2store-actions-link] +[![Code Coverage][e2store-coverage-badge]][e2store-coverage-link] +[![Discord][discord-badge]][discord-link] + +| A collection of utility functions for Ethereum data storage formats. | +| ------------------------------------------------------------------- | + +`@ethereumjs/e2store` provides utilities for working with Ethereum data storage formats, including E2HS, Era1, and Era files. These formats are commonly used for storing historical blockchain data, beacon states, and block data in an efficient, provable, and standardized way. + +## Table of Contents + +- [@ethereumjs/e2store `v10`](#ethereumjse2store-v10) + - [Table of Contents](#table-of-contents) + - [Installation](#installation) + - [Usage](#usage) + - [E2HS](#e2hs) + - [Format E2HS](#format-e2hs) + - [Read Tuples from E2HS](#read-tuples-from-e2hs) + - [Read E2HS Tuple at Index](#read-e2hs-tuple-at-index) + - [Era1](#era1) + - [Export History as Era1](#export-history-as-era1) + - [Read Era1 file](#read-era1-file) + - [Era](#era) + - [Read Era file](#read-era-file) + - [Common Use Cases](#common-use-cases) + - [EthereumJS](#ethereumjs) + - [License](#license) + +## Installation + +To obtain the latest version, simply require the project using `npm`: + +```shell +npm install @ethereumjs/e2store +``` + +## Usage + +All helpers are re-exported from the root level and deep imports are not necessary. So an import can be done like this: + +```ts +import { formatEntry } from "@ethereumjs/e2store" +``` + +### E2HS + +E2HS is a format for storing historical blockchain data along with proofs. It provides efficient access to block headers, bodies, and receipts, and can be used to bootstrap a Portal History Network DB. + +#### Format E2HS + +```ts +import { formatE2HS } from "@ethereumjs/e2store" + +// Format data into E2HS format +// data is an array of block tuple data and an epoch index +const e2hs = await formatE2HS(data) +``` + +#### Read Tuples from E2HS + +```ts +import { readTuplesFromE2HS, parseEH2SBlockTuple } from "@ethereumjs/e2store" + +// Read all tuples from an E2HS file +const tuples = await readTuplesFromE2HS(filePath) +for await (const tuple of tuples) { + const { headerWithProof, body, receipts } = parseEH2SBlockTuple(tuple) + console.log(headerWithProof) + console.log(body) + console.log(receipts) +} +``` + +#### Read E2HS Tuple at Index + +```ts +import { readE2HSTupleAtIndex, parseEH2SBlockTuple } from "@ethereumjs/e2store" + +// Read a specific tuple by index +const tuple = await readE2HSTupleAtIndex(filePath, index) +const { headerWithProof, body, receipts } = parseEH2SBlockTuple(tuple) +console.log(headerWithProof) +console.log(body) +console.log(receipts) +``` + +### Era1 + +Era1 files store historical data in epochs of 8192 blocks, making it efficient to access large ranges of historical data. Era1 block tuples contain a header, body, receipts, and total difficulty. The data can be verified by reconstructing the epoch accumulator, and validating again the accumulator root, also contained in the era1 file. + +#### Export History as Era1 + +Export history from an EthereumJS client DB in epochs of 8192 blocks as Era1 files: + +```ts +import { exportEpochAsEra1 } from "@ethereumjs/e2store" + +const dataDir = PATH_TO_ETHEREUMJS_CLIENT_DB +const epoch = 0 + +// Generates ${dataDir}/era1/epoch-0.era1 +await exportEpochAsEra1(epoch, dataDir) +``` + +### Read Era1 file + +`readERA1` returns an async iterator of block tuples (header + body + receipts + totalDifficulty): + +```ts +import { + readBinaryFile, + validateERA1, + readERA1, + parseBlockTuple, + blockFromTuple, + getHeaderRecords, + EpochAccumulator, +} from "@ethereumjs/e2store" + +const era1File = readBinaryFile(PATH_TO_ERA1_FILE) + +// Validate era1 file +// Rebuilds epoch accumulator and validates the accumulator root +const isValid = validateERA1(era1File) +if (!isValid) { + throw new Error('Invalid Era1 file') +} + +// Read blocks from era1 file +const blocks = readERA1(era1File) + +for await (const blockTuple of blocks) { + const { header, body, receipts } = await parseBlockTuple(blockTuple) + const block = blockFromTuple({ header, body }) + console.log(`Block number: ${block.header.number}`) +} + +// Reconstruct epoch accumulator +const headerRecords = await getHeaderRecords(era1File) +const epochAccumulator = EpochAccumulator.encode(headerRecords) +const epochAccumulatorRoot = EpochAccumulator.merkleRoot(headerRecords) +``` + +### Era + +Era files are used to store beacon chain data, including beacon states and blocks. + +#### Read Era file + +```ts +import { readBeaconState, readBlocksFromEra } from "@ethereumjs/e2store" + +const eraFile = readBinaryFile(PATH_TO_ERA_FILE) + +// Extract BeaconState +const state = await readBeaconState(eraFile) +console.log(`Current slot: ${state.slot}`) + +// Read Beacon Blocks from era file +let count = 0 +for await (const block of readBlocksFromEra(eraFile)) { + console.log(`Block slot: ${block.message.slot}`) + count++ + if (count > 10) break +} +``` + +## Common Use Cases + +1. **Historical Data Access**: Use E2HS and Era1 formats to efficiently access historical blockchain data +2. **Beacon Chain Analysis**: Read and analyze beacon chain states and blocks using Era files +3. **Data Export**: Export historical data in standardized formats for analysis or archival +4. **Portal History Network**: Bootstrap a Portal History Network DB using E2HS +5. **Execution Client Sync**: Sync an execution client without devp2p using Era1 or E2HS files + +## EthereumJS + +See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices. If you want to join for work or carry out improvements on the libraries, please review our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html) first. + +## License + +[MPL-2.0]() + +[e2store-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/e2store.svg +[e2store-npm-link]: https://www.npmjs.org/package/@ethereumjs/e2store +[e2store-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-monorepo/package:%20e2store?label=issues +[e2store-issues-link]: https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+e2store" +[e2store-actions-badge]: https://github.com/ethereumjs/ethereumjs-monorepo/workflows/E2Store/badge.svg +[e2store-actions-link]: https://github.com/ethereumjs/ethereumjs-monorepo/actions?query=workflow%3A%22E2Store%22 +[e2store-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/branch/master/graph/badge.svg?flag=e2store +[e2store-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/tree/master/packages/e2store +[discord-badge]: https://img.shields.io/static/v1?logo=discord&label=discord&message=Join&color=blue +[discord-link]: https://discord.gg/TNwARpR diff --git a/packages/e2store/docs/README.md b/packages/e2store/docs/README.md new file mode 100644 index 00000000000..8f14f0d58a3 --- /dev/null +++ b/packages/e2store/docs/README.md @@ -0,0 +1,68 @@ +**@ethereumjs/e2store** + +*** + +# @ethereumjs/e2store + +## Type Aliases + +- [DBKey](type-aliases/DBKey.md) +- [DBTarget](type-aliases/DBTarget.md) +- [e2StoreEntry](type-aliases/e2StoreEntry.md) +- [SlotIndex](type-aliases/SlotIndex.md) + +## Variables + +- [CommonTypes](variables/CommonTypes.md) +- [DBKey](variables/DBKey.md) +- [DBTarget](variables/DBTarget.md) +- [E2HSTypes](variables/E2HSTypes.md) +- [EpochAccumulator](variables/EpochAccumulator.md) +- [Era1Types](variables/Era1Types.md) +- [EraTypes](variables/EraTypes.md) +- [HeaderRecord](variables/HeaderRecord.md) +- [sszHeaderWithProof](variables/sszHeaderWithProof.md) +- [VERSION](variables/VERSION.md) + +## Functions + +- [blockFromTuple](functions/blockFromTuple.md) +- [compressData](functions/compressData.md) +- [createBlockIndex](functions/createBlockIndex.md) +- [createBlockTuples](functions/createBlockTuples.md) +- [decompressData](functions/decompressData.md) +- [decompressE2HSTuple](functions/decompressE2HSTuple.md) +- [exportEpochAsEra1](functions/exportEpochAsEra1.md) +- [formatE2HS](functions/formatE2HS.md) +- [formatEntry](functions/formatEntry.md) +- [formatEra1](functions/formatEra1.md) +- [getBlock](functions/getBlock.md) +- [getBlockIndex](functions/getBlockIndex.md) +- [getBlockReceipts](functions/getBlockReceipts.md) +- [getBlocks](functions/getBlocks.md) +- [getBlockTuple](functions/getBlockTuple.md) +- [getBody](functions/getBody.md) +- [getEraIndexes](functions/getEraIndexes.md) +- [getHeader](functions/getHeader.md) +- [getHeaderRecords](functions/getHeaderRecords.md) +- [getTotalDifficulty](functions/getTotalDifficulty.md) +- [numberToHash](functions/numberToHash.md) +- [parseBlockTuple](functions/parseBlockTuple.md) +- [parseEH2SBlockTuple](functions/parseEH2SBlockTuple.md) +- [parseEntry](functions/parseEntry.md) +- [readAccumulatorRoot](functions/readAccumulatorRoot.md) +- [readBeaconBlock](functions/readBeaconBlock.md) +- [readBeaconState](functions/readBeaconState.md) +- [readBinaryFile](functions/readBinaryFile.md) +- [readBlockIndex](functions/readBlockIndex.md) +- [readBlocksFromEra](functions/readBlocksFromEra.md) +- [readBlockTupleAtOffset](functions/readBlockTupleAtOffset.md) +- [readBlockTuplesFromERA1](functions/readBlockTuplesFromERA1.md) +- [readE2HSTupleAtIndex](functions/readE2HSTupleAtIndex.md) +- [readE2HSTupleAtOffset](functions/readE2HSTupleAtOffset.md) +- [readEntry](functions/readEntry.md) +- [readERA1](functions/readERA1.md) +- [readOtherEntries](functions/readOtherEntries.md) +- [readSlotIndex](functions/readSlotIndex.md) +- [readTuplesFromE2HS](functions/readTuplesFromE2HS.md) +- [validateERA1](functions/validateERA1.md) diff --git a/packages/e2store/docs/functions/blockFromTuple.md b/packages/e2store/docs/functions/blockFromTuple.md new file mode 100644 index 00000000000..cdc2c6db282 --- /dev/null +++ b/packages/e2store/docs/functions/blockFromTuple.md @@ -0,0 +1,27 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / blockFromTuple + +# Function: blockFromTuple() + +> **blockFromTuple**(`__namedParameters`): `Block` + +Defined in: [packages/e2store/src/era1/blockTuple.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/blockTuple.ts#L81) + +## Parameters + +### \_\_namedParameters + +#### body + +`any` + +#### header + +`any` + +## Returns + +`Block` diff --git a/packages/e2store/docs/functions/compressData.md b/packages/e2store/docs/functions/compressData.md new file mode 100644 index 00000000000..c822b9f33b5 --- /dev/null +++ b/packages/e2store/docs/functions/compressData.md @@ -0,0 +1,25 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / compressData + +# Function: compressData() + +> **compressData**(`uncompressedData`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/snappy.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/snappy.ts#L9) + +Compress data using snappy + +## Parameters + +### uncompressedData + +`Uint8Array` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +compressed data diff --git a/packages/e2store/docs/functions/createBlockIndex.md b/packages/e2store/docs/functions/createBlockIndex.md new file mode 100644 index 00000000000..6eb486dbfae --- /dev/null +++ b/packages/e2store/docs/functions/createBlockIndex.md @@ -0,0 +1,25 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / createBlockIndex + +# Function: createBlockIndex() + +> **createBlockIndex**(`blockTuples`, `startingNumber`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/blockIndex.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/blockIndex.ts#L34) + +## Parameters + +### blockTuples + +`Uint8Array`\<`ArrayBufferLike`\>[] + +### startingNumber + +`bigint` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/e2store/docs/functions/createBlockTuples.md b/packages/e2store/docs/functions/createBlockTuples.md new file mode 100644 index 00000000000..8accc77aa70 --- /dev/null +++ b/packages/e2store/docs/functions/createBlockTuples.md @@ -0,0 +1,29 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / createBlockTuples + +# Function: createBlockTuples() + +> **createBlockTuples**(`blocks`, `blockReceipts`, `td`): `Promise`\<\{ `blockTuples`: `object`[]; `headerRecords`: `object`[]; `totalDifficulty`: `bigint`; \}\> + +Defined in: [packages/e2store/src/era1/blockTuple.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/blockTuple.ts#L8) + +## Parameters + +### blocks + +`Block`[] + +### blockReceipts + +`Uint8Array`\<`ArrayBufferLike`\>[] + +### td + +`bigint` + +## Returns + +`Promise`\<\{ `blockTuples`: `object`[]; `headerRecords`: `object`[]; `totalDifficulty`: `bigint`; \}\> diff --git a/packages/e2store/docs/functions/decompressData.md b/packages/e2store/docs/functions/decompressData.md new file mode 100644 index 00000000000..04e153ec686 --- /dev/null +++ b/packages/e2store/docs/functions/decompressData.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / decompressData + +# Function: decompressData() + +> **decompressData**(`compressedData`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/snappy.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/snappy.ts#L41) + +## Parameters + +### compressedData + +`Uint8Array` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/e2store/docs/functions/decompressE2HSTuple.md b/packages/e2store/docs/functions/decompressE2HSTuple.md new file mode 100644 index 00000000000..2ecec0c223b --- /dev/null +++ b/packages/e2store/docs/functions/decompressE2HSTuple.md @@ -0,0 +1,31 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / decompressE2HSTuple + +# Function: decompressE2HSTuple() + +> **decompressE2HSTuple**(`__namedParameters`): `Promise`\<`EncodedBlockTuple`\> + +Defined in: [packages/e2store/src/e2hs/blockTuple.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2hs/blockTuple.ts#L9) + +## Parameters + +### \_\_namedParameters + +#### bodyEntry + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +#### headerWithProofEntry + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +#### receiptsEntry + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +## Returns + +`Promise`\<`EncodedBlockTuple`\> diff --git a/packages/e2store/docs/functions/exportEpochAsEra1.md b/packages/e2store/docs/functions/exportEpochAsEra1.md new file mode 100644 index 00000000000..285bac487fb --- /dev/null +++ b/packages/e2store/docs/functions/exportEpochAsEra1.md @@ -0,0 +1,33 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / exportEpochAsEra1 + +# Function: exportEpochAsEra1() + +> **exportEpochAsEra1**(`epoch`, `dataDir`, `outputDir`, `chain`): `Promise`\<`void`\> + +Defined in: [packages/e2store/src/exportHistory.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L144) + +## Parameters + +### epoch + +`number` + +### dataDir + +`string` + +### outputDir + +`string` = `dataDir` + +### chain + +`string` = `'mainnet'` + +## Returns + +`Promise`\<`void`\> diff --git a/packages/e2store/docs/functions/formatE2HS.md b/packages/e2store/docs/functions/formatE2HS.md new file mode 100644 index 00000000000..218523e9a5b --- /dev/null +++ b/packages/e2store/docs/functions/formatE2HS.md @@ -0,0 +1,33 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / formatE2HS + +# Function: formatE2HS() + +> **formatE2HS**(`data`, `epoch`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/e2hs/e2hs.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2hs/e2hs.ts#L18) + +Format E2HS + +## Parameters + +### data + +`object`[] + +array of block tuples + +### epoch + +`number` + +epoch index + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +serialized E2HS diff --git a/packages/e2store/docs/functions/formatEntry.md b/packages/e2store/docs/functions/formatEntry.md new file mode 100644 index 00000000000..9fbad2cb3fb --- /dev/null +++ b/packages/e2store/docs/functions/formatEntry.md @@ -0,0 +1,33 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / formatEntry + +# Function: formatEntry() + +> **formatEntry**(`entry`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/e2store.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2store.ts#L76) + +Format e2store entry + +## Parameters + +### entry + +{ type: entry type, data: uncompressed data } + +#### data + +`Uint8Array` + +#### type + +`Uint8Array` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +serialized entry diff --git a/packages/e2store/docs/functions/formatEra1.md b/packages/e2store/docs/functions/formatEra1.md new file mode 100644 index 00000000000..04592a0549d --- /dev/null +++ b/packages/e2store/docs/functions/formatEra1.md @@ -0,0 +1,39 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / formatEra1 + +# Function: formatEra1() + +> **formatEra1**(`blockTuples`, `headerRecords`, `epoch`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/era1/era1.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/era1.ts#L23) + +Format era1 from epoch of history data + +## Parameters + +### blockTuples + +`object`[] + +header, body, receipts, totalDifficulty + +### headerRecords + +`object`[] + +array of Header Records { blockHash: Uint8Array, totalDifficulty: bigint } + +### epoch + +`number` + +epoch index + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +serialized era1 file diff --git a/packages/e2store/docs/functions/getBlock.md b/packages/e2store/docs/functions/getBlock.md new file mode 100644 index 00000000000..176a4fe92b5 --- /dev/null +++ b/packages/e2store/docs/functions/getBlock.md @@ -0,0 +1,25 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getBlock + +# Function: getBlock() + +> **getBlock**(`DB`, `number`): `Promise`\<\{ `body`: `Uint8Array`\<`ArrayBufferLike`\>; `header`: `Uint8Array`\<`ArrayBufferLike`\>; \}\> + +Defined in: [packages/e2store/src/exportHistory.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L68) + +## Parameters + +### DB + +`BlockDB` + +### number + +`bigint` + +## Returns + +`Promise`\<\{ `body`: `Uint8Array`\<`ArrayBufferLike`\>; `header`: `Uint8Array`\<`ArrayBufferLike`\>; \}\> diff --git a/packages/e2store/docs/functions/getBlockIndex.md b/packages/e2store/docs/functions/getBlockIndex.md new file mode 100644 index 00000000000..e44b25e24b8 --- /dev/null +++ b/packages/e2store/docs/functions/getBlockIndex.md @@ -0,0 +1,37 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getBlockIndex + +# Function: getBlockIndex() + +> **getBlockIndex**(`bytes`): `object` + +Defined in: [packages/e2store/src/blockIndex.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/blockIndex.ts#L6) + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +`object` + +### count + +> **count**: `number` + +### data + +> **data**: `Uint8Array`\<`ArrayBufferLike`\> + +### recordStart + +> **recordStart**: `number` + +### type + +> **type**: `Uint8Array`\<`ArrayBufferLike`\> diff --git a/packages/e2store/docs/functions/getBlockReceipts.md b/packages/e2store/docs/functions/getBlockReceipts.md new file mode 100644 index 00000000000..4b155909356 --- /dev/null +++ b/packages/e2store/docs/functions/getBlockReceipts.md @@ -0,0 +1,25 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getBlockReceipts + +# Function: getBlockReceipts() + +> **getBlockReceipts**(`DB`, `blockHash`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/exportHistory.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L79) + +## Parameters + +### DB + +`BlockDB` + +### blockHash + +`Uint8Array` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/e2store/docs/functions/getBlockTuple.md b/packages/e2store/docs/functions/getBlockTuple.md new file mode 100644 index 00000000000..f8189c26fb0 --- /dev/null +++ b/packages/e2store/docs/functions/getBlockTuple.md @@ -0,0 +1,29 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getBlockTuple + +# Function: getBlockTuple() + +> **getBlockTuple**(`chainDB`, `metaDB`, `number`): `Promise`\<\{ `blockHash`: `Uint8Array`\<`ArrayBufferLike`\>; `body`: `Uint8Array`\<`ArrayBufferLike`\>; `header`: `Uint8Array`\<`ArrayBufferLike`\>; `receipts`: `Uint8Array`\<`ArrayBufferLike`\>; `totalDifficulty`: `bigint`; \}\> + +Defined in: [packages/e2store/src/exportHistory.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L85) + +## Parameters + +### chainDB + +`BlockDB` + +### metaDB + +`BlockDB` + +### number + +`bigint` + +## Returns + +`Promise`\<\{ `blockHash`: `Uint8Array`\<`ArrayBufferLike`\>; `body`: `Uint8Array`\<`ArrayBufferLike`\>; `header`: `Uint8Array`\<`ArrayBufferLike`\>; `receipts`: `Uint8Array`\<`ArrayBufferLike`\>; `totalDifficulty`: `bigint`; \}\> diff --git a/packages/e2store/docs/functions/getBlocks.md b/packages/e2store/docs/functions/getBlocks.md new file mode 100644 index 00000000000..75b39367484 --- /dev/null +++ b/packages/e2store/docs/functions/getBlocks.md @@ -0,0 +1,33 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getBlocks + +# Function: getBlocks() + +> **getBlocks**(`chainDB`, `metaDB`, `start`, `number`): `Promise`\<`object`[]\> + +Defined in: [packages/e2store/src/exportHistory.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L93) + +## Parameters + +### chainDB + +`BlockDB` + +### metaDB + +`BlockDB` + +### start + +`bigint` + +### number + +`number` + +## Returns + +`Promise`\<`object`[]\> diff --git a/packages/e2store/docs/functions/getBody.md b/packages/e2store/docs/functions/getBody.md new file mode 100644 index 00000000000..479391afbb8 --- /dev/null +++ b/packages/e2store/docs/functions/getBody.md @@ -0,0 +1,31 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getBody + +# Function: getBody() + +> **getBody**(`DB`, `blockHash`, `blockNumber`): `Promise`\<`undefined` \| `BlockBodyBytes`\> + +Defined in: [packages/e2store/src/exportHistory.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L54) + +Fetches body of a block given its hash and number. + +## Parameters + +### DB + +`BlockDB` + +### blockHash + +`Uint8Array` + +### blockNumber + +`bigint` + +## Returns + +`Promise`\<`undefined` \| `BlockBodyBytes`\> diff --git a/packages/e2store/docs/functions/getEraIndexes.md b/packages/e2store/docs/functions/getEraIndexes.md new file mode 100644 index 00000000000..12c3f90690f --- /dev/null +++ b/packages/e2store/docs/functions/getEraIndexes.md @@ -0,0 +1,35 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getEraIndexes + +# Function: getEraIndexes() + +> **getEraIndexes**(`eraContents`): `object` + +Defined in: [packages/e2store/src/era/era.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era/era.ts#L46) + +Reads a an era file and extracts the State and Block slot indices + +## Parameters + +### eraContents + +`Uint8Array` + +a bytestring representing a serialized era file + +## Returns + +`object` + +a dictionary containing the State and Block Slot Indices (if present) + +### blockSlotIndex + +> **blockSlotIndex**: `undefined` \| [`SlotIndex`](../type-aliases/SlotIndex.md) + +### stateSlotIndex + +> **stateSlotIndex**: [`SlotIndex`](../type-aliases/SlotIndex.md) diff --git a/packages/e2store/docs/functions/getHeader.md b/packages/e2store/docs/functions/getHeader.md new file mode 100644 index 00000000000..779745c71c2 --- /dev/null +++ b/packages/e2store/docs/functions/getHeader.md @@ -0,0 +1,29 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getHeader + +# Function: getHeader() + +> **getHeader**(`DB`, `hash`, `number`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/exportHistory.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L46) + +## Parameters + +### DB + +`BlockDB` + +### hash + +`Uint8Array` + +### number + +`bigint` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/e2store/docs/functions/getHeaderRecords.md b/packages/e2store/docs/functions/getHeaderRecords.md new file mode 100644 index 00000000000..1789c0b3a51 --- /dev/null +++ b/packages/e2store/docs/functions/getHeaderRecords.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getHeaderRecords + +# Function: getHeaderRecords() + +> **getHeaderRecords**(`bytes`): `Promise`\<`object`[]\> + +Defined in: [packages/e2store/src/era1/era1.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/era1.ts#L123) + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +`Promise`\<`object`[]\> diff --git a/packages/e2store/docs/functions/getTotalDifficulty.md b/packages/e2store/docs/functions/getTotalDifficulty.md new file mode 100644 index 00000000000..e6bc784a63d --- /dev/null +++ b/packages/e2store/docs/functions/getTotalDifficulty.md @@ -0,0 +1,29 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / getTotalDifficulty + +# Function: getTotalDifficulty() + +> **getTotalDifficulty**(`DB`, `hash`, `number`): `Promise`\<`bigint`\> + +Defined in: [packages/e2store/src/exportHistory.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L63) + +## Parameters + +### DB + +`BlockDB` + +### hash + +`Uint8Array` + +### number + +`bigint` + +## Returns + +`Promise`\<`bigint`\> diff --git a/packages/e2store/docs/functions/numberToHash.md b/packages/e2store/docs/functions/numberToHash.md new file mode 100644 index 00000000000..8664eeedc42 --- /dev/null +++ b/packages/e2store/docs/functions/numberToHash.md @@ -0,0 +1,25 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / numberToHash + +# Function: numberToHash() + +> **numberToHash**(`DB`, `number`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/exportHistory.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L41) + +## Parameters + +### DB + +`BlockDB` + +### number + +`bigint` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/e2store/docs/functions/parseBlockTuple.md b/packages/e2store/docs/functions/parseBlockTuple.md new file mode 100644 index 00000000000..bb87d0b6628 --- /dev/null +++ b/packages/e2store/docs/functions/parseBlockTuple.md @@ -0,0 +1,35 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / parseBlockTuple + +# Function: parseBlockTuple() + +> **parseBlockTuple**(`__namedParameters`): `Promise`\<\{ `body`: `any`; `header`: `any`; `receipts`: `any`; `totalDifficulty`: `any`; \}\> + +Defined in: [packages/e2store/src/era1/blockTuple.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/blockTuple.ts#L48) + +## Parameters + +### \_\_namedParameters + +#### bodyEntry + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +#### headerEntry + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +#### receiptsEntry + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +#### totalDifficultyEntry + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +## Returns + +`Promise`\<\{ `body`: `any`; `header`: `any`; `receipts`: `any`; `totalDifficulty`: `any`; \}\> diff --git a/packages/e2store/docs/functions/parseEH2SBlockTuple.md b/packages/e2store/docs/functions/parseEH2SBlockTuple.md new file mode 100644 index 00000000000..78803ebd2ba --- /dev/null +++ b/packages/e2store/docs/functions/parseEH2SBlockTuple.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / parseEH2SBlockTuple + +# Function: parseEH2SBlockTuple() + +> **parseEH2SBlockTuple**(`tuple`): `RawBlockTuple` + +Defined in: [packages/e2store/src/e2hs/blockTuple.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2hs/blockTuple.ts#L61) + +## Parameters + +### tuple + +`EncodedBlockTuple` + +## Returns + +`RawBlockTuple` diff --git a/packages/e2store/docs/functions/parseEntry.md b/packages/e2store/docs/functions/parseEntry.md new file mode 100644 index 00000000000..b683ae99f6f --- /dev/null +++ b/packages/e2store/docs/functions/parseEntry.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / parseEntry + +# Function: parseEntry() + +> **parseEntry**(`entry`): `Promise`\<\{ `data`: `number` \| `bigint`; `type`: `Uint8Array`\<`ArrayBufferLike`\>; \} \| \{ `data`: `Uint8Array`\<`ArrayBufferLike`\> \| `NestedUint8Array` \| \{ `txs`: `number` \| `NestedUint8Array` \| `Uint8Array`\<`ArrayBufferLike`\>; `uncles`: `number` \| `NestedUint8Array` \| `Uint8Array`\<`ArrayBufferLike`\>; `withdrawals`: `number` \| `NestedUint8Array` \| `Uint8Array`\<`ArrayBufferLike`\>; \}; `type`: `Uint8Array`\<`ArrayBufferLike`\>; \}\> + +Defined in: [packages/e2store/src/e2store.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2store.ts#L16) + +## Parameters + +### entry + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +## Returns + +`Promise`\<\{ `data`: `number` \| `bigint`; `type`: `Uint8Array`\<`ArrayBufferLike`\>; \} \| \{ `data`: `Uint8Array`\<`ArrayBufferLike`\> \| `NestedUint8Array` \| \{ `txs`: `number` \| `NestedUint8Array` \| `Uint8Array`\<`ArrayBufferLike`\>; `uncles`: `number` \| `NestedUint8Array` \| `Uint8Array`\<`ArrayBufferLike`\>; `withdrawals`: `number` \| `NestedUint8Array` \| `Uint8Array`\<`ArrayBufferLike`\>; \}; `type`: `Uint8Array`\<`ArrayBufferLike`\>; \}\> diff --git a/packages/e2store/docs/functions/readAccumulatorRoot.md b/packages/e2store/docs/functions/readAccumulatorRoot.md new file mode 100644 index 00000000000..f44f348e5aa --- /dev/null +++ b/packages/e2store/docs/functions/readAccumulatorRoot.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readAccumulatorRoot + +# Function: readAccumulatorRoot() + +> **readAccumulatorRoot**(`bytes`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/e2store/src/era1/era1.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/era1.ts#L112) + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/e2store/docs/functions/readBeaconBlock.md b/packages/e2store/docs/functions/readBeaconBlock.md new file mode 100644 index 00000000000..d265d35c868 --- /dev/null +++ b/packages/e2store/docs/functions/readBeaconBlock.md @@ -0,0 +1,33 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readBeaconBlock + +# Function: readBeaconBlock() + +> **readBeaconBlock**(`eraData`, `offset`): `Promise`\<\{ `message`: \{ `body`: \{ `attestations`: `object`[]; `attester_slashings`: `object`[]; `deposits`: `object`[]; `eth1_data`: \{ `block_hash`: `Uint8Array`; `deposit_count`: `number` \| `bigint`; `deposit_root`: `Uint8Array`; \}; `graffiti`: `Uint8Array`; `proposer_slashings`: `object`[]; `randao_reveal`: `Uint8Array`; `voluntary_exits`: `object`[]; \}; `parent_root`: `Uint8Array`; `proposer_index`: `number` \| `bigint`; `slot`: `number` \| `bigint`; `state_root`: `Uint8Array`; \}; `signature`: `Uint8Array`; \}\> + +Defined in: [packages/e2store/src/era/era.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era/era.ts#L91) + +## Parameters + +### eraData + +`Uint8Array` + +a bytestring representing an era file + +### offset + +`number` + +## Returns + +`Promise`\<\{ `message`: \{ `body`: \{ `attestations`: `object`[]; `attester_slashings`: `object`[]; `deposits`: `object`[]; `eth1_data`: \{ `block_hash`: `Uint8Array`; `deposit_count`: `number` \| `bigint`; `deposit_root`: `Uint8Array`; \}; `graffiti`: `Uint8Array`; `proposer_slashings`: `object`[]; `randao_reveal`: `Uint8Array`; `voluntary_exits`: `object`[]; \}; `parent_root`: `Uint8Array`; `proposer_index`: `number` \| `bigint`; `slot`: `number` \| `bigint`; `state_root`: `Uint8Array`; \}; `signature`: `Uint8Array`; \}\> + +a decompressed SignedBeaconBlock object of the same time as returned by ssz.ETH2\_TYPES.SignedBeaconBlock + +## Throws + +if SignedBeaconBlock is not found when reading an entry diff --git a/packages/e2store/docs/functions/readBeaconState.md b/packages/e2store/docs/functions/readBeaconState.md new file mode 100644 index 00000000000..fe497479c50 --- /dev/null +++ b/packages/e2store/docs/functions/readBeaconState.md @@ -0,0 +1,29 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readBeaconState + +# Function: readBeaconState() + +> **readBeaconState**(`eraData`): `Promise`\<\{ `balances`: (`number` \| `bigint`)[]; `block_roots`: `Uint8Array`\<`ArrayBufferLike`\>[]; `current_epoch_participation`: (`number` \| `bigint`)[]; `current_justified_checkpoint`: \{ `epoch`: `number` \| `bigint`; `root`: `Uint8Array`; \}; `eth1_data`: \{ `block_hash`: `Uint8Array`; `deposit_count`: `number` \| `bigint`; `deposit_root`: `Uint8Array`; \}; `eth1_data_votes`: `object`[]; `eth1_deposit_index`: `number` \| `bigint`; `finalized_checkpoint`: \{ `epoch`: `number` \| `bigint`; `root`: `Uint8Array`; \}; `fork`: \{ `current_version`: `Uint8Array`; `epoch`: `number` \| `bigint`; `previous_version`: `Uint8Array`; \}; `genesis_time`: `number` \| `bigint`; `genesis_validators_root`: `Uint8Array`; `historical_roots`: `Uint8Array`\<`ArrayBufferLike`\>[]; `justification_bits`: `boolean`[]; `latest_block_header`: \{ `body_root`: `Uint8Array`; `parent_root`: `Uint8Array`; `proposer_index`: `number` \| `bigint`; `slot`: `number` \| `bigint`; `state_root`: `Uint8Array`; \}; `previous_epoch_participation`: (`number` \| `bigint`)[]; `previous_justified_checkpoint`: \{ `epoch`: `number` \| `bigint`; `root`: `Uint8Array`; \}; `randao_mixes`: `Uint8Array`\<`ArrayBufferLike`\>[]; `slashings`: (`number` \| `bigint`)[]; `slot`: `number` \| `bigint`; `state_roots`: `Uint8Array`\<`ArrayBufferLike`\>[]; `validators`: `object`[]; \}\> + +Defined in: [packages/e2store/src/era/era.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era/era.ts#L63) + +## Parameters + +### eraData + +`Uint8Array` + +a bytestring representing an era file + +## Returns + +`Promise`\<\{ `balances`: (`number` \| `bigint`)[]; `block_roots`: `Uint8Array`\<`ArrayBufferLike`\>[]; `current_epoch_participation`: (`number` \| `bigint`)[]; `current_justified_checkpoint`: \{ `epoch`: `number` \| `bigint`; `root`: `Uint8Array`; \}; `eth1_data`: \{ `block_hash`: `Uint8Array`; `deposit_count`: `number` \| `bigint`; `deposit_root`: `Uint8Array`; \}; `eth1_data_votes`: `object`[]; `eth1_deposit_index`: `number` \| `bigint`; `finalized_checkpoint`: \{ `epoch`: `number` \| `bigint`; `root`: `Uint8Array`; \}; `fork`: \{ `current_version`: `Uint8Array`; `epoch`: `number` \| `bigint`; `previous_version`: `Uint8Array`; \}; `genesis_time`: `number` \| `bigint`; `genesis_validators_root`: `Uint8Array`; `historical_roots`: `Uint8Array`\<`ArrayBufferLike`\>[]; `justification_bits`: `boolean`[]; `latest_block_header`: \{ `body_root`: `Uint8Array`; `parent_root`: `Uint8Array`; `proposer_index`: `number` \| `bigint`; `slot`: `number` \| `bigint`; `state_root`: `Uint8Array`; \}; `previous_epoch_participation`: (`number` \| `bigint`)[]; `previous_justified_checkpoint`: \{ `epoch`: `number` \| `bigint`; `root`: `Uint8Array`; \}; `randao_mixes`: `Uint8Array`\<`ArrayBufferLike`\>[]; `slashings`: (`number` \| `bigint`)[]; `slot`: `number` \| `bigint`; `state_roots`: `Uint8Array`\<`ArrayBufferLike`\>[]; `validators`: `object`[]; \}\> + +a BeaconState object of the type corresponding to the fork the state snapshot occurred at + +## Throws + +if BeaconState cannot be found diff --git a/packages/e2store/docs/functions/readBinaryFile.md b/packages/e2store/docs/functions/readBinaryFile.md new file mode 100644 index 00000000000..aaf6596273c --- /dev/null +++ b/packages/e2store/docs/functions/readBinaryFile.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readBinaryFile + +# Function: readBinaryFile() + +> **readBinaryFile**(`path`): `Uint8Array`\<`ArrayBuffer`\> + +Defined in: [packages/e2store/src/index.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/index.ts#L12) + +## Parameters + +### path + +`string` + +## Returns + +`Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/e2store/docs/functions/readBlockIndex.md b/packages/e2store/docs/functions/readBlockIndex.md new file mode 100644 index 00000000000..ad918a3358b --- /dev/null +++ b/packages/e2store/docs/functions/readBlockIndex.md @@ -0,0 +1,33 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readBlockIndex + +# Function: readBlockIndex() + +> **readBlockIndex**(`data`, `count`): `object` + +Defined in: [packages/e2store/src/blockIndex.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/blockIndex.ts#L20) + +## Parameters + +### data + +`Uint8Array` + +### count + +`number` + +## Returns + +`object` + +### offsets + +> **offsets**: `number`[] + +### startingNumber + +> **startingNumber**: `number` diff --git a/packages/e2store/docs/functions/readBlockTupleAtOffset.md b/packages/e2store/docs/functions/readBlockTupleAtOffset.md new file mode 100644 index 00000000000..c774881afe4 --- /dev/null +++ b/packages/e2store/docs/functions/readBlockTupleAtOffset.md @@ -0,0 +1,49 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readBlockTupleAtOffset + +# Function: readBlockTupleAtOffset() + +> **readBlockTupleAtOffset**(`bytes`, `recordStart`, `offset`): `object` + +Defined in: [packages/e2store/src/era1/blockTuple.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/blockTuple.ts#L66) + +## Parameters + +### bytes + +`Uint8Array` + +### recordStart + +`number` + +### offset + +`number` + +## Returns + +`object` + +### bodyEntry + +> **bodyEntry**: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +### headerEntry + +> **headerEntry**: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +### length + +> **length**: `number` = `totalLength` + +### receiptsEntry + +> **receiptsEntry**: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +### totalDifficultyEntry + +> **totalDifficultyEntry**: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md) diff --git a/packages/e2store/docs/functions/readBlockTuplesFromERA1.md b/packages/e2store/docs/functions/readBlockTuplesFromERA1.md new file mode 100644 index 00000000000..b170c0da12c --- /dev/null +++ b/packages/e2store/docs/functions/readBlockTuplesFromERA1.md @@ -0,0 +1,33 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readBlockTuplesFromERA1 + +# Function: readBlockTuplesFromERA1() + +> **readBlockTuplesFromERA1**(`bytes`, `count`, `offsets`, `recordStart`): `AsyncGenerator`\<\{ `bodyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `headerEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `receiptsEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `totalDifficultyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); \}, `void`, `unknown`\> + +Defined in: [packages/e2store/src/era1/era1.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/era1.ts#L81) + +## Parameters + +### bytes + +`Uint8Array` + +### count + +`number` + +### offsets + +`number`[] + +### recordStart + +`number` + +## Returns + +`AsyncGenerator`\<\{ `bodyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `headerEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `receiptsEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `totalDifficultyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); \}, `void`, `unknown`\> diff --git a/packages/e2store/docs/functions/readBlocksFromEra.md b/packages/e2store/docs/functions/readBlocksFromEra.md new file mode 100644 index 00000000000..23e40d70216 --- /dev/null +++ b/packages/e2store/docs/functions/readBlocksFromEra.md @@ -0,0 +1,27 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readBlocksFromEra + +# Function: readBlocksFromEra() + +> **readBlocksFromEra**(`eraFile`): `AsyncGenerator`\<\{ `message`: \{ `body`: \{ `attestations`: `object`[]; `attester_slashings`: `object`[]; `deposits`: `object`[]; `eth1_data`: \{ `block_hash`: `Uint8Array`; `deposit_count`: `number` \| `bigint`; `deposit_root`: `Uint8Array`; \}; `graffiti`: `Uint8Array`; `proposer_slashings`: `object`[]; `randao_reveal`: `Uint8Array`; `voluntary_exits`: `object`[]; \}; `parent_root`: `Uint8Array`; `proposer_index`: `number` \| `bigint`; `slot`: `number` \| `bigint`; `state_root`: `Uint8Array`; \}; `signature`: `Uint8Array`; \}, `void`, `unknown`\> + +Defined in: [packages/e2store/src/era/era.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era/era.ts#L123) + +Reads a an era file and yields a stream of decompressed SignedBeaconBlocks + +## Parameters + +### eraFile + +`Uint8Array` + +Uint8Array a serialized era file + +## Returns + +`AsyncGenerator`\<\{ `message`: \{ `body`: \{ `attestations`: `object`[]; `attester_slashings`: `object`[]; `deposits`: `object`[]; `eth1_data`: \{ `block_hash`: `Uint8Array`; `deposit_count`: `number` \| `bigint`; `deposit_root`: `Uint8Array`; \}; `graffiti`: `Uint8Array`; `proposer_slashings`: `object`[]; `randao_reveal`: `Uint8Array`; `voluntary_exits`: `object`[]; \}; `parent_root`: `Uint8Array`; `proposer_index`: `number` \| `bigint`; `slot`: `number` \| `bigint`; `state_root`: `Uint8Array`; \}; `signature`: `Uint8Array`; \}, `void`, `unknown`\> + +a stream of decompressed SignedBeaconBlocks or undefined if no blocks are present diff --git a/packages/e2store/docs/functions/readE2HSTupleAtIndex.md b/packages/e2store/docs/functions/readE2HSTupleAtIndex.md new file mode 100644 index 00000000000..9584847226e --- /dev/null +++ b/packages/e2store/docs/functions/readE2HSTupleAtIndex.md @@ -0,0 +1,25 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readE2HSTupleAtIndex + +# Function: readE2HSTupleAtIndex() + +> **readE2HSTupleAtIndex**(`bytes`, `index`): `Promise`\<\{ `bodyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `headerWithProofEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `receiptsEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); \}\> + +Defined in: [packages/e2store/src/e2hs/e2hs.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2hs/e2hs.ts#L62) + +## Parameters + +### bytes + +`Uint8Array` + +### index + +`number` + +## Returns + +`Promise`\<\{ `bodyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `headerWithProofEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `receiptsEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); \}\> diff --git a/packages/e2store/docs/functions/readE2HSTupleAtOffset.md b/packages/e2store/docs/functions/readE2HSTupleAtOffset.md new file mode 100644 index 00000000000..1d7ffb3ed15 --- /dev/null +++ b/packages/e2store/docs/functions/readE2HSTupleAtOffset.md @@ -0,0 +1,37 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readE2HSTupleAtOffset + +# Function: readE2HSTupleAtOffset() + +> **readE2HSTupleAtOffset**(`bytes`, `offset`): `object` + +Defined in: [packages/e2store/src/e2hs/blockTuple.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2hs/blockTuple.ts#L24) + +## Parameters + +### bytes + +`Uint8Array` + +### offset + +`number` + +## Returns + +`object` + +### bodyEntry + +> **bodyEntry**: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +### headerWithProofEntry + +> **headerWithProofEntry**: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +### receiptsEntry + +> **receiptsEntry**: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md) diff --git a/packages/e2store/docs/functions/readERA1.md b/packages/e2store/docs/functions/readERA1.md new file mode 100644 index 00000000000..1c36e7880db --- /dev/null +++ b/packages/e2store/docs/functions/readERA1.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readERA1 + +# Function: readERA1() + +> **readERA1**(`bytes`): `Promise`\<`AsyncGenerator`\<\{ `bodyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `headerEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `receiptsEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `totalDifficultyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); \}, `void`, `unknown`\>\> + +Defined in: [packages/e2store/src/era1/era1.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/era1.ts#L117) + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +`Promise`\<`AsyncGenerator`\<\{ `bodyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `headerEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `receiptsEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `totalDifficultyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); \}, `void`, `unknown`\>\> diff --git a/packages/e2store/docs/functions/readEntry.md b/packages/e2store/docs/functions/readEntry.md new file mode 100644 index 00000000000..74e64a0494a --- /dev/null +++ b/packages/e2store/docs/functions/readEntry.md @@ -0,0 +1,31 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readEntry + +# Function: readEntry() + +> **readEntry**(`bytes`): [`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +Defined in: [packages/e2store/src/e2store.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2store.ts#L50) + +Reads the first e2Store formatted entry from a string of bytes + +## Parameters + +### bytes + +`Uint8Array` + +a Uint8Array containing one or more serialized [e2StoreEntry](../type-aliases/e2StoreEntry.md) + +## Returns + +[`e2StoreEntry`](../type-aliases/e2StoreEntry.md) + +a deserialized [e2StoreEntry](../type-aliases/e2StoreEntry.md) + +## Throws + +if the length of the entry read is greater than the possible number of bytes in the data element diff --git a/packages/e2store/docs/functions/readOtherEntries.md b/packages/e2store/docs/functions/readOtherEntries.md new file mode 100644 index 00000000000..0f2a062e172 --- /dev/null +++ b/packages/e2store/docs/functions/readOtherEntries.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readOtherEntries + +# Function: readOtherEntries() + +> **readOtherEntries**(`bytes`): `Promise`\<\{ `accumulatorRoot`: `Uint8Array`\<`ArrayBufferLike`\>; `otherEntries`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md)[]; \}\> + +Defined in: [packages/e2store/src/era1/era1.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/era1.ts#L98) + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +`Promise`\<\{ `accumulatorRoot`: `Uint8Array`\<`ArrayBufferLike`\>; `otherEntries`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md)[]; \}\> diff --git a/packages/e2store/docs/functions/readSlotIndex.md b/packages/e2store/docs/functions/readSlotIndex.md new file mode 100644 index 00000000000..e3495f7a834 --- /dev/null +++ b/packages/e2store/docs/functions/readSlotIndex.md @@ -0,0 +1,27 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readSlotIndex + +# Function: readSlotIndex() + +> **readSlotIndex**(`bytes`): [`SlotIndex`](../type-aliases/SlotIndex.md) + +Defined in: [packages/e2store/src/era/era.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era/era.ts#L13) + +Reads a Slot Index from the end of a bytestring representing an era file + +## Parameters + +### bytes + +`Uint8Array` + +a Uint8Array bytestring representing a [SlotIndex](../type-aliases/SlotIndex.md) plus any arbitrary prefixed data + +## Returns + +[`SlotIndex`](../type-aliases/SlotIndex.md) + +a deserialized [SlotIndex](../type-aliases/SlotIndex.md) diff --git a/packages/e2store/docs/functions/readTuplesFromE2HS.md b/packages/e2store/docs/functions/readTuplesFromE2HS.md new file mode 100644 index 00000000000..389547acfa2 --- /dev/null +++ b/packages/e2store/docs/functions/readTuplesFromE2HS.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / readTuplesFromE2HS + +# Function: readTuplesFromE2HS() + +> **readTuplesFromE2HS**(`bytes`): `AsyncGenerator`\<\{ `bodyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `headerWithProofEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `receiptsEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); \}, `void`, `unknown`\> + +Defined in: [packages/e2store/src/e2hs/e2hs.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2hs/e2hs.ts#L50) + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +`AsyncGenerator`\<\{ `bodyEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `headerWithProofEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); `receiptsEntry`: [`e2StoreEntry`](../type-aliases/e2StoreEntry.md); \}, `void`, `unknown`\> diff --git a/packages/e2store/docs/functions/validateERA1.md b/packages/e2store/docs/functions/validateERA1.md new file mode 100644 index 00000000000..8fa071cced1 --- /dev/null +++ b/packages/e2store/docs/functions/validateERA1.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / validateERA1 + +# Function: validateERA1() + +> **validateERA1**(`bytes`): `Promise`\<`boolean`\> + +Defined in: [packages/e2store/src/era1/era1.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/era1/era1.ts#L138) + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +`Promise`\<`boolean`\> diff --git a/packages/e2store/docs/type-aliases/DBKey.md b/packages/e2store/docs/type-aliases/DBKey.md new file mode 100644 index 00000000000..9898eefb942 --- /dev/null +++ b/packages/e2store/docs/type-aliases/DBKey.md @@ -0,0 +1,11 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / DBKey + +# Type Alias: DBKey + +> **DBKey** = *typeof* [`DBKey`](../variables/DBKey.md)\[keyof *typeof* [`DBKey`](../variables/DBKey.md)\] + +Defined in: [packages/e2store/src/exportHistory.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L25) diff --git a/packages/e2store/docs/type-aliases/DBTarget.md b/packages/e2store/docs/type-aliases/DBTarget.md new file mode 100644 index 00000000000..bdb27fdcf9e --- /dev/null +++ b/packages/e2store/docs/type-aliases/DBTarget.md @@ -0,0 +1,11 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / DBTarget + +# Type Alias: DBTarget + +> **DBTarget** = *typeof* [`DBTarget`](../variables/DBTarget.md)\[keyof *typeof* [`DBTarget`](../variables/DBTarget.md)\] + +Defined in: [packages/e2store/src/exportHistory.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L16) diff --git a/packages/e2store/docs/type-aliases/SlotIndex.md b/packages/e2store/docs/type-aliases/SlotIndex.md new file mode 100644 index 00000000000..9a379a637c3 --- /dev/null +++ b/packages/e2store/docs/type-aliases/SlotIndex.md @@ -0,0 +1,35 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / SlotIndex + +# Type Alias: SlotIndex + +> **SlotIndex** = `object` + +Defined in: [packages/e2store/src/types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L51) + +## Properties + +### recordStart + +> **recordStart**: `number` + +Defined in: [packages/e2store/src/types.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L53) + +*** + +### slotOffsets + +> **slotOffsets**: `number`[] + +Defined in: [packages/e2store/src/types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L54) + +*** + +### startSlot + +> **startSlot**: `number` + +Defined in: [packages/e2store/src/types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L52) diff --git a/packages/e2store/docs/type-aliases/e2StoreEntry.md b/packages/e2store/docs/type-aliases/e2StoreEntry.md new file mode 100644 index 00000000000..48bd7c90b05 --- /dev/null +++ b/packages/e2store/docs/type-aliases/e2StoreEntry.md @@ -0,0 +1,27 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / e2StoreEntry + +# Type Alias: e2StoreEntry + +> **e2StoreEntry** = `object` + +Defined in: [packages/e2store/src/types.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L3) + +## Properties + +### data + +> **data**: `Uint8Array` + +Defined in: [packages/e2store/src/types.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L5) + +*** + +### type + +> **type**: `Uint8Array` + +Defined in: [packages/e2store/src/types.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L4) diff --git a/packages/e2store/docs/variables/CommonTypes.md b/packages/e2store/docs/variables/CommonTypes.md new file mode 100644 index 00000000000..8bca54f342c --- /dev/null +++ b/packages/e2store/docs/variables/CommonTypes.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / CommonTypes + +# Variable: CommonTypes + +> `const` **CommonTypes**: `object` + +Defined in: [packages/e2store/src/types.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L8) + +## Type declaration + +### BlockIndex + +> `readonly` **BlockIndex**: `Uint8Array`\<`ArrayBuffer`\> + +### Version + +> `readonly` **Version**: `Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/e2store/docs/variables/DBKey.md b/packages/e2store/docs/variables/DBKey.md new file mode 100644 index 00000000000..47c44e7afbf --- /dev/null +++ b/packages/e2store/docs/variables/DBKey.md @@ -0,0 +1,17 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / DBKey + +# Variable: DBKey + +> **DBKey**: `object` + +Defined in: [packages/e2store/src/exportHistory.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L25) + +## Type declaration + +### Receipts + +> `readonly` **Receipts**: `0` = `0` diff --git a/packages/e2store/docs/variables/DBTarget.md b/packages/e2store/docs/variables/DBTarget.md new file mode 100644 index 00000000000..abbd2668666 --- /dev/null +++ b/packages/e2store/docs/variables/DBTarget.md @@ -0,0 +1,29 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / DBTarget + +# Variable: DBTarget + +> **DBTarget**: `object` + +Defined in: [packages/e2store/src/exportHistory.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/exportHistory.ts#L16) + +## Type declaration + +### Body + +> `readonly` **Body**: `6` = `6` + +### Header + +> `readonly` **Header**: `7` = `7` + +### NumberToHash + +> `readonly` **NumberToHash**: `4` = `4` + +### TotalDifficulty + +> `readonly` **TotalDifficulty**: `5` = `5` diff --git a/packages/e2store/docs/variables/E2HSTypes.md b/packages/e2store/docs/variables/E2HSTypes.md new file mode 100644 index 00000000000..eca6547c758 --- /dev/null +++ b/packages/e2store/docs/variables/E2HSTypes.md @@ -0,0 +1,40 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / E2HSTypes + +# Variable: E2HSTypes + +> `const` **E2HSTypes**: `object` + +Defined in: [packages/e2store/src/types.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L66) + +E2HS Type Identifiers +Version = { type: [0x65, 0x32], data: nil } +CompressedHeaderWithProof = { type: [0x03, 0x01], data: snappyFramed(ssz(header_with_proof)) } +CompressedBody = { type: [0x04, 0x00], data: snappyFramed(rlp(body)) } +CompressedReceipts = { type: [0x05, 0x00], data: snappyFramed(rlp(receipts)) } +BlockIndex = { type: [0x66, 0x32], data: block-index } + +## Type declaration + +### BlockIndex + +> `readonly` **BlockIndex**: `Uint8Array`\<`ArrayBuffer`\> + +### CompressedBody + +> `readonly` **CompressedBody**: `Uint8Array`\<`ArrayBuffer`\> + +### CompressedHeaderWithProof + +> `readonly` **CompressedHeaderWithProof**: `Uint8Array`\<`ArrayBuffer`\> + +### CompressedReceipts + +> `readonly` **CompressedReceipts**: `Uint8Array`\<`ArrayBuffer`\> + +### Version + +> `readonly` **Version**: `Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/e2store/docs/variables/EpochAccumulator.md b/packages/e2store/docs/variables/EpochAccumulator.md new file mode 100644 index 00000000000..fd19b64adce --- /dev/null +++ b/packages/e2store/docs/variables/EpochAccumulator.md @@ -0,0 +1,11 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / EpochAccumulator + +# Variable: EpochAccumulator + +> `const` **EpochAccumulator**: `SSZCoder`\<`object`[]\> + +Defined in: [packages/e2store/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L36) diff --git a/packages/e2store/docs/variables/Era1Types.md b/packages/e2store/docs/variables/Era1Types.md new file mode 100644 index 00000000000..84c56ce874e --- /dev/null +++ b/packages/e2store/docs/variables/Era1Types.md @@ -0,0 +1,35 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / Era1Types + +# Variable: Era1Types + +> `const` **Era1Types**: `object` + +Defined in: [packages/e2store/src/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L14) + +Era 1 Type Identifiers + +## Type declaration + +### AccumulatorRoot + +> `readonly` **AccumulatorRoot**: `Uint8Array`\<`ArrayBuffer`\> + +### CompressedBody + +> `readonly` **CompressedBody**: `Uint8Array`\<`ArrayBuffer`\> + +### CompressedHeader + +> `readonly` **CompressedHeader**: `Uint8Array`\<`ArrayBuffer`\> + +### CompressedReceipts + +> `readonly` **CompressedReceipts**: `Uint8Array`\<`ArrayBuffer`\> + +### TotalDifficulty + +> `readonly` **TotalDifficulty**: `Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/e2store/docs/variables/EraTypes.md b/packages/e2store/docs/variables/EraTypes.md new file mode 100644 index 00000000000..3343d826277 --- /dev/null +++ b/packages/e2store/docs/variables/EraTypes.md @@ -0,0 +1,31 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / EraTypes + +# Variable: EraTypes + +> `const` **EraTypes**: `object` + +Defined in: [packages/e2store/src/types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L44) + +Era Type Identifiers + +## Type declaration + +### CompressedBeaconState + +> **CompressedBeaconState**: `Uint8Array`\<`ArrayBuffer`\> + +### CompressedSignedBeaconBlockType + +> **CompressedSignedBeaconBlockType**: `Uint8Array`\<`ArrayBuffer`\> + +### Empty + +> **Empty**: `Uint8Array`\<`ArrayBuffer`\> + +### SlotIndex + +> **SlotIndex**: `Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/e2store/docs/variables/HeaderRecord.md b/packages/e2store/docs/variables/HeaderRecord.md new file mode 100644 index 00000000000..9845fb18397 --- /dev/null +++ b/packages/e2store/docs/variables/HeaderRecord.md @@ -0,0 +1,13 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / HeaderRecord + +# Variable: HeaderRecord + +> `const` **HeaderRecord**: `SSZCoder`\<\{ `blockHash`: `Uint8Array`; `totalDifficulty`: `bigint`; \}\> + +Defined in: [packages/e2store/src/types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L28) + +Era1 SSZ containers diff --git a/packages/e2store/docs/variables/VERSION.md b/packages/e2store/docs/variables/VERSION.md new file mode 100644 index 00000000000..11f8bc756ef --- /dev/null +++ b/packages/e2store/docs/variables/VERSION.md @@ -0,0 +1,21 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / VERSION + +# Variable: VERSION + +> `const` **VERSION**: `object` + +Defined in: [packages/e2store/src/types.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/types.ts#L22) + +## Type declaration + +### data + +> **data**: `Uint8Array`\<`ArrayBuffer`\> + +### type + +> **type**: `Uint8Array`\<`ArrayBuffer`\> = `CommonTypes.Version` diff --git a/packages/e2store/docs/variables/sszHeaderWithProof.md b/packages/e2store/docs/variables/sszHeaderWithProof.md new file mode 100644 index 00000000000..db3dc40670b --- /dev/null +++ b/packages/e2store/docs/variables/sszHeaderWithProof.md @@ -0,0 +1,11 @@ +[**@ethereumjs/e2store**](../README.md) + +*** + +[@ethereumjs/e2store](../README.md) / sszHeaderWithProof + +# Variable: sszHeaderWithProof + +> `const` **sszHeaderWithProof**: `ContainerCoder`\<\{ `header`: `ByteListType`; `proof`: `ByteListType`; \}\> + +Defined in: [packages/e2store/src/e2hs/blockTuple.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/e2store/src/e2hs/blockTuple.ts#L39) diff --git a/packages/era/eslint.config.mjs b/packages/e2store/eslint.config.mjs similarity index 100% rename from packages/era/eslint.config.mjs rename to packages/e2store/eslint.config.mjs diff --git a/packages/era/package.json b/packages/e2store/package.json similarity index 87% rename from packages/era/package.json rename to packages/e2store/package.json index 6b7c61e9887..a9481a36449 100644 --- a/packages/era/package.json +++ b/packages/e2store/package.json @@ -1,11 +1,11 @@ { - "name": "@ethereumjs/era", + "name": "@ethereumjs/e2store", "version": "10.0.0-dev-rc.1", - "description": "Era file support for EthereumJS", - "keywords": ["ethereum", "era", "era1"], - "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/era#readme", + "description": "E2Store support for EthereumJS", + "keywords": ["ethereum", "e2store", "e2hs", "era", "era1", "era2", "storage", "snappy"], + "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/e2store#readme", "bugs": { - "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+era%22" + "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+e2store%22" }, "repository": { "type": "git", @@ -40,7 +40,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "npx typedoc --options typedoc.cjs", + "docs:build": "npx typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- util", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", diff --git a/packages/e2store/src/blockIndex.ts b/packages/e2store/src/blockIndex.ts new file mode 100644 index 00000000000..733434fb739 --- /dev/null +++ b/packages/e2store/src/blockIndex.ts @@ -0,0 +1,57 @@ +import { EthereumJSErrorWithoutCode } from '@ethereumjs/rlp' +import { bigInt64ToBytes, bytesToBigInt64, concatBytes, equalsBytes } from '@ethereumjs/util' +import { formatEntry, readEntry } from './e2store.ts' +import { CommonTypes, VERSION } from './types.ts' + +export function getBlockIndex(bytes: Uint8Array) { + const count = Number(bytesToBigInt64(bytes.slice(-8), true)) + const recordLength = 8 * count + 24 + const recordEnd = bytes.length + const recordStart = recordEnd - recordLength + const { data, type } = readEntry(bytes.subarray(recordStart, recordEnd)) + if (!equalsBytes(type, CommonTypes.BlockIndex)) { + throw EthereumJSErrorWithoutCode( + `Expected block index (type: ${CommonTypes.BlockIndex}) but got ${type}`, + ) + } + return { data, type, count, recordStart } +} + +export function readBlockIndex(data: Uint8Array, count: number) { + const startingNumber = Number(bytesToBigInt64(data.slice(0, 8), true)) + const offsets: number[] = [] + for (let i = 0; i < count; i++) { + const slotEntry = data.subarray((i + 1) * 8, (i + 2) * 8) + const offset = Number(new DataView(slotEntry.slice(0, 8).buffer).getBigInt64(0, true)) + offsets.push(offset) + } + return { + startingNumber, + offsets, + } +} + +export async function createBlockIndex(blockTuples: Uint8Array[], startingNumber: bigint) { + const version = await formatEntry(VERSION) + const tuplesLength = blockTuples.reduce((acc, b) => acc + b.length, 0) + const count = bigInt64ToBytes(BigInt(blockTuples.length), true) + const blockIndexLength = 8 * blockTuples.length + 24 + const e2hsLength = version.length + tuplesLength + count.length + blockIndexLength + const recordStart = e2hsLength - blockIndexLength + const offsetBigInt: bigint[] = [] + for (let i = 0; i < blockTuples.length; i++) { + if (i === 0) { + const offset = 8 - recordStart + offsetBigInt.push(BigInt(offset)) + } else { + const offset = offsetBigInt[i - 1] + BigInt(blockTuples[i - 1].length) + offsetBigInt.push(offset) + } + } + const offsets: Uint8Array[] = offsetBigInt.map((o) => bigInt64ToBytes(o, true)) + const blockIndex = await formatEntry({ + type: CommonTypes.BlockIndex, + data: concatBytes(bigInt64ToBytes(startingNumber, true), ...offsets, count), + }) + return blockIndex +} diff --git a/packages/e2store/src/e2hs/blockTuple.ts b/packages/e2store/src/e2hs/blockTuple.ts new file mode 100644 index 00000000000..3c84cabfc79 --- /dev/null +++ b/packages/e2store/src/e2hs/blockTuple.ts @@ -0,0 +1,66 @@ +import { bytelist, container } from 'micro-eth-signer/ssz' +import { readEntry } from '../e2store.ts' +import { decompressData } from '../snappy.ts' + +import { RLP } from '@ethereumjs/rlp' +import type { NestedUint8Array } from '@ethereumjs/util' +import type { e2StoreEntry } from '../types.ts' + +export async function decompressE2HSTuple({ + headerWithProofEntry, + bodyEntry, + receiptsEntry, +}: { + headerWithProofEntry: e2StoreEntry + bodyEntry: e2StoreEntry + receiptsEntry: e2StoreEntry +}): Promise { + const headerWithProof = await decompressData(headerWithProofEntry.data) + const body = await decompressData(bodyEntry.data) + const receipts = await decompressData(receiptsEntry.data) + return { headerWithProof, body, receipts } +} + +export function readE2HSTupleAtOffset(bytes: Uint8Array, offset: number) { + const headerWithProofEntry = readEntry(bytes.slice(offset)) + const headerWithProofLength = headerWithProofEntry.data.length + 8 + const bodyEntry = readEntry(bytes.slice(offset + headerWithProofLength)) + const bodyLength = bodyEntry.data.length + 8 + const receiptsEntry = readEntry(bytes.slice(offset + headerWithProofLength + bodyLength)) + return { headerWithProofEntry, bodyEntry, receiptsEntry } +} + +const MAX_HEADER_LENGTH = 2048 +const MAX_HEADER_PROOF_LENGTH = 1024 + +const sszHeader = bytelist(MAX_HEADER_LENGTH) +const sszProof = bytelist(MAX_HEADER_PROOF_LENGTH) + +export const sszHeaderWithProof = container({ + header: sszHeader, + proof: sszProof, +}) + +type HeaderWithProof = { + header: Uint8Array + proof: Uint8Array +} + +type RawBlockTuple = { + headerWithProof: HeaderWithProof + body: Uint8Array | NestedUint8Array + receipts: Uint8Array | NestedUint8Array +} + +type EncodedBlockTuple = { + headerWithProof: Uint8Array + body: Uint8Array + receipts: Uint8Array +} + +export function parseEH2SBlockTuple(tuple: EncodedBlockTuple): RawBlockTuple { + const headerWithProof = sszHeaderWithProof.decode(tuple.headerWithProof) + const body = RLP.decode(tuple.body) + const receipts = RLP.decode(tuple.receipts) + return { headerWithProof, body, receipts } +} diff --git a/packages/e2store/src/e2hs/e2hs.ts b/packages/e2store/src/e2hs/e2hs.ts new file mode 100644 index 00000000000..cc165c025bd --- /dev/null +++ b/packages/e2store/src/e2hs/e2hs.ts @@ -0,0 +1,66 @@ +// https://github.com/eth-clients/e2store-format-specs/blob/main/formats/e2hs.md + +import { concatBytes } from '@ethereumjs/util' +import { createBlockIndex, getBlockIndex, readBlockIndex } from '../blockIndex.ts' +import { formatEntry } from '../e2store.ts' +import { E2HSTypes, VERSION } from '../types.ts' +import { readE2HSTupleAtOffset } from './blockTuple.ts' + +// e2hs := Version | block-tuple* | other-entries* | BlockIndex +// block-tuple := CompressedHeaderWithProof | CompressedBody | CompressedReceipts + +/** + * Format E2HS + * @param data array of block tuples + * @param epoch epoch index + * @returns serialized E2HS + */ +export const formatE2HS = async ( + data: Array<{ + headerWithProof: Uint8Array + body: Uint8Array + receipts: Uint8Array + }>, + epoch: number, +) => { + const version = await formatEntry(VERSION) + const blockTuples = [] + for (const { headerWithProof, body, receipts } of data) { + const compressedHeaderWithProof = await formatEntry({ + type: E2HSTypes.CompressedHeaderWithProof, + data: headerWithProof, + }) + const compressedBody = await formatEntry({ + type: E2HSTypes.CompressedBody, + data: body, + }) + const compressedReceipts = await formatEntry({ + type: E2HSTypes.CompressedReceipts, + data: receipts, + }) + const entry = concatBytes(compressedHeaderWithProof, compressedBody, compressedReceipts) + blockTuples.push(entry) + } + const startingNumber = BigInt(epoch * 8192) + const blockIndex = await createBlockIndex(blockTuples, startingNumber) + const e2hs = concatBytes(version, ...blockTuples, blockIndex) + return e2hs +} + +export async function* readTuplesFromE2HS(bytes: Uint8Array) { + const { data, count } = getBlockIndex(bytes) + const { offsets } = readBlockIndex(data, count) + for (let x = 0; x < count; x++) { + try { + yield readE2HSTupleAtOffset(bytes, offsets[x]) + } catch { + // noop - we skip empty slots + } + } +} + +export async function readE2HSTupleAtIndex(bytes: Uint8Array, index: number) { + const { data, count } = getBlockIndex(bytes) + const { offsets } = readBlockIndex(data, count) + return readE2HSTupleAtOffset(bytes, offsets[index]) +} diff --git a/packages/e2store/src/e2hs/index.ts b/packages/e2store/src/e2hs/index.ts new file mode 100644 index 00000000000..c8fe3efebad --- /dev/null +++ b/packages/e2store/src/e2hs/index.ts @@ -0,0 +1,2 @@ +export * from './e2hs.ts' +export * from './blockTuple.ts' diff --git a/packages/era/src/e2store.ts b/packages/e2store/src/e2store.ts similarity index 93% rename from packages/era/src/e2store.ts rename to packages/e2store/src/e2store.ts index 1e2cc1e9848..ff5891a7564 100644 --- a/packages/era/src/e2store.ts +++ b/packages/e2store/src/e2store.ts @@ -9,7 +9,7 @@ import { import { uint256 } from 'micro-eth-signer/ssz' import { compressData, decompressData } from './snappy.ts' -import { Era1Types, EraTypes } from './types.ts' +import { CommonTypes, Era1Types, EraTypes } from './types.ts' import type { e2StoreEntry } from './types.ts' @@ -29,7 +29,7 @@ export async function parseEntry(entry: e2StoreEntry) { case bytesToHex(Era1Types.CompressedReceipts): data = RLP.decode(decompressed) break - case bytesToHex(Era1Types.Version): + case bytesToHex(CommonTypes.Version): case bytesToHex(Era1Types.AccumulatorRoot): case bytesToHex(EraTypes.CompressedBeaconState): case bytesToHex(EraTypes.CompressedSignedBeaconBlockType): @@ -84,9 +84,9 @@ export const formatEntry = async ({ ? data : equalsBytes(type, Era1Types.AccumulatorRoot) ? data - : equalsBytes(type, Era1Types.Version) + : equalsBytes(type, CommonTypes.Version) ? data - : equalsBytes(type, Era1Types.BlockIndex) + : equalsBytes(type, CommonTypes.BlockIndex) ? data : await compressData(data) const length = compressed.length diff --git a/packages/era/src/era.ts b/packages/e2store/src/era/era.ts similarity index 98% rename from packages/era/src/era.ts rename to packages/e2store/src/era/era.ts index 65225eef2a1..649dee20500 100644 --- a/packages/era/src/era.ts +++ b/packages/e2store/src/era/era.ts @@ -1,9 +1,9 @@ import { EthereumJSErrorWithoutCode, bytesToHex, equalsBytes } from '@ethereumjs/util' import * as ssz from 'micro-eth-signer/ssz' -import { EraTypes, parseEntry, readEntry } from './index.ts' +import { EraTypes, parseEntry, readEntry } from '../index.ts' -import type { SlotIndex } from './index.ts' +import type { SlotIndex } from '../index.ts' /** * Reads a Slot Index from the end of a bytestring representing an era file diff --git a/packages/e2store/src/era/index.ts b/packages/e2store/src/era/index.ts new file mode 100644 index 00000000000..3e5fb02740c --- /dev/null +++ b/packages/e2store/src/era/index.ts @@ -0,0 +1 @@ +export * from './era.ts' diff --git a/packages/era/src/blockTuple.ts b/packages/e2store/src/era1/blockTuple.ts similarity index 96% rename from packages/era/src/blockTuple.ts rename to packages/e2store/src/era1/blockTuple.ts index 324e95543cb..9b462955cfd 100644 --- a/packages/era/src/blockTuple.ts +++ b/packages/e2store/src/era1/blockTuple.ts @@ -1,9 +1,9 @@ import { type Block, type BlockBytes, createBlockFromBytesArray } from '@ethereumjs/block' import { RLP } from '@ethereumjs/rlp' -import { parseEntry, readEntry } from './e2store.ts' +import { parseEntry, readEntry } from '../index.ts' -import type { e2StoreEntry } from './types.ts' +import type { e2StoreEntry } from '../index.ts' export async function createBlockTuples(blocks: Block[], blockReceipts: Uint8Array[], td: bigint) { const blockTuples: { diff --git a/packages/era/src/era1.ts b/packages/e2store/src/era1/era1.ts similarity index 66% rename from packages/era/src/era1.ts rename to packages/e2store/src/era1/era1.ts index f667de85f7d..178b63cda9b 100644 --- a/packages/era/src/era1.ts +++ b/packages/e2store/src/era1/era1.ts @@ -1,15 +1,17 @@ -import { - EthereumJSErrorWithoutCode, - bigInt64ToBytes, - bytesToBigInt64, - concatBytes, - equalsBytes, -} from '@ethereumjs/util' +import { concatBytes, equalsBytes } from '@ethereumjs/util' import * as ssz from 'micro-eth-signer/ssz' +import { + EpochAccumulator, + Era1Types, + VERSION, + createBlockIndex, + formatEntry, + getBlockIndex, + readBlockIndex, + readEntry, +} from '../index.ts' import { blockFromTuple, parseBlockTuple, readBlockTupleAtOffset } from './blockTuple.ts' -import { formatEntry, readEntry } from './e2store.ts' -import { EpochAccumulator, Era1Types, VERSION } from './types.ts' /** * Format era1 from epoch of history data @@ -58,7 +60,6 @@ export const formatEra1 = async ( ) blocks.push(entry) } - const blocksLength = blocks.reduce((acc, b) => acc + b.length, 0) const epochAccumulatorRoot = EpochAccumulator.merkleRoot(headerRecords) @@ -67,64 +68,16 @@ export const formatEra1 = async ( data: epochAccumulatorRoot, }) - const startingNumber = bigInt64ToBytes(BigInt(epoch * 8192), true) - const count = bigInt64ToBytes(BigInt(blocks.length), true) - - const blockIndexLength = 8 * blocks.length + 24 - - const eraLength = version.length + blocksLength + accumulatorEntry.length + blockIndexLength - - const recordStart = eraLength - blockIndexLength - const offsetBigInt: bigint[] = [] - for (let i = 0; i < blocks.length; i++) { - if (i === 0) { - const offset = 8 - recordStart - offsetBigInt.push(BigInt(offset)) - } else { - const offset = offsetBigInt[i - 1] + BigInt(blocks[i - 1].length) - offsetBigInt.push(offset) - } - } - - const offsets: Uint8Array[] = offsetBigInt.map((o) => bigInt64ToBytes(o, true)) + const startingNumber = BigInt(epoch * 8192) // startingNumber | index | index | index ... | count - const blockIndex = await formatEntry({ - type: Era1Types.BlockIndex, - data: concatBytes(startingNumber, ...offsets, count), - }) + const blockIndex = await createBlockIndex(blocks, startingNumber) // version | block-tuple* | other-entries | Accumulator | BLockIndex const era1 = concatBytes(version, ...blocks, accumulatorEntry, blockIndex) return era1 } -export function getBlockIndex(bytes: Uint8Array) { - const count = Number(bytesToBigInt64(bytes.slice(-8), true)) - const recordLength = 8 * count + 24 - const recordEnd = bytes.length - const recordStart = recordEnd - recordLength - const { data, type } = readEntry(bytes.subarray(recordStart, recordEnd)) - if (!equalsBytes(type, Era1Types.BlockIndex)) { - throw EthereumJSErrorWithoutCode('not a valid block index') - } - return { data, type, count, recordStart } -} - -export function readBlockIndex(data: Uint8Array, count: number) { - const startingNumber = Number(bytesToBigInt64(data.slice(0, 8), true)) - const offsets: number[] = [] - for (let i = 0; i < count; i++) { - const slotEntry = data.subarray((i + 1) * 8, (i + 2) * 8) - const offset = Number(new DataView(slotEntry.slice(0, 8).buffer).getBigInt64(0, true)) - offsets.push(offset) - } - return { - startingNumber, - offsets, - } -} - export async function* readBlockTuplesFromERA1( bytes: Uint8Array, count: number, diff --git a/packages/e2store/src/era1/index.ts b/packages/e2store/src/era1/index.ts new file mode 100644 index 00000000000..200d041cdf9 --- /dev/null +++ b/packages/e2store/src/era1/index.ts @@ -0,0 +1,2 @@ +export * from './era1.ts' +export * from './blockTuple.ts' diff --git a/packages/era/src/exportHistory.ts b/packages/e2store/src/exportHistory.ts similarity index 99% rename from packages/era/src/exportHistory.ts rename to packages/e2store/src/exportHistory.ts index 94327835b56..bb67f242963 100644 --- a/packages/era/src/exportHistory.ts +++ b/packages/e2store/src/exportHistory.ts @@ -4,7 +4,7 @@ import { RLP } from '@ethereumjs/rlp' import { bytesToBigInt, concatBytes, intToBytes } from '@ethereumjs/util' import { Level } from 'level' -import { formatEra1 } from './era1.ts' +import { formatEra1 } from './era1/index.ts' import type { BlockBodyBytes } from '@ethereumjs/block' diff --git a/packages/era/src/index.ts b/packages/e2store/src/index.ts similarity index 66% rename from packages/era/src/index.ts rename to packages/e2store/src/index.ts index bf1bc1f74cf..f1b1a354c42 100644 --- a/packages/era/src/index.ts +++ b/packages/e2store/src/index.ts @@ -1,11 +1,13 @@ import { readFileSync } from 'fs' -export * from './blockTuple.ts' +export * from './era/index.ts' export * from './e2store.ts' -export * from './era1.ts' +export * from './era1/index.ts' +export * from './e2hs/index.ts' export * from './exportHistory.ts' export * from './snappy.ts' export * from './types.ts' +export * from './blockIndex.ts' export function readBinaryFile(path: string) { return new Uint8Array(readFileSync(path)) diff --git a/packages/era/src/snappy.ts b/packages/e2store/src/snappy.ts similarity index 100% rename from packages/era/src/snappy.ts rename to packages/e2store/src/snappy.ts diff --git a/packages/era/src/types.ts b/packages/e2store/src/types.ts similarity index 61% rename from packages/era/src/types.ts rename to packages/e2store/src/types.ts index ce6f40f607e..929da875f25 100644 --- a/packages/era/src/types.ts +++ b/packages/e2store/src/types.ts @@ -5,19 +5,22 @@ export type e2StoreEntry = { data: Uint8Array } +export const CommonTypes = { + Version: new Uint8Array([0x65, 0x32]), + BlockIndex: new Uint8Array([0x66, 0x32]), +} as const + /** Era 1 Type Identifiers */ export const Era1Types = { - Version: new Uint8Array([0x65, 0x32]), CompressedHeader: new Uint8Array([0x03, 0x00]), CompressedBody: new Uint8Array([0x04, 0x00]), CompressedReceipts: new Uint8Array([0x05, 0x00]), TotalDifficulty: new Uint8Array([0x06, 0x00]), AccumulatorRoot: new Uint8Array([0x07, 0x00]), - BlockIndex: new Uint8Array([0x66, 0x32]), } as const export const VERSION = { - type: Era1Types.Version, + type: CommonTypes.Version, data: new Uint8Array([]), } @@ -50,3 +53,20 @@ export type SlotIndex = { recordStart: number slotOffsets: number[] } + +/** + * E2HS Type Identifiers + * Version = { type: [0x65, 0x32], data: nil } + * CompressedHeaderWithProof = { type: [0x03, 0x01], data: snappyFramed(ssz(header_with_proof)) } + * CompressedBody = { type: [0x04, 0x00], data: snappyFramed(rlp(body)) } + * CompressedReceipts = { type: [0x05, 0x00], data: snappyFramed(rlp(receipts)) } + * BlockIndex = { type: [0x66, 0x32], data: block-index } + */ + +export const E2HSTypes = { + Version: new Uint8Array([0x65, 0x32]), + CompressedHeaderWithProof: new Uint8Array([0x03, 0x01]), + CompressedBody: new Uint8Array([0x04, 0x00]), + CompressedReceipts: new Uint8Array([0x05, 0x00]), + BlockIndex: new Uint8Array([0x66, 0x32]), +} as const diff --git a/packages/era/src/types/snappy-stream.d.ts b/packages/e2store/src/types/snappy-stream.d.ts similarity index 100% rename from packages/era/src/types/snappy-stream.d.ts rename to packages/e2store/src/types/snappy-stream.d.ts diff --git a/packages/e2store/test/e2hs.spec.ts b/packages/e2store/test/e2hs.spec.ts new file mode 100644 index 00000000000..219924186d5 --- /dev/null +++ b/packages/e2store/test/e2hs.spec.ts @@ -0,0 +1,91 @@ +import { readFileSync } from 'fs' +import { createBlockHeaderFromRLP } from '@ethereumjs/block' +import { describe, expect, it } from 'vitest' +import { + CommonTypes, + decompressE2HSTuple, + getBlockIndex, + parseEH2SBlockTuple, + readBlockIndex, + readE2HSTupleAtIndex, + readTuplesFromE2HS, +} from '../src/index.ts' + +// Reference file downloaded from era1.ethportal.net +const filePath = './test/mainnet-00000-a6860fef.e2hs' +const expectedLength = 7356608 + +function readBinaryFile(filePath: string): Uint8Array { + const buffer = readFileSync(filePath) + return new Uint8Array(buffer) +} + +describe('Read E2HS', async () => { + const e2hsFile = readBinaryFile(filePath) + it('file should not have changed', () => { + expect(e2hsFile.length).toEqual(expectedLength) + }) + + const blockIndex = getBlockIndex(e2hsFile) + + it('should read the block index', () => { + expect(blockIndex.type).toEqual(CommonTypes.BlockIndex) + expect(blockIndex.count).toEqual(8192) + }) + + const { startingNumber, offsets } = readBlockIndex(blockIndex.data, blockIndex.count) + it('should read block Index', () => { + expect(blockIndex.recordStart).toEqual(e2hsFile.length - blockIndex.data.length - 8) + expect(startingNumber).toEqual(0) + expect(offsets.length).toEqual(8192) + }) + + // Test reading tuples from E2HS using the iterator + const tuples = readTuplesFromE2HS(e2hsFile) + for (let i = 0; i < 10; i++) { + const tuple = await tuples.next() + it('should read the block', () => { + expect(tuple.value).toBeDefined() + }) + const { headerWithProof, body, receipts } = parseEH2SBlockTuple( + await decompressE2HSTuple(tuple.value!), + ) + + it(`should read block ${i} body`, () => { + expect(body).toBeDefined() + }) + it(`should read block ${i} receipts`, () => { + expect(receipts).toBeDefined() + }) + + const blockHeader = createBlockHeaderFromRLP(headerWithProof.header, { setHardfork: true }) + + it(`should find block ${i} header`, () => { + expect(blockHeader.number).toEqual(BigInt(i)) + }) + } + + // Test reading tuples from E2HS using the index + for (let i = 0; i < 10; i++) { + const index = Math.floor(Math.random() * 8192) + const tuple = await readE2HSTupleAtIndex(e2hsFile, index) + it('should read the tuple', () => { + expect(tuple).toBeDefined() + }) + const { headerWithProof, body, receipts } = parseEH2SBlockTuple( + await decompressE2HSTuple(tuple), + ) + it(`should read block ${index} body`, () => { + expect(body).toBeDefined() + }) + it(`should read block ${index} receipts`, () => { + expect(receipts).toBeDefined() + }) + + const blockHeader = createBlockHeaderFromRLP(headerWithProof.header, { setHardfork: true }) + + it(`should find block ${index} header`, () => { + expect(blockHeader.number).toEqual(BigInt(index)) + }) + } +}) diff --git a/packages/era/test/era.spec.ts b/packages/e2store/test/era.spec.ts similarity index 96% rename from packages/era/test/era.spec.ts rename to packages/e2store/test/era.spec.ts index 093ede73b1a..e73abaf3e07 100644 --- a/packages/era/test/era.spec.ts +++ b/packages/e2store/test/era.spec.ts @@ -1,7 +1,12 @@ import { readFileSync } from 'fs' import { assert, beforeAll, describe, it } from 'vitest' -import { readBeaconBlock, readBeaconState, readBlocksFromEra, readSlotIndex } from '../src/era.ts' +import { + readBeaconBlock, + readBeaconState, + readBlocksFromEra, + readSlotIndex, +} from '../src/era/index.ts' import { readBinaryFile } from '../src/index.ts' // To test this, download mainnet-01339-75d1c621.era from https://mainnet.era.nimbus.team/mainnet-01339-75d1c621.era diff --git a/packages/era/test/era1.spec.ts b/packages/e2store/test/era1.spec.ts similarity index 96% rename from packages/era/test/era1.spec.ts rename to packages/e2store/test/era1.spec.ts index 6cdc1004e56..39cba52e859 100644 --- a/packages/era/test/era1.spec.ts +++ b/packages/e2store/test/era1.spec.ts @@ -4,7 +4,7 @@ import { bytesToHex } from '@ethereumjs/util' import { assert, describe, expect, it } from 'vitest' import { - Era1Types, + CommonTypes, getBlockIndex, parseBlockTuple, readBlockIndex, @@ -29,7 +29,7 @@ describe('Read Era1', async () => { }) const blockIndex = getBlockIndex(era1File) it('should have block index type', () => { - assert.deepEqual(blockIndex.type, Era1Types.BlockIndex) + assert.deepEqual(blockIndex.type, CommonTypes.BlockIndex) }) it('should have correct count', () => { expect(blockIndex.count).toEqual(8192) diff --git a/packages/era/test/exportHistory.spec.ts b/packages/e2store/test/exportHistory.spec.ts similarity index 94% rename from packages/era/test/exportHistory.spec.ts rename to packages/e2store/test/exportHistory.spec.ts index 00d7924eb3c..a399811d55b 100644 --- a/packages/era/test/exportHistory.spec.ts +++ b/packages/e2store/test/exportHistory.spec.ts @@ -1,9 +1,9 @@ -import { bytesToBigInt64, hexToBytes } from '@ethereumjs/util' +import { type PrefixedHexString, bytesToBigInt64, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' import { compressData, formatEntry } from '../src/index.ts' describe('era1', async () => { - const test = { + const test: { compressed: PrefixedHexString; decompressed: PrefixedHexString } = { compressed: '0xff060000734e6150705900cb0000ec6da9a6970410f90214a0007a010088a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794004a4200f043a0d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0567a210004b9014a7800fe0100fe0100fe0100b6010004850401f098808213888080a011bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa82ea0120880000000000000042', decompressed: diff --git a/packages/era/test/mainnet-00000-5ec1ffb8.era1 b/packages/e2store/test/mainnet-00000-5ec1ffb8.era1 similarity index 100% rename from packages/era/test/mainnet-00000-5ec1ffb8.era1 rename to packages/e2store/test/mainnet-00000-5ec1ffb8.era1 diff --git a/packages/e2store/test/mainnet-00000-a6860fef.e2hs b/packages/e2store/test/mainnet-00000-a6860fef.e2hs new file mode 100644 index 00000000000..0ec68f1e71b Binary files /dev/null and b/packages/e2store/test/mainnet-00000-a6860fef.e2hs differ diff --git a/packages/era/test/mainnet-00001-40cf2f3c.era b/packages/e2store/test/mainnet-00001-40cf2f3c.era similarity index 100% rename from packages/era/test/mainnet-00001-40cf2f3c.era rename to packages/e2store/test/mainnet-00001-40cf2f3c.era diff --git a/packages/era/tsconfig.json b/packages/e2store/tsconfig.json similarity index 100% rename from packages/era/tsconfig.json rename to packages/e2store/tsconfig.json diff --git a/packages/era/tsconfig.lint.json b/packages/e2store/tsconfig.lint.json similarity index 100% rename from packages/era/tsconfig.lint.json rename to packages/e2store/tsconfig.lint.json diff --git a/packages/era/tsconfig.prod.cjs.json b/packages/e2store/tsconfig.prod.cjs.json similarity index 100% rename from packages/era/tsconfig.prod.cjs.json rename to packages/e2store/tsconfig.prod.cjs.json diff --git a/packages/era/tsconfig.prod.esm.json b/packages/e2store/tsconfig.prod.esm.json similarity index 100% rename from packages/era/tsconfig.prod.esm.json rename to packages/e2store/tsconfig.prod.esm.json diff --git a/packages/era/typedoc.cjs b/packages/e2store/typedoc.mjs similarity index 53% rename from packages/era/typedoc.cjs rename to packages/e2store/typedoc.mjs index 0c5a50bf952..766425d2740 100644 --- a/packages/era/typedoc.cjs +++ b/packages/e2store/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/*.ts'], diff --git a/packages/era/README.md b/packages/era/README.md deleted file mode 100644 index 9c62e0c14ae..00000000000 --- a/packages/era/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# @ethereumjs/era - -[![NPM Package][era-npm-badge]][era-npm-link] -[![GitHub Issues][era-issues-badge]][era-issues-link] -[![Actions Status][era-actions-badge]][era-actions-link] -[![Code Coverage][era-coverage-badge]][era-coverage-link] -[![Discord][discord-badge]][discord-link] - -| A collection of utility functions for Ethereum. | -| ----------------------------------------------- | - -## Installation - -To obtain the latest version, simply require the project using `npm`: - -```shell -npm install @ethereumjs/era -``` - -## Usage - -All helpers are re-exported from the root level and deep imports are not necessary. So an import can be done like this: - -```ts -import { formatEntry } from "@ethereumjs/era"; -``` - -### Export History as Era1 - -Export history in epochs of 8192 blocks as Era1 files - -```ts -import { exportEpochAsEra1 } from "@ethereumjs/era"; - -const dataDir = PATH_TO_ETHEREUMJS_CLIENT_DB; -const epoch = 0; - -// generates ${dataDir}/era1/epoch-0.era1 -await exportEpochAsEra1(epoch, dataDir); -``` - -### Read Era1 file - -`readERA1` returns an async iterator of block tuples (header + body + receipts + totalDifficulty) - -```ts -import { - readBinaryFile, - validateERA1, - readERA1, - parseBlockTuple, - blockFromTuple, - getHeaderRecords, - EpochAccumulator, -} from "@ethereumjs/era"; - -const era1File = readBinaryFile(PATH_TO_ERA1_FILE); - -// validate era1 file -const isValid = validateERA1(era1File); - -// read blocks from era1 file -const blocks = readERA1(era1File); - -for await (const blockTuple of blocks) { - const { header, body, receipts } = await parseBlockTuple(blockTuple); - const block = blockFromTuple({ header, body }); - console.log(block.header.number); -} - -// reconstruct epoch accumulator -const headerRecords = await getHeaderRecords(era1File); -const epochAccumulator = EpochAccumulator.encode(headerRecords); -const epochAccumulatorRoot = EpochAccumulator.merkleRoot(headerRecords); -``` - -### Read Era file - -```ts -import { readBeaconState } from "@ethereumjs/era"; - -const eraFile = readBinaryFile(PATH_TO_ERA_FILE); - -// Extract BeaconState -const state = await readBeaconState(eraFile); -console.log(state.slot) - -// Read Beacon Blocks from era file -let count = 0 -for await (const block of readBlocksFromEra(eraFile)) { - console.log(block.message.slot) - count++ - if (count > 10) break -} -``` - -## EthereumJS - -See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices. If you want to join for work or carry out improvements on the libraries, please review our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html) first. - -## License - -[MPL-2.0]() - -[era-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/era.svg -[era-npm-link]: https://www.npmjs.org/package/@ethereumjs/era -[era-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-monorepo/package:%20era?label=issues -[era-issues-link]: https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+era" -[era-actions-badge]: https://github.com/ethereumjs/ethereumjs-monorepo/workflows/Era/badge.svg -[era-actions-link]: https://github.com/ethereumjs/ethereumjs-monorepo/actions?query=workflow%3A%22Era%22 -[era-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/branch/master/graph/badge.svg?flag=era -[era-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/tree/master/packages/era -[discord-badge]: https://img.shields.io/static/v1?logo=discord&label=discord&message=Join&color=blue -[discord-link]: https://discord.gg/TNwARpR diff --git a/packages/ethash/README.md b/packages/ethash/README.md index ac418bd1c14..b87f7ff6664 100644 --- a/packages/ethash/README.md +++ b/packages/ethash/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/ethash +# @ethereumjs/ethash `v10` [![NPM Package][ethash-npm-badge]][ethash-npm-link] [![GitHub Issues][ethash-issues-badge]][ethash-issues-link] @@ -9,6 +9,14 @@ | [Ethash](https://github.com/ethereum/wiki/wiki/Ethash) implementation in TypeScript. | | ------------------------------------------------------------------------------------ | +## Table of Contents + +- [Installation](#installation) +- [Usage](#usage) +- [API](#api) +- [EthereumJS](#ethereumjs) +- [License](#license) + ## Installation To obtain the latest version, simply require the project using `npm`: @@ -106,7 +114,7 @@ Using ESM will give you additional advantages over CJS beyond browser usage like See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices. If you want to join for work or carry out improvements on the libraries, please review our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html) first. -# LICENSE +## License [MPL-2.0]() diff --git a/packages/ethash/docs/README.md b/packages/ethash/docs/README.md index cf5dd92c8f6..a658c433d5f 100644 --- a/packages/ethash/docs/README.md +++ b/packages/ethash/docs/README.md @@ -1,31 +1,14 @@ -@ethereumjs/ethash +**@ethereumjs/ethash** -# @ethereumjs/ethash +*** -## Table of contents +# @ethereumjs/ethash -### Classes +## Classes - [Ethash](classes/Ethash.md) - [Miner](classes/Miner.md) -### Type Aliases - -- [Solution](README.md#solution) - ## Type Aliases -### Solution - -Ƭ **Solution**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `mixHash` | `Uint8Array` | -| `nonce` | `Uint8Array` | - -#### Defined in - -[index.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L42) +- [Solution](type-aliases/Solution.md) diff --git a/packages/ethash/docs/classes/Ethash.md b/packages/ethash/docs/classes/Ethash.md index d05ef3e2573..33b340f1e4a 100644 --- a/packages/ethash/docs/classes/Ethash.md +++ b/packages/ethash/docs/classes/Ethash.md @@ -1,189 +1,153 @@ -[@ethereumjs/ethash](../README.md) / Ethash - -# Class: Ethash - -## Table of contents +[**@ethereumjs/ethash**](../README.md) -### Constructors +*** -- [constructor](Ethash.md#constructor) - -### Properties - -- [cache](Ethash.md#cache) -- [cacheDB](Ethash.md#cachedb) -- [cacheSize](Ethash.md#cachesize) -- [dbOpts](Ethash.md#dbopts) -- [epoc](Ethash.md#epoc) -- [fullSize](Ethash.md#fullsize) -- [seed](Ethash.md#seed) +[@ethereumjs/ethash](../README.md) / Ethash -### Methods +# Class: Ethash -- [\_verifyPOW](Ethash.md#_verifypow) -- [cacheHash](Ethash.md#cachehash) -- [calcDatasetItem](Ethash.md#calcdatasetitem) -- [getMiner](Ethash.md#getminer) -- [headerHash](Ethash.md#headerhash) -- [loadEpoc](Ethash.md#loadepoc) -- [mkcache](Ethash.md#mkcache) -- [run](Ethash.md#run) -- [verifyPOW](Ethash.md#verifypow) +Defined in: [index.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L160) ## Constructors -### constructor +### Constructor + +> **new Ethash**(`cacheDB?`): `Ethash` -• **new Ethash**(`cacheDB?`) +Defined in: [index.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L169) #### Parameters -| Name | Type | -| :------ | :------ | -| `cacheDB?` | `DB`<`number`, `DBObject`\> | +##### cacheDB? + +`DB`\<`number`, `DBObject`\> -#### Defined in +#### Returns -[index.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L169) +`Ethash` ## Properties ### cache -• **cache**: `Uint8Array`[] - -#### Defined in - -[index.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L163) +> **cache**: `Uint8Array`\<`ArrayBufferLike`\>[] -___ +Defined in: [index.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L163) -### cacheDB +*** -• `Optional` **cacheDB**: `DB`<`number`, `DBObject`\> +### cacheDB? -#### Defined in +> `optional` **cacheDB**: `DB`\<`number`, `DBObject`\> -[index.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L162) +Defined in: [index.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L162) -___ +*** -### cacheSize +### cacheSize? -• `Optional` **cacheSize**: `number` +> `optional` **cacheSize**: `number` -#### Defined in +Defined in: [index.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L166) -[index.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L166) - -___ +*** ### dbOpts -• **dbOpts**: `Object` - -#### Defined in - -[index.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L161) +> **dbOpts**: `object` -___ +Defined in: [index.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L161) -### epoc +*** -• `Optional` **epoc**: `number` +### epoc? -#### Defined in +> `optional` **epoc**: `number` -[index.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L164) +Defined in: [index.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L164) -___ +*** -### fullSize +### fullSize? -• `Optional` **fullSize**: `number` +> `optional` **fullSize**: `number` -#### Defined in +Defined in: [index.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L165) -[index.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L165) +*** -___ +### seed? -### seed +> `optional` **seed**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **seed**: `Uint8Array` - -#### Defined in - -[index.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L167) +Defined in: [index.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L167) ## Methods -### \_verifyPOW +### \_verifyPOW() + +> **\_verifyPOW**(`header`): `Promise`\<`boolean`\> -▸ **_verifyPOW**(`header`): `Promise`<`boolean`\> +Defined in: [index.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L369) #### Parameters -| Name | Type | -| :------ | :------ | -| `header` | `BlockHeader` | +##### header -#### Returns +`BlockHeader` -`Promise`<`boolean`\> +#### Returns -#### Defined in +`Promise`\<`boolean`\> -[index.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L369) +*** -___ +### cacheHash() -### cacheHash +> **cacheHash**(): `Uint8Array`\<`ArrayBufferLike`\> -▸ **cacheHash**(): `Uint8Array` +Defined in: [index.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L257) #### Returns -`Uint8Array` - -#### Defined in +`Uint8Array`\<`ArrayBufferLike`\> -[index.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L257) +*** -___ +### calcDatasetItem() -### calcDatasetItem +> **calcDatasetItem**(`i`): `Uint8Array` -▸ **calcDatasetItem**(`i`): `Uint8Array` +Defined in: [index.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L197) #### Parameters -| Name | Type | -| :------ | :------ | -| `i` | `number` | +##### i + +`number` #### Returns `Uint8Array` -#### Defined in - -[index.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L197) +*** -___ +### getMiner() -### getMiner +> **getMiner**(`mineObject`): [`Miner`](Miner.md) -▸ **getMiner**(`mineObject`): [`Miner`](Miner.md) +Defined in: [index.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L365) Returns a `Miner` object To mine a `BlockHeader` or `Block`, use the one-liner `await ethash.getMiner(block).mine(-1)` #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `mineObject` | `BlockHeader` \| `Block` | Object to mine on, either a `BlockHeader` or a `Block` | +##### mineObject + +Object to mine on, either a `BlockHeader` or a `Block` + +`BlockHeader` | `Block` #### Returns @@ -191,116 +155,114 @@ To mine a `BlockHeader` or `Block`, use the one-liner `await ethash.getMiner(blo - A miner object -#### Defined in +*** -[index.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L365) +### headerHash() -___ +> **headerHash**(`rawHeader`): `Uint8Array`\<`ArrayBufferLike`\> -### headerHash - -▸ **headerHash**(`rawHeader`): `Uint8Array` +Defined in: [index.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L272) #### Parameters -| Name | Type | -| :------ | :------ | -| `rawHeader` | `Uint8Array`[] | +##### rawHeader -#### Returns +`Uint8Array`\<`ArrayBufferLike`\>[] -`Uint8Array` +#### Returns -#### Defined in +`Uint8Array`\<`ArrayBufferLike`\> -[index.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L272) +*** -___ +### loadEpoc() -### loadEpoc +> **loadEpoc**(`number`): `Promise`\<`void`\> -▸ **loadEpoc**(`number`): `Promise`<`void`\> +Defined in: [index.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L279) Loads the seed and cache given a block number. #### Parameters -| Name | Type | -| :------ | :------ | -| `number` | `bigint` | +##### number -#### Returns +`bigint` -`Promise`<`void`\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[index.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L279) +*** -___ +### mkcache() -### mkcache +> **mkcache**(`cacheSize`, `seed`): `Uint8Array`\<`ArrayBufferLike`\>[] -▸ **mkcache**(`cacheSize`, `seed`): `Uint8Array`[] +Defined in: [index.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L177) #### Parameters -| Name | Type | -| :------ | :------ | -| `cacheSize` | `number` | -| `seed` | `Uint8Array` | +##### cacheSize -#### Returns +`number` + +##### seed -`Uint8Array`[] +`Uint8Array` + +#### Returns -#### Defined in +`Uint8Array`\<`ArrayBufferLike`\>[] -[index.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L177) +*** -___ +### run() -### run +> **run**(`val`, `nonce`, `fullSize?`): `object` -▸ **run**(`val`, `nonce`, `fullSize?`): `Object` +Defined in: [index.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L211) #### Parameters -| Name | Type | -| :------ | :------ | -| `val` | `Uint8Array` | -| `nonce` | `Uint8Array` | -| `fullSize?` | `number` | +##### val + +`Uint8Array` + +##### nonce + +`Uint8Array` + +##### fullSize? + +`number` #### Returns -`Object` +`object` -| Name | Type | -| :------ | :------ | -| `hash` | `Uint8Array` | -| `mix` | `Uint8Array` | +##### hash -#### Defined in +> **hash**: `Uint8Array`\<`ArrayBufferLike`\> -[index.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L211) +##### mix -___ +> **mix**: `Uint8Array`\<`ArrayBuffer`\> = `cmix` -### verifyPOW +*** -▸ **verifyPOW**(`block`): `Promise`<`boolean`\> +### verifyPOW() -#### Parameters +> **verifyPOW**(`block`): `Promise`\<`boolean`\> -| Name | Type | -| :------ | :------ | -| `block` | `Block` | +Defined in: [index.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L379) -#### Returns +#### Parameters + +##### block -`Promise`<`boolean`\> +`Block` -#### Defined in +#### Returns -[index.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L379) +`Promise`\<`boolean`\> diff --git a/packages/ethash/docs/classes/Miner.md b/packages/ethash/docs/classes/Miner.md index c2e436f30f9..8bb2c4a88e2 100644 --- a/packages/ethash/docs/classes/Miner.md +++ b/packages/ethash/docs/classes/Miner.md @@ -1,113 +1,108 @@ +[**@ethereumjs/ethash**](../README.md) + +*** + [@ethereumjs/ethash](../README.md) / Miner # Class: Miner -## Table of contents +Defined in: [index.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L47) -### Constructors +## Constructors -- [constructor](Miner.md#constructor) +### Constructor -### Properties +> **new Miner**(`mineObject`, `ethash`): `Miner` -- [solution](Miner.md#solution) +Defined in: [index.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L64) -### Methods +Create a Miner object -- [iterate](Miner.md#iterate) -- [mine](Miner.md#mine) -- [stop](Miner.md#stop) +#### Parameters -## Constructors +##### mineObject -### constructor +The object to mine on, either a `BlockHeader` or a `Block` object -• **new Miner**(`mineObject`, `ethash`) +`BlockHeader` | `Block` -Create a Miner object +##### ethash -#### Parameters +[`Ethash`](Ethash.md) -| Name | Type | Description | -| :------ | :------ | :------ | -| `mineObject` | `BlockHeader` \| `Block` | The object to mine on, either a `BlockHeader` or a `Block` object | -| `ethash` | [`Ethash`](Ethash.md) | Ethash object to use for mining | +Ethash object to use for mining -#### Defined in +#### Returns -[index.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L64) +`Miner` ## Properties -### solution - -• `Optional` **solution**: [`Solution`](../README.md#solution) +### solution? -#### Defined in +> `optional` **solution**: [`Solution`](../type-aliases/Solution.md) -[index.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L52) +Defined in: [index.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L52) ## Methods -### iterate +### iterate() -▸ **iterate**(`iterations?`): `Promise`<`undefined` \| [`Solution`](../README.md#solution)\> +> **iterate**(`iterations`): `Promise`\<`undefined` \| [`Solution`](../type-aliases/Solution.md)\> + +Defined in: [index.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L114) Iterate `iterations` times over nonces to find a valid PoW. Caches solution if one is found #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `iterations` | `number` | `0` | Number of iterations to iterate over. If `-1` is passed, the loop runs until a solution is found | +##### iterations + +`number` = `0` + +Number of iterations to iterate over. If `-1` is passed, the loop runs until a solution is found #### Returns -`Promise`<`undefined` \| [`Solution`](../README.md#solution)\> +`Promise`\<`undefined` \| [`Solution`](../type-aliases/Solution.md)\> - `undefined` if no solution was found, or otherwise a `Solution` object -#### Defined in +*** -[index.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L114) +### mine() -___ +> **mine**(`iterations`): `Promise`\<`undefined` \| `BlockHeader` \| `Block`\> -### mine - -▸ **mine**(`iterations?`): `Promise`<`undefined` \| `BlockHeader` \| `Block`\> +Defined in: [index.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L91) Iterate `iterations` time over nonces, returns a `BlockHeader` or `Block` if a solution is found, `undefined` otherwise #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `iterations` | `number` | `0` | Number of iterations to iterate over. If `-1` is passed, the loop runs until a solution is found | +##### iterations + +`number` = `0` + +Number of iterations to iterate over. If `-1` is passed, the loop runs until a solution is found #### Returns -`Promise`<`undefined` \| `BlockHeader` \| `Block`\> +`Promise`\<`undefined` \| `BlockHeader` \| `Block`\> - `undefined` if no solution was found within the iterations, or a `BlockHeader` or `Block` with valid PoW based upon what was passed in the constructor -#### Defined in - -[index.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L91) +*** -___ +### stop() -### stop +> **stop**(): `void` -▸ **stop**(): `void` +Defined in: [index.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L81) Stop the miner on the next iteration #### Returns `void` - -#### Defined in - -[index.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L81) diff --git a/packages/ethash/docs/type-aliases/Solution.md b/packages/ethash/docs/type-aliases/Solution.md new file mode 100644 index 00000000000..b65c1aade82 --- /dev/null +++ b/packages/ethash/docs/type-aliases/Solution.md @@ -0,0 +1,27 @@ +[**@ethereumjs/ethash**](../README.md) + +*** + +[@ethereumjs/ethash](../README.md) / Solution + +# Type Alias: Solution + +> **Solution** = `object` + +Defined in: [index.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L42) + +## Properties + +### mixHash + +> **mixHash**: `Uint8Array` + +Defined in: [index.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L43) + +*** + +### nonce + +> **nonce**: `Uint8Array` + +Defined in: [index.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/ethash/src/index.ts#L44) diff --git a/packages/ethash/package.json b/packages/ethash/package.json index 7e11904ebb9..2e9d4cf0864 100644 --- a/packages/ethash/package.json +++ b/packages/ethash/package.json @@ -34,7 +34,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- ethash", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", @@ -44,7 +44,7 @@ "spellcheck": "npm run spellcheck:ts && npm run spellcheck:md", "spellcheck:ts": "npx cspell --gitignore -c ../../config/cspell-ts.json \"./**/*.ts\" --cache --show-suggestions --show-context", "spellcheck:md": "npx cspell --gitignore -c ../../config/cspell-md.json \"**.md\" --cache --show-suggestions --show-context", - "test": "npx vitest run -c ../../config/vitest.config.mts", + "test": "npx vitest run -c ./vite.config.ts", "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { @@ -52,7 +52,7 @@ "@ethereumjs/rlp": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", "bigint-crypto-utils": "^3.3.0", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@ethereumjs/common": "^10.0.0-rc.1" diff --git a/packages/ethash/typedoc.cjs b/packages/ethash/typedoc.mjs similarity index 60% rename from packages/ethash/typedoc.cjs rename to packages/ethash/typedoc.mjs index 1e0dab9e636..b9f8eb8e843 100644 --- a/packages/ethash/typedoc.cjs +++ b/packages/ethash/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts', 'examples/*.ts'], diff --git a/packages/evm/README.md b/packages/evm/README.md index e9ea7cc015d..6747e00caa6 100644 --- a/packages/evm/README.md +++ b/packages/evm/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/evm +# @ethereumjs/evm `v10` [![NPM Package][evm-npm-badge]][evm-npm-link] [![GitHub Issues][evm-issues-badge]][evm-issues-link] @@ -9,6 +9,35 @@ | TypeScript implementation of the Ethereum EVM. | | ---------------------------------------------- | +- 🦄 All hardforks up till **Pectra** +- 🌴 Tree-shakeable API +- 👷🏼 Controlled dependency set (7 external + `@Noble` crypto) +- 🧩 Flexible EIP on/off engine +- 🛠️ Custom precompiles +- 🚀 Build-in profiler +- 🪢 User-friendly colored debugging +- 🛵 422KB bundle size (110KB gzipped) +- 🏄🏾‍♂️ WASM-free default + Fully browser ready + +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Examples](#examples) +- [Browser](#browser) +- [API](#api) +- [Architecture](#architecture) +- [Supported Hardforks](#supported-hardforks) +- [Supported EIPs](#supported-eips) +- [Precompiles](#precompiles) +- [Events](#events) +- [Understanding the EVM](#understanding-the-evm) +- [Profiling the EVM](#profiling-the-evm) +- [Development](#development) +- [EthereumJS](#ethereumjs) +- [License](#license) + + ## Installation To obtain the latest version, simply require the project using `npm`: @@ -19,15 +48,13 @@ npm install @ethereumjs/evm This package provides the core Ethereum Virtual Machine (EVM) implementation which is capable of executing EVM-compatible bytecode. The package has been extracted from the [@ethereumjs/vm](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm) package along the VM `v6` release. -**Note:** Starting with the Dencun hardfork `EIP-4844` related functionality will become an integrated part of the EVM functionality with the activation of the point evaluation precompile. It is therefore strongly recommended to _always_ run the EVM with a KZG library installed and initialized, see [KZG Setup](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) for instructions. +**Note:** Starting with the Dencun hardfork `EIP-4844` related functionality has become an integrated part of the EVM functionality with the activation of the point evaluation precompile. For this precompile to work a separate installation of the KZG library is necessary (we decided not to bundle due to large bundle sizes), see [KZG Setup](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) for instructions. -## Usage +## Getting Started ### Basic -With the v2 release (Summer 2023) the EVM/VM packages have been further decoupled and it now possible to run the EVM package in isolation with reasonable defaults. - -The following is the simplest example for an EVM instantiation: +The following is the simplest example for an EVM instantiation with reasonable defaults for state and blockchain information (like blockhashes): ```ts // ./examples/simple.ts @@ -44,8 +71,6 @@ const main = async () => { void main() ``` -Note: with the switch from v2 to v3 the old direct `new EVM()` constructor usage has been deprecated and an `EVM` now has to be instantiated with the async static `EVM.create()` constructor. - ### Blockchain, State and Events If the EVM should run on a certain state an `@ethereumjs/statemanager` is needed. An `@ethereumjs/blockchain` instance can be passed in to provide access to external interface information like a blockhash: @@ -99,67 +124,13 @@ 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 { Common, Hardfork, Mainnet } from '@ethereumjs/common' -import { createEVM, getActivePrecompiles } from '@ethereumjs/evm' -import { bytesToHex, hexToBytes } from '@ethereumjs/util' - -const main = async () => { - const common = new Common({ 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 createEVM({ 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)}`) -} - -void 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' +### WASM Crypto Support -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 }) -``` +This library by default uses JavaScript implementations for the basic standard crypto primitives like hashing or signature verification (for included txs). See `@ethereumjs/common` [README](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common) for instructions on how to replace with e.g. a more performant WASM implementation by using a shared `common` instance. ## Examples -This projects contain the following examples: - -1. [./examples/decode-opcodes](./examples/decode-opcodes.ts): Decodes a binary EVM program into its opcodes. -1. [./examples/runCode](./examples/runCode.ts): Show how to use this library in a browser. - -All of the examples have their own `README.md` explaining how to run them. +See the [examples](./examples/) folder for different meaningful examples on how to use the EVM package and invoke certain aspects of it, e.g. running a bytecode snippet, listening to events or activate an EVM with a certain EIP for experimental purposes. ## Browser @@ -209,9 +180,7 @@ The interfaces (in a non-TypeScript sense) between these packages have been simp This allows for both a standalone EVM instantiation with reasonable defaults as well as for a simplified EVM -> VM passing if a customized EVM is needed. -## Setup - -### Hardfork Support +## Supported Hardforks The EthereumJS EVM implements all hardforks from `Frontier` (`chainstart`) up to the latest active mainnet hardfork. @@ -232,26 +201,27 @@ Currently the following hardfork rules are supported: - `merge` - `shanghai` (`v2.0.0`+) - `cancun` (`v2.0.0`+) +- `prague` (`v10`+) -Default: `shanghai` (taken from `Common.DEFAULT_HARDFORK`) +Default: `prague` (taken from `Common.DEFAULT_HARDFORK`) A specific hardfork EVM ruleset can be activated by passing in the hardfork along the `Common` instance to the outer `@ethereumjs/vm` instance. -### EIP Support +## Supported EIPs If you want to activate an EIP not currently active on the hardfork your `common` instance is set to, it is possible to individually activate EIP support in the EVM by specifying the desired EIPs using the `eips` property in your `CommonOpts` setup, e.g.: ```ts // ./examples/eips.ts -import { Common, Mainnet } from '@ethereumjs/common' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { createEVM } from '@ethereumjs/evm' const main = async () => { - const common = new Common({ chain: Mainnet, eips: [7702] }) + const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) const evm = await createEVM({ common }) - console.log(`EIP 7702 is active - ${evm.common.isActivatedEIP(7702)}`) + console.log(`EIP 7702 is active in isolation on top of the Cancun HF - ${evm.common.isActivatedEIP(7702)}`) } void main() @@ -296,30 +266,66 @@ Currently supported EIPs: - [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - Set EOA account code (Prague) - [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Verkle) -### WASM Crypto Support +### EIP-4844 Shard Blob Transactions Support (Cancun) -This library by default uses JavaScript implementations for the basic standard crypto primitives like hashing or signature verification (for included txs). See `@ethereumjs/common` [README](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common) for instructions on how to replace with e.g. a more performant WASM implementation by using a shared `common` instance. +This library supports the blob transaction type introduced with [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844). EIP-4844 comes with a dedicated opcode `BLOBHASH` and has added a new point evaluation precompile at address `0x0a`. -### EIP-4844 Shard Blob Transactions Support +**Note:** Usage of the point evaluation precompile 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. -This library supports the blob transaction type introduced with [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844). +## Precompiles -#### Initialization +This library support all EVM precompiles up to the `Prague` hardfork. -To run EVM related EIP-4844 functionality you have to active the EIP in the associated `@ethereumjs/common` library: +The following code allows to run precompiles in isolation, e.g. for testing purposes: ```ts -// ./examples/4844.ts +// ./examples/precompile.ts import { Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { createEVM, getActivePrecompiles } from '@ethereumjs/evm' +import { bytesToHex, hexToBytes } from '@ethereumjs/util' -const common = new Common({ chain: Mainnet, hardfork: Hardfork.Shanghai, eips: [4844] }) +const main = async () => { + const common = new Common({ 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 createEVM({ 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)}`) +} + +void main() ``` -EIP-4844 comes with a new opcode `BLOBHASH` (Attention! Renamed from `DATAHASH`) and adds a new point evaluation precompile at address `0x0a` -(moved from `0x14` at some point along spec updates). +### EIP-2537 BLS Precompiles (Prague) -**Note:** Usage of the point evaluation precompile 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. +Starting with `v10` the EVM supports the BLS precompiles introduced with [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) in its final version introduced with the `Prague` hardfork. 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 createEVM({ common, bls }) +``` + +## Events ### Tracing Events @@ -370,11 +376,11 @@ The following loggers are currently available: | Logger | Description | | ---------------------------------- | --------------------------------------------------- | -| `evm:evm` |  EVM control flow, CALL or CREATE message execution | -| `evm:gas` |  EVM gas logger | -| `evm:precompiles` |  EVM precompiles logger | -| `evm:journal` |  EVM journal logger | -| `evm:ops` |  Opcode traces | +| `evm:evm` | EVM control flow, CALL or CREATE message execution | +| `evm:gas` | EVM gas logger | +| `evm:precompiles` | EVM precompiles logger | +| `evm:journal` | EVM journal logger | +| `evm:ops` | Opcode traces | | `evm:ops:[Lower-case opcode name]` | Traces on a specific opcode | Here are some examples for useful logger combinations. @@ -441,9 +447,9 @@ TODO: this section likely needs an update. ## Profiling the EVM -Starting with the `v2.1.0` release the EVM comes with build-in profiling capabilities to detect performance bottlenecks and to generally support the targeted evolution of the JavaScript EVM performance. +The EthereumJS EVM comes with build-in profiling capabilities to detect performance bottlenecks and to generally support the targeted evolution of the JavaScript EVM performance. -While the EVM now has a dedicated `profiler` setting to activate, the profiler can best and most useful be run through the EthereumJS [client](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/client) since this gives the most realistic conditions providing both real-world txs and a meaningful state size. +While the EVM has a dedicated `profiler` setting to activate, the profiler can best and most useful be run through the EthereumJS [client](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/client) since this gives the most realistic conditions providing both real-world txs and a meaningful state size. To repeatedly run the EVM profiler within the client sync the client on mainnet or a larger testnet to the desired block. Then the profiler should be run without sync (to not distort the results) by using the `--executeBlocks` and the `--vmProfileBlocks` (or `--vmProfileTxs`) flags in conjunction like: diff --git a/packages/evm/docs/README.md b/packages/evm/docs/README.md index 788d31576da..1107a55830e 100644 --- a/packages/evm/docs/README.md +++ b/packages/evm/docs/README.md @@ -1,21 +1,28 @@ -@ethereumjs/evm +**@ethereumjs/evm** -# @ethereumjs/evm - -## Table of contents - -### Enumerations +*** -- [EVMErrorMessage](enums/EVMErrorMessage.md) +# @ethereumjs/evm -### Classes +## Classes -- [EvmError](classes/EvmError.md) +- [BinaryTreeAccessWitness](classes/BinaryTreeAccessWitness.md) +- [EOFContainer](classes/EOFContainer.md) +- [EVMError](classes/EVMError.md) +- [EVMMockBlockchain](classes/EVMMockBlockchain.md) +- [EVMPerformanceLogger](classes/EVMPerformanceLogger.md) +- [MCLBLS](classes/MCLBLS.md) - [Message](classes/Message.md) +- [NobleBLS](classes/NobleBLS.md) +- [NobleBN254](classes/NobleBN254.md) +- [RustBN254](classes/RustBN254.md) +- [Timer](classes/Timer.md) +- [VerkleAccessWitness](classes/VerkleAccessWitness.md) -### Interfaces +## Interfaces - [EVMInterface](interfaces/EVMInterface.md) +- [EVMMockBlockchainInterface](interfaces/EVMMockBlockchainInterface.md) - [EVMOpts](interfaces/EVMOpts.md) - [EVMResult](interfaces/EVMResult.md) - [EVMRunCallOpts](interfaces/EVMRunCallOpts.md) @@ -23,95 +30,31 @@ - [ExecResult](interfaces/ExecResult.md) - [InterpreterStep](interfaces/InterpreterStep.md) - [PrecompileInput](interfaces/PrecompileInput.md) -- [bn128](interfaces/bn128.md) - -### Type Aliases - -- [Log](README.md#log) - -### Variables - -- [EOF](README.md#eof) - -### Functions - -- [getActivePrecompiles](README.md#getactiveprecompiles) -- [getOpcodesForHF](README.md#getopcodesforhf) ## Type Aliases -### Log - -Ƭ **Log**: [address: Uint8Array, topics: Uint8Array[], data: Uint8Array] - -Log that the contract emits. - -#### Defined in - -[types.ts:337](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L337) +- [BinaryChunkAccessEvent](type-aliases/BinaryChunkAccessEvent.md) +- [BinaryStemAccessEvent](type-aliases/BinaryStemAccessEvent.md) +- [BinaryStemMeta](type-aliases/BinaryStemMeta.md) +- [ChunkAccessEvent](type-aliases/ChunkAccessEvent.md) +- [EVMBLSInterface](type-aliases/EVMBLSInterface.md) +- [EVMBN254Interface](type-aliases/EVMBN254Interface.md) +- [EVMPerformanceLogOutput](type-aliases/EVMPerformanceLogOutput.md) +- [Log](type-aliases/Log.md) +- [StemAccessEvent](type-aliases/StemAccessEvent.md) +- [StemMeta](type-aliases/StemMeta.md) ## Variables -### EOF - -• `Const` **EOF**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `FORMAT` | `number` | -| `MAGIC` | `number` | -| `VERSION` | `number` | -| `codeAnalysis` | (`container`: `Uint8Array`) => `undefined` \| { `code`: `number` = 0; `data`: `number` = 0 } | -| `validOpcodes` | (`code`: `Uint8Array`) => `boolean` | - -#### Defined in - -[eof.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof.ts#L105) +- [paramsEVM](variables/paramsEVM.md) ## Functions -### getActivePrecompiles - -▸ **getActivePrecompiles**(`common`, `customPrecompiles?`): `Map`<`string`, `PrecompileFunc`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `common` | `Common` | -| `customPrecompiles?` | `CustomPrecompile`[] | - -#### Returns - -`Map`<`string`, `PrecompileFunc`\> - -#### Defined in - -[precompiles/index.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/index.ts#L167) - -___ - -### getOpcodesForHF - -▸ **getOpcodesForHF**(`common`, `customOpcodes?`): `OpcodeContext` - -Get suitable opcodes for the required hardfork. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `common` | `Common` | {Common} Ethereumjs Common metadata object. | -| `customOpcodes?` | `CustomOpcode`[] | List with custom opcodes (see EVM `customOpcodes` option description). | - -#### Returns - -`OpcodeContext` - -Opcodes dictionary object. - -#### Defined in - -[opcodes/codes.ts:368](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/opcodes/codes.ts#L368) +- [createEVM](functions/createEVM.md) +- [decodeAccessedState](functions/decodeAccessedState.md) +- [decodeBinaryAccessState](functions/decodeBinaryAccessState.md) +- [generateBinaryExecutionWitness](functions/generateBinaryExecutionWitness.md) +- [generateExecutionWitness](functions/generateExecutionWitness.md) +- [getActivePrecompiles](functions/getActivePrecompiles.md) +- [getOpcodesForHF](functions/getOpcodesForHF.md) +- [validateEOF](functions/validateEOF.md) diff --git a/packages/evm/docs/classes/BinaryTreeAccessWitness.md b/packages/evm/docs/classes/BinaryTreeAccessWitness.md new file mode 100644 index 00000000000..8aeacaaab74 --- /dev/null +++ b/packages/evm/docs/classes/BinaryTreeAccessWitness.md @@ -0,0 +1,553 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / BinaryTreeAccessWitness + +# Class: BinaryTreeAccessWitness + +Defined in: [binaryTreeAccessWitness.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L92) + +## Implements + +- `BinaryTreeAccessWitnessInterface` + +## Constructors + +### Constructor + +> **new BinaryTreeAccessWitness**(`opts`): `BinaryTreeAccessWitness` + +Defined in: [binaryTreeAccessWitness.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L98) + +#### Parameters + +##### opts + +###### chunks? + +`Map`\<`` `0x${string}` ``, [`BinaryChunkAccessEvent`](../type-aliases/BinaryChunkAccessEvent.md)\> + +###### hashFunction + +(`msg`) => `Uint8Array` + +###### stems? + +`Map`\<`` `0x${string}` ``, [`BinaryStemAccessEvent`](../type-aliases/BinaryStemAccessEvent.md) & [`BinaryStemMeta`](../type-aliases/BinaryStemMeta.md)\> + +#### Returns + +`BinaryTreeAccessWitness` + +## Properties + +### chunkCache + +> **chunkCache**: `ChunkCache` + +Defined in: [binaryTreeAccessWitness.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L96) + +*** + +### chunks + +> **chunks**: `Map`\<`` `0x${string}` ``, [`BinaryChunkAccessEvent`](../type-aliases/BinaryChunkAccessEvent.md)\> + +Defined in: [binaryTreeAccessWitness.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L94) + +*** + +### hashFunction() + +> **hashFunction**: (`msg`) => `Uint8Array` + +Defined in: [binaryTreeAccessWitness.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L97) + +#### Parameters + +##### msg + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### stemCache + +> **stemCache**: `StemCache` + +Defined in: [binaryTreeAccessWitness.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L95) + +*** + +### stems + +> **stems**: `Map`\<`` `0x${string}` ``, [`BinaryStemAccessEvent`](../type-aliases/BinaryStemAccessEvent.md) & [`BinaryStemMeta`](../type-aliases/BinaryStemMeta.md)\> + +Defined in: [binaryTreeAccessWitness.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L93) + +## Methods + +### accesses() + +> **accesses**(): `Generator`\<`BinaryTreeAccessedStateWithAddress`\> + +Defined in: [binaryTreeAccessWitness.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L375) + +#### Returns + +`Generator`\<`BinaryTreeAccessedStateWithAddress`\> + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.accesses` + +*** + +### commit() + +> **commit**(): `void` + +Defined in: [binaryTreeAccessWitness.ts:310](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L310) + +#### Returns + +`void` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.commit` + +*** + +### debugWitnessCost() + +> **debugWitnessCost**(): `void` + +Defined in: [binaryTreeAccessWitness.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L327) + +#### Returns + +`void` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.debugWitnessCost` + +*** + +### merge() + +> **merge**(`accessWitness`): `void` + +Defined in: [binaryTreeAccessWitness.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L285) + +#### Parameters + +##### accessWitness + +`BinaryTreeAccessWitness` + +#### Returns + +`void` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.merge` + +*** + +### rawAccesses() + +> **rawAccesses**(): `Generator`\<`RawBinaryTreeAccessedState`\> + +Defined in: [binaryTreeAccessWitness.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L360) + +#### Returns + +`Generator`\<`RawBinaryTreeAccessedState`\> + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.rawAccesses` + +*** + +### readAccountBasicData() + +> **readAccountBasicData**(`address`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L108) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.readAccountBasicData` + +*** + +### readAccountCodeChunks() + +> **readAccountCodeChunks**(`contract`, `startPc`, `endPc`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L142) + +#### Parameters + +##### contract + +`Address` + +##### startPc + +`number` + +##### endPc + +`number` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.readAccountCodeChunks` + +*** + +### readAccountCodeHash() + +> **readAccountCodeHash**(`address`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L116) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.readAccountCodeHash` + +*** + +### readAccountHeader() + +> **readAccountHeader**(`address`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L124) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.readAccountHeader` + +*** + +### readAccountStorage() + +> **readAccountStorage**(`address`, `storageSlot`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L160) + +#### Parameters + +##### address + +`Address` + +##### storageSlot + +`bigint` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.readAccountStorage` + +*** + +### revert() + +> **revert**(): `void` + +Defined in: [binaryTreeAccessWitness.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L322) + +#### Returns + +`void` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.revert` + +*** + +### touchAddress() + +> **touchAddress**(`address`, `treeIndex`, `subIndex`, `__namedParameters`): `AccessEventFlags` + +Defined in: [binaryTreeAccessWitness.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L229) + +#### Parameters + +##### address + +`Address` + +##### treeIndex + +`number` | `bigint` + +##### subIndex + +`number` | `Uint8Array`\<`ArrayBufferLike`\> + +##### \_\_namedParameters + +###### isWrite? + +`boolean` + +#### Returns + +`AccessEventFlags` + +*** + +### touchAddressAndComputeGas() + +> **touchAddressAndComputeGas**(`address`, `treeIndex`, `subIndex`, `__namedParameters`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L190) + +#### Parameters + +##### address + +`Address` + +##### treeIndex + +`number` | `bigint` + +##### subIndex + +`number` | `Uint8Array`\<`ArrayBufferLike`\> + +##### \_\_namedParameters + +###### isWrite? + +`boolean` + +#### Returns + +`bigint` + +*** + +### touchAddressOnReadAndComputeGas() + +> **touchAddressOnReadAndComputeGas**(`address`, `treeIndex`, `subIndex`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L180) + +#### Parameters + +##### address + +`Address` + +##### treeIndex + +`number` | `bigint` + +##### subIndex + +`number` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`bigint` + +*** + +### touchAddressOnWriteAndComputeGas() + +> **touchAddressOnWriteAndComputeGas**(`address`, `treeIndex`, `subIndex`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L170) + +#### Parameters + +##### address + +`Address` + +##### treeIndex + +`number` | `bigint` + +##### subIndex + +`number` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`bigint` + +*** + +### writeAccountBasicData() + +> **writeAccountBasicData**(`address`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L112) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.writeAccountBasicData` + +*** + +### writeAccountCodeChunks() + +> **writeAccountCodeChunks**(`contract`, `startPc`, `endPc`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L151) + +#### Parameters + +##### contract + +`Address` + +##### startPc + +`number` + +##### endPc + +`number` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.writeAccountCodeChunks` + +*** + +### writeAccountCodeHash() + +> **writeAccountCodeHash**(`address`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L120) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.writeAccountCodeHash` + +*** + +### writeAccountHeader() + +> **writeAccountHeader**(`address`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L133) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.writeAccountHeader` + +*** + +### writeAccountStorage() + +> **writeAccountStorage**(`address`, `storageSlot`): `bigint` + +Defined in: [binaryTreeAccessWitness.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L165) + +#### Parameters + +##### address + +`Address` + +##### storageSlot + +`bigint` + +#### Returns + +`bigint` + +#### Implementation of + +`BinaryTreeAccessWitnessInterface.writeAccountStorage` diff --git a/packages/evm/docs/classes/EOFContainer.md b/packages/evm/docs/classes/EOFContainer.md new file mode 100644 index 00000000000..6894219e411 --- /dev/null +++ b/packages/evm/docs/classes/EOFContainer.md @@ -0,0 +1,75 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / EOFContainer + +# Class: EOFContainer + +Defined in: [eof/container.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof/container.ts#L438) + +Main constructor for the EOFContainer + +## Constructors + +### Constructor + +> **new EOFContainer**(`buf`, `eofMode`, `dataSectionAllowedSmaller`): `EOFContainer` + +Defined in: [eof/container.ts:450](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof/container.ts#L450) + +#### Parameters + +##### buf + +`Uint8Array` + +Entire container buffer + +##### eofMode + +`EOFContainerMode` = `EOFContainerMode.Default` + +Container mode to validate the container on + +##### dataSectionAllowedSmaller + +`boolean` = `false` + +`true` if the data section is allowed to be smaller than the data section size in the header + +#### Returns + +`EOFContainer` + +## Properties + +### body + +> **body**: `EOFBody` + +Defined in: [eof/container.ts:440](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof/container.ts#L440) + +*** + +### buffer + +> **buffer**: `Uint8Array` + +Defined in: [eof/container.ts:441](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof/container.ts#L441) + +*** + +### eofMode + +> **eofMode**: `EOFContainerMode` + +Defined in: [eof/container.ts:442](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof/container.ts#L442) + +*** + +### header + +> **header**: `EOFHeader` + +Defined in: [eof/container.ts:439](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof/container.ts#L439) diff --git a/packages/evm/docs/classes/EVMError.md b/packages/evm/docs/classes/EVMError.md new file mode 100644 index 00000000000..0f1d9ecde47 --- /dev/null +++ b/packages/evm/docs/classes/EVMError.md @@ -0,0 +1,51 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / EVMError + +# Class: EVMError + +Defined in: [errors.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/errors.ts#L36) + +## Constructors + +### Constructor + +> **new EVMError**(`error`): `EVMError` + +Defined in: [errors.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/errors.ts#L41) + +#### Parameters + +##### error + +`EVMErrorType` + +#### Returns + +`EVMError` + +## Properties + +### error + +> **error**: `EVMErrorType` + +Defined in: [errors.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/errors.ts#L37) + +*** + +### errorType + +> **errorType**: `string` + +Defined in: [errors.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/errors.ts#L38) + +*** + +### errorMessages + +> `static` **errorMessages**: `Record`\<`"INVALID_OPCODE"` \| `"STACK_UNDERFLOW"` \| `"STACK_OVERFLOW"` \| `"STOP"` \| `"REVERT"` \| `"OUT_OF_GAS"` \| `"CODESTORE_OUT_OF_GAS"` \| `"CODESIZE_EXCEEDS_MAXIMUM"` \| `"INVALID_JUMP"` \| `"OUT_OF_RANGE"` \| `"STATIC_STATE_CHANGE"` \| `"INTERNAL_ERROR"` \| `"CREATE_COLLISION"` \| `"REFUND_EXHAUSTED"` \| `"VALUE_OVERFLOW"` \| `"INSUFFICIENT_BALANCE"` \| `"INVALID_BYTECODE_RESULT"` \| `"INITCODE_SIZE_VIOLATION"` \| `"INVALID_INPUT_LENGTH"` \| `"INVALID_EOF_FORMAT"` \| `"BLS_12_381_INVALID_INPUT_LENGTH"` \| `"BLS_12_381_POINT_NOT_ON_CURVE"` \| `"BLS_12_381_INPUT_EMPTY"` \| `"BLS_12_381_FP_NOT_IN_FIELD"` \| `"BN254_FP_NOT_IN_FIELD"` \| `"INVALID_COMMITMENT"` \| `"INVALID_INPUTS"` \| `"INVALID_PROOF"`, `EVMErrorType`\> = `EVMErrorMessages` + +Defined in: [errors.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/errors.ts#L39) diff --git a/packages/evm/docs/classes/EVMMockBlockchain.md b/packages/evm/docs/classes/EVMMockBlockchain.md new file mode 100644 index 00000000000..342ab3560ab --- /dev/null +++ b/packages/evm/docs/classes/EVMMockBlockchain.md @@ -0,0 +1,71 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / EVMMockBlockchain + +# Class: EVMMockBlockchain + +Defined in: [types.ts:507](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L507) + +## Implements + +- [`EVMMockBlockchainInterface`](../interfaces/EVMMockBlockchainInterface.md) + +## Constructors + +### Constructor + +> **new EVMMockBlockchain**(): `EVMMockBlockchain` + +#### Returns + +`EVMMockBlockchain` + +## Methods + +### getBlock() + +> **getBlock**(): `Promise`\<\{ `hash`: `Uint8Array`\<`ArrayBuffer`\>; \}\> + +Defined in: [types.ts:508](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L508) + +#### Returns + +`Promise`\<\{ `hash`: `Uint8Array`\<`ArrayBuffer`\>; \}\> + +#### Implementation of + +[`EVMMockBlockchainInterface`](../interfaces/EVMMockBlockchainInterface.md).[`getBlock`](../interfaces/EVMMockBlockchainInterface.md#getblock) + +*** + +### putBlock() + +> **putBlock**(): `Promise`\<`void`\> + +Defined in: [types.ts:515](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L515) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +[`EVMMockBlockchainInterface`](../interfaces/EVMMockBlockchainInterface.md).[`putBlock`](../interfaces/EVMMockBlockchainInterface.md#putblock) + +*** + +### shallowCopy() + +> **shallowCopy**(): `EVMMockBlockchain` + +Defined in: [types.ts:516](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L516) + +#### Returns + +`EVMMockBlockchain` + +#### Implementation of + +[`EVMMockBlockchainInterface`](../interfaces/EVMMockBlockchainInterface.md).[`shallowCopy`](../interfaces/EVMMockBlockchainInterface.md#shallowcopy) diff --git a/packages/evm/docs/classes/EVMPerformanceLogger.md b/packages/evm/docs/classes/EVMPerformanceLogger.md new file mode 100644 index 00000000000..5401cde9971 --- /dev/null +++ b/packages/evm/docs/classes/EVMPerformanceLogger.md @@ -0,0 +1,147 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / EVMPerformanceLogger + +# Class: EVMPerformanceLogger + +Defined in: [logger.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L57) + +## Constructors + +### Constructor + +> **new EVMPerformanceLogger**(): `EVMPerformanceLogger` + +Defined in: [logger.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L63) + +#### Returns + +`EVMPerformanceLogger` + +## Methods + +### clear() + +> **clear**(): `void` + +Defined in: [logger.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L67) + +#### Returns + +`void` + +*** + +### getLogs() + +> **getLogs**(): `object` + +Defined in: [logger.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L72) + +#### Returns + +`object` + +##### opcodes + +> **opcodes**: [`EVMPerformanceLogOutput`](../type-aliases/EVMPerformanceLogOutput.md)[] + +##### precompiles + +> **precompiles**: [`EVMPerformanceLogOutput`](../type-aliases/EVMPerformanceLogOutput.md)[] + +*** + +### hasTimer() + +> **hasTimer**(): `boolean` + +Defined in: [logger.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L110) + +#### Returns + +`boolean` + +*** + +### pauseTimer() + +> **pauseTimer**(): [`Timer`](Timer.md) + +Defined in: [logger.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L126) + +#### Returns + +[`Timer`](Timer.md) + +*** + +### startTimer() + +> **startTimer**(`tag`): [`Timer`](Timer.md) + +Defined in: [logger.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L116) + +#### Parameters + +##### tag + +`string` + +#### Returns + +[`Timer`](Timer.md) + +*** + +### stopTimer() + +> **stopTimer**(`timer`, `gasUsed`, `targetTimer`, `staticGas?`, `dynamicGas?`): `void` + +Defined in: [logger.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L146) + +#### Parameters + +##### timer + +[`Timer`](Timer.md) + +##### gasUsed + +`number` + +##### targetTimer + +`"precompiles"` | `"opcodes"` + +##### staticGas? + +`number` + +##### dynamicGas? + +`number` + +#### Returns + +`void` + +*** + +### unpauseTimer() + +> **unpauseTimer**(`timer`): `void` + +Defined in: [logger.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L137) + +#### Parameters + +##### timer + +[`Timer`](Timer.md) + +#### Returns + +`void` diff --git a/packages/evm/docs/classes/EvmError.md b/packages/evm/docs/classes/EvmError.md deleted file mode 100644 index 9156ea38d66..00000000000 --- a/packages/evm/docs/classes/EvmError.md +++ /dev/null @@ -1,50 +0,0 @@ -[@ethereumjs/evm](../README.md) / EvmError - -# Class: EvmError - -## Table of contents - -### Constructors - -- [constructor](EvmError.md#constructor) - -### Properties - -- [error](EvmError.md#error) -- [errorType](EvmError.md#errortype) - -## Constructors - -### constructor - -• **new EvmError**(`error`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `error` | [`EVMErrorMessage`](../enums/EVMErrorMessage.md) | - -#### Defined in - -[exceptions.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L46) - -## Properties - -### error - -• **error**: [`EVMErrorMessage`](../enums/EVMErrorMessage.md) - -#### Defined in - -[exceptions.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L43) - -___ - -### errorType - -• **errorType**: `string` - -#### Defined in - -[exceptions.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L44) diff --git a/packages/evm/docs/classes/MCLBLS.md b/packages/evm/docs/classes/MCLBLS.md new file mode 100644 index 00000000000..36ac0385851 --- /dev/null +++ b/packages/evm/docs/classes/MCLBLS.md @@ -0,0 +1,251 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / MCLBLS + +# Class: MCLBLS + +Defined in: [precompiles/bls12\_381/mcl.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L210) + +Implementation of the `EVMBLSInterface` using the `mcl-wasm` WASM `mcl` wrapper library, +see https://github.com/herumi/mcl-wasm. + +This can be optionally used to replace the build-in Noble implementation (`NobleBLS`) with +a more performant WASM variant. See EVM `bls` constructor option on how to use. + +## Implements + +- [`EVMBLSInterface`](../type-aliases/EVMBLSInterface.md) + +## Constructors + +### Constructor + +> **new MCLBLS**(`mcl`): `MCLBLS` + +Defined in: [precompiles/bls12\_381/mcl.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L213) + +#### Parameters + +##### mcl + +`any` + +#### Returns + +`MCLBLS` + +## Methods + +### addG1() + +> **addG1**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L223) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.addG1` + +*** + +### addG2() + +> **addG2**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:247](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L247) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.addG2` + +*** + +### init() + +> **init**(): `void` + +Defined in: [precompiles/bls12\_381/mcl.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L217) + +#### Returns + +`void` + +#### Implementation of + +`EVMBLSInterface.init` + +*** + +### mapFP2toG2() + +> **mapFP2toG2**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:280](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L280) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.mapFP2toG2` + +*** + +### mapFPtoG1() + +> **mapFPtoG1**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:271](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L271) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.mapFPtoG1` + +*** + +### msmG1() + +> **msmG1**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L289) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.msmG1` + +*** + +### msmG2() + +> **msmG2**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L315) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.msmG2` + +*** + +### mulG1() + +> **mulG1**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:237](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L237) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.mulG1` + +*** + +### mulG2() + +> **mulG2**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L261) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.mulG2` + +*** + +### pairingCheck() + +> **pairingCheck**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/mcl.ts:340](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/mcl.ts#L340) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.pairingCheck` diff --git a/packages/evm/docs/classes/Message.md b/packages/evm/docs/classes/Message.md index 458a51294f2..006d8af968f 100644 --- a/packages/evm/docs/classes/Message.md +++ b/packages/evm/docs/classes/Message.md @@ -1,277 +1,217 @@ -[@ethereumjs/evm](../README.md) / Message - -# Class: Message - -## Table of contents - -### Constructors - -- [constructor](Message.md#constructor) +[**@ethereumjs/evm**](../README.md) -### Properties +*** -- [\_codeAddress](Message.md#_codeaddress) -- [accessWitness](Message.md#accesswitness) -- [authcallOrigin](Message.md#authcallorigin) -- [blobVersionedHashes](Message.md#blobversionedhashes) -- [caller](Message.md#caller) -- [chargeCodeAccesses](Message.md#chargecodeaccesses) -- [code](Message.md#code) -- [containerCode](Message.md#containercode) -- [createdAddresses](Message.md#createdaddresses) -- [data](Message.md#data) -- [delegatecall](Message.md#delegatecall) -- [depth](Message.md#depth) -- [gasLimit](Message.md#gaslimit) -- [gasRefund](Message.md#gasrefund) -- [isCompiled](Message.md#iscompiled) -- [isStatic](Message.md#isstatic) -- [salt](Message.md#salt) -- [selfdestruct](Message.md#selfdestruct) -- [to](Message.md#to) -- [value](Message.md#value) +[@ethereumjs/evm](../README.md) / Message -### Accessors +# Class: Message -- [codeAddress](Message.md#codeaddress) +Defined in: [message.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L49) ## Constructors -### constructor - -• **new Message**(`opts`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | `MessageOpts` | +### Constructor -#### Defined in +> **new Message**(`opts`): `Message` -[message.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L79) +Defined in: [message.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L81) -## Properties - -### \_codeAddress - -• `Optional` **\_codeAddress**: `Address` +#### Parameters -#### Defined in +##### opts -[message.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L52) +`MessageOpts` -___ +#### Returns -### accessWitness +`Message` -• `Optional` **accessWitness**: `AccessWitness` +## Properties -#### Defined in +### \_codeAddress? -[message.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L77) +> `optional` **\_codeAddress**: `Address` -___ +Defined in: [message.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L59) -### authcallOrigin +*** -• `Optional` **authcallOrigin**: `Address` +### accessWitness? -This is used to store the origin of the AUTHCALL, -the purpose is to figure out where `value` should be taken from (not from `caller`) +> `optional` **accessWitness**: `VerkleAccessWitnessInterface` \| `BinaryTreeAccessWitnessInterface` -#### Defined in +Defined in: [message.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L79) -[message.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L71) +*** -___ +### blobVersionedHashes? -### blobVersionedHashes +> `optional` **blobVersionedHashes**: `` `0x${string}` ``[] -• `Optional` **blobVersionedHashes**: `Uint8Array`[] +Defined in: [message.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L78) List of versioned hashes if message is a blob transaction in the outer VM -#### Defined in - -[message.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L76) - -___ +*** ### caller -• **caller**: `Address` - -#### Defined in - -[message.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L47) - -___ +> **caller**: `Address` -### chargeCodeAccesses +Defined in: [message.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L52) -• `Optional` **chargeCodeAccesses**: `boolean` +*** -#### Defined in +### chargeCodeAccesses? -[message.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L57) +> `optional` **chargeCodeAccesses**: `boolean` -___ +Defined in: [message.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L64) -### code +*** -• `Optional` **code**: `Uint8Array` \| `PrecompileFunc` +### code? -#### Defined in +> `optional` **code**: `Uint8Array`\<`ArrayBufferLike`\> \| `PrecompileFunc` -[message.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L51) +Defined in: [message.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L58) -___ +*** -### containerCode +### createdAddresses? -• `Optional` **containerCode**: `Uint8Array` +> `optional` **createdAddresses**: `Set`\<`` `0x${string}` ``\> -#### Defined in +Defined in: [message.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L72) -[message.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L56) - -___ +Map of addresses which were created (used in EIP 6780) -### createdAddresses +*** -• `Optional` **createdAddresses**: `Set`<`string`\> +### data -Map of addresses which were created (used in EIP 6780) +> **data**: `Uint8Array` -#### Defined in +Defined in: [message.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L54) -[message.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L65) +*** -___ +### delegatecall -### data +> **delegatecall**: `boolean` -• **data**: `Uint8Array` +Defined in: [message.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L73) -#### Defined in +*** -[message.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L49) +### depth -___ +> **depth**: `number` -### delegatecall +Defined in: [message.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L57) -• **delegatecall**: `boolean` +*** -#### Defined in +### eof? -[message.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L66) +> `optional` **eof**: `EOFEnv` -___ +Defined in: [message.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L63) -### depth +*** -• **depth**: `number` +### eofCallData? -#### Defined in +> `optional` **eofCallData**: `Uint8Array`\<`ArrayBufferLike`\> -[message.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L50) +Defined in: [message.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L55) -___ +*** ### gasLimit -• **gasLimit**: `bigint` +> **gasLimit**: `bigint` -#### Defined in +Defined in: [message.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L53) -[message.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L48) - -___ +*** ### gasRefund -• **gasRefund**: `bigint` - -#### Defined in +> **gasRefund**: `bigint` -[message.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L72) +Defined in: [message.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L74) -___ +*** ### isCompiled -• **isCompiled**: `boolean` +> **isCompiled**: `boolean` -#### Defined in +Defined in: [message.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L61) -[message.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L54) +*** -___ +### isCreate? -### isStatic - -• **isStatic**: `boolean` +> `optional` **isCreate**: `boolean` -#### Defined in +Defined in: [message.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L56) -[message.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L53) +*** -___ +### isStatic -### salt +> **isStatic**: `boolean` -• `Optional` **salt**: `Uint8Array` +Defined in: [message.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L60) -#### Defined in +*** -[message.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L55) +### salt? -___ +> `optional` **salt**: `Uint8Array`\<`ArrayBufferLike`\> -### selfdestruct +Defined in: [message.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L62) -• `Optional` **selfdestruct**: `Set`<`string`\> +*** -Set of addresses to selfdestruct. Key is the unprefixed address. +### selfdestruct? -#### Defined in +> `optional` **selfdestruct**: `Set`\<`` `0x${string}` ``\> -[message.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L61) +Defined in: [message.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L68) -___ +Set of addresses to selfdestruct. Key is the unprefixed address. -### to +*** -• `Optional` **to**: `Address` +### to? -#### Defined in +> `optional` **to**: `Address` -[message.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L45) +Defined in: [message.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L50) -___ +*** ### value -• **value**: `bigint` - -#### Defined in +> **value**: `bigint` -[message.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L46) +Defined in: [message.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L51) ## Accessors ### codeAddress -• `get` **codeAddress**(): `Address` +#### Get Signature -Note: should only be called in instances where `_codeAddress` or `to` is defined. +> **get** **codeAddress**(): `Address` -#### Returns +Defined in: [message.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L108) -`Address` +Note: should only be called in instances where `_codeAddress` or `to` is defined. -#### Defined in +##### Returns -[message.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L106) +`Address` diff --git a/packages/evm/docs/classes/NobleBLS.md b/packages/evm/docs/classes/NobleBLS.md new file mode 100644 index 00000000000..ee64bd5365d --- /dev/null +++ b/packages/evm/docs/classes/NobleBLS.md @@ -0,0 +1,226 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / NobleBLS + +# Class: NobleBLS + +Defined in: [precompiles/bls12\_381/noble.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L174) + +Implementation of the `EVMBLSInterface` using the `ethereum-cryptography (`@noble/curves`) +JS library, see https://github.com/ethereum/js-ethereum-cryptography. + +This is the EVM default implementation. + +## Implements + +- [`EVMBLSInterface`](../type-aliases/EVMBLSInterface.md) + +## Constructors + +### Constructor + +> **new NobleBLS**(): `NobleBLS` + +#### Returns + +`NobleBLS` + +## Methods + +### addG1() + +> **addG1**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L175) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.addG1` + +*** + +### addG2() + +> **addG2**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L200) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.addG2` + +*** + +### mapFP2toG2() + +> **mapFP2toG2**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L232) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.mapFP2toG2` + +*** + +### mapFPtoG1() + +> **mapFPtoG1**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L224) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.mapFPtoG1` + +*** + +### msmG1() + +> **msmG1**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L240) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.msmG1` + +*** + +### msmG2() + +> **msmG2**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L272) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.msmG2` + +*** + +### mulG1() + +> **mulG1**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L188) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.mulG1` + +*** + +### mulG2() + +> **mulG2**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L212) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.mulG2` + +*** + +### pairingCheck() + +> **pairingCheck**(`input`): `Uint8Array` + +Defined in: [precompiles/bls12\_381/noble.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bls12_381/noble.ts#L304) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBLSInterface.pairingCheck` diff --git a/packages/evm/docs/classes/NobleBN254.md b/packages/evm/docs/classes/NobleBN254.md new file mode 100644 index 00000000000..1b6033cdffd --- /dev/null +++ b/packages/evm/docs/classes/NobleBN254.md @@ -0,0 +1,94 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / NobleBN254 + +# Class: NobleBN254 + +Defined in: [precompiles/bn254/noble.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/noble.ts#L122) + +Implementation of the `EVMBN254Interface` using the `ethereum-cryptography (`@noble/curves`) +JS library, see https://github.com/ethereum/js-ethereum-cryptography. + +This is the EVM default implementation. + +## Implements + +- [`EVMBN254Interface`](../type-aliases/EVMBN254Interface.md) + +## Constructors + +### Constructor + +> **new NobleBN254**(): `NobleBN254` + +#### Returns + +`NobleBN254` + +## Methods + +### add() + +> **add**(`input`): `Uint8Array` + +Defined in: [precompiles/bn254/noble.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/noble.ts#L123) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBN254Interface.add` + +*** + +### mul() + +> **mul**(`input`): `Uint8Array` + +Defined in: [precompiles/bn254/noble.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/noble.ts#L131) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBN254Interface.mul` + +*** + +### pairing() + +> **pairing**(`input`): `Uint8Array` + +Defined in: [precompiles/bn254/noble.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/noble.ts#L142) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBN254Interface.pairing` diff --git a/packages/evm/docs/classes/RustBN254.md b/packages/evm/docs/classes/RustBN254.md new file mode 100644 index 00000000000..dd7da6b1552 --- /dev/null +++ b/packages/evm/docs/classes/RustBN254.md @@ -0,0 +1,103 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / RustBN254 + +# Class: RustBN254 + +Defined in: [precompiles/bn254/rustbn.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/rustbn.ts#L12) + +Implementation of the `EVMBN254Interface` using a WASM wrapper https://github.com/ethereumjs/rustbn.js +around the Parity fork of the Zcash bn pairing cryptography library. + +This can be optionally used to replace the build-in Noble implementation (`NobleBN254`) with +a more performant WASM variant. See EVM `bls` constructor option on how to use. + +## Implements + +- [`EVMBN254Interface`](../type-aliases/EVMBN254Interface.md) + +## Constructors + +### Constructor + +> **new RustBN254**(`rustbn`): `RustBN254` + +Defined in: [precompiles/bn254/rustbn.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/rustbn.ts#L15) + +#### Parameters + +##### rustbn + +`any` + +#### Returns + +`RustBN254` + +## Methods + +### add() + +> **add**(`input`): `Uint8Array` + +Defined in: [precompiles/bn254/rustbn.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/rustbn.ts#L19) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBN254Interface.add` + +*** + +### mul() + +> **mul**(`input`): `Uint8Array` + +Defined in: [precompiles/bn254/rustbn.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/rustbn.ts#L24) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBN254Interface.mul` + +*** + +### pairing() + +> **pairing**(`input`): `Uint8Array` + +Defined in: [precompiles/bn254/rustbn.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/bn254/rustbn.ts#L28) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +#### Implementation of + +`EVMBN254Interface.pairing` diff --git a/packages/evm/docs/classes/Timer.md b/packages/evm/docs/classes/Timer.md new file mode 100644 index 00000000000..702d2e834c0 --- /dev/null +++ b/packages/evm/docs/classes/Timer.md @@ -0,0 +1,71 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / Timer + +# Class: Timer + +Defined in: [logger.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L34) + +## Constructors + +### Constructor + +> **new Timer**(`tag`): `Timer` + +Defined in: [logger.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L39) + +#### Parameters + +##### tag + +`string` + +#### Returns + +`Timer` + +## Properties + +### tag + +> **tag**: `string` + +Defined in: [logger.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L37) + +## Methods + +### pause() + +> **pause**(): `void` + +Defined in: [logger.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L44) + +#### Returns + +`void` + +*** + +### time() + +> **time**(): `number` + +Defined in: [logger.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L52) + +#### Returns + +`number` + +*** + +### unpause() + +> **unpause**(): `void` + +Defined in: [logger.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L48) + +#### Returns + +`void` diff --git a/packages/evm/docs/classes/VerkleAccessWitness.md b/packages/evm/docs/classes/VerkleAccessWitness.md new file mode 100644 index 00000000000..9f4227741b9 --- /dev/null +++ b/packages/evm/docs/classes/VerkleAccessWitness.md @@ -0,0 +1,543 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / VerkleAccessWitness + +# Class: VerkleAccessWitness + +Defined in: [verkleAccessWitness.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L96) + +## Implements + +- `VerkleAccessWitnessInterface` + +## Constructors + +### Constructor + +> **new VerkleAccessWitness**(`opts`): `VerkleAccessWitness` + +Defined in: [verkleAccessWitness.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L102) + +#### Parameters + +##### opts + +###### chunks? + +`Map`\<`` `0x${string}` ``, [`ChunkAccessEvent`](../type-aliases/ChunkAccessEvent.md)\> + +###### stems? + +`Map`\<`` `0x${string}` ``, [`StemAccessEvent`](../type-aliases/StemAccessEvent.md) & [`StemMeta`](../type-aliases/StemMeta.md)\> + +###### verkleCrypto + +`VerkleCrypto` + +#### Returns + +`VerkleAccessWitness` + +## Properties + +### chunkCache + +> **chunkCache**: `ChunkCache` + +Defined in: [verkleAccessWitness.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L100) + +*** + +### chunks + +> **chunks**: `Map`\<`` `0x${string}` ``, [`ChunkAccessEvent`](../type-aliases/ChunkAccessEvent.md)\> + +Defined in: [verkleAccessWitness.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L98) + +*** + +### stemCache + +> **stemCache**: `StemCache` + +Defined in: [verkleAccessWitness.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L99) + +*** + +### stems + +> **stems**: `Map`\<`` `0x${string}` ``, [`StemAccessEvent`](../type-aliases/StemAccessEvent.md) & [`StemMeta`](../type-aliases/StemMeta.md)\> + +Defined in: [verkleAccessWitness.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L97) + +*** + +### verkleCrypto + +> **verkleCrypto**: `VerkleCrypto` + +Defined in: [verkleAccessWitness.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L101) + +## Methods + +### accesses() + +> **accesses**(): `Generator`\<`VerkleAccessedStateWithAddress`\> + +Defined in: [verkleAccessWitness.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L382) + +#### Returns + +`Generator`\<`VerkleAccessedStateWithAddress`\> + +#### Implementation of + +`VerkleAccessWitnessInterface.accesses` + +*** + +### commit() + +> **commit**(): `void` + +Defined in: [verkleAccessWitness.ts:317](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L317) + +#### Returns + +`void` + +#### Implementation of + +`VerkleAccessWitnessInterface.commit` + +*** + +### debugWitnessCost() + +> **debugWitnessCost**(): `void` + +Defined in: [verkleAccessWitness.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L334) + +#### Returns + +`void` + +#### Implementation of + +`VerkleAccessWitnessInterface.debugWitnessCost` + +*** + +### merge() + +> **merge**(`accessWitness`): `void` + +Defined in: [verkleAccessWitness.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L292) + +#### Parameters + +##### accessWitness + +`VerkleAccessWitness` + +#### Returns + +`void` + +#### Implementation of + +`VerkleAccessWitnessInterface.merge` + +*** + +### rawAccesses() + +> **rawAccesses**(): `Generator`\<`RawVerkleAccessedState`\> + +Defined in: [verkleAccessWitness.ts:367](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L367) + +#### Returns + +`Generator`\<`RawVerkleAccessedState`\> + +#### Implementation of + +`VerkleAccessWitnessInterface.rawAccesses` + +*** + +### readAccountBasicData() + +> **readAccountBasicData**(`address`): `bigint` + +Defined in: [verkleAccessWitness.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L115) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.readAccountBasicData` + +*** + +### readAccountCodeChunks() + +> **readAccountCodeChunks**(`contract`, `startPc`, `endPc`): `bigint` + +Defined in: [verkleAccessWitness.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L149) + +#### Parameters + +##### contract + +`Address` + +##### startPc + +`number` + +##### endPc + +`number` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.readAccountCodeChunks` + +*** + +### readAccountCodeHash() + +> **readAccountCodeHash**(`address`): `bigint` + +Defined in: [verkleAccessWitness.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L123) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.readAccountCodeHash` + +*** + +### readAccountHeader() + +> **readAccountHeader**(`address`): `bigint` + +Defined in: [verkleAccessWitness.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L131) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.readAccountHeader` + +*** + +### readAccountStorage() + +> **readAccountStorage**(`address`, `storageSlot`): `bigint` + +Defined in: [verkleAccessWitness.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L167) + +#### Parameters + +##### address + +`Address` + +##### storageSlot + +`bigint` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.readAccountStorage` + +*** + +### revert() + +> **revert**(): `void` + +Defined in: [verkleAccessWitness.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L329) + +#### Returns + +`void` + +#### Implementation of + +`VerkleAccessWitnessInterface.revert` + +*** + +### touchAddress() + +> **touchAddress**(`address`, `treeIndex`, `subIndex`, `__namedParameters`): `AccessEventFlags` + +Defined in: [verkleAccessWitness.ts:236](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L236) + +#### Parameters + +##### address + +`Address` + +##### treeIndex + +`number` | `bigint` + +##### subIndex + +`number` | `Uint8Array`\<`ArrayBufferLike`\> + +##### \_\_namedParameters + +###### isWrite? + +`boolean` + +#### Returns + +`AccessEventFlags` + +*** + +### touchAddressAndComputeGas() + +> **touchAddressAndComputeGas**(`address`, `treeIndex`, `subIndex`, `__namedParameters`): `bigint` + +Defined in: [verkleAccessWitness.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L197) + +#### Parameters + +##### address + +`Address` + +##### treeIndex + +`number` | `bigint` + +##### subIndex + +`number` | `Uint8Array`\<`ArrayBufferLike`\> + +##### \_\_namedParameters + +###### isWrite? + +`boolean` + +#### Returns + +`bigint` + +*** + +### touchAddressOnReadAndComputeGas() + +> **touchAddressOnReadAndComputeGas**(`address`, `treeIndex`, `subIndex`): `bigint` + +Defined in: [verkleAccessWitness.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L187) + +#### Parameters + +##### address + +`Address` + +##### treeIndex + +`number` | `bigint` + +##### subIndex + +`number` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`bigint` + +*** + +### touchAddressOnWriteAndComputeGas() + +> **touchAddressOnWriteAndComputeGas**(`address`, `treeIndex`, `subIndex`): `bigint` + +Defined in: [verkleAccessWitness.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L177) + +#### Parameters + +##### address + +`Address` + +##### treeIndex + +`number` | `bigint` + +##### subIndex + +`number` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`bigint` + +*** + +### writeAccountBasicData() + +> **writeAccountBasicData**(`address`): `bigint` + +Defined in: [verkleAccessWitness.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L119) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.writeAccountBasicData` + +*** + +### writeAccountCodeChunks() + +> **writeAccountCodeChunks**(`contract`, `startPc`, `endPc`): `bigint` + +Defined in: [verkleAccessWitness.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L158) + +#### Parameters + +##### contract + +`Address` + +##### startPc + +`number` + +##### endPc + +`number` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.writeAccountCodeChunks` + +*** + +### writeAccountCodeHash() + +> **writeAccountCodeHash**(`address`): `bigint` + +Defined in: [verkleAccessWitness.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L127) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.writeAccountCodeHash` + +*** + +### writeAccountHeader() + +> **writeAccountHeader**(`address`): `bigint` + +Defined in: [verkleAccessWitness.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L140) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.writeAccountHeader` + +*** + +### writeAccountStorage() + +> **writeAccountStorage**(`address`, `storageSlot`): `bigint` + +Defined in: [verkleAccessWitness.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L172) + +#### Parameters + +##### address + +`Address` + +##### storageSlot + +`bigint` + +#### Returns + +`bigint` + +#### Implementation of + +`VerkleAccessWitnessInterface.writeAccountStorage` diff --git a/packages/evm/docs/enums/EvmErrorMessage.md b/packages/evm/docs/enums/EvmErrorMessage.md deleted file mode 100644 index b94326ceec6..00000000000 --- a/packages/evm/docs/enums/EvmErrorMessage.md +++ /dev/null @@ -1,371 +0,0 @@ -[@ethereumjs/evm](../README.md) / EVMErrorMessage - -# Enumeration: EVMErrorMessage - -## Table of contents - -### Enumeration Members - -- [AUTHCALL\_NONZERO\_VALUEEXT](EVMErrorMessage.md#authcall_nonzero_valueext) -- [AUTHCALL\_UNSET](EVMErrorMessage.md#authcall_unset) -- [AUTH\_INVALID\_S](EVMErrorMessage.md#auth_invalid_s) -- [BLS\_12\_381\_FP\_NOT\_IN\_FIELD](EVMErrorMessage.md#bls_12_381_fp_not_in_field) -- [BLS\_12\_381\_INPUT\_EMPTY](EVMErrorMessage.md#bls_12_381_input_empty) -- [BLS\_12\_381\_INVALID\_INPUT\_LENGTH](EVMErrorMessage.md#bls_12_381_invalid_input_length) -- [BLS\_12\_381\_POINT\_NOT\_ON\_CURVE](EVMErrorMessage.md#bls_12_381_point_not_on_curve) -- [CODESIZE\_EXCEEDS\_MAXIMUM](EVMErrorMessage.md#codesize_exceeds_maximum) -- [CODESTORE\_OUT\_OF\_GAS](EVMErrorMessage.md#codestore_out_of_gas) -- [CREATE\_COLLISION](EVMErrorMessage.md#create_collision) -- [INITCODE\_SIZE\_VIOLATION](EVMErrorMessage.md#initcode_size_violation) -- [INSUFFICIENT\_BALANCE](EVMErrorMessage.md#insufficient_balance) -- [INTERNAL\_ERROR](EVMErrorMessage.md#internal_error) -- [INVALID\_BEGINSUB](EVMErrorMessage.md#invalid_beginsub) -- [INVALID\_BYTECODE\_RESULT](EVMErrorMessage.md#invalid_bytecode_result) -- [INVALID\_COMMITMENT](EVMErrorMessage.md#invalid_commitment) -- [INVALID\_EOF\_FORMAT](EVMErrorMessage.md#invalid_eof_format) -- [INVALID\_INPUTS](EVMErrorMessage.md#invalid_inputs) -- [INVALID\_INPUT\_LENGTH](EVMErrorMessage.md#invalid_input_length) -- [INVALID\_JUMP](EVMErrorMessage.md#invalid_jump) -- [INVALID\_JUMPSUB](EVMErrorMessage.md#invalid_jumpsub) -- [INVALID\_OPCODE](EVMErrorMessage.md#invalid_opcode) -- [INVALID\_PROOF](EVMErrorMessage.md#invalid_proof) -- [INVALID\_RETURNSUB](EVMErrorMessage.md#invalid_returnsub) -- [OUT\_OF\_GAS](EVMErrorMessage.md#out_of_gas) -- [OUT\_OF\_RANGE](EVMErrorMessage.md#out_of_range) -- [REFUND\_EXHAUSTED](EVMErrorMessage.md#refund_exhausted) -- [REVERT](EVMErrorMessage.md#revert) -- [STACK\_OVERFLOW](EVMErrorMessage.md#stack_overflow) -- [STACK\_UNDERFLOW](EVMErrorMessage.md#stack_underflow) -- [STATIC\_STATE\_CHANGE](EVMErrorMessage.md#static_state_change) -- [STOP](EVMErrorMessage.md#stop) -- [VALUE\_OVERFLOW](EVMErrorMessage.md#value_overflow) - -## Enumeration Members - -### AUTHCALL\_NONZERO\_VALUEEXT - -• **AUTHCALL\_NONZERO\_VALUEEXT** = ``"attempting to execute AUTHCALL with nonzero external value"`` - -#### Defined in - -[exceptions.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L27) - -___ - -### AUTHCALL\_UNSET - -• **AUTHCALL\_UNSET** = ``"attempting to AUTHCALL without AUTH set"`` - -#### Defined in - -[exceptions.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L26) - -___ - -### AUTH\_INVALID\_S - -• **AUTH\_INVALID\_S** = ``"invalid Signature: s-values greater than secp256k1n/2 are considered invalid"`` - -#### Defined in - -[exceptions.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L28) - -___ - -### BLS\_12\_381\_FP\_NOT\_IN\_FIELD - -• **BLS\_12\_381\_FP\_NOT\_IN\_FIELD** = ``"fp point not in field"`` - -#### Defined in - -[exceptions.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L34) - -___ - -### BLS\_12\_381\_INPUT\_EMPTY - -• **BLS\_12\_381\_INPUT\_EMPTY** = ``"input is empty"`` - -#### Defined in - -[exceptions.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L33) - -___ - -### BLS\_12\_381\_INVALID\_INPUT\_LENGTH - -• **BLS\_12\_381\_INVALID\_INPUT\_LENGTH** = ``"invalid input length"`` - -#### Defined in - -[exceptions.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L31) - -___ - -### BLS\_12\_381\_POINT\_NOT\_ON\_CURVE - -• **BLS\_12\_381\_POINT\_NOT\_ON\_CURVE** = ``"point not on curve"`` - -#### Defined in - -[exceptions.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L32) - -___ - -### CODESIZE\_EXCEEDS\_MAXIMUM - -• **CODESIZE\_EXCEEDS\_MAXIMUM** = ``"code size to deposit exceeds maximum code size"`` - -#### Defined in - -[exceptions.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L4) - -___ - -### CODESTORE\_OUT\_OF\_GAS - -• **CODESTORE\_OUT\_OF\_GAS** = ``"code store out of gas"`` - -#### Defined in - -[exceptions.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L3) - -___ - -### CREATE\_COLLISION - -• **CREATE\_COLLISION** = ``"create collision"`` - -#### Defined in - -[exceptions.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L13) - -___ - -### INITCODE\_SIZE\_VIOLATION - -• **INITCODE\_SIZE\_VIOLATION** = ``"initcode exceeds max initcode size"`` - -#### Defined in - -[exceptions.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L23) - -___ - -### INSUFFICIENT\_BALANCE - -• **INSUFFICIENT\_BALANCE** = ``"insufficient balance"`` - -#### Defined in - -[exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L17) - -___ - -### INTERNAL\_ERROR - -• **INTERNAL\_ERROR** = ``"internal error"`` - -#### Defined in - -[exceptions.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L12) - -___ - -### INVALID\_BEGINSUB - -• **INVALID\_BEGINSUB** = ``"invalid BEGINSUB"`` - -#### Defined in - -[exceptions.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L18) - -___ - -### INVALID\_BYTECODE\_RESULT - -• **INVALID\_BYTECODE\_RESULT** = ``"invalid bytecode deployed"`` - -#### Defined in - -[exceptions.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L21) - -___ - -### INVALID\_COMMITMENT - -• **INVALID\_COMMITMENT** = ``"kzg commitment does not match versioned hash"`` - -#### Defined in - -[exceptions.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L37) - -___ - -### INVALID\_EOF\_FORMAT - -• **INVALID\_EOF\_FORMAT** = ``"invalid EOF format"`` - -#### Defined in - -[exceptions.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L22) - -___ - -### INVALID\_INPUTS - -• **INVALID\_INPUTS** = ``"kzg inputs invalid"`` - -#### Defined in - -[exceptions.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L38) - -___ - -### INVALID\_INPUT\_LENGTH - -• **INVALID\_INPUT\_LENGTH** = ``"invalid input length"`` - -#### Defined in - -[exceptions.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L24) - -___ - -### INVALID\_JUMP - -• **INVALID\_JUMP** = ``"invalid JUMP"`` - -#### Defined in - -[exceptions.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L7) - -___ - -### INVALID\_JUMPSUB - -• **INVALID\_JUMPSUB** = ``"invalid JUMPSUB"`` - -#### Defined in - -[exceptions.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L20) - -___ - -### INVALID\_OPCODE - -• **INVALID\_OPCODE** = ``"invalid opcode"`` - -#### Defined in - -[exceptions.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L8) - -___ - -### INVALID\_PROOF - -• **INVALID\_PROOF** = ``"kzg proof invalid"`` - -#### Defined in - -[exceptions.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L39) - -___ - -### INVALID\_RETURNSUB - -• **INVALID\_RETURNSUB** = ``"invalid RETURNSUB"`` - -#### Defined in - -[exceptions.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L19) - -___ - -### OUT\_OF\_GAS - -• **OUT\_OF\_GAS** = ``"out of gas"`` - -#### Defined in - -[exceptions.ts:2](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L2) - -___ - -### OUT\_OF\_RANGE - -• **OUT\_OF\_RANGE** = ``"value out of range"`` - -#### Defined in - -[exceptions.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L9) - -___ - -### REFUND\_EXHAUSTED - -• **REFUND\_EXHAUSTED** = ``"refund exhausted"`` - -#### Defined in - -[exceptions.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L15) - -___ - -### REVERT - -• **REVERT** = ``"revert"`` - -#### Defined in - -[exceptions.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L10) - -___ - -### STACK\_OVERFLOW - -• **STACK\_OVERFLOW** = ``"stack overflow"`` - -#### Defined in - -[exceptions.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L6) - -___ - -### STACK\_UNDERFLOW - -• **STACK\_UNDERFLOW** = ``"stack underflow"`` - -#### Defined in - -[exceptions.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L5) - -___ - -### STATIC\_STATE\_CHANGE - -• **STATIC\_STATE\_CHANGE** = ``"static state change"`` - -#### Defined in - -[exceptions.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L11) - -___ - -### STOP - -• **STOP** = ``"stop"`` - -#### Defined in - -[exceptions.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L14) - -___ - -### VALUE\_OVERFLOW - -• **VALUE\_OVERFLOW** = ``"value overflow"`` - -#### Defined in - -[exceptions.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L16) diff --git a/packages/evm/docs/functions/createEVM.md b/packages/evm/docs/functions/createEVM.md new file mode 100644 index 00000000000..6babe42a659 --- /dev/null +++ b/packages/evm/docs/functions/createEVM.md @@ -0,0 +1,28 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / createEVM + +# Function: createEVM() + +> **createEVM**(`createOpts?`): `Promise`\<`EVM`\> + +Defined in: [constructors.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/constructors.ts#L17) + +Use this async static constructor for the initialization +of an EVM object + +## Parameters + +### createOpts? + +[`EVMOpts`](../interfaces/EVMOpts.md) + +The EVM options + +## Returns + +`Promise`\<`EVM`\> + +A new EVM diff --git a/packages/evm/docs/functions/decodeAccessedState.md b/packages/evm/docs/functions/decodeAccessedState.md new file mode 100644 index 00000000000..ed958296a84 --- /dev/null +++ b/packages/evm/docs/functions/decodeAccessedState.md @@ -0,0 +1,25 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / decodeAccessedState + +# Function: decodeAccessedState() + +> **decodeAccessedState**(`treeIndex`, `chunkIndex`): `VerkleAccessedState` + +Defined in: [verkleAccessWitness.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L61) + +## Parameters + +### treeIndex + +`number` | `bigint` + +### chunkIndex + +`number` + +## Returns + +`VerkleAccessedState` diff --git a/packages/evm/docs/functions/decodeBinaryAccessState.md b/packages/evm/docs/functions/decodeBinaryAccessState.md new file mode 100644 index 00000000000..7e4c0625b23 --- /dev/null +++ b/packages/evm/docs/functions/decodeBinaryAccessState.md @@ -0,0 +1,25 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / decodeBinaryAccessState + +# Function: decodeBinaryAccessState() + +> **decodeBinaryAccessState**(`treeIndex`, `chunkIndex`): `BinaryTreeAccessedState` + +Defined in: [binaryTreeAccessWitness.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L54) + +## Parameters + +### treeIndex + +`number` | `bigint` + +### chunkIndex + +`number` + +## Returns + +`BinaryTreeAccessedState` diff --git a/packages/evm/docs/functions/generateBinaryExecutionWitness.md b/packages/evm/docs/functions/generateBinaryExecutionWitness.md new file mode 100644 index 00000000000..0f73557b6d3 --- /dev/null +++ b/packages/evm/docs/functions/generateBinaryExecutionWitness.md @@ -0,0 +1,39 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / generateBinaryExecutionWitness + +# Function: generateBinaryExecutionWitness() + +> **generateBinaryExecutionWitness**(`stateManager`, `accessWitness`, `parentStateRoot`): `Promise`\<`BinaryTreeExecutionWitness`\> + +Defined in: [binaryTreeAccessWitness.ts:391](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L391) + +Generate a BinaryTreeExecutionWitness from a state manager and an access witness. + +## Parameters + +### stateManager + +`StatefulBinaryTreeStateManager` + +The state manager containing the state to generate the witness for. + +### accessWitness + +[`BinaryTreeAccessWitness`](../classes/BinaryTreeAccessWitness.md) + +The access witness containing the accessed states. + +### parentStateRoot + +`Uint8Array` + +The parent state root (i.e. prestate root) to generate the witness for. + +## Returns + +`Promise`\<`BinaryTreeExecutionWitness`\> + +The generated binary tree execution witness diff --git a/packages/evm/docs/functions/generateExecutionWitness.md b/packages/evm/docs/functions/generateExecutionWitness.md new file mode 100644 index 00000000000..e4d03568949 --- /dev/null +++ b/packages/evm/docs/functions/generateExecutionWitness.md @@ -0,0 +1,41 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / generateExecutionWitness + +# Function: generateExecutionWitness() + +> **generateExecutionWitness**(`stateManager`, `accessWitness`, `parentStateRoot`): `Promise`\<`VerkleExecutionWitness`\> + +Defined in: [verkleAccessWitness.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L400) + +Generate a VerkleExecutionWitness from a state manager and an access witness. + +## Parameters + +### stateManager + +`StatefulVerkleStateManager` + +The state manager containing the state to generate the witness for. + +### accessWitness + +[`VerkleAccessWitness`](../classes/VerkleAccessWitness.md) + +The access witness containing the accessed states. + +### parentStateRoot + +`Uint8Array` + +The parent state root (i.e. prestate root) to generate the witness for. + +## Returns + +`Promise`\<`VerkleExecutionWitness`\> + +The generated verkle execution witness + +Note: This does not provide the verkle proof, which is not implemented diff --git a/packages/evm/docs/functions/getActivePrecompiles.md b/packages/evm/docs/functions/getActivePrecompiles.md new file mode 100644 index 00000000000..b954c9fa59d --- /dev/null +++ b/packages/evm/docs/functions/getActivePrecompiles.md @@ -0,0 +1,25 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / getActivePrecompiles + +# Function: getActivePrecompiles() + +> **getActivePrecompiles**(`common`, `customPrecompiles?`): `Map`\<`string`, `PrecompileFunc`\> + +Defined in: [precompiles/index.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/index.ts#L249) + +## Parameters + +### common + +`Common` + +### customPrecompiles? + +`CustomPrecompile`[] + +## Returns + +`Map`\<`string`, `PrecompileFunc`\> diff --git a/packages/evm/docs/functions/getOpcodesForHF.md b/packages/evm/docs/functions/getOpcodesForHF.md new file mode 100644 index 00000000000..cba1b3a3c2c --- /dev/null +++ b/packages/evm/docs/functions/getOpcodesForHF.md @@ -0,0 +1,33 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / getOpcodesForHF + +# Function: getOpcodesForHF() + +> **getOpcodesForHF**(`common`, `customOpcodes?`): `OpcodeContext` + +Defined in: [opcodes/codes.ts:424](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/opcodes/codes.ts#L424) + +Get suitable opcodes for the required hardfork. + +## Parameters + +### common + +`Common` + +{Common} Ethereumjs Common metadata object. + +### customOpcodes? + +`CustomOpcode`[] + +List with custom opcodes (see EVM `customOpcodes` option description). + +## Returns + +`OpcodeContext` + +Opcodes dictionary object. diff --git a/packages/evm/docs/functions/validateEOF.md b/packages/evm/docs/functions/validateEOF.md new file mode 100644 index 00000000000..2d1eea295b9 --- /dev/null +++ b/packages/evm/docs/functions/validateEOF.md @@ -0,0 +1,45 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / validateEOF + +# Function: validateEOF() + +> **validateEOF**(`input`, `evm`, `containerMode`, `eofMode`): [`EOFContainer`](../classes/EOFContainer.md) + +Defined in: [eof/container.ts:477](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof/container.ts#L477) + +This method validates the EOF. It also performs deeper validation of the body, such as stack/opcode validation +This is ONLY necessary when trying to deploy contracts from a transaction: these can submit containers which are invalid +Since all deployed EOF containers are valid by definition, `validateEOF` does not need to be called each time an EOF contract is called + +## Parameters + +### input + +`Uint8Array` + +Full container buffer + +### evm + +`EVM` + +EVM, to read opcodes from + +### containerMode + +`ContainerSectionType` = `ContainerSectionType.RuntimeCode` + +Container mode to validate on + +### eofMode + +`EOFContainerMode` = `EOFContainerMode.Default` + +EOF mode to run in + +## Returns + +[`EOFContainer`](../classes/EOFContainer.md) diff --git a/packages/evm/docs/interfaces/EVMInterface.md b/packages/evm/docs/interfaces/EVMInterface.md index f85fb83911d..6cf73a6d21c 100644 --- a/packages/evm/docs/interfaces/EVMInterface.md +++ b/packages/evm/docs/interfaces/EVMInterface.md @@ -1,115 +1,253 @@ +[**@ethereumjs/evm**](../README.md) + +*** + [@ethereumjs/evm](../README.md) / EVMInterface # Interface: EVMInterface -## Table of contents +Defined in: [types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L160) + +## Properties -### Properties +### binaryTreeAccessWitness? -- [events](EVMInterface.md#events) -- [journal](EVMInterface.md#journal) -- [precompiles](EVMInterface.md#precompiles) -- [stateManager](EVMInterface.md#statemanager) +> `optional` **binaryTreeAccessWitness**: [`BinaryTreeAccessWitness`](../classes/BinaryTreeAccessWitness.md) -### Methods +Defined in: [types.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L184) -- [runCall](EVMInterface.md#runcall) -- [runCode](EVMInterface.md#runcode) +*** -## Properties +### common + +> **common**: `Common` -### events +Defined in: [types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L161) -• `Optional` **events**: `AsyncEventEmitter`<`EVMEvents`\> +*** -#### Defined in +### events? -[types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L163) +> `optional` **events**: `EventEmitter`\<`EVMEvent`, `any`\> -___ +Defined in: [types.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L181) + +*** ### journal -• **journal**: `Object` +> **journal**: `object` -#### Type declaration +Defined in: [types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L162) -| Name | Type | -| :------ | :------ | -| `accessList?` | `Map`<`string`, `Set`<`string`\>\> | -| `preimages?` | `Map`<`string`, `Uint8Array`\> | -| `addAlwaysWarmAddress` | (`address`: `string`, `addToAccessList?`: `boolean`) => `void` | -| `addAlwaysWarmSlot` | (`address`: `string`, `slot`: `string`, `addToAccessList?`: `boolean`) => `void` | -| `checkpoint` | () => `Promise`<`void`\> | -| `cleanJournal` | () => `void` | -| `cleanup` | () => `Promise`<`void`\> | -| `commit` | () => `Promise`<`void`\> | -| `deleteAccount` | (`address`: `Address`) => `Promise`<`void`\> | -| `putAccount` | (`address`: `Address`, `account`: `Account`) => `Promise`<`void`\> | -| `revert` | () => `Promise`<`void`\> | -| `startReportingAccessList` | () => `void` | -| `startReportingPreimages?` | () => `void` | +#### accessList? -#### Defined in +> `optional` **accessList**: `Map`\<`string`, `Set`\<`string`\>\> -[types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L144) +#### preimages? -___ +> `optional` **preimages**: `Map`\<`` `0x${string}` ``, `Uint8Array`\<`ArrayBufferLike`\>\> -### precompiles +#### addAlwaysWarmAddress() + +> **addAlwaysWarmAddress**(`address`, `addToAccessList?`): `void` + +##### Parameters + +###### address + +`string` + +###### addToAccessList? + +`boolean` + +##### Returns + +`void` + +#### addAlwaysWarmSlot() + +> **addAlwaysWarmSlot**(`address`, `slot`, `addToAccessList?`): `void` + +##### Parameters + +###### address + +`string` + +###### slot + +`string` + +###### addToAccessList? + +`boolean` + +##### Returns + +`void` + +#### checkpoint() + +> **checkpoint**(): `Promise`\<`void`\> + +##### Returns + +`Promise`\<`void`\> + +#### cleanJournal() + +> **cleanJournal**(): `void` + +##### Returns + +`void` + +#### cleanup() + +> **cleanup**(): `Promise`\<`void`\> + +##### Returns + +`Promise`\<`void`\> + +#### commit() + +> **commit**(): `Promise`\<`void`\> + +##### Returns + +`Promise`\<`void`\> + +#### deleteAccount() + +> **deleteAccount**(`address`): `Promise`\<`void`\> -• **precompiles**: `Map`<`string`, `PrecompileFunc`\> +##### Parameters -#### Defined in +###### address -[types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L160) +`Address` -___ +##### Returns + +`Promise`\<`void`\> + +#### putAccount() + +> **putAccount**(`address`, `account`): `Promise`\<`void`\> + +##### Parameters + +###### address + +`Address` + +###### account + +`Account` + +##### Returns + +`Promise`\<`void`\> + +#### revert() + +> **revert**(): `Promise`\<`void`\> + +##### Returns + +`Promise`\<`void`\> + +#### startReportingAccessList() + +> **startReportingAccessList**(): `void` + +##### Returns + +`void` + +#### startReportingPreimages()? + +> `optional` **startReportingPreimages**(): `void` + +##### Returns + +`void` + +*** + +### precompiles + +> **precompiles**: `Map`\<`string`, `PrecompileFunc`\> + +Defined in: [types.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L178) + +*** ### stateManager -• **stateManager**: `EVMStateManagerInterface` +> **stateManager**: `StateManagerInterface` -#### Defined in +Defined in: [types.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L177) -[types.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L159) +*** -## Methods +### systemBinaryTreeAccessWitness? -### runCall +> `optional` **systemBinaryTreeAccessWitness**: [`BinaryTreeAccessWitness`](../classes/BinaryTreeAccessWitness.md) -▸ **runCall**(`opts`): `Promise`<[`EVMResult`](EVMResult.md)\> +Defined in: [types.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L185) -#### Parameters +*** -| Name | Type | -| :------ | :------ | -| `opts` | [`EVMRunCallOpts`](EVMRunCallOpts.md) | +### systemVerkleAccessWitness? -#### Returns +> `optional` **systemVerkleAccessWitness**: [`VerkleAccessWitness`](../classes/VerkleAccessWitness.md) + +Defined in: [types.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L183) + +*** + +### verkleAccessWitness? -`Promise`<[`EVMResult`](EVMResult.md)\> +> `optional` **verkleAccessWitness**: [`VerkleAccessWitness`](../classes/VerkleAccessWitness.md) -#### Defined in +Defined in: [types.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L182) -[types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L161) +## Methods -___ +### runCall() -### runCode +> **runCall**(`opts`): `Promise`\<[`EVMResult`](EVMResult.md)\> -▸ **runCode**(`opts`): `Promise`<[`ExecResult`](ExecResult.md)\> +Defined in: [types.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L179) #### Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`EVMRunCodeOpts`](EVMRunCodeOpts.md) | +##### opts + +[`EVMRunCallOpts`](EVMRunCallOpts.md) #### Returns -`Promise`<[`ExecResult`](ExecResult.md)\> +`Promise`\<[`EVMResult`](EVMResult.md)\> + +*** + +### runCode() + +> **runCode**(`opts`): `Promise`\<[`ExecResult`](ExecResult.md)\> + +Defined in: [types.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L180) -#### Defined in +#### Parameters + +##### opts + +[`EVMRunCodeOpts`](EVMRunCodeOpts.md) + +#### Returns -[types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L162) +`Promise`\<[`ExecResult`](ExecResult.md)\> diff --git a/packages/evm/docs/interfaces/EVMMockBlockchainInterface.md b/packages/evm/docs/interfaces/EVMMockBlockchainInterface.md new file mode 100644 index 00000000000..b6590391541 --- /dev/null +++ b/packages/evm/docs/interfaces/EVMMockBlockchainInterface.md @@ -0,0 +1,57 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / EVMMockBlockchainInterface + +# Interface: EVMMockBlockchainInterface + +Defined in: [types.ts:501](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L501) + +## Methods + +### getBlock() + +> **getBlock**(`blockId`): `Promise`\<`EVMMockBlock`\> + +Defined in: [types.ts:502](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L502) + +#### Parameters + +##### blockId + +`number` + +#### Returns + +`Promise`\<`EVMMockBlock`\> + +*** + +### putBlock() + +> **putBlock**(`block`): `Promise`\<`void`\> + +Defined in: [types.ts:503](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L503) + +#### Parameters + +##### block + +`EVMMockBlock` + +#### Returns + +`Promise`\<`void`\> + +*** + +### shallowCopy() + +> **shallowCopy**(): `EVMMockBlockchainInterface` + +Defined in: [types.ts:504](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L504) + +#### Returns + +`EVMMockBlockchainInterface` diff --git a/packages/evm/docs/interfaces/EVMOpts.md b/packages/evm/docs/interfaces/EVMOpts.md index d5d3bc6038d..86bc4e2b3a5 100644 --- a/packages/evm/docs/interfaces/EVMOpts.md +++ b/packages/evm/docs/interfaces/EVMOpts.md @@ -1,65 +1,165 @@ -[@ethereumjs/evm](../README.md) / EVMOpts +[**@ethereumjs/evm**](../README.md) -# Interface: EVMOpts +*** -Options for instantiating a EVM. +[@ethereumjs/evm](../README.md) / EVMOpts -## Table of contents +# Interface: EVMOpts -### Properties +Defined in: [types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L196) -- [allowUnlimitedContractSize](EVMOpts.md#allowunlimitedcontractsize) -- [allowUnlimitedInitCodeSize](EVMOpts.md#allowunlimitedinitcodesize) -- [blockchain](EVMOpts.md#blockchain) -- [common](EVMOpts.md#common) -- [customOpcodes](EVMOpts.md#customopcodes) -- [customPrecompiles](EVMOpts.md#customprecompiles) -- [profiler](EVMOpts.md#profiler) -- [stateManager](EVMOpts.md#statemanager) +Options for instantiating a EVM. ## Properties -### allowUnlimitedContractSize +### allowUnlimitedContractSize? + +> `optional` **allowUnlimitedContractSize**: `boolean` -• `Optional` **allowUnlimitedContractSize**: `boolean` +Defined in: [types.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L251) Allows unlimited contract sizes while debugging. By setting this to `true`, the check for contract size limit of 24KB (see [EIP-170](https://git.io/vxZkK)) is bypassed. Default: `false` [ONLY set to `true` during debugging] -#### Defined in +*** -[types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L223) +### allowUnlimitedInitCodeSize? -___ +> `optional` **allowUnlimitedInitCodeSize**: `boolean` -### allowUnlimitedInitCodeSize - -• `Optional` **allowUnlimitedInitCodeSize**: `boolean` +Defined in: [types.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L257) Allows unlimited contract code-size init while debugging. This (partially) disables EIP-3860. Gas cost for initcode size analysis will still be charged. Use with caution. -#### Defined in +*** + +### blockchain? + +> `optional` **blockchain**: [`EVMMockBlockchainInterface`](EVMMockBlockchainInterface.md) + +Defined in: [types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L370) + +The EVM comes with a basic mock blockchain interface and implementation for +non-block containing use cases. + +For block-containing setups use the full blockchain implementation from the +`@ethereumjs/blockchain package. + +*** + +### bls? + +> `optional` **bls**: [`EVMBLSInterface`](../type-aliases/EVMBLSInterface.md) + +Defined in: [types.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L327) + +For the EIP-2537 BLS Precompiles, the native JS `ethereum-cryptography` (`@noble/curves`) +https://github.com/ethereum/js-ethereum-cryptography BLS12-381 curve implementation +is used (see `noble.ts` file in the `precompiles/bls12_381/` folder). + +To use an alternative implementation this option can be used by passing +in a wrapper implementation integrating the desired library and adhering +to the `EVMBLSInterface` specification. + +An interface for the MCL WASM implementation https://github.com/herumi/mcl-wasm +is shipped with this library which can be used as follows (with `mcl-wasm` being +explicitly added to the set of dependencies): + +```ts +import * as mcl from 'mcl-wasm' + +await mcl.init(mcl.BLS12_381) +const evm = await createEVM({ bls: new MCLBLS(mcl) }) +``` + +*** + +### bn254? + +> `optional` **bn254**: [`EVMBN254Interface`](../type-aliases/EVMBN254Interface.md) + +Defined in: [types.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L350) + +For the EIP-196/EIP-197 BN254 (alt_BN128) EC precompiles, the native JS `ethereum-cryptography` +(`@noble/curves`) https://github.com/ethereum/js-ethereum-cryptography BN254 curve implementation +is used (see `noble.ts` file in the `precompiles/bn254/` folder). + +To use an alternative implementation this option can be used by passing +in a wrapper implementation integrating the desired library and adhering +to the `EVMBN254Interface` specification. -[types.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L229) +An interface for a WASM wrapper https://github.com/ethereumjs/rustbn.js around the +Parity fork of the Zcash bn pairing cryptography library is shipped with this library +which can be used as follows (with `rustbn.js` being explicitly added to the set of +dependencies): -___ +```ts +import { initRustBN } from 'rustbn-wasm' -### blockchain +const bn254 = await initRustBN() +const evm = await createEVM({ bn254: new RustBN254(bn254) }) +``` -• `Optional` **blockchain**: `Blockchain` +*** -#### Defined in +### cliqueSigner()? -[types.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L269) +> `optional` **cliqueSigner**: (`header`) => `Address` -___ +Defined in: [types.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L382) -### common +When running the EVM with PoA consensus, the `cliqueSigner` function from the `@ethereumjs/block` class +must be provided along with a `BlockHeader` so that the coinbase can be correctly retrieved when the +`Interpreter.getBlockCoinbase` method is called. -• `Optional` **common**: `Common` +#### Parameters + +##### header + +###### baseFeePerGas? + +`bigint` + +###### coinbase + +`Address` + +###### difficulty + +`bigint` + +###### gasLimit + +`bigint` + +###### number + +`bigint` + +###### prevRandao + +`Uint8Array` + +###### timestamp + +`bigint` + +###### getBlobGasPrice + +#### Returns + +`Address` + +*** + +### common? + +> `optional` **common**: `Common` + +Defined in: [types.ts:243](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L243) Use a Common instance for EVM instantiation. @@ -67,21 +167,19 @@ 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-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) +- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - Precompile for BLS12-381 curve operations (Prague) - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost -- [EIP-2718](https://eips.ethereum.org/EIPS/eip-2565) - Transaction Types +- [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) - Typed Transaction Envelope - [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 - [EIP-3198](https://eips.ethereum.org/EIPS/eip-3198) - Base fee Opcode - [EIP-3529](https://eips.ethereum.org/EIPS/eip-3529) - Reduction in refunds -- [EIP-3540](https://eips.ethereum.org/EIPS/eip-3541) - EVM Object Format (EOF) v1 (`outdated`) - [EIP-3541](https://eips.ethereum.org/EIPS/eip-3541) - Reject new contracts starting with the 0xEF byte - [EIP-3554](https://eips.ethereum.org/EIPS/eip-3554) - Difficulty Bomb Delay to December 2021 (only PoW networks) - [EIP-3607](https://eips.ethereum.org/EIPS/eip-3607) - Reject transactions from senders with deployed code - [EIP-3651](https://eips.ethereum.org/EIPS/eip-3651) - Warm COINBASE (Shanghai) -- [EIP-3670](https://eips.ethereum.org/EIPS/eip-3670) - EOF - Code Validation (`outdated`) - [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675) - Upgrade consensus to Proof-of-Stake - [EIP-3855](https://eips.ethereum.org/EIPS/eip-3855) - Push0 opcode (Shanghai) - [EIP-3860](https://eips.ethereum.org/EIPS/eip-3860) - Limit and meter initcode (Shanghai) @@ -92,28 +190,29 @@ 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-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 (Verkle) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable exits (Prague) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Increase the MAX_EFFECTIVE_BALANCE (Prague) - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) +- [EIP-7623](https://eips.ethereum.org/EIPS/eip-7623) - Increase calldata cost (Prague) - [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) +- [EIP-7691](https://eips.ethereum.org/EIPS/eip-7691) - Blob throughput increase (Prague) +- [EIP-7692](https://eips.ethereum.org/EIPS/eip-7692) - EVM Object Format (EOF) v1 (`experimental`) +- [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - Set EOA account code (Prague) +- [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Verkle) *Annotations:* - `experimental`: behaviour can change on patch versions -#### Defined in - -[types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L215) +*** -___ +### customOpcodes? -### customOpcodes +> `optional` **customOpcodes**: `CustomOpcode`[] -• `Optional` **customOpcodes**: `CustomOpcode`[] +Defined in: [types.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L297) Override or add custom opcodes to the EVM instruction set These custom opcodes are EIP-agnostic and are always statically added @@ -134,36 +233,49 @@ To add an opcode, add an entry of the following format: } Note: gasFunction and logicFunction can both be async or synchronous functions -#### Defined in +*** + +### customPrecompiles? + +> `optional` **customPrecompiles**: `CustomPrecompile`[] + +Defined in: [types.ts:305](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L305) -[types.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L251) +*** -___ +### params? -### customPrecompiles +> `optional` **params**: `ParamsDict` -• `Optional` **customPrecompiles**: `CustomPrecompile`[] +Defined in: [types.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L275) -#### Defined in +EVM parameters sorted by EIP can be found in the exported `paramsEVM` dictionary, +which is internally passed to the associated `@ethereumjs/common` instance which +manages parameter selection based on the hardfork and EIP settings. -[types.ts:259](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L259) +This option allows providing a custom set of parameters. Note that parameters +get fully overwritten, so you need to extend the default parameter dict +to provide the full parameter set. -___ +It is recommended to deep-clone the params object for this to avoid side effects: -### profiler +```ts +const params = JSON.parse(JSON.stringify(paramsEVM)) +params['1679']['bn254AddGas'] = 100 // 150 +``` -• `Optional` **profiler**: `EVMProfilerOpts` +*** -#### Defined in +### profiler? -[types.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L274) +> `optional` **profiler**: `EVMProfilerOpts` -___ +Defined in: [types.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L375) -### stateManager +*** -• `Optional` **stateManager**: `EVMStateManagerInterface` +### stateManager? -#### Defined in +> `optional` **stateManager**: `StateManagerInterface` -[types.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L264) +Defined in: [types.ts:361](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L361) diff --git a/packages/evm/docs/interfaces/EVMResult.md b/packages/evm/docs/interfaces/EVMResult.md index bd406a4c2e4..566927013b0 100644 --- a/packages/evm/docs/interfaces/EVMResult.md +++ b/packages/evm/docs/interfaces/EVMResult.md @@ -1,36 +1,31 @@ -[@ethereumjs/evm](../README.md) / EVMResult +[**@ethereumjs/evm**](../README.md) -# Interface: EVMResult +*** -Result of executing a message via the EVM. +[@ethereumjs/evm](../README.md) / EVMResult -## Table of contents +# Interface: EVMResult -### Properties +Defined in: [types.ts:388](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L388) -- [createdAddress](EVMResult.md#createdaddress) -- [execResult](EVMResult.md#execresult) +Result of executing a message via the EVM. ## Properties -### createdAddress +### createdAddress? -• `Optional` **createdAddress**: `Address` +> `optional` **createdAddress**: `Address` -Address of created account during transaction, if any - -#### Defined in +Defined in: [types.ts:392](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L392) -[types.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L284) +Address of created account during transaction, if any -___ +*** ### execResult -• **execResult**: [`ExecResult`](ExecResult.md) +> **execResult**: [`ExecResult`](ExecResult.md) -Contains the results from running the code, if any, as described in runCode - -#### Defined in +Defined in: [types.ts:396](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L396) -[types.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L288) +Contains the results from running the code, if any, as described in runCode diff --git a/packages/evm/docs/interfaces/EVMRunCallOpts.md b/packages/evm/docs/interfaces/EVMRunCallOpts.md index 320c1f8d5f1..a384f7f1bf7 100644 --- a/packages/evm/docs/interfaces/EVMRunCallOpts.md +++ b/packages/evm/docs/interfaces/EVMRunCallOpts.md @@ -1,340 +1,276 @@ +[**@ethereumjs/evm**](../README.md) + +*** + [@ethereumjs/evm](../README.md) / EVMRunCallOpts # Interface: EVMRunCallOpts +Defined in: [types.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L113) + Options for running a call (or create) operation with `EVM.runCall()` -## Hierarchy +## Extends - `EVMRunOpts` - ↳ **`EVMRunCallOpts`** - -## Table of contents - -### Properties - -- [accessWitness](EVMRunCallOpts.md#accesswitness) -- [blobVersionedHashes](EVMRunCallOpts.md#blobversionedhashes) -- [block](EVMRunCallOpts.md#block) -- [caller](EVMRunCallOpts.md#caller) -- [code](EVMRunCallOpts.md#code) -- [createdAddresses](EVMRunCallOpts.md#createdaddresses) -- [data](EVMRunCallOpts.md#data) -- [delegatecall](EVMRunCallOpts.md#delegatecall) -- [depth](EVMRunCallOpts.md#depth) -- [gasLimit](EVMRunCallOpts.md#gaslimit) -- [gasPrice](EVMRunCallOpts.md#gasprice) -- [gasRefund](EVMRunCallOpts.md#gasrefund) -- [isCompiled](EVMRunCallOpts.md#iscompiled) -- [isStatic](EVMRunCallOpts.md#isstatic) -- [message](EVMRunCallOpts.md#message) -- [origin](EVMRunCallOpts.md#origin) -- [salt](EVMRunCallOpts.md#salt) -- [selfdestruct](EVMRunCallOpts.md#selfdestruct) -- [skipBalance](EVMRunCallOpts.md#skipbalance) -- [to](EVMRunCallOpts.md#to) -- [value](EVMRunCallOpts.md#value) - ## Properties -### accessWitness +### accessWitness? -• `Optional` **accessWitness**: `AccessWitness` +> `optional` **accessWitness**: `VerkleAccessWitnessInterface` \| `BinaryTreeAccessWitnessInterface` -#### Defined in +Defined in: [types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L144) -[types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L127) +*** -___ +### blobVersionedHashes? -### blobVersionedHashes +> `optional` **blobVersionedHashes**: `` `0x${string}` ``[] -• `Optional` **blobVersionedHashes**: `Uint8Array`[] +Defined in: [types.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L100) Versioned hashes for each blob in a blob transaction #### Inherited from -EVMRunOpts.blobVersionedHashes +`EVMRunOpts.blobVersionedHashes` -#### Defined in +*** -[types.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L83) +### block? -___ +> `optional` **block**: `Block` -### block - -• `Optional` **block**: `Block` +Defined in: [types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L52) The `block` the `tx` belongs to. If omitted a default blank block will be used. #### Inherited from -EVMRunOpts.block - -#### Defined in +`EVMRunOpts.block` -[types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L35) +*** -___ +### caller? -### caller +> `optional` **caller**: `Address` -• `Optional` **caller**: `Address` +Defined in: [types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L64) The address that ran this code (`msg.sender`). Defaults to the zero address. #### Inherited from -EVMRunOpts.caller - -#### Defined in +`EVMRunOpts.caller` -[types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L47) +*** -___ +### code? -### code +> `optional` **code**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **code**: `Uint8Array` +Defined in: [types.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L68) The EVM code to run. #### Inherited from -EVMRunOpts.code +`EVMRunOpts.code` -#### Defined in +*** -[types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L51) +### createdAddresses? -___ +> `optional` **createdAddresses**: `Set`\<`` `0x${string}` ``\> -### createdAddresses - -• `Optional` **createdAddresses**: `Set`<`string`\> +Defined in: [types.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L125) Created addresses in current context. Used in EIP 6780 -#### Defined in - -[types.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L108) +*** -___ +### data? -### data +> `optional` **data**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **data**: `Uint8Array` +Defined in: [types.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L72) The input data. #### Inherited from -EVMRunOpts.data - -#### Defined in +`EVMRunOpts.data` -[types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L55) +*** -___ +### delegatecall? -### delegatecall +> `optional` **delegatecall**: `boolean` -• `Optional` **delegatecall**: `boolean` +Defined in: [types.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L134) If the call is a DELEGATECALL. Defaults to false. -#### Defined in +*** -[types.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L117) +### depth? -___ +> `optional` **depth**: `number` -### depth - -• `Optional` **depth**: `number` +Defined in: [types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L84) The call depth. Defaults to `0` #### Inherited from -EVMRunOpts.depth - -#### Defined in +`EVMRunOpts.depth` -[types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L67) +*** -___ +### gasLimit? -### gasLimit +> `optional` **gasLimit**: `bigint` -• `Optional` **gasLimit**: `bigint` +Defined in: [types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L76) The gas limit for the call. Defaults to `16777215` (`0xffffff`) #### Inherited from -EVMRunOpts.gasLimit - -#### Defined in +`EVMRunOpts.gasLimit` -[types.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L59) +*** -___ +### gasPrice? -### gasPrice +> `optional` **gasPrice**: `bigint` -• `Optional` **gasPrice**: `bigint` +Defined in: [types.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L56) The gas price for the call. Defaults to `0` #### Inherited from -EVMRunOpts.gasPrice +`EVMRunOpts.gasPrice` -#### Defined in +*** -[types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L39) +### gasRefund? -___ +> `optional` **gasRefund**: `bigint` -### gasRefund - -• `Optional` **gasRefund**: `bigint` +Defined in: [types.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L138) Refund counter. Defaults to `0` -#### Defined in - -[types.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L121) +*** -___ +### isCompiled? -### isCompiled +> `optional` **isCompiled**: `boolean` -• `Optional` **isCompiled**: `boolean` +Defined in: [types.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L117) If the code location is a precompile. -#### Defined in - -[types.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L100) +*** -___ +### isStatic? -### isStatic +> `optional` **isStatic**: `boolean` -• `Optional` **isStatic**: `boolean` +Defined in: [types.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L88) If the call should be executed statically. Defaults to false. #### Inherited from -EVMRunOpts.isStatic +`EVMRunOpts.isStatic` -#### Defined in +*** -[types.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L71) +### message? -___ +> `optional` **message**: [`Message`](../classes/Message.md) -### message - -• `Optional` **message**: [`Message`](../classes/Message.md) +Defined in: [types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L142) Optionally pass in an already-built message. -#### Defined in - -[types.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L125) +*** -___ +### origin? -### origin +> `optional` **origin**: `Address` -• `Optional` **origin**: `Address` +Defined in: [types.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L60) The address where the call originated from. Defaults to the zero address. #### Inherited from -EVMRunOpts.origin - -#### Defined in +`EVMRunOpts.origin` -[types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L43) +*** -___ +### salt? -### salt +> `optional` **salt**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **salt**: `Uint8Array` +Defined in: [types.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L121) An optional salt to pass to CREATE2. -#### Defined in +*** -[types.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L104) +### selfdestruct? -___ +> `optional` **selfdestruct**: `Set`\<`` `0x${string}` ``\> -### selfdestruct - -• `Optional` **selfdestruct**: `Set`<`string`\> +Defined in: [types.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L92) Addresses to selfdestruct. Defaults to the empty set. #### Inherited from -EVMRunOpts.selfdestruct - -#### Defined in +`EVMRunOpts.selfdestruct` -[types.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L75) +*** -___ +### skipBalance? -### skipBalance +> `optional` **skipBalance**: `boolean` -• `Optional` **skipBalance**: `boolean` +Defined in: [types.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L130) Skip balance checks if true. If caller balance is less than message value, sets balance to message value to ensure execution doesn't fail. -#### Defined in - -[types.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L113) +*** -___ +### to? -### to +> `optional` **to**: `Address` -• `Optional` **to**: `Address` +Defined in: [types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L96) The address of the account that is executing this code (`address(this)`). Defaults to the zero address. #### Inherited from -EVMRunOpts.to +`EVMRunOpts.to` -#### Defined in +*** -[types.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L79) +### value? -___ +> `optional` **value**: `bigint` -### value - -• `Optional` **value**: `bigint` +Defined in: [types.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L80) The value in ether that is being sent to `opts.address`. Defaults to `0` #### Inherited from -EVMRunOpts.value - -#### Defined in - -[types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L63) +`EVMRunOpts.value` diff --git a/packages/evm/docs/interfaces/EVMRunCodeOpts.md b/packages/evm/docs/interfaces/EVMRunCodeOpts.md index 9ef76eaf3ed..ca36f22ada0 100644 --- a/packages/evm/docs/interfaces/EVMRunCodeOpts.md +++ b/packages/evm/docs/interfaces/EVMRunCodeOpts.md @@ -1,246 +1,203 @@ -[@ethereumjs/evm](../README.md) / EVMRunCodeOpts - -# Interface: EVMRunCodeOpts +[**@ethereumjs/evm**](../README.md) -## Hierarchy +*** -- `EVMRunOpts` +[@ethereumjs/evm](../README.md) / EVMRunCodeOpts - ↳ **`EVMRunCodeOpts`** +# Interface: EVMRunCodeOpts -## Table of contents +Defined in: [types.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L103) -### Properties +## Extends -- [blobVersionedHashes](EVMRunCodeOpts.md#blobversionedhashes) -- [block](EVMRunCodeOpts.md#block) -- [caller](EVMRunCodeOpts.md#caller) -- [code](EVMRunCodeOpts.md#code) -- [data](EVMRunCodeOpts.md#data) -- [depth](EVMRunCodeOpts.md#depth) -- [gasLimit](EVMRunCodeOpts.md#gaslimit) -- [gasPrice](EVMRunCodeOpts.md#gasprice) -- [isStatic](EVMRunCodeOpts.md#isstatic) -- [origin](EVMRunCodeOpts.md#origin) -- [pc](EVMRunCodeOpts.md#pc) -- [selfdestruct](EVMRunCodeOpts.md#selfdestruct) -- [to](EVMRunCodeOpts.md#to) -- [value](EVMRunCodeOpts.md#value) +- `EVMRunOpts` ## Properties -### blobVersionedHashes +### blobVersionedHashes? + +> `optional` **blobVersionedHashes**: `` `0x${string}` ``[] -• `Optional` **blobVersionedHashes**: `Uint8Array`[] +Defined in: [types.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L100) Versioned hashes for each blob in a blob transaction #### Inherited from -EVMRunOpts.blobVersionedHashes - -#### Defined in +`EVMRunOpts.blobVersionedHashes` -[types.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L83) +*** -___ +### block? -### block +> `optional` **block**: `Block` -• `Optional` **block**: `Block` +Defined in: [types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L52) The `block` the `tx` belongs to. If omitted a default blank block will be used. #### Inherited from -EVMRunOpts.block +`EVMRunOpts.block` -#### Defined in +*** -[types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L35) +### caller? -___ +> `optional` **caller**: `Address` -### caller - -• `Optional` **caller**: `Address` +Defined in: [types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L64) The address that ran this code (`msg.sender`). Defaults to the zero address. #### Inherited from -EVMRunOpts.caller - -#### Defined in +`EVMRunOpts.caller` -[types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L47) +*** -___ +### code? -### code +> `optional` **code**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **code**: `Uint8Array` +Defined in: [types.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L68) The EVM code to run. #### Inherited from -EVMRunOpts.code - -#### Defined in +`EVMRunOpts.code` -[types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L51) +*** -___ +### data? -### data +> `optional` **data**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **data**: `Uint8Array` +Defined in: [types.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L72) The input data. #### Inherited from -EVMRunOpts.data +`EVMRunOpts.data` -#### Defined in +*** -[types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L55) +### depth? -___ +> `optional` **depth**: `number` -### depth - -• `Optional` **depth**: `number` +Defined in: [types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L84) The call depth. Defaults to `0` #### Inherited from -EVMRunOpts.depth - -#### Defined in +`EVMRunOpts.depth` -[types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L67) +*** -___ +### gasLimit? -### gasLimit +> `optional` **gasLimit**: `bigint` -• `Optional` **gasLimit**: `bigint` +Defined in: [types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L76) The gas limit for the call. Defaults to `16777215` (`0xffffff`) #### Inherited from -EVMRunOpts.gasLimit - -#### Defined in +`EVMRunOpts.gasLimit` -[types.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L59) +*** -___ +### gasPrice? -### gasPrice +> `optional` **gasPrice**: `bigint` -• `Optional` **gasPrice**: `bigint` +Defined in: [types.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L56) The gas price for the call. Defaults to `0` #### Inherited from -EVMRunOpts.gasPrice +`EVMRunOpts.gasPrice` -#### Defined in +*** -[types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L39) +### isStatic? -___ +> `optional` **isStatic**: `boolean` -### isStatic - -• `Optional` **isStatic**: `boolean` +Defined in: [types.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L88) If the call should be executed statically. Defaults to false. #### Inherited from -EVMRunOpts.isStatic - -#### Defined in +`EVMRunOpts.isStatic` -[types.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L71) +*** -___ +### origin? -### origin +> `optional` **origin**: `Address` -• `Optional` **origin**: `Address` +Defined in: [types.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L60) The address where the call originated from. Defaults to the zero address. #### Inherited from -EVMRunOpts.origin - -#### Defined in +`EVMRunOpts.origin` -[types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L43) +*** -___ +### pc? -### pc +> `optional` **pc**: `number` -• `Optional` **pc**: `number` +Defined in: [types.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L107) -#### Defined in +*** -[types.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L90) +### selfdestruct? -___ +> `optional` **selfdestruct**: `Set`\<`` `0x${string}` ``\> -### selfdestruct - -• `Optional` **selfdestruct**: `Set`<`string`\> +Defined in: [types.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L92) Addresses to selfdestruct. Defaults to the empty set. #### Inherited from -EVMRunOpts.selfdestruct - -#### Defined in +`EVMRunOpts.selfdestruct` -[types.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L75) +*** -___ +### to? -### to +> `optional` **to**: `Address` -• `Optional` **to**: `Address` +Defined in: [types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L96) The address of the account that is executing this code (`address(this)`). Defaults to the zero address. #### Inherited from -EVMRunOpts.to - -#### Defined in +`EVMRunOpts.to` -[types.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L79) +*** -___ +### value? -### value +> `optional` **value**: `bigint` -• `Optional` **value**: `bigint` +Defined in: [types.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L80) The value in ether that is being sent to `opts.address`. Defaults to `0` #### Inherited from -EVMRunOpts.value - -#### Defined in - -[types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L63) +`EVMRunOpts.value` diff --git a/packages/evm/docs/interfaces/ExecResult.md b/packages/evm/docs/interfaces/ExecResult.md index b43ad47ade8..c736754a87c 100644 --- a/packages/evm/docs/interfaces/ExecResult.md +++ b/packages/evm/docs/interfaces/ExecResult.md @@ -1,138 +1,109 @@ -[@ethereumjs/evm](../README.md) / ExecResult +[**@ethereumjs/evm**](../README.md) -# Interface: ExecResult +*** -Result of executing a call via the EVM. +[@ethereumjs/evm](../README.md) / ExecResult -## Table of contents +# Interface: ExecResult -### Properties +Defined in: [types.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L402) -- [blobGasUsed](ExecResult.md#blobgasused) -- [createdAddresses](ExecResult.md#createdaddresses) -- [exceptionError](ExecResult.md#exceptionerror) -- [executionGasUsed](ExecResult.md#executiongasused) -- [gas](ExecResult.md#gas) -- [gasRefund](ExecResult.md#gasrefund) -- [logs](ExecResult.md#logs) -- [returnValue](ExecResult.md#returnvalue) -- [runState](ExecResult.md#runstate) -- [selfdestruct](ExecResult.md#selfdestruct) +Result of executing a call via the EVM. ## Properties -### blobGasUsed +### blobGasUsed? -• `Optional` **blobGasUsed**: `bigint` +> `optional` **blobGasUsed**: `bigint` -Amount of blob gas consumed by the transaction +Defined in: [types.ts:439](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L439) -#### Defined in +Amount of blob gas consumed by the transaction -[types.ts:331](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L331) +*** -___ +### createdAddresses? -### createdAddresses +> `optional` **createdAddresses**: `Set`\<`` `0x${string}` ``\> -• `Optional` **createdAddresses**: `Set`<`string`\> +Defined in: [types.ts:431](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L431) Map of addresses which were created (used in EIP 6780) -#### Defined in - -[types.ts:323](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L323) +*** -___ +### exceptionError? -### exceptionError +> `optional` **exceptionError**: [`EVMError`](../classes/EVMError.md) -• `Optional` **exceptionError**: [`EvmError`](../classes/EvmError.md) +Defined in: [types.ts:407](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L407) Description of the exception, if any occurred -#### Defined in - -[types.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L299) - -___ +*** ### executionGasUsed -• **executionGasUsed**: `bigint` +> **executionGasUsed**: `bigint` -Amount of gas the code used to run +Defined in: [types.ts:415](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L415) -#### Defined in +Amount of gas the code used to run -[types.ts:307](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L307) +*** -___ +### gas? -### gas +> `optional` **gas**: `bigint` -• `Optional` **gas**: `bigint` +Defined in: [types.ts:411](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L411) Amount of gas left -#### Defined in - -[types.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L303) +*** -___ +### gasRefund? -### gasRefund +> `optional` **gasRefund**: `bigint` -• `Optional` **gasRefund**: `bigint` +Defined in: [types.ts:435](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L435) The gas refund counter -#### Defined in +*** -[types.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L327) +### logs? -___ +> `optional` **logs**: [`Log`](../type-aliases/Log.md)[] -### logs - -• `Optional` **logs**: [`Log`](../README.md#log)[] +Defined in: [types.ts:423](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L423) Array of logs that the contract emitted -#### Defined in - -[types.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L315) - -___ +*** ### returnValue -• **returnValue**: `Uint8Array` +> **returnValue**: `Uint8Array` -Return value from the contract - -#### Defined in +Defined in: [types.ts:419](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L419) -[types.ts:311](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L311) +Return value from the contract -___ +*** -### runState +### runState? -• `Optional` **runState**: `RunState` +> `optional` **runState**: `RunState` -#### Defined in +Defined in: [types.ts:403](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L403) -[types.ts:295](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L295) +*** -___ +### selfdestruct? -### selfdestruct +> `optional` **selfdestruct**: `Set`\<`` `0x${string}` ``\> -• `Optional` **selfdestruct**: `Set`<`string`\> +Defined in: [types.ts:427](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L427) A set of accounts to selfdestruct - -#### Defined in - -[types.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L319) diff --git a/packages/evm/docs/interfaces/InterpreterStep.md b/packages/evm/docs/interfaces/InterpreterStep.md index 00ca32015fc..c8e6dc14249 100644 --- a/packages/evm/docs/interfaces/InterpreterStep.md +++ b/packages/evm/docs/interfaces/InterpreterStep.md @@ -1,160 +1,165 @@ -[@ethereumjs/evm](../README.md) / InterpreterStep +[**@ethereumjs/evm**](../README.md) -# Interface: InterpreterStep +*** -## Table of contents +[@ethereumjs/evm](../README.md) / InterpreterStep -### Properties +# Interface: InterpreterStep -- [account](InterpreterStep.md#account) -- [address](InterpreterStep.md#address) -- [codeAddress](InterpreterStep.md#codeaddress) -- [depth](InterpreterStep.md#depth) -- [gasLeft](InterpreterStep.md#gasleft) -- [gasRefund](InterpreterStep.md#gasrefund) -- [memory](InterpreterStep.md#memory) -- [memoryWordCount](InterpreterStep.md#memorywordcount) -- [opcode](InterpreterStep.md#opcode) -- [pc](InterpreterStep.md#pc) -- [returnStack](InterpreterStep.md#returnstack) -- [stack](InterpreterStep.md#stack) -- [stateManager](InterpreterStep.md#statemanager) +Defined in: [interpreter.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L119) ## Properties ### account -• **account**: `Account` +> **account**: `Account` -#### Defined in +Defined in: [interpreter.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L133) -[interpreter.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L118) - -___ +*** ### address -• **address**: `Address` - -#### Defined in +> **address**: `Address` -[interpreter.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L119) +Defined in: [interpreter.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L134) -___ +*** ### codeAddress -• **codeAddress**: `Address` +> **codeAddress**: `Address` -#### Defined in +Defined in: [interpreter.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L137) -[interpreter.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L122) - -___ +*** ### depth -• **depth**: `number` +> **depth**: `number` -#### Defined in +Defined in: [interpreter.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L125) -[interpreter.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L111) +*** -___ +### eofFunctionDepth? -### gasLeft +> `optional` **eofFunctionDepth**: `number` -• **gasLeft**: `bigint` +Defined in: [interpreter.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L140) -#### Defined in +*** -[interpreter.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L105) +### eofSection? -___ +> `optional` **eofSection**: `number` + +Defined in: [interpreter.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L138) + +*** + +### error? + +> `optional` **error**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [interpreter.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L141) + +*** + +### gasLeft + +> **gasLeft**: `bigint` + +Defined in: [interpreter.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L120) + +*** ### gasRefund -• **gasRefund**: `bigint` +> **gasRefund**: `bigint` -#### Defined in +Defined in: [interpreter.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L121) -[interpreter.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L106) +*** -___ +### immediate? -### memory +> `optional` **immediate**: `Uint8Array`\<`ArrayBufferLike`\> -• **memory**: `Uint8Array` +Defined in: [interpreter.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L139) -#### Defined in +*** -[interpreter.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L120) +### memory -___ +> **memory**: `Uint8Array` -### memoryWordCount +Defined in: [interpreter.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L135) -• **memoryWordCount**: `bigint` +*** + +### memoryWordCount -#### Defined in +> **memoryWordCount**: `bigint` -[interpreter.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L121) +Defined in: [interpreter.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L136) -___ +*** ### opcode -• **opcode**: `Object` +> **opcode**: `object` -#### Type declaration +Defined in: [interpreter.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L126) -| Name | Type | -| :------ | :------ | -| `dynamicFee?` | `bigint` | -| `fee` | `number` | -| `isAsync` | `boolean` | -| `name` | `string` | +#### code -#### Defined in +> **code**: `number` -[interpreter.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L112) +#### dynamicFee? -___ +> `optional` **dynamicFee**: `bigint` -### pc +#### fee + +> **fee**: `number` -• **pc**: `number` +#### isAsync -#### Defined in +> **isAsync**: `boolean` -[interpreter.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L110) +#### name -___ +> **name**: `string` -### returnStack +*** -• **returnStack**: `bigint`[] +### pc -#### Defined in +> **pc**: `number` -[interpreter.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L109) +Defined in: [interpreter.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L124) -___ +*** ### stack -• **stack**: `bigint`[] - -#### Defined in +> **stack**: `bigint`[] -[interpreter.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L108) +Defined in: [interpreter.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L123) -___ +*** ### stateManager -• **stateManager**: `EVMStateManagerInterface` +> **stateManager**: `StateManagerInterface` + +Defined in: [interpreter.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L122) + +*** + +### storage? -#### Defined in +> `optional` **storage**: \[`` `0x${string}` ``, `` `0x${string}` ``\][] -[interpreter.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L107) +Defined in: [interpreter.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L142) diff --git a/packages/evm/docs/interfaces/PrecompileInput.md b/packages/evm/docs/interfaces/PrecompileInput.md index 53c76263d99..587525dcd7c 100644 --- a/packages/evm/docs/interfaces/PrecompileInput.md +++ b/packages/evm/docs/interfaces/PrecompileInput.md @@ -1,63 +1,49 @@ -[@ethereumjs/evm](../README.md) / PrecompileInput +[**@ethereumjs/evm**](../README.md) -# Interface: PrecompileInput +*** -## Table of contents +[@ethereumjs/evm](../README.md) / PrecompileInput -### Properties +# Interface: PrecompileInput -- [\_EVM](PrecompileInput.md#_evm) -- [\_debug](PrecompileInput.md#_debug) -- [common](PrecompileInput.md#common) -- [data](PrecompileInput.md#data) -- [gasLimit](PrecompileInput.md#gaslimit) +Defined in: [precompiles/types.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L9) ## Properties -### \_EVM - -• **\_EVM**: [`EVMInterface`](EVMInterface.md) +### \_debug? -#### Defined in +> `optional` **\_debug**: `Debugger` -[precompiles/types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L13) +Defined in: [precompiles/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L14) -___ +*** -### \_debug - -• `Optional` **\_debug**: `Debugger` +### \_EVM -#### Defined in +> **\_EVM**: [`EVMInterface`](EVMInterface.md) -[precompiles/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L14) +Defined in: [precompiles/types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L13) -___ +*** ### common -• **common**: `Common` - -#### Defined in +> **common**: `Common` -[precompiles/types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L12) +Defined in: [precompiles/types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L12) -___ +*** ### data -• **data**: `Uint8Array` +> **data**: `Uint8Array` -#### Defined in +Defined in: [precompiles/types.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L10) -[precompiles/types.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L10) - -___ +*** ### gasLimit -• **gasLimit**: `bigint` - -#### Defined in +> **gasLimit**: `bigint` -[precompiles/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L11) +Defined in: [precompiles/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L11) diff --git a/packages/evm/docs/interfaces/bn128.md b/packages/evm/docs/interfaces/bn128.md deleted file mode 100644 index 07679efb9c0..00000000000 --- a/packages/evm/docs/interfaces/bn128.md +++ /dev/null @@ -1,85 +0,0 @@ -[@ethereumjs/evm](../README.md) / bn128 - -# Interface: bn128 - -The BN128 curve package (`rustbn-wasm`) - -## Table of contents - -### Properties - -- [ec\_add](bn128.md#ec_add) -- [ec\_mul](bn128.md#ec_mul) -- [ec\_pairing](bn128.md#ec_pairing) - -## Properties - -### ec\_add - -• **ec\_add**: (`input_str`: `string`) => `string` - -#### Type declaration - -▸ (`input_str`): `string` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `input_str` | `string` | - -##### Returns - -`string` - -#### Defined in - -[types.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L390) - -___ - -### ec\_mul - -• **ec\_mul**: (`input_hex`: `string`) => `string` - -#### Type declaration - -▸ (`input_hex`): `string` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `input_hex` | `string` | - -##### Returns - -`string` - -#### Defined in - -[types.ts:391](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L391) - -___ - -### ec\_pairing - -• **ec\_pairing**: (`input_str`: `string`) => `string` - -#### Type declaration - -▸ (`input_str`): `string` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `input_str` | `string` | - -##### Returns - -`string` - -#### Defined in - -[types.ts:389](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L389) diff --git a/packages/evm/docs/type-aliases/BinaryChunkAccessEvent.md b/packages/evm/docs/type-aliases/BinaryChunkAccessEvent.md new file mode 100644 index 00000000000..39f34594507 --- /dev/null +++ b/packages/evm/docs/type-aliases/BinaryChunkAccessEvent.md @@ -0,0 +1,17 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / BinaryChunkAccessEvent + +# Type Alias: BinaryChunkAccessEvent + +> **BinaryChunkAccessEvent** = [`BinaryStemAccessEvent`](BinaryStemAccessEvent.md) & `object` + +Defined in: [binaryTreeAccessWitness.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L49) + +## Type declaration + +### fill? + +> `optional` **fill**: `boolean` diff --git a/packages/evm/docs/type-aliases/BinaryStemAccessEvent.md b/packages/evm/docs/type-aliases/BinaryStemAccessEvent.md new file mode 100644 index 00000000000..2ec00f41d97 --- /dev/null +++ b/packages/evm/docs/type-aliases/BinaryStemAccessEvent.md @@ -0,0 +1,19 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / BinaryStemAccessEvent + +# Type Alias: BinaryStemAccessEvent + +> **BinaryStemAccessEvent** = `object` + +Defined in: [binaryTreeAccessWitness.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L47) + +## Properties + +### write? + +> `optional` **write**: `boolean` + +Defined in: [binaryTreeAccessWitness.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L47) diff --git a/packages/evm/docs/type-aliases/BinaryStemMeta.md b/packages/evm/docs/type-aliases/BinaryStemMeta.md new file mode 100644 index 00000000000..01af622806b --- /dev/null +++ b/packages/evm/docs/type-aliases/BinaryStemMeta.md @@ -0,0 +1,27 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / BinaryStemMeta + +# Type Alias: BinaryStemMeta + +> **BinaryStemMeta** = `object` + +Defined in: [binaryTreeAccessWitness.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L52) + +## Properties + +### address + +> **address**: `Address` + +Defined in: [binaryTreeAccessWitness.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L52) + +*** + +### treeIndex + +> **treeIndex**: `number` \| `bigint` + +Defined in: [binaryTreeAccessWitness.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/binaryTreeAccessWitness.ts#L52) diff --git a/packages/evm/docs/type-aliases/ChunkAccessEvent.md b/packages/evm/docs/type-aliases/ChunkAccessEvent.md new file mode 100644 index 00000000000..59cffb08cbf --- /dev/null +++ b/packages/evm/docs/type-aliases/ChunkAccessEvent.md @@ -0,0 +1,17 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / ChunkAccessEvent + +# Type Alias: ChunkAccessEvent + +> **ChunkAccessEvent** = [`StemAccessEvent`](StemAccessEvent.md) & `object` + +Defined in: [verkleAccessWitness.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L56) + +## Type declaration + +### fill? + +> `optional` **fill**: `boolean` diff --git a/packages/evm/docs/type-aliases/EVMBLSInterface.md b/packages/evm/docs/type-aliases/EVMBLSInterface.md new file mode 100644 index 00000000000..3289f151ecf --- /dev/null +++ b/packages/evm/docs/type-aliases/EVMBLSInterface.md @@ -0,0 +1,188 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / EVMBLSInterface + +# Type Alias: EVMBLSInterface + +> **EVMBLSInterface** = `object` + +Defined in: [types.ts:446](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L446) + +High level wrapper for BLS libraries used +for the BLS precompiles + +## Methods + +### addG1() + +> **addG1**(`input`): `Uint8Array` + +Defined in: [types.ts:448](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L448) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### addG2() + +> **addG2**(`input`): `Uint8Array` + +Defined in: [types.ts:450](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L450) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### init()? + +> `optional` **init**(): `void` + +Defined in: [types.ts:447](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L447) + +#### Returns + +`void` + +*** + +### mapFP2toG2() + +> **mapFP2toG2**(`input`): `Uint8Array` + +Defined in: [types.ts:453](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L453) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### mapFPtoG1() + +> **mapFPtoG1**(`input`): `Uint8Array` + +Defined in: [types.ts:452](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L452) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### msmG1() + +> **msmG1**(`input`): `Uint8Array` + +Defined in: [types.ts:454](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L454) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### msmG2() + +> **msmG2**(`input`): `Uint8Array` + +Defined in: [types.ts:455](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L455) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### mulG1() + +> **mulG1**(`input`): `Uint8Array` + +Defined in: [types.ts:449](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L449) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### mulG2() + +> **mulG2**(`input`): `Uint8Array` + +Defined in: [types.ts:451](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L451) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### pairingCheck() + +> **pairingCheck**(`input`): `Uint8Array` + +Defined in: [types.ts:456](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L456) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` diff --git a/packages/evm/docs/type-aliases/EVMBN254Interface.md b/packages/evm/docs/type-aliases/EVMBN254Interface.md new file mode 100644 index 00000000000..de502bcc5ad --- /dev/null +++ b/packages/evm/docs/type-aliases/EVMBN254Interface.md @@ -0,0 +1,68 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / EVMBN254Interface + +# Type Alias: EVMBN254Interface + +> **EVMBN254Interface** = `object` + +Defined in: [types.ts:463](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L463) + +High level wrapper for BN254 (alt_BN128) libraries +used for the BN254 (alt_BN128) EC precompiles + +## Properties + +### add() + +> **add**: (`input`) => `Uint8Array` + +Defined in: [types.ts:464](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L464) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### mul() + +> **mul**: (`input`) => `Uint8Array` + +Defined in: [types.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L465) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### pairing() + +> **pairing**: (`input`) => `Uint8Array` + +Defined in: [types.ts:466](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L466) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` diff --git a/packages/evm/docs/type-aliases/EVMPerformanceLogOutput.md b/packages/evm/docs/type-aliases/EVMPerformanceLogOutput.md new file mode 100644 index 00000000000..b866bbd895a --- /dev/null +++ b/packages/evm/docs/type-aliases/EVMPerformanceLogOutput.md @@ -0,0 +1,91 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / EVMPerformanceLogOutput + +# Type Alias: EVMPerformanceLogOutput + +> **EVMPerformanceLogOutput** = `object` + +Defined in: [logger.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L11) + +## Properties + +### avgTimePerCall + +> **avgTimePerCall**: `number` + +Defined in: [logger.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L14) + +*** + +### blocksPerSlot + +> **blocksPerSlot**: `number` + +Defined in: [logger.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L17) + +*** + +### calls + +> **calls**: `number` + +Defined in: [logger.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L12) + +*** + +### dynamicGasUsed? + +> `optional` **dynamicGasUsed**: `number` + +Defined in: [logger.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L20) + +*** + +### gasUsed + +> **gasUsed**: `number` + +Defined in: [logger.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L15) + +*** + +### millionGasPerSecond + +> **millionGasPerSecond**: `number` + +Defined in: [logger.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L16) + +*** + +### staticGas? + +> `optional` **staticGas**: `number` + +Defined in: [logger.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L21) + +*** + +### staticGasUsed? + +> `optional` **staticGasUsed**: `number` + +Defined in: [logger.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L19) + +*** + +### tag + +> **tag**: `string` + +Defined in: [logger.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L18) + +*** + +### totalTime + +> **totalTime**: `number` + +Defined in: [logger.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/logger.ts#L13) diff --git a/packages/evm/docs/type-aliases/Log.md b/packages/evm/docs/type-aliases/Log.md new file mode 100644 index 00000000000..2ca5d66ea7b --- /dev/null +++ b/packages/evm/docs/type-aliases/Log.md @@ -0,0 +1,13 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / Log + +# Type Alias: Log + +> **Log** = \[`Uint8Array`, `Uint8Array`[], `Uint8Array`\] + +Defined in: [types.ts:472](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L472) + +Log that the contract emits. diff --git a/packages/evm/docs/type-aliases/StemAccessEvent.md b/packages/evm/docs/type-aliases/StemAccessEvent.md new file mode 100644 index 00000000000..fcdbadccf54 --- /dev/null +++ b/packages/evm/docs/type-aliases/StemAccessEvent.md @@ -0,0 +1,19 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / StemAccessEvent + +# Type Alias: StemAccessEvent + +> **StemAccessEvent** = `object` + +Defined in: [verkleAccessWitness.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L53) + +## Properties + +### write? + +> `optional` **write**: `boolean` + +Defined in: [verkleAccessWitness.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L53) diff --git a/packages/evm/docs/type-aliases/StemMeta.md b/packages/evm/docs/type-aliases/StemMeta.md new file mode 100644 index 00000000000..44307698a97 --- /dev/null +++ b/packages/evm/docs/type-aliases/StemMeta.md @@ -0,0 +1,27 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / StemMeta + +# Type Alias: StemMeta + +> **StemMeta** = `object` + +Defined in: [verkleAccessWitness.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L59) + +## Properties + +### address + +> **address**: `Address` + +Defined in: [verkleAccessWitness.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L59) + +*** + +### treeIndex + +> **treeIndex**: `number` \| `bigint` + +Defined in: [verkleAccessWitness.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/verkleAccessWitness.ts#L59) diff --git a/packages/evm/docs/variables/paramsEVM.md b/packages/evm/docs/variables/paramsEVM.md new file mode 100644 index 00000000000..1460e0577f2 --- /dev/null +++ b/packages/evm/docs/variables/paramsEVM.md @@ -0,0 +1,11 @@ +[**@ethereumjs/evm**](../README.md) + +*** + +[@ethereumjs/evm](../README.md) / paramsEVM + +# Variable: paramsEVM + +> `const` **paramsEVM**: `ParamsDict` + +Defined in: [params.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/params.ts#L3) diff --git a/packages/evm/examples/eips.ts b/packages/evm/examples/eips.ts index 4d405bcf120..986ce6ed8c7 100644 --- a/packages/evm/examples/eips.ts +++ b/packages/evm/examples/eips.ts @@ -1,10 +1,12 @@ -import { Common, Mainnet } from '@ethereumjs/common' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { createEVM } from '@ethereumjs/evm' const main = async () => { - const common = new Common({ chain: Mainnet, eips: [7702] }) + const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) const evm = await createEVM({ common }) - console.log(`EIP 7702 is active - ${evm.common.isActivatedEIP(7702)}`) + console.log( + `EIP 7702 is active in isolation on top of the Cancun HF - ${evm.common.isActivatedEIP(7702)}`, + ) } void main() diff --git a/packages/evm/package.json b/packages/evm/package.json index ea6ac3773b4..8eb399c0ed9 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -35,7 +35,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- evm", "examples:build": "npx embedme README.md", "formatTest": "node ./scripts/formatTest", @@ -59,10 +59,10 @@ "@ethereumjs/statemanager": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", "@ethereumjs/verkle": "^10.0.0-dev-rc.1", - "@noble/curves": "^1.8.2", + "@noble/curves": "^1.9.0", "@types/debug": "^4.1.12", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "eventemitter3": "^5.0.1" }, "devDependencies": { diff --git a/packages/evm/src/eof/container.ts b/packages/evm/src/eof/container.ts index 4772aa8d551..31f6c7d92e7 100644 --- a/packages/evm/src/eof/container.ts +++ b/packages/evm/src/eof/container.ts @@ -22,7 +22,7 @@ import { TYPE_MIN, VERSION, } from './constants.ts' -import { EOFError, validationError } from './errors.ts' +import { EOFErrorMessage, validationError } from './errors.ts' import { ContainerSectionType, verifyCode } from './verify.ts' import type { EVM } from '../evm.ts' @@ -64,7 +64,7 @@ class StreamReader { readBytes(amount: number, errorStr?: string) { const end = this.ptr + amount if (end > this.data.length) { - validationError(EOFError.OUT_OF_BOUNDS, this.ptr, errorStr) + validationError(EOFErrorMessage.OUT_OF_BOUNDS, this.ptr, errorStr) } const ptr = this.ptr this.ptr += amount @@ -78,7 +78,7 @@ class StreamReader { */ readUint(errorStr?: string) { if (this.ptr >= this.data.length) { - validationError(EOFError.OUT_OF_BOUNDS, this.ptr, errorStr) + validationError(EOFErrorMessage.OUT_OF_BOUNDS, this.ptr, errorStr) } return this.data[this.ptr++] } @@ -91,7 +91,7 @@ class StreamReader { */ verifyUint(expect: number, errorStr?: string) { if (this.readUint() !== expect) { - validationError(EOFError.VERIFY_UINT, this.ptr - 1, errorStr) + validationError(EOFErrorMessage.VERIFY_UINT, this.ptr - 1, errorStr) } } @@ -103,7 +103,7 @@ class StreamReader { readUint16(errorStr?: string) { const end = this.ptr + 2 if (end > this.data.length) { - validationError(EOFError.OUT_OF_BOUNDS, this.ptr, errorStr) + validationError(EOFErrorMessage.OUT_OF_BOUNDS, this.ptr, errorStr) } const ptr = this.ptr this.ptr += 2 @@ -155,20 +155,20 @@ class EOFHeader { } const stream = new StreamReader(input) // Verify that the header starts with 0xEF0001 - stream.verifyUint(FORMAT, EOFError.FORMAT) - stream.verifyUint(MAGIC, EOFError.MAGIC) - stream.verifyUint(VERSION, EOFError.VERSION) + stream.verifyUint(FORMAT, EOFErrorMessage.FORMAT) + stream.verifyUint(MAGIC, EOFErrorMessage.MAGIC) + stream.verifyUint(VERSION, EOFErrorMessage.VERSION) if (input.length < 15) { throw EthereumJSErrorWithoutCode('err: container size less than minimum valid size') } // Verify that the types section is present and its length is valid - stream.verifyUint(KIND_TYPE, EOFError.KIND_TYPE) - const typeSize = stream.readUint16(EOFError.TYPE_SIZE) + stream.verifyUint(KIND_TYPE, EOFErrorMessage.KIND_TYPE) + const typeSize = stream.readUint16(EOFErrorMessage.TYPE_SIZE) if (typeSize < TYPE_MIN) { - validationError(EOFError.INVALID_TYPE_SIZE, typeSize) + validationError(EOFErrorMessage.INVALID_TYPE_SIZE, typeSize) } if (typeSize % TYPE_DIVISOR !== 0) { - validationError(EOFError.INVALID_TYPE_SIZE, typeSize) + validationError(EOFErrorMessage.INVALID_TYPE_SIZE, typeSize) } if (typeSize > TYPE_MAX) { throw EthereumJSErrorWithoutCode( @@ -176,20 +176,20 @@ class EOFHeader { ) } // Verify that the code section is present and its size is valid - stream.verifyUint(KIND_CODE, EOFError.KIND_CODE) - const codeSize = stream.readUint16(EOFError.CODE_SIZE) + stream.verifyUint(KIND_CODE, EOFErrorMessage.KIND_CODE) + const codeSize = stream.readUint16(EOFErrorMessage.CODE_SIZE) if (codeSize < CODE_MIN) { - validationError(EOFError.MIN_CODE_SECTIONS) + validationError(EOFErrorMessage.MIN_CODE_SECTIONS) } if (codeSize !== typeSize / TYPE_DIVISOR) { - validationError(EOFError.TYPE_SECTIONS, typeSize / TYPE_DIVISOR, codeSize) + validationError(EOFErrorMessage.TYPE_SECTIONS, typeSize / TYPE_DIVISOR, codeSize) } // Read the actual code sizes in the code section and verify that each section has the minimum size const codeSizes = [] for (let i = 0; i < codeSize; i++) { - const codeSectionSize = stream.readUint16(EOFError.CODE_SECTION) + const codeSectionSize = stream.readUint16(EOFErrorMessage.CODE_SECTION) if (codeSectionSize < CODE_SIZE_MIN) { - validationError(EOFError.CODE_SECTION_SIZE) + validationError(EOFErrorMessage.CODE_SECTION_SIZE) } codeSizes.push(codeSectionSize) } @@ -199,21 +199,21 @@ class EOFHeader { const containerSizes: number[] = [] if (nextSection === KIND_CONTAINER) { // The optional container section is present, validate that the size is within bounds - const containerSectionSize = stream.readUint16(EOFError.CONTAINER_SIZE) + const containerSectionSize = stream.readUint16(EOFErrorMessage.CONTAINER_SIZE) if (containerSectionSize < CONTAINER_MIN) { - validationError(EOFError.CONTAINER_SECTION_SIZE) + validationError(EOFErrorMessage.CONTAINER_SECTION_SIZE) } if (containerSectionSize > CONTAINER_MAX) { - validationError(EOFError.CONTAINER_SECTION_SIZE) + validationError(EOFErrorMessage.CONTAINER_SECTION_SIZE) } // Read the actual container sections and validate that each section has the minimum size for (let i = 0; i < containerSectionSize; i++) { - const containerSize = stream.readUint16(EOFError.CONTAINER_SECTION) + const containerSize = stream.readUint16(EOFErrorMessage.CONTAINER_SECTION) if (containerSize < CONTAINER_SIZE_MIN) { - validationError(EOFError.CONTAINER_SECTION_MIN) + validationError(EOFErrorMessage.CONTAINER_SECTION_MIN) } containerSizes.push(containerSize) @@ -224,15 +224,15 @@ class EOFHeader { // Verify that the next section is of the data type if (nextSection !== KIND_DATA) { - validationError(EOFError.KIND_DATA) + validationError(EOFErrorMessage.KIND_DATA) } this.dataSizePtr = stream.getPtr() - const dataSize = stream.readUint16(EOFError.DATA_SIZE) + const dataSize = stream.readUint16(EOFErrorMessage.DATA_SIZE) // Verify that the header ends with the TERMINATOR byte - stream.verifyUint(TERMINATOR, EOFError.TERMINATOR) + stream.verifyUint(TERMINATOR, EOFErrorMessage.TERMINATOR) // Write all values to the header object this.typeSize = typeSize @@ -269,6 +269,31 @@ class EOFHeader { } return offset } + + // Returns the code section for a given program counter position + getSectionFromProgramCounter(programCounter: number) { + if ( + programCounter < 0 || + programCounter > + this.codeStartPos[this.codeStartPos.lastIndex] + this.codeSizes[this.codeSizes.lastIndex] + ) { + // If code position is outside the beginning or end of the code sections, return 0 + throw EthereumJSErrorWithoutCode('program counter out of bounds') + } + + if (this.codeStartPos.length < this.codeSizes.length) { + this.getCodePosition(this.codeSizes.length - 1) // initialize code positions if uninitialized + } + + for (let i = 0; i < this.codeSizes.length; i++) { + if (programCounter < this.codeStartPos[i] + this.codeSizes[i]) { + // We've found our section if the code position is less than the end of the current code section + return i + } + } + // This shouldn't happen so just error + throw EthereumJSErrorWithoutCode(`Invalid program counter value: ${programCounter}`) + } } export interface TypeSection { @@ -302,25 +327,25 @@ class EOFBody { const typeSections: TypeSection[] = [] // Read and parse each type section, and validate that the type section values are within valid bounds for (let i = 0; i < header.typeSize / 4; i++) { - const inputs = stream.readUint(EOFError.INPUTS) - const outputs = stream.readUint(EOFError.OUTPUTS) - const maxStackHeight = stream.readUint16(EOFError.MAX_STACK_HEIGHT) + const inputs = stream.readUint(EOFErrorMessage.INPUTS) + const outputs = stream.readUint(EOFErrorMessage.OUTPUTS) + const maxStackHeight = stream.readUint16(EOFErrorMessage.MAX_STACK_HEIGHT) if (i === 0) { if (inputs !== 0) { - validationError(EOFError.CODE0_INPUTS) + validationError(EOFErrorMessage.CODE0_INPUTS) } if (outputs !== 0x80) { - validationError(EOFError.CODE0_OUTPUTS) + validationError(EOFErrorMessage.CODE0_OUTPUTS) } } if (inputs > INPUTS_MAX) { - validationError(EOFError.MAX_INPUTS, i, inputs) + validationError(EOFErrorMessage.MAX_INPUTS, i, inputs) } if (outputs > OUTPUTS_MAX) { - validationError(EOFError.MAX_OUTPUTS, i, outputs) + validationError(EOFErrorMessage.MAX_OUTPUTS, i, outputs) } if (maxStackHeight > MAX_STACK_HEIGHT) { - validationError(EOFError.MAX_STACK_HEIGHT_LIMIT, i, maxStackHeight) + validationError(EOFErrorMessage.MAX_STACK_HEIGHT_LIMIT, i, maxStackHeight) } typeSections.push({ inputs, @@ -336,7 +361,7 @@ class EOFBody { const code = stream.readBytes(codeSize) codes.push(code) } catch { - validationError(EOFError.CODE_SECTION, i) + validationError(EOFErrorMessage.CODE_SECTION, i) } } // Write the entire code section to the entireCodeSection @@ -349,7 +374,7 @@ class EOFBody { const container = stream.readBytes(containerSize) containers.push(container) } catch { - validationError(EOFError.CONTAINER_SECTION, i) + validationError(EOFErrorMessage.CONTAINER_SECTION, i) } } @@ -361,12 +386,12 @@ class EOFBody { // Edge case: deployment code validation if (eofMode !== EOFContainerMode.Initmode && !dataSectionAllowedSmaller) { - dataSection = stream.readBytes(header.dataSize, EOFError.DATA_SECTION) + dataSection = stream.readBytes(header.dataSize, EOFErrorMessage.DATA_SECTION) if (eofMode === EOFContainerMode.Default) { if (!stream.isAtEnd()) { // If there are dangling bytes in default container mode, this is invalid - validationError(EOFError.DANGLING_BYTES) + validationError(EOFErrorMessage.DANGLING_BYTES) } } else { // Tx init mode: the remaining bytes (if any) are used as CALLDATA in the EVM, in case of a Tx init @@ -376,7 +401,7 @@ class EOFBody { dataSection = stream.readRemainder() if (dataSection.length > header.dataSize) { - validationError(EOFError.DANGLING_BYTES) + validationError(EOFErrorMessage.DANGLING_BYTES) } } diff --git a/packages/evm/src/eof/errors.ts b/packages/evm/src/eof/errors.ts index 1ab73edb1f6..849d9ac55a9 100644 --- a/packages/evm/src/eof/errors.ts +++ b/packages/evm/src/eof/errors.ts @@ -1,8 +1,8 @@ import { EthereumJSErrorWithoutCode } from '@ethereumjs/util' -export type EOFError = (typeof EOFError)[keyof typeof EOFError] +export type EOFErrorMessage = (typeof EOFErrorMessage)[keyof typeof EOFErrorMessage] -export const EOFError = { +export const EOFErrorMessage = { OUT_OF_BOUNDS: 'Trying to read out of bounds', VERIFY_UINT: 'Uint does not match expected value ', VERIFY_BYTES: 'Bytes do not match expected value', @@ -32,7 +32,6 @@ export const EOFError = { MAX_STACK_HEIGHT: 'expected maxStackHeight', MAX_STACK_HEIGHT_LIMIT: 'stack height limit of 1024 exceeded: ', MIN_CODE_SECTIONS: 'should have at least 1 code section', - MAX_CODE_SECTIONS: 'can have at most 1024 code sections', CODE_SECTION: 'expected a code section', DATA_SECTION: 'Expected data section', CONTAINER_SECTION: 'expected a container section', @@ -66,172 +65,147 @@ export const EOFError = { RETURN_STACK_OVERFLOW: 'Return stack overflow', INVALID_EXTCALL_TARGET: 'invalid extcall target: address > 20 bytes', INVALID_RETURN_CONTRACT_DATA_SIZE: 'invalid RETURNCONTRACT: data size lower than expected', - INVALID_EOF_FORMAT: 'invalid EOF format', } as const -export type SimpleErrors = (typeof SimpleErrors)[keyof typeof SimpleErrors] - -export const SimpleErrors = { - MIN_CONTAINER_SIZE: 'err: container size less than minimum valid size', - INVALID_CONTAINER_SIZE: 'err: invalid container size', - TYPE_SIZE: 'err: type section size invalid', - CODE0_MSH: 'err: computed max stack height for code section 0 does not match expect', - UNDERFLOW: 'err: stack underflow', - CODE0_IO: 'err: input and output of first code section must be 0', - VERIFY_UINT: 'Uint does not match expected value ', - VERIFY_BYTES: 'Bytes do not match expected value', - INVALID_TYPE_SIZE: 'err: type section invalid', - CODE_SIZE: 'missing code size', - CODE_SECTION_SIZE: 'code section should be at least one byte', - INVALID_CODE_SIZE: 'code size does not match type size', - DATA_SIZE: 'missing data size', - TYPE_SECTIONS: 'need to have a type section for each code section', - INPUTS: 'expected inputs', - OUTPUTS: 'expected outputs', - MAX_INPUTS: 'inputs exceeds 127, the maximum, got: ', - MAX_OUTPUTS: 'outputs exceeds 127, the maximum, got: ', - CODE0_INPUTS: 'first code section should have 0 inputs', - CODE0_OUTPUTS: 'first code section should have 0 outputs', - MAX_STACK_HEIGHT: 'expected maxStackHeight', - MAX_STACK_HEIGHT_LIMIT: 'stack height limit of 1024 exceeded: ', - MIN_CODE_SECTIONS: 'should have at least 1 code section', - MAX_CODE_SECTIONS: 'can have at most 1024 code sections', - CODE_SECTION: 'expected a code section', - DATA_SECTION: 'Expected data section', - DANGLING_BYTES: 'got dangling bytes in body', -} as const - -export function validationErrorMsg(type: EOFError, ...args: any) { +export function validationErrorMsg(type: EOFErrorMessage, ...args: any) { switch (type) { - case EOFError.OUT_OF_BOUNDS: { - return EOFError.OUT_OF_BOUNDS + ` at pos: ${args[0]}: ${args[1]}` + case EOFErrorMessage.OUT_OF_BOUNDS: { + return EOFErrorMessage.OUT_OF_BOUNDS + ` at pos: ${args[0]}: ${args[1]}` } - case EOFError.VERIFY_BYTES: { - return EOFError.VERIFY_BYTES + ` at pos: ${args[0]}: ${args[1]}` + case EOFErrorMessage.VERIFY_BYTES: { + return EOFErrorMessage.VERIFY_BYTES + ` at pos: ${args[0]}: ${args[1]}` } - case EOFError.VERIFY_UINT: { - return EOFError.VERIFY_UINT + `at pos: ${args[0]}: ${args[1]}` + case EOFErrorMessage.VERIFY_UINT: { + return EOFErrorMessage.VERIFY_UINT + `at pos: ${args[0]}: ${args[1]}` } - case EOFError.TYPE_SIZE: { - return EOFError.TYPE_SIZE + args[0] + case EOFErrorMessage.TYPE_SIZE: { + return EOFErrorMessage.TYPE_SIZE + args[0] } - case EOFError.INVALID_TYPE_SIZE: { - return EOFError.INVALID_TYPE_SIZE + args[0] + case EOFErrorMessage.INVALID_TYPE_SIZE: { + return EOFErrorMessage.INVALID_TYPE_SIZE + args[0] } - case EOFError.INVALID_CODE_SIZE: { - return EOFError.INVALID_CODE_SIZE + args[0] + case EOFErrorMessage.INVALID_CODE_SIZE: { + return EOFErrorMessage.INVALID_CODE_SIZE + args[0] } - case EOFError.INPUTS: { - return `${EOFError.INPUTS} - typeSection ${args[0]}` + case EOFErrorMessage.INPUTS: { + return `${EOFErrorMessage.INPUTS} - typeSection ${args[0]}` } - case EOFError.OUTPUTS: { - return `${EOFError.OUTPUTS} - typeSection ${args[0]}` + case EOFErrorMessage.OUTPUTS: { + return `${EOFErrorMessage.OUTPUTS} - typeSection ${args[0]}` } - case EOFError.CODE0_INPUTS: { + case EOFErrorMessage.CODE0_INPUTS: { return `first code section should have 0 inputs` } - case EOFError.CODE0_OUTPUTS: { + case EOFErrorMessage.CODE0_OUTPUTS: { return `first code section should have 0 outputs` } - case EOFError.MAX_INPUTS: { - return EOFError.MAX_INPUTS + `${args[1]} - code section ${args[0]}` + case EOFErrorMessage.MAX_INPUTS: { + return EOFErrorMessage.MAX_INPUTS + `${args[1]} - code section ${args[0]}` } - case EOFError.MAX_OUTPUTS: { - return EOFError.MAX_OUTPUTS + `${args[1]} - code section ${args[0]}` + case EOFErrorMessage.MAX_OUTPUTS: { + return EOFErrorMessage.MAX_OUTPUTS + `${args[1]} - code section ${args[0]}` } - case EOFError.CODE_SECTION: { + case EOFErrorMessage.CODE_SECTION: { return `expected code: codeSection ${args[0]}: ` } - case EOFError.DATA_SECTION: { - return EOFError.DATA_SECTION + case EOFErrorMessage.DATA_SECTION: { + return EOFErrorMessage.DATA_SECTION } - case EOFError.MAX_STACK_HEIGHT: { - return `${EOFError.MAX_STACK_HEIGHT} - typeSection ${args[0]}: ` + case EOFErrorMessage.MAX_STACK_HEIGHT: { + return `${EOFErrorMessage.MAX_STACK_HEIGHT} - typeSection ${args[0]}: ` } - case EOFError.MAX_STACK_HEIGHT_LIMIT: { - return `${EOFError.MAX_STACK_HEIGHT_LIMIT}, got: ${args[1]} - typeSection ${args[0]}` + case EOFErrorMessage.MAX_STACK_HEIGHT_LIMIT: { + return `${EOFErrorMessage.MAX_STACK_HEIGHT_LIMIT}, got: ${args[1]} - typeSection ${args[0]}` } - case EOFError.DANGLING_BYTES: { - return EOFError.DANGLING_BYTES + case EOFErrorMessage.DANGLING_BYTES: { + return EOFErrorMessage.DANGLING_BYTES } default: { return type } } } -export function validationError(type: EOFError, ...args: any): never { +export function validationError(type: EOFErrorMessage, ...args: any): never { switch (type) { - case EOFError.OUT_OF_BOUNDS: { + case EOFErrorMessage.OUT_OF_BOUNDS: { const pos = args[0] if (pos === 0 || pos === 2 || pos === 3 || pos === 6) { throw EthereumJSErrorWithoutCode(args[1]) } - throw EthereumJSErrorWithoutCode(EOFError.OUT_OF_BOUNDS + ` `) + throw EthereumJSErrorWithoutCode(EOFErrorMessage.OUT_OF_BOUNDS + ` `) } - case EOFError.VERIFY_BYTES: { + case EOFErrorMessage.VERIFY_BYTES: { const pos = args[0] if (pos === 0 || pos === 2 || pos === 3 || pos === 6) { throw EthereumJSErrorWithoutCode(args[1]) } - throw EthereumJSErrorWithoutCode(EOFError.VERIFY_BYTES + ` at pos: ${args[0]}: ${args[1]}`) + throw EthereumJSErrorWithoutCode( + EOFErrorMessage.VERIFY_BYTES + ` at pos: ${args[0]}: ${args[1]}`, + ) } - case EOFError.VERIFY_UINT: { + case EOFErrorMessage.VERIFY_UINT: { const pos = args[0] if (pos === 0 || pos === 2 || pos === 3 || pos === 6 || pos === 18) { throw EthereumJSErrorWithoutCode(args[1]) } - throw EthereumJSErrorWithoutCode(EOFError.VERIFY_UINT + `at pos: ${args[0]}: ${args[1]}`) + throw EthereumJSErrorWithoutCode( + EOFErrorMessage.VERIFY_UINT + `at pos: ${args[0]}: ${args[1]}`, + ) } - case EOFError.TYPE_SIZE: { - throw EthereumJSErrorWithoutCode(EOFError.TYPE_SIZE + args[0]) + case EOFErrorMessage.TYPE_SIZE: { + throw EthereumJSErrorWithoutCode(EOFErrorMessage.TYPE_SIZE + args[0]) } - case EOFError.TYPE_SECTIONS: { + case EOFErrorMessage.TYPE_SECTIONS: { throw EthereumJSErrorWithoutCode( - `${EOFError.TYPE_SECTIONS} (types ${args[0]} code ${args[1]})`, + `${EOFErrorMessage.TYPE_SECTIONS} (types ${args[0]} code ${args[1]})`, ) } - case EOFError.INVALID_TYPE_SIZE: { - throw EthereumJSErrorWithoutCode(EOFError.INVALID_TYPE_SIZE) + case EOFErrorMessage.INVALID_TYPE_SIZE: { + throw EthereumJSErrorWithoutCode(EOFErrorMessage.INVALID_TYPE_SIZE) } - case EOFError.INVALID_CODE_SIZE: { - throw EthereumJSErrorWithoutCode(EOFError.INVALID_CODE_SIZE + args[0]) + case EOFErrorMessage.INVALID_CODE_SIZE: { + throw EthereumJSErrorWithoutCode(EOFErrorMessage.INVALID_CODE_SIZE + args[0]) } - case EOFError.INPUTS: { - throw EthereumJSErrorWithoutCode(`${EOFError.INPUTS} - typeSection ${args[0]}`) + case EOFErrorMessage.INPUTS: { + throw EthereumJSErrorWithoutCode(`${EOFErrorMessage.INPUTS} - typeSection ${args[0]}`) } - case EOFError.OUTPUTS: { - throw EthereumJSErrorWithoutCode(`${EOFError.OUTPUTS} - typeSection ${args[0]}`) + case EOFErrorMessage.OUTPUTS: { + throw EthereumJSErrorWithoutCode(`${EOFErrorMessage.OUTPUTS} - typeSection ${args[0]}`) } - case EOFError.CODE0_INPUTS: { + case EOFErrorMessage.CODE0_INPUTS: { throw EthereumJSErrorWithoutCode(`first code section should have 0 inputs`) } - case EOFError.CODE0_OUTPUTS: { + case EOFErrorMessage.CODE0_OUTPUTS: { throw EthereumJSErrorWithoutCode(`first code section should have 0 outputs`) } - case EOFError.MAX_INPUTS: { - throw EthereumJSErrorWithoutCode(EOFError.MAX_INPUTS + `${args[1]} - code section ${args[0]}`) + case EOFErrorMessage.MAX_INPUTS: { + throw EthereumJSErrorWithoutCode( + EOFErrorMessage.MAX_INPUTS + `${args[1]} - code section ${args[0]}`, + ) } - case EOFError.MAX_OUTPUTS: { + case EOFErrorMessage.MAX_OUTPUTS: { throw EthereumJSErrorWithoutCode( - EOFError.MAX_OUTPUTS + `${args[1]} - code section ${args[0]}`, + EOFErrorMessage.MAX_OUTPUTS + `${args[1]} - code section ${args[0]}`, ) } - case EOFError.CODE_SECTION: { + case EOFErrorMessage.CODE_SECTION: { throw EthereumJSErrorWithoutCode(`expected code: codeSection ${args[0]}: `) } - case EOFError.DATA_SECTION: { - throw EthereumJSErrorWithoutCode(EOFError.DATA_SECTION) + case EOFErrorMessage.DATA_SECTION: { + throw EthereumJSErrorWithoutCode(EOFErrorMessage.DATA_SECTION) } - case EOFError.MAX_STACK_HEIGHT: { - throw EthereumJSErrorWithoutCode(`${EOFError.MAX_STACK_HEIGHT} - typeSection ${args[0]}: `) + case EOFErrorMessage.MAX_STACK_HEIGHT: { + throw EthereumJSErrorWithoutCode( + `${EOFErrorMessage.MAX_STACK_HEIGHT} - typeSection ${args[0]}: `, + ) } - case EOFError.MAX_STACK_HEIGHT_LIMIT: { + case EOFErrorMessage.MAX_STACK_HEIGHT_LIMIT: { throw EthereumJSErrorWithoutCode( - `${EOFError.MAX_STACK_HEIGHT_LIMIT}, got: ${args[1]} - typeSection ${args[0]}`, + `${EOFErrorMessage.MAX_STACK_HEIGHT_LIMIT}, got: ${args[1]} - typeSection ${args[0]}`, ) } - case EOFError.DANGLING_BYTES: { - throw EthereumJSErrorWithoutCode(EOFError.DANGLING_BYTES) + case EOFErrorMessage.DANGLING_BYTES: { + throw EthereumJSErrorWithoutCode(EOFErrorMessage.DANGLING_BYTES) } default: { throw EthereumJSErrorWithoutCode(type) diff --git a/packages/evm/src/eof/verify.ts b/packages/evm/src/eof/verify.ts index b6b37642036..570483b849b 100644 --- a/packages/evm/src/eof/verify.ts +++ b/packages/evm/src/eof/verify.ts @@ -1,4 +1,4 @@ -import { EOFError, validationError } from './errors.ts' +import { EOFErrorMessage, validationError } from './errors.ts' import { stackDelta } from './stackDelta.ts' import type { EVM } from '../evm.ts' @@ -143,7 +143,7 @@ function validateOpcodes( function addJump(location: number) { if (intermediateBytes.has(location)) { // When trying to JUMP into an intermediate byte: this is invalid - validationError(EOFError.INVALID_RJUMP) + validationError(EOFErrorMessage.INVALID_RJUMP) } jumpLocations.add(location) } @@ -151,7 +151,7 @@ function validateOpcodes( function addIntermediate(location: number) { if (jumpLocations.has(location)) { // When trying to add an intermediate to a location already JUMPed to: this is invalid - validationError(EOFError.INVALID_RJUMP) + validationError(EOFErrorMessage.INVALID_RJUMP) } intermediateBytes.add(location) } @@ -194,12 +194,12 @@ function validateOpcodes( // ReachableOpcodes: this can likely be deleted after implementing the 5450 algorithm if (!reachableOpcodes.has(ptr)) { - validationError(EOFError.UNREACHABLE_CODE) + validationError(EOFErrorMessage.UNREACHABLE_CODE) } if (stackHeightMin[ptr] === undefined || stackHeightMax[ptr] === undefined) { // Code is either unreachable or only reachable via a backwards jump - validationError(EOFError.UNREACHABLE_CODE) + validationError(EOFErrorMessage.UNREACHABLE_CODE) } validJumps.add(ptr) @@ -212,7 +212,7 @@ function validateOpcodes( const opcodeOutputs = stackDelta[opcode].outputs if (minStackCurrent - opcodeInputs < 0) { - validationError(EOFError.STACK_UNDERFLOW) + validationError(EOFErrorMessage.STACK_UNDERFLOW) } const delta = opcodeOutputs - opcodeInputs @@ -222,23 +222,23 @@ function validateOpcodes( if (maxStackNext > 1024) { // TODO verify if 1023 or 1024 is the right constant - validationError(EOFError.STACK_OVERFLOW) + validationError(EOFErrorMessage.STACK_OVERFLOW) } if (nonReturningFunction && opcode === 0xe4) { - validationError(EOFError.INVALID_RETURNING_SECTION) + validationError(EOFErrorMessage.INVALID_RETURNING_SECTION) } lastOpcode = opcode if (!opcodeNumbers.has(opcode)) { - validationError(EOFError.INVALID_OPCODE) + validationError(EOFErrorMessage.INVALID_OPCODE) } if (opcode === 0xe0 || opcode === 0xe1) { // RJUMP / RJUMPI const target = readInt16(code, ptr + 1) + ptr + 3 if (target < 0 || target >= code.length) { - validationError(EOFError.INVALID_RJUMP) + validationError(EOFErrorMessage.INVALID_RJUMP) } successorSet.add(target) @@ -253,7 +253,7 @@ function validateOpcodes( if (!reachableOpcodes.has(ptr + 3) && ptr + 3 < code.length) { // Note: the final condition above ensures that the bytes after ptr are there // This is an edge case, if the container ends with RJUMP (which is valid) - validationError(EOFError.UNREACHABLE_CODE) + validationError(EOFErrorMessage.UNREACHABLE_CODE) } } } else if (opcode === 0xe2) { @@ -261,14 +261,14 @@ function validateOpcodes( const tableSize = code[ptr + 1] + 1 if (tableSize === undefined) { - validationError(EOFError.OPCODE_INTERMEDIATES_OOB) + validationError(EOFErrorMessage.OPCODE_INTERMEDIATES_OOB) } else if (tableSize === 0) { - validationError(EOFError.RJUMPV_TABLE_SIZE0) + validationError(EOFErrorMessage.RJUMPV_TABLE_SIZE0) } if (ptr + tableSize * 2 + 2 >= code.length) { // Fall-through case - validationError(EOFError.OPCODE_INTERMEDIATES_OOB) + validationError(EOFErrorMessage.OPCODE_INTERMEDIATES_OOB) } const newPc = ptr + 2 + tableSize * 2 @@ -280,7 +280,7 @@ function validateOpcodes( addIntermediate(newPtr + 1) const target = readInt16(code, newPtr) + newPc if (target < 0 || target >= code.length) { - validationError(EOFError.OPCODE_INTERMEDIATES_OOB) + validationError(EOFErrorMessage.OPCODE_INTERMEDIATES_OOB) } successorSet.add(target) @@ -298,7 +298,7 @@ function validateOpcodes( const target = readUint16(code, ptr + 1) reachableSections[codeSection].add(target) if (target >= container.header.codeSizes.length) { - validationError(EOFError.INVALID_CALL_TARGET) + validationError(EOFErrorMessage.INVALID_CALL_TARGET) } if (opcode === 0xe3) { // CALLF @@ -306,18 +306,18 @@ function validateOpcodes( const targetInputs = container.body.typeSections[target].inputs if (targetOutputs === 0x80) { // CALLF points to non-returning function which is not allowed - validationError(EOFError.INVALID_CALLF_RETURNING) + validationError(EOFErrorMessage.INVALID_CALLF_RETURNING) } if (minStackCurrent < targetInputs) { - validationError(EOFError.STACK_UNDERFLOW) + validationError(EOFErrorMessage.STACK_UNDERFLOW) } if ( maxStackCurrent + container.body.typeSections[target].maxStackHeight - targetInputs > 1024 ) { - validationError(EOFError.STACK_OVERFLOW) + validationError(EOFErrorMessage.STACK_OVERFLOW) } minStackNext += targetOutputs - targetInputs @@ -333,24 +333,24 @@ function validateOpcodes( // Spec rule: // JUMPF operand must point to a code section with equal or fewer number of outputs as // the section in which it resides, or to a section with 0x80 as outputs (non-returning) - validationError(EOFError.INVALID_JUMPF) + validationError(EOFErrorMessage.INVALID_JUMPF) } if (nonReturningFunction && targetOutputs <= 0x7f) { // Current function is returning, but target is not, cannot jump into this - validationError(EOFError.INVALID_RETURNING_SECTION) + validationError(EOFErrorMessage.INVALID_RETURNING_SECTION) } if (targetNonReturning) { // Target is returning if (minStackCurrent < targetInputs) { - validationError(EOFError.STACK_UNDERFLOW) + validationError(EOFErrorMessage.STACK_UNDERFLOW) } } else { // Target is returning const expectedStack = currentOutputs + targetInputs - targetOutputs if (!(minStackCurrent === maxStackCurrent && maxStackCurrent === expectedStack)) { - validationError(EOFError.INVALID_STACK_HEIGHT) + validationError(EOFErrorMessage.INVALID_STACK_HEIGHT) } sectionHasReturningOpcode = true } @@ -358,7 +358,7 @@ function validateOpcodes( maxStackCurrent + container.body.typeSections[target].maxStackHeight - targetInputs > 1024 ) { - validationError(EOFError.STACK_OVERFLOW) + validationError(EOFErrorMessage.STACK_OVERFLOW) } } } else if (opcode === 0xe4) { @@ -366,20 +366,20 @@ function validateOpcodes( // Stack height must match the outputs of current code section const outputs = container.body.typeSections[codeSection].outputs if (!(minStackCurrent === maxStackCurrent && maxStackCurrent === outputs)) { - validationError(EOFError.INVALID_STACK_HEIGHT) + validationError(EOFErrorMessage.INVALID_STACK_HEIGHT) } sectionHasReturningOpcode = true } else if (opcode === 0xe6) { // DUPN const toDup = code[ptr + 1] if (toDup + 1 > minStackCurrent) { - validationError(EOFError.STACK_UNDERFLOW) + validationError(EOFErrorMessage.STACK_UNDERFLOW) } } else if (opcode === 0xe7) { // SWAPN const toSwap = code[ptr + 1] if (toSwap + 2 > minStackCurrent) { - validationError(EOFError.STACK_UNDERFLOW) + validationError(EOFErrorMessage.STACK_UNDERFLOW) } } else if (opcode === 0xe8) { // EXCHANGE @@ -387,17 +387,17 @@ function validateOpcodes( const n = (exchangeRaw >> 4) + 1 const m = (exchangeRaw & 0x0f) + 1 if (n + m + 1 > minStackCurrent) { - validationError(EOFError.STACK_UNDERFLOW) + validationError(EOFErrorMessage.STACK_UNDERFLOW) } } else if (opcode === 0xec) { // EOFCREATE const target = code[ptr + 1] if (target >= container.header.containerSizes.length) { - validationError(EOFError.INVALID_EOF_CREATE_TARGET) + validationError(EOFErrorMessage.INVALID_EOF_CREATE_TARGET) } if (containerTypeMap.has(target)) { if (containerTypeMap.get(target) !== ContainerSectionType.InitCode) { - validationError(EOFError.CONTAINER_DOUBLE_TYPE) + validationError(EOFErrorMessage.CONTAINER_DOUBLE_TYPE) } } containerTypeMap.set(target, ContainerSectionType.InitCode) @@ -405,16 +405,16 @@ function validateOpcodes( // RETURNCONTRACT if (mode !== ContainerSectionType.InitCode) { - validationError(EOFError.CONTAINER_TYPE_ERROR) + validationError(EOFErrorMessage.CONTAINER_TYPE_ERROR) } const target = code[ptr + 1] if (target >= container.header.containerSizes.length) { - validationError(EOFError.INVALID_RETURN_CONTRACT_TARGET) + validationError(EOFErrorMessage.INVALID_RETURN_CONTRACT_TARGET) } if (containerTypeMap.has(target)) { if (containerTypeMap.get(target) !== ContainerSectionType.DeploymentCode) { - validationError(EOFError.CONTAINER_DOUBLE_TYPE) + validationError(EOFErrorMessage.CONTAINER_DOUBLE_TYPE) } } containerTypeMap.set(target, ContainerSectionType.DeploymentCode) @@ -423,13 +423,13 @@ function validateOpcodes( const dataTarget = readUint16(code, ptr + 1) const endOfSlice = dataTarget + 32 if (container.header.dataSize < endOfSlice) { - validationError(EOFError.DATALOADN_OOB) + validationError(EOFErrorMessage.DATALOADN_OOB) } } else if (opcode === 0x00 || opcode === 0xf3) { // STOP / RETURN if (mode === ContainerSectionType.InitCode) { - validationError(EOFError.CONTAINER_TYPE_ERROR) + validationError(EOFErrorMessage.CONTAINER_TYPE_ERROR) } } @@ -443,7 +443,7 @@ function validateOpcodes( ptr += intermediates // If the opcode has any intermediates, jump over it } if (ptr >= code.length) { - validationError(EOFError.OPCODE_INTERMEDIATES_OOB) + validationError(EOFErrorMessage.OPCODE_INTERMEDIATES_OOB) } ptr++ // Move to next opcode if (stackDelta[opcode].terminating === undefined) { @@ -467,7 +467,7 @@ function validateOpcodes( stackHeightMin[successor] !== minStackNext || stackHeightMax[successor] !== maxStackNext ) { - validationError(EOFError.UNSTABLE_STACK) + validationError(EOFErrorMessage.UNSTABLE_STACK) } } @@ -486,20 +486,20 @@ function validateOpcodes( // Validate that the final opcode terminates if (!terminatingOpcodes.has(lastOpcode)) { - validationError(EOFError.INVALID_TERMINATOR) + validationError(EOFErrorMessage.INVALID_TERMINATOR) } if (container.body.typeSections[codeSection].maxStackHeight !== maxStackHeight) { - validationError(EOFError.MAX_STACK_HEIGHT_VIOLATION) + validationError(EOFErrorMessage.MAX_STACK_HEIGHT_VIOLATION) } if (maxStackHeight > 1024) { // TODO verify if 1023 or 1024 is the right constant - validationError(EOFError.MAX_STACK_HEIGHT_LIMIT) + validationError(EOFErrorMessage.MAX_STACK_HEIGHT_LIMIT) } // Validate that if the section is returning, there is a returning opcode if (!sectionHasReturningOpcode && !nonReturningFunction) { - validationError(EOFError.RETURNING_NO_RETURN) + validationError(EOFErrorMessage.RETURNING_NO_RETURN) } } @@ -520,11 +520,11 @@ function validateOpcodes( } if (sectionAccumulator.size !== container.header.codeSizes.length) { - validationError(EOFError.UNREACHABLE_CODE_SECTIONS) + validationError(EOFErrorMessage.UNREACHABLE_CODE_SECTIONS) } if (containerTypeMap.size !== container.header.containerSizes.length) { - validationError(EOFError.UNREACHABLE_CONTAINER_SECTIONS) + validationError(EOFErrorMessage.UNREACHABLE_CONTAINER_SECTIONS) } return containerTypeMap diff --git a/packages/evm/src/errors.ts b/packages/evm/src/errors.ts index 14521f144c2..71c65022eda 100644 --- a/packages/evm/src/errors.ts +++ b/packages/evm/src/errors.ts @@ -1,6 +1,8 @@ -export type EVMErrorType = (typeof EVMErrorMessages)[keyof typeof EVMErrorMessages] +export type EVMErrorType = (typeof EVMErrorMessage)[keyof typeof EVMErrorMessage] -export const EVMErrorMessages = { +export const EVMErrorTypeString = 'EVMError' + +const EVMErrorMessage = { OUT_OF_GAS: 'out of gas', CODESTORE_OUT_OF_GAS: 'code store out of gas', CODESIZE_EXCEEDS_MAXIMUM: 'code size to deposit exceeds maximum code size', @@ -17,9 +19,6 @@ export const EVMErrorMessages = { REFUND_EXHAUSTED: 'refund exhausted', VALUE_OVERFLOW: 'value overflow', INSUFFICIENT_BALANCE: 'insufficient balance', - INVALID_BEGINSUB: 'invalid BEGINSUB', - INVALID_RETURNSUB: 'invalid RETURNSUB', - INVALID_JUMPSUB: 'invalid JUMPSUB', INVALID_BYTECODE_RESULT: 'invalid bytecode deployed', INITCODE_SIZE_VIOLATION: 'initcode exceeds max initcode size', INVALID_INPUT_LENGTH: 'invalid input length', @@ -37,9 +36,10 @@ export const EVMErrorMessages = { export class EVMError { error: EVMErrorType errorType: string + static errorMessages: Record = EVMErrorMessage constructor(error: EVMErrorType) { this.error = error - this.errorType = 'EVMError' + this.errorType = EVMErrorTypeString } } diff --git a/packages/evm/src/evm.ts b/packages/evm/src/evm.ts index d6298e998a7..7ea57352aa3 100644 --- a/packages/evm/src/evm.ts +++ b/packages/evm/src/evm.ts @@ -21,7 +21,7 @@ import { EventEmitter } from 'eventemitter3' import { FORMAT } from './eof/constants.ts' import { isEOF } from './eof/util.ts' -import { EVMError, EVMErrorMessages } from './errors.ts' +import { EVMError } from './errors.ts' import { Interpreter } from './interpreter.ts' import { Journal } from './journal.ts' import { EVMPerformanceLogger } from './logger.ts' @@ -64,7 +64,7 @@ export function OOGResult(gasLimit: bigint): ExecResult { return { returnValue: new Uint8Array(0), executionGasUsed: gasLimit, - exceptionError: new EVMError(EVMErrorMessages.OUT_OF_GAS), + exceptionError: new EVMError(EVMError.errorMessages.OUT_OF_GAS), } } // CodeDeposit OOG Result @@ -72,7 +72,7 @@ export function COOGResult(gasUsedCreateCode: bigint): ExecResult { return { returnValue: new Uint8Array(0), executionGasUsed: gasUsedCreateCode, - exceptionError: new EVMError(EVMErrorMessages.CODESTORE_OUT_OF_GAS), + exceptionError: new EVMError(EVMError.errorMessages.CODESTORE_OUT_OF_GAS), } } @@ -80,7 +80,7 @@ export function INVALID_BYTECODE_RESULT(gasLimit: bigint): ExecResult { return { returnValue: new Uint8Array(0), executionGasUsed: gasLimit, - exceptionError: new EVMError(EVMErrorMessages.INVALID_BYTECODE_RESULT), + exceptionError: new EVMError(EVMError.errorMessages.INVALID_BYTECODE_RESULT), } } @@ -88,7 +88,7 @@ export function INVALID_EOF_RESULT(gasLimit: bigint): ExecResult { return { returnValue: new Uint8Array(0), executionGasUsed: gasLimit, - exceptionError: new EVMError(EVMErrorMessages.INVALID_EOF_FORMAT), + exceptionError: new EVMError(EVMError.errorMessages.INVALID_EOF_FORMAT), } } @@ -96,11 +96,11 @@ export function CodesizeExceedsMaximumError(gasUsed: bigint): ExecResult { return { returnValue: new Uint8Array(0), executionGasUsed: gasUsed, - exceptionError: new EVMError(EVMErrorMessages.CODESIZE_EXCEEDS_MAXIMUM), + exceptionError: new EVMError(EVMError.errorMessages.CODESIZE_EXCEEDS_MAXIMUM), } } -export function EvmErrorResult(error: EVMError, gasUsed: bigint): ExecResult { +export function EVMErrorResult(error: EVMError, gasUsed: bigint): ExecResult { return { returnValue: new Uint8Array(0), executionGasUsed: gasUsed, @@ -508,7 +508,7 @@ export class EVM implements EVMInterface { createdAddress: message.to, execResult: { returnValue: new Uint8Array(0), - exceptionError: new EVMError(EVMErrorMessages.INITCODE_SIZE_VIOLATION), + exceptionError: new EVMError(EVMError.errorMessages.INITCODE_SIZE_VIOLATION), executionGasUsed: message.gasLimit, }, } @@ -567,7 +567,7 @@ export class EVM implements EVMInterface { createdAddress: message.to, execResult: { returnValue: new Uint8Array(0), - exceptionError: new EVMError(EVMErrorMessages.CREATE_COLLISION), + exceptionError: new EVMError(EVMError.errorMessages.CREATE_COLLISION), executionGasUsed: message.gasLimit, }, } @@ -871,8 +871,8 @@ export class EVM implements EVMInterface { let gasUsed = message.gasLimit - interpreterRes.runState!.gasLeft if (interpreterRes.exceptionError) { if ( - interpreterRes.exceptionError.error !== EVMErrorMessages.REVERT && - interpreterRes.exceptionError.error !== EVMErrorMessages.INVALID_EOF_FORMAT + interpreterRes.exceptionError.error !== EVMError.errorMessages.REVERT && + interpreterRes.exceptionError.error !== EVMError.errorMessages.INVALID_EOF_FORMAT ) { gasUsed = message.gasLimit } @@ -1019,7 +1019,7 @@ export class EVM implements EVMInterface { // There is one exception: if the CODESTORE_OUT_OF_GAS error is thrown // (this only happens the Frontier/Chainstart fork) // then the error is dismissed - if (err && err.error !== EVMErrorMessages.CODESTORE_OUT_OF_GAS) { + if (err && err.error !== EVMError.errorMessages.CODESTORE_OUT_OF_GAS) { result.execResult.selfdestruct = new Set() result.execResult.createdAddresses = new Set() result.execResult.gasRefund = BIGINT_0 @@ -1028,7 +1028,7 @@ export class EVM implements EVMInterface { err && !( this.common.hardfork() === Hardfork.Chainstart && - err.error === EVMErrorMessages.CODESTORE_OUT_OF_GAS + err.error === EVMError.errorMessages.CODESTORE_OUT_OF_GAS ) ) { result.execResult.logs = [] @@ -1159,7 +1159,7 @@ export class EVM implements EVMInterface { protected async _reduceSenderBalance(account: Account, message: Message): Promise { account.balance -= message.value if (account.balance < BIGINT_0) { - throw new EVMError(EVMErrorMessages.INSUFFICIENT_BALANCE) + throw new EVMError(EVMError.errorMessages.INSUFFICIENT_BALANCE) } const result = this.journal.putAccount(message.caller, account) if (this.DEBUG) { @@ -1171,7 +1171,7 @@ export class EVM implements EVMInterface { protected async _addToBalance(toAccount: Account, message: MessageWithTo): Promise { const newBalance = toAccount.balance + message.value if (newBalance > MAX_INTEGER) { - throw new EVMError(EVMErrorMessages.VALUE_OVERFLOW) + throw new EVMError(EVMError.errorMessages.VALUE_OVERFLOW) } toAccount.balance = newBalance // putAccount as the nonce may have changed for contract creation diff --git a/packages/evm/src/index.ts b/packages/evm/src/index.ts index b12391fa890..df97e14cdc1 100644 --- a/packages/evm/src/index.ts +++ b/packages/evm/src/index.ts @@ -1,5 +1,5 @@ import { EOFContainer, validateEOF } from './eof/container.ts' -import { EVMError, EVMErrorMessages } from './errors.ts' +import { EVMError } from './errors.ts' import { EVM } from './evm.ts' import { Message } from './message.ts' import { getOpcodesForHF } from './opcodes/index.ts' @@ -47,7 +47,6 @@ export { EOFContainer, EVM, EVMError, - EVMErrorMessages, EVMMockBlockchain, getActivePrecompiles, getOpcodesForHF, diff --git a/packages/evm/src/interpreter.ts b/packages/evm/src/interpreter.ts index 75d4df4d7c9..a56ad9d09d8 100644 --- a/packages/evm/src/interpreter.ts +++ b/packages/evm/src/interpreter.ts @@ -18,7 +18,7 @@ import { FORMAT, MAGIC, VERSION } from './eof/constants.ts' import { EOFContainerMode, validateEOF } from './eof/container.ts' import { setupEOF } from './eof/setup.ts' import { ContainerSectionType } from './eof/verify.ts' -import { EVMError, EVMErrorMessages } from './errors.ts' +import { EVMError, EVMErrorTypeString } from './errors.ts' import { type EVMPerformanceLogger, type Timer } from './logger.ts' import { Memory } from './memory.ts' import { Message } from './message.ts' @@ -32,6 +32,7 @@ import type { VerkleAccessWitnessInterface, } from '@ethereumjs/common' import type { Address, PrefixedHexString } from '@ethereumjs/util' +import { stackDelta } from './eof/stackDelta.ts' import type { EVM } from './evm.ts' import type { Journal } from './journal.ts' import type { AsyncOpHandler, Opcode, OpcodeMapEntry } from './opcodes/index.ts' @@ -127,12 +128,18 @@ export interface InterpreterStep { fee: number dynamicFee?: bigint isAsync: boolean + code: number // The hexadecimal representation of the opcode (e.g. 0x60 for PUSH1) } account: Account address: Address memory: Uint8Array memoryWordCount: bigint codeAddress: Address + eofSection?: number // Current EOF section being executed + immediate?: Uint8Array // Immediate argument of the opcode + eofFunctionDepth?: number // Depth of CALLF return stack + error?: Uint8Array // Error bytes returned if revert occurs + storage?: [PrefixedHexString, PrefixedHexString][] } /** @@ -219,14 +226,14 @@ export class Interpreter { // Bytecode contains invalid EOF magic byte return { runState: this._runState, - exceptionError: new EVMError(EVMErrorMessages.INVALID_BYTECODE_RESULT), + exceptionError: new EVMError(EVMError.errorMessages.INVALID_BYTECODE_RESULT), } } if (code[2] !== VERSION) { // Bytecode contains invalid EOF version number return { runState: this._runState, - exceptionError: new EVMError(EVMErrorMessages.INVALID_EOF_FORMAT), + exceptionError: new EVMError(EVMError.errorMessages.INVALID_EOF_FORMAT), } } this._runState.code = code @@ -239,7 +246,7 @@ export class Interpreter { } catch { return { runState: this._runState, - exceptionError: new EVMError(EVMErrorMessages.INVALID_EOF_FORMAT), // TODO: verify if all gas should be consumed + exceptionError: new EVMError(EVMError.errorMessages.INVALID_EOF_FORMAT), // TODO: verify if all gas should be consumed } } @@ -256,7 +263,7 @@ export class Interpreter { // Trying to deploy an invalid EOF container return { runState: this._runState, - exceptionError: new EVMError(EVMErrorMessages.INVALID_EOF_FORMAT), // TODO: verify if all gas should be consumed + exceptionError: new EVMError(EVMError.errorMessages.INVALID_EOF_FORMAT), // TODO: verify if all gas should be consumed } } } @@ -283,7 +290,7 @@ export class Interpreter { while (this._runState.programCounter < this._runState.code.length) { const programCounter = this._runState.programCounter let opCode: number - let opCodeObj: OpcodeMapEntry + let opCodeObj: OpcodeMapEntry | undefined if (doJumpAnalysis) { opCode = this._runState.code[programCounter] // Only run the jump destination analysis if `code` actually contains a JUMP/JUMPI/JUMPSUB opcode @@ -319,13 +326,13 @@ export class Interpreter { } } - this._runState.opCode = opCode! + this._runState.opCode = opCode try { if (overheadTimer !== undefined) { this.performanceLogger.pauseTimer() } - await this.runStep(opCodeObj!) + await this.runStep(opCodeObj) if (overheadTimer !== undefined) { this.performanceLogger.unpauseTimer(overheadTimer) } @@ -336,11 +343,11 @@ export class Interpreter { this.performanceLogger.unpauseTimer(overheadTimer) } // re-throw on non-VM errors - if (!('errorType' in e && e.errorType === 'EVMError')) { + if (!('errorType' in e && e.errorType === EVMErrorTypeString)) { throw e } // STOP is not an exception - if (e.error !== EVMErrorMessages.STOP) { + if (e.error !== EVMError.errorMessages.STOP) { err = e } break @@ -374,6 +381,9 @@ export class Interpreter { let gas = opInfo.feeBigInt + // Cache pre-gas memory size if doing tracing (EIP-7756) + const memorySizeCache = this._runState.memoryWordCount + try { if (opInfo.dynamicGas) { // This function updates the gas in-place. @@ -384,7 +394,7 @@ export class Interpreter { if (this._evm.events.listenerCount('step') > 0 || this._evm.DEBUG) { // Only run this stepHook function if there is an event listener (e.g. test runner) // or if the vm is running in debug mode (to display opcode debug logs) - await this._runStepHook(gas, this.getGasLeft()) + await this._runStepHook(gas, this.getGasLeft(), memorySizeCache) } if ( @@ -403,7 +413,7 @@ export class Interpreter { // Check for invalid opcode if (opInfo.isInvalid) { - throw new EVMError(EVMErrorMessages.INVALID_OPCODE) + throw new EVMError(EVMError.errorMessages.INVALID_OPCODE) } // Reduce opcode's base fee @@ -441,27 +451,58 @@ export class Interpreter { return this._evm['_opcodeMap'][op] } - async _runStepHook(dynamicFee: bigint, gasLeft: bigint): Promise { - const opcodeInfo = this.lookupOpInfo(this._runState.opCode) - const opcode = opcodeInfo.opcodeInfo + async _runStepHook(dynamicFee: bigint, gasLeft: bigint, memorySize: bigint): Promise { + const opcodeInfo = this.lookupOpInfo(this._runState.opCode).opcodeInfo + const section = this._env.eof?.container.header.getSectionFromProgramCounter( + this._runState.programCounter, + ) + let error = undefined + let immediate = undefined + if (opcodeInfo.code === 0xfd) { + // If opcode is REVERT, read error data and return in trace + const [offset, length] = this._runState.stack.peek(2) + error = new Uint8Array(0) + if (length !== BIGINT_0) { + error = this._runState.memory.read(Number(offset), Number(length)) + } + } + + // Add immediate if present (i.e. bytecode parameter for a preceding opcode like (RJUMP 01 - jumps to PC 1)) + if ( + stackDelta[opcodeInfo.code] !== undefined && + stackDelta[opcodeInfo.code].intermediates > 0 + ) { + immediate = this._runState.code.slice( + this._runState.programCounter + 1, // immediates start "immediately" following current opcode + this._runState.programCounter + 1 + stackDelta[opcodeInfo.code].intermediates, + ) + } + + // Create event object for step const eventObj: InterpreterStep = { pc: this._runState.programCounter, gasLeft, gasRefund: this._runState.gasRefund, opcode: { - name: opcode.fullName, - fee: opcode.fee, + name: opcodeInfo.fullName, + fee: opcodeInfo.fee, dynamicFee, - isAsync: opcode.isAsync, + isAsync: opcodeInfo.isAsync, + code: opcodeInfo.code, }, stack: this._runState.stack.getStack(), depth: this._env.depth, address: this._env.address, account: this._env.contract, - memory: this._runState.memory._store.subarray(0, Number(this._runState.memoryWordCount) * 32), - memoryWordCount: this._runState.memoryWordCount, + memory: this._runState.memory._store.subarray(0, Number(memorySize) * 32), + memoryWordCount: memorySize, codeAddress: this._env.codeAddress, stateManager: this._runState.stateManager, + eofSection: section, + immediate, + error, + eofFunctionDepth: + this._env.eof !== undefined ? this._env.eof?.eofRunState.returnStack.length + 1 : undefined, } if (this._evm.DEBUG) { @@ -499,6 +540,7 @@ export class Interpreter { * @property {fee} opcode.number Base fee of the opcode * @property {dynamicFee} opcode.dynamicFee Dynamic opcode fee * @property {boolean} opcode.isAsync opcode is async + * @property {number} opcode.code opcode code * @property {BigInt} gasLeft amount of gasLeft * @property {BigInt} gasRefund gas refund * @property {StateManager} stateManager a {@link StateManager} instance @@ -510,6 +552,11 @@ export class Interpreter { * @property {Uint8Array} memory the memory of the EVM as a `Uint8Array` * @property {BigInt} memoryWordCount current size of memory in words * @property {Address} codeAddress the address of the code which is currently being ran (this differs from `address` in a `DELEGATECALL` and `CALLCODE` call) + * @property {number} eofSection the current EOF code section referenced by the PC + * @property {Uint8Array} immediate the immediate argument of the opcode + * @property {Uint8Array} error the error data of the opcode (only present for REVERT) + * @property {number} eofFunctionDepth the depth of the function call (only present for EOF) + * @property {Array} storage an array of tuples, where each tuple contains a storage key and value */ await this._evm['_emit']('step', eventObj) } @@ -563,7 +610,7 @@ export class Interpreter { } if (this._runState.gasLeft < BIGINT_0) { this._runState.gasLeft = BIGINT_0 - trap(EVMErrorMessages.OUT_OF_GAS) + trap(EVMError.errorMessages.OUT_OF_GAS) } } @@ -599,7 +646,7 @@ export class Interpreter { this._runState.gasRefund -= amount if (this._runState.gasRefund < BIGINT_0) { this._runState.gasRefund = BIGINT_0 - trap(EVMErrorMessages.REFUND_EXHAUSTED) + trap(EVMError.errorMessages.REFUND_EXHAUSTED) } } @@ -681,7 +728,7 @@ export class Interpreter { */ finish(returnData: Uint8Array): void { this._result.returnValue = returnData - trap(EVMErrorMessages.STOP) + trap(EVMError.errorMessages.STOP) } /** @@ -691,7 +738,7 @@ export class Interpreter { */ revert(returnData: Uint8Array): void { this._result.returnValue = returnData - trap(EVMErrorMessages.REVERT) + trap(EVMError.errorMessages.REVERT) } /** @@ -1016,7 +1063,7 @@ export class Interpreter { if ( results.execResult.returnValue !== undefined && (!results.execResult.exceptionError || - results.execResult.exceptionError.error === EVMErrorMessages.REVERT) + results.execResult.exceptionError.error === EVMError.errorMessages.REVERT) ) { this._runState.returnBytes = results.execResult.returnValue } @@ -1117,14 +1164,14 @@ export class Interpreter { // Set return buffer in case revert happened if ( results.execResult.exceptionError && - results.execResult.exceptionError.error === EVMErrorMessages.REVERT + results.execResult.exceptionError.error === EVMError.errorMessages.REVERT ) { this._runState.returnBytes = results.execResult.returnValue } if ( !results.execResult.exceptionError || - results.execResult.exceptionError.error === EVMErrorMessages.CODESTORE_OUT_OF_GAS + results.execResult.exceptionError.error === EVMError.errorMessages.CODESTORE_OUT_OF_GAS ) { for (const addressToSelfdestructHex of selfdestruct) { this._result.selfdestruct.add(addressToSelfdestructHex) @@ -1230,7 +1277,7 @@ export class Interpreter { }) } - trap(EVMErrorMessages.STOP) + trap(EVMError.errorMessages.STOP) } /** @@ -1238,11 +1285,11 @@ export class Interpreter { */ log(data: Uint8Array, numberOfTopics: number, topics: Uint8Array[]): void { if (numberOfTopics < 0 || numberOfTopics > 4) { - trap(EVMErrorMessages.OUT_OF_RANGE) + trap(EVMError.errorMessages.OUT_OF_RANGE) } if (topics.length !== numberOfTopics) { - trap(EVMErrorMessages.INTERNAL_ERROR) + trap(EVMError.errorMessages.INTERNAL_ERROR) } const log: Log = [this._env.address.bytes, topics, data] @@ -1259,7 +1306,7 @@ export class Interpreter { } else { // EOF mode, call was either EXTCALL / EXTDELEGATECALL / EXTSTATICCALL if (results.execResult.exceptionError !== undefined) { - if (results.execResult.exceptionError.error === EVMErrorMessages.REVERT) { + if (results.execResult.exceptionError.error === EVMError.errorMessages.REVERT) { // Revert return BIGINT_1 } else { diff --git a/packages/evm/src/opcodes/EIP2200.ts b/packages/evm/src/opcodes/EIP2200.ts index 9c6cbccfff7..6ac2436f069 100644 --- a/packages/evm/src/opcodes/EIP2200.ts +++ b/packages/evm/src/opcodes/EIP2200.ts @@ -1,6 +1,6 @@ import { equalsBytes } from '@ethereumjs/util' -import { EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import { adjustSstoreGasEIP2929 } from './EIP2929.ts' import { trap } from './util.ts' @@ -27,7 +27,7 @@ export function updateSstoreGasEIP2200( ) { // Fail if not enough gas is left if (runState.interpreter.getGasLeft() <= common.param('sstoreSentryEIP2200Gas')) { - trap(EVMErrorMessages.OUT_OF_GAS) + trap(EVMError.errorMessages.OUT_OF_GAS) } // Noop diff --git a/packages/evm/src/opcodes/functions.ts b/packages/evm/src/opcodes/functions.ts index e726c32b394..e686fbd2faa 100644 --- a/packages/evm/src/opcodes/functions.ts +++ b/packages/evm/src/opcodes/functions.ts @@ -29,9 +29,9 @@ import { import { keccak256 } from 'ethereum-cryptography/keccak.js' import { EOFContainer, EOFContainerMode } from '../eof/container.ts' -import { EOFError } from '../eof/errors.ts' +import { EOFErrorMessage } from '../eof/errors.ts' import { EOFBYTES, EOFHASH, isEOF } from '../eof/util.ts' -import { EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import { createAddressFromStackBigInt, @@ -65,7 +65,7 @@ export const handlers: Map = new Map([ [ 0x00, function () { - trap(EVMErrorMessages.STOP) + trap(EVMError.errorMessages.STOP) }, ], // 0x01: ADD @@ -810,13 +810,13 @@ export const handlers: Map = new Map([ function (runState) { const dest = runState.stack.pop() if (dest > runState.interpreter.getCodeSize()) { - trap(EVMErrorMessages.INVALID_JUMP + ' at ' + describeLocation(runState)) + trap(EVMError.errorMessages.INVALID_JUMP + ' at ' + describeLocation(runState)) } const destNum = Number(dest) if (!jumpIsValid(runState, destNum)) { - trap(EVMErrorMessages.INVALID_JUMP + ' at ' + describeLocation(runState)) + trap(EVMError.errorMessages.INVALID_JUMP + ' at ' + describeLocation(runState)) } runState.programCounter = destNum @@ -829,13 +829,13 @@ export const handlers: Map = new Map([ const [dest, cond] = runState.stack.popN(2) if (cond !== BIGINT_0) { if (dest > runState.interpreter.getCodeSize()) { - trap(EVMErrorMessages.INVALID_JUMP + ' at ' + describeLocation(runState)) + trap(EVMError.errorMessages.INVALID_JUMP + ' at ' + describeLocation(runState)) } const destNum = Number(dest) if (!jumpIsValid(runState, destNum)) { - trap(EVMErrorMessages.INVALID_JUMP + ' at ' + describeLocation(runState)) + trap(EVMError.errorMessages.INVALID_JUMP + ' at ' + describeLocation(runState)) } runState.programCounter = destNum @@ -882,7 +882,7 @@ export const handlers: Map = new Map([ function (runState) { // TSTORE if (runState.interpreter.isStatic()) { - trap(EVMErrorMessages.STATIC_STATE_CHANGE) + trap(EVMError.errorMessages.STATIC_STATE_CHANGE) } const [key, val] = runState.stack.popN(2) @@ -995,7 +995,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const pos = runState.stack.pop() if (pos > runState.env.eof!.container.body.dataSection.length) { @@ -1020,7 +1020,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const toLoad = Number( bytesToBigInt(runState.code.subarray(runState.programCounter, runState.programCounter + 2)), @@ -1038,7 +1038,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } runState.stack.push(BigInt(runState.env.eof!.container.body.dataSection.length)) }, @@ -1049,7 +1049,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const [memOffset, offset, size] = runState.stack.popN(3) if (size !== BIGINT_0) { @@ -1066,7 +1066,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } else { const code = runState.env.code const rjumpDest = new DataView(code.buffer).getInt16(runState.programCounter) @@ -1080,7 +1080,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } else { const cond = runState.stack.pop() // Move PC to the PC post instruction @@ -1100,7 +1100,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } else { const code = runState.env.code const jumptableEntries = code[runState.programCounter] @@ -1127,7 +1127,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const sectionTarget = bytesToInt( runState.code.slice(runState.programCounter, runState.programCounter + 2), @@ -1135,10 +1135,10 @@ export const handlers: Map = new Map([ const stackItems = runState.stack.length const typeSection = runState.env.eof!.container.body.typeSections[sectionTarget] if (stackItems > 1024 - typeSection.maxStackHeight + typeSection.inputs) { - trap(EOFError.STACK_OVERFLOW) + trap(EOFErrorMessage.STACK_OVERFLOW) } if (runState.env.eof!.eofRunState.returnStack.length >= 1024) { - trap(EOFError.RETURN_STACK_OVERFLOW) + trap(EOFErrorMessage.RETURN_STACK_OVERFLOW) } runState.env.eof?.eofRunState.returnStack.push(runState.programCounter + 2) @@ -1152,12 +1152,12 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const newPc = runState.env.eof!.eofRunState.returnStack.pop() if (newPc === undefined) { // This should NEVER happen since it is validated that functions either terminate (the call frame) or return - trap(EOFError.RETF_NO_RETURN) + trap(EOFErrorMessage.RETF_NO_RETURN) } runState.programCounter = newPc! }, @@ -1168,7 +1168,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } // NOTE: (and also TODO) this code is exactly the same as CALLF, except pushing to the return stack is now skipped // (and also the return stack overflow check) @@ -1179,10 +1179,10 @@ export const handlers: Map = new Map([ const stackItems = runState.stack.length const typeSection = runState.env.eof!.container.body.typeSections[sectionTarget] if (stackItems > 1024 - typeSection.maxStackHeight + typeSection.inputs) { - trap(EOFError.STACK_OVERFLOW) + trap(EOFErrorMessage.STACK_OVERFLOW) } /*if (runState.env.eof!.eofRunState.returnStack.length >= 1024) { - trap(EOFError.ReturnStackOverflow) + trap(EOFErrorMessage.ReturnStackOverflow) } runState.env.eof?.eofRunState.returnStack.push(runState.programCounter + 2)*/ @@ -1196,7 +1196,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const toDup = Number( @@ -1214,7 +1214,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const toSwap = Number( @@ -1232,7 +1232,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const toExchange = Number( bytesToBigInt(runState.code.subarray(runState.programCounter, runState.programCounter + 1)), @@ -1249,10 +1249,10 @@ export const handlers: Map = new Map([ async function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } else { if (runState.interpreter.isStatic()) { - trap(EVMErrorMessages.STATIC_STATE_CHANGE) + trap(EVMError.errorMessages.STATIC_STATE_CHANGE) } // Read container index const containerIndex = runState.env.code[runState.programCounter] @@ -1288,7 +1288,7 @@ export const handlers: Map = new Map([ async function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } else { // Read container index const containerIndex = runState.env.code[runState.programCounter] @@ -1310,13 +1310,13 @@ export const handlers: Map = new Map([ const actualSectionSize = preDeployDataSectionSize + Number(auxDataSize) if (actualSectionSize < originalDataSize) { - trap(EOFError.INVALID_RETURN_CONTRACT_DATA_SIZE) + trap(EOFErrorMessage.INVALID_RETURN_CONTRACT_DATA_SIZE) } if (actualSectionSize > 0xffff) { // Data section size is now larger than the max data section size // Temp: trap OOG? - trap(EVMErrorMessages.OUT_OF_GAS) + trap(EVMError.errorMessages.OUT_OF_GAS) } const newSize = setLengthLeft(bigIntToBytes(BigInt(actualSectionSize)), 2) @@ -1344,7 +1344,7 @@ export const handlers: Map = new Map([ length > Number(common.param('maxInitCodeSize')) && !runState.interpreter._evm.allowUnlimitedInitCodeSize ) { - trap(EVMErrorMessages.INITCODE_SIZE_VIOLATION) + trap(EVMError.errorMessages.INITCODE_SIZE_VIOLATION) } const gasLimit = runState.messageGasLimit! @@ -1370,7 +1370,7 @@ export const handlers: Map = new Map([ 0xf5, async function (runState, common) { if (runState.interpreter.isStatic()) { - trap(EVMErrorMessages.STATIC_STATE_CHANGE) + trap(EVMError.errorMessages.STATIC_STATE_CHANGE) } const [value, offset, length, salt] = runState.stack.popN(4) @@ -1380,7 +1380,7 @@ export const handlers: Map = new Map([ length > Number(common.param('maxInitCodeSize')) && !runState.interpreter._evm.allowUnlimitedInitCodeSize ) { - trap(EVMErrorMessages.INITCODE_SIZE_VIOLATION) + trap(EVMError.errorMessages.INITCODE_SIZE_VIOLATION) } const gasLimit = runState.messageGasLimit! @@ -1491,7 +1491,7 @@ export const handlers: Map = new Map([ function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } const pos = runState.stack.pop() if (pos > runState.interpreter.getReturnDataSize()) { @@ -1515,7 +1515,7 @@ export const handlers: Map = new Map([ async function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } else { const [toAddr, inOffset, inLength, value] = runState.stack.popN(4) @@ -1549,7 +1549,7 @@ export const handlers: Map = new Map([ async function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } else { const value = runState.interpreter.getCallValue() const [toAddr, inOffset, inLength] = runState.stack.popN(3) @@ -1614,7 +1614,7 @@ export const handlers: Map = new Map([ async function (runState) { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } else { const value = BIGINT_0 const [toAddr, inOffset, inLength] = runState.stack.popN(3) diff --git a/packages/evm/src/opcodes/gas.ts b/packages/evm/src/opcodes/gas.ts index 31ba27ab896..7d3660b0374 100644 --- a/packages/evm/src/opcodes/gas.ts +++ b/packages/evm/src/opcodes/gas.ts @@ -11,8 +11,8 @@ import { setLengthLeft, } from '@ethereumjs/util' -import { EOFError } from '../eof/errors.ts' -import { EVMErrorMessages } from '../errors.ts' +import { EOFErrorMessage } from '../eof/errors.ts' +import { EVMError } from '../errors.ts' import { DELEGATION_7702_FLAG } from '../types.ts' import { updateSstoreGasEIP1283 } from './EIP1283.ts' @@ -79,7 +79,7 @@ export const dynamicGasHandlers: Map 32) { - trap(EVMErrorMessages.OUT_OF_RANGE) + trap(EVMError.errorMessages.OUT_OF_RANGE) } const expPricePerByte = common.param('expByteGas') gas += BigInt(byteLength) * expPricePerByte @@ -244,7 +244,7 @@ export const dynamicGasHandlers: Map { if (runState.interpreter.isStatic()) { - trap(EVMErrorMessages.STATIC_STATE_CHANGE) + trap(EVMError.errorMessages.STATIC_STATE_CHANGE) } const [key, val] = runState.stack.peek(2) @@ -415,7 +415,7 @@ export const dynamicGasHandlers: Map { if (runState.interpreter.isStatic()) { - trap(EVMErrorMessages.STATIC_STATE_CHANGE) + trap(EVMError.errorMessages.STATIC_STATE_CHANGE) } const [memOffset, memLength] = runState.stack.peek(2) @@ -423,7 +423,7 @@ export const dynamicGasHandlers: Map 4) { - trap(EVMErrorMessages.OUT_OF_RANGE) + trap(EVMError.errorMessages.OUT_OF_RANGE) } gas += subMemUsage(runState, memOffset, memLength, common) @@ -438,7 +438,7 @@ export const dynamicGasHandlers: Map { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } // Note: TX_CREATE_COST is in the base fee (this is 32000 and same as CREATE / CREATE2) @@ -514,7 +514,7 @@ export const dynamicGasHandlers: Map { if (runState.interpreter.isStatic()) { - trap(EVMErrorMessages.STATIC_STATE_CHANGE) + trap(EVMError.errorMessages.STATIC_STATE_CHANGE) } const [_value, offset, length] = runState.stack.peek(3) @@ -549,7 +549,7 @@ export const dynamicGasHandlers: Map runState.interpreter.getGasLeft() - gas) { - trap(EVMErrorMessages.OUT_OF_GAS) + trap(EVMError.errorMessages.OUT_OF_GAS) } if (gas > runState.interpreter.getGasLeft()) { - trap(EVMErrorMessages.OUT_OF_GAS) + trap(EVMError.errorMessages.OUT_OF_GAS) } runState.messageGasLimit = gasLimit @@ -669,7 +669,7 @@ export const dynamicGasHandlers: Map runState.interpreter.getGasLeft() - gas) { - trap(EVMErrorMessages.OUT_OF_GAS) + trap(EVMError.errorMessages.OUT_OF_GAS) } runState.messageGasLimit = gasLimit @@ -729,7 +729,7 @@ export const dynamicGasHandlers: Map runState.interpreter.getGasLeft() - gas) { - trap(EVMErrorMessages.OUT_OF_GAS) + trap(EVMError.errorMessages.OUT_OF_GAS) } runState.messageGasLimit = gasLimit @@ -741,7 +741,7 @@ export const dynamicGasHandlers: Map { if (runState.interpreter.isStatic()) { - trap(EVMErrorMessages.STATIC_STATE_CHANGE) + trap(EVMError.errorMessages.STATIC_STATE_CHANGE) } const [_value, offset, length, _salt] = runState.stack.peek(4) @@ -774,7 +774,7 @@ export const dynamicGasHandlers: Map { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } // Charge WARM_STORAGE_READ_COST (100) -> done in accessAddressEIP2929 @@ -783,7 +783,7 @@ export const dynamicGasHandlers: Map 0, charge CALL_VALUE_COST @@ -793,7 +793,7 @@ export const dynamicGasHandlers: Map 20 bytes if (toAddr > EXTCALL_TARGET_MAX) { - trap(EOFError.INVALID_EXTCALL_TARGET) + trap(EOFErrorMessage.INVALID_EXTCALL_TARGET) } // Charge for memory expansion @@ -851,7 +851,7 @@ export const dynamicGasHandlers: Map { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } // Charge WARM_STORAGE_READ_COST (100) -> done in accessAddressEIP2929 @@ -860,7 +860,7 @@ export const dynamicGasHandlers: Map 20 bytes if (toAddr > EXTCALL_TARGET_MAX) { - trap(EOFError.INVALID_EXTCALL_TARGET) + trap(EOFErrorMessage.INVALID_EXTCALL_TARGET) } // Charge for memory expansion @@ -955,7 +955,7 @@ export const dynamicGasHandlers: Map { if (runState.env.eof === undefined) { // Opcode not available in legacy contracts - trap(EVMErrorMessages.INVALID_OPCODE) + trap(EVMError.errorMessages.INVALID_OPCODE) } // Charge WARM_STORAGE_READ_COST (100) -> done in accessAddressEIP2929 @@ -964,7 +964,7 @@ export const dynamicGasHandlers: Map 20 bytes if (toAddr > EXTCALL_TARGET_MAX) { - trap(EOFError.INVALID_EXTCALL_TARGET) + trap(EOFErrorMessage.INVALID_EXTCALL_TARGET) } // Charge for memory expansion @@ -1016,7 +1016,7 @@ export const dynamicGasHandlers: Map { if (runState.interpreter.isStatic()) { - trap(EVMErrorMessages.STATIC_STATE_CHANGE) + trap(EVMError.errorMessages.STATIC_STATE_CHANGE) } const selfdestructToaddressBigInt = runState.stack.peek()[0] diff --git a/packages/evm/src/opcodes/util.ts b/packages/evm/src/opcodes/util.ts index b118528f42d..5b4af7775dd 100644 --- a/packages/evm/src/opcodes/util.ts +++ b/packages/evm/src/opcodes/util.ts @@ -85,7 +85,7 @@ export function setLengthLeftStorage(value: Uint8Array) { } /** - * Wraps error message as EvmError + * Wraps error message as EVMError */ export function trap(err: string) { // TODO: facilitate extra data along with errors diff --git a/packages/evm/src/precompiles/06-bn254-add.ts b/packages/evm/src/precompiles/06-bn254-add.ts index f4006ddf1e6..8892cfee681 100644 --- a/packages/evm/src/precompiles/06-bn254-add.ts +++ b/packages/evm/src/precompiles/06-bn254-add.ts @@ -1,6 +1,6 @@ import { bytesToHex, setLengthRight } from '@ethereumjs/util' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { getPrecompileName } from './index.ts' import { gasLimitCheck } from './util.ts' @@ -27,7 +27,7 @@ export function precompile06(opts: PrecompileInput): ExecResult { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } // check ecadd success or failure by comparing the output length diff --git a/packages/evm/src/precompiles/07-bn254-mul.ts b/packages/evm/src/precompiles/07-bn254-mul.ts index 76f5312bc06..25618e2fd68 100644 --- a/packages/evm/src/precompiles/07-bn254-mul.ts +++ b/packages/evm/src/precompiles/07-bn254-mul.ts @@ -1,6 +1,6 @@ import { bytesToHex, setLengthRight } from '@ethereumjs/util' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { getPrecompileName } from './index.ts' import { gasLimitCheck } from './util.ts' @@ -27,7 +27,7 @@ export function precompile07(opts: PrecompileInput): ExecResult { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } // check ecmul success or failure by comparing the output length diff --git a/packages/evm/src/precompiles/08-bn254-pairing.ts b/packages/evm/src/precompiles/08-bn254-pairing.ts index 7da55488157..48b0a335f83 100644 --- a/packages/evm/src/precompiles/08-bn254-pairing.ts +++ b/packages/evm/src/precompiles/08-bn254-pairing.ts @@ -1,7 +1,7 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMError } from '../errors.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { getPrecompileName } from './index.ts' import { gasLimitCheck, moduloLengthCheck } from './util.ts' @@ -13,7 +13,7 @@ import type { PrecompileInput } from './types.ts' export function precompile08(opts: PrecompileInput): ExecResult { const pName = getPrecompileName('08') if (!moduloLengthCheck(opts, 192, pName)) { - return EvmErrorResult(new EVMError(EVMErrorMessages.INVALID_INPUT_LENGTH), opts.gasLimit) + return EVMErrorResult(new EVMError(EVMError.errorMessages.INVALID_INPUT_LENGTH), opts.gasLimit) } const inputDataSize = BigInt(Math.floor(opts.data.length / 192)) @@ -31,7 +31,7 @@ export function precompile08(opts: PrecompileInput): ExecResult { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } // check ecpairing success or failure by comparing the output length diff --git a/packages/evm/src/precompiles/09-blake2f.ts b/packages/evm/src/precompiles/09-blake2f.ts index 34a04476f61..319e41dd62e 100644 --- a/packages/evm/src/precompiles/09-blake2f.ts +++ b/packages/evm/src/precompiles/09-blake2f.ts @@ -1,6 +1,6 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import { OOGResult } from '../evm.ts' import { getPrecompileName } from './index.ts' @@ -181,7 +181,7 @@ export function precompile09(opts: PrecompileInput): ExecResult { return { returnValue: new Uint8Array(0), executionGasUsed: opts.gasLimit, - exceptionError: new EVMError(EVMErrorMessages.OUT_OF_RANGE), + exceptionError: new EVMError(EVMError.errorMessages.OUT_OF_RANGE), } } const lastByte = data.subarray(212, 213)[0] @@ -192,7 +192,7 @@ export function precompile09(opts: PrecompileInput): ExecResult { return { returnValue: new Uint8Array(0), executionGasUsed: opts.gasLimit, - exceptionError: new EVMError(EVMErrorMessages.OUT_OF_RANGE), + exceptionError: new EVMError(EVMError.errorMessages.OUT_OF_RANGE), } } diff --git a/packages/evm/src/precompiles/0a-kzg-point-evaluation.ts b/packages/evm/src/precompiles/0a-kzg-point-evaluation.ts index 80f60acf50f..fea3b925ff3 100644 --- a/packages/evm/src/precompiles/0a-kzg-point-evaluation.ts +++ b/packages/evm/src/precompiles/0a-kzg-point-evaluation.ts @@ -7,8 +7,8 @@ import { setLengthLeft, } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMError } from '../errors.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { getPrecompileName } from './index.ts' import { gasLimitCheck } from './util.ts' @@ -33,7 +33,7 @@ export async function precompile0a(opts: PrecompileInput): Promise { } if (opts.data.length !== 192) { - return EvmErrorResult(new EVMError(EVMErrorMessages.INVALID_INPUT_LENGTH), opts.gasLimit) + return EVMErrorResult(new EVMError(EVMError.errorMessages.INVALID_INPUT_LENGTH), opts.gasLimit) } const version = Number(opts.common.param('blobCommitmentVersionKzg')) @@ -48,7 +48,7 @@ export async function precompile0a(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: INVALID_COMMITMENT`) } - return EvmErrorResult(new EVMError(EVMErrorMessages.INVALID_COMMITMENT), opts.gasLimit) + return EVMErrorResult(new EVMError(EVMError.errorMessages.INVALID_COMMITMENT), opts.gasLimit) } if (opts._debug !== undefined) { @@ -61,19 +61,19 @@ export async function precompile0a(opts: PrecompileInput): Promise { try { const res = opts.common.customCrypto?.kzg?.verifyProof(commitment, z, y, kzgProof) if (res === false) { - return EvmErrorResult(new EVMError(EVMErrorMessages.INVALID_PROOF), opts.gasLimit) + return EVMErrorResult(new EVMError(EVMError.errorMessages.INVALID_PROOF), opts.gasLimit) } } catch (err: any) { if (((err.message.includes('C_KZG_BADARGS') === true) === true) === true) { if (opts._debug !== undefined) { opts._debug(`${pName} failed: INVALID_INPUTS`) } - return EvmErrorResult(new EVMError(EVMErrorMessages.INVALID_INPUTS), opts.gasLimit) + return EVMErrorResult(new EVMError(EVMError.errorMessages.INVALID_INPUTS), opts.gasLimit) } if (opts._debug !== undefined) { opts._debug(`${pName} failed: Unknown error - ${err.message}`) } - return EvmErrorResult(new EVMError(EVMErrorMessages.REVERT), opts.gasLimit) + return EVMErrorResult(new EVMError(EVMError.errorMessages.REVERT), opts.gasLimit) } // Return value - FIELD_ELEMENTS_PER_BLOB and BLS_MODULUS as padded 32 byte big endian values diff --git a/packages/evm/src/precompiles/0b-bls12-g1add.ts b/packages/evm/src/precompiles/0b-bls12-g1add.ts index e408ffc81c8..f1a620db89d 100644 --- a/packages/evm/src/precompiles/0b-bls12-g1add.ts +++ b/packages/evm/src/precompiles/0b-bls12-g1add.ts @@ -1,8 +1,8 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import type { EVM } from '../evm.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { leading16ZeroBytesCheck } from './bls12_381/index.ts' import { getPrecompileName } from './index.ts' @@ -22,8 +22,8 @@ export async function precompile0b(opts: PrecompileInput): Promise { } if (!equalityLengthCheck(opts, 256, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_INVALID_INPUT_LENGTH), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit, ) } @@ -36,8 +36,8 @@ export async function precompile0b(opts: PrecompileInput): Promise { [192, 208], ] if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit, ) } @@ -49,7 +49,7 @@ export async function precompile0b(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } if (opts._debug !== undefined) { diff --git a/packages/evm/src/precompiles/0c-bls12-g1msm.ts b/packages/evm/src/precompiles/0c-bls12-g1msm.ts index 96c86a9c7a8..c4e8e5169e3 100644 --- a/packages/evm/src/precompiles/0c-bls12-g1msm.ts +++ b/packages/evm/src/precompiles/0c-bls12-g1msm.ts @@ -1,8 +1,8 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import type { EVM } from '../evm.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { BLS_GAS_DISCOUNT_PAIRS_G1, @@ -25,7 +25,10 @@ export async function precompile0c(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: Empty input`) } - return EvmErrorResult(new EVMError(EVMErrorMessages.BLS_12_381_INPUT_EMPTY), opts.gasLimit) // follow Geth's implementation + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INPUT_EMPTY), + opts.gasLimit, + ) // follow Geth's implementation } // TODO: Double-check respectively confirm that this order is really correct that the gas check @@ -43,14 +46,14 @@ export async function precompile0c(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: Invalid input length length=${inputData.length}`) } - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_INVALID_INPUT_LENGTH), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit, ) } if (!moduloLengthCheck(opts, 160, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_INVALID_INPUT_LENGTH), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit, ) } @@ -65,8 +68,8 @@ export async function precompile0c(opts: PrecompileInput): Promise { // zero bytes check const pairStart = 160 * k if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName, pairStart)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit, ) } @@ -79,7 +82,7 @@ export async function precompile0c(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } if (opts._debug !== undefined) { diff --git a/packages/evm/src/precompiles/0d-bls12-g2add.ts b/packages/evm/src/precompiles/0d-bls12-g2add.ts index c279487c2bf..93946b595e0 100644 --- a/packages/evm/src/precompiles/0d-bls12-g2add.ts +++ b/packages/evm/src/precompiles/0d-bls12-g2add.ts @@ -1,8 +1,8 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import type { EVM } from '../evm.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { leading16ZeroBytesCheck } from './bls12_381/index.ts' import { getPrecompileName } from './index.ts' @@ -22,8 +22,8 @@ export async function precompile0d(opts: PrecompileInput): Promise { } if (!equalityLengthCheck(opts, 512, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_INVALID_INPUT_LENGTH), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit, ) } @@ -40,8 +40,8 @@ export async function precompile0d(opts: PrecompileInput): Promise { [448, 464], ] if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit, ) } @@ -52,7 +52,7 @@ export async function precompile0d(opts: PrecompileInput): Promise { try { returnValue = bls.addG2(opts.data) } catch (e: any) { - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } if (opts._debug !== undefined) { diff --git a/packages/evm/src/precompiles/0e-bls12-g2msm.ts b/packages/evm/src/precompiles/0e-bls12-g2msm.ts index 10ba60ecd04..0b71ba4af76 100644 --- a/packages/evm/src/precompiles/0e-bls12-g2msm.ts +++ b/packages/evm/src/precompiles/0e-bls12-g2msm.ts @@ -1,8 +1,8 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import type { EVM } from '../evm.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { BLS_GAS_DISCOUNT_PAIRS_G2, @@ -23,7 +23,10 @@ export async function precompile0e(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: Empty input`) } - return EvmErrorResult(new EVMError(EVMErrorMessages.BLS_12_381_INPUT_EMPTY), opts.gasLimit) // follow Geth's implementation + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INPUT_EMPTY), + opts.gasLimit, + ) // follow Geth's implementation } const numPairs = Math.floor(opts.data.length / 288) @@ -35,8 +38,8 @@ export async function precompile0e(opts: PrecompileInput): Promise { } if (!moduloLengthCheck(opts, 288, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_INVALID_INPUT_LENGTH), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit, ) } @@ -53,8 +56,8 @@ export async function precompile0e(opts: PrecompileInput): Promise { // zero bytes check const pairStart = 288 * k if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName, pairStart)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit, ) } @@ -67,7 +70,7 @@ export async function precompile0e(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } if (opts._debug !== undefined) { diff --git a/packages/evm/src/precompiles/0f-bls12-pairing.ts b/packages/evm/src/precompiles/0f-bls12-pairing.ts index 72b69450a4d..63e1124dfc8 100644 --- a/packages/evm/src/precompiles/0f-bls12-pairing.ts +++ b/packages/evm/src/precompiles/0f-bls12-pairing.ts @@ -1,8 +1,8 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import type { EVM } from '../evm.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { leading16ZeroBytesCheck } from './bls12_381/index.ts' import { getPrecompileName } from './index.ts' @@ -22,7 +22,10 @@ export async function precompile0f(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: Empty input`) } - return EvmErrorResult(new EVMError(EVMErrorMessages.BLS_12_381_INPUT_EMPTY), opts.gasLimit) + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INPUT_EMPTY), + opts.gasLimit, + ) } const gasUsedPerPair = opts.common.param('bls12381PairingPerPairGas') ?? BigInt(0) @@ -31,8 +34,8 @@ export async function precompile0f(opts: PrecompileInput): Promise { // gas check. I will keep it there to not side-change the existing implementation, but we should // check (respectively Jochem can maybe have a word) if this is something intended or not if (!moduloLengthCheck(opts, 384, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_INVALID_INPUT_LENGTH), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit, ) } @@ -55,8 +58,8 @@ export async function precompile0f(opts: PrecompileInput): Promise { // zero bytes check const pairStart = 384 * k if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName, pairStart)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit, ) } @@ -69,7 +72,7 @@ export async function precompile0f(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } if (opts._debug !== undefined) { diff --git a/packages/evm/src/precompiles/10-bls12-map-fp-to-g1.ts b/packages/evm/src/precompiles/10-bls12-map-fp-to-g1.ts index ce816ae2ec1..42690e00076 100644 --- a/packages/evm/src/precompiles/10-bls12-map-fp-to-g1.ts +++ b/packages/evm/src/precompiles/10-bls12-map-fp-to-g1.ts @@ -1,8 +1,8 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import type { EVM } from '../evm.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { leading16ZeroBytesCheck } from './bls12_381/index.ts' import { getPrecompileName } from './index.ts' @@ -22,8 +22,8 @@ export async function precompile10(opts: PrecompileInput): Promise { } if (!equalityLengthCheck(opts, 64, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_INVALID_INPUT_LENGTH), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit, ) } @@ -31,8 +31,8 @@ export async function precompile10(opts: PrecompileInput): Promise { // check if some parts of input are zero bytes. const zeroByteRanges = [[0, 16]] if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit, ) } @@ -44,19 +44,7 @@ export async function precompile10(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - // noble‑curves throws this for inputs that map to the point at infinity - if (e.message === 'bad point: ZERO') { - // return two zeroed field elements (x & y), each the same length as the input - const zeroPoint = new Uint8Array(opts.data.length * 2) - if (opts._debug !== undefined) { - opts._debug(`${pName} mapping to ZERO point, returning zero-filled output`) - } - return { - executionGasUsed: gasUsed, - returnValue: zeroPoint, - } - } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } if (opts._debug !== undefined) { diff --git a/packages/evm/src/precompiles/11-bls12-map-fp2-to-g2.ts b/packages/evm/src/precompiles/11-bls12-map-fp2-to-g2.ts index 9ec579e92b0..8cb7aded655 100644 --- a/packages/evm/src/precompiles/11-bls12-map-fp2-to-g2.ts +++ b/packages/evm/src/precompiles/11-bls12-map-fp2-to-g2.ts @@ -1,8 +1,8 @@ import { bytesToHex } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../errors.ts' +import { EVMError } from '../errors.ts' import type { EVM } from '../evm.ts' -import { EvmErrorResult, OOGResult } from '../evm.ts' +import { EVMErrorResult, OOGResult } from '../evm.ts' import { leading16ZeroBytesCheck } from './bls12_381/index.ts' import { getPrecompileName } from './index.ts' @@ -22,8 +22,8 @@ export async function precompile11(opts: PrecompileInput): Promise { } if (!equalityLengthCheck(opts, 128, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_INVALID_INPUT_LENGTH), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit, ) } @@ -34,8 +34,8 @@ export async function precompile11(opts: PrecompileInput): Promise { [64, 80], ] if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName)) { - return EvmErrorResult( - new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE), + return EVMErrorResult( + new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit, ) } @@ -47,7 +47,7 @@ export async function precompile11(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`${pName} failed: ${e.message}`) } - return EvmErrorResult(e, opts.gasLimit) + return EVMErrorResult(e, opts.gasLimit) } if (opts._debug !== undefined) { diff --git a/packages/evm/src/precompiles/bls12_381/mcl.ts b/packages/evm/src/precompiles/bls12_381/mcl.ts index 2f253dd1b1f..65ed1389352 100644 --- a/packages/evm/src/precompiles/bls12_381/mcl.ts +++ b/packages/evm/src/precompiles/bls12_381/mcl.ts @@ -7,7 +7,7 @@ import { unprefixedHexToBytes, } from '@ethereumjs/util' -import { EVMError, EVMErrorMessages } from '../../errors.ts' +import { EVMError } from '../../errors.ts' import { BLS_FIELD_MODULUS, @@ -53,12 +53,12 @@ function BLS12_381_ToG1Point(input: Uint8Array, mcl: any, verifyOrder = true): a mcl.verifyOrderG1(verifyOrder) if (verifyOrder && G1.isValidOrder() === false) { - throw new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE) + throw new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE) } // Check if these coordinates are actually on the curve. if (G1.isValid() === false) { - throw new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE) + throw new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE) } return G1 @@ -87,10 +87,10 @@ function BLS12_381_FromG1Point(input: any): Uint8Array { function BLS12_381_ToFp2Point(fpXCoordinate: Uint8Array, fpYCoordinate: Uint8Array, mcl: any): any { // check if the coordinates are in the field if (bytesToBigInt(fpXCoordinate) >= BLS_FIELD_MODULUS) { - throw new EVMError(EVMErrorMessages.BLS_12_381_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BLS_12_381_FP_NOT_IN_FIELD) } if (bytesToBigInt(fpYCoordinate) >= BLS_FIELD_MODULUS) { - throw new EVMError(EVMErrorMessages.BLS_12_381_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BLS_12_381_FP_NOT_IN_FIELD) } const fp_x = new mcl.Fp() @@ -146,11 +146,11 @@ function BLS12_381_ToG2Point(input: Uint8Array, mcl: any, verifyOrder = true): a mcl.verifyOrderG2(verifyOrder) if (verifyOrder && p.isValidOrder() === false) { - throw new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE) + throw new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE) } if (p.isValid() === false) { - throw new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE) + throw new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE) } return p @@ -190,7 +190,7 @@ function BLS12_381_ToFrPoint(input: Uint8Array, mcl: any): any { function BLS12_381_ToFpPoint(fpCoordinate: Uint8Array, mcl: any): any { // check if point is in field if (bytesToBigInt(fpCoordinate) >= BLS_FIELD_MODULUS) { - throw new EVMError(EVMErrorMessages.BLS_12_381_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BLS_12_381_FP_NOT_IN_FIELD) } const fp = new mcl.Fp() diff --git a/packages/evm/src/precompiles/bls12_381/noble.ts b/packages/evm/src/precompiles/bls12_381/noble.ts index 7be334127e0..b5cb37ba851 100644 --- a/packages/evm/src/precompiles/bls12_381/noble.ts +++ b/packages/evm/src/precompiles/bls12_381/noble.ts @@ -8,7 +8,7 @@ import { } from '@ethereumjs/util' import { bls12_381 } from '@noble/curves/bls12-381' -import { EVMError, EVMErrorMessages } from '../../errors.ts' +import { EVMError } from '../../errors.ts' import { BLS_FIELD_MODULUS, @@ -30,10 +30,10 @@ const G2_ZERO = bls12_381.G2.ProjectivePoint.ZERO function BLS12_381_ToFp2Point(fpXCoordinate: Uint8Array, fpYCoordinate: Uint8Array) { // check if the coordinates are in the field if (bytesToBigInt(fpXCoordinate) >= BLS_FIELD_MODULUS) { - throw new EVMError(EVMErrorMessages.BLS_12_381_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BLS_12_381_FP_NOT_IN_FIELD) } if (bytesToBigInt(fpYCoordinate) >= BLS_FIELD_MODULUS) { - throw new EVMError(EVMErrorMessages.BLS_12_381_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BLS_12_381_FP_NOT_IN_FIELD) } const fpBytes = concatBytes(fpXCoordinate.subarray(16), fpYCoordinate.subarray(16)) @@ -65,7 +65,7 @@ function BLS12_381_ToG1Point(input: Uint8Array, verifyOrder = true) { G1.assertValidity() } catch (e) { if (verifyOrder || (e as Error).message !== 'bad point: not in prime-order subgroup') - throw new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE) + throw new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE) } return G1 @@ -108,7 +108,7 @@ function BLS12_381_ToG2Point(input: Uint8Array, verifyOrder = true) { pG2.assertValidity() } catch (e) { if (verifyOrder || (e as Error).message !== 'bad point: not in prime-order subgroup') - throw new EVMError(EVMErrorMessages.BLS_12_381_POINT_NOT_ON_CURVE) + throw new EVMError(EVMError.errorMessages.BLS_12_381_POINT_NOT_ON_CURVE) } return pG2 @@ -159,7 +159,7 @@ function BLS12_381_ToFrPoint(input: Uint8Array): bigint { function BLS12_381_ToFpPoint(fpCoordinate: Uint8Array) { // check if point is in field if (bytesToBigInt(fpCoordinate) >= BLS_FIELD_MODULUS) { - throw new EVMError(EVMErrorMessages.BLS_12_381_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BLS_12_381_FP_NOT_IN_FIELD) } const FP = bls12_381.fields.Fp.fromBytes(fpCoordinate.slice(16)) return FP diff --git a/packages/evm/src/precompiles/bn254/noble.ts b/packages/evm/src/precompiles/bn254/noble.ts index 2a6a06a4579..73ffc5f4c04 100644 --- a/packages/evm/src/precompiles/bn254/noble.ts +++ b/packages/evm/src/precompiles/bn254/noble.ts @@ -9,7 +9,7 @@ import { } from '@ethereumjs/util' import { bn254 } from '@noble/curves/bn254' -import { EVMError, EVMErrorMessages } from '../../errors.ts' +import { EVMError } from '../../errors.ts' import type { AffinePoint } from '@noble/curves/abstract/weierstrass' import type { EVMBN254Interface } from '../../types.ts' @@ -64,10 +64,10 @@ function toFrPoint(input: Uint8Array): bigint { function toFp2Point(fpXCoordinate: Uint8Array, fpYCoordinate: Uint8Array) { if (bytesToBigInt(fpXCoordinate) >= bn254.fields.Fp2.ORDER) { - throw new EVMError(EVMErrorMessages.BN254_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BN254_FP_NOT_IN_FIELD) } if (bytesToBigInt(fpYCoordinate) >= bn254.fields.Fp2.ORDER) { - throw new EVMError(EVMErrorMessages.BN254_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BN254_FP_NOT_IN_FIELD) } const fpBytes = concatBytes(fpXCoordinate, fpYCoordinate) @@ -96,7 +96,7 @@ function toG2Point(input: Uint8Array) { for (const p of [p_x_1, p_x_2, p_y_1, p_y_2]) { const pB = bytesToBigInt(p) if (bn254.fields.Fp.create(pB) !== pB) { - throw new EVMError(EVMErrorMessages.BN254_FP_NOT_IN_FIELD) + throw new EVMError(EVMError.errorMessages.BN254_FP_NOT_IN_FIELD) } } diff --git a/packages/evm/src/stack.ts b/packages/evm/src/stack.ts index c4e50247a27..810e1ea0d91 100644 --- a/packages/evm/src/stack.ts +++ b/packages/evm/src/stack.ts @@ -1,4 +1,4 @@ -import { EVMError, EVMErrorMessages } from './errors.ts' +import { EVMError } from './errors.ts' /** * Implementation of the stack used in evm. @@ -23,7 +23,7 @@ export class Stack { push(value: bigint) { if (this._len >= this._maxHeight) { - throw new EVMError(EVMErrorMessages.STACK_OVERFLOW) + throw new EVMError(EVMError.errorMessages.STACK_OVERFLOW) } // Read current length, set `_store` to value, and then increase the length @@ -32,7 +32,7 @@ export class Stack { pop(): bigint { if (this._len < 1) { - throw new EVMError(EVMErrorMessages.STACK_UNDERFLOW) + throw new EVMError(EVMError.errorMessages.STACK_UNDERFLOW) } // Length is checked above, so pop shouldn't return undefined @@ -49,7 +49,7 @@ export class Stack { */ popN(num: number = 1): bigint[] { if (this._len < num) { - throw new EVMError(EVMErrorMessages.STACK_UNDERFLOW) + throw new EVMError(EVMError.errorMessages.STACK_UNDERFLOW) } if (num === 0) { @@ -79,7 +79,7 @@ export class Stack { for (let peek = 0; peek < num; peek++) { const index = --start if (index < 0) { - throw new EVMError(EVMErrorMessages.STACK_UNDERFLOW) + throw new EVMError(EVMError.errorMessages.STACK_UNDERFLOW) } peekArray[peek] = this._store[index] } @@ -92,7 +92,7 @@ export class Stack { */ swap(position: number) { if (this._len <= position) { - throw new EVMError(EVMErrorMessages.STACK_UNDERFLOW) + throw new EVMError(EVMError.errorMessages.STACK_UNDERFLOW) } const head = this._len - 1 @@ -115,12 +115,12 @@ export class Stack { dup(position: number) { const len = this._len if (len < position) { - throw new EVMError(EVMErrorMessages.STACK_UNDERFLOW) + throw new EVMError(EVMError.errorMessages.STACK_UNDERFLOW) } // Note: this code is borrowed from `push()` (avoids a call) if (len >= this._maxHeight) { - throw new EVMError(EVMErrorMessages.STACK_OVERFLOW) + throw new EVMError(EVMError.errorMessages.STACK_OVERFLOW) } const i = len - position @@ -139,7 +139,7 @@ export class Stack { // Stack underflow is not possible in EOF if (exchangeIndex1 < 0 || exchangeIndex2 < 0) { - throw new EVMError(EVMErrorMessages.STACK_UNDERFLOW) + throw new EVMError(EVMError.errorMessages.STACK_UNDERFLOW) } const cache = this._store[exchangeIndex2] diff --git a/packages/evm/test/eips/eip-5450.spec.ts b/packages/evm/test/eips/eip-5450.spec.ts index 7c498fd32dd..54216458d81 100644 --- a/packages/evm/test/eips/eip-5450.spec.ts +++ b/packages/evm/test/eips/eip-5450.spec.ts @@ -1,4 +1,4 @@ -import { hexToBytes } from '@ethereumjs/util' +import { type PrefixedHexString, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' import { default as testData } from '../../../ethereum-tests/EOFTests/EIP5450/validInvalid.json' with { @@ -22,7 +22,7 @@ describe('EIP 5450 tests', async () => { for (const key in testData.validInvalid.vectors) { it(`Container validation tests ${key}`, () => { const input = testData.validInvalid.vectors[key as keyof typeof testData.validInvalid.vectors] - const code = hexToBytes(input.code) + const code = hexToBytes(input.code as PrefixedHexString) const expected = input.results.Osaka.result diff --git a/packages/evm/test/eips/eip-5656.spec.ts b/packages/evm/test/eips/eip-5656.spec.ts index b07247ff5dd..d26950d1b5c 100644 --- a/packages/evm/test/eips/eip-5656.spec.ts +++ b/packages/evm/test/eips/eip-5656.spec.ts @@ -62,7 +62,7 @@ describe('should test mcopy', () => { for (const situation of situations) { it('should produce correct output', async () => { // create bytecode - let bytecode: PrefixedHexString = '0x' + let bytecode = '0x' // prepare the memory for (let i = 0; i < situation.pre.length / 2; i++) { const start = i * 2 diff --git a/packages/evm/test/eips/eof-runner.spec.ts b/packages/evm/test/eips/eof-runner.spec.ts index cccce816659..a6448e0e87b 100644 --- a/packages/evm/test/eips/eof-runner.spec.ts +++ b/packages/evm/test/eips/eof-runner.spec.ts @@ -1,7 +1,7 @@ -import { Account, Address, hexToBytes } from '@ethereumjs/util' +import { Account, Address, type PrefixedHexString, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' -import { createEVM } from '../../src/index.ts' +import { EOFContainer, createEVM } from '../../src/index.ts' import { getCommon } from './eof-utils.ts' @@ -38,4 +38,19 @@ describe('EOF: should run a simple contract', async () => { // This costs 4 gas assert.equal(result.execResult.executionGasUsed, BigInt(4)) }) + it('should initialize code positions correctly', async () => { + const code = hexToBytes( + ('0xef0001' + + '010008' + + '02' + + '000200080003' + + '040000' + + '00' + + '0080000100000001' + // Section 1 + '3050e30001600100' + // Section 2 + '3050e4') as PrefixedHexString, + ) + const eofContainer = new EOFContainer(code) + assert.doesNotThrow(() => eofContainer.header.getSectionFromProgramCounter(33)) + }) }) diff --git a/packages/evm/test/runCall.spec.ts b/packages/evm/test/runCall.spec.ts index 2c4e9953e6d..bcb26d3e3aa 100644 --- a/packages/evm/test/runCall.spec.ts +++ b/packages/evm/test/runCall.spec.ts @@ -17,7 +17,7 @@ import { import { keccak256 } from 'ethereum-cryptography/keccak.js' import { assert, describe, it } from 'vitest' -import { EVMErrorMessages } from '../src/errors.ts' +import { EVMError } from '../src/errors.ts' import { defaultBlock } from '../src/evm.ts' import { createEVM } from '../src/index.ts' @@ -273,7 +273,7 @@ describe('RunCall tests', () => { assert.equal(result.execResult.gasRefund, BigInt(0), 'gas refund correct') assert.equal( result.execResult.exceptionError?.error, - EVMErrorMessages.OUT_OF_GAS, + EVMError.errorMessages.OUT_OF_GAS, 'call went out of gas', ) }) @@ -541,7 +541,7 @@ describe('RunCall tests', () => { const result = await evm.runCall(runCallArgs) assert.equal( result.execResult.exceptionError?.error, - EVMErrorMessages.CODESIZE_EXCEEDS_MAXIMUM, + EVMError.errorMessages.CODESIZE_EXCEEDS_MAXIMUM, 'reported error is correct', ) }) @@ -652,7 +652,10 @@ describe('RunCall tests', () => { } const res = await evm.runCall(runCallArgs) - assert.equal(res.execResult.exceptionError?.error, EVMErrorMessages.CODESIZE_EXCEEDS_MAXIMUM) + assert.equal( + res.execResult.exceptionError?.error, + EVMError.errorMessages.CODESIZE_EXCEEDS_MAXIMUM, + ) // Create a contract which goes OOG when creating const runCallArgs2 = { @@ -661,7 +664,7 @@ describe('RunCall tests', () => { } const res2 = await evm.runCall(runCallArgs2) - assert.equal(res2.execResult.exceptionError?.error, EVMErrorMessages.OUT_OF_GAS) + assert.equal(res2.execResult.exceptionError?.error, EVMError.errorMessages.OUT_OF_GAS) }) it('ensure code deposit errors are logged correctly (Frontier)', async () => { @@ -675,7 +678,7 @@ describe('RunCall tests', () => { } const res = await evm.runCall(runCallArgs) - assert.equal(res.execResult.exceptionError?.error, EVMErrorMessages.CODESTORE_OUT_OF_GAS) + assert.equal(res.execResult.exceptionError?.error, EVMError.errorMessages.CODESTORE_OUT_OF_GAS) // Create a contract which goes OOG when creating const runCallArgs2 = { @@ -684,7 +687,7 @@ describe('RunCall tests', () => { } const res2 = await evm.runCall(runCallArgs2) - assert.equal(res2.execResult.exceptionError?.error, EVMErrorMessages.OUT_OF_GAS) + assert.equal(res2.execResult.exceptionError?.error, EVMError.errorMessages.OUT_OF_GAS) }) it('ensure call and callcode handle gas stipend correctly', async () => { diff --git a/packages/evm/test/runCode.spec.ts b/packages/evm/test/runCode.spec.ts index 34782e2ab8d..fb9587798ca 100644 --- a/packages/evm/test/runCode.spec.ts +++ b/packages/evm/test/runCode.spec.ts @@ -1,6 +1,7 @@ import { Account, createAddressFromString, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' +import { EVMErrorTypeString } from '../src/errors.ts' import { createEVM } from '../src/index.ts' const PUSH1 = '60' @@ -56,7 +57,7 @@ describe('VM.runCode: initial program counter', () => { }) describe('VM.runCode: interpreter', () => { - it('should return a EvmError as an exceptionError on the result', async () => { + it('should return a EVMError as an exceptionError on the result', async () => { const evm = await createEVM() const INVALID_opcode = 'fe' @@ -71,11 +72,11 @@ describe('VM.runCode: interpreter', () => { } catch { assert.fail('should not throw error') } - assert.equal(result?.exceptionError?.errorType, 'EVMError') + assert.equal(result?.exceptionError?.errorType, EVMErrorTypeString) assert.isTrue(result?.exceptionError?.error.includes('invalid opcode')) }) - it('should throw on non-EvmError', async () => { + it('should throw on non-EVMError', async () => { const evm = await createEVM() // NOTE: due to now throwing on `getStorage` if account does not exist // this now means that if `runCode` is called and the address it runs on (default: zero address) diff --git a/packages/evm/test/stack.spec.ts b/packages/evm/test/stack.spec.ts index 79c5ae45a00..fd8b725a4ca 100644 --- a/packages/evm/test/stack.spec.ts +++ b/packages/evm/test/stack.spec.ts @@ -161,22 +161,19 @@ describe('Stack', () => { const evm = await createEVM() for (let pushN = 0x60; pushN <= 0x7f; pushN++) { - // PUSHx 01 - const code = `0x${pushN.toString(16)}01` - // PUSH 0x03 JUMP JUMPDEST < PUSHx 01 > - const codeWithJumps = `0x6003565B${pushN.toString(16)}01` - const expectedStack = new Stack(1024) expectedStack.push(bytesToBigInt(setLengthRight(new Uint8Array([0x01]), pushN - 0x5f))) const resWithoutJumps = await evm.runCall({ - data: hexToBytes(code), + // PUSHx 01 + data: hexToBytes(`0x${pushN.toString(16)}01`), }) const executionStack = resWithoutJumps.execResult.runState?.stack assert.deepEqual(executionStack, expectedStack, 'code without jumps ok') const resWithJumps = await evm.runCall({ - data: hexToBytes(codeWithJumps), + // PUSH 0x03 JUMP JUMPDEST < PUSHx 01 > + data: hexToBytes(`0x6003565B${pushN.toString(16)}01`), }) const executionStackWithJumps = resWithJumps.execResult.runState?.stack assert.deepEqual(executionStackWithJumps, expectedStack, 'code with jumps ok') diff --git a/packages/evm/test/verkle.spec.ts b/packages/evm/test/verkle.spec.ts index 963ace154dd..f572606e7ca 100644 --- a/packages/evm/test/verkle.spec.ts +++ b/packages/evm/test/verkle.spec.ts @@ -1,6 +1,7 @@ import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { StatefulVerkleStateManager } from '@ethereumjs/statemanager' import { + type PrefixedHexString, bigIntToBytes, bytesToHex, createAccount, @@ -111,10 +112,10 @@ describe('verkle tests', () => { assert.equal(writtenChunks.length, 1) assert.equal(res.execResult.exceptionError?.error, undefined) }) -}) +}, 20000) describe('generate an execution witness', () => { it('should generate the correct execution witness from a prestate and changes', async () => { - const preStateVKT = { + const preStateVKT: Record = { '0x0365b079a274a1808d56484ce5bd97914629907d75767f51439102e22cd50d00': '0x00000000000000000000000000000000000000000000003635c9adc5dea00000', '0x0365b079a274a1808d56484ce5bd97914629907d75767f51439102e22cd50d01': @@ -152,7 +153,7 @@ describe('generate an execution witness', () => { const trie = await createVerkleTree() // Setup prestate for (const [key, value] of Object.entries(preStateVKT)) { - const stem = hexToBytes(key).slice(0, 31) + const stem = hexToBytes(key as PrefixedHexString).slice(0, 31) const suffix = parseInt(key.slice(64), 16) await trie.put(stem, [suffix], [hexToBytes(value)]) } @@ -167,7 +168,7 @@ describe('generate an execution witness', () => { }) // Run tx await evm.runCall({ - code: hexToBytes(tx.input), + code: hexToBytes(tx.input as PrefixedHexString), caller: createAddressFromString(tx.sender), to: createAddressFromString(tx.to), gasLimit: BigInt(tx.gas), @@ -187,4 +188,4 @@ describe('generate an execution witness', () => { // Ensure sender account nonce is 1 in execution witness assert.equal(decodeVerkleLeafBasicData(hexToBytes(suffixDiff!.newValue!)).nonce, 1n) }) -}) +}, 20000) diff --git a/packages/evm/typedoc.cjs b/packages/evm/typedoc.mjs similarity index 59% rename from packages/evm/typedoc.cjs rename to packages/evm/typedoc.mjs index 04314aef630..6bd3ee71688 100644 --- a/packages/evm/typedoc.cjs +++ b/packages/evm/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts', 'src/evm/**'], diff --git a/packages/genesis/README.md b/packages/genesis/README.md index 58cdefc7bcd..c4590acbaa1 100644 --- a/packages/genesis/README.md +++ b/packages/genesis/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/genesis +# @ethereumjs/genesis `v10` [![NPM Package][genesis-npm-badge]][genesis-npm-link] [![GitHub Issues][genesis-issues-badge]][genesis-issues-link] @@ -16,6 +16,15 @@ This module provides access to Ethereum genesis state for the following networks - Holesky - Hoodi +## Table of Contents + +- [Installation](#installation) +- [Usage](#usage) +- [EthereumJS](#ethereumjs) +- [License](#license) + +## Installation + The package can be install with: ```shell diff --git a/packages/genesis/docs/README.md b/packages/genesis/docs/README.md index 87f7d2e133c..d116222dff9 100644 --- a/packages/genesis/docs/README.md +++ b/packages/genesis/docs/README.md @@ -1,34 +1,9 @@ -@ethereumjs/genesis +**@ethereumjs/genesis** -# @ethereumjs/genesis - -## Table of contents +*** -### Functions - -- [getGenesis](README.md#getgenesis) +# @ethereumjs/genesis ## Functions -### getGenesis - -▸ **getGenesis**(`chainId`): `GenesisState` \| `undefined` - -Utility to get the genesisState of a well known network -@param: chainId of the network - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chainId` | `number` | - -#### Returns - -`GenesisState` \| `undefined` - -genesisState of the chain - -#### Defined in - -[index.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/genesis/src/index.ts#L15) +- [getGenesis](functions/getGenesis.md) diff --git a/packages/genesis/docs/functions/getGenesis.md b/packages/genesis/docs/functions/getGenesis.md new file mode 100644 index 00000000000..c9067cdfece --- /dev/null +++ b/packages/genesis/docs/functions/getGenesis.md @@ -0,0 +1,26 @@ +[**@ethereumjs/genesis**](../README.md) + +*** + +[@ethereumjs/genesis](../README.md) / getGenesis + +# Function: getGenesis() + +> **getGenesis**(`chainId`): `undefined` \| `GenesisState` + +Defined in: [index.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/genesis/src/index.ts#L15) + +Utility to get the genesisState of a well known network +@param: chainId of the network + +## Parameters + +### chainId + +`number` + +## Returns + +`undefined` \| `GenesisState` + +genesisState of the chain diff --git a/packages/genesis/package.json b/packages/genesis/package.json index 5defd0b7729..bf8daf76197 100644 --- a/packages/genesis/package.json +++ b/packages/genesis/package.json @@ -64,7 +64,7 @@ "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", "examples": "tsx ../../scripts/examples-runner.ts -- genesis", "examples:build": "npx embedme README.md", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", "lint:fix": "npm run biome:fix && eslint --fix --config ./eslint.config.mjs .", "prepublishOnly": "../../config/cli/prepublish.sh", diff --git a/packages/binarytree/typedoc.cjs b/packages/genesis/typedoc.mjs similarity index 54% rename from packages/binarytree/typedoc.cjs rename to packages/genesis/typedoc.mjs index 701fee055fa..4f962d06684 100644 --- a/packages/binarytree/typedoc.cjs +++ b/packages/genesis/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts'], diff --git a/packages/mpt/README.md b/packages/mpt/README.md index 78398ac16ad..ff4bd470dde 100644 --- a/packages/mpt/README.md +++ b/packages/mpt/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/mpt +# @ethereumjs/mpt `v10` [![NPM Package][mpt-npm-badge]][mpt-npm-link] [![GitHub Issues][mpt-issues-badge]][mpt-issues-link] @@ -7,9 +7,32 @@ [![Discord][discord-badge]][discord-link] | Implementation of the [Modified Merkle Patricia Trie](https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-mpt/) as specified in the [Ethereum Yellow Paper](http://gavwood.com/Paper.pdf) | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ---------------------------------------------------------------------------- | + +- 🔭 Highly scalable +- 🌴 Tree-shakeable API +- 👷🏼 Controlled dependency set (3 external + `@Noble` crypto) +- ⏳ Checkpoint Functionality +- 🛢️ Flexible storage backends +- ⚖️ `EIP-1186` Proofs +- 🛵 176KB bundle size (48KB gzipped) +- 🏄🏾‍♂️ WASM-free default + Fully browser ready + +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Merkle Patricia Tries](#merkle-patricia-tries) +- [Proofs](#proofs) +- [Examples](#examples) +- [Browser](#browser) +- [API](#api) +- [Benchmarking](#benchmarking) +- [Debugging](#debugging) +- [References](#references) +- [EthereumJS](#ethereumjs) +- [License](#license) -> The modified Merkle Patricia tree (mpt) provides a persistent data structure to map between arbitrary-length binary data (byte arrays). It is defined in terms of a mutable data structure to map between 256-bit binary fragments and arbitrary-length binary data. The core of the mpt, and its sole requirement in terms of the protocol specification, is to provide a single 32-byte value that identifies a given set of key-value pairs. ## Installation @@ -19,7 +42,7 @@ To obtain the latest version, simply require the project using `npm`: npm install @ethereumjs/mpt ``` -## Usage +## Getting Started This class implements the basic [Modified Merkle Patricia Trie](https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-mpt/) in the `Trie` base class, which you can use with the `useKeyHashing` option set to `true` to create a Merkle Patricia Trie which stores values under the `keccak256` hash of its keys (this is the Trie flavor which is used in Ethereum production systems). @@ -158,9 +181,9 @@ async function main() { void main() ``` -### `MerklePatriciaTrie` Configuration Options +## Merkle Patricia Tries -#### Database Options +### Database Options The `DB` opt in the `MPTOpts` allows you to use any database that conforms to the `DB` interface to store the trie data in. We provide several [examples](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/trie/examples) for database implementations. The [level.js](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/trie/examples/level.js) example is used in the `ethereumjs client` while [lmdb.js](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/trie/examples/lmdb.js) is an alternative implementation that uses the popular [LMDB](https://en.wikipedia.org/wiki/Lightning_Memory-Mapped_Database) as its underlying database. @@ -168,7 +191,7 @@ If no `db` option is provided, an in-memory database powered by [a Javascript Ma If you want to use an alternative database, you can integrate your own by writing a DB wrapper that conforms to the [`DB` interface](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts) (in `@ethereumjs/util`). The `DB` interface defines the methods `get`, `put`, `del`, `batch` and `copy` that a concrete implementation of the `DB` interface will need to implement. -##### LevelDB +#### LevelDB As an example, to leverage `LevelDB` for all operations then you should create a file with the [following implementation from our recipes](./recipes//level.ts) in your project. Then instantiate your DB and trie as below: @@ -182,11 +205,11 @@ async function main() { console.log(trie.database().db) // LevelDB { ... ``` -#### Node Deletion (Pruning) +### Node Deletion (Pruning) By default, the deletion of trie nodes from the underlying database does not occur in order to avoid corrupting older trie states (as of `v4.2.0`). Should you only wish to work with the latest state of a trie, you can switch to a delete behavior (for example, if you wish to save disk space) by using the `useNodePruning` constructor option (see related release notes in the changelog for further details). -#### Root Persistence +### Root Persistence You can enable persistence by setting the `useRootPersistence` option to `true` when constructing a trie through the `createMPT` function. As such, this value is preserved when creating copies of the trie and is incapable of being modified once a trie is instantiated. diff --git a/packages/mpt/docs/README.md b/packages/mpt/docs/README.md index 82129244dcc..0ba3273a1be 100644 --- a/packages/mpt/docs/README.md +++ b/packages/mpt/docs/README.md @@ -1,557 +1,63 @@ -@ethereumjs/trie +**@ethereumjs/mpt** -# @ethereumjs/trie +*** -## Table of contents +# @ethereumjs/mpt -### Classes +## Classes -- [BranchNode](classes/BranchNode.md) +- [BranchMPTNode](classes/BranchMPTNode.md) - [CheckpointDB](classes/CheckpointDB.md) -- [ExtensionNode](classes/ExtensionNode.md) -- [LeafNode](classes/LeafNode.md) -- [PrioritizedTaskExecutor](classes/PrioritizedTaskExecutor.md) -- [Trie](classes/Trie.md) -- [TrieReadStream](classes/TrieReadStream.md) +- [ExtensionMPTNode](classes/ExtensionMPTNode.md) +- [LeafMPTNode](classes/LeafMPTNode.md) +- [MerklePatriciaTrie](classes/MerklePatriciaTrie.md) - [WalkController](classes/WalkController.md) -### Interfaces +## Interfaces - [CheckpointDBOpts](interfaces/CheckpointDBOpts.md) - [CommonInterface](interfaces/CommonInterface.md) +- [MPTOpts](interfaces/MPTOpts.md) - [Path](interfaces/Path.md) -- [TrieOpts](interfaces/TrieOpts.md) - [TrieShallowCopyOpts](interfaces/TrieShallowCopyOpts.md) -### Type Aliases - -- [Checkpoint](README.md#checkpoint) -- [EmbeddedNode](README.md#embeddednode) -- [FoundNodeFunction](README.md#foundnodefunction) -- [HashKeysFunction](README.md#hashkeysfunction) -- [Nibbles](README.md#nibbles) -- [Proof](README.md#proof) -- [TrieNode](README.md#trienode) -- [TrieOptsWithDefaults](README.md#trieoptswithdefaults) - -### Variables - -- [ROOT\_DB\_KEY](README.md#root_db_key) - -### Functions - -- [byteTypeToNibbleType](README.md#bytetypetonibbletype) -- [bytesToNibbles](README.md#bytestonibbles) -- [compactBytesToNibbles](README.md#compactbytestonibbles) -- [decodeNode](README.md#decodenode) -- [decodeRawNode](README.md#decoderawnode) -- [genesisStateRoot](README.md#genesisstateroot) -- [hasTerminator](README.md#hasterminator) -- [hexToKeybytes](README.md#hextokeybytes) -- [isRawNode](README.md#israwnode) -- [mergeAndFormatKeyPaths](README.md#mergeandformatkeypaths) -- [nibbleTypeToByteType](README.md#nibbletypetobytetype) -- [nibbleTypeToPackedBytes](README.md#nibbletypetopackedbytes) -- [nibblesToBytes](README.md#nibblestobytes) -- [nibblesToCompactBytes](README.md#nibblestocompactbytes) -- [pathToHexKey](README.md#pathtohexkey) -- [verifyRangeProof](README.md#verifyrangeproof) - ## Type Aliases -### Checkpoint - -Ƭ **Checkpoint**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `keyValueMap` | `Map`<`string`, `Uint8Array` \| `undefined`\> | -| `root` | `Uint8Array` | - -#### Defined in - -[packages/trie/src/types.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L135) - -___ - -### EmbeddedNode - -Ƭ **EmbeddedNode**: `Uint8Array` \| `Uint8Array`[] - -#### Defined in - -[packages/trie/src/types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L13) - -___ - -### FoundNodeFunction - -Ƭ **FoundNodeFunction**: (`nodeRef`: `Uint8Array`, `node`: [`TrieNode`](README.md#trienode) \| ``null``, `key`: [`Nibbles`](README.md#nibbles), `walkController`: [`WalkController`](classes/WalkController.md)) => `void` - -#### Type declaration - -▸ (`nodeRef`, `node`, `key`, `walkController`): `void` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `nodeRef` | `Uint8Array` | -| `node` | [`TrieNode`](README.md#trienode) \| ``null`` | -| `key` | [`Nibbles`](README.md#nibbles) | -| `walkController` | [`WalkController`](classes/WalkController.md) | - -##### Returns - -`void` - -#### Defined in - -[packages/trie/src/types.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L29) - -___ - -### HashKeysFunction - -Ƭ **HashKeysFunction**: (`msg`: `Uint8Array`) => `Uint8Array` - -#### Type declaration - -▸ (`msg`): `Uint8Array` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `msg` | `Uint8Array` | - -##### Returns - -`Uint8Array` - -#### Defined in - -[packages/trie/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L36) - -___ - -### Nibbles - -Ƭ **Nibbles**: `number`[] - -#### Defined in - -[packages/trie/src/types.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L9) - -___ - -### Proof - -Ƭ **Proof**: `Uint8Array`[] - -#### Defined in - -[packages/trie/src/types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L15) - -___ - -### TrieNode - -Ƭ **TrieNode**: [`BranchNode`](classes/BranchNode.md) \| [`ExtensionNode`](classes/ExtensionNode.md) \| [`LeafNode`](classes/LeafNode.md) - -#### Defined in - -[packages/trie/src/types.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L7) - -___ - -### TrieOptsWithDefaults - -Ƭ **TrieOptsWithDefaults**: [`TrieOpts`](interfaces/TrieOpts.md) & { `cacheSize`: `number` ; `useKeyHashing`: `boolean` ; `useKeyHashingFunction`: [`HashKeysFunction`](README.md#hashkeysfunction) ; `useNodePruning`: `boolean` ; `useRootPersistence`: `boolean` } - -#### Defined in - -[packages/trie/src/types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L105) +- [BranchMPTNodeBranchValue](type-aliases/BranchMPTNodeBranchValue.md) +- [Checkpoint](type-aliases/Checkpoint.md) +- [FoundNodeFunction](type-aliases/FoundNodeFunction.md) +- [HashKeysFunction](type-aliases/HashKeysFunction.md) +- [MPTNode](type-aliases/MPTNode.md) +- [MPTOptsWithDefaults](type-aliases/MPTOptsWithDefaults.md) +- [Nibbles](type-aliases/Nibbles.md) +- [NodeReferenceOrRawMPTNode](type-aliases/NodeReferenceOrRawMPTNode.md) +- [Proof](type-aliases/Proof.md) +- [RawExtensionMPTNode](type-aliases/RawExtensionMPTNode.md) +- [RawLeafMPTNode](type-aliases/RawLeafMPTNode.md) ## Variables -### ROOT\_DB\_KEY - -• `Const` **ROOT\_DB\_KEY**: `Uint8Array` - -#### Defined in - -[packages/trie/src/types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L142) +- [ROOT\_DB\_KEY](variables/ROOT_DB_KEY.md) ## Functions -### byteTypeToNibbleType - -▸ **byteTypeToNibbleType**(`key`): [`Nibbles`](README.md#nibbles) - -Turns each byte into a single nibble, only extracting the lower nibble of each byte - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `Uint8Array` | Uint8Array typed byte array | - -#### Returns - -[`Nibbles`](README.md#nibbles) - -Nibble typed nibble array - -#### Defined in - -[packages/trie/src/util/encoding.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L144) - -___ - -### bytesToNibbles - -▸ **bytesToNibbles**(`str`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `str` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/trie/src/util/encoding.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L77) - -___ - -### compactBytesToNibbles - -▸ **compactBytesToNibbles**(`compact`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `compact` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/trie/src/util/encoding.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L91) - -___ - -### decodeNode - -▸ **decodeNode**(`node`): [`BranchNode`](classes/BranchNode.md) \| [`ExtensionNode`](classes/ExtensionNode.md) \| [`LeafNode`](classes/LeafNode.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `node` | `Uint8Array` | - -#### Returns - -[`BranchNode`](classes/BranchNode.md) \| [`ExtensionNode`](classes/ExtensionNode.md) \| [`LeafNode`](classes/LeafNode.md) - -#### Defined in - -[packages/trie/src/node/util.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/util.ts#L30) - -___ - -### decodeRawNode - -▸ **decodeRawNode**(`raw`): [`BranchNode`](classes/BranchNode.md) \| [`ExtensionNode`](classes/ExtensionNode.md) \| [`LeafNode`](classes/LeafNode.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `raw` | `Uint8Array`[] | - -#### Returns - -[`BranchNode`](classes/BranchNode.md) \| [`ExtensionNode`](classes/ExtensionNode.md) \| [`LeafNode`](classes/LeafNode.md) - -#### Defined in - -[packages/trie/src/node/util.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/util.ts#L12) - -___ - -### genesisStateRoot - -▸ **genesisStateRoot**(`genesisState`): `Promise`<`Uint8Array`\> - -Derives the stateRoot of the genesis block based on genesis allocations - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `genesisState` | `GenesisState` | - -#### Returns - -`Promise`<`Uint8Array`\> - -#### Defined in - -[packages/trie/src/util/genesisState.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/genesisState.ts#L12) - -___ - -### hasTerminator - -▸ **hasTerminator**(`nibbles`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `nibbles` | `Uint8Array` | - -#### Returns - -`boolean` - -boolean indicating if input hex nibble sequence has terminator indicating leaf-node - terminator is represented with 16 because a nibble ranges from 0 - 15(f) - -#### Defined in - -[packages/trie/src/util/encoding.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L31) - -___ - -### hexToKeybytes - -▸ **hexToKeybytes**(`hex`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hex` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/trie/src/util/encoding.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L41) - -___ - -### isRawNode - -▸ **isRawNode**(`n`): n is Uint8Array[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `Uint8Array` \| `NestedUint8Array` | - -#### Returns - -n is Uint8Array[] - -#### Defined in - -[packages/trie/src/node/util.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/util.ts#L26) - -___ - -### mergeAndFormatKeyPaths - -▸ **mergeAndFormatKeyPaths**(`pathStrings`): `Uint8Array`[][] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `pathStrings` | `string`[] | - -#### Returns - -`Uint8Array`[][] - -#### Defined in - -[packages/trie/src/util/encoding.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L175) - -___ - -### nibbleTypeToByteType - -▸ **nibbleTypeToByteType**(`arr`): `Uint8Array` - -Converts each nibble into a single byte - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `arr` | [`Nibbles`](README.md#nibbles) | Nibble typed nibble array | - -#### Returns - -`Uint8Array` - -Uint8Array typed byte array - -#### Defined in - -[packages/trie/src/util/encoding.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L128) - -___ - -### nibbleTypeToPackedBytes - -▸ **nibbleTypeToPackedBytes**(`arr`): `Uint8Array` - -Packs every two nibbles into a single byte - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `arr` | [`Nibbles`](README.md#nibbles) | Nibble typed nibble array | - -#### Returns - -`Uint8Array` - -Uint8Array typed byte array - -#### Defined in - -[packages/trie/src/util/encoding.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L112) - -___ - -### nibblesToBytes - -▸ **nibblesToBytes**(`nibbles`, `bytes`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `nibbles` | `Uint8Array` | -| `bytes` | `Uint8Array` | - -#### Returns - -`void` - -#### Defined in - -[packages/trie/src/util/encoding.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L35) - -___ - -### nibblesToCompactBytes - -▸ **nibblesToCompactBytes**(`nibbles`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `nibbles` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/trie/src/util/encoding.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L55) - -___ - -### pathToHexKey - -▸ **pathToHexKey**(`path`, `extension`, `retType`): `Uint8Array` - -Takes a string path and extends it by the given extension nibbles - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `path` | `string` | String node path | -| `extension` | [`Nibbles`](README.md#nibbles) | nibbles to extend by | -| `retType` | `string` | string indicating whether to return the key in "keybyte" or "hex" encoding | - -#### Returns - -`Uint8Array` - -hex-encoded key - -#### Defined in - -[packages/trie/src/util/encoding.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L164) - -___ - -### verifyRangeProof - -▸ **verifyRangeProof**(`rootHash`, `firstKey`, `lastKey`, `keys`, `values`, `proof`, `useKeyHashingFunction`): `Promise`<`boolean`\> - -verifyRangeProof checks whether the given leaf nodes and edge proof -can prove the given trie leaves range is matched with the specific root. - -There are four situations: - -- All elements proof. In this case the proof can be null, but the range should - be all the leaves in the trie. - -- One element proof. In this case no matter the edge proof is a non-existent - proof or not, we can always verify the correctness of the proof. - -- Zero element proof. In this case a single non-existent proof is enough to prove. - Besides, if there are still some other leaves available on the right side, then - an error will be returned. - -- Two edge elements proof. In this case two existent or non-existent proof(first and last) should be provided. - -NOTE: Currently only supports verification when the length of firstKey and lastKey are the same. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `rootHash` | `Uint8Array` | root hash of state trie this proof is being verified against. | -| `firstKey` | ``null`` \| [`Nibbles`](README.md#nibbles) | first key of range being proven. | -| `lastKey` | ``null`` \| [`Nibbles`](README.md#nibbles) | last key of range being proven. | -| `keys` | [`Nibbles`](README.md#nibbles)[] | key list of leaf data being proven. | -| `values` | `Uint8Array`[] | value list of leaf data being proven, one-to-one correspondence with keys. | -| `proof` | ``null`` \| `Uint8Array`[] | proof node list, if all-elements-proof where no proof is needed, proof should be null, and both `firstKey` and `lastKey` must be null as well | -| `useKeyHashingFunction` | [`HashKeysFunction`](README.md#hashkeysfunction) | - | - -#### Returns - -`Promise`<`boolean`\> - -a flag to indicate whether there exists more trie node in the trie - -#### Defined in - -[packages/trie/src/proof/range.ts:411](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/proof/range.ts#L411) +- [bytesToNibbles](functions/bytesToNibbles.md) +- [byteTypeToNibbleType](functions/byteTypeToNibbleType.md) +- [compactBytesToNibbles](functions/compactBytesToNibbles.md) +- [createMerkleProof](functions/createMerkleProof.md) +- [createMPT](functions/createMPT.md) +- [createMPTFromProof](functions/createMPTFromProof.md) +- [decodeMPTNode](functions/decodeMPTNode.md) +- [decodeRawMPTNode](functions/decodeRawMPTNode.md) +- [genesisMPTStateRoot](functions/genesisMPTStateRoot.md) +- [hexToKeybytes](functions/hexToKeybytes.md) +- [isRawMPTNode](functions/isRawMPTNode.md) +- [mergeAndFormatKeyPaths](functions/mergeAndFormatKeyPaths.md) +- [nibblesToBytes](functions/nibblesToBytes.md) +- [nibblesToCompactBytes](functions/nibblesToCompactBytes.md) +- [nibbleTypeToByteType](functions/nibbleTypeToByteType.md) +- [pathToHexKey](functions/pathToHexKey.md) +- [updateMPTFromMerkleProof](functions/updateMPTFromMerkleProof.md) +- [verifyMerkleProof](functions/verifyMerkleProof.md) +- [verifyMerkleRangeProof](functions/verifyMerkleRangeProof.md) +- [verifyMPTWithMerkleProof](functions/verifyMPTWithMerkleProof.md) diff --git a/packages/mpt/docs/classes/BranchMPTNode.md b/packages/mpt/docs/classes/BranchMPTNode.md new file mode 100644 index 00000000000..a070ac03a6f --- /dev/null +++ b/packages/mpt/docs/classes/BranchMPTNode.md @@ -0,0 +1,149 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / BranchMPTNode + +# Class: BranchMPTNode + +Defined in: [packages/mpt/src/node/branch.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L5) + +## Constructors + +### Constructor + +> **new BranchMPTNode**(): `BranchMPTNode` + +Defined in: [packages/mpt/src/node/branch.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L9) + +#### Returns + +`BranchMPTNode` + +## Properties + +### \_branches + +> **\_branches**: [`BranchMPTNodeBranchValue`](../type-aliases/BranchMPTNodeBranchValue.md)[] + +Defined in: [packages/mpt/src/node/branch.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L6) + +*** + +### \_value + +> **\_value**: `null` \| `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/node/branch.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L7) + +## Methods + +### getBranch() + +> **getBranch**(`i`): [`BranchMPTNodeBranchValue`](../type-aliases/BranchMPTNodeBranchValue.md) + +Defined in: [packages/mpt/src/node/branch.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L41) + +#### Parameters + +##### i + +`number` + +#### Returns + +[`BranchMPTNodeBranchValue`](../type-aliases/BranchMPTNodeBranchValue.md) + +*** + +### getChildren() + +> **getChildren**(): \[`number`, [`NodeReferenceOrRawMPTNode`](../type-aliases/NodeReferenceOrRawMPTNode.md)\][] + +Defined in: [packages/mpt/src/node/branch.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L50) + +#### Returns + +\[`number`, [`NodeReferenceOrRawMPTNode`](../type-aliases/NodeReferenceOrRawMPTNode.md)\][] + +*** + +### raw() + +> **raw**(): [`BranchMPTNodeBranchValue`](../type-aliases/BranchMPTNodeBranchValue.md)[] + +Defined in: [packages/mpt/src/node/branch.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L33) + +#### Returns + +[`BranchMPTNodeBranchValue`](../type-aliases/BranchMPTNodeBranchValue.md)[] + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [packages/mpt/src/node/branch.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L37) + +#### Returns + +`Uint8Array` + +*** + +### setBranch() + +> **setBranch**(`i`, `v`): `void` + +Defined in: [packages/mpt/src/node/branch.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L29) + +#### Parameters + +##### i + +`number` + +##### v + +[`BranchMPTNodeBranchValue`](../type-aliases/BranchMPTNodeBranchValue.md) + +#### Returns + +`void` + +*** + +### value() + +> **value**(`v?`): `null` \| `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/node/branch.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L21) + +#### Parameters + +##### v? + +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`null` \| `Uint8Array`\<`ArrayBufferLike`\> + +*** + +### fromArray() + +> `static` **fromArray**(`arr`): `BranchMPTNode` + +Defined in: [packages/mpt/src/node/branch.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/branch.ts#L14) + +#### Parameters + +##### arr + +`Uint8Array`\<`ArrayBufferLike`\>[] + +#### Returns + +`BranchMPTNode` diff --git a/packages/mpt/docs/classes/BranchNode.md b/packages/mpt/docs/classes/BranchNode.md deleted file mode 100644 index 3b009db99b5..00000000000 --- a/packages/mpt/docs/classes/BranchNode.md +++ /dev/null @@ -1,177 +0,0 @@ -[@ethereumjs/trie](../README.md) / BranchNode - -# Class: BranchNode - -## Table of contents - -### Constructors - -- [constructor](BranchNode.md#constructor) - -### Properties - -- [\_branches](BranchNode.md#_branches) -- [\_value](BranchNode.md#_value) - -### Methods - -- [getBranch](BranchNode.md#getbranch) -- [getChildren](BranchNode.md#getchildren) -- [raw](BranchNode.md#raw) -- [serialize](BranchNode.md#serialize) -- [setBranch](BranchNode.md#setbranch) -- [value](BranchNode.md#value) -- [fromArray](BranchNode.md#fromarray) - -## Constructors - -### constructor - -• **new BranchNode**() - -#### Defined in - -[packages/trie/src/node/branch.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L9) - -## Properties - -### \_branches - -• **\_branches**: (``null`` \| [`EmbeddedNode`](../README.md#embeddednode))[] - -#### Defined in - -[packages/trie/src/node/branch.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L6) - -___ - -### \_value - -• **\_value**: ``null`` \| `Uint8Array` - -#### Defined in - -[packages/trie/src/node/branch.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L7) - -## Methods - -### getBranch - -▸ **getBranch**(`i`): ``null`` \| [`EmbeddedNode`](../README.md#embeddednode) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `i` | `number` | - -#### Returns - -``null`` \| [`EmbeddedNode`](../README.md#embeddednode) - -#### Defined in - -[packages/trie/src/node/branch.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L41) - -___ - -### getChildren - -▸ **getChildren**(): [`number`, [`EmbeddedNode`](../README.md#embeddednode)][] - -#### Returns - -[`number`, [`EmbeddedNode`](../README.md#embeddednode)][] - -#### Defined in - -[packages/trie/src/node/branch.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L50) - -___ - -### raw - -▸ **raw**(): (``null`` \| [`EmbeddedNode`](../README.md#embeddednode))[] - -#### Returns - -(``null`` \| [`EmbeddedNode`](../README.md#embeddednode))[] - -#### Defined in - -[packages/trie/src/node/branch.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L33) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/trie/src/node/branch.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L37) - -___ - -### setBranch - -▸ **setBranch**(`i`, `v`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `i` | `number` | -| `v` | ``null`` \| [`EmbeddedNode`](../README.md#embeddednode) | - -#### Returns - -`void` - -#### Defined in - -[packages/trie/src/node/branch.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L29) - -___ - -### value - -▸ **value**(`v?`): ``null`` \| `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `v?` | ``null`` \| `Uint8Array` | - -#### Returns - -``null`` \| `Uint8Array` - -#### Defined in - -[packages/trie/src/node/branch.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L21) - -___ - -### fromArray - -▸ `Static` **fromArray**(`arr`): [`BranchNode`](BranchNode.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `arr` | `Uint8Array`[] | - -#### Returns - -[`BranchNode`](BranchNode.md) - -#### Defined in - -[packages/trie/src/node/branch.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/branch.ts#L14) diff --git a/packages/mpt/docs/classes/CheckpointDB.md b/packages/mpt/docs/classes/CheckpointDB.md index 447200170b5..183cf4edce6 100644 --- a/packages/mpt/docs/classes/CheckpointDB.md +++ b/packages/mpt/docs/classes/CheckpointDB.md @@ -1,7 +1,13 @@ -[@ethereumjs/trie](../README.md) / CheckpointDB +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / CheckpointDB # Class: CheckpointDB +Defined in: [packages/mpt/src/db/checkpointDB.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L16) + DB is a thin wrapper around the underlying levelup db, which validates inputs and sets encoding type. @@ -9,226 +15,203 @@ which validates inputs and sets encoding type. - `DB` -## Table of contents +## Constructors -### Constructors +### Constructor -- [constructor](CheckpointDB.md#constructor) +> **new CheckpointDB**(`opts`): `CheckpointDB` -### Properties +Defined in: [packages/mpt/src/db/checkpointDB.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L50) -- [\_stats](CheckpointDB.md#_stats) -- [cacheSize](CheckpointDB.md#cachesize) -- [checkpoints](CheckpointDB.md#checkpoints) -- [db](CheckpointDB.md#db) +Initialize a DB instance. -### Methods +#### Parameters -- [batch](CheckpointDB.md#batch) -- [checkpoint](CheckpointDB.md#checkpoint) -- [commit](CheckpointDB.md#commit) -- [del](CheckpointDB.md#del) -- [get](CheckpointDB.md#get) -- [hasCheckpoints](CheckpointDB.md#hascheckpoints) -- [open](CheckpointDB.md#open) -- [put](CheckpointDB.md#put) -- [revert](CheckpointDB.md#revert) -- [setCheckpoints](CheckpointDB.md#setcheckpoints) -- [shallowCopy](CheckpointDB.md#shallowcopy) -- [stats](CheckpointDB.md#stats) +##### opts -## Constructors +[`CheckpointDBOpts`](../interfaces/CheckpointDBOpts.md) -### constructor +#### Returns -• **new CheckpointDB**(`opts`) +`CheckpointDB` -Initialize a DB instance. +## Properties -#### Parameters +### \_stats -| Name | Type | -| :------ | :------ | -| `opts` | [`CheckpointDBOpts`](../interfaces/CheckpointDBOpts.md) | +> **\_stats**: `object` -#### Defined in +Defined in: [packages/mpt/src/db/checkpointDB.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L34) -[packages/trie/src/db/checkpoint.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L50) +#### cache -## Properties +> **cache**: `object` -### \_stats +##### cache.hits -• **\_stats**: `Object` +> **hits**: `number` = `0` -#### Type declaration +##### cache.reads -| Name | Type | -| :------ | :------ | -| `cache` | { `hits`: `number` = 0; `reads`: `number` = 0; `writes`: `number` = 0 } | -| `cache.hits` | `number` | -| `cache.reads` | `number` | -| `cache.writes` | `number` | -| `db` | { `hits`: `number` = 0; `reads`: `number` = 0; `writes`: `number` = 0 } | -| `db.hits` | `number` | -| `db.reads` | `number` | -| `db.writes` | `number` | +> **reads**: `number` = `0` -#### Defined in +##### cache.writes -[packages/trie/src/db/checkpoint.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L34) +> **writes**: `number` = `0` -___ +#### db -### cacheSize +> **db**: `object` -• `Readonly` **cacheSize**: `number` +##### db.hits -#### Defined in +> **hits**: `number` = `0` -[packages/trie/src/db/checkpoint.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L19) +##### db.reads -___ +> **reads**: `number` = `0` -### checkpoints +##### db.writes -• **checkpoints**: [`Checkpoint`](../README.md#checkpoint)[] +> **writes**: `number` = `0` -#### Defined in +*** -[packages/trie/src/db/checkpoint.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L17) +### cacheSize -___ +> `readonly` **cacheSize**: `number` -### db +Defined in: [packages/mpt/src/db/checkpointDB.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L19) + +*** + +### checkpoints -• **db**: `DB`<`string`, `string` \| `Uint8Array`\> +> **checkpoints**: [`Checkpoint`](../type-aliases/Checkpoint.md)[] + +Defined in: [packages/mpt/src/db/checkpointDB.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L17) + +*** + +### db -#### Defined in +> **db**: `DB`\<`string`, `string` \| `Uint8Array`\<`ArrayBufferLike`\>\> -[packages/trie/src/db/checkpoint.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L18) +Defined in: [packages/mpt/src/db/checkpointDB.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L18) ## Methods -### batch +### batch() -▸ **batch**(`opStack`): `Promise`<`void`\> +> **batch**(`opStack`): `Promise`\<`void`\> -**`Inherit Doc`** +Defined in: [packages/mpt/src/db/checkpointDB.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L229) #### Parameters -| Name | Type | -| :------ | :------ | -| `opStack` | `BatchDBOp`<`Uint8Array`, `Uint8Array`\>[] | +##### opStack + +`BatchDBOp`[] #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Implementation of +#### Inherit Doc -DB.batch +#### Implementation of -#### Defined in +`DB.batch` -[packages/trie/src/db/checkpoint.ts:230](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L230) +*** -___ +### checkpoint() -### checkpoint +> **checkpoint**(`root`): `void` -▸ **checkpoint**(`root`): `void` +Defined in: [packages/mpt/src/db/checkpointDB.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L91) Adds a new checkpoint to the stack #### Parameters -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | +##### root + +`Uint8Array` #### Returns `void` -#### Defined in +*** -[packages/trie/src/db/checkpoint.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L92) +### commit() -___ +> **commit**(): `Promise`\<`void`\> -### commit - -▸ **commit**(): `Promise`<`void`\> +Defined in: [packages/mpt/src/db/checkpointDB.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L98) Commits the latest checkpoint #### Returns -`Promise`<`void`\> - -#### Defined in +`Promise`\<`void`\> -[packages/trie/src/db/checkpoint.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L99) +*** -___ +### del() -### del +> **del**(`key`): `Promise`\<`void`\> -▸ **del**(`key`): `Promise`<`void`\> - -**`Inherit Doc`** +Defined in: [packages/mpt/src/db/checkpointDB.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L207) #### Parameters -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | +##### key -#### Returns +`Uint8Array` -`Promise`<`void`\> +#### Returns -#### Implementation of +`Promise`\<`void`\> -DB.del +#### Inherit Doc -#### Defined in +#### Implementation of -[packages/trie/src/db/checkpoint.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L208) +`DB.del` -___ +*** -### get +### get() -▸ **get**(`key`): `Promise`<`undefined` \| `Uint8Array`\> +> **get**(`key`): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> -**`Inherit Doc`** +Defined in: [packages/mpt/src/db/checkpointDB.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L138) #### Parameters -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | +##### key + +`Uint8Array` #### Returns -`Promise`<`undefined` \| `Uint8Array`\> +`Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> -#### Implementation of +#### Inherit Doc -DB.get +#### Implementation of -#### Defined in +`DB.get` -[packages/trie/src/db/checkpoint.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L139) +*** -___ +### hasCheckpoints() -### hasCheckpoints +> **hasCheckpoints**(): `boolean` -▸ **hasCheckpoints**(): `boolean` +Defined in: [packages/mpt/src/db/checkpointDB.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L83) Is the DB during a checkpoint phase? @@ -236,141 +219,154 @@ Is the DB during a checkpoint phase? `boolean` -#### Defined in +*** -[packages/trie/src/db/checkpoint.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L84) +### open() -___ +> **open**(): `Promise`\<`void`\> -### open +Defined in: [packages/mpt/src/db/checkpointDB.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L291) -▸ **open**(): `Promise`<`void`\> +Opens the database -- if applicable #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -DB.open +`DB.open` + +*** -#### Defined in +### put() -[packages/trie/src/db/checkpoint.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L291) +> **put**(`key`, `value`): `Promise`\<`void`\> -___ +Defined in: [packages/mpt/src/db/checkpointDB.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L183) -### put +#### Parameters -▸ **put**(`key`, `value`): `Promise`<`void`\> +##### key -**`Inherit Doc`** +`Uint8Array` -#### Parameters +##### value -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | -| `value` | `Uint8Array` | +`Uint8Array` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Implementation of +#### Inherit Doc -DB.put +#### Implementation of -#### Defined in +`DB.put` -[packages/trie/src/db/checkpoint.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L184) +*** -___ +### revert() -### revert +> **revert**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **revert**(): `Promise`<`Uint8Array`\> +Defined in: [packages/mpt/src/db/checkpointDB.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L130) Reverts the latest checkpoint #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -#### Defined in +*** -[packages/trie/src/db/checkpoint.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L131) +### setCheckpoints() -___ +> **setCheckpoints**(`checkpoints`): `void` -### setCheckpoints - -▸ **setCheckpoints**(`checkpoints`): `void` +Defined in: [packages/mpt/src/db/checkpointDB.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L69) Flush the checkpoints and use the given checkpoints instead. #### Parameters -| Name | Type | -| :------ | :------ | -| `checkpoints` | [`Checkpoint`](../README.md#checkpoint)[] | +##### checkpoints + +[`Checkpoint`](../type-aliases/Checkpoint.md)[] #### Returns `void` -#### Defined in +*** -[packages/trie/src/db/checkpoint.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L70) +### shallowCopy() -___ +> **shallowCopy**(): `CheckpointDB` -### shallowCopy - -▸ **shallowCopy**(): [`CheckpointDB`](CheckpointDB.md) - -**`Inherit Doc`** +Defined in: [packages/mpt/src/db/checkpointDB.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L283) #### Returns -[`CheckpointDB`](CheckpointDB.md) +`CheckpointDB` -#### Implementation of +#### Inherit Doc -DB.shallowCopy +#### Implementation of -#### Defined in +`DB.shallowCopy` -[packages/trie/src/db/checkpoint.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L283) +*** -___ +### stats() -### stats +> **stats**(`reset`): `object` -▸ **stats**(`reset?`): `Object` +Defined in: [packages/mpt/src/db/checkpointDB.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/db/checkpointDB.ts#L261) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `reset` | `boolean` | `true` | +##### reset + +`boolean` = `true` #### Returns -`Object` +`object` + +##### cache + +> **cache**: `object` + +###### cache.hits + +> **hits**: `number` = `0` + +###### cache.reads + +> **reads**: `number` = `0` + +###### cache.writes + +> **writes**: `number` = `0` + +##### db + +> **db**: `object` + +###### db.hits + +> **hits**: `number` = `0` + +###### db.reads + +> **reads**: `number` = `0` + +###### db.writes -| Name | Type | -| :------ | :------ | -| `cache` | { `hits`: `number` = 0; `reads`: `number` = 0; `writes`: `number` = 0 } | -| `cache.hits` | `number` | -| `cache.reads` | `number` | -| `cache.writes` | `number` | -| `db` | { `hits`: `number` = 0; `reads`: `number` = 0; `writes`: `number` = 0 } | -| `db.hits` | `number` | -| `db.reads` | `number` | -| `db.writes` | `number` | -| `size` | `number` | +> **writes**: `number` = `0` -#### Defined in +##### size -[packages/trie/src/db/checkpoint.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L261) +> **size**: `number` diff --git a/packages/mpt/docs/classes/ExtensionMPTNode.md b/packages/mpt/docs/classes/ExtensionMPTNode.md new file mode 100644 index 00000000000..08367693f20 --- /dev/null +++ b/packages/mpt/docs/classes/ExtensionMPTNode.md @@ -0,0 +1,205 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / ExtensionMPTNode + +# Class: ExtensionMPTNode + +Defined in: [packages/mpt/src/node/extension.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extension.ts#L5) + +## Extends + +- `ExtensionOrLeafMPTNodeBase` + +## Constructors + +### Constructor + +> **new ExtensionMPTNode**(`nibbles`, `value`): `ExtensionMPTNode` + +Defined in: [packages/mpt/src/node/extension.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extension.ts#L6) + +#### Parameters + +##### nibbles + +[`Nibbles`](../type-aliases/Nibbles.md) + +##### value + +`Uint8Array` + +#### Returns + +`ExtensionMPTNode` + +#### Overrides + +`ExtensionOrLeafMPTNodeBase.constructor` + +## Properties + +### \_isLeaf + +> **\_isLeaf**: `boolean` + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L11) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase._isLeaf` + +*** + +### \_nibbles + +> **\_nibbles**: [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L9) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase._nibbles` + +*** + +### \_value + +> **\_value**: `Uint8Array` + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L10) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase._value` + +## Methods + +### encodedKey() + +> **encodedKey**(): [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L23) + +#### Returns + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.encodedKey` + +*** + +### key() + +> **key**(`k?`): [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L27) + +#### Parameters + +##### k? + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Returns + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.key` + +*** + +### keyLength() + +> **keyLength**(): `number` + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L35) + +#### Returns + +`number` + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.keyLength` + +*** + +### raw() + +> **raw**(): [`RawExtensionMPTNode`](../type-aliases/RawExtensionMPTNode.md) + +Defined in: [packages/mpt/src/node/extension.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extension.ts#L10) + +#### Returns + +[`RawExtensionMPTNode`](../type-aliases/RawExtensionMPTNode.md) + +#### Overrides + +`ExtensionOrLeafMPTNodeBase.raw` + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L51) + +#### Returns + +`Uint8Array` + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.serialize` + +*** + +### value() + +> **value**(`v?`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L39) + +#### Parameters + +##### v? + +`Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.value` + +*** + +### decodeKey() + +> `static` **decodeKey**(`key`): [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L19) + +#### Parameters + +##### key + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Returns + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.decodeKey` diff --git a/packages/mpt/docs/classes/ExtensionNode.md b/packages/mpt/docs/classes/ExtensionNode.md deleted file mode 100644 index 203516c3d4f..00000000000 --- a/packages/mpt/docs/classes/ExtensionNode.md +++ /dev/null @@ -1,259 +0,0 @@ -[@ethereumjs/trie](../README.md) / ExtensionNode - -# Class: ExtensionNode - -## Hierarchy - -- `Node` - - ↳ **`ExtensionNode`** - -## Table of contents - -### Constructors - -- [constructor](ExtensionNode.md#constructor) - -### Properties - -- [\_nibbles](ExtensionNode.md#_nibbles) -- [\_terminator](ExtensionNode.md#_terminator) -- [\_value](ExtensionNode.md#_value) - -### Methods - -- [encodedKey](ExtensionNode.md#encodedkey) -- [key](ExtensionNode.md#key) -- [keyLength](ExtensionNode.md#keylength) -- [raw](ExtensionNode.md#raw) -- [serialize](ExtensionNode.md#serialize) -- [value](ExtensionNode.md#value) -- [decodeKey](ExtensionNode.md#decodekey) -- [encodeKey](ExtensionNode.md#encodekey) - -## Constructors - -### constructor - -• **new ExtensionNode**(`nibbles`, `value`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `nibbles` | [`Nibbles`](../README.md#nibbles) | -| `value` | `Uint8Array` | - -#### Overrides - -Node.constructor - -#### Defined in - -[packages/trie/src/node/extension.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/extension.ts#L8) - -## Properties - -### \_nibbles - -• **\_nibbles**: [`Nibbles`](../README.md#nibbles) - -#### Inherited from - -Node.\_nibbles - -#### Defined in - -[packages/trie/src/node/node.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L9) - -___ - -### \_terminator - -• **\_terminator**: `boolean` - -#### Inherited from - -Node.\_terminator - -#### Defined in - -[packages/trie/src/node/node.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L11) - -___ - -### \_value - -• **\_value**: `Uint8Array` - -#### Inherited from - -Node.\_value - -#### Defined in - -[packages/trie/src/node/node.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L10) - -## Methods - -### encodedKey - -▸ **encodedKey**(): [`Nibbles`](../README.md#nibbles) - -#### Returns - -[`Nibbles`](../README.md#nibbles) - -#### Inherited from - -Node.encodedKey - -#### Defined in - -[packages/trie/src/node/node.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L43) - -___ - -### key - -▸ **key**(`k?`): [`Nibbles`](../README.md#nibbles) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `k?` | [`Nibbles`](../README.md#nibbles) | - -#### Returns - -[`Nibbles`](../README.md#nibbles) - -#### Inherited from - -Node.key - -#### Defined in - -[packages/trie/src/node/node.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L23) - -___ - -### keyLength - -▸ **keyLength**(): `number` - -#### Returns - -`number` - -#### Inherited from - -Node.keyLength - -#### Defined in - -[packages/trie/src/node/node.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L31) - -___ - -### raw - -▸ **raw**(): [`Uint8Array`, `Uint8Array`] - -#### Returns - -[`Uint8Array`, `Uint8Array`] - -#### Inherited from - -Node.raw - -#### Defined in - -[packages/trie/src/node/node.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L47) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Inherited from - -Node.serialize - -#### Defined in - -[packages/trie/src/node/node.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L51) - -___ - -### value - -▸ **value**(`v?`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `v?` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Inherited from - -Node.value - -#### Defined in - -[packages/trie/src/node/node.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L35) - -___ - -### decodeKey - -▸ `Static` **decodeKey**(`key`): [`Nibbles`](../README.md#nibbles) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | [`Nibbles`](../README.md#nibbles) | - -#### Returns - -[`Nibbles`](../README.md#nibbles) - -#### Inherited from - -Node.decodeKey - -#### Defined in - -[packages/trie/src/node/node.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L19) - -___ - -### encodeKey - -▸ `Static` **encodeKey**(`key`): [`Nibbles`](../README.md#nibbles) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | [`Nibbles`](../README.md#nibbles) | - -#### Returns - -[`Nibbles`](../README.md#nibbles) - -#### Defined in - -[packages/trie/src/node/extension.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/extension.ts#L12) diff --git a/packages/mpt/docs/classes/LeafMPTNode.md b/packages/mpt/docs/classes/LeafMPTNode.md new file mode 100644 index 00000000000..d9eac65d06b --- /dev/null +++ b/packages/mpt/docs/classes/LeafMPTNode.md @@ -0,0 +1,205 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / LeafMPTNode + +# Class: LeafMPTNode + +Defined in: [packages/mpt/src/node/leaf.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/leaf.ts#L5) + +## Extends + +- `ExtensionOrLeafMPTNodeBase` + +## Constructors + +### Constructor + +> **new LeafMPTNode**(`nibbles`, `value`): `LeafMPTNode` + +Defined in: [packages/mpt/src/node/leaf.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/leaf.ts#L6) + +#### Parameters + +##### nibbles + +[`Nibbles`](../type-aliases/Nibbles.md) + +##### value + +`Uint8Array` + +#### Returns + +`LeafMPTNode` + +#### Overrides + +`ExtensionOrLeafMPTNodeBase.constructor` + +## Properties + +### \_isLeaf + +> **\_isLeaf**: `boolean` + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L11) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase._isLeaf` + +*** + +### \_nibbles + +> **\_nibbles**: [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L9) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase._nibbles` + +*** + +### \_value + +> **\_value**: `Uint8Array` + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L10) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase._value` + +## Methods + +### encodedKey() + +> **encodedKey**(): [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L23) + +#### Returns + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.encodedKey` + +*** + +### key() + +> **key**(`k?`): [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L27) + +#### Parameters + +##### k? + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Returns + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.key` + +*** + +### keyLength() + +> **keyLength**(): `number` + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L35) + +#### Returns + +`number` + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.keyLength` + +*** + +### raw() + +> **raw**(): [`RawLeafMPTNode`](../type-aliases/RawLeafMPTNode.md) + +Defined in: [packages/mpt/src/node/leaf.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/leaf.ts#L10) + +#### Returns + +[`RawLeafMPTNode`](../type-aliases/RawLeafMPTNode.md) + +#### Overrides + +`ExtensionOrLeafMPTNodeBase.raw` + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L51) + +#### Returns + +`Uint8Array` + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.serialize` + +*** + +### value() + +> **value**(`v?`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L39) + +#### Parameters + +##### v? + +`Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.value` + +*** + +### decodeKey() + +> `static` **decodeKey**(`key`): [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/node/extensionOrLeafNodeBase.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/extensionOrLeafNodeBase.ts#L19) + +#### Parameters + +##### key + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Returns + +[`Nibbles`](../type-aliases/Nibbles.md) + +#### Inherited from + +`ExtensionOrLeafMPTNodeBase.decodeKey` diff --git a/packages/mpt/docs/classes/LeafNode.md b/packages/mpt/docs/classes/LeafNode.md deleted file mode 100644 index 0ebce1040f4..00000000000 --- a/packages/mpt/docs/classes/LeafNode.md +++ /dev/null @@ -1,259 +0,0 @@ -[@ethereumjs/trie](../README.md) / LeafNode - -# Class: LeafNode - -## Hierarchy - -- `Node` - - ↳ **`LeafNode`** - -## Table of contents - -### Constructors - -- [constructor](LeafNode.md#constructor) - -### Properties - -- [\_nibbles](LeafNode.md#_nibbles) -- [\_terminator](LeafNode.md#_terminator) -- [\_value](LeafNode.md#_value) - -### Methods - -- [encodedKey](LeafNode.md#encodedkey) -- [key](LeafNode.md#key) -- [keyLength](LeafNode.md#keylength) -- [raw](LeafNode.md#raw) -- [serialize](LeafNode.md#serialize) -- [value](LeafNode.md#value) -- [decodeKey](LeafNode.md#decodekey) -- [encodeKey](LeafNode.md#encodekey) - -## Constructors - -### constructor - -• **new LeafNode**(`nibbles`, `value`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `nibbles` | [`Nibbles`](../README.md#nibbles) | -| `value` | `Uint8Array` | - -#### Overrides - -Node.constructor - -#### Defined in - -[packages/trie/src/node/leaf.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/leaf.ts#L8) - -## Properties - -### \_nibbles - -• **\_nibbles**: [`Nibbles`](../README.md#nibbles) - -#### Inherited from - -Node.\_nibbles - -#### Defined in - -[packages/trie/src/node/node.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L9) - -___ - -### \_terminator - -• **\_terminator**: `boolean` - -#### Inherited from - -Node.\_terminator - -#### Defined in - -[packages/trie/src/node/node.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L11) - -___ - -### \_value - -• **\_value**: `Uint8Array` - -#### Inherited from - -Node.\_value - -#### Defined in - -[packages/trie/src/node/node.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L10) - -## Methods - -### encodedKey - -▸ **encodedKey**(): [`Nibbles`](../README.md#nibbles) - -#### Returns - -[`Nibbles`](../README.md#nibbles) - -#### Inherited from - -Node.encodedKey - -#### Defined in - -[packages/trie/src/node/node.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L43) - -___ - -### key - -▸ **key**(`k?`): [`Nibbles`](../README.md#nibbles) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `k?` | [`Nibbles`](../README.md#nibbles) | - -#### Returns - -[`Nibbles`](../README.md#nibbles) - -#### Inherited from - -Node.key - -#### Defined in - -[packages/trie/src/node/node.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L23) - -___ - -### keyLength - -▸ **keyLength**(): `number` - -#### Returns - -`number` - -#### Inherited from - -Node.keyLength - -#### Defined in - -[packages/trie/src/node/node.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L31) - -___ - -### raw - -▸ **raw**(): [`Uint8Array`, `Uint8Array`] - -#### Returns - -[`Uint8Array`, `Uint8Array`] - -#### Inherited from - -Node.raw - -#### Defined in - -[packages/trie/src/node/node.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L47) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Inherited from - -Node.serialize - -#### Defined in - -[packages/trie/src/node/node.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L51) - -___ - -### value - -▸ **value**(`v?`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `v?` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Inherited from - -Node.value - -#### Defined in - -[packages/trie/src/node/node.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L35) - -___ - -### decodeKey - -▸ `Static` **decodeKey**(`key`): [`Nibbles`](../README.md#nibbles) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | [`Nibbles`](../README.md#nibbles) | - -#### Returns - -[`Nibbles`](../README.md#nibbles) - -#### Inherited from - -Node.decodeKey - -#### Defined in - -[packages/trie/src/node/node.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/node.ts#L19) - -___ - -### encodeKey - -▸ `Static` **encodeKey**(`key`): [`Nibbles`](../README.md#nibbles) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | [`Nibbles`](../README.md#nibbles) | - -#### Returns - -[`Nibbles`](../README.md#nibbles) - -#### Defined in - -[packages/trie/src/node/leaf.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/node/leaf.ts#L12) diff --git a/packages/mpt/docs/classes/MerklePatriciaTrie.md b/packages/mpt/docs/classes/MerklePatriciaTrie.md new file mode 100644 index 00000000000..6bb1486cbf2 --- /dev/null +++ b/packages/mpt/docs/classes/MerklePatriciaTrie.md @@ -0,0 +1,584 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / MerklePatriciaTrie + +# Class: MerklePatriciaTrie + +Defined in: [packages/mpt/src/mpt.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L55) + +The basic trie interface, use with `import { MerklePatriciaTrie } from '@ethereumjs/mpt'`. + +## Constructors + +### Constructor + +> **new MerklePatriciaTrie**(`opts?`): `MerklePatriciaTrie` + +Defined in: [packages/mpt/src/mpt.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L86) + +Creates a new trie. + +#### Parameters + +##### opts? + +[`MPTOpts`](../interfaces/MPTOpts.md) + +Options for instantiating the trie + +Note: in most cases, [createMPT](../functions/createMPT.md) constructor should be used. It uses the same API but provides sensible defaults + +#### Returns + +`MerklePatriciaTrie` + +## Properties + +### EMPTY\_TRIE\_ROOT + +> **EMPTY\_TRIE\_ROOT**: `Uint8Array` + +Defined in: [packages/mpt/src/mpt.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L67) + +The root for an empty trie + +*** + +### walkTrieIterable() + +> **walkTrieIterable**: (...`args`) => `AsyncIterable` + +Defined in: [packages/mpt/src/mpt.ts:464](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L464) + +#### Parameters + +##### args + +...\[`Uint8Array`\<`ArrayBufferLike`\>, `number`[], `OnFound`, `NodeFilter`, `Set`\<`string`\>\] + +#### Returns + +`AsyncIterable` + +## Methods + +### batch() + +> **batch**(`ops`, `skipKeyTransform?`): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:872](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L872) + +The given hash of operations (key additions or deletions) are executed on the trie +(delete operations are only executed on DB with `deleteFromDB` set to `true`) + +#### Parameters + +##### ops + +`BatchDBOp`[] + +##### skipKeyTransform? + +`boolean` + +#### Returns + +`Promise`\<`void`\> + +#### Example + +```ts +const ops = [ + { type: 'del', key: Uint8Array.from('father') } + , { type: 'put', key: Uint8Array.from('name'), value: Uint8Array.from('Yuri Irsenovich Kim') } // cspell:disable-line + , { type: 'put', key: Uint8Array.from('dob'), value: Uint8Array.from('16 February 1941') } + , { type: 'put', key: Uint8Array.from('spouse'), value: Uint8Array.from('Kim Young-sook') } // cspell:disable-line + , { type: 'put', key: Uint8Array.from('occupation'), value: Uint8Array.from('Clown') } +] +await trie.batch(ops) +``` + +*** + +### checkpoint() + +> **checkpoint**(): `void` + +Defined in: [packages/mpt/src/mpt.ts:1036](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L1036) + +Creates a checkpoint that can later be reverted to or committed. +After this is called, all changes can be reverted until `commit` is called. + +#### Returns + +`void` + +*** + +### checkRoot() + +> **checkRoot**(`root`): `Promise`\<`boolean`\> + +Defined in: [packages/mpt/src/mpt.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L172) + +Checks if a given root exists. + +#### Parameters + +##### root + +`Uint8Array` + +#### Returns + +`Promise`\<`boolean`\> + +*** + +### commit() + +> **commit**(): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:1046](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L1046) + +Commits a checkpoint to disk, if current checkpoint is not nested. +If nested, only sets the parent checkpoint as current checkpoint. + +#### Returns + +`Promise`\<`void`\> + +#### Throws + +If not during a checkpoint phase + +*** + +### database() + +> **database**(`db?`, `valueEncoding?`): [`CheckpointDB`](CheckpointDB.md) + +Defined in: [packages/mpt/src/mpt.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L137) + +#### Parameters + +##### db? + +`DB`\<`string`, `string` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +##### valueEncoding? + +`ValueEncoding` + +#### Returns + +[`CheckpointDB`](CheckpointDB.md) + +*** + +### del() + +> **del**(`key`, `skipKeyTransform`): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:278](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L278) + +Deletes a value given a `key` from the trie +(delete operations are only executed on DB with `deleteFromDB` set to `true`) + +#### Parameters + +##### key + +`Uint8Array` + +##### skipKeyTransform + +`boolean` = `false` + +#### Returns + +`Promise`\<`void`\> + +A Promise that resolves once value is deleted. + +*** + +### findPath() + +> **findPath**(`key`, `throwIfMissing`, `partialPath`): `Promise`\<[`Path`](../interfaces/Path.md)\> + +Defined in: [packages/mpt/src/mpt.ts:321](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L321) + +Tries to find a path to the node for the given key. +It returns a `stack` of nodes to the closest node. + +#### Parameters + +##### key + +`Uint8Array` + +the search key + +##### throwIfMissing + +`boolean` = `false` + +if true, throws if any nodes are missing. Used for verifying proofs. (default: false) + +##### partialPath + +###### stack + +[`MPTNode`](../type-aliases/MPTNode.md)[] + +#### Returns + +`Promise`\<[`Path`](../interfaces/Path.md)\> + +*** + +### flushCheckpoints() + +> **flushCheckpoints**(): `void` + +Defined in: [packages/mpt/src/mpt.ts:1078](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L1078) + +Flushes all checkpoints, restoring the initial checkpoint state. + +#### Returns + +`void` + +*** + +### get() + +> **get**(`key`, `throwIfMissing`): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/mpt/src/mpt.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L191) + +Gets a value given a `key` + +#### Parameters + +##### key + +`Uint8Array` + +the key to search for + +##### throwIfMissing + +`boolean` = `false` + +if true, throws if any nodes are missing. Used for verifying proofs. (default: false) + +#### Returns + +`Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +A Promise that resolves to `Uint8Array` if a value was found or `null` if no value was found. + +*** + +### getValueMap() + +> **getValueMap**(`startKey`, `limit?`): `Promise`\<\{ `nextKey`: `null` \| `string`; `values`: \{[`key`: `string`]: `string`; \}; \}\> + +Defined in: [packages/mpt/src/mpt.ts:1090](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L1090) + +Returns a list of values stored in the trie + +#### Parameters + +##### startKey + +`bigint` = `BIGINT_0` + +first unhashed key in the range to be returned (defaults to 0). Note, all keys must be of the same length or undefined behavior will result + +##### limit? + +`number` + +the number of keys to be returned (undefined means all keys) + +#### Returns + +`Promise`\<\{ `nextKey`: `null` \| `string`; `values`: \{[`key`: `string`]: `string`; \}; \}\> + +an object with two properties (a map of all key/value pairs in the trie - or in the specified range) and then a `nextKey` reference if a range is specified + +*** + +### hasCheckpoints() + +> **hasCheckpoints**(): `boolean` + +Defined in: [packages/mpt/src/mpt.ts:1028](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L1028) + +Is the trie during a checkpoint phase? + +#### Returns + +`boolean` + +*** + +### lookupNode() + +> **lookupNode**(`node`): `Promise`\<[`MPTNode`](../type-aliases/MPTNode.md)\> + +Defined in: [packages/mpt/src/mpt.ts:515](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L515) + +Retrieves a node from db by hash. + +#### Parameters + +##### node + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +#### Returns + +`Promise`\<[`MPTNode`](../type-aliases/MPTNode.md)\> + +*** + +### persistRoot() + +> **persistRoot**(): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:975](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L975) + +Persists the root hash in the underlying database + +#### Returns + +`Promise`\<`void`\> + +*** + +### put() + +> **put**(`key`, `value`, `skipKeyTransform`): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L209) + +Stores a given `value` at the given `key` or do a delete if `value` is empty +(delete operations are only executed on DB with `deleteFromDB` set to `true`) + +#### Parameters + +##### key + +`Uint8Array` + +##### value + +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +##### skipKeyTransform + +`boolean` = `false` + +#### Returns + +`Promise`\<`void`\> + +A Promise that resolves once value is stored. + +*** + +### revert() + +> **revert**(): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:1062](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L1062) + +Reverts the trie to the state it was at when `checkpoint` was first called. +If during a nested checkpoint, sets root to most recent checkpoint, and sets +parent checkpoint as current. + +#### Returns + +`Promise`\<`void`\> + +*** + +### root() + +> **root**(`value?`): `Uint8Array` + +Defined in: [packages/mpt/src/mpt.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L152) + +Gets and/or Sets the current root of the `trie` + +#### Parameters + +##### value? + +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`Uint8Array` + +*** + +### saveStack() + +> **saveStack**(`key`, `stack`, `opStack`): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:786](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L786) + +Saves a stack of nodes to the database. + +#### Parameters + +##### key + +[`Nibbles`](../type-aliases/Nibbles.md) + +the key. Should follow the stack + +##### stack + +[`MPTNode`](../type-aliases/MPTNode.md)[] + +a stack of nodes to the value given by the key + +##### opStack + +`BatchDBOp`[] + +a stack of levelup operations to commit at the end of this function + +#### Returns + +`Promise`\<`void`\> + +*** + +### shallowCopy() + +> **shallowCopy**(`includeCheckpoints`, `opts?`): `MerklePatriciaTrie` + +Defined in: [packages/mpt/src/mpt.ts:958](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L958) + +Returns a copy of the underlying trie. + +Note on db: the copy will create a reference to the +same underlying database. + +Note on cache: for memory reasons a copy will by default +not recreate a new LRU cache but initialize with cache +being deactivated. This behavior can be overwritten by +explicitly setting `cacheSize` as an option on the method. + +#### Parameters + +##### includeCheckpoints + +`boolean` = `true` + +If true and during a checkpoint, the copy will contain the checkpointing metadata and will use the same scratch as underlying db. + +##### opts? + +[`TrieShallowCopyOpts`](../interfaces/TrieShallowCopyOpts.md) + +#### Returns + +`MerklePatriciaTrie` + +*** + +### verifyPrunedIntegrity() + +> **verifyPrunedIntegrity**(): `Promise`\<`boolean`\> + +Defined in: [packages/mpt/src/mpt.ts:890](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L890) + +#### Returns + +`Promise`\<`boolean`\> + +*** + +### walkAllNodes() + +> **walkAllNodes**(`onFound`): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:471](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L471) + +Executes a callback for each node in the trie. + +#### Parameters + +##### onFound + +`OnFound` + +callback to call when a node is found. + +#### Returns + +`Promise`\<`void`\> + +Resolves when finished walking trie. + +*** + +### walkAllValueNodes() + +> **walkAllValueNodes**(`onFound`): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:482](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L482) + +Executes a callback for each value node in the trie. + +#### Parameters + +##### onFound + +`OnFound` + +callback to call when a node is found. + +#### Returns + +`Promise`\<`void`\> + +Resolves when finished walking trie. + +*** + +### walkTrie() + +> **walkTrie**(`root`, `onFound`): `Promise`\<`void`\> + +Defined in: [packages/mpt/src/mpt.ts:460](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/mpt.ts#L460) + +Walks a trie until finished. + +#### Parameters + +##### root + +`Uint8Array` + +##### onFound + +[`FoundNodeFunction`](../type-aliases/FoundNodeFunction.md) + +callback to call when a node is found. This schedules new tasks. If no tasks are available, the Promise resolves. + +#### Returns + +`Promise`\<`void`\> + +Resolves when finished walking trie. diff --git a/packages/mpt/docs/classes/PrioritizedTaskExecutor.md b/packages/mpt/docs/classes/PrioritizedTaskExecutor.md deleted file mode 100644 index eb244ae4c67..00000000000 --- a/packages/mpt/docs/classes/PrioritizedTaskExecutor.md +++ /dev/null @@ -1,3 +0,0 @@ -[@ethereumjs/trie](../README.md) / PrioritizedTaskExecutor - -# Class: PrioritizedTaskExecutor diff --git a/packages/mpt/docs/classes/Trie.md b/packages/mpt/docs/classes/Trie.md deleted file mode 100644 index f69e040cb57..00000000000 --- a/packages/mpt/docs/classes/Trie.md +++ /dev/null @@ -1,878 +0,0 @@ -[@ethereumjs/trie](../README.md) / Trie - -# Class: Trie - -The basic trie interface, use with `import { Trie } from '@ethereumjs/trie'`. - -## Table of contents - -### Constructors - -- [constructor](Trie.md#constructor) - -### Properties - -- [EMPTY\_TRIE\_ROOT](Trie.md#empty_trie_root) -- [walkTrieIterable](Trie.md#walktrieiterable) - -### Methods - -- [batch](Trie.md#batch) -- [checkRoot](Trie.md#checkroot) -- [checkpoint](Trie.md#checkpoint) -- [commit](Trie.md#commit) -- [createProof](Trie.md#createproof) -- [createReadStream](Trie.md#createreadstream) -- [database](Trie.md#database) -- [del](Trie.md#del) -- [findPath](Trie.md#findpath) -- [flushCheckpoints](Trie.md#flushcheckpoints) -- [fromProof](Trie.md#fromproof) -- [get](Trie.md#get) -- [hasCheckpoints](Trie.md#hascheckpoints) -- [lookupNode](Trie.md#lookupnode) -- [persistRoot](Trie.md#persistroot) -- [put](Trie.md#put) -- [revert](Trie.md#revert) -- [root](Trie.md#root) -- [saveStack](Trie.md#savestack) -- [shallowCopy](Trie.md#shallowcopy) -- [updateFromProof](Trie.md#updatefromproof) -- [verifyProof](Trie.md#verifyproof) -- [verifyPrunedIntegrity](Trie.md#verifyprunedintegrity) -- [verifyRangeProof](Trie.md#verifyrangeproof) -- [walkAllNodes](Trie.md#walkallnodes) -- [walkAllValueNodes](Trie.md#walkallvaluenodes) -- [walkTrie](Trie.md#walktrie) -- [create](Trie.md#create) -- [createFromProof](Trie.md#createfromproof) -- [fromProof](Trie.md#fromproof-1) -- [verifyProof](Trie.md#verifyproof-1) -- [verifyRangeProof](Trie.md#verifyrangeproof-1) - -## Constructors - -### constructor - -• **new Trie**(`opts?`) - -Creates a new trie. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts?` | [`TrieOpts`](../interfaces/TrieOpts.md) | Options for instantiating the trie Note: in most cases, the static [create](Trie.md#create) constructor should be used. It uses the same API but provides sensible defaults | - -#### Defined in - -[packages/trie/src/trie.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L85) - -## Properties - -### EMPTY\_TRIE\_ROOT - -• **EMPTY\_TRIE\_ROOT**: `Uint8Array` - -The root for an empty trie - -#### Defined in - -[packages/trie/src/trie.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L66) - -___ - -### walkTrieIterable - -• **walkTrieIterable**: (...`args`: [nodeHash: Uint8Array, currentKey: number[], onFound: OnFound, filter: NodeFilter, visited: Set]) => `AsyncIterable`<{ `currentKey`: `number`[] ; `node`: [`TrieNode`](../README.md#trienode) }\> - -#### Type declaration - -▸ (...`args`): `AsyncIterable`<{ `currentKey`: `number`[] ; `node`: [`TrieNode`](../README.md#trienode) }\> - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `...args` | [nodeHash: Uint8Array, currentKey: number[], onFound: OnFound, filter: NodeFilter, visited: Set] | - -##### Returns - -`AsyncIterable`<{ `currentKey`: `number`[] ; `node`: [`TrieNode`](../README.md#trienode) }\> - -#### Defined in - -[packages/trie/src/trie.ts:738](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L738) - -## Methods - -### batch - -▸ **batch**(`ops`, `skipKeyTransform?`): `Promise`<`void`\> - -The given hash of operations (key additions or deletions) are executed on the trie -(delete operations are only executed on DB with `deleteFromDB` set to `true`) - -**`Example`** - -```ts -const ops = [ - { type: 'del', key: Uint8Array.from('father') } - , { type: 'put', key: Uint8Array.from('name'), value: Uint8Array.from('Yuri Irsenovich Kim') } - , { type: 'put', key: Uint8Array.from('dob'), value: Uint8Array.from('16 February 1941') } - , { type: 'put', key: Uint8Array.from('spouse'), value: Uint8Array.from('Kim Young-sook') } - , { type: 'put', key: Uint8Array.from('occupation'), value: Uint8Array.from('Clown') } -] -await trie.batch(ops) -``` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `ops` | `BatchDBOp`<`Uint8Array`, `Uint8Array`\>[] | -| `skipKeyTransform?` | `boolean` | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[packages/trie/src/trie.ts:1139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1139) - -___ - -### checkRoot - -▸ **checkRoot**(`root`): `Promise`<`boolean`\> - -Checks if a given root exists. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | - -#### Returns - -`Promise`<`boolean`\> - -#### Defined in - -[packages/trie/src/trie.ts:458](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L458) - -___ - -### checkpoint - -▸ **checkpoint**(): `void` - -Creates a checkpoint that can later be reverted to or committed. -After this is called, all changes can be reverted until `commit` is called. - -#### Returns - -`void` - -#### Defined in - -[packages/trie/src/trie.ts:1306](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1306) - -___ - -### commit - -▸ **commit**(): `Promise`<`void`\> - -Commits a checkpoint to disk, if current checkpoint is not nested. -If nested, only sets the parent checkpoint as current checkpoint. - -**`Throws`** - -If not during a checkpoint phase - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[packages/trie/src/trie.ts:1316](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1316) - -___ - -### createProof - -▸ **createProof**(`key`): `Promise`<[`Proof`](../README.md#proof)\> - -Creates a proof from a trie and key that can be verified using [verifyProof](Trie.md#verifyproof-1). An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains -the encoded trie nodes from the root node to the leaf node storing state data. The returned proof will be in the format of an array that contains Uint8Arrays of -serialized branch, extension, and/or leaf nodes. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `Uint8Array` | key to create a proof for | - -#### Returns - -`Promise`<[`Proof`](../README.md#proof)\> - -#### Defined in - -[packages/trie/src/trie.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L269) - -___ - -### createReadStream - -▸ **createReadStream**(): [`TrieReadStream`](TrieReadStream.md) - -The `data` event is given an `Object` that has two properties; the `key` and the `value`. Both should be Uint8Arrays. - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -Returns a [stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_class_stream_readable) of the contents of the `trie` - -#### Defined in - -[packages/trie/src/trie.ts:1211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1211) - -___ - -### database - -▸ **database**(`db?`, `valueEncoding?`): [`CheckpointDB`](CheckpointDB.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `db?` | `DB`<`string`, `string` \| `Uint8Array`\> | -| `valueEncoding?` | `ValueEncoding` | - -#### Returns - -[`CheckpointDB`](CheckpointDB.md) - -#### Defined in - -[packages/trie/src/trie.ts:423](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L423) - -___ - -### del - -▸ **del**(`key`, `skipKeyTransform?`): `Promise`<`void`\> - -Deletes a value given a `key` from the trie -(delete operations are only executed on DB with `deleteFromDB` set to `true`) - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `key` | `Uint8Array` | `undefined` | -| `skipKeyTransform` | `boolean` | `false` | - -#### Returns - -`Promise`<`void`\> - -A Promise that resolves once value is deleted. - -#### Defined in - -[packages/trie/src/trie.ts:559](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L559) - -___ - -### findPath - -▸ **findPath**(`key`, `throwIfMissing?`, `partialPath?`): `Promise`<[`Path`](../interfaces/Path.md)\> - -Tries to find a path to the node for the given key. -It returns a `stack` of nodes to the closest node. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `key` | `Uint8Array` | `undefined` | the search key | -| `throwIfMissing` | `boolean` | `false` | if true, throws if any nodes are missing. Used for verifying proofs. (default: false) | -| `partialPath` | `Object` | `undefined` | - | -| `partialPath.stack` | [`TrieNode`](../README.md#trienode)[] | `undefined` | - | - -#### Returns - -`Promise`<[`Path`](../interfaces/Path.md)\> - -#### Defined in - -[packages/trie/src/trie.ts:599](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L599) - -___ - -### flushCheckpoints - -▸ **flushCheckpoints**(): `void` - -Flushes all checkpoints, restoring the initial checkpoint state. - -#### Returns - -`void` - -#### Defined in - -[packages/trie/src/trie.ts:1348](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1348) - -___ - -### fromProof - -▸ **fromProof**(`proof`): `Promise`<`void`\> - -Create a trie from a given (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof. An EIP-1186 proof contains the encoded trie nodes from the root -node to the leaf node storing state data. This function does not check if the proof has the same expected root. A static version of this function exists -with the same name. - -**`Deprecated`** - -Use `updateFromProof` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `proof` | [`Proof`](../README.md#proof) | an EIP-1186 proof to update the trie from | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[packages/trie/src/trie.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L369) - -___ - -### get - -▸ **get**(`key`, `throwIfMissing?`): `Promise`<``null`` \| `Uint8Array`\> - -Gets a value given a `key` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `key` | `Uint8Array` | `undefined` | the key to search for | -| `throwIfMissing` | `boolean` | `false` | if true, throws if any nodes are missing. Used for verifying proofs. (default: false) | - -#### Returns - -`Promise`<``null`` \| `Uint8Array`\> - -A Promise that resolves to `Uint8Array` if a value was found or `null` if no value was found. - -#### Defined in - -[packages/trie/src/trie.ts:477](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L477) - -___ - -### hasCheckpoints - -▸ **hasCheckpoints**(): `boolean` - -Is the trie during a checkpoint phase? - -#### Returns - -`boolean` - -#### Defined in - -[packages/trie/src/trie.ts:1298](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1298) - -___ - -### lookupNode - -▸ **lookupNode**(`node`): `Promise`<[`TrieNode`](../README.md#trienode)\> - -Retrieves a node from db by hash. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `node` | `Uint8Array` \| `Uint8Array`[] | - -#### Returns - -`Promise`<[`TrieNode`](../README.md#trienode)\> - -#### Defined in - -[packages/trie/src/trie.ts:787](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L787) - -___ - -### persistRoot - -▸ **persistRoot**(): `Promise`<`void`\> - -Persists the root hash in the underlying database - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[packages/trie/src/trie.ts:1245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1245) - -___ - -### put - -▸ **put**(`key`, `value`, `skipKeyTransform?`): `Promise`<`void`\> - -Stores a given `value` at the given `key` or do a delete if `value` is empty -(delete operations are only executed on DB with `deleteFromDB` set to `true`) - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `key` | `Uint8Array` | `undefined` | -| `value` | ``null`` \| `Uint8Array` | `undefined` | -| `skipKeyTransform` | `boolean` | `false` | - -#### Returns - -`Promise`<`void`\> - -A Promise that resolves once value is stored. - -#### Defined in - -[packages/trie/src/trie.ts:495](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L495) - -___ - -### revert - -▸ **revert**(): `Promise`<`void`\> - -Reverts the trie to the state it was at when `checkpoint` was first called. -If during a nested checkpoint, sets root to most recent checkpoint, and sets -parent checkpoint as current. - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[packages/trie/src/trie.ts:1332](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1332) - -___ - -### root - -▸ **root**(`value?`): `Uint8Array` - -Gets and/or Sets the current root of the `trie` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value?` | ``null`` \| `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/trie/src/trie.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L438) - -___ - -### saveStack - -▸ **saveStack**(`key`, `stack`, `opStack`): `Promise`<`void`\> - -Saves a stack of nodes to the database. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | [`Nibbles`](../README.md#nibbles) | the key. Should follow the stack | -| `stack` | [`TrieNode`](../README.md#trienode)[] | a stack of nodes to the value given by the key | -| `opStack` | `BatchDBOp`<`Uint8Array`, `Uint8Array`\>[] | a stack of levelup operations to commit at the end of this function | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[packages/trie/src/trie.ts:1053](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1053) - -___ - -### shallowCopy - -▸ **shallowCopy**(`includeCheckpoints?`, `opts?`): [`Trie`](Trie.md) - -Returns a copy of the underlying trie. - -Note on db: the copy will create a reference to the -same underlying database. - -Note on cache: for memory reasons a copy will by default -not recreate a new LRU cache but initialize with cache -being deactivated. This behavior can be overwritten by -explicitly setting `cacheSize` as an option on the method. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `includeCheckpoints` | `boolean` | `true` | If true and during a checkpoint, the copy will contain the checkpointing metadata and will use the same scratch as underlying db. | -| `opts?` | [`TrieShallowCopyOpts`](../interfaces/TrieShallowCopyOpts.md) | `undefined` | - | - -#### Returns - -[`Trie`](Trie.md) - -#### Defined in - -[packages/trie/src/trie.ts:1228](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1228) - -___ - -### updateFromProof - -▸ **updateFromProof**(`proof`, `shouldVerifyRoot?`): `Promise`<`undefined` \| `Uint8Array`\> - -Updates a trie from a proof by putting all the nodes in the proof into the trie. If a trie is being updated with multiple proofs, {@param shouldVerifyRoot} can -be passed as false in order to not immediately throw on an unexpected root, so that root verification can happen after all proofs and their nodes have been added. -An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `proof` | [`Proof`](../README.md#proof) | `undefined` | An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof to update the trie from. | -| `shouldVerifyRoot` | `boolean` | `false` | If `true`, verifies that the root key of the proof matches the trie root. Throws if this is not the case. | - -#### Returns - -`Promise`<`undefined` \| `Uint8Array`\> - -The root of the proof - -#### Defined in - -[packages/trie/src/trie.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L287) - -___ - -### verifyProof - -▸ **verifyProof**(`rootHash`, `key`, `proof`): `Promise`<``null`` \| `Uint8Array`\> - -Verifies a proof by putting all of its nodes into a trie and attempting to get the proven key. An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof -contains the encoded trie nodes from the root node to the leaf node storing state data. A static version of this function exists with the same name. - -**`Throws`** - -If proof is found to be invalid. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `rootHash` | `Uint8Array` | Root hash of the trie that this proof was created from and is being verified for | -| `key` | `Uint8Array` | Key that is being verified and that the proof is created for | -| `proof` | [`Proof`](../README.md#proof) | an EIP-1186 proof to verify the key against | - -#### Returns - -`Promise`<``null`` \| `Uint8Array`\> - -The value from the key, or null if valid proof of non-existence. - -#### Defined in - -[packages/trie/src/trie.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L322) - -___ - -### verifyPrunedIntegrity - -▸ **verifyPrunedIntegrity**(): `Promise`<`boolean`\> - -#### Returns - -`Promise`<`boolean`\> - -#### Defined in - -[packages/trie/src/trie.ts:1157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1157) - -___ - -### verifyRangeProof - -▸ **verifyRangeProof**(`rootHash`, `firstKey`, `lastKey`, `keys`, `values`, `proof`): `Promise`<`boolean`\> - -A range proof is a proof that includes the encoded trie nodes from the root node to leaf node for one or more branches of a trie, -allowing an entire range of leaf nodes to be validated. This is useful in applications such as snap sync where contiguous ranges -of state trie data is received and validated for constructing world state, locally. Also see [verifyRangeProof](../README.md#verifyrangeproof). A static -version of this function also exists. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `rootHash` | `Uint8Array` | root hash of state trie this proof is being verified against. | -| `firstKey` | ``null`` \| `Uint8Array` | first key of range being proven. | -| `lastKey` | ``null`` \| `Uint8Array` | last key of range being proven. | -| `keys` | `Uint8Array`[] | key list of leaf data being proven. | -| `values` | `Uint8Array`[] | value list of leaf data being proven, one-to-one correspondence with keys. | -| `proof` | ``null`` \| `Uint8Array`[] | proof node list, if all-elements-proof where no proof is needed, proof should be null, and both `firstKey` and `lastKey` must be null as well | - -#### Returns - -`Promise`<`boolean`\> - -a flag to indicate whether there exists more trie node in the trie - -#### Defined in - -[packages/trie/src/trie.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L244) - -___ - -### walkAllNodes - -▸ **walkAllNodes**(`onFound`): `Promise`<`void`\> - -Executes a callback for each node in the trie. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `onFound` | `OnFound` | callback to call when a node is found. | - -#### Returns - -`Promise`<`void`\> - -Resolves when finished walking trie. - -#### Defined in - -[packages/trie/src/trie.ts:745](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L745) - -___ - -### walkAllValueNodes - -▸ **walkAllValueNodes**(`onFound`): `Promise`<`void`\> - -Executes a callback for each value node in the trie. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `onFound` | `OnFound` | callback to call when a node is found. | - -#### Returns - -`Promise`<`void`\> - -Resolves when finished walking trie. - -#### Defined in - -[packages/trie/src/trie.ts:756](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L756) - -___ - -### walkTrie - -▸ **walkTrie**(`root`, `onFound`): `Promise`<`void`\> - -Walks a trie until finished. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `root` | `Uint8Array` | | -| `onFound` | [`FoundNodeFunction`](../README.md#foundnodefunction) | callback to call when a node is found. This schedules new tasks. If no tasks are available, the Promise resolves. | - -#### Returns - -`Promise`<`void`\> - -Resolves when finished walking trie. - -#### Defined in - -[packages/trie/src/trie.ts:734](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L734) - -___ - -### create - -▸ `Static` **create**(`opts?`): `Promise`<[`Trie`](Trie.md)\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | [`TrieOpts`](../interfaces/TrieOpts.md) | - -#### Returns - -`Promise`<[`Trie`](Trie.md)\> - -#### Defined in - -[packages/trie/src/trie.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L382) - -___ - -### createFromProof - -▸ `Static` **createFromProof**(`proof`, `trieOpts?`, `shouldVerifyRoot?`): `Promise`<[`Trie`](Trie.md)\> - -Create a trie from a given (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof. A proof contains the encoded trie nodes -from the root node to the leaf node storing state data. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `proof` | [`Proof`](../README.md#proof) | `undefined` | an EIP-1186 proof to create trie from | -| `trieOpts?` | [`TrieOpts`](../interfaces/TrieOpts.md) | `undefined` | trie opts to be applied to returned trie | -| `shouldVerifyRoot` | `boolean` | `false` | If `true`, verifies that the root key of the proof matches the trie root. Throws if this is not the case. | - -#### Returns - -`Promise`<[`Trie`](Trie.md)\> - -new trie created from given proof - -#### Defined in - -[packages/trie/src/trie.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L144) - -___ - -### fromProof - -▸ `Static` **fromProof**(`proof`, `opts?`): `Promise`<[`Trie`](Trie.md)\> - -Static version of fromProof function. If a root is provided in the opts param, the proof will be checked to have the same expected root. An -(EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data. - -**`Deprecated`** - -Use `createFromProof` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `proof` | [`Proof`](../README.md#proof) | An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data. | -| `opts?` | [`TrieOpts`](../interfaces/TrieOpts.md) | - | - -#### Returns - -`Promise`<[`Trie`](Trie.md)\> - -#### Defined in - -[packages/trie/src/trie.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L220) - -___ - -### verifyProof - -▸ `Static` **verifyProof**(`key`, `proof`, `opts?`): `Promise`<``null`` \| `Uint8Array`\> - -Static version of verifyProof function with the same behavior. An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes -from the root node to the leaf node storing state data. - -**`Throws`** - -If proof is found to be invalid. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `Uint8Array` | Key that is being verified and that the proof is created for | -| `proof` | [`Proof`](../README.md#proof) | An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data. | -| `opts?` | [`TrieOpts`](../interfaces/TrieOpts.md) | optional, the opts may include a custom hashing function to use with the trie for proof verification | - -#### Returns - -`Promise`<``null`` \| `Uint8Array`\> - -The value from the key, or null if valid proof of non-existence. - -#### Defined in - -[packages/trie/src/trie.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L166) - -___ - -### verifyRangeProof - -▸ `Static` **verifyRangeProof**(`rootHash`, `firstKey`, `lastKey`, `keys`, `values`, `proof`, `opts?`): `Promise`<`boolean`\> - -A range proof is a proof that includes the encoded trie nodes from the root node to leaf node for one or more branches of a trie, -allowing an entire range of leaf nodes to be validated. This is useful in applications such as snap sync where contiguous ranges -of state trie data is received and validated for constructing world state, locally. Also see [verifyRangeProof](../README.md#verifyrangeproof). A static -version of this function also exists. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `rootHash` | `Uint8Array` | root hash of state trie this proof is being verified against. | -| `firstKey` | ``null`` \| `Uint8Array` | first key of range being proven. | -| `lastKey` | ``null`` \| `Uint8Array` | last key of range being proven. | -| `keys` | `Uint8Array`[] | key list of leaf data being proven. | -| `values` | `Uint8Array`[] | value list of leaf data being proven, one-to-one correspondence with keys. | -| `proof` | ``null`` \| `Uint8Array`[] | proof node list, if all-elements-proof where no proof is needed, proof should be null, and both `firstKey` and `lastKey` must be null as well | -| `opts?` | [`TrieOpts`](../interfaces/TrieOpts.md) | optional, the opts may include a custom hashing function to use with the trie for proof verification | - -#### Returns - -`Promise`<`boolean`\> - -a flag to indicate whether there exists more trie node in the trie - -#### Defined in - -[packages/trie/src/trie.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L194) diff --git a/packages/mpt/docs/classes/TrieReadStream.md b/packages/mpt/docs/classes/TrieReadStream.md deleted file mode 100644 index 46ee7a87dc1..00000000000 --- a/packages/mpt/docs/classes/TrieReadStream.md +++ /dev/null @@ -1,1696 +0,0 @@ -[@ethereumjs/trie](../README.md) / TrieReadStream - -# Class: TrieReadStream - -## Hierarchy - -- `Readable` - - ↳ **`TrieReadStream`** - -## Table of contents - -### Constructors - -- [constructor](TrieReadStream.md#constructor) - -### Properties - -- [\_readableState](TrieReadStream.md#_readablestate) -- [closed](TrieReadStream.md#closed) -- [destroyed](TrieReadStream.md#destroyed) -- [errored](TrieReadStream.md#errored) -- [readable](TrieReadStream.md#readable) -- [readableAborted](TrieReadStream.md#readableaborted) -- [readableDidRead](TrieReadStream.md#readabledidread) -- [readableEncoding](TrieReadStream.md#readableencoding) -- [readableEnded](TrieReadStream.md#readableended) -- [readableFlowing](TrieReadStream.md#readableflowing) -- [readableHighWaterMark](TrieReadStream.md#readablehighwatermark) -- [readableLength](TrieReadStream.md#readablelength) -- [readableObjectMode](TrieReadStream.md#readableobjectmode) - -### Methods - -- [[asyncIterator]](TrieReadStream.md#[asynciterator]) -- [\_destroy](TrieReadStream.md#_destroy) -- [\_read](TrieReadStream.md#_read) -- [\_undestroy](TrieReadStream.md#_undestroy) -- [addListener](TrieReadStream.md#addlistener) -- [destroy](TrieReadStream.md#destroy) -- [emit](TrieReadStream.md#emit) -- [eventNames](TrieReadStream.md#eventnames) -- [getMaxListeners](TrieReadStream.md#getmaxlisteners) -- [isPaused](TrieReadStream.md#ispaused) -- [listenerCount](TrieReadStream.md#listenercount) -- [listeners](TrieReadStream.md#listeners) -- [off](TrieReadStream.md#off) -- [on](TrieReadStream.md#on) -- [once](TrieReadStream.md#once) -- [pause](TrieReadStream.md#pause) -- [pipe](TrieReadStream.md#pipe) -- [prependListener](TrieReadStream.md#prependlistener) -- [prependOnceListener](TrieReadStream.md#prependoncelistener) -- [push](TrieReadStream.md#push) -- [rawListeners](TrieReadStream.md#rawlisteners) -- [read](TrieReadStream.md#read) -- [removeAllListeners](TrieReadStream.md#removealllisteners) -- [removeListener](TrieReadStream.md#removelistener) -- [resume](TrieReadStream.md#resume) -- [setEncoding](TrieReadStream.md#setencoding) -- [setMaxListeners](TrieReadStream.md#setmaxlisteners) -- [unpipe](TrieReadStream.md#unpipe) -- [unshift](TrieReadStream.md#unshift) -- [wrap](TrieReadStream.md#wrap) - -## Constructors - -### constructor - -• **new TrieReadStream**(`trie`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `trie` | [`Trie`](Trie.md) | - -#### Overrides - -Readable.constructor - -#### Defined in - -[packages/trie/src/util/readStream.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/readStream.ts#L35) - -## Properties - -### \_readableState - -• **\_readableState**: `ReadableState` - -#### Inherited from - -Readable.\_readableState - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:146 - -___ - -### closed - -• `Readonly` **closed**: `boolean` - -#### Inherited from - -Readable.closed - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:59 - -___ - -### destroyed - -• **destroyed**: `boolean` - -#### Inherited from - -Readable.destroyed - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:147 - -___ - -### errored - -• `Readonly` **errored**: ``null`` \| `Error` - -#### Inherited from - -Readable.errored - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:60 - -___ - -### readable - -• **readable**: `boolean` - -#### Inherited from - -Readable.readable - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:55 - -___ - -### readableAborted - -• `Readonly` **readableAborted**: `never` - -#### Inherited from - -Readable.readableAborted - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:292 - -___ - -### readableDidRead - -• `Readonly` **readableDidRead**: `never` - -#### Inherited from - -Readable.readableDidRead - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:293 - -___ - -### readableEncoding - -• `Readonly` **readableEncoding**: `never` - -#### Inherited from - -Readable.readableEncoding - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:294 - -___ - -### readableEnded - -• `Readonly` **readableEnded**: `never` - -#### Inherited from - -Readable.readableEnded - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:295 - -___ - -### readableFlowing - -• `Readonly` **readableFlowing**: ``null`` \| `boolean` - -#### Inherited from - -Readable.readableFlowing - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:56 - -___ - -### readableHighWaterMark - -• `Readonly` **readableHighWaterMark**: `number` - -#### Inherited from - -Readable.readableHighWaterMark - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:57 - -___ - -### readableLength - -• `Readonly` **readableLength**: `number` - -#### Inherited from - -Readable.readableLength - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:58 - -___ - -### readableObjectMode - -• `Readonly` **readableObjectMode**: `never` - -#### Inherited from - -Readable.readableObjectMode - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:296 - -## Methods - -### [asyncIterator] - -▸ **[asyncIterator]**(): `AsyncIterableIterator`<`any`\> - -#### Returns - -`AsyncIterableIterator`<`any`\> - -#### Inherited from - -Readable.\_\_@asyncIterator@21529 - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:143 - -___ - -### \_destroy - -▸ **_destroy**(`error`, `callback`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `error` | ``null`` \| `Error` | -| `callback` | (`error?`: ``null`` \| `Error`) => `void` | - -#### Returns - -`void` - -#### Inherited from - -Readable.\_destroy - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:71 - -___ - -### \_read - -▸ **_read**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Overrides - -Readable.\_read - -#### Defined in - -[packages/trie/src/util/readStream.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/readStream.ts#L42) - -___ - -### \_undestroy - -▸ **_undestroy**(): `void` - -#### Returns - -`void` - -#### Inherited from - -Readable.\_undestroy - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:151 - -___ - -### addListener - -▸ **addListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -Event emitter -The defined events on documents including: -1. close -2. data -3. end -4. readable -5. error - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"close"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.addListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:83 - -▸ **addListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"data"`` | -| `listener` | (`chunk`: `any`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.addListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:84 - -▸ **addListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"end"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.addListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:85 - -▸ **addListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"readable"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.addListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:86 - -▸ **addListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"error"`` | -| `listener` | (`err`: `Error`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.addListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:87 - -▸ **addListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.addListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:88 - -___ - -### destroy - -▸ **destroy**(`error?`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `error?` | `Error` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.destroy - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:72 - -___ - -### emit - -▸ **emit**(`event`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"close"`` | - -#### Returns - -`boolean` - -#### Inherited from - -Readable.emit - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:90 - -▸ **emit**(`event`, `chunk`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"data"`` | -| `chunk` | `any` | - -#### Returns - -`boolean` - -#### Inherited from - -Readable.emit - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:91 - -▸ **emit**(`event`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"end"`` | - -#### Returns - -`boolean` - -#### Inherited from - -Readable.emit - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:92 - -▸ **emit**(`event`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"readable"`` | - -#### Returns - -`boolean` - -#### Inherited from - -Readable.emit - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:93 - -▸ **emit**(`event`, `err`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"error"`` | -| `err` | `Error` | - -#### Returns - -`boolean` - -#### Inherited from - -Readable.emit - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:94 - -▸ **emit**(`event`, ...`args`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -Readable.emit - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:95 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -Readable.eventNames - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:141 - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -#### Returns - -`number` - -#### Inherited from - -Readable.getMaxListeners - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:135 - -___ - -### isPaused - -▸ **isPaused**(): `boolean` - -#### Returns - -`boolean` - -#### Inherited from - -Readable.isPaused - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:66 - -___ - -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`number` - -#### Inherited from - -Readable.listenerCount - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:140 - -___ - -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Readable.listeners - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:137 - -___ - -### off - -▸ **off**(`eventName`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.off - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:133 - -___ - -### on - -▸ **on**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"close"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.on - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:97 - -▸ **on**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"data"`` | -| `listener` | (`chunk`: `any`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.on - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:98 - -▸ **on**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"end"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.on - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:99 - -▸ **on**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"readable"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.on - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:100 - -▸ **on**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"error"`` | -| `listener` | (`err`: `Error`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.on - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:101 - -▸ **on**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.on - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:102 - -___ - -### once - -▸ **once**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"close"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.once - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:104 - -▸ **once**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"data"`` | -| `listener` | (`chunk`: `any`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.once - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:105 - -▸ **once**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"end"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.once - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:106 - -▸ **once**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"readable"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.once - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:107 - -▸ **once**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"error"`` | -| `listener` | (`err`: `Error`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.once - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:108 - -▸ **once**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.once - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:109 - -___ - -### pause - -▸ **pause**(): [`TrieReadStream`](TrieReadStream.md) - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.pause - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:64 - -___ - -### pipe - -▸ **pipe**<`T`\>(`destination`, `options?`): `T` - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends `_IWritable`<`T`\> | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `destination` | `T` | -| `options?` | `Object` | -| `options.end?` | `boolean` | - -#### Returns - -`T` - -#### Inherited from - -Readable.pipe - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:299 - -___ - -### prependListener - -▸ **prependListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"close"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:111 - -▸ **prependListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"data"`` | -| `listener` | (`chunk`: `any`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:112 - -▸ **prependListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"end"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:113 - -▸ **prependListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"readable"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:114 - -▸ **prependListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"error"`` | -| `listener` | (`err`: `Error`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:115 - -▸ **prependListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:116 - -___ - -### prependOnceListener - -▸ **prependOnceListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"close"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependOnceListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:118 - -▸ **prependOnceListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"data"`` | -| `listener` | (`chunk`: `any`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependOnceListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:119 - -▸ **prependOnceListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"end"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependOnceListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:120 - -▸ **prependOnceListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"readable"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependOnceListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:121 - -▸ **prependOnceListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"error"`` | -| `listener` | (`err`: `Error`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependOnceListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:122 - -▸ **prependOnceListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.prependOnceListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:123 - -___ - -### push - -▸ **push**(`chunk`, `encoding?`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chunk` | `any` | -| `encoding?` | `string` | - -#### Returns - -`boolean` - -#### Inherited from - -Readable.push - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:70 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Readable.rawListeners - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:139 - -___ - -### read - -▸ **read**(`size?`): `any` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `size?` | `number` | - -#### Returns - -`any` - -#### Inherited from - -Readable.read - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:62 - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.removeAllListeners - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:132 - -___ - -### removeListener - -▸ **removeListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"close"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.removeListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:125 - -▸ **removeListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"data"`` | -| `listener` | (`chunk`: `any`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.removeListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:126 - -▸ **removeListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"end"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.removeListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:127 - -▸ **removeListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"readable"`` | -| `listener` | () => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.removeListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:128 - -▸ **removeListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | ``"error"`` | -| `listener` | (`err`: `Error`) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.removeListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:129 - -▸ **removeListener**(`event`, `listener`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.removeListener - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:130 - -___ - -### resume - -▸ **resume**(): [`TrieReadStream`](TrieReadStream.md) - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.resume - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:65 - -___ - -### setEncoding - -▸ **setEncoding**(`encoding`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `encoding` | `string` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.setEncoding - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:63 - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.setMaxListeners - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:134 - -___ - -### unpipe - -▸ **unpipe**(`destination?`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `destination?` | `Writable` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.unpipe - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:67 - -___ - -### unshift - -▸ **unshift**(`chunk`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chunk` | `any` | - -#### Returns - -`void` - -#### Inherited from - -Readable.unshift - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:68 - -___ - -### wrap - -▸ **wrap**(`oldStream`): [`TrieReadStream`](TrieReadStream.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `oldStream` | `Readable` | - -#### Returns - -[`TrieReadStream`](TrieReadStream.md) - -#### Inherited from - -Readable.wrap - -#### Defined in - -node_modules/@types/readable-stream/index.d.ts:69 diff --git a/packages/mpt/docs/classes/WalkController.md b/packages/mpt/docs/classes/WalkController.md index 7f1e493f7a0..6b0f32a71d6 100644 --- a/packages/mpt/docs/classes/WalkController.md +++ b/packages/mpt/docs/classes/WalkController.md @@ -1,147 +1,177 @@ -[@ethereumjs/trie](../README.md) / WalkController +[**@ethereumjs/mpt**](../README.md) -# Class: WalkController - -WalkController is an interface to control how the trie is being traversed. +*** -## Table of contents +[@ethereumjs/mpt](../README.md) / WalkController -### Properties - -- [onNode](WalkController.md#onnode) -- [taskExecutor](WalkController.md#taskexecutor) -- [trie](WalkController.md#trie) +# Class: WalkController -### Methods +Defined in: [packages/mpt/src/util/walkController.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/walkController.ts#L11) -- [allChildren](WalkController.md#allchildren) -- [onlyBranchIndex](WalkController.md#onlybranchindex) -- [pushNodeToQueue](WalkController.md#pushnodetoqueue) -- [newWalk](WalkController.md#newwalk) +WalkController is an interface to control how the trie is being traversed. ## Properties ### onNode -• `Readonly` **onNode**: [`FoundNodeFunction`](../README.md#foundnodefunction) +> `readonly` **onNode**: [`FoundNodeFunction`](../type-aliases/FoundNodeFunction.md) -#### Defined in +Defined in: [packages/mpt/src/util/walkController.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/walkController.ts#L12) -[packages/trie/src/util/walkController.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/walkController.ts#L12) - -___ +*** ### taskExecutor -• `Readonly` **taskExecutor**: [`PrioritizedTaskExecutor`](PrioritizedTaskExecutor.md) - -#### Defined in +> `readonly` **taskExecutor**: `PrioritizedTaskExecutor` -[packages/trie/src/util/walkController.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/walkController.ts#L13) +Defined in: [packages/mpt/src/util/walkController.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/walkController.ts#L13) -___ +*** ### trie -• `Readonly` **trie**: [`Trie`](Trie.md) - -#### Defined in +> `readonly` **trie**: [`MerklePatriciaTrie`](MerklePatriciaTrie.md) -[packages/trie/src/util/walkController.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/walkController.ts#L14) +Defined in: [packages/mpt/src/util/walkController.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/walkController.ts#L14) ## Methods -### allChildren +### allChildren() -▸ **allChildren**(`node`, `key?`): `void` +> **allChildren**(`node`, `key`): `void` + +Defined in: [packages/mpt/src/util/walkController.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/walkController.ts#L69) Run all children of a node. Priority of these nodes are the key length of the children. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `node` | [`TrieNode`](../README.md#trienode) | `undefined` | Node to get all children of and call onNode on. | -| `key` | [`Nibbles`](../README.md#nibbles) | `[]` | The current `key` which would yield the `node` when trying to get this node with a `get` operation. | +##### node + +[`MPTNode`](../type-aliases/MPTNode.md) + +Node to get all children of and call onNode on. + +##### key + +[`Nibbles`](../type-aliases/Nibbles.md) = `[]` + +The current `key` which would yield the `node` when trying to get this node with a `get` operation. #### Returns `void` -#### Defined in +*** -[packages/trie/src/util/walkController.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/walkController.ts#L69) +### onlyBranchIndex() -___ +> **onlyBranchIndex**(`node`, `key`, `childIndex`, `priority?`): `void` -### onlyBranchIndex +Defined in: [packages/mpt/src/util/walkController.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/walkController.ts#L120) -▸ **onlyBranchIndex**(`node`, `key?`, `childIndex`, `priority?`): `void` - -Push a branch of a certain BranchNode to the event queue. +Push a branch of a certain BranchMPTNode to the event queue. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `node` | [`BranchNode`](BranchNode.md) | `undefined` | The node to select a branch on. Should be a BranchNode. | -| `key` | [`Nibbles`](../README.md#nibbles) | `[]` | The current key which leads to the corresponding node. | -| `childIndex` | `number` | `undefined` | The child index to add to the event queue. | -| `priority?` | `number` | `undefined` | Optional priority of the event, defaults to the total key length. | +##### node + +[`BranchMPTNode`](BranchMPTNode.md) + +The node to select a branch on. Should be a BranchMPTNode. + +##### key + +[`Nibbles`](../type-aliases/Nibbles.md) = `[]` + +The current key which leads to the corresponding node. + +##### childIndex + +`number` + +The child index to add to the event queue. + +##### priority? + +`number` + +Optional priority of the event, defaults to the total key length. #### Returns `void` -#### Defined in +*** -[packages/trie/src/util/walkController.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/walkController.ts#L120) +### pushNodeToQueue() -___ +> **pushNodeToQueue**(`nodeRef`, `key`, `priority?`): `void` -### pushNodeToQueue - -▸ **pushNodeToQueue**(`nodeRef`, `key?`, `priority?`): `void` +Defined in: [packages/mpt/src/util/walkController.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/walkController.ts#L97) Push a node to the queue. If the queue has places left for tasks, the node is executed immediately, otherwise it is queued. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `nodeRef` | `Uint8Array` | `undefined` | Push a node reference to the event queue. This reference is a 32-byte keccak hash of the value corresponding to the `key`. | -| `key` | [`Nibbles`](../README.md#nibbles) | `[]` | The current key. | -| `priority?` | `number` | `undefined` | Optional priority, defaults to key length | +##### nodeRef + +`Uint8Array` + +Push a node reference to the event queue. This reference is a 32-byte keccak hash of the value corresponding to the `key`. + +##### key + +[`Nibbles`](../type-aliases/Nibbles.md) = `[]` + +The current key. + +##### priority? + +`number` + +Optional priority, defaults to key length #### Returns `void` -#### Defined in +*** -[packages/trie/src/util/walkController.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/walkController.ts#L97) +### newWalk() -___ +> `static` **newWalk**(`onNode`, `trie`, `root`, `poolSize?`): `Promise`\<`void`\> -### newWalk - -▸ `Static` **newWalk**(`onNode`, `trie`, `root`, `poolSize?`): `Promise`<`void`\> +Defined in: [packages/mpt/src/util/walkController.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/walkController.ts#L39) Async function to create and start a new walk over a trie. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `onNode` | [`FoundNodeFunction`](../README.md#foundnodefunction) | The `FoundNodeFunction to call if a node is found. | -| `trie` | [`Trie`](Trie.md) | The trie to walk on. | -| `root` | `Uint8Array` | The root key to walk on. | -| `poolSize?` | `number` | Task execution pool size to prevent OOM errors. Defaults to 500. | +##### onNode -#### Returns +[`FoundNodeFunction`](../type-aliases/FoundNodeFunction.md) + +The `FoundNodeFunction to call if a node is found. + +##### trie + +[`MerklePatriciaTrie`](MerklePatriciaTrie.md) + +The trie to walk on. -`Promise`<`void`\> +##### root -#### Defined in +`Uint8Array` + +The root key to walk on. + +##### poolSize? + +`number` + +Task execution pool size to prevent OOM errors. Defaults to 500. + +#### Returns -[packages/trie/src/util/walkController.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/walkController.ts#L39) +`Promise`\<`void`\> diff --git a/packages/mpt/docs/functions/byteTypeToNibbleType.md b/packages/mpt/docs/functions/byteTypeToNibbleType.md new file mode 100644 index 00000000000..f81544c35ac --- /dev/null +++ b/packages/mpt/docs/functions/byteTypeToNibbleType.md @@ -0,0 +1,27 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / byteTypeToNibbleType + +# Function: byteTypeToNibbleType() + +> **byteTypeToNibbleType**(`key`): [`Nibbles`](../type-aliases/Nibbles.md) + +Defined in: [packages/mpt/src/util/encoding.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L131) + +Turns each byte into a single nibble, only extracting the lower nibble of each byte + +## Parameters + +### key + +`Uint8Array` + +Uint8Array typed byte array + +## Returns + +[`Nibbles`](../type-aliases/Nibbles.md) + +Nibble typed nibble array diff --git a/packages/mpt/docs/functions/bytesToNibbles.md b/packages/mpt/docs/functions/bytesToNibbles.md new file mode 100644 index 00000000000..5acb9473227 --- /dev/null +++ b/packages/mpt/docs/functions/bytesToNibbles.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / bytesToNibbles + +# Function: bytesToNibbles() + +> **bytesToNibbles**(`str`): `Uint8Array`\<`ArrayBuffer`\> + +Defined in: [packages/mpt/src/util/encoding.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L80) + +## Parameters + +### str + +`Uint8Array` + +## Returns + +`Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/mpt/docs/functions/compactBytesToNibbles.md b/packages/mpt/docs/functions/compactBytesToNibbles.md new file mode 100644 index 00000000000..9392ca7e4e1 --- /dev/null +++ b/packages/mpt/docs/functions/compactBytesToNibbles.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / compactBytesToNibbles + +# Function: compactBytesToNibbles() + +> **compactBytesToNibbles**(`compact`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/util/encoding.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L94) + +## Parameters + +### compact + +`Uint8Array` + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> diff --git a/packages/mpt/docs/functions/createMPT.md b/packages/mpt/docs/functions/createMPT.md new file mode 100644 index 00000000000..3880bbe638e --- /dev/null +++ b/packages/mpt/docs/functions/createMPT.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / createMPT + +# Function: createMPT() + +> **createMPT**(`opts?`): `Promise`\<[`MerklePatriciaTrie`](../classes/MerklePatriciaTrie.md)\> + +Defined in: [packages/mpt/src/constructors.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/constructors.ts#L14) + +## Parameters + +### opts? + +[`MPTOpts`](../interfaces/MPTOpts.md) + +## Returns + +`Promise`\<[`MerklePatriciaTrie`](../classes/MerklePatriciaTrie.md)\> diff --git a/packages/mpt/docs/functions/createMPTFromProof.md b/packages/mpt/docs/functions/createMPTFromProof.md new file mode 100644 index 00000000000..2d2bec92584 --- /dev/null +++ b/packages/mpt/docs/functions/createMPTFromProof.md @@ -0,0 +1,34 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / createMPTFromProof + +# Function: createMPTFromProof() + +> **createMPTFromProof**(`proof`, `trieOpts?`): `Promise`\<[`MerklePatriciaTrie`](../classes/MerklePatriciaTrie.md)\> + +Defined in: [packages/mpt/src/constructors.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/constructors.ts#L62) + +Create a trie from a given (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof. A proof contains the encoded trie nodes +from the root node to the leaf node storing state data. + +## Parameters + +### proof + +[`Proof`](../type-aliases/Proof.md) + +an EIP-1186 proof to create trie from + +### trieOpts? + +[`MPTOpts`](../interfaces/MPTOpts.md) + +trie opts to be applied to returned trie + +## Returns + +`Promise`\<[`MerklePatriciaTrie`](../classes/MerklePatriciaTrie.md)\> + +new trie created from given proof diff --git a/packages/mpt/docs/functions/createMerkleProof.md b/packages/mpt/docs/functions/createMerkleProof.md new file mode 100644 index 00000000000..a1f571c494e --- /dev/null +++ b/packages/mpt/docs/functions/createMerkleProof.md @@ -0,0 +1,31 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / createMerkleProof + +# Function: createMerkleProof() + +> **createMerkleProof**(`trie`, `key`): `Promise`\<[`Proof`](../type-aliases/Proof.md)\> + +Defined in: [packages/mpt/src/proof/proof.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/proof/proof.ts#L37) + +Creates a proof from a trie and key that can be verified using [verifyMPTWithMerkleProof](verifyMPTWithMerkleProof.md). An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains +the encoded trie nodes from the root node to the leaf node storing state data. The returned proof will be in the format of an array that contains Uint8Arrays of +serialized branch, extension, and/or leaf nodes. + +## Parameters + +### trie + +[`MerklePatriciaTrie`](../classes/MerklePatriciaTrie.md) + +### key + +`Uint8Array` + +key to create a proof for + +## Returns + +`Promise`\<[`Proof`](../type-aliases/Proof.md)\> diff --git a/packages/mpt/docs/functions/decodeMPTNode.md b/packages/mpt/docs/functions/decodeMPTNode.md new file mode 100644 index 00000000000..d66a7db0380 --- /dev/null +++ b/packages/mpt/docs/functions/decodeMPTNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / decodeMPTNode + +# Function: decodeMPTNode() + +> **decodeMPTNode**(`node`): [`BranchMPTNode`](../classes/BranchMPTNode.md) \| [`ExtensionMPTNode`](../classes/ExtensionMPTNode.md) \| [`LeafMPTNode`](../classes/LeafMPTNode.md) + +Defined in: [packages/mpt/src/node/util.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/util.ts#L29) + +## Parameters + +### node + +`Uint8Array` + +## Returns + +[`BranchMPTNode`](../classes/BranchMPTNode.md) \| [`ExtensionMPTNode`](../classes/ExtensionMPTNode.md) \| [`LeafMPTNode`](../classes/LeafMPTNode.md) diff --git a/packages/mpt/docs/functions/decodeRawMPTNode.md b/packages/mpt/docs/functions/decodeRawMPTNode.md new file mode 100644 index 00000000000..84b2c883285 --- /dev/null +++ b/packages/mpt/docs/functions/decodeRawMPTNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / decodeRawMPTNode + +# Function: decodeRawMPTNode() + +> **decodeRawMPTNode**(`raw`): [`BranchMPTNode`](../classes/BranchMPTNode.md) \| [`ExtensionMPTNode`](../classes/ExtensionMPTNode.md) \| [`LeafMPTNode`](../classes/LeafMPTNode.md) + +Defined in: [packages/mpt/src/node/util.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/util.ts#L11) + +## Parameters + +### raw + +`Uint8Array`\<`ArrayBufferLike`\>[] + +## Returns + +[`BranchMPTNode`](../classes/BranchMPTNode.md) \| [`ExtensionMPTNode`](../classes/ExtensionMPTNode.md) \| [`LeafMPTNode`](../classes/LeafMPTNode.md) diff --git a/packages/mpt/docs/functions/genesisMPTStateRoot.md b/packages/mpt/docs/functions/genesisMPTStateRoot.md new file mode 100644 index 00000000000..13de5b6025a --- /dev/null +++ b/packages/mpt/docs/functions/genesisMPTStateRoot.md @@ -0,0 +1,23 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / genesisMPTStateRoot + +# Function: genesisMPTStateRoot() + +> **genesisMPTStateRoot**(`genesisState`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/mpt/src/util/genesisState.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/genesisState.ts#L18) + +Derives the stateRoot of the genesis block based on genesis allocations + +## Parameters + +### genesisState + +`GenesisState` + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/mpt/docs/functions/hexToKeybytes.md b/packages/mpt/docs/functions/hexToKeybytes.md new file mode 100644 index 00000000000..d38a001231d --- /dev/null +++ b/packages/mpt/docs/functions/hexToKeybytes.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / hexToKeybytes + +# Function: hexToKeybytes() + +> **hexToKeybytes**(`hex`): `Uint8Array`\<`ArrayBuffer`\> + +Defined in: [packages/mpt/src/util/encoding.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L46) + +## Parameters + +### hex + +`Uint8Array` + +## Returns + +`Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/mpt/docs/functions/isRawMPTNode.md b/packages/mpt/docs/functions/isRawMPTNode.md new file mode 100644 index 00000000000..302111fc60a --- /dev/null +++ b/packages/mpt/docs/functions/isRawMPTNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / isRawMPTNode + +# Function: isRawMPTNode() + +> **isRawMPTNode**(`n`): `n is Uint8Array[]` + +Defined in: [packages/mpt/src/node/util.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/node/util.ts#L25) + +## Parameters + +### n + +`Uint8Array`\<`ArrayBufferLike`\> | `NestedUint8Array` + +## Returns + +`n is Uint8Array[]` diff --git a/packages/mpt/docs/functions/mergeAndFormatKeyPaths.md b/packages/mpt/docs/functions/mergeAndFormatKeyPaths.md new file mode 100644 index 00000000000..8f8bb4f2a02 --- /dev/null +++ b/packages/mpt/docs/functions/mergeAndFormatKeyPaths.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / mergeAndFormatKeyPaths + +# Function: mergeAndFormatKeyPaths() + +> **mergeAndFormatKeyPaths**(`pathStrings`): `Uint8Array`\<`ArrayBufferLike`\>[][] + +Defined in: [packages/mpt/src/util/encoding.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L161) + +## Parameters + +### pathStrings + +`string`[] + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\>[][] diff --git a/packages/mpt/docs/functions/nibbleTypeToByteType.md b/packages/mpt/docs/functions/nibbleTypeToByteType.md new file mode 100644 index 00000000000..564ee2de957 --- /dev/null +++ b/packages/mpt/docs/functions/nibbleTypeToByteType.md @@ -0,0 +1,27 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / nibbleTypeToByteType + +# Function: nibbleTypeToByteType() + +> **nibbleTypeToByteType**(`arr`): `Uint8Array` + +Defined in: [packages/mpt/src/util/encoding.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L115) + +Converts each nibble into a single byte + +## Parameters + +### arr + +[`Nibbles`](../type-aliases/Nibbles.md) + +Nibble typed nibble array + +## Returns + +`Uint8Array` + +Uint8Array typed byte array diff --git a/packages/mpt/docs/functions/nibblesToBytes.md b/packages/mpt/docs/functions/nibblesToBytes.md new file mode 100644 index 00000000000..b96dde0cd00 --- /dev/null +++ b/packages/mpt/docs/functions/nibblesToBytes.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / nibblesToBytes + +# Function: nibblesToBytes() + +> **nibblesToBytes**(`nibbles`): `Uint8Array`\<`ArrayBuffer`\> + +Defined in: [packages/mpt/src/util/encoding.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L37) + +## Parameters + +### nibbles + +`Uint8Array` + +## Returns + +`Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/mpt/docs/functions/nibblesToCompactBytes.md b/packages/mpt/docs/functions/nibblesToCompactBytes.md new file mode 100644 index 00000000000..cffa13f2387 --- /dev/null +++ b/packages/mpt/docs/functions/nibblesToCompactBytes.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / nibblesToCompactBytes + +# Function: nibblesToCompactBytes() + +> **nibblesToCompactBytes**(`nibbles`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/util/encoding.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L58) + +## Parameters + +### nibbles + +`Uint8Array` + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> diff --git a/packages/mpt/docs/functions/pathToHexKey.md b/packages/mpt/docs/functions/pathToHexKey.md new file mode 100644 index 00000000000..95db05b44c2 --- /dev/null +++ b/packages/mpt/docs/functions/pathToHexKey.md @@ -0,0 +1,39 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / pathToHexKey + +# Function: pathToHexKey() + +> **pathToHexKey**(`path`, `extension`, `retType`): `Uint8Array` + +Defined in: [packages/mpt/src/util/encoding.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/util/encoding.ts#L150) + +Takes a string path and extends it by the given extension nibbles + +## Parameters + +### path + +`string` + +String node path + +### extension + +[`Nibbles`](../type-aliases/Nibbles.md) + +nibbles to extend by + +### retType + +`string` + +string indicating whether to return the key in "keybyte" or "hex" encoding + +## Returns + +`Uint8Array` + +hex-encoded key diff --git a/packages/mpt/docs/functions/updateMPTFromMerkleProof.md b/packages/mpt/docs/functions/updateMPTFromMerkleProof.md new file mode 100644 index 00000000000..bda545b054e --- /dev/null +++ b/packages/mpt/docs/functions/updateMPTFromMerkleProof.md @@ -0,0 +1,41 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / updateMPTFromMerkleProof + +# Function: updateMPTFromMerkleProof() + +> **updateMPTFromMerkleProof**(`trie`, `proof`, `shouldVerifyRoot`): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/mpt/src/proof/proof.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/proof/proof.ts#L56) + +Updates a trie from a proof by putting all the nodes in the proof into the trie. Pass shouldVerifyRoot as true to check +that root key of proof matches root of trie and throw if not. +An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data. + +## Parameters + +### trie + +[`MerklePatriciaTrie`](../classes/MerklePatriciaTrie.md) + +The trie to update from the proof. + +### proof + +[`Proof`](../type-aliases/Proof.md) + +An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof to update the trie from. + +### shouldVerifyRoot + +`boolean` = `false` + +defaults to false. If `true`, verifies that the root key of the proof matches the trie root and throws if not (i.e invalid proof). + +## Returns + +`Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +The root of the proof diff --git a/packages/mpt/docs/functions/verifyMPTWithMerkleProof.md b/packages/mpt/docs/functions/verifyMPTWithMerkleProof.md new file mode 100644 index 00000000000..2f979a9839b --- /dev/null +++ b/packages/mpt/docs/functions/verifyMPTWithMerkleProof.md @@ -0,0 +1,50 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / verifyMPTWithMerkleProof + +# Function: verifyMPTWithMerkleProof() + +> **verifyMPTWithMerkleProof**(`trie`, `rootHash`, `key`, `proof`): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/mpt/src/proof/proof.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/proof/proof.ts#L96) + +Verifies a proof by putting all of its nodes into a trie and attempting to get the proven key. An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof +contains the encoded trie nodes from the root node to the leaf node storing state data. + +## Parameters + +### trie + +[`MerklePatriciaTrie`](../classes/MerklePatriciaTrie.md) + +The trie to verify the proof against + +### rootHash + +`Uint8Array` + +Root hash of the trie that this proof was created from and is being verified for + +### key + +`Uint8Array` + +Key that is being verified and that the proof is created for + +### proof + +[`Proof`](../type-aliases/Proof.md) + +an EIP-1186 proof to verify the key against + +## Returns + +`Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +The value from the key, or null if valid proof of non-existence. + +## Throws + +If proof is found to be invalid. diff --git a/packages/mpt/docs/functions/verifyMerkleProof.md b/packages/mpt/docs/functions/verifyMerkleProof.md new file mode 100644 index 00000000000..abe2921f065 --- /dev/null +++ b/packages/mpt/docs/functions/verifyMerkleProof.md @@ -0,0 +1,44 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / verifyMerkleProof + +# Function: verifyMerkleProof() + +> **verifyMerkleProof**(`key`, `proof`, `opts?`): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/mpt/src/proof/proof.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/proof/proof.ts#L17) + +An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes +from the root node to the leaf node storing state data. + +## Parameters + +### key + +`Uint8Array` + +Key that is being verified and that the proof is created for + +### proof + +[`Proof`](../type-aliases/Proof.md) + +An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data. + +### opts? + +[`MPTOpts`](../interfaces/MPTOpts.md) + +optional, the opts may include a custom hashing function to use with the trie for proof verification + +## Returns + +`Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +The value from the key, or null if valid proof of non-existence. + +## Throws + +If proof is found to be invalid. diff --git a/packages/mpt/docs/functions/verifyMerkleRangeProof.md b/packages/mpt/docs/functions/verifyMerkleRangeProof.md new file mode 100644 index 00000000000..b0ec87b5585 --- /dev/null +++ b/packages/mpt/docs/functions/verifyMerkleRangeProof.md @@ -0,0 +1,75 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / verifyMerkleRangeProof + +# Function: verifyMerkleRangeProof() + +> **verifyMerkleRangeProof**(`rootHash`, `firstKeyRaw`, `lastKeyRaw`, `keysRaw`, `values`, `proof`, `useKeyHashingFunction`): `Promise`\<`boolean`\> + +Defined in: [packages/mpt/src/proof/range.ts:420](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/proof/range.ts#L420) + +Checks whether the given leaf nodes and edge proof can prove the given trie leaves range is matched with the specific root. + +A range proof is a proof that includes the encoded trie nodes from the root node to leaf node for one or more branches of a trie, +allowing an entire range of leaf nodes to be validated. This is useful in applications such as snap sync where contiguous ranges +of state trie data is received and validated for constructing world state, locally. + +There are four situations: + +- All elements proof. In this case the proof can be null, but the range should + be all the leaves in the trie. + +- One element proof. In this case no matter the edge proof is a non-existent + proof or not, we can always verify the correctness of the proof. + +- Zero element proof. In this case a single non-existent proof is enough to prove. + Besides, if there are still some other leaves available on the right side, then + an error will be returned. + +- Two edge elements proof. In this case two existent or non-existent proof(first and last) should be provided. + +NOTE: Currently only supports verification when the length of firstKey and lastKey are the same. + +## Parameters + +### rootHash + +`Uint8Array` + +root hash of state trie this proof is being verified against. + +### firstKeyRaw + +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +### lastKeyRaw + +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +### keysRaw + +`Uint8Array`\<`ArrayBufferLike`\>[] + +### values + +`Uint8Array`\<`ArrayBufferLike`\>[] + +value list of leaf data being proven, one-to-one correspondence with keys. + +### proof + +proof node list, if all-elements-proof where no proof is needed, proof should be null, and both `firstKey` and `lastKey` must be null as well + +`null` | `Uint8Array`\<`ArrayBufferLike`\>[] + +### useKeyHashingFunction + +[`HashKeysFunction`](../type-aliases/HashKeysFunction.md) = `keccak256` + +## Returns + +`Promise`\<`boolean`\> + +a flag to indicate whether there exists more trie node in the trie diff --git a/packages/mpt/docs/interfaces/CheckpointDBOpts.md b/packages/mpt/docs/interfaces/CheckpointDBOpts.md index b9fb7d85470..1439b354527 100644 --- a/packages/mpt/docs/interfaces/CheckpointDBOpts.md +++ b/packages/mpt/docs/interfaces/CheckpointDBOpts.md @@ -1,47 +1,39 @@ -[@ethereumjs/trie](../README.md) / CheckpointDBOpts +[**@ethereumjs/mpt**](../README.md) -# Interface: CheckpointDBOpts +*** -## Table of contents +[@ethereumjs/mpt](../README.md) / CheckpointDBOpts -### Properties +# Interface: CheckpointDBOpts -- [cacheSize](CheckpointDBOpts.md#cachesize) -- [db](CheckpointDBOpts.md#db) -- [valueEncoding](CheckpointDBOpts.md#valueencoding) +Defined in: [packages/mpt/src/types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L127) ## Properties -### cacheSize +### cacheSize? -• `Optional` **cacheSize**: `number` +> `optional` **cacheSize**: `number` -Cache size (default: 0) +Defined in: [packages/mpt/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L141) -#### Defined in - -[packages/trie/src/types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L132) +Cache size (default: 0) -___ +*** ### db -• **db**: `DB`<`string`, `string` \| `Uint8Array`\> +> **db**: `DB`\<`string`, `string` \| `Uint8Array`\<`ArrayBufferLike`\>\> -A database instance. +Defined in: [packages/mpt/src/types.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L131) -#### Defined in +A database instance. -[packages/trie/src/types.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L122) +*** -___ +### valueEncoding? -### valueEncoding +> `optional` **valueEncoding**: `ValueEncoding` -• `Optional` **valueEncoding**: `ValueEncoding` +Defined in: [packages/mpt/src/types.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L136) ValueEncoding of the database (the values which are `put`/`get` in the db are of this type). Defaults to `string` - -#### Defined in - -[packages/trie/src/types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L127) diff --git a/packages/mpt/docs/interfaces/CommonInterface.md b/packages/mpt/docs/interfaces/CommonInterface.md index 5063113d58e..aa7bf5373c6 100644 --- a/packages/mpt/docs/interfaces/CommonInterface.md +++ b/packages/mpt/docs/interfaces/CommonInterface.md @@ -1,25 +1,31 @@ -[@ethereumjs/trie](../README.md) / CommonInterface +[**@ethereumjs/mpt**](../README.md) -# Interface: CommonInterface +*** -## Table of contents +[@ethereumjs/mpt](../README.md) / CommonInterface -### Properties +# Interface: CommonInterface -- [customCrypto](CommonInterface.md#customcrypto) +Defined in: [packages/mpt/src/types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L26) ## Properties ### customCrypto -• **customCrypto**: `Object` +> **customCrypto**: `object` + +Defined in: [packages/mpt/src/types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L27) + +#### keccak256()? + +> `optional` **keccak256**: (`msg`) => `Uint8Array` + +##### Parameters -#### Type declaration +###### msg -| Name | Type | -| :------ | :------ | -| `keccak256?` | (`msg`: `Uint8Array`) => `Uint8Array` | +`Uint8Array` -#### Defined in +##### Returns -[packages/trie/src/types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L18) +`Uint8Array` diff --git a/packages/mpt/docs/interfaces/MPTOpts.md b/packages/mpt/docs/interfaces/MPTOpts.md new file mode 100644 index 00000000000..08c0edceb72 --- /dev/null +++ b/packages/mpt/docs/interfaces/MPTOpts.md @@ -0,0 +1,124 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / MPTOpts + +# Interface: MPTOpts + +Defined in: [packages/mpt/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L47) + +## Properties + +### cacheSize? + +> `optional` **cacheSize**: `number` + +Defined in: [packages/mpt/src/types.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L106) + +LRU cache for trie nodes to allow for faster node retrieval. + +Default: 0 (deactivated) + +*** + +### common? + +> `optional` **common**: [`CommonInterface`](CommonInterface.md) + +Defined in: [packages/mpt/src/types.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L111) + +@ethereumjs/common `Common` instance (an alternative to passing in a `customHashingFunction`) + +*** + +### db? + +> `optional` **db**: `DB`\<`string`, `string` \| `Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/mpt/src/types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L51) + +A database instance. + +*** + +### keyPrefix? + +> `optional` **keyPrefix**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/types.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L83) + +Add a prefix to the trie node keys + +(potential performance benefits if multiple tries are stored within the same DB, +e.g. all storage tries being stored in the outer account state DB) + +*** + +### root? + +> `optional` **root**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/types.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L56) + +A `Uint8Array` for the root of a previously stored trie + +*** + +### useKeyHashing? + +> `optional` **useKeyHashing**: `boolean` + +Defined in: [packages/mpt/src/types.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L70) + +Create as a secure MerklePatriciaTrie where the keys are automatically hashed using the +**keccak256** hash function or alternatively the custom hash function provided. +Default: `false` + +This is the flavor of the MerklePatriciaTrie which is used in production Ethereum networks +like Ethereum Mainnet. + +Note: This functionality has been refactored along the v5 release and was before +provided as a separate inherited class `SecureTrie`. Just replace with `Trie` +instantiation with `useKeyHashing` set to `true`. + +*** + +### useKeyHashingFunction? + +> `optional` **useKeyHashingFunction**: [`HashKeysFunction`](../type-aliases/HashKeysFunction.md) + +Defined in: [packages/mpt/src/types.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L75) + +Hash function used for hashing trie node and securing key. + +*** + +### useNodePruning? + +> `optional` **useNodePruning**: `boolean` + +Defined in: [packages/mpt/src/types.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L99) + +Flag to prune the trie. When set to `true`, each time a value is overridden, +unreachable nodes will be pruned (deleted) from the trie + +*** + +### useRootPersistence? + +> `optional` **useRootPersistence**: `boolean` + +Defined in: [packages/mpt/src/types.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L93) + +Store the root inside the database after every `write` operation + +*** + +### valueEncoding? + +> `optional` **valueEncoding**: `ValueEncoding` + +Defined in: [packages/mpt/src/types.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L88) + +ValueEncoding of the database (the values which are `put`/`get` in the db are of this type). Defaults to `string` diff --git a/packages/mpt/docs/interfaces/Path.md b/packages/mpt/docs/interfaces/Path.md index a434f56a9f3..c1cafa0397b 100644 --- a/packages/mpt/docs/interfaces/Path.md +++ b/packages/mpt/docs/interfaces/Path.md @@ -1,41 +1,33 @@ -[@ethereumjs/trie](../README.md) / Path +[**@ethereumjs/mpt**](../README.md) -# Interface: Path +*** -## Table of contents +[@ethereumjs/mpt](../README.md) / Path -### Properties +# Interface: Path -- [node](Path.md#node) -- [remaining](Path.md#remaining) -- [stack](Path.md#stack) +Defined in: [packages/mpt/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L32) ## Properties ### node -• **node**: ``null`` \| [`TrieNode`](../README.md#trienode) - -#### Defined in +> **node**: `null` \| [`MPTNode`](../type-aliases/MPTNode.md) -[packages/trie/src/types.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L24) +Defined in: [packages/mpt/src/types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L33) -___ +*** ### remaining -• **remaining**: [`Nibbles`](../README.md#nibbles) +> **remaining**: [`Nibbles`](../type-aliases/Nibbles.md) -#### Defined in +Defined in: [packages/mpt/src/types.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L34) -[packages/trie/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L25) - -___ +*** ### stack -• **stack**: [`TrieNode`](../README.md#trienode)[] - -#### Defined in +> **stack**: [`MPTNode`](../type-aliases/MPTNode.md)[] -[packages/trie/src/types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L26) +Defined in: [packages/mpt/src/types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L35) diff --git a/packages/mpt/docs/interfaces/TrieOpts.md b/packages/mpt/docs/interfaces/TrieOpts.md deleted file mode 100644 index 16e9ae3f59a..00000000000 --- a/packages/mpt/docs/interfaces/TrieOpts.md +++ /dev/null @@ -1,153 +0,0 @@ -[@ethereumjs/trie](../README.md) / TrieOpts - -# Interface: TrieOpts - -## Table of contents - -### Properties - -- [cacheSize](TrieOpts.md#cachesize) -- [common](TrieOpts.md#common) -- [db](TrieOpts.md#db) -- [keyPrefix](TrieOpts.md#keyprefix) -- [root](TrieOpts.md#root) -- [useKeyHashing](TrieOpts.md#usekeyhashing) -- [useKeyHashingFunction](TrieOpts.md#usekeyhashingfunction) -- [useNodePruning](TrieOpts.md#usenodepruning) -- [useRootPersistence](TrieOpts.md#userootpersistence) -- [valueEncoding](TrieOpts.md#valueencoding) - -## Properties - -### cacheSize - -• `Optional` **cacheSize**: `number` - -LRU cache for trie nodes to allow for faster node retrieval. - -Default: 0 (deactivated) - -#### Defined in - -[packages/trie/src/types.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L97) - -___ - -### common - -• `Optional` **common**: [`CommonInterface`](CommonInterface.md) - -@ethereumjs/common `Common` instance (an alternative to passing in a `customHashingFunction`) - -#### Defined in - -[packages/trie/src/types.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L102) - -___ - -### db - -• `Optional` **db**: `DB`<`string`, `string` \| `Uint8Array`\> - -A database instance. - -#### Defined in - -[packages/trie/src/types.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L42) - -___ - -### keyPrefix - -• `Optional` **keyPrefix**: `Uint8Array` - -Add a prefix to the trie node keys - -(potential performance benefits if multiple tries are stored within the same DB, -e.g. all storage tries being stored in the outer account state DB) - -#### Defined in - -[packages/trie/src/types.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L74) - -___ - -### root - -• `Optional` **root**: `Uint8Array` - -A `Uint8Array` for the root of a previously stored trie - -#### Defined in - -[packages/trie/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L47) - -___ - -### useKeyHashing - -• `Optional` **useKeyHashing**: `boolean` - -Create as a secure Trie where the keys are automatically hashed using the -**keccak256** hash function or alternatively the custom hash function provided. -Default: `false` - -This is the flavor of the Trie which is used in production Ethereum networks -like Ethereum Mainnet. - -Note: This functionality has been refactored along the v5 release and was before -provided as a separate inherited class `SecureTrie`. Just replace with `Trie` -instantiation with `useKeyHashing` set to `true`. - -#### Defined in - -[packages/trie/src/types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L61) - -___ - -### useKeyHashingFunction - -• `Optional` **useKeyHashingFunction**: [`HashKeysFunction`](../README.md#hashkeysfunction) - -Hash function used for hashing trie node and securing key. - -#### Defined in - -[packages/trie/src/types.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L66) - -___ - -### useNodePruning - -• `Optional` **useNodePruning**: `boolean` - -Flag to prune the trie. When set to `true`, each time a value is overridden, -unreachable nodes will be pruned (deleted) from the trie - -#### Defined in - -[packages/trie/src/types.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L90) - -___ - -### useRootPersistence - -• `Optional` **useRootPersistence**: `boolean` - -Store the root inside the database after every `write` operation - -#### Defined in - -[packages/trie/src/types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L84) - -___ - -### valueEncoding - -• `Optional` **valueEncoding**: `ValueEncoding` - -ValueEncoding of the database (the values which are `put`/`get` in the db are of this type). Defaults to `string` - -#### Defined in - -[packages/trie/src/types.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L79) diff --git a/packages/mpt/docs/interfaces/TrieShallowCopyOpts.md b/packages/mpt/docs/interfaces/TrieShallowCopyOpts.md index 33b985c91a4..1035b22436b 100644 --- a/packages/mpt/docs/interfaces/TrieShallowCopyOpts.md +++ b/packages/mpt/docs/interfaces/TrieShallowCopyOpts.md @@ -1,30 +1,25 @@ -[@ethereumjs/trie](../README.md) / TrieShallowCopyOpts +[**@ethereumjs/mpt**](../README.md) -# Interface: TrieShallowCopyOpts +*** -## Table of contents +[@ethereumjs/mpt](../README.md) / TrieShallowCopyOpts -### Properties +# Interface: TrieShallowCopyOpts -- [cacheSize](TrieShallowCopyOpts.md#cachesize) -- [keyPrefix](TrieShallowCopyOpts.md#keyprefix) +Defined in: [packages/mpt/src/types.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L122) ## Properties -### cacheSize - -• `Optional` **cacheSize**: `number` - -#### Defined in +### cacheSize? -[packages/trie/src/types.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L115) +> `optional` **cacheSize**: `number` -___ +Defined in: [packages/mpt/src/types.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L124) -### keyPrefix +*** -• `Optional` **keyPrefix**: `Uint8Array` +### keyPrefix? -#### Defined in +> `optional` **keyPrefix**: `Uint8Array`\<`ArrayBufferLike`\> -[packages/trie/src/types.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/types.ts#L114) +Defined in: [packages/mpt/src/types.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L123) diff --git a/packages/mpt/docs/type-aliases/BranchMPTNodeBranchValue.md b/packages/mpt/docs/type-aliases/BranchMPTNodeBranchValue.md new file mode 100644 index 00000000000..c85768dd4a7 --- /dev/null +++ b/packages/mpt/docs/type-aliases/BranchMPTNodeBranchValue.md @@ -0,0 +1,11 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / BranchMPTNodeBranchValue + +# Type Alias: BranchMPTNodeBranchValue + +> **BranchMPTNodeBranchValue** = [`NodeReferenceOrRawMPTNode`](NodeReferenceOrRawMPTNode.md) \| `null` + +Defined in: [packages/mpt/src/types.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L22) diff --git a/packages/mpt/docs/type-aliases/Checkpoint.md b/packages/mpt/docs/type-aliases/Checkpoint.md new file mode 100644 index 00000000000..7b7afb5772d --- /dev/null +++ b/packages/mpt/docs/type-aliases/Checkpoint.md @@ -0,0 +1,27 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / Checkpoint + +# Type Alias: Checkpoint + +> **Checkpoint** = `object` + +Defined in: [packages/mpt/src/types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L144) + +## Properties + +### keyValueMap + +> **keyValueMap**: `Map`\<`string`, `Uint8Array` \| `undefined`\> + +Defined in: [packages/mpt/src/types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L147) + +*** + +### root + +> **root**: `Uint8Array` + +Defined in: [packages/mpt/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L148) diff --git a/packages/mpt/docs/type-aliases/FoundNodeFunction.md b/packages/mpt/docs/type-aliases/FoundNodeFunction.md new file mode 100644 index 00000000000..d2aeec967e3 --- /dev/null +++ b/packages/mpt/docs/type-aliases/FoundNodeFunction.md @@ -0,0 +1,33 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / FoundNodeFunction + +# Type Alias: FoundNodeFunction() + +> **FoundNodeFunction** = (`nodeRef`, `node`, `key`, `walkController`) => `void` + +Defined in: [packages/mpt/src/types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L38) + +## Parameters + +### nodeRef + +`Uint8Array` + +### node + +[`MPTNode`](MPTNode.md) | `null` + +### key + +[`Nibbles`](Nibbles.md) + +### walkController + +[`WalkController`](../classes/WalkController.md) + +## Returns + +`void` diff --git a/packages/mpt/docs/type-aliases/HashKeysFunction.md b/packages/mpt/docs/type-aliases/HashKeysFunction.md new file mode 100644 index 00000000000..b85ff7f2fcf --- /dev/null +++ b/packages/mpt/docs/type-aliases/HashKeysFunction.md @@ -0,0 +1,21 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / HashKeysFunction + +# Type Alias: HashKeysFunction() + +> **HashKeysFunction** = (`msg`) => `Uint8Array` + +Defined in: [packages/mpt/src/types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L45) + +## Parameters + +### msg + +`Uint8Array` + +## Returns + +`Uint8Array` diff --git a/packages/mpt/docs/type-aliases/MPTNode.md b/packages/mpt/docs/type-aliases/MPTNode.md new file mode 100644 index 00000000000..146a4a26a65 --- /dev/null +++ b/packages/mpt/docs/type-aliases/MPTNode.md @@ -0,0 +1,11 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / MPTNode + +# Type Alias: MPTNode + +> **MPTNode** = [`BranchMPTNode`](../classes/BranchMPTNode.md) \| [`ExtensionMPTNode`](../classes/ExtensionMPTNode.md) \| [`LeafMPTNode`](../classes/LeafMPTNode.md) + +Defined in: [packages/mpt/src/types.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L7) diff --git a/packages/mpt/docs/type-aliases/MPTOptsWithDefaults.md b/packages/mpt/docs/type-aliases/MPTOptsWithDefaults.md new file mode 100644 index 00000000000..ad7c5ae15c6 --- /dev/null +++ b/packages/mpt/docs/type-aliases/MPTOptsWithDefaults.md @@ -0,0 +1,33 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / MPTOptsWithDefaults + +# Type Alias: MPTOptsWithDefaults + +> **MPTOptsWithDefaults** = [`MPTOpts`](../interfaces/MPTOpts.md) & `object` + +Defined in: [packages/mpt/src/types.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L114) + +## Type declaration + +### cacheSize + +> **cacheSize**: `number` + +### useKeyHashing + +> **useKeyHashing**: `boolean` + +### useKeyHashingFunction + +> **useKeyHashingFunction**: [`HashKeysFunction`](HashKeysFunction.md) + +### useNodePruning + +> **useNodePruning**: `boolean` + +### useRootPersistence + +> **useRootPersistence**: `boolean` diff --git a/packages/mpt/docs/type-aliases/Nibbles.md b/packages/mpt/docs/type-aliases/Nibbles.md new file mode 100644 index 00000000000..2821109d38e --- /dev/null +++ b/packages/mpt/docs/type-aliases/Nibbles.md @@ -0,0 +1,11 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / Nibbles + +# Type Alias: Nibbles + +> **Nibbles** = `number`[] + +Defined in: [packages/mpt/src/types.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L9) diff --git a/packages/mpt/docs/type-aliases/NodeReferenceOrRawMPTNode.md b/packages/mpt/docs/type-aliases/NodeReferenceOrRawMPTNode.md new file mode 100644 index 00000000000..7ac5c1b2da9 --- /dev/null +++ b/packages/mpt/docs/type-aliases/NodeReferenceOrRawMPTNode.md @@ -0,0 +1,11 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / NodeReferenceOrRawMPTNode + +# Type Alias: NodeReferenceOrRawMPTNode + +> **NodeReferenceOrRawMPTNode** = `Uint8Array` \| [`RawExtensionMPTNode`](RawExtensionMPTNode.md) \| [`RawLeafMPTNode`](RawLeafMPTNode.md) + +Defined in: [packages/mpt/src/types.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L20) diff --git a/packages/mpt/docs/type-aliases/Proof.md b/packages/mpt/docs/type-aliases/Proof.md new file mode 100644 index 00000000000..22f5e48bd56 --- /dev/null +++ b/packages/mpt/docs/type-aliases/Proof.md @@ -0,0 +1,11 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / Proof + +# Type Alias: Proof + +> **Proof** = `Uint8Array`[] + +Defined in: [packages/mpt/src/types.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L24) diff --git a/packages/mpt/docs/type-aliases/RawExtensionMPTNode.md b/packages/mpt/docs/type-aliases/RawExtensionMPTNode.md new file mode 100644 index 00000000000..9b90a0ef871 --- /dev/null +++ b/packages/mpt/docs/type-aliases/RawExtensionMPTNode.md @@ -0,0 +1,11 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / RawExtensionMPTNode + +# Type Alias: RawExtensionMPTNode + +> **RawExtensionMPTNode** = \[`Uint8Array`, `Uint8Array`\] + +Defined in: [packages/mpt/src/types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L15) diff --git a/packages/mpt/docs/type-aliases/RawLeafMPTNode.md b/packages/mpt/docs/type-aliases/RawLeafMPTNode.md new file mode 100644 index 00000000000..2e9537e9bda --- /dev/null +++ b/packages/mpt/docs/type-aliases/RawLeafMPTNode.md @@ -0,0 +1,11 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / RawLeafMPTNode + +# Type Alias: RawLeafMPTNode + +> **RawLeafMPTNode** = \[`Uint8Array`, `Uint8Array`\] + +Defined in: [packages/mpt/src/types.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L16) diff --git a/packages/mpt/docs/variables/ROOT_DB_KEY.md b/packages/mpt/docs/variables/ROOT_DB_KEY.md new file mode 100644 index 00000000000..90c629fdf2d --- /dev/null +++ b/packages/mpt/docs/variables/ROOT_DB_KEY.md @@ -0,0 +1,11 @@ +[**@ethereumjs/mpt**](../README.md) + +*** + +[@ethereumjs/mpt](../README.md) / ROOT\_DB\_KEY + +# Variable: ROOT\_DB\_KEY + +> `const` **ROOT\_DB\_KEY**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/mpt/src/types.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/mpt/src/types.ts#L151) diff --git a/packages/mpt/package.json b/packages/mpt/package.json index 271ca8b4e48..128f3a2448d 100644 --- a/packages/mpt/package.json +++ b/packages/mpt/package.json @@ -36,7 +36,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- mpt", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", @@ -57,7 +57,7 @@ "@ethereumjs/util": "^10.0.0-rc.1", "debug": "^4.4.0", "lru-cache": "11.0.2", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@ethereumjs/genesis": "^10.0.0-rc.1", diff --git a/packages/mpt/src/util/encoding.ts b/packages/mpt/src/util/encoding.ts index a18443a0301..6df59bbbfe0 100644 --- a/packages/mpt/src/util/encoding.ts +++ b/packages/mpt/src/util/encoding.ts @@ -1,4 +1,4 @@ -import { concatBytes, hexToBytes, toBytes, unprefixedHexToBytes } from '@ethereumjs/util' +import { concatBytes, hexToBytes, unprefixedHexToBytes } from '@ethereumjs/util' import { nibblesTypeToPackedBytes } from './nibbles.ts' @@ -129,12 +129,11 @@ export const nibbleTypeToByteType = (arr: Nibbles): Uint8Array => { * @returns Nibble typed nibble array */ export const byteTypeToNibbleType = (key: Uint8Array): Nibbles => { - const bKey = toBytes(key) const nibbles = [] as Nibbles - for (let i = 0; i < bKey.length; i++) { + for (let i = 0; i < key.length; i++) { const q = i - nibbles[q] = bKey[i] % 16 + nibbles[q] = key[i] % 16 } return nibbles diff --git a/packages/mpt/src/util/nibbles.ts b/packages/mpt/src/util/nibbles.ts index 980edfa2b68..1a333a06635 100644 --- a/packages/mpt/src/util/nibbles.ts +++ b/packages/mpt/src/util/nibbles.ts @@ -1,5 +1,3 @@ -import { toBytes } from '@ethereumjs/util' - import type { Nibbles } from '../types.ts' /** @@ -8,14 +6,13 @@ import type { Nibbles } from '../types.ts' * @param key */ export function bytesToNibbles(key: Uint8Array): Nibbles { - const bKey = toBytes(key) const nibbles = [] as Nibbles - for (let i = 0; i < bKey.length; i++) { + for (let i = 0; i < key.length; i++) { let q = i * 2 - nibbles[q] = bKey[i] >> 4 + nibbles[q] = key[i] >> 4 ++q - nibbles[q] = bKey[i] % 16 + nibbles[q] = key[i] % 16 } return nibbles diff --git a/packages/mpt/test/proof/range.spec.ts b/packages/mpt/test/proof/range.spec.ts index 5fce15fafa2..0da1f447ea8 100644 --- a/packages/mpt/test/proof/range.spec.ts +++ b/packages/mpt/test/proof/range.spec.ts @@ -3,9 +3,9 @@ import { compareBytes, concatBytes, hexToBytes, + intToBytes, randomBytes, setLengthLeft, - toBytes, } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' @@ -28,8 +28,9 @@ async function randomTrie(db: DB, addKey: boolean = true) { if (addKey) { for (let i = 0; i < 100; i++) { - const key = setLengthLeft(toBytes(i), 32) - const val = toBytes(i) + const indexBytes = intToBytes(i) + const key = setLengthLeft(indexBytes, 32) + const val = indexBytes await trie.put(key, val) entries.push([key, val]) } @@ -62,7 +63,7 @@ function getRandomIntInclusive(min: number, max: number): number { function decreaseKey(key: Uint8Array) { for (let i = key.length - 1; i >= 0; i--) { if (key[i] > 0) { - return concatBytes(key.slice(0, i), toBytes(key[i] - 1), key.slice(i + 1)) + return concatBytes(key.slice(0, i), intToBytes(key[i] - 1), key.slice(i + 1)) } } } @@ -70,7 +71,7 @@ function decreaseKey(key: Uint8Array) { function increaseKey(key: Uint8Array) { for (let i = key.length - 1; i >= 0; i--) { if (key[i] < 255) { - return concatBytes(key.slice(0, i), toBytes(key[i] + 1), key.slice(i + 1)) + return concatBytes(key.slice(0, i), intToBytes(key[i] + 1), key.slice(i + 1)) } } } @@ -323,8 +324,9 @@ describe('simple merkle range proofs generation and verification', () => { const trie = new MerklePatriciaTrie() const entries: [Uint8Array, Uint8Array][] = [] for (let i = 0; i < 10; i++) { - const key = setLengthLeft(toBytes(i), 32) - const val = toBytes(i) + const indexBytes = intToBytes(i) + const key = setLengthLeft(indexBytes, 32) + const val = indexBytes await trie.put(key, val) entries.push([key, val]) } diff --git a/packages/mpt/test/trie/trie.spec.ts b/packages/mpt/test/trie/trie.spec.ts index cb6320021db..046b44c4e8e 100644 --- a/packages/mpt/test/trie/trie.spec.ts +++ b/packages/mpt/test/trie/trie.spec.ts @@ -4,6 +4,7 @@ import { BIGINT_2, KECCAK256_RLP, MapDB, + type PrefixedHexString, bigIntToBytes, bytesToBigInt, bytesToHex, @@ -277,10 +278,10 @@ describe('keyHashingFunction', async () => { describe('getValueMap', async () => { const trie = await createMPT({}) - const entries: [Uint8Array, string][] = [ - [bigIntToBytes(0x01n), '0x' + '0a'.repeat(32)], - [bigIntToBytes(0x02n), '0x' + '0b'.repeat(32)], - [bigIntToBytes(0x03n), '0x' + '0c'.repeat(32)], + const entries: [Uint8Array, PrefixedHexString][] = [ + [bigIntToBytes(0x01n), `0x${'0a'.repeat(32)}`], + [bigIntToBytes(0x02n), `0x${'0b'.repeat(32)}`], + [bigIntToBytes(0x03n), `0x${'0c'.repeat(32)}`], ] for (const entry of entries) { await trie.put(entry[0], hexToBytes(entry[1])) @@ -348,7 +349,7 @@ describe('getValueMap', async () => { const KEYS = 1000 const KEY_LEN = 3 // Keys are of equal length const gotKeys = new Set() - const entries: [Uint8Array, string][] = [] + const entries: [Uint8Array, PrefixedHexString][] = [] for (let i = 0; i < KEYS; i++) { const key = randomBytes(KEY_LEN) const keyBigInt = bytesToBigInt(key) diff --git a/packages/mpt/typedoc.cjs b/packages/mpt/typedoc.mjs similarity index 54% rename from packages/mpt/typedoc.cjs rename to packages/mpt/typedoc.mjs index 701fee055fa..4f962d06684 100644 --- a/packages/mpt/typedoc.cjs +++ b/packages/mpt/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts'], diff --git a/packages/rlp/README.md b/packages/rlp/README.md index 9913f4152da..bfffacd408f 100644 --- a/packages/rlp/README.md +++ b/packages/rlp/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/rlp +# @ethereumjs/rlp `v10` [![NPM Package][rlp-npm-badge]][rlp-npm-link] [![GitHub Issues][rlp-issues-badge]][rlp-issues-link] @@ -9,6 +9,16 @@ | [Recursive Length Prefix](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp) encoding for Node.js and the browser. | | ----------------------------------------------------------------------------------------------------------------------------------------- | +## Table of Contents + +- [Installation](#installation) +- [Usage](#usage) +- [Browser](#browser) +- [API](#api) +- [CLI](#cli) +- [EthereumJS](#ethereumjs) +- [License](#license) + ## Installation To obtain the latest version, simply require the project using `npm`: diff --git a/packages/statemanager/README.md b/packages/statemanager/README.md index a796375904a..c23b83768d4 100644 --- a/packages/statemanager/README.md +++ b/packages/statemanager/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/statemanager +# @ethereumjs/statemanager `v10` [![NPM Package][statemanager-npm-badge]][statemanager-npm-link] [![GitHub Issues][statemanager-issues-badge]][statemanager-issues-link] @@ -9,6 +9,30 @@ | Library to provide high level access to Ethereum State | | ------------------------------------------------------ | +- 🫧 Transparent state access from EVM/VM +- 🌴 Tree-shakeable API +- 👷🏼 Controlled dependency set (5 external + `@Noble` crypto) +- ⏳ Checkpoints + Diff-based Caches +- 🔌 Unified interface (for custom SMs) +- 🎁 3 SMs included (Merkle/Simple/RPC) +- 🛵 233KB bundle size (for Merkle SM) (63KB gzipped) +- 🏄🏾‍♂️ WASM-free default + Fully browser ready + +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [MerkleStateManager](#merklestatemanager) +- [SimpleStateManager](#simplestatemanager) +- [RPCStateManager](#rpcstatemanager) +- [Verkle (experimental)](#verkle-state-managers-experimental) +- [Browser](#browser) +- [API](#api) +- [Development](#development) +- [EthereumJS](#ethereumjs) +- [License](#license) + + ## Installation To obtain the latest version, simply require the project using `npm`: @@ -17,9 +41,9 @@ To obtain the latest version, simply require the project using `npm`: npm install @ethereumjs/statemanager ``` -## Usage +## Getting Started -### Introduction +### Overview The `StateManager` provides high-level access and manipulation methods to and for the Ethereum state, thinking in terms of accounts or contract code rather then the storage operations of the underlying data structure (e.g. a [Trie](../trie/)). @@ -33,9 +57,13 @@ This library includes several different implementations that all implement the ` It also includes a checkpoint/revert/commit mechanism to either persist or revert state changes and provides a sophisticated caching mechanism under the hood to reduce the need reading state accesses from disk. -### `MerkleStateManager` +### WASM Crypto Support + +This library by default uses JavaScript implementations for the basic standard crypto primitives like hashing for underlying trie keys. See `@ethereumjs/common` [README](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common) for instructions on how to replace with e.g. a more performant WASM implementation by using a shared `common` instance. + +## `MerkleStateManager` -#### Usage example +### Usage example ```ts // ./examples/basicUsage.ts @@ -62,7 +90,7 @@ const main = async () => { void main() ``` -#### Account, Storage and Code Caches +### Account, Storage and Code Caches Starting with the v2 release and complemented by the v2.1 release the StateManager comes with a significantly more elaborate caching mechanism for account, storage and code caches. @@ -72,34 +100,7 @@ Caches now "survive" a flush operation and especially long-lived usage scenarios Have a look at the extended `CacheOptions` on how to use and leverage the new cache system. -### `SimpleStateManager` - -The `SimpleStateManager` is a dependency-minimized simple state manager implementation. While this state manager implementation lacks the implementations of some non-core functionality as well as proof related logic (e.g. `setStateRoot()`) it is suitable for a lot use cases where things like sophisticated caching or state root handling is not needed. - -This state manager can be instantiated and used as follows: - -```ts -// ./examples/simple.ts - -import { Account, createAddressFromPrivateKey, randomBytes } from '@ethereumjs/util' - -import { SimpleStateManager } from '../src/index.ts' - -const main = async () => { - const sm = new SimpleStateManager() - const address = createAddressFromPrivateKey(randomBytes(32)) - const account = new Account(0n, 0xfffffn) - await sm.putAccount(address, account) - console.log(await sm.getAccount(address)) -} - -void main() - -``` - -### `MerkleStateManager` -> Proofs - -#### Instantiating from a Proof +### Instantiating from Proofs The `MerkleStateManager` has a standalone constructor function `fromMerkleStateProof` that accepts one or more [EIP-1186](https://eips.ethereum.org/EIPS/eip-1186) [proofs](./src/stateManager.ts) and will instantiate a `MerkleStateManager` with a partial trie containing the state provided by the proof(s). Be aware that this constructor accepts the `StateManagerOpts` dictionary as a third parameter (i.e. `fromMerkleStateProof(proof, safe, opts)`). @@ -168,7 +169,32 @@ const main = async () => { void main() ``` -### `RPCStateManager` +## `SimpleStateManager` + +The `SimpleStateManager` is a dependency-minimized simple state manager implementation. While this state manager implementation lacks the implementations of some non-core functionality as well as proof related logic (e.g. `setStateRoot()`) it is suitable for a lot use cases where things like sophisticated caching or state root handling is not needed. + +This state manager can be instantiated and used as follows: + +```ts +// ./examples/simple.ts + +import { Account, createAddressFromPrivateKey, randomBytes } from '@ethereumjs/util' + +import { SimpleStateManager } from '../src/index.ts' + +const main = async () => { + const sm = new SimpleStateManager() + const address = createAddressFromPrivateKey(randomBytes(32)) + const account = new Account(0n, 0xfffffn) + await sm.putAccount(address, account) + console.log(await sm.getAccount(address)) +} + +void main() + +``` + +## `RPCStateManager` The `RPCStateManager` can be be used with any JSON-RPC provider that supports the `eth` namespace. Instantiate the `VM` and pass in an `RPCStateManager` to run transactions against accounts sourced from the provider or to run blocks pulled from the provider at any specified block height. @@ -196,9 +222,9 @@ void main() **Note:** Usage of this StateManager can cause a heavy load regarding state request API calls, so be careful (or at least: aware) if used in combination with a JSON-RPC provider connecting to a third-party API service like Infura! -#### Points on `RPCStateManager` usage +### Points on `RPCStateManager` usage -##### Instantiating the EVM +#### Instantiating the EVM In order to have an EVM instance that supports the BLOCKHASH opcode (which requires access to block history), you must instantiate both the `RPCStateManager` and the `RpcBlockChain` and use that when initializing your EVM instance as below: @@ -224,37 +250,33 @@ void main() Note: Failing to provide the `RPCBlockChain` instance when instantiating the EVM means that the `BLOCKHASH` opcode will fail to work correctly during EVM execution. -##### Provider selection +#### Provider selection - The provider you select must support the `eth_getProof`, `eth_getCode`, and `eth_getStorageAt` RPC methods. - Not all providers support retrieving state from all block heights so refer to your provider's documentation. Trying to use a block height not supported by your provider (e.g. any block older than the last 256 for CloudFlare) will result in RPC errors when using the state manager. -##### Block Tag selection +#### Block Tag selection - You have to pass a block number or `earliest` in the constructor that specifies the block height you want to pull state from. - The `latest`/`pending` values supported by the Ethereum JSON-RPC are not supported as longer running scripts run the risk of state values changing as blocks are mined while your script is running. - If using a very recent block as your block tag, be aware that reorgs could occur and potentially alter the state you are interacting with. - If you want to rerun transactions from block X or run block X, you need to specify the block tag as X-1 in the state manager constructor to ensure you are pulling the state values at the point in time the transactions or block was run. -##### Potential gotchas +#### Potential gotchas - The RPC State Manager cannot compute valid state roots when running blocks as it does not have access to the entire Ethereum state trie so can not compute correct state roots, either for the account trie or for storage tries. - If you are replaying mainnet transactions and an account or account storage is touched by multiple transactions in a block, you must replay those transactions in order (with regard to their position in that block) or calculated gas will likely be different than actual gas consumed. -##### Further reference +#### Further reference Refer to [this test script](./test/rpcStateManager.spec.ts) for complete examples of running transactions and blocks in the `vm` with data sourced from a provider. -### `StatefulVerkleStateManager`/`StatelessVerkleStateManager` (experimental) +## Verkle (experimental) There are two new verkle related state managers integrated into the code base. These state managers are very experimental and meant to be used for connecting to early [Verkle Tree](https://eips.ethereum.org/EIPS/eip-6800) test networks (Kaustinen). These state managers are not yet sufficiently tested and APIs are not yet stable and it therefore should not be used in production. See [PRs around Verkle](https://github.com/search?q=repo%3Aethereumjs%2Fethereumjs-monorepo+verkle&type=pullrequests) in our monorepo for an entrypoint if you are interested in our current Verkle related work. -### WASM Crypto Support - -This library by default uses JavaScript implementations for the basic standard crypto primitives like hashing for underlying trie keys. See `@ethereumjs/common` [README](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common) for instructions on how to replace with e.g. a more performant WASM implementation by using a shared `common` instance. - ## Browser We provide hybrid ESM/CJS builds for all our libraries. With the v10 breaking release round from Spring 2025, all libraries are "pure-JS" by default and we have eliminated all hard-wired WASM code. Additionally we have substantially lowered the bundle sizes, reduced the number of dependencies, and cut out all usages of Node.js-specific primitives (like the Node.js event emitter). diff --git a/packages/statemanager/docs/README.md b/packages/statemanager/docs/README.md index dec8db9c23a..5fd0161ed9e 100644 --- a/packages/statemanager/docs/README.md +++ b/packages/statemanager/docs/README.md @@ -1,308 +1,57 @@ -@ethereumjs/statemanager +**@ethereumjs/statemanager** -# @ethereumjs/statemanager - -## Table of contents +*** -### Enumerations - -- [VerkleAccessedStateType](enums/VerkleAccessedStateType.md) -- [CacheType](enums/CacheType.md) +# @ethereumjs/statemanager -### Classes +## Classes -- [AccessWitness](classes/AccessWitness.md) - [AccountCache](classes/AccountCache.md) +- [Caches](classes/Caches.md) - [CodeCache](classes/CodeCache.md) -- [DefaultStateManager](classes/DefaultStateManager.md) +- [MerkleStateManager](classes/MerkleStateManager.md) - [OriginalStorageCache](classes/OriginalStorageCache.md) - [RPCBlockChain](classes/RPCBlockChain.md) - [RPCStateManager](classes/RPCStateManager.md) +- [SimpleStateManager](classes/SimpleStateManager.md) +- [StatefulBinaryTreeStateManager](classes/StatefulBinaryTreeStateManager.md) +- [StatefulVerkleStateManager](classes/StatefulVerkleStateManager.md) - [StatelessVerkleStateManager](classes/StatelessVerkleStateManager.md) - [StorageCache](classes/StorageCache.md) -### Interfaces +## Interfaces +- [BinaryTreeState](interfaces/BinaryTreeState.md) - [CacheOpts](interfaces/CacheOpts.md) -- [DefaultStateManagerOpts](interfaces/DefaultStateManagerOpts.md) +- [CachesStateManagerOpts](interfaces/CachesStateManagerOpts.md) +- [EncodedBinaryTreeState](interfaces/EncodedBinaryTreeState.md) - [EncodedVerkleProof](interfaces/EncodedVerkleProof.md) +- [MerkleStateManagerOpts](interfaces/MerkleStateManagerOpts.md) - [RPCStateManagerOpts](interfaces/RPCStateManagerOpts.md) +- [SimpleStateManagerOpts](interfaces/SimpleStateManagerOpts.md) +- [StatefulBinaryTreeStateManagerOpts](interfaces/StatefulBinaryTreeStateManagerOpts.md) +- [StatefulVerkleStateManagerOpts](interfaces/StatefulVerkleStateManagerOpts.md) - [StatelessVerkleStateManagerOpts](interfaces/StatelessVerkleStateManagerOpts.md) - [VerkleState](interfaces/VerkleState.md) -### Type Aliases - -- [AccessedStateWithAddress](README.md#accessedstatewithaddress) -- [Proof](README.md#proof) -- [StorageProof](README.md#storageproof) - -### Variables - -- [BALANCE\_LEAF\_KEY](README.md#balance_leaf_key) -- [CODEHASH\_PREFIX](README.md#codehash_prefix) -- [CODE\_KECCAK\_LEAF\_KEY](README.md#CODE_HASH_leaf_key) -- [CODE\_OFFSET](README.md#code_offset) -- [CODE\_SIZE\_LEAF\_KEY](README.md#code_size_leaf_key) -- [HEADER\_STORAGE\_OFFSET](README.md#header_storage_offset) -- [MAIN\_STORAGE\_OFFSET](README.md#main_storage_offset) -- [NONCE\_LEAF\_KEY](README.md#nonce_leaf_key) -- [VERKLE\_NODE\_WIDTH](README.md#verkle_node_width) -- [VERSION\_LEAF\_KEY](README.md#version_leaf_key) - -### Functions - -- [decodeAccessedState](README.md#decodeaccessedstate) -- [decodeValue](README.md#decodevalue) -- [getTreeIndexesForStorageSlot](README.md#gettreeindexesforstorageslot) -- [getTreeIndicesForCodeChunk](README.md#gettreeindicesforcodechunk) - ## Type Aliases -### AccessedStateWithAddress - -Ƭ **AccessedStateWithAddress**: `AccessedState` & { `address`: `Address` ; `chunkKey`: `PrefixedHexString` } - -#### Defined in - -[accessWitness.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L69) - -___ - -### Proof - -Ƭ **Proof**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `accountProof` | `PrefixedHexString`[] | -| `address` | `PrefixedHexString` | -| `balance` | `PrefixedHexString` | -| `codeHash` | `PrefixedHexString` | -| `nonce` | `PrefixedHexString` | -| `storageHash` | `PrefixedHexString` | -| `storageProof` | [`StorageProof`](README.md#storageproof)[] | - -#### Defined in - -[stateManager.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L43) - -___ - -### StorageProof - -Ƭ **StorageProof**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `key` | `PrefixedHexString` | -| `proof` | `PrefixedHexString`[] | -| `value` | `PrefixedHexString` | - -#### Defined in - -[stateManager.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L37) +- [CacheType](type-aliases/CacheType.md) +- [Proof](type-aliases/Proof.md) +- [StorageProof](type-aliases/StorageProof.md) ## Variables -### BALANCE\_LEAF\_KEY - -• `Const` **BALANCE\_LEAF\_KEY**: `Uint8Array` - -#### Defined in - -[accessWitness.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L14) - -___ - -### CODEHASH\_PREFIX - -• `Const` **CODEHASH\_PREFIX**: `Uint8Array` - -Prefix to distinguish between a contract deployed with code `0x80` -and `RLP([])` (also having the value `0x80`). - -Otherwise the creation of the code hash for the `0x80` contract -will be the same as the hash of the empty trie which leads to -misbehaviour in the underlying trie library. - -#### Defined in - -[stateManager.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L104) - -___ - -### CODE\_KECCAK\_LEAF\_KEY - -• `Const` **CODE\_KECCAK\_LEAF\_KEY**: `Uint8Array` - -#### Defined in - -[accessWitness.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L16) - -___ - -### CODE\_OFFSET - -• `Const` **CODE\_OFFSET**: ``128`` - -#### Defined in - -[accessWitness.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L20) - -___ - -### CODE\_SIZE\_LEAF\_KEY - -• `Const` **CODE\_SIZE\_LEAF\_KEY**: `Uint8Array` - -#### Defined in - -[accessWitness.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L17) - -___ - -### HEADER\_STORAGE\_OFFSET - -• `Const` **HEADER\_STORAGE\_OFFSET**: ``64`` - -#### Defined in - -[accessWitness.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L19) - -___ - -### MAIN\_STORAGE\_OFFSET - -• `Const` **MAIN\_STORAGE\_OFFSET**: `bigint` - -#### Defined in - -[accessWitness.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L24) - -___ - -### NONCE\_LEAF\_KEY - -• `Const` **NONCE\_LEAF\_KEY**: `Uint8Array` - -#### Defined in - -[accessWitness.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L15) - -___ - -### VERKLE\_NODE\_WIDTH - -• `Const` **VERKLE\_NODE\_WIDTH**: ``256`` - -#### Defined in - -[accessWitness.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L21) - -___ - -### VERSION\_LEAF\_KEY - -• `Const` **VERSION\_LEAF\_KEY**: `Uint8Array` - -Tree key constants. - -#### Defined in - -[accessWitness.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L13) +- [CacheType](variables/CacheType.md) +- [CODEHASH\_PREFIX](variables/CODEHASH_PREFIX.md) ## Functions -### decodeAccessedState - -▸ **decodeAccessedState**(`treeIndex`, `chunkIndex`): `AccessedState` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `treeIndex` | `number` \| `bigint` | -| `chunkIndex` | `number` | - -#### Returns - -`AccessedState` - -#### Defined in - -[accessWitness.ts:378](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L378) - -___ - -### decodeValue - -▸ **decodeValue**(`type`, `value`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `type` | [`VerkleAccessedStateType`](enums/VerkleAccessedStateType.md) | -| `value` | ``null`` \| `string` | - -#### Returns - -`string` - -#### Defined in - -[accessWitness.ts:413](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L413) - -___ - -### getTreeIndexesForStorageSlot - -▸ **getTreeIndexesForStorageSlot**(`storageKey`): `Object` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `storageKey` | `bigint` | - -#### Returns - -`Object` - -| Name | Type | -| :------ | :------ | -| `subIndex` | `number` | -| `treeIndex` | `bigint` | - -#### Defined in - -[accessWitness.ts:355](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L355) - -___ - -### getTreeIndicesForCodeChunk - -▸ **getTreeIndicesForCodeChunk**(`chunkId`): `Object` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chunkId` | `number` | - -#### Returns - -`Object` - -| Name | Type | -| :------ | :------ | -| `subIndex` | `number` | -| `treeIndex` | `number` | - -#### Defined in - -[accessWitness.ts:372](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L372) +- [addMerkleStateProofData](functions/addMerkleStateProofData.md) +- [addMerkleStateStorageProof](functions/addMerkleStateStorageProof.md) +- [fromMerkleStateProof](functions/fromMerkleStateProof.md) +- [getMerkleStateProof](functions/getMerkleStateProof.md) +- [getRPCStateProof](functions/getRPCStateProof.md) +- [getVerkleStateProof](functions/getVerkleStateProof.md) +- [verifyMerkleStateProof](functions/verifyMerkleStateProof.md) +- [verifyVerkleStateProof](functions/verifyVerkleStateProof.md) diff --git a/packages/statemanager/docs/classes/AccessWitness.md b/packages/statemanager/docs/classes/AccessWitness.md deleted file mode 100644 index 39163b5e1a2..00000000000 --- a/packages/statemanager/docs/classes/AccessWitness.md +++ /dev/null @@ -1,417 +0,0 @@ -[@ethereumjs/statemanager](../README.md) / AccessWitness - -# Class: AccessWitness - -## Table of contents - -### Constructors - -- [constructor](AccessWitness.md#constructor) - -### Properties - -- [chunks](AccessWitness.md#chunks) -- [stems](AccessWitness.md#stems) - -### Methods - -- [accesses](AccessWitness.md#accesses) -- [merge](AccessWitness.md#merge) -- [rawAccesses](AccessWitness.md#rawaccesses) -- [shallowCopy](AccessWitness.md#shallowcopy) -- [touchAddress](AccessWitness.md#touchaddress) -- [touchAddressAndChargeGas](AccessWitness.md#touchaddressandchargegas) -- [touchAddressOnReadAndComputeGas](AccessWitness.md#touchaddressonreadandcomputegas) -- [touchAddressOnWriteAndComputeGas](AccessWitness.md#touchaddressonwriteandcomputegas) -- [touchAndChargeContractCreateCompleted](AccessWitness.md#touchandchargecontractcreatecompleted) -- [touchAndChargeContractCreateInit](AccessWitness.md#touchandchargecontractcreateinit) -- [touchAndChargeMessageCall](AccessWitness.md#touchandchargemessagecall) -- [touchAndChargeProofOfAbsence](AccessWitness.md#touchandchargeproofofabsence) -- [touchAndChargeValueTransfer](AccessWitness.md#touchandchargevaluetransfer) -- [touchCodeChunksRangeOnReadAndChargeGas](AccessWitness.md#touchcodechunksrangeonreadandchargegas) -- [touchCodeChunksRangeOnWriteAndChargeGas](AccessWitness.md#touchcodechunksrangeonwriteandchargegas) -- [touchTxTargetAndComputeGas](AccessWitness.md#touchtxtargetandcomputegas) -- [touchTxOriginAndComputeGas](AccessWitness.md#touchtxoriginandcomputegas) - -## Constructors - -### constructor - -• **new AccessWitness**(`opts?`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | `Object` | -| `opts.chunks?` | `Map`<`string`, `ChunkAccessEvent`\> | -| `opts.stems?` | `Map`<`string`, `StemAccessEvent` & `StemMeta`\> | - -#### Defined in - -[accessWitness.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L78) - -## Properties - -### chunks - -• **chunks**: `Map`<`string`, `ChunkAccessEvent`\> - -#### Defined in - -[accessWitness.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L76) - -___ - -### stems - -• **stems**: `Map`<`string`, `StemAccessEvent` & `StemMeta`\> - -#### Defined in - -[accessWitness.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L75) - -## Methods - -### accesses - -▸ **accesses**(): `Generator`<[`AccessedStateWithAddress`](../README.md#accessedstatewithaddress), `any`, `unknown`\> - -#### Returns - -`Generator`<[`AccessedStateWithAddress`](../README.md#accessedstatewithaddress), `any`, `unknown`\> - -#### Defined in - -[accessWitness.ts:346](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L346) - -___ - -### merge - -▸ **merge**(`accessWitness`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `accessWitness` | [`AccessWitness`](AccessWitness.md) | - -#### Returns - -`void` - -#### Defined in - -[accessWitness.ts:306](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L306) - -___ - -### rawAccesses - -▸ **rawAccesses**(): `Generator`<`RawAccessedState`, `any`, `unknown`\> - -#### Returns - -`Generator`<`RawAccessedState`, `any`, `unknown`\> - -#### Defined in - -[accessWitness.ts:331](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L331) - -___ - -### shallowCopy - -▸ **shallowCopy**(): [`AccessWitness`](AccessWitness.md) - -Create a shallow copy, could clone some caches in future for optimizations - -#### Returns - -[`AccessWitness`](AccessWitness.md) - -#### Defined in - -[accessWitness.ts:302](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L302) - -___ - -### touchAddress - -▸ **touchAddress**(`address`, `treeIndex`, `subIndex`, `__namedParameters?`): `AccessEventFlags` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `treeIndex` | `number` \| `bigint` | -| `subIndex` | `number` \| `Uint8Array` | -| `__namedParameters` | `Object` | -| `__namedParameters.isWrite?` | `boolean` | - -#### Returns - -`AccessEventFlags` - -#### Defined in - -[accessWitness.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L249) - -___ - -### touchAddressAndChargeGas - -▸ **touchAddressAndChargeGas**(`address`, `treeIndex`, `subIndex`, `__namedParameters`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `treeIndex` | `number` \| `bigint` | -| `subIndex` | `number` \| `Uint8Array` | -| `__namedParameters` | `Object` | -| `__namedParameters.isWrite?` | `boolean` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L210) - -___ - -### touchAddressOnReadAndComputeGas - -▸ **touchAddressOnReadAndComputeGas**(`address`, `treeIndex`, `subIndex`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `treeIndex` | `number` \| `bigint` | -| `subIndex` | `number` \| `Uint8Array` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L202) - -___ - -### touchAddressOnWriteAndComputeGas - -▸ **touchAddressOnWriteAndComputeGas**(`address`, `treeIndex`, `subIndex`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `treeIndex` | `number` \| `bigint` | -| `subIndex` | `number` \| `Uint8Array` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L194) - -___ - -### touchAndChargeContractCreateCompleted - -▸ **touchAndChargeContractCreateCompleted**(`address`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L134) - -___ - -### touchAndChargeContractCreateInit - -▸ **touchAndChargeContractCreateInit**(`address`, `__namedParameters?`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `__namedParameters` | `Object` | -| `__namedParameters.sendsValue?` | `boolean` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L118) - -___ - -### touchAndChargeMessageCall - -▸ **touchAndChargeMessageCall**(`address`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L100) - -___ - -### touchAndChargeProofOfAbsence - -▸ **touchAndChargeProofOfAbsence**(`address`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L88) - -___ - -### touchAndChargeValueTransfer - -▸ **touchAndChargeValueTransfer**(`caller`, `target`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `caller` | `Address` | -| `target` | `Address` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L109) - -___ - -### touchCodeChunksRangeOnReadAndChargeGas - -▸ **touchCodeChunksRangeOnReadAndChargeGas**(`contact`, `startPc`, `endPc`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contact` | `Address` | -| `startPc` | `number` | -| `endPc` | `number` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L176) - -___ - -### touchCodeChunksRangeOnWriteAndChargeGas - -▸ **touchCodeChunksRangeOnWriteAndChargeGas**(`contact`, `startPc`, `endPc`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contact` | `Address` | -| `startPc` | `number` | -| `endPc` | `number` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L185) - -___ - -### touchTxTargetAndComputeGas - -▸ **touchTxTargetAndComputeGas**(`target`, `__namedParameters?`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `target` | `Address` | -| `__namedParameters` | `Object` | -| `__namedParameters.sendsValue?` | `boolean` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L159) - -___ - -### touchTxOriginAndComputeGas - -▸ **touchTxOriginAndComputeGas**(`origin`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `origin` | `Address` | - -#### Returns - -`bigint` - -#### Defined in - -[accessWitness.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L146) diff --git a/packages/statemanager/docs/classes/AccountCache.md b/packages/statemanager/docs/classes/AccountCache.md index 8a5fc9b8043..3bd40c6ecbc 100644 --- a/packages/statemanager/docs/classes/AccountCache.md +++ b/packages/statemanager/docs/classes/AccountCache.md @@ -1,95 +1,70 @@ -[@ethereumjs/statemanager](../README.md) / AccountCache - -# Class: AccountCache +[**@ethereumjs/statemanager**](../README.md) -## Hierarchy +*** -- `Cache` +[@ethereumjs/statemanager](../README.md) / AccountCache - ↳ **`AccountCache`** +# Class: AccountCache -## Table of contents +Defined in: [cache/account.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L21) -### Constructors +## Extends -- [constructor](AccountCache.md#constructor) +- `Cache` -### Properties +## Constructors -- [\_checkpoints](AccountCache.md#_checkpoints) -- [\_debug](AccountCache.md#_debug) -- [\_diffCache](AccountCache.md#_diffcache) -- [\_lruCache](AccountCache.md#_lrucache) -- [\_orderedMapCache](AccountCache.md#_orderedmapcache) -- [\_stats](AccountCache.md#_stats) +### Constructor -### Methods +> **new AccountCache**(`opts`): `AccountCache` -- [\_saveCachePreState](AccountCache.md#_savecacheprestate) -- [checkpoint](AccountCache.md#checkpoint) -- [clear](AccountCache.md#clear) -- [commit](AccountCache.md#commit) -- [del](AccountCache.md#del) -- [flush](AccountCache.md#flush) -- [get](AccountCache.md#get) -- [put](AccountCache.md#put) -- [revert](AccountCache.md#revert) -- [size](AccountCache.md#size) -- [stats](AccountCache.md#stats) +Defined in: [cache/account.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L35) -## Constructors +#### Parameters -### constructor +##### opts -• **new AccountCache**(`opts`) +[`CacheOpts`](../interfaces/CacheOpts.md) -#### Parameters +#### Returns -| Name | Type | -| :------ | :------ | -| `opts` | [`CacheOpts`](../interfaces/CacheOpts.md) | +`AccountCache` #### Overrides -Cache.constructor - -#### Defined in - -[cache/account.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L36) +`Cache.constructor` ## Properties ### \_checkpoints -• **\_checkpoints**: `number` = `0` - -#### Inherited from +> **\_checkpoints**: `number` = `0` -Cache.\_checkpoints +Defined in: [cache/cache.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L8) -#### Defined in +#### Inherited from -[cache/cache.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L9) +`Cache._checkpoints` -___ +*** ### \_debug -• **\_debug**: `Debugger` - -#### Inherited from +> **\_debug**: `Debugger` -Cache.\_debug +Defined in: [cache/cache.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L6) -#### Defined in +#### Inherited from -[cache/cache.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L7) +`Cache._debug` -___ +*** ### \_diffCache -• **\_diffCache**: `Map`<`string`, `undefined` \| `AccountCacheElement`\>[] = `[]` +> **\_diffCache**: `Map`\<`string`, `undefined` \| `AccountCacheElement`\>[] = `[]` + +Defined in: [cache/account.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L34) Diff cache collecting the state of the cache at the beginning of checkpoint height @@ -99,79 +74,79 @@ If the whole cache element is undefined (in contrast to the account), the element didn't exist in the cache before. -#### Defined in +*** + +### \_lruCache -[cache/account.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L35) +> **\_lruCache**: `undefined` \| `LRUCache`\<`string`, `AccountCacheElement`, `unknown`\> -___ +Defined in: [cache/account.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L22) -### \_lruCache +*** -• **\_lruCache**: `undefined` \| `LRUCache`<`string`, `AccountCacheElement`, `unknown`\> +### \_orderedMapCache -#### Defined in +> **\_orderedMapCache**: `undefined` \| `OrderedMap`\<`string`, `AccountCacheElement`\> -[cache/account.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L23) +Defined in: [cache/account.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L23) -___ +*** -### \_orderedMapCache +### \_stats -• **\_orderedMapCache**: `undefined` \| `OrderedMap`<`string`, `AccountCacheElement`\> +> **\_stats**: `object` -#### Defined in +Defined in: [cache/cache.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L10) -[cache/account.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L24) +#### deletions -___ +> **deletions**: `number` = `0` -### \_stats +#### hits -• **\_stats**: `Object` +> **hits**: `number` = `0` -#### Type declaration +#### reads -| Name | Type | -| :------ | :------ | -| `dels` | `number` | -| `hits` | `number` | -| `reads` | `number` | -| `size` | `number` | -| `writes` | `number` | +> **reads**: `number` = `0` -#### Inherited from +#### size + +> **size**: `number` = `0` -Cache.\_stats +#### writes -#### Defined in +> **writes**: `number` = `0` + +#### Inherited from -[cache/cache.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L11) +`Cache._stats` ## Methods -### \_saveCachePreState +### \_saveCachePreState() -▸ **_saveCachePreState**(`cacheKeyHex`): `void` +> **\_saveCachePreState**(`cacheKeyHex`): `void` + +Defined in: [cache/account.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L50) #### Parameters -| Name | Type | -| :------ | :------ | -| `cacheKeyHex` | `string` | +##### cacheKeyHex + +`string` #### Returns `void` -#### Defined in +*** -[cache/account.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L51) +### checkpoint() -___ +> **checkpoint**(): `void` -### checkpoint - -▸ **checkpoint**(): `void` +Defined in: [cache/account.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L222) Marks current state of cache as checkpoint, which can later on be reverted or committed. @@ -180,15 +155,13 @@ later on be reverted or committed. `void` -#### Defined in - -[cache/account.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L214) +*** -___ +### clear() -### clear +> **clear**(): `void` -▸ **clear**(): `void` +Defined in: [cache/account.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L264) Clears cache. @@ -196,15 +169,13 @@ Clears cache. `void` -#### Defined in +*** -[cache/account.ts:256](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L256) +### commit() -___ +> **commit**(): `void` -### commit - -▸ **commit**(): `void` +Defined in: [cache/account.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L202) Commits to current state of cache (no effect on trie). @@ -212,99 +183,104 @@ Commits to current state of cache (no effect on trie). `void` -#### Defined in - -[cache/account.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L194) +*** -___ +### del() -### del +> **del**(`address`): `void` -▸ **del**(`address`): `void` +Defined in: [cache/account.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L122) Marks address as deleted in cache. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address | +##### address + +`Address` + +Address #### Returns `void` -#### Defined in +*** -[cache/account.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L114) +### flush() -___ +> **flush**(): \[`string`, `AccountCacheElement`\][] -### flush - -▸ **flush**(): [`string`, `AccountCacheElement`][] +Defined in: [cache/account.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L145) Flushes cache by returning accounts that have been modified or deleted and resetting the diff cache (at checkpoint height). #### Returns -[`string`, `AccountCacheElement`][] - -#### Defined in +\[`string`, `AccountCacheElement`\][] -[cache/account.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L137) +*** -___ +### get() -### get +> **get**(`address`): `undefined` \| `AccountCacheElement` -▸ **get**(`address`): `undefined` \| `AccountCacheElement` +Defined in: [cache/account.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L99) Returns the queried account or undefined if account doesn't exist #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of account | +##### address + +`Address` + +Address of account #### Returns `undefined` \| `AccountCacheElement` -#### Defined in +*** -[cache/account.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L91) +### put() -___ +> **put**(`address`, `account`, `couldBePartialAccount`): `void` -### put - -▸ **put**(`address`, `account`): `void` +Defined in: [cache/account.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L68) Puts account to cache under its address. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of account | -| `account` | `undefined` \| `Account` | Account or undefined if account doesn't exist in the trie | +##### address + +`Address` + +Address of account + +##### account + +Account or undefined if account doesn't exist in the trie + +`undefined` | `Account` + +##### couldBePartialAccount + +`boolean` = `false` #### Returns `void` -#### Defined in +*** -[cache/account.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L69) +### revert() -___ +> **revert**(): `void` -### revert - -▸ **revert**(): `void` +Defined in: [cache/account.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L174) Revert changes to cache last checkpoint (no effect on trie). @@ -312,15 +288,13 @@ Revert changes to cache last checkpoint (no effect on trie). `void` -#### Defined in - -[cache/account.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L166) +*** -___ +### size() -### size +> **size**(): `number` -▸ **size**(): `number` +Defined in: [cache/account.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L234) Returns the size of the cache @@ -328,36 +302,42 @@ Returns the size of the cache `number` -#### Defined in +*** -[cache/account.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L226) +### stats() -___ +> **stats**(`reset`): `object` -### stats - -▸ **stats**(`reset?`): `Object` +Defined in: [cache/account.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L246) Returns a dict with cache stats #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `reset` | `boolean` | `true` | +##### reset + +`boolean` = `true` #### Returns -`Object` +`object` + +##### deletions + +> **deletions**: `number` = `0` + +##### hits + +> **hits**: `number` = `0` + +##### reads + +> **reads**: `number` = `0` + +##### size -| Name | Type | -| :------ | :------ | -| `dels` | `number` | -| `hits` | `number` | -| `reads` | `number` | -| `size` | `number` | -| `writes` | `number` | +> **size**: `number` = `0` -#### Defined in +##### writes -[cache/account.ts:238](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/account.ts#L238) +> **writes**: `number` = `0` diff --git a/packages/statemanager/docs/classes/Caches.md b/packages/statemanager/docs/classes/Caches.md new file mode 100644 index 00000000000..f8ce776a85d --- /dev/null +++ b/packages/statemanager/docs/classes/Caches.md @@ -0,0 +1,143 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / Caches + +# Class: Caches + +Defined in: [cache/caches.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L8) + +## Constructors + +### Constructor + +> **new Caches**(`opts`): `Caches` + +Defined in: [cache/caches.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L15) + +#### Parameters + +##### opts + +[`CachesStateManagerOpts`](../interfaces/CachesStateManagerOpts.md) = `{}` + +#### Returns + +`Caches` + +## Properties + +### account? + +> `optional` **account**: [`AccountCache`](AccountCache.md) + +Defined in: [cache/caches.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L9) + +*** + +### code? + +> `optional` **code**: [`CodeCache`](CodeCache.md) + +Defined in: [cache/caches.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L10) + +*** + +### settings + +> **settings**: `Record`\<`"code"` \| `"account"` \| `"storage"`, [`CacheOpts`](../interfaces/CacheOpts.md)\> + +Defined in: [cache/caches.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L13) + +*** + +### storage? + +> `optional` **storage**: [`StorageCache`](StorageCache.md) + +Defined in: [cache/caches.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L11) + +## Methods + +### checkpoint() + +> **checkpoint**(): `void` + +Defined in: [cache/caches.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L59) + +#### Returns + +`void` + +*** + +### clear() + +> **clear**(): `void` + +Defined in: [cache/caches.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L65) + +#### Returns + +`void` + +*** + +### commit() + +> **commit**(): `void` + +Defined in: [cache/caches.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L71) + +#### Returns + +`void` + +*** + +### deleteAccount() + +> **deleteAccount**(`address`): `void` + +Defined in: [cache/caches.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L77) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`void` + +*** + +### revert() + +> **revert**(): `void` + +Defined in: [cache/caches.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L120) + +#### Returns + +`void` + +*** + +### shallowCopy() + +> **shallowCopy**(`downlevelCaches`): `undefined` \| `Caches` + +Defined in: [cache/caches.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/caches.ts#L83) + +#### Parameters + +##### downlevelCaches + +`boolean` + +#### Returns + +`undefined` \| `Caches` diff --git a/packages/statemanager/docs/classes/CodeCache.md b/packages/statemanager/docs/classes/CodeCache.md index ac047c287e4..e6990eab944 100644 --- a/packages/statemanager/docs/classes/CodeCache.md +++ b/packages/statemanager/docs/classes/CodeCache.md @@ -1,95 +1,70 @@ -[@ethereumjs/statemanager](../README.md) / CodeCache - -# Class: CodeCache +[**@ethereumjs/statemanager**](../README.md) -## Hierarchy +*** -- `Cache` +[@ethereumjs/statemanager](../README.md) / CodeCache - ↳ **`CodeCache`** +# Class: CodeCache -## Table of contents +Defined in: [cache/code.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L19) -### Constructors +## Extends -- [constructor](CodeCache.md#constructor) +- `Cache` -### Properties +## Constructors -- [\_checkpoints](CodeCache.md#_checkpoints) -- [\_debug](CodeCache.md#_debug) -- [\_diffCache](CodeCache.md#_diffcache) -- [\_lruCache](CodeCache.md#_lrucache) -- [\_orderedMapCache](CodeCache.md#_orderedmapcache) -- [\_stats](CodeCache.md#_stats) +### Constructor -### Methods +> **new CodeCache**(`opts`): `CodeCache` -- [\_saveCachePreState](CodeCache.md#_savecacheprestate) -- [checkpoint](CodeCache.md#checkpoint) -- [clear](CodeCache.md#clear) -- [commit](CodeCache.md#commit) -- [del](CodeCache.md#del) -- [flush](CodeCache.md#flush) -- [get](CodeCache.md#get) -- [put](CodeCache.md#put) -- [revert](CodeCache.md#revert) -- [size](CodeCache.md#size) -- [stats](CodeCache.md#stats) +Defined in: [cache/code.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L34) -## Constructors +#### Parameters -### constructor +##### opts -• **new CodeCache**(`opts`) +[`CacheOpts`](../interfaces/CacheOpts.md) -#### Parameters +#### Returns -| Name | Type | -| :------ | :------ | -| `opts` | [`CacheOpts`](../interfaces/CacheOpts.md) | +`CodeCache` #### Overrides -Cache.constructor - -#### Defined in - -[cache/code.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L36) +`Cache.constructor` ## Properties ### \_checkpoints -• **\_checkpoints**: `number` = `0` +> **\_checkpoints**: `number` = `0` -#### Inherited from +Defined in: [cache/cache.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L8) -Cache.\_checkpoints - -#### Defined in +#### Inherited from -[cache/cache.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L9) +`Cache._checkpoints` -___ +*** ### \_debug -• **\_debug**: `Debugger` - -#### Inherited from +> **\_debug**: `Debugger` -Cache.\_debug +Defined in: [cache/cache.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L6) -#### Defined in +#### Inherited from -[cache/cache.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L7) +`Cache._debug` -___ +*** ### \_diffCache -• **\_diffCache**: `Map`<`string`, `undefined` \| `CodeCacheElement`\>[] = `[]` +> **\_diffCache**: `Map`\<`string`, `undefined` \| `CodeCacheElement`\>[] = `[]` + +Defined in: [cache/code.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L32) Diff cache collecting the state of the cache at the beginning of checkpoint height @@ -99,81 +74,83 @@ If the whole cache element is undefined (in contrast to the code), the element didn't exist in the cache before. -#### Defined in +*** + +### \_lruCache -[cache/code.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L34) +> **\_lruCache**: `undefined` \| `LRUCache`\<`string`, `CodeCacheElement`, `unknown`\> -___ +Defined in: [cache/code.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L20) -### \_lruCache +*** -• **\_lruCache**: `undefined` \| `LRUCache`<`string`, `CodeCacheElement`, `unknown`\> +### \_orderedMapCache -#### Defined in +> **\_orderedMapCache**: `undefined` \| `OrderedMap`\<`string`, `CodeCacheElement`\> -[cache/code.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L22) +Defined in: [cache/code.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L21) -___ +*** -### \_orderedMapCache +### \_stats -• **\_orderedMapCache**: `undefined` \| `OrderedMap`<`string`, `CodeCacheElement`\> +> **\_stats**: `object` -#### Defined in +Defined in: [cache/cache.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L10) -[cache/code.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L23) +#### deletions -___ +> **deletions**: `number` = `0` -### \_stats +#### hits -• **\_stats**: `Object` +> **hits**: `number` = `0` -#### Type declaration +#### reads -| Name | Type | -| :------ | :------ | -| `dels` | `number` | -| `hits` | `number` | -| `reads` | `number` | -| `size` | `number` | -| `writes` | `number` | +> **reads**: `number` = `0` -#### Inherited from +#### size -Cache.\_stats +> **size**: `number` = `0` -#### Defined in +#### writes -[cache/cache.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L11) +> **writes**: `number` = `0` + +#### Inherited from + +`Cache._stats` ## Methods -### \_saveCachePreState +### \_saveCachePreState() + +> **\_saveCachePreState**(`cacheKeyHex`): `void` -▸ **_saveCachePreState**(`cacheKeyHex`): `void` +Defined in: [cache/code.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L54) Saves the state of the code cache before making changes to it. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `cacheKeyHex` | `string` | Account key for which code is being modified. | +##### cacheKeyHex + +`string` + +Account key for which code is being modified. #### Returns `void` -#### Defined in +*** -[cache/code.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L56) +### checkpoint() -___ +> **checkpoint**(): `void` -### checkpoint - -▸ **checkpoint**(): `void` +Defined in: [cache/code.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L220) Marks the current state of the cache as a checkpoint, which can later be reverted or committed. @@ -182,15 +159,13 @@ later be reverted or committed. `void` -#### Defined in - -[cache/code.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L222) +*** -___ +### clear() -### clear +> **clear**(): `void` -▸ **clear**(): `void` +Defined in: [cache/code.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L264) Clears the cache. @@ -198,15 +173,13 @@ Clears the cache. `void` -#### Defined in +*** -[cache/code.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L266) +### commit() -___ +> **commit**(): `void` -### commit - -▸ **commit**(): `void` +Defined in: [cache/code.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L200) Commits the current state of the cache (no effect on trie). @@ -214,99 +187,100 @@ Commits the current state of the cache (no effect on trie). `void` -#### Defined in - -[cache/code.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L202) +*** -___ +### del() -### del +> **del**(`address`): `void` -▸ **del**(`address`): `void` +Defined in: [cache/code.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L120) Marks code as deleted in the cache. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Account address for which code is being fetched. | +##### address + +`Address` + +Account address for which code is being fetched. #### Returns `void` -#### Defined in +*** -[cache/code.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L122) +### flush() -___ +> **flush**(): \[`string`, `CodeCacheElement`\][] -### flush - -▸ **flush**(): [`string`, `CodeCacheElement`][] +Defined in: [cache/code.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L143) Flushes the cache by returning codes that have been modified or deleted and resetting the diff cache (at checkpoint height). #### Returns -[`string`, `CodeCacheElement`][] - -#### Defined in +\[`string`, `CodeCacheElement`\][] -[cache/code.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L145) +*** -___ +### get() -### get +> **get**(`address`): `undefined` \| `CodeCacheElement` -▸ **get**(`address`): `undefined` \| `CodeCacheElement` +Defined in: [cache/code.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L96) Returns the queried code or undefined if it doesn't exist. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Account address for which code is being fetched. | +##### address + +`Address` + +Account address for which code is being fetched. #### Returns `undefined` \| `CodeCacheElement` -#### Defined in - -[cache/code.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L98) +*** -___ +### put() -### put +> **put**(`address`, `code`): `void` -▸ **put**(`address`, `code`): `void` +Defined in: [cache/code.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L73) Puts code into the cache under its hash. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of account code is being modified for. | -| `code` | `undefined` \| `Uint8Array` | Bytecode or undefined if code doesn't exist. | +##### address + +`Address` + +Address of account code is being modified for. + +##### code + +Bytecode or undefined if code doesn't exist. + +`undefined` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `void` -#### Defined in +*** -[cache/code.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L75) +### revert() -___ +> **revert**(): `void` -### revert - -▸ **revert**(): `void` +Defined in: [cache/code.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L172) Revert changes to the cache to the last checkpoint (no effect on trie). @@ -314,15 +288,13 @@ Revert changes to the cache to the last checkpoint (no effect on trie). `void` -#### Defined in - -[cache/code.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L174) +*** -___ +### size() -### size +> **size**(): `number` -▸ **size**(): `number` +Defined in: [cache/code.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L232) Returns the size of the cache @@ -330,30 +302,26 @@ Returns the size of the cache `number` -#### Defined in +*** -[cache/code.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L234) +### stats() -___ +> **stats**(`reset`): `any` -### stats - -▸ **stats**(`reset?`): `any` +Defined in: [cache/code.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L246) Returns a dictionary with cache statistics. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `reset` | `boolean` | `true` | Whether to reset statistics after retrieval. | +##### reset + +`boolean` = `true` + +Whether to reset statistics after retrieval. #### Returns `any` A dictionary with cache statistics. - -#### Defined in - -[cache/code.ts:248](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/code.ts#L248) diff --git a/packages/statemanager/docs/classes/DefaultStateManager.md b/packages/statemanager/docs/classes/DefaultStateManager.md deleted file mode 100644 index b83a7834e7a..00000000000 --- a/packages/statemanager/docs/classes/DefaultStateManager.md +++ /dev/null @@ -1,788 +0,0 @@ -[@ethereumjs/statemanager](../README.md) / DefaultStateManager - -# Class: DefaultStateManager - -Default StateManager implementation for the VM. - -The state manager abstracts from the underlying data store -by providing higher level access to accounts, contract code -and storage slots. - -The default state manager implementation uses a -`@ethereumjs/trie` trie as a data backend. - -## Implements - -- `EVMStateManagerInterface` - -## Table of contents - -### Constructors - -- [constructor](DefaultStateManager.md#constructor) - -### Properties - -- [common](DefaultStateManager.md#common) -- [originalStorageCache](DefaultStateManager.md#originalstoragecache) - -### Methods - -- [addProofData](DefaultStateManager.md#addproofdata) -- [checkpoint](DefaultStateManager.md#checkpoint) -- [clearCaches](DefaultStateManager.md#clearcaches) -- [clearContractStorage](DefaultStateManager.md#clearcontractstorage) -- [commit](DefaultStateManager.md#commit) -- [deleteAccount](DefaultStateManager.md#deleteaccount) -- [dumpStorage](DefaultStateManager.md#dumpstorage) -- [dumpStorageRange](DefaultStateManager.md#dumpstoragerange) -- [flush](DefaultStateManager.md#flush) -- [generateCanonicalGenesis](DefaultStateManager.md#generatecanonicalgenesis) -- [getAccount](DefaultStateManager.md#getaccount) -- [getAppliedKey](DefaultStateManager.md#getappliedkey) -- [getContractCode](DefaultStateManager.md#getcontractcode) -- [getContractStorage](DefaultStateManager.md#getcontractstorage) -- [getProof](DefaultStateManager.md#getproof) -- [getStateRoot](DefaultStateManager.md#getstateroot) -- [hasStateRoot](DefaultStateManager.md#hasstateroot) -- [modifyAccountFields](DefaultStateManager.md#modifyaccountfields) -- [putAccount](DefaultStateManager.md#putaccount) -- [putContractCode](DefaultStateManager.md#putcontractcode) -- [putContractStorage](DefaultStateManager.md#putcontractstorage) -- [revert](DefaultStateManager.md#revert) -- [setStateRoot](DefaultStateManager.md#setstateroot) -- [shallowCopy](DefaultStateManager.md#shallowcopy) -- [verifyProof](DefaultStateManager.md#verifyproof) -- [fromProof](DefaultStateManager.md#fromproof) - -## Constructors - -### constructor - -• **new DefaultStateManager**(`opts?`) - -Instantiate the StateManager interface. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`DefaultStateManagerOpts`](../interfaces/DefaultStateManagerOpts.md) | - -#### Defined in - -[stateManager.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L192) - -## Properties - -### common - -• `Readonly` **common**: `Common` - -#### Defined in - -[stateManager.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L173) - -___ - -### originalStorageCache - -• **originalStorageCache**: [`OriginalStorageCache`](OriginalStorageCache.md) - -#### Implementation of - -EVMStateManagerInterface.originalStorageCache - -#### Defined in - -[stateManager.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L162) - -## Methods - -### addProofData - -▸ **addProofData**(`proof`, `safe?`): `Promise`<`void`\> - -Add proof(s) into an already existing trie - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `proof` | [`Proof`](../README.md#proof) \| [`Proof`](../README.md#proof)[] | `undefined` | The proof(s) retrieved from `getProof` | -| `safe` | `boolean` | `false` | - | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[stateManager.ts:819](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L819) - -___ - -### checkpoint - -▸ **checkpoint**(): `Promise`<`void`\> - -Checkpoints the current state of the StateManager instance. -State changes that follow can then be committed by calling -`commit` or `reverted` by calling rollback. - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.checkpoint - -#### Defined in - -[stateManager.ts:593](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L593) - -___ - -### clearCaches - -▸ **clearCaches**(): `void` - -Clears all underlying caches - -#### Returns - -`void` - -#### Defined in - -[stateManager.ts:1148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L1148) - -___ - -### clearContractStorage - -▸ **clearContractStorage**(`address`): `Promise`<`void`\> - -Clears all storage entries for the account corresponding to `address`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to clear the storage of | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.clearContractStorage - -#### Defined in - -[stateManager.ts:576](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L576) - -___ - -### commit - -▸ **commit**(): `Promise`<`void`\> - -Commits the current change-set to the instance since the -last call to checkpoint. - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.commit - -#### Defined in - -[stateManager.ts:605](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L605) - -___ - -### deleteAccount - -▸ **deleteAccount**(`address`): `Promise`<`void`\> - -Deletes an account from state under the provided `address`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the account which should be deleted | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.deleteAccount - -#### Defined in - -[stateManager.ts:333](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L333) - -___ - -### dumpStorage - -▸ **dumpStorage**(`address`): `Promise`<`StorageDump`\> - -Dumps the RLP-encoded storage values for an `account` specified by `address`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | The address of the `account` to return storage for | - -#### Returns - -`Promise`<`StorageDump`\> - -- The state of the account as an `Object` map. -Keys are are the storage keys, values are the storage values as strings. -Both are represented as hex strings without the `0x` prefix. - -#### Implementation of - -EVMStateManagerInterface.dumpStorage - -#### Defined in - -[stateManager.ts:962](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L962) - -___ - -### dumpStorageRange - -▸ **dumpStorageRange**(`address`, `startKey`, `limit`): `Promise`<`StorageRange`\> - -Dumps a limited number of RLP-encoded storage values for an account specified by `address`, -starting from `startKey` or greater. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | The address of the `account` to return storage for. | -| `startKey` | `bigint` | The bigint representation of the smallest storage key that will be returned. | -| `limit` | `number` | The maximum number of storage values that will be returned. | - -#### Returns - -`Promise`<`StorageRange`\> - -- A StorageRange object that will contain at most `limit` entries in its `storage` field. -The object will also contain `nextKey`, the next (hashed) storage key after the range included in `storage`. - -#### Implementation of - -EVMStateManagerInterface.dumpStorageRange - -#### Defined in - -[stateManager.ts:995](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L995) - -___ - -### flush - -▸ **flush**(): `Promise`<`void`\> - -Writes all cache items to the trie - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[stateManager.ts:647](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L647) - -___ - -### generateCanonicalGenesis - -▸ **generateCanonicalGenesis**(`initState`): `Promise`<`void`\> - -Initializes the provided genesis state into the state trie. -Will error if there are uncommitted checkpoints on the instance. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `initState` | `any` | address -> balance \| [balance, code, storage] | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.generateCanonicalGenesis - -#### Defined in - -[stateManager.ts:1051](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L1051) - -___ - -### getAccount - -▸ **getAccount**(`address`): `Promise`<`undefined` \| `Account`\> - -Gets the account associated with `address` or `undefined` if account does not exist - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the `account` to get | - -#### Returns - -`Promise`<`undefined` \| `Account`\> - -#### Implementation of - -EVMStateManagerInterface.getAccount - -#### Defined in - -[stateManager.ts:260](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L260) - -___ - -### getAppliedKey - -▸ **getAppliedKey**(`address`): `Uint8Array` - -Returns the applied key for a given address -Used for saving preimages - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Uint8Array` | The address to return the applied key | - -#### Returns - -`Uint8Array` - -- The applied key (e.g. hashed address) - -#### Implementation of - -EVMStateManagerInterface.getAppliedKey - -#### Defined in - -[stateManager.ts:1160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L1160) - -___ - -### getContractCode - -▸ **getContractCode**(`address`): `Promise`<`Uint8Array`\> - -Gets the code corresponding to the provided `address`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to get the `code` for | - -#### Returns - -`Promise`<`Uint8Array`\> - -- Resolves with the code corresponding to the provided address. -Returns an empty `Uint8Array` if the account has no associated code. - -#### Implementation of - -EVMStateManagerInterface.getContractCode - -#### Defined in - -[stateManager.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L379) - -___ - -### getContractStorage - -▸ **getContractStorage**(`address`, `key`): `Promise`<`Uint8Array`\> - -Gets the storage value associated with the provided `address` and `key`. This method returns -the shortest representation of the stored value. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the account to get the storage for | -| `key` | `Uint8Array` | Key in the account's storage to get the value for. Must be 32 bytes long. | - -#### Returns - -`Promise`<`Uint8Array`\> - -- The storage value for the account -corresponding to the provided address at the provided key. -If this does not exist an empty `Uint8Array` is returned. - -#### Implementation of - -EVMStateManagerInterface.getContractStorage - -#### Defined in - -[stateManager.ts:462](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L462) - -___ - -### getProof - -▸ **getProof**(`address`, `storageSlots?`): `Promise`<[`Proof`](../README.md#proof)\> - -Get an EIP-1186 proof - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `address` | `Address` | `undefined` | address to get proof of | -| `storageSlots` | `Uint8Array`[] | `[]` | storage slots to get proof of | - -#### Returns - -`Promise`<[`Proof`](../README.md#proof)\> - -#### Implementation of - -EVMStateManagerInterface.getProof - -#### Defined in - -[stateManager.ts:707](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L707) - -___ - -### getStateRoot - -▸ **getStateRoot**(): `Promise`<`Uint8Array`\> - -Gets the state-root of the Merkle-Patricia trie representation -of the state of this StateManager. Will error if there are uncommitted -checkpoints on the instance. - -#### Returns - -`Promise`<`Uint8Array`\> - -- Returns the state-root of the `StateManager` - -#### Implementation of - -EVMStateManagerInterface.getStateRoot - -#### Defined in - -[stateManager.ts:920](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L920) - -___ - -### hasStateRoot - -▸ **hasStateRoot**(`root`): `Promise`<`boolean`\> - -Checks whether there is a state corresponding to a stateRoot - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | - -#### Returns - -`Promise`<`boolean`\> - -#### Implementation of - -EVMStateManagerInterface.hasStateRoot - -#### Defined in - -[stateManager.ts:1087](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L1087) - -___ - -### modifyAccountFields - -▸ **modifyAccountFields**(`address`, `accountFields`): `Promise`<`void`\> - -Gets the account associated with `address`, modifies the given account -fields, then saves the account into state. Account fields can include -`nonce`, `balance`, `storageRoot`, and `codeHash`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the account to modify | -| `accountFields` | `Partial`<`Pick`<`Account`, ``"nonce"`` \| ``"balance"`` \| ``"storageRoot"`` \| ``"codeHash"``\>\> | Object containing account fields and values to modify | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.modifyAccountFields - -#### Defined in - -[stateManager.ts:317](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L317) - -___ - -### putAccount - -▸ **putAccount**(`address`, `account`): `Promise`<`void`\> - -Saves an account into state under the provided `address`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address under which to store `account` | -| `account` | `undefined` \| `Account` | The account to store or undefined if to be deleted | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.putAccount - -#### Defined in - -[stateManager.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L284) - -___ - -### putContractCode - -▸ **putContractCode**(`address`, `value`): `Promise`<`void`\> - -Adds `value` to the state trie as code, and sets `codeHash` on the account -corresponding to `address` to reference this. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the `account` to add the `code` for | -| `value` | `Uint8Array` | The value of the `code` | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.putContractCode - -#### Defined in - -[stateManager.ts:356](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L356) - -___ - -### putContractStorage - -▸ **putContractStorage**(`address`, `key`, `value`): `Promise`<`void`\> - -Adds value to the state trie for the `account` -corresponding to `address` at the provided `key`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to set a storage value for | -| `key` | `Uint8Array` | Key to set the value at. Must be 32 bytes long. | -| `value` | `Uint8Array` | Value to set at `key` for account corresponding to `address`. Cannot be more than 32 bytes. Leading zeros are stripped. If it is a empty or filled with zeros, deletes the value. | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.putContractStorage - -#### Defined in - -[stateManager.ts:549](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L549) - -___ - -### revert - -▸ **revert**(): `Promise`<`void`\> - -Reverts the current change-set to the instance since the -last call to checkpoint. - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.revert - -#### Defined in - -[stateManager.ts:627](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L627) - -___ - -### setStateRoot - -▸ **setStateRoot**(`stateRoot`, `clearCache?`): `Promise`<`void`\> - -Sets the state of the instance to that represented -by the provided `stateRoot`. Will error if there are uncommitted -checkpoints on the instance or if the state root does not exist in -the state trie. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `stateRoot` | `Uint8Array` | `undefined` | The state-root to reset the instance to | -| `clearCache` | `boolean` | `true` | - | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.setStateRoot - -#### Defined in - -[stateManager.ts:932](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L932) - -___ - -### shallowCopy - -▸ **shallowCopy**(`downlevelCaches?`): [`DefaultStateManager`](DefaultStateManager.md) - -Copies the current instance of the `StateManager` -at the last fully committed point, i.e. as if all current -checkpoints were reverted. - -Caches are downleveled (so: adopted for short-term usage) -by default. - -This means in particular: -1. For caches instantiated as an LRU cache type -the copy() method will instantiate with an ORDERED_MAP cache -instead, since copied instantances are mostly used in -short-term usage contexts and LRU cache instantation would create -a large overhead here. -2. The underlying trie object is initialized with 0 cache size - -Both adoptions can be deactivated by setting `downlevelCaches` to -`false`. - -Cache values are generally not copied along regardless of the -`downlevelCaches` setting. - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `downlevelCaches` | `boolean` | `true` | - -#### Returns - -[`DefaultStateManager`](DefaultStateManager.md) - -#### Implementation of - -EVMStateManagerInterface.shallowCopy - -#### Defined in - -[stateManager.ts:1113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L1113) - -___ - -### verifyProof - -▸ **verifyProof**(`proof`): `Promise`<`boolean`\> - -Verify an EIP-1186 proof. Throws if proof is invalid, otherwise returns true. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `proof` | [`Proof`](../README.md#proof) | the proof to prove | - -#### Returns - -`Promise`<`boolean`\> - -#### Defined in - -[stateManager.ts:842](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L842) - -___ - -### fromProof - -▸ `Static` **fromProof**(`proof`, `safe?`, `opts?`): `Promise`<[`DefaultStateManager`](DefaultStateManager.md)\> - -Create a StateManager and initialize this with proof(s) gotten previously from getProof -This generates a (partial) StateManager where one can retrieve all items from the proof - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `proof` | [`Proof`](../README.md#proof) \| [`Proof`](../README.md#proof)[] | `undefined` | Either a proof retrieved from `getProof`, or an array of those proofs | -| `safe` | `boolean` | `false` | Whether or not to verify that the roots of the proof items match the reported roots | -| `opts` | [`DefaultStateManagerOpts`](../interfaces/DefaultStateManagerOpts.md) | `{}` | a dictionary of StateManager opts | - -#### Returns - -`Promise`<[`DefaultStateManager`](DefaultStateManager.md)\> - -A new DefaultStateManager with elements from the given proof included in its backing state trie - -#### Defined in - -[stateManager.ts:760](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L760) diff --git a/packages/statemanager/docs/classes/MerkleStateManager.md b/packages/statemanager/docs/classes/MerkleStateManager.md new file mode 100644 index 00000000000..b607f42e99e --- /dev/null +++ b/packages/statemanager/docs/classes/MerkleStateManager.md @@ -0,0 +1,713 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / MerkleStateManager + +# Class: MerkleStateManager + +Defined in: [merkleStateManager.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L61) + +Default StateManager implementation for the VM. + +The state manager abstracts from the underlying data store +by providing higher level access to accounts, contract code +and storage slots. + +The default state manager implementation uses a +`@ethereumjs/mpt` trie as a data backend. + +Note that there is a `SimpleStateManager` dependency-free state +manager implementation available shipped with the `@ethereumjs/statemanager` +package which might be an alternative to this implementation +for many basic use cases. + +## Implements + +- `StateManagerInterface` + +## Constructors + +### Constructor + +> **new MerkleStateManager**(`opts`): `MerkleStateManager` + +Defined in: [merkleStateManager.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L92) + +Instantiate the StateManager interface. + +#### Parameters + +##### opts + +[`MerkleStateManagerOpts`](../interfaces/MerkleStateManagerOpts.md) = `{}` + +#### Returns + +`MerkleStateManager` + +## Properties + +### common + +> `readonly` **common**: `Common` + +Defined in: [merkleStateManager.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L73) + +*** + +### originalStorageCache + +> **originalStorageCache**: [`OriginalStorageCache`](OriginalStorageCache.md) + +Defined in: [merkleStateManager.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L65) + +#### Implementation of + +`StateManagerInterface.originalStorageCache` + +## Methods + +### checkpoint() + +> **checkpoint**(): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:442](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L442) + +Checkpoints the current state of the StateManager instance. +State changes that follow can then be committed by calling +`commit` or `reverted` by calling rollback. + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.checkpoint` + +*** + +### clearCaches() + +> **clearCaches**(): `void` + +Defined in: [merkleStateManager.ts:723](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L723) + +Clears all underlying caches + +#### Returns + +`void` + +#### Implementation of + +`StateManagerInterface.clearCaches` + +*** + +### clearStorage() + +> **clearStorage**(`address`): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:425](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L425) + +Clears all storage entries for the account corresponding to `address`. + +#### Parameters + +##### address + +`Address` + +Address to clear the storage of + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.clearStorage` + +*** + +### commit() + +> **commit**(): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:452](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L452) + +Commits the current change-set to the instance since the +last call to checkpoint. + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.commit` + +*** + +### deleteAccount() + +> **deleteAccount**(`address`): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L182) + +Deletes an account from state under the provided `address`. + +#### Parameters + +##### address + +`Address` + +Address of the account which should be deleted + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.deleteAccount` + +*** + +### dumpStorage() + +> **dumpStorage**(`address`): `Promise`\<`StorageDump`\> + +Defined in: [merkleStateManager.ts:582](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L582) + +Dumps the RLP-encoded storage values for an `account` specified by `address`. + +#### Parameters + +##### address + +`Address` + +The address of the `account` to return storage for + +#### Returns + +`Promise`\<`StorageDump`\> + +- The state of the account as an `Object` map. +Keys are are the storage keys, values are the storage values as strings. +Both are represented as hex strings without the `0x` prefix. + +#### Implementation of + +`StateManagerInterface.dumpStorage` + +*** + +### dumpStorageRange() + +> **dumpStorageRange**(`address`, `startKey`, `limit`): `Promise`\<`StorageRange`\> + +Defined in: [merkleStateManager.ts:604](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L604) + +Dumps a limited number of RLP-encoded storage values for an account specified by `address`, +starting from `startKey` or greater. + +#### Parameters + +##### address + +`Address` + +The address of the `account` to return storage for. + +##### startKey + +`bigint` + +The bigint representation of the smallest storage key that will be returned. + +##### limit + +`number` + +The maximum number of storage values that will be returned. + +#### Returns + +`Promise`\<`StorageRange`\> + +- A StorageRange object that will contain at most `limit` entries in its `storage` field. +The object will also contain `nextKey`, the next (hashed) storage key after the range included in `storage`. + +#### Implementation of + +`StateManagerInterface.dumpStorageRange` + +*** + +### flush() + +> **flush**(): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:490](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L490) + +Writes all cache items to the trie + +#### Returns + +`Promise`\<`void`\> + +*** + +### generateCanonicalGenesis() + +> **generateCanonicalGenesis**(`initState`): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:640](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L640) + +Initializes the provided genesis state into the state trie. +Will error if there are uncommitted checkpoints on the instance. + +#### Parameters + +##### initState + +`any` + +address -> balance | [balance, code, storage] + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.generateCanonicalGenesis` + +*** + +### getAccount() + +> **getAccount**(`address`): `Promise`\<`undefined` \| `Account`\> + +Defined in: [merkleStateManager.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L121) + +Gets the account associated with `address` or `undefined` if account does not exist + +#### Parameters + +##### address + +`Address` + +Address of the `account` to get + +#### Returns + +`Promise`\<`undefined` \| `Account`\> + +#### Implementation of + +`StateManagerInterface.getAccount` + +*** + +### getAppliedKey() + +> **getAppliedKey**(`address`): `Uint8Array` + +Defined in: [merkleStateManager.ts:733](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L733) + +Returns the applied key for a given address +Used for saving preimages + +#### Parameters + +##### address + +`Uint8Array` + +The address to return the applied key + +#### Returns + +`Uint8Array` + +- The applied key (e.g. hashed address) + +#### Implementation of + +`StateManagerInterface.getAppliedKey` + +*** + +### getCode() + +> **getCode**(`address`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [merkleStateManager.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L226) + +Gets the code corresponding to the provided `address`. + +#### Parameters + +##### address + +`Address` + +Address to get the `code` for + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +- Resolves with the code corresponding to the provided address. +Returns an empty `Uint8Array` if the account has no associated code. + +#### Implementation of + +`StateManagerInterface.getCode` + +*** + +### getCodeSize() + +> **getCodeSize**(`address`): `Promise`\<`number`\> + +Defined in: [merkleStateManager.ts:247](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L247) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`number`\> + +#### Implementation of + +`StateManagerInterface.getCodeSize` + +*** + +### getStateRoot() + +> **getStateRoot**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [merkleStateManager.ts:546](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L546) + +Gets the state-root of the Merkle-Patricia trie representation +of the state of this StateManager. Will error if there are uncommitted +checkpoints on the instance. + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +- Returns the state-root of the `StateManager` + +#### Implementation of + +`StateManagerInterface.getStateRoot` + +*** + +### getStorage() + +> **getStorage**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [merkleStateManager.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L319) + +Gets the storage value associated with the provided `address` and `key`. This method returns +the shortest representation of the stored value. + +#### Parameters + +##### address + +`Address` + +Address of the account to get the storage for + +##### key + +`Uint8Array` + +Key in the account's storage to get the value for. Must be 32 bytes long. + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +- The storage value for the account +corresponding to the provided address at the provided key. +If this does not exist an empty `Uint8Array` is returned. + +#### Implementation of + +`StateManagerInterface.getStorage` + +*** + +### hasStateRoot() + +> **hasStateRoot**(`root`): `Promise`\<`boolean`\> + +Defined in: [merkleStateManager.ts:676](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L676) + +Checks whether there is a state corresponding to a stateRoot + +#### Parameters + +##### root + +`Uint8Array` + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +`StateManagerInterface.hasStateRoot` + +*** + +### modifyAccountFields() + +> **modifyAccountFields**(`address`, `accountFields`): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L174) + +Gets the account associated with `address`, modifies the given account +fields, then saves the account into state. Account fields can include +`nonce`, `balance`, `storageRoot`, and `codeHash`. + +#### Parameters + +##### address + +`Address` + +Address of the account to modify + +##### accountFields + +`Partial` + +Object containing account fields and values to modify + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.modifyAccountFields` + +*** + +### putAccount() + +> **putAccount**(`address`, `account`): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L141) + +Saves an account into state under the provided `address`. + +#### Parameters + +##### address + +`Address` + +Address under which to store `account` + +##### account + +The account to store or undefined if to be deleted + +`undefined` | `Account` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putAccount` + +*** + +### putCode() + +> **putCode**(`address`, `value`): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L200) + +Adds `value` to the state trie as code, and sets `codeHash` on the account +corresponding to `address` to reference this. + +#### Parameters + +##### address + +`Address` + +Address of the `account` to add the `code` for + +##### value + +`Uint8Array` + +The value of the `code` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putCode` + +*** + +### putStorage() + +> **putStorage**(`address`, `key`, `value`): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L402) + +Adds value to the state trie for the `account` +corresponding to `address` at the provided `key`. + +#### Parameters + +##### address + +`Address` + +Address to set a storage value for + +##### key + +`Uint8Array` + +Key to set the value at. Must be 32 bytes long. + +##### value + +`Uint8Array` + +Value to set at `key` for account corresponding to `address`. +Cannot be more than 32 bytes. Leading zeros are stripped. +If it is a empty or filled with zeros, deletes the value. + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putStorage` + +*** + +### revert() + +> **revert**(): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:472](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L472) + +Reverts the current change-set to the instance since the +last call to checkpoint. + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.revert` + +*** + +### setStateRoot() + +> **setStateRoot**(`stateRoot`, `clearCache`): `Promise`\<`void`\> + +Defined in: [merkleStateManager.ts:558](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L558) + +Sets the state of the instance to that represented +by the provided `stateRoot`. Will error if there are uncommitted +checkpoints on the instance or if the state root does not exist in +the state trie. + +#### Parameters + +##### stateRoot + +`Uint8Array` + +The state-root to reset the instance to + +##### clearCache + +`boolean` = `true` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.setStateRoot` + +*** + +### shallowCopy() + +> **shallowCopy**(`downlevelCaches`): `MerkleStateManager` + +Defined in: [merkleStateManager.ts:702](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L702) + +Copies the current instance of the `StateManager` +at the last fully committed point, i.e. as if all current +checkpoints were reverted. + +Caches are downleveled (so: adopted for short-term usage) +by default. + +This means in particular: +1. For caches instantiated as an LRU cache type +the copy() method will instantiate with an ORDERED_MAP cache +instead, since copied instances are mostly used in +short-term usage contexts and LRU cache instantiation would create +a large overhead here. +2. The underlying trie object is initialized with 0 cache size + +Both adoptions can be deactivated by setting `downlevelCaches` to +`false`. + +Cache values are generally not copied along regardless of the +`downlevelCaches` setting. + +#### Parameters + +##### downlevelCaches + +`boolean` = `true` + +#### Returns + +`MerkleStateManager` + +#### Implementation of + +`StateManagerInterface.shallowCopy` diff --git a/packages/statemanager/docs/classes/OriginalStorageCache.md b/packages/statemanager/docs/classes/OriginalStorageCache.md index 3b5460234eb..115e321f11f 100644 --- a/packages/statemanager/docs/classes/OriginalStorageCache.md +++ b/packages/statemanager/docs/classes/OriginalStorageCache.md @@ -1,88 +1,94 @@ -[@ethereumjs/statemanager](../README.md) / OriginalStorageCache +[**@ethereumjs/statemanager**](../README.md) -# Class: OriginalStorageCache +*** -## Table of contents +[@ethereumjs/statemanager](../README.md) / OriginalStorageCache -### Constructors +# Class: OriginalStorageCache -- [constructor](OriginalStorageCache.md#constructor) +Defined in: [cache/originalStorageCache.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L16) -### Methods +Helper class to cache original storage values (so values already being present in +the pre-state of a call), mainly for correct gas cost calculation in EVM/VM. -- [clear](OriginalStorageCache.md#clear) -- [get](OriginalStorageCache.md#get) -- [put](OriginalStorageCache.md#put) +TODO: Usage of this class is very implicit through the injected `getStorage()` +method bound to the calling state manager. It should be examined if there are alternative +designs being more transparent and direct along the next breaking release round. ## Constructors -### constructor +### Constructor + +> **new OriginalStorageCache**(`getStorage`): `OriginalStorageCache` -• **new OriginalStorageCache**(`getContractStorage`) +Defined in: [cache/originalStorageCache.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L19) #### Parameters -| Name | Type | -| :------ | :------ | -| `getContractStorage` | `getContractStorage` | +##### getStorage -#### Defined in +`getStorage` -[cache/originalStorageCache.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L10) +#### Returns + +`OriginalStorageCache` ## Methods -### clear +### clear() + +> **clear**(): `void` -▸ **clear**(): `void` +Defined in: [cache/originalStorageCache.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L52) #### Returns `void` -#### Defined in +*** -[cache/originalStorageCache.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L43) +### get() -___ +> **get**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -### get - -▸ **get**(`address`, `key`): `Promise`<`Uint8Array`\> +Defined in: [cache/originalStorageCache.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L24) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Uint8Array` | +##### address -#### Returns +`Address` -`Promise`<`Uint8Array`\> +##### key -#### Defined in +`Uint8Array` -[cache/originalStorageCache.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L15) +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +*** -___ +### put() -### put +> **put**(`address`, `key`, `value`): `void` -▸ **put**(`address`, `key`, `value`): `void` +Defined in: [cache/originalStorageCache.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L39) #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Uint8Array` | -| `value` | `Uint8Array` | +##### address -#### Returns +`Address` -`void` +##### key -#### Defined in +`Uint8Array` -[cache/originalStorageCache.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/originalStorageCache.ts#L30) +##### value + +`Uint8Array` + +#### Returns + +`void` diff --git a/packages/statemanager/docs/classes/RPCBlockChain.md b/packages/statemanager/docs/classes/RPCBlockChain.md index 7d85a86c543..648d97a028d 100644 --- a/packages/statemanager/docs/classes/RPCBlockChain.md +++ b/packages/statemanager/docs/classes/RPCBlockChain.md @@ -1,78 +1,65 @@ -[@ethereumjs/statemanager](../README.md) / RPCBlockChain - -# Class: RPCBlockChain - -## Table of contents - -### Constructors +[**@ethereumjs/statemanager**](../README.md) -- [constructor](RPCBlockChain.md#constructor) +*** -### Properties - -- [provider](RPCBlockChain.md#provider) +[@ethereumjs/statemanager](../README.md) / RPCBlockChain -### Methods +# Class: RPCBlockChain -- [getBlock](RPCBlockChain.md#getblock) -- [shallowCopy](RPCBlockChain.md#shallowcopy) +Defined in: [rpcStateManager.ts:362](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L362) ## Constructors -### constructor +### Constructor + +> **new RPCBlockChain**(`provider`): `RPCBlockChain` -• **new RPCBlockChain**(`provider`) +Defined in: [rpcStateManager.ts:364](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L364) #### Parameters -| Name | Type | -| :------ | :------ | -| `provider` | `string` | +##### provider -#### Defined in +`string` -[rpcStateManager.ts:445](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L445) +#### Returns + +`RPCBlockChain` ## Properties ### provider -• `Readonly` **provider**: `string` +> `readonly` **provider**: `string` -#### Defined in - -[rpcStateManager.ts:444](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L444) +Defined in: [rpcStateManager.ts:363](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L363) ## Methods -### getBlock +### getBlock() + +> **getBlock**(`blockId`): `Promise`\<\{ `hash`: () => `Uint8Array`\<`ArrayBufferLike`\>; \}\> -▸ **getBlock**(`blockId`): `Promise`<{ `hash`: () => `Uint8Array` }\> +Defined in: [rpcStateManager.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L369) #### Parameters -| Name | Type | -| :------ | :------ | -| `blockId` | `number` | +##### blockId -#### Returns +`number` -`Promise`<{ `hash`: () => `Uint8Array` }\> +#### Returns -#### Defined in +`Promise`\<\{ `hash`: () => `Uint8Array`\<`ArrayBufferLike`\>; \}\> -[rpcStateManager.ts:449](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L449) +*** -___ +### shallowCopy() -### shallowCopy +> **shallowCopy**(): `RPCBlockChain` -▸ **shallowCopy**(): [`RPCBlockChain`](RPCBlockChain.md) +Defined in: [rpcStateManager.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L379) #### Returns -[`RPCBlockChain`](RPCBlockChain.md) - -#### Defined in - -[rpcStateManager.ts:459](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L459) +`RPCBlockChain` diff --git a/packages/statemanager/docs/classes/RPCStateManager.md b/packages/statemanager/docs/classes/RPCStateManager.md index 4ccdbf9ff2f..05df026df32 100644 --- a/packages/statemanager/docs/classes/RPCStateManager.md +++ b/packages/statemanager/docs/classes/RPCStateManager.md @@ -1,141 +1,82 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + [@ethereumjs/statemanager](../README.md) / RPCStateManager # Class: RPCStateManager +Defined in: [rpcStateManager.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L29) + ## Implements -- `EVMStateManagerInterface` - -## Table of contents - -### Constructors - -- [constructor](RPCStateManager.md#constructor) - -### Properties - -- [common](RPCStateManager.md#common) -- [originalStorageCache](RPCStateManager.md#originalstoragecache) - -### Methods - -- [accountExists](RPCStateManager.md#accountexists) -- [checkpoint](RPCStateManager.md#checkpoint) -- [clearCaches](RPCStateManager.md#clearcaches) -- [clearContractStorage](RPCStateManager.md#clearcontractstorage) -- [commit](RPCStateManager.md#commit) -- [deleteAccount](RPCStateManager.md#deleteaccount) -- [dumpStorage](RPCStateManager.md#dumpstorage) -- [dumpStorageRange](RPCStateManager.md#dumpstoragerange) -- [flush](RPCStateManager.md#flush) -- [generateCanonicalGenesis](RPCStateManager.md#generatecanonicalgenesis) -- [getAccount](RPCStateManager.md#getaccount) -- [getAppliedKey](RPCStateManager.md#getappliedkey) -- [getContractCode](RPCStateManager.md#getcontractcode) -- [getContractStorage](RPCStateManager.md#getcontractstorage) -- [getProof](RPCStateManager.md#getproof) -- [getStateRoot](RPCStateManager.md#getstateroot) -- [hasStateRoot](RPCStateManager.md#hasstateroot) -- [modifyAccountFields](RPCStateManager.md#modifyaccountfields) -- [putAccount](RPCStateManager.md#putaccount) -- [putContractCode](RPCStateManager.md#putcontractcode) -- [putContractStorage](RPCStateManager.md#putcontractstorage) -- [revert](RPCStateManager.md#revert) -- [setBlockTag](RPCStateManager.md#setblocktag) -- [setStateRoot](RPCStateManager.md#setstateroot) -- [shallowCopy](RPCStateManager.md#shallowcopy) +- `StateManagerInterface` ## Constructors -### constructor +### Constructor -• **new RPCStateManager**(`opts`) +> **new RPCStateManager**(`opts`): `RPCStateManager` + +Defined in: [rpcStateManager.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L39) #### Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`RPCStateManagerOpts`](../interfaces/RPCStateManagerOpts.md) | +##### opts + +[`RPCStateManagerOpts`](../interfaces/RPCStateManagerOpts.md) -#### Defined in +#### Returns -[rpcStateManager.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L50) +`RPCStateManager` ## Properties ### common -• `Readonly` **common**: `Common` - -#### Defined in +> `readonly` **common**: `Common` -[rpcStateManager.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L48) +Defined in: [rpcStateManager.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L37) -___ +*** ### originalStorageCache -• **originalStorageCache**: [`OriginalStorageCache`](OriginalStorageCache.md) +> **originalStorageCache**: [`OriginalStorageCache`](OriginalStorageCache.md) -#### Implementation of +Defined in: [rpcStateManager.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L33) -EVMStateManagerInterface.originalStorageCache - -#### Defined in +#### Implementation of -[rpcStateManager.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L44) +`StateManagerInterface.originalStorageCache` ## Methods -### accountExists - -▸ **accountExists**(`address`): `Promise`<`boolean`\> - -Checks if an `account` exists at `address` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the `account` to check | - -#### Returns - -`Promise`<`boolean`\> - -#### Defined in +### checkpoint() -[rpcStateManager.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L225) +> **checkpoint**(): `Promise`\<`void`\> -___ - -### checkpoint - -▸ **checkpoint**(): `Promise`<`void`\> +Defined in: [rpcStateManager.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L313) Checkpoints the current state of the StateManager instance. State changes that follow can then be committed by calling `commit` or `reverted` by calling rollback. -Partial implementation, called from the subclass. - #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.checkpoint - -#### Defined in +`StateManagerInterface.checkpoint` -[rpcStateManager.ts:387](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L387) +*** -___ +### clearCaches() -### clearCaches +> **clearCaches**(): `void` -▸ **clearCaches**(): `void` +Defined in: [rpcStateManager.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L91) Clears the internal cache so all accounts, contract code, and storage slots will initially be retrieved from the provider @@ -144,41 +85,43 @@ initially be retrieved from the provider `void` -#### Defined in +#### Implementation of + +`StateManagerInterface.clearCaches` -[rpcStateManager.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L111) +*** -___ +### clearStorage() -### clearContractStorage +> **clearStorage**(`address`): `Promise`\<`void`\> -▸ **clearContractStorage**(`address`): `Promise`<`void`\> +Defined in: [rpcStateManager.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L177) Clears all storage entries for the account corresponding to `address`. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to clear the storage of | +##### address + +`Address` + +Address to clear the storage of #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.clearContractStorage +`StateManagerInterface.clearStorage` -#### Defined in +*** -[rpcStateManager.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L194) +### commit() -___ +> **commit**(): `Promise`\<`void`\> -### commit - -▸ **commit**(): `Promise`<`void`\> +Defined in: [rpcStateManager.ts:323](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L323) Commits the current change-set to the instance since the last call to checkpoint. @@ -187,59 +130,59 @@ Partial implementation, called from the subclass. #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.commit - -#### Defined in +`StateManagerInterface.commit` -[rpcStateManager.ts:398](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L398) +*** -___ +### deleteAccount() -### deleteAccount +> **deleteAccount**(`address`): `Promise`\<`void`\> -▸ **deleteAccount**(`address`): `Promise`<`void`\> +Defined in: [rpcStateManager.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L291) Deletes an account from state under the provided `address`. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the account which should be deleted | +##### address + +`Address` + +Address of the account which should be deleted #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.deleteAccount - -#### Defined in +`StateManagerInterface.deleteAccount` -[rpcStateManager.ts:343](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L343) +*** -___ +### dumpStorage() -### dumpStorage +> **dumpStorage**(`address`): `Promise`\<`StorageDump`\> -▸ **dumpStorage**(`address`): `Promise`<`StorageDump`\> +Defined in: [rpcStateManager.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L188) Dumps the RLP-encoded storage values for an `account` specified by `address`. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | The address of the `account` to return storage for | +##### address + +`Address` + +The address of the `account` to return storage for #### Returns -`Promise`<`StorageDump`\> +`Promise`\<`StorageDump`\> - The state of the account as an `Object` map. Keys are the storage keys, values are the storage values as strings. @@ -247,182 +190,174 @@ Both are represented as `0x` prefixed hex strings. #### Implementation of -EVMStateManagerInterface.dumpStorage +`StateManagerInterface.dumpStorage` -#### Defined in +*** -[rpcStateManager.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L205) +### flush() -___ +> **flush**(): `Promise`\<`void`\> -### dumpStorageRange +Defined in: [rpcStateManager.ts:338](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L338) -▸ **dumpStorageRange**(`_address`, `_startKey`, `_limit`): `Promise`<`StorageRange`\> - -#### Parameters +#### Returns -| Name | Type | -| :------ | :------ | -| `_address` | `Address` | -| `_startKey` | `bigint` | -| `_limit` | `number` | +`Promise`\<`void`\> -#### Returns +*** -`Promise`<`StorageRange`\> +### getAccount() -#### Implementation of +> **getAccount**(`address`): `Promise`\<`undefined` \| `Account`\> -EVMStateManagerInterface.dumpStorageRange +Defined in: [rpcStateManager.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L203) -#### Defined in +Gets the account associated with `address` or `undefined` if account does not exist -[rpcStateManager.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L216) +#### Parameters -___ +##### address -### flush +`Address` -▸ **flush**(): `Promise`<`void`\> +Address of the `account` to get #### Returns -`Promise`<`void`\> +`Promise`\<`undefined` \| `Account`\> -#### Defined in +#### Implementation of -[rpcStateManager.ts:415](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L415) +`StateManagerInterface.getAccount` -___ +*** -### generateCanonicalGenesis +### getAppliedKey() -▸ **generateCanonicalGenesis**(`_initState`): `Promise`<`void`\> +> **getAppliedKey**(`address`): `Uint8Array` + +Defined in: [rpcStateManager.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L304) + +Returns the applied key for a given address +Used for saving preimages #### Parameters -| Name | Type | -| :------ | :------ | -| `_initState` | `any` | +##### address + +`Uint8Array` + +The address to return the applied key #### Returns -`Promise`<`void`\> +`Uint8Array` -#### Implementation of +- The applied key (e.g. hashed address) -EVMStateManagerInterface.generateCanonicalGenesis +#### Implementation of -#### Defined in +`StateManagerInterface.getAppliedKey` -[rpcStateManager.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L438) +*** -___ +### getCode() -### getAccount +> **getCode**(`address`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **getAccount**(`address`): `Promise`<`undefined` \| `Account`\> +Defined in: [rpcStateManager.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L101) Gets the code corresponding to the provided `address`. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to get the `account` for | +##### address + +`Address` + +Address to get the `code` for #### Returns -`Promise`<`undefined` \| `Account`\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> - Resolves with the code corresponding to the provided address. Returns an empty `Uint8Array` if the account has no associated code. #### Implementation of -EVMStateManagerInterface.getAccount +`StateManagerInterface.getCode` -#### Defined in +*** -[rpcStateManager.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L251) +### getCodeSize() -___ +> **getCodeSize**(`address`): `Promise`\<`number`\> -### getAppliedKey - -▸ **getAppliedKey**(`address`): `Uint8Array` - -Returns the applied key for a given address -Used for saving preimages +Defined in: [rpcStateManager.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L113) #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Uint8Array` | The address to return the applied key | +##### address -#### Returns +`Address` -`Uint8Array` +#### Returns -- The applied key (e.g. hashed address) +`Promise`\<`number`\> #### Implementation of -EVMStateManagerInterface.getAppliedKey - -#### Defined in +`StateManagerInterface.getCodeSize` -[rpcStateManager.ts:376](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L376) +*** -___ +### ~~getStateRoot()~~ -### getContractCode +> **getStateRoot**(): `Promise`\<`Uint8Array`\<`ArrayBuffer`\>\> -▸ **getContractCode**(`address`): `Promise`<`Uint8Array`\> - -Gets the code corresponding to the provided `address`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to get the `code` for | +Defined in: [rpcStateManager.ts:345](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L345) #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`Uint8Array`\<`ArrayBuffer`\>\> -- Resolves with the code corresponding to the provided address. -Returns an empty `Uint8Array` if the account has no associated code. +#### Deprecated -#### Implementation of +This method is not used by the RPC State Manager and is a stub required by the State Manager interface -EVMStateManagerInterface.getContractCode +#### Implementation of -#### Defined in +`StateManagerInterface.getStateRoot` -[rpcStateManager.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L123) +*** -___ +### getStorage() -### getContractStorage +> **getStorage**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **getContractStorage**(`address`, `key`): `Promise`<`Uint8Array`\> +Defined in: [rpcStateManager.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L138) Gets the storage value associated with the provided `address` and `key`. This method returns the shortest representation of the stored value. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the account to get the storage for | -| `key` | `Uint8Array` | Key in the account's storage to get the value for. Must be 32 bytes long. | +##### address + +`Address` + +Address of the account to get the storage for + +##### key + +`Uint8Array` + +Key in the account's storage to get the value for. Must be 32 bytes long. #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> - The storage value for the account corresponding to the provided address at the provided key. @@ -430,203 +365,175 @@ If this does not exist an empty `Uint8Array` is returned. #### Implementation of -EVMStateManagerInterface.getContractStorage - -#### Defined in - -[rpcStateManager.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L155) +`StateManagerInterface.getStorage` -___ +*** -### getProof +### ~~hasStateRoot()~~ -▸ **getProof**(`address`, `storageSlots?`): `Promise`<[`Proof`](../README.md#proof)\> +> **hasStateRoot**(): `never` -Get an EIP-1186 proof from the provider - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `address` | `Address` | `undefined` | address to get proof of | -| `storageSlots` | `Uint8Array`[] | `[]` | storage slots to get proof of | +Defined in: [rpcStateManager.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L357) #### Returns -`Promise`<[`Proof`](../README.md#proof)\> +`never` -an EIP-1186 formatted proof +#### Deprecated -#### Implementation of - -EVMStateManagerInterface.getProof +This method is not used by the RPC State Manager and is a stub required by the State Manager interface -#### Defined in +#### Implementation of -[rpcStateManager.ts:356](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L356) +`StateManagerInterface.hasStateRoot` -___ +*** -### getStateRoot +### modifyAccountFields() -▸ **getStateRoot**(): `Promise`<`Uint8Array`\> +> **modifyAccountFields**(`address`, `accountFields`): `Promise`\<`void`\> -**`Deprecated`** +Defined in: [rpcStateManager.ts:270](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L270) -This method is not used by the RPC State Manager and is a stub required by the State Manager interface +Gets the account associated with `address`, modifies the given account +fields, then saves the account into state. Account fields can include +`nonce`, `balance`, `storageRoot`, and `codeHash`. -#### Returns +#### Parameters -`Promise`<`Uint8Array`\> +##### address -#### Implementation of +`Address` -EVMStateManagerInterface.getStateRoot +Address of the account to modify -#### Defined in +##### accountFields -[rpcStateManager.ts:422](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L422) +`Partial` -___ +Object containing account fields and values to modify -### hasStateRoot +#### Returns -▸ **hasStateRoot**(): `never` +`Promise`\<`void`\> -**`Deprecated`** +#### Implementation of -This method is not used by the RPC State Manager and is a stub required by the State Manager interface +`StateManagerInterface.modifyAccountFields` -#### Returns +*** -`never` +### putAccount() -#### Implementation of +> **putAccount**(`address`, `account`): `Promise`\<`void`\> -EVMStateManagerInterface.hasStateRoot +Defined in: [rpcStateManager.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L246) -#### Defined in +Saves an account into state under the provided `address`. -[rpcStateManager.ts:434](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L434) +#### Parameters -___ +##### address -### modifyAccountFields +`Address` -▸ **modifyAccountFields**(`address`, `accountFields`): `Promise`<`void`\> +Address under which to store `account` -Gets the account associated with `address`, modifies the given account -fields, then saves the account into state. Account fields can include -`nonce`, `balance`, `storageRoot`, and `codeHash`. +##### account -#### Parameters +The account to store -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the account to modify | -| `accountFields` | `Partial`<`Pick`<`Account`, ``"nonce"`` \| ``"balance"`` \| ``"storageRoot"`` \| ``"codeHash"``\>\> | Object containing account fields and values to modify | +`undefined` | `Account` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.modifyAccountFields +`StateManagerInterface.putAccount` -#### Defined in +*** -[rpcStateManager.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L314) +### putCode() -___ +> **putCode**(`address`, `value`): `Promise`\<`void`\> -### putAccount +Defined in: [rpcStateManager.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L124) -▸ **putAccount**(`address`, `account`): `Promise`<`void`\> - -Saves an account into state under the provided `address`. +Adds `value` to the state trie as code, and sets `codeHash` on the account +corresponding to `address` to reference this. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address under which to store `account` | -| `account` | `undefined` \| `Account` | The account to store | +##### address -#### Returns +`Address` -`Promise`<`void`\> +Address of the `account` to add the `code` for -#### Implementation of +##### value -EVMStateManagerInterface.putAccount +`Uint8Array` -#### Defined in +The value of the `code` -[rpcStateManager.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L290) +#### Returns -___ +`Promise`\<`void`\> -### putContractCode +#### Implementation of -▸ **putContractCode**(`address`, `value`): `Promise`<`void`\> +`StateManagerInterface.putCode` -Adds `value` to the state trie as code, and sets `codeHash` on the account -corresponding to `address` to reference this. +*** -#### Parameters +### putStorage() -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the `account` to add the `code` for | -| `value` | `Uint8Array` | The value of the `code` | +> **putStorage**(`address`, `key`, `value`): `Promise`\<`void`\> -#### Returns +Defined in: [rpcStateManager.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L169) -`Promise`<`void`\> +Adds value to the cache for the `account` +corresponding to `address` at the provided `key`. -#### Implementation of +#### Parameters -EVMStateManagerInterface.putContractCode +##### address -#### Defined in +`Address` -[rpcStateManager.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L141) +Address to set a storage value for -___ +##### key -### putContractStorage +`Uint8Array` -▸ **putContractStorage**(`address`, `key`, `value`): `Promise`<`void`\> +Key to set the value at. Must be 32 bytes long. -Adds value to the cache for the `account` -corresponding to `address` at the provided `key`. +##### value -#### Parameters +`Uint8Array` -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to set a storage value for | -| `key` | `Uint8Array` | Key to set the value at. Must be 32 bytes long. | -| `value` | `Uint8Array` | Value to set at `key` for account corresponding to `address`. Cannot be more than 32 bytes. Leading zeros are stripped. If it is empty or filled with zeros, deletes the value. | +Value to set at `key` for account corresponding to `address`. +Cannot be more than 32 bytes. Leading zeros are stripped. +If it is empty or filled with zeros, deletes the value. #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.putContractStorage - -#### Defined in +`StateManagerInterface.putStorage` -[rpcStateManager.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L186) +*** -___ +### revert() -### revert +> **revert**(): `Promise`\<`void`\> -▸ **revert**(): `Promise`<`void`\> +Defined in: [rpcStateManager.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L334) Reverts the current change-set to the instance since the last call to checkpoint. @@ -635,85 +542,77 @@ Partial implementation , called from the subclass. #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.revert +`StateManagerInterface.revert` -#### Defined in +*** -[rpcStateManager.ts:409](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L409) +### setBlockTag() -___ +> **setBlockTag**(`blockTag`): `void` -### setBlockTag - -▸ **setBlockTag**(`blockTag`): `void` +Defined in: [rpcStateManager.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L81) Sets the new block tag used when querying the provider and clears the internal cache. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `blockTag` | `bigint` \| ``"earliest"`` | the new block tag to use when querying the provider | +##### blockTag + +the new block tag to use when querying the provider + +`bigint` | `"earliest"` #### Returns `void` -#### Defined in +*** -[rpcStateManager.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L101) +### ~~setStateRoot()~~ -___ +> **setStateRoot**(`_root`): `Promise`\<`void`\> -### setStateRoot +Defined in: [rpcStateManager.ts:352](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L352) -▸ **setStateRoot**(`_root`): `Promise`<`void`\> +#### Parameters -**`Deprecated`** +##### \_root -This method is not used by the RPC State Manager and is a stub required by the State Manager interface +`Uint8Array` -#### Parameters +#### Returns -| Name | Type | -| :------ | :------ | -| `_root` | `Uint8Array` | +`Promise`\<`void`\> -#### Returns +#### Deprecated -`Promise`<`void`\> +This method is not used by the RPC State Manager and is a stub required by the State Manager interface #### Implementation of -EVMStateManagerInterface.setStateRoot - -#### Defined in +`StateManagerInterface.setStateRoot` -[rpcStateManager.ts:429](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L429) +*** -___ +### shallowCopy() -### shallowCopy +> **shallowCopy**(): `RPCStateManager` -▸ **shallowCopy**(): [`RPCStateManager`](RPCStateManager.md) +Defined in: [rpcStateManager.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L66) -Note that the returned statemanager will share the same JsonRpcProvider as the original +Note that the returned statemanager will share the same JSONRPCProvider as the original #### Returns -[`RPCStateManager`](RPCStateManager.md) +`RPCStateManager` RPCStateManager #### Implementation of -EVMStateManagerInterface.shallowCopy - -#### Defined in - -[rpcStateManager.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L79) +`StateManagerInterface.shallowCopy` diff --git a/packages/statemanager/docs/classes/SimpleStateManager.md b/packages/statemanager/docs/classes/SimpleStateManager.md new file mode 100644 index 00000000000..abb165ce88d --- /dev/null +++ b/packages/statemanager/docs/classes/SimpleStateManager.md @@ -0,0 +1,493 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / SimpleStateManager + +# Class: SimpleStateManager + +Defined in: [simpleStateManager.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L26) + +Simple and dependency-free state manager for basic state access use cases +where a merkle-patricia or verkle tree backed state manager is too heavy-weight. + +This state manager comes with the basic state access logic for +accounts, storage and code (put* and get* methods) as well as a simple +implementation of checkpointing but lacks methods implementations of +state root related logic as well as some other non-core functions. + +Functionality provided is sufficient to be used for simple EVM use +cases and the state manager is used as default there. + +For a more full fledged and MPT-backed state manager implementation +have a look at the [`@ethereumjs/statemanager` package docs](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/docs/README.md). + +## Implements + +- `StateManagerInterface` + +## Constructors + +### Constructor + +> **new SimpleStateManager**(`opts`): `SimpleStateManager` + +Defined in: [simpleStateManager.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L38) + +#### Parameters + +##### opts + +[`SimpleStateManagerOpts`](../interfaces/SimpleStateManagerOpts.md) = `{}` + +#### Returns + +`SimpleStateManager` + +## Properties + +### accountStack + +> **accountStack**: `Map`\<`` `0x${string}` ``, `undefined` \| `Account`\>[] = `[]` + +Defined in: [simpleStateManager.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L27) + +*** + +### codeStack + +> **codeStack**: `Map`\<`` `0x${string}` ``, `Uint8Array`\<`ArrayBufferLike`\>\>[] = `[]` + +Defined in: [simpleStateManager.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L28) + +*** + +### common? + +> `readonly` `optional` **common**: `Common` + +Defined in: [simpleStateManager.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L36) + +*** + +### originalStorageCache + +> **originalStorageCache**: `object` + +Defined in: [simpleStateManager.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L31) + +#### clear() + +> **clear**(): `void` + +##### Returns + +`void` + +#### get() + +> **get**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +##### Parameters + +###### address + +`Address` + +###### key + +`Uint8Array` + +##### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.originalStorageCache` + +*** + +### storageStack + +> **storageStack**: `Map`\<`string`, `Uint8Array`\<`ArrayBufferLike`\>\>[] = `[]` + +Defined in: [simpleStateManager.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L29) + +## Methods + +### checkpoint() + +> **checkpoint**(): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L116) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.checkpoint` + +*** + +### clearCaches() + +> **clearCaches**(): `void` + +Defined in: [simpleStateManager.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L132) + +#### Returns + +`void` + +#### Implementation of + +`StateManagerInterface.clearCaches` + +*** + +### clearStorage() + +> **clearStorage**(): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L114) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.clearStorage` + +*** + +### commit() + +> **commit**(): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L119) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.commit` + +*** + +### deleteAccount() + +> **deleteAccount**(`address`): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L77) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.deleteAccount` + +*** + +### flush() + +> **flush**(): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L131) + +#### Returns + +`Promise`\<`void`\> + +*** + +### getAccount() + +> **getAccount**(`address`): `Promise`\<`undefined` \| `Account`\> + +Defined in: [simpleStateManager.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L69) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`undefined` \| `Account`\> + +#### Implementation of + +`StateManagerInterface.getAccount` + +*** + +### getCode() + +> **getCode**(`address`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [simpleStateManager.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L85) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getCode` + +*** + +### getCodeSize() + +> **getCodeSize**(`address`): `Promise`\<`number`\> + +Defined in: [simpleStateManager.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L99) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`number`\> + +#### Implementation of + +`StateManagerInterface.getCodeSize` + +*** + +### getStateRoot() + +> **getStateRoot**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [simpleStateManager.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L145) + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getStateRoot` + +*** + +### getStorage() + +> **getStorage**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [simpleStateManager.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L104) + +#### Parameters + +##### address + +`Address` + +##### key + +`Uint8Array` + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getStorage` + +*** + +### hasStateRoot() + +> **hasStateRoot**(): `Promise`\<`boolean`\> + +Defined in: [simpleStateManager.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L151) + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +`StateManagerInterface.hasStateRoot` + +*** + +### modifyAccountFields() + +> **modifyAccountFields**(`address`, `accountFields`): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L81) + +#### Parameters + +##### address + +`Address` + +##### accountFields + +`Partial` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.modifyAccountFields` + +*** + +### putAccount() + +> **putAccount**(`address`, `account?`): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L73) + +#### Parameters + +##### address + +`Address` + +##### account? + +`Account` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putAccount` + +*** + +### putCode() + +> **putCode**(`address`, `value`): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L89) + +#### Parameters + +##### address + +`Address` + +##### value + +`Uint8Array` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putCode` + +*** + +### putStorage() + +> **putStorage**(`address`, `key`, `value`): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L110) + +#### Parameters + +##### address + +`Address` + +##### key + +`Uint8Array` + +##### value + +`Uint8Array` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putStorage` + +*** + +### revert() + +> **revert**(): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L125) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.revert` + +*** + +### setStateRoot() + +> **setStateRoot**(): `Promise`\<`void`\> + +Defined in: [simpleStateManager.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L148) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.setStateRoot` + +*** + +### shallowCopy() + +> **shallowCopy**(): `StateManagerInterface` + +Defined in: [simpleStateManager.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/simpleStateManager.ts#L134) + +#### Returns + +`StateManagerInterface` + +#### Implementation of + +`StateManagerInterface.shallowCopy` diff --git a/packages/statemanager/docs/classes/StatefulBinaryTreeStateManager.md b/packages/statemanager/docs/classes/StatefulBinaryTreeStateManager.md new file mode 100644 index 00000000000..1f9a9ecd547 --- /dev/null +++ b/packages/statemanager/docs/classes/StatefulBinaryTreeStateManager.md @@ -0,0 +1,655 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / StatefulBinaryTreeStateManager + +# Class: StatefulBinaryTreeStateManager + +Defined in: [statefulBinaryTreeStateManager.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L58) + +## Implements + +- `StateManagerInterface` + +## Constructors + +### Constructor + +> **new StatefulBinaryTreeStateManager**(`opts`): `StatefulBinaryTreeStateManager` + +Defined in: [statefulBinaryTreeStateManager.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L86) + +#### Parameters + +##### opts + +[`StatefulBinaryTreeStateManagerOpts`](../interfaces/StatefulBinaryTreeStateManagerOpts.md) + +#### Returns + +`StatefulBinaryTreeStateManager` + +## Properties + +### hashFunction() + +> **hashFunction**: (`input`) => `Uint8Array` + +Defined in: [statefulBinaryTreeStateManager.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L64) + +#### Parameters + +##### input + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### originalStorageCache + +> **originalStorageCache**: [`OriginalStorageCache`](OriginalStorageCache.md) + +Defined in: [statefulBinaryTreeStateManager.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L63) + +#### Implementation of + +`StateManagerInterface.originalStorageCache` + +*** + +### preStateRoot + +> **preStateRoot**: `Uint8Array` + +Defined in: [statefulBinaryTreeStateManager.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L62) + +## Methods + +### checkChunkWitnessPresent() + +> **checkChunkWitnessPresent**(`_address`, `_codeOffset`): `Promise`\<`boolean`\> + +Defined in: [statefulBinaryTreeStateManager.ts:738](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L738) + +#### Parameters + +##### \_address + +`Address` + +##### \_codeOffset + +`number` + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +`StateManagerInterface.checkChunkWitnessPresent` + +*** + +### checkpoint() + +> **checkpoint**(): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:450](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L450) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.checkpoint` + +*** + +### clearCaches() + +> **clearCaches**(): `void` + +Defined in: [statefulBinaryTreeStateManager.ts:732](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L732) + +#### Returns + +`void` + +#### Implementation of + +`StateManagerInterface.clearCaches` + +*** + +### clearStorage() + +> **clearStorage**(`address`): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:446](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L446) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.clearStorage` + +*** + +### commit() + +> **commit**(): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:455](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L455) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.commit` + +*** + +### deleteAccount() + +> **deleteAccount**(`address`): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L245) + +Deletes an account from state under the provided `address`. + +#### Parameters + +##### address + +`Address` + +Address of the account which should be deleted + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.deleteAccount` + +*** + +### dumpStorage()? + +> `optional` **dumpStorage**(`_address`): `Promise`\<`StorageDump`\> + +Defined in: [statefulBinaryTreeStateManager.ts:726](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L726) + +#### Parameters + +##### \_address + +`Address` + +#### Returns + +`Promise`\<`StorageDump`\> + +#### Implementation of + +`StateManagerInterface.dumpStorage` + +*** + +### dumpStorageRange()? + +> `optional` **dumpStorageRange**(`_address`, `_startKey`, `_limit`): `Promise`\<`StorageRange`\> + +Defined in: [statefulBinaryTreeStateManager.ts:729](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L729) + +#### Parameters + +##### \_address + +`Address` + +##### \_startKey + +`bigint` + +##### \_limit + +`number` + +#### Returns + +`Promise`\<`StorageRange`\> + +#### Implementation of + +`StateManagerInterface.dumpStorageRange` + +*** + +### flush() + +> **flush**(): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:481](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L481) + +#### Returns + +`Promise`\<`void`\> + +*** + +### generateCanonicalGenesis() + +> **generateCanonicalGenesis**(`genesisState`): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:741](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L741) + +#### Parameters + +##### genesisState + +`GenesisState` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.generateCanonicalGenesis` + +*** + +### getAccount() + +> **getAccount**(`address`): `Promise`\<`undefined` \| `Account`\> + +Defined in: [statefulBinaryTreeStateManager.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L118) + +Gets the account associated with `address` or `undefined` if account does not exist + +#### Parameters + +##### address + +`Address` + +Address of the `account` to get + +#### Returns + +`Promise`\<`undefined` \| `Account`\> + +#### Implementation of + +`StateManagerInterface.getAccount` + +*** + +### getCode() + +> **getCode**(`address`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [statefulBinaryTreeStateManager.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L324) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getCode` + +*** + +### getCodeSize() + +> **getCodeSize**(`address`): `Promise`\<`number`\> + +Defined in: [statefulBinaryTreeStateManager.ts:399](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L399) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`number`\> + +#### Implementation of + +`StateManagerInterface.getCodeSize` + +*** + +### getComputedValue() + +> **getComputedValue**(`accessedState`): `Promise`\<`null` \| `` `0x${string}` ``\> + +Defined in: [statefulBinaryTreeStateManager.ts:521](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L521) + +#### Parameters + +##### accessedState + +`BinaryTreeAccessedStateWithAddress` + +#### Returns + +`Promise`\<`null` \| `` `0x${string}` ``\> + +*** + +### getStateRoot() + +> **getStateRoot**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [statefulBinaryTreeStateManager.ts:714](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L714) + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getStateRoot` + +*** + +### getStorage() + +> **getStorage**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [statefulBinaryTreeStateManager.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L408) + +#### Parameters + +##### address + +`Address` + +##### key + +`Uint8Array` + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getStorage` + +*** + +### hasStateRoot() + +> **hasStateRoot**(`root`): `Promise`\<`boolean`\> + +Defined in: [statefulBinaryTreeStateManager.ts:723](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L723) + +#### Parameters + +##### root + +`Uint8Array` + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +`StateManagerInterface.hasStateRoot` + +*** + +### initBinaryTreeExecutionWitness() + +> **initBinaryTreeExecutionWitness**(`_blockNum`, `executionWitness?`): `void` + +Defined in: [statefulBinaryTreeStateManager.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L165) + +#### Parameters + +##### \_blockNum + +`bigint` + +##### executionWitness? + +`null` | `BinaryTreeExecutionWitness` + +#### Returns + +`void` + +#### Implementation of + +`StateManagerInterface.initBinaryTreeExecutionWitness` + +*** + +### modifyAccountFields() + +> **modifyAccountFields**(`address`, `accountFields`): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L263) + +#### Parameters + +##### address + +`Address` + +##### accountFields + +`Partial` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.modifyAccountFields` + +*** + +### putAccount() + +> **putAccount**(`address`, `account?`): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L209) + +Saves an account into state under the provided `address`. + +#### Parameters + +##### address + +`Address` + +Address under which to store `account` + +##### account? + +`Account` + +The account to store or undefined if to be deleted + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putAccount` + +*** + +### putCode() + +> **putCode**(`address`, `value`): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L266) + +#### Parameters + +##### address + +`Address` + +##### value + +`Uint8Array` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putCode` + +*** + +### putStorage() + +> **putStorage**(`address`, `key`, `value`): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:434](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L434) + +#### Parameters + +##### address + +`Address` + +##### key + +`Uint8Array` + +##### value + +`Uint8Array` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putStorage` + +*** + +### revert() + +> **revert**(): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:469](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L469) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.revert` + +*** + +### setStateRoot() + +> **setStateRoot**(`stateRoot`, `clearCache?`): `Promise`\<`void`\> + +Defined in: [statefulBinaryTreeStateManager.ts:718](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L718) + +#### Parameters + +##### stateRoot + +`Uint8Array` + +##### clearCache? + +`boolean` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.setStateRoot` + +*** + +### shallowCopy() + +> **shallowCopy**(`_downlevelCaches?`): `StateManagerInterface` + +Defined in: [statefulBinaryTreeStateManager.ts:735](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L735) + +#### Parameters + +##### \_downlevelCaches? + +`boolean` + +#### Returns + +`StateManagerInterface` + +#### Implementation of + +`StateManagerInterface.shallowCopy` + +*** + +### verifyBinaryTreePostState() + +> **verifyBinaryTreePostState**(`accessWitness`): `Promise`\<`boolean`\> + +Defined in: [statefulBinaryTreeStateManager.ts:615](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulBinaryTreeStateManager.ts#L615) + +#### Parameters + +##### accessWitness + +`BinaryTreeAccessWitnessInterface` + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +`StateManagerInterface.verifyBinaryTreePostState` diff --git a/packages/statemanager/docs/classes/StatefulVerkleStateManager.md b/packages/statemanager/docs/classes/StatefulVerkleStateManager.md new file mode 100644 index 00000000000..dcdac3c1da3 --- /dev/null +++ b/packages/statemanager/docs/classes/StatefulVerkleStateManager.md @@ -0,0 +1,653 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / StatefulVerkleStateManager + +# Class: StatefulVerkleStateManager + +Defined in: [statefulVerkleStateManager.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L63) + +## Implements + +- `StateManagerInterface` + +## Constructors + +### Constructor + +> **new StatefulVerkleStateManager**(`opts`): `StatefulVerkleStateManager` + +Defined in: [statefulVerkleStateManager.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L93) + +#### Parameters + +##### opts + +[`StatefulVerkleStateManagerOpts`](../interfaces/StatefulVerkleStateManagerOpts.md) + +#### Returns + +`StatefulVerkleStateManager` + +## Properties + +### common + +> `readonly` **common**: `Common` + +Defined in: [statefulVerkleStateManager.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L73) + +*** + +### originalStorageCache + +> **originalStorageCache**: [`OriginalStorageCache`](OriginalStorageCache.md) + +Defined in: [statefulVerkleStateManager.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L68) + +#### Implementation of + +`StateManagerInterface.originalStorageCache` + +*** + +### preStateRoot + +> **preStateRoot**: `Uint8Array` + +Defined in: [statefulVerkleStateManager.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L67) + +*** + +### verkleCrypto + +> **verkleCrypto**: `VerkleCrypto` + +Defined in: [statefulVerkleStateManager.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L69) + +## Methods + +### checkChunkWitnessPresent() + +> **checkChunkWitnessPresent**(`_address`, `_codeOffset`): `Promise`\<`boolean`\> + +Defined in: [statefulVerkleStateManager.ts:743](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L743) + +#### Parameters + +##### \_address + +`Address` + +##### \_codeOffset + +`number` + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +`StateManagerInterface.checkChunkWitnessPresent` + +*** + +### checkpoint() + +> **checkpoint**(): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:460](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L460) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.checkpoint` + +*** + +### clearCaches() + +> **clearCaches**(): `void` + +Defined in: [statefulVerkleStateManager.ts:737](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L737) + +#### Returns + +`void` + +#### Implementation of + +`StateManagerInterface.clearCaches` + +*** + +### clearStorage() + +> **clearStorage**(`address`): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:450](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L450) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.clearStorage` + +*** + +### commit() + +> **commit**(): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L465) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.commit` + +*** + +### deleteAccount() + +> **deleteAccount**(`address`): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:255](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L255) + +Deletes an account from state under the provided `address`. + +#### Parameters + +##### address + +`Address` + +Address of the account which should be deleted + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.deleteAccount` + +*** + +### dumpStorage()? + +> `optional` **dumpStorage**(`_address`): `Promise`\<`StorageDump`\> + +Defined in: [statefulVerkleStateManager.ts:731](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L731) + +#### Parameters + +##### \_address + +`Address` + +#### Returns + +`Promise`\<`StorageDump`\> + +#### Implementation of + +`StateManagerInterface.dumpStorage` + +*** + +### dumpStorageRange()? + +> `optional` **dumpStorageRange**(`_address`, `_startKey`, `_limit`): `Promise`\<`StorageRange`\> + +Defined in: [statefulVerkleStateManager.ts:734](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L734) + +#### Parameters + +##### \_address + +`Address` + +##### \_startKey + +`bigint` + +##### \_limit + +`number` + +#### Returns + +`Promise`\<`StorageRange`\> + +#### Implementation of + +`StateManagerInterface.dumpStorageRange` + +*** + +### flush() + +> **flush**(): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:491](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L491) + +#### Returns + +`Promise`\<`void`\> + +*** + +### generateCanonicalGenesis() + +> **generateCanonicalGenesis**(`genesisState`): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:746](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L746) + +#### Parameters + +##### genesisState + +`GenesisState` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.generateCanonicalGenesis` + +*** + +### getAccount() + +> **getAccount**(`address`): `Promise`\<`undefined` \| `Account`\> + +Defined in: [statefulVerkleStateManager.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L130) + +Gets the account associated with `address` or `undefined` if account does not exist + +#### Parameters + +##### address + +`Address` + +Address of the `account` to get + +#### Returns + +`Promise`\<`undefined` \| `Account`\> + +#### Implementation of + +`StateManagerInterface.getAccount` + +*** + +### getCode() + +> **getCode**(`address`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [statefulVerkleStateManager.ts:335](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L335) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getCode` + +*** + +### getCodeSize() + +> **getCodeSize**(`address`): `Promise`\<`number`\> + +Defined in: [statefulVerkleStateManager.ts:405](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L405) + +#### Parameters + +##### address + +`Address` + +#### Returns + +`Promise`\<`number`\> + +#### Implementation of + +`StateManagerInterface.getCodeSize` + +*** + +### getComputedValue() + +> **getComputedValue**(`accessedState`): `Promise`\<`null` \| `` `0x${string}` ``\> + +Defined in: [statefulVerkleStateManager.ts:531](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L531) + +#### Parameters + +##### accessedState + +`VerkleAccessedStateWithAddress` + +#### Returns + +`Promise`\<`null` \| `` `0x${string}` ``\> + +*** + +### getStateRoot() + +> **getStateRoot**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [statefulVerkleStateManager.ts:719](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L719) + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getStateRoot` + +*** + +### getStorage() + +> **getStorage**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [statefulVerkleStateManager.ts:412](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L412) + +#### Parameters + +##### address + +`Address` + +##### key + +`Uint8Array` + +#### Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +#### Implementation of + +`StateManagerInterface.getStorage` + +*** + +### hasStateRoot() + +> **hasStateRoot**(`root`): `Promise`\<`boolean`\> + +Defined in: [statefulVerkleStateManager.ts:728](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L728) + +#### Parameters + +##### root + +`Uint8Array` + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +`StateManagerInterface.hasStateRoot` + +*** + +### initVerkleExecutionWitness() + +> **initVerkleExecutionWitness**(`_blockNum`, `executionWitness?`): `void` + +Defined in: [statefulVerkleStateManager.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L175) + +#### Parameters + +##### \_blockNum + +`bigint` + +##### executionWitness? + +`null` | `VerkleExecutionWitness` + +#### Returns + +`void` + +#### Implementation of + +`StateManagerInterface.initVerkleExecutionWitness` + +*** + +### modifyAccountFields() + +> **modifyAccountFields**(`address`, `accountFields`): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:276](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L276) + +#### Parameters + +##### address + +`Address` + +##### accountFields + +`Partial` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.modifyAccountFields` + +*** + +### putAccount() + +> **putAccount**(`address`, `account?`): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L219) + +Saves an account into state under the provided `address`. + +#### Parameters + +##### address + +`Address` + +Address under which to store `account` + +##### account? + +`Account` + +The account to store or undefined if to be deleted + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putAccount` + +*** + +### putCode() + +> **putCode**(`address`, `value`): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L279) + +#### Parameters + +##### address + +`Address` + +##### value + +`Uint8Array` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putCode` + +*** + +### putStorage() + +> **putStorage**(`address`, `key`, `value`): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L438) + +#### Parameters + +##### address + +`Address` + +##### key + +`Uint8Array` + +##### value + +`Uint8Array` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.putStorage` + +*** + +### revert() + +> **revert**(): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:479](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L479) + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.revert` + +*** + +### setStateRoot() + +> **setStateRoot**(`stateRoot`, `clearCache?`): `Promise`\<`void`\> + +Defined in: [statefulVerkleStateManager.ts:723](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L723) + +#### Parameters + +##### stateRoot + +`Uint8Array` + +##### clearCache? + +`boolean` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +`StateManagerInterface.setStateRoot` + +*** + +### shallowCopy() + +> **shallowCopy**(`_downlevelCaches?`): `StateManagerInterface` + +Defined in: [statefulVerkleStateManager.ts:740](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L740) + +#### Parameters + +##### \_downlevelCaches? + +`boolean` + +#### Returns + +`StateManagerInterface` + +#### Implementation of + +`StateManagerInterface.shallowCopy` + +*** + +### verifyVerklePostState() + +> **verifyVerklePostState**(`accessWitness`): `Promise`\<`boolean`\> + +Defined in: [statefulVerkleStateManager.ts:626](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statefulVerkleStateManager.ts#L626) + +#### Parameters + +##### accessWitness + +`VerkleAccessWitnessInterface` + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +`StateManagerInterface.verifyVerklePostState` diff --git a/packages/statemanager/docs/classes/StatelessVerkleStateManager.md b/packages/statemanager/docs/classes/StatelessVerkleStateManager.md index 24bb3f863cd..7fa8aeca5cd 100644 --- a/packages/statemanager/docs/classes/StatelessVerkleStateManager.md +++ b/packages/statemanager/docs/classes/StatelessVerkleStateManager.md @@ -1,7 +1,13 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + [@ethereumjs/statemanager](../README.md) / StatelessVerkleStateManager # Class: StatelessVerkleStateManager +Defined in: [statelessVerkleStateManager.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L69) + Stateless Verkle StateManager implementation for the VM. Experimental. @@ -13,160 +19,97 @@ to fetch data requested by the the VM. ## Implements -- `EVMStateManagerInterface` - -## Table of contents - -### Constructors - -- [constructor](StatelessVerkleStateManager.md#constructor) - -### Properties - -- [\_accountCache](StatelessVerkleStateManager.md#_accountcache) -- [\_codeCache](StatelessVerkleStateManager.md#_codecache) -- [\_storageCache](StatelessVerkleStateManager.md#_storagecache) -- [accessWitness](StatelessVerkleStateManager.md#accesswitness) -- [originalStorageCache](StatelessVerkleStateManager.md#originalstoragecache) - -### Methods - -- [checkChunkWitnessPresent](StatelessVerkleStateManager.md#checkchunkwitnesspresent) -- [checkpoint](StatelessVerkleStateManager.md#checkpoint) -- [chunkifyCode](StatelessVerkleStateManager.md#chunkifycode) -- [clearCaches](StatelessVerkleStateManager.md#clearcaches) -- [clearContractStorage](StatelessVerkleStateManager.md#clearcontractstorage) -- [commit](StatelessVerkleStateManager.md#commit) -- [deleteAccount](StatelessVerkleStateManager.md#deleteaccount) -- [dumpStorage](StatelessVerkleStateManager.md#dumpstorage) -- [dumpStorageRange](StatelessVerkleStateManager.md#dumpstoragerange) -- [flush](StatelessVerkleStateManager.md#flush) -- [generateCanonicalGenesis](StatelessVerkleStateManager.md#generatecanonicalgenesis) -- [getAccount](StatelessVerkleStateManager.md#getaccount) -- [getAppliedKey](StatelessVerkleStateManager.md#getappliedkey) -- [getComputedValue](StatelessVerkleStateManager.md#getcomputedvalue) -- [getContractCode](StatelessVerkleStateManager.md#getcontractcode) -- [getContractStorage](StatelessVerkleStateManager.md#getcontractstorage) -- [getProof](StatelessVerkleStateManager.md#getproof) -- [getStateRoot](StatelessVerkleStateManager.md#getstateroot) -- [getTransitionStateRoot](StatelessVerkleStateManager.md#gettransitionstateroot) -- [getTreeKeyForBalance](StatelessVerkleStateManager.md#gettreekeyforbalance) -- [getTreeKeyForCodeChunk](StatelessVerkleStateManager.md#gettreekeyforcodechunk) -- [getTreeKeyForCodeHash](StatelessVerkleStateManager.md#gettreekeyforcodehash) -- [getTreeKeyForCodeSize](StatelessVerkleStateManager.md#gettreekeyforcodesize) -- [getTreeKeyForNonce](StatelessVerkleStateManager.md#gettreekeyfornonce) -- [getTreeKeyForStorageSlot](StatelessVerkleStateManager.md#gettreekeyforstorageslot) -- [getTreeKeyForVersion](StatelessVerkleStateManager.md#gettreekeyforversion) -- [hasStateRoot](StatelessVerkleStateManager.md#hasstateroot) -- [initVerkleExecutionWitness](StatelessVerkleStateManager.md#initverkleexecutionwitness) -- [modifyAccountFields](StatelessVerkleStateManager.md#modifyaccountfields) -- [putAccount](StatelessVerkleStateManager.md#putaccount) -- [putContractCode](StatelessVerkleStateManager.md#putcontractcode) -- [putContractStorage](StatelessVerkleStateManager.md#putcontractstorage) -- [revert](StatelessVerkleStateManager.md#revert) -- [setStateRoot](StatelessVerkleStateManager.md#setstateroot) -- [shallowCopy](StatelessVerkleStateManager.md#shallowcopy) -- [verifyPostState](StatelessVerkleStateManager.md#verifypoststate) -- [verifyProof](StatelessVerkleStateManager.md#verifyproof) +- `StateManagerInterface` ## Constructors -### constructor +### Constructor + +> **new StatelessVerkleStateManager**(`opts`): `StatelessVerkleStateManager` -• **new StatelessVerkleStateManager**(`opts?`) +Defined in: [statelessVerkleStateManager.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L113) Instantiate the StateManager interface. #### Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`StatelessVerkleStateManagerOpts`](../interfaces/StatelessVerkleStateManagerOpts.md) | - -#### Defined in - -[statelessVerkleStateManager.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L178) - -## Properties - -### \_accountCache +##### opts -• `Optional` **\_accountCache**: [`AccountCache`](AccountCache.md) +[`StatelessVerkleStateManagerOpts`](../interfaces/StatelessVerkleStateManagerOpts.md) -#### Defined in +#### Returns -[statelessVerkleStateManager.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L138) +`StatelessVerkleStateManager` -___ +## Properties -### \_codeCache +### \_cachedStateRoot? -• `Optional` **\_codeCache**: [`CodeCache`](CodeCache.md) +> `optional` **\_cachedStateRoot**: `Uint8Array`\<`ArrayBufferLike`\> -#### Defined in +Defined in: [statelessVerkleStateManager.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L70) -[statelessVerkleStateManager.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L140) +*** -___ +### common -### \_storageCache +> `readonly` **common**: `Common` -• `Optional` **\_storageCache**: [`StorageCache`](StorageCache.md) +Defined in: [statelessVerkleStateManager.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L80) -#### Defined in +*** -[statelessVerkleStateManager.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L139) +### originalStorageCache -___ +> **originalStorageCache**: [`OriginalStorageCache`](OriginalStorageCache.md) -### accessWitness +Defined in: [statelessVerkleStateManager.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L72) -• `Optional` **accessWitness**: [`AccessWitness`](AccessWitness.md) +#### Implementation of -#### Defined in +`StateManagerInterface.originalStorageCache` -[statelessVerkleStateManager.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L171) +*** -___ +### verkleCrypto -### originalStorageCache +> **verkleCrypto**: `VerkleCrypto` -• **originalStorageCache**: [`OriginalStorageCache`](OriginalStorageCache.md) +Defined in: [statelessVerkleStateManager.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L74) -#### Implementation of +## Methods -EVMStateManagerInterface.originalStorageCache +### checkChunkWitnessPresent() -#### Defined in +> **checkChunkWitnessPresent**(`address`, `codeOffset`): `Promise`\<`boolean`\> -[statelessVerkleStateManager.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L142) +Defined in: [statelessVerkleStateManager.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L206) -## Methods +#### Parameters -### checkChunkWitnessPresent +##### address -▸ **checkChunkWitnessPresent**(`address`, `codeOffset`): `boolean` +`Address` -#### Parameters +##### codeOffset -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `codeOffset` | `number` | +`number` #### Returns -`boolean` +`Promise`\<`boolean`\> + +#### Implementation of -#### Defined in +`StateManagerInterface.checkChunkWitnessPresent` -[statelessVerkleStateManager.ts:344](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L344) +*** -___ +### checkpoint() -### checkpoint +> **checkpoint**(): `Promise`\<`void`\> -▸ **checkpoint**(): `Promise`<`void`\> +Defined in: [statelessVerkleStateManager.ts:639](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L639) Checkpoints the current state of the StateManager instance. State changes that follow can then be committed by calling @@ -174,41 +117,19 @@ State changes that follow can then be committed by calling #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.checkpoint - -#### Defined in - -[statelessVerkleStateManager.ts:806](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L806) - -___ - -### chunkifyCode - -▸ **chunkifyCode**(`code`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `code` | `Uint8Array` | - -#### Returns - -`void` - -#### Defined in +`StateManagerInterface.checkpoint` -[statelessVerkleStateManager.ts:328](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L328) +*** -___ +### clearCaches() -### clearCaches +> **clearCaches**(): `void` -▸ **clearCaches**(): `void` +Defined in: [statelessVerkleStateManager.ts:698](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L698) Clears all underlying caches @@ -216,772 +137,551 @@ Clears all underlying caches `void` -#### Defined in +#### Implementation of + +`StateManagerInterface.clearCaches` -[statelessVerkleStateManager.ts:881](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L881) +*** -___ +### clearStorage() -### clearContractStorage +> **clearStorage**(`address`): `Promise`\<`void`\> -▸ **clearContractStorage**(`address`): `Promise`<`void`\> +Defined in: [statelessVerkleStateManager.ts:388](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L388) Clears all storage entries for the account corresponding to `address`. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to clear the storage of | +##### address + +`Address` + +Address to clear the storage of #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.clearContractStorage +`StateManagerInterface.clearStorage` -#### Defined in +*** -[statelessVerkleStateManager.ts:495](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L495) +### commit() -___ +> **commit**(): `Promise`\<`void`\> -### commit - -▸ **commit**(): `Promise`<`void`\> +Defined in: [statelessVerkleStateManager.ts:648](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L648) Commits the current change-set to the instance since the last call to checkpoint. #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.commit - -#### Defined in +`StateManagerInterface.commit` -[statelessVerkleStateManager.ts:817](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L817) +*** -___ +### deleteAccount() -### deleteAccount +> **deleteAccount**(`address`): `Promise`\<`void`\> -▸ **deleteAccount**(`address`): `Promise`<`void`\> +Defined in: [statelessVerkleStateManager.ts:489](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L489) Deletes an account from state under the provided `address`. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the account which should be deleted | +##### address -#### Returns +`Address` -`Promise`<`void`\> - -#### Implementation of - -EVMStateManagerInterface.deleteAccount - -#### Defined in - -[statelessVerkleStateManager.ts:595](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L595) - -___ - -### dumpStorage - -▸ **dumpStorage**(`_`): `Promise`<`StorageDump`\> - -Dumps the RLP-encoded storage values for an `account` specified by `address`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_` | `Address` | +Address of the account which should be deleted #### Returns -`Promise`<`StorageDump`\> - -- The state of the account as an `Object` map. -Keys are are the storage keys, values are the storage values as strings. -Both are represented as hex strings without the `0x` prefix. +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.dumpStorage +`StateManagerInterface.deleteAccount` -#### Defined in +*** -[statelessVerkleStateManager.ts:870](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L870) +### flush() -___ +> **flush**(): `Promise`\<`void`\> -### dumpStorageRange - -▸ **dumpStorageRange**(`_`, `__`, `___`): `Promise`<`StorageRange`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_` | `Address` | -| `__` | `bigint` | -| `___` | `number` | - -#### Returns - -`Promise`<`StorageRange`\> - -#### Implementation of - -EVMStateManagerInterface.dumpStorageRange - -#### Defined in - -[statelessVerkleStateManager.ts:874](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L874) - -___ - -### flush - -▸ **flush**(): `Promise`<`void`\> +Defined in: [statelessVerkleStateManager.ts:671](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L671) Writes all cache items to the trie #### Returns -`Promise`<`void`\> - -#### Defined in +`Promise`\<`void`\> -[statelessVerkleStateManager.ts:844](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L844) +*** -___ +### generateCanonicalGenesis() -### generateCanonicalGenesis +> **generateCanonicalGenesis**(`_initState`): `Promise`\<`void`\> -▸ **generateCanonicalGenesis**(`_initState`): `Promise`<`void`\> +Defined in: [statelessVerkleStateManager.ts:706](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L706) #### Parameters -| Name | Type | -| :------ | :------ | -| `_initState` | `any` | - -#### Returns - -`Promise`<`void`\> - -#### Implementation of +##### \_initState -EVMStateManagerInterface.generateCanonicalGenesis - -#### Defined in - -[statelessVerkleStateManager.ts:887](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L887) - -___ - -### getAccount - -▸ **getAccount**(`address`): `Promise`<`undefined` \| `Account`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | +`any` #### Returns -`Promise`<`undefined` \| `Account`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.getAccount +`StateManagerInterface.generateCanonicalGenesis` -#### Defined in +*** -[statelessVerkleStateManager.ts:505](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L505) +### getAccount() -___ +> **getAccount**(`address`): `Promise`\<`undefined` \| `Account`\> -### getAppliedKey - -▸ **getAppliedKey**(`_`): `Uint8Array` +Defined in: [statelessVerkleStateManager.ts:396](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L396) #### Parameters -| Name | Type | -| :------ | :------ | -| `_` | `Uint8Array` | +##### address + +`Address` #### Returns -`Uint8Array` +`Promise`\<`undefined` \| `Account`\> #### Implementation of -EVMStateManagerInterface.getAppliedKey +`StateManagerInterface.getAccount` -#### Defined in +*** -[statelessVerkleStateManager.ts:891](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L891) +### getCode() -___ +> **getCode**(`address`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -### getComputedValue +Defined in: [statelessVerkleStateManager.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L257) -▸ **getComputedValue**(`accessedState`): ``null`` \| `string` +Gets the code corresponding to the provided `address`. #### Parameters -| Name | Type | -| :------ | :------ | -| `accessedState` | [`AccessedStateWithAddress`](../README.md#accessedstatewithaddress) | - -#### Returns - -``null`` \| `string` - -#### Defined in - -[statelessVerkleStateManager.ts:717](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L717) - -___ - -### getContractCode +##### address -▸ **getContractCode**(`address`): `Promise`<`Uint8Array`\> +`Address` -Gets the code corresponding to the provided `address`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to get the `code` for | +Address to get the `code` for #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> - Resolves with the code corresponding to the provided address. Returns an empty `Uint8Array` if the account has no associated code. #### Implementation of -EVMStateManagerInterface.getContractCode +`StateManagerInterface.getCode` -#### Defined in +*** -[statelessVerkleStateManager.ts:391](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L391) +### getCodeSize() -___ +> **getCodeSize**(`address`): `Promise`\<`number`\> -### getContractStorage - -▸ **getContractStorage**(`address`, `key`): `Promise`<`Uint8Array`\> - -Gets the storage value associated with the provided `address` and `key`. This method returns -the shortest representation of the stored value. +Defined in: [statelessVerkleStateManager.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L312) #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the account to get the storage for | -| `key` | `Uint8Array` | Key in the account's storage to get the value for. Must be 32 bytes long. | +##### address -#### Returns +`Address` -`Promise`<`Uint8Array`\> +#### Returns -- The storage value for the account -corresponding to the provided address at the provided key. -If this does not exist an empty `Uint8Array` is returned. +`Promise`\<`number`\> #### Implementation of -EVMStateManagerInterface.getContractStorage +`StateManagerInterface.getCodeSize` -#### Defined in +*** -[statelessVerkleStateManager.ts:455](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L455) +### getComputedValue() -___ +> **getComputedValue**(`accessedState`): `null` \| `` `0x${string}` `` -### getProof - -▸ **getProof**(`_`, `__?`): `Promise`<`Proof`\> +Defined in: [statelessVerkleStateManager.ts:581](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L581) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `_` | `Address` | `undefined` | -| `__` | `Uint8Array`[] | `[]` | - -#### Returns +##### accessedState -`Promise`<`Proof`\> +`VerkleAccessedStateWithAddress` -#### Implementation of - -EVMStateManagerInterface.getProof +#### Returns -#### Defined in +`null` \| `` `0x${string}` `` -[statelessVerkleStateManager.ts:621](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L621) +*** -___ +### getStateRoot() -### getStateRoot +> **getStateRoot**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **getStateRoot**(): `Promise`<`Uint8Array`\> +Defined in: [statelessVerkleStateManager.ts:679](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L679) -Gets the verkle root. -NOTE: this needs some examination in the code where this is needed -and if we have the verkle root present +Gets the cache state root. +This is used to persist the stateRoot between blocks, so that blocks can retrieve the stateRoot of the parent block. +This is required to verify and prove verkle execution witnesses. #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -- Returns the verkle root of the `StateManager` +- Returns the cached state root #### Implementation of -EVMStateManagerInterface.getStateRoot +`StateManagerInterface.getStateRoot` -#### Defined in +*** -[statelessVerkleStateManager.ts:852](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L852) +### getStorage() -___ +> **getStorage**(`address`, `key`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -### getTransitionStateRoot +Defined in: [statelessVerkleStateManager.ts:342](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L342) -▸ **getTransitionStateRoot**(`_`, `__`): `Promise`<`Uint8Array`\> +Gets the storage value associated with the provided `address` and `key`. This method returns +the shortest representation of the stored value. #### Parameters -| Name | Type | -| :------ | :------ | -| `_` | [`DefaultStateManager`](DefaultStateManager.md) | -| `__` | `Uint8Array` | - -#### Returns - -`Promise`<`Uint8Array`\> +##### address -#### Defined in +`Address` -[statelessVerkleStateManager.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L242) +Address of the account to get the storage for -___ - -### getTreeKeyForBalance - -▸ **getTreeKeyForBalance**(`stem`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stem` | `Uint8Array` | - -#### Returns +##### key `Uint8Array` -#### Defined in +Key in the account's storage to get the value for. Must be 32 bytes long. -[statelessVerkleStateManager.ts:307](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L307) - -___ +#### Returns -### getTreeKeyForCodeChunk +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **getTreeKeyForCodeChunk**(`address`, `chunkId`): `Uint8Array` +- The storage value for the account +corresponding to the provided address at the provided key. +If this does not exist an empty `Uint8Array` is returned. -#### Parameters +#### Implementation of -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `chunkId` | `number` | +`StateManagerInterface.getStorage` -#### Returns +*** -`Uint8Array` +### getTransitionStateRoot() -#### Defined in +> **getTransitionStateRoot**(`_`, `__`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -[statelessVerkleStateManager.ts:323](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L323) +Defined in: [statelessVerkleStateManager.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L138) -___ +#### Parameters -### getTreeKeyForCodeHash +##### \_ -▸ **getTreeKeyForCodeHash**(`stem`): `Uint8Array` +[`MerkleStateManager`](MerkleStateManager.md) -#### Parameters +##### \_\_ -| Name | Type | -| :------ | :------ | -| `stem` | `Uint8Array` | +`Uint8Array` #### Returns -`Uint8Array` +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -#### Defined in +*** -[statelessVerkleStateManager.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L315) +### hasStateRoot() -___ +> **hasStateRoot**(`_`): `Promise`\<`boolean`\> -### getTreeKeyForCodeSize - -▸ **getTreeKeyForCodeSize**(`stem`): `Uint8Array` +Defined in: [statelessVerkleStateManager.ts:654](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L654) #### Parameters -| Name | Type | -| :------ | :------ | -| `stem` | `Uint8Array` | - -#### Returns +##### \_ `Uint8Array` -#### Defined in - -[statelessVerkleStateManager.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L319) - -___ - -### getTreeKeyForNonce - -▸ **getTreeKeyForNonce**(`stem`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stem` | `Uint8Array` | - #### Returns -`Uint8Array` - -#### Defined in +`Promise`\<`boolean`\> -[statelessVerkleStateManager.ts:311](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L311) +#### Implementation of -___ +`StateManagerInterface.hasStateRoot` -### getTreeKeyForStorageSlot +*** -▸ **getTreeKeyForStorageSlot**(`address`, `storageKey`): `Uint8Array` +### initVerkleExecutionWitness() -#### Parameters +> **initVerkleExecutionWitness**(`blockNum`, `executionWitness?`): `void` -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `storageKey` | `bigint` | +Defined in: [statelessVerkleStateManager.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L142) -#### Returns +#### Parameters -`Uint8Array` +##### blockNum -#### Defined in +`bigint` -[statelessVerkleStateManager.ts:338](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L338) +##### executionWitness? -___ +`null` | `VerkleExecutionWitness` -### getTreeKeyForVersion +#### Returns -▸ **getTreeKeyForVersion**(`stem`): `Uint8Array` +`void` -#### Parameters +#### Implementation of -| Name | Type | -| :------ | :------ | -| `stem` | `Uint8Array` | +`StateManagerInterface.initVerkleExecutionWitness` -#### Returns +*** -`Uint8Array` +### modifyAccountFields() -#### Defined in +> **modifyAccountFields**(`address`, `accountFields`): `Promise`\<`void`\> -[statelessVerkleStateManager.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L303) +Defined in: [statelessVerkleStateManager.ts:497](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L497) -___ +#### Parameters -### hasStateRoot +##### address -▸ **hasStateRoot**(`_`): `Promise`<`boolean`\> +`Address` -#### Parameters +##### accountFields -| Name | Type | -| :------ | :------ | -| `_` | `Uint8Array` | +`Partial` #### Returns -`Promise`<`boolean`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.hasStateRoot +`StateManagerInterface.modifyAccountFields` -#### Defined in +*** -[statelessVerkleStateManager.ts:825](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L825) +### putAccount() -___ +> **putAccount**(`address`, `account`): `Promise`\<`void`\> -### initVerkleExecutionWitness - -▸ **initVerkleExecutionWitness**(`executionWitness?`, `accessWitness?`): `void` +Defined in: [statelessVerkleStateManager.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L465) #### Parameters -| Name | Type | -| :------ | :------ | -| `executionWitness?` | ``null`` \| `VerkleExecutionWitness` | -| `accessWitness?` | [`AccessWitness`](AccessWitness.md) | - -#### Returns - -`void` - -#### Defined in - -[statelessVerkleStateManager.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L246) +##### address -___ +`Address` -### modifyAccountFields - -▸ **modifyAccountFields**(`address`, `accountFields`): `Promise`<`void`\> - -#### Parameters +##### account -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `accountFields` | `Partial`<`Pick`<`Account`, ``"nonce"`` \| ``"balance"`` \| ``"storageRoot"`` \| ``"codeHash"``\>\> | +`Account` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.modifyAccountFields +`StateManagerInterface.putAccount` -#### Defined in +*** -[statelessVerkleStateManager.ts:608](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L608) +### putCode() -___ +> **putCode**(`address`, `value`): `Promise`\<`void`\> -### putAccount +Defined in: [statelessVerkleStateManager.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L233) -▸ **putAccount**(`address`, `account`): `Promise`<`void`\> +Adds `value` to the state trie as code, and sets `codeHash` on the account +corresponding to `address` to reference this. #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `account` | `Account` | +##### address -#### Returns +`Address` -`Promise`<`void`\> +Address of the `account` to add the `code` for -#### Implementation of +##### value -EVMStateManagerInterface.putAccount +`Uint8Array` -#### Defined in +The value of the `code` -[statelessVerkleStateManager.ts:561](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L561) +#### Returns -___ +`Promise`\<`void`\> -### putContractCode +#### Implementation of -▸ **putContractCode**(`address`, `value`): `Promise`<`void`\> +`StateManagerInterface.putCode` -Adds `value` to the state trie as code, and sets `codeHash` on the account -corresponding to `address` to reference this. +*** -#### Parameters +### putStorage() -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of the `account` to add the `code` for | -| `value` | `Uint8Array` | The value of the `code` | +> **putStorage**(`address`, `key`, `value`): `Promise`\<`void`\> -#### Returns +Defined in: [statelessVerkleStateManager.ts:368](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L368) -`Promise`<`void`\> +Adds value to the state for the `account` +corresponding to `address` at the provided `key`. -#### Implementation of +#### Parameters -EVMStateManagerInterface.putContractCode +##### address -#### Defined in +`Address` -[statelessVerkleStateManager.ts:367](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L367) +Address to set a storage value for -___ +##### key -### putContractStorage +`Uint8Array` -▸ **putContractStorage**(`address`, `key`, `value`): `Promise`<`void`\> +Key to set the value at. Must be 32 bytes long. -Adds value to the state for the `account` -corresponding to `address` at the provided `key`. +##### value -#### Parameters +`Uint8Array` -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address to set a storage value for | -| `key` | `Uint8Array` | Key to set the value at. Must be 32 bytes long. | -| `value` | `Uint8Array` | Value to set at `key` for account corresponding to `address`. Cannot be more than 32 bytes. Leading zeros are stripped. If it is a empty or filled with zeros, deletes the value. | +Value to set at `key` for account corresponding to `address`. Cannot be more than 32 bytes. Leading zeros are stripped. If it is a empty or filled with zeros, deletes the value. #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.putContractStorage +`StateManagerInterface.putStorage` -#### Defined in +*** -[statelessVerkleStateManager.ts:480](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L480) +### revert() -___ +> **revert**(): `Promise`\<`void`\> -### revert - -▸ **revert**(): `Promise`<`void`\> +Defined in: [statelessVerkleStateManager.ts:662](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L662) Reverts the current change-set to the instance since the last call to checkpoint. #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.revert - -#### Defined in +`StateManagerInterface.revert` -[statelessVerkleStateManager.ts:833](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L833) +*** -___ +### setStateRoot() -### setStateRoot +> **setStateRoot**(`stateRoot`): `Promise`\<`void`\> -▸ **setStateRoot**(`_`): `Promise`<`void`\> +Defined in: [statelessVerkleStateManager.ts:691](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L691) -TODO: needed? -Maybe in this context: reset to original pre state suffice +Sets the cache state root. +This is used to persist the stateRoot between blocks, so that blocks can retrieve the stateRoot of the parent block. #### Parameters -| Name | Type | -| :------ | :------ | -| `_` | `Uint8Array` | +##### stateRoot + +`Uint8Array` + +The stateRoot to set #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -EVMStateManagerInterface.setStateRoot - -#### Defined in +`StateManagerInterface.setStateRoot` -[statelessVerkleStateManager.ts:861](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L861) +*** -___ +### shallowCopy() -### shallowCopy +> **shallowCopy**(`downlevelCaches`): `StatelessVerkleStateManager` -▸ **shallowCopy**(): `EVMStateManagerInterface` +Defined in: [statelessVerkleStateManager.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L219) Copies the current instance of the `StateManager` at the last fully committed point, i.e. as if all current checkpoints were reverted. -#### Returns - -`EVMStateManagerInterface` - -#### Implementation of - -EVMStateManagerInterface.shallowCopy - -#### Defined in - -[statelessVerkleStateManager.ts:355](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L355) - -___ +#### Parameters -### verifyPostState +##### downlevelCaches -▸ **verifyPostState**(): `boolean` +`boolean` = `true` #### Returns -`boolean` +`StatelessVerkleStateManager` + +#### Implementation of -#### Defined in +`StateManagerInterface.shallowCopy` -[statelessVerkleStateManager.ts:648](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L648) +*** -___ +### verifyVerklePostState() -### verifyProof +> **verifyVerklePostState**(`accessWitness`): `Promise`\<`boolean`\> -▸ **verifyProof**(`parentVerkleRoot`): `Promise`<`boolean`\> +Defined in: [statelessVerkleStateManager.ts:503](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L503) #### Parameters -| Name | Type | -| :------ | :------ | -| `parentVerkleRoot` | `Uint8Array` | +##### accessWitness + +`VerkleAccessWitnessInterface` #### Returns -`Promise`<`boolean`\> +`Promise`\<`boolean`\> -#### Defined in +#### Implementation of -[statelessVerkleStateManager.ts:625](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L625) +`StateManagerInterface.verifyVerklePostState` diff --git a/packages/statemanager/docs/classes/StorageCache.md b/packages/statemanager/docs/classes/StorageCache.md index 10139ce9492..796a5ecdc0d 100644 --- a/packages/statemanager/docs/classes/StorageCache.md +++ b/packages/statemanager/docs/classes/StorageCache.md @@ -1,97 +1,70 @@ -[@ethereumjs/statemanager](../README.md) / StorageCache - -# Class: StorageCache +[**@ethereumjs/statemanager**](../README.md) -## Hierarchy +*** -- `Cache` +[@ethereumjs/statemanager](../README.md) / StorageCache - ↳ **`StorageCache`** +# Class: StorageCache -## Table of contents +Defined in: [cache/storage.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L20) -### Constructors +## Extends -- [constructor](StorageCache.md#constructor) +- `Cache` -### Properties +## Constructors -- [\_checkpoints](StorageCache.md#_checkpoints) -- [\_debug](StorageCache.md#_debug) -- [\_diffCache](StorageCache.md#_diffcache) -- [\_lruCache](StorageCache.md#_lrucache) -- [\_orderedMapCache](StorageCache.md#_orderedmapcache) -- [\_stats](StorageCache.md#_stats) +### Constructor -### Methods +> **new StorageCache**(`opts`): `StorageCache` -- [\_saveCachePreState](StorageCache.md#_savecacheprestate) -- [checkpoint](StorageCache.md#checkpoint) -- [clear](StorageCache.md#clear) -- [clearContractStorage](StorageCache.md#clearcontractstorage) -- [commit](StorageCache.md#commit) -- [del](StorageCache.md#del) -- [dump](StorageCache.md#dump) -- [flush](StorageCache.md#flush) -- [get](StorageCache.md#get) -- [put](StorageCache.md#put) -- [revert](StorageCache.md#revert) -- [size](StorageCache.md#size) -- [stats](StorageCache.md#stats) +Defined in: [cache/storage.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L35) -## Constructors +#### Parameters -### constructor +##### opts -• **new StorageCache**(`opts`) +[`CacheOpts`](../interfaces/CacheOpts.md) -#### Parameters +#### Returns -| Name | Type | -| :------ | :------ | -| `opts` | [`CacheOpts`](../interfaces/CacheOpts.md) | +`StorageCache` #### Overrides -Cache.constructor - -#### Defined in - -[cache/storage.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L36) +`Cache.constructor` ## Properties ### \_checkpoints -• **\_checkpoints**: `number` = `0` +> **\_checkpoints**: `number` = `0` -#### Inherited from +Defined in: [cache/cache.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L8) -Cache.\_checkpoints - -#### Defined in +#### Inherited from -[cache/cache.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L9) +`Cache._checkpoints` -___ +*** ### \_debug -• **\_debug**: `Debugger` - -#### Inherited from +> **\_debug**: `Debugger` -Cache.\_debug +Defined in: [cache/cache.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L6) -#### Defined in +#### Inherited from -[cache/cache.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L7) +`Cache._debug` -___ +*** ### \_diffCache -• **\_diffCache**: `Map`<`string`, `DiffStorageCacheMap`\>[] = `[]` +> **\_diffCache**: `Map`\<`string`, `DiffStorageCacheMap`\>[] = `[]` + +Defined in: [cache/storage.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L33) Diff cache collecting the state of the cache at the beginning of checkpoint height @@ -101,80 +74,83 @@ If the whole cache element is undefined (in contrast to the account), the element didn't exist in the cache before. -#### Defined in +*** -[cache/storage.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L34) +### \_lruCache -___ +> **\_lruCache**: `undefined` \| `LRUCache`\<`string`, `StorageCacheMap`, `unknown`\> -### \_lruCache +Defined in: [cache/storage.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L21) + +*** -• **\_lruCache**: `undefined` \| `LRUCache`<`string`, `StorageCacheMap`, `unknown`\> +### \_orderedMapCache -#### Defined in +> **\_orderedMapCache**: `undefined` \| `OrderedMap`\<`string`, `StorageCacheMap`\> -[cache/storage.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L22) +Defined in: [cache/storage.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L22) -___ +*** -### \_orderedMapCache +### \_stats -• **\_orderedMapCache**: `undefined` \| `OrderedMap`<`string`, `StorageCacheMap`\> +> **\_stats**: `object` -#### Defined in +Defined in: [cache/cache.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L10) -[cache/storage.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L23) +#### deletions -___ +> **deletions**: `number` = `0` -### \_stats +#### hits -• **\_stats**: `Object` +> **hits**: `number` = `0` -#### Type declaration +#### reads -| Name | Type | -| :------ | :------ | -| `dels` | `number` | -| `hits` | `number` | -| `reads` | `number` | -| `size` | `number` | -| `writes` | `number` | +> **reads**: `number` = `0` -#### Inherited from +#### size -Cache.\_stats +> **size**: `number` = `0` -#### Defined in +#### writes -[cache/cache.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/cache.ts#L11) +> **writes**: `number` = `0` + +#### Inherited from + +`Cache._stats` ## Methods -### \_saveCachePreState +### \_saveCachePreState() -▸ **_saveCachePreState**(`addressHex`, `keyHex`): `void` +> **\_saveCachePreState**(`addressHex`, `keyHex`): `void` + +Defined in: [cache/storage.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L53) #### Parameters -| Name | Type | -| :------ | :------ | -| `addressHex` | `string` | -| `keyHex` | `string` | +##### addressHex + +`string` + +##### keyHex + +`string` #### Returns `void` -#### Defined in +*** -[cache/storage.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L54) +### checkpoint() -___ +> **checkpoint**(): `void` -### checkpoint - -▸ **checkpoint**(): `void` +Defined in: [cache/storage.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L301) Marks current state of cache as checkpoint, which can later on be reverted or committed. @@ -183,15 +159,13 @@ later on be reverted or committed. `void` -#### Defined in - -[cache/storage.ts:300](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L300) +*** -___ +### clear() -### clear +> **clear**(): `void` -▸ **clear**(): `void` +Defined in: [cache/storage.ts:343](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L343) Clears cache. @@ -199,37 +173,33 @@ Clears cache. `void` -#### Defined in +*** -[cache/storage.ts:342](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L342) +### clearStorage() -___ +> **clearStorage**(`address`): `void` -### clearContractStorage - -▸ **clearContractStorage**(`address`): `void` +Defined in: [cache/storage.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L175) Deletes all storage slots for address from the cache #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | `Address` | +##### address + +`Address` #### Returns `void` -#### Defined in - -[cache/storage.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L176) +*** -___ +### commit() -### commit +> **commit**(): `void` -▸ **commit**(): `void` +Defined in: [cache/storage.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L268) Commits to current state of cache (no effect on trie). @@ -237,46 +207,51 @@ Commits to current state of cache (no effect on trie). `void` -#### Defined in +*** -[cache/storage.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L267) +### del() -___ +> **del**(`address`, `key`): `void` -### del - -▸ **del**(`address`, `key`): `void` +Defined in: [cache/storage.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L145) Marks storage key for address as deleted in cache. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address | -| `key` | `Uint8Array` | Storage key | +##### address + +`Address` + +Address + +##### key + +`Uint8Array` + +Storage key #### Returns `void` -#### Defined in - -[cache/storage.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L146) +*** -___ +### dump() -### dump +> **dump**(`address`): `undefined` \| `StorageCacheMap` -▸ **dump**(`address`): `undefined` \| `StorageCacheMap` +Defined in: [cache/storage.ts:359](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L359) Dumps the RLP-encoded storage values for an `account` specified by `address`. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | The address of the `account` to return storage for | +##### address + +`Address` + +The address of the `account` to return storage for #### Returns @@ -284,32 +259,28 @@ Dumps the RLP-encoded storage values for an `account` specified by `address`. - The storage values for the `account` or undefined if the `account` is not in the cache -#### Defined in - -[cache/storage.ts:358](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L358) +*** -___ +### flush() -### flush +> **flush**(): \[`string`, `string`, `undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\][] -▸ **flush**(): [`string`, `string`, `undefined` \| `Uint8Array`][] +Defined in: [cache/storage.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L188) Flushes cache by returning storage slots that have been modified or deleted and resetting the diff cache (at checkpoint height). #### Returns -[`string`, `string`, `undefined` \| `Uint8Array`][] +\[`string`, `string`, `undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\][] -#### Defined in +*** -[cache/storage.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L189) +### get() -___ +> **get**(`address`, `key`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> -### get - -▸ **get**(`address`, `key`): `undefined` \| `Uint8Array` +Defined in: [cache/storage.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L120) Returns the queried slot as the RLP encoded storage value hexToBytes('0x80'): slot is known to be empty @@ -317,50 +288,63 @@ undefined: slot is not in cache #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Address of account | -| `key` | `Uint8Array` | Storage key | +##### address + +`Address` + +Address of account + +##### key + +`Uint8Array` + +Storage key #### Returns -`undefined` \| `Uint8Array` +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> Storage value or undefined -#### Defined in +*** -[cache/storage.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L121) +### put() -___ +> **put**(`address`, `key`, `value`): `void` -### put - -▸ **put**(`address`, `key`, `value`): `void` +Defined in: [cache/storage.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L82) Puts storage value to cache under address_key cache key. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `Address` | Account address | -| `key` | `Uint8Array` | Storage key | -| `value` | `Uint8Array` | - | +##### address + +`Address` + +Account address + +##### key + +`Uint8Array` + +Storage key + +##### value + +`Uint8Array` #### Returns `void` -#### Defined in +*** -[cache/storage.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L83) +### revert() -___ +> **revert**(): `void` -### revert - -▸ **revert**(): `void` +Defined in: [cache/storage.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L226) Revert changes to cache last checkpoint (no effect on trie). @@ -368,15 +352,13 @@ Revert changes to cache last checkpoint (no effect on trie). `void` -#### Defined in - -[cache/storage.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L225) +*** -___ +### size() -### size +> **size**(): `number` -▸ **size**(): `number` +Defined in: [cache/storage.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L313) Returns the size of the cache @@ -384,36 +366,42 @@ Returns the size of the cache `number` -#### Defined in +*** -[cache/storage.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L312) +### stats() -___ +> **stats**(`reset`): `object` -### stats - -▸ **stats**(`reset?`): `Object` +Defined in: [cache/storage.ts:325](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L325) Returns a dict with cache stats #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `reset` | `boolean` | `true` | +##### reset + +`boolean` = `true` #### Returns -`Object` +`object` + +##### deletions + +> **deletions**: `number` = `0` + +##### hits + +> **hits**: `number` = `0` + +##### reads + +> **reads**: `number` = `0` + +##### size -| Name | Type | -| :------ | :------ | -| `dels` | `number` | -| `hits` | `number` | -| `reads` | `number` | -| `size` | `number` | -| `writes` | `number` | +> **size**: `number` = `0` -#### Defined in +##### writes -[cache/storage.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/storage.ts#L324) +> **writes**: `number` = `0` diff --git a/packages/statemanager/docs/enums/CacheType.md b/packages/statemanager/docs/enums/CacheType.md deleted file mode 100644 index a42e97de64c..00000000000 --- a/packages/statemanager/docs/enums/CacheType.md +++ /dev/null @@ -1,30 +0,0 @@ -[@ethereumjs/statemanager](../README.md) / CacheType - -# Enumeration: CacheType - -## Table of contents - -### Enumeration Members - -- [LRU](CacheType.md#lru) -- [ORDERED\_MAP](CacheType.md#ordered_map) - -## Enumeration Members - -### LRU - -• **LRU** = ``"lru"`` - -#### Defined in - -[cache/types.ts:2](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L2) - -___ - -### ORDERED\_MAP - -• **ORDERED\_MAP** = ``"ordered_map"`` - -#### Defined in - -[cache/types.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L3) diff --git a/packages/statemanager/docs/enums/VerkleAccessedStateType.md b/packages/statemanager/docs/enums/VerkleAccessedStateType.md deleted file mode 100644 index e6069e7fa4b..00000000000 --- a/packages/statemanager/docs/enums/VerkleAccessedStateType.md +++ /dev/null @@ -1,85 +0,0 @@ -[@ethereumjs/statemanager](../README.md) / VerkleAccessedStateType - -# Enumeration: VerkleAccessedStateType - -## Table of contents - -### Enumeration Members - -- [Balance](VerkleAccessedStateType.md#balance) -- [Code](VerkleAccessedStateType.md#code) -- [CodeHash](VerkleAccessedStateType.md#codehash) -- [CodeSize](VerkleAccessedStateType.md#codesize) -- [Nonce](VerkleAccessedStateType.md#nonce) -- [Storage](VerkleAccessedStateType.md#storage) -- [Version](VerkleAccessedStateType.md#version) - -## Enumeration Members - -### Balance - -• **Balance** = ``"balance"`` - -#### Defined in - -[accessWitness.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L57) - -___ - -### Code - -• **Code** = ``"code"`` - -#### Defined in - -[accessWitness.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L61) - -___ - -### CodeHash - -• **CodeHash** = ``"codeHash"`` - -#### Defined in - -[accessWitness.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L59) - -___ - -### CodeSize - -• **CodeSize** = ``"codeSize"`` - -#### Defined in - -[accessWitness.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L60) - -___ - -### Nonce - -• **Nonce** = ``"nonce"`` - -#### Defined in - -[accessWitness.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L58) - -___ - -### Storage - -• **Storage** = ``"storage"`` - -#### Defined in - -[accessWitness.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L62) - -___ - -### Version - -• **Version** = ``"version"`` - -#### Defined in - -[accessWitness.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/accessWitness.ts#L56) diff --git a/packages/statemanager/docs/functions/addMerkleStateProofData.md b/packages/statemanager/docs/functions/addMerkleStateProofData.md new file mode 100644 index 00000000000..633a8fec274 --- /dev/null +++ b/packages/statemanager/docs/functions/addMerkleStateProofData.md @@ -0,0 +1,33 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / addMerkleStateProofData + +# Function: addMerkleStateProofData() + +> **addMerkleStateProofData**(`sm`, `proof`, `safe`): `Promise`\<`void`\> + +Defined in: [proof/merkle.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/proof/merkle.ts#L158) + +Add proof(s) into an already existing trie + +## Parameters + +### sm + +[`MerkleStateManager`](../classes/MerkleStateManager.md) + +### proof + +The proof(s) retrieved from `getProof` + +`Proof` | `Proof`[] + +### safe + +`boolean` = `false` + +## Returns + +`Promise`\<`void`\> diff --git a/packages/statemanager/docs/functions/addMerkleStateStorageProof.md b/packages/statemanager/docs/functions/addMerkleStateStorageProof.md new file mode 100644 index 00000000000..4a9fda93e40 --- /dev/null +++ b/packages/statemanager/docs/functions/addMerkleStateStorageProof.md @@ -0,0 +1,47 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / addMerkleStateStorageProof + +# Function: addMerkleStateStorageProof() + +> **addMerkleStateStorageProof**(`sm`, `storageProof`, `storageHash`, `address`, `safe`): `Promise`\<`void`\> + +Defined in: [proof/merkle.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/proof/merkle.ts#L90) + +Adds a storage proof to the state manager + +## Parameters + +### sm + +[`MerkleStateManager`](../classes/MerkleStateManager.md) + +### storageProof + +`StorageProof`[] + +The storage proof + +### storageHash + +`` `0x${string}` `` + +The root hash of the storage trie + +### address + +`Address` + +The address + +### safe + +`boolean` = `false` + +Whether or not to verify if the reported roots match the current storage root + +## Returns + +`Promise`\<`void`\> diff --git a/packages/statemanager/docs/functions/fromMerkleStateProof.md b/packages/statemanager/docs/functions/fromMerkleStateProof.md new file mode 100644 index 00000000000..d70139f9544 --- /dev/null +++ b/packages/statemanager/docs/functions/fromMerkleStateProof.md @@ -0,0 +1,40 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / fromMerkleStateProof + +# Function: fromMerkleStateProof() + +> **fromMerkleStateProof**(`proof`, `safe`, `opts`): `Promise`\<[`MerkleStateManager`](../classes/MerkleStateManager.md)\> + +Defined in: [proof/merkle.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/proof/merkle.ts#L116) + +Create a StateManager and initialize this with proof(s) gotten previously from getProof +This generates a (partial) StateManager where one can retrieve all items from the proof + +## Parameters + +### proof + +Either a proof retrieved from `getProof`, or an array of those proofs + +`Proof` | `Proof`[] + +### safe + +`boolean` = `false` + +Whether or not to verify that the roots of the proof items match the reported roots + +### opts + +[`MerkleStateManagerOpts`](../interfaces/MerkleStateManagerOpts.md) = `{}` + +a dictionary of StateManager opts + +## Returns + +`Promise`\<[`MerkleStateManager`](../classes/MerkleStateManager.md)\> + +A new MerkleStateManager with elements from the given proof included in its backing state trie diff --git a/packages/statemanager/docs/functions/getMerkleStateProof.md b/packages/statemanager/docs/functions/getMerkleStateProof.md new file mode 100644 index 00000000000..f1cf255f380 --- /dev/null +++ b/packages/statemanager/docs/functions/getMerkleStateProof.md @@ -0,0 +1,35 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / getMerkleStateProof + +# Function: getMerkleStateProof() + +> **getMerkleStateProof**(`sm`, `address`, `storageSlots`): `Promise`\<`Proof`\> + +Defined in: [proof/merkle.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/proof/merkle.ts#L35) + +Get an EIP-1186 proof + +## Parameters + +### sm + +[`MerkleStateManager`](../classes/MerkleStateManager.md) + +### address + +`Address` + +address to get proof of + +### storageSlots + +`Uint8Array`\<`ArrayBufferLike`\>[] = `[]` + +storage slots to get proof of + +## Returns + +`Promise`\<`Proof`\> diff --git a/packages/statemanager/docs/functions/getRPCStateProof.md b/packages/statemanager/docs/functions/getRPCStateProof.md new file mode 100644 index 00000000000..5e59923ed5f --- /dev/null +++ b/packages/statemanager/docs/functions/getRPCStateProof.md @@ -0,0 +1,37 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / getRPCStateProof + +# Function: getRPCStateProof() + +> **getRPCStateProof**(`sm`, `address`, `storageSlots`): `Promise`\<[`Proof`](../type-aliases/Proof.md)\> + +Defined in: [proof/rpc.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/proof/rpc.ts#L12) + +Get an EIP-1186 proof from the provider + +## Parameters + +### sm + +[`RPCStateManager`](../classes/RPCStateManager.md) + +### address + +`Address` + +address to get proof of + +### storageSlots + +`Uint8Array`\<`ArrayBufferLike`\>[] = `[]` + +storage slots to get proof of + +## Returns + +`Promise`\<[`Proof`](../type-aliases/Proof.md)\> + +an EIP-1186 formatted proof diff --git a/packages/statemanager/docs/functions/getVerkleStateProof.md b/packages/statemanager/docs/functions/getVerkleStateProof.md new file mode 100644 index 00000000000..a8fc4e3cbfc --- /dev/null +++ b/packages/statemanager/docs/functions/getVerkleStateProof.md @@ -0,0 +1,29 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / getVerkleStateProof + +# Function: getVerkleStateProof() + +> **getVerkleStateProof**(`sm`, `_`, `__`): `Promise`\<[`Proof`](../type-aliases/Proof.md)\> + +Defined in: [proof/verkle.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/proof/verkle.ts#L7) + +## Parameters + +### sm + +[`StatelessVerkleStateManager`](../classes/StatelessVerkleStateManager.md) + +### \_ + +`Address` + +### \_\_ + +`Uint8Array`\<`ArrayBufferLike`\>[] = `[]` + +## Returns + +`Promise`\<[`Proof`](../type-aliases/Proof.md)\> diff --git a/packages/statemanager/docs/functions/verifyMerkleStateProof.md b/packages/statemanager/docs/functions/verifyMerkleStateProof.md new file mode 100644 index 00000000000..41bc773c95f --- /dev/null +++ b/packages/statemanager/docs/functions/verifyMerkleStateProof.md @@ -0,0 +1,29 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / verifyMerkleStateProof + +# Function: verifyMerkleStateProof() + +> **verifyMerkleStateProof**(`sm`, `proof`): `Promise`\<`boolean`\> + +Defined in: [proof/merkle.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/proof/merkle.ts#L187) + +Verify an EIP-1186 proof. Throws if proof is invalid, otherwise returns true. + +## Parameters + +### sm + +[`MerkleStateManager`](../classes/MerkleStateManager.md) + +### proof + +`Proof` + +the proof to prove + +## Returns + +`Promise`\<`boolean`\> diff --git a/packages/statemanager/docs/functions/verifyVerkleStateProof.md b/packages/statemanager/docs/functions/verifyVerkleStateProof.md new file mode 100644 index 00000000000..17b1f9e5074 --- /dev/null +++ b/packages/statemanager/docs/functions/verifyVerkleStateProof.md @@ -0,0 +1,25 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / verifyVerkleStateProof + +# Function: verifyVerkleStateProof() + +> **verifyVerkleStateProof**(`sm`): `boolean` + +Defined in: [proof/verkle.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/proof/verkle.ts#L19) + +Verifies whether the execution witness matches the stateRoot + +## Parameters + +### sm + +[`StatelessVerkleStateManager`](../classes/StatelessVerkleStateManager.md) + +## Returns + +`boolean` + +- Returns true if the executionWitness matches the provided stateRoot, otherwise false diff --git a/packages/statemanager/docs/interfaces/BinaryTreeState.md b/packages/statemanager/docs/interfaces/BinaryTreeState.md new file mode 100644 index 00000000000..28feb0dbfe6 --- /dev/null +++ b/packages/statemanager/docs/interfaces/BinaryTreeState.md @@ -0,0 +1,13 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / BinaryTreeState + +# Interface: BinaryTreeState + +Defined in: [types.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L88) + +## Indexable + +\[`key`: `` `0x${string}` ``\]: `null` \| `` `0x${string}` `` diff --git a/packages/statemanager/docs/interfaces/CacheOpts.md b/packages/statemanager/docs/interfaces/CacheOpts.md index 20620f48d31..6de868a1b37 100644 --- a/packages/statemanager/docs/interfaces/CacheOpts.md +++ b/packages/statemanager/docs/interfaces/CacheOpts.md @@ -1,30 +1,44 @@ -[@ethereumjs/statemanager](../README.md) / CacheOpts +[**@ethereumjs/statemanager**](../README.md) -# Interface: CacheOpts +*** -## Table of contents +[@ethereumjs/statemanager](../README.md) / CacheOpts -### Properties +# Interface: CacheOpts -- [size](CacheOpts.md#size) -- [type](CacheOpts.md#type) +Defined in: [cache/types.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L8) ## Properties ### size -• **size**: `number` +> **size**: `number` + +Defined in: [cache/types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L19) -#### Defined in +Size of the cache (only for LRU cache) -[cache/types.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L7) +Default: 100000 (account cache) / 20000 (storage cache) / 20000 (code cache) -___ +Note: the cache/trie interplay mechanism is designed in a way that +the theoretical number of max modified accounts between two flush operations +should be smaller than the cache size, otherwise the cache will "forget" the +old modifications resulting in an incomplete set of trie-flushed accounts. + +*** ### type -• **type**: [`CacheType`](../enums/CacheType.md) +> **type**: [`CacheType`](../type-aliases/CacheType.md) + +Defined in: [cache/types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L31) + +Cache type to use. + +Available options: -#### Defined in +ORDERED_MAP: Cache with no fixed upper bound and dynamic allocation, +use for dynamic setups like testing or similar. -[cache/types.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L8) +LRU: LRU cache with pre-allocation of memory and a fixed size. +Use for larger and more persistent caches. diff --git a/packages/statemanager/docs/interfaces/CachesStateManagerOpts.md b/packages/statemanager/docs/interfaces/CachesStateManagerOpts.md new file mode 100644 index 00000000000..68147137a1f --- /dev/null +++ b/packages/statemanager/docs/interfaces/CachesStateManagerOpts.md @@ -0,0 +1,33 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / CachesStateManagerOpts + +# Interface: CachesStateManagerOpts + +Defined in: [cache/types.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L34) + +## Properties + +### account? + +> `optional` **account**: `Partial`\<[`CacheOpts`](CacheOpts.md)\> + +Defined in: [cache/types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L35) + +*** + +### code? + +> `optional` **code**: `Partial`\<[`CacheOpts`](CacheOpts.md)\> + +Defined in: [cache/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L36) + +*** + +### storage? + +> `optional` **storage**: `Partial`\<[`CacheOpts`](CacheOpts.md)\> + +Defined in: [cache/types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L37) diff --git a/packages/statemanager/docs/interfaces/DefaultStateManagerOpts.md b/packages/statemanager/docs/interfaces/DefaultStateManagerOpts.md deleted file mode 100644 index 2fbde8e450f..00000000000 --- a/packages/statemanager/docs/interfaces/DefaultStateManagerOpts.md +++ /dev/null @@ -1,105 +0,0 @@ -[@ethereumjs/statemanager](../README.md) / DefaultStateManagerOpts - -# Interface: DefaultStateManagerOpts - -Options for constructing a StateManager. - -## Table of contents - -### Properties - -- [accountCacheOpts](DefaultStateManagerOpts.md#accountcacheopts) -- [codeCacheOpts](DefaultStateManagerOpts.md#codecacheopts) -- [common](DefaultStateManagerOpts.md#common) -- [prefixCodeHashes](DefaultStateManagerOpts.md#prefixcodehashes) -- [prefixStorageTrieKeys](DefaultStateManagerOpts.md#prefixstoragetriekeys) -- [storageCacheOpts](DefaultStateManagerOpts.md#storagecacheopts) -- [trie](DefaultStateManagerOpts.md#trie) - -## Properties - -### accountCacheOpts - -• `Optional` **accountCacheOpts**: `CacheOptions` - -#### Defined in - -[stateManager.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L134) - -___ - -### codeCacheOpts - -• `Optional` **codeCacheOpts**: `CacheOptions` - -#### Defined in - -[stateManager.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L138) - -___ - -### common - -• `Optional` **common**: `Common` - -The common to use - -#### Defined in - -[stateManager.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L143) - -___ - -### prefixCodeHashes - -• `Optional` **prefixCodeHashes**: `boolean` - -Option to prefix codehashes in the database. This defaults to `true`. -If this is disabled, note that it is possible to corrupt the trie, by deploying code -which code is equal to the preimage of a trie-node. -E.g. by putting the code `0x80` into the empty trie, will lead to a corrupted trie. - -#### Defined in - -[stateManager.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L120) - -___ - -### prefixStorageTrieKeys - -• `Optional` **prefixStorageTrieKeys**: `boolean` - -Option to prefix the keys for the storage tries with the first 7 bytes from the -associated account address. Activating this option gives a noticeable performance -boost for storage DB reads when operating on larger tries. - -Note: Activating/deactivating this option causes continued state reads to be -incompatible with existing databases. - -Default: false (for backwards compatibility reasons) - -#### Defined in - -[stateManager.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L132) - -___ - -### storageCacheOpts - -• `Optional` **storageCacheOpts**: `CacheOptions` - -#### Defined in - -[stateManager.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L136) - -___ - -### trie - -• `Optional` **trie**: `Trie` - -A Trie instance - -#### Defined in - -[stateManager.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L113) diff --git a/packages/statemanager/docs/interfaces/EncodedBinaryTreeState.md b/packages/statemanager/docs/interfaces/EncodedBinaryTreeState.md new file mode 100644 index 00000000000..2385e16db7a --- /dev/null +++ b/packages/statemanager/docs/interfaces/EncodedBinaryTreeState.md @@ -0,0 +1,13 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / EncodedBinaryTreeState + +# Interface: EncodedBinaryTreeState + +Defined in: [types.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L92) + +## Indexable + +\[`key`: `` `0x${string}` ``\]: `null` \| `` `0x${string}` `` diff --git a/packages/statemanager/docs/interfaces/EncodedVerkleProof.md b/packages/statemanager/docs/interfaces/EncodedVerkleProof.md index 9e36fc181b2..1f7eafb48d7 100644 --- a/packages/statemanager/docs/interfaces/EncodedVerkleProof.md +++ b/packages/statemanager/docs/interfaces/EncodedVerkleProof.md @@ -1,7 +1,13 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + [@ethereumjs/statemanager](../README.md) / EncodedVerkleProof # Interface: EncodedVerkleProof +Defined in: [types.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L100) + ## Indexable -▪ [key: `PrefixedHexString`]: `PrefixedHexString` +\[`key`: `` `0x${string}` ``\]: `` `0x${string}` `` diff --git a/packages/statemanager/docs/interfaces/MerkleStateManagerOpts.md b/packages/statemanager/docs/interfaces/MerkleStateManagerOpts.md new file mode 100644 index 00000000000..27a4be02aa7 --- /dev/null +++ b/packages/statemanager/docs/interfaces/MerkleStateManagerOpts.md @@ -0,0 +1,83 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / MerkleStateManagerOpts + +# Interface: MerkleStateManagerOpts + +Defined in: [types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L33) + +Options for constructing a StateManager. + +## Extends + +- `BaseStateManagerOpts` + +## Properties + +### caches? + +> `optional` **caches**: [`Caches`](../classes/Caches.md) + +Defined in: [types.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L65) + +Options to enable and configure the use of a cache account, code and storage +This can be useful for speeding up reads, especially when the trie is large. +The cache is only used for reading from the trie and is not used for writing to the trie. + +Default: false + +*** + +### common? + +> `optional` **common**: `Common` + +Defined in: [types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L15) + +The common to use + +#### Inherited from + +`BaseStateManagerOpts.common` + +*** + +### prefixCodeHashes? + +> `optional` **prefixCodeHashes**: `boolean` + +Defined in: [types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L44) + +Option to prefix codehashes in the database. This defaults to `true`. +If this is disabled, note that it is possible to corrupt the trie, by deploying code +which code is equal to the preimage of a trie-node. +E.g. by putting the code `0x80` into the empty trie, will lead to a corrupted trie. + +*** + +### prefixStorageTrieKeys? + +> `optional` **prefixStorageTrieKeys**: `boolean` + +Defined in: [types.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L56) + +Option to prefix the keys for the storage tries with the first 7 bytes from the +associated account address. Activating this option gives a noticeable performance +boost for storage DB reads when operating on larger tries. + +Note: Activating/deactivating this option causes continued state reads to be +incompatible with existing databases. + +Default: false (for backwards compatibility reasons) + +*** + +### trie? + +> `optional` **trie**: `MerklePatriciaTrie` + +Defined in: [types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L37) + +A MerklePatriciaTrie instance diff --git a/packages/statemanager/docs/interfaces/RPCStateManagerOpts.md b/packages/statemanager/docs/interfaces/RPCStateManagerOpts.md index 1f8c4609ca1..1daad1d2988 100644 --- a/packages/statemanager/docs/interfaces/RPCStateManagerOpts.md +++ b/packages/statemanager/docs/interfaces/RPCStateManagerOpts.md @@ -1,43 +1,43 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + [@ethereumjs/statemanager](../README.md) / RPCStateManagerOpts # Interface: RPCStateManagerOpts -## Table of contents +Defined in: [types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L25) -### Properties +## Extends -- [blockTag](RPCStateManagerOpts.md#blocktag) -- [common](RPCStateManagerOpts.md#common) -- [provider](RPCStateManagerOpts.md#provider) +- `BaseStateManagerOpts` ## Properties ### blockTag -• **blockTag**: `bigint` \| ``"earliest"`` +> **blockTag**: `bigint` \| `"earliest"` -#### Defined in +Defined in: [types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L27) -[rpcStateManager.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L30) +*** -___ +### common? -### common +> `optional` **common**: `Common` -• `Optional` **common**: `Common` +Defined in: [types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L15) The common to use -#### Defined in +#### Inherited from -[rpcStateManager.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L35) +`BaseStateManagerOpts.common` -___ +*** ### provider -• **provider**: `string` - -#### Defined in +> **provider**: `string` -[rpcStateManager.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/rpcStateManager.ts#L29) +Defined in: [types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L26) diff --git a/packages/statemanager/docs/interfaces/SimpleStateManagerOpts.md b/packages/statemanager/docs/interfaces/SimpleStateManagerOpts.md new file mode 100644 index 00000000000..fd5eddd7857 --- /dev/null +++ b/packages/statemanager/docs/interfaces/SimpleStateManagerOpts.md @@ -0,0 +1,29 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / SimpleStateManagerOpts + +# Interface: SimpleStateManagerOpts + +Defined in: [types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L21) + +Options for constructing a [SimpleStateManager](../classes/SimpleStateManager.md). + +## Extends + +- `BaseStateManagerOpts` + +## Properties + +### common? + +> `optional` **common**: `Common` + +Defined in: [types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L15) + +The common to use + +#### Inherited from + +`BaseStateManagerOpts.common` diff --git a/packages/statemanager/docs/interfaces/StatefulBinaryTreeStateManagerOpts.md b/packages/statemanager/docs/interfaces/StatefulBinaryTreeStateManagerOpts.md new file mode 100644 index 00000000000..e9cb00d0b89 --- /dev/null +++ b/packages/statemanager/docs/interfaces/StatefulBinaryTreeStateManagerOpts.md @@ -0,0 +1,61 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / StatefulBinaryTreeStateManagerOpts + +# Interface: StatefulBinaryTreeStateManagerOpts + +Defined in: [types.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L82) + +## Extends + +- `BaseStateManagerOpts` + +## Properties + +### caches? + +> `optional` **caches**: [`Caches`](../classes/Caches.md) + +Defined in: [types.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L85) + +*** + +### common? + +> `optional` **common**: `Common` + +Defined in: [types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L15) + +The common to use + +#### Inherited from + +`BaseStateManagerOpts.common` + +*** + +### hashFunction()? + +> `optional` **hashFunction**: (`data`) => `Uint8Array` + +Defined in: [types.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L83) + +#### Parameters + +##### data + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### tree? + +> `optional` **tree**: `BinaryTree` + +Defined in: [types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L84) diff --git a/packages/statemanager/docs/interfaces/StatefulVerkleStateManagerOpts.md b/packages/statemanager/docs/interfaces/StatefulVerkleStateManagerOpts.md new file mode 100644 index 00000000000..1b3300f4fb8 --- /dev/null +++ b/packages/statemanager/docs/interfaces/StatefulVerkleStateManagerOpts.md @@ -0,0 +1,43 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / StatefulVerkleStateManagerOpts + +# Interface: StatefulVerkleStateManagerOpts + +Defined in: [types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L76) + +## Extends + +- `BaseStateManagerOpts` + +## Properties + +### caches? + +> `optional` **caches**: [`Caches`](../classes/Caches.md) + +Defined in: [types.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L79) + +*** + +### common + +> **common**: `Common` + +Defined in: [types.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L77) + +The common to use + +#### Overrides + +`BaseStateManagerOpts.common` + +*** + +### trie? + +> `optional` **trie**: `VerkleTree` + +Defined in: [types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L78) diff --git a/packages/statemanager/docs/interfaces/StatelessVerkleStateManagerOpts.md b/packages/statemanager/docs/interfaces/StatelessVerkleStateManagerOpts.md index 3aecb571ee1..b6492cf9c7a 100644 --- a/packages/statemanager/docs/interfaces/StatelessVerkleStateManagerOpts.md +++ b/packages/statemanager/docs/interfaces/StatelessVerkleStateManagerOpts.md @@ -1,67 +1,37 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + [@ethereumjs/statemanager](../README.md) / StatelessVerkleStateManagerOpts # Interface: StatelessVerkleStateManagerOpts -Options dictionary. +Defined in: [types.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L71) -## Table of contents +Options dictionary. -### Properties +## Extends -- [accesses](StatelessVerkleStateManagerOpts.md#accesses) -- [accountCacheOpts](StatelessVerkleStateManagerOpts.md#accountcacheopts) -- [codeCacheOpts](StatelessVerkleStateManagerOpts.md#codecacheopts) -- [common](StatelessVerkleStateManagerOpts.md#common) -- [storageCacheOpts](StatelessVerkleStateManagerOpts.md#storagecacheopts) +- `BaseStateManagerOpts` ## Properties -### accesses - -• `Optional` **accesses**: [`AccessWitness`](../classes/AccessWitness.md) - -#### Defined in - -[statelessVerkleStateManager.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L115) - -___ - -### accountCacheOpts - -• `Optional` **accountCacheOpts**: `CacheOptions` - -#### Defined in +### caches? -[statelessVerkleStateManager.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L112) +> `optional` **caches**: [`Caches`](../classes/Caches.md) -___ +Defined in: [types.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L73) -### codeCacheOpts - -• `Optional` **codeCacheOpts**: `CacheOptions` - -#### Defined in - -[statelessVerkleStateManager.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L114) - -___ +*** ### common -• `Optional` **common**: `Common` - -The common to use - -#### Defined in - -[statelessVerkleStateManager.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L111) +> **common**: `Common` -___ +Defined in: [types.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L72) -### storageCacheOpts - -• `Optional` **storageCacheOpts**: `CacheOptions` +The common to use -#### Defined in +#### Overrides -[statelessVerkleStateManager.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/statelessVerkleStateManager.ts#L113) +`BaseStateManagerOpts.common` diff --git a/packages/statemanager/docs/interfaces/VerkleState.md b/packages/statemanager/docs/interfaces/VerkleState.md index 068a3335020..3764247051b 100644 --- a/packages/statemanager/docs/interfaces/VerkleState.md +++ b/packages/statemanager/docs/interfaces/VerkleState.md @@ -1,7 +1,13 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + [@ethereumjs/statemanager](../README.md) / VerkleState # Interface: VerkleState +Defined in: [types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L96) + ## Indexable -▪ [key: `PrefixedHexString`]: `PrefixedHexString` \| ``null`` +\[`key`: `` `0x${string}` ``\]: `null` \| `` `0x${string}` `` diff --git a/packages/statemanager/docs/type-aliases/CacheType.md b/packages/statemanager/docs/type-aliases/CacheType.md new file mode 100644 index 00000000000..e566e838262 --- /dev/null +++ b/packages/statemanager/docs/type-aliases/CacheType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / CacheType + +# Type Alias: CacheType + +> **CacheType** = *typeof* [`CacheType`](../variables/CacheType.md)\[keyof *typeof* [`CacheType`](../variables/CacheType.md)\] + +Defined in: [cache/types.ts:1](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L1) diff --git a/packages/statemanager/docs/type-aliases/Proof.md b/packages/statemanager/docs/type-aliases/Proof.md new file mode 100644 index 00000000000..3ae76d084bb --- /dev/null +++ b/packages/statemanager/docs/type-aliases/Proof.md @@ -0,0 +1,67 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / Proof + +# Type Alias: Proof + +> **Proof** = `object` + +Defined in: [types.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L110) + +## Properties + +### accountProof + +> **accountProof**: `PrefixedHexString`[] + +Defined in: [types.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L116) + +*** + +### address + +> **address**: `PrefixedHexString` + +Defined in: [types.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L111) + +*** + +### balance + +> **balance**: `PrefixedHexString` + +Defined in: [types.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L112) + +*** + +### codeHash + +> **codeHash**: `PrefixedHexString` + +Defined in: [types.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L113) + +*** + +### nonce + +> **nonce**: `PrefixedHexString` + +Defined in: [types.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L114) + +*** + +### storageHash + +> **storageHash**: `PrefixedHexString` + +Defined in: [types.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L115) + +*** + +### storageProof + +> **storageProof**: [`StorageProof`](StorageProof.md)[] + +Defined in: [types.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L117) diff --git a/packages/statemanager/docs/type-aliases/StorageProof.md b/packages/statemanager/docs/type-aliases/StorageProof.md new file mode 100644 index 00000000000..21c1761ba78 --- /dev/null +++ b/packages/statemanager/docs/type-aliases/StorageProof.md @@ -0,0 +1,35 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / StorageProof + +# Type Alias: StorageProof + +> **StorageProof** = `object` + +Defined in: [types.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L104) + +## Properties + +### key + +> **key**: `PrefixedHexString` + +Defined in: [types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L105) + +*** + +### proof + +> **proof**: `PrefixedHexString`[] + +Defined in: [types.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L106) + +*** + +### value + +> **value**: `PrefixedHexString` + +Defined in: [types.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/types.ts#L107) diff --git a/packages/statemanager/docs/variables/CODEHASH_PREFIX.md b/packages/statemanager/docs/variables/CODEHASH_PREFIX.md new file mode 100644 index 00000000000..cd266678205 --- /dev/null +++ b/packages/statemanager/docs/variables/CODEHASH_PREFIX.md @@ -0,0 +1,18 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / CODEHASH\_PREFIX + +# Variable: CODEHASH\_PREFIX + +> `const` **CODEHASH\_PREFIX**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [merkleStateManager.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/merkleStateManager.ts#L44) + +Prefix to distinguish between a contract deployed with code `0x80` +and `RLP([])` (also having the value `0x80`). + +Otherwise the creation of the code hash for the `0x80` contract +will be the same as the hash of the empty trie which leads to +misbehaviour in the underlying trie library. diff --git a/packages/statemanager/docs/variables/CacheType.md b/packages/statemanager/docs/variables/CacheType.md new file mode 100644 index 00000000000..bf8ea8e6317 --- /dev/null +++ b/packages/statemanager/docs/variables/CacheType.md @@ -0,0 +1,21 @@ +[**@ethereumjs/statemanager**](../README.md) + +*** + +[@ethereumjs/statemanager](../README.md) / CacheType + +# Variable: CacheType + +> **CacheType**: `object` + +Defined in: [cache/types.ts:1](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/cache/types.ts#L1) + +## Type declaration + +### LRU + +> `readonly` **LRU**: `"lru"` = `'lru'` + +### ORDERED\_MAP + +> `readonly` **ORDERED\_MAP**: `"ordered_map"` = `'ordered_map'` diff --git a/packages/statemanager/package.json b/packages/statemanager/package.json index 2e1e5da9294..e02f41b1eee 100644 --- a/packages/statemanager/package.json +++ b/packages/statemanager/package.json @@ -35,7 +35,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- statemanager", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", @@ -56,7 +56,7 @@ "@js-sdsl/ordered-map": "^4.4.2", "@noble/hashes": "^1.7.2", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "lru-cache": "11.0.2" }, "devDependencies": { diff --git a/packages/statemanager/src/statefulBinaryTreeStateManager.ts b/packages/statemanager/src/statefulBinaryTreeStateManager.ts index 163ada1a61e..700377ea9d1 100644 --- a/packages/statemanager/src/statefulBinaryTreeStateManager.ts +++ b/packages/statemanager/src/statefulBinaryTreeStateManager.ts @@ -741,9 +741,11 @@ export class StatefulBinaryTreeStateManager implements StateManagerInterface { async generateCanonicalGenesis(genesisState: GenesisState) { await this._tree.createRootNode() await this.checkpoint() - for (const addressStr of Object.keys(genesisState)) { + for (const addressStr of Object.keys(genesisState) as PrefixedHexString[]) { const addrState = genesisState[addressStr] - let nonce, balance, code + let nonce: PrefixedHexString | undefined + let balance: PrefixedHexString | bigint + let code: PrefixedHexString | undefined let storage: StoragePair[] | undefined = [] if (Array.isArray(addrState)) { ;[balance, code, storage, nonce] = addrState @@ -754,7 +756,7 @@ export class StatefulBinaryTreeStateManager implements StateManagerInterface { } const address = createAddressFromString(addressStr) await this.putAccount(address, new Account()) - const codeBuf = hexToBytes((code as string) ?? '0x') + const codeBuf = hexToBytes(code ?? '0x') const codeHash = this.keccakFunction(codeBuf) @@ -774,8 +776,8 @@ export class StatefulBinaryTreeStateManager implements StateManagerInterface { // Put account data const account = createPartialAccount({ - nonce: nonce as PrefixedHexString, - balance: balance as PrefixedHexString, + nonce, + balance, codeHash, codeSize: codeBuf.byteLength, }) diff --git a/packages/statemanager/src/statefulVerkleStateManager.ts b/packages/statemanager/src/statefulVerkleStateManager.ts index 595eb126ea6..9393d3f4208 100644 --- a/packages/statemanager/src/statefulVerkleStateManager.ts +++ b/packages/statemanager/src/statefulVerkleStateManager.ts @@ -622,7 +622,8 @@ export class StatefulVerkleStateManager implements StateManagerInterface { } // Verifies that the witness post-state matches the computed post-state - async verifyPostState(accessWitness: VerkleAccessWitnessInterface): Promise { + // NOTE: Do not rename this method as we check for this function name in the VM to verify we're using a StatefulVerkleStateManager + async verifyVerklePostState(accessWitness: VerkleAccessWitnessInterface): Promise { // track what all chunks were accessed so as to compare in the end if any chunks were missed // in access while comparing against the provided poststate in the execution witness const accessedChunks = new Map() @@ -710,7 +711,7 @@ export class StatefulVerkleStateManager implements StateManagerInterface { const verifyPassed = postFailures === 0 this.DEBUG && - this._debug(`verifyPostState verifyPassed=${verifyPassed} postFailures=${postFailures}`) + this._debug(`verifyVerklePostState verifyPassed=${verifyPassed} postFailures=${postFailures}`) return verifyPassed } @@ -745,9 +746,11 @@ export class StatefulVerkleStateManager implements StateManagerInterface { async generateCanonicalGenesis(genesisState: GenesisState) { await this._trie.createRootNode() await this.checkpoint() - for (const addressStr of Object.keys(genesisState)) { + for (const addressStr of Object.keys(genesisState) as PrefixedHexString[]) { const addrState = genesisState[addressStr] - let nonce, balance, code + let nonce: PrefixedHexString | undefined + let balance: PrefixedHexString | bigint + let code: PrefixedHexString | undefined let storage: StoragePair[] | undefined = [] if (Array.isArray(addrState)) { ;[balance, code, storage, nonce] = addrState @@ -758,7 +761,7 @@ export class StatefulVerkleStateManager implements StateManagerInterface { } const address = createAddressFromString(addressStr) await this.putAccount(address, new Account()) - const codeBuf = hexToBytes((code as string) ?? '0x') + const codeBuf = hexToBytes(code ?? '0x') if (this.common.customCrypto?.keccak256 === undefined) { throw Error('keccak256 required') } @@ -780,8 +783,8 @@ export class StatefulVerkleStateManager implements StateManagerInterface { // Put account data const account = createPartialAccount({ - nonce: nonce as PrefixedHexString, - balance: balance as PrefixedHexString, + nonce, + balance, codeHash, codeSize: codeBuf.byteLength, }) diff --git a/packages/statemanager/src/statelessVerkleStateManager.ts b/packages/statemanager/src/statelessVerkleStateManager.ts index 6c148c68658..b01ad7256f0 100644 --- a/packages/statemanager/src/statelessVerkleStateManager.ts +++ b/packages/statemanager/src/statelessVerkleStateManager.ts @@ -21,7 +21,6 @@ import { setLengthLeft, setLengthRight, short, - toBytes, } from '@ethereumjs/util' import debugDefault from 'debug' import { keccak256 } from 'ethereum-cryptography/keccak.js' @@ -351,7 +350,8 @@ export class StatelessVerkleStateManager implements StateManagerInterface { BigInt(bytesToHex(key)), this.verkleCrypto, ) - const storageValue = toBytes(this._state[bytesToHex(storageKey)]) + const rawStorageValue = this._state[bytesToHex(storageKey)] + const storageValue = rawStorageValue === null ? new Uint8Array() : hexToBytes(rawStorageValue) this._caches?.storage?.put(address, key, storageValue ?? hexToBytes('0x80')) @@ -499,7 +499,8 @@ export class StatelessVerkleStateManager implements StateManagerInterface { } // Verifies that the witness post-state matches the computed post-state - verifyPostState(accessWitness: VerkleAccessWitnessInterface): Promise { + // NOTE: Do not rename this method as we check for this function name in the VM to verify we're using a StatelessVerkleStateManager + verifyVerklePostState(accessWitness: VerkleAccessWitnessInterface): Promise { // track what all chunks were accessed so as to compare in the end if any chunks were missed // in access while comparing against the provided poststate in the execution witness const accessedChunks = new Map() @@ -571,7 +572,7 @@ export class StatelessVerkleStateManager implements StateManagerInterface { const verifyPassed = postFailures === 0 this.DEBUG && - this._debug(`verifyPostState verifyPassed=${verifyPassed} postFailures=${postFailures}`) + this._debug(`verifyVerklePostState verifyPassed=${verifyPassed} postFailures=${postFailures}`) // This is async so the stateful variant can use the same interface method return Promise.resolve(verifyPassed) diff --git a/packages/genesis/typedoc.cjs b/packages/statemanager/typedoc.mjs similarity index 54% rename from packages/genesis/typedoc.cjs rename to packages/statemanager/typedoc.mjs index 701fee055fa..4f962d06684 100644 --- a/packages/genesis/typedoc.cjs +++ b/packages/statemanager/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts'], diff --git a/packages/testdata/src/blocks/index.ts b/packages/testdata/src/blocks/index.ts index 9fbc60b8acb..e286aaa6f5b 100644 --- a/packages/testdata/src/blocks/index.ts +++ b/packages/testdata/src/blocks/index.ts @@ -1,5 +1,5 @@ export * from './mainnetBlocks.ts' export * from './goerliBlocks.ts' -export * from './preLondonTestDataBlocks1.ts' -export * from './preLondonTestDataBlocks2.ts' +export * from './preLondonTestDataBlocks1RLP.ts' +export * from './preLondonTestDataBlocks2RLP.ts' export * from './verkleKaustinen6Block72.ts' diff --git a/packages/testdata/src/blocks/preLondonTestDataBlocks1.ts b/packages/testdata/src/blocks/preLondonTestDataBlocks1.ts deleted file mode 100644 index fbd6174a39d..00000000000 --- a/packages/testdata/src/blocks/preLondonTestDataBlocks1.ts +++ /dev/null @@ -1,162 +0,0 @@ -export const preLondonTestDataBlocks1 = { - blocks: [ - { - blockHeader: { - bloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - coinbase: '0x8888f1f195afa192cfee860698584c030f4c9db1', - difficulty: '0x020000', - extraData: '0x', - gasLimit: '0x023ec6', - gasUsed: '0x021536', - hash: '0xf53f268d23a71e85c7d6d83a9504298712b84c1a2ba220441c86eeda0bf0b6e3', - mixHash: '0x29f07836e4e59229b3a065913afc27702642c683bba689910b2b2fd45db310d3', - nonce: '0x8957e6d004a31802', - number: '0x01', - parentHash: '0xce1f26f798dd03c8782d63b3e42e79a64eaea5694ea686ac5d7ce3df5171d1ae', - receiptTrie: '0x5c5b4fc43c2d45787f54e1ae7d27afdb4ad16dfc567c5692070d5c4556e0b1d7', - stateRoot: '0xa65c2364cd0f1542d761823dc0109c6b072f14c20459598c5455c274601438f4', - timestamp: '0x56851097', - transactionsTrie: '0x70616ebd7ad2ed6fb7860cf7e9df00163842351c38a87cac2c1cb193895035a2', - uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - }, - rlp: '0xf904a8f901faa0ce1f26f798dd03c8782d63b3e42e79a64eaea5694ea686ac5d7ce3df5171d1aea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0a65c2364cd0f1542d761823dc0109c6b072f14c20459598c5455c274601438f4a070616ebd7ad2ed6fb7860cf7e9df00163842351c38a87cac2c1cb193895035a2a05c5b4fc43c2d45787f54e1ae7d27afdb4ad16dfc567c5692070d5c4556e0b1d7b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200000183023ec683021536845685109780a029f07836e4e59229b3a065913afc27702642c683bba689910b2b2fd45db310d3888957e6d004a31802f902a7f85f800a8255f094aaaf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca0575da4e21b66fa764be5f74da9389e67693d066fb0d1312e19e17e501da00ecda06baf5a5327595f6619dfc2fcb3f2e6fb410b5810af3cb52d0e7508038e91a188f85f010a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ba04fa966bf34b93abc1bcd665554b7f316b50f928477b50be0f3285ead29d18c5ba017bba0eeec1625ab433746955e125d46d80b7fdc97386c51266f842d8e02192ef85f020a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca004377418ae981cc32b1312b4a427a1d69a821b28db8584f5f2bd8c6d42458adaa053a1dba1af177fac92f3b6af0a9fa46a22adf56e686c93794b6a012bf254abf5f85f030a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca04fe13febd28a05f4fcb2f451d7ddc2dda56486d9f8c79a62b0ba4da775122615a0651b2382dd402df9ebc27f8cb4b2e0f3cea68dda2dca0ee9603608f0b6f51668f85f040a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ba078e6a0ba086a08f8450e208a399bb2f2d2a0d984acd2517c7c7df66ccfab567da013254002cd45a97fac049ae00afbc43ed0d9961d0c56a3b2382c80ce41c198ddf85f050a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ba0a7174d8f43ea71c8e3ca9477691add8d80ac8e0ed89d8d8b572041eef81f4a54a0534ea2e28ec4da3b5b944b18c51ec84a5cf35f5b3343c5fb86521fd2d388f506f85f060a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ba034bd04065833536a10c77ee2a43a5371bc6d34837088b861dd9d4b7f44074b59a078807715786a13876d3455716a6b9cb2186b7a4887a5c31160fc877454958616c0', - transactions: [ - { - data: '0x', - gasLimit: '0x55f0', - gasPrice: '0x0a', - nonce: '0x', - r: '0x575da4e21b66fa764be5f74da9389e67693d066fb0d1312e19e17e501da00ecd', - s: '0x6baf5a5327595f6619dfc2fcb3f2e6fb410b5810af3cb52d0e7508038e91a188', - to: '0xaaaf5374fce5edbc8e2a8697c15331677e6ebf0b', - v: '0x1c', - value: '0x0a', - }, - { - data: '0x', - gasLimit: '0x5208', - gasPrice: '0x0a', - nonce: '0x01', - r: '0x4fa966bf34b93abc1bcd665554b7f316b50f928477b50be0f3285ead29d18c5b', - s: '0x17bba0eeec1625ab433746955e125d46d80b7fdc97386c51266f842d8e02192e', - to: '0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b', - v: '0x1b', - value: '0x0a', - }, - { - data: '0x', - gasLimit: '0x5208', - gasPrice: '0x0a', - nonce: '0x02', - r: '0x04377418ae981cc32b1312b4a427a1d69a821b28db8584f5f2bd8c6d42458ada', - s: '0x53a1dba1af177fac92f3b6af0a9fa46a22adf56e686c93794b6a012bf254abf5', - to: 'bbbf5374fce5edbc8e2a8697c15331677e6ebf0b', - v: '0x1c', - value: '0x0a', - }, - { - data: '0x', - gasLimit: '0x5208', - gasPrice: '0x0a', - nonce: '0x03', - r: '0x4fe13febd28a05f4fcb2f451d7ddc2dda56486d9f8c79a62b0ba4da775122615', - s: '0x651b2382dd402df9ebc27f8cb4b2e0f3cea68dda2dca0ee9603608f0b6f51668', - to: '0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b', - v: '0x1c', - value: '0x0a', - }, - { - data: '0x', - gasLimit: '0x5208', - gasPrice: '0x0a', - nonce: '0x04', - r: '0x78e6a0ba086a08f8450e208a399bb2f2d2a0d984acd2517c7c7df66ccfab567d', - s: '0x13254002cd45a97fac049ae00afbc43ed0d9961d0c56a3b2382c80ce41c198dd', - to: '0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b', - v: '0x1b', - value: '0x0a', - }, - { - data: '0x', - gasLimit: '0x5208', - gasPrice: '0x0a', - nonce: '0x05', - r: '0xa7174d8f43ea71c8e3ca9477691add8d80ac8e0ed89d8d8b572041eef81f4a54', - s: '0x534ea2e28ec4da3b5b944b18c51ec84a5cf35f5b3343c5fb86521fd2d388f506', - to: '0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b', - v: '0x1b', - value: '0x0a', - }, - { - data: '0x', - gasLimit: '0x5208', - gasPrice: '0x0a', - nonce: '0x06', - r: '0x34bd04065833536a10c77ee2a43a5371bc6d34837088b861dd9d4b7f44074b59', - s: '0x78807715786a13876d3455716a6b9cb2186b7a4887a5c31160fc877454958616', - to: '0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b', - v: '0x1b', - value: '0x0a', - }, - ], - uncleHeaders: [], - }, - ], - genesisBlockHeader: { - bloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - coinbase: '0x8888f1f195afa192cfee860698584c030f4c9db1', - difficulty: '0x020000', - extraData: '0x42', - gasLimit: '0x023e38', - gasUsed: '0x00', - hash: '0xce1f26f798dd03c8782d63b3e42e79a64eaea5694ea686ac5d7ce3df5171d1ae', - mixHash: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - nonce: '0x0102030405060708', - number: '0x00', - parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - receiptTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - stateRoot: '0xaf81e09f8c46ca322193edfda764fa7e88e81923f802f1d325ec0b0308ac2cd0', - timestamp: '0x54c98c81', - transactionsTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - }, - genesisRLP: - '0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0af81e09f8c46ca322193edfda764fa7e88e81923f802f1d325ec0b0308ac2cd0a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008083023e38808454c98c8142a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421880102030405060708c0c0', - lastblockhash: '0xf53f268d23a71e85c7d6d83a9504298712b84c1a2ba220441c86eeda0bf0b6e3', - postState: { - '8888f1f195afa192cfee860698584c030f4c9db1': { - balance: '0x456391824508d41c', - code: '0x', - nonce: '0x', - storage: {}, - }, - a94f5374fce5edbc8e2a8697c15331677e6ebf0b: { - balance: '0x4a723dc6b40b8cedf70fa8', - code: '0x', - nonce: '0x07', - storage: {}, - }, - bbbf5374fce5edbc8e2a8697c15331677e6ebf0b: { - balance: '0x3c', - code: '0x', - nonce: '0x', - storage: {}, - }, - }, - pre: { - a94f5374fce5edbc8e2a8697c15331677e6ebf0b: { - balance: '0x4a723dc6b40b8a9a000000', - code: '0x', - nonce: '0x', - storage: {}, - }, - aaaf5374fce5edbc8e2a8697c15331677e6ebf0b: { - balance: '0x02540be400', - code: '0x73a94f5374fce5edbc8e2a8697c15331677e6ebf0bff', - nonce: '0x', - storage: {}, - }, - }, -} diff --git a/packages/testdata/src/blocks/preLondonTestDataBlocks1RLP.ts b/packages/testdata/src/blocks/preLondonTestDataBlocks1RLP.ts new file mode 100644 index 00000000000..0e8ee1b876b --- /dev/null +++ b/packages/testdata/src/blocks/preLondonTestDataBlocks1RLP.ts @@ -0,0 +1,11 @@ +import type { PrefixedHexString } from '@ethereumjs/util' + +export const preLondonTestDataBlocks1RLP: { + blockRLP: PrefixedHexString + genesisRLP: PrefixedHexString +} = { + blockRLP: + '0xf904a8f901faa0ce1f26f798dd03c8782d63b3e42e79a64eaea5694ea686ac5d7ce3df5171d1aea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0a65c2364cd0f1542d761823dc0109c6b072f14c20459598c5455c274601438f4a070616ebd7ad2ed6fb7860cf7e9df00163842351c38a87cac2c1cb193895035a2a05c5b4fc43c2d45787f54e1ae7d27afdb4ad16dfc567c5692070d5c4556e0b1d7b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200000183023ec683021536845685109780a029f07836e4e59229b3a065913afc27702642c683bba689910b2b2fd45db310d3888957e6d004a31802f902a7f85f800a8255f094aaaf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca0575da4e21b66fa764be5f74da9389e67693d066fb0d1312e19e17e501da00ecda06baf5a5327595f6619dfc2fcb3f2e6fb410b5810af3cb52d0e7508038e91a188f85f010a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ba04fa966bf34b93abc1bcd665554b7f316b50f928477b50be0f3285ead29d18c5ba017bba0eeec1625ab433746955e125d46d80b7fdc97386c51266f842d8e02192ef85f020a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca004377418ae981cc32b1312b4a427a1d69a821b28db8584f5f2bd8c6d42458adaa053a1dba1af177fac92f3b6af0a9fa46a22adf56e686c93794b6a012bf254abf5f85f030a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca04fe13febd28a05f4fcb2f451d7ddc2dda56486d9f8c79a62b0ba4da775122615a0651b2382dd402df9ebc27f8cb4b2e0f3cea68dda2dca0ee9603608f0b6f51668f85f040a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ba078e6a0ba086a08f8450e208a399bb2f2d2a0d984acd2517c7c7df66ccfab567da013254002cd45a97fac049ae00afbc43ed0d9961d0c56a3b2382c80ce41c198ddf85f050a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ba0a7174d8f43ea71c8e3ca9477691add8d80ac8e0ed89d8d8b572041eef81f4a54a0534ea2e28ec4da3b5b944b18c51ec84a5cf35f5b3343c5fb86521fd2d388f506f85f060a82520894bbbf5374fce5edbc8e2a8697c15331677e6ebf0b0a801ba034bd04065833536a10c77ee2a43a5371bc6d34837088b861dd9d4b7f44074b59a078807715786a13876d3455716a6b9cb2186b7a4887a5c31160fc877454958616c0', + genesisRLP: + '0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0af81e09f8c46ca322193edfda764fa7e88e81923f802f1d325ec0b0308ac2cd0a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008083023e38808454c98c8142a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421880102030405060708c0c0', +} diff --git a/packages/testdata/src/blocks/preLondonTestDataBlocks2.ts b/packages/testdata/src/blocks/preLondonTestDataBlocks2.ts deleted file mode 100644 index 89f461c3a60..00000000000 --- a/packages/testdata/src/blocks/preLondonTestDataBlocks2.ts +++ /dev/null @@ -1,194 +0,0 @@ -export const preLondonTestDataBlocks2 = { - _info: { - comment: '', - filledwith: 'cpp-1.3.0+commit.26123543.Linux.g++', - source: '/src/BlockchainTestsFiller/bcUncleHeaderValiditiy/correctFiller.json', // cspell:disable-line - }, - blocks: [ - { - blockHeader: { - bloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - coinbase: '0x8888f1f195afa192cfee860698584c030f4c9db1', - difficulty: '0x020000', - extraData: '', - gasLimit: '0x2fefba', - gasUsed: '0x5208', - hash: '0xca028b1318795714d130a99d8023bd7463cf8084f31d2f95f1a2d9eb342e9cac', - mixHash: '0xc62911f4c54474a95c8f49044e4cf77aa7bb4c6534887d80ddc1a1ccdad9d3e8', - nonce: '0x4e379cdf33222ddf', - number: '0x01', - parentHash: '0x5a39ed1020c04d4d84539975b893a4e7c53eab6c2965db8bc3468093a31bc5ae', - receiptTrie: '0xe9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313', - stateRoot: '0xcb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878', - timestamp: '0x5982d2cb', - transactionsTrie: '0x5c9151c2413d1cd25c51ffb4ac38948acc1359bf08c6b49f283660e9bcf0f516', - uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - }, - rlp: '0xf90261f901f9a05a39ed1020c04d4d84539975b893a4e7c53eab6c2965db8bc3468093a31bc5aea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a05c9151c2413d1cd25c51ffb4ac38948acc1359bf08c6b49f283660e9bcf0f516a0e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefba825208845982d2cb80a0c62911f4c54474a95c8f49044e4cf77aa7bb4c6534887d80ddc1a1ccdad9d3e8884e379cdf33222ddff862f86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba077c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8a03f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288dc0', - transactions: [ - { - data: '', - gasLimit: '0x04cb2f', - gasPrice: '0x01', - nonce: '0x', - r: '0x77c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8', - s: '0x3f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288d', - to: '0x095e7baea6a6c7c4c2dfeb977efac326af552d87', - v: '0x1b', - value: '0x0a', - }, - ], - uncleHeaders: [], - }, - { - blockHeader: { - bloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - coinbase: '0x8888f1f195afa192cfee860698584c030f4c9db1', - difficulty: '0x020040', - extraData: '', - gasLimit: '0x2fefba', - gasUsed: '0x5208', - hash: '0x2b530c31b2556d8ad5e12311658f0ec47e35a4ceffecd83d06e7cd918d3a85f1', - mixHash: '0x6695294f40e94ba1641fad8c4827dfa8929c8b5b6df64bf79dae8067ae5809ca', - nonce: '0xb4fca9b7d3af4ecc', - number: '0x02', - parentHash: '0xca028b1318795714d130a99d8023bd7463cf8084f31d2f95f1a2d9eb342e9cac', - receiptTrie: '0x5ea1a8b24652fed0ecab4738edd9211891eb8c4353c345973b78a02cc0f32f6b', - stateRoot: '0xe7e4760f75476ec7f51869d8bdce5c693058fd5a95c77ea9c0bf7ced1e50d70e', - timestamp: '0x5982d2cd', - transactionsTrie: '0xc673e076264c4669a5c2e479f1757b78e42511efe33b5fd2c0a23b929c7f87f5', - uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - }, - rlp: '0xf90260f901f9a0ca028b1318795714d130a99d8023bd7463cf8084f31d2f95f1a2d9eb342e9caca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0e7e4760f75476ec7f51869d8bdce5c693058fd5a95c77ea9c0bf7ced1e50d70ea0c673e076264c4669a5c2e479f1757b78e42511efe33b5fd2c0a23b929c7f87f5a05ea1a8b24652fed0ecab4738edd9211891eb8c4353c345973b78a02cc0f32f6bb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefba825208845982d2cd80a06695294f40e94ba1641fad8c4827dfa8929c8b5b6df64bf79dae8067ae5809ca88b4fca9b7d3af4eccf861f85f01018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba033c86e64d708c97c6b135cadff79dbf45985aa0b53694789e90d15f756765f239f1d0f8caa2a16405148c9d85581be5814960010f3cba938b5501590cea1f7cfc0', - transactions: [ - { - data: '', - gasLimit: '0x04cb2f', - gasPrice: '0x01', - nonce: '0x01', - r: '0x33c86e64d708c97c6b135cadff79dbf45985aa0b53694789e90d15f756765f23', - s: '0x1d0f8caa2a16405148c9d85581be5814960010f3cba938b5501590cea1f7cf', - to: '0x095e7baea6a6c7c4c2dfeb977efac326af552d87', - v: '0x1b', - value: '0x0a', - }, - ], - uncleHeaders: [], - }, - { - blockHeader: { - bloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - coinbase: '0x8888f1f195afa192cfee860698584c030f4c9db1', - difficulty: '0x020080', - extraData: '', - gasLimit: '0x2fefba', - gasUsed: '0x5208', - hash: '0xc6208f30be1fb9053b073c49cc16795001bd07c6d2650b28d2e4a37a5eb2dde2', - mixHash: '0x16bd3db367a3b218565e6744de193fb601587af40ba093e8e3cf9b29f0aa4ff1', - nonce: '0xf5c0d237b1a07faa', - number: '0x03', - parentHash: '0x2b530c31b2556d8ad5e12311658f0ec47e35a4ceffecd83d06e7cd918d3a85f1', - receiptTrie: '0x4ede0225773c7a517b91994aca65ade45124e7ef4b8be1e6097c9773a11920af', - stateRoot: '0x77f96f4c766c10cd0207e2672b1b747c741ed75bc94e7be7abacb71cdca3c8fb', - timestamp: '0x5982d2d1', - transactionsTrie: '0x1722b8a91bfc4f5614ce36ee77c7cce6620ab4af36d3c54baa66d7dbeb7bce1a', - uncleHash: '0xbeb175854a56183e630cd77e1c6dcd50a8bab221f81f2376919c649b33c500e0', - }, - rlp: '0xf9045df901f9a02b530c31b2556d8ad5e12311658f0ec47e35a4ceffecd83d06e7cd918d3a85f1a0beb175854a56183e630cd77e1c6dcd50a8bab221f81f2376919c649b33c500e0948888f1f195afa192cfee860698584c030f4c9db1a077f96f4c766c10cd0207e2672b1b747c741ed75bc94e7be7abacb71cdca3c8fba01722b8a91bfc4f5614ce36ee77c7cce6620ab4af36d3c54baa66d7dbeb7bce1aa04ede0225773c7a517b91994aca65ade45124e7ef4b8be1e6097c9773a11920afb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefba825208845982d2d180a016bd3db367a3b218565e6744de193fb601587af40ba093e8e3cf9b29f0aa4ff188f5c0d237b1a07faaf862f86002018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca015eb1cc916728b9799e55c489857727669afb2986433d5f54cde11faaed9f0eea05d36f6d06c34aae8d0a2a5895c8ba4a17ad46a5fa59f361cb3e7e01a23030e38f901faf901f7a0ca028b1318795714d130a99d8023bd7463cf8084f31d2f95f1a2d9eb342e9caca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefba80845982d2cf80a0b5488407bc8b147a9b3c4811864ebfc5bdb568fc8f91dcf9232ed6b7429c52f8882b9b47250942c14e', - transactions: [ - { - data: '', - gasLimit: '0x04cb2f', - gasPrice: '0x01', - nonce: '0x02', - r: '0x15eb1cc916728b9799e55c489857727669afb2986433d5f54cde11faaed9f0ee', - s: '0x5d36f6d06c34aae8d0a2a5895c8ba4a17ad46a5fa59f361cb3e7e01a23030e38', - to: '0x095e7baea6a6c7c4c2dfeb977efac326af552d87', - v: '0x1c', - value: '0x0a', - }, - ], - uncleHeaders: [ - { - bloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - coinbase: '0x0000000000000000000000000000000000000000', - difficulty: '0x020040', - extraData: '', - gasLimit: '0x2fefba', - gasUsed: '0x00', - hash: '0xcac5903348d2b4ca370227f7bd24bc3101b327a05172a3d7d3106a11d2019c16', - mixHash: '0xb5488407bc8b147a9b3c4811864ebfc5bdb568fc8f91dcf9232ed6b7429c52f8', - nonce: '0x2b9b47250942c14e', - number: '0x02', - parentHash: '0xca028b1318795714d130a99d8023bd7463cf8084f31d2f95f1a2d9eb342e9cac', - receiptTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - stateRoot: '0xcb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878', - timestamp: '0x5982d2cf', - transactionsTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - }, - ], - }, - ], - genesisBlockHeader: { - bloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - coinbase: '0x8888f1f195afa192cfee860698584c030f4c9db1', - difficulty: '0x020000', - extraData: '0x42', - gasLimit: '0x2fefd8', - gasUsed: '0x00', - hash: '0x5a39ed1020c04d4d84539975b893a4e7c53eab6c2965db8bc3468093a31bc5ae', - mixHash: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - nonce: '0x0102030405060708', - number: '0x00', - parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - receiptTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - stateRoot: '0x7dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1', - timestamp: '0x54c98c81', - transactionsTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - }, - genesisRLP: - '0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421880102030405060708c0c0', - lastblockhash: '0xc6208f30be1fb9053b073c49cc16795001bd07c6d2650b28d2e4a37a5eb2dde2', - network: 'EIP150', - postState: { - '0x0000000000000000000000000000000000000000': { - balance: '0x3cb71f51fc558000', - code: '', - nonce: '0x', - storage: {}, - }, - '0x095e7baea6a6c7c4c2dfeb977efac326af552d87': { - balance: '0x1e', - code: '', - nonce: '0x', - storage: {}, - }, - '0x8888f1f195afa192cfee860698584c030f4c9db1': { - balance: '0xd255d112e1049618', - code: '', - nonce: '0x', - storage: {}, - }, - '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b': { - balance: '0x09184e71a9ca', - code: '', - nonce: '0x03', - storage: {}, - }, - }, - pre: { - '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b': { - balance: '0x09184e72a000', - code: '', - nonce: '0x', - storage: {}, - }, - }, -} diff --git a/packages/testdata/src/blocks/preLondonTestDataBlocks2RLP.ts b/packages/testdata/src/blocks/preLondonTestDataBlocks2RLP.ts new file mode 100644 index 00000000000..03302f9b10a --- /dev/null +++ b/packages/testdata/src/blocks/preLondonTestDataBlocks2RLP.ts @@ -0,0 +1,12 @@ +import type { PrefixedHexString } from '@ethereumjs/util' + +export const preLondonTestDataBlocks2RLP: Record = { + block0RLP: + '0xf90261f901f9a05a39ed1020c04d4d84539975b893a4e7c53eab6c2965db8bc3468093a31bc5aea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a05c9151c2413d1cd25c51ffb4ac38948acc1359bf08c6b49f283660e9bcf0f516a0e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefba825208845982d2cb80a0c62911f4c54474a95c8f49044e4cf77aa7bb4c6534887d80ddc1a1ccdad9d3e8884e379cdf33222ddff862f86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba077c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8a03f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288dc0', + block1RLP: + '0xf90260f901f9a0ca028b1318795714d130a99d8023bd7463cf8084f31d2f95f1a2d9eb342e9caca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0e7e4760f75476ec7f51869d8bdce5c693058fd5a95c77ea9c0bf7ced1e50d70ea0c673e076264c4669a5c2e479f1757b78e42511efe33b5fd2c0a23b929c7f87f5a05ea1a8b24652fed0ecab4738edd9211891eb8c4353c345973b78a02cc0f32f6bb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefba825208845982d2cd80a06695294f40e94ba1641fad8c4827dfa8929c8b5b6df64bf79dae8067ae5809ca88b4fca9b7d3af4eccf861f85f01018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba033c86e64d708c97c6b135cadff79dbf45985aa0b53694789e90d15f756765f239f1d0f8caa2a16405148c9d85581be5814960010f3cba938b5501590cea1f7cfc0', + block2RLP: + '0xf9045df901f9a02b530c31b2556d8ad5e12311658f0ec47e35a4ceffecd83d06e7cd918d3a85f1a0beb175854a56183e630cd77e1c6dcd50a8bab221f81f2376919c649b33c500e0948888f1f195afa192cfee860698584c030f4c9db1a077f96f4c766c10cd0207e2672b1b747c741ed75bc94e7be7abacb71cdca3c8fba01722b8a91bfc4f5614ce36ee77c7cce6620ab4af36d3c54baa66d7dbeb7bce1aa04ede0225773c7a517b91994aca65ade45124e7ef4b8be1e6097c9773a11920afb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefba825208845982d2d180a016bd3db367a3b218565e6744de193fb601587af40ba093e8e3cf9b29f0aa4ff188f5c0d237b1a07faaf862f86002018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca015eb1cc916728b9799e55c489857727669afb2986433d5f54cde11faaed9f0eea05d36f6d06c34aae8d0a2a5895c8ba4a17ad46a5fa59f361cb3e7e01a23030e38f901faf901f7a0ca028b1318795714d130a99d8023bd7463cf8084f31d2f95f1a2d9eb342e9caca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefba80845982d2cf80a0b5488407bc8b147a9b3c4811864ebfc5bdb568fc8f91dcf9232ed6b7429c52f8882b9b47250942c14e', + genesisRLP: + '0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421880102030405060708c0c0', +} diff --git a/packages/testdata/src/gethGenesis/invalidSpuriousDragonGethGenesis.ts b/packages/testdata/src/gethGenesis/invalidSpuriousDragonGethGenesis.ts index 29196700957..253513efc47 100644 --- a/packages/testdata/src/gethGenesis/invalidSpuriousDragonGethGenesis.ts +++ b/packages/testdata/src/gethGenesis/invalidSpuriousDragonGethGenesis.ts @@ -32,4 +32,4 @@ export const invalidSpuriousDragonGethGenesis: GethGenesis = { gasUsed: '0x0', parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', baseFeePerGas: null, -} as GethGenesis +} as unknown as GethGenesis diff --git a/packages/testdata/src/gethGenesis/withdrawalsGethGenesis.ts b/packages/testdata/src/gethGenesis/withdrawalsGethGenesis.ts index ce397d83ffc..62a67a1bd86 100644 --- a/packages/testdata/src/gethGenesis/withdrawalsGethGenesis.ts +++ b/packages/testdata/src/gethGenesis/withdrawalsGethGenesis.ts @@ -1,4 +1,6 @@ -export const withdrawalsGethGenesis = { +import type { GethGenesis } from '@ethereumjs/common' + +export const withdrawalsGethGenesis: GethGenesis = { config: { chainId: 1, homesteadBlock: 0, diff --git a/packages/tx/README.md b/packages/tx/README.md index 10415dea702..e92ccbf00e9 100644 --- a/packages/tx/README.md +++ b/packages/tx/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/tx +# @ethereumjs/tx `v10` [![NPM Package][tx-npm-badge]][tx-npm-link] [![GitHub Issues][tx-issues-badge]][tx-issues-link] @@ -9,9 +9,30 @@ | Implements schema and functions for the different Ethereum transaction types | | ---------------------------------------------------------------------------- | -## Installation +- 🦄 All tx types up till **Pectra** +- 🌴 Tree-shakeable API +- 👷🏼 Controlled dependency set (1 external + `@Noble` crypto) +- 🎼 Unified tx type API +- 📲 New type for **EIP-7702** account abstraction +- 🛵 190KB bundle size (all tx types) (47KB gzipped) +- 🏄🏾‍♂️ WASM-free default + Fully browser ready + +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Chain and Hardfork Support](#chain-and-hardfork-support) +- [Transaction Types](#transaction-types) +- [Transaction Factory](#transaction-factory) +- [KZG Setup](#kzg-setup) +- [Sending a Transaction](#sending-a-transaction) +- [Browser](#browser) +- [Hardware Wallets](#hardware-wallets) +- [API](#api) +- [EthereumJS](#ethereumjs) +- [License](#license) -### General +## Installation To obtain the latest version, simply require the project using `npm`: @@ -19,7 +40,7 @@ To obtain the latest version, simply require the project using `npm`: npm install @ethereumjs/tx ``` -## Usage +## Getting Started ### Static Constructor Methods @@ -33,7 +54,11 @@ See one of the code examples on the tx types below on how to use. All types of transaction objects are frozen with `Object.freeze()` which gives you enhanced security and consistency properties when working with the instantiated object. This behavior can be modified using the `freeze` option in the constructor if needed. -### Chain and Hardfork Support +### WASM Crypto Support + +This library by default uses JavaScript implementations for the basic standard crypto primitives like hashing or signature verification. See `@ethereumjs/common` [README](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common) for instructions on how to replace with e.g. a more performant WASM implementation by using a shared `common` instance. + +## Chain and Hardfork Support To use a chain other than the default Mainnet chain, or a different hardfork than the default [`@ethereumjs/common`](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common) hardfork (`Hardfork.Prague`), provide a `common` object in the constructor of the tx. @@ -43,30 +68,30 @@ Hardforks adding features and/or tx types: | Hardfork | Introduced | Description | | ---------------- | ---------- | ------------------------------------------------------------------------------------------------------- | -| `spuriousDragon` |  `v2.0.0` |  `EIP-155` replay protection (disable by setting HF pre-`spuriousDragon`) | -| `istanbul` |  `v2.1.1`  | Support for reduced non-zero call blob gas prices ([EIP-2028](https://eips.ethereum.org/EIPS/eip-2028)) | -| `muirGlacier` |  `v2.1.2` |  - | -| `berlin` | `v3.1.0` |  `EIP-2718` Typed Transactions, Optional Access Lists Tx Type `EIP-2930` | +| `spuriousDragon` | `v2.0.0` | `EIP-155` replay protection (disable by setting HF pre-`spuriousDragon`) | +| `istanbul` | `v2.1.1` | Support for reduced non-zero call blob gas prices ([EIP-2028](https://eips.ethereum.org/EIPS/eip-2028)) | +| `muirGlacier` | `v2.1.2` | - | +| `berlin` | `v3.1.0` | `EIP-2718` Typed Transactions, Optional Access Lists Tx Type `EIP-2930` | | `london` | `v3.2.0` | `EIP-1559` Transactions | | `cancun` | `v5.0.0` | `EIP-4844` Transactions | +| `prague` | `v10.0.0` | `EIP-7702` Transactions | -### WASM Crypto Support +## Transaction Types -This library by default uses JavaScript implementations for the basic standard crypto primitives like hashing or signature verification. See `@ethereumjs/common` [README](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common) for instructions on how to replace with e.g. a more performant WASM implementation by using a shared `common` instance. - -### Transaction Types +### Table of Contents This library supports the following transaction types ([EIP-2718](https://eips.ethereum.org/EIPS/eip-2718)): -- `FeeMarketEIP1559Tx` ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559), gas fee market) -- `AccessListEIP2930Tx` ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930), optional access lists) -- `BlobEIP4844Tx` ([EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), blob transactions) -- `EOACodeEIP7702Tx` ([EIP-7702](https://eips.ethereum.org/EIPS/eip-7702), EOA code delegation) -- `LegacyTx`, the Ethereum standard tx up to `berlin`, now referred to as legacy txs with the introduction of tx types +- [Gas Fee Market Transactions (EIP-1559)](#gas-fee-market-transactions-eip-1559) +- [Access List Transactions (EIP-2930)](#access-list-transactions-eip-2930) +- [Blob Transactions (EIP-4844)](#blob-transactions-eip-4844) +- [EOA Code Transaction (EIP-7702)](#eoa-code-transaction-eip-7702) +- [Legacy Transactions](#legacy-transactions) (original Ethereum txs) -#### Gas Fee Market Transactions (EIP-1559) +### Gas Fee Market Transactions (EIP-1559) - Class: `FeeMarketEIP1559Tx` +- EIP: [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Activation: `london` - Type: `2` @@ -101,9 +126,10 @@ const tx = createFeeMarket1559Tx(txData, { common }) console.log(bytesToHex(tx.hash())) // 0x6f9ef69ccb1de1aea64e511efd6542541008ced321887937c95b03779358ec8a ``` -#### Access List Transactions (EIP-2930) +### Access List Transactions (EIP-2930) - Class: `AccessListEIP2930Tx` +- EIP: [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Activation: `berlin` - Type: `1` @@ -148,9 +174,10 @@ console.log(bytesToHex(tx.hash())) // 0x9150cdebad74e88b038e6c6b964d99af705f9c08 For generating access lists from tx data based on a certain network state there is a `reportAccessList` option on the `Vm.runTx()` method of the `@ethereumjs/vm` `TypeScript` VM implementation. -#### Blob Transactions (EIP-4844) +### Blob Transactions (EIP-4844) - Class: `BlobEIP4844Tx` +- EIP: [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) - Activation: `cancun` - Type: `3` @@ -158,8 +185,6 @@ This library supports the blob transaction type introduced with [EIP-4844](https **Note:** This functionality 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. -##### Usage - See the following code snipped for an example on how to instantiate: ```ts @@ -212,9 +237,10 @@ Alternatively, you can pass a `blobsData` property with an array of strings corr See the [Blob Transaction Tests](./test/eip4844.spec.ts) for examples of usage in instantiating, serializing, and deserializing these transactions. -#### EOA Code Transaction (EIP-7702) +### EOA Code Transaction (EIP-7702) - Class: `EOACodeEIP7702Tx` +- EIP: [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - Activation: `prague` - Type: `4` @@ -291,7 +317,7 @@ console.log(bytesToHex(signedTx.hash())) // 0x894b72d87f8333fccd29d1b3aca39af69d ``` -### Transaction Factory +## Transaction Factory If you only know on runtime which tx type will be used within your code or if you want to keep your code transparent to tx types, this library comes with a `TransactionFactory` for your convenience which can be used as follows: @@ -324,7 +350,7 @@ The correct tx type class for instantiation will then be chosen on runtime based - `public static fromBlockBodyData(data: Uint8Array | Uint8Array[], txOptions: TxOptions = {})` - `public static async fromJsonRpcProvider(provider: string | EthersProvider, txHash: string, txOptions?: TxOptions)` -### KZG Setup +## KZG Setup This library fully supports `EIP-4844` blob transactions. For blob transactions and other KZG related proof functionality (e.g. for EVM precompiles) KZG has to be manually installed and initialized in the `common` instance to be used in instantiating blob transactions. @@ -354,9 +380,9 @@ void main() Note: We did not want to directly bundle because bundle sizes are large due to the large trusted setup inclusion (especially for the mainnet trusted setup). -### Sending a Transaction +## Sending a Transaction -#### L2 Support +### L2 Support This library has been tested to work with various L2 networks. To set an associated chainID, use the `createCustomCommon()` constructor from our `Common` library. The following is a simple example to send a tx to the xDai chain: @@ -391,9 +417,9 @@ We provide hybrid ESM/CJS builds for all our libraries. With the v10 breaking re It is easily possible to run a browser build of one of the EthereumJS libraries within a modern browser using the provided ESM build. For a setup example see [./examples/browser.html](./examples/browser.html). -## Special Topics +## Hardware Wallets -### Signing with a hardware or external wallet +### Ledger To sign a tx with a hardware or external wallet use `tx.getMessageToSign()` to return an [EIP-155](https://eips.ethereum.org/EIPS/eip-155) compliant unsigned tx. diff --git a/packages/tx/docs/README.md b/packages/tx/docs/README.md index 75b44155094..b0a389c23b7 100644 --- a/packages/tx/docs/README.md +++ b/packages/tx/docs/README.md @@ -1,33 +1,30 @@ -@ethereumjs/tx +**@ethereumjs/tx** -# @ethereumjs/tx - -## Table of contents - -### Enumerations +*** -- [Capability](enums/Capability.md) -- [TransactionType](enums/TransactionType.md) +# @ethereumjs/tx -### Classes +## Classes -- [AccessListEIP2930Transaction](classes/AccessListEIP2930Transaction.md) -- [BlobEIP4844Transaction](classes/BlobEIP4844Transaction.md) -- [FeeMarketEIP1559Transaction](classes/FeeMarketEIP1559Transaction.md) -- [LegacyTransaction](classes/LegacyTransaction.md) -- [TransactionFactory](classes/TransactionFactory.md) +- [AccessList2930Tx](classes/AccessList2930Tx.md) +- [Blob4844Tx](classes/Blob4844Tx.md) +- [EOACode7702Tx](classes/EOACode7702Tx.md) +- [FeeMarket1559Tx](classes/FeeMarket1559Tx.md) +- [LegacyTx](classes/LegacyTx.md) -### Interfaces +## Interfaces -- [AccessListEIP2930TxData](interfaces/AccessListEIP2930TxData.md) +- [AccessList2930TxData](interfaces/AccessList2930TxData.md) - [BlobEIP4844TxData](interfaces/BlobEIP4844TxData.md) - [EIP1559CompatibleTx](interfaces/EIP1559CompatibleTx.md) - [EIP2718CompatibleTx](interfaces/EIP2718CompatibleTx.md) - [EIP2930CompatibleTx](interfaces/EIP2930CompatibleTx.md) - [EIP4844CompatibleTx](interfaces/EIP4844CompatibleTx.md) +- [EIP7702CompatibleTx](interfaces/EIP7702CompatibleTx.md) +- [EOACode7702TxData](interfaces/EOACode7702TxData.md) - [FeeMarketEIP1559TxData](interfaces/FeeMarketEIP1559TxData.md) -- [JsonRpcTx](interfaces/JsonRpcTx.md) -- [JsonTx](interfaces/JsonTx.md) +- [JSONRPCTx](interfaces/JSONRPCTx.md) +- [JSONTx](interfaces/JSONTx.md) - [LegacyTxInterface](interfaces/LegacyTxInterface.md) - [Transaction](interfaces/Transaction.md) - [TransactionCache](interfaces/TransactionCache.md) @@ -36,330 +33,77 @@ - [TxOptions](interfaces/TxOptions.md) - [TxValuesArray](interfaces/TxValuesArray.md) -### Type Aliases - -- [AccessList](README.md#accesslist) -- [AccessListBytes](README.md#accesslistbytes) -- [AccessListBytesItem](README.md#accesslistbytesitem) -- [AccessListItem](README.md#accesslistitem) -- [BlobEIP4844NetworkValuesArray](README.md#blobeip4844networkvaluesarray) -- [LegacyTxData](README.md#legacytxdata) -- [TypedTransaction](README.md#typedtransaction) -- [TypedTxData](README.md#typedtxdata) - -### Functions - -- [isAccessList](README.md#isaccesslist) -- [isAccessListBytes](README.md#isaccesslistbytes) -- [isAccessListEIP2930Tx](README.md#isaccesslisteip2930tx) -- [isAccessListEIP2930TxData](README.md#isaccesslisteip2930txdata) -- [isBlobEIP4844Tx](README.md#isblobeip4844tx) -- [isBlobEIP4844TxData](README.md#isblobeip4844txdata) -- [isFeeMarketEIP1559Tx](README.md#isfeemarketeip1559tx) -- [isFeeMarketEIP1559TxData](README.md#isfeemarketeip1559txdata) -- [isLegacyTx](README.md#islegacytx) -- [isLegacyTxData](README.md#islegacytxdata) - ## Type Aliases -### AccessList - -Ƭ **AccessList**: [`AccessListItem`](README.md#accesslistitem)[] - -#### Defined in - -common/dist/cjs/interfaces.d.ts:51 - -___ - -### AccessListBytes - -Ƭ **AccessListBytes**: [`AccessListBytesItem`](README.md#accesslistbytesitem)[] - -#### Defined in - -common/dist/cjs/interfaces.d.ts:50 - -___ - -### AccessListBytesItem - -Ƭ **AccessListBytesItem**: [`Uint8Array`, `Uint8Array`[]] - -#### Defined in - -common/dist/cjs/interfaces.d.ts:49 - -___ - -### AccessListItem - -Ƭ **AccessListItem**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `address` | `PrefixedHexString` | -| `storageKeys` | `PrefixedHexString`[] | - -#### Defined in - -common/dist/cjs/interfaces.d.ts:45 - -___ - -### BlobEIP4844NetworkValuesArray - -Ƭ **BlobEIP4844NetworkValuesArray**: [`BlobEIP4844TxValuesArray`, `Uint8Array`[], `Uint8Array`[], `Uint8Array`[]] - -#### Defined in - -[tx/src/types.ts:422](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L422) - -___ - -### LegacyTxData - -Ƭ **LegacyTxData**: `Object` - -Legacy [Transaction](interfaces/Transaction.md) Data - -#### Type declaration - -| Name | Type | Description | -| :------ | :------ | :------ | -| `data?` | `BytesLike` | This will contain the data of the message or the init of a contract. | -| `gasLimit?` | `BigIntLike` | The transaction's gas limit. | -| `gasPrice?` | `BigIntLike` \| ``null`` | The transaction's gas price. | -| `nonce?` | `BigIntLike` | The transaction's nonce. | -| `r?` | `BigIntLike` | EC signature parameter. | -| `s?` | `BigIntLike` | EC signature parameter. | -| `to?` | `AddressLike` | The transaction's the address is sent to. | -| `type?` | `BigIntLike` | The transaction type | -| `v?` | `BigIntLike` | EC recovery ID. | -| `value?` | `BigIntLike` | The amount of Ether sent. | - -#### Defined in - -[tx/src/types.ts:238](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L238) - -___ - -### TypedTransaction - -Ƭ **TypedTransaction**: [`Transaction`](interfaces/Transaction.md)[[`TransactionType`](enums/TransactionType.md)] - -#### Defined in - -[tx/src/types.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L122) - -___ - -### TypedTxData - -Ƭ **TypedTxData**: [`TxData`](interfaces/TxData.md)[[`TransactionType`](enums/TransactionType.md)] - -#### Defined in - -[tx/src/types.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L213) +- [AccessList](type-aliases/AccessList.md) +- [AccessListBytes](type-aliases/AccessListBytes.md) +- [AccessListBytesItem](type-aliases/AccessListBytesItem.md) +- [AccessListItem](type-aliases/AccessListItem.md) +- [AuthorizationList](type-aliases/AuthorizationList.md) +- [AuthorizationListBytes](type-aliases/AuthorizationListBytes.md) +- [AuthorizationListBytesItem](type-aliases/AuthorizationListBytesItem.md) +- [AuthorizationListBytesItemUnsigned](type-aliases/AuthorizationListBytesItemUnsigned.md) +- [AuthorizationListItem](type-aliases/AuthorizationListItem.md) +- [AuthorizationListItemUnsigned](type-aliases/AuthorizationListItemUnsigned.md) +- [BlobEIP4844NetworkValuesArray](type-aliases/BlobEIP4844NetworkValuesArray.md) +- [Capability](type-aliases/Capability.md) +- [JSONBlobTxNetworkWrapper](type-aliases/JSONBlobTxNetworkWrapper.md) +- [LegacyTxData](type-aliases/LegacyTxData.md) +- [TransactionType](type-aliases/TransactionType.md) +- [TypedTransaction](type-aliases/TypedTransaction.md) +- [TypedTxData](type-aliases/TypedTxData.md) + +## Variables + +- [Capability](variables/Capability.md) +- [paramsTx](variables/paramsTx.md) +- [TransactionType](variables/TransactionType.md) ## Functions -### isAccessList - -▸ **isAccessList**(`input`): input is AccessList - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `input` | [`AccessListBytes`](README.md#accesslistbytes) \| [`AccessList`](README.md#accesslist) | - -#### Returns - -input is AccessList - -#### Defined in - -[tx/src/types.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L92) - -___ - -### isAccessListBytes - -▸ **isAccessListBytes**(`input`): input is AccessListBytes - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `input` | [`AccessListBytes`](README.md#accesslistbytes) \| [`AccessList`](README.md#accesslist) | - -#### Returns - -input is AccessListBytes - -#### Defined in - -[tx/src/types.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L81) - -___ - -### isAccessListEIP2930Tx - -▸ **isAccessListEIP2930Tx**(`tx`): tx is AccessListEIP2930Transaction - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`TypedTransaction`](README.md#typedtransaction) | - -#### Returns - -tx is AccessListEIP2930Transaction - -#### Defined in - -[tx/src/types.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L128) - -___ - -### isAccessListEIP2930TxData - -▸ **isAccessListEIP2930TxData**(`txData`): txData is AccessListEIP2930TxData - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`TypedTxData`](README.md#typedtxdata) | - -#### Returns - -txData is AccessListEIP2930TxData - -#### Defined in - -[tx/src/types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L220) - -___ - -### isBlobEIP4844Tx - -▸ **isBlobEIP4844Tx**(`tx`): tx is BlobEIP4844Transaction - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`TypedTransaction`](README.md#typedtransaction) | - -#### Returns - -tx is BlobEIP4844Transaction - -#### Defined in - -[tx/src/types.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L136) - -___ - -### isBlobEIP4844TxData - -▸ **isBlobEIP4844TxData**(`txData`): txData is BlobEIP4844TxData - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`TypedTxData`](README.md#typedtxdata) | - -#### Returns - -txData is BlobEIP4844TxData - -#### Defined in - -[tx/src/types.ts:230](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L230) - -___ - -### isFeeMarketEIP1559Tx - -▸ **isFeeMarketEIP1559Tx**(`tx`): tx is FeeMarketEIP1559Transaction - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`TypedTransaction`](README.md#typedtransaction) | - -#### Returns - -tx is FeeMarketEIP1559Transaction - -#### Defined in - -[tx/src/types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L132) - -___ - -### isFeeMarketEIP1559TxData - -▸ **isFeeMarketEIP1559TxData**(`txData`): txData is FeeMarketEIP1559TxData - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`TypedTxData`](README.md#typedtxdata) | - -#### Returns - -txData is FeeMarketEIP1559TxData - -#### Defined in - -[tx/src/types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L225) - -___ - -### isLegacyTx - -▸ **isLegacyTx**(`tx`): tx is LegacyTransaction - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`TypedTransaction`](README.md#typedtransaction) | - -#### Returns - -tx is LegacyTransaction - -#### Defined in - -[tx/src/types.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L124) - -___ - -### isLegacyTxData - -▸ **isLegacyTxData**(`txData`): txData is LegacyTxData - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`TypedTxData`](README.md#typedtxdata) | - -#### Returns - -txData is LegacyTxData - -#### Defined in - -[tx/src/types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L215) +- [accessListBytesToJSON](functions/accessListBytesToJSON.md) +- [accessListJSONToBytes](functions/accessListJSONToBytes.md) +- [authorizationHashedMessageToSign](functions/authorizationHashedMessageToSign.md) +- [authorizationListBytesItemToJSON](functions/authorizationListBytesItemToJSON.md) +- [authorizationListJSONItemToBytes](functions/authorizationListJSONItemToBytes.md) +- [authorizationMessageToSign](functions/authorizationMessageToSign.md) +- [blobTxNetworkWrapperToJSON](functions/blobTxNetworkWrapperToJSON.md) +- [create1559FeeMarketTxFromBytesArray](functions/create1559FeeMarketTxFromBytesArray.md) +- [createAccessList2930Tx](functions/createAccessList2930Tx.md) +- [createAccessList2930TxFromBytesArray](functions/createAccessList2930TxFromBytesArray.md) +- [createAccessList2930TxFromRLP](functions/createAccessList2930TxFromRLP.md) +- [createBlob4844Tx](functions/createBlob4844Tx.md) +- [createBlob4844TxFromBytesArray](functions/createBlob4844TxFromBytesArray.md) +- [createBlob4844TxFromRLP](functions/createBlob4844TxFromRLP.md) +- [createBlob4844TxFromSerializedNetworkWrapper](functions/createBlob4844TxFromSerializedNetworkWrapper.md) +- [createEOACode7702Tx](functions/createEOACode7702Tx.md) +- [createEOACode7702TxFromBytesArray](functions/createEOACode7702TxFromBytesArray.md) +- [createEOACode7702TxFromRLP](functions/createEOACode7702TxFromRLP.md) +- [createFeeMarket1559Tx](functions/createFeeMarket1559Tx.md) +- [createFeeMarket1559TxFromRLP](functions/createFeeMarket1559TxFromRLP.md) +- [createLegacyTx](functions/createLegacyTx.md) +- [createLegacyTxFromBytesArray](functions/createLegacyTxFromBytesArray.md) +- [createLegacyTxFromRLP](functions/createLegacyTxFromRLP.md) +- [createMinimal4844TxFromNetworkWrapper](functions/createMinimal4844TxFromNetworkWrapper.md) +- [createTx](functions/createTx.md) +- [createTxFromBlockBodyData](functions/createTxFromBlockBodyData.md) +- [createTxFromJSONRPCProvider](functions/createTxFromJSONRPCProvider.md) +- [createTxFromRLP](functions/createTxFromRLP.md) +- [createTxFromRPC](functions/createTxFromRPC.md) +- [isAccessList](functions/isAccessList.md) +- [isAccessList2930Tx](functions/isAccessList2930Tx.md) +- [isAccessList2930TxData](functions/isAccessList2930TxData.md) +- [isAccessListBytes](functions/isAccessListBytes.md) +- [isAuthorizationList](functions/isAuthorizationList.md) +- [isAuthorizationListBytes](functions/isAuthorizationListBytes.md) +- [isBlob4844Tx](functions/isBlob4844Tx.md) +- [isBlob4844TxData](functions/isBlob4844TxData.md) +- [isEOACode7702Tx](functions/isEOACode7702Tx.md) +- [isEOACode7702TxData](functions/isEOACode7702TxData.md) +- [isFeeMarket1559Tx](functions/isFeeMarket1559Tx.md) +- [isFeeMarket1559TxData](functions/isFeeMarket1559TxData.md) +- [isLegacyTx](functions/isLegacyTx.md) +- [isLegacyTxData](functions/isLegacyTxData.md) +- [normalizeTxParams](functions/normalizeTxParams.md) +- [recoverAuthority](functions/recoverAuthority.md) +- [signAuthorization](functions/signAuthorization.md) diff --git a/packages/tx/docs/classes/AccessList2930Tx.md b/packages/tx/docs/classes/AccessList2930Tx.md new file mode 100644 index 00000000000..88d44929474 --- /dev/null +++ b/packages/tx/docs/classes/AccessList2930Tx.md @@ -0,0 +1,674 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AccessList2930Tx + +# Class: AccessList2930Tx + +Defined in: [2930/tx.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L41) + +Typed transaction with optional access lists + +- TransactionType: 1 +- EIP: [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) + +## Implements + +- [`TransactionInterface`](../interfaces/TransactionInterface.md)\<*typeof* [`AccessListEIP2930`](../variables/TransactionType.md#accesslisteip2930)\> + +## Constructors + +### Constructor + +> **new AccessList2930Tx**(`txData`, `opts`): `AccessList2930Tx` + +Defined in: [2930/tx.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L83) + +This constructor takes the values, validates them, assigns them and freezes the object. + +It is not recommended to use this constructor directly. Instead use +the static factory methods to assist in creating a Transaction object from +varying data types. + +#### Parameters + +##### txData + +[`AccessList2930TxData`](../interfaces/AccessList2930TxData.md) + +##### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +#### Returns + +`AccessList2930Tx` + +## Properties + +### accessList + +> `readonly` **accessList**: [`AccessListBytes`](../type-aliases/AccessListBytes.md) + +Defined in: [2930/tx.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L53) + +*** + +### cache + +> `readonly` **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) = `{}` + +Defined in: [2930/tx.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L67) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`cache`](../interfaces/TransactionInterface.md#cache) + +*** + +### chainId + +> `readonly` **chainId**: `bigint` + +Defined in: [2930/tx.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L54) + +*** + +### common + +> `readonly` **common**: `Common` + +Defined in: [2930/tx.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L63) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`common`](../interfaces/TransactionInterface.md#common) + +*** + +### data + +> `readonly` **data**: `Uint8Array` + +Defined in: [2930/tx.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L51) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`data`](../interfaces/TransactionInterface.md#data) + +*** + +### gasLimit + +> `readonly` **gasLimit**: `bigint` + +Defined in: [2930/tx.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L49) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`gasLimit`](../interfaces/TransactionInterface.md#gaslimit) + +*** + +### gasPrice + +> `readonly` **gasPrice**: `bigint` + +Defined in: [2930/tx.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L47) + +*** + +### nonce + +> `readonly` **nonce**: `bigint` + +Defined in: [2930/tx.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L48) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`nonce`](../interfaces/TransactionInterface.md#nonce) + +*** + +### r? + +> `readonly` `optional` **r**: `bigint` + +Defined in: [2930/tx.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L58) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`r`](../interfaces/TransactionInterface.md#r) + +*** + +### s? + +> `readonly` `optional` **s**: `bigint` + +Defined in: [2930/tx.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L59) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`s`](../interfaces/TransactionInterface.md#s) + +*** + +### to? + +> `readonly` `optional` **to**: `Address` + +Defined in: [2930/tx.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L52) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`to`](../interfaces/TransactionInterface.md#to) + +*** + +### txOptions + +> `readonly` **txOptions**: [`TxOptions`](../interfaces/TxOptions.md) + +Defined in: [2930/tx.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L65) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`txOptions`](../interfaces/TransactionInterface.md#txoptions) + +*** + +### type + +> **type**: `1` = `TransactionType.AccessListEIP2930` + +Defined in: [2930/tx.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L44) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`type`](../interfaces/TransactionInterface.md#type) + +*** + +### v? + +> `readonly` `optional` **v**: `bigint` + +Defined in: [2930/tx.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L57) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`v`](../interfaces/TransactionInterface.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [2930/tx.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L50) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`value`](../interfaces/TransactionInterface.md#value) + +## Methods + +### addSignature() + +> **addSignature**(`v`, `r`, `s`): `AccessList2930Tx` + +Defined in: [2930/tx.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L273) + +#### Parameters + +##### v + +`bigint` + +##### r + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +##### s + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`AccessList2930Tx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`addSignature`](../interfaces/TransactionInterface.md#addsignature) + +*** + +### errorStr() + +> **errorStr**(): `string` + +Defined in: [2930/tx.ts:338](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L338) + +Return a compact error string representation of the object + +#### Returns + +`string` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`errorStr`](../interfaces/TransactionInterface.md#errorstr) + +*** + +### getDataGas() + +> **getDataGas**(): `bigint` + +Defined in: [2930/tx.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L151) + +The amount of gas paid for the data in this tx + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getDataGas`](../interfaces/TransactionInterface.md#getdatagas) + +*** + +### getEffectivePriorityFee() + +> **getEffectivePriorityFee**(`baseFee?`): `bigint` + +Defined in: [2930/tx.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L144) + +#### Parameters + +##### baseFee? + +`bigint` + +#### Returns + +`bigint` + +*** + +### getHashedMessageToSign() + +> **getHashedMessageToSign**(): `Uint8Array` + +Defined in: [2930/tx.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L245) + +Returns the hashed serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: in contrast to the legacy tx the raw message format is already +serialized and doesn't need to be RLP encoded any more. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getHashedMessageToSign`](../interfaces/TransactionInterface.md#gethashedmessagetosign) + +*** + +### getIntrinsicGas() + +> **getIntrinsicGas**(): `bigint` + +Defined in: [2930/tx.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L168) + +The minimum gas limit which the tx to have to be valid. +This covers costs as the standard fee (21000 gas), the data fee (paid for each calldata byte), +the optional creation fee (if the transaction creates a contract), and if relevant the gas +to be paid for access lists (EIP-2930) and authority lists (EIP-7702). + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getIntrinsicGas`](../interfaces/TransactionInterface.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array` + +Defined in: [2930/tx.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L234) + +Returns the raw serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: in contrast to the legacy tx the raw message format is already +serialized and doesn't need to be RLP encoded any more. + +```javascript +const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input +``` + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToSign`](../interfaces/TransactionInterface.md#getmessagetosign) + +*** + +### getMessageToVerifySignature() + +> **getMessageToVerifySignature**(): `Uint8Array` + +Defined in: [2930/tx.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L262) + +Computes a sha3-256 hash which can be used to verify the signature + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToVerifySignature`](../interfaces/TransactionInterface.md#getmessagetoverifysignature) + +*** + +### getSenderAddress() + +> **getSenderAddress**(): `Address` + +Defined in: [2930/tx.ts:323](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L323) + +#### Returns + +`Address` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderAddress`](../interfaces/TransactionInterface.md#getsenderaddress) + +*** + +### getSenderPublicKey() + +> **getSenderPublicKey**(): `Uint8Array` + +Defined in: [2930/tx.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L269) + +Returns the public key of the sender + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderPublicKey`](../interfaces/TransactionInterface.md#getsenderpublickey) + +*** + +### getUpfrontCost() + +> **getUpfrontCost**(): `bigint` + +Defined in: [2930/tx.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L158) + +The up front amount that an account must have for this transaction to be valid + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getUpfrontCost`](../interfaces/TransactionInterface.md#getupfrontcost) + +*** + +### getValidationErrors() + +> **getValidationErrors**(): `string`[] + +Defined in: [2930/tx.ts:311](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L311) + +#### Returns + +`string`[] + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getValidationErrors`](../interfaces/TransactionInterface.md#getvalidationerrors) + +*** + +### hash() + +> **hash**(): `Uint8Array` + +Defined in: [2930/tx.ts:255](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L255) + +Computes a sha3-256 hash of the serialized tx. + +This method can only be used for signed txs (it throws otherwise). +Use Transaction.getMessageToSign to get a tx hash for the purpose of signing. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`hash`](../interfaces/TransactionInterface.md#hash) + +*** + +### isSigned() + +> **isSigned**(): `boolean` + +Defined in: [2930/tx.ts:331](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L331) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isSigned`](../interfaces/TransactionInterface.md#issigned) + +*** + +### isValid() + +> **isValid**(): `boolean` + +Defined in: [2930/tx.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L315) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isValid`](../interfaces/TransactionInterface.md#isvalid) + +*** + +### raw() + +> **raw**(): `AccessList2930TxValuesArray` + +Defined in: [2930/tx.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L193) + +Returns a Uint8Array Array of the raw Bytes of the EIP-2930 transaction, in order. + +Format: `[chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, +signatureYParity (v), signatureR (r), signatureS (s)]` + +Use [AccessList2930Tx.serialize](#serialize) to add a transaction to a block +with createBlockFromBytesArray. + +For an unsigned tx this method uses the empty Bytes values for the +signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant +representation for external signing use [AccessList2930Tx.getMessageToSign](#getmessagetosign). + +#### Returns + +`AccessList2930TxValuesArray` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`raw`](../interfaces/TransactionInterface.md#raw) + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [2930/tx.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L219) + +Returns the serialized encoding of the EIP-2930 transaction. + +Format: `0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, +signatureYParity (v), signatureR (r), signatureS (s)])` + +Note that in contrast to the legacy tx serialization format this is not +valid RLP any more due to the raw tx type preceding and concatenated to +the RLP encoding of the values. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`serialize`](../interfaces/TransactionInterface.md#serialize) + +*** + +### sign() + +> **sign**(`privateKey`, `extraEntropy`): `AccessList2930Tx` + +Defined in: [2930/tx.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L327) + +#### Parameters + +##### privateKey + +`Uint8Array` + +##### extraEntropy + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`AccessList2930Tx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`sign`](../interfaces/TransactionInterface.md#sign) + +*** + +### supports() + +> **supports**(`capability`): `boolean` + +Defined in: [2930/tx.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L140) + +Checks if a tx type defining capability is active +on a tx, for example the EIP-1559 fee market mechanism +or the EIP-2930 access list feature. + +Note that this is different from the tx type itself, +so EIP-2930 access lists can very well be active +on an EIP-1559 tx for example. + +This method can be useful for feature checks if the +tx type is unknown (e.g. when instantiated with +the tx factory). + +See `Capabilities` in the `types` module for a reference +on all supported capabilities. + +#### Parameters + +##### capability + +`number` + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`supports`](../interfaces/TransactionInterface.md#supports) + +*** + +### toCreationAddress() + +> **toCreationAddress**(): `boolean` + +Defined in: [2930/tx.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L176) + +If the tx's `to` is to the creation address + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toCreationAddress`](../interfaces/TransactionInterface.md#tocreationaddress) + +*** + +### toJSON() + +> **toJSON**(): [`JSONTx`](../interfaces/JSONTx.md) + +Defined in: [2930/tx.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L299) + +Returns an object with the JSON representation of the transaction + +#### Returns + +[`JSONTx`](../interfaces/JSONTx.md) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toJSON`](../interfaces/TransactionInterface.md#tojson) + +*** + +### verifySignature() + +> **verifySignature**(): `boolean` + +Defined in: [2930/tx.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/tx.ts#L319) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`verifySignature`](../interfaces/TransactionInterface.md#verifysignature) diff --git a/packages/tx/docs/classes/AccessListEIP2930Transaction.md b/packages/tx/docs/classes/AccessListEIP2930Transaction.md deleted file mode 100644 index e32c14b2766..00000000000 --- a/packages/tx/docs/classes/AccessListEIP2930Transaction.md +++ /dev/null @@ -1,896 +0,0 @@ -[@ethereumjs/tx](../README.md) / AccessListEIP2930Transaction - -# Class: AccessListEIP2930Transaction - -Typed transaction with optional access lists - -- TransactionType: 1 -- EIP: [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - -## Hierarchy - -- `BaseTransaction`<[`AccessListEIP2930`](../enums/TransactionType.md#accesslisteip2930)\> - - ↳ **`AccessListEIP2930Transaction`** - -## Table of contents - -### Constructors - -- [constructor](AccessListEIP2930Transaction.md#constructor) - -### Properties - -- [AccessListJSON](AccessListEIP2930Transaction.md#accesslistjson) -- [accessList](AccessListEIP2930Transaction.md#accesslist) -- [cache](AccessListEIP2930Transaction.md#cache) -- [chainId](AccessListEIP2930Transaction.md#chainid) -- [common](AccessListEIP2930Transaction.md#common) -- [data](AccessListEIP2930Transaction.md#data) -- [gasLimit](AccessListEIP2930Transaction.md#gaslimit) -- [gasPrice](AccessListEIP2930Transaction.md#gasprice) -- [nonce](AccessListEIP2930Transaction.md#nonce) -- [r](AccessListEIP2930Transaction.md#r) -- [s](AccessListEIP2930Transaction.md#s) -- [to](AccessListEIP2930Transaction.md#to) -- [v](AccessListEIP2930Transaction.md#v) -- [value](AccessListEIP2930Transaction.md#value) - -### Accessors - -- [type](AccessListEIP2930Transaction.md#type) - -### Methods - -- [addSignature](AccessListEIP2930Transaction.md#addsignature) -- [errorStr](AccessListEIP2930Transaction.md#errorstr) -- [getBaseFee](AccessListEIP2930Transaction.md#getbasefee) -- [getDataFee](AccessListEIP2930Transaction.md#getdatafee) -- [getEffectivePriorityFee](AccessListEIP2930Transaction.md#geteffectivepriorityfee) -- [getHashedMessageToSign](AccessListEIP2930Transaction.md#gethashedmessagetosign) -- [getMessageToSign](AccessListEIP2930Transaction.md#getmessagetosign) -- [getMessageToVerifySignature](AccessListEIP2930Transaction.md#getmessagetoverifysignature) -- [getSenderAddress](AccessListEIP2930Transaction.md#getsenderaddress) -- [getSenderPublicKey](AccessListEIP2930Transaction.md#getsenderpublickey) -- [getUpfrontCost](AccessListEIP2930Transaction.md#getupfrontcost) -- [getValidationErrors](AccessListEIP2930Transaction.md#getvalidationerrors) -- [hash](AccessListEIP2930Transaction.md#hash) -- [isSigned](AccessListEIP2930Transaction.md#issigned) -- [isValid](AccessListEIP2930Transaction.md#isvalid) -- [raw](AccessListEIP2930Transaction.md#raw) -- [serialize](AccessListEIP2930Transaction.md#serialize) -- [sign](AccessListEIP2930Transaction.md#sign) -- [supports](AccessListEIP2930Transaction.md#supports) -- [toCreationAddress](AccessListEIP2930Transaction.md#tocreationaddress) -- [toJSON](AccessListEIP2930Transaction.md#tojson) -- [verifySignature](AccessListEIP2930Transaction.md#verifysignature) -- [fromSerializedTx](AccessListEIP2930Transaction.md#fromserializedtx) -- [fromTxData](AccessListEIP2930Transaction.md#fromtxdata) -- [fromValuesArray](AccessListEIP2930Transaction.md#fromvaluesarray) - -## Constructors - -### constructor - -• **new AccessListEIP2930Transaction**(`txData`, `opts?`) - -This constructor takes the values, validates them, assigns them and freezes the object. - -It is not recommended to use this constructor directly. Instead use -the static factory methods to assist in creating a Transaction object from -varying data types. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`AccessListEIP2930TxData`](../interfaces/AccessListEIP2930TxData.md) | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Overrides - -BaseTransaction<TransactionType.AccessListEIP2930\>.constructor - -#### Defined in - -[tx/src/eip2930Transaction.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L134) - -## Properties - -### AccessListJSON - -• `Readonly` **AccessListJSON**: [`AccessList`](../README.md#accesslist) - -#### Defined in - -[tx/src/eip2930Transaction.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L43) - -___ - -### accessList - -• `Readonly` **accessList**: [`AccessListBytes`](../README.md#accesslistbytes) - -#### Defined in - -[tx/src/eip2930Transaction.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L42) - -___ - -### cache - -• **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) - -#### Inherited from - -BaseTransaction.cache - -#### Defined in - -[tx/src/baseTransaction.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L54) - -___ - -### chainId - -• `Readonly` **chainId**: `bigint` - -#### Defined in - -[tx/src/eip2930Transaction.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L41) - -___ - -### common - -• `Readonly` **common**: `Common` - -#### Overrides - -BaseTransaction.common - -#### Defined in - -[tx/src/eip2930Transaction.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L46) - -___ - -### data - -• `Readonly` **data**: `Uint8Array` - -#### Inherited from - -BaseTransaction.data - -#### Defined in - -[tx/src/baseTransaction.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L46) - -___ - -### gasLimit - -• `Readonly` **gasLimit**: `bigint` - -#### Inherited from - -BaseTransaction.gasLimit - -#### Defined in - -[tx/src/baseTransaction.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L43) - -___ - -### gasPrice - -• `Readonly` **gasPrice**: `bigint` - -#### Defined in - -[tx/src/eip2930Transaction.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L44) - -___ - -### nonce - -• `Readonly` **nonce**: `bigint` - -#### Inherited from - -BaseTransaction.nonce - -#### Defined in - -[tx/src/baseTransaction.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L42) - -___ - -### r - -• `Optional` `Readonly` **r**: `bigint` - -#### Inherited from - -BaseTransaction.r - -#### Defined in - -[tx/src/baseTransaction.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L49) - -___ - -### s - -• `Optional` `Readonly` **s**: `bigint` - -#### Inherited from - -BaseTransaction.s - -#### Defined in - -[tx/src/baseTransaction.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L50) - -___ - -### to - -• `Optional` `Readonly` **to**: `Address` - -#### Inherited from - -BaseTransaction.to - -#### Defined in - -[tx/src/baseTransaction.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L44) - -___ - -### v - -• `Optional` `Readonly` **v**: `bigint` - -#### Inherited from - -BaseTransaction.v - -#### Defined in - -[tx/src/baseTransaction.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L48) - -___ - -### value - -• `Readonly` **value**: `bigint` - -#### Inherited from - -BaseTransaction.value - -#### Defined in - -[tx/src/baseTransaction.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L45) - -## Accessors - -### type - -• `get` **type**(): [`TransactionType`](../enums/TransactionType.md) - -Returns the transaction type. - -Note: legacy txs will return tx type `0`. - -#### Returns - -[`TransactionType`](../enums/TransactionType.md) - -#### Inherited from - -BaseTransaction.type - -#### Defined in - -[tx/src/baseTransaction.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L121) - -## Methods - -### addSignature - -▸ **addSignature**(`v`, `r`, `s`, `convertV?`): [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `v` | `bigint` | `undefined` | -| `r` | `bigint` \| `Uint8Array` | `undefined` | -| `s` | `bigint` \| `Uint8Array` | `undefined` | -| `convertV` | `boolean` | `false` | - -#### Returns - -[`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -#### Overrides - -BaseTransaction.addSignature - -#### Defined in - -[tx/src/eip2930Transaction.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L287) - -___ - -### errorStr - -▸ **errorStr**(): `string` - -Return a compact error string representation of the object - -#### Returns - -`string` - -#### Overrides - -BaseTransaction.errorStr - -#### Defined in - -[tx/src/eip2930Transaction.ts:333](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L333) - -___ - -### getBaseFee - -▸ **getBaseFee**(): `bigint` - -The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) - -#### Returns - -`bigint` - -#### Inherited from - -BaseTransaction.getBaseFee - -#### Defined in - -[tx/src/baseTransaction.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L176) - -___ - -### getDataFee - -▸ **getDataFee**(): `bigint` - -The amount of gas paid for the data in this tx - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getDataFee - -#### Defined in - -[tx/src/eip2930Transaction.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L183) - -___ - -### getEffectivePriorityFee - -▸ **getEffectivePriorityFee**(`baseFee?`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `baseFee?` | `bigint` | - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getEffectivePriorityFee - -#### Defined in - -[tx/src/eip2930Transaction.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L176) - -___ - -### getHashedMessageToSign - -▸ **getHashedMessageToSign**(): `Uint8Array` - -Returns the hashed serialized unsigned tx, which can be used -to sign the transaction (e.g. for sending to a hardware wallet). - -Note: in contrast to the legacy tx the raw message format is already -serialized and doesn't need to be RLP encoded any more. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getHashedMessageToSign - -#### Defined in - -[tx/src/eip2930Transaction.ts:259](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L259) - -___ - -### getMessageToSign - -▸ **getMessageToSign**(): `Uint8Array` - -Returns the raw serialized unsigned tx, which can be used -to sign the transaction (e.g. for sending to a hardware wallet). - -Note: in contrast to the legacy tx the raw message format is already -serialized and doesn't need to be RLP encoded any more. - -```javascript -const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input -``` - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getMessageToSign - -#### Defined in - -[tx/src/eip2930Transaction.ts:248](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L248) - -___ - -### getMessageToVerifySignature - -▸ **getMessageToVerifySignature**(): `Uint8Array` - -Computes a sha3-256 hash which can be used to verify the signature - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getMessageToVerifySignature - -#### Defined in - -[tx/src/eip2930Transaction.ts:276](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L276) - -___ - -### getSenderAddress - -▸ **getSenderAddress**(): `Address` - -Returns the sender's address - -#### Returns - -`Address` - -#### Inherited from - -BaseTransaction.getSenderAddress - -#### Defined in - -[tx/src/baseTransaction.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L279) - -___ - -### getSenderPublicKey - -▸ **getSenderPublicKey**(): `Uint8Array` - -Returns the public key of the sender - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getSenderPublicKey - -#### Defined in - -[tx/src/eip2930Transaction.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L283) - -___ - -### getUpfrontCost - -▸ **getUpfrontCost**(): `bigint` - -The up front amount that an account must have for this transaction to be valid - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getUpfrontCost - -#### Defined in - -[tx/src/eip2930Transaction.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L190) - -___ - -### getValidationErrors - -▸ **getValidationErrors**(): `string`[] - -Validates the transaction signature and minimum gas requirements. - -#### Returns - -`string`[] - -an array of error strings - -#### Inherited from - -BaseTransaction.getValidationErrors - -#### Defined in - -[tx/src/baseTransaction.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L149) - -___ - -### hash - -▸ **hash**(): `Uint8Array` - -Computes a sha3-256 hash of the serialized tx. - -This method can only be used for signed txs (it throws otherwise). -Use [getMessageToSign](AccessListEIP2930Transaction.md#getmessagetosign) to get a tx hash for the purpose of signing. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.hash - -#### Defined in - -[tx/src/eip2930Transaction.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L269) - -___ - -### isSigned - -▸ **isSigned**(): `boolean` - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.isSigned - -#### Defined in - -[tx/src/baseTransaction.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L254) - -___ - -### isValid - -▸ **isValid**(): `boolean` - -Validates the transaction signature and minimum gas requirements. - -#### Returns - -`boolean` - -true if the transaction is valid, false otherwise - -#### Inherited from - -BaseTransaction.isValid - -#### Defined in - -[tx/src/baseTransaction.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L167) - -___ - -### raw - -▸ **raw**(): `AccessListEIP2930TxValuesArray` - -Returns a Uint8Array Array of the raw Bytess of the EIP-2930 transaction, in order. - -Format: `[chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, -signatureYParity (v), signatureR (r), signatureS (s)]` - -Use [serialize](AccessListEIP2930Transaction.md#serialize) to add a transaction to a block -with Block.fromValuesArray. - -For an unsigned tx this method uses the empty Bytes values for the -signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant -representation for external signing use [getMessageToSign](AccessListEIP2930Transaction.md#getmessagetosign). - -#### Returns - -`AccessListEIP2930TxValuesArray` - -#### Overrides - -BaseTransaction.raw - -#### Defined in - -[tx/src/eip2930Transaction.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L207) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -Returns the serialized encoding of the EIP-2930 transaction. - -Format: `0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, -signatureYParity (v), signatureR (r), signatureS (s)])` - -Note that in contrast to the legacy tx serialization format this is not -valid RLP any more due to the raw tx type preceding and concatenated to -the RLP encoding of the values. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.serialize - -#### Defined in - -[tx/src/eip2930Transaction.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L233) - -___ - -### sign - -▸ **sign**(`privateKey`): [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -Signs a transaction. - -Note that the signed tx is returned as a new object, -use as follows: -```javascript -const signedTx = tx.sign(privateKey) -``` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | - -#### Returns - -[`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -#### Inherited from - -BaseTransaction.sign - -#### Defined in - -[tx/src/baseTransaction.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L297) - -___ - -### supports - -▸ **supports**(`capability`): `boolean` - -Checks if a tx type defining capability is active -on a tx, for example the EIP-1559 fee market mechanism -or the EIP-2930 access list feature. - -Note that this is different from the tx type itself, -so EIP-2930 access lists can very well be active -on an EIP-1559 tx for example. - -This method can be useful for feature checks if the -tx type is unknown (e.g. when instantiated with -the tx factory). - -See `Capabilities` in the `types` module for a reference -on all supported capabilities. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.supports - -#### Defined in - -[tx/src/baseTransaction.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L141) - -___ - -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` - -If the tx's `to` is to the creation address - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.toCreationAddress - -#### Defined in - -[tx/src/baseTransaction.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L223) - -___ - -### toJSON - -▸ **toJSON**(): [`JsonTx`](../interfaces/JsonTx.md) - -Returns an object with the JSON representation of the transaction - -#### Returns - -[`JsonTx`](../interfaces/JsonTx.md) - -#### Overrides - -BaseTransaction.toJSON - -#### Defined in - -[tx/src/eip2930Transaction.ts:318](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L318) - -___ - -### verifySignature - -▸ **verifySignature**(): `boolean` - -Determines if the signature is valid - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.verifySignature - -#### Defined in - -[tx/src/baseTransaction.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L266) - -___ - -### fromSerializedTx - -▸ `Static` **fromSerializedTx**(`serialized`, `opts?`): [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -Instantiate a transaction from the serialized tx. - -Format: `0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, -signatureYParity (v), signatureR (r), signatureS (s)])` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `serialized` | `Uint8Array` | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -#### Defined in - -[tx/src/eip2930Transaction.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L68) - -___ - -### fromTxData - -▸ `Static` **fromTxData**(`txData`, `opts?`): [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -Instantiate a transaction from a data dictionary. - -Format: { chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, -v, r, s } - -Notes: -- `chainId` will be set automatically if not provided -- All parameters are optional and have some basic default values - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`AccessListEIP2930TxData`](../interfaces/AccessListEIP2930TxData.md) | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -#### Defined in - -[tx/src/eip2930Transaction.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L58) - -___ - -### fromValuesArray - -▸ `Static` **fromValuesArray**(`values`, `opts?`): [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -Create a transaction from a values array. - -Format: `[chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, -signatureYParity (v), signatureR (r), signatureS (s)]` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `values` | `AccessListEIP2930TxValuesArray` | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) - -#### Defined in - -[tx/src/eip2930Transaction.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip2930Transaction.ts#L95) diff --git a/packages/tx/docs/classes/Blob4844Tx.md b/packages/tx/docs/classes/Blob4844Tx.md new file mode 100644 index 00000000000..50627b08445 --- /dev/null +++ b/packages/tx/docs/classes/Blob4844Tx.md @@ -0,0 +1,758 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / Blob4844Tx + +# Class: Blob4844Tx + +Defined in: [4844/tx.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L51) + +Typed transaction with a new gas fee market mechanism for transactions that include "blobs" of data + +- TransactionType: 3 +- EIP: [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) + +## Implements + +- [`TransactionInterface`](../interfaces/TransactionInterface.md)\<*typeof* [`BlobEIP4844`](../variables/TransactionType.md#blobeip4844)\> + +## Constructors + +### Constructor + +> **new Blob4844Tx**(`txData`, `opts`): `Blob4844Tx` + +Defined in: [4844/tx.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L98) + +This constructor takes the values, validates them, assigns them and freezes the object. + +It is not recommended to use this constructor directly. Instead use +the static constructors or factory methods to assist in creating a Transaction object from +varying data types. + +#### Parameters + +##### txData + +[`BlobEIP4844TxData`](../interfaces/BlobEIP4844TxData.md) + +##### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +#### Returns + +`Blob4844Tx` + +## Properties + +### accessList + +> `readonly` **accessList**: [`AccessListBytes`](../type-aliases/AccessListBytes.md) + +Defined in: [4844/tx.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L60) + +*** + +### blobs? + +> `optional` **blobs**: `` `0x${string}` ``[] + +Defined in: [4844/tx.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L74) + +*** + +### blobVersionedHashes + +> **blobVersionedHashes**: `` `0x${string}` ``[] + +Defined in: [4844/tx.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L65) + +*** + +### cache + +> `readonly` **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) = `{}` + +Defined in: [4844/tx.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L82) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`cache`](../interfaces/TransactionInterface.md#cache) + +*** + +### chainId + +> `readonly` **chainId**: `bigint` + +Defined in: [4844/tx.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L61) + +*** + +### common + +> `readonly` **common**: `Common` + +Defined in: [4844/tx.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L78) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`common`](../interfaces/TransactionInterface.md#common) + +*** + +### data + +> `readonly` **data**: `Uint8Array` + +Defined in: [4844/tx.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L58) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`data`](../interfaces/TransactionInterface.md#data) + +*** + +### gasLimit + +> `readonly` **gasLimit**: `bigint` + +Defined in: [4844/tx.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L56) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`gasLimit`](../interfaces/TransactionInterface.md#gaslimit) + +*** + +### kzgCommitments? + +> `optional` **kzgCommitments**: `` `0x${string}` ``[] + +Defined in: [4844/tx.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L75) + +*** + +### kzgProofs? + +> `optional` **kzgProofs**: `` `0x${string}` ``[] + +Defined in: [4844/tx.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L76) + +*** + +### maxFeePerBlobGas + +> `readonly` **maxFeePerBlobGas**: `bigint` + +Defined in: [4844/tx.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L64) + +*** + +### maxFeePerGas + +> `readonly` **maxFeePerGas**: `bigint` + +Defined in: [4844/tx.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L63) + +*** + +### maxPriorityFeePerGas + +> `readonly` **maxPriorityFeePerGas**: `bigint` + +Defined in: [4844/tx.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L62) + +*** + +### nonce + +> `readonly` **nonce**: `bigint` + +Defined in: [4844/tx.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L55) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`nonce`](../interfaces/TransactionInterface.md#nonce) + +*** + +### r? + +> `readonly` `optional` **r**: `bigint` + +Defined in: [4844/tx.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L69) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`r`](../interfaces/TransactionInterface.md#r) + +*** + +### s? + +> `readonly` `optional` **s**: `bigint` + +Defined in: [4844/tx.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L70) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`s`](../interfaces/TransactionInterface.md#s) + +*** + +### to? + +> `readonly` `optional` **to**: `Address` + +Defined in: [4844/tx.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L59) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`to`](../interfaces/TransactionInterface.md#to) + +*** + +### txOptions + +> `readonly` **txOptions**: [`TxOptions`](../interfaces/TxOptions.md) + +Defined in: [4844/tx.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L80) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`txOptions`](../interfaces/TransactionInterface.md#txoptions) + +*** + +### type + +> **type**: `3` = `TransactionType.BlobEIP4844` + +Defined in: [4844/tx.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L52) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`type`](../interfaces/TransactionInterface.md#type) + +*** + +### v? + +> `readonly` `optional` **v**: `bigint` + +Defined in: [4844/tx.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L68) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`v`](../interfaces/TransactionInterface.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [4844/tx.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L57) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`value`](../interfaces/TransactionInterface.md#value) + +## Methods + +### addSignature() + +> **addSignature**(`v`, `r`, `s`): `Blob4844Tx` + +Defined in: [4844/tx.ts:398](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L398) + +#### Parameters + +##### v + +`bigint` + +##### r + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +##### s + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`Blob4844Tx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`addSignature`](../interfaces/TransactionInterface.md#addsignature) + +*** + +### errorStr() + +> **errorStr**(): `string` + +Defined in: [4844/tx.ts:459](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L459) + +Return a compact error string representation of the object + +#### Returns + +`string` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`errorStr`](../interfaces/TransactionInterface.md#errorstr) + +*** + +### getDataGas() + +> **getDataGas**(): `bigint` + +Defined in: [4844/tx.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L242) + +The amount of gas paid for the data in this tx + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getDataGas`](../interfaces/TransactionInterface.md#getdatagas) + +*** + +### getEffectivePriorityFee() + +> **getEffectivePriorityFee**(`baseFee`): `bigint` + +Defined in: [4844/tx.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L235) + +Returns the minimum of calculated priority fee (from maxFeePerGas and baseFee) and maxPriorityFeePerGas + +#### Parameters + +##### baseFee + +`bigint` + +Base fee retrieved from block + +#### Returns + +`bigint` + +*** + +### getHashedMessageToSign() + +> **getHashedMessageToSign**(): `Uint8Array` + +Defined in: [4844/tx.ts:358](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L358) + +Returns the hashed serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: in contrast to the legacy tx the raw message format is already +serialized and doesn't need to be RLP encoded any more. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getHashedMessageToSign`](../interfaces/TransactionInterface.md#gethashedmessagetosign) + +*** + +### getIntrinsicGas() + +> **getIntrinsicGas**(): `bigint` + +Defined in: [4844/tx.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L269) + +The minimum gas limit which the tx to have to be valid. +This covers costs as the standard fee (21000 gas), the data fee (paid for each calldata byte), +the optional creation fee (if the transaction creates a contract), and if relevant the gas +to be paid for access lists (EIP-2930) and authority lists (EIP-7702). + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getIntrinsicGas`](../interfaces/TransactionInterface.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array` + +Defined in: [4844/tx.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L347) + +Returns the raw serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: in contrast to the legacy tx the raw message format is already +serialized and doesn't need to be RLP encoded any more. + +```javascript +const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input +``` + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToSign`](../interfaces/TransactionInterface.md#getmessagetosign) + +*** + +### getMessageToVerifySignature() + +> **getMessageToVerifySignature**(): `Uint8Array` + +Defined in: [4844/tx.ts:372](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L372) + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToVerifySignature`](../interfaces/TransactionInterface.md#getmessagetoverifysignature) + +*** + +### getSenderAddress() + +> **getSenderAddress**(): `Address` + +Defined in: [4844/tx.ts:439](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L439) + +#### Returns + +`Address` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderAddress`](../interfaces/TransactionInterface.md#getsenderaddress) + +*** + +### getSenderPublicKey() + +> **getSenderPublicKey**(): `Uint8Array` + +Defined in: [4844/tx.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L379) + +Returns the public key of the sender + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderPublicKey`](../interfaces/TransactionInterface.md#getsenderpublickey) + +*** + +### getUpfrontCost() + +> **getUpfrontCost**(`baseFee`): `bigint` + +Defined in: [4844/tx.ts:250](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L250) + +The up front amount that an account must have for this transaction to be valid + +#### Parameters + +##### baseFee + +`bigint` = `BIGINT_0` + +The base fee of the block (will be set to 0 if not provided) + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getUpfrontCost`](../interfaces/TransactionInterface.md#getupfrontcost) + +*** + +### getValidationErrors() + +> **getValidationErrors**(): `string`[] + +Defined in: [4844/tx.ts:427](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L427) + +#### Returns + +`string`[] + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getValidationErrors`](../interfaces/TransactionInterface.md#getvalidationerrors) + +*** + +### hash() + +> **hash**(): `Uint8Array` + +Defined in: [4844/tx.ts:368](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L368) + +Computes a sha3-256 hash of the serialized tx. + +This method can only be used for signed txs (it throws otherwise). +Use [Blob4844Tx.getMessageToSign](#getmessagetosign) to get a tx hash for the purpose of signing. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`hash`](../interfaces/TransactionInterface.md#hash) + +*** + +### isSigned() + +> **isSigned**(): `boolean` + +Defined in: [4844/tx.ts:447](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L447) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isSigned`](../interfaces/TransactionInterface.md#issigned) + +*** + +### isValid() + +> **isValid**(): `boolean` + +Defined in: [4844/tx.ts:431](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L431) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isValid`](../interfaces/TransactionInterface.md#isvalid) + +*** + +### numBlobs() + +> **numBlobs**(): `number` + +Defined in: [4844/tx.ts:468](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L468) + +#### Returns + +`number` + +the number of blobs included with this transaction + +*** + +### raw() + +> **raw**(): `BlobEIP4844TxValuesArray` + +Defined in: [4844/tx.ts:286](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L286) + +Returns a Uint8Array Array of the raw Bytes of the EIP-4844 transaction, in order. + +Format: [chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, +access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s]`. + +Use [Blob4844Tx.serialize](#serialize) to add a transaction to a block +with createBlockFromBytesArray. + +For an unsigned tx this method uses the empty Bytes values for the +signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant +representation for external signing use [Blob4844Tx.getMessageToSign](#getmessagetosign). + +#### Returns + +`BlobEIP4844TxValuesArray` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`raw`](../interfaces/TransactionInterface.md#raw) + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [4844/tx.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L315) + +Returns the serialized encoding of the EIP-4844 transaction. + +Format: `0x03 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s])`. + +Note that in contrast to the legacy tx serialization format this is not +valid RLP any more due to the raw tx type preceding and concatenated to +the RLP encoding of the values. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`serialize`](../interfaces/TransactionInterface.md#serialize) + +*** + +### serializeNetworkWrapper() + +> **serializeNetworkWrapper**(): `Uint8Array` + +Defined in: [4844/tx.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L322) + +#### Returns + +`Uint8Array` + +the serialized form of a blob transaction in the network wrapper format (used for gossipping mempool transactions over devp2p) + +*** + +### sign() + +> **sign**(`privateKey`, `extraEntropy`): `Blob4844Tx` + +Defined in: [4844/tx.ts:443](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L443) + +#### Parameters + +##### privateKey + +`Uint8Array` + +##### extraEntropy + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`Blob4844Tx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`sign`](../interfaces/TransactionInterface.md#sign) + +*** + +### supports() + +> **supports**(`capability`): `boolean` + +Defined in: [4844/tx.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L227) + +Checks if a tx type defining capability is active +on a tx, for example the EIP-1559 fee market mechanism +or the EIP-2930 access list feature. + +Note that this is different from the tx type itself, +so EIP-2930 access lists can very well be active +on an EIP-1559 tx for example. + +This method can be useful for feature checks if the +tx type is unknown (e.g. when instantiated with +the tx factory). + +See `Capabilities` in the `types` module for a reference +on all supported capabilities. + +#### Parameters + +##### capability + +`number` + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`supports`](../interfaces/TransactionInterface.md#supports) + +*** + +### toCreationAddress() + +> **toCreationAddress**(): `boolean` + +Defined in: [4844/tx.ts:259](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L259) + +If the tx's `to` is to the creation address + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toCreationAddress`](../interfaces/TransactionInterface.md#tocreationaddress) + +*** + +### toJSON() + +> **toJSON**(): [`JSONTx`](../interfaces/JSONTx.md) + +Defined in: [4844/tx.ts:383](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L383) + +#### Returns + +[`JSONTx`](../interfaces/JSONTx.md) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toJSON`](../interfaces/TransactionInterface.md#tojson) + +*** + +### verifySignature() + +> **verifySignature**(): `boolean` + +Defined in: [4844/tx.ts:435](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/tx.ts#L435) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`verifySignature`](../interfaces/TransactionInterface.md#verifysignature) diff --git a/packages/tx/docs/classes/BlobEIP4844Transaction.md b/packages/tx/docs/classes/BlobEIP4844Transaction.md deleted file mode 100644 index a0df79aa7ca..00000000000 --- a/packages/tx/docs/classes/BlobEIP4844Transaction.md +++ /dev/null @@ -1,1044 +0,0 @@ -[@ethereumjs/tx](../README.md) / BlobEIP4844Transaction - -# Class: BlobEIP4844Transaction - -Typed transaction with a new gas fee market mechanism for transactions that include "blobs" of data - -- TransactionType: 3 -- EIP: [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) - -## Hierarchy - -- `BaseTransaction`<[`BlobEIP4844`](../enums/TransactionType.md#blobeip4844)\> - - ↳ **`BlobEIP4844Transaction`** - -## Table of contents - -### Constructors - -- [constructor](BlobEIP4844Transaction.md#constructor) - -### Properties - -- [AccessListJSON](BlobEIP4844Transaction.md#accesslistjson) -- [accessList](BlobEIP4844Transaction.md#accesslist) -- [blobVersionedHashes](BlobEIP4844Transaction.md#blobversionedhashes) -- [blobs](BlobEIP4844Transaction.md#blobs) -- [cache](BlobEIP4844Transaction.md#cache) -- [chainId](BlobEIP4844Transaction.md#chainid) -- [common](BlobEIP4844Transaction.md#common) -- [data](BlobEIP4844Transaction.md#data) -- [gasLimit](BlobEIP4844Transaction.md#gaslimit) -- [kzgCommitments](BlobEIP4844Transaction.md#kzgcommitments) -- [kzgProofs](BlobEIP4844Transaction.md#kzgproofs) -- [maxFeePerBlobGas](BlobEIP4844Transaction.md#maxfeeperblobgas) -- [maxFeePerGas](BlobEIP4844Transaction.md#maxfeepergas) -- [maxPriorityFeePerGas](BlobEIP4844Transaction.md#maxpriorityfeepergas) -- [nonce](BlobEIP4844Transaction.md#nonce) -- [r](BlobEIP4844Transaction.md#r) -- [s](BlobEIP4844Transaction.md#s) -- [to](BlobEIP4844Transaction.md#to) -- [v](BlobEIP4844Transaction.md#v) -- [value](BlobEIP4844Transaction.md#value) - -### Accessors - -- [type](BlobEIP4844Transaction.md#type) - -### Methods - -- [addSignature](BlobEIP4844Transaction.md#addsignature) -- [errorStr](BlobEIP4844Transaction.md#errorstr) -- [getBaseFee](BlobEIP4844Transaction.md#getbasefee) -- [getDataFee](BlobEIP4844Transaction.md#getdatafee) -- [getEffectivePriorityFee](BlobEIP4844Transaction.md#geteffectivepriorityfee) -- [getHashedMessageToSign](BlobEIP4844Transaction.md#gethashedmessagetosign) -- [getMessageToSign](BlobEIP4844Transaction.md#getmessagetosign) -- [getMessageToVerifySignature](BlobEIP4844Transaction.md#getmessagetoverifysignature) -- [getSenderAddress](BlobEIP4844Transaction.md#getsenderaddress) -- [getSenderPublicKey](BlobEIP4844Transaction.md#getsenderpublickey) -- [getUpfrontCost](BlobEIP4844Transaction.md#getupfrontcost) -- [getValidationErrors](BlobEIP4844Transaction.md#getvalidationerrors) -- [hash](BlobEIP4844Transaction.md#hash) -- [isSigned](BlobEIP4844Transaction.md#issigned) -- [isValid](BlobEIP4844Transaction.md#isvalid) -- [numBlobs](BlobEIP4844Transaction.md#numblobs) -- [raw](BlobEIP4844Transaction.md#raw) -- [serialize](BlobEIP4844Transaction.md#serialize) -- [serializeNetworkWrapper](BlobEIP4844Transaction.md#serializenetworkwrapper) -- [sign](BlobEIP4844Transaction.md#sign) -- [supports](BlobEIP4844Transaction.md#supports) -- [toCreationAddress](BlobEIP4844Transaction.md#tocreationaddress) -- [toJSON](BlobEIP4844Transaction.md#tojson) -- [verifySignature](BlobEIP4844Transaction.md#verifysignature) -- [fromSerializedBlobTxNetworkWrapper](BlobEIP4844Transaction.md#fromserializedblobtxnetworkwrapper) -- [fromSerializedTx](BlobEIP4844Transaction.md#fromserializedtx) -- [fromTxData](BlobEIP4844Transaction.md#fromtxdata) -- [fromValuesArray](BlobEIP4844Transaction.md#fromvaluesarray) -- [minimalFromNetworkWrapper](BlobEIP4844Transaction.md#minimalfromnetworkwrapper) - -## Constructors - -### constructor - -• **new BlobEIP4844Transaction**(`txData`, `opts?`) - -This constructor takes the values, validates them, assigns them and freezes the object. - -It is not recommended to use this constructor directly. Instead use -the static constructors or factory methods to assist in creating a Transaction object from -varying data types. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`BlobEIP4844TxData`](../interfaces/BlobEIP4844TxData.md) | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Overrides - -BaseTransaction<TransactionType.BlobEIP4844\>.constructor - -#### Defined in - -[tx/src/eip4844Transaction.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L104) - -## Properties - -### AccessListJSON - -• `Readonly` **AccessListJSON**: [`AccessList`](../README.md#accesslist) - -#### Defined in - -[tx/src/eip4844Transaction.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L86) - -___ - -### accessList - -• `Readonly` **accessList**: [`AccessListBytes`](../README.md#accesslistbytes) - -#### Defined in - -[tx/src/eip4844Transaction.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L85) - -___ - -### blobVersionedHashes - -• **blobVersionedHashes**: `Uint8Array`[] - -#### Defined in - -[tx/src/eip4844Transaction.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L92) - -___ - -### blobs - -• `Optional` **blobs**: `Uint8Array`[] - -#### Defined in - -[tx/src/eip4844Transaction.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L93) - -___ - -### cache - -• **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) - -#### Inherited from - -BaseTransaction.cache - -#### Defined in - -[tx/src/baseTransaction.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L54) - -___ - -### chainId - -• `Readonly` **chainId**: `bigint` - -#### Defined in - -[tx/src/eip4844Transaction.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L84) - -___ - -### common - -• `Readonly` **common**: `Common` - -#### Overrides - -BaseTransaction.common - -#### Defined in - -[tx/src/eip4844Transaction.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L91) - -___ - -### data - -• `Readonly` **data**: `Uint8Array` - -#### Inherited from - -BaseTransaction.data - -#### Defined in - -[tx/src/baseTransaction.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L46) - -___ - -### gasLimit - -• `Readonly` **gasLimit**: `bigint` - -#### Inherited from - -BaseTransaction.gasLimit - -#### Defined in - -[tx/src/baseTransaction.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L43) - -___ - -### kzgCommitments - -• `Optional` **kzgCommitments**: `Uint8Array`[] - -#### Defined in - -[tx/src/eip4844Transaction.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L94) - -___ - -### kzgProofs - -• `Optional` **kzgProofs**: `Uint8Array`[] - -#### Defined in - -[tx/src/eip4844Transaction.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L95) - -___ - -### maxFeePerBlobGas - -• `Readonly` **maxFeePerBlobGas**: `bigint` - -#### Defined in - -[tx/src/eip4844Transaction.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L89) - -___ - -### maxFeePerGas - -• `Readonly` **maxFeePerGas**: `bigint` - -#### Defined in - -[tx/src/eip4844Transaction.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L88) - -___ - -### maxPriorityFeePerGas - -• `Readonly` **maxPriorityFeePerGas**: `bigint` - -#### Defined in - -[tx/src/eip4844Transaction.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L87) - -___ - -### nonce - -• `Readonly` **nonce**: `bigint` - -#### Inherited from - -BaseTransaction.nonce - -#### Defined in - -[tx/src/baseTransaction.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L42) - -___ - -### r - -• `Optional` `Readonly` **r**: `bigint` - -#### Inherited from - -BaseTransaction.r - -#### Defined in - -[tx/src/baseTransaction.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L49) - -___ - -### s - -• `Optional` `Readonly` **s**: `bigint` - -#### Inherited from - -BaseTransaction.s - -#### Defined in - -[tx/src/baseTransaction.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L50) - -___ - -### to - -• `Optional` `Readonly` **to**: `Address` - -#### Inherited from - -BaseTransaction.to - -#### Defined in - -[tx/src/baseTransaction.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L44) - -___ - -### v - -• `Optional` `Readonly` **v**: `bigint` - -#### Inherited from - -BaseTransaction.v - -#### Defined in - -[tx/src/baseTransaction.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L48) - -___ - -### value - -• `Readonly` **value**: `bigint` - -#### Inherited from - -BaseTransaction.value - -#### Defined in - -[tx/src/baseTransaction.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L45) - -## Accessors - -### type - -• `get` **type**(): [`TransactionType`](../enums/TransactionType.md) - -Returns the transaction type. - -Note: legacy txs will return tx type `0`. - -#### Returns - -[`TransactionType`](../enums/TransactionType.md) - -#### Inherited from - -BaseTransaction.type - -#### Defined in - -[tx/src/baseTransaction.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L121) - -## Methods - -### addSignature - -▸ **addSignature**(`v`, `r`, `s`, `convertV?`): [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `v` | `bigint` | `undefined` | -| `r` | `bigint` \| `Uint8Array` | `undefined` | -| `s` | `bigint` \| `Uint8Array` | `undefined` | -| `convertV` | `boolean` | `false` | - -#### Returns - -[`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -#### Overrides - -BaseTransaction.addSignature - -#### Defined in - -[tx/src/eip4844Transaction.ts:558](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L558) - -___ - -### errorStr - -▸ **errorStr**(): `string` - -Return a compact error string representation of the object - -#### Returns - -`string` - -#### Overrides - -BaseTransaction.errorStr - -#### Defined in - -[tx/src/eip4844Transaction.ts:594](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L594) - -___ - -### getBaseFee - -▸ **getBaseFee**(): `bigint` - -The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) - -#### Returns - -`bigint` - -#### Inherited from - -BaseTransaction.getBaseFee - -#### Defined in - -[tx/src/baseTransaction.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L176) - -___ - -### getDataFee - -▸ **getDataFee**(): `bigint` - -The amount of gas paid for the data in this tx - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getDataFee - -#### Defined in - -[tx/src/eip4844Transaction.ts:421](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L421) - -___ - -### getEffectivePriorityFee - -▸ **getEffectivePriorityFee**(`baseFee`): `bigint` - -Returns the minimum of calculated priority fee (from maxFeePerGas and baseFee) and maxPriorityFeePerGas - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `baseFee` | `bigint` | Base fee retrieved from block | - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getEffectivePriorityFee - -#### Defined in - -[tx/src/eip4844Transaction.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L224) - -___ - -### getHashedMessageToSign - -▸ **getHashedMessageToSign**(): `Uint8Array` - -Returns the hashed serialized unsigned tx, which can be used -to sign the transaction (e.g. for sending to a hardware wallet). - -Note: in contrast to the legacy tx the raw message format is already -serialized and doesn't need to be RLP encoded any more. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getHashedMessageToSign - -#### Defined in - -[tx/src/eip4844Transaction.ts:518](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L518) - -___ - -### getMessageToSign - -▸ **getMessageToSign**(): `Uint8Array` - -Returns the raw serialized unsigned tx, which can be used -to sign the transaction (e.g. for sending to a hardware wallet). - -Note: in contrast to the legacy tx the raw message format is already -serialized and doesn't need to be RLP encoded any more. - -```javascript -const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input -``` - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getMessageToSign - -#### Defined in - -[tx/src/eip4844Transaction.ts:507](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L507) - -___ - -### getMessageToVerifySignature - -▸ **getMessageToVerifySignature**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getMessageToVerifySignature - -#### Defined in - -[tx/src/eip4844Transaction.ts:532](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L532) - -___ - -### getSenderAddress - -▸ **getSenderAddress**(): `Address` - -Returns the sender's address - -#### Returns - -`Address` - -#### Inherited from - -BaseTransaction.getSenderAddress - -#### Defined in - -[tx/src/baseTransaction.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L279) - -___ - -### getSenderPublicKey - -▸ **getSenderPublicKey**(): `Uint8Array` - -Returns the public key of the sender - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getSenderPublicKey - -#### Defined in - -[tx/src/eip4844Transaction.ts:539](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L539) - -___ - -### getUpfrontCost - -▸ **getUpfrontCost**(`baseFee?`): `bigint` - -The up front amount that an account must have for this transaction to be valid - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `baseFee` | `bigint` | `BIGINT_0` | The base fee of the block (will be set to 0 if not provided) | - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getUpfrontCost - -#### Defined in - -[tx/src/eip4844Transaction.ts:429](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L429) - -___ - -### getValidationErrors - -▸ **getValidationErrors**(): `string`[] - -Validates the transaction signature and minimum gas requirements. - -#### Returns - -`string`[] - -an array of error strings - -#### Inherited from - -BaseTransaction.getValidationErrors - -#### Defined in - -[tx/src/baseTransaction.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L149) - -___ - -### hash - -▸ **hash**(): `Uint8Array` - -Computes a sha3-256 hash of the serialized tx. - -This method can only be used for signed txs (it throws otherwise). -Use [getMessageToSign](BlobEIP4844Transaction.md#getmessagetosign) to get a tx hash for the purpose of signing. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.hash - -#### Defined in - -[tx/src/eip4844Transaction.ts:528](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L528) - -___ - -### isSigned - -▸ **isSigned**(): `boolean` - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.isSigned - -#### Defined in - -[tx/src/baseTransaction.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L254) - -___ - -### isValid - -▸ **isValid**(): `boolean` - -Validates the transaction signature and minimum gas requirements. - -#### Returns - -`boolean` - -true if the transaction is valid, false otherwise - -#### Inherited from - -BaseTransaction.isValid - -#### Defined in - -[tx/src/baseTransaction.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L167) - -___ - -### numBlobs - -▸ **numBlobs**(): `number` - -#### Returns - -`number` - -the number of blobs included with this transaction - -#### Defined in - -[tx/src/eip4844Transaction.ts:613](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L613) - -___ - -### raw - -▸ **raw**(): `BlobEIP4844TxValuesArray` - -Returns a Uint8Array Array of the raw Bytes of the EIP-4844 transaction, in order. - -Format: [chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, -access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s]`. - -Use {@link BlobEIP4844Transaction.serialize} to add a transaction to a block -with {@link Block.fromValuesArray}. - -For an unsigned tx this method uses the empty Bytes values for the -signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant -representation for external signing use [getMessageToSign](BlobEIP4844Transaction.md#getmessagetosign). - -#### Returns - -`BlobEIP4844TxValuesArray` - -#### Overrides - -BaseTransaction.raw - -#### Defined in - -[tx/src/eip4844Transaction.ts:446](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L446) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -Returns the serialized encoding of the EIP-4844 transaction. - -Format: `0x03 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, -access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s])`. - -Note that in contrast to the legacy tx serialization format this is not -valid RLP any more due to the raw tx type preceding and concatenated to -the RLP encoding of the values. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.serialize - -#### Defined in - -[tx/src/eip4844Transaction.ts:475](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L475) - -___ - -### serializeNetworkWrapper - -▸ **serializeNetworkWrapper**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -the serialized form of a blob transaction in the network wrapper format (used for gossipping mempool transactions over devp2p) - -#### Defined in - -[tx/src/eip4844Transaction.ts:482](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L482) - -___ - -### sign - -▸ **sign**(`privateKey`): [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -Signs a transaction. - -Note that the signed tx is returned as a new object, -use as follows: -```javascript -const signedTx = tx.sign(privateKey) -``` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | - -#### Returns - -[`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -#### Inherited from - -BaseTransaction.sign - -#### Defined in - -[tx/src/baseTransaction.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L297) - -___ - -### supports - -▸ **supports**(`capability`): `boolean` - -Checks if a tx type defining capability is active -on a tx, for example the EIP-1559 fee market mechanism -or the EIP-2930 access list feature. - -Note that this is different from the tx type itself, -so EIP-2930 access lists can very well be active -on an EIP-1559 tx for example. - -This method can be useful for feature checks if the -tx type is unknown (e.g. when instantiated with -the tx factory). - -See `Capabilities` in the `types` module for a reference -on all supported capabilities. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.supports - -#### Defined in - -[tx/src/baseTransaction.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L141) - -___ - -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` - -If the tx's `to` is to the creation address - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.toCreationAddress - -#### Defined in - -[tx/src/baseTransaction.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L223) - -___ - -### toJSON - -▸ **toJSON**(): [`JsonTx`](../interfaces/JsonTx.md) - -#### Returns - -[`JsonTx`](../interfaces/JsonTx.md) - -#### Overrides - -BaseTransaction.toJSON - -#### Defined in - -[tx/src/eip4844Transaction.ts:543](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L543) - -___ - -### verifySignature - -▸ **verifySignature**(): `boolean` - -Determines if the signature is valid - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.verifySignature - -#### Defined in - -[tx/src/baseTransaction.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L266) - -___ - -### fromSerializedBlobTxNetworkWrapper - -▸ `Static` **fromSerializedBlobTxNetworkWrapper**(`serialized`, `opts?`): [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -Creates a transaction from the network encoding of a blob transaction (with blobs/commitments/proof) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `serialized` | `Uint8Array` | a buffer representing a serialized BlobTransactionNetworkWrapper | -| `opts?` | [`TxOptions`](../interfaces/TxOptions.md) | any TxOptions defined | - -#### Returns - -[`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -a BlobEIP4844Transaction - -#### Defined in - -[tx/src/eip4844Transaction.ts:358](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L358) - -___ - -### fromSerializedTx - -▸ `Static` **fromSerializedTx**(`serialized`, `opts?`): [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -Instantiate a transaction from the serialized tx. - -Format: `0x03 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, -access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s])` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `serialized` | `Uint8Array` | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -#### Defined in - -[tx/src/eip4844Transaction.ts:259](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L259) - -___ - -### fromTxData - -▸ `Static` **fromTxData**(`txData`, `opts?`): [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`BlobEIP4844TxData`](../interfaces/BlobEIP4844TxData.md) | -| `opts?` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -#### Defined in - -[tx/src/eip4844Transaction.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L192) - -___ - -### fromValuesArray - -▸ `Static` **fromValuesArray**(`values`, `opts?`): [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -Create a transaction from a values array. - -Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, -accessList, signatureYParity, signatureR, signatureS]` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `values` | `BlobEIP4844TxValuesArray` | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -#### Defined in - -[tx/src/eip4844Transaction.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L289) - -___ - -### minimalFromNetworkWrapper - -▸ `Static` **minimalFromNetworkWrapper**(`txData`, `opts?`): [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -Creates the minimal representation of a blob transaction from the network wrapper version. -The minimal representation is used when adding transactions to an execution payload/block - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `txData` | [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) | a [BlobEIP4844Transaction](BlobEIP4844Transaction.md) containing optional blobs/kzg commitments | -| `opts?` | [`TxOptions`](../interfaces/TxOptions.md) | dictionary of [TxOptions](../interfaces/TxOptions.md) | - -#### Returns - -[`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -the "minimal" representation of a BlobEIP4844Transaction (i.e. transaction object minus blobs and kzg commitments) - -#### Defined in - -[tx/src/eip4844Transaction.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L235) diff --git a/packages/tx/docs/classes/EOACode7702Tx.md b/packages/tx/docs/classes/EOACode7702Tx.md new file mode 100644 index 00000000000..f75ac394660 --- /dev/null +++ b/packages/tx/docs/classes/EOACode7702Tx.md @@ -0,0 +1,702 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / EOACode7702Tx + +# Class: EOACode7702Tx + +Defined in: [7702/tx.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L54) + +Typed transaction with the ability to set codes on EOA accounts + +- TransactionType: 4 +- EIP: [EIP-7702](https://github.com/ethereum/EIPs/blob/62419ca3f45375db00b04a368ea37c0bfb05386a/EIPS/eip-7702.md) + +## Implements + +- [`TransactionInterface`](../interfaces/TransactionInterface.md)\<*typeof* [`EOACodeEIP7702`](../variables/TransactionType.md#eoacodeeip7702)\> + +## Constructors + +### Constructor + +> **new EOACode7702Tx**(`txData`, `opts`): `EOACode7702Tx` + +Defined in: [7702/tx.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L96) + +This constructor takes the values, validates them, assigns them and freezes the object. + +It is not recommended to use this constructor directly. Instead use +the static factory methods to assist in creating a Transaction object from +varying data types. + +#### Parameters + +##### txData + +[`EOACode7702TxData`](../interfaces/EOACode7702TxData.md) + +##### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +#### Returns + +`EOACode7702Tx` + +## Properties + +### accessList + +> `readonly` **accessList**: [`AccessListBytes`](../type-aliases/AccessListBytes.md) + +Defined in: [7702/tx.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L63) + +*** + +### authorizationList + +> `readonly` **authorizationList**: [`AuthorizationListBytes`](../type-aliases/AuthorizationListBytes.md) + +Defined in: [7702/tx.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L64) + +*** + +### cache + +> `readonly` **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) = `{}` + +Defined in: [7702/tx.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L80) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`cache`](../interfaces/TransactionInterface.md#cache) + +*** + +### chainId + +> `readonly` **chainId**: `bigint` + +Defined in: [7702/tx.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L65) + +*** + +### common + +> `readonly` **common**: `Common` + +Defined in: [7702/tx.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L76) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`common`](../interfaces/TransactionInterface.md#common) + +*** + +### data + +> `readonly` **data**: `Uint8Array` + +Defined in: [7702/tx.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L61) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`data`](../interfaces/TransactionInterface.md#data) + +*** + +### gasLimit + +> `readonly` **gasLimit**: `bigint` + +Defined in: [7702/tx.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L59) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`gasLimit`](../interfaces/TransactionInterface.md#gaslimit) + +*** + +### maxFeePerGas + +> `readonly` **maxFeePerGas**: `bigint` + +Defined in: [7702/tx.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L67) + +*** + +### maxPriorityFeePerGas + +> `readonly` **maxPriorityFeePerGas**: `bigint` + +Defined in: [7702/tx.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L66) + +*** + +### nonce + +> `readonly` **nonce**: `bigint` + +Defined in: [7702/tx.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L58) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`nonce`](../interfaces/TransactionInterface.md#nonce) + +*** + +### r? + +> `readonly` `optional` **r**: `bigint` + +Defined in: [7702/tx.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L71) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`r`](../interfaces/TransactionInterface.md#r) + +*** + +### s? + +> `readonly` `optional` **s**: `bigint` + +Defined in: [7702/tx.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L72) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`s`](../interfaces/TransactionInterface.md#s) + +*** + +### to? + +> `readonly` `optional` **to**: `Address` + +Defined in: [7702/tx.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L62) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`to`](../interfaces/TransactionInterface.md#to) + +*** + +### txOptions + +> `readonly` **txOptions**: [`TxOptions`](../interfaces/TxOptions.md) + +Defined in: [7702/tx.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L78) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`txOptions`](../interfaces/TransactionInterface.md#txoptions) + +*** + +### type + +> **type**: `4` = `TransactionType.EOACodeEIP7702` + +Defined in: [7702/tx.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L55) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`type`](../interfaces/TransactionInterface.md#type) + +*** + +### v? + +> `readonly` `optional` **v**: `bigint` + +Defined in: [7702/tx.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L70) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`v`](../interfaces/TransactionInterface.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [7702/tx.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L60) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`value`](../interfaces/TransactionInterface.md#value) + +## Methods + +### addSignature() + +> **addSignature**(`v`, `r`, `s`): `EOACode7702Tx` + +Defined in: [7702/tx.ts:331](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L331) + +#### Parameters + +##### v + +`bigint` + +##### r + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +##### s + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`EOACode7702Tx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`addSignature`](../interfaces/TransactionInterface.md#addsignature) + +*** + +### errorStr() + +> **errorStr**(): `string` + +Defined in: [7702/tx.ts:409](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L409) + +Return a compact error string representation of the object + +#### Returns + +`string` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`errorStr`](../interfaces/TransactionInterface.md#errorstr) + +*** + +### getDataGas() + +> **getDataGas**(): `bigint` + +Defined in: [7702/tx.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L198) + +The amount of gas paid for the data in this tx + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getDataGas`](../interfaces/TransactionInterface.md#getdatagas) + +*** + +### getEffectivePriorityFee() + +> **getEffectivePriorityFee**(`baseFee`): `bigint` + +Defined in: [7702/tx.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L206) + +Returns the minimum of calculated priority fee (from maxFeePerGas and baseFee) and maxPriorityFeePerGas + +#### Parameters + +##### baseFee + +`bigint` + +Base fee retrieved from block + +#### Returns + +`bigint` + +*** + +### getHashedMessageToSign() + +> **getHashedMessageToSign**(): `Uint8Array` + +Defined in: [7702/tx.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L303) + +Returns the hashed serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: in contrast to the legacy tx the raw message format is already +serialized and doesn't need to be RLP encoded any more. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getHashedMessageToSign`](../interfaces/TransactionInterface.md#gethashedmessagetosign) + +*** + +### getIntrinsicGas() + +> **getIntrinsicGas**(): `bigint` + +Defined in: [7702/tx.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L224) + +The minimum gas limit which the tx to have to be valid. +This covers costs as the standard fee (21000 gas), the data fee (paid for each calldata byte), +the optional creation fee (if the transaction creates a contract), and if relevant the gas +to be paid for access lists (EIP-2930) and authority lists (EIP-7702). + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getIntrinsicGas`](../interfaces/TransactionInterface.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array` + +Defined in: [7702/tx.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L292) + +Returns the raw serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: in contrast to the legacy tx the raw message format is already +serialized and doesn't need to be RLP encoded any more. + +```javascript +const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input +``` + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToSign`](../interfaces/TransactionInterface.md#getmessagetosign) + +*** + +### getMessageToVerifySignature() + +> **getMessageToVerifySignature**(): `Uint8Array` + +Defined in: [7702/tx.ts:320](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L320) + +Computes a sha3-256 hash which can be used to verify the signature + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToVerifySignature`](../interfaces/TransactionInterface.md#getmessagetoverifysignature) + +*** + +### getSenderAddress() + +> **getSenderAddress**(): `Address` + +Defined in: [7702/tx.ts:389](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L389) + +#### Returns + +`Address` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderAddress`](../interfaces/TransactionInterface.md#getsenderaddress) + +*** + +### getSenderPublicKey() + +> **getSenderPublicKey**(): `Uint8Array` + +Defined in: [7702/tx.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L327) + +Returns the public key of the sender + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderPublicKey`](../interfaces/TransactionInterface.md#getsenderpublickey) + +*** + +### getUpfrontCost() + +> **getUpfrontCost**(`baseFee`): `bigint` + +Defined in: [7702/tx.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L214) + +The up front amount that an account must have for this transaction to be valid + +#### Parameters + +##### baseFee + +`bigint` = `BIGINT_0` + +The base fee of the block (will be set to 0 if not provided) + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getUpfrontCost`](../interfaces/TransactionInterface.md#getupfrontcost) + +*** + +### getValidationErrors() + +> **getValidationErrors**(): `string`[] + +Defined in: [7702/tx.ts:377](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L377) + +#### Returns + +`string`[] + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getValidationErrors`](../interfaces/TransactionInterface.md#getvalidationerrors) + +*** + +### hash() + +> **hash**(): `Uint8Array` + +Defined in: [7702/tx.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L313) + +Computes a sha3-256 hash of the serialized tx. + +This method can only be used for signed txs (it throws otherwise). +Use EOACode7702Transaction.getMessageToSign to get a tx hash for the purpose of signing. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`hash`](../interfaces/TransactionInterface.md#hash) + +*** + +### isSigned() + +> **isSigned**(): `boolean` + +Defined in: [7702/tx.ts:397](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L397) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isSigned`](../interfaces/TransactionInterface.md#issigned) + +*** + +### isValid() + +> **isValid**(): `boolean` + +Defined in: [7702/tx.ts:381](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L381) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isValid`](../interfaces/TransactionInterface.md#isvalid) + +*** + +### raw() + +> **raw**(): `EOACode7702TxValuesArray` + +Defined in: [7702/tx.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L249) + +Returns a Uint8Array Array of the raw Bytes of the EIP-7702 transaction, in order. + +Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, authorizationList, signatureYParity, signatureR, signatureS]` + +Use EOACode7702Transaction.serialize to add a transaction to a block +with createBlockFromBytesArray. + +For an unsigned tx this method uses the empty Bytes values for the +signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant +representation for external signing use EOACode7702Transaction.getMessageToSign. + +#### Returns + +`EOACode7702TxValuesArray` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`raw`](../interfaces/TransactionInterface.md#raw) + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [7702/tx.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L277) + +Returns the serialized encoding of the EIP-7702 transaction. + +Format: `0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, authorizationList, signatureYParity, signatureR, signatureS])` + +Note that in contrast to the legacy tx serialization format this is not +valid RLP any more due to the raw tx type preceding and concatenated to +the RLP encoding of the values. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`serialize`](../interfaces/TransactionInterface.md#serialize) + +*** + +### sign() + +> **sign**(`privateKey`, `extraEntropy`): `EOACode7702Tx` + +Defined in: [7702/tx.ts:393](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L393) + +#### Parameters + +##### privateKey + +`Uint8Array` + +##### extraEntropy + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`EOACode7702Tx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`sign`](../interfaces/TransactionInterface.md#sign) + +*** + +### supports() + +> **supports**(`capability`): `boolean` + +Defined in: [7702/tx.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L191) + +Checks if a tx type defining capability is active +on a tx, for example the EIP-1559 fee market mechanism +or the EIP-2930 access list feature. + +Note that this is different from the tx type itself, +so EIP-2930 access lists can very well be active +on an EIP-1559 tx for example. + +This method can be useful for feature checks if the +tx type is unknown (e.g. when instantiated with +the tx factory). + +See `Capabilities` in the `types` module for a reference +on all supported capabilities. + +#### Parameters + +##### capability + +`number` + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`supports`](../interfaces/TransactionInterface.md#supports) + +*** + +### toCreationAddress() + +> **toCreationAddress**(): `boolean` + +Defined in: [7702/tx.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L232) + +If the tx's `to` is to the creation address + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toCreationAddress`](../interfaces/TransactionInterface.md#tocreationaddress) + +*** + +### toJSON() + +> **toJSON**(): [`JSONTx`](../interfaces/JSONTx.md) + +Defined in: [7702/tx.ts:359](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L359) + +Returns an object with the JSON representation of the transaction + +#### Returns + +[`JSONTx`](../interfaces/JSONTx.md) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toJSON`](../interfaces/TransactionInterface.md#tojson) + +*** + +### verifySignature() + +> **verifySignature**(): `boolean` + +Defined in: [7702/tx.ts:385](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/tx.ts#L385) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`verifySignature`](../interfaces/TransactionInterface.md#verifysignature) diff --git a/packages/tx/docs/classes/FeeMarket1559Tx.md b/packages/tx/docs/classes/FeeMarket1559Tx.md new file mode 100644 index 00000000000..61e9a530199 --- /dev/null +++ b/packages/tx/docs/classes/FeeMarket1559Tx.md @@ -0,0 +1,694 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / FeeMarket1559Tx + +# Class: FeeMarket1559Tx + +Defined in: [1559/tx.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L43) + +Typed transaction with a new gas fee market mechanism + +- TransactionType: 2 +- EIP: [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) + +## Implements + +- [`TransactionInterface`](../interfaces/TransactionInterface.md)\<*typeof* [`FeeMarketEIP1559`](../variables/TransactionType.md#feemarketeip1559)\> + +## Constructors + +### Constructor + +> **new FeeMarket1559Tx**(`txData`, `opts`): `FeeMarket1559Tx` + +Defined in: [1559/tx.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L87) + +This constructor takes the values, validates them, assigns them and freezes the object. + +It is not recommended to use this constructor directly. Instead use +the static factory methods to assist in creating a Transaction object from +varying data types. + +#### Parameters + +##### txData + +[`FeeMarketEIP1559TxData`](../interfaces/FeeMarketEIP1559TxData.md) + +##### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +#### Returns + +`FeeMarket1559Tx` + +## Properties + +### accessList + +> `readonly` **accessList**: [`AccessListBytes`](../type-aliases/AccessListBytes.md) + +Defined in: [1559/tx.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L55) + +*** + +### cache + +> `readonly` **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) = `{}` + +Defined in: [1559/tx.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L71) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`cache`](../interfaces/TransactionInterface.md#cache) + +*** + +### chainId + +> `readonly` **chainId**: `bigint` + +Defined in: [1559/tx.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L56) + +*** + +### common + +> `readonly` **common**: `Common` + +Defined in: [1559/tx.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L67) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`common`](../interfaces/TransactionInterface.md#common) + +*** + +### data + +> `readonly` **data**: `Uint8Array` + +Defined in: [1559/tx.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L53) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`data`](../interfaces/TransactionInterface.md#data) + +*** + +### gasLimit + +> `readonly` **gasLimit**: `bigint` + +Defined in: [1559/tx.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L51) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`gasLimit`](../interfaces/TransactionInterface.md#gaslimit) + +*** + +### maxFeePerGas + +> `readonly` **maxFeePerGas**: `bigint` + +Defined in: [1559/tx.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L58) + +*** + +### maxPriorityFeePerGas + +> `readonly` **maxPriorityFeePerGas**: `bigint` + +Defined in: [1559/tx.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L57) + +*** + +### nonce + +> `readonly` **nonce**: `bigint` + +Defined in: [1559/tx.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L50) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`nonce`](../interfaces/TransactionInterface.md#nonce) + +*** + +### r? + +> `readonly` `optional` **r**: `bigint` + +Defined in: [1559/tx.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L62) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`r`](../interfaces/TransactionInterface.md#r) + +*** + +### s? + +> `readonly` `optional` **s**: `bigint` + +Defined in: [1559/tx.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L63) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`s`](../interfaces/TransactionInterface.md#s) + +*** + +### to? + +> `readonly` `optional` **to**: `Address` + +Defined in: [1559/tx.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L54) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`to`](../interfaces/TransactionInterface.md#to) + +*** + +### txOptions + +> `readonly` **txOptions**: [`TxOptions`](../interfaces/TxOptions.md) + +Defined in: [1559/tx.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L69) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`txOptions`](../interfaces/TransactionInterface.md#txoptions) + +*** + +### type + +> **type**: `2` = `TransactionType.FeeMarketEIP1559` + +Defined in: [1559/tx.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L47) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`type`](../interfaces/TransactionInterface.md#type) + +*** + +### v? + +> `readonly` `optional` **v**: `bigint` + +Defined in: [1559/tx.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L61) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`v`](../interfaces/TransactionInterface.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [1559/tx.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L52) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`value`](../interfaces/TransactionInterface.md#value) + +## Methods + +### addSignature() + +> **addSignature**(`v`, `r`, `s`): `FeeMarket1559Tx` + +Defined in: [1559/tx.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L297) + +#### Parameters + +##### v + +`bigint` + +##### r + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +##### s + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`FeeMarket1559Tx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`addSignature`](../interfaces/TransactionInterface.md#addsignature) + +*** + +### errorStr() + +> **errorStr**(): `string` + +Defined in: [1559/tx.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L369) + +Return a compact error string representation of the object + +#### Returns + +`string` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`errorStr`](../interfaces/TransactionInterface.md#errorstr) + +*** + +### getDataGas() + +> **getDataGas**(): `bigint` + +Defined in: [1559/tx.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L165) + +The amount of gas paid for the data in this tx + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getDataGas`](../interfaces/TransactionInterface.md#getdatagas) + +*** + +### getEffectivePriorityFee() + +> **getEffectivePriorityFee**(`baseFee`): `bigint` + +Defined in: [1559/tx.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L173) + +Returns the minimum of calculated priority fee (from maxFeePerGas and baseFee) and maxPriorityFeePerGas + +#### Parameters + +##### baseFee + +`bigint` + +Base fee retrieved from block + +#### Returns + +`bigint` + +*** + +### getHashedMessageToSign() + +> **getHashedMessageToSign**(): `Uint8Array` + +Defined in: [1559/tx.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L269) + +Returns the hashed serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: in contrast to the legacy tx the raw message format is already +serialized and doesn't need to be RLP encoded any more. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getHashedMessageToSign`](../interfaces/TransactionInterface.md#gethashedmessagetosign) + +*** + +### getIntrinsicGas() + +> **getIntrinsicGas**(): `bigint` + +Defined in: [1559/tx.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L191) + +The minimum gas limit which the tx to have to be valid. +This covers costs as the standard fee (21000 gas), the data fee (paid for each calldata byte), +the optional creation fee (if the transaction creates a contract), and if relevant the gas +to be paid for access lists (EIP-2930) and authority lists (EIP-7702). + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getIntrinsicGas`](../interfaces/TransactionInterface.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array` + +Defined in: [1559/tx.ts:258](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L258) + +Returns the raw serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: in contrast to the legacy tx the raw message format is already +serialized and doesn't need to be RLP encoded any more. + +```javascript +const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input +``` + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToSign`](../interfaces/TransactionInterface.md#getmessagetosign) + +*** + +### getMessageToVerifySignature() + +> **getMessageToVerifySignature**(): `Uint8Array` + +Defined in: [1559/tx.ts:286](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L286) + +Computes a sha3-256 hash which can be used to verify the signature + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToVerifySignature`](../interfaces/TransactionInterface.md#getmessagetoverifysignature) + +*** + +### getSenderAddress() + +> **getSenderAddress**(): `Address` + +Defined in: [1559/tx.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L349) + +#### Returns + +`Address` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderAddress`](../interfaces/TransactionInterface.md#getsenderaddress) + +*** + +### getSenderPublicKey() + +> **getSenderPublicKey**(): `Uint8Array` + +Defined in: [1559/tx.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L293) + +Returns the public key of the sender + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderPublicKey`](../interfaces/TransactionInterface.md#getsenderpublickey) + +*** + +### getUpfrontCost() + +> **getUpfrontCost**(`baseFee`): `bigint` + +Defined in: [1559/tx.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L181) + +The up front amount that an account must have for this transaction to be valid + +#### Parameters + +##### baseFee + +`bigint` = `BIGINT_0` + +The base fee of the block (will be set to 0 if not provided) + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getUpfrontCost`](../interfaces/TransactionInterface.md#getupfrontcost) + +*** + +### getValidationErrors() + +> **getValidationErrors**(): `string`[] + +Defined in: [1559/tx.ts:337](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L337) + +#### Returns + +`string`[] + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getValidationErrors`](../interfaces/TransactionInterface.md#getvalidationerrors) + +*** + +### hash() + +> **hash**(): `Uint8Array` + +Defined in: [1559/tx.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L279) + +Computes a sha3-256 hash of the serialized tx. + +This method can only be used for signed txs (it throws otherwise). +Use [FeeMarket1559Tx.getMessageToSign](#getmessagetosign) to get a tx hash for the purpose of signing. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`hash`](../interfaces/TransactionInterface.md#hash) + +*** + +### isSigned() + +> **isSigned**(): `boolean` + +Defined in: [1559/tx.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L357) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isSigned`](../interfaces/TransactionInterface.md#issigned) + +*** + +### isValid() + +> **isValid**(): `boolean` + +Defined in: [1559/tx.ts:341](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L341) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isValid`](../interfaces/TransactionInterface.md#isvalid) + +*** + +### raw() + +> **raw**(): `FeeMarketEIP1559TxValuesArray` + +Defined in: [1559/tx.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L216) + +Returns a Uint8Array Array of the raw Bytes of the EIP-1559 transaction, in order. + +Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, signatureYParity, signatureR, signatureS]` + +Use [FeeMarket1559Tx.serialize](#serialize) to add a transaction to a block +with createBlockFromBytesArray. + +For an unsigned tx this method uses the empty Bytes values for the +signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant +representation for external signing use [FeeMarket1559Tx.getMessageToSign](#getmessagetosign). + +#### Returns + +`FeeMarketEIP1559TxValuesArray` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`raw`](../interfaces/TransactionInterface.md#raw) + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [1559/tx.ts:243](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L243) + +Returns the serialized encoding of the EIP-1559 transaction. + +Format: `0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, signatureYParity, signatureR, signatureS])` + +Note that in contrast to the legacy tx serialization format this is not +valid RLP any more due to the raw tx type preceding and concatenated to +the RLP encoding of the values. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`serialize`](../interfaces/TransactionInterface.md#serialize) + +*** + +### sign() + +> **sign**(`privateKey`, `extraEntropy`): `FeeMarket1559Tx` + +Defined in: [1559/tx.ts:353](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L353) + +#### Parameters + +##### privateKey + +`Uint8Array` + +##### extraEntropy + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`FeeMarket1559Tx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`sign`](../interfaces/TransactionInterface.md#sign) + +*** + +### supports() + +> **supports**(`capability`): `boolean` + +Defined in: [1559/tx.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L158) + +Checks if a tx type defining capability is active +on a tx, for example the EIP-1559 fee market mechanism +or the EIP-2930 access list feature. + +Note that this is different from the tx type itself, +so EIP-2930 access lists can very well be active +on an EIP-1559 tx for example. + +This method can be useful for feature checks if the +tx type is unknown (e.g. when instantiated with +the tx factory). + +See `Capabilities` in the `types` module for a reference +on all supported capabilities. + +#### Parameters + +##### capability + +`number` + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`supports`](../interfaces/TransactionInterface.md#supports) + +*** + +### toCreationAddress() + +> **toCreationAddress**(): `boolean` + +Defined in: [1559/tx.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L199) + +If the tx's `to` is to the creation address + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toCreationAddress`](../interfaces/TransactionInterface.md#tocreationaddress) + +*** + +### toJSON() + +> **toJSON**(): [`JSONTx`](../interfaces/JSONTx.md) + +Defined in: [1559/tx.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L324) + +Returns an object with the JSON representation of the transaction + +#### Returns + +[`JSONTx`](../interfaces/JSONTx.md) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toJSON`](../interfaces/TransactionInterface.md#tojson) + +*** + +### verifySignature() + +> **verifySignature**(): `boolean` + +Defined in: [1559/tx.ts:345](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/tx.ts#L345) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`verifySignature`](../interfaces/TransactionInterface.md#verifysignature) diff --git a/packages/tx/docs/classes/FeeMarketEIP1559Transaction.md b/packages/tx/docs/classes/FeeMarketEIP1559Transaction.md deleted file mode 100644 index ed999030c65..00000000000 --- a/packages/tx/docs/classes/FeeMarketEIP1559Transaction.md +++ /dev/null @@ -1,915 +0,0 @@ -[@ethereumjs/tx](../README.md) / FeeMarketEIP1559Transaction - -# Class: FeeMarketEIP1559Transaction - -Typed transaction with a new gas fee market mechanism - -- TransactionType: 2 -- EIP: [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - -## Hierarchy - -- `BaseTransaction`<[`FeeMarketEIP1559`](../enums/TransactionType.md#feemarketeip1559)\> - - ↳ **`FeeMarketEIP1559Transaction`** - -## Table of contents - -### Constructors - -- [constructor](FeeMarketEIP1559Transaction.md#constructor) - -### Properties - -- [AccessListJSON](FeeMarketEIP1559Transaction.md#accesslistjson) -- [accessList](FeeMarketEIP1559Transaction.md#accesslist) -- [cache](FeeMarketEIP1559Transaction.md#cache) -- [chainId](FeeMarketEIP1559Transaction.md#chainid) -- [common](FeeMarketEIP1559Transaction.md#common) -- [data](FeeMarketEIP1559Transaction.md#data) -- [gasLimit](FeeMarketEIP1559Transaction.md#gaslimit) -- [maxFeePerGas](FeeMarketEIP1559Transaction.md#maxfeepergas) -- [maxPriorityFeePerGas](FeeMarketEIP1559Transaction.md#maxpriorityfeepergas) -- [nonce](FeeMarketEIP1559Transaction.md#nonce) -- [r](FeeMarketEIP1559Transaction.md#r) -- [s](FeeMarketEIP1559Transaction.md#s) -- [to](FeeMarketEIP1559Transaction.md#to) -- [v](FeeMarketEIP1559Transaction.md#v) -- [value](FeeMarketEIP1559Transaction.md#value) - -### Accessors - -- [type](FeeMarketEIP1559Transaction.md#type) - -### Methods - -- [addSignature](FeeMarketEIP1559Transaction.md#addsignature) -- [errorStr](FeeMarketEIP1559Transaction.md#errorstr) -- [getBaseFee](FeeMarketEIP1559Transaction.md#getbasefee) -- [getDataFee](FeeMarketEIP1559Transaction.md#getdatafee) -- [getEffectivePriorityFee](FeeMarketEIP1559Transaction.md#geteffectivepriorityfee) -- [getHashedMessageToSign](FeeMarketEIP1559Transaction.md#gethashedmessagetosign) -- [getMessageToSign](FeeMarketEIP1559Transaction.md#getmessagetosign) -- [getMessageToVerifySignature](FeeMarketEIP1559Transaction.md#getmessagetoverifysignature) -- [getSenderAddress](FeeMarketEIP1559Transaction.md#getsenderaddress) -- [getSenderPublicKey](FeeMarketEIP1559Transaction.md#getsenderpublickey) -- [getUpfrontCost](FeeMarketEIP1559Transaction.md#getupfrontcost) -- [getValidationErrors](FeeMarketEIP1559Transaction.md#getvalidationerrors) -- [hash](FeeMarketEIP1559Transaction.md#hash) -- [isSigned](FeeMarketEIP1559Transaction.md#issigned) -- [isValid](FeeMarketEIP1559Transaction.md#isvalid) -- [raw](FeeMarketEIP1559Transaction.md#raw) -- [serialize](FeeMarketEIP1559Transaction.md#serialize) -- [sign](FeeMarketEIP1559Transaction.md#sign) -- [supports](FeeMarketEIP1559Transaction.md#supports) -- [toCreationAddress](FeeMarketEIP1559Transaction.md#tocreationaddress) -- [toJSON](FeeMarketEIP1559Transaction.md#tojson) -- [verifySignature](FeeMarketEIP1559Transaction.md#verifysignature) -- [fromSerializedTx](FeeMarketEIP1559Transaction.md#fromserializedtx) -- [fromTxData](FeeMarketEIP1559Transaction.md#fromtxdata) -- [fromValuesArray](FeeMarketEIP1559Transaction.md#fromvaluesarray) - -## Constructors - -### constructor - -• **new FeeMarketEIP1559Transaction**(`txData`, `opts?`) - -This constructor takes the values, validates them, assigns them and freezes the object. - -It is not recommended to use this constructor directly. Instead use -the static factory methods to assist in creating a Transaction object from -varying data types. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`FeeMarketEIP1559TxData`](../interfaces/FeeMarketEIP1559TxData.md) | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Overrides - -BaseTransaction<TransactionType.FeeMarketEIP1559\>.constructor - -#### Defined in - -[tx/src/eip1559Transaction.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L150) - -## Properties - -### AccessListJSON - -• `Readonly` **AccessListJSON**: [`AccessList`](../README.md#accesslist) - -#### Defined in - -[tx/src/eip1559Transaction.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L46) - -___ - -### accessList - -• `Readonly` **accessList**: [`AccessListBytes`](../README.md#accesslistbytes) - -#### Defined in - -[tx/src/eip1559Transaction.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L45) - -___ - -### cache - -• **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) - -#### Inherited from - -BaseTransaction.cache - -#### Defined in - -[tx/src/baseTransaction.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L54) - -___ - -### chainId - -• `Readonly` **chainId**: `bigint` - -#### Defined in - -[tx/src/eip1559Transaction.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L44) - -___ - -### common - -• `Readonly` **common**: `Common` - -#### Overrides - -BaseTransaction.common - -#### Defined in - -[tx/src/eip1559Transaction.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L50) - -___ - -### data - -• `Readonly` **data**: `Uint8Array` - -#### Inherited from - -BaseTransaction.data - -#### Defined in - -[tx/src/baseTransaction.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L46) - -___ - -### gasLimit - -• `Readonly` **gasLimit**: `bigint` - -#### Inherited from - -BaseTransaction.gasLimit - -#### Defined in - -[tx/src/baseTransaction.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L43) - -___ - -### maxFeePerGas - -• `Readonly` **maxFeePerGas**: `bigint` - -#### Defined in - -[tx/src/eip1559Transaction.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L48) - -___ - -### maxPriorityFeePerGas - -• `Readonly` **maxPriorityFeePerGas**: `bigint` - -#### Defined in - -[tx/src/eip1559Transaction.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L47) - -___ - -### nonce - -• `Readonly` **nonce**: `bigint` - -#### Inherited from - -BaseTransaction.nonce - -#### Defined in - -[tx/src/baseTransaction.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L42) - -___ - -### r - -• `Optional` `Readonly` **r**: `bigint` - -#### Inherited from - -BaseTransaction.r - -#### Defined in - -[tx/src/baseTransaction.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L49) - -___ - -### s - -• `Optional` `Readonly` **s**: `bigint` - -#### Inherited from - -BaseTransaction.s - -#### Defined in - -[tx/src/baseTransaction.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L50) - -___ - -### to - -• `Optional` `Readonly` **to**: `Address` - -#### Inherited from - -BaseTransaction.to - -#### Defined in - -[tx/src/baseTransaction.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L44) - -___ - -### v - -• `Optional` `Readonly` **v**: `bigint` - -#### Inherited from - -BaseTransaction.v - -#### Defined in - -[tx/src/baseTransaction.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L48) - -___ - -### value - -• `Readonly` **value**: `bigint` - -#### Inherited from - -BaseTransaction.value - -#### Defined in - -[tx/src/baseTransaction.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L45) - -## Accessors - -### type - -• `get` **type**(): [`TransactionType`](../enums/TransactionType.md) - -Returns the transaction type. - -Note: legacy txs will return tx type `0`. - -#### Returns - -[`TransactionType`](../enums/TransactionType.md) - -#### Inherited from - -BaseTransaction.type - -#### Defined in - -[tx/src/baseTransaction.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L121) - -## Methods - -### addSignature - -▸ **addSignature**(`v`, `r`, `s`, `convertV?`): [`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `v` | `bigint` | `undefined` | -| `r` | `bigint` \| `Uint8Array` | `undefined` | -| `s` | `bigint` \| `Uint8Array` | `undefined` | -| `convertV` | `boolean` | `false` | - -#### Returns - -[`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -#### Overrides - -BaseTransaction.addSignature - -#### Defined in - -[tx/src/eip1559Transaction.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L319) - -___ - -### errorStr - -▸ **errorStr**(): `string` - -Return a compact error string representation of the object - -#### Returns - -`string` - -#### Overrides - -BaseTransaction.errorStr - -#### Defined in - -[tx/src/eip1559Transaction.ts:367](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L367) - -___ - -### getBaseFee - -▸ **getBaseFee**(): `bigint` - -The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) - -#### Returns - -`bigint` - -#### Inherited from - -BaseTransaction.getBaseFee - -#### Defined in - -[tx/src/baseTransaction.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L176) - -___ - -### getDataFee - -▸ **getDataFee**(): `bigint` - -The amount of gas paid for the data in this tx - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getDataFee - -#### Defined in - -[tx/src/eip1559Transaction.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L205) - -___ - -### getEffectivePriorityFee - -▸ **getEffectivePriorityFee**(`baseFee`): `bigint` - -Returns the minimum of calculated priority fee (from maxFeePerGas and baseFee) and maxPriorityFeePerGas - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `baseFee` | `bigint` | Base fee retrieved from block | - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getEffectivePriorityFee - -#### Defined in - -[tx/src/eip1559Transaction.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L213) - -___ - -### getHashedMessageToSign - -▸ **getHashedMessageToSign**(): `Uint8Array` - -Returns the hashed serialized unsigned tx, which can be used -to sign the transaction (e.g. for sending to a hardware wallet). - -Note: in contrast to the legacy tx the raw message format is already -serialized and doesn't need to be RLP encoded any more. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getHashedMessageToSign - -#### Defined in - -[tx/src/eip1559Transaction.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L291) - -___ - -### getMessageToSign - -▸ **getMessageToSign**(): `Uint8Array` - -Returns the raw serialized unsigned tx, which can be used -to sign the transaction (e.g. for sending to a hardware wallet). - -Note: in contrast to the legacy tx the raw message format is already -serialized and doesn't need to be RLP encoded any more. - -```javascript -const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input -``` - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getMessageToSign - -#### Defined in - -[tx/src/eip1559Transaction.ts:280](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L280) - -___ - -### getMessageToVerifySignature - -▸ **getMessageToVerifySignature**(): `Uint8Array` - -Computes a sha3-256 hash which can be used to verify the signature - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getMessageToVerifySignature - -#### Defined in - -[tx/src/eip1559Transaction.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L308) - -___ - -### getSenderAddress - -▸ **getSenderAddress**(): `Address` - -Returns the sender's address - -#### Returns - -`Address` - -#### Inherited from - -BaseTransaction.getSenderAddress - -#### Defined in - -[tx/src/baseTransaction.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L279) - -___ - -### getSenderPublicKey - -▸ **getSenderPublicKey**(): `Uint8Array` - -Returns the public key of the sender - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getSenderPublicKey - -#### Defined in - -[tx/src/eip1559Transaction.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L315) - -___ - -### getUpfrontCost - -▸ **getUpfrontCost**(`baseFee?`): `bigint` - -The up front amount that an account must have for this transaction to be valid - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `baseFee` | `bigint` | `BIGINT_0` | The base fee of the block (will be set to 0 if not provided) | - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getUpfrontCost - -#### Defined in - -[tx/src/eip1559Transaction.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L221) - -___ - -### getValidationErrors - -▸ **getValidationErrors**(): `string`[] - -Validates the transaction signature and minimum gas requirements. - -#### Returns - -`string`[] - -an array of error strings - -#### Inherited from - -BaseTransaction.getValidationErrors - -#### Defined in - -[tx/src/baseTransaction.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L149) - -___ - -### hash - -▸ **hash**(): `Uint8Array` - -Computes a sha3-256 hash of the serialized tx. - -This method can only be used for signed txs (it throws otherwise). -Use [getMessageToSign](FeeMarketEIP1559Transaction.md#getmessagetosign) to get a tx hash for the purpose of signing. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.hash - -#### Defined in - -[tx/src/eip1559Transaction.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L301) - -___ - -### isSigned - -▸ **isSigned**(): `boolean` - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.isSigned - -#### Defined in - -[tx/src/baseTransaction.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L254) - -___ - -### isValid - -▸ **isValid**(): `boolean` - -Validates the transaction signature and minimum gas requirements. - -#### Returns - -`boolean` - -true if the transaction is valid, false otherwise - -#### Inherited from - -BaseTransaction.isValid - -#### Defined in - -[tx/src/baseTransaction.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L167) - -___ - -### raw - -▸ **raw**(): `FeeMarketEIP1559TxValuesArray` - -Returns a Uint8Array Array of the raw Bytes of the EIP-1559 transaction, in order. - -Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, -accessList, signatureYParity, signatureR, signatureS]` - -Use [serialize](FeeMarketEIP1559Transaction.md#serialize) to add a transaction to a block -with Block.fromValuesArray. - -For an unsigned tx this method uses the empty Bytes values for the -signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant -representation for external signing use [getMessageToSign](FeeMarketEIP1559Transaction.md#getmessagetosign). - -#### Returns - -`FeeMarketEIP1559TxValuesArray` - -#### Overrides - -BaseTransaction.raw - -#### Defined in - -[tx/src/eip1559Transaction.ts:238](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L238) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -Returns the serialized encoding of the EIP-1559 transaction. - -Format: `0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, -accessList, signatureYParity, signatureR, signatureS])` - -Note that in contrast to the legacy tx serialization format this is not -valid RLP any more due to the raw tx type preceding and concatenated to -the RLP encoding of the values. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.serialize - -#### Defined in - -[tx/src/eip1559Transaction.ts:265](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L265) - -___ - -### sign - -▸ **sign**(`privateKey`): [`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -Signs a transaction. - -Note that the signed tx is returned as a new object, -use as follows: -```javascript -const signedTx = tx.sign(privateKey) -``` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | - -#### Returns - -[`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -#### Inherited from - -BaseTransaction.sign - -#### Defined in - -[tx/src/baseTransaction.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L297) - -___ - -### supports - -▸ **supports**(`capability`): `boolean` - -Checks if a tx type defining capability is active -on a tx, for example the EIP-1559 fee market mechanism -or the EIP-2930 access list feature. - -Note that this is different from the tx type itself, -so EIP-2930 access lists can very well be active -on an EIP-1559 tx for example. - -This method can be useful for feature checks if the -tx type is unknown (e.g. when instantiated with -the tx factory). - -See `Capabilities` in the `types` module for a reference -on all supported capabilities. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.supports - -#### Defined in - -[tx/src/baseTransaction.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L141) - -___ - -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` - -If the tx's `to` is to the creation address - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.toCreationAddress - -#### Defined in - -[tx/src/baseTransaction.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L223) - -___ - -### toJSON - -▸ **toJSON**(): [`JsonTx`](../interfaces/JsonTx.md) - -Returns an object with the JSON representation of the transaction - -#### Returns - -[`JsonTx`](../interfaces/JsonTx.md) - -#### Overrides - -BaseTransaction.toJSON - -#### Defined in - -[tx/src/eip1559Transaction.ts:351](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L351) - -___ - -### verifySignature - -▸ **verifySignature**(): `boolean` - -Determines if the signature is valid - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.verifySignature - -#### Defined in - -[tx/src/baseTransaction.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L266) - -___ - -### fromSerializedTx - -▸ `Static` **fromSerializedTx**(`serialized`, `opts?`): [`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -Instantiate a transaction from the serialized tx. - -Format: `0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, -accessList, signatureYParity, signatureR, signatureS])` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `serialized` | `Uint8Array` | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -#### Defined in - -[tx/src/eip1559Transaction.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L72) - -___ - -### fromTxData - -▸ `Static` **fromTxData**(`txData`, `opts?`): [`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -Instantiate a transaction from a data dictionary. - -Format: { chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, -accessList, v, r, s } - -Notes: -- `chainId` will be set automatically if not provided -- All parameters are optional and have some basic default values - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`FeeMarketEIP1559TxData`](../interfaces/FeeMarketEIP1559TxData.md) | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -#### Defined in - -[tx/src/eip1559Transaction.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L62) - -___ - -### fromValuesArray - -▸ `Static` **fromValuesArray**(`values`, `opts?`): [`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -Create a transaction from a values array. - -Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, -accessList, signatureYParity, signatureR, signatureS]` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `values` | `FeeMarketEIP1559TxValuesArray` | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) - -#### Defined in - -[tx/src/eip1559Transaction.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip1559Transaction.ts#L99) diff --git a/packages/tx/docs/classes/LegacyTransaction.md b/packages/tx/docs/classes/LegacyTransaction.md deleted file mode 100644 index bedeb9e0197..00000000000 --- a/packages/tx/docs/classes/LegacyTransaction.md +++ /dev/null @@ -1,854 +0,0 @@ -[@ethereumjs/tx](../README.md) / LegacyTransaction - -# Class: LegacyTransaction - -An Ethereum non-typed (legacy) transaction - -## Hierarchy - -- `BaseTransaction`<[`Legacy`](../enums/TransactionType.md#legacy)\> - - ↳ **`LegacyTransaction`** - -## Table of contents - -### Constructors - -- [constructor](LegacyTransaction.md#constructor) - -### Properties - -- [cache](LegacyTransaction.md#cache) -- [common](LegacyTransaction.md#common) -- [data](LegacyTransaction.md#data) -- [gasLimit](LegacyTransaction.md#gaslimit) -- [gasPrice](LegacyTransaction.md#gasprice) -- [nonce](LegacyTransaction.md#nonce) -- [r](LegacyTransaction.md#r) -- [s](LegacyTransaction.md#s) -- [to](LegacyTransaction.md#to) -- [v](LegacyTransaction.md#v) -- [value](LegacyTransaction.md#value) - -### Accessors - -- [type](LegacyTransaction.md#type) - -### Methods - -- [addSignature](LegacyTransaction.md#addsignature) -- [errorStr](LegacyTransaction.md#errorstr) -- [getBaseFee](LegacyTransaction.md#getbasefee) -- [getDataFee](LegacyTransaction.md#getdatafee) -- [getEffectivePriorityFee](LegacyTransaction.md#geteffectivepriorityfee) -- [getHashedMessageToSign](LegacyTransaction.md#gethashedmessagetosign) -- [getMessageToSign](LegacyTransaction.md#getmessagetosign) -- [getMessageToVerifySignature](LegacyTransaction.md#getmessagetoverifysignature) -- [getSenderAddress](LegacyTransaction.md#getsenderaddress) -- [getSenderPublicKey](LegacyTransaction.md#getsenderpublickey) -- [getUpfrontCost](LegacyTransaction.md#getupfrontcost) -- [getValidationErrors](LegacyTransaction.md#getvalidationerrors) -- [hash](LegacyTransaction.md#hash) -- [isSigned](LegacyTransaction.md#issigned) -- [isValid](LegacyTransaction.md#isvalid) -- [raw](LegacyTransaction.md#raw) -- [serialize](LegacyTransaction.md#serialize) -- [sign](LegacyTransaction.md#sign) -- [supports](LegacyTransaction.md#supports) -- [toCreationAddress](LegacyTransaction.md#tocreationaddress) -- [toJSON](LegacyTransaction.md#tojson) -- [verifySignature](LegacyTransaction.md#verifysignature) -- [fromSerializedTx](LegacyTransaction.md#fromserializedtx) -- [fromTxData](LegacyTransaction.md#fromtxdata) -- [fromValuesArray](LegacyTransaction.md#fromvaluesarray) - -## Constructors - -### constructor - -• **new LegacyTransaction**(`txData`, `opts?`) - -This constructor takes the values, validates them, assigns them and freezes the object. - -It is not recommended to use this constructor directly. Instead use -the static factory methods to assist in creating a Transaction object from -varying data types. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`LegacyTxData`](../README.md#legacytxdata) | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Overrides - -BaseTransaction<TransactionType.Legacy\>.constructor - -#### Defined in - -[tx/src/legacyTransaction.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L113) - -## Properties - -### cache - -• **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) - -#### Inherited from - -BaseTransaction.cache - -#### Defined in - -[tx/src/baseTransaction.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L54) - -___ - -### common - -• `Readonly` **common**: `Common` - -#### Overrides - -BaseTransaction.common - -#### Defined in - -[tx/src/legacyTransaction.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L42) - -___ - -### data - -• `Readonly` **data**: `Uint8Array` - -#### Inherited from - -BaseTransaction.data - -#### Defined in - -[tx/src/baseTransaction.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L46) - -___ - -### gasLimit - -• `Readonly` **gasLimit**: `bigint` - -#### Inherited from - -BaseTransaction.gasLimit - -#### Defined in - -[tx/src/baseTransaction.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L43) - -___ - -### gasPrice - -• `Readonly` **gasPrice**: `bigint` - -#### Defined in - -[tx/src/legacyTransaction.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L40) - -___ - -### nonce - -• `Readonly` **nonce**: `bigint` - -#### Inherited from - -BaseTransaction.nonce - -#### Defined in - -[tx/src/baseTransaction.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L42) - -___ - -### r - -• `Optional` `Readonly` **r**: `bigint` - -#### Inherited from - -BaseTransaction.r - -#### Defined in - -[tx/src/baseTransaction.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L49) - -___ - -### s - -• `Optional` `Readonly` **s**: `bigint` - -#### Inherited from - -BaseTransaction.s - -#### Defined in - -[tx/src/baseTransaction.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L50) - -___ - -### to - -• `Optional` `Readonly` **to**: `Address` - -#### Inherited from - -BaseTransaction.to - -#### Defined in - -[tx/src/baseTransaction.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L44) - -___ - -### v - -• `Optional` `Readonly` **v**: `bigint` - -#### Inherited from - -BaseTransaction.v - -#### Defined in - -[tx/src/baseTransaction.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L48) - -___ - -### value - -• `Readonly` **value**: `bigint` - -#### Inherited from - -BaseTransaction.value - -#### Defined in - -[tx/src/baseTransaction.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L45) - -## Accessors - -### type - -• `get` **type**(): [`TransactionType`](../enums/TransactionType.md) - -Returns the transaction type. - -Note: legacy txs will return tx type `0`. - -#### Returns - -[`TransactionType`](../enums/TransactionType.md) - -#### Inherited from - -BaseTransaction.type - -#### Defined in - -[tx/src/baseTransaction.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L121) - -## Methods - -### addSignature - -▸ **addSignature**(`v`, `r`, `s`, `convertV?`): [`LegacyTransaction`](LegacyTransaction.md) - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `v` | `bigint` | `undefined` | -| `r` | `bigint` \| `Uint8Array` | `undefined` | -| `s` | `bigint` \| `Uint8Array` | `undefined` | -| `convertV` | `boolean` | `false` | - -#### Returns - -[`LegacyTransaction`](LegacyTransaction.md) - -#### Overrides - -BaseTransaction.addSignature - -#### Defined in - -[tx/src/legacyTransaction.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L277) - -___ - -### errorStr - -▸ **errorStr**(): `string` - -Return a compact error string representation of the object - -#### Returns - -`string` - -#### Overrides - -BaseTransaction.errorStr - -#### Defined in - -[tx/src/legacyTransaction.ts:367](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L367) - -___ - -### getBaseFee - -▸ **getBaseFee**(): `bigint` - -The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) - -#### Returns - -`bigint` - -#### Inherited from - -BaseTransaction.getBaseFee - -#### Defined in - -[tx/src/baseTransaction.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L176) - -___ - -### getDataFee - -▸ **getDataFee**(): `bigint` - -The amount of gas paid for the data in this tx - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getDataFee - -#### Defined in - -[tx/src/legacyTransaction.ts:238](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L238) - -___ - -### getEffectivePriorityFee - -▸ **getEffectivePriorityFee**(`baseFee?`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `baseFee?` | `bigint` | - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getEffectivePriorityFee - -#### Defined in - -[tx/src/legacyTransaction.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L150) - -___ - -### getHashedMessageToSign - -▸ **getHashedMessageToSign**(): `Uint8Array` - -Returns the hashed serialized unsigned tx, which can be used -to sign the transaction (e.g. for sending to a hardware wallet). - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getHashedMessageToSign - -#### Defined in - -[tx/src/legacyTransaction.ts:230](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L230) - -___ - -### getMessageToSign - -▸ **getMessageToSign**(): `Uint8Array`[] - -Returns the raw unsigned tx, which can be used -to sign the transaction (e.g. for sending to a hardware wallet). - -Note: the raw message message format for the legacy tx is not RLP encoded -and you might need to do yourself with: - -```javascript -import { RLP } from '@ethereumjs/rlp' -const message = tx.getMessageToSign() -const serializedMessage = RLP.encode(message)) // use this for the HW wallet input -``` - -#### Returns - -`Uint8Array`[] - -#### Overrides - -BaseTransaction.getMessageToSign - -#### Defined in - -[tx/src/legacyTransaction.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L207) - -___ - -### getMessageToVerifySignature - -▸ **getMessageToVerifySignature**(): `Uint8Array` - -Computes a sha3-256 hash which can be used to verify the signature - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getMessageToVerifySignature - -#### Defined in - -[tx/src/legacyTransaction.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L262) - -___ - -### getSenderAddress - -▸ **getSenderAddress**(): `Address` - -Returns the sender's address - -#### Returns - -`Address` - -#### Inherited from - -BaseTransaction.getSenderAddress - -#### Defined in - -[tx/src/baseTransaction.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L279) - -___ - -### getSenderPublicKey - -▸ **getSenderPublicKey**(): `Uint8Array` - -Returns the public key of the sender - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.getSenderPublicKey - -#### Defined in - -[tx/src/legacyTransaction.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L273) - -___ - -### getUpfrontCost - -▸ **getUpfrontCost**(): `bigint` - -The up front amount that an account must have for this transaction to be valid - -#### Returns - -`bigint` - -#### Overrides - -BaseTransaction.getUpfrontCost - -#### Defined in - -[tx/src/legacyTransaction.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L245) - -___ - -### getValidationErrors - -▸ **getValidationErrors**(): `string`[] - -Validates the transaction signature and minimum gas requirements. - -#### Returns - -`string`[] - -an array of error strings - -#### Inherited from - -BaseTransaction.getValidationErrors - -#### Defined in - -[tx/src/baseTransaction.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L149) - -___ - -### hash - -▸ **hash**(): `Uint8Array` - -Computes a sha3-256 hash of the serialized tx. - -This method can only be used for signed txs (it throws otherwise). -Use Transaction.getMessageToSign to get a tx hash for the purpose of signing. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.hash - -#### Defined in - -[tx/src/legacyTransaction.ts:255](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L255) - -___ - -### isSigned - -▸ **isSigned**(): `boolean` - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.isSigned - -#### Defined in - -[tx/src/baseTransaction.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L254) - -___ - -### isValid - -▸ **isValid**(): `boolean` - -Validates the transaction signature and minimum gas requirements. - -#### Returns - -`boolean` - -true if the transaction is valid, false otherwise - -#### Inherited from - -BaseTransaction.isValid - -#### Defined in - -[tx/src/baseTransaction.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L167) - -___ - -### raw - -▸ **raw**(): `LegacyTxValuesArray` - -Returns a Uint8Array Array of the raw Bytes of the legacy transaction, in order. - -Format: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]` - -For legacy txs this is also the correct format to add transactions -to a block with Block.fromValuesArray (use the `serialize()` method -for typed txs). - -For an unsigned tx this method returns the empty Bytes values -for the signature parameters `v`, `r` and `s`. For an EIP-155 compliant -representation have a look at Transaction.getMessageToSign. - -#### Returns - -`LegacyTxValuesArray` - -#### Overrides - -BaseTransaction.raw - -#### Defined in - -[tx/src/legacyTransaction.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L167) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -Returns the serialized encoding of the legacy transaction. - -Format: `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])` - -For an unsigned tx this method uses the empty Uint8Array values for the -signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant -representation for external signing use Transaction.getMessageToSign. - -#### Returns - -`Uint8Array` - -#### Overrides - -BaseTransaction.serialize - -#### Defined in - -[tx/src/legacyTransaction.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L190) - -___ - -### sign - -▸ **sign**(`privateKey`): [`LegacyTransaction`](LegacyTransaction.md) - -Signs a transaction. - -Note that the signed tx is returned as a new object, -use as follows: -```javascript -const signedTx = tx.sign(privateKey) -``` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | - -#### Returns - -[`LegacyTransaction`](LegacyTransaction.md) - -#### Inherited from - -BaseTransaction.sign - -#### Defined in - -[tx/src/baseTransaction.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L297) - -___ - -### supports - -▸ **supports**(`capability`): `boolean` - -Checks if a tx type defining capability is active -on a tx, for example the EIP-1559 fee market mechanism -or the EIP-2930 access list feature. - -Note that this is different from the tx type itself, -so EIP-2930 access lists can very well be active -on an EIP-1559 tx for example. - -This method can be useful for feature checks if the -tx type is unknown (e.g. when instantiated with -the tx factory). - -See `Capabilities` in the `types` module for a reference -on all supported capabilities. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.supports - -#### Defined in - -[tx/src/baseTransaction.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L141) - -___ - -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` - -If the tx's `to` is to the creation address - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.toCreationAddress - -#### Defined in - -[tx/src/baseTransaction.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L223) - -___ - -### toJSON - -▸ **toJSON**(): [`JsonTx`](../interfaces/JsonTx.md) - -Returns an object with the JSON representation of the transaction. - -#### Returns - -[`JsonTx`](../interfaces/JsonTx.md) - -#### Overrides - -BaseTransaction.toJSON - -#### Defined in - -[tx/src/legacyTransaction.ts:310](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L310) - -___ - -### verifySignature - -▸ **verifySignature**(): `boolean` - -Determines if the signature is valid - -#### Returns - -`boolean` - -#### Inherited from - -BaseTransaction.verifySignature - -#### Defined in - -[tx/src/baseTransaction.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/baseTransaction.ts#L266) - -___ - -### fromSerializedTx - -▸ `Static` **fromSerializedTx**(`serialized`, `opts?`): [`LegacyTransaction`](LegacyTransaction.md) - -Instantiate a transaction from the serialized tx. - -Format: `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `serialized` | `Uint8Array` | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`LegacyTransaction`](LegacyTransaction.md) - -#### Defined in - -[tx/src/legacyTransaction.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L62) - -___ - -### fromTxData - -▸ `Static` **fromTxData**(`txData`, `opts?`): [`LegacyTransaction`](LegacyTransaction.md) - -Instantiate a transaction from a data dictionary. - -Format: { nonce, gasPrice, gasLimit, to, value, data, v, r, s } - -Notes: -- All parameters are optional and have some basic default values - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `txData` | [`LegacyTxData`](../README.md#legacytxdata) | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`LegacyTransaction`](LegacyTransaction.md) - -#### Defined in - -[tx/src/legacyTransaction.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L53) - -___ - -### fromValuesArray - -▸ `Static` **fromValuesArray**(`values`, `opts?`): [`LegacyTransaction`](LegacyTransaction.md) - -Create a transaction from a values array. - -Format: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `values` | `LegacyTxValuesArray` | -| `opts` | [`TxOptions`](../interfaces/TxOptions.md) | - -#### Returns - -[`LegacyTransaction`](LegacyTransaction.md) - -#### Defined in - -[tx/src/legacyTransaction.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacyTransaction.ts#L77) diff --git a/packages/tx/docs/classes/LegacyTx.md b/packages/tx/docs/classes/LegacyTx.md new file mode 100644 index 00000000000..2752c07a020 --- /dev/null +++ b/packages/tx/docs/classes/LegacyTx.md @@ -0,0 +1,657 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / LegacyTx + +# Class: LegacyTx + +Defined in: [legacy/tx.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L82) + +An Ethereum non-typed (legacy) transaction + +## Implements + +- [`TransactionInterface`](../interfaces/TransactionInterface.md)\<*typeof* [`Legacy`](../variables/TransactionType.md#legacy)\> + +## Constructors + +### Constructor + +> **new LegacyTx**(`txData`, `opts`): `LegacyTx` + +Defined in: [legacy/tx.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L123) + +This constructor takes the values, validates them, assigns them and freezes the object. + +It is not recommended to use this constructor directly. Instead use +the static factory methods to assist in creating a Transaction object from +varying data types. + +#### Parameters + +##### txData + +[`LegacyTxData`](../type-aliases/LegacyTxData.md) + +##### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +#### Returns + +`LegacyTx` + +## Properties + +### cache + +> `readonly` **cache**: [`TransactionCache`](../interfaces/TransactionCache.md) = `{}` + +Defined in: [legacy/tx.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L107) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`cache`](../interfaces/TransactionInterface.md#cache) + +*** + +### common + +> `readonly` **common**: `Common` + +Defined in: [legacy/tx.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L102) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`common`](../interfaces/TransactionInterface.md#common) + +*** + +### data + +> `readonly` **data**: `Uint8Array` + +Defined in: [legacy/tx.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L91) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`data`](../interfaces/TransactionInterface.md#data) + +*** + +### gasLimit + +> `readonly` **gasLimit**: `bigint` + +Defined in: [legacy/tx.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L89) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`gasLimit`](../interfaces/TransactionInterface.md#gaslimit) + +*** + +### gasPrice + +> `readonly` **gasPrice**: `bigint` + +Defined in: [legacy/tx.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L87) + +*** + +### nonce + +> `readonly` **nonce**: `bigint` + +Defined in: [legacy/tx.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L88) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`nonce`](../interfaces/TransactionInterface.md#nonce) + +*** + +### r? + +> `readonly` `optional` **r**: `bigint` + +Defined in: [legacy/tx.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L96) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`r`](../interfaces/TransactionInterface.md#r) + +*** + +### s? + +> `readonly` `optional` **s**: `bigint` + +Defined in: [legacy/tx.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L97) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`s`](../interfaces/TransactionInterface.md#s) + +*** + +### to? + +> `readonly` `optional` **to**: `Address` + +Defined in: [legacy/tx.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L92) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`to`](../interfaces/TransactionInterface.md#to) + +*** + +### txOptions + +> `readonly` **txOptions**: [`TxOptions`](../interfaces/TxOptions.md) + +Defined in: [legacy/tx.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L105) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`txOptions`](../interfaces/TransactionInterface.md#txoptions) + +*** + +### type + +> **type**: `0` = `TransactionType.Legacy` + +Defined in: [legacy/tx.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L84) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`type`](../interfaces/TransactionInterface.md#type) + +*** + +### v? + +> `readonly` `optional` **v**: `bigint` + +Defined in: [legacy/tx.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L95) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`v`](../interfaces/TransactionInterface.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [legacy/tx.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L90) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`value`](../interfaces/TransactionInterface.md#value) + +## Methods + +### addSignature() + +> **addSignature**(`v`, `r`, `s`, `convertV`): `LegacyTx` + +Defined in: [legacy/tx.ts:335](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L335) + +#### Parameters + +##### v + +`bigint` + +##### r + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +##### s + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +##### convertV + +`boolean` = `false` + +#### Returns + +`LegacyTx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`addSignature`](../interfaces/TransactionInterface.md#addsignature) + +*** + +### errorStr() + +> **errorStr**(): `string` + +Defined in: [legacy/tx.ts:407](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L407) + +Return a compact error string representation of the object + +#### Returns + +`string` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`errorStr`](../interfaces/TransactionInterface.md#errorstr) + +*** + +### getDataGas() + +> **getDataGas**(): `bigint` + +Defined in: [legacy/tx.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L279) + +The amount of gas paid for the data in this tx + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getDataGas`](../interfaces/TransactionInterface.md#getdatagas) + +*** + +### getEffectivePriorityFee() + +> **getEffectivePriorityFee**(`baseFee?`): `bigint` + +Defined in: [legacy/tx.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L191) + +#### Parameters + +##### baseFee? + +`bigint` + +#### Returns + +`bigint` + +*** + +### getHashedMessageToSign() + +> **getHashedMessageToSign**(): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [legacy/tx.ts:271](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L271) + +Returns the hashed serialized unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getHashedMessageToSign`](../interfaces/TransactionInterface.md#gethashedmessagetosign) + +*** + +### getIntrinsicGas() + +> **getIntrinsicGas**(): `bigint` + +Defined in: [legacy/tx.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L297) + +The minimum gas limit which the tx to have to be valid. +This covers costs as the standard fee (21000 gas), the data fee (paid for each calldata byte), +the optional creation fee (if the transaction creates a contract), and if relevant the gas +to be paid for access lists (EIP-2930) and authority lists (EIP-7702). + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getIntrinsicGas`](../interfaces/TransactionInterface.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [legacy/tx.ts:248](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L248) + +Returns the raw unsigned tx, which can be used +to sign the transaction (e.g. for sending to a hardware wallet). + +Note: the raw message message format for the legacy tx is not RLP encoded +and you might need to do yourself with: + +```javascript +import { RLP } from '@ethereumjs/rlp' +const message = tx.getMessageToSign() +const serializedMessage = RLP.encode(message)) // use this for the HW wallet input +``` + +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToSign`](../interfaces/TransactionInterface.md#getmessagetosign) + +*** + +### getMessageToVerifySignature() + +> **getMessageToVerifySignature**(): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [legacy/tx.ts:320](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L320) + +Computes a sha3-256 hash which can be used to verify the signature + +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getMessageToVerifySignature`](../interfaces/TransactionInterface.md#getmessagetoverifysignature) + +*** + +### getSenderAddress() + +> **getSenderAddress**(): `Address` + +Defined in: [legacy/tx.ts:396](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L396) + +#### Returns + +`Address` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderAddress`](../interfaces/TransactionInterface.md#getsenderaddress) + +*** + +### getSenderPublicKey() + +> **getSenderPublicKey**(): `Uint8Array` + +Defined in: [legacy/tx.ts:331](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L331) + +Returns the public key of the sender + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getSenderPublicKey`](../interfaces/TransactionInterface.md#getsenderpublickey) + +*** + +### getUpfrontCost() + +> **getUpfrontCost**(): `bigint` + +Defined in: [legacy/tx.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L303) + +The up front amount that an account must have for this transaction to be valid + +#### Returns + +`bigint` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getUpfrontCost`](../interfaces/TransactionInterface.md#getupfrontcost) + +*** + +### getValidationErrors() + +> **getValidationErrors**(): `string`[] + +Defined in: [legacy/tx.ts:384](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L384) + +#### Returns + +`string`[] + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`getValidationErrors`](../interfaces/TransactionInterface.md#getvalidationerrors) + +*** + +### hash() + +> **hash**(): `Uint8Array` + +Defined in: [legacy/tx.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L313) + +Computes a sha3-256 hash of the serialized tx. + +This method can only be used for signed txs (it throws otherwise). +Use Transaction.getMessageToSign to get a tx hash for the purpose of signing. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`hash`](../interfaces/TransactionInterface.md#hash) + +*** + +### isSigned() + +> **isSigned**(): `boolean` + +Defined in: [legacy/tx.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L187) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isSigned`](../interfaces/TransactionInterface.md#issigned) + +*** + +### isValid() + +> **isValid**(): `boolean` + +Defined in: [legacy/tx.ts:388](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L388) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`isValid`](../interfaces/TransactionInterface.md#isvalid) + +*** + +### raw() + +> **raw**(): `LegacyTxValuesArray` + +Defined in: [legacy/tx.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L208) + +Returns a Uint8Array Array of the raw Bytes of the legacy transaction, in order. + +Format: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]` + +For legacy txs this is also the correct format to add transactions +to a block with createBlockFromBytesArray (use the `serialize()` method +for typed txs). + +For an unsigned tx this method returns the empty Bytes values +for the signature parameters `v`, `r` and `s`. For an EIP-155 compliant +representation have a look at Transaction.getMessageToSign. + +#### Returns + +`LegacyTxValuesArray` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`raw`](../interfaces/TransactionInterface.md#raw) + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [legacy/tx.ts:231](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L231) + +Returns the serialized encoding of the legacy transaction. + +Format: `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])` + +For an unsigned tx this method uses the empty Uint8Array values for the +signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant +representation for external signing use Transaction.getMessageToSign. + +#### Returns + +`Uint8Array` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`serialize`](../interfaces/TransactionInterface.md#serialize) + +*** + +### sign() + +> **sign**(`privateKey`, `extraEntropy`): `LegacyTx` + +Defined in: [legacy/tx.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L400) + +#### Parameters + +##### privateKey + +`Uint8Array` + +##### extraEntropy + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +`LegacyTx` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`sign`](../interfaces/TransactionInterface.md#sign) + +*** + +### supports() + +> **supports**(`capability`): `boolean` + +Defined in: [legacy/tx.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L183) + +Checks if a tx type defining capability is active +on a tx, for example the EIP-1559 fee market mechanism +or the EIP-2930 access list feature. + +Note that this is different from the tx type itself, +so EIP-2930 access lists can very well be active +on an EIP-1559 tx for example. + +This method can be useful for feature checks if the +tx type is unknown (e.g. when instantiated with +the tx factory). + +See `Capabilities` in the `types` module for a reference +on all supported capabilities. + +#### Parameters + +##### capability + +`number` + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`supports`](../interfaces/TransactionInterface.md#supports) + +*** + +### toCreationAddress() + +> **toCreationAddress**(): `boolean` + +Defined in: [legacy/tx.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L287) + +If the tx's `to` is to the creation address + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toCreationAddress`](../interfaces/TransactionInterface.md#tocreationaddress) + +*** + +### toJSON() + +> **toJSON**(): [`JSONTx`](../interfaces/JSONTx.md) + +Defined in: [legacy/tx.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L375) + +Returns an object with the JSON representation of the transaction. + +#### Returns + +[`JSONTx`](../interfaces/JSONTx.md) + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`toJSON`](../interfaces/TransactionInterface.md#tojson) + +*** + +### verifySignature() + +> **verifySignature**(): `boolean` + +Defined in: [legacy/tx.ts:392](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/tx.ts#L392) + +#### Returns + +`boolean` + +#### Implementation of + +[`TransactionInterface`](../interfaces/TransactionInterface.md).[`verifySignature`](../interfaces/TransactionInterface.md#verifysignature) diff --git a/packages/tx/docs/classes/TransactionFactory.md b/packages/tx/docs/classes/TransactionFactory.md deleted file mode 100644 index cad9708da3f..00000000000 --- a/packages/tx/docs/classes/TransactionFactory.md +++ /dev/null @@ -1,153 +0,0 @@ -[@ethereumjs/tx](../README.md) / TransactionFactory - -# Class: TransactionFactory - -## Table of contents - -### Methods - -- [fromBlockBodyData](TransactionFactory.md#fromblockbodydata) -- [fromJsonRpcProvider](TransactionFactory.md#fromjsonrpcprovider) -- [fromRPC](TransactionFactory.md#fromrpc) -- [fromSerializedData](TransactionFactory.md#fromserializeddata) -- [fromTxData](TransactionFactory.md#fromtxdata) - -## Methods - -### fromBlockBodyData - -▸ `Static` **fromBlockBodyData**(`data`, `txOptions?`): [`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) \| [`LegacyTransaction`](LegacyTransaction.md) \| [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) \| [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -When decoding a BlockBody, in the transactions field, a field is either: -A Uint8Array (a TypedTransaction - encoded as TransactionType || rlp(TransactionPayload)) -A Uint8Array[] (Legacy Transaction) -This method returns the right transaction. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `data` | `Uint8Array` \| `Uint8Array`[] | A Uint8Array or Uint8Array[] | -| `txOptions` | [`TxOptions`](../interfaces/TxOptions.md) | The transaction options | - -#### Returns - -[`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) \| [`LegacyTransaction`](LegacyTransaction.md) \| [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) \| [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md) - -#### Defined in - -[tx/src/transactionFactory.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L87) - -___ - -### fromJsonRpcProvider - -▸ `Static` **fromJsonRpcProvider**(`provider`, `txHash`, `txOptions?`): `Promise`<[`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) \| [`LegacyTransaction`](LegacyTransaction.md) \| [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) \| [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md)\> - -Method to retrieve a transaction from the provider - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `provider` | `string` \| `EthersProvider` | a url string for a JSON-RPC provider or an Ethers JsonRPCProvider object | -| `txHash` | `string` | Transaction hash | -| `txOptions?` | [`TxOptions`](../interfaces/TxOptions.md) | The transaction options | - -#### Returns - -`Promise`<[`FeeMarketEIP1559Transaction`](FeeMarketEIP1559Transaction.md) \| [`LegacyTransaction`](LegacyTransaction.md) \| [`AccessListEIP2930Transaction`](AccessListEIP2930Transaction.md) \| [`BlobEIP4844Transaction`](BlobEIP4844Transaction.md)\> - -the transaction specified by `txHash` - -#### Defined in - -[tx/src/transactionFactory.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L105) - -___ - -### fromRPC - -▸ `Static` **fromRPC**<`T`\>(`txData`, `txOptions?`): `Promise`<[`Transaction`](../interfaces/Transaction.md)[`T`]\> - -Method to decode data retrieved from RPC, such as `eth_getTransactionByHash` -Note that this normalizes some of the parameters - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `txData` | [`TxData`](../interfaces/TxData.md)[`T`] | The RPC-encoded data | -| `txOptions` | [`TxOptions`](../interfaces/TxOptions.md) | The transaction options | - -#### Returns - -`Promise`<[`Transaction`](../interfaces/Transaction.md)[`T`]\> - -#### Defined in - -[tx/src/transactionFactory.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L128) - -___ - -### fromSerializedData - -▸ `Static` **fromSerializedData**<`T`\>(`data`, `txOptions?`): [`Transaction`](../interfaces/Transaction.md)[`T`] - -This method tries to decode serialized data. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `data` | `Uint8Array` | The data Uint8Array | -| `txOptions` | [`TxOptions`](../interfaces/TxOptions.md) | The transaction options | - -#### Returns - -[`Transaction`](../interfaces/Transaction.md)[`T`] - -#### Defined in - -[tx/src/transactionFactory.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L57) - -___ - -### fromTxData - -▸ `Static` **fromTxData**<`T`\>(`txData`, `txOptions?`): [`Transaction`](../interfaces/Transaction.md)[`T`] - -Create a transaction from a `txData` object - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `txData` | [`TypedTxData`](../README.md#typedtxdata) | The transaction data. The `type` field will determine which transaction type is returned (if undefined, creates a legacy transaction) | -| `txOptions` | [`TxOptions`](../interfaces/TxOptions.md) | Options to pass on to the constructor of the transaction | - -#### Returns - -[`Transaction`](../interfaces/Transaction.md)[`T`] - -#### Defined in - -[tx/src/transactionFactory.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L29) diff --git a/packages/tx/docs/enums/Capability.md b/packages/tx/docs/enums/Capability.md deleted file mode 100644 index 3856fa9f31e..00000000000 --- a/packages/tx/docs/enums/Capability.md +++ /dev/null @@ -1,67 +0,0 @@ -[@ethereumjs/tx](../README.md) / Capability - -# Enumeration: Capability - -Can be used in conjunction with [[TransactionType].supports](../interfaces/Transaction.md) -to query on tx capabilities - -## Table of contents - -### Enumeration Members - -- [EIP1559FeeMarket](Capability.md#eip1559feemarket) -- [EIP155ReplayProtection](Capability.md#eip155replayprotection) -- [EIP2718TypedTransaction](Capability.md#eip2718typedtransaction) -- [EIP2930AccessLists](Capability.md#eip2930accesslists) - -## Enumeration Members - -### EIP1559FeeMarket - -• **EIP1559FeeMarket** = ``1559`` - -Tx supports EIP-1559 gas fee market mechanism -See: [1559](https://eips.ethereum.org/EIPS/eip-1559) Fee Market EIP - -#### Defined in - -[tx/src/types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L31) - -___ - -### EIP155ReplayProtection - -• **EIP155ReplayProtection** = ``155`` - -Tx supports EIP-155 replay protection -See: [155](https://eips.ethereum.org/EIPS/eip-155) Replay Attack Protection EIP - -#### Defined in - -[tx/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L25) - -___ - -### EIP2718TypedTransaction - -• **EIP2718TypedTransaction** = ``2718`` - -Tx is a typed transaction as defined in EIP-2718 -See: [2718](https://eips.ethereum.org/EIPS/eip-2718) Transaction Type EIP - -#### Defined in - -[tx/src/types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L37) - -___ - -### EIP2930AccessLists - -• **EIP2930AccessLists** = ``2930`` - -Tx supports access list generation as defined in EIP-2930 -See: [2930](https://eips.ethereum.org/EIPS/eip-2930) Access Lists EIP - -#### Defined in - -[tx/src/types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L43) diff --git a/packages/tx/docs/enums/TransactionType.md b/packages/tx/docs/enums/TransactionType.md deleted file mode 100644 index df58c088805..00000000000 --- a/packages/tx/docs/enums/TransactionType.md +++ /dev/null @@ -1,54 +0,0 @@ -[@ethereumjs/tx](../README.md) / TransactionType - -# Enumeration: TransactionType - -Encompassing type for all transaction types. - -## Table of contents - -### Enumeration Members - -- [AccessListEIP2930](TransactionType.md#accesslisteip2930) -- [BlobEIP4844](TransactionType.md#blobeip4844) -- [FeeMarketEIP1559](TransactionType.md#feemarketeip1559) -- [Legacy](TransactionType.md#legacy) - -## Enumeration Members - -### AccessListEIP2930 - -• **AccessListEIP2930** = ``1`` - -#### Defined in - -[tx/src/types.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L110) - -___ - -### BlobEIP4844 - -• **BlobEIP4844** = ``3`` - -#### Defined in - -[tx/src/types.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L112) - -___ - -### FeeMarketEIP1559 - -• **FeeMarketEIP1559** = ``2`` - -#### Defined in - -[tx/src/types.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L111) - -___ - -### Legacy - -• **Legacy** = ``0`` - -#### Defined in - -[tx/src/types.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L109) diff --git a/packages/tx/docs/functions/accessListBytesToJSON.md b/packages/tx/docs/functions/accessListBytesToJSON.md new file mode 100644 index 00000000000..bef60a6738e --- /dev/null +++ b/packages/tx/docs/functions/accessListBytesToJSON.md @@ -0,0 +1,25 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / accessListBytesToJSON + +# Function: accessListBytesToJSON() + +> **accessListBytesToJSON**(`accessList`): [`AccessList`](../type-aliases/AccessList.md) + +Defined in: [util/access.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/access.ts#L11) + +Converts an access list in bytes to a JSON format + +## Parameters + +### accessList + +[`AccessListBytes`](../type-aliases/AccessListBytes.md) + +## Returns + +[`AccessList`](../type-aliases/AccessList.md) + +JSON format of the access list diff --git a/packages/tx/docs/functions/accessListJSONToBytes.md b/packages/tx/docs/functions/accessListJSONToBytes.md new file mode 100644 index 00000000000..dbd24373f06 --- /dev/null +++ b/packages/tx/docs/functions/accessListJSONToBytes.md @@ -0,0 +1,25 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / accessListJSONToBytes + +# Function: accessListJSONToBytes() + +> **accessListJSONToBytes**(`accessList`): [`AccessListBytes`](../type-aliases/AccessListBytes.md) + +Defined in: [util/access.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/access.ts#L23) + +Converts an access list in JSON to a bytes format + +## Parameters + +### accessList + +[`AccessList`](../type-aliases/AccessList.md) + +## Returns + +[`AccessListBytes`](../type-aliases/AccessListBytes.md) + +bytes format of the access list diff --git a/packages/tx/docs/functions/authorizationHashedMessageToSign.md b/packages/tx/docs/functions/authorizationHashedMessageToSign.md new file mode 100644 index 00000000000..aadc27ee072 --- /dev/null +++ b/packages/tx/docs/functions/authorizationHashedMessageToSign.md @@ -0,0 +1,23 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / authorizationHashedMessageToSign + +# Function: authorizationHashedMessageToSign() + +> **authorizationHashedMessageToSign**(`input`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [util/authorization.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/authorization.ts#L114) + +Hashes the RLP-encoded message to sign + +## Parameters + +### input + +[`AuthorizationListItemUnsigned`](../type-aliases/AuthorizationListItemUnsigned.md) | [`AuthorizationListBytesItemUnsigned`](../type-aliases/AuthorizationListBytesItemUnsigned.md) + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> diff --git a/packages/tx/docs/functions/authorizationListBytesItemToJSON.md b/packages/tx/docs/functions/authorizationListBytesItemToJSON.md new file mode 100644 index 00000000000..7d80f53f406 --- /dev/null +++ b/packages/tx/docs/functions/authorizationListBytesItemToJSON.md @@ -0,0 +1,25 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / authorizationListBytesItemToJSON + +# Function: authorizationListBytesItemToJSON() + +> **authorizationListBytesItemToJSON**(`authorizationList`): [`AuthorizationListItem`](../type-aliases/AuthorizationListItem.md) + +Defined in: [util/authorization.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/authorization.ts#L33) + +Converts an authorization list to a JSON format + +## Parameters + +### authorizationList + +[`AuthorizationListBytesItem`](../type-aliases/AuthorizationListBytesItem.md) + +## Returns + +[`AuthorizationListItem`](../type-aliases/AuthorizationListItem.md) + +authorizationList in JSON format diff --git a/packages/tx/docs/functions/authorizationListJSONItemToBytes.md b/packages/tx/docs/functions/authorizationListJSONItemToBytes.md new file mode 100644 index 00000000000..390b5060411 --- /dev/null +++ b/packages/tx/docs/functions/authorizationListJSONItemToBytes.md @@ -0,0 +1,25 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / authorizationListJSONItemToBytes + +# Function: authorizationListJSONItemToBytes() + +> **authorizationListJSONItemToBytes**(`authorizationList`): [`AuthorizationListBytesItem`](../type-aliases/AuthorizationListBytesItem.md) + +Defined in: [util/authorization.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/authorization.ts#L52) + +Converts an authority list in JSON to a bytes format + +## Parameters + +### authorizationList + +[`AuthorizationListItem`](../type-aliases/AuthorizationListItem.md) + +## Returns + +[`AuthorizationListBytesItem`](../type-aliases/AuthorizationListBytesItem.md) + +bytes format of the authority list diff --git a/packages/tx/docs/functions/authorizationMessageToSign.md b/packages/tx/docs/functions/authorizationMessageToSign.md new file mode 100644 index 00000000000..eab46c38fdc --- /dev/null +++ b/packages/tx/docs/functions/authorizationMessageToSign.md @@ -0,0 +1,25 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / authorizationMessageToSign + +# Function: authorizationMessageToSign() + +> **authorizationMessageToSign**(`input`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [util/authorization.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/authorization.ts#L90) + +Returns the bytes (RLP-encoded) to sign + +## Parameters + +### input + +Either the bytes or the object format of the authorization list item + +[`AuthorizationListItemUnsigned`](../type-aliases/AuthorizationListItemUnsigned.md) | [`AuthorizationListBytesItemUnsigned`](../type-aliases/AuthorizationListBytesItemUnsigned.md) + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> diff --git a/packages/tx/docs/functions/blobTxNetworkWrapperToJSON.md b/packages/tx/docs/functions/blobTxNetworkWrapperToJSON.md new file mode 100644 index 00000000000..3d1fa85f0bc --- /dev/null +++ b/packages/tx/docs/functions/blobTxNetworkWrapperToJSON.md @@ -0,0 +1,34 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / blobTxNetworkWrapperToJSON + +# Function: blobTxNetworkWrapperToJSON() + +> **blobTxNetworkWrapperToJSON**(`serialized`, `opts?`): [`JSONBlobTxNetworkWrapper`](../type-aliases/JSONBlobTxNetworkWrapper.md) + +Defined in: [4844/constructors.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/constructors.ts#L329) + +Returns the EIP 4844 transaction network wrapper in JSON format similar to toJSON, including +blobs, commitments, and proofs fields + +## Parameters + +### serialized + +`Uint8Array` + +a buffer representing a serialized BlobTransactionNetworkWrapper + +### opts? + +[`TxOptions`](../interfaces/TxOptions.md) + +any TxOptions defined + +## Returns + +[`JSONBlobTxNetworkWrapper`](../type-aliases/JSONBlobTxNetworkWrapper.md) + +JSONBlobTxNetworkWrapper with blobs, KZG commitments, and KZG proofs fields diff --git a/packages/tx/docs/functions/create1559FeeMarketTxFromBytesArray.md b/packages/tx/docs/functions/create1559FeeMarketTxFromBytesArray.md new file mode 100644 index 00000000000..c565640aed7 --- /dev/null +++ b/packages/tx/docs/functions/create1559FeeMarketTxFromBytesArray.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / create1559FeeMarketTxFromBytesArray + +# Function: create1559FeeMarketTxFromBytesArray() + +> **create1559FeeMarketTxFromBytesArray**(`values`, `opts`): [`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) + +Defined in: [1559/constructors.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/constructors.ts#L38) + +Create a transaction from an array of byte encoded values ordered according to the devp2p network encoding - format noted below. + +Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, signatureYParity, signatureR, signatureS]` + +## Parameters + +### values + +`FeeMarketEIP1559TxValuesArray` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) diff --git a/packages/tx/docs/functions/createAccessList2930Tx.md b/packages/tx/docs/functions/createAccessList2930Tx.md new file mode 100644 index 00000000000..d60740a8b88 --- /dev/null +++ b/packages/tx/docs/functions/createAccessList2930Tx.md @@ -0,0 +1,34 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createAccessList2930Tx + +# Function: createAccessList2930Tx() + +> **createAccessList2930Tx**(`txData`, `opts`): [`AccessList2930Tx`](../classes/AccessList2930Tx.md) + +Defined in: [2930/constructors.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/constructors.ts#L28) + +Instantiate a transaction from a data dictionary. + +Format: { chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, +v, r, s } + +Notes: +- `chainId` will be set automatically if not provided +- All parameters are optional and have some basic default values + +## Parameters + +### txData + +[`AccessList2930TxData`](../interfaces/AccessList2930TxData.md) + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`AccessList2930Tx`](../classes/AccessList2930Tx.md) diff --git a/packages/tx/docs/functions/createAccessList2930TxFromBytesArray.md b/packages/tx/docs/functions/createAccessList2930TxFromBytesArray.md new file mode 100644 index 00000000000..7945fab0132 --- /dev/null +++ b/packages/tx/docs/functions/createAccessList2930TxFromBytesArray.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createAccessList2930TxFromBytesArray + +# Function: createAccessList2930TxFromBytesArray() + +> **createAccessList2930TxFromBytesArray**(`values`, `opts`): [`AccessList2930Tx`](../classes/AccessList2930Tx.md) + +Defined in: [2930/constructors.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/constructors.ts#L38) + +Create a transaction from an array of byte encoded values ordered according to the devp2p network encoding - format noted below. + +Format: `[chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, +signatureYParity (v), signatureR (r), signatureS (s)]` + +## Parameters + +### values + +`AccessList2930TxValuesArray` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`AccessList2930Tx`](../classes/AccessList2930Tx.md) diff --git a/packages/tx/docs/functions/createAccessList2930TxFromRLP.md b/packages/tx/docs/functions/createAccessList2930TxFromRLP.md new file mode 100644 index 00000000000..dba31d4e6ec --- /dev/null +++ b/packages/tx/docs/functions/createAccessList2930TxFromRLP.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createAccessList2930TxFromRLP + +# Function: createAccessList2930TxFromRLP() + +> **createAccessList2930TxFromRLP**(`serialized`, `opts`): [`AccessList2930Tx`](../classes/AccessList2930Tx.md) + +Defined in: [2930/constructors.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/2930/constructors.ts#L76) + +Instantiate a transaction from a RLP serialized tx. + +Format: `0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, +signatureYParity (v), signatureR (r), signatureS (s)])` + +## Parameters + +### serialized + +`Uint8Array` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`AccessList2930Tx`](../classes/AccessList2930Tx.md) diff --git a/packages/tx/docs/functions/createBlob4844Tx.md b/packages/tx/docs/functions/createBlob4844Tx.md new file mode 100644 index 00000000000..b929847bb08 --- /dev/null +++ b/packages/tx/docs/functions/createBlob4844Tx.md @@ -0,0 +1,36 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createBlob4844Tx + +# Function: createBlob4844Tx() + +> **createBlob4844Tx**(`txData`, `opts?`): [`Blob4844Tx`](../classes/Blob4844Tx.md) + +Defined in: [4844/constructors.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/constructors.ts#L80) + +Instantiate a transaction from a data dictionary. + +Format: { chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, +v, r, s, blobs, kzgCommitments, blobVersionedHashes, kzgProofs } + +Notes: +- `chainId` will be set automatically if not provided +- All parameters are optional and have some basic default values +- `blobs` cannot be supplied as well as `kzgCommitments`, `blobVersionedHashes`, `kzgProofs` +- If `blobs` is passed in, `kzgCommitments`, `blobVersionedHashes`, `kzgProofs` will be derived by the constructor + +## Parameters + +### txData + +[`BlobEIP4844TxData`](../interfaces/BlobEIP4844TxData.md) + +### opts? + +[`TxOptions`](../interfaces/TxOptions.md) + +## Returns + +[`Blob4844Tx`](../classes/Blob4844Tx.md) diff --git a/packages/tx/docs/functions/createBlob4844TxFromBytesArray.md b/packages/tx/docs/functions/createBlob4844TxFromBytesArray.md new file mode 100644 index 00000000000..be555524f36 --- /dev/null +++ b/packages/tx/docs/functions/createBlob4844TxFromBytesArray.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createBlob4844TxFromBytesArray + +# Function: createBlob4844TxFromBytesArray() + +> **createBlob4844TxFromBytesArray**(`values`, `opts`): [`Blob4844Tx`](../classes/Blob4844Tx.md) + +Defined in: [4844/constructors.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/constructors.ts#L129) + +Create a transaction from an array of byte encoded values ordered according to the devp2p network encoding - format noted below. + +Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, signatureYParity, signatureR, signatureS]` + +## Parameters + +### values + +`BlobEIP4844TxValuesArray` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`Blob4844Tx`](../classes/Blob4844Tx.md) diff --git a/packages/tx/docs/functions/createBlob4844TxFromRLP.md b/packages/tx/docs/functions/createBlob4844TxFromRLP.md new file mode 100644 index 00000000000..2470e13a848 --- /dev/null +++ b/packages/tx/docs/functions/createBlob4844TxFromRLP.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createBlob4844TxFromRLP + +# Function: createBlob4844TxFromRLP() + +> **createBlob4844TxFromRLP**(`serialized`, `opts`): [`Blob4844Tx`](../classes/Blob4844Tx.md) + +Defined in: [4844/constructors.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/constructors.ts#L199) + +Instantiate a transaction from a RLP serialized tx. + +Format: `0x03 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, +access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s])` + +## Parameters + +### serialized + +`Uint8Array` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`Blob4844Tx`](../classes/Blob4844Tx.md) diff --git a/packages/tx/docs/functions/createBlob4844TxFromSerializedNetworkWrapper.md b/packages/tx/docs/functions/createBlob4844TxFromSerializedNetworkWrapper.md new file mode 100644 index 00000000000..710857df2fb --- /dev/null +++ b/packages/tx/docs/functions/createBlob4844TxFromSerializedNetworkWrapper.md @@ -0,0 +1,33 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createBlob4844TxFromSerializedNetworkWrapper + +# Function: createBlob4844TxFromSerializedNetworkWrapper() + +> **createBlob4844TxFromSerializedNetworkWrapper**(`serialized`, `opts?`): [`Blob4844Tx`](../classes/Blob4844Tx.md) + +Defined in: [4844/constructors.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/constructors.ts#L229) + +Creates a transaction from the network encoding of a blob transaction (with blobs/commitments/proof) + +## Parameters + +### serialized + +`Uint8Array` + +a buffer representing a serialized BlobTransactionNetworkWrapper + +### opts? + +[`TxOptions`](../interfaces/TxOptions.md) + +any TxOptions defined + +## Returns + +[`Blob4844Tx`](../classes/Blob4844Tx.md) + +a Blob4844Tx diff --git a/packages/tx/docs/functions/createEOACode7702Tx.md b/packages/tx/docs/functions/createEOACode7702Tx.md new file mode 100644 index 00000000000..2f5305b8e4b --- /dev/null +++ b/packages/tx/docs/functions/createEOACode7702Tx.md @@ -0,0 +1,34 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createEOACode7702Tx + +# Function: createEOACode7702Tx() + +> **createEOACode7702Tx**(`txData`, `opts`): [`EOACode7702Tx`](../classes/EOACode7702Tx.md) + +Defined in: [7702/constructors.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/constructors.ts#L28) + +Instantiate a transaction from a data dictionary. + +Format: { chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, v, r, s } + +Notes: +- `chainId` will be set automatically if not provided +- All parameters are optional and have some basic default values + +## Parameters + +### txData + +[`EOACode7702TxData`](../interfaces/EOACode7702TxData.md) + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`EOACode7702Tx`](../classes/EOACode7702Tx.md) diff --git a/packages/tx/docs/functions/createEOACode7702TxFromBytesArray.md b/packages/tx/docs/functions/createEOACode7702TxFromBytesArray.md new file mode 100644 index 00000000000..e4aff71f331 --- /dev/null +++ b/packages/tx/docs/functions/createEOACode7702TxFromBytesArray.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createEOACode7702TxFromBytesArray + +# Function: createEOACode7702TxFromBytesArray() + +> **createEOACode7702TxFromBytesArray**(`values`, `opts`): [`EOACode7702Tx`](../classes/EOACode7702Tx.md) + +Defined in: [7702/constructors.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/constructors.ts#L38) + +Create a transaction from an array of byte encoded values ordered according to the devp2p network encoding - format noted below. + +Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, signatureYParity, signatureR, signatureS]` + +## Parameters + +### values + +`EOACode7702TxValuesArray` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`EOACode7702Tx`](../classes/EOACode7702Tx.md) diff --git a/packages/tx/docs/functions/createEOACode7702TxFromRLP.md b/packages/tx/docs/functions/createEOACode7702TxFromRLP.md new file mode 100644 index 00000000000..cfbc1b4e89f --- /dev/null +++ b/packages/tx/docs/functions/createEOACode7702TxFromRLP.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createEOACode7702TxFromRLP + +# Function: createEOACode7702TxFromRLP() + +> **createEOACode7702TxFromRLP**(`serialized`, `opts`): [`EOACode7702Tx`](../classes/EOACode7702Tx.md) + +Defined in: [7702/constructors.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/7702/constructors.ts#L90) + +Instantiate a transaction from a RLP serialized tx. + +Format: `0x04 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, signatureYParity, signatureR, signatureS])` + +## Parameters + +### serialized + +`Uint8Array` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`EOACode7702Tx`](../classes/EOACode7702Tx.md) diff --git a/packages/tx/docs/functions/createFeeMarket1559Tx.md b/packages/tx/docs/functions/createFeeMarket1559Tx.md new file mode 100644 index 00000000000..b330faa543b --- /dev/null +++ b/packages/tx/docs/functions/createFeeMarket1559Tx.md @@ -0,0 +1,34 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createFeeMarket1559Tx + +# Function: createFeeMarket1559Tx() + +> **createFeeMarket1559Tx**(`txData`, `opts`): [`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) + +Defined in: [1559/constructors.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/constructors.ts#L28) + +Instantiate a transaction from a data dictionary. + +Format: { chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, v, r, s } + +Notes: +- `chainId` will be set automatically if not provided +- All parameters are optional and have some basic default values + +## Parameters + +### txData + +[`FeeMarketEIP1559TxData`](../interfaces/FeeMarketEIP1559TxData.md) + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) diff --git a/packages/tx/docs/functions/createFeeMarket1559TxFromRLP.md b/packages/tx/docs/functions/createFeeMarket1559TxFromRLP.md new file mode 100644 index 00000000000..cf5c8a69f31 --- /dev/null +++ b/packages/tx/docs/functions/createFeeMarket1559TxFromRLP.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createFeeMarket1559TxFromRLP + +# Function: createFeeMarket1559TxFromRLP() + +> **createFeeMarket1559TxFromRLP**(`serialized`, `opts`): [`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) + +Defined in: [1559/constructors.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/1559/constructors.ts#L88) + +Instantiate a transaction from an RLP serialized tx. + +Format: `0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, +accessList, signatureYParity, signatureR, signatureS])` + +## Parameters + +### serialized + +`Uint8Array` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) diff --git a/packages/tx/docs/functions/createLegacyTx.md b/packages/tx/docs/functions/createLegacyTx.md new file mode 100644 index 00000000000..c165a967cca --- /dev/null +++ b/packages/tx/docs/functions/createLegacyTx.md @@ -0,0 +1,32 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createLegacyTx + +# Function: createLegacyTx() + +> **createLegacyTx**(`txData`, `opts`): [`LegacyTx`](../classes/LegacyTx.md) + +Defined in: [legacy/constructors.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/constructors.ts#L17) + +Instantiate a transaction from a data dictionary. + +Format: { nonce, gasPrice, gasLimit, to, value, data, v, r, s } + +Notes: +- All parameters are optional and have some basic default values + +## Parameters + +### txData + +[`LegacyTxData`](../type-aliases/LegacyTxData.md) + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`LegacyTx`](../classes/LegacyTx.md) diff --git a/packages/tx/docs/functions/createLegacyTxFromBytesArray.md b/packages/tx/docs/functions/createLegacyTxFromBytesArray.md new file mode 100644 index 00000000000..243803f770c --- /dev/null +++ b/packages/tx/docs/functions/createLegacyTxFromBytesArray.md @@ -0,0 +1,29 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createLegacyTxFromBytesArray + +# Function: createLegacyTxFromBytesArray() + +> **createLegacyTxFromBytesArray**(`values`, `opts`): [`LegacyTx`](../classes/LegacyTx.md) + +Defined in: [legacy/constructors.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/constructors.ts#L26) + +Create a transaction from an array of byte encoded values ordered according to the devp2p network encoding - format noted below. + +Format: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]` + +## Parameters + +### values + +`LegacyTxValuesArray` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`LegacyTx`](../classes/LegacyTx.md) diff --git a/packages/tx/docs/functions/createLegacyTxFromRLP.md b/packages/tx/docs/functions/createLegacyTxFromRLP.md new file mode 100644 index 00000000000..427b8fcd37b --- /dev/null +++ b/packages/tx/docs/functions/createLegacyTxFromRLP.md @@ -0,0 +1,30 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createLegacyTxFromRLP + +# Function: createLegacyTxFromRLP() + +> **createLegacyTxFromRLP**(`serialized`, `opts`): [`LegacyTx`](../classes/LegacyTx.md) + +Defined in: [legacy/constructors.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/legacy/constructors.ts#L61) + +Instantiate a transaction from a RLP serialized tx. + +Format: `rlp([nonce, gasPrice, gasLimit, to, value, data, +signatureV, signatureR, signatureS])` + +## Parameters + +### serialized + +`Uint8Array` + +### opts + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +## Returns + +[`LegacyTx`](../classes/LegacyTx.md) diff --git a/packages/tx/docs/functions/createMinimal4844TxFromNetworkWrapper.md b/packages/tx/docs/functions/createMinimal4844TxFromNetworkWrapper.md new file mode 100644 index 00000000000..d1b44801ec7 --- /dev/null +++ b/packages/tx/docs/functions/createMinimal4844TxFromNetworkWrapper.md @@ -0,0 +1,34 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createMinimal4844TxFromNetworkWrapper + +# Function: createMinimal4844TxFromNetworkWrapper() + +> **createMinimal4844TxFromNetworkWrapper**(`txData`, `opts?`): [`Blob4844Tx`](../classes/Blob4844Tx.md) + +Defined in: [4844/constructors.ts:302](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/4844/constructors.ts#L302) + +Creates the minimal representation of a blob transaction from the network wrapper version. +The minimal representation is used when adding transactions to an execution payload/block + +## Parameters + +### txData + +[`Blob4844Tx`](../classes/Blob4844Tx.md) + +a [Blob4844Tx](../classes/Blob4844Tx.md) containing optional blobs/kzg commitments + +### opts? + +[`TxOptions`](../interfaces/TxOptions.md) + +dictionary of [TxOptions](../interfaces/TxOptions.md) + +## Returns + +[`Blob4844Tx`](../classes/Blob4844Tx.md) + +the "minimal" representation of a Blob4844Tx (i.e. transaction object minus blobs and kzg commitments) diff --git a/packages/tx/docs/functions/createTx.md b/packages/tx/docs/functions/createTx.md new file mode 100644 index 00000000000..0c499c8d52f --- /dev/null +++ b/packages/tx/docs/functions/createTx.md @@ -0,0 +1,37 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createTx + +# Function: createTx() + +> **createTx**\<`T`\>(`txData`, `txOptions`): [`Transaction`](../interfaces/Transaction.md)\[`T`\] + +Defined in: [transactionFactory.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L30) + +Create a transaction from a `txData` object + +## Type Parameters + +### T + +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) + +## Parameters + +### txData + +[`TypedTxData`](../type-aliases/TypedTxData.md) + +The transaction data. The `type` field will determine which transaction type is returned (if undefined, creates a legacy transaction) + +### txOptions + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +Options to pass on to the constructor of the transaction + +## Returns + +[`Transaction`](../interfaces/Transaction.md)\[`T`\] diff --git a/packages/tx/docs/functions/createTxFromBlockBodyData.md b/packages/tx/docs/functions/createTxFromBlockBodyData.md new file mode 100644 index 00000000000..39da4903365 --- /dev/null +++ b/packages/tx/docs/functions/createTxFromBlockBodyData.md @@ -0,0 +1,34 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createTxFromBlockBodyData + +# Function: createTxFromBlockBodyData() + +> **createTxFromBlockBodyData**(`data`, `txOptions`): [`LegacyTx`](../classes/LegacyTx.md) \| [`AccessList2930Tx`](../classes/AccessList2930Tx.md) \| [`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) \| [`Blob4844Tx`](../classes/Blob4844Tx.md) \| [`EOACode7702Tx`](../classes/EOACode7702Tx.md) + +Defined in: [transactionFactory.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L94) + +When decoding a BlockBody, in the transactions field, a field is either: +A Uint8Array (a TypedTransaction - encoded as TransactionType || rlp(TransactionPayload)) +A Uint8Array[] (Legacy Transaction) +This method returns the right transaction. + +## Parameters + +### data + +A Uint8Array or Uint8Array[] + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +### txOptions + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +The transaction options + +## Returns + +[`LegacyTx`](../classes/LegacyTx.md) \| [`AccessList2930Tx`](../classes/AccessList2930Tx.md) \| [`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) \| [`Blob4844Tx`](../classes/Blob4844Tx.md) \| [`EOACode7702Tx`](../classes/EOACode7702Tx.md) diff --git a/packages/tx/docs/functions/createTxFromJSONRPCProvider.md b/packages/tx/docs/functions/createTxFromJSONRPCProvider.md new file mode 100644 index 00000000000..b0bc8874104 --- /dev/null +++ b/packages/tx/docs/functions/createTxFromJSONRPCProvider.md @@ -0,0 +1,39 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createTxFromJSONRPCProvider + +# Function: createTxFromJSONRPCProvider() + +> **createTxFromJSONRPCProvider**(`provider`, `txHash`, `txOptions?`): `Promise`\<[`LegacyTx`](../classes/LegacyTx.md) \| [`AccessList2930Tx`](../classes/AccessList2930Tx.md) \| [`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) \| [`Blob4844Tx`](../classes/Blob4844Tx.md) \| [`EOACode7702Tx`](../classes/EOACode7702Tx.md)\> + +Defined in: [transactionFactory.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L129) + +Method to retrieve a transaction from the provider + +## Parameters + +### provider + +a url string for a JSON-RPC provider or an Ethers JSONRPCProvider object + +`string` | `EthersProvider` + +### txHash + +`string` + +Transaction hash + +### txOptions? + +[`TxOptions`](../interfaces/TxOptions.md) + +The transaction options + +## Returns + +`Promise`\<[`LegacyTx`](../classes/LegacyTx.md) \| [`AccessList2930Tx`](../classes/AccessList2930Tx.md) \| [`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) \| [`Blob4844Tx`](../classes/Blob4844Tx.md) \| [`EOACode7702Tx`](../classes/EOACode7702Tx.md)\> + +the transaction specified by `txHash` diff --git a/packages/tx/docs/functions/createTxFromRLP.md b/packages/tx/docs/functions/createTxFromRLP.md new file mode 100644 index 00000000000..f2705c7da70 --- /dev/null +++ b/packages/tx/docs/functions/createTxFromRLP.md @@ -0,0 +1,37 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createTxFromRLP + +# Function: createTxFromRLP() + +> **createTxFromRLP**\<`T`\>(`data`, `txOptions`): [`Transaction`](../interfaces/Transaction.md)\[`T`\] + +Defined in: [transactionFactory.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L62) + +This method tries to decode serialized data. + +## Type Parameters + +### T + +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) + +## Parameters + +### data + +`Uint8Array` + +The data Uint8Array + +### txOptions + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +The transaction options + +## Returns + +[`Transaction`](../interfaces/Transaction.md)\[`T`\] diff --git a/packages/tx/docs/functions/createTxFromRPC.md b/packages/tx/docs/functions/createTxFromRPC.md new file mode 100644 index 00000000000..aefae2e7733 --- /dev/null +++ b/packages/tx/docs/functions/createTxFromRPC.md @@ -0,0 +1,38 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / createTxFromRPC + +# Function: createTxFromRPC() + +> **createTxFromRPC**\<`T`\>(`txData`, `txOptions`): `Promise`\<[`Transaction`](../interfaces/Transaction.md)\[`T`\]\> + +Defined in: [transactionFactory.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/transactionFactory.ts#L115) + +Method to decode data retrieved from RPC, such as `eth_getTransactionByHash` +Note that this normalizes some of the parameters + +## Type Parameters + +### T + +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) + +## Parameters + +### txData + +[`TxData`](../interfaces/TxData.md)\[`T`\] + +The RPC-encoded data + +### txOptions + +[`TxOptions`](../interfaces/TxOptions.md) = `{}` + +The transaction options + +## Returns + +`Promise`\<[`Transaction`](../interfaces/Transaction.md)\[`T`\]\> diff --git a/packages/tx/docs/functions/isAccessList.md b/packages/tx/docs/functions/isAccessList.md new file mode 100644 index 00000000000..48ab57d51a9 --- /dev/null +++ b/packages/tx/docs/functions/isAccessList.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isAccessList + +# Function: isAccessList() + +> **isAccessList**(`input`): `input is AccessList` + +Defined in: [types.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L117) + +## Parameters + +### input + +[`AccessListBytes`](../type-aliases/AccessListBytes.md) | [`AccessList`](../type-aliases/AccessList.md) + +## Returns + +`input is AccessList` diff --git a/packages/tx/docs/functions/isAccessList2930Tx.md b/packages/tx/docs/functions/isAccessList2930Tx.md new file mode 100644 index 00000000000..c2558b1971c --- /dev/null +++ b/packages/tx/docs/functions/isAccessList2930Tx.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isAccessList2930Tx + +# Function: isAccessList2930Tx() + +> **isAccessList2930Tx**(`tx`): `tx is AccessList2930Tx` + +Defined in: [types.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L177) + +## Parameters + +### tx + +[`TypedTransaction`](../type-aliases/TypedTransaction.md) + +## Returns + +`tx is AccessList2930Tx` diff --git a/packages/tx/docs/functions/isAccessList2930TxData.md b/packages/tx/docs/functions/isAccessList2930TxData.md new file mode 100644 index 00000000000..8b9584549eb --- /dev/null +++ b/packages/tx/docs/functions/isAccessList2930TxData.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isAccessList2930TxData + +# Function: isAccessList2930TxData() + +> **isAccessList2930TxData**(`txData`): `txData is AccessList2930TxData` + +Defined in: [types.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L287) + +## Parameters + +### txData + +[`TypedTxData`](../type-aliases/TypedTxData.md) + +## Returns + +`txData is AccessList2930TxData` diff --git a/packages/tx/docs/functions/isAccessListBytes.md b/packages/tx/docs/functions/isAccessListBytes.md new file mode 100644 index 00000000000..3109024f973 --- /dev/null +++ b/packages/tx/docs/functions/isAccessListBytes.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isAccessListBytes + +# Function: isAccessListBytes() + +> **isAccessListBytes**(`input`): `input is AccessListBytes` + +Defined in: [types.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L106) + +## Parameters + +### input + +[`AccessListBytes`](../type-aliases/AccessListBytes.md) | [`AccessList`](../type-aliases/AccessList.md) + +## Returns + +`input is AccessListBytes` diff --git a/packages/tx/docs/functions/isAuthorizationList.md b/packages/tx/docs/functions/isAuthorizationList.md new file mode 100644 index 00000000000..b74819473e1 --- /dev/null +++ b/packages/tx/docs/functions/isAuthorizationList.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isAuthorizationList + +# Function: isAuthorizationList() + +> **isAuthorizationList**(`input`): `input is AuthorizationList` + +Defined in: [types.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L134) + +## Parameters + +### input + +[`AuthorizationListBytes`](../type-aliases/AuthorizationListBytes.md) | [`AuthorizationList`](../type-aliases/AuthorizationList.md) + +## Returns + +`input is AuthorizationList` diff --git a/packages/tx/docs/functions/isAuthorizationListBytes.md b/packages/tx/docs/functions/isAuthorizationListBytes.md new file mode 100644 index 00000000000..ae29a6e7142 --- /dev/null +++ b/packages/tx/docs/functions/isAuthorizationListBytes.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isAuthorizationListBytes + +# Function: isAuthorizationListBytes() + +> **isAuthorizationListBytes**(`input`): `input is AuthorizationListBytes` + +Defined in: [types.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L121) + +## Parameters + +### input + +[`AuthorizationListBytes`](../type-aliases/AuthorizationListBytes.md) | [`AuthorizationList`](../type-aliases/AuthorizationList.md) + +## Returns + +`input is AuthorizationListBytes` diff --git a/packages/tx/docs/functions/isBlob4844Tx.md b/packages/tx/docs/functions/isBlob4844Tx.md new file mode 100644 index 00000000000..1aa7fae8743 --- /dev/null +++ b/packages/tx/docs/functions/isBlob4844Tx.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isBlob4844Tx + +# Function: isBlob4844Tx() + +> **isBlob4844Tx**(`tx`): `tx is Blob4844Tx` + +Defined in: [types.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L185) + +## Parameters + +### tx + +[`TypedTransaction`](../type-aliases/TypedTransaction.md) + +## Returns + +`tx is Blob4844Tx` diff --git a/packages/tx/docs/functions/isBlob4844TxData.md b/packages/tx/docs/functions/isBlob4844TxData.md new file mode 100644 index 00000000000..67ab95d08e5 --- /dev/null +++ b/packages/tx/docs/functions/isBlob4844TxData.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isBlob4844TxData + +# Function: isBlob4844TxData() + +> **isBlob4844TxData**(`txData`): `txData is BlobEIP4844TxData` + +Defined in: [types.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L297) + +## Parameters + +### txData + +[`TypedTxData`](../type-aliases/TypedTxData.md) + +## Returns + +`txData is BlobEIP4844TxData` diff --git a/packages/tx/docs/functions/isEOACode7702Tx.md b/packages/tx/docs/functions/isEOACode7702Tx.md new file mode 100644 index 00000000000..8b86e671829 --- /dev/null +++ b/packages/tx/docs/functions/isEOACode7702Tx.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isEOACode7702Tx + +# Function: isEOACode7702Tx() + +> **isEOACode7702Tx**(`tx`): `tx is EOACode7702Tx` + +Defined in: [types.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L189) + +## Parameters + +### tx + +[`TypedTransaction`](../type-aliases/TypedTransaction.md) + +## Returns + +`tx is EOACode7702Tx` diff --git a/packages/tx/docs/functions/isEOACode7702TxData.md b/packages/tx/docs/functions/isEOACode7702TxData.md new file mode 100644 index 00000000000..f8db4afc258 --- /dev/null +++ b/packages/tx/docs/functions/isEOACode7702TxData.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isEOACode7702TxData + +# Function: isEOACode7702TxData() + +> **isEOACode7702TxData**(`txData`): `txData is EOACode7702TxData` + +Defined in: [types.ts:302](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L302) + +## Parameters + +### txData + +[`TypedTxData`](../type-aliases/TypedTxData.md) + +## Returns + +`txData is EOACode7702TxData` diff --git a/packages/tx/docs/functions/isFeeMarket1559Tx.md b/packages/tx/docs/functions/isFeeMarket1559Tx.md new file mode 100644 index 00000000000..c088deb62af --- /dev/null +++ b/packages/tx/docs/functions/isFeeMarket1559Tx.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isFeeMarket1559Tx + +# Function: isFeeMarket1559Tx() + +> **isFeeMarket1559Tx**(`tx`): `tx is FeeMarket1559Tx` + +Defined in: [types.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L181) + +## Parameters + +### tx + +[`TypedTransaction`](../type-aliases/TypedTransaction.md) + +## Returns + +`tx is FeeMarket1559Tx` diff --git a/packages/tx/docs/functions/isFeeMarket1559TxData.md b/packages/tx/docs/functions/isFeeMarket1559TxData.md new file mode 100644 index 00000000000..b34f2bc138e --- /dev/null +++ b/packages/tx/docs/functions/isFeeMarket1559TxData.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isFeeMarket1559TxData + +# Function: isFeeMarket1559TxData() + +> **isFeeMarket1559TxData**(`txData`): `txData is FeeMarketEIP1559TxData` + +Defined in: [types.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L292) + +## Parameters + +### txData + +[`TypedTxData`](../type-aliases/TypedTxData.md) + +## Returns + +`txData is FeeMarketEIP1559TxData` diff --git a/packages/tx/docs/functions/isLegacyTx.md b/packages/tx/docs/functions/isLegacyTx.md new file mode 100644 index 00000000000..9dcafba5df4 --- /dev/null +++ b/packages/tx/docs/functions/isLegacyTx.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isLegacyTx + +# Function: isLegacyTx() + +> **isLegacyTx**(`tx`): `tx is LegacyTx` + +Defined in: [types.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L173) + +## Parameters + +### tx + +[`TypedTransaction`](../type-aliases/TypedTransaction.md) + +## Returns + +`tx is LegacyTx` diff --git a/packages/tx/docs/functions/isLegacyTxData.md b/packages/tx/docs/functions/isLegacyTxData.md new file mode 100644 index 00000000000..df34a6cdc43 --- /dev/null +++ b/packages/tx/docs/functions/isLegacyTxData.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / isLegacyTxData + +# Function: isLegacyTxData() + +> **isLegacyTxData**(`txData`): `txData is LegacyTxData` + +Defined in: [types.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L282) + +## Parameters + +### txData + +[`TypedTxData`](../type-aliases/TypedTxData.md) + +## Returns + +`txData is LegacyTxData` diff --git a/packages/tx/docs/functions/normalizeTxParams.md b/packages/tx/docs/functions/normalizeTxParams.md new file mode 100644 index 00000000000..445b61c655f --- /dev/null +++ b/packages/tx/docs/functions/normalizeTxParams.md @@ -0,0 +1,28 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / normalizeTxParams + +# Function: normalizeTxParams() + +> **normalizeTxParams**(`txParamsFromRPC`): [`TypedTxData`](../type-aliases/TypedTxData.md) + +Defined in: [util/general.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/general.ts#L11) + +Normalizes values for transactions that are received from an RPC provider to be properly usable within +the ethereumjs context + +## Parameters + +### txParamsFromRPC + +`any` + +a transaction in the standard JSON-RPC format + +## Returns + +[`TypedTxData`](../type-aliases/TypedTxData.md) + +a normalized [TypedTxData](../type-aliases/TypedTxData.md) object with valid values diff --git a/packages/tx/docs/functions/recoverAuthority.md b/packages/tx/docs/functions/recoverAuthority.md new file mode 100644 index 00000000000..4f02025b8c3 --- /dev/null +++ b/packages/tx/docs/functions/recoverAuthority.md @@ -0,0 +1,21 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / recoverAuthority + +# Function: recoverAuthority() + +> **recoverAuthority**(`input`): `Address` + +Defined in: [util/authorization.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/authorization.ts#L149) + +## Parameters + +### input + +[`AuthorizationListBytesItem`](../type-aliases/AuthorizationListBytesItem.md) | [`AuthorizationListItem`](../type-aliases/AuthorizationListItem.md) + +## Returns + +`Address` diff --git a/packages/tx/docs/functions/signAuthorization.md b/packages/tx/docs/functions/signAuthorization.md new file mode 100644 index 00000000000..8ca2985ab29 --- /dev/null +++ b/packages/tx/docs/functions/signAuthorization.md @@ -0,0 +1,32 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / signAuthorization + +# Function: signAuthorization() + +> **signAuthorization**(`input`, `privateKey`, `common?`): [`AuthorizationListBytesItem`](../type-aliases/AuthorizationListBytesItem.md) + +Defined in: [util/authorization.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/util/authorization.ts#L127) + +Signs an authorization list item and returns it in `bytes` format. +To get the JSON format, use `authorizationListBytesToJSON([signed])[0] to convert it` + +## Parameters + +### input + +[`AuthorizationListItemUnsigned`](../type-aliases/AuthorizationListItemUnsigned.md) | [`AuthorizationListBytesItemUnsigned`](../type-aliases/AuthorizationListBytesItemUnsigned.md) + +### privateKey + +`Uint8Array` + +### common? + +`Common` + +## Returns + +[`AuthorizationListBytesItem`](../type-aliases/AuthorizationListBytesItem.md) diff --git a/packages/tx/docs/interfaces/AccessList2930TxData.md b/packages/tx/docs/interfaces/AccessList2930TxData.md new file mode 100644 index 00000000000..80aa533c83a --- /dev/null +++ b/packages/tx/docs/interfaces/AccessList2930TxData.md @@ -0,0 +1,179 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AccessList2930TxData + +# Interface: AccessList2930TxData + +Defined in: [types.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L366) + +[AccessList2930Tx](../classes/AccessList2930Tx.md) data. + +## Extends + +- [`LegacyTxData`](../type-aliases/LegacyTxData.md) + +## Extended by + +- [`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md) + +## Properties + +### accessList? + +> `optional` **accessList**: `null` \| [`AccessListBytes`](../type-aliases/AccessListBytes.md) \| [`AccessList`](../type-aliases/AccessList.md) + +Defined in: [types.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L375) + +The access list which contains the addresses/storage slots which the transaction wishes to access + +*** + +### chainId? + +> `optional` **chainId**: `BigIntLike` + +Defined in: [types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L370) + +The transaction's chain ID + +*** + +### data? + +> `optional` **data**: `""` \| `BytesLike` + +Defined in: [types.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L339) + +This will contain the data of the message or the init of a contract. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`data`](../type-aliases/LegacyTxData.md#data) + +*** + +### gasLimit? + +> `optional` **gasLimit**: `BigIntLike` + +Defined in: [types.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L324) + +The transaction's gas limit. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`gasLimit`](../type-aliases/LegacyTxData.md#gaslimit) + +*** + +### gasPrice? + +> `optional` **gasPrice**: `null` \| `BigIntLike` + +Defined in: [types.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L319) + +The transaction's gas price. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`gasPrice`](../type-aliases/LegacyTxData.md#gasprice) + +*** + +### nonce? + +> `optional` **nonce**: `BigIntLike` + +Defined in: [types.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L314) + +The transaction's nonce. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`nonce`](../type-aliases/LegacyTxData.md#nonce) + +*** + +### r? + +> `optional` **r**: `BigIntLike` + +Defined in: [types.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L349) + +EC signature parameter. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`r`](../type-aliases/LegacyTxData.md#r) + +*** + +### s? + +> `optional` **s**: `BigIntLike` + +Defined in: [types.ts:354](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L354) + +EC signature parameter. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`s`](../type-aliases/LegacyTxData.md#s) + +*** + +### to? + +> `optional` **to**: `""` \| `AddressLike` + +Defined in: [types.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L329) + +The transaction's the address is sent to. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`to`](../type-aliases/LegacyTxData.md#to) + +*** + +### type? + +> `optional` **type**: `BigIntLike` + +Defined in: [types.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L360) + +The transaction type + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`type`](../type-aliases/LegacyTxData.md#type) + +*** + +### v? + +> `optional` **v**: `BigIntLike` + +Defined in: [types.ts:344](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L344) + +EC recovery ID. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`v`](../type-aliases/LegacyTxData.md#v) + +*** + +### value? + +> `optional` **value**: `BigIntLike` + +Defined in: [types.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L334) + +The amount of Ether sent. + +#### Inherited from + +[`LegacyTxData`](../type-aliases/LegacyTxData.md).[`value`](../type-aliases/LegacyTxData.md#value) diff --git a/packages/tx/docs/interfaces/AccessListEIP2930TxData.md b/packages/tx/docs/interfaces/AccessListEIP2930TxData.md deleted file mode 100644 index a82c16a7506..00000000000 --- a/packages/tx/docs/interfaces/AccessListEIP2930TxData.md +++ /dev/null @@ -1,214 +0,0 @@ -[@ethereumjs/tx](../README.md) / AccessListEIP2930TxData - -# Interface: AccessListEIP2930TxData - -[AccessListEIP2930Transaction](../classes/AccessListEIP2930Transaction.md) data. - -## Hierarchy - -- [`LegacyTxData`](../README.md#legacytxdata) - - ↳ **`AccessListEIP2930TxData`** - - ↳↳ [`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md) - -## Table of contents - -### Properties - -- [accessList](AccessListEIP2930TxData.md#accesslist) -- [chainId](AccessListEIP2930TxData.md#chainid) -- [data](AccessListEIP2930TxData.md#data) -- [gasLimit](AccessListEIP2930TxData.md#gaslimit) -- [gasPrice](AccessListEIP2930TxData.md#gasprice) -- [nonce](AccessListEIP2930TxData.md#nonce) -- [r](AccessListEIP2930TxData.md#r) -- [s](AccessListEIP2930TxData.md#s) -- [to](AccessListEIP2930TxData.md#to) -- [type](AccessListEIP2930TxData.md#type) -- [v](AccessListEIP2930TxData.md#v) -- [value](AccessListEIP2930TxData.md#value) - -## Properties - -### accessList - -• `Optional` **accessList**: ``null`` \| [`AccessListBytes`](../README.md#accesslistbytes) \| [`AccessList`](../README.md#accesslist) - -The access list which contains the addresses/storage slots which the transaction wishes to access - -#### Defined in - -[tx/src/types.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L303) - -___ - -### chainId - -• `Optional` **chainId**: `BigIntLike` - -The transaction's chain ID - -#### Defined in - -[tx/src/types.ts:298](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L298) - -___ - -### data - -• `Optional` **data**: `BytesLike` - -This will contain the data of the message or the init of a contract. - -#### Inherited from - -LegacyTxData.data - -#### Defined in - -[tx/src/types.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L267) - -___ - -### gasLimit - -• `Optional` **gasLimit**: `BigIntLike` - -The transaction's gas limit. - -#### Inherited from - -LegacyTxData.gasLimit - -#### Defined in - -[tx/src/types.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L252) - -___ - -### gasPrice - -• `Optional` **gasPrice**: ``null`` \| `BigIntLike` - -The transaction's gas price. - -#### Inherited from - -LegacyTxData.gasPrice - -#### Defined in - -[tx/src/types.ts:247](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L247) - -___ - -### nonce - -• `Optional` **nonce**: `BigIntLike` - -The transaction's nonce. - -#### Inherited from - -LegacyTxData.nonce - -#### Defined in - -[tx/src/types.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L242) - -___ - -### r - -• `Optional` **r**: `BigIntLike` - -EC signature parameter. - -#### Inherited from - -LegacyTxData.r - -#### Defined in - -[tx/src/types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L277) - -___ - -### s - -• `Optional` **s**: `BigIntLike` - -EC signature parameter. - -#### Inherited from - -LegacyTxData.s - -#### Defined in - -[tx/src/types.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L282) - -___ - -### to - -• `Optional` **to**: `AddressLike` - -The transaction's the address is sent to. - -#### Inherited from - -LegacyTxData.to - -#### Defined in - -[tx/src/types.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L257) - -___ - -### type - -• `Optional` **type**: `BigIntLike` - -The transaction type - -#### Inherited from - -LegacyTxData.type - -#### Defined in - -[tx/src/types.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L288) - -___ - -### v - -• `Optional` **v**: `BigIntLike` - -EC recovery ID. - -#### Inherited from - -LegacyTxData.v - -#### Defined in - -[tx/src/types.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L272) - -___ - -### value - -• `Optional` **value**: `BigIntLike` - -The amount of Ether sent. - -#### Inherited from - -LegacyTxData.value - -#### Defined in - -[tx/src/types.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L262) diff --git a/packages/tx/docs/interfaces/BlobEIP4844TxData.md b/packages/tx/docs/interfaces/BlobEIP4844TxData.md index d0b209d9c32..10332740ff2 100644 --- a/packages/tx/docs/interfaces/BlobEIP4844TxData.md +++ b/packages/tx/docs/interfaces/BlobEIP4844TxData.md @@ -1,333 +1,272 @@ +[**@ethereumjs/tx**](../README.md) + +*** + [@ethereumjs/tx](../README.md) / BlobEIP4844TxData # Interface: BlobEIP4844TxData -[BlobEIP4844Transaction](../classes/BlobEIP4844Transaction.md) data. +Defined in: [types.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L400) -## Hierarchy +[Blob4844Tx](../classes/Blob4844Tx.md) data. -- [`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md) +## Extends - ↳ **`BlobEIP4844TxData`** - -## Table of contents - -### Properties - -- [accessList](BlobEIP4844TxData.md#accesslist) -- [blobVersionedHashes](BlobEIP4844TxData.md#blobversionedhashes) -- [blobs](BlobEIP4844TxData.md#blobs) -- [blobsData](BlobEIP4844TxData.md#blobsdata) -- [chainId](BlobEIP4844TxData.md#chainid) -- [data](BlobEIP4844TxData.md#data) -- [gasLimit](BlobEIP4844TxData.md#gaslimit) -- [gasPrice](BlobEIP4844TxData.md#gasprice) -- [kzgCommitments](BlobEIP4844TxData.md#kzgcommitments) -- [kzgProofs](BlobEIP4844TxData.md#kzgproofs) -- [maxFeePerBlobGas](BlobEIP4844TxData.md#maxfeeperblobgas) -- [maxFeePerGas](BlobEIP4844TxData.md#maxfeepergas) -- [maxPriorityFeePerGas](BlobEIP4844TxData.md#maxpriorityfeepergas) -- [nonce](BlobEIP4844TxData.md#nonce) -- [r](BlobEIP4844TxData.md#r) -- [s](BlobEIP4844TxData.md#s) -- [to](BlobEIP4844TxData.md#to) -- [type](BlobEIP4844TxData.md#type) -- [v](BlobEIP4844TxData.md#v) -- [value](BlobEIP4844TxData.md#value) +- [`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md) ## Properties -### accessList +### accessList? -• `Optional` **accessList**: ``null`` \| [`AccessListBytes`](../README.md#accesslistbytes) \| [`AccessList`](../README.md#accesslist) +> `optional` **accessList**: `null` \| [`AccessListBytes`](../type-aliases/AccessListBytes.md) \| [`AccessList`](../type-aliases/AccessList.md) + +Defined in: [types.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L375) The access list which contains the addresses/storage slots which the transaction wishes to access #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[accessList](FeeMarketEIP1559TxData.md#accesslist) - -#### Defined in - -[tx/src/types.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L303) - -___ +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`accessList`](FeeMarketEIP1559TxData.md#accesslist) -### blobVersionedHashes +*** -• `Optional` **blobVersionedHashes**: `BytesLike`[] +### blobs? -The versioned hashes used to validate the blobs attached to a transaction - -#### Defined in +> `optional` **blobs**: `BytesLike`[] -[tx/src/types.ts:332](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L332) +Defined in: [types.ts:412](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L412) -___ +The blobs associated with a transaction -### blobs +*** -• `Optional` **blobs**: `BytesLike`[] +### blobsData? -The blobs associated with a transaction +> `optional` **blobsData**: `string`[] -#### Defined in +Defined in: [types.ts:424](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L424) -[tx/src/types.ts:340](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L340) +An array of arbitrary strings that blobs are to be constructed from -___ +*** -### blobsData +### blobVersionedHashes? -• `Optional` **blobsData**: `string`[] +> `optional` **blobVersionedHashes**: `BytesLike`[] -An array of arbitrary strings that blobs are to be constructed from +Defined in: [types.ts:404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L404) -#### Defined in +The versioned hashes used to validate the blobs attached to a transaction -[tx/src/types.ts:352](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L352) +*** -___ +### chainId? -### chainId +> `optional` **chainId**: `BigIntLike` -• `Optional` **chainId**: `BigIntLike` +Defined in: [types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L370) The transaction's chain ID #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[chainId](FeeMarketEIP1559TxData.md#chainid) - -#### Defined in +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`chainId`](FeeMarketEIP1559TxData.md#chainid) -[tx/src/types.ts:298](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L298) +*** -___ +### data? -### data +> `optional` **data**: `""` \| `BytesLike` -• `Optional` **data**: `BytesLike` +Defined in: [types.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L339) This will contain the data of the message or the init of a contract. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[data](FeeMarketEIP1559TxData.md#data) +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`data`](FeeMarketEIP1559TxData.md#data) -#### Defined in +*** -[tx/src/types.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L267) +### gasLimit? -___ +> `optional` **gasLimit**: `BigIntLike` -### gasLimit - -• `Optional` **gasLimit**: `BigIntLike` +Defined in: [types.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L324) The transaction's gas limit. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[gasLimit](FeeMarketEIP1559TxData.md#gaslimit) - -#### Defined in +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`gasLimit`](FeeMarketEIP1559TxData.md#gaslimit) -[tx/src/types.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L252) +*** -___ +### gasPrice? -### gasPrice +> `optional` **gasPrice**: `null` -• `Optional` **gasPrice**: ``null`` +Defined in: [types.ts:386](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L386) The transaction's gas price, inherited from [Transaction](Transaction.md). This property is not used for EIP1559 transactions and should always be undefined for this specific transaction type. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[gasPrice](FeeMarketEIP1559TxData.md#gasprice) +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`gasPrice`](FeeMarketEIP1559TxData.md#gasprice) -#### Defined in +*** -[tx/src/types.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L314) +### kzgCommitments? -___ +> `optional` **kzgCommitments**: `BytesLike`[] -### kzgCommitments - -• `Optional` **kzgCommitments**: `BytesLike`[] +Defined in: [types.ts:416](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L416) The KZG commitments corresponding to the versioned hashes for each blob -#### Defined in - -[tx/src/types.ts:344](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L344) +*** -___ +### kzgProofs? -### kzgProofs +> `optional` **kzgProofs**: `BytesLike`[] -• `Optional` **kzgProofs**: `BytesLike`[] +Defined in: [types.ts:420](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L420) The KZG proofs associated with the transaction -#### Defined in +*** -[tx/src/types.ts:348](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L348) +### maxFeePerBlobGas? -___ +> `optional` **maxFeePerBlobGas**: `BigIntLike` -### maxFeePerBlobGas - -• `Optional` **maxFeePerBlobGas**: `BigIntLike` +Defined in: [types.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L408) The maximum fee per blob gas paid for the transaction -#### Defined in - -[tx/src/types.ts:336](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L336) +*** -___ +### maxFeePerGas? -### maxFeePerGas +> `optional` **maxFeePerGas**: `BigIntLike` -• `Optional` **maxFeePerGas**: `BigIntLike` +Defined in: [types.ts:394](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L394) The maximum total fee #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[maxFeePerGas](FeeMarketEIP1559TxData.md#maxfeepergas) +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`maxFeePerGas`](FeeMarketEIP1559TxData.md#maxfeepergas) -#### Defined in +*** -[tx/src/types.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L322) +### maxPriorityFeePerGas? -___ +> `optional` **maxPriorityFeePerGas**: `BigIntLike` -### maxPriorityFeePerGas - -• `Optional` **maxPriorityFeePerGas**: `BigIntLike` +Defined in: [types.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L390) The maximum inclusion fee per gas (this fee is given to the miner) #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[maxPriorityFeePerGas](FeeMarketEIP1559TxData.md#maxpriorityfeepergas) - -#### Defined in +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`maxPriorityFeePerGas`](FeeMarketEIP1559TxData.md#maxpriorityfeepergas) -[tx/src/types.ts:318](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L318) +*** -___ +### nonce? -### nonce +> `optional` **nonce**: `BigIntLike` -• `Optional` **nonce**: `BigIntLike` +Defined in: [types.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L314) The transaction's nonce. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[nonce](FeeMarketEIP1559TxData.md#nonce) +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`nonce`](FeeMarketEIP1559TxData.md#nonce) -#### Defined in +*** -[tx/src/types.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L242) +### r? -___ +> `optional` **r**: `BigIntLike` -### r - -• `Optional` **r**: `BigIntLike` +Defined in: [types.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L349) EC signature parameter. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[r](FeeMarketEIP1559TxData.md#r) - -#### Defined in +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`r`](FeeMarketEIP1559TxData.md#r) -[tx/src/types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L277) +*** -___ +### s? -### s +> `optional` **s**: `BigIntLike` -• `Optional` **s**: `BigIntLike` +Defined in: [types.ts:354](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L354) EC signature parameter. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[s](FeeMarketEIP1559TxData.md#s) +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`s`](FeeMarketEIP1559TxData.md#s) -#### Defined in +*** -[tx/src/types.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L282) +### to? -___ +> `optional` **to**: `""` \| `AddressLike` -### to - -• `Optional` **to**: `AddressLike` +Defined in: [types.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L329) The transaction's the address is sent to. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[to](FeeMarketEIP1559TxData.md#to) - -#### Defined in +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`to`](FeeMarketEIP1559TxData.md#to) -[tx/src/types.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L257) +*** -___ +### type? -### type +> `optional` **type**: `BigIntLike` -• `Optional` **type**: `BigIntLike` +Defined in: [types.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L360) The transaction type #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[type](FeeMarketEIP1559TxData.md#type) +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`type`](FeeMarketEIP1559TxData.md#type) -#### Defined in +*** -[tx/src/types.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L288) +### v? -___ +> `optional` **v**: `BigIntLike` -### v - -• `Optional` **v**: `BigIntLike` +Defined in: [types.ts:344](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L344) EC recovery ID. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[v](FeeMarketEIP1559TxData.md#v) - -#### Defined in +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`v`](FeeMarketEIP1559TxData.md#v) -[tx/src/types.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L272) +*** -___ +### value? -### value +> `optional` **value**: `BigIntLike` -• `Optional` **value**: `BigIntLike` +Defined in: [types.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L334) The amount of Ether sent. #### Inherited from -[FeeMarketEIP1559TxData](FeeMarketEIP1559TxData.md).[value](FeeMarketEIP1559TxData.md#value) - -#### Defined in - -[tx/src/types.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L262) +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`value`](FeeMarketEIP1559TxData.md#value) diff --git a/packages/tx/docs/interfaces/EIP1559CompatibleTx.md b/packages/tx/docs/interfaces/EIP1559CompatibleTx.md index 7ad7b85b934..73f7eedb3d4 100644 --- a/packages/tx/docs/interfaces/EIP1559CompatibleTx.md +++ b/packages/tx/docs/interfaces/EIP1559CompatibleTx.md @@ -1,322 +1,269 @@ +[**@ethereumjs/tx**](../README.md) + +*** + [@ethereumjs/tx](../README.md) / EIP1559CompatibleTx -# Interface: EIP1559CompatibleTx - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) = [`TransactionType`](../enums/TransactionType.md) | - -## Hierarchy - -- [`EIP2930CompatibleTx`](EIP2930CompatibleTx.md)<`T`\> - - ↳ **`EIP1559CompatibleTx`** - - ↳↳ [`EIP4844CompatibleTx`](EIP4844CompatibleTx.md) - -## Table of contents - -### Properties - -- [AccessListJSON](EIP1559CompatibleTx.md#accesslistjson) -- [accessList](EIP1559CompatibleTx.md#accesslist) -- [cache](EIP1559CompatibleTx.md#cache) -- [chainId](EIP1559CompatibleTx.md#chainid) -- [common](EIP1559CompatibleTx.md#common) -- [data](EIP1559CompatibleTx.md#data) -- [gasLimit](EIP1559CompatibleTx.md#gaslimit) -- [maxFeePerGas](EIP1559CompatibleTx.md#maxfeepergas) -- [maxPriorityFeePerGas](EIP1559CompatibleTx.md#maxpriorityfeepergas) -- [nonce](EIP1559CompatibleTx.md#nonce) -- [r](EIP1559CompatibleTx.md#r) -- [s](EIP1559CompatibleTx.md#s) -- [to](EIP1559CompatibleTx.md#to) -- [type](EIP1559CompatibleTx.md#type) -- [v](EIP1559CompatibleTx.md#v) -- [value](EIP1559CompatibleTx.md#value) - -### Methods - -- [errorStr](EIP1559CompatibleTx.md#errorstr) -- [getBaseFee](EIP1559CompatibleTx.md#getbasefee) -- [getDataFee](EIP1559CompatibleTx.md#getdatafee) -- [getHashedMessageToSign](EIP1559CompatibleTx.md#gethashedmessagetosign) -- [getMessageToSign](EIP1559CompatibleTx.md#getmessagetosign) -- [getMessageToVerifySignature](EIP1559CompatibleTx.md#getmessagetoverifysignature) -- [getSenderAddress](EIP1559CompatibleTx.md#getsenderaddress) -- [getSenderPublicKey](EIP1559CompatibleTx.md#getsenderpublickey) -- [getUpfrontCost](EIP1559CompatibleTx.md#getupfrontcost) -- [getValidationErrors](EIP1559CompatibleTx.md#getvalidationerrors) -- [hash](EIP1559CompatibleTx.md#hash) -- [isSigned](EIP1559CompatibleTx.md#issigned) -- [isValid](EIP1559CompatibleTx.md#isvalid) -- [raw](EIP1559CompatibleTx.md#raw) -- [serialize](EIP1559CompatibleTx.md#serialize) -- [sign](EIP1559CompatibleTx.md#sign) -- [supports](EIP1559CompatibleTx.md#supports) -- [toCreationAddress](EIP1559CompatibleTx.md#tocreationaddress) -- [toJSON](EIP1559CompatibleTx.md#tojson) -- [verifySignature](EIP1559CompatibleTx.md#verifysignature) +# Interface: EIP1559CompatibleTx\ -## Properties +Defined in: [types.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L249) -### AccessListJSON +## Extends -• `Readonly` **AccessListJSON**: [`AccessList`](../README.md#accesslist) +- [`EIP2930CompatibleTx`](EIP2930CompatibleTx.md)\<`T`\> -#### Inherited from +## Extended by -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[AccessListJSON](EIP2930CompatibleTx.md#accesslistjson) +- [`EIP4844CompatibleTx`](EIP4844CompatibleTx.md) +- [`EIP7702CompatibleTx`](EIP7702CompatibleTx.md) -#### Defined in +## Type Parameters -[tx/src/types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L186) +### T -___ +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) = [`TransactionType`](../type-aliases/TransactionType.md) -### accessList +## Properties -• `Readonly` **accessList**: [`AccessListBytes`](../README.md#accesslistbytes) +### accessList -#### Inherited from +> `readonly` **accessList**: [`AccessListBytes`](../type-aliases/AccessListBytes.md) -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[accessList](EIP2930CompatibleTx.md#accesslist) +Defined in: [types.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L246) -#### Defined in +#### Inherited from -[tx/src/types.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L185) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`accessList`](EIP2930CompatibleTx.md#accesslist) -___ +*** ### cache -• `Readonly` **cache**: [`TransactionCache`](TransactionCache.md) +> `readonly` **cache**: [`TransactionCache`](TransactionCache.md) -#### Inherited from - -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[cache](EIP2930CompatibleTx.md#cache) +Defined in: [types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L203) -#### Defined in +#### Inherited from -[tx/src/types.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L150) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`cache`](EIP2930CompatibleTx.md#cache) -___ +*** ### chainId -• `Readonly` **chainId**: `bigint` +> `readonly` **chainId**: `bigint` -#### Inherited from - -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[chainId](EIP2930CompatibleTx.md#chainid) +Defined in: [types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L240) -#### Defined in +#### Inherited from -[tx/src/types.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L179) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`chainId`](EIP2930CompatibleTx.md#chainid) -___ +*** ### common -• `Readonly` **common**: `Common` +> `readonly` **common**: `Common` -#### Inherited from - -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[common](EIP2930CompatibleTx.md#common) +Defined in: [types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L194) -#### Defined in +#### Inherited from -[tx/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L141) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`common`](EIP2930CompatibleTx.md#common) -___ +*** ### data -• `Readonly` **data**: `Uint8Array` +> `readonly` **data**: `Uint8Array` -#### Inherited from - -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[data](EIP2930CompatibleTx.md#data) +Defined in: [types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L199) -#### Defined in +#### Inherited from -[tx/src/types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L146) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`data`](EIP2930CompatibleTx.md#data) -___ +*** ### gasLimit -• `Readonly` **gasLimit**: `bigint` - -#### Inherited from +> `readonly` **gasLimit**: `bigint` -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[gasLimit](EIP2930CompatibleTx.md#gaslimit) +Defined in: [types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L196) -#### Defined in +#### Inherited from -[tx/src/types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L143) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`gasLimit`](EIP2930CompatibleTx.md#gaslimit) -___ +*** ### maxFeePerGas -• `Readonly` **maxFeePerGas**: `bigint` - -#### Defined in +> `readonly` **maxFeePerGas**: `bigint` -[tx/src/types.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L192) +Defined in: [types.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L252) -___ +*** ### maxPriorityFeePerGas -• `Readonly` **maxPriorityFeePerGas**: `bigint` - -#### Defined in +> `readonly` **maxPriorityFeePerGas**: `bigint` -[tx/src/types.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L191) +Defined in: [types.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L251) -___ +*** ### nonce -• `Readonly` **nonce**: `bigint` +> `readonly` **nonce**: `bigint` -#### Inherited from +Defined in: [types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L195) -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[nonce](EIP2930CompatibleTx.md#nonce) +#### Inherited from -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`nonce`](EIP2930CompatibleTx.md#nonce) -[tx/src/types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L142) +*** -___ +### r? -### r +> `readonly` `optional` **r**: `bigint` -• `Optional` `Readonly` **r**: `bigint` +Defined in: [types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L201) #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[r](EIP2930CompatibleTx.md#r) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`r`](EIP2930CompatibleTx.md#r) -[tx/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L148) +*** -___ +### s? -### s +> `readonly` `optional` **s**: `bigint` -• `Optional` `Readonly` **s**: `bigint` +Defined in: [types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L202) #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[s](EIP2930CompatibleTx.md#s) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`s`](EIP2930CompatibleTx.md#s) -#### Defined in +*** -[tx/src/types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L149) +### to? -___ +> `readonly` `optional` **to**: `Address` -### to - -• `Optional` `Readonly` **to**: `Address` +Defined in: [types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L197) #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[to](EIP2930CompatibleTx.md#to) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`to`](EIP2930CompatibleTx.md#to) + +*** + +### txOptions + +> **txOptions**: [`TxOptions`](TxOptions.md) + +Defined in: [types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L206) -#### Defined in +#### Inherited from -[tx/src/types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L144) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`txOptions`](EIP2930CompatibleTx.md#txoptions) -___ +*** ### type -• **type**: [`TransactionType`](../enums/TransactionType.md) +> **type**: [`TransactionType`](../type-aliases/TransactionType.md) + +Defined in: [types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L205) #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[type](EIP2930CompatibleTx.md#type) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`type`](EIP2930CompatibleTx.md#type) + +*** -#### Defined in +### v? -[tx/src/types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L152) +> `readonly` `optional` **v**: `bigint` -___ +Defined in: [types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L200) -### v +#### Inherited from + +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`v`](EIP2930CompatibleTx.md#v) -• `Optional` `Readonly` **v**: `bigint` +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L198) #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[v](EIP2930CompatibleTx.md#v) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`value`](EIP2930CompatibleTx.md#value) -#### Defined in +## Methods -[tx/src/types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L147) +### addSignature() -___ +> **addSignature**(`v`, `r`, `s`, `convertV?`): [`Transaction`](Transaction.md)\[`T`\] -### value +Defined in: [types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L227) -• `Readonly` **value**: `bigint` +#### Parameters -#### Inherited from +##### v + +`bigint` -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[value](EIP2930CompatibleTx.md#value) +##### r -#### Defined in +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -[tx/src/types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L145) +##### s -## Methods +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -### errorStr +##### convertV? -▸ **errorStr**(): `string` +`boolean` #### Returns -`string` +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[errorStr](EIP2930CompatibleTx.md#errorstr) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`addSignature`](EIP2930CompatibleTx.md#addsignature) -[tx/src/types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L171) +*** -___ +### errorStr() -### getBaseFee +> **errorStr**(): `string` -▸ **getBaseFee**(): `bigint` +Defined in: [types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L225) #### Returns -`bigint` +`string` #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getBaseFee](EIP2930CompatibleTx.md#getbasefee) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`errorStr`](EIP2930CompatibleTx.md#errorstr) -[tx/src/types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L153) +*** -___ +### getDataGas() -### getDataFee +> **getDataGas**(): `bigint` -▸ **getDataFee**(): `bigint` +Defined in: [types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L208) #### Returns @@ -324,17 +271,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getDataFee](EIP2930CompatibleTx.md#getdatafee) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getDataGas`](EIP2930CompatibleTx.md#getdatagas) -#### Defined in +*** -[tx/src/types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L154) +### getHashedMessageToSign() -___ +> **getHashedMessageToSign**(): `Uint8Array` -### getHashedMessageToSign - -▸ **getHashedMessageToSign**(): `Uint8Array` +Defined in: [types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L214) #### Returns @@ -342,17 +287,31 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getHashedMessageToSign](EIP2930CompatibleTx.md#gethashedmessagetosign) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getHashedMessageToSign`](EIP2930CompatibleTx.md#gethashedmessagetosign) + +*** + +### getIntrinsicGas() + +> **getIntrinsicGas**(): `bigint` + +Defined in: [types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L207) + +#### Returns + +`bigint` + +#### Inherited from -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getIntrinsicGas`](EIP2930CompatibleTx.md#getintrinsicgas) -[tx/src/types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L160) +*** -___ +### getMessageToSign() -### getMessageToSign +> **getMessageToSign**(): `Uint8Array` -▸ **getMessageToSign**(): `Uint8Array` +Defined in: [types.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L241) #### Returns @@ -360,17 +319,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getMessageToSign](EIP2930CompatibleTx.md#getmessagetosign) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getMessageToSign`](EIP2930CompatibleTx.md#getmessagetosign) -#### Defined in +*** -[tx/src/types.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L180) +### getMessageToVerifySignature() -___ +> **getMessageToVerifySignature**(): `Uint8Array` -### getMessageToVerifySignature - -▸ **getMessageToVerifySignature**(): `Uint8Array` +Defined in: [types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L216) #### Returns @@ -378,17 +335,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getMessageToVerifySignature](EIP2930CompatibleTx.md#getmessagetoverifysignature) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getMessageToVerifySignature`](EIP2930CompatibleTx.md#getmessagetoverifysignature) -[tx/src/types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L162) +*** -___ +### getSenderAddress() -### getSenderAddress +> **getSenderAddress**(): `Address` -▸ **getSenderAddress**(): `Address` +Defined in: [types.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L221) #### Returns @@ -396,17 +351,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getSenderAddress](EIP2930CompatibleTx.md#getsenderaddress) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getSenderAddress`](EIP2930CompatibleTx.md#getsenderaddress) -[tx/src/types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L167) +*** -___ +### getSenderPublicKey() -### getSenderPublicKey +> **getSenderPublicKey**(): `Uint8Array` -▸ **getSenderPublicKey**(): `Uint8Array` +Defined in: [types.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L222) #### Returns @@ -414,17 +367,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getSenderPublicKey](EIP2930CompatibleTx.md#getsenderpublickey) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getSenderPublicKey`](EIP2930CompatibleTx.md#getsenderpublickey) -#### Defined in +*** -[tx/src/types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L168) +### getUpfrontCost() -___ +> **getUpfrontCost**(): `bigint` -### getUpfrontCost - -▸ **getUpfrontCost**(): `bigint` +Defined in: [types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L209) #### Returns @@ -432,17 +383,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getUpfrontCost](EIP2930CompatibleTx.md#getupfrontcost) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getUpfrontCost`](EIP2930CompatibleTx.md#getupfrontcost) -[tx/src/types.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L155) +*** -___ +### getValidationErrors() -### getValidationErrors +> **getValidationErrors**(): `string`[] -▸ **getValidationErrors**(): `string`[] +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L217) #### Returns @@ -450,17 +399,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[getValidationErrors](EIP2930CompatibleTx.md#getvalidationerrors) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`getValidationErrors`](EIP2930CompatibleTx.md#getvalidationerrors) -[tx/src/types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L163) +*** -___ +### hash() -### hash +> **hash**(): `Uint8Array` -▸ **hash**(): `Uint8Array` +Defined in: [types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L215) #### Returns @@ -468,17 +415,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[hash](EIP2930CompatibleTx.md#hash) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`hash`](EIP2930CompatibleTx.md#hash) -#### Defined in +*** -[tx/src/types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L161) +### isSigned() -___ +> **isSigned**(): `boolean` -### isSigned - -▸ **isSigned**(): `boolean` +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L218) #### Returns @@ -486,17 +431,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[isSigned](EIP2930CompatibleTx.md#issigned) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`isSigned`](EIP2930CompatibleTx.md#issigned) -[tx/src/types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L164) +*** -___ +### isValid() -### isValid +> **isValid**(): `boolean` -▸ **isValid**(): `boolean` +Defined in: [types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L219) #### Returns @@ -504,35 +447,31 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[isValid](EIP2930CompatibleTx.md#isvalid) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`isValid`](EIP2930CompatibleTx.md#isvalid) -[tx/src/types.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L165) +*** -___ +### raw() -### raw +> **raw**(): [`TxValuesArray`](TxValuesArray.md)\[`T`\] -▸ **raw**(): [`TxValuesArray`](TxValuesArray.md)[`T`] +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L211) #### Returns -[`TxValuesArray`](TxValuesArray.md)[`T`] +[`TxValuesArray`](TxValuesArray.md)\[`T`\] #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[raw](EIP2930CompatibleTx.md#raw) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`raw`](EIP2930CompatibleTx.md#raw) -#### Defined in +*** -[tx/src/types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L157) +### serialize() -___ +> **serialize**(): `Uint8Array` -### serialize - -▸ **serialize**(): `Uint8Array` +Defined in: [types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L212) #### Returns @@ -540,47 +479,47 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[serialize](EIP2930CompatibleTx.md#serialize) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`serialize`](EIP2930CompatibleTx.md#serialize) -[tx/src/types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L158) +*** -___ +### sign() -### sign +> **sign**(`privateKey`, `extraEntropy?`): [`Transaction`](Transaction.md)\[`T`\] -▸ **sign**(`privateKey`): [`Transaction`](Transaction.md)[`T`] +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L223) #### Parameters -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | +##### privateKey + +`Uint8Array` + +##### extraEntropy? + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns -[`Transaction`](Transaction.md)[`T`] +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[sign](EIP2930CompatibleTx.md#sign) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`sign`](EIP2930CompatibleTx.md#sign) -[tx/src/types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L169) +*** -___ +### supports() -### supports +> **supports**(`capability`): `boolean` -▸ **supports**(`capability`): `boolean` +Defined in: [types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L204) #### Parameters -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | +##### capability + +`number` #### Returns @@ -588,17 +527,15 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[supports](EIP2930CompatibleTx.md#supports) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`supports`](EIP2930CompatibleTx.md#supports) -#### Defined in +*** -[tx/src/types.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L151) +### toCreationAddress() -___ +> **toCreationAddress**(): `boolean` -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` +Defined in: [types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L210) #### Returns @@ -606,35 +543,31 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[toCreationAddress](EIP2930CompatibleTx.md#tocreationaddress) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`toCreationAddress`](EIP2930CompatibleTx.md#tocreationaddress) -[tx/src/types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L156) +*** -___ +### toJSON() -### toJSON +> **toJSON**(): [`JSONTx`](JSONTx.md) -▸ **toJSON**(): [`JsonTx`](JsonTx.md) +Defined in: [types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L224) #### Returns -[`JsonTx`](JsonTx.md) +[`JSONTx`](JSONTx.md) #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[toJSON](EIP2930CompatibleTx.md#tojson) - -#### Defined in +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`toJSON`](EIP2930CompatibleTx.md#tojson) -[tx/src/types.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L170) +*** -___ +### verifySignature() -### verifySignature +> **verifySignature**(): `boolean` -▸ **verifySignature**(): `boolean` +Defined in: [types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L220) #### Returns @@ -642,8 +575,4 @@ ___ #### Inherited from -[EIP2930CompatibleTx](EIP2930CompatibleTx.md).[verifySignature](EIP2930CompatibleTx.md#verifysignature) - -#### Defined in - -[tx/src/types.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L166) +[`EIP2930CompatibleTx`](EIP2930CompatibleTx.md).[`verifySignature`](EIP2930CompatibleTx.md#verifysignature) diff --git a/packages/tx/docs/interfaces/EIP2718CompatibleTx.md b/packages/tx/docs/interfaces/EIP2718CompatibleTx.md index 20cfc055dc7..1f5f89fac6c 100644 --- a/packages/tx/docs/interfaces/EIP2718CompatibleTx.md +++ b/packages/tx/docs/interfaces/EIP2718CompatibleTx.md @@ -1,266 +1,236 @@ +[**@ethereumjs/tx**](../README.md) + +*** + [@ethereumjs/tx](../README.md) / EIP2718CompatibleTx -# Interface: EIP2718CompatibleTx - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) = [`TransactionType`](../enums/TransactionType.md) | - -## Hierarchy - -- [`TransactionInterface`](TransactionInterface.md)<`T`\> - - ↳ **`EIP2718CompatibleTx`** - - ↳↳ [`EIP2930CompatibleTx`](EIP2930CompatibleTx.md) - -## Table of contents - -### Properties - -- [cache](EIP2718CompatibleTx.md#cache) -- [chainId](EIP2718CompatibleTx.md#chainid) -- [common](EIP2718CompatibleTx.md#common) -- [data](EIP2718CompatibleTx.md#data) -- [gasLimit](EIP2718CompatibleTx.md#gaslimit) -- [nonce](EIP2718CompatibleTx.md#nonce) -- [r](EIP2718CompatibleTx.md#r) -- [s](EIP2718CompatibleTx.md#s) -- [to](EIP2718CompatibleTx.md#to) -- [type](EIP2718CompatibleTx.md#type) -- [v](EIP2718CompatibleTx.md#v) -- [value](EIP2718CompatibleTx.md#value) - -### Methods - -- [errorStr](EIP2718CompatibleTx.md#errorstr) -- [getBaseFee](EIP2718CompatibleTx.md#getbasefee) -- [getDataFee](EIP2718CompatibleTx.md#getdatafee) -- [getHashedMessageToSign](EIP2718CompatibleTx.md#gethashedmessagetosign) -- [getMessageToSign](EIP2718CompatibleTx.md#getmessagetosign) -- [getMessageToVerifySignature](EIP2718CompatibleTx.md#getmessagetoverifysignature) -- [getSenderAddress](EIP2718CompatibleTx.md#getsenderaddress) -- [getSenderPublicKey](EIP2718CompatibleTx.md#getsenderpublickey) -- [getUpfrontCost](EIP2718CompatibleTx.md#getupfrontcost) -- [getValidationErrors](EIP2718CompatibleTx.md#getvalidationerrors) -- [hash](EIP2718CompatibleTx.md#hash) -- [isSigned](EIP2718CompatibleTx.md#issigned) -- [isValid](EIP2718CompatibleTx.md#isvalid) -- [raw](EIP2718CompatibleTx.md#raw) -- [serialize](EIP2718CompatibleTx.md#serialize) -- [sign](EIP2718CompatibleTx.md#sign) -- [supports](EIP2718CompatibleTx.md#supports) -- [toCreationAddress](EIP2718CompatibleTx.md#tocreationaddress) -- [toJSON](EIP2718CompatibleTx.md#tojson) -- [verifySignature](EIP2718CompatibleTx.md#verifysignature) +# Interface: EIP2718CompatibleTx\ -## Properties +Defined in: [types.ts:238](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L238) -### cache +## Extends -• `Readonly` **cache**: [`TransactionCache`](TransactionCache.md) +- [`TransactionInterface`](TransactionInterface.md)\<`T`\> -#### Inherited from +## Extended by -[TransactionInterface](TransactionInterface.md).[cache](TransactionInterface.md#cache) +- [`EIP2930CompatibleTx`](EIP2930CompatibleTx.md) -#### Defined in +## Type Parameters -[tx/src/types.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L150) +### T -___ +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) = [`TransactionType`](../type-aliases/TransactionType.md) -### chainId +## Properties -• `Readonly` **chainId**: `bigint` +### cache -#### Defined in +> `readonly` **cache**: [`TransactionCache`](TransactionCache.md) -[tx/src/types.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L179) +Defined in: [types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L203) -___ +#### Inherited from -### common +[`TransactionInterface`](TransactionInterface.md).[`cache`](TransactionInterface.md#cache) -• `Readonly` **common**: `Common` +*** -#### Inherited from +### chainId -[TransactionInterface](TransactionInterface.md).[common](TransactionInterface.md#common) +> `readonly` **chainId**: `bigint` -#### Defined in +Defined in: [types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L240) -[tx/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L141) +*** -___ +### common -### data +> `readonly` **common**: `Common` -• `Readonly` **data**: `Uint8Array` +Defined in: [types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L194) #### Inherited from -[TransactionInterface](TransactionInterface.md).[data](TransactionInterface.md#data) +[`TransactionInterface`](TransactionInterface.md).[`common`](TransactionInterface.md#common) -#### Defined in +*** -[tx/src/types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L146) - -___ +### data -### gasLimit +> `readonly` **data**: `Uint8Array` -• `Readonly` **gasLimit**: `bigint` +Defined in: [types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L199) #### Inherited from -[TransactionInterface](TransactionInterface.md).[gasLimit](TransactionInterface.md#gaslimit) +[`TransactionInterface`](TransactionInterface.md).[`data`](TransactionInterface.md#data) -#### Defined in +*** -[tx/src/types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L143) +### gasLimit + +> `readonly` **gasLimit**: `bigint` + +Defined in: [types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L196) + +#### Inherited from -___ +[`TransactionInterface`](TransactionInterface.md).[`gasLimit`](TransactionInterface.md#gaslimit) + +*** ### nonce -• `Readonly` **nonce**: `bigint` +> `readonly` **nonce**: `bigint` -#### Inherited from +Defined in: [types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L195) -[TransactionInterface](TransactionInterface.md).[nonce](TransactionInterface.md#nonce) +#### Inherited from -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`nonce`](TransactionInterface.md#nonce) -[tx/src/types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L142) +*** -___ +### r? -### r +> `readonly` `optional` **r**: `bigint` -• `Optional` `Readonly` **r**: `bigint` +Defined in: [types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L201) #### Inherited from -[TransactionInterface](TransactionInterface.md).[r](TransactionInterface.md#r) +[`TransactionInterface`](TransactionInterface.md).[`r`](TransactionInterface.md#r) -#### Defined in +*** -[tx/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L148) +### s? -___ +> `readonly` `optional` **s**: `bigint` -### s - -• `Optional` `Readonly` **s**: `bigint` +Defined in: [types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L202) #### Inherited from -[TransactionInterface](TransactionInterface.md).[s](TransactionInterface.md#s) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`s`](TransactionInterface.md#s) -[tx/src/types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L149) +*** -___ +### to? -### to +> `readonly` `optional` **to**: `Address` -• `Optional` `Readonly` **to**: `Address` +Defined in: [types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L197) #### Inherited from -[TransactionInterface](TransactionInterface.md).[to](TransactionInterface.md#to) +[`TransactionInterface`](TransactionInterface.md).[`to`](TransactionInterface.md#to) + +*** -#### Defined in +### txOptions -[tx/src/types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L144) +> **txOptions**: [`TxOptions`](TxOptions.md) -___ +Defined in: [types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L206) + +#### Inherited from + +[`TransactionInterface`](TransactionInterface.md).[`txOptions`](TransactionInterface.md#txoptions) + +*** ### type -• **type**: [`TransactionType`](../enums/TransactionType.md) +> **type**: [`TransactionType`](../type-aliases/TransactionType.md) + +Defined in: [types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L205) #### Inherited from -[TransactionInterface](TransactionInterface.md).[type](TransactionInterface.md#type) +[`TransactionInterface`](TransactionInterface.md).[`type`](TransactionInterface.md#type) -#### Defined in +*** -[tx/src/types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L152) +### v? -___ +> `readonly` `optional` **v**: `bigint` -### v +Defined in: [types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L200) -• `Optional` `Readonly` **v**: `bigint` +#### Inherited from + +[`TransactionInterface`](TransactionInterface.md).[`v`](TransactionInterface.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L198) #### Inherited from -[TransactionInterface](TransactionInterface.md).[v](TransactionInterface.md#v) +[`TransactionInterface`](TransactionInterface.md).[`value`](TransactionInterface.md#value) -#### Defined in +## Methods -[tx/src/types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L147) +### addSignature() -___ +> **addSignature**(`v`, `r`, `s`, `convertV?`): [`Transaction`](Transaction.md)\[`T`\] -### value +Defined in: [types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L227) + +#### Parameters -• `Readonly` **value**: `bigint` +##### v -#### Inherited from +`bigint` -[TransactionInterface](TransactionInterface.md).[value](TransactionInterface.md#value) +##### r -#### Defined in +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -[tx/src/types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L145) +##### s -## Methods +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -### errorStr +##### convertV? -▸ **errorStr**(): `string` +`boolean` #### Returns -`string` +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[TransactionInterface](TransactionInterface.md).[errorStr](TransactionInterface.md#errorstr) +[`TransactionInterface`](TransactionInterface.md).[`addSignature`](TransactionInterface.md#addsignature) -#### Defined in +*** -[tx/src/types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L171) +### errorStr() -___ +> **errorStr**(): `string` -### getBaseFee - -▸ **getBaseFee**(): `bigint` +Defined in: [types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L225) #### Returns -`bigint` +`string` #### Inherited from -[TransactionInterface](TransactionInterface.md).[getBaseFee](TransactionInterface.md#getbasefee) +[`TransactionInterface`](TransactionInterface.md).[`errorStr`](TransactionInterface.md#errorstr) -#### Defined in +*** -[tx/src/types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L153) +### getDataGas() -___ +> **getDataGas**(): `bigint` -### getDataFee - -▸ **getDataFee**(): `bigint` +Defined in: [types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L208) #### Returns @@ -268,17 +238,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getDataFee](TransactionInterface.md#getdatafee) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getDataGas`](TransactionInterface.md#getdatagas) -[tx/src/types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L154) +*** -___ +### getHashedMessageToSign() -### getHashedMessageToSign +> **getHashedMessageToSign**(): `Uint8Array` -▸ **getHashedMessageToSign**(): `Uint8Array` +Defined in: [types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L214) #### Returns @@ -286,17 +254,31 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getHashedMessageToSign](TransactionInterface.md#gethashedmessagetosign) +[`TransactionInterface`](TransactionInterface.md).[`getHashedMessageToSign`](TransactionInterface.md#gethashedmessagetosign) -#### Defined in +*** -[tx/src/types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L160) +### getIntrinsicGas() -___ +> **getIntrinsicGas**(): `bigint` -### getMessageToSign +Defined in: [types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L207) -▸ **getMessageToSign**(): `Uint8Array` +#### Returns + +`bigint` + +#### Inherited from + +[`TransactionInterface`](TransactionInterface.md).[`getIntrinsicGas`](TransactionInterface.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array` + +Defined in: [types.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L241) #### Returns @@ -304,17 +286,15 @@ ___ #### Overrides -[TransactionInterface](TransactionInterface.md).[getMessageToSign](TransactionInterface.md#getmessagetosign) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getMessageToSign`](TransactionInterface.md#getmessagetosign) -[tx/src/types.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L180) +*** -___ +### getMessageToVerifySignature() -### getMessageToVerifySignature +> **getMessageToVerifySignature**(): `Uint8Array` -▸ **getMessageToVerifySignature**(): `Uint8Array` +Defined in: [types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L216) #### Returns @@ -322,17 +302,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getMessageToVerifySignature](TransactionInterface.md#getmessagetoverifysignature) +[`TransactionInterface`](TransactionInterface.md).[`getMessageToVerifySignature`](TransactionInterface.md#getmessagetoverifysignature) -#### Defined in +*** -[tx/src/types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L162) +### getSenderAddress() -___ +> **getSenderAddress**(): `Address` -### getSenderAddress - -▸ **getSenderAddress**(): `Address` +Defined in: [types.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L221) #### Returns @@ -340,17 +318,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getSenderAddress](TransactionInterface.md#getsenderaddress) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getSenderAddress`](TransactionInterface.md#getsenderaddress) -[tx/src/types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L167) +*** -___ +### getSenderPublicKey() -### getSenderPublicKey +> **getSenderPublicKey**(): `Uint8Array` -▸ **getSenderPublicKey**(): `Uint8Array` +Defined in: [types.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L222) #### Returns @@ -358,17 +334,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getSenderPublicKey](TransactionInterface.md#getsenderpublickey) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getSenderPublicKey`](TransactionInterface.md#getsenderpublickey) -[tx/src/types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L168) +*** -___ +### getUpfrontCost() -### getUpfrontCost +> **getUpfrontCost**(): `bigint` -▸ **getUpfrontCost**(): `bigint` +Defined in: [types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L209) #### Returns @@ -376,17 +350,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getUpfrontCost](TransactionInterface.md#getupfrontcost) +[`TransactionInterface`](TransactionInterface.md).[`getUpfrontCost`](TransactionInterface.md#getupfrontcost) -#### Defined in +*** -[tx/src/types.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L155) +### getValidationErrors() -___ +> **getValidationErrors**(): `string`[] -### getValidationErrors - -▸ **getValidationErrors**(): `string`[] +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L217) #### Returns @@ -394,17 +366,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getValidationErrors](TransactionInterface.md#getvalidationerrors) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getValidationErrors`](TransactionInterface.md#getvalidationerrors) -[tx/src/types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L163) +*** -___ +### hash() -### hash +> **hash**(): `Uint8Array` -▸ **hash**(): `Uint8Array` +Defined in: [types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L215) #### Returns @@ -412,17 +382,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[hash](TransactionInterface.md#hash) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`hash`](TransactionInterface.md#hash) -[tx/src/types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L161) +*** -___ +### isSigned() -### isSigned +> **isSigned**(): `boolean` -▸ **isSigned**(): `boolean` +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L218) #### Returns @@ -430,17 +398,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[isSigned](TransactionInterface.md#issigned) +[`TransactionInterface`](TransactionInterface.md).[`isSigned`](TransactionInterface.md#issigned) -#### Defined in +*** -[tx/src/types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L164) +### isValid() -___ +> **isValid**(): `boolean` -### isValid - -▸ **isValid**(): `boolean` +Defined in: [types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L219) #### Returns @@ -448,35 +414,31 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[isValid](TransactionInterface.md#isvalid) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`isValid`](TransactionInterface.md#isvalid) -[tx/src/types.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L165) +*** -___ +### raw() -### raw +> **raw**(): [`TxValuesArray`](TxValuesArray.md)\[`T`\] -▸ **raw**(): [`TxValuesArray`](TxValuesArray.md)[`T`] +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L211) #### Returns -[`TxValuesArray`](TxValuesArray.md)[`T`] +[`TxValuesArray`](TxValuesArray.md)\[`T`\] #### Inherited from -[TransactionInterface](TransactionInterface.md).[raw](TransactionInterface.md#raw) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`raw`](TransactionInterface.md#raw) -[tx/src/types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L157) +*** -___ +### serialize() -### serialize +> **serialize**(): `Uint8Array` -▸ **serialize**(): `Uint8Array` +Defined in: [types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L212) #### Returns @@ -484,47 +446,47 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[serialize](TransactionInterface.md#serialize) +[`TransactionInterface`](TransactionInterface.md).[`serialize`](TransactionInterface.md#serialize) -#### Defined in +*** -[tx/src/types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L158) +### sign() -___ +> **sign**(`privateKey`, `extraEntropy?`): [`Transaction`](Transaction.md)\[`T`\] -### sign - -▸ **sign**(`privateKey`): [`Transaction`](Transaction.md)[`T`] +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L223) #### Parameters -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | +##### privateKey + +`Uint8Array` + +##### extraEntropy? + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns -[`Transaction`](Transaction.md)[`T`] +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[TransactionInterface](TransactionInterface.md).[sign](TransactionInterface.md#sign) +[`TransactionInterface`](TransactionInterface.md).[`sign`](TransactionInterface.md#sign) -#### Defined in +*** -[tx/src/types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L169) +### supports() -___ +> **supports**(`capability`): `boolean` -### supports - -▸ **supports**(`capability`): `boolean` +Defined in: [types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L204) #### Parameters -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | +##### capability + +`number` #### Returns @@ -532,17 +494,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[supports](TransactionInterface.md#supports) +[`TransactionInterface`](TransactionInterface.md).[`supports`](TransactionInterface.md#supports) -#### Defined in +*** -[tx/src/types.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L151) +### toCreationAddress() -___ +> **toCreationAddress**(): `boolean` -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` +Defined in: [types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L210) #### Returns @@ -550,35 +510,31 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[toCreationAddress](TransactionInterface.md#tocreationaddress) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`toCreationAddress`](TransactionInterface.md#tocreationaddress) -[tx/src/types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L156) +*** -___ +### toJSON() -### toJSON +> **toJSON**(): [`JSONTx`](JSONTx.md) -▸ **toJSON**(): [`JsonTx`](JsonTx.md) +Defined in: [types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L224) #### Returns -[`JsonTx`](JsonTx.md) +[`JSONTx`](JSONTx.md) #### Inherited from -[TransactionInterface](TransactionInterface.md).[toJSON](TransactionInterface.md#tojson) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`toJSON`](TransactionInterface.md#tojson) -[tx/src/types.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L170) +*** -___ +### verifySignature() -### verifySignature +> **verifySignature**(): `boolean` -▸ **verifySignature**(): `boolean` +Defined in: [types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L220) #### Returns @@ -586,8 +542,4 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[verifySignature](TransactionInterface.md#verifysignature) - -#### Defined in - -[tx/src/types.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L166) +[`TransactionInterface`](TransactionInterface.md).[`verifySignature`](TransactionInterface.md#verifysignature) diff --git a/packages/tx/docs/interfaces/EIP2930CompatibleTx.md b/packages/tx/docs/interfaces/EIP2930CompatibleTx.md index 320ae726a60..d7a2db71065 100644 --- a/packages/tx/docs/interfaces/EIP2930CompatibleTx.md +++ b/packages/tx/docs/interfaces/EIP2930CompatibleTx.md @@ -1,292 +1,248 @@ +[**@ethereumjs/tx**](../README.md) + +*** + [@ethereumjs/tx](../README.md) / EIP2930CompatibleTx -# Interface: EIP2930CompatibleTx - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) = [`TransactionType`](../enums/TransactionType.md) | - -## Hierarchy - -- [`EIP2718CompatibleTx`](EIP2718CompatibleTx.md)<`T`\> - - ↳ **`EIP2930CompatibleTx`** - - ↳↳ [`EIP1559CompatibleTx`](EIP1559CompatibleTx.md) - -## Table of contents - -### Properties - -- [AccessListJSON](EIP2930CompatibleTx.md#accesslistjson) -- [accessList](EIP2930CompatibleTx.md#accesslist) -- [cache](EIP2930CompatibleTx.md#cache) -- [chainId](EIP2930CompatibleTx.md#chainid) -- [common](EIP2930CompatibleTx.md#common) -- [data](EIP2930CompatibleTx.md#data) -- [gasLimit](EIP2930CompatibleTx.md#gaslimit) -- [nonce](EIP2930CompatibleTx.md#nonce) -- [r](EIP2930CompatibleTx.md#r) -- [s](EIP2930CompatibleTx.md#s) -- [to](EIP2930CompatibleTx.md#to) -- [type](EIP2930CompatibleTx.md#type) -- [v](EIP2930CompatibleTx.md#v) -- [value](EIP2930CompatibleTx.md#value) - -### Methods - -- [errorStr](EIP2930CompatibleTx.md#errorstr) -- [getBaseFee](EIP2930CompatibleTx.md#getbasefee) -- [getDataFee](EIP2930CompatibleTx.md#getdatafee) -- [getHashedMessageToSign](EIP2930CompatibleTx.md#gethashedmessagetosign) -- [getMessageToSign](EIP2930CompatibleTx.md#getmessagetosign) -- [getMessageToVerifySignature](EIP2930CompatibleTx.md#getmessagetoverifysignature) -- [getSenderAddress](EIP2930CompatibleTx.md#getsenderaddress) -- [getSenderPublicKey](EIP2930CompatibleTx.md#getsenderpublickey) -- [getUpfrontCost](EIP2930CompatibleTx.md#getupfrontcost) -- [getValidationErrors](EIP2930CompatibleTx.md#getvalidationerrors) -- [hash](EIP2930CompatibleTx.md#hash) -- [isSigned](EIP2930CompatibleTx.md#issigned) -- [isValid](EIP2930CompatibleTx.md#isvalid) -- [raw](EIP2930CompatibleTx.md#raw) -- [serialize](EIP2930CompatibleTx.md#serialize) -- [sign](EIP2930CompatibleTx.md#sign) -- [supports](EIP2930CompatibleTx.md#supports) -- [toCreationAddress](EIP2930CompatibleTx.md#tocreationaddress) -- [toJSON](EIP2930CompatibleTx.md#tojson) -- [verifySignature](EIP2930CompatibleTx.md#verifysignature) +# Interface: EIP2930CompatibleTx\ -## Properties +Defined in: [types.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L244) -### AccessListJSON +## Extends -• `Readonly` **AccessListJSON**: [`AccessList`](../README.md#accesslist) +- [`EIP2718CompatibleTx`](EIP2718CompatibleTx.md)\<`T`\> -#### Defined in +## Extended by -[tx/src/types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L186) +- [`EIP1559CompatibleTx`](EIP1559CompatibleTx.md) -___ +## Type Parameters -### accessList +### T -• `Readonly` **accessList**: [`AccessListBytes`](../README.md#accesslistbytes) +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) = [`TransactionType`](../type-aliases/TransactionType.md) -#### Defined in +## Properties -[tx/src/types.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L185) +### accessList -___ +> `readonly` **accessList**: [`AccessListBytes`](../type-aliases/AccessListBytes.md) -### cache +Defined in: [types.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L246) -• `Readonly` **cache**: [`TransactionCache`](TransactionCache.md) +*** -#### Inherited from +### cache -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[cache](EIP2718CompatibleTx.md#cache) +> `readonly` **cache**: [`TransactionCache`](TransactionCache.md) -#### Defined in +Defined in: [types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L203) -[tx/src/types.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L150) +#### Inherited from -___ +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`cache`](EIP2718CompatibleTx.md#cache) -### chainId +*** -• `Readonly` **chainId**: `bigint` +### chainId -#### Inherited from +> `readonly` **chainId**: `bigint` -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[chainId](EIP2718CompatibleTx.md#chainid) +Defined in: [types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L240) -#### Defined in +#### Inherited from -[tx/src/types.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L179) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`chainId`](EIP2718CompatibleTx.md#chainid) -___ +*** ### common -• `Readonly` **common**: `Common` +> `readonly` **common**: `Common` -#### Inherited from - -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[common](EIP2718CompatibleTx.md#common) +Defined in: [types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L194) -#### Defined in +#### Inherited from -[tx/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L141) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`common`](EIP2718CompatibleTx.md#common) -___ +*** ### data -• `Readonly` **data**: `Uint8Array` +> `readonly` **data**: `Uint8Array` -#### Inherited from - -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[data](EIP2718CompatibleTx.md#data) +Defined in: [types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L199) -#### Defined in +#### Inherited from -[tx/src/types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L146) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`data`](EIP2718CompatibleTx.md#data) -___ +*** ### gasLimit -• `Readonly` **gasLimit**: `bigint` - -#### Inherited from +> `readonly` **gasLimit**: `bigint` -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[gasLimit](EIP2718CompatibleTx.md#gaslimit) +Defined in: [types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L196) -#### Defined in +#### Inherited from -[tx/src/types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L143) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`gasLimit`](EIP2718CompatibleTx.md#gaslimit) -___ +*** ### nonce -• `Readonly` **nonce**: `bigint` +> `readonly` **nonce**: `bigint` -#### Inherited from +Defined in: [types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L195) -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[nonce](EIP2718CompatibleTx.md#nonce) +#### Inherited from -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`nonce`](EIP2718CompatibleTx.md#nonce) -[tx/src/types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L142) +*** -___ +### r? -### r +> `readonly` `optional` **r**: `bigint` -• `Optional` `Readonly` **r**: `bigint` +Defined in: [types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L201) #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[r](EIP2718CompatibleTx.md#r) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`r`](EIP2718CompatibleTx.md#r) -#### Defined in +*** -[tx/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L148) +### s? -___ +> `readonly` `optional` **s**: `bigint` -### s - -• `Optional` `Readonly` **s**: `bigint` +Defined in: [types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L202) #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[s](EIP2718CompatibleTx.md#s) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`s`](EIP2718CompatibleTx.md#s) -[tx/src/types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L149) +*** -___ +### to? -### to +> `readonly` `optional` **to**: `Address` -• `Optional` `Readonly` **to**: `Address` +Defined in: [types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L197) #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[to](EIP2718CompatibleTx.md#to) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`to`](EIP2718CompatibleTx.md#to) + +*** -#### Defined in +### txOptions -[tx/src/types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L144) +> **txOptions**: [`TxOptions`](TxOptions.md) -___ +Defined in: [types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L206) + +#### Inherited from + +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`txOptions`](EIP2718CompatibleTx.md#txoptions) + +*** ### type -• **type**: [`TransactionType`](../enums/TransactionType.md) +> **type**: [`TransactionType`](../type-aliases/TransactionType.md) + +Defined in: [types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L205) #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[type](EIP2718CompatibleTx.md#type) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`type`](EIP2718CompatibleTx.md#type) -#### Defined in +*** -[tx/src/types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L152) +### v? -___ +> `readonly` `optional` **v**: `bigint` -### v +Defined in: [types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L200) -• `Optional` `Readonly` **v**: `bigint` +#### Inherited from + +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`v`](EIP2718CompatibleTx.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L198) #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[v](EIP2718CompatibleTx.md#v) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`value`](EIP2718CompatibleTx.md#value) -#### Defined in +## Methods -[tx/src/types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L147) +### addSignature() -___ +> **addSignature**(`v`, `r`, `s`, `convertV?`): [`Transaction`](Transaction.md)\[`T`\] -### value +Defined in: [types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L227) + +#### Parameters -• `Readonly` **value**: `bigint` +##### v -#### Inherited from +`bigint` -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[value](EIP2718CompatibleTx.md#value) +##### r -#### Defined in +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -[tx/src/types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L145) +##### s -## Methods +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -### errorStr +##### convertV? -▸ **errorStr**(): `string` +`boolean` #### Returns -`string` +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[errorStr](EIP2718CompatibleTx.md#errorstr) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`addSignature`](EIP2718CompatibleTx.md#addsignature) -#### Defined in +*** -[tx/src/types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L171) +### errorStr() -___ +> **errorStr**(): `string` -### getBaseFee - -▸ **getBaseFee**(): `bigint` +Defined in: [types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L225) #### Returns -`bigint` +`string` #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getBaseFee](EIP2718CompatibleTx.md#getbasefee) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`errorStr`](EIP2718CompatibleTx.md#errorstr) -#### Defined in +*** -[tx/src/types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L153) +### getDataGas() -___ +> **getDataGas**(): `bigint` -### getDataFee - -▸ **getDataFee**(): `bigint` +Defined in: [types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L208) #### Returns @@ -294,17 +250,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getDataFee](EIP2718CompatibleTx.md#getdatafee) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getDataGas`](EIP2718CompatibleTx.md#getdatagas) -[tx/src/types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L154) +*** -___ +### getHashedMessageToSign() -### getHashedMessageToSign +> **getHashedMessageToSign**(): `Uint8Array` -▸ **getHashedMessageToSign**(): `Uint8Array` +Defined in: [types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L214) #### Returns @@ -312,17 +266,31 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getHashedMessageToSign](EIP2718CompatibleTx.md#gethashedmessagetosign) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getHashedMessageToSign`](EIP2718CompatibleTx.md#gethashedmessagetosign) -#### Defined in +*** -[tx/src/types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L160) +### getIntrinsicGas() -___ +> **getIntrinsicGas**(): `bigint` -### getMessageToSign +Defined in: [types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L207) -▸ **getMessageToSign**(): `Uint8Array` +#### Returns + +`bigint` + +#### Inherited from + +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getIntrinsicGas`](EIP2718CompatibleTx.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array` + +Defined in: [types.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L241) #### Returns @@ -330,17 +298,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getMessageToSign](EIP2718CompatibleTx.md#getmessagetosign) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getMessageToSign`](EIP2718CompatibleTx.md#getmessagetosign) -[tx/src/types.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L180) +*** -___ +### getMessageToVerifySignature() -### getMessageToVerifySignature +> **getMessageToVerifySignature**(): `Uint8Array` -▸ **getMessageToVerifySignature**(): `Uint8Array` +Defined in: [types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L216) #### Returns @@ -348,17 +314,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getMessageToVerifySignature](EIP2718CompatibleTx.md#getmessagetoverifysignature) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getMessageToVerifySignature`](EIP2718CompatibleTx.md#getmessagetoverifysignature) -#### Defined in +*** -[tx/src/types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L162) +### getSenderAddress() -___ +> **getSenderAddress**(): `Address` -### getSenderAddress - -▸ **getSenderAddress**(): `Address` +Defined in: [types.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L221) #### Returns @@ -366,17 +330,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getSenderAddress](EIP2718CompatibleTx.md#getsenderaddress) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getSenderAddress`](EIP2718CompatibleTx.md#getsenderaddress) -[tx/src/types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L167) +*** -___ +### getSenderPublicKey() -### getSenderPublicKey +> **getSenderPublicKey**(): `Uint8Array` -▸ **getSenderPublicKey**(): `Uint8Array` +Defined in: [types.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L222) #### Returns @@ -384,17 +346,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getSenderPublicKey](EIP2718CompatibleTx.md#getsenderpublickey) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getSenderPublicKey`](EIP2718CompatibleTx.md#getsenderpublickey) -[tx/src/types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L168) +*** -___ +### getUpfrontCost() -### getUpfrontCost +> **getUpfrontCost**(): `bigint` -▸ **getUpfrontCost**(): `bigint` +Defined in: [types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L209) #### Returns @@ -402,17 +362,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getUpfrontCost](EIP2718CompatibleTx.md#getupfrontcost) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getUpfrontCost`](EIP2718CompatibleTx.md#getupfrontcost) -#### Defined in +*** -[tx/src/types.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L155) +### getValidationErrors() -___ +> **getValidationErrors**(): `string`[] -### getValidationErrors - -▸ **getValidationErrors**(): `string`[] +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L217) #### Returns @@ -420,17 +378,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[getValidationErrors](EIP2718CompatibleTx.md#getvalidationerrors) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`getValidationErrors`](EIP2718CompatibleTx.md#getvalidationerrors) -[tx/src/types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L163) +*** -___ +### hash() -### hash +> **hash**(): `Uint8Array` -▸ **hash**(): `Uint8Array` +Defined in: [types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L215) #### Returns @@ -438,17 +394,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[hash](EIP2718CompatibleTx.md#hash) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`hash`](EIP2718CompatibleTx.md#hash) -[tx/src/types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L161) +*** -___ +### isSigned() -### isSigned +> **isSigned**(): `boolean` -▸ **isSigned**(): `boolean` +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L218) #### Returns @@ -456,17 +410,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[isSigned](EIP2718CompatibleTx.md#issigned) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`isSigned`](EIP2718CompatibleTx.md#issigned) -#### Defined in +*** -[tx/src/types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L164) +### isValid() -___ +> **isValid**(): `boolean` -### isValid - -▸ **isValid**(): `boolean` +Defined in: [types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L219) #### Returns @@ -474,35 +426,31 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[isValid](EIP2718CompatibleTx.md#isvalid) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`isValid`](EIP2718CompatibleTx.md#isvalid) -[tx/src/types.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L165) +*** -___ +### raw() -### raw +> **raw**(): [`TxValuesArray`](TxValuesArray.md)\[`T`\] -▸ **raw**(): [`TxValuesArray`](TxValuesArray.md)[`T`] +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L211) #### Returns -[`TxValuesArray`](TxValuesArray.md)[`T`] +[`TxValuesArray`](TxValuesArray.md)\[`T`\] #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[raw](EIP2718CompatibleTx.md#raw) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`raw`](EIP2718CompatibleTx.md#raw) -[tx/src/types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L157) +*** -___ +### serialize() -### serialize +> **serialize**(): `Uint8Array` -▸ **serialize**(): `Uint8Array` +Defined in: [types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L212) #### Returns @@ -510,47 +458,47 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[serialize](EIP2718CompatibleTx.md#serialize) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`serialize`](EIP2718CompatibleTx.md#serialize) -#### Defined in +*** -[tx/src/types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L158) +### sign() -___ +> **sign**(`privateKey`, `extraEntropy?`): [`Transaction`](Transaction.md)\[`T`\] -### sign - -▸ **sign**(`privateKey`): [`Transaction`](Transaction.md)[`T`] +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L223) #### Parameters -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | +##### privateKey + +`Uint8Array` + +##### extraEntropy? + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns -[`Transaction`](Transaction.md)[`T`] +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[sign](EIP2718CompatibleTx.md#sign) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`sign`](EIP2718CompatibleTx.md#sign) -#### Defined in +*** -[tx/src/types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L169) +### supports() -___ +> **supports**(`capability`): `boolean` -### supports - -▸ **supports**(`capability`): `boolean` +Defined in: [types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L204) #### Parameters -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | +##### capability + +`number` #### Returns @@ -558,17 +506,15 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[supports](EIP2718CompatibleTx.md#supports) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`supports`](EIP2718CompatibleTx.md#supports) -#### Defined in +*** -[tx/src/types.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L151) +### toCreationAddress() -___ +> **toCreationAddress**(): `boolean` -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` +Defined in: [types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L210) #### Returns @@ -576,35 +522,31 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[toCreationAddress](EIP2718CompatibleTx.md#tocreationaddress) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`toCreationAddress`](EIP2718CompatibleTx.md#tocreationaddress) -[tx/src/types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L156) +*** -___ +### toJSON() -### toJSON +> **toJSON**(): [`JSONTx`](JSONTx.md) -▸ **toJSON**(): [`JsonTx`](JsonTx.md) +Defined in: [types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L224) #### Returns -[`JsonTx`](JsonTx.md) +[`JSONTx`](JSONTx.md) #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[toJSON](EIP2718CompatibleTx.md#tojson) - -#### Defined in +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`toJSON`](EIP2718CompatibleTx.md#tojson) -[tx/src/types.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L170) +*** -___ +### verifySignature() -### verifySignature +> **verifySignature**(): `boolean` -▸ **verifySignature**(): `boolean` +Defined in: [types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L220) #### Returns @@ -612,8 +554,4 @@ ___ #### Inherited from -[EIP2718CompatibleTx](EIP2718CompatibleTx.md).[verifySignature](EIP2718CompatibleTx.md#verifysignature) - -#### Defined in - -[tx/src/types.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L166) +[`EIP2718CompatibleTx`](EIP2718CompatibleTx.md).[`verifySignature`](EIP2718CompatibleTx.md#verifysignature) diff --git a/packages/tx/docs/interfaces/EIP4844CompatibleTx.md b/packages/tx/docs/interfaces/EIP4844CompatibleTx.md index 83b990fba34..e517c3bcfb6 100644 --- a/packages/tx/docs/interfaces/EIP4844CompatibleTx.md +++ b/packages/tx/docs/interfaces/EIP4844CompatibleTx.md @@ -1,385 +1,312 @@ -[@ethereumjs/tx](../README.md) / EIP4844CompatibleTx +[**@ethereumjs/tx**](../README.md) -# Interface: EIP4844CompatibleTx - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) = [`TransactionType`](../enums/TransactionType.md) | - -## Hierarchy - -- [`EIP1559CompatibleTx`](EIP1559CompatibleTx.md)<`T`\> - - ↳ **`EIP4844CompatibleTx`** - -## Table of contents - -### Properties - -- [AccessListJSON](EIP4844CompatibleTx.md#accesslistjson) -- [accessList](EIP4844CompatibleTx.md#accesslist) -- [blobVersionedHashes](EIP4844CompatibleTx.md#blobversionedhashes) -- [blobs](EIP4844CompatibleTx.md#blobs) -- [cache](EIP4844CompatibleTx.md#cache) -- [chainId](EIP4844CompatibleTx.md#chainid) -- [common](EIP4844CompatibleTx.md#common) -- [data](EIP4844CompatibleTx.md#data) -- [gasLimit](EIP4844CompatibleTx.md#gaslimit) -- [kzgCommitments](EIP4844CompatibleTx.md#kzgcommitments) -- [kzgProofs](EIP4844CompatibleTx.md#kzgproofs) -- [maxFeePerBlobGas](EIP4844CompatibleTx.md#maxfeeperblobgas) -- [maxFeePerGas](EIP4844CompatibleTx.md#maxfeepergas) -- [maxPriorityFeePerGas](EIP4844CompatibleTx.md#maxpriorityfeepergas) -- [nonce](EIP4844CompatibleTx.md#nonce) -- [r](EIP4844CompatibleTx.md#r) -- [s](EIP4844CompatibleTx.md#s) -- [to](EIP4844CompatibleTx.md#to) -- [type](EIP4844CompatibleTx.md#type) -- [v](EIP4844CompatibleTx.md#v) -- [value](EIP4844CompatibleTx.md#value) - -### Methods - -- [errorStr](EIP4844CompatibleTx.md#errorstr) -- [getBaseFee](EIP4844CompatibleTx.md#getbasefee) -- [getDataFee](EIP4844CompatibleTx.md#getdatafee) -- [getHashedMessageToSign](EIP4844CompatibleTx.md#gethashedmessagetosign) -- [getMessageToSign](EIP4844CompatibleTx.md#getmessagetosign) -- [getMessageToVerifySignature](EIP4844CompatibleTx.md#getmessagetoverifysignature) -- [getSenderAddress](EIP4844CompatibleTx.md#getsenderaddress) -- [getSenderPublicKey](EIP4844CompatibleTx.md#getsenderpublickey) -- [getUpfrontCost](EIP4844CompatibleTx.md#getupfrontcost) -- [getValidationErrors](EIP4844CompatibleTx.md#getvalidationerrors) -- [hash](EIP4844CompatibleTx.md#hash) -- [isSigned](EIP4844CompatibleTx.md#issigned) -- [isValid](EIP4844CompatibleTx.md#isvalid) -- [numBlobs](EIP4844CompatibleTx.md#numblobs) -- [raw](EIP4844CompatibleTx.md#raw) -- [serialize](EIP4844CompatibleTx.md#serialize) -- [serializeNetworkWrapper](EIP4844CompatibleTx.md#serializenetworkwrapper) -- [sign](EIP4844CompatibleTx.md#sign) -- [supports](EIP4844CompatibleTx.md#supports) -- [toCreationAddress](EIP4844CompatibleTx.md#tocreationaddress) -- [toJSON](EIP4844CompatibleTx.md#tojson) -- [verifySignature](EIP4844CompatibleTx.md#verifysignature) +*** -## Properties +[@ethereumjs/tx](../README.md) / EIP4844CompatibleTx -### AccessListJSON +# Interface: EIP4844CompatibleTx\ -• `Readonly` **AccessListJSON**: [`AccessList`](../README.md#accesslist) +Defined in: [types.ts:255](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L255) -#### Inherited from +## Extends + +- [`EIP1559CompatibleTx`](EIP1559CompatibleTx.md)\<`T`\> -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[AccessListJSON](EIP1559CompatibleTx.md#accesslistjson) +## Type Parameters -#### Defined in +### T -[tx/src/types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L186) +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) = [`TransactionType`](../type-aliases/TransactionType.md) -___ +## Properties ### accessList -• `Readonly` **accessList**: [`AccessListBytes`](../README.md#accesslistbytes) +> `readonly` **accessList**: [`AccessListBytes`](../type-aliases/AccessListBytes.md) + +Defined in: [types.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L246) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[accessList](EIP1559CompatibleTx.md#accesslist) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`accessList`](EIP1559CompatibleTx.md#accesslist) + +*** + +### blobs? -#### Defined in +> `optional` **blobs**: `Uint8Array`\<`ArrayBufferLike`\>[] -[tx/src/types.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L185) +Defined in: [types.ts:259](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L259) -___ +*** ### blobVersionedHashes -• **blobVersionedHashes**: `Uint8Array`[] +> **blobVersionedHashes**: `Uint8Array`\<`ArrayBufferLike`\>[] -#### Defined in +Defined in: [types.ts:258](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L258) -[tx/src/types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L198) +*** -___ +### cache -### blobs +> `readonly` **cache**: [`TransactionCache`](TransactionCache.md) -• `Optional` **blobs**: `Uint8Array`[] +Defined in: [types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L203) -#### Defined in +#### Inherited from -[tx/src/types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L199) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`cache`](EIP1559CompatibleTx.md#cache) -___ +*** -### cache +### chainId -• `Readonly` **cache**: [`TransactionCache`](TransactionCache.md) +> `readonly` **chainId**: `bigint` -#### Inherited from +Defined in: [types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L240) -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[cache](EIP1559CompatibleTx.md#cache) +#### Inherited from -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`chainId`](EIP1559CompatibleTx.md#chainid) -[tx/src/types.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L150) +*** -___ +### common -### chainId +> `readonly` **common**: `Common` -• `Readonly` **chainId**: `bigint` +Defined in: [types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L194) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[chainId](EIP1559CompatibleTx.md#chainid) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`common`](EIP1559CompatibleTx.md#common) -[tx/src/types.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L179) +*** -___ +### data -### common +> `readonly` **data**: `Uint8Array` -• `Readonly` **common**: `Common` +Defined in: [types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L199) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[common](EIP1559CompatibleTx.md#common) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`data`](EIP1559CompatibleTx.md#data) -[tx/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L141) +*** -___ +### gasLimit -### data +> `readonly` **gasLimit**: `bigint` -• `Readonly` **data**: `Uint8Array` +Defined in: [types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L196) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[data](EIP1559CompatibleTx.md#data) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`gasLimit`](EIP1559CompatibleTx.md#gaslimit) -#### Defined in +*** -[tx/src/types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L146) +### kzgCommitments? -___ +> `optional` **kzgCommitments**: `Uint8Array`\<`ArrayBufferLike`\>[] -### gasLimit +Defined in: [types.ts:260](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L260) -• `Readonly` **gasLimit**: `bigint` +*** -#### Inherited from +### kzgProofs? -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[gasLimit](EIP1559CompatibleTx.md#gaslimit) +> `optional` **kzgProofs**: `Uint8Array`\<`ArrayBufferLike`\>[] -#### Defined in +Defined in: [types.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L261) -[tx/src/types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L143) +*** -___ +### maxFeePerBlobGas -### kzgCommitments +> `readonly` **maxFeePerBlobGas**: `bigint` -• `Optional` **kzgCommitments**: `Uint8Array`[] +Defined in: [types.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L257) -#### Defined in +*** -[tx/src/types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L200) +### maxFeePerGas -___ +> `readonly` **maxFeePerGas**: `bigint` -### kzgProofs +Defined in: [types.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L252) -• `Optional` **kzgProofs**: `Uint8Array`[] +#### Inherited from -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`maxFeePerGas`](EIP1559CompatibleTx.md#maxfeepergas) -[tx/src/types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L201) +*** -___ +### maxPriorityFeePerGas -### maxFeePerBlobGas +> `readonly` **maxPriorityFeePerGas**: `bigint` -• `Readonly` **maxFeePerBlobGas**: `bigint` +Defined in: [types.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L251) -#### Defined in +#### Inherited from -[tx/src/types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L197) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`maxPriorityFeePerGas`](EIP1559CompatibleTx.md#maxpriorityfeepergas) -___ +*** -### maxFeePerGas +### nonce -• `Readonly` **maxFeePerGas**: `bigint` +> `readonly` **nonce**: `bigint` -#### Inherited from +Defined in: [types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L195) -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[maxFeePerGas](EIP1559CompatibleTx.md#maxfeepergas) +#### Inherited from -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`nonce`](EIP1559CompatibleTx.md#nonce) -[tx/src/types.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L192) +*** -___ +### r? -### maxPriorityFeePerGas +> `readonly` `optional` **r**: `bigint` -• `Readonly` **maxPriorityFeePerGas**: `bigint` +Defined in: [types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L201) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[maxPriorityFeePerGas](EIP1559CompatibleTx.md#maxpriorityfeepergas) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`r`](EIP1559CompatibleTx.md#r) -#### Defined in +*** -[tx/src/types.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L191) +### s? -___ +> `readonly` `optional` **s**: `bigint` -### nonce - -• `Readonly` **nonce**: `bigint` +Defined in: [types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L202) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[nonce](EIP1559CompatibleTx.md#nonce) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`s`](EIP1559CompatibleTx.md#s) -[tx/src/types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L142) +*** -___ +### to? -### r +> `readonly` `optional` **to**: `Address` -• `Optional` `Readonly` **r**: `bigint` +Defined in: [types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L197) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[r](EIP1559CompatibleTx.md#r) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`to`](EIP1559CompatibleTx.md#to) -#### Defined in +*** -[tx/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L148) +### txOptions -___ +> **txOptions**: [`TxOptions`](TxOptions.md) -### s - -• `Optional` `Readonly` **s**: `bigint` +Defined in: [types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L206) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[s](EIP1559CompatibleTx.md#s) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`txOptions`](EIP1559CompatibleTx.md#txoptions) -[tx/src/types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L149) +*** -___ +### type -### to +> **type**: [`TransactionType`](../type-aliases/TransactionType.md) -• `Optional` `Readonly` **to**: `Address` +Defined in: [types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L205) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[to](EIP1559CompatibleTx.md#to) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`type`](EIP1559CompatibleTx.md#type) -#### Defined in +*** -[tx/src/types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L144) +### v? -___ +> `readonly` `optional` **v**: `bigint` -### type - -• **type**: [`TransactionType`](../enums/TransactionType.md) +Defined in: [types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L200) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[type](EIP1559CompatibleTx.md#type) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`v`](EIP1559CompatibleTx.md#v) -[tx/src/types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L152) +*** -___ +### value -### v +> `readonly` **value**: `bigint` -• `Optional` `Readonly` **v**: `bigint` +Defined in: [types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L198) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[v](EIP1559CompatibleTx.md#v) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`value`](EIP1559CompatibleTx.md#value) -#### Defined in +## Methods -[tx/src/types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L147) +### addSignature() -___ +> **addSignature**(`v`, `r`, `s`, `convertV?`): [`Transaction`](Transaction.md)\[`T`\] -### value +Defined in: [types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L227) -• `Readonly` **value**: `bigint` +#### Parameters -#### Inherited from +##### v + +`bigint` -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[value](EIP1559CompatibleTx.md#value) +##### r -#### Defined in +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -[tx/src/types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L145) +##### s -## Methods +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -### errorStr +##### convertV? -▸ **errorStr**(): `string` +`boolean` #### Returns -`string` +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[errorStr](EIP1559CompatibleTx.md#errorstr) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`addSignature`](EIP1559CompatibleTx.md#addsignature) -[tx/src/types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L171) +*** -___ +### errorStr() -### getBaseFee +> **errorStr**(): `string` -▸ **getBaseFee**(): `bigint` +Defined in: [types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L225) #### Returns -`bigint` +`string` #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getBaseFee](EIP1559CompatibleTx.md#getbasefee) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`errorStr`](EIP1559CompatibleTx.md#errorstr) -[tx/src/types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L153) +*** -___ +### getDataGas() -### getDataFee +> **getDataGas**(): `bigint` -▸ **getDataFee**(): `bigint` +Defined in: [types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L208) #### Returns @@ -387,17 +314,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getDataFee](EIP1559CompatibleTx.md#getdatafee) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getDataGas`](EIP1559CompatibleTx.md#getdatagas) -[tx/src/types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L154) +*** -___ +### getHashedMessageToSign() -### getHashedMessageToSign +> **getHashedMessageToSign**(): `Uint8Array` -▸ **getHashedMessageToSign**(): `Uint8Array` +Defined in: [types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L214) #### Returns @@ -405,17 +330,31 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getHashedMessageToSign](EIP1559CompatibleTx.md#gethashedmessagetosign) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getHashedMessageToSign`](EIP1559CompatibleTx.md#gethashedmessagetosign) -#### Defined in +*** -[tx/src/types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L160) +### getIntrinsicGas() -___ +> **getIntrinsicGas**(): `bigint` -### getMessageToSign +Defined in: [types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L207) -▸ **getMessageToSign**(): `Uint8Array` +#### Returns + +`bigint` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getIntrinsicGas`](EIP1559CompatibleTx.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array` + +Defined in: [types.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L241) #### Returns @@ -423,17 +362,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getMessageToSign](EIP1559CompatibleTx.md#getmessagetosign) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getMessageToSign`](EIP1559CompatibleTx.md#getmessagetosign) -[tx/src/types.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L180) +*** -___ +### getMessageToVerifySignature() -### getMessageToVerifySignature +> **getMessageToVerifySignature**(): `Uint8Array` -▸ **getMessageToVerifySignature**(): `Uint8Array` +Defined in: [types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L216) #### Returns @@ -441,17 +378,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getMessageToVerifySignature](EIP1559CompatibleTx.md#getmessagetoverifysignature) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getMessageToVerifySignature`](EIP1559CompatibleTx.md#getmessagetoverifysignature) -[tx/src/types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L162) +*** -___ +### getSenderAddress() -### getSenderAddress +> **getSenderAddress**(): `Address` -▸ **getSenderAddress**(): `Address` +Defined in: [types.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L221) #### Returns @@ -459,17 +394,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getSenderAddress](EIP1559CompatibleTx.md#getsenderaddress) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getSenderAddress`](EIP1559CompatibleTx.md#getsenderaddress) -#### Defined in +*** -[tx/src/types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L167) +### getSenderPublicKey() -___ +> **getSenderPublicKey**(): `Uint8Array` -### getSenderPublicKey - -▸ **getSenderPublicKey**(): `Uint8Array` +Defined in: [types.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L222) #### Returns @@ -477,17 +410,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getSenderPublicKey](EIP1559CompatibleTx.md#getsenderpublickey) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getSenderPublicKey`](EIP1559CompatibleTx.md#getsenderpublickey) -[tx/src/types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L168) +*** -___ +### getUpfrontCost() -### getUpfrontCost +> **getUpfrontCost**(): `bigint` -▸ **getUpfrontCost**(): `bigint` +Defined in: [types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L209) #### Returns @@ -495,17 +426,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getUpfrontCost](EIP1559CompatibleTx.md#getupfrontcost) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getUpfrontCost`](EIP1559CompatibleTx.md#getupfrontcost) -[tx/src/types.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L155) +*** -___ +### getValidationErrors() -### getValidationErrors +> **getValidationErrors**(): `string`[] -▸ **getValidationErrors**(): `string`[] +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L217) #### Returns @@ -513,17 +442,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[getValidationErrors](EIP1559CompatibleTx.md#getvalidationerrors) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getValidationErrors`](EIP1559CompatibleTx.md#getvalidationerrors) -#### Defined in +*** -[tx/src/types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L163) +### hash() -___ +> **hash**(): `Uint8Array` -### hash - -▸ **hash**(): `Uint8Array` +Defined in: [types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L215) #### Returns @@ -531,17 +458,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[hash](EIP1559CompatibleTx.md#hash) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`hash`](EIP1559CompatibleTx.md#hash) -[tx/src/types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L161) +*** -___ +### isSigned() -### isSigned +> **isSigned**(): `boolean` -▸ **isSigned**(): `boolean` +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L218) #### Returns @@ -549,17 +474,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[isSigned](EIP1559CompatibleTx.md#issigned) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`isSigned`](EIP1559CompatibleTx.md#issigned) -[tx/src/types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L164) +*** -___ +### isValid() -### isValid +> **isValid**(): `boolean` -▸ **isValid**(): `boolean` +Defined in: [types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L219) #### Returns @@ -567,49 +490,43 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[isValid](EIP1559CompatibleTx.md#isvalid) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`isValid`](EIP1559CompatibleTx.md#isvalid) -#### Defined in +*** -[tx/src/types.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L165) +### numBlobs() -___ +> **numBlobs**(): `number` -### numBlobs - -▸ **numBlobs**(): `number` +Defined in: [types.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L263) #### Returns `number` -#### Defined in - -[tx/src/types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L203) +*** -___ +### raw() -### raw +> **raw**(): [`TxValuesArray`](TxValuesArray.md)\[`T`\] -▸ **raw**(): [`TxValuesArray`](TxValuesArray.md)[`T`] +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L211) #### Returns -[`TxValuesArray`](TxValuesArray.md)[`T`] +[`TxValuesArray`](TxValuesArray.md)\[`T`\] #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[raw](EIP1559CompatibleTx.md#raw) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`raw`](EIP1559CompatibleTx.md#raw) -[tx/src/types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L157) +*** -___ +### serialize() -### serialize +> **serialize**(): `Uint8Array` -▸ **serialize**(): `Uint8Array` +Defined in: [types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L212) #### Returns @@ -617,61 +534,59 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[serialize](EIP1559CompatibleTx.md#serialize) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`serialize`](EIP1559CompatibleTx.md#serialize) -#### Defined in +*** -[tx/src/types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L158) +### serializeNetworkWrapper() -___ +> **serializeNetworkWrapper**(): `Uint8Array` -### serializeNetworkWrapper - -▸ **serializeNetworkWrapper**(): `Uint8Array` +Defined in: [types.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L262) #### Returns `Uint8Array` -#### Defined in - -[tx/src/types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L202) +*** -___ +### sign() -### sign +> **sign**(`privateKey`, `extraEntropy?`): [`Transaction`](Transaction.md)\[`T`\] -▸ **sign**(`privateKey`): [`Transaction`](Transaction.md)[`T`] +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L223) #### Parameters -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | +##### privateKey + +`Uint8Array` + +##### extraEntropy? + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns -[`Transaction`](Transaction.md)[`T`] +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[sign](EIP1559CompatibleTx.md#sign) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`sign`](EIP1559CompatibleTx.md#sign) -#### Defined in +*** -[tx/src/types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L169) +### supports() -___ +> **supports**(`capability`): `boolean` -### supports - -▸ **supports**(`capability`): `boolean` +Defined in: [types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L204) #### Parameters -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | +##### capability + +`number` #### Returns @@ -679,17 +594,15 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[supports](EIP1559CompatibleTx.md#supports) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`supports`](EIP1559CompatibleTx.md#supports) -#### Defined in +*** -[tx/src/types.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L151) +### toCreationAddress() -___ +> **toCreationAddress**(): `boolean` -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` +Defined in: [types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L210) #### Returns @@ -697,35 +610,31 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[toCreationAddress](EIP1559CompatibleTx.md#tocreationaddress) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`toCreationAddress`](EIP1559CompatibleTx.md#tocreationaddress) -[tx/src/types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L156) +*** -___ +### toJSON() -### toJSON +> **toJSON**(): [`JSONTx`](JSONTx.md) -▸ **toJSON**(): [`JsonTx`](JsonTx.md) +Defined in: [types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L224) #### Returns -[`JsonTx`](JsonTx.md) +[`JSONTx`](JSONTx.md) #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[toJSON](EIP1559CompatibleTx.md#tojson) - -#### Defined in +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`toJSON`](EIP1559CompatibleTx.md#tojson) -[tx/src/types.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L170) +*** -___ +### verifySignature() -### verifySignature +> **verifySignature**(): `boolean` -▸ **verifySignature**(): `boolean` +Defined in: [types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L220) #### Returns @@ -733,8 +642,4 @@ ___ #### Inherited from -[EIP1559CompatibleTx](EIP1559CompatibleTx.md).[verifySignature](EIP1559CompatibleTx.md#verifysignature) - -#### Defined in - -[tx/src/types.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L166) +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`verifySignature`](EIP1559CompatibleTx.md#verifysignature) diff --git a/packages/tx/docs/interfaces/EIP7702CompatibleTx.md b/packages/tx/docs/interfaces/EIP7702CompatibleTx.md new file mode 100644 index 00000000000..f50e467db14 --- /dev/null +++ b/packages/tx/docs/interfaces/EIP7702CompatibleTx.md @@ -0,0 +1,589 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / EIP7702CompatibleTx + +# Interface: EIP7702CompatibleTx\ + +Defined in: [types.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L266) + +## Extends + +- [`EIP1559CompatibleTx`](EIP1559CompatibleTx.md)\<`T`\> + +## Type Parameters + +### T + +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) = [`TransactionType`](../type-aliases/TransactionType.md) + +## Properties + +### accessList + +> `readonly` **accessList**: [`AccessListBytes`](../type-aliases/AccessListBytes.md) + +Defined in: [types.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L246) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`accessList`](EIP1559CompatibleTx.md#accesslist) + +*** + +### authorizationList + +> `readonly` **authorizationList**: [`AuthorizationListBytes`](../type-aliases/AuthorizationListBytes.md) + +Defined in: [types.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L269) + +*** + +### cache + +> `readonly` **cache**: [`TransactionCache`](TransactionCache.md) + +Defined in: [types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L203) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`cache`](EIP1559CompatibleTx.md#cache) + +*** + +### chainId + +> `readonly` **chainId**: `bigint` + +Defined in: [types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L240) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`chainId`](EIP1559CompatibleTx.md#chainid) + +*** + +### common + +> `readonly` **common**: `Common` + +Defined in: [types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L194) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`common`](EIP1559CompatibleTx.md#common) + +*** + +### data + +> `readonly` **data**: `Uint8Array` + +Defined in: [types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L199) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`data`](EIP1559CompatibleTx.md#data) + +*** + +### gasLimit + +> `readonly` **gasLimit**: `bigint` + +Defined in: [types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L196) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`gasLimit`](EIP1559CompatibleTx.md#gaslimit) + +*** + +### maxFeePerGas + +> `readonly` **maxFeePerGas**: `bigint` + +Defined in: [types.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L252) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`maxFeePerGas`](EIP1559CompatibleTx.md#maxfeepergas) + +*** + +### maxPriorityFeePerGas + +> `readonly` **maxPriorityFeePerGas**: `bigint` + +Defined in: [types.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L251) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`maxPriorityFeePerGas`](EIP1559CompatibleTx.md#maxpriorityfeepergas) + +*** + +### nonce + +> `readonly` **nonce**: `bigint` + +Defined in: [types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L195) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`nonce`](EIP1559CompatibleTx.md#nonce) + +*** + +### r? + +> `readonly` `optional` **r**: `bigint` + +Defined in: [types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L201) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`r`](EIP1559CompatibleTx.md#r) + +*** + +### s? + +> `readonly` `optional` **s**: `bigint` + +Defined in: [types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L202) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`s`](EIP1559CompatibleTx.md#s) + +*** + +### to? + +> `readonly` `optional` **to**: `Address` + +Defined in: [types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L197) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`to`](EIP1559CompatibleTx.md#to) + +*** + +### txOptions + +> **txOptions**: [`TxOptions`](TxOptions.md) + +Defined in: [types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L206) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`txOptions`](EIP1559CompatibleTx.md#txoptions) + +*** + +### type + +> **type**: [`TransactionType`](../type-aliases/TransactionType.md) + +Defined in: [types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L205) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`type`](EIP1559CompatibleTx.md#type) + +*** + +### v? + +> `readonly` `optional` **v**: `bigint` + +Defined in: [types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L200) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`v`](EIP1559CompatibleTx.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L198) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`value`](EIP1559CompatibleTx.md#value) + +## Methods + +### addSignature() + +> **addSignature**(`v`, `r`, `s`, `convertV?`): [`Transaction`](Transaction.md)\[`T`\] + +Defined in: [types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L227) + +#### Parameters + +##### v + +`bigint` + +##### r + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +##### s + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> + +##### convertV? + +`boolean` + +#### Returns + +[`Transaction`](Transaction.md)\[`T`\] + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`addSignature`](EIP1559CompatibleTx.md#addsignature) + +*** + +### errorStr() + +> **errorStr**(): `string` + +Defined in: [types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L225) + +#### Returns + +`string` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`errorStr`](EIP1559CompatibleTx.md#errorstr) + +*** + +### getDataGas() + +> **getDataGas**(): `bigint` + +Defined in: [types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L208) + +#### Returns + +`bigint` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getDataGas`](EIP1559CompatibleTx.md#getdatagas) + +*** + +### getHashedMessageToSign() + +> **getHashedMessageToSign**(): `Uint8Array` + +Defined in: [types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L214) + +#### Returns + +`Uint8Array` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getHashedMessageToSign`](EIP1559CompatibleTx.md#gethashedmessagetosign) + +*** + +### getIntrinsicGas() + +> **getIntrinsicGas**(): `bigint` + +Defined in: [types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L207) + +#### Returns + +`bigint` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getIntrinsicGas`](EIP1559CompatibleTx.md#getintrinsicgas) + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array` + +Defined in: [types.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L241) + +#### Returns + +`Uint8Array` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getMessageToSign`](EIP1559CompatibleTx.md#getmessagetosign) + +*** + +### getMessageToVerifySignature() + +> **getMessageToVerifySignature**(): `Uint8Array` + +Defined in: [types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L216) + +#### Returns + +`Uint8Array` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getMessageToVerifySignature`](EIP1559CompatibleTx.md#getmessagetoverifysignature) + +*** + +### getSenderAddress() + +> **getSenderAddress**(): `Address` + +Defined in: [types.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L221) + +#### Returns + +`Address` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getSenderAddress`](EIP1559CompatibleTx.md#getsenderaddress) + +*** + +### getSenderPublicKey() + +> **getSenderPublicKey**(): `Uint8Array` + +Defined in: [types.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L222) + +#### Returns + +`Uint8Array` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getSenderPublicKey`](EIP1559CompatibleTx.md#getsenderpublickey) + +*** + +### getUpfrontCost() + +> **getUpfrontCost**(): `bigint` + +Defined in: [types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L209) + +#### Returns + +`bigint` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getUpfrontCost`](EIP1559CompatibleTx.md#getupfrontcost) + +*** + +### getValidationErrors() + +> **getValidationErrors**(): `string`[] + +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L217) + +#### Returns + +`string`[] + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`getValidationErrors`](EIP1559CompatibleTx.md#getvalidationerrors) + +*** + +### hash() + +> **hash**(): `Uint8Array` + +Defined in: [types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L215) + +#### Returns + +`Uint8Array` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`hash`](EIP1559CompatibleTx.md#hash) + +*** + +### isSigned() + +> **isSigned**(): `boolean` + +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L218) + +#### Returns + +`boolean` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`isSigned`](EIP1559CompatibleTx.md#issigned) + +*** + +### isValid() + +> **isValid**(): `boolean` + +Defined in: [types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L219) + +#### Returns + +`boolean` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`isValid`](EIP1559CompatibleTx.md#isvalid) + +*** + +### raw() + +> **raw**(): [`TxValuesArray`](TxValuesArray.md)\[`T`\] + +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L211) + +#### Returns + +[`TxValuesArray`](TxValuesArray.md)\[`T`\] + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`raw`](EIP1559CompatibleTx.md#raw) + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L212) + +#### Returns + +`Uint8Array` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`serialize`](EIP1559CompatibleTx.md#serialize) + +*** + +### sign() + +> **sign**(`privateKey`, `extraEntropy?`): [`Transaction`](Transaction.md)\[`T`\] + +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L223) + +#### Parameters + +##### privateKey + +`Uint8Array` + +##### extraEntropy? + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> + +#### Returns + +[`Transaction`](Transaction.md)\[`T`\] + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`sign`](EIP1559CompatibleTx.md#sign) + +*** + +### supports() + +> **supports**(`capability`): `boolean` + +Defined in: [types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L204) + +#### Parameters + +##### capability + +`number` + +#### Returns + +`boolean` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`supports`](EIP1559CompatibleTx.md#supports) + +*** + +### toCreationAddress() + +> **toCreationAddress**(): `boolean` + +Defined in: [types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L210) + +#### Returns + +`boolean` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`toCreationAddress`](EIP1559CompatibleTx.md#tocreationaddress) + +*** + +### toJSON() + +> **toJSON**(): [`JSONTx`](JSONTx.md) + +Defined in: [types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L224) + +#### Returns + +[`JSONTx`](JSONTx.md) + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`toJSON`](EIP1559CompatibleTx.md#tojson) + +*** + +### verifySignature() + +> **verifySignature**(): `boolean` + +Defined in: [types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L220) + +#### Returns + +`boolean` + +#### Inherited from + +[`EIP1559CompatibleTx`](EIP1559CompatibleTx.md).[`verifySignature`](EIP1559CompatibleTx.md#verifysignature) diff --git a/packages/tx/docs/interfaces/EOACode7702TxData.md b/packages/tx/docs/interfaces/EOACode7702TxData.md new file mode 100644 index 00000000000..ea36ef04f12 --- /dev/null +++ b/packages/tx/docs/interfaces/EOACode7702TxData.md @@ -0,0 +1,220 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / EOACode7702TxData + +# Interface: EOACode7702TxData + +Defined in: [types.ts:430](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L430) + +[EOACode7702Tx](../classes/EOACode7702Tx.md) data. + +## Extends + +- [`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md) + +## Properties + +### accessList? + +> `optional` **accessList**: `null` \| [`AccessListBytes`](../type-aliases/AccessListBytes.md) \| [`AccessList`](../type-aliases/AccessList.md) + +Defined in: [types.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L375) + +The access list which contains the addresses/storage slots which the transaction wishes to access + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`accessList`](FeeMarketEIP1559TxData.md#accesslist) + +*** + +### authorizationList? + +> `optional` **authorizationList**: [`AuthorizationListBytes`](../type-aliases/AuthorizationListBytes.md) \| [`AuthorizationList`](../type-aliases/AuthorizationList.md) + +Defined in: [types.ts:431](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L431) + +*** + +### chainId? + +> `optional` **chainId**: `BigIntLike` + +Defined in: [types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L370) + +The transaction's chain ID + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`chainId`](FeeMarketEIP1559TxData.md#chainid) + +*** + +### data? + +> `optional` **data**: `""` \| `BytesLike` + +Defined in: [types.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L339) + +This will contain the data of the message or the init of a contract. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`data`](FeeMarketEIP1559TxData.md#data) + +*** + +### gasLimit? + +> `optional` **gasLimit**: `BigIntLike` + +Defined in: [types.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L324) + +The transaction's gas limit. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`gasLimit`](FeeMarketEIP1559TxData.md#gaslimit) + +*** + +### gasPrice? + +> `optional` **gasPrice**: `null` + +Defined in: [types.ts:386](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L386) + +The transaction's gas price, inherited from [Transaction](Transaction.md). This property is not used for EIP1559 +transactions and should always be undefined for this specific transaction type. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`gasPrice`](FeeMarketEIP1559TxData.md#gasprice) + +*** + +### maxFeePerGas? + +> `optional` **maxFeePerGas**: `BigIntLike` + +Defined in: [types.ts:394](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L394) + +The maximum total fee + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`maxFeePerGas`](FeeMarketEIP1559TxData.md#maxfeepergas) + +*** + +### maxPriorityFeePerGas? + +> `optional` **maxPriorityFeePerGas**: `BigIntLike` + +Defined in: [types.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L390) + +The maximum inclusion fee per gas (this fee is given to the miner) + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`maxPriorityFeePerGas`](FeeMarketEIP1559TxData.md#maxpriorityfeepergas) + +*** + +### nonce? + +> `optional` **nonce**: `BigIntLike` + +Defined in: [types.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L314) + +The transaction's nonce. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`nonce`](FeeMarketEIP1559TxData.md#nonce) + +*** + +### r? + +> `optional` **r**: `BigIntLike` + +Defined in: [types.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L349) + +EC signature parameter. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`r`](FeeMarketEIP1559TxData.md#r) + +*** + +### s? + +> `optional` **s**: `BigIntLike` + +Defined in: [types.ts:354](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L354) + +EC signature parameter. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`s`](FeeMarketEIP1559TxData.md#s) + +*** + +### to? + +> `optional` **to**: `""` \| `AddressLike` + +Defined in: [types.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L329) + +The transaction's the address is sent to. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`to`](FeeMarketEIP1559TxData.md#to) + +*** + +### type? + +> `optional` **type**: `BigIntLike` + +Defined in: [types.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L360) + +The transaction type + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`type`](FeeMarketEIP1559TxData.md#type) + +*** + +### v? + +> `optional` **v**: `BigIntLike` + +Defined in: [types.ts:344](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L344) + +EC recovery ID. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`v`](FeeMarketEIP1559TxData.md#v) + +*** + +### value? + +> `optional` **value**: `BigIntLike` + +Defined in: [types.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L334) + +The amount of Ether sent. + +#### Inherited from + +[`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md).[`value`](FeeMarketEIP1559TxData.md#value) diff --git a/packages/tx/docs/interfaces/FeeMarketEIP1559TxData.md b/packages/tx/docs/interfaces/FeeMarketEIP1559TxData.md index d7a225d4d87..cd12e29f15b 100644 --- a/packages/tx/docs/interfaces/FeeMarketEIP1559TxData.md +++ b/packages/tx/docs/interfaces/FeeMarketEIP1559TxData.md @@ -1,249 +1,209 @@ -[@ethereumjs/tx](../README.md) / FeeMarketEIP1559TxData +[**@ethereumjs/tx**](../README.md) -# Interface: FeeMarketEIP1559TxData +*** -[FeeMarketEIP1559Transaction](../classes/FeeMarketEIP1559Transaction.md) data. +[@ethereumjs/tx](../README.md) / FeeMarketEIP1559TxData -## Hierarchy +# Interface: FeeMarketEIP1559TxData -- [`AccessListEIP2930TxData`](AccessListEIP2930TxData.md) +Defined in: [types.ts:381](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L381) - ↳ **`FeeMarketEIP1559TxData`** +[FeeMarket1559Tx](../classes/FeeMarket1559Tx.md) data. - ↳↳ [`BlobEIP4844TxData`](BlobEIP4844TxData.md) +## Extends -## Table of contents +- [`AccessList2930TxData`](AccessList2930TxData.md) -### Properties +## Extended by -- [accessList](FeeMarketEIP1559TxData.md#accesslist) -- [chainId](FeeMarketEIP1559TxData.md#chainid) -- [data](FeeMarketEIP1559TxData.md#data) -- [gasLimit](FeeMarketEIP1559TxData.md#gaslimit) -- [gasPrice](FeeMarketEIP1559TxData.md#gasprice) -- [maxFeePerGas](FeeMarketEIP1559TxData.md#maxfeepergas) -- [maxPriorityFeePerGas](FeeMarketEIP1559TxData.md#maxpriorityfeepergas) -- [nonce](FeeMarketEIP1559TxData.md#nonce) -- [r](FeeMarketEIP1559TxData.md#r) -- [s](FeeMarketEIP1559TxData.md#s) -- [to](FeeMarketEIP1559TxData.md#to) -- [type](FeeMarketEIP1559TxData.md#type) -- [v](FeeMarketEIP1559TxData.md#v) -- [value](FeeMarketEIP1559TxData.md#value) +- [`BlobEIP4844TxData`](BlobEIP4844TxData.md) +- [`EOACode7702TxData`](EOACode7702TxData.md) ## Properties -### accessList +### accessList? + +> `optional` **accessList**: `null` \| [`AccessListBytes`](../type-aliases/AccessListBytes.md) \| [`AccessList`](../type-aliases/AccessList.md) -• `Optional` **accessList**: ``null`` \| [`AccessListBytes`](../README.md#accesslistbytes) \| [`AccessList`](../README.md#accesslist) +Defined in: [types.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L375) The access list which contains the addresses/storage slots which the transaction wishes to access #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[accessList](AccessListEIP2930TxData.md#accesslist) +[`AccessList2930TxData`](AccessList2930TxData.md).[`accessList`](AccessList2930TxData.md#accesslist) -#### Defined in +*** -[tx/src/types.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L303) +### chainId? -___ +> `optional` **chainId**: `BigIntLike` -### chainId - -• `Optional` **chainId**: `BigIntLike` +Defined in: [types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L370) The transaction's chain ID #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[chainId](AccessListEIP2930TxData.md#chainid) - -#### Defined in +[`AccessList2930TxData`](AccessList2930TxData.md).[`chainId`](AccessList2930TxData.md#chainid) -[tx/src/types.ts:298](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L298) +*** -___ +### data? -### data +> `optional` **data**: `""` \| `BytesLike` -• `Optional` **data**: `BytesLike` +Defined in: [types.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L339) This will contain the data of the message or the init of a contract. #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[data](AccessListEIP2930TxData.md#data) - -#### Defined in +[`AccessList2930TxData`](AccessList2930TxData.md).[`data`](AccessList2930TxData.md#data) -[tx/src/types.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L267) +*** -___ +### gasLimit? -### gasLimit +> `optional` **gasLimit**: `BigIntLike` -• `Optional` **gasLimit**: `BigIntLike` +Defined in: [types.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L324) The transaction's gas limit. #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[gasLimit](AccessListEIP2930TxData.md#gaslimit) +[`AccessList2930TxData`](AccessList2930TxData.md).[`gasLimit`](AccessList2930TxData.md#gaslimit) -#### Defined in +*** -[tx/src/types.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L252) +### gasPrice? -___ +> `optional` **gasPrice**: `null` -### gasPrice - -• `Optional` **gasPrice**: ``null`` +Defined in: [types.ts:386](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L386) The transaction's gas price, inherited from [Transaction](Transaction.md). This property is not used for EIP1559 transactions and should always be undefined for this specific transaction type. #### Overrides -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[gasPrice](AccessListEIP2930TxData.md#gasprice) - -#### Defined in +[`AccessList2930TxData`](AccessList2930TxData.md).[`gasPrice`](AccessList2930TxData.md#gasprice) -[tx/src/types.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L314) +*** -___ +### maxFeePerGas? -### maxFeePerGas +> `optional` **maxFeePerGas**: `BigIntLike` -• `Optional` **maxFeePerGas**: `BigIntLike` +Defined in: [types.ts:394](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L394) The maximum total fee -#### Defined in +*** -[tx/src/types.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L322) +### maxPriorityFeePerGas? -___ +> `optional` **maxPriorityFeePerGas**: `BigIntLike` -### maxPriorityFeePerGas - -• `Optional` **maxPriorityFeePerGas**: `BigIntLike` +Defined in: [types.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L390) The maximum inclusion fee per gas (this fee is given to the miner) -#### Defined in - -[tx/src/types.ts:318](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L318) +*** -___ +### nonce? -### nonce +> `optional` **nonce**: `BigIntLike` -• `Optional` **nonce**: `BigIntLike` +Defined in: [types.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L314) The transaction's nonce. #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[nonce](AccessListEIP2930TxData.md#nonce) - -#### Defined in +[`AccessList2930TxData`](AccessList2930TxData.md).[`nonce`](AccessList2930TxData.md#nonce) -[tx/src/types.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L242) +*** -___ +### r? -### r +> `optional` **r**: `BigIntLike` -• `Optional` **r**: `BigIntLike` +Defined in: [types.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L349) EC signature parameter. #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[r](AccessListEIP2930TxData.md#r) +[`AccessList2930TxData`](AccessList2930TxData.md).[`r`](AccessList2930TxData.md#r) -#### Defined in +*** -[tx/src/types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L277) +### s? -___ +> `optional` **s**: `BigIntLike` -### s - -• `Optional` **s**: `BigIntLike` +Defined in: [types.ts:354](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L354) EC signature parameter. #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[s](AccessListEIP2930TxData.md#s) - -#### Defined in +[`AccessList2930TxData`](AccessList2930TxData.md).[`s`](AccessList2930TxData.md#s) -[tx/src/types.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L282) +*** -___ +### to? -### to +> `optional` **to**: `""` \| `AddressLike` -• `Optional` **to**: `AddressLike` +Defined in: [types.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L329) The transaction's the address is sent to. #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[to](AccessListEIP2930TxData.md#to) +[`AccessList2930TxData`](AccessList2930TxData.md).[`to`](AccessList2930TxData.md#to) -#### Defined in +*** -[tx/src/types.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L257) +### type? -___ +> `optional` **type**: `BigIntLike` -### type - -• `Optional` **type**: `BigIntLike` +Defined in: [types.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L360) The transaction type #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[type](AccessListEIP2930TxData.md#type) - -#### Defined in +[`AccessList2930TxData`](AccessList2930TxData.md).[`type`](AccessList2930TxData.md#type) -[tx/src/types.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L288) +*** -___ +### v? -### v +> `optional` **v**: `BigIntLike` -• `Optional` **v**: `BigIntLike` +Defined in: [types.ts:344](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L344) EC recovery ID. #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[v](AccessListEIP2930TxData.md#v) - -#### Defined in +[`AccessList2930TxData`](AccessList2930TxData.md).[`v`](AccessList2930TxData.md#v) -[tx/src/types.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L272) +*** -___ +### value? -### value +> `optional` **value**: `BigIntLike` -• `Optional` **value**: `BigIntLike` +Defined in: [types.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L334) The amount of Ether sent. #### Inherited from -[AccessListEIP2930TxData](AccessListEIP2930TxData.md).[value](AccessListEIP2930TxData.md#value) - -#### Defined in - -[tx/src/types.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L262) +[`AccessList2930TxData`](AccessList2930TxData.md).[`value`](AccessList2930TxData.md#value) diff --git a/packages/tx/docs/interfaces/JSONRPCTx.md b/packages/tx/docs/interfaces/JSONRPCTx.md new file mode 100644 index 00000000000..23b461f0d4b --- /dev/null +++ b/packages/tx/docs/interfaces/JSONRPCTx.md @@ -0,0 +1,185 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / JSONRPCTx + +# Interface: JSONRPCTx + +Defined in: [types.ts:568](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L568) + +## Properties + +### accessList? + +> `optional` **accessList**: `JSONAccessListItem`[] + +Defined in: [types.ts:577](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L577) + +*** + +### blobVersionedHashes? + +> `optional` **blobVersionedHashes**: `string`[] + +Defined in: [types.ts:589](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L589) + +*** + +### blockHash + +> **blockHash**: `null` \| `string` + +Defined in: [types.ts:569](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L569) + +*** + +### blockNumber + +> **blockNumber**: `null` \| `string` + +Defined in: [types.ts:570](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L570) + +*** + +### chainId? + +> `optional` **chainId**: `string` + +Defined in: [types.ts:578](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L578) + +*** + +### from + +> **from**: `string` + +Defined in: [types.ts:571](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L571) + +*** + +### gas + +> **gas**: `string` + +Defined in: [types.ts:572](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L572) + +*** + +### gasPrice + +> **gasPrice**: `string` + +Defined in: [types.ts:573](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L573) + +*** + +### hash + +> **hash**: `string` + +Defined in: [types.ts:579](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L579) + +*** + +### input + +> **input**: `string` + +Defined in: [types.ts:580](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L580) + +*** + +### maxFeePerBlobGas? + +> `optional` **maxFeePerBlobGas**: `string` + +Defined in: [types.ts:588](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L588) + +*** + +### maxFeePerGas? + +> `optional` **maxFeePerGas**: `string` + +Defined in: [types.ts:574](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L574) + +*** + +### maxPriorityFeePerGas? + +> `optional` **maxPriorityFeePerGas**: `string` + +Defined in: [types.ts:575](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L575) + +*** + +### nonce + +> **nonce**: `string` + +Defined in: [types.ts:581](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L581) + +*** + +### r + +> **r**: `string` + +Defined in: [types.ts:586](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L586) + +*** + +### s + +> **s**: `string` + +Defined in: [types.ts:587](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L587) + +*** + +### to + +> **to**: `null` \| `string` + +Defined in: [types.ts:582](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L582) + +*** + +### transactionIndex + +> **transactionIndex**: `null` \| `string` + +Defined in: [types.ts:583](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L583) + +*** + +### type + +> **type**: `string` + +Defined in: [types.ts:576](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L576) + +*** + +### v + +> **v**: `string` + +Defined in: [types.ts:585](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L585) + +*** + +### value + +> **value**: `string` + +Defined in: [types.ts:584](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L584) + +*** + +### yParity? + +> `optional` **yParity**: `string` + +Defined in: [types.ts:590](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L590) diff --git a/packages/tx/docs/interfaces/JSONTx.md b/packages/tx/docs/interfaces/JSONTx.md new file mode 100644 index 00000000000..2cd5e801bd0 --- /dev/null +++ b/packages/tx/docs/interfaces/JSONTx.md @@ -0,0 +1,160 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / JSONTx + +# Interface: JSONTx + +Defined in: [types.ts:538](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L538) + +Generic interface for all tx types with a +JSON representation of a transaction. + +Note that all values are marked as optional +and not all the values are present on all tx types +(an EIP1559 tx e.g. lacks a `gasPrice`). + +## Properties + +### accessList? + +> `optional` **accessList**: `JSONAccessListItem`[] + +Defined in: [types.ts:549](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L549) + +*** + +### authorizationList? + +> `optional` **authorizationList**: [`AuthorizationList`](../type-aliases/AuthorizationList.md) + +Defined in: [types.ts:550](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L550) + +*** + +### blobVersionedHashes? + +> `optional` **blobVersionedHashes**: `` `0x${string}` ``[] + +Defined in: [types.ts:555](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L555) + +*** + +### chainId? + +> `optional` **chainId**: `` `0x${string}` `` + +Defined in: [types.ts:548](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L548) + +*** + +### data? + +> `optional` **data**: `` `0x${string}` `` + +Defined in: [types.ts:543](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L543) + +*** + +### gasLimit? + +> `optional` **gasLimit**: `` `0x${string}` `` + +Defined in: [types.ts:541](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L541) + +*** + +### gasPrice? + +> `optional` **gasPrice**: `` `0x${string}` `` + +Defined in: [types.ts:540](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L540) + +*** + +### maxFeePerBlobGas? + +> `optional` **maxFeePerBlobGas**: `` `0x${string}` `` + +Defined in: [types.ts:554](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L554) + +*** + +### maxFeePerGas? + +> `optional` **maxFeePerGas**: `` `0x${string}` `` + +Defined in: [types.ts:553](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L553) + +*** + +### maxPriorityFeePerGas? + +> `optional` **maxPriorityFeePerGas**: `` `0x${string}` `` + +Defined in: [types.ts:552](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L552) + +*** + +### nonce? + +> `optional` **nonce**: `` `0x${string}` `` + +Defined in: [types.ts:539](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L539) + +*** + +### r? + +> `optional` **r**: `` `0x${string}` `` + +Defined in: [types.ts:545](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L545) + +*** + +### s? + +> `optional` **s**: `` `0x${string}` `` + +Defined in: [types.ts:546](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L546) + +*** + +### to? + +> `optional` **to**: `` `0x${string}` `` + +Defined in: [types.ts:542](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L542) + +*** + +### type? + +> `optional` **type**: `` `0x${string}` `` + +Defined in: [types.ts:551](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L551) + +*** + +### v? + +> `optional` **v**: `` `0x${string}` `` + +Defined in: [types.ts:544](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L544) + +*** + +### value? + +> `optional` **value**: `` `0x${string}` `` + +Defined in: [types.ts:547](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L547) + +*** + +### yParity? + +> `optional` **yParity**: `` `0x${string}` `` + +Defined in: [types.ts:556](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L556) diff --git a/packages/tx/docs/interfaces/JsonRpcTx.md b/packages/tx/docs/interfaces/JsonRpcTx.md deleted file mode 100644 index 91cfe19f6c7..00000000000 --- a/packages/tx/docs/interfaces/JsonRpcTx.md +++ /dev/null @@ -1,239 +0,0 @@ -[@ethereumjs/tx](../README.md) / JsonRpcTx - -# Interface: JsonRpcTx - -## Table of contents - -### Properties - -- [accessList](JsonRpcTx.md#accesslist) -- [blobVersionedHashes](JsonRpcTx.md#blobversionedhashes) -- [blockHash](JsonRpcTx.md#blockhash) -- [blockNumber](JsonRpcTx.md#blocknumber) -- [chainId](JsonRpcTx.md#chainid) -- [from](JsonRpcTx.md#from) -- [gas](JsonRpcTx.md#gas) -- [gasPrice](JsonRpcTx.md#gasprice) -- [hash](JsonRpcTx.md#hash) -- [input](JsonRpcTx.md#input) -- [maxFeePerBlobGas](JsonRpcTx.md#maxfeeperblobgas) -- [maxFeePerGas](JsonRpcTx.md#maxfeepergas) -- [maxPriorityFeePerGas](JsonRpcTx.md#maxpriorityfeepergas) -- [nonce](JsonRpcTx.md#nonce) -- [r](JsonRpcTx.md#r) -- [s](JsonRpcTx.md#s) -- [to](JsonRpcTx.md#to) -- [transactionIndex](JsonRpcTx.md#transactionindex) -- [type](JsonRpcTx.md#type) -- [v](JsonRpcTx.md#v) -- [value](JsonRpcTx.md#value) - -## Properties - -### accessList - -• `Optional` **accessList**: `JsonAccessListItem`[] - -#### Defined in - -[tx/src/types.ts:470](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L470) - -___ - -### blobVersionedHashes - -• `Optional` **blobVersionedHashes**: `string`[] - -#### Defined in - -[tx/src/types.ts:482](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L482) - -___ - -### blockHash - -• **blockHash**: ``null`` \| `string` - -#### Defined in - -[tx/src/types.ts:462](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L462) - -___ - -### blockNumber - -• **blockNumber**: ``null`` \| `string` - -#### Defined in - -[tx/src/types.ts:463](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L463) - -___ - -### chainId - -• `Optional` **chainId**: `string` - -#### Defined in - -[tx/src/types.ts:471](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L471) - -___ - -### from - -• **from**: `string` - -#### Defined in - -[tx/src/types.ts:464](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L464) - -___ - -### gas - -• **gas**: `string` - -#### Defined in - -[tx/src/types.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L465) - -___ - -### gasPrice - -• **gasPrice**: `string` - -#### Defined in - -[tx/src/types.ts:466](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L466) - -___ - -### hash - -• **hash**: `string` - -#### Defined in - -[tx/src/types.ts:472](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L472) - -___ - -### input - -• **input**: `string` - -#### Defined in - -[tx/src/types.ts:473](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L473) - -___ - -### maxFeePerBlobGas - -• `Optional` **maxFeePerBlobGas**: `string` - -#### Defined in - -[tx/src/types.ts:481](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L481) - -___ - -### maxFeePerGas - -• `Optional` **maxFeePerGas**: `string` - -#### Defined in - -[tx/src/types.ts:467](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L467) - -___ - -### maxPriorityFeePerGas - -• `Optional` **maxPriorityFeePerGas**: `string` - -#### Defined in - -[tx/src/types.ts:468](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L468) - -___ - -### nonce - -• **nonce**: `string` - -#### Defined in - -[tx/src/types.ts:474](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L474) - -___ - -### r - -• **r**: `string` - -#### Defined in - -[tx/src/types.ts:479](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L479) - -___ - -### s - -• **s**: `string` - -#### Defined in - -[tx/src/types.ts:480](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L480) - -___ - -### to - -• **to**: ``null`` \| `string` - -#### Defined in - -[tx/src/types.ts:475](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L475) - -___ - -### transactionIndex - -• **transactionIndex**: ``null`` \| `string` - -#### Defined in - -[tx/src/types.ts:476](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L476) - -___ - -### type - -• **type**: `string` - -#### Defined in - -[tx/src/types.ts:469](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L469) - -___ - -### v - -• **v**: `string` - -#### Defined in - -[tx/src/types.ts:478](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L478) - -___ - -### value - -• **value**: `string` - -#### Defined in - -[tx/src/types.ts:477](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L477) diff --git a/packages/tx/docs/interfaces/JsonTx.md b/packages/tx/docs/interfaces/JsonTx.md deleted file mode 100644 index d345b8d8e75..00000000000 --- a/packages/tx/docs/interfaces/JsonTx.md +++ /dev/null @@ -1,191 +0,0 @@ -[@ethereumjs/tx](../README.md) / JsonTx - -# Interface: JsonTx - -Generic interface for all tx types with a -JSON representation of a transaction. - -Note that all values are marked as optional -and not all the values are present on all tx types -(an EIP1559 tx e.g. lacks a `gasPrice`). - -## Table of contents - -### Properties - -- [accessList](JsonTx.md#accesslist) -- [blobVersionedHashes](JsonTx.md#blobversionedhashes) -- [chainId](JsonTx.md#chainid) -- [data](JsonTx.md#data) -- [gasLimit](JsonTx.md#gaslimit) -- [gasPrice](JsonTx.md#gasprice) -- [maxFeePerBlobGas](JsonTx.md#maxfeeperblobgas) -- [maxFeePerGas](JsonTx.md#maxfeepergas) -- [maxPriorityFeePerGas](JsonTx.md#maxpriorityfeepergas) -- [nonce](JsonTx.md#nonce) -- [r](JsonTx.md#r) -- [s](JsonTx.md#s) -- [to](JsonTx.md#to) -- [type](JsonTx.md#type) -- [v](JsonTx.md#v) -- [value](JsonTx.md#value) - -## Properties - -### accessList - -• `Optional` **accessList**: `JsonAccessListItem`[] - -#### Defined in - -[tx/src/types.ts:450](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L450) - -___ - -### blobVersionedHashes - -• `Optional` **blobVersionedHashes**: `string`[] - -#### Defined in - -[tx/src/types.ts:455](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L455) - -___ - -### chainId - -• `Optional` **chainId**: `string` - -#### Defined in - -[tx/src/types.ts:449](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L449) - -___ - -### data - -• `Optional` **data**: `string` - -#### Defined in - -[tx/src/types.ts:444](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L444) - -___ - -### gasLimit - -• `Optional` **gasLimit**: `string` - -#### Defined in - -[tx/src/types.ts:442](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L442) - -___ - -### gasPrice - -• `Optional` **gasPrice**: `string` - -#### Defined in - -[tx/src/types.ts:441](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L441) - -___ - -### maxFeePerBlobGas - -• `Optional` **maxFeePerBlobGas**: `string` - -#### Defined in - -[tx/src/types.ts:454](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L454) - -___ - -### maxFeePerGas - -• `Optional` **maxFeePerGas**: `string` - -#### Defined in - -[tx/src/types.ts:453](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L453) - -___ - -### maxPriorityFeePerGas - -• `Optional` **maxPriorityFeePerGas**: `string` - -#### Defined in - -[tx/src/types.ts:452](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L452) - -___ - -### nonce - -• `Optional` **nonce**: `string` - -#### Defined in - -[tx/src/types.ts:440](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L440) - -___ - -### r - -• `Optional` **r**: `string` - -#### Defined in - -[tx/src/types.ts:446](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L446) - -___ - -### s - -• `Optional` **s**: `string` - -#### Defined in - -[tx/src/types.ts:447](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L447) - -___ - -### to - -• `Optional` **to**: `string` - -#### Defined in - -[tx/src/types.ts:443](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L443) - -___ - -### type - -• `Optional` **type**: `string` - -#### Defined in - -[tx/src/types.ts:451](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L451) - -___ - -### v - -• `Optional` **v**: `string` - -#### Defined in - -[tx/src/types.ts:445](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L445) - -___ - -### value - -• `Optional` **value**: `string` - -#### Defined in - -[tx/src/types.ts:448](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L448) diff --git a/packages/tx/docs/interfaces/LegacyTxInterface.md b/packages/tx/docs/interfaces/LegacyTxInterface.md index c7b82b833d2..c68dfce06cc 100644 --- a/packages/tx/docs/interfaces/LegacyTxInterface.md +++ b/packages/tx/docs/interfaces/LegacyTxInterface.md @@ -1,253 +1,224 @@ +[**@ethereumjs/tx**](../README.md) + +*** + [@ethereumjs/tx](../README.md) / LegacyTxInterface -# Interface: LegacyTxInterface - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) = [`TransactionType`](../enums/TransactionType.md) | - -## Hierarchy - -- [`TransactionInterface`](TransactionInterface.md)<`T`\> - - ↳ **`LegacyTxInterface`** - -## Table of contents - -### Properties - -- [cache](LegacyTxInterface.md#cache) -- [common](LegacyTxInterface.md#common) -- [data](LegacyTxInterface.md#data) -- [gasLimit](LegacyTxInterface.md#gaslimit) -- [nonce](LegacyTxInterface.md#nonce) -- [r](LegacyTxInterface.md#r) -- [s](LegacyTxInterface.md#s) -- [to](LegacyTxInterface.md#to) -- [type](LegacyTxInterface.md#type) -- [v](LegacyTxInterface.md#v) -- [value](LegacyTxInterface.md#value) - -### Methods - -- [errorStr](LegacyTxInterface.md#errorstr) -- [getBaseFee](LegacyTxInterface.md#getbasefee) -- [getDataFee](LegacyTxInterface.md#getdatafee) -- [getHashedMessageToSign](LegacyTxInterface.md#gethashedmessagetosign) -- [getMessageToSign](LegacyTxInterface.md#getmessagetosign) -- [getMessageToVerifySignature](LegacyTxInterface.md#getmessagetoverifysignature) -- [getSenderAddress](LegacyTxInterface.md#getsenderaddress) -- [getSenderPublicKey](LegacyTxInterface.md#getsenderpublickey) -- [getUpfrontCost](LegacyTxInterface.md#getupfrontcost) -- [getValidationErrors](LegacyTxInterface.md#getvalidationerrors) -- [hash](LegacyTxInterface.md#hash) -- [isSigned](LegacyTxInterface.md#issigned) -- [isValid](LegacyTxInterface.md#isvalid) -- [raw](LegacyTxInterface.md#raw) -- [serialize](LegacyTxInterface.md#serialize) -- [sign](LegacyTxInterface.md#sign) -- [supports](LegacyTxInterface.md#supports) -- [toCreationAddress](LegacyTxInterface.md#tocreationaddress) -- [toJSON](LegacyTxInterface.md#tojson) -- [verifySignature](LegacyTxInterface.md#verifysignature) +# Interface: LegacyTxInterface\ -## Properties +Defined in: [types.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L235) -### cache +## Extends -• `Readonly` **cache**: [`TransactionCache`](TransactionCache.md) +- [`TransactionInterface`](TransactionInterface.md)\<`T`\> -#### Inherited from +## Type Parameters -[TransactionInterface](TransactionInterface.md).[cache](TransactionInterface.md#cache) +### T -#### Defined in +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) = [`TransactionType`](../type-aliases/TransactionType.md) -[tx/src/types.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L150) +## Properties -___ +### cache -### common +> `readonly` **cache**: [`TransactionCache`](TransactionCache.md) -• `Readonly` **common**: `Common` +Defined in: [types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L203) #### Inherited from -[TransactionInterface](TransactionInterface.md).[common](TransactionInterface.md#common) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`cache`](TransactionInterface.md#cache) -[tx/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L141) +*** -___ +### common -### data +> `readonly` **common**: `Common` -• `Readonly` **data**: `Uint8Array` +Defined in: [types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L194) #### Inherited from -[TransactionInterface](TransactionInterface.md).[data](TransactionInterface.md#data) +[`TransactionInterface`](TransactionInterface.md).[`common`](TransactionInterface.md#common) -#### Defined in +*** -[tx/src/types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L146) - -___ +### data -### gasLimit +> `readonly` **data**: `Uint8Array` -• `Readonly` **gasLimit**: `bigint` +Defined in: [types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L199) #### Inherited from -[TransactionInterface](TransactionInterface.md).[gasLimit](TransactionInterface.md#gaslimit) +[`TransactionInterface`](TransactionInterface.md).[`data`](TransactionInterface.md#data) + +*** + +### gasLimit + +> `readonly` **gasLimit**: `bigint` -#### Defined in +Defined in: [types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L196) -[tx/src/types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L143) +#### Inherited from -___ +[`TransactionInterface`](TransactionInterface.md).[`gasLimit`](TransactionInterface.md#gaslimit) + +*** ### nonce -• `Readonly` **nonce**: `bigint` +> `readonly` **nonce**: `bigint` -#### Inherited from +Defined in: [types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L195) -[TransactionInterface](TransactionInterface.md).[nonce](TransactionInterface.md#nonce) +#### Inherited from -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`nonce`](TransactionInterface.md#nonce) -[tx/src/types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L142) +*** -___ +### r? -### r +> `readonly` `optional` **r**: `bigint` -• `Optional` `Readonly` **r**: `bigint` +Defined in: [types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L201) #### Inherited from -[TransactionInterface](TransactionInterface.md).[r](TransactionInterface.md#r) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`r`](TransactionInterface.md#r) -[tx/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L148) +*** -___ +### s? -### s +> `readonly` `optional` **s**: `bigint` -• `Optional` `Readonly` **s**: `bigint` +Defined in: [types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L202) #### Inherited from -[TransactionInterface](TransactionInterface.md).[s](TransactionInterface.md#s) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`s`](TransactionInterface.md#s) -[tx/src/types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L149) +*** -___ +### to? -### to +> `readonly` `optional` **to**: `Address` -• `Optional` `Readonly` **to**: `Address` +Defined in: [types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L197) #### Inherited from -[TransactionInterface](TransactionInterface.md).[to](TransactionInterface.md#to) +[`TransactionInterface`](TransactionInterface.md).[`to`](TransactionInterface.md#to) -#### Defined in +*** -[tx/src/types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L144) +### txOptions -___ +> **txOptions**: [`TxOptions`](TxOptions.md) + +Defined in: [types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L206) + +#### Inherited from + +[`TransactionInterface`](TransactionInterface.md).[`txOptions`](TransactionInterface.md#txoptions) + +*** ### type -• **type**: [`TransactionType`](../enums/TransactionType.md) +> **type**: [`TransactionType`](../type-aliases/TransactionType.md) + +Defined in: [types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L205) #### Inherited from -[TransactionInterface](TransactionInterface.md).[type](TransactionInterface.md#type) +[`TransactionInterface`](TransactionInterface.md).[`type`](TransactionInterface.md#type) -#### Defined in +*** -[tx/src/types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L152) +### v? -___ +> `readonly` `optional` **v**: `bigint` -### v +Defined in: [types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L200) + +#### Inherited from -• `Optional` `Readonly` **v**: `bigint` +[`TransactionInterface`](TransactionInterface.md).[`v`](TransactionInterface.md#v) + +*** + +### value + +> `readonly` **value**: `bigint` + +Defined in: [types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L198) #### Inherited from -[TransactionInterface](TransactionInterface.md).[v](TransactionInterface.md#v) +[`TransactionInterface`](TransactionInterface.md).[`value`](TransactionInterface.md#value) -#### Defined in +## Methods -[tx/src/types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L147) +### addSignature() -___ +> **addSignature**(`v`, `r`, `s`, `convertV?`): [`Transaction`](Transaction.md)\[`T`\] -### value +Defined in: [types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L227) -• `Readonly` **value**: `bigint` +#### Parameters -#### Inherited from +##### v -[TransactionInterface](TransactionInterface.md).[value](TransactionInterface.md#value) +`bigint` -#### Defined in +##### r -[tx/src/types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L145) +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -## Methods +##### s + +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -### errorStr +##### convertV? -▸ **errorStr**(): `string` +`boolean` #### Returns -`string` +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[TransactionInterface](TransactionInterface.md).[errorStr](TransactionInterface.md#errorstr) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`addSignature`](TransactionInterface.md#addsignature) -[tx/src/types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L171) +*** -___ +### errorStr() -### getBaseFee +> **errorStr**(): `string` -▸ **getBaseFee**(): `bigint` +Defined in: [types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L225) #### Returns -`bigint` +`string` #### Inherited from -[TransactionInterface](TransactionInterface.md).[getBaseFee](TransactionInterface.md#getbasefee) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`errorStr`](TransactionInterface.md#errorstr) -[tx/src/types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L153) +*** -___ +### getDataGas() -### getDataFee +> **getDataGas**(): `bigint` -▸ **getDataFee**(): `bigint` +Defined in: [types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L208) #### Returns @@ -255,17 +226,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getDataFee](TransactionInterface.md#getdatafee) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getDataGas`](TransactionInterface.md#getdatagas) -[tx/src/types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L154) +*** -___ +### getHashedMessageToSign() -### getHashedMessageToSign +> **getHashedMessageToSign**(): `Uint8Array` -▸ **getHashedMessageToSign**(): `Uint8Array` +Defined in: [types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L214) #### Returns @@ -273,35 +242,47 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getHashedMessageToSign](TransactionInterface.md#gethashedmessagetosign) +[`TransactionInterface`](TransactionInterface.md).[`getHashedMessageToSign`](TransactionInterface.md#gethashedmessagetosign) -#### Defined in +*** -[tx/src/types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L160) +### getIntrinsicGas() -___ +> **getIntrinsicGas**(): `bigint` -### getMessageToSign - -▸ **getMessageToSign**(): `Uint8Array` \| `Uint8Array`[] +Defined in: [types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L207) #### Returns -`Uint8Array` \| `Uint8Array`[] +`bigint` #### Inherited from -[TransactionInterface](TransactionInterface.md).[getMessageToSign](TransactionInterface.md#getmessagetosign) +[`TransactionInterface`](TransactionInterface.md).[`getIntrinsicGas`](TransactionInterface.md#getintrinsicgas) -#### Defined in +*** -[tx/src/types.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L159) +### getMessageToSign() -___ +> **getMessageToSign**(): `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] -### getMessageToVerifySignature +Defined in: [types.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L213) -▸ **getMessageToVerifySignature**(): `Uint8Array` +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +#### Inherited from + +[`TransactionInterface`](TransactionInterface.md).[`getMessageToSign`](TransactionInterface.md#getmessagetosign) + +*** + +### getMessageToVerifySignature() + +> **getMessageToVerifySignature**(): `Uint8Array` + +Defined in: [types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L216) #### Returns @@ -309,17 +290,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getMessageToVerifySignature](TransactionInterface.md#getmessagetoverifysignature) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getMessageToVerifySignature`](TransactionInterface.md#getmessagetoverifysignature) -[tx/src/types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L162) +*** -___ +### getSenderAddress() -### getSenderAddress +> **getSenderAddress**(): `Address` -▸ **getSenderAddress**(): `Address` +Defined in: [types.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L221) #### Returns @@ -327,17 +306,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getSenderAddress](TransactionInterface.md#getsenderaddress) +[`TransactionInterface`](TransactionInterface.md).[`getSenderAddress`](TransactionInterface.md#getsenderaddress) -#### Defined in +*** -[tx/src/types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L167) +### getSenderPublicKey() -___ +> **getSenderPublicKey**(): `Uint8Array` -### getSenderPublicKey - -▸ **getSenderPublicKey**(): `Uint8Array` +Defined in: [types.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L222) #### Returns @@ -345,17 +322,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getSenderPublicKey](TransactionInterface.md#getsenderpublickey) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getSenderPublicKey`](TransactionInterface.md#getsenderpublickey) -[tx/src/types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L168) +*** -___ +### getUpfrontCost() -### getUpfrontCost +> **getUpfrontCost**(): `bigint` -▸ **getUpfrontCost**(): `bigint` +Defined in: [types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L209) #### Returns @@ -363,17 +338,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getUpfrontCost](TransactionInterface.md#getupfrontcost) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`getUpfrontCost`](TransactionInterface.md#getupfrontcost) -[tx/src/types.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L155) +*** -___ +### getValidationErrors() -### getValidationErrors +> **getValidationErrors**(): `string`[] -▸ **getValidationErrors**(): `string`[] +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L217) #### Returns @@ -381,17 +354,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[getValidationErrors](TransactionInterface.md#getvalidationerrors) +[`TransactionInterface`](TransactionInterface.md).[`getValidationErrors`](TransactionInterface.md#getvalidationerrors) -#### Defined in +*** -[tx/src/types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L163) +### hash() -___ +> **hash**(): `Uint8Array` -### hash - -▸ **hash**(): `Uint8Array` +Defined in: [types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L215) #### Returns @@ -399,17 +370,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[hash](TransactionInterface.md#hash) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`hash`](TransactionInterface.md#hash) -[tx/src/types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L161) +*** -___ +### isSigned() -### isSigned +> **isSigned**(): `boolean` -▸ **isSigned**(): `boolean` +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L218) #### Returns @@ -417,17 +386,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[isSigned](TransactionInterface.md#issigned) +[`TransactionInterface`](TransactionInterface.md).[`isSigned`](TransactionInterface.md#issigned) -#### Defined in +*** -[tx/src/types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L164) +### isValid() -___ +> **isValid**(): `boolean` -### isValid - -▸ **isValid**(): `boolean` +Defined in: [types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L219) #### Returns @@ -435,35 +402,31 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[isValid](TransactionInterface.md#isvalid) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`isValid`](TransactionInterface.md#isvalid) -[tx/src/types.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L165) +*** -___ +### raw() -### raw +> **raw**(): [`TxValuesArray`](TxValuesArray.md)\[`T`\] -▸ **raw**(): [`TxValuesArray`](TxValuesArray.md)[`T`] +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L211) #### Returns -[`TxValuesArray`](TxValuesArray.md)[`T`] +[`TxValuesArray`](TxValuesArray.md)\[`T`\] #### Inherited from -[TransactionInterface](TransactionInterface.md).[raw](TransactionInterface.md#raw) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`raw`](TransactionInterface.md#raw) -[tx/src/types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L157) +*** -___ +### serialize() -### serialize +> **serialize**(): `Uint8Array` -▸ **serialize**(): `Uint8Array` +Defined in: [types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L212) #### Returns @@ -471,47 +434,47 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[serialize](TransactionInterface.md#serialize) +[`TransactionInterface`](TransactionInterface.md).[`serialize`](TransactionInterface.md#serialize) -#### Defined in +*** -[tx/src/types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L158) +### sign() -___ +> **sign**(`privateKey`, `extraEntropy?`): [`Transaction`](Transaction.md)\[`T`\] -### sign - -▸ **sign**(`privateKey`): [`Transaction`](Transaction.md)[`T`] +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L223) #### Parameters -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | +##### privateKey + +`Uint8Array` + +##### extraEntropy? + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns -[`Transaction`](Transaction.md)[`T`] +[`Transaction`](Transaction.md)\[`T`\] #### Inherited from -[TransactionInterface](TransactionInterface.md).[sign](TransactionInterface.md#sign) +[`TransactionInterface`](TransactionInterface.md).[`sign`](TransactionInterface.md#sign) -#### Defined in +*** -[tx/src/types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L169) +### supports() -___ +> **supports**(`capability`): `boolean` -### supports - -▸ **supports**(`capability`): `boolean` +Defined in: [types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L204) #### Parameters -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | +##### capability + +`number` #### Returns @@ -519,17 +482,15 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[supports](TransactionInterface.md#supports) +[`TransactionInterface`](TransactionInterface.md).[`supports`](TransactionInterface.md#supports) -#### Defined in +*** -[tx/src/types.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L151) +### toCreationAddress() -___ +> **toCreationAddress**(): `boolean` -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` +Defined in: [types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L210) #### Returns @@ -537,35 +498,31 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[toCreationAddress](TransactionInterface.md#tocreationaddress) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`toCreationAddress`](TransactionInterface.md#tocreationaddress) -[tx/src/types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L156) +*** -___ +### toJSON() -### toJSON +> **toJSON**(): [`JSONTx`](JSONTx.md) -▸ **toJSON**(): [`JsonTx`](JsonTx.md) +Defined in: [types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L224) #### Returns -[`JsonTx`](JsonTx.md) +[`JSONTx`](JSONTx.md) #### Inherited from -[TransactionInterface](TransactionInterface.md).[toJSON](TransactionInterface.md#tojson) - -#### Defined in +[`TransactionInterface`](TransactionInterface.md).[`toJSON`](TransactionInterface.md#tojson) -[tx/src/types.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L170) +*** -___ +### verifySignature() -### verifySignature +> **verifySignature**(): `boolean` -▸ **verifySignature**(): `boolean` +Defined in: [types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L220) #### Returns @@ -573,8 +530,4 @@ ___ #### Inherited from -[TransactionInterface](TransactionInterface.md).[verifySignature](TransactionInterface.md#verifysignature) - -#### Defined in - -[tx/src/types.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L166) +[`TransactionInterface`](TransactionInterface.md).[`verifySignature`](TransactionInterface.md#verifysignature) diff --git a/packages/tx/docs/interfaces/Transaction.md b/packages/tx/docs/interfaces/Transaction.md index 511db46217a..2623f91540b 100644 --- a/packages/tx/docs/interfaces/Transaction.md +++ b/packages/tx/docs/interfaces/Transaction.md @@ -1,52 +1,49 @@ -[@ethereumjs/tx](../README.md) / Transaction +[**@ethereumjs/tx**](../README.md) -# Interface: Transaction +*** -## Table of contents +[@ethereumjs/tx](../README.md) / Transaction -### Properties +# Interface: Transaction -- [0](Transaction.md#0) -- [1](Transaction.md#1) -- [2](Transaction.md#2) -- [3](Transaction.md#3) +Defined in: [types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L163) ## Properties ### 0 -• **0**: [`LegacyTransaction`](../classes/LegacyTransaction.md) - -#### Defined in +> **0**: [`LegacyTx`](../classes/LegacyTx.md) -[tx/src/types.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L116) +Defined in: [types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L164) -___ +*** ### 1 -• **1**: [`AccessListEIP2930Transaction`](../classes/AccessListEIP2930Transaction.md) +> **1**: [`AccessList2930Tx`](../classes/AccessList2930Tx.md) -#### Defined in +Defined in: [types.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L166) -[tx/src/types.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L118) - -___ +*** ### 2 -• **2**: [`FeeMarketEIP1559Transaction`](../classes/FeeMarketEIP1559Transaction.md) - -#### Defined in +> **2**: [`FeeMarket1559Tx`](../classes/FeeMarket1559Tx.md) -[tx/src/types.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L117) +Defined in: [types.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L165) -___ +*** ### 3 -• **3**: [`BlobEIP4844Transaction`](../classes/BlobEIP4844Transaction.md) +> **3**: [`Blob4844Tx`](../classes/Blob4844Tx.md) + +Defined in: [types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L167) + +*** + +### 4 -#### Defined in +> **4**: [`EOACode7702Tx`](../classes/EOACode7702Tx.md) -[tx/src/types.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L119) +Defined in: [types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L168) diff --git a/packages/tx/docs/interfaces/TransactionCache.md b/packages/tx/docs/interfaces/TransactionCache.md index e806707eb49..125fe0d9738 100644 --- a/packages/tx/docs/interfaces/TransactionCache.md +++ b/packages/tx/docs/interfaces/TransactionCache.md @@ -1,48 +1,41 @@ -[@ethereumjs/tx](../README.md) / TransactionCache +[**@ethereumjs/tx**](../README.md) -# Interface: TransactionCache +*** -## Table of contents +[@ethereumjs/tx](../README.md) / TransactionCache -### Properties +# Interface: TransactionCache -- [dataFee](TransactionCache.md#datafee) -- [hash](TransactionCache.md#hash) -- [senderPubKey](TransactionCache.md#senderpubkey) +Defined in: [types.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L140) ## Properties -### dataFee - -• `Optional` **dataFee**: `Object` +### dataFee? -#### Type declaration +> `optional` **dataFee**: `object` -| Name | Type | -| :------ | :------ | -| `hardfork` | `string` | -| `value` | `bigint` | +Defined in: [types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L142) -#### Defined in +#### hardfork -[tx/src/types.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L98) +> **hardfork**: `string` -___ +#### value -### hash +> **value**: `bigint` -• `Optional` **hash**: `Uint8Array` +*** -#### Defined in +### hash? -[tx/src/types.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L97) +> `optional` **hash**: `Uint8Array`\<`ArrayBufferLike`\> -___ +Defined in: [types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L141) -### senderPubKey +*** -• `Optional` **senderPubKey**: `Uint8Array` +### senderPubKey? -#### Defined in +> `optional` **senderPubKey**: `Uint8Array`\<`ArrayBufferLike`\> -[tx/src/types.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L102) +Defined in: [types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L146) diff --git a/packages/tx/docs/interfaces/TransactionInterface.md b/packages/tx/docs/interfaces/TransactionInterface.md index 2c81fa286eb..5d7f33ebc52 100644 --- a/packages/tx/docs/interfaces/TransactionInterface.md +++ b/packages/tx/docs/interfaces/TransactionInterface.md @@ -1,458 +1,402 @@ +[**@ethereumjs/tx**](../README.md) + +*** + [@ethereumjs/tx](../README.md) / TransactionInterface -# Interface: TransactionInterface - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TransactionType`](../enums/TransactionType.md) = [`TransactionType`](../enums/TransactionType.md) | - -## Hierarchy - -- **`TransactionInterface`** - - ↳ [`LegacyTxInterface`](LegacyTxInterface.md) - - ↳ [`EIP2718CompatibleTx`](EIP2718CompatibleTx.md) - -## Table of contents - -### Properties - -- [cache](TransactionInterface.md#cache) -- [common](TransactionInterface.md#common) -- [data](TransactionInterface.md#data) -- [gasLimit](TransactionInterface.md#gaslimit) -- [nonce](TransactionInterface.md#nonce) -- [r](TransactionInterface.md#r) -- [s](TransactionInterface.md#s) -- [to](TransactionInterface.md#to) -- [type](TransactionInterface.md#type) -- [v](TransactionInterface.md#v) -- [value](TransactionInterface.md#value) - -### Methods - -- [errorStr](TransactionInterface.md#errorstr) -- [getBaseFee](TransactionInterface.md#getbasefee) -- [getDataFee](TransactionInterface.md#getdatafee) -- [getHashedMessageToSign](TransactionInterface.md#gethashedmessagetosign) -- [getMessageToSign](TransactionInterface.md#getmessagetosign) -- [getMessageToVerifySignature](TransactionInterface.md#getmessagetoverifysignature) -- [getSenderAddress](TransactionInterface.md#getsenderaddress) -- [getSenderPublicKey](TransactionInterface.md#getsenderpublickey) -- [getUpfrontCost](TransactionInterface.md#getupfrontcost) -- [getValidationErrors](TransactionInterface.md#getvalidationerrors) -- [hash](TransactionInterface.md#hash) -- [isSigned](TransactionInterface.md#issigned) -- [isValid](TransactionInterface.md#isvalid) -- [raw](TransactionInterface.md#raw) -- [serialize](TransactionInterface.md#serialize) -- [sign](TransactionInterface.md#sign) -- [supports](TransactionInterface.md#supports) -- [toCreationAddress](TransactionInterface.md#tocreationaddress) -- [toJSON](TransactionInterface.md#tojson) -- [verifySignature](TransactionInterface.md#verifysignature) +# Interface: TransactionInterface\ + +Defined in: [types.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L193) + +## Extended by + +- [`LegacyTxInterface`](LegacyTxInterface.md) +- [`EIP2718CompatibleTx`](EIP2718CompatibleTx.md) + +## Type Parameters + +### T + +`T` *extends* [`TransactionType`](../type-aliases/TransactionType.md) = [`TransactionType`](../type-aliases/TransactionType.md) ## Properties ### cache -• `Readonly` **cache**: [`TransactionCache`](TransactionCache.md) +> `readonly` **cache**: [`TransactionCache`](TransactionCache.md) -#### Defined in +Defined in: [types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L203) -[tx/src/types.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L150) - -___ +*** ### common -• `Readonly` **common**: `Common` - -#### Defined in +> `readonly` **common**: `Common` -[tx/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L141) +Defined in: [types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L194) -___ +*** ### data -• `Readonly` **data**: `Uint8Array` +> `readonly` **data**: `Uint8Array` -#### Defined in +Defined in: [types.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L199) -[tx/src/types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L146) - -___ +*** ### gasLimit -• `Readonly` **gasLimit**: `bigint` - -#### Defined in +> `readonly` **gasLimit**: `bigint` -[tx/src/types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L143) +Defined in: [types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L196) -___ +*** ### nonce -• `Readonly` **nonce**: `bigint` +> `readonly` **nonce**: `bigint` -#### Defined in +Defined in: [types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L195) -[tx/src/types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L142) +*** -___ +### r? -### r +> `readonly` `optional` **r**: `bigint` -• `Optional` `Readonly` **r**: `bigint` +Defined in: [types.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L201) -#### Defined in +*** -[tx/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L148) +### s? -___ +> `readonly` `optional` **s**: `bigint` -### s +Defined in: [types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L202) -• `Optional` `Readonly` **s**: `bigint` +*** -#### Defined in +### to? -[tx/src/types.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L149) +> `readonly` `optional` **to**: `Address` -___ +Defined in: [types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L197) -### to +*** -• `Optional` `Readonly` **to**: `Address` +### txOptions -#### Defined in +> **txOptions**: [`TxOptions`](TxOptions.md) -[tx/src/types.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L144) +Defined in: [types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L206) -___ +*** ### type -• **type**: [`TransactionType`](../enums/TransactionType.md) +> **type**: [`TransactionType`](../type-aliases/TransactionType.md) -#### Defined in +Defined in: [types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L205) -[tx/src/types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L152) +*** -___ +### v? -### v +> `readonly` `optional` **v**: `bigint` -• `Optional` `Readonly` **v**: `bigint` +Defined in: [types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L200) -#### Defined in +*** -[tx/src/types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L147) +### value -___ +> `readonly` **value**: `bigint` -### value +Defined in: [types.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L198) -• `Readonly` **value**: `bigint` +## Methods -#### Defined in +### addSignature() -[tx/src/types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L145) +> **addSignature**(`v`, `r`, `s`, `convertV?`): [`Transaction`](Transaction.md)\[`T`\] -## Methods +Defined in: [types.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L227) -### errorStr +#### Parameters -▸ **errorStr**(): `string` +##### v -#### Returns +`bigint` -`string` +##### r -#### Defined in +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -[tx/src/types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L171) +##### s -___ +`bigint` | `Uint8Array`\<`ArrayBufferLike`\> -### getBaseFee +##### convertV? -▸ **getBaseFee**(): `bigint` +`boolean` #### Returns -`bigint` +[`Transaction`](Transaction.md)\[`T`\] -#### Defined in +*** -[tx/src/types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L153) +### errorStr() -___ +> **errorStr**(): `string` -### getDataFee +Defined in: [types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L225) -▸ **getDataFee**(): `bigint` +#### Returns + +`string` + +*** + +### getDataGas() + +> **getDataGas**(): `bigint` + +Defined in: [types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L208) #### Returns `bigint` -#### Defined in - -[tx/src/types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L154) +*** -___ +### getHashedMessageToSign() -### getHashedMessageToSign +> **getHashedMessageToSign**(): `Uint8Array` -▸ **getHashedMessageToSign**(): `Uint8Array` +Defined in: [types.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L214) #### Returns `Uint8Array` -#### Defined in +*** -[tx/src/types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L160) +### getIntrinsicGas() -___ +> **getIntrinsicGas**(): `bigint` -### getMessageToSign - -▸ **getMessageToSign**(): `Uint8Array` \| `Uint8Array`[] +Defined in: [types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L207) #### Returns -`Uint8Array` \| `Uint8Array`[] +`bigint` + +*** + +### getMessageToSign() + +> **getMessageToSign**(): `Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [types.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L213) + +#### Returns -#### Defined in +`Uint8Array`\<`ArrayBufferLike`\> \| `Uint8Array`\<`ArrayBufferLike`\>[] -[tx/src/types.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L159) +*** -___ +### getMessageToVerifySignature() -### getMessageToVerifySignature +> **getMessageToVerifySignature**(): `Uint8Array` -▸ **getMessageToVerifySignature**(): `Uint8Array` +Defined in: [types.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L216) #### Returns `Uint8Array` -#### Defined in +*** -[tx/src/types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L162) +### getSenderAddress() -___ +> **getSenderAddress**(): `Address` -### getSenderAddress - -▸ **getSenderAddress**(): `Address` +Defined in: [types.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L221) #### Returns `Address` -#### Defined in - -[tx/src/types.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L167) +*** -___ +### getSenderPublicKey() -### getSenderPublicKey +> **getSenderPublicKey**(): `Uint8Array` -▸ **getSenderPublicKey**(): `Uint8Array` +Defined in: [types.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L222) #### Returns `Uint8Array` -#### Defined in +*** -[tx/src/types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L168) +### getUpfrontCost() -___ +> **getUpfrontCost**(): `bigint` -### getUpfrontCost - -▸ **getUpfrontCost**(): `bigint` +Defined in: [types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L209) #### Returns `bigint` -#### Defined in - -[tx/src/types.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L155) +*** -___ +### getValidationErrors() -### getValidationErrors +> **getValidationErrors**(): `string`[] -▸ **getValidationErrors**(): `string`[] +Defined in: [types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L217) #### Returns `string`[] -#### Defined in +*** -[tx/src/types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L163) +### hash() -___ +> **hash**(): `Uint8Array` -### hash - -▸ **hash**(): `Uint8Array` +Defined in: [types.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L215) #### Returns `Uint8Array` -#### Defined in - -[tx/src/types.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L161) +*** -___ +### isSigned() -### isSigned +> **isSigned**(): `boolean` -▸ **isSigned**(): `boolean` +Defined in: [types.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L218) #### Returns `boolean` -#### Defined in - -[tx/src/types.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L164) +*** -___ +### isValid() -### isValid +> **isValid**(): `boolean` -▸ **isValid**(): `boolean` +Defined in: [types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L219) #### Returns `boolean` -#### Defined in +*** -[tx/src/types.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L165) +### raw() -___ +> **raw**(): [`TxValuesArray`](TxValuesArray.md)\[`T`\] -### raw - -▸ **raw**(): [`TxValuesArray`](TxValuesArray.md)[`T`] +Defined in: [types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L211) #### Returns -[`TxValuesArray`](TxValuesArray.md)[`T`] - -#### Defined in +[`TxValuesArray`](TxValuesArray.md)\[`T`\] -[tx/src/types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L157) +*** -___ +### serialize() -### serialize +> **serialize**(): `Uint8Array` -▸ **serialize**(): `Uint8Array` +Defined in: [types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L212) #### Returns `Uint8Array` -#### Defined in +*** -[tx/src/types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L158) +### sign() -___ +> **sign**(`privateKey`, `extraEntropy?`): [`Transaction`](Transaction.md)\[`T`\] -### sign - -▸ **sign**(`privateKey`): [`Transaction`](Transaction.md)[`T`] +Defined in: [types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L223) #### Parameters -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | +##### privateKey -#### Returns +`Uint8Array` + +##### extraEntropy? + +`boolean` | `Uint8Array`\<`ArrayBufferLike`\> -[`Transaction`](Transaction.md)[`T`] +#### Returns -#### Defined in +[`Transaction`](Transaction.md)\[`T`\] -[tx/src/types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L169) +*** -___ +### supports() -### supports +> **supports**(`capability`): `boolean` -▸ **supports**(`capability`): `boolean` +Defined in: [types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L204) #### Parameters -| Name | Type | -| :------ | :------ | -| `capability` | [`Capability`](../enums/Capability.md) | +##### capability + +`number` #### Returns `boolean` -#### Defined in +*** -[tx/src/types.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L151) +### toCreationAddress() -___ +> **toCreationAddress**(): `boolean` -### toCreationAddress - -▸ **toCreationAddress**(): `boolean` +Defined in: [types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L210) #### Returns `boolean` -#### Defined in - -[tx/src/types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L156) +*** -___ +### toJSON() -### toJSON +> **toJSON**(): [`JSONTx`](JSONTx.md) -▸ **toJSON**(): [`JsonTx`](JsonTx.md) +Defined in: [types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L224) #### Returns -[`JsonTx`](JsonTx.md) +[`JSONTx`](JSONTx.md) -#### Defined in +*** -[tx/src/types.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L170) +### verifySignature() -___ +> **verifySignature**(): `boolean` -### verifySignature - -▸ **verifySignature**(): `boolean` +Defined in: [types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L220) #### Returns `boolean` - -#### Defined in - -[tx/src/types.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L166) diff --git a/packages/tx/docs/interfaces/TxData.md b/packages/tx/docs/interfaces/TxData.md index 1257ff0e034..961e5520a63 100644 --- a/packages/tx/docs/interfaces/TxData.md +++ b/packages/tx/docs/interfaces/TxData.md @@ -1,52 +1,49 @@ -[@ethereumjs/tx](../README.md) / TxData +[**@ethereumjs/tx**](../README.md) -# Interface: TxData +*** -## Table of contents +[@ethereumjs/tx](../README.md) / TxData -### Properties +# Interface: TxData -- [0](TxData.md#0) -- [1](TxData.md#1) -- [2](TxData.md#2) -- [3](TxData.md#3) +Defined in: [types.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L272) ## Properties ### 0 -• **0**: [`LegacyTxData`](../README.md#legacytxdata) - -#### Defined in +> **0**: [`LegacyTxData`](../type-aliases/LegacyTxData.md) -[tx/src/types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L207) +Defined in: [types.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L273) -___ +*** ### 1 -• **1**: [`AccessListEIP2930TxData`](AccessListEIP2930TxData.md) +> **1**: [`AccessList2930TxData`](AccessList2930TxData.md) -#### Defined in +Defined in: [types.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L274) -[tx/src/types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L208) - -___ +*** ### 2 -• **2**: [`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md) - -#### Defined in +> **2**: [`FeeMarketEIP1559TxData`](FeeMarketEIP1559TxData.md) -[tx/src/types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L209) +Defined in: [types.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L275) -___ +*** ### 3 -• **3**: [`BlobEIP4844TxData`](BlobEIP4844TxData.md) +> **3**: [`BlobEIP4844TxData`](BlobEIP4844TxData.md) + +Defined in: [types.ts:276](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L276) + +*** + +### 4 -#### Defined in +> **4**: [`EOACode7702TxData`](EOACode7702TxData.md) -[tx/src/types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L210) +Defined in: [types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L277) diff --git a/packages/tx/docs/interfaces/TxOptions.md b/packages/tx/docs/interfaces/TxOptions.md index 867ea5beaaf..1bc2a0c1788 100644 --- a/packages/tx/docs/interfaces/TxOptions.md +++ b/packages/tx/docs/interfaces/TxOptions.md @@ -1,35 +1,33 @@ -[@ethereumjs/tx](../README.md) / TxOptions +[**@ethereumjs/tx**](../README.md) -# Interface: TxOptions +*** -The options for initializing a [Transaction](Transaction.md). +[@ethereumjs/tx](../README.md) / TxOptions -## Table of contents +# Interface: TxOptions -### Properties +Defined in: [types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L57) -- [allowUnlimitedInitCodeSize](TxOptions.md#allowunlimitedinitcodesize) -- [common](TxOptions.md#common) -- [freeze](TxOptions.md#freeze) +The options for initializing a [Transaction](Transaction.md). ## Properties -### allowUnlimitedInitCodeSize +### allowUnlimitedInitCodeSize? -• `Optional` **allowUnlimitedInitCodeSize**: `boolean` +> `optional` **allowUnlimitedInitCodeSize**: `boolean` + +Defined in: [types.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L103) Allows unlimited contract code-size init while debugging. This (partially) disables EIP-3860. Gas cost for initcode size analysis will still be charged. Use with caution. -#### Defined in - -[tx/src/types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L78) +*** -___ +### common? -### common +> `optional` **common**: `Common` -• `Optional` **common**: `Common` +Defined in: [types.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L68) A Common object defining the chain and hardfork for the transaction. @@ -40,15 +38,13 @@ Default: Common object set to `mainnet` and the default hardfork as defined in t Current default hardfork: `istanbul` -#### Defined in +*** -[tx/src/types.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L60) +### freeze? -___ +> `optional` **freeze**: `boolean` -### freeze - -• `Optional` **freeze**: `boolean` +Defined in: [types.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L97) A transaction object by default gets frozen along initialization. This gives you strong additional security guarantees on the consistency of the tx parameters. @@ -60,6 +56,25 @@ within your code instead. Default: true -#### Defined in +*** + +### params? + +> `optional` **params**: `ParamsDict` + +Defined in: [types.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L85) + +Tx parameters sorted by EIP can be found in the exported `paramsTx` dictionary, +which is internally passed to the associated `@ethereumjs/common` instance which +manages parameter selection based on the hardfork and EIP settings. + +This option allows providing a custom set of parameters. Note that parameters +get fully overwritten, so you need to extend the default parameter dict +to provide the full parameter set. + +It is recommended to deep-clone the params object for this to avoid side effects: -[tx/src/types.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L72) +```ts +const params = JSON.parse(JSON.stringify(paramsTx)) +params['1']['txGas'] = 30000 // 21000 +``` diff --git a/packages/tx/docs/interfaces/TxValuesArray.md b/packages/tx/docs/interfaces/TxValuesArray.md index 03a201642b3..6877c982d53 100644 --- a/packages/tx/docs/interfaces/TxValuesArray.md +++ b/packages/tx/docs/interfaces/TxValuesArray.md @@ -1,52 +1,49 @@ -[@ethereumjs/tx](../README.md) / TxValuesArray +[**@ethereumjs/tx**](../README.md) -# Interface: TxValuesArray +*** -## Table of contents +[@ethereumjs/tx](../README.md) / TxValuesArray -### Properties +# Interface: TxValuesArray -- [0](TxValuesArray.md#0) -- [1](TxValuesArray.md#1) -- [2](TxValuesArray.md#2) -- [3](TxValuesArray.md#3) +Defined in: [types.ts:434](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L434) ## Properties ### 0 -• **0**: `LegacyTxValuesArray` - -#### Defined in +> **0**: `LegacyTxValuesArray` -[tx/src/types.ts:356](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L356) +Defined in: [types.ts:435](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L435) -___ +*** ### 1 -• **1**: `AccessListEIP2930TxValuesArray` +> **1**: `AccessList2930TxValuesArray` -#### Defined in +Defined in: [types.ts:436](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L436) -[tx/src/types.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L357) - -___ +*** ### 2 -• **2**: `FeeMarketEIP1559TxValuesArray` - -#### Defined in +> **2**: `FeeMarketEIP1559TxValuesArray` -[tx/src/types.ts:358](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L358) +Defined in: [types.ts:437](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L437) -___ +*** ### 3 -• **3**: `BlobEIP4844TxValuesArray` +> **3**: `BlobEIP4844TxValuesArray` + +Defined in: [types.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L438) + +*** + +### 4 -#### Defined in +> **4**: `EOACode7702TxValuesArray` -[tx/src/types.ts:359](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L359) +Defined in: [types.ts:439](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L439) diff --git a/packages/tx/docs/type-aliases/AccessList.md b/packages/tx/docs/type-aliases/AccessList.md new file mode 100644 index 00000000000..71e463c8000 --- /dev/null +++ b/packages/tx/docs/type-aliases/AccessList.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AccessList + +# Type Alias: AccessList + +> **AccessList** = [`AccessListItem`](AccessListItem.md)[] + +Defined in: [types.ts:607](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L607) diff --git a/packages/tx/docs/type-aliases/AccessListBytes.md b/packages/tx/docs/type-aliases/AccessListBytes.md new file mode 100644 index 00000000000..2cafe34c20d --- /dev/null +++ b/packages/tx/docs/type-aliases/AccessListBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AccessListBytes + +# Type Alias: AccessListBytes + +> **AccessListBytes** = [`AccessListBytesItem`](AccessListBytesItem.md)[] + +Defined in: [types.ts:606](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L606) diff --git a/packages/tx/docs/type-aliases/AccessListBytesItem.md b/packages/tx/docs/type-aliases/AccessListBytesItem.md new file mode 100644 index 00000000000..1fc4543cffe --- /dev/null +++ b/packages/tx/docs/type-aliases/AccessListBytesItem.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AccessListBytesItem + +# Type Alias: AccessListBytesItem + +> **AccessListBytesItem** = \[`Uint8Array`, `Uint8Array`[]\] + +Defined in: [types.ts:605](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L605) diff --git a/packages/tx/docs/type-aliases/AccessListItem.md b/packages/tx/docs/type-aliases/AccessListItem.md new file mode 100644 index 00000000000..f1fbe81eed3 --- /dev/null +++ b/packages/tx/docs/type-aliases/AccessListItem.md @@ -0,0 +1,27 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AccessListItem + +# Type Alias: AccessListItem + +> **AccessListItem** = `object` + +Defined in: [types.ts:597](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L597) + +## Properties + +### address + +> **address**: `PrefixedHexString` + +Defined in: [types.ts:598](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L598) + +*** + +### storageKeys + +> **storageKeys**: `PrefixedHexString`[] + +Defined in: [types.ts:599](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L599) diff --git a/packages/tx/docs/type-aliases/AuthorizationList.md b/packages/tx/docs/type-aliases/AuthorizationList.md new file mode 100644 index 00000000000..908d7779930 --- /dev/null +++ b/packages/tx/docs/type-aliases/AuthorizationList.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AuthorizationList + +# Type Alias: AuthorizationList + +> **AuthorizationList** = [`AuthorizationListItem`](AuthorizationListItem.md)[] + +Defined in: [types.ts:634](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L634) diff --git a/packages/tx/docs/type-aliases/AuthorizationListBytes.md b/packages/tx/docs/type-aliases/AuthorizationListBytes.md new file mode 100644 index 00000000000..40207da768b --- /dev/null +++ b/packages/tx/docs/type-aliases/AuthorizationListBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AuthorizationListBytes + +# Type Alias: AuthorizationListBytes + +> **AuthorizationListBytes** = [`AuthorizationListBytesItem`](AuthorizationListBytesItem.md)[] + +Defined in: [types.ts:633](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L633) diff --git a/packages/tx/docs/type-aliases/AuthorizationListBytesItem.md b/packages/tx/docs/type-aliases/AuthorizationListBytesItem.md new file mode 100644 index 00000000000..187cc2a22f6 --- /dev/null +++ b/packages/tx/docs/type-aliases/AuthorizationListBytesItem.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AuthorizationListBytesItem + +# Type Alias: AuthorizationListBytesItem + +> **AuthorizationListBytesItem** = \[`Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`\] + +Defined in: [types.ts:625](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L625) diff --git a/packages/tx/docs/type-aliases/AuthorizationListBytesItemUnsigned.md b/packages/tx/docs/type-aliases/AuthorizationListBytesItemUnsigned.md new file mode 100644 index 00000000000..946b69437b5 --- /dev/null +++ b/packages/tx/docs/type-aliases/AuthorizationListBytesItemUnsigned.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AuthorizationListBytesItemUnsigned + +# Type Alias: AuthorizationListBytesItemUnsigned + +> **AuthorizationListBytesItemUnsigned** = \[`Uint8Array`, `Uint8Array`, `Uint8Array`\] + +Defined in: [types.ts:636](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L636) diff --git a/packages/tx/docs/type-aliases/AuthorizationListItem.md b/packages/tx/docs/type-aliases/AuthorizationListItem.md new file mode 100644 index 00000000000..d3d2d9f0c54 --- /dev/null +++ b/packages/tx/docs/type-aliases/AuthorizationListItem.md @@ -0,0 +1,25 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AuthorizationListItem + +# Type Alias: AuthorizationListItem + +> **AuthorizationListItem** = `object` & [`AuthorizationListItemUnsigned`](AuthorizationListItemUnsigned.md) + +Defined in: [types.ts:618](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L618) + +## Type declaration + +### r + +> **r**: `PrefixedHexString` + +### s + +> **s**: `PrefixedHexString` + +### yParity + +> **yParity**: `PrefixedHexString` diff --git a/packages/tx/docs/type-aliases/AuthorizationListItemUnsigned.md b/packages/tx/docs/type-aliases/AuthorizationListItemUnsigned.md new file mode 100644 index 00000000000..0ffb587053c --- /dev/null +++ b/packages/tx/docs/type-aliases/AuthorizationListItemUnsigned.md @@ -0,0 +1,37 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / AuthorizationListItemUnsigned + +# Type Alias: AuthorizationListItemUnsigned + +> **AuthorizationListItemUnsigned** = `object` + +Defined in: [types.ts:612](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L612) + +Authorization list types + +## Properties + +### address + +> **address**: `PrefixedHexString` + +Defined in: [types.ts:614](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L614) + +*** + +### chainId + +> **chainId**: `PrefixedHexString` + +Defined in: [types.ts:613](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L613) + +*** + +### nonce + +> **nonce**: `PrefixedHexString` + +Defined in: [types.ts:615](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L615) diff --git a/packages/tx/docs/type-aliases/BlobEIP4844NetworkValuesArray.md b/packages/tx/docs/type-aliases/BlobEIP4844NetworkValuesArray.md new file mode 100644 index 00000000000..dac1006a926 --- /dev/null +++ b/packages/tx/docs/type-aliases/BlobEIP4844NetworkValuesArray.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / BlobEIP4844NetworkValuesArray + +# Type Alias: BlobEIP4844NetworkValuesArray + +> **BlobEIP4844NetworkValuesArray** = \[`BlobEIP4844TxValuesArray`, `Uint8Array`[], `Uint8Array`[], `Uint8Array`[]\] + +Defined in: [types.ts:521](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L521) diff --git a/packages/tx/docs/type-aliases/Capability.md b/packages/tx/docs/type-aliases/Capability.md new file mode 100644 index 00000000000..17a98b66f4c --- /dev/null +++ b/packages/tx/docs/type-aliases/Capability.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / Capability + +# Type Alias: Capability + +> **Capability** = *typeof* [`Capability`](../variables/Capability.md)\[keyof *typeof* [`Capability`](../variables/Capability.md)\] + +Defined in: [types.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L16) diff --git a/packages/tx/docs/type-aliases/JSONBlobTxNetworkWrapper.md b/packages/tx/docs/type-aliases/JSONBlobTxNetworkWrapper.md new file mode 100644 index 00000000000..e758a89b556 --- /dev/null +++ b/packages/tx/docs/type-aliases/JSONBlobTxNetworkWrapper.md @@ -0,0 +1,25 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / JSONBlobTxNetworkWrapper + +# Type Alias: JSONBlobTxNetworkWrapper + +> **JSONBlobTxNetworkWrapper** = [`JSONTx`](../interfaces/JSONTx.md) & `object` + +Defined in: [types.ts:559](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L559) + +## Type declaration + +### blobs + +> **blobs**: `PrefixedHexString`[] + +### kzgCommitments + +> **kzgCommitments**: `PrefixedHexString`[] + +### kzgProofs + +> **kzgProofs**: `PrefixedHexString`[] diff --git a/packages/tx/docs/type-aliases/LegacyTxData.md b/packages/tx/docs/type-aliases/LegacyTxData.md new file mode 100644 index 00000000000..c674282bc6e --- /dev/null +++ b/packages/tx/docs/type-aliases/LegacyTxData.md @@ -0,0 +1,117 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / LegacyTxData + +# Type Alias: LegacyTxData + +> **LegacyTxData** = `object` + +Defined in: [types.ts:310](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L310) + +Legacy [Transaction](../interfaces/Transaction.md) Data + +## Extended by + +- [`AccessList2930TxData`](../interfaces/AccessList2930TxData.md) + +## Properties + +### data? + +> `optional` **data**: `BytesLike` \| `""` + +Defined in: [types.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L339) + +This will contain the data of the message or the init of a contract. + +*** + +### gasLimit? + +> `optional` **gasLimit**: `BigIntLike` + +Defined in: [types.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L324) + +The transaction's gas limit. + +*** + +### gasPrice? + +> `optional` **gasPrice**: `BigIntLike` \| `null` + +Defined in: [types.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L319) + +The transaction's gas price. + +*** + +### nonce? + +> `optional` **nonce**: `BigIntLike` + +Defined in: [types.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L314) + +The transaction's nonce. + +*** + +### r? + +> `optional` **r**: `BigIntLike` + +Defined in: [types.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L349) + +EC signature parameter. + +*** + +### s? + +> `optional` **s**: `BigIntLike` + +Defined in: [types.ts:354](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L354) + +EC signature parameter. + +*** + +### to? + +> `optional` **to**: `AddressLike` \| `""` + +Defined in: [types.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L329) + +The transaction's the address is sent to. + +*** + +### type? + +> `optional` **type**: `BigIntLike` + +Defined in: [types.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L360) + +The transaction type + +*** + +### v? + +> `optional` **v**: `BigIntLike` + +Defined in: [types.ts:344](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L344) + +EC recovery ID. + +*** + +### value? + +> `optional` **value**: `BigIntLike` + +Defined in: [types.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L334) + +The amount of Ether sent. diff --git a/packages/tx/docs/type-aliases/TransactionType.md b/packages/tx/docs/type-aliases/TransactionType.md new file mode 100644 index 00000000000..1418cd56dd6 --- /dev/null +++ b/packages/tx/docs/type-aliases/TransactionType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / TransactionType + +# Type Alias: TransactionType + +> **TransactionType** = *typeof* [`TransactionType`](../variables/TransactionType.md)\[keyof *typeof* [`TransactionType`](../variables/TransactionType.md)\] + +Defined in: [types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L153) diff --git a/packages/tx/docs/type-aliases/TypedTransaction.md b/packages/tx/docs/type-aliases/TypedTransaction.md new file mode 100644 index 00000000000..424b2772637 --- /dev/null +++ b/packages/tx/docs/type-aliases/TypedTransaction.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / TypedTransaction + +# Type Alias: TypedTransaction + +> **TypedTransaction** = [`Transaction`](../interfaces/Transaction.md)\[[`TransactionType`](TransactionType.md)\] + +Defined in: [types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L171) diff --git a/packages/tx/docs/type-aliases/TypedTxData.md b/packages/tx/docs/type-aliases/TypedTxData.md new file mode 100644 index 00000000000..f118ac0c638 --- /dev/null +++ b/packages/tx/docs/type-aliases/TypedTxData.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / TypedTxData + +# Type Alias: TypedTxData + +> **TypedTxData** = [`TxData`](../interfaces/TxData.md)\[[`TransactionType`](TransactionType.md)\] + +Defined in: [types.ts:280](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L280) diff --git a/packages/tx/docs/variables/Capability.md b/packages/tx/docs/variables/Capability.md new file mode 100644 index 00000000000..a5c3d2071ec --- /dev/null +++ b/packages/tx/docs/variables/Capability.md @@ -0,0 +1,51 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / Capability + +# Variable: Capability + +> **Capability**: `object` + +Defined in: [types.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L16) + +Can be used in conjunction with [\[TransactionType\].supports](../interfaces/Transaction.md) +to query on tx capabilities + +## Type declaration + +### EIP1559FeeMarket + +> **EIP1559FeeMarket**: `number` = `1559` + +Tx supports EIP-1559 gas fee market mechanism +See: [1559](https://eips.ethereum.org/EIPS/eip-1559) Fee Market EIP + +### EIP155ReplayProtection + +> **EIP155ReplayProtection**: `number` = `155` + +Tx supports EIP-155 replay protection +See: [155](https://eips.ethereum.org/EIPS/eip-155) Replay Attack Protection EIP + +### EIP2718TypedTransaction + +> **EIP2718TypedTransaction**: `number` = `2718` + +Tx is a typed transaction as defined in EIP-2718 +See: [2718](https://eips.ethereum.org/EIPS/eip-2718) Transaction Type EIP + +### EIP2930AccessLists + +> **EIP2930AccessLists**: `number` = `2930` + +Tx supports access list generation as defined in EIP-2930 +See: [2930](https://eips.ethereum.org/EIPS/eip-2930) Access Lists EIP + +### EIP7702EOACode + +> **EIP7702EOACode**: `number` = `7702` + +Tx supports setting EOA code +See [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) diff --git a/packages/tx/docs/variables/TransactionType.md b/packages/tx/docs/variables/TransactionType.md new file mode 100644 index 00000000000..1d9945c6e8b --- /dev/null +++ b/packages/tx/docs/variables/TransactionType.md @@ -0,0 +1,33 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / TransactionType + +# Variable: TransactionType + +> **TransactionType**: `object` + +Defined in: [types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L153) + +## Type declaration + +### AccessListEIP2930 + +> `readonly` **AccessListEIP2930**: `1` = `1` + +### BlobEIP4844 + +> `readonly` **BlobEIP4844**: `3` = `3` + +### EOACodeEIP7702 + +> `readonly` **EOACodeEIP7702**: `4` = `4` + +### FeeMarketEIP1559 + +> `readonly` **FeeMarketEIP1559**: `2` = `2` + +### Legacy + +> `readonly` **Legacy**: `0` = `0` diff --git a/packages/tx/docs/variables/paramsTx.md b/packages/tx/docs/variables/paramsTx.md new file mode 100644 index 00000000000..d9d2aeeeb22 --- /dev/null +++ b/packages/tx/docs/variables/paramsTx.md @@ -0,0 +1,11 @@ +[**@ethereumjs/tx**](../README.md) + +*** + +[@ethereumjs/tx](../README.md) / paramsTx + +# Variable: paramsTx + +> `const` **paramsTx**: `ParamsDict` + +Defined in: [params.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/params.ts#L3) diff --git a/packages/tx/examples/custom-chain-id-tx.ts b/packages/tx/examples/custom-chain-id-tx.ts index 50a65adabbb..74ec92197b1 100644 --- a/packages/tx/examples/custom-chain-id-tx.ts +++ b/packages/tx/examples/custom-chain-id-tx.ts @@ -1,8 +1,8 @@ import { Hardfork, Mainnet, createCustomCommon } from '@ethereumjs/common' import { createLegacyTxFromRLP } from '@ethereumjs/tx' -import { toBytes } from '@ethereumjs/util' +import { hexToBytes, toBytes } from '@ethereumjs/util' -const txData = toBytes( +const txData = hexToBytes( '0xf9010b82930284d09dc30083419ce0942d18de92e0f9aee1a29770c3b15c6cf8ac5498e580b8a42f43f4fb0000000000000000000000000000000000000000000000000000016b78998da900000000000000000000000000000000000000000000000000000000000cb1b70000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000001363e4f00000000000000000000000000000000000000000000000000000000000186a029a0fac36e66d329af0e831b2e61179b3ec8d7c7a8a2179e303cfed3364aff2bc3e4a07cb73d56e561ccbd838818dd3dea5fa0b5158577ffc61c0e6ec1f0ed55716891', ) diff --git a/packages/tx/examples/setEOATx.ts b/packages/tx/examples/setEOATx.ts index 636c6297582..4d277f9ff05 100644 --- a/packages/tx/examples/setEOATx.ts +++ b/packages/tx/examples/setEOATx.ts @@ -9,33 +9,38 @@ // It will self-delegate. Note that in a 7702-tx, you are free to include any authorization item. // If the authorization item is valid (it has the correct nonce, and matches the chainId (or the chainId is 0)) // then it will delegate the code of the account **who signed that authorization item** to the address in that authority item +import { createEOACode7702Tx } from '@ethereumjs/tx' +import type { EOACode7702AuthorizationListItemUnsigned } from '@ethereumjs/util' import { - authorizationListBytesItemToJSON, - createEOACode7702Tx, - signAuthorization, -} from '@ethereumjs/tx' -import { Address, privateToAddress } from '@ethereumjs/util' + Address, + eoaCode7702AuthorizationListBytesItemToJSON, + eoaCode7702SignAuthorization, + privateToAddress, +} from '@ethereumjs/util' const privateKey = new Uint8Array(32).fill(0x20) const privateKeyOther = new Uint8Array(32).fill(0x99) const myAddress = new Address(privateToAddress(privateKey)) -const unsignedAuthorizationListItemSelf = { +const unsignedAuthorizationListItemSelf: EOACode7702AuthorizationListItemUnsigned = { chainId: '0x1337', // This delegation will only work on the chain with chainId 0x1337 address: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', nonce: '0x01', // Since we are self-delegating we need account for the nonce being bumped of the account } -const signedSelf = signAuthorization(unsignedAuthorizationListItemSelf, privateKey) -// To convert the bytes array to a human-readable form, use `authorizationListBytesItemToJSON` -console.log(authorizationListBytesItemToJSON(signedSelf)) +const signedSelf = eoaCode7702SignAuthorization(unsignedAuthorizationListItemSelf, privateKey) +// To convert the bytes array to a human-readable form, use `eoaCode7702AuthorizationListBytesItemToJSON` +console.log(eoaCode7702AuthorizationListBytesItemToJSON(signedSelf)) -const unsignedAuthorizationListItemOther = { +const unsignedAuthorizationListItemOther: EOACode7702AuthorizationListItemUnsigned = { chainId: '0x', // The chainId 0 is special: this authorization will work on any chain which supports EIP-7702 address: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', nonce: '0x', } -const signedOther = signAuthorization(unsignedAuthorizationListItemOther, privateKeyOther) +const signedOther = eoaCode7702SignAuthorization( + unsignedAuthorizationListItemOther, + privateKeyOther, +) const authorizationList = [signedSelf, signedOther] diff --git a/packages/tx/package.json b/packages/tx/package.json index 9c4cff38730..769c1ac1cff 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -41,7 +41,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- tx", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", @@ -60,7 +60,7 @@ "@ethereumjs/common": "^10.0.0-rc.1", "@ethereumjs/rlp": "^10.0.0-rc.1", "@ethereumjs/util": "^10.0.0-rc.1", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@ethereumjs/testdata": "1.0.0", diff --git a/packages/tx/src/7702/tx.ts b/packages/tx/src/7702/tx.ts index e7e01e3057a..270b8de8088 100644 --- a/packages/tx/src/7702/tx.ts +++ b/packages/tx/src/7702/tx.ts @@ -5,15 +5,19 @@ import { bigIntToHex, bigIntToUnpaddedBytes, bytesToBigInt, + eoaCode7702AuthorizationListBytesItemToJSON, + eoaCode7702AuthorizationListJSONItemToBytes, + isEOACode7702AuthorizationList, toBytes, } from '@ethereumjs/util' +import type { Address, EOACode7702AuthorizationListBytes } from '@ethereumjs/util' import * as EIP1559 from '../capabilities/eip1559.ts' import * as EIP2718 from '../capabilities/eip2718.ts' import * as EIP2930 from '../capabilities/eip2930.ts' import * as EIP7702 from '../capabilities/eip7702.ts' import * as Legacy from '../capabilities/legacy.ts' -import { TransactionType, isAccessList, isAuthorizationList } from '../types.ts' +import { TransactionType, isAccessList } from '../types.ts' import { getBaseJSON, sharedConstructor, @@ -24,12 +28,11 @@ import { import { createEOACode7702Tx } from './constructors.ts' import type { Common } from '@ethereumjs/common' -import type { Address } from '@ethereumjs/util' + import type { AccessListBytes, TxData as AllTypesTxData, TxValuesArray as AllTypesTxValuesArray, - AuthorizationListBytes, Capability, JSONTx, TransactionCache, @@ -37,10 +40,6 @@ import type { TxOptions, } from '../types.ts' import { accessListBytesToJSON, accessListJSONToBytes } from '../util/access.ts' -import { - authorizationListBytesItemToJSON, - authorizationListJSONItemToBytes, -} from '../util/authorization.ts' export type TxData = AllTypesTxData[typeof TransactionType.EOACodeEIP7702] export type TxValuesArray = AllTypesTxValuesArray[typeof TransactionType.EOACodeEIP7702] @@ -61,7 +60,7 @@ export class EOACode7702Tx implements TransactionInterface authorizationListJSONItemToBytes(item)) + this.authorizationList = isEOACode7702AuthorizationList(authorizationList) + ? authorizationList.map((item) => eoaCode7702AuthorizationListJSONItemToBytes(item)) : authorizationList // Verify the authority list format. EIP7702.verifyAuthorizationList(this) @@ -359,7 +358,7 @@ export class EOACode7702Tx implements TransactionInterface - authorizationListBytesItemToJSON(item), + eoaCode7702AuthorizationListBytesItemToJSON(item), ) const baseJSON = getBaseJSON(this) diff --git a/packages/tx/src/constants.ts b/packages/tx/src/constants.ts index 3a0568762e4..b6762a28632 100644 --- a/packages/tx/src/constants.ts +++ b/packages/tx/src/constants.ts @@ -1,14 +1,8 @@ /** EIP-4844 constants */ -import { hexToBytes } from '@ethereumjs/util' - export const MAX_CALLDATA_SIZE = 16777216 // 2 ** 24 export const MAX_ACCESS_LIST_SIZE = 16777216 // 2 ** 24 export const MAX_VERSIONED_HASHES_LIST_SIZE = 16777216 // 2 ** 24 export const MAX_TX_WRAP_KZG_COMMITMENTS = 16777216 // 2 ** 24 export const FIELD_ELEMENTS_PER_BLOB = 4096 // This is also in the Common 4844 parameters but needed here since types can't access Common params export const BYTES_PER_FIELD_ELEMENT = 32 - -/** EIP-7702 constants */ - -export const AUTHORITY_SIGNING_MAGIC = hexToBytes('0x05') diff --git a/packages/tx/src/legacy/tx.ts b/packages/tx/src/legacy/tx.ts index 02a8ad26c99..7d90b8bab68 100644 --- a/packages/tx/src/legacy/tx.ts +++ b/packages/tx/src/legacy/tx.ts @@ -6,6 +6,7 @@ import { bigIntToHex, bigIntToUnpaddedBytes, bytesToBigInt, + intToBytes, toBytes, unpadBytes, } from '@ethereumjs/util' @@ -256,8 +257,8 @@ export class LegacyTx implements TransactionInterface extends EIP1559CompatibleTx { // ChainID, Address, [nonce], y_parity, r, s - readonly authorizationList: AuthorizationListBytes + readonly authorizationList: EOACode7702AuthorizationListBytes } export interface TxData { @@ -428,7 +411,7 @@ export interface BlobEIP4844TxData extends FeeMarketEIP1559TxData { * {@link EOACode7702Tx} data. */ export interface EOACode7702TxData extends FeeMarketEIP1559TxData { - authorizationList?: AuthorizationListBytes | AuthorizationList | never + authorizationList?: EOACode7702AuthorizationListBytes | EOACode7702AuthorizationList | never } export interface TxValuesArray { @@ -492,7 +475,7 @@ type EOACode7702TxValuesArray = [ Uint8Array, Uint8Array, AccessListBytes, - AuthorizationListBytes, + EOACode7702AuthorizationListBytes, Uint8Array?, Uint8Array?, Uint8Array?, @@ -547,7 +530,7 @@ export interface JSONTx { value?: PrefixedHexString chainId?: PrefixedHexString accessList?: JSONAccessListItem[] // TODO should this not be AccessList? - authorizationList?: AuthorizationList + authorizationList?: EOACode7702AuthorizationList type?: PrefixedHexString maxPriorityFeePerGas?: PrefixedHexString maxFeePerGas?: PrefixedHexString @@ -605,34 +588,3 @@ export type AccessListItem = { export type AccessListBytesItem = [Uint8Array, Uint8Array[]] export type AccessListBytes = AccessListBytesItem[] export type AccessList = AccessListItem[] - -/** - * Authorization list types - */ -export type AuthorizationListItemUnsigned = { - // Note: these are `PrefixedHexString`s - chainId: string - address: string - nonce: string -} - -export type AuthorizationListItem = { - // Note: these are `PrefixedHexString`s - yParity: string - r: string - s: string -} & AuthorizationListItemUnsigned - -// Tuple of [chain_id, address, [nonce], y_parity, r, s] -export type AuthorizationListBytesItem = [ - Uint8Array, - Uint8Array, - Uint8Array, - Uint8Array, - Uint8Array, - Uint8Array, -] -export type AuthorizationListBytes = AuthorizationListBytesItem[] -export type AuthorizationList = AuthorizationListItem[] - -export type AuthorizationListBytesItemUnsigned = [Uint8Array, Uint8Array, Uint8Array] diff --git a/packages/tx/src/util/index.ts b/packages/tx/src/util/index.ts index 7ce74e5aef5..b80d6e081d0 100644 --- a/packages/tx/src/util/index.ts +++ b/packages/tx/src/util/index.ts @@ -1,4 +1,3 @@ // Do not add `./internal.ts`, this will export the internal helpers also at package level export * from './general.ts' export * from './access.ts' -export * from './authorization.ts' diff --git a/packages/tx/test/base.spec.ts b/packages/tx/test/base.spec.ts index 8ac98d948a1..3d23fa9fcdd 100644 --- a/packages/tx/test/base.spec.ts +++ b/packages/tx/test/base.spec.ts @@ -7,7 +7,6 @@ import { equalsBytes, hexToBytes, privateToPublic, - toBytes, utf8ToBytes, } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' @@ -186,7 +185,7 @@ describe('[BaseTransaction]', () => { it('createWithdrawalFromBytesArray()', () => { let rlpData: any = legacyTxs[0].raw() - rlpData[0] = toBytes('0x0') + rlpData[0] = hexToBytes('0x0') try { createLegacyTxFromBytesArray(rlpData) assert.fail('should have thrown when nonce has leading zeroes') @@ -196,8 +195,8 @@ describe('[BaseTransaction]', () => { 'should throw with nonce with leading zeroes', ) } - rlpData[0] = toBytes('0x') - rlpData[6] = toBytes('0x0') + rlpData[0] = hexToBytes('0x') + rlpData[6] = hexToBytes('0x0') try { createLegacyTxFromBytesArray(rlpData) assert.fail('should have thrown when v has leading zeroes') @@ -208,7 +207,7 @@ describe('[BaseTransaction]', () => { ) } rlpData = eip2930Txs[0].raw() - rlpData[3] = toBytes('0x0') + rlpData[3] = hexToBytes('0x0') try { createAccessList2930TxFromBytesArray(rlpData) assert.fail('should have thrown when gasLimit has leading zeroes') @@ -219,7 +218,7 @@ describe('[BaseTransaction]', () => { ) } rlpData = eip1559Txs[0].raw() - rlpData[2] = toBytes('0x0') + rlpData[2] = hexToBytes('0x0') try { create1559FeeMarketTxFromBytesArray(rlpData) assert.fail('should have thrown when maxPriorityFeePerGas has leading zeroes') @@ -414,7 +413,7 @@ describe('[BaseTransaction]', () => { }) it('initialization with defaults', () => { - const bufferZero = toBytes('0x') + const bufferZero = hexToBytes('0x') const tx = createLegacyTx({ nonce: undefined, gasLimit: undefined, diff --git a/packages/tx/test/eip7702.spec.ts b/packages/tx/test/eip7702.spec.ts index 8627f2ae457..45accc148ac 100644 --- a/packages/tx/test/eip7702.spec.ts +++ b/packages/tx/test/eip7702.spec.ts @@ -13,9 +13,8 @@ import { assert, describe, it } from 'vitest' import { createEOACode7702Tx } from '../src/index.ts' -import type { PrefixedHexString } from '@ethereumjs/util' +import type { EOACode7702AuthorizationListItem, PrefixedHexString } from '@ethereumjs/util' import type { TxData } from '../src/7702/tx.ts' -import type { AuthorizationListItem } from '../src/index.ts' const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) @@ -24,8 +23,8 @@ const addr = createAddressFromPrivateKey(pkey) const ones32: PrefixedHexString = `0x${'01'.repeat(32)}` -function getTxData(override: Partial = {}): TxData { - const validAuthorizationList: AuthorizationListItem = { +function getTxData(override: Partial = {}): TxData { + const validAuthorizationList: EOACode7702AuthorizationListItem = { chainId: '0x', address: `0x${'20'.repeat(20)}`, nonce: '0x1', @@ -78,7 +77,7 @@ describe('[EOACode7702Transaction]', () => { }) it('valid and invalid authorizationList values', () => { - const tests: [Partial, string][] = [ + const tests: [Partial, string][] = [ [ { address: `0x${'20'.repeat(21)}`, diff --git a/packages/tx/test/t9n.spec.ts b/packages/tx/test/t9n.spec.ts index 2ba4fdfe9d5..ff93cba2754 100644 --- a/packages/tx/test/t9n.spec.ts +++ b/packages/tx/test/t9n.spec.ts @@ -77,7 +77,7 @@ function runTests(filePath: string) { for (const testName in tests) { const test = tests[testName] - const txBytes = hexToBytes(test.txbytes) + const txBytes = hexToBytes(test.txbytes as PrefixedHexString) for (const fork in test.result) { it(`${testName} [${getFork(fork)}]`, () => { diff --git a/packages/tx/typedoc.cjs b/packages/tx/typedoc.mjs similarity index 59% rename from packages/tx/typedoc.cjs rename to packages/tx/typedoc.mjs index f843620ce5c..0e1e7f89f5e 100644 --- a/packages/tx/typedoc.cjs +++ b/packages/tx/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['src/util.ts', 'test/**/*.ts'], diff --git a/packages/util/README.md b/packages/util/README.md index b6395405afa..9e864e51f7a 100644 --- a/packages/util/README.md +++ b/packages/util/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/util +# @ethereumjs/util `v10` [![NPM Package][util-npm-badge]][util-npm-link] [![GitHub Issues][util-issues-badge]][util-issues-link] @@ -9,6 +9,30 @@ | A collection of utility functions for Ethereum. | | ----------------------------------------------- | +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Module: [account]](#module-account) +- [Module: [address]](#module-address) +- [Module: [blobs]](#module-blobs) +- [Module: [bytes]](#module-bytes) +- [Module: [constants]](#module-constants) +- [Module: [db]](#module-db) +- [Module: [genesis]](#module-genesis) +- [Module: [internal]](#module-internal) +- [Module: [kzg]](#module-kzg) +- [Module: [mapDB]](#module-mapdb) +- [Module: [request]](#module-request) +- [Module: [signature]](#module-signature) +- [Module: [types]](#module-types) +- [Module: [verkle]](#module-verkle) +- [Module: [withdrawal]](#module-withdrawal) +- [Browser](#browser) +- [API](#api) +- [EthereumJS](#ethereumjs) +- [License](#license) + ## Installation To obtain the latest version, simply require the project using `npm`: @@ -17,7 +41,7 @@ To obtain the latest version, simply require the project using `npm`: npm install @ethereumjs/util ``` -## Usage +## Getting Started This package contains the following modules providing respective helper methods, classes and commonly re-used constants. @@ -27,9 +51,9 @@ All helpers are re-exported from the root level and deep imports are not necessa import { hexToBytes, isValidChecksumAddress } from '@ethereumjs/util' ``` -### Module: [account](src/account.ts) +## Module: [account](src/account.ts) -Class representing an `Account` and providing private/public key and address-related functionality (creation, validation, conversion). +Class representing an `Account` and providing private/public key and address-related functionality (creation, validation, conversion). It is not recommended to use this constructor directly. Instead use the static factory methods to assist in creating an Account from varying data types. ```ts // ./examples/account.ts @@ -59,7 +83,7 @@ const account = createPartialAccount({ console.log(`Partial account with nonce=${account.nonce} and balance=${account.balance} created`) ``` -### Module: [address](src/address.ts) +## Module: [address](src/address.ts) Class representing an Ethereum `Address` with instantiation helpers and validation methods. @@ -72,7 +96,7 @@ const address = createAddressFromString('0x2f015c60e0be116b1f0cd534704db9c92118f console.log(`Ethereum address ${address.toString()} created`) ``` -### Module: [blobs](src/blobs.ts) +## Module: [blobs](src/blobs.ts) Module providing helpers for 4844 blobs and versioned hashes. @@ -93,7 +117,7 @@ const versionedHash = computeVersionedHash(commitment, blobCommitmentVersion) console.log(`Versioned hash ${versionedHash} computed`) ``` -### Module: [bytes](src/bytes.ts) +## Module: [bytes](src/bytes.ts) Byte-related helper and conversion functions. @@ -108,7 +132,7 @@ const bigIntValue = bytesToBigInt(bytesValue) console.log(`Converted value: ${bigIntValue}`) ``` -### Module: [constants](src/constants.ts) +## Module: [constants](src/constants.ts) Exposed constants (e.g. `KECCAK256_NULL_S` for string representation of Keccak-256 hash of null) @@ -121,27 +145,27 @@ console.log(`The keccak-256 hash of null: ${KECCAK256_NULL_S}`) console.log(`BigInt constants (performance), e.g. BIGINT_2EXP96: ${BIGINT_2EXP96}`) ``` -### Module: [db](src/db.ts) +## Module: [db](src/db.ts) DB interface for database abstraction (Blockchain, Trie), see e.g. [@ethereumjs/trie recipes](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/trie/recipes/level.ts)) for usage. -### Module: [genesis](src/genesis.ts) +## Module: [genesis](src/genesis.ts) Genesis related interfaces and helpers. -### Module: [internal](src/internal.ts) +## Module: [internal](src/internal.ts) Internalized simple helper methods like `isHexString`. Note that methods from this module might get deprecated in the future. -### Module: [kzg](src/kzg.ts) +## Module: [kzg](src/kzg.ts) KZG interface (used for 4844 blob txs), see [@ethereumjs/tx](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) README for main usage instructions. -### Module: [mapDB](src/mapDB.ts) +## Module: [mapDB](src/mapDB.ts) Simple map DB implementation using the `DB` interface (see above). -### Module: [request](src/request.ts) +## Module: [request](src/request.ts) Module with a compact generic request class for [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) general purpose execution layer requests to the CL (Prague hardfork) with the possibility to set `data` and a `type` conforming to the following request types: @@ -151,7 +175,7 @@ Module with a compact generic request class for [EIP-7685](https://eips.ethereum 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) +## Module: [signature](src/signature.ts) Small helpers around signature validation, conversion, recovery as well as selected convenience wrappers for calls to the underlying crypo libraries, using the cryptographic primitive implementations from the [Noble](https://paulmillr.com/noble/) crypto library set. If possible for your use case it is recommended to use the underlying crypto libraries directly for robustness. @@ -172,11 +196,11 @@ const pubkey = ecrecover(ecHash, v, r, s, chainId) console.log(`Recovered public key ${bytesToHex(pubkey)} from valid signature values`) ``` -### Module: [types](src/types.ts) +## Module: [types](src/types.ts) Various TypeScript types. Direct usage is not recommended, type structure might change in the future. -### Module: [verkle](src/verkle.ts) +## Module: [verkle](src/verkle.ts) Various functions for accessing verkle state: @@ -212,7 +236,7 @@ const basicData = decodeVerkleLeafBasicData(hexToBytes(basicDataRaw!)) console.log(basicData) // { version: 1, nonce: 1n, codeSize: 0, balance: 1n } ``` -### Module: [withdrawal](src/withdrawal.ts) +## Module: [withdrawal](src/withdrawal.ts) Class representing an `EIP-4895` `Withdrawal` with different constructors as well as conversion and output helpers. diff --git a/packages/util/docs/README.md b/packages/util/docs/README.md index 8333d27d8dd..57d9bb8e683 100644 --- a/packages/util/docs/README.md +++ b/packages/util/docs/README.md @@ -1,2827 +1,276 @@ -@ethereumjs/util +**@ethereumjs/util** -# @ethereumjs/util - -## Table of contents +*** -### Enumerations - -- [KeyEncoding](enums/KeyEncoding.md) -- [TypeOutput](enums/TypeOutput.md) -- [ValueEncoding](enums/ValueEncoding.md) +# @ethereumjs/util -### Classes +## Classes - [Account](classes/Account.md) - [Address](classes/Address.md) -- [AsyncEventEmitter](classes/AsyncEventEmitter.md) +- [CLRequest](classes/CLRequest.md) +- [EthereumJSError](classes/EthereumJSError.md) - [Lock](classes/Lock.md) - [MapDB](classes/MapDB.md) +- [PrioritizedTaskExecutor](classes/PrioritizedTaskExecutor.md) +- [Units](classes/Units.md) - [Withdrawal](classes/Withdrawal.md) -### Interfaces +## Interfaces - [AccountData](interfaces/AccountData.md) +- [BinaryTreeExecutionWitness](interfaces/BinaryTreeExecutionWitness.md) +- [BinaryTreeStateDiff](interfaces/BinaryTreeStateDiff.md) - [DB](interfaces/DB.md) - [DelBatch](interfaces/DelBatch.md) -- [ECDSASignature](interfaces/ECDSASignature.md) - [EthersProvider](interfaces/EthersProvider.md) -- [EventMap](interfaces/EventMap.md) -- [GenesisState](interfaces/GenesisState.md) -- [JsonRpcWithdrawal](interfaces/JsonRpcWithdrawal.md) -- [Kzg](interfaces/Kzg.md) +- [JSONRPCWithdrawal](interfaces/JSONRPCWithdrawal.md) +- [KZG](interfaces/KZG.md) +- [PartialAccountData](interfaces/PartialAccountData.md) +- [ProverInput](interfaces/ProverInput.md) - [PutBatch](interfaces/PutBatch.md) -- [TransformabletoBytes](interfaces/TransformabletoBytes.md) - -### Type Aliases - -- [AccountBodyBytes](README.md#accountbodybytes) -- [AccountState](README.md#accountstate) -- [AddressLike](README.md#addresslike) -- [BatchDBOp](README.md#batchdbop) -- [BigIntLike](README.md#bigintlike) -- [BytesLike](README.md#byteslike) -- [DBObject](README.md#dbobject) -- [EncodingOpts](README.md#encodingopts) -- [NestedUint8Array](README.md#nesteduint8array) -- [PrefixedHexString](README.md#prefixedhexstring) -- [StoragePair](README.md#storagepair) -- [ToBytesInputTypes](README.md#tobytesinputtypes) -- [TypeOutputReturnType](README.md#typeoutputreturntype) -- [WithdrawalBytes](README.md#withdrawalbytes) -- [WithdrawalData](README.md#withdrawaldata) - -### Variables - -- [BIGINT\_0](README.md#bigint_0) -- [BIGINT\_1](README.md#bigint_1) -- [BIGINT\_100](README.md#bigint_100) -- [BIGINT\_128](README.md#bigint_128) -- [BIGINT\_160](README.md#bigint_160) -- [BIGINT\_2](README.md#bigint_2) -- [BIGINT\_224](README.md#bigint_224) -- [BIGINT\_255](README.md#bigint_255) -- [BIGINT\_256](README.md#bigint_256) -- [BIGINT\_27](README.md#bigint_27) -- [BIGINT\_28](README.md#bigint_28) -- [BIGINT\_2EXP160](README.md#bigint_2exp160) -- [BIGINT\_2EXP224](README.md#bigint_2exp224) -- [BIGINT\_2EXP256](README.md#bigint_2exp256) -- [BIGINT\_2EXP96](README.md#bigint_2exp96) -- [BIGINT\_3](README.md#bigint_3) -- [BIGINT\_31](README.md#bigint_31) -- [BIGINT\_32](README.md#bigint_32) -- [BIGINT\_64](README.md#bigint_64) -- [BIGINT\_7](README.md#bigint_7) -- [BIGINT\_8](README.md#bigint_8) -- [BIGINT\_96](README.md#bigint_96) -- [BIGINT\_NEG1](README.md#bigint_neg1) -- [GWEI\_TO\_WEI](README.md#gwei_to_wei) -- [KECCAK256\_NULL](README.md#keccak256_null) -- [KECCAK256\_NULL\_S](README.md#keccak256_null_s) -- [KECCAK256\_RLP](README.md#keccak256_rlp) -- [KECCAK256\_RLP\_ARRAY](README.md#keccak256_rlp_array) -- [KECCAK256\_RLP\_ARRAY\_S](README.md#keccak256_rlp_array_s) -- [KECCAK256\_RLP\_S](README.md#keccak256_rlp_s) -- [MAX\_INTEGER](README.md#max_integer) -- [MAX\_INTEGER\_BIGINT](README.md#max_integer_bigint) -- [MAX\_UINT64](README.md#max_uint64) -- [MAX\_WITHDRAWALS\_PER\_PAYLOAD](README.md#max_withdrawals_per_payload) -- [RIPEMD160\_ADDRESS\_STRING](README.md#ripemd160_address_string) -- [RLP\_EMPTY\_STRING](README.md#rlp_empty_string) -- [SECP256K1\_ORDER](README.md#secp256k1_order) -- [SECP256K1\_ORDER\_DIV\_2](README.md#secp256k1_order_div_2) -- [TWO\_POW256](README.md#two_pow256) -- [kzg](README.md#kzg) - -### Functions - -- [accountBodyFromSlim](README.md#accountbodyfromslim) -- [accountBodyToRLP](README.md#accountbodytorlp) -- [accountBodyToSlim](README.md#accountbodytoslim) -- [addHexPrefix](README.md#addhexprefix) -- [arrayContainsArray](README.md#arraycontainsarray) -- [bigInt64ToBytes](README.md#bigint64tobytes) -- [bigIntMax](README.md#bigintmax) -- [bigIntMin](README.md#bigintmin) -- [bigIntToBytes](README.md#biginttobytes) -- [bigIntToHex](README.md#biginttohex) -- [bigIntToUnpaddedBytes](README.md#biginttounpaddedbytes) -- [blobsToCommitments](README.md#blobstocommitments) -- [blobsToProofs](README.md#blobstoproofs) -- [bytesToBigInt](README.md#bytestobigint) -- [bytesToBigInt64](README.md#bytestobigint64) -- [bytesToHex](README.md#bytestohex) -- [bytesToInt](README.md#bytestoint) -- [bytesToInt32](README.md#bytestoint32) -- [bytesToUnprefixedHex](README.md#bytestounprefixedhex) -- [bytesToUtf8](README.md#bytestoutf8) -- [calculateSigRecovery](README.md#calculatesigrecovery) -- [commitmentsToVersionedHashes](README.md#commitmentstoversionedhashes) -- [compareBytes](README.md#comparebytes) -- [computeVersionedHash](README.md#computeversionedhash) -- [concatBytes](README.md#concatbytes) -- [ecrecover](README.md#ecrecover) -- [ecsign](README.md#ecsign) -- [equalsBytes](README.md#equalsbytes) -- [fetchFromProvider](README.md#fetchfromprovider) -- [formatBigDecimal](README.md#formatbigdecimal) -- [fromAscii](README.md#fromascii) -- [fromRpcSig](README.md#fromrpcsig) -- [fromSigned](README.md#fromsigned) -- [fromUtf8](README.md#fromutf8) -- [generateAddress](README.md#generateaddress) -- [generateAddress2](README.md#generateaddress2) -- [getBinarySize](README.md#getbinarysize) -- [getBlobs](README.md#getblobs) -- [getKeys](README.md#getkeys) -- [getProvider](README.md#getprovider) -- [hashPersonalMessage](README.md#hashpersonalmessage) -- [hexToBytes](README.md#hextobytes) -- [importPublic](README.md#importpublic) -- [initKZG](README.md#initkzg) -- [int32ToBytes](README.md#int32tobytes) -- [intToBytes](README.md#inttobytes) -- [intToHex](README.md#inttohex) -- [intToUnpaddedBytes](README.md#inttounpaddedbytes) -- [isHexPrefixed](README.md#ishexprefixed) -- [isHexString](README.md#ishexstring) -- [isValidAddress](README.md#isvalidaddress) -- [isValidChecksumAddress](README.md#isvalidchecksumaddress) -- [isValidPrivate](README.md#isvalidprivate) -- [isValidPublic](README.md#isvalidpublic) -- [isValidSignature](README.md#isvalidsignature) -- [isZeroAddress](README.md#iszeroaddress) -- [padToEven](README.md#padtoeven) -- [parseGethGenesisState](README.md#parsegethgenesisstate) -- [privateToAddress](README.md#privatetoaddress) -- [privateToPublic](README.md#privatetopublic) -- [pubToAddress](README.md#pubtoaddress) -- [publicToAddress](README.md#publictoaddress) -- [randomBytes](README.md#randombytes) -- [setLengthLeft](README.md#setlengthleft) -- [setLengthRight](README.md#setlengthright) -- [short](README.md#short) -- [stripHexPrefix](README.md#striphexprefix) -- [toAscii](README.md#toascii) -- [toBytes](README.md#tobytes) -- [toChecksumAddress](README.md#tochecksumaddress) -- [toCompactSig](README.md#tocompactsig) -- [toRpcSig](README.md#torpcsig) -- [toType](README.md#totype) -- [toUnsigned](README.md#tounsigned) -- [unpadArray](README.md#unpadarray) -- [unpadBytes](README.md#unpadbytes) -- [unpadHex](README.md#unpadhex) -- [unprefixedHexToBytes](README.md#unprefixedhextobytes) -- [utf8ToBytes](README.md#utf8tobytes) -- [validateNoLeadingZeroes](README.md#validatenoleadingzeroes) -- [zeroAddress](README.md#zeroaddress) -- [zeros](README.md#zeros) +- [RequestJSON](interfaces/RequestJSON.md) +- [TransformableToBytes](interfaces/TransformableToBytes.md) +- [VerifierInput](interfaces/VerifierInput.md) +- [VerkleCrypto](interfaces/VerkleCrypto.md) +- [VerkleExecutionWitness](interfaces/VerkleExecutionWitness.md) +- [VerkleProof](interfaces/VerkleProof.md) +- [VerkleStateDiff](interfaces/VerkleStateDiff.md) ## Type Aliases -### AccountBodyBytes - -Ƭ **AccountBodyBytes**: [`Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`] - -#### Defined in - -[packages/util/src/account.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L29) - -___ - -### AccountState - -Ƭ **AccountState**: [balance: PrefixedHexString, code: PrefixedHexString, storage: StoragePair[], nonce: PrefixedHexString] - -#### Defined in - -[packages/util/src/genesis.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/genesis.ts#L8) - -___ - -### AddressLike - -Ƭ **AddressLike**: [`Address`](classes/Address.md) \| `Uint8Array` \| [`PrefixedHexString`](README.md#prefixedhexstring) - -A type that represents an input that can be converted to an Address. - -#### Defined in - -[packages/util/src/types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L31) - -___ - -### BatchDBOp - -Ƭ **BatchDBOp**<`TKey`, `TValue`\>: [`PutBatch`](interfaces/PutBatch.md)<`TKey`, `TValue`\> \| [`DelBatch`](interfaces/DelBatch.md)<`TKey`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `TKey` | extends `Uint8Array` \| `string` \| `number` = `Uint8Array` | -| `TValue` | extends `Uint8Array` \| `string` \| [`DBObject`](README.md#dbobject) = `Uint8Array` | - -#### Defined in - -[packages/util/src/db.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L4) - -___ - -### BigIntLike - -Ƭ **BigIntLike**: `bigint` \| [`PrefixedHexString`](README.md#prefixedhexstring) \| `number` \| `Uint8Array` - -#### Defined in - -[packages/util/src/types.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L10) - -___ - -### BytesLike - -Ƭ **BytesLike**: `Uint8Array` \| `number`[] \| `number` \| `bigint` \| [`TransformabletoBytes`](interfaces/TransformabletoBytes.md) \| [`PrefixedHexString`](README.md#prefixedhexstring) - -#### Defined in - -[packages/util/src/types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L15) - -___ - -### DBObject - -Ƭ **DBObject**: `Object` - -#### Index signature - -▪ [key: `string`]: `string` \| `string`[] \| `number` - -#### Defined in - -[packages/util/src/db.ts:1](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L1) - -___ - -### EncodingOpts - -Ƭ **EncodingOpts**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `keyEncoding?` | [`KeyEncoding`](enums/KeyEncoding.md) | -| `valueEncoding?` | [`ValueEncoding`](enums/ValueEncoding.md) | - -#### Defined in - -[packages/util/src/db.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L21) - -___ - -### NestedUint8Array - -Ƭ **NestedUint8Array**: (`Uint8Array` \| [`NestedUint8Array`](README.md#nesteduint8array))[] - -#### Defined in - -[packages/util/src/types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L37) - -___ - -### PrefixedHexString - -Ƭ **PrefixedHexString**: `string` - -#### Defined in - -[packages/util/src/types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L26) - -___ - -### StoragePair - -Ƭ **StoragePair**: [key: PrefixedHexString, value: PrefixedHexString] - -#### Defined in - -[packages/util/src/genesis.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/genesis.ts#L6) - -___ - -### ToBytesInputTypes - -Ƭ **ToBytesInputTypes**: [`PrefixedHexString`](README.md#prefixedhexstring) \| `number` \| `bigint` \| `Uint8Array` \| `number`[] \| [`TransformabletoBytes`](interfaces/TransformabletoBytes.md) \| ``null`` \| `undefined` - -#### Defined in - -[packages/util/src/bytes.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L267) - -___ - -### TypeOutputReturnType - -Ƭ **TypeOutputReturnType**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `0` | `number` | -| `1` | `bigint` | -| `2` | `Uint8Array` | -| `3` | [`PrefixedHexString`](README.md#prefixedhexstring) | - -#### Defined in - -[packages/util/src/types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L49) - -___ - -### WithdrawalBytes - -Ƭ **WithdrawalBytes**: [`Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`] - -#### Defined in - -[packages/util/src/withdrawal.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L30) - -___ - -### WithdrawalData - -Ƭ **WithdrawalData**: `Object` - -Flexible input data type for EIP-4895 withdrawal data with amount in Gwei to -match CL representation and for eventual ssz withdrawalsRoot - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `address` | [`AddressLike`](README.md#addresslike) | -| `amount` | [`BigIntLike`](README.md#bigintlike) | -| `index` | [`BigIntLike`](README.md#bigintlike) | -| `validatorIndex` | [`BigIntLike`](README.md#bigintlike) | - -#### Defined in - -[packages/util/src/withdrawal.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L12) +- [AccountBodyBytes](type-aliases/AccountBodyBytes.md) +- [AddressLike](type-aliases/AddressLike.md) +- [BatchDBOp](type-aliases/BatchDBOp.md) +- [BigIntLike](type-aliases/BigIntLike.md) +- [BinaryTreeLeafBasicData](type-aliases/BinaryTreeLeafBasicData.md) +- [BinaryTreeLeafType](type-aliases/BinaryTreeLeafType.md) +- [BinaryTreeProof](type-aliases/BinaryTreeProof.md) +- [BytesLike](type-aliases/BytesLike.md) +- [CLRequestType](type-aliases/CLRequestType.md) +- [DBObject](type-aliases/DBObject.md) +- [EncodingOpts](type-aliases/EncodingOpts.md) +- [EthereumJSErrorMetaData](type-aliases/EthereumJSErrorMetaData.md) +- [EthereumJSErrorObject](type-aliases/EthereumJSErrorObject.md) +- [KeyEncoding](type-aliases/KeyEncoding.md) +- [NestedUint8Array](type-aliases/NestedUint8Array.md) +- [NumericString](type-aliases/NumericString.md) +- [PrefixedHexString](type-aliases/PrefixedHexString.md) +- [RequestBytes](type-aliases/RequestBytes.md) +- [ToBytesInputTypes](type-aliases/ToBytesInputTypes.md) +- [TypeOutput](type-aliases/TypeOutput.md) +- [TypeOutputReturnType](type-aliases/TypeOutputReturnType.md) +- [ValueEncoding](type-aliases/ValueEncoding.md) +- [VerkleLeafBasicData](type-aliases/VerkleLeafBasicData.md) +- [VerkleLeafType](type-aliases/VerkleLeafType.md) +- [WithdrawalBytes](type-aliases/WithdrawalBytes.md) +- [WithdrawalData](type-aliases/WithdrawalData.md) ## Variables -### BIGINT\_0 - -• `Const` **BIGINT\_0**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L82) - -___ - -### BIGINT\_1 - -• `Const` **BIGINT\_1**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L83) - -___ - -### BIGINT\_100 - -• `Const` **BIGINT\_100**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L100) - -___ - -### BIGINT\_128 - -• `Const` **BIGINT\_128**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L95) - -___ - -### BIGINT\_160 - -• `Const` **BIGINT\_160**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L101) - -___ - -### BIGINT\_2 - -• `Const` **BIGINT\_2**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L84) - -___ - -### BIGINT\_224 - -• `Const` **BIGINT\_224**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L102) - -___ - -### BIGINT\_255 - -• `Const` **BIGINT\_255**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L96) - -___ - -### BIGINT\_256 - -• `Const` **BIGINT\_256**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L97) - -___ - -### BIGINT\_27 - -• `Const` **BIGINT\_27**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L89) - -___ - -### BIGINT\_28 - -• `Const` **BIGINT\_28**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L90) - -___ - -### BIGINT\_2EXP160 - -• `Const` **BIGINT\_2EXP160**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L104) - -___ - -### BIGINT\_2EXP224 - -• `Const` **BIGINT\_2EXP224**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L105) - -___ - -### BIGINT\_2EXP256 - -• `Const` **BIGINT\_2EXP256**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L107) - -___ - -### BIGINT\_2EXP96 - -• `Const` **BIGINT\_2EXP96**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L103) - -___ - -### BIGINT\_3 - -• `Const` **BIGINT\_3**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L85) - -___ - -### BIGINT\_31 - -• `Const` **BIGINT\_31**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L91) - -___ - -### BIGINT\_32 - -• `Const` **BIGINT\_32**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L92) - -___ - -### BIGINT\_64 - -• `Const` **BIGINT\_64**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L93) - -___ - -### BIGINT\_7 - -• `Const` **BIGINT\_7**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L86) - -___ - -### BIGINT\_8 - -• `Const` **BIGINT\_8**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L87) - -___ - -### BIGINT\_96 - -• `Const` **BIGINT\_96**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L99) - -___ - -### BIGINT\_NEG1 - -• `Const` **BIGINT\_NEG1**: `bigint` - -BigInt constants - -#### Defined in - -[packages/util/src/constants.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L80) - -___ - -### GWEI\_TO\_WEI - -• `Const` **GWEI\_TO\_WEI**: `bigint` - -Easy conversion from Gwei to wei - -#### Defined in - -[packages/util/src/units.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L3) - -___ - -### KECCAK256\_NULL - -• `Const` **KECCAK256\_NULL**: `Uint8Array` - -Keccak-256 hash of null - -#### Defined in - -[packages/util/src/constants.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L44) - -___ - -### KECCAK256\_NULL\_S - -• `Const` **KECCAK256\_NULL\_S**: ``"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"`` - -Keccak-256 hash of null - -#### Defined in - -[packages/util/src/constants.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L39) - -___ - -### KECCAK256\_RLP - -• `Const` **KECCAK256\_RLP**: `Uint8Array` - -Keccak-256 hash of the RLP of null - -#### Defined in - -[packages/util/src/constants.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L65) - -___ - -### KECCAK256\_RLP\_ARRAY - -• `Const` **KECCAK256\_RLP\_ARRAY**: `Uint8Array` - -Keccak-256 of an RLP of an empty array - -#### Defined in - -[packages/util/src/constants.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L55) - -___ - -### KECCAK256\_RLP\_ARRAY\_S - -• `Const` **KECCAK256\_RLP\_ARRAY\_S**: ``"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"`` - -Keccak-256 of an RLP of an empty array - -#### Defined in - -[packages/util/src/constants.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L49) - -___ - -### KECCAK256\_RLP\_S - -• `Const` **KECCAK256\_RLP\_S**: ``"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"`` - -Keccak-256 hash of the RLP of null - -#### Defined in - -[packages/util/src/constants.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L60) - -___ - -### MAX\_INTEGER - -• `Const` **MAX\_INTEGER**: `bigint` - -The max integer that the evm can handle (2^256-1) - -#### Defined in - -[packages/util/src/constants.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L13) - -___ - -### MAX\_INTEGER\_BIGINT - -• `Const` **MAX\_INTEGER\_BIGINT**: `bigint` - -The max integer that the evm can handle (2^256-1) as a bigint -2^256-1 equals to 340282366920938463463374607431768211455 -We use literal value instead of calculated value for compatibility issue. - -#### Defined in - -[packages/util/src/constants.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L22) - -___ - -### MAX\_UINT64 - -• `Const` **MAX\_UINT64**: `bigint` - -2^64-1 - -#### Defined in - -[packages/util/src/constants.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L8) - -___ - -### MAX\_WITHDRAWALS\_PER\_PAYLOAD - -• `Const` **MAX\_WITHDRAWALS\_PER\_PAYLOAD**: ``16`` - -#### Defined in - -[packages/util/src/constants.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L72) - -___ - -### RIPEMD160\_ADDRESS\_STRING - -• `Const` **RIPEMD160\_ADDRESS\_STRING**: ``"0000000000000000000000000000000000000003"`` - -#### Defined in - -[packages/util/src/constants.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L74) - -___ - -### RLP\_EMPTY\_STRING - -• `Const` **RLP\_EMPTY\_STRING**: `Uint8Array` - -RLP encoded empty string - -#### Defined in - -[packages/util/src/constants.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L70) - -___ - -### SECP256K1\_ORDER - -• `Const` **SECP256K1\_ORDER**: `bigint` = `secp256k1.CURVE.n` - -#### Defined in - -[packages/util/src/constants.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L26) - -___ - -### SECP256K1\_ORDER\_DIV\_2 - -• `Const` **SECP256K1\_ORDER\_DIV\_2**: `bigint` - -#### Defined in - -[packages/util/src/constants.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L27) - -___ - -### TWO\_POW256 - -• `Const` **TWO\_POW256**: `bigint` - -2^256 - -#### Defined in - -[packages/util/src/constants.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L32) - -___ - -### kzg - -• **kzg**: [`Kzg`](interfaces/Kzg.md) - -#### Defined in - -[packages/util/src/kzg.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L26) +- [BIGINT\_0](variables/BIGINT_0.md) +- [BIGINT\_1](variables/BIGINT_1.md) +- [BIGINT\_100](variables/BIGINT_100.md) +- [BIGINT\_128](variables/BIGINT_128.md) +- [BIGINT\_160](variables/BIGINT_160.md) +- [BIGINT\_2](variables/BIGINT_2.md) +- [BIGINT\_224](variables/BIGINT_224.md) +- [BIGINT\_255](variables/BIGINT_255.md) +- [BIGINT\_256](variables/BIGINT_256.md) +- [BIGINT\_27](variables/BIGINT_27.md) +- [BIGINT\_28](variables/BIGINT_28.md) +- [BIGINT\_2EXP160](variables/BIGINT_2EXP160.md) +- [BIGINT\_2EXP224](variables/BIGINT_2EXP224.md) +- [BIGINT\_2EXP256](variables/BIGINT_2EXP256.md) +- [BIGINT\_2EXP96](variables/BIGINT_2EXP96.md) +- [BIGINT\_3](variables/BIGINT_3.md) +- [BIGINT\_31](variables/BIGINT_31.md) +- [BIGINT\_32](variables/BIGINT_32.md) +- [BIGINT\_64](variables/BIGINT_64.md) +- [BIGINT\_7](variables/BIGINT_7.md) +- [BIGINT\_8](variables/BIGINT_8.md) +- [BIGINT\_96](variables/BIGINT_96.md) +- [BIGINT\_NEG1](variables/BIGINT_NEG1.md) +- [BINARY\_TREE\_BALANCE\_BYTES\_LENGTH](variables/BINARY_TREE_BALANCE_BYTES_LENGTH.md) +- [BINARY\_TREE\_BALANCE\_OFFSET](variables/BINARY_TREE_BALANCE_OFFSET.md) +- [BINARY\_TREE\_BASIC\_DATA\_LEAF\_KEY](variables/BINARY_TREE_BASIC_DATA_LEAF_KEY.md) +- [BINARY\_TREE\_CODE\_CHUNK\_SIZE](variables/BINARY_TREE_CODE_CHUNK_SIZE.md) +- [BINARY\_TREE\_CODE\_HASH\_LEAF\_KEY](variables/BINARY_TREE_CODE_HASH_LEAF_KEY.md) +- [BINARY\_TREE\_CODE\_OFFSET](variables/BINARY_TREE_CODE_OFFSET.md) +- [BINARY\_TREE\_CODE\_SIZE\_BYTES\_LENGTH](variables/BINARY_TREE_CODE_SIZE_BYTES_LENGTH.md) +- [BINARY\_TREE\_CODE\_SIZE\_OFFSET](variables/BINARY_TREE_CODE_SIZE_OFFSET.md) +- [BINARY\_TREE\_HEADER\_STORAGE\_OFFSET](variables/BINARY_TREE_HEADER_STORAGE_OFFSET.md) +- [BINARY\_TREE\_MAIN\_STORAGE\_OFFSET](variables/BINARY_TREE_MAIN_STORAGE_OFFSET.md) +- [BINARY\_TREE\_NODE\_WIDTH](variables/BINARY_TREE_NODE_WIDTH.md) +- [BINARY\_TREE\_NONCE\_BYTES\_LENGTH](variables/BINARY_TREE_NONCE_BYTES_LENGTH.md) +- [BINARY\_TREE\_NONCE\_OFFSET](variables/BINARY_TREE_NONCE_OFFSET.md) +- [BINARY\_TREE\_VERSION\_BYTES\_LENGTH](variables/BINARY_TREE_VERSION_BYTES_LENGTH.md) +- [BINARY\_TREE\_VERSION\_OFFSET](variables/BINARY_TREE_VERSION_OFFSET.md) +- [BinaryTreeLeafType](variables/BinaryTreeLeafType.md) +- [~~bytesToUnprefixedHex~~](variables/bytesToUnprefixedHex.md) +- [CLRequestType](variables/CLRequestType.md) +- [DEFAULT\_ERROR\_CODE](variables/DEFAULT_ERROR_CODE.md) +- [ETHER\_TO\_WEI](variables/ETHER_TO_WEI.md) +- [GWEI\_TO\_WEI](variables/GWEI_TO_WEI.md) +- [KECCAK256\_NULL](variables/KECCAK256_NULL.md) +- [KECCAK256\_NULL\_S](variables/KECCAK256_NULL_S.md) +- [KECCAK256\_RLP](variables/KECCAK256_RLP.md) +- [KECCAK256\_RLP\_ARRAY](variables/KECCAK256_RLP_ARRAY.md) +- [KECCAK256\_RLP\_ARRAY\_S](variables/KECCAK256_RLP_ARRAY_S.md) +- [KECCAK256\_RLP\_S](variables/KECCAK256_RLP_S.md) +- [KeyEncoding](variables/KeyEncoding.md) +- [MAX\_INTEGER](variables/MAX_INTEGER.md) +- [MAX\_INTEGER\_BIGINT](variables/MAX_INTEGER_BIGINT.md) +- [MAX\_UINT64](variables/MAX_UINT64.md) +- [MAX\_WITHDRAWALS\_PER\_PAYLOAD](variables/MAX_WITHDRAWALS_PER_PAYLOAD.md) +- [publicToAddress](variables/publicToAddress.md) +- [RIPEMD160\_ADDRESS\_STRING](variables/RIPEMD160_ADDRESS_STRING.md) +- [RLP\_EMPTY\_STRING](variables/RLP_EMPTY_STRING.md) +- [SECP256K1\_ORDER](variables/SECP256K1_ORDER.md) +- [SECP256K1\_ORDER\_DIV\_2](variables/SECP256K1_ORDER_DIV_2.md) +- [SHA256\_NULL](variables/SHA256_NULL.md) +- [TWO\_POW256](variables/TWO_POW256.md) +- [TypeOutput](variables/TypeOutput.md) +- [ValueEncoding](variables/ValueEncoding.md) +- [VERKLE\_BALANCE\_BYTES\_LENGTH](variables/VERKLE_BALANCE_BYTES_LENGTH.md) +- [VERKLE\_BALANCE\_OFFSET](variables/VERKLE_BALANCE_OFFSET.md) +- [VERKLE\_BASIC\_DATA\_LEAF\_KEY](variables/VERKLE_BASIC_DATA_LEAF_KEY.md) +- [VERKLE\_CODE\_CHUNK\_SIZE](variables/VERKLE_CODE_CHUNK_SIZE.md) +- [VERKLE\_CODE\_HASH\_LEAF\_KEY](variables/VERKLE_CODE_HASH_LEAF_KEY.md) +- [VERKLE\_CODE\_OFFSET](variables/VERKLE_CODE_OFFSET.md) +- [VERKLE\_CODE\_SIZE\_BYTES\_LENGTH](variables/VERKLE_CODE_SIZE_BYTES_LENGTH.md) +- [VERKLE\_CODE\_SIZE\_OFFSET](variables/VERKLE_CODE_SIZE_OFFSET.md) +- [VERKLE\_HEADER\_STORAGE\_OFFSET](variables/VERKLE_HEADER_STORAGE_OFFSET.md) +- [VERKLE\_MAIN\_STORAGE\_OFFSET](variables/VERKLE_MAIN_STORAGE_OFFSET.md) +- [VERKLE\_NODE\_WIDTH](variables/VERKLE_NODE_WIDTH.md) +- [VERKLE\_NONCE\_BYTES\_LENGTH](variables/VERKLE_NONCE_BYTES_LENGTH.md) +- [VERKLE\_NONCE\_OFFSET](variables/VERKLE_NONCE_OFFSET.md) +- [VERKLE\_VERSION\_BYTES\_LENGTH](variables/VERKLE_VERSION_BYTES_LENGTH.md) +- [VERKLE\_VERSION\_OFFSET](variables/VERKLE_VERSION_OFFSET.md) +- [VerkleLeafType](variables/VerkleLeafType.md) ## Functions -### accountBodyFromSlim - -▸ **accountBodyFromSlim**(`body`): `Uint8Array`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `body` | [`AccountBodyBytes`](README.md#accountbodybytes) | - -#### Returns - -`Uint8Array`[] - -#### Defined in - -[packages/util/src/account.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L357) - -___ - -### accountBodyToRLP - -▸ **accountBodyToRLP**(`body`, `couldBeSlim?`): `Uint8Array` - -Converts a slim account (per snap protocol spec) to the RLP encoded version of the account - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `body` | [`AccountBodyBytes`](README.md#accountbodybytes) | `undefined` | Array of 4 Uint8Array-like items to represent the account | -| `couldBeSlim` | `boolean` | `true` | - | - -#### Returns - -`Uint8Array` - -RLP encoded version of the account - -#### Defined in - -[packages/util/src/account.ts:383](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L383) - -___ - -### accountBodyToSlim - -▸ **accountBodyToSlim**(`body`): `Uint8Array`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `body` | [`AccountBodyBytes`](README.md#accountbodybytes) | - -#### Returns - -`Uint8Array`[] - -#### Defined in - -[packages/util/src/account.ts:368](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L368) - -___ - -### addHexPrefix - -▸ **addHexPrefix**(`str`): `string` - -Adds "0x" to a given `string` if it does not already start with "0x". - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `str` | `string` | - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/bytes.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L347) - -___ - -### arrayContainsArray - -▸ **arrayContainsArray**(`superset`, `subset`, `some?`): `boolean` - -Returns TRUE if the first specified array contains all elements -from the second one. FALSE otherwise. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `superset` | `unknown`[] | -| `subset` | `unknown`[] | -| `some?` | `boolean` | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/internal.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L91) - -___ - -### bigInt64ToBytes - -▸ **bigInt64ToBytes**(`value`, `littleEndian?`): `Uint8Array` - -**`Notice`** - -Convert a 64-bit bigint to a Uint8Array. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `value` | `bigint` | `undefined` | The 64-bit bigint to convert. | -| `littleEndian` | `boolean` | `false` | True for little-endian, undefined or false for big-endian. | - -#### Returns - -`Uint8Array` - -A Uint8Array of length 8 containing the bigint. - -#### Defined in - -[packages/util/src/bytes.ts:529](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L529) - -___ - -### bigIntMax - -▸ **bigIntMax**(...`args`): `bigint` - -Calculates max bigint from an array of bigints - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...args` | `bigint`[] | array of bigints | - -#### Returns - -`bigint` - -#### Defined in - -[packages/util/src/bytes.ts:409](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L409) - -___ - -### bigIntMin - -▸ **bigIntMin**(...`args`): `bigint` - -Calculates min BigInt from an array of BigInts - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...args` | `bigint`[] | array of bigints | - -#### Returns - -`bigint` - -#### Defined in - -[packages/util/src/bytes.ts:415](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L415) - -___ - -### bigIntToBytes - -▸ **bigIntToBytes**(`num`, `littleEndian?`): `Uint8Array` - -Converts a bigint to a Uint8Array - * - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `num` | `bigint` | `undefined` | the bigint to convert | -| `littleEndian` | `boolean` | `false` | - | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L156) - -___ - -### bigIntToHex - -▸ **bigIntToHex**(`num`): `string` - -Converts a bigint to a `0x` prefixed hex string - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `num` | `bigint` | the bigint to convert | - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/bytes.ts:401](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L401) - -___ - -### bigIntToUnpaddedBytes - -▸ **bigIntToUnpaddedBytes**(`value`): `Uint8Array` - -Convert value from bigint to an unpadded Uint8Array -(useful for RLP transport) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `bigint` | the bigint to convert | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:423](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L423) - -___ - -### blobsToCommitments - -▸ **blobsToCommitments**(`blobs`): `Uint8Array`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `blobs` | `Uint8Array`[] | - -#### Returns - -`Uint8Array`[] - -#### Defined in - -[packages/util/src/blobs.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L58) - -___ - -### blobsToProofs - -▸ **blobsToProofs**(`blobs`, `commitments`): `Uint8Array`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `blobs` | `Uint8Array`[] | -| `commitments` | `Uint8Array`[] | - -#### Returns - -`Uint8Array`[] - -#### Defined in - -[packages/util/src/blobs.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L66) - -___ - -### bytesToBigInt - -▸ **bytesToBigInt**(`bytes`, `littleEndian?`): `bigint` - -Converts a Uint8Array to a bigint - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `bytes` | `Uint8Array` | `undefined` | the bytes to convert | -| `littleEndian` | `boolean` | `false` | - | - -#### Returns - -`bigint` - -#### Defined in - -[packages/util/src/bytes.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L80) - -___ - -### bytesToBigInt64 - -▸ **bytesToBigInt64**(`bytes`, `littleEndian?`): `bigint` - -**`Notice`** - -Convert a Uint8Array to a 64-bit bigint - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `bytes` | `Uint8Array` | `undefined` | The input Uint8Array from which to read the 64-bit bigint. | -| `littleEndian` | `boolean` | `false` | True for little-endian, undefined or false for big-endian. | - -#### Returns - -`bigint` - -The 64-bit bigint read from the input Uint8Array. - -#### Defined in - -[packages/util/src/bytes.ts:502](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L502) - -___ - -### bytesToHex - -▸ **bytesToHex**(`bytes`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `bytes` | `Uint8Array` | - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/bytes.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L60) - -___ - -### bytesToInt - -▸ **bytesToInt**(`bytes`): `number` - -Converts a Uint8Array to a number. - -**`Throws`** - -If the input number exceeds 53 bits. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `bytes` | `Uint8Array` | the bytes to convert | - -#### Returns - -`number` - -#### Defined in - -[packages/util/src/bytes.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L104) - -___ - -### bytesToInt32 - -▸ **bytesToInt32**(`bytes`, `littleEndian?`): `number` - -**`Notice`** - -Convert a Uint8Array to a 32-bit integer - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `bytes` | `Uint8Array` | `undefined` | The input Uint8Array from which to read the 32-bit integer. | -| `littleEndian` | `boolean` | `false` | True for little-endian, undefined or false for big-endian. | - -#### Returns - -`number` - -The 32-bit integer read from the input Uint8Array. - -#### Defined in - -[packages/util/src/bytes.ts:488](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L488) - -___ - -### bytesToUnprefixedHex - -▸ **bytesToUnprefixedHex**(`bytes`): `string` - -**`Example`** - -```ts -bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' -``` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `bytes` | `Uint8Array` | - -#### Returns - -`string` - -#### Defined in - -node_modules/@noble/hashes/utils.d.ts:11 - -___ - -### bytesToUtf8 - -▸ **bytesToUtf8**(`data`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `data` | `Uint8Array` | - -#### Returns - -`string` - -#### Defined in - -node_modules/ethereum-cryptography/utils.d.ts:5 - -___ - -### calculateSigRecovery - -▸ **calculateSigRecovery**(`v`, `chainId?`): `bigint` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `v` | `bigint` | -| `chainId?` | `bigint` | - -#### Returns - -`bigint` - -#### Defined in - -[packages/util/src/signature.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L53) - -___ - -### commitmentsToVersionedHashes - -▸ **commitmentsToVersionedHashes**(`commitments`): `Uint8Array`[] - -Generate an array of versioned hashes from corresponding kzg commitments - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `commitments` | `Uint8Array`[] | array of kzg commitments | - -#### Returns - -`Uint8Array`[] - -array of versioned hashes -Note: assumes KZG commitments (version 1 version hashes) - -#### Defined in - -[packages/util/src/blobs.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L93) - -___ - -### compareBytes - -▸ **compareBytes**(`value1`, `value2`): `number` - -Compares two Uint8Arrays and returns a number indicating their order in a sorted array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value1` | `Uint8Array` | The first Uint8Array to compare. | -| `value2` | `Uint8Array` | The second Uint8Array to compare. | - -#### Returns - -`number` - -A positive number if value1 is larger than value2, - A negative number if value1 is smaller than value2, - or 0 if value1 and value2 are equal. - -#### Defined in - -[packages/util/src/bytes.ts:446](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L446) - -___ - -### computeVersionedHash - -▸ **computeVersionedHash**(`commitment`, `blobCommitmentVersion`): `Uint8Array` - -Converts a vector commitment for a given data blob to its versioned hash. For 4844, this version -number will be 0x01 for KZG vector commitments but could be different if future vector commitment -types are introduced - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `commitment` | `Uint8Array` | a vector commitment to a blob | -| `blobCommitmentVersion` | `number` | the version number corresponding to the type of vector commitment | - -#### Returns - -`Uint8Array` - -a versioned hash corresponding to a given blob vector commitment - -#### Defined in - -[packages/util/src/blobs.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L80) - -___ - -### concatBytes - -▸ **concatBytes**(...`arrays`): `Uint8Array` - -This mirrors the functionality of the `ethereum-cryptography` export except -it skips the check to validate that every element of `arrays` is indead a `uint8Array` -Can give small performance gains on large arrays - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...arrays` | `Uint8Array`[] | an array of Uint8Arrays | - -#### Returns - -`Uint8Array` - -one Uint8Array with all the elements of the original set -works like `Buffer.concat` - -#### Defined in - -[packages/util/src/bytes.ts:470](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L470) - -___ - -### ecrecover - -▸ **ecrecover**(`msgHash`, `v`, `r`, `s`, `chainId?`): `Uint8Array` - -ECDSA public key recovery from signature. -NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `msgHash` | `Uint8Array` | -| `v` | `bigint` | -| `r` | `Uint8Array` | -| `s` | `Uint8Array` | -| `chainId?` | `bigint` | - -#### Returns - -`Uint8Array` - -Recovered public key - -#### Defined in - -[packages/util/src/signature.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L71) - -___ - -### ecsign - -▸ **ecsign**(`msgHash`, `privateKey`, `chainId?`): [`ECDSASignature`](interfaces/ECDSASignature.md) - -Returns the ECDSA signature of a message hash. - -If `chainId` is provided assume an EIP-155-style signature and calculate the `v` value -accordingly, otherwise return a "static" `v` just derived from the `recovery` bit - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `msgHash` | `Uint8Array` | -| `privateKey` | `Uint8Array` | -| `chainId?` | `bigint` | - -#### Returns - -[`ECDSASignature`](interfaces/ECDSASignature.md) - -#### Defined in - -[packages/util/src/signature.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L35) - -___ - -### equalsBytes - -▸ **equalsBytes**(`a`, `b`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `a` | `Uint8Array` | -| `b` | `Uint8Array` | - -#### Returns - -`boolean` - -#### Defined in - -node_modules/ethereum-cryptography/utils.d.ts:7 - -___ - -### fetchFromProvider - -▸ **fetchFromProvider**(`url`, `params`): `Promise`<`any`\> - -Makes a simple RPC call to a remote Ethereum JSON-RPC provider and passes through the response. -No parameter or response validation is done. - -**`Example`** - -```ts -const provider = 'https://mainnet.infura.io/v3/...' -const params = { - method: 'eth_getBlockByNumber', - params: ['latest', false], -} - const block = await fetchFromProvider(provider, params) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `url` | `string` | the URL for the JSON RPC provider | -| `params` | `rpcParams` | the parameters for the JSON-RPC method - refer to https://ethereum.org/en/developers/docs/apis/json-rpc/ for details on RPC methods | - -#### Returns - -`Promise`<`any`\> - -the `result` field from the JSON-RPC response - -#### Defined in - -[packages/util/src/provider.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L23) - -___ - -### formatBigDecimal - -▸ **formatBigDecimal**(`numerator`, `denominator`, `maxDecimalFactor`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `numerator` | `bigint` | -| `denominator` | `bigint` | -| `maxDecimalFactor` | `bigint` | - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/units.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L5) - -___ - -### fromAscii - -▸ **fromAscii**(`stringValue`): `string` - -Should be called to get hex representation (prefixed by 0x) of ascii string - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stringValue` | `string` | - -#### Returns - -`string` - -hex representation of input string - -#### Defined in - -[packages/util/src/internal.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L152) - -___ - -### fromRpcSig - -▸ **fromRpcSig**(`sig`): [`ECDSASignature`](interfaces/ECDSASignature.md) - -Convert signature format of the `eth_sign` RPC method to signature parameters - -NOTE: For an extracted `v` value < 27 (see Geth bug https://github.com/ethereum/go-ethereum/issues/2053) -`v + 27` is returned for the `v` value -NOTE: After EIP1559, `v` could be `0` or `1` but this function assumes -it's a signed message (EIP-191 or EIP-712) adding `27` at the end. Remove if needed. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `sig` | `string` | - -#### Returns - -[`ECDSASignature`](interfaces/ECDSASignature.md) - -#### Defined in - -[packages/util/src/signature.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L142) - -___ - -### fromSigned - -▸ **fromSigned**(`num`): `bigint` - -Interprets a `Uint8Array` as a signed integer and returns a `BigInt`. Assumes 256-bit numbers. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `num` | `Uint8Array` | Signed integer value | - -#### Returns - -`bigint` - -#### Defined in - -[packages/util/src/bytes.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L329) - -___ - -### fromUtf8 - -▸ **fromUtf8**(`stringValue`): `string` - -Should be called to get hex representation (prefixed by 0x) of utf8 string. -Strips leading and trailing 0's. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stringValue` | `string` | - -#### Returns - -`string` - -hex representation of input string - -#### Defined in - -[packages/util/src/internal.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L139) - -___ - -### generateAddress - -▸ **generateAddress**(`from`, `nonce`): `Uint8Array` - -Generates an address of a newly created contract. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `from` | `Uint8Array` | The address which is creating this new address | -| `nonce` | `Uint8Array` | The nonce of the from account | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/account.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L207) - -___ - -### generateAddress2 - -▸ **generateAddress2**(`from`, `salt`, `initCode`): `Uint8Array` - -Generates an address for a contract created using CREATE2. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `from` | `Uint8Array` | The address which is creating this new address | -| `salt` | `Uint8Array` | A salt | -| `initCode` | `Uint8Array` | The init code of the contract being created | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/account.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L227) - -___ - -### getBinarySize - -▸ **getBinarySize**(`str`): `number` - -Get the binary size of a string - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `str` | `string` | - -#### Returns - -`number` - -the number of bytes contained within the string - -#### Defined in - -[packages/util/src/internal.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L75) - -___ - -### getBlobs - -▸ **getBlobs**(`input`): `Uint8Array`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `input` | `string` | - -#### Returns - -`Uint8Array`[] - -#### Defined in - -[packages/util/src/blobs.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L34) - -___ - -### getKeys - -▸ **getKeys**(`params`, `key`, `allowEmpty?`): `string`[] - -Returns the keys from an array of objects. - -**`Example`** - -```js -getKeys([{a: '1', b: '2'}, {a: '3', b: '4'}], 'a') => ['1', '3'] -```` -@param params -@param key -@param allowEmpty -@returns output just a simple array of output keys - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `params` | `Record`<`string`, `string`\>[] | -| `key` | `string` | -| `allowEmpty?` | `boolean` | - -#### Returns - -`string`[] - -#### Defined in - -[packages/util/src/internal.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L174) - -___ - -### getProvider - -▸ **getProvider**(`provider`): `string` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `provider` | `string` \| [`EthersProvider`](interfaces/EthersProvider.md) | a URL string or [EthersProvider](interfaces/EthersProvider.md) | - -#### Returns - -`string` - -the extracted URL string for the JSON-RPC Provider - -#### Defined in - -[packages/util/src/provider.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L63) - -___ - -### hashPersonalMessage - -▸ **hashPersonalMessage**(`message`): `Uint8Array` - -Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call. -The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign` -call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key -used to produce the signature. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `message` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/signature.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L219) - -___ - -### hexToBytes - -▸ **hexToBytes**(`hex`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hex` | `string` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L110) - -___ - -### importPublic - -▸ **importPublic**(`publicKey`): `Uint8Array` - -Converts a public key to the Ethereum format. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `publicKey` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/account.ts:326](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L326) - -___ - -### initKZG - -▸ **initKZG**(`kzgLib`, `trustedSetupPath?`): `void` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `kzgLib` | [`Kzg`](interfaces/Kzg.md) | a KZG implementation (defaults to c-kzg) | -| `trustedSetupPath?` | `string` | the full path (e.g. "/home/linux/devnet4.txt") to a kzg trusted setup text file | - -#### Returns - -`void` - -#### Defined in - -[packages/util/src/kzg.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L38) - -___ - -### int32ToBytes - -▸ **int32ToBytes**(`value`, `littleEndian?`): `Uint8Array` - -**`Notice`** - -Convert a 32-bit integer to a Uint8Array. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `value` | `number` | `undefined` | The 32-bit integer to convert. | -| `littleEndian` | `boolean` | `false` | True for little-endian, undefined or false for big-endian. | - -#### Returns - -`Uint8Array` - -A Uint8Array of length 4 containing the integer. - -#### Defined in - -[packages/util/src/bytes.ts:516](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L516) - -___ - -### intToBytes - -▸ **intToBytes**(`i`): `Uint8Array` - -Converts an number to a Uint8Array - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `i` | `number` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L146) - -___ - -### intToHex - -▸ **intToHex**(`i`): `string` - -Converts a number into a [PrefixedHexString](README.md#prefixedhexstring) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `i` | `number` | - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/bytes.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L134) - -___ - -### intToUnpaddedBytes - -▸ **intToUnpaddedBytes**(`value`): `Uint8Array` - -Convert value from number to an unpadded Uint8Array -(useful for RLP transport) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `number` | the bigint to convert | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:433](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L433) - -___ - -### isHexPrefixed - -▸ **isHexPrefixed**(`str`): `boolean` - -Returns a `Boolean` on whether or not the a `String` starts with '0x' - -**`Throws`** - -if the str input is not a string - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `str` | `string` | the string input value | - -#### Returns - -`boolean` - -a boolean if it is or is not hex prefixed - -#### Defined in - -[packages/util/src/internal.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L33) - -___ - -### isHexString - -▸ **isHexString**(`value`, `length?`): `boolean` - -Is the string a hex string. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | -| `length?` | `number` | - -#### Returns - -`boolean` - -output the string is a hex string - -#### Defined in - -[packages/util/src/internal.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L206) - -___ - -### isValidAddress - -▸ **isValidAddress**(`hexAddress`): `boolean` - -Checks if the address is a valid. Accepts checksummed addresses too. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hexAddress` | `string` | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/account.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L140) - -___ - -### isValidChecksumAddress - -▸ **isValidChecksumAddress**(`hexAddress`, `eip1191ChainId?`): `boolean` - -Checks if the address is a valid checksummed address. - -See toChecksumAddress' documentation for details about the eip1191ChainId parameter. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hexAddress` | `string` | -| `eip1191ChainId?` | [`BigIntLike`](README.md#bigintlike) | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/account.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L195) - -___ - -### isValidPrivate - -▸ **isValidPrivate**(`privateKey`): `boolean` - -Checks if the private key satisfies the rules of the curve secp256k1. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/account.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L251) - -___ - -### isValidPublic - -▸ **isValidPublic**(`publicKey`, `sanitize?`): `boolean` - -Checks if the public key satisfies the rules of the curve secp256k1 -and the requirements of Ethereum. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `publicKey` | `Uint8Array` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | -| `sanitize` | `boolean` | `false` | Accept public keys in other formats | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/account.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L261) - -___ - -### isValidSignature - -▸ **isValidSignature**(`v`, `r`, `s`, `homesteadOrLater?`, `chainId?`): `boolean` - -Validate a ECDSA signature. -NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `v` | `bigint` | `undefined` | - | -| `r` | `Uint8Array` | `undefined` | - | -| `s` | `Uint8Array` | `undefined` | - | -| `homesteadOrLater` | `boolean` | `true` | Indicates whether this is being used on either the homestead hardfork or a later one | -| `chainId?` | `bigint` | `undefined` | - | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/signature.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L179) - -___ - -### isZeroAddress - -▸ **isZeroAddress**(`hexAddress`): `boolean` - -Checks if a given address is the zero address. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hexAddress` | `string` | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/account.ts:346](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L346) - -___ - -### padToEven - -▸ **padToEven**(`value`): `string` - -Pads a `String` to have an even length - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`string` - -output - -#### Defined in - -[packages/util/src/internal.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L58) - -___ - -### parseGethGenesisState - -▸ **parseGethGenesisState**(`json`): [`GenesisState`](interfaces/GenesisState.md) - -Parses the geth genesis state into Blockchain [GenesisState](interfaces/GenesisState.md) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `json` | `any` | representing the `alloc` key in a Geth genesis file | - -#### Returns - -[`GenesisState`](interfaces/GenesisState.md) - -#### Defined in - -[packages/util/src/genesis.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/genesis.ts#L47) - -___ - -### privateToAddress - -▸ **privateToAddress**(`privateKey`): `Uint8Array` - -Returns the ethereum address of a given private key. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `privateKey` | `Uint8Array` | A private key must be 256 bits wide | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/account.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L319) - -___ - -### privateToPublic - -▸ **privateToPublic**(`privateKey`): `Uint8Array` - -Returns the ethereum public key of a given private key. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `privateKey` | `Uint8Array` | A private key must be 256 bits wide | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/account.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L309) - -___ - -### pubToAddress - -▸ **pubToAddress**(`pubKey`, `sanitize?`): `Uint8Array` - -Returns the ethereum address of a given public key. -Accepts "Ethereum public keys" and SEC1 encoded keys. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `pubKey` | `Uint8Array` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | -| `sanitize` | `boolean` | `false` | Accept public keys in other formats | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/account.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L292) - -___ - -### publicToAddress - -▸ **publicToAddress**(`pubKey`, `sanitize?`): `Uint8Array` - -Returns the ethereum address of a given public key. -Accepts "Ethereum public keys" and SEC1 encoded keys. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `pubKey` | `Uint8Array` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | -| `sanitize` | `boolean` | `false` | Accept public keys in other formats | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/account.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L292) - -___ - -### randomBytes - -▸ **randomBytes**(`length`): `Uint8Array` - -Generates a Uint8Array of random bytes of specified length. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `length` | `number` | The length of the Uint8Array. | - -#### Returns - -`Uint8Array` - -A Uint8Array of random bytes of specified length. - -#### Defined in - -[packages/util/src/bytes.ts:458](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L458) - -___ - -### setLengthLeft - -▸ **setLengthLeft**(`msg`, `length`): `Uint8Array` - -Left Pads a `Uint8Array` with leading zeros till it has `length` bytes. -Or it truncates the beginning if it exceeds. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `msg` | `Uint8Array` | the value to pad | -| `length` | `number` | the number of bytes the output should be | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L201) - -___ - -### setLengthRight - -▸ **setLengthRight**(`msg`, `length`): `Uint8Array` - -Right Pads a `Uint8Array` with trailing zeros till it has `length` bytes. -it truncates the end if it exceeds. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `msg` | `Uint8Array` | the value to pad | -| `length` | `number` | the number of bytes the output should be | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L213) - -___ - -### short - -▸ **short**(`bytes`, `maxLength?`): `string` - -Shortens a string or Uint8Array's hex string representation to maxLength (default 50). - -Examples: - -Input: '657468657265756d000000000000000000000000000000000000000000000000' -Output: '657468657265756d0000000000000000000000000000000000…' - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `bytes` | `string` \| `Uint8Array` | `undefined` | -| `maxLength` | `number` | `50` | - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/bytes.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L366) - -___ - -### stripHexPrefix - -▸ **stripHexPrefix**(`str`): `string` - -Removes '0x' from a given `String` if present - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `str` | `string` | the string value | - -#### Returns - -`string` - -the string without 0x prefix - -#### Defined in - -[packages/util/src/internal.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L46) - -___ - -### toAscii - -▸ **toAscii**(`hex`): `string` - -Should be called to get ascii from its hex representation - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hex` | `string` | - -#### Returns - -`string` - -ascii string representation of hex value - -#### Defined in - -[packages/util/src/internal.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L116) - -___ - -### toBytes - -▸ **toBytes**(`v`): `Uint8Array` - -Attempts to turn a value into a `Uint8Array`. -Inputs supported: `Buffer`, `Uint8Array`, `String` (hex-prefixed), `Number`, null/undefined, `BigInt` and other objects -with a `toArray()` or `toBytes()` method. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `v` | [`ToBytesInputTypes`](README.md#tobytesinputtypes) | the value | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L285) - -___ - -### toChecksumAddress - -▸ **toChecksumAddress**(`hexAddress`, `eip1191ChainId?`): `string` - -Returns a checksummed address. - -If an eip1191ChainId is provided, the chainId will be included in the checksum calculation. This -has the effect of checksummed addresses for one chain having invalid checksums for others. -For more details see [EIP-1191](https://eips.ethereum.org/EIPS/eip-1191). - -WARNING: Checksums with and without the chainId will differ and the EIP-1191 checksum is not -backwards compatible to the original widely adopted checksum format standard introduced in -[EIP-55](https://eips.ethereum.org/EIPS/eip-55), so this will break in existing applications. -Usage of this EIP is therefore discouraged unless you have a very targeted use case. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `hexAddress` | `string` | -| `eip1191ChainId?` | [`BigIntLike`](README.md#bigintlike) | - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/account.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L162) - -___ - -### toCompactSig - -▸ **toCompactSig**(`v`, `r`, `s`, `chainId?`): `string` - -Convert signature parameters into the format of Compact Signature Representation (EIP-2098). -NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `v` | `bigint` | -| `r` | `Uint8Array` | -| `s` | `Uint8Array` | -| `chainId?` | `bigint` | - -#### Returns - -`string` - -Signature - -#### Defined in - -[packages/util/src/signature.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L115) - -___ - -### toRpcSig - -▸ **toRpcSig**(`v`, `r`, `s`, `chainId?`): `string` - -Convert signature parameters into the format of `eth_sign` RPC method. -NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `v` | `bigint` | -| `r` | `Uint8Array` | -| `s` | `Uint8Array` | -| `chainId?` | `bigint` | - -#### Returns - -`string` - -Signature - -#### Defined in - -[packages/util/src/signature.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L94) - -___ - -### toType - -▸ **toType**<`T`\>(`input`, `outputType`): ``null`` - -Convert an input to a specified type. -Input of null/undefined returns null/undefined regardless of the output type. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TypeOutput`](enums/TypeOutput.md) | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `input` | ``null`` | value to convert | -| `outputType` | `T` | type to output | - -#### Returns - -``null`` - -#### Defined in - -[packages/util/src/types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L62) - -▸ **toType**<`T`\>(`input`, `outputType`): `undefined` - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TypeOutput`](enums/TypeOutput.md) | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `input` | `undefined` | -| `outputType` | `T` | - -#### Returns - -`undefined` - -#### Defined in - -[packages/util/src/types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L63) - -▸ **toType**<`T`\>(`input`, `outputType`): [`TypeOutputReturnType`](README.md#typeoutputreturntype)[`T`] - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`TypeOutput`](enums/TypeOutput.md) | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `input` | [`ToBytesInputTypes`](README.md#tobytesinputtypes) | -| `outputType` | `T` | - -#### Returns - -[`TypeOutputReturnType`](README.md#typeoutputreturntype)[`T`] - -#### Defined in - -[packages/util/src/types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L64) - -___ - -### toUnsigned - -▸ **toUnsigned**(`num`): `Uint8Array` - -Converts a `BigInt` to an unsigned integer and returns it as a `Uint8Array`. Assumes 256-bit numbers. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `num` | `bigint` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:338](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L338) - -___ - -### unpadArray - -▸ **unpadArray**(`a`): `number`[] - -Trims leading zeros from an `Array` (of numbers). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `a` | `number`[] | - -#### Returns - -`number`[] - -#### Defined in - -[packages/util/src/bytes.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L251) - -___ - -### unpadBytes - -▸ **unpadBytes**(`a`): `Uint8Array` - -Trims leading zeros from a `Uint8Array`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `a` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L241) - -___ - -### unpadHex - -▸ **unpadHex**(`a`): `string` - -Trims leading zeros from a `PrefixedHexString`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `a` | `string` | - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/bytes.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L261) - -___ - -### unprefixedHexToBytes - -▸ **unprefixedHexToBytes**(`inp`): `Uint8Array` - -**`Deprecated`** - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `inp` | `string` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L48) - -___ - -### utf8ToBytes - -▸ **utf8ToBytes**(`str`): `Uint8Array` - -**`Example`** - -```ts -utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) -``` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `str` | `string` | - -#### Returns - -`Uint8Array` - -#### Defined in - -node_modules/@noble/hashes/utils.d.ts:21 - -___ - -### validateNoLeadingZeroes - -▸ **validateNoLeadingZeroes**(`values`): `void` - -Checks provided Uint8Array for leading zeroes and throws if found. - -Examples: - -Valid values: 0x1, 0x, 0x01, 0x1234 -Invalid values: 0x0, 0x00, 0x001, 0x0001 - -Note: This method is useful for validating that RLP encoded integers comply with the rule that all -integer values encoded to RLP must be in the most compact form and contain no leading zero bytes - -**`Throws`** - -if any provided value is found to have leading zero bytes - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `values` | `Object` | An object containing string keys and Uint8Array values | - -#### Returns - -`void` - -#### Defined in - -[packages/util/src/bytes.ts:388](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L388) - -___ - -### zeroAddress - -▸ **zeroAddress**(): `string` - -Returns the zero address. - -#### Returns - -`string` - -#### Defined in - -[packages/util/src/account.ts:337](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L337) - -___ - -### zeros - -▸ **zeros**(`bytes`): `Uint8Array` - -Returns a Uint8Array filled with 0s. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `bytes` | `number` | the number of bytes of the Uint8Array | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/bytes.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L168) +- [accountBodyFromSlim](functions/accountBodyFromSlim.md) +- [accountBodyToRLP](functions/accountBodyToRLP.md) +- [accountBodyToSlim](functions/accountBodyToSlim.md) +- [addHexPrefix](functions/addHexPrefix.md) +- [arrayContainsArray](functions/arrayContainsArray.md) +- [bigInt64ToBytes](functions/bigInt64ToBytes.md) +- [bigIntMax](functions/bigIntMax.md) +- [bigIntMin](functions/bigIntMin.md) +- [bigIntToAddressBytes](functions/bigIntToAddressBytes.md) +- [bigIntToBytes](functions/bigIntToBytes.md) +- [bigIntToHex](functions/bigIntToHex.md) +- [bigIntToUnpaddedBytes](functions/bigIntToUnpaddedBytes.md) +- [bitsToBytes](functions/bitsToBytes.md) +- [blobsToCommitments](functions/blobsToCommitments.md) +- [blobsToProofs](functions/blobsToProofs.md) +- [bytesToBigInt](functions/bytesToBigInt.md) +- [bytesToBigInt64](functions/bytesToBigInt64.md) +- [bytesToBits](functions/bytesToBits.md) +- [bytesToHex](functions/bytesToHex.md) +- [bytesToInt](functions/bytesToInt.md) +- [bytesToInt32](functions/bytesToInt32.md) +- [bytesToUtf8](functions/bytesToUtf8.md) +- [calculateSigRecovery](functions/calculateSigRecovery.md) +- [chunkifyBinaryTreeCode](functions/chunkifyBinaryTreeCode.md) +- [chunkifyCode](functions/chunkifyCode.md) +- [commitmentsToVersionedHashes](functions/commitmentsToVersionedHashes.md) +- [compareBytes](functions/compareBytes.md) +- [computeVersionedHash](functions/computeVersionedHash.md) +- [concatBytes](functions/concatBytes.md) +- [createAccount](functions/createAccount.md) +- [createAccountFromBytesArray](functions/createAccountFromBytesArray.md) +- [createAccountFromRLP](functions/createAccountFromRLP.md) +- [createAddressFromBigInt](functions/createAddressFromBigInt.md) +- [createAddressFromPrivateKey](functions/createAddressFromPrivateKey.md) +- [createAddressFromPublicKey](functions/createAddressFromPublicKey.md) +- [createAddressFromString](functions/createAddressFromString.md) +- [createCLRequest](functions/createCLRequest.md) +- [createContractAddress](functions/createContractAddress.md) +- [createContractAddress2](functions/createContractAddress2.md) +- [createPartialAccount](functions/createPartialAccount.md) +- [createPartialAccountFromRLP](functions/createPartialAccountFromRLP.md) +- [createWithdrawal](functions/createWithdrawal.md) +- [createWithdrawalFromBytesArray](functions/createWithdrawalFromBytesArray.md) +- [createZeroAddress](functions/createZeroAddress.md) +- [decodeBinaryTreeLeafBasicData](functions/decodeBinaryTreeLeafBasicData.md) +- [decodeVerkleLeafBasicData](functions/decodeVerkleLeafBasicData.md) +- [ecrecover](functions/ecrecover.md) +- [encodeBinaryTreeLeafBasicData](functions/encodeBinaryTreeLeafBasicData.md) +- [encodeVerkleLeafBasicData](functions/encodeVerkleLeafBasicData.md) +- [equalsBits](functions/equalsBits.md) +- [equalsBytes](functions/equalsBytes.md) +- [~~EthereumJSErrorWithoutCode~~](functions/EthereumJSErrorWithoutCode.md) +- [fetchFromProvider](functions/fetchFromProvider.md) +- [formatBigDecimal](functions/formatBigDecimal.md) +- [fromAscii](functions/fromAscii.md) +- [fromRPCSig](functions/fromRPCSig.md) +- [fromSigned](functions/fromSigned.md) +- [fromUtf8](functions/fromUtf8.md) +- [generateAddress](functions/generateAddress.md) +- [generateAddress2](functions/generateAddress2.md) +- [generateBinaryTreeChunkSuffixes](functions/generateBinaryTreeChunkSuffixes.md) +- [generateBinaryTreeCodeStems](functions/generateBinaryTreeCodeStems.md) +- [generateChunkSuffixes](functions/generateChunkSuffixes.md) +- [generateCodeStems](functions/generateCodeStems.md) +- [getBinarySize](functions/getBinarySize.md) +- [getBinaryTreeIndicesForCodeChunk](functions/getBinaryTreeIndicesForCodeChunk.md) +- [getBinaryTreeIndicesForStorageSlot](functions/getBinaryTreeIndicesForStorageSlot.md) +- [getBinaryTreeKey](functions/getBinaryTreeKey.md) +- [getBinaryTreeKeyForCodeChunk](functions/getBinaryTreeKeyForCodeChunk.md) +- [getBinaryTreeKeyForStorageSlot](functions/getBinaryTreeKeyForStorageSlot.md) +- [getBinaryTreeStem](functions/getBinaryTreeStem.md) +- [getBlobs](functions/getBlobs.md) +- [getKeys](functions/getKeys.md) +- [getProvider](functions/getProvider.md) +- [getVerkleKey](functions/getVerkleKey.md) +- [getVerkleStem](functions/getVerkleStem.md) +- [getVerkleTreeIndicesForCodeChunk](functions/getVerkleTreeIndicesForCodeChunk.md) +- [getVerkleTreeIndicesForStorageSlot](functions/getVerkleTreeIndicesForStorageSlot.md) +- [getVerkleTreeKeyForCodeChunk](functions/getVerkleTreeKeyForCodeChunk.md) +- [getVerkleTreeKeyForStorageSlot](functions/getVerkleTreeKeyForStorageSlot.md) +- [hashPersonalMessage](functions/hashPersonalMessage.md) +- [hexToBigInt](functions/hexToBigInt.md) +- [hexToBytes](functions/hexToBytes.md) +- [importPublic](functions/importPublic.md) +- [int32ToBytes](functions/int32ToBytes.md) +- [intToBytes](functions/intToBytes.md) +- [intToHex](functions/intToHex.md) +- [intToUnpaddedBytes](functions/intToUnpaddedBytes.md) +- [isHexString](functions/isHexString.md) +- [isNestedUint8Array](functions/isNestedUint8Array.md) +- [isValidAddress](functions/isValidAddress.md) +- [isValidChecksumAddress](functions/isValidChecksumAddress.md) +- [isValidPrivate](functions/isValidPrivate.md) +- [isValidPublic](functions/isValidPublic.md) +- [isValidSignature](functions/isValidSignature.md) +- [isZeroAddress](functions/isZeroAddress.md) +- [matchingBitsLength](functions/matchingBitsLength.md) +- [matchingBytesLength](functions/matchingBytesLength.md) +- [padToEven](functions/padToEven.md) +- [privateToAddress](functions/privateToAddress.md) +- [privateToPublic](functions/privateToPublic.md) +- [pubToAddress](functions/pubToAddress.md) +- [randomBytes](functions/randomBytes.md) +- [setLengthLeft](functions/setLengthLeft.md) +- [setLengthRight](functions/setLengthRight.md) +- [short](functions/short.md) +- [stripHexPrefix](functions/stripHexPrefix.md) +- [toAscii](functions/toAscii.md) +- [toBytes](functions/toBytes.md) +- [toChecksumAddress](functions/toChecksumAddress.md) +- [toCompactSig](functions/toCompactSig.md) +- [toRPCSig](functions/toRPCSig.md) +- [toType](functions/toType.md) +- [toUnsigned](functions/toUnsigned.md) +- [unpadArray](functions/unpadArray.md) +- [unpadBytes](functions/unpadBytes.md) +- [unpadHex](functions/unpadHex.md) +- [unprefixedHexToBytes](functions/unprefixedHexToBytes.md) +- [utf8ToBytes](functions/utf8ToBytes.md) +- [validateNoLeadingZeroes](functions/validateNoLeadingZeroes.md) +- [verifyVerkleProof](functions/verifyVerkleProof.md) +- [withdrawalToBytesArray](functions/withdrawalToBytesArray.md) +- [zeroAddress](functions/zeroAddress.md) diff --git a/packages/util/docs/classes/Account.md b/packages/util/docs/classes/Account.md index 00acd8322c2..4b72547a398 100644 --- a/packages/util/docs/classes/Account.md +++ b/packages/util/docs/classes/Account.md @@ -1,214 +1,361 @@ +[**@ethereumjs/util**](../README.md) + +*** + [@ethereumjs/util](../README.md) / Account # Class: Account -## Table of contents +Defined in: [packages/util/src/account.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L81) -### Constructors +Account class to load and maintain the basic account objects. +Supports partial loading and access required for verkle with null +as the placeholder. -- [constructor](Account.md#constructor) +Note: passing undefined in constructor is different from null +While undefined leads to default assignment, null is retained +to track the information not available/loaded because of partial +witness access -### Properties +## Constructors -- [balance](Account.md#balance) -- [codeHash](Account.md#codehash) -- [nonce](Account.md#nonce) -- [storageRoot](Account.md#storageroot) +### Constructor -### Methods +> **new Account**(`nonce`, `balance`, `storageRoot`, `codeHash`, `codeSize`, `version`): `Account` -- [isContract](Account.md#iscontract) -- [isEmpty](Account.md#isempty) -- [raw](Account.md#raw) -- [serialize](Account.md#serialize) -- [fromAccountData](Account.md#fromaccountdata) -- [fromRlpSerializedAccount](Account.md#fromrlpserializedaccount) -- [fromValuesArray](Account.md#fromvaluesarray) +Defined in: [packages/util/src/account.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L163) -## Constructors +This constructor assigns and validates the values. +It is not recommended to use this constructor directly. Instead use the static +factory methods to assist in creating an Account from varying data types. +undefined get assigned with the defaults, but null args are retained as is -### constructor +#### Parameters -• **new Account**(`nonce?`, `balance?`, `storageRoot?`, `codeHash?`) +##### nonce -This constructor assigns and validates the values. -Use the static factory methods to assist in creating an Account from varying data types. +`null` | `bigint` -#### Parameters +##### balance -| Name | Type | Default value | -| :------ | :------ | :------ | -| `nonce` | `bigint` | `BIGINT_0` | -| `balance` | `bigint` | `BIGINT_0` | -| `storageRoot` | `Uint8Array` | `KECCAK256_RLP` | -| `codeHash` | `Uint8Array` | `KECCAK256_NULL` | +`null` | `bigint` -#### Defined in +##### storageRoot -[packages/util/src/account.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L68) +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +##### codeHash + +`null` | `Uint8Array`\<`ArrayBufferLike`\> + +##### codeSize + +`null` | `number` + +##### version + +`null` | `number` + +#### Returns + +`Account` + +#### Deprecated ## Properties +### \_balance + +> **\_balance**: `null` \| `bigint` = `null` + +Defined in: [packages/util/src/account.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L83) + +*** + +### \_codeHash + +> **\_codeHash**: `null` \| `Uint8Array`\<`ArrayBufferLike`\> = `null` + +Defined in: [packages/util/src/account.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L85) + +*** + +### \_codeSize + +> **\_codeSize**: `null` \| `number` = `null` + +Defined in: [packages/util/src/account.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L87) + +*** + +### \_nonce + +> **\_nonce**: `null` \| `bigint` = `null` + +Defined in: [packages/util/src/account.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L82) + +*** + +### \_storageRoot + +> **\_storageRoot**: `null` \| `Uint8Array`\<`ArrayBufferLike`\> = `null` + +Defined in: [packages/util/src/account.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L84) + +*** + +### \_version + +> **\_version**: `null` \| `number` = `null` + +Defined in: [packages/util/src/account.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L88) + +## Accessors + ### balance -• **balance**: `bigint` +#### Get Signature + +> **get** **balance**(): `bigint` + +Defined in: [packages/util/src/account.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L112) + +##### Returns + +`bigint` + +#### Set Signature -#### Defined in +> **set** **balance**(`_balance`): `void` -[packages/util/src/account.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L33) +Defined in: [packages/util/src/account.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L119) -___ +##### Parameters + +###### \_balance + +`bigint` + +##### Returns + +`void` + +*** ### codeHash -• **codeHash**: `Uint8Array` +#### Get Signature -#### Defined in +> **get** **codeHash**(): `Uint8Array`\<`ArrayBufferLike`\> -[packages/util/src/account.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L35) +Defined in: [packages/util/src/account.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L134) -___ +##### Returns -### nonce +`Uint8Array`\<`ArrayBufferLike`\> -• **nonce**: `bigint` +#### Set Signature -#### Defined in +> **set** **codeHash**(`_codeHash`): `void` -[packages/util/src/account.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L32) +Defined in: [packages/util/src/account.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L141) -___ +##### Parameters -### storageRoot +###### \_codeHash -• **storageRoot**: `Uint8Array` +`Uint8Array` -#### Defined in +##### Returns -[packages/util/src/account.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L34) +`void` -## Methods +*** -### isContract +### codeSize -▸ **isContract**(): `boolean` +#### Get Signature -Returns a `Boolean` determining if the account is a contract. +> **get** **codeSize**(): `number` -#### Returns +Defined in: [packages/util/src/account.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L145) -`boolean` +##### Returns -#### Defined in +`number` -[packages/util/src/account.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L119) +#### Set Signature -___ +> **set** **codeSize**(`_codeSize`): `void` -### isEmpty +Defined in: [packages/util/src/account.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L152) -▸ **isEmpty**(): `boolean` +##### Parameters -Returns a `Boolean` determining if the account is empty complying to the definition of -account emptiness in [EIP-161](https://eips.ethereum.org/EIPS/eip-161): -"An account is considered empty when it has no code and zero nonce and zero balance." +###### \_codeSize -#### Returns +`number` -`boolean` +##### Returns -#### Defined in +`void` -[packages/util/src/account.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L128) +*** -___ +### nonce -### raw +#### Get Signature -▸ **raw**(): `Uint8Array`[] +> **get** **nonce**(): `bigint` -Returns an array of Uint8Arrays of the raw bytes for the account, in order. +Defined in: [packages/util/src/account.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L101) -#### Returns +##### Returns -`Uint8Array`[] +`bigint` -#### Defined in +#### Set Signature -[packages/util/src/account.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L100) +> **set** **nonce**(`_nonce`): `void` -___ +Defined in: [packages/util/src/account.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L108) -### serialize +##### Parameters -▸ **serialize**(): `Uint8Array` +###### \_nonce -Returns the RLP serialization of the account as a `Uint8Array`. +`bigint` -#### Returns +##### Returns + +`void` + +*** + +### storageRoot + +#### Get Signature + +> **get** **storageRoot**(): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/account.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L123) + +##### Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +#### Set Signature + +> **set** **storageRoot**(`_storageRoot`): `void` + +Defined in: [packages/util/src/account.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L130) + +##### Parameters + +###### \_storageRoot `Uint8Array` -#### Defined in +##### Returns -[packages/util/src/account.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L112) +`void` -___ +*** -### fromAccountData +### version -▸ `Static` **fromAccountData**(`accountData`): [`Account`](Account.md) +#### Get Signature -#### Parameters +> **get** **version**(): `number` -| Name | Type | -| :------ | :------ | -| `accountData` | [`AccountData`](../interfaces/AccountData.md) | +Defined in: [packages/util/src/account.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L90) -#### Returns +##### Returns -[`Account`](Account.md) +`number` -#### Defined in +#### Set Signature -[packages/util/src/account.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L37) +> **set** **version**(`_version`): `void` -___ +Defined in: [packages/util/src/account.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L97) -### fromRlpSerializedAccount +##### Parameters -▸ `Static` **fromRlpSerializedAccount**(`serialized`): [`Account`](Account.md) +###### \_version -#### Parameters +`number` -| Name | Type | -| :------ | :------ | -| `serialized` | `Uint8Array` | +##### Returns + +`void` + +## Methods + +### isContract() + +> **isContract**(): `boolean` + +Defined in: [packages/util/src/account.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L269) + +Returns a `Boolean` determining if the account is a contract. #### Returns -[`Account`](Account.md) +`boolean` + +*** -#### Defined in +### isEmpty() -[packages/util/src/account.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L48) +> **isEmpty**(): `boolean` -___ +Defined in: [packages/util/src/account.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L284) -### fromValuesArray +Returns a `Boolean` determining if the account is empty complying to the definition of +account emptiness in [EIP-161](https://eips.ethereum.org/EIPS/eip-161): +"An account is considered empty when it has no code and zero nonce and zero balance." -▸ `Static` **fromValuesArray**(`values`): [`Account`](Account.md) +#### Returns -#### Parameters +`boolean` + +*** + +### raw() + +> **raw**(): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [packages/util/src/account.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L206) + +Returns an array of Uint8Arrays of the raw bytes for the account, in order. -| Name | Type | -| :------ | :------ | -| `values` | `Uint8Array`[] | +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [packages/util/src/account.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L218) + +Returns the RLP serialization of the account as a `Uint8Array`. #### Returns -[`Account`](Account.md) +`Uint8Array` + +*** + +### serializeWithPartialInfo() + +> **serializeWithPartialInfo**(): `Uint8Array` -#### Defined in +Defined in: [packages/util/src/account.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L222) -[packages/util/src/account.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L58) +#### Returns + +`Uint8Array` diff --git a/packages/util/docs/classes/Address.md b/packages/util/docs/classes/Address.md index a50735c78cd..0af76067f62 100644 --- a/packages/util/docs/classes/Address.md +++ b/packages/util/docs/classes/Address.md @@ -1,86 +1,68 @@ -[@ethereumjs/util](../README.md) / Address - -# Class: Address - -Handling and generating Ethereum addresses - -## Table of contents +[**@ethereumjs/util**](../README.md) -### Constructors +*** -- [constructor](Address.md#constructor) - -### Properties +[@ethereumjs/util](../README.md) / Address -- [bytes](Address.md#bytes) +# Class: Address -### Methods +Defined in: [packages/util/src/address.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L24) -- [equals](Address.md#equals) -- [isPrecompileOrSystemAddress](Address.md#isprecompileorsystemaddress) -- [isZero](Address.md#iszero) -- [toBytes](Address.md#tobytes) -- [toString](Address.md#tostring) -- [fromPrivateKey](Address.md#fromprivatekey) -- [fromPublicKey](Address.md#frompublickey) -- [fromString](Address.md#fromstring) -- [generate](Address.md#generate) -- [generate2](Address.md#generate2) -- [zero](Address.md#zero) +Handling and generating Ethereum addresses ## Constructors -### constructor +### Constructor + +> **new Address**(`bytes`): `Address` -• **new Address**(`bytes`) +Defined in: [packages/util/src/address.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L27) #### Parameters -| Name | Type | -| :------ | :------ | -| `bytes` | `Uint8Array` | +##### bytes -#### Defined in +`Uint8Array` -[packages/util/src/address.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L17) +#### Returns + +`Address` ## Properties ### bytes -• `Readonly` **bytes**: `Uint8Array` - -#### Defined in +> `readonly` **bytes**: `Uint8Array` -[packages/util/src/address.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L15) +Defined in: [packages/util/src/address.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L25) ## Methods -### equals +### equals() -▸ **equals**(`address`): `boolean` +> **equals**(`address`): `boolean` + +Defined in: [packages/util/src/address.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L37) Is address equal to another. #### Parameters -| Name | Type | -| :------ | :------ | -| `address` | [`Address`](Address.md) | +##### address + +`Address` #### Returns `boolean` -#### Defined in - -[packages/util/src/address.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L97) +*** -___ +### isPrecompileOrSystemAddress() -### isPrecompileOrSystemAddress +> **isPrecompileOrSystemAddress**(): `boolean` -▸ **isPrecompileOrSystemAddress**(): `boolean` +Defined in: [packages/util/src/address.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L52) True if address is in the address range defined by EIP-1352 @@ -89,15 +71,13 @@ by EIP-1352 `boolean` -#### Defined in +*** -[packages/util/src/address.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L112) +### isZero() -___ +> **isZero**(): `boolean` -### isZero - -▸ **isZero**(): `boolean` +Defined in: [packages/util/src/address.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L44) Is address zero. @@ -105,15 +85,13 @@ Is address zero. `boolean` -#### Defined in - -[packages/util/src/address.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L104) +*** -___ +### toBytes() -### toBytes +> **toBytes**(): `Uint8Array` -▸ **toBytes**(): `Uint8Array` +Defined in: [packages/util/src/address.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L69) Returns a new Uint8Array representation of address. @@ -121,151 +99,16 @@ Returns a new Uint8Array representation of address. `Uint8Array` -#### Defined in - -[packages/util/src/address.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L129) +*** -___ +### toString() -### toString +> **toString**(): `` `0x${string}` `` -▸ **toString**(): `string` +Defined in: [packages/util/src/address.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L62) Returns hex encoding of address. #### Returns -`string` - -#### Defined in - -[packages/util/src/address.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L122) - -___ - -### fromPrivateKey - -▸ `Static` **fromPrivateKey**(`privateKey`): [`Address`](Address.md) - -Returns an address for a given private key. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `privateKey` | `Uint8Array` | A private key must be 256 bits wide | - -#### Returns - -[`Address`](Address.md) - -#### Defined in - -[packages/util/src/address.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L58) - -___ - -### fromPublicKey - -▸ `Static` **fromPublicKey**(`pubKey`): [`Address`](Address.md) - -Returns an address for a given public key. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `pubKey` | `Uint8Array` | The two points of an uncompressed key | - -#### Returns - -[`Address`](Address.md) - -#### Defined in - -[packages/util/src/address.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L46) - -___ - -### fromString - -▸ `Static` **fromString**(`str`): [`Address`](Address.md) - -Returns an Address object from a hex-encoded string. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `str` | `string` | Hex-encoded address | - -#### Returns - -[`Address`](Address.md) - -#### Defined in - -[packages/util/src/address.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L35) - -___ - -### generate - -▸ `Static` **generate**(`from`, `nonce`): [`Address`](Address.md) - -Generates an address for a newly created contract. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `from` | [`Address`](Address.md) | The address which is creating this new address | -| `nonce` | `bigint` | The nonce of the from account | - -#### Returns - -[`Address`](Address.md) - -#### Defined in - -[packages/util/src/address.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L71) - -___ - -### generate2 - -▸ `Static` **generate2**(`from`, `salt`, `initCode`): [`Address`](Address.md) - -Generates an address for a contract created using CREATE2. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `from` | [`Address`](Address.md) | The address which is creating this new address | -| `salt` | `Uint8Array` | A salt | -| `initCode` | `Uint8Array` | The init code of the contract being created | - -#### Returns - -[`Address`](Address.md) - -#### Defined in - -[packages/util/src/address.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L84) - -___ - -### zero - -▸ `Static` **zero**(): [`Address`](Address.md) - -Returns the zero address. - -#### Returns - -[`Address`](Address.md) - -#### Defined in - -[packages/util/src/address.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L27) +`` `0x${string}` `` diff --git a/packages/util/docs/classes/AsyncEventEmitter.md b/packages/util/docs/classes/AsyncEventEmitter.md deleted file mode 100644 index 90cf0f5723f..00000000000 --- a/packages/util/docs/classes/AsyncEventEmitter.md +++ /dev/null @@ -1,1027 +0,0 @@ -[@ethereumjs/util](../README.md) / AsyncEventEmitter - -# Class: AsyncEventEmitter - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`EventMap`](../interfaces/EventMap.md) | - -## Hierarchy - -- `EventEmitter` - - ↳ **`AsyncEventEmitter`** - -## Table of contents - -### Constructors - -- [constructor](AsyncEventEmitter.md#constructor) - -### Properties - -- [captureRejectionSymbol](AsyncEventEmitter.md#capturerejectionsymbol) -- [captureRejections](AsyncEventEmitter.md#capturerejections) -- [defaultMaxListeners](AsyncEventEmitter.md#defaultmaxlisteners) -- [errorMonitor](AsyncEventEmitter.md#errormonitor) - -### Methods - -- [addListener](AsyncEventEmitter.md#addlistener) -- [after](AsyncEventEmitter.md#after) -- [before](AsyncEventEmitter.md#before) -- [emit](AsyncEventEmitter.md#emit) -- [eventNames](AsyncEventEmitter.md#eventnames) -- [first](AsyncEventEmitter.md#first) -- [getMaxListeners](AsyncEventEmitter.md#getmaxlisteners) -- [listenerCount](AsyncEventEmitter.md#listenercount) -- [listeners](AsyncEventEmitter.md#listeners) -- [off](AsyncEventEmitter.md#off) -- [on](AsyncEventEmitter.md#on) -- [once](AsyncEventEmitter.md#once) -- [prependListener](AsyncEventEmitter.md#prependlistener) -- [prependOnceListener](AsyncEventEmitter.md#prependoncelistener) -- [rawListeners](AsyncEventEmitter.md#rawlisteners) -- [removeAllListeners](AsyncEventEmitter.md#removealllisteners) -- [removeListener](AsyncEventEmitter.md#removelistener) -- [setMaxListeners](AsyncEventEmitter.md#setmaxlisteners) -- [getEventListeners](AsyncEventEmitter.md#geteventlisteners) -- [listenerCount](AsyncEventEmitter.md#listenercount-1) -- [on](AsyncEventEmitter.md#on-1) -- [once](AsyncEventEmitter.md#once-1) -- [setMaxListeners](AsyncEventEmitter.md#setmaxlisteners-1) - -## Constructors - -### constructor - -• **new AsyncEventEmitter**<`T`\>(`options?`) - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`EventMap`](../interfaces/EventMap.md) | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options?` | `EventEmitterOptions` | - -#### Inherited from - -EventEmitter.constructor - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:111 - -## Properties - -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](AsyncEventEmitter.md#capturerejectionsymbol) - -#### Inherited from - -EventEmitter.captureRejectionSymbol - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:328 - -___ - -### captureRejections - -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -EventEmitter.captureRejections - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:333 - -___ - -### defaultMaxListeners - -▪ `Static` **defaultMaxListeners**: `number` - -#### Inherited from - -EventEmitter.defaultMaxListeners - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:334 - -___ - -### errorMonitor - -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](AsyncEventEmitter.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. - -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. - -#### Inherited from - -EventEmitter.errorMonitor - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:327 - -## Methods - -### addListener - -▸ **addListener**<`E`\>(`event`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Overrides - -EventEmitter.addListener - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L173) - -___ - -### after - -▸ **after**<`E`\>(`event`, `target`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `target` | `T`[`E`] | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L127) - -___ - -### before - -▸ **before**<`E`\>(`event`, `target`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `target` | `T`[`E`] | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L123) - -___ - -### emit - -▸ **emit**<`E`\>(`event`, ...`args`): `boolean` - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `...args` | `Parameters`<`T`[`E`]\> | - -#### Returns - -`boolean` - -#### Overrides - -EventEmitter.emit - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L50) - -___ - -### eventNames - -▸ **eventNames**(): keyof `T` & `string`[] - -#### Returns - -keyof `T` & `string`[] - -#### Overrides - -EventEmitter.eventNames - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L193) - -___ - -### first - -▸ **first**<`E`\>(`event`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L105) - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -#### Returns - -`number` - -#### Overrides - -EventEmitter.getMaxListeners - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L205) - -___ - -### listenerCount - -▸ **listenerCount**(`event`): `number` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | keyof `T` & `string` | - -#### Returns - -`number` - -#### Overrides - -EventEmitter.listenerCount - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L201) - -___ - -### listeners - -▸ **listeners**<`E`\>(`event`): `T`[`E`][] - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | - -#### Returns - -`T`[`E`][] - -#### Overrides - -EventEmitter.listeners - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L197) - -___ - -### off - -▸ **off**(`eventName`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -Alias for `emitter.removeListener()`. - -**`Since`** - -v10.0.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Inherited from - -EventEmitter.off - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:499 - -___ - -### on - -▸ **on**<`E`\>(`event`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Overrides - -EventEmitter.on - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L169) - -___ - -### once - -▸ **once**<`E`\>(`event`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Overrides - -EventEmitter.once - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L79) - -___ - -### prependListener - -▸ **prependListener**<`E`\>(`event`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Overrides - -EventEmitter.prependListener - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L177) - -___ - -### prependOnceListener - -▸ **prependOnceListener**<`E`\>(`event`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Overrides - -EventEmitter.prependOnceListener - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L181) - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.rawListeners - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:569 - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | keyof `T` & `string` | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Overrides - -EventEmitter.removeAllListeners - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L185) - -___ - -### removeListener - -▸ **removeListener**<`E`\>(`event`, `listener`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `E` | extends `string` \| `number` \| `symbol` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event` | `E` & `string` | -| `listener` | `T`[`E`] | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Overrides - -EventEmitter.removeListener - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L189) - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`maxListeners`): [`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `maxListeners` | `number` | - -#### Returns - -[`AsyncEventEmitter`](AsyncEventEmitter.md)<`T`\> - -#### Overrides - -EventEmitter.setMaxListeners - -#### Defined in - -[packages/util/src/asyncEventEmitter.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/asyncEventEmitter.ts#L209) - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0, v14.17.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `_DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.getEventListeners - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:299 - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:271 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:254 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `_NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:194 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `_DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:195 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `_DOMEventTarget`)[] | - | - -#### Returns - -`void` - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/ts4.8/events.d.ts:317 diff --git a/packages/util/docs/classes/CLRequest.md b/packages/util/docs/classes/CLRequest.md new file mode 100644 index 00000000000..36eec4eb684 --- /dev/null +++ b/packages/util/docs/classes/CLRequest.md @@ -0,0 +1,73 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / CLRequest + +# Class: CLRequest\ + +Defined in: [packages/util/src/request.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L20) + +## Type Parameters + +### T + +`T` *extends* [`CLRequestType`](../type-aliases/CLRequestType.md) + +## Constructors + +### Constructor + +> **new CLRequest**\<`T`\>(`requestType`, `requestData`): `CLRequest`\<`T`\> + +Defined in: [packages/util/src/request.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L32) + +#### Parameters + +##### requestType + +`T` + +##### requestData + +`Uint8Array` + +#### Returns + +`CLRequest`\<`T`\> + +## Properties + +### bytes + +> `readonly` **bytes**: `Uint8Array` + +Defined in: [packages/util/src/request.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L22) + +## Accessors + +### data + +#### Get Signature + +> **get** **data**(): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/request.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L28) + +##### Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +*** + +### type + +#### Get Signature + +> **get** **type**(): `T` + +Defined in: [packages/util/src/request.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L24) + +##### Returns + +`T` diff --git a/packages/util/docs/classes/EthereumJSError.md b/packages/util/docs/classes/EthereumJSError.md new file mode 100644 index 00000000000..86b942e837b --- /dev/null +++ b/packages/util/docs/classes/EthereumJSError.md @@ -0,0 +1,193 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / EthereumJSError + +# Class: EthereumJSError\ + +Defined in: packages/rlp/dist/esm/errors.d.ts:19 + +Generic EthereumJS error with attached metadata + +## Extends + +- `Error` + +## Type Parameters + +### T + +`T` *extends* `object` + +## Constructors + +### Constructor + +> **new EthereumJSError**\<`T`\>(`type`, `message?`, `stack?`): `EthereumJSError`\<`T`\> + +Defined in: packages/rlp/dist/esm/errors.d.ts:23 + +#### Parameters + +##### type + +`T` + +##### message? + +`string` + +##### stack? + +`string` + +#### Returns + +`EthereumJSError`\<`T`\> + +#### Overrides + +`Error.constructor` + +## Properties + +### message + +> **message**: `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +`Error.message` + +*** + +### name + +> **name**: `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +`Error.name` + +*** + +### stack? + +> `optional` **stack**: `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +`Error.stack` + +*** + +### type + +> **type**: `T` + +Defined in: packages/rlp/dist/esm/errors.d.ts:22 + +*** + +### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Defined in: node\_modules/@types/node/globals.d.ts:143 + +Optional override for formatting stack traces + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +`Error.prepareStackTrace` + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +Defined in: node\_modules/@types/node/globals.d.ts:145 + +#### Inherited from + +`Error.stackTraceLimit` + +## Methods + +### getMetadata() + +> **getMetadata**(): [`EthereumJSErrorMetaData`](../type-aliases/EthereumJSErrorMetaData.md) + +Defined in: packages/rlp/dist/esm/errors.d.ts:24 + +#### Returns + +[`EthereumJSErrorMetaData`](../type-aliases/EthereumJSErrorMetaData.md) + +*** + +### toObject() + +> **toObject**(): [`EthereumJSErrorObject`](../type-aliases/EthereumJSErrorObject.md) + +Defined in: packages/rlp/dist/esm/errors.d.ts:28 + +Get the metadata and the stacktrace for the error. + +#### Returns + +[`EthereumJSErrorObject`](../type-aliases/EthereumJSErrorObject.md) + +*** + +### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` + +Defined in: node\_modules/@types/node/globals.d.ts:136 + +Create .stack property on a target object + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +`Error.captureStackTrace` diff --git a/packages/util/docs/classes/Lock.md b/packages/util/docs/classes/Lock.md index 430e2d89bce..03790d0222d 100644 --- a/packages/util/docs/classes/Lock.md +++ b/packages/util/docs/classes/Lock.md @@ -1,47 +1,46 @@ -[@ethereumjs/util](../README.md) / Lock +[**@ethereumjs/util**](../README.md) -# Class: Lock +*** -## Table of contents +[@ethereumjs/util](../README.md) / Lock -### Constructors +# Class: Lock -- [constructor](Lock.md#constructor) +Defined in: [packages/util/src/lock.ts:2](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/lock.ts#L2) -### Methods +## Constructors -- [acquire](Lock.md#acquire) -- [release](Lock.md#release) +### Constructor -## Constructors +> **new Lock**(): `Lock` -### constructor +#### Returns -• **new Lock**() +`Lock` ## Methods -### acquire +### acquire() + +> **acquire**(): `Promise`\<`boolean`\> -▸ **acquire**(): `Promise`<`boolean`\> +Defined in: [packages/util/src/lock.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/lock.ts#L10) Returns a promise used to wait for a permit to become available. This method should be awaited on. #### Returns -`Promise`<`boolean`\> +`Promise`\<`boolean`\> A promise that gets resolved when execution is allowed to proceed. -#### Defined in - -[packages/util/src/lock.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/lock.ts#L10) +*** -___ +### release() -### release +> **release**(): `void` -▸ **release**(): `void` +Defined in: [packages/util/src/lock.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/lock.ts#L25) Increases the number of permits by one. If there are other functions waiting, one of them will continue to execute in a future iteration of the event loop. @@ -49,7 +48,3 @@ continue to execute in a future iteration of the event loop. #### Returns `void` - -#### Defined in - -[packages/util/src/lock.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/lock.ts#L25) diff --git a/packages/util/docs/classes/MapDB.md b/packages/util/docs/classes/MapDB.md index 3fcfac43629..583e016edfc 100644 --- a/packages/util/docs/classes/MapDB.md +++ b/packages/util/docs/classes/MapDB.md @@ -1,215 +1,193 @@ -[@ethereumjs/util](../README.md) / MapDB - -# Class: MapDB +[**@ethereumjs/util**](../README.md) -## Type parameters +*** -| Name | Type | -| :------ | :------ | -| `TKey` | extends `Uint8Array` \| `string` \| `number` | -| `TValue` | extends `Uint8Array` \| `string` \| [`DBObject`](../README.md#dbobject) | +[@ethereumjs/util](../README.md) / MapDB -## Implements +# Class: MapDB\ -- [`DB`](../interfaces/DB.md)<`TKey`, `TValue`\> +Defined in: [packages/util/src/mapDB.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L5) -## Table of contents +## Type Parameters -### Constructors +### TKey -- [constructor](MapDB.md#constructor) +`TKey` *extends* `Uint8Array` \| `string` \| `number` -### Properties +### TValue -- [\_database](MapDB.md#_database) +`TValue` *extends* `Uint8Array` \| `string` \| [`DBObject`](../type-aliases/DBObject.md) -### Methods +## Implements -- [batch](MapDB.md#batch) -- [del](MapDB.md#del) -- [get](MapDB.md#get) -- [open](MapDB.md#open) -- [put](MapDB.md#put) -- [shallowCopy](MapDB.md#shallowcopy) +- [`DB`](../interfaces/DB.md)\<`TKey`, `TValue`\> ## Constructors -### constructor - -• **new MapDB**<`TKey`, `TValue`\>(`database?`) +### Constructor -#### Type parameters +> **new MapDB**\<`TKey`, `TValue`\>(`database?`): `MapDB`\<`TKey`, `TValue`\> -| Name | Type | -| :------ | :------ | -| `TKey` | extends `string` \| `number` \| `Uint8Array` | -| `TValue` | extends `string` \| `Uint8Array` \| [`DBObject`](../README.md#dbobject) | +Defined in: [packages/util/src/mapDB.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L12) #### Parameters -| Name | Type | -| :------ | :------ | -| `database?` | `Map`<`TKey`, `TValue`\> | +##### database? -#### Defined in +`Map`\<`TKey`, `TValue`\> -[packages/util/src/mapDB.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L12) +#### Returns + +`MapDB`\<`TKey`, `TValue`\> ## Properties ### \_database -• **\_database**: `Map`<`TKey`, `TValue`\> - -#### Defined in +> **\_database**: `Map`\<`TKey`, `TValue`\> -[packages/util/src/mapDB.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L10) +Defined in: [packages/util/src/mapDB.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L10) ## Methods -### batch +### batch() + +> **batch**(`opStack`): `Promise`\<`void`\> -▸ **batch**(`opStack`): `Promise`<`void`\> +Defined in: [packages/util/src/mapDB.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L31) Performs a batch operation on db. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `opStack` | [`BatchDBOp`](../README.md#batchdbop)<`TKey`, `TValue`\>[] | A stack of levelup operations | +##### opStack + +[`BatchDBOp`](../type-aliases/BatchDBOp.md)\<`TKey`, `TValue`\>[] + +A stack of levelup operations #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[DB](../interfaces/DB.md).[batch](../interfaces/DB.md#batch) - -#### Defined in +[`DB`](../interfaces/DB.md).[`batch`](../interfaces/DB.md#batch) -[packages/util/src/mapDB.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L31) +*** -___ +### del() -### del +> **del**(`key`): `Promise`\<`void`\> -▸ **del**(`key`): `Promise`<`void`\> +Defined in: [packages/util/src/mapDB.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L26) Removes a raw value in the underlying db. #### Parameters -| Name | Type | -| :------ | :------ | -| `key` | `TKey` | +##### key + +`TKey` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[DB](../interfaces/DB.md).[del](../interfaces/DB.md#del) - -#### Defined in +[`DB`](../interfaces/DB.md).[`del`](../interfaces/DB.md#del) -[packages/util/src/mapDB.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L26) +*** -___ +### get() -### get +> **get**(`key`): `Promise`\<`undefined` \| `TValue`\> -▸ **get**(`key`): `Promise`<`undefined` \| `TValue`\> +Defined in: [packages/util/src/mapDB.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L16) Retrieves a raw value from db. #### Parameters -| Name | Type | -| :------ | :------ | -| `key` | `TKey` | +##### key + +`TKey` #### Returns -`Promise`<`undefined` \| `TValue`\> +`Promise`\<`undefined` \| `TValue`\> A Promise that resolves to `Uint8Array` if a value is found or `undefined` if no value is found. #### Implementation of -[DB](../interfaces/DB.md).[get](../interfaces/DB.md#get) +[`DB`](../interfaces/DB.md).[`get`](../interfaces/DB.md#get) -#### Defined in +*** -[packages/util/src/mapDB.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L16) +### open() -___ +> **open**(): `Promise`\<`void`\> -### open - -▸ **open**(): `Promise`<`void`\> +Defined in: [packages/util/src/mapDB.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L52) Opens the database -- if applicable #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[DB](../interfaces/DB.md).[open](../interfaces/DB.md#open) - -#### Defined in +[`DB`](../interfaces/DB.md).[`open`](../interfaces/DB.md#open) -[packages/util/src/mapDB.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L52) +*** -___ +### put() -### put +> **put**(`key`, `val`): `Promise`\<`void`\> -▸ **put**(`key`, `val`): `Promise`<`void`\> +Defined in: [packages/util/src/mapDB.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L21) Writes a value directly to db. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `TKey` | The key as a `TValue` | -| `val` | `TValue` | - | +##### key + +`TKey` + +The key as a `TValue` + +##### val + +`TValue` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -[DB](../interfaces/DB.md).[put](../interfaces/DB.md#put) +[`DB`](../interfaces/DB.md).[`put`](../interfaces/DB.md#put) -#### Defined in +*** -[packages/util/src/mapDB.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L21) +### shallowCopy() -___ +> **shallowCopy**(): [`DB`](../interfaces/DB.md)\<`TKey`, `TValue`\> -### shallowCopy - -▸ **shallowCopy**(): [`DB`](../interfaces/DB.md)<`TKey`, `TValue`\> +Defined in: [packages/util/src/mapDB.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L48) Note that the returned shallow copy will share the underlying database with the original #### Returns -[`DB`](../interfaces/DB.md)<`TKey`, `TValue`\> +[`DB`](../interfaces/DB.md)\<`TKey`, `TValue`\> DB #### Implementation of -[DB](../interfaces/DB.md).[shallowCopy](../interfaces/DB.md#shallowcopy) - -#### Defined in - -[packages/util/src/mapDB.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L48) +[`DB`](../interfaces/DB.md).[`shallowCopy`](../interfaces/DB.md#shallowcopy) diff --git a/packages/util/docs/classes/PrioritizedTaskExecutor.md b/packages/util/docs/classes/PrioritizedTaskExecutor.md new file mode 100644 index 00000000000..f459722cf2a --- /dev/null +++ b/packages/util/docs/classes/PrioritizedTaskExecutor.md @@ -0,0 +1,9 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / PrioritizedTaskExecutor + +# Class: PrioritizedTaskExecutor + +Defined in: [packages/util/src/tasks.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/tasks.ts#L6) diff --git a/packages/util/docs/classes/Units.md b/packages/util/docs/classes/Units.md new file mode 100644 index 00000000000..bba2757799a --- /dev/null +++ b/packages/util/docs/classes/Units.md @@ -0,0 +1,85 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / Units + +# Class: Units + +Defined in: [packages/util/src/units.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L25) + +## Constructors + +### Constructor + +> **new Units**(): `Units` + +#### Returns + +`Units` + +## Methods + +### ether() + +> `static` **ether**(`amount`): `bigint` + +Defined in: [packages/util/src/units.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L41) + +Convert a number or bigint input of ether to wei + +#### Parameters + +##### amount + +amount of units of ether to convert to wei + +`number` | `bigint` + +#### Returns + +`bigint` + +amount of units in wei + +*** + +### gwei() + +> `static` **gwei**(`amount`): `bigint` + +Defined in: [packages/util/src/units.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L52) + +Convert a number or bigint input of gwei to wei + +#### Parameters + +##### amount + +amount of units of gwei to convert to wei + +`number` | `bigint` + +#### Returns + +`bigint` + +amount of units in wei + +*** + +### validateInput() + +> `static` **validateInput**(`amount`): `void` + +Defined in: [packages/util/src/units.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L26) + +#### Parameters + +##### amount + +`number` | `bigint` + +#### Returns + +`void` diff --git a/packages/util/docs/classes/Withdrawal.md b/packages/util/docs/classes/Withdrawal.md index 9d594fa9d54..eb75a664ed0 100644 --- a/packages/util/docs/classes/Withdrawal.md +++ b/packages/util/docs/classes/Withdrawal.md @@ -1,212 +1,145 @@ +[**@ethereumjs/util**](../README.md) + +*** + [@ethereumjs/util](../README.md) / Withdrawal # Class: Withdrawal +Defined in: [packages/util/src/withdrawal.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L59) + Representation of EIP-4895 withdrawal data -## Table of contents +## Constructors -### Constructors +### Constructor -- [constructor](Withdrawal.md#constructor) +> **new Withdrawal**(`index`, `validatorIndex`, `address`, `amount`): `Withdrawal` -### Properties +Defined in: [packages/util/src/withdrawal.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L70) -- [address](Withdrawal.md#address) -- [amount](Withdrawal.md#amount) -- [index](Withdrawal.md#index) -- [validatorIndex](Withdrawal.md#validatorindex) +This constructor assigns and validates the values. +Use the static factory methods to assist in creating a Withdrawal object from varying data types. +Its amount is in Gwei to match CL representation and for eventual ssz withdrawalsRoot -### Methods +#### Parameters -- [raw](Withdrawal.md#raw) -- [toJSON](Withdrawal.md#tojson) -- [toValue](Withdrawal.md#tovalue) -- [fromValuesArray](Withdrawal.md#fromvaluesarray) -- [fromWithdrawalData](Withdrawal.md#fromwithdrawaldata) -- [toBytesArray](Withdrawal.md#tobytesarray) +##### index -## Constructors +`bigint` -### constructor +##### validatorIndex -• **new Withdrawal**(`index`, `validatorIndex`, `address`, `amount`) +`bigint` -This constructor assigns and validates the values. -Use the static factory methods to assist in creating a Withdrawal object from varying data types. -Its amount is in Gwei to match CL representation and for eventual ssz withdrawalsRoot +##### address -#### Parameters +[`Address`](Address.md) + +##### amount -| Name | Type | Description | -| :------ | :------ | :------ | -| `index` | `bigint` | - | -| `validatorIndex` | `bigint` | - | -| `address` | [`Address`](Address.md) | - | -| `amount` | `bigint` | withdrawal amount in Gwei to match the CL repesentation and eventually ssz withdrawalsRoot | +`bigint` -#### Defined in +#### Returns -[packages/util/src/withdrawal.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L41) +`Withdrawal` ## Properties ### address -• `Readonly` **address**: [`Address`](Address.md) - -#### Defined in +> `readonly` **address**: [`Address`](Address.md) -[packages/util/src/withdrawal.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L44) +Defined in: [packages/util/src/withdrawal.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L62) -___ +*** ### amount -• `Readonly` **amount**: `bigint` - -withdrawal amount in Gwei to match the CL repesentation and eventually ssz withdrawalsRoot +> `readonly` **amount**: `bigint` -#### Defined in +Defined in: [packages/util/src/withdrawal.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L63) -[packages/util/src/withdrawal.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L48) - -___ +*** ### index -• `Readonly` **index**: `bigint` - -#### Defined in +> `readonly` **index**: `bigint` -[packages/util/src/withdrawal.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L42) +Defined in: [packages/util/src/withdrawal.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L60) -___ +*** ### validatorIndex -• `Readonly` **validatorIndex**: `bigint` - -#### Defined in +> `readonly` **validatorIndex**: `bigint` -[packages/util/src/withdrawal.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L43) +Defined in: [packages/util/src/withdrawal.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L61) ## Methods -### raw - -▸ **raw**(): [`WithdrawalBytes`](../README.md#withdrawalbytes) - -#### Returns - -[`WithdrawalBytes`](../README.md#withdrawalbytes) - -#### Defined in +### raw() -[packages/util/src/withdrawal.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L100) +> **raw**(): [`WithdrawalBytes`](../type-aliases/WithdrawalBytes.md) -___ - -### toJSON - -▸ **toJSON**(): `Object` +Defined in: [packages/util/src/withdrawal.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L77) #### Returns -`Object` - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `amount` | `string` | -| `index` | `string` | -| `validatorIndex` | `string` | +[`WithdrawalBytes`](../type-aliases/WithdrawalBytes.md) -#### Defined in +*** -[packages/util/src/withdrawal.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L113) +### toJSON() -___ +> **toJSON**(): `object` -### toValue - -▸ **toValue**(): `Object` +Defined in: [packages/util/src/withdrawal.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L90) #### Returns -`Object` - -| Name | Type | -| :------ | :------ | -| `address` | `Uint8Array` | -| `amount` | `bigint` | -| `index` | `bigint` | -| `validatorIndex` | `bigint` | - -#### Defined in - -[packages/util/src/withdrawal.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L104) - -___ +`object` -### fromValuesArray +##### address -▸ `Static` **fromValuesArray**(`withdrawalArray`): [`Withdrawal`](Withdrawal.md) +> **address**: `` `0x${string}` `` -#### Parameters - -| Name | Type | -| :------ | :------ | -| `withdrawalArray` | [`WithdrawalBytes`](../README.md#withdrawalbytes) | +##### amount -#### Returns +> **amount**: `` `0x${string}` `` -[`Withdrawal`](Withdrawal.md) +##### index -#### Defined in +> **index**: `` `0x${string}` `` -[packages/util/src/withdrawal.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L66) +##### validatorIndex -___ +> **validatorIndex**: `` `0x${string}` `` -### fromWithdrawalData +*** -▸ `Static` **fromWithdrawalData**(`withdrawalData`): [`Withdrawal`](Withdrawal.md) +### toValue() -#### Parameters +> **toValue**(): `object` -| Name | Type | -| :------ | :------ | -| `withdrawalData` | [`WithdrawalData`](../README.md#withdrawaldata) | +Defined in: [packages/util/src/withdrawal.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L81) #### Returns -[`Withdrawal`](Withdrawal.md) - -#### Defined in - -[packages/util/src/withdrawal.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L51) +`object` -___ +##### address -### toBytesArray +> **address**: `Uint8Array`\<`ArrayBufferLike`\> -▸ `Static` **toBytesArray**(`withdrawal`): [`WithdrawalBytes`](../README.md#withdrawalbytes) +##### amount -Convert a withdrawal to a buffer array - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `withdrawal` | [`WithdrawalData`](../README.md#withdrawaldata) \| [`Withdrawal`](Withdrawal.md) | the withdrawal to convert | - -#### Returns +> **amount**: `bigint` -[`WithdrawalBytes`](../README.md#withdrawalbytes) +##### index -buffer array of the withdrawal +> **index**: `bigint` -#### Defined in +##### validatorIndex -[packages/util/src/withdrawal.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L79) +> **validatorIndex**: `bigint` diff --git a/packages/util/docs/enums/KeyEncoding.md b/packages/util/docs/enums/KeyEncoding.md deleted file mode 100644 index e8656cfe80c..00000000000 --- a/packages/util/docs/enums/KeyEncoding.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/util](../README.md) / KeyEncoding - -# Enumeration: KeyEncoding - -## Table of contents - -### Enumeration Members - -- [Bytes](KeyEncoding.md#bytes) -- [Number](KeyEncoding.md#number) -- [String](KeyEncoding.md#string) - -## Enumeration Members - -### Bytes - -• **Bytes** = ``"view"`` - -#### Defined in - -[packages/util/src/db.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L11) - -___ - -### Number - -• **Number** = ``"number"`` - -#### Defined in - -[packages/util/src/db.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L12) - -___ - -### String - -• **String** = ``"string"`` - -#### Defined in - -[packages/util/src/db.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L10) diff --git a/packages/util/docs/enums/TypeOutput.md b/packages/util/docs/enums/TypeOutput.md deleted file mode 100644 index 445a1e4d57f..00000000000 --- a/packages/util/docs/enums/TypeOutput.md +++ /dev/null @@ -1,54 +0,0 @@ -[@ethereumjs/util](../README.md) / TypeOutput - -# Enumeration: TypeOutput - -Type output options - -## Table of contents - -### Enumeration Members - -- [BigInt](TypeOutput.md#bigint) -- [Number](TypeOutput.md#number) -- [PrefixedHexString](TypeOutput.md#prefixedhexstring) -- [Uint8Array](TypeOutput.md#uint8array) - -## Enumeration Members - -### BigInt - -• **BigInt** = ``1`` - -#### Defined in - -[packages/util/src/types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L44) - -___ - -### Number - -• **Number** = ``0`` - -#### Defined in - -[packages/util/src/types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L43) - -___ - -### PrefixedHexString - -• **PrefixedHexString** = ``3`` - -#### Defined in - -[packages/util/src/types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L46) - -___ - -### Uint8Array - -• **Uint8Array** = ``2`` - -#### Defined in - -[packages/util/src/types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L45) diff --git a/packages/util/docs/enums/ValueEncoding.md b/packages/util/docs/enums/ValueEncoding.md deleted file mode 100644 index 15456584d73..00000000000 --- a/packages/util/docs/enums/ValueEncoding.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/util](../README.md) / ValueEncoding - -# Enumeration: ValueEncoding - -## Table of contents - -### Enumeration Members - -- [Bytes](ValueEncoding.md#bytes) -- [JSON](ValueEncoding.md#json) -- [String](ValueEncoding.md#string) - -## Enumeration Members - -### Bytes - -• **Bytes** = ``"view"`` - -#### Defined in - -[packages/util/src/db.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L17) - -___ - -### JSON - -• **JSON** = ``"json"`` - -#### Defined in - -[packages/util/src/db.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L18) - -___ - -### String - -• **String** = ``"string"`` - -#### Defined in - -[packages/util/src/db.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L16) diff --git a/packages/util/docs/functions/EthereumJSErrorWithoutCode.md b/packages/util/docs/functions/EthereumJSErrorWithoutCode.md new file mode 100644 index 00000000000..64a46badd6b --- /dev/null +++ b/packages/util/docs/functions/EthereumJSErrorWithoutCode.md @@ -0,0 +1,33 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / EthereumJSErrorWithoutCode + +# Function: ~~EthereumJSErrorWithoutCode()~~ + +> **EthereumJSErrorWithoutCode**(`message?`, `stack?`): [`EthereumJSError`](../classes/EthereumJSError.md)\<\{ `code`: `string`; \}\> + +Defined in: packages/rlp/dist/esm/errors.d.ts:36 + +## Parameters + +### message? + +`string` + +Optional error message + +### stack? + +`string` + +Optional stack trace + +## Returns + +[`EthereumJSError`](../classes/EthereumJSError.md)\<\{ `code`: `string`; \}\> + +## Deprecated + +Use `EthereumJSError` with a set error code instead diff --git a/packages/util/docs/functions/accountBodyFromSlim.md b/packages/util/docs/functions/accountBodyFromSlim.md new file mode 100644 index 00000000000..2b0d56fa537 --- /dev/null +++ b/packages/util/docs/functions/accountBodyFromSlim.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / accountBodyFromSlim + +# Function: accountBodyFromSlim() + +> **accountBodyFromSlim**(`body`): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [packages/util/src/account.ts:601](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L601) + +## Parameters + +### body + +[`AccountBodyBytes`](../type-aliases/AccountBodyBytes.md) + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] diff --git a/packages/util/docs/functions/accountBodyToRLP.md b/packages/util/docs/functions/accountBodyToRLP.md new file mode 100644 index 00000000000..300a396f010 --- /dev/null +++ b/packages/util/docs/functions/accountBodyToRLP.md @@ -0,0 +1,31 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / accountBodyToRLP + +# Function: accountBodyToRLP() + +> **accountBodyToRLP**(`body`, `couldBeSlim`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/account.ts:627](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L627) + +Converts a slim account (per snap protocol spec) to the RLP encoded version of the account + +## Parameters + +### body + +[`AccountBodyBytes`](../type-aliases/AccountBodyBytes.md) + +Array of 4 Uint8Array-like items to represent the account + +### couldBeSlim + +`boolean` = `true` + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +RLP encoded version of the account diff --git a/packages/util/docs/functions/accountBodyToSlim.md b/packages/util/docs/functions/accountBodyToSlim.md new file mode 100644 index 00000000000..f52b3f10940 --- /dev/null +++ b/packages/util/docs/functions/accountBodyToSlim.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / accountBodyToSlim + +# Function: accountBodyToSlim() + +> **accountBodyToSlim**(`body`): `Uint8Array`\<`ArrayBuffer`\>[] + +Defined in: [packages/util/src/account.ts:612](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L612) + +## Parameters + +### body + +[`AccountBodyBytes`](../type-aliases/AccountBodyBytes.md) + +## Returns + +`Uint8Array`\<`ArrayBuffer`\>[] diff --git a/packages/util/docs/functions/addHexPrefix.md b/packages/util/docs/functions/addHexPrefix.md new file mode 100644 index 00000000000..40abd401e45 --- /dev/null +++ b/packages/util/docs/functions/addHexPrefix.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / addHexPrefix + +# Function: addHexPrefix() + +> **addHexPrefix**(`str`): `` `0x${string}` `` + +Defined in: [packages/util/src/bytes.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L296) + +Adds "0x" to a given `string` if it does not already start with "0x". + +## Parameters + +### str + +`string` + +## Returns + +`` `0x${string}` `` diff --git a/packages/util/docs/functions/arrayContainsArray.md b/packages/util/docs/functions/arrayContainsArray.md new file mode 100644 index 00000000000..9672b14cd17 --- /dev/null +++ b/packages/util/docs/functions/arrayContainsArray.md @@ -0,0 +1,32 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / arrayContainsArray + +# Function: arrayContainsArray() + +> **arrayContainsArray**(`superset`, `subset`, `some?`): `boolean` + +Defined in: [packages/util/src/internal.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L100) + +Returns TRUE if the first specified array contains all elements +from the second one. FALSE otherwise. + +## Parameters + +### superset + +`unknown`[] + +### subset + +`unknown`[] + +### some? + +`boolean` + +## Returns + +`boolean` diff --git a/packages/util/docs/functions/bigInt64ToBytes.md b/packages/util/docs/functions/bigInt64ToBytes.md new file mode 100644 index 00000000000..77e6843cbae --- /dev/null +++ b/packages/util/docs/functions/bigInt64ToBytes.md @@ -0,0 +1,35 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bigInt64ToBytes + +# Function: bigInt64ToBytes() + +> **bigInt64ToBytes**(`value`, `littleEndian`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:490](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L490) + +## Parameters + +### value + +`bigint` + +The 64-bit bigint to convert. + +### littleEndian + +`boolean` = `false` + +True for little-endian, undefined or false for big-endian. + +## Returns + +`Uint8Array` + +A Uint8Array of length 8 containing the bigint. + +## Notice + +Convert a 64-bit bigint to a Uint8Array. diff --git a/packages/util/docs/functions/bigIntMax.md b/packages/util/docs/functions/bigIntMax.md new file mode 100644 index 00000000000..e014d5105a0 --- /dev/null +++ b/packages/util/docs/functions/bigIntMax.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bigIntMax + +# Function: bigIntMax() + +> **bigIntMax**(...`args`): `bigint` + +Defined in: [packages/util/src/bytes.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L360) + +Calculates max bigint from an array of bigints + +## Parameters + +### args + +...`bigint`[] + +array of bigints + +## Returns + +`bigint` diff --git a/packages/util/docs/functions/bigIntMin.md b/packages/util/docs/functions/bigIntMin.md new file mode 100644 index 00000000000..2c09ed39ad0 --- /dev/null +++ b/packages/util/docs/functions/bigIntMin.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bigIntMin + +# Function: bigIntMin() + +> **bigIntMin**(...`args`): `bigint` + +Defined in: [packages/util/src/bytes.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L366) + +Calculates min BigInt from an array of BigInts + +## Parameters + +### args + +...`bigint`[] + +array of bigints + +## Returns + +`bigint` diff --git a/packages/util/docs/functions/bigIntToAddressBytes.md b/packages/util/docs/functions/bigIntToAddressBytes.md new file mode 100644 index 00000000000..4721bf94953 --- /dev/null +++ b/packages/util/docs/functions/bigIntToAddressBytes.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bigIntToAddressBytes + +# Function: bigIntToAddressBytes() + +> **bigIntToAddressBytes**(`value`, `strict`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:378](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L378) + +## Parameters + +### value + +`bigint` + +### strict + +`boolean` = `true` + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/bigIntToBytes.md b/packages/util/docs/functions/bigIntToBytes.md new file mode 100644 index 00000000000..b99428f230a --- /dev/null +++ b/packages/util/docs/functions/bigIntToBytes.md @@ -0,0 +1,30 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bigIntToBytes + +# Function: bigIntToBytes() + +> **bigIntToBytes**(`num`, `littleEndian`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L118) + +Converts a bigint to a Uint8Array + * + +## Parameters + +### num + +`bigint` + +the bigint to convert + +### littleEndian + +`boolean` = `false` + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/bigIntToHex.md b/packages/util/docs/functions/bigIntToHex.md new file mode 100644 index 00000000000..c0383a829ee --- /dev/null +++ b/packages/util/docs/functions/bigIntToHex.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bigIntToHex + +# Function: bigIntToHex() + +> **bigIntToHex**(`num`): `` `0x${string}` `` + +Defined in: [packages/util/src/bytes.ts:352](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L352) + +Converts a bigint to a `0x` prefixed hex string + +## Parameters + +### num + +`bigint` + +the bigint to convert + +## Returns + +`` `0x${string}` `` diff --git a/packages/util/docs/functions/bigIntToUnpaddedBytes.md b/packages/util/docs/functions/bigIntToUnpaddedBytes.md new file mode 100644 index 00000000000..aec36233f3a --- /dev/null +++ b/packages/util/docs/functions/bigIntToUnpaddedBytes.md @@ -0,0 +1,26 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bigIntToUnpaddedBytes + +# Function: bigIntToUnpaddedBytes() + +> **bigIntToUnpaddedBytes**(`value`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L374) + +Convert value from bigint to an unpadded Uint8Array +(useful for RLP transport) + +## Parameters + +### value + +`bigint` + +the bigint to convert + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/bitsToBytes.md b/packages/util/docs/functions/bitsToBytes.md new file mode 100644 index 00000000000..7b6a7ac007e --- /dev/null +++ b/packages/util/docs/functions/bitsToBytes.md @@ -0,0 +1,28 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bitsToBytes + +# Function: bitsToBytes() + +> **bitsToBytes**(`bits`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:527](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L527) + +Converts an array of bits into a Uint8Array. +The input bits are grouped into sets of 8, with the first bit in each group being the most significant. + +## Parameters + +### bits + +`number`[] + +The input array of bits (each should be 0 or 1). Its length should be a multiple of 8. + +## Returns + +`Uint8Array` + +A Uint8Array constructed from the input bits. diff --git a/packages/util/docs/functions/blobsToCommitments.md b/packages/util/docs/functions/blobsToCommitments.md new file mode 100644 index 00000000000..5d37ddc2541 --- /dev/null +++ b/packages/util/docs/functions/blobsToCommitments.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / blobsToCommitments + +# Function: blobsToCommitments() + +> **blobsToCommitments**(`kzg`, `blobs`): `` `0x${string}` ``[] + +Defined in: [packages/util/src/blobs.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L60) + +## Parameters + +### kzg + +[`KZG`](../interfaces/KZG.md) + +### blobs + +`` `0x${string}` ``[] + +## Returns + +`` `0x${string}` ``[] diff --git a/packages/util/docs/functions/blobsToProofs.md b/packages/util/docs/functions/blobsToProofs.md new file mode 100644 index 00000000000..86fe88f7078 --- /dev/null +++ b/packages/util/docs/functions/blobsToProofs.md @@ -0,0 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / blobsToProofs + +# Function: blobsToProofs() + +> **blobsToProofs**(`kzg`, `blobs`, `commitments`): `` `0x${string}` ``[] + +Defined in: [packages/util/src/blobs.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L68) + +## Parameters + +### kzg + +[`KZG`](../interfaces/KZG.md) + +### blobs + +`` `0x${string}` ``[] + +### commitments + +`` `0x${string}` ``[] + +## Returns + +`` `0x${string}` ``[] diff --git a/packages/util/docs/functions/bytesToBigInt.md b/packages/util/docs/functions/bytesToBigInt.md new file mode 100644 index 00000000000..3e9002ea26b --- /dev/null +++ b/packages/util/docs/functions/bytesToBigInt.md @@ -0,0 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bytesToBigInt + +# Function: bytesToBigInt() + +> **bytesToBigInt**(`bytes`, `littleEndian`): `bigint` + +Defined in: [packages/util/src/bytes.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L59) + +Converts a Uint8Array to a bigint + +## Parameters + +### bytes + +`Uint8Array` + +the bytes to convert + +### littleEndian + +`boolean` = `false` + +## Returns + +`bigint` diff --git a/packages/util/docs/functions/bytesToBigInt64.md b/packages/util/docs/functions/bytesToBigInt64.md new file mode 100644 index 00000000000..43f60173782 --- /dev/null +++ b/packages/util/docs/functions/bytesToBigInt64.md @@ -0,0 +1,35 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bytesToBigInt64 + +# Function: bytesToBigInt64() + +> **bytesToBigInt64**(`bytes`, `littleEndian`): `bigint` + +Defined in: [packages/util/src/bytes.ts:463](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L463) + +## Parameters + +### bytes + +`Uint8Array` + +The input Uint8Array from which to read the 64-bit bigint. + +### littleEndian + +`boolean` = `false` + +True for little-endian, undefined or false for big-endian. + +## Returns + +`bigint` + +The 64-bit bigint read from the input Uint8Array. + +## Notice + +Convert a Uint8Array to a 64-bit bigint diff --git a/packages/util/docs/functions/bytesToBits.md b/packages/util/docs/functions/bytesToBits.md new file mode 100644 index 00000000000..fc16e6ecbd4 --- /dev/null +++ b/packages/util/docs/functions/bytesToBits.md @@ -0,0 +1,33 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bytesToBits + +# Function: bytesToBits() + +> **bytesToBits**(`bytes`, `bitLength?`): `number`[] + +Defined in: [packages/util/src/bytes.ts:509](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L509) + +Converts a Uint8Array of bytes into an array of bits. + +## Parameters + +### bytes + +`Uint8Array` + +The input byte array. + +### bitLength? + +`number` + +The number of bits to extract from the input bytes. + +## Returns + +`number`[] + +An array of bits (each 0 or 1) corresponding to the input bytes. diff --git a/packages/util/docs/functions/bytesToHex.md b/packages/util/docs/functions/bytesToHex.md new file mode 100644 index 00000000000..6c822cc18e0 --- /dev/null +++ b/packages/util/docs/functions/bytesToHex.md @@ -0,0 +1,31 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bytesToHex + +# Function: bytesToHex() + +> **bytesToHex**(`bytes`): `` `0x${string}` `` + +Defined in: [packages/util/src/bytes.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L43) + +Converts a Uint8Array to a [PrefixedHexString](../type-aliases/PrefixedHexString.md) + +## Parameters + +### bytes + +`Uint8Array` + +the bytes to convert + +## Returns + +`` `0x${string}` `` + +the hex string + +## Dev + +Returns `0x` if provided an empty Uint8Array diff --git a/packages/util/docs/functions/bytesToInt.md b/packages/util/docs/functions/bytesToInt.md new file mode 100644 index 00000000000..68c71c9088f --- /dev/null +++ b/packages/util/docs/functions/bytesToInt.md @@ -0,0 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bytesToInt + +# Function: bytesToInt() + +> **bytesToInt**(`bytes`): `number` + +Defined in: [packages/util/src/bytes.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L83) + +Converts a Uint8Array to a number. + +## Parameters + +### bytes + +`Uint8Array` + +the bytes to convert + +## Returns + +`number` + +## Throws + +If the input number exceeds 53 bits. diff --git a/packages/util/docs/functions/bytesToInt32.md b/packages/util/docs/functions/bytesToInt32.md new file mode 100644 index 00000000000..17c43f68153 --- /dev/null +++ b/packages/util/docs/functions/bytesToInt32.md @@ -0,0 +1,35 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bytesToInt32 + +# Function: bytesToInt32() + +> **bytesToInt32**(`bytes`, `littleEndian`): `number` + +Defined in: [packages/util/src/bytes.ts:449](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L449) + +## Parameters + +### bytes + +`Uint8Array` + +The input Uint8Array from which to read the 32-bit integer. + +### littleEndian + +`boolean` = `false` + +True for little-endian, undefined or false for big-endian. + +## Returns + +`number` + +The 32-bit integer read from the input Uint8Array. + +## Notice + +Convert a Uint8Array to a 32-bit integer diff --git a/packages/util/docs/functions/bytesToUtf8.md b/packages/util/docs/functions/bytesToUtf8.md new file mode 100644 index 00000000000..7804d1bd128 --- /dev/null +++ b/packages/util/docs/functions/bytesToUtf8.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bytesToUtf8 + +# Function: bytesToUtf8() + +> **bytesToUtf8**(`data`): `string` + +Defined in: node\_modules/ethereum-cryptography/esm/utils.d.ts:5 + +## Parameters + +### data + +`Uint8Array` + +## Returns + +`string` diff --git a/packages/util/docs/functions/calculateSigRecovery.md b/packages/util/docs/functions/calculateSigRecovery.md new file mode 100644 index 00000000000..bf6c7629dc8 --- /dev/null +++ b/packages/util/docs/functions/calculateSigRecovery.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / calculateSigRecovery + +# Function: calculateSigRecovery() + +> **calculateSigRecovery**(`v`, `chainId?`): `bigint` + +Defined in: [packages/util/src/signature.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L27) + +## Parameters + +### v + +`bigint` + +### chainId? + +`bigint` + +## Returns + +`bigint` diff --git a/packages/util/docs/functions/chunkifyBinaryTreeCode.md b/packages/util/docs/functions/chunkifyBinaryTreeCode.md new file mode 100644 index 00000000000..4e3c28f59af --- /dev/null +++ b/packages/util/docs/functions/chunkifyBinaryTreeCode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / chunkifyBinaryTreeCode + +# Function: chunkifyBinaryTreeCode() + +> **chunkifyBinaryTreeCode**(`code`): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [packages/util/src/binaryTree.ts:179](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L179) + +## Parameters + +### code + +`Uint8Array` + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] diff --git a/packages/util/docs/functions/chunkifyCode.md b/packages/util/docs/functions/chunkifyCode.md new file mode 100644 index 00000000000..1cc4bd6eb38 --- /dev/null +++ b/packages/util/docs/functions/chunkifyCode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / chunkifyCode + +# Function: chunkifyCode() + +> **chunkifyCode**(`code`): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [packages/util/src/verkle.ts:243](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L243) + +## Parameters + +### code + +`Uint8Array` + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] diff --git a/packages/util/docs/functions/commitmentsToVersionedHashes.md b/packages/util/docs/functions/commitmentsToVersionedHashes.md new file mode 100644 index 00000000000..544f92fa4d0 --- /dev/null +++ b/packages/util/docs/functions/commitmentsToVersionedHashes.md @@ -0,0 +1,28 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / commitmentsToVersionedHashes + +# Function: commitmentsToVersionedHashes() + +> **commitmentsToVersionedHashes**(`commitments`): `` `0x${string}` ``[] + +Defined in: [packages/util/src/blobs.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L104) + +Generate an array of versioned hashes from corresponding kzg commitments + +## Parameters + +### commitments + +`` `0x${string}` ``[] + +array of kzg commitments + +## Returns + +`` `0x${string}` ``[] + +array of versioned hashes +Note: assumes KZG commitments (version 1 version hashes) diff --git a/packages/util/docs/functions/compareBytes.md b/packages/util/docs/functions/compareBytes.md new file mode 100644 index 00000000000..da2bab6e738 --- /dev/null +++ b/packages/util/docs/functions/compareBytes.md @@ -0,0 +1,35 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / compareBytes + +# Function: compareBytes() + +> **compareBytes**(`value1`, `value2`): `number` + +Defined in: [packages/util/src/bytes.ts:407](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L407) + +Compares two Uint8Arrays and returns a number indicating their order in a sorted array. + +## Parameters + +### value1 + +`Uint8Array` + +The first Uint8Array to compare. + +### value2 + +`Uint8Array` + +The second Uint8Array to compare. + +## Returns + +`number` + +A positive number if value1 is larger than value2, + A negative number if value1 is smaller than value2, + or 0 if value1 and value2 are equal. diff --git a/packages/util/docs/functions/computeVersionedHash.md b/packages/util/docs/functions/computeVersionedHash.md new file mode 100644 index 00000000000..60737f375b2 --- /dev/null +++ b/packages/util/docs/functions/computeVersionedHash.md @@ -0,0 +1,35 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / computeVersionedHash + +# Function: computeVersionedHash() + +> **computeVersionedHash**(`commitment`, `blobCommitmentVersion`): `` `0x${string}` `` + +Defined in: [packages/util/src/blobs.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L88) + +Converts a vector commitment for a given data blob to its versioned hash. For 4844, this version +number will be 0x01 for KZG vector commitments but could be different if future vector commitment +types are introduced + +## Parameters + +### commitment + +`` `0x${string}` `` + +a vector commitment to a blob + +### blobCommitmentVersion + +`number` + +the version number corresponding to the type of vector commitment + +## Returns + +`` `0x${string}` `` + +a versioned hash corresponding to a given blob vector commitment diff --git a/packages/util/docs/functions/concatBytes.md b/packages/util/docs/functions/concatBytes.md new file mode 100644 index 00000000000..8db033a9aca --- /dev/null +++ b/packages/util/docs/functions/concatBytes.md @@ -0,0 +1,30 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / concatBytes + +# Function: concatBytes() + +> **concatBytes**(...`arrays`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:431](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L431) + +This mirrors the functionality of the `ethereum-cryptography` export except +it skips the check to validate that every element of `arrays` is indeed a `uint8Array` +Can give small performance gains on large arrays + +## Parameters + +### arrays + +...`Uint8Array`\<`ArrayBufferLike`\>[] + +an array of Uint8Arrays + +## Returns + +`Uint8Array` + +one Uint8Array with all the elements of the original set +works like `Buffer.concat` diff --git a/packages/util/docs/functions/createAccount.md b/packages/util/docs/functions/createAccount.md new file mode 100644 index 00000000000..ab371cf4a42 --- /dev/null +++ b/packages/util/docs/functions/createAccount.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createAccount + +# Function: createAccount() + +> **createAccount**(`accountData`): [`Account`](../classes/Account.md) + +Defined in: [packages/util/src/account.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L304) + +## Parameters + +### accountData + +[`AccountData`](../interfaces/AccountData.md) + +## Returns + +[`Account`](../classes/Account.md) diff --git a/packages/util/docs/functions/createAccountFromBytesArray.md b/packages/util/docs/functions/createAccountFromBytesArray.md new file mode 100644 index 00000000000..4871662eebe --- /dev/null +++ b/packages/util/docs/functions/createAccountFromBytesArray.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createAccountFromBytesArray + +# Function: createAccountFromBytesArray() + +> **createAccountFromBytesArray**(`values`): [`Account`](../classes/Account.md) + +Defined in: [packages/util/src/account.ts:318](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L318) + +## Parameters + +### values + +`Uint8Array`\<`ArrayBufferLike`\>[] + +## Returns + +[`Account`](../classes/Account.md) diff --git a/packages/util/docs/functions/createAccountFromRLP.md b/packages/util/docs/functions/createAccountFromRLP.md new file mode 100644 index 00000000000..3b6f186653a --- /dev/null +++ b/packages/util/docs/functions/createAccountFromRLP.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createAccountFromRLP + +# Function: createAccountFromRLP() + +> **createAccountFromRLP**(`serialized`): [`Account`](../classes/Account.md) + +Defined in: [packages/util/src/account.ts:348](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L348) + +## Parameters + +### serialized + +`Uint8Array` + +## Returns + +[`Account`](../classes/Account.md) diff --git a/packages/util/docs/functions/createAddressFromBigInt.md b/packages/util/docs/functions/createAddressFromBigInt.md new file mode 100644 index 00000000000..dff160a04b5 --- /dev/null +++ b/packages/util/docs/functions/createAddressFromBigInt.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createAddressFromBigInt + +# Function: createAddressFromBigInt() + +> **createAddressFromBigInt**(`value`): [`Address`](../classes/Address.md) + +Defined in: [packages/util/src/address.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L85) + +Returns an Address object from a bigint address (they are stored as bigints on the stack) + +## Parameters + +### value + +`bigint` + +The bigint address + +## Returns + +[`Address`](../classes/Address.md) diff --git a/packages/util/docs/functions/createAddressFromPrivateKey.md b/packages/util/docs/functions/createAddressFromPrivateKey.md new file mode 100644 index 00000000000..9dbc1c15da5 --- /dev/null +++ b/packages/util/docs/functions/createAddressFromPrivateKey.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createAddressFromPrivateKey + +# Function: createAddressFromPrivateKey() + +> **createAddressFromPrivateKey**(`privateKey`): [`Address`](../classes/Address.md) + +Defined in: [packages/util/src/address.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L120) + +Returns an address for a given private key. + +## Parameters + +### privateKey + +`Uint8Array` + +A private key must be 256 bits wide + +## Returns + +[`Address`](../classes/Address.md) diff --git a/packages/util/docs/functions/createAddressFromPublicKey.md b/packages/util/docs/functions/createAddressFromPublicKey.md new file mode 100644 index 00000000000..494dd04fa04 --- /dev/null +++ b/packages/util/docs/functions/createAddressFromPublicKey.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createAddressFromPublicKey + +# Function: createAddressFromPublicKey() + +> **createAddressFromPublicKey**(`pubKey`): [`Address`](../classes/Address.md) + +Defined in: [packages/util/src/address.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L108) + +Returns an address for a given public key. + +## Parameters + +### pubKey + +`Uint8Array` + +The two points of an uncompressed key + +## Returns + +[`Address`](../classes/Address.md) diff --git a/packages/util/docs/functions/createAddressFromString.md b/packages/util/docs/functions/createAddressFromString.md new file mode 100644 index 00000000000..0b0790588e7 --- /dev/null +++ b/packages/util/docs/functions/createAddressFromString.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createAddressFromString + +# Function: createAddressFromString() + +> **createAddressFromString**(`str`): [`Address`](../classes/Address.md) + +Defined in: [packages/util/src/address.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L97) + +Returns an Address object from a hex-encoded string. + +## Parameters + +### str + +`string` + +Hex-encoded address + +## Returns + +[`Address`](../classes/Address.md) diff --git a/packages/util/docs/functions/createCLRequest.md b/packages/util/docs/functions/createCLRequest.md new file mode 100644 index 00000000000..9f4e44f432d --- /dev/null +++ b/packages/util/docs/functions/createCLRequest.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createCLRequest + +# Function: createCLRequest() + +> **createCLRequest**(`bytes`): [`CLRequest`](../classes/CLRequest.md)\<[`CLRequestType`](../type-aliases/CLRequestType.md)\> + +Defined in: [packages/util/src/request.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L37) + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +[`CLRequest`](../classes/CLRequest.md)\<[`CLRequestType`](../type-aliases/CLRequestType.md)\> diff --git a/packages/util/docs/functions/createContractAddress.md b/packages/util/docs/functions/createContractAddress.md new file mode 100644 index 00000000000..6f041de7c8a --- /dev/null +++ b/packages/util/docs/functions/createContractAddress.md @@ -0,0 +1,31 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createContractAddress + +# Function: createContractAddress() + +> **createContractAddress**(`from`, `nonce`): [`Address`](../classes/Address.md) + +Defined in: [packages/util/src/address.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L133) + +Generates an address for a newly created contract. + +## Parameters + +### from + +[`Address`](../classes/Address.md) + +The address which is creating this new address + +### nonce + +`bigint` + +The nonce of the from account + +## Returns + +[`Address`](../classes/Address.md) diff --git a/packages/util/docs/functions/createContractAddress2.md b/packages/util/docs/functions/createContractAddress2.md new file mode 100644 index 00000000000..84078f4a1c5 --- /dev/null +++ b/packages/util/docs/functions/createContractAddress2.md @@ -0,0 +1,37 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createContractAddress2 + +# Function: createContractAddress2() + +> **createContractAddress2**(`from`, `salt`, `initCode`): [`Address`](../classes/Address.md) + +Defined in: [packages/util/src/address.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L146) + +Generates an address for a contract created using CREATE2. + +## Parameters + +### from + +[`Address`](../classes/Address.md) + +The address which is creating this new address + +### salt + +`Uint8Array` + +A salt + +### initCode + +`Uint8Array` + +The init code of the contract being created + +## Returns + +[`Address`](../classes/Address.md) diff --git a/packages/util/docs/functions/createPartialAccount.md b/packages/util/docs/functions/createPartialAccount.md new file mode 100644 index 00000000000..2a5d9b563c2 --- /dev/null +++ b/packages/util/docs/functions/createPartialAccount.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createPartialAccount + +# Function: createPartialAccount() + +> **createPartialAccount**(`partialAccountData`): [`Account`](../classes/Account.md) + +Defined in: [packages/util/src/account.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L324) + +## Parameters + +### partialAccountData + +[`PartialAccountData`](../interfaces/PartialAccountData.md) + +## Returns + +[`Account`](../classes/Account.md) diff --git a/packages/util/docs/functions/createPartialAccountFromRLP.md b/packages/util/docs/functions/createPartialAccountFromRLP.md new file mode 100644 index 00000000000..c05d7f24d50 --- /dev/null +++ b/packages/util/docs/functions/createPartialAccountFromRLP.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createPartialAccountFromRLP + +# Function: createPartialAccountFromRLP() + +> **createPartialAccountFromRLP**(`serialized`): [`Account`](../classes/Account.md) + +Defined in: [packages/util/src/account.ts:358](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L358) + +## Parameters + +### serialized + +`Uint8Array` + +## Returns + +[`Account`](../classes/Account.md) diff --git a/packages/util/docs/functions/createWithdrawal.md b/packages/util/docs/functions/createWithdrawal.md new file mode 100644 index 00000000000..aa45e5d3e86 --- /dev/null +++ b/packages/util/docs/functions/createWithdrawal.md @@ -0,0 +1,28 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createWithdrawal + +# Function: createWithdrawal() + +> **createWithdrawal**(`withdrawalData`): [`Withdrawal`](../classes/Withdrawal.md) + +Defined in: [packages/util/src/withdrawal.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L106) + +Creates a validator withdrawal request to be submitted to the consensus layer + +## Parameters + +### withdrawalData + +[`WithdrawalData`](../type-aliases/WithdrawalData.md) + +the consensus layer index and validator index values for the +validator requesting the withdrawal and the address and withdrawal amount of the request + +## Returns + +[`Withdrawal`](../classes/Withdrawal.md) + +a [Withdrawal](../classes/Withdrawal.md) object diff --git a/packages/util/docs/functions/createWithdrawalFromBytesArray.md b/packages/util/docs/functions/createWithdrawalFromBytesArray.md new file mode 100644 index 00000000000..b011f20af54 --- /dev/null +++ b/packages/util/docs/functions/createWithdrawalFromBytesArray.md @@ -0,0 +1,28 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createWithdrawalFromBytesArray + +# Function: createWithdrawalFromBytesArray() + +> **createWithdrawalFromBytesArray**(`withdrawalArray`): [`Withdrawal`](../classes/Withdrawal.md) + +Defined in: [packages/util/src/withdrawal.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L127) + +Creates a validator withdrawal request to be submitted to the consensus layer from +an RLP list + +## Parameters + +### withdrawalArray + +[`WithdrawalBytes`](../type-aliases/WithdrawalBytes.md) + +decoded RLP list of withdrawal data elements + +## Returns + +[`Withdrawal`](../classes/Withdrawal.md) + +a [Withdrawal](../classes/Withdrawal.md) object diff --git a/packages/util/docs/functions/createZeroAddress.md b/packages/util/docs/functions/createZeroAddress.md new file mode 100644 index 00000000000..2af3a5e1e62 --- /dev/null +++ b/packages/util/docs/functions/createZeroAddress.md @@ -0,0 +1,17 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / createZeroAddress + +# Function: createZeroAddress() + +> **createZeroAddress**(): [`Address`](../classes/Address.md) + +Defined in: [packages/util/src/address.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/address.ts#L77) + +Returns the zero address. + +## Returns + +[`Address`](../classes/Address.md) diff --git a/packages/util/docs/functions/decodeBinaryTreeLeafBasicData.md b/packages/util/docs/functions/decodeBinaryTreeLeafBasicData.md new file mode 100644 index 00000000000..9ffb187c0f2 --- /dev/null +++ b/packages/util/docs/functions/decodeBinaryTreeLeafBasicData.md @@ -0,0 +1,31 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / decodeBinaryTreeLeafBasicData + +# Function: decodeBinaryTreeLeafBasicData() + +> **decodeBinaryTreeLeafBasicData**(`encodedBasicData`): [`BinaryTreeLeafBasicData`](../type-aliases/BinaryTreeLeafBasicData.md) + +Defined in: [packages/util/src/binaryTree.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L245) + +This function extracts and decodes account header elements (version, nonce, code size, and balance) +from an encoded `Uint8Array` representation of raw BinaryTree leaf-node basic data. Each component is sliced +from the `encodedBasicData` array based on predefined offsets and lengths, and then converted +to its appropriate type (integer or BigInt). + +## Parameters + +### encodedBasicData + +`Uint8Array` + +The encoded BinaryTree leaf basic data containing the version, nonce, +code size, and balance in a compact Uint8Array format. + +## Returns + +[`BinaryTreeLeafBasicData`](../type-aliases/BinaryTreeLeafBasicData.md) + +- An object containing the decoded version, nonce, code size, and balance. diff --git a/packages/util/docs/functions/decodeVerkleLeafBasicData.md b/packages/util/docs/functions/decodeVerkleLeafBasicData.md new file mode 100644 index 00000000000..3663149a6e1 --- /dev/null +++ b/packages/util/docs/functions/decodeVerkleLeafBasicData.md @@ -0,0 +1,31 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / decodeVerkleLeafBasicData + +# Function: decodeVerkleLeafBasicData() + +> **decodeVerkleLeafBasicData**(`encodedBasicData`): [`VerkleLeafBasicData`](../type-aliases/VerkleLeafBasicData.md) + +Defined in: [packages/util/src/verkle.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L309) + +This function extracts and decodes account header elements (version, nonce, code size, and balance) +from an encoded `Uint8Array` representation of raw Verkle leaf-node basic data. Each component is sliced +from the `encodedBasicData` array based on predefined offsets and lengths, and then converted +to its appropriate type (integer or BigInt). + +## Parameters + +### encodedBasicData + +`Uint8Array` + +The encoded Verkle leaf basic data containing the version, nonce, +code size, and balance in a compact Uint8Array format. + +## Returns + +[`VerkleLeafBasicData`](../type-aliases/VerkleLeafBasicData.md) + +- An object containing the decoded version, nonce, code size, and balance. diff --git a/packages/util/docs/functions/ecrecover.md b/packages/util/docs/functions/ecrecover.md new file mode 100644 index 00000000000..45cd997d374 --- /dev/null +++ b/packages/util/docs/functions/ecrecover.md @@ -0,0 +1,42 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / ecrecover + +# Function: ecrecover() + +> **ecrecover**(`msgHash`, `v`, `r`, `s`, `chainId?`): `Uint8Array` + +Defined in: [packages/util/src/signature.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L45) + +ECDSA public key recovery from signature. +NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions + +## Parameters + +### msgHash + +`Uint8Array` + +### v + +`bigint` + +### r + +`Uint8Array` + +### s + +`Uint8Array` + +### chainId? + +`bigint` + +## Returns + +`Uint8Array` + +Recovered public key diff --git a/packages/util/docs/functions/encodeBinaryTreeLeafBasicData.md b/packages/util/docs/functions/encodeBinaryTreeLeafBasicData.md new file mode 100644 index 00000000000..1717050a037 --- /dev/null +++ b/packages/util/docs/functions/encodeBinaryTreeLeafBasicData.md @@ -0,0 +1,32 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / encodeBinaryTreeLeafBasicData + +# Function: encodeBinaryTreeLeafBasicData() + +> **encodeBinaryTreeLeafBasicData**(`account`): `Uint8Array` + +Defined in: [packages/util/src/binaryTree.ts:280](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L280) + +This function takes a `BinaryTreeLeafBasicData` object and encodes its properties +(version, nonce, code size, and balance) into a compact `Uint8Array` format. Each +property is serialized and padded to match the required byte lengths defined by +EIP-7864. Additionally, 4 bytes are reserved for future use as specified +in EIP-7864. + +## Parameters + +### account + +[`Account`](../classes/Account.md) + +An object containing the version, nonce, + code size, and balance to be encoded. + +## Returns + +`Uint8Array` + +- A compact bytes representation of the account header basic data. diff --git a/packages/util/docs/functions/encodeVerkleLeafBasicData.md b/packages/util/docs/functions/encodeVerkleLeafBasicData.md new file mode 100644 index 00000000000..379165c9832 --- /dev/null +++ b/packages/util/docs/functions/encodeVerkleLeafBasicData.md @@ -0,0 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / encodeVerkleLeafBasicData + +# Function: encodeVerkleLeafBasicData() + +> **encodeVerkleLeafBasicData**(`account`): `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:342](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L342) + +This function takes a `VerkleLeafBasicData` object and encodes its properties +(version, nonce, code size, and balance) into a compact `Uint8Array` format. Each +property is serialized and padded to match the required byte lengths defined by +EIP-6800. Additionally, 4 bytes are reserved for future use as specified +in EIP-6800. + +## Parameters + +### account + +[`Account`](../classes/Account.md) + +## Returns + +`Uint8Array` + +- A compact bytes representation of the account header basic data. diff --git a/packages/util/docs/functions/equalsBits.md b/packages/util/docs/functions/equalsBits.md new file mode 100644 index 00000000000..8259cfb6451 --- /dev/null +++ b/packages/util/docs/functions/equalsBits.md @@ -0,0 +1,35 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / equalsBits + +# Function: equalsBits() + +> **equalsBits**(`bits1`, `bits2`): `boolean` + +Defined in: [packages/util/src/bytes.ts:589](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L589) + +Checks whether two arrays of bits are equal. + +Two arrays are considered equal if they have the same length and each corresponding element is identical. + +## Parameters + +### bits1 + +`number`[] + +The first bits array. + +### bits2 + +`number`[] + +The second bits array. + +## Returns + +`boolean` + +True if the arrays are equal; otherwise, false. diff --git a/packages/util/docs/functions/equalsBytes.md b/packages/util/docs/functions/equalsBytes.md new file mode 100644 index 00000000000..4f3bb78df9f --- /dev/null +++ b/packages/util/docs/functions/equalsBytes.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / equalsBytes + +# Function: equalsBytes() + +> **equalsBytes**(`a`, `b`): `boolean` + +Defined in: node\_modules/ethereum-cryptography/esm/utils.d.ts:7 + +## Parameters + +### a + +`Uint8Array` + +### b + +`Uint8Array` + +## Returns + +`boolean` diff --git a/packages/util/docs/functions/fetchFromProvider.md b/packages/util/docs/functions/fetchFromProvider.md new file mode 100644 index 00000000000..b9578f2d46e --- /dev/null +++ b/packages/util/docs/functions/fetchFromProvider.md @@ -0,0 +1,46 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / fetchFromProvider + +# Function: fetchFromProvider() + +> **fetchFromProvider**(`url`, `params`): `Promise`\<`any`\> + +Defined in: [packages/util/src/provider.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L26) + +Makes a simple RPC call to a remote Ethereum JSON-RPC provider and passes through the response. +No parameter or response validation is done. + +## Parameters + +### url + +`string` + +the URL for the JSON RPC provider + +### params + +`rpcParams` + +the parameters for the JSON-RPC method - refer to +https://ethereum.org/en/developers/docs/apis/json-rpc/ for details on RPC methods + +## Returns + +`Promise`\<`any`\> + +the `result` field from the JSON-RPC response + +## Example + +```ts +const provider = 'https://mainnet.infura.io/v3/...' +const params = { + method: 'eth_getBlockByNumber', + params: ['latest', false], +} +const block = await fetchFromProvider(provider, params) +``` diff --git a/packages/util/docs/functions/formatBigDecimal.md b/packages/util/docs/functions/formatBigDecimal.md new file mode 100644 index 00000000000..35d535d84b2 --- /dev/null +++ b/packages/util/docs/functions/formatBigDecimal.md @@ -0,0 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / formatBigDecimal + +# Function: formatBigDecimal() + +> **formatBigDecimal**(`numerator`, `denominator`, `maxDecimalFactor`): `string` + +Defined in: [packages/util/src/units.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L8) + +## Parameters + +### numerator + +`bigint` + +### denominator + +`bigint` + +### maxDecimalFactor + +`bigint` + +## Returns + +`string` diff --git a/packages/util/docs/functions/fromAscii.md b/packages/util/docs/functions/fromAscii.md new file mode 100644 index 00000000000..4c400796771 --- /dev/null +++ b/packages/util/docs/functions/fromAscii.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / fromAscii + +# Function: fromAscii() + +> **fromAscii**(`stringValue`): `string` + +Defined in: [packages/util/src/internal.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L161) + +Should be called to get hex representation (prefixed by 0x) of ascii string + +## Parameters + +### stringValue + +`string` + +## Returns + +`string` + +hex representation of input string diff --git a/packages/util/docs/functions/fromRPCSig.md b/packages/util/docs/functions/fromRPCSig.md new file mode 100644 index 00000000000..0b135104ebd --- /dev/null +++ b/packages/util/docs/functions/fromRPCSig.md @@ -0,0 +1,40 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / fromRPCSig + +# Function: fromRPCSig() + +> **fromRPCSig**(`sig`): `object` + +Defined in: [packages/util/src/signature.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L116) + +Convert signature format of the `eth_sign` RPC method to signature parameters + +NOTE: For an extracted `v` value < 27 (see Geth bug https://github.com/ethereum/go-ethereum/issues/2053) +`v + 27` is returned for the `v` value +NOTE: After EIP1559, `v` could be `0` or `1` but this function assumes +it's a signed message (EIP-191 or EIP-712) adding `27` at the end. Remove if needed. + +## Parameters + +### sig + +`` `0x${string}` `` + +## Returns + +`object` + +### r + +> **r**: `Uint8Array` + +### s + +> **s**: `Uint8Array` + +### v + +> **v**: `bigint` diff --git a/packages/util/docs/functions/fromSigned.md b/packages/util/docs/functions/fromSigned.md new file mode 100644 index 00000000000..d10208b5718 --- /dev/null +++ b/packages/util/docs/functions/fromSigned.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / fromSigned + +# Function: fromSigned() + +> **fromSigned**(`num`): `bigint` + +Defined in: [packages/util/src/bytes.ts:278](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L278) + +Interprets a `Uint8Array` as a signed integer and returns a `BigInt`. Assumes 256-bit numbers. + +## Parameters + +### num + +`Uint8Array` + +Signed integer value + +## Returns + +`bigint` diff --git a/packages/util/docs/functions/fromUtf8.md b/packages/util/docs/functions/fromUtf8.md new file mode 100644 index 00000000000..ebf7c82394a --- /dev/null +++ b/packages/util/docs/functions/fromUtf8.md @@ -0,0 +1,26 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / fromUtf8 + +# Function: fromUtf8() + +> **fromUtf8**(`stringValue`): `string` + +Defined in: [packages/util/src/internal.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L148) + +Should be called to get hex representation (prefixed by 0x) of utf8 string. +Strips leading and trailing 0's. + +## Parameters + +### stringValue + +`string` + +## Returns + +`string` + +hex representation of input string diff --git a/packages/util/docs/functions/generateAddress.md b/packages/util/docs/functions/generateAddress.md new file mode 100644 index 00000000000..c069aa2581e --- /dev/null +++ b/packages/util/docs/functions/generateAddress.md @@ -0,0 +1,31 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / generateAddress + +# Function: generateAddress() + +> **generateAddress**(`from`, `nonce`): `Uint8Array` + +Defined in: [packages/util/src/account.ts:453](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L453) + +Generates an address of a newly created contract. + +## Parameters + +### from + +`Uint8Array` + +The address which is creating this new address + +### nonce + +`Uint8Array` + +The nonce of the from account + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/generateAddress2.md b/packages/util/docs/functions/generateAddress2.md new file mode 100644 index 00000000000..55cf52a04b0 --- /dev/null +++ b/packages/util/docs/functions/generateAddress2.md @@ -0,0 +1,37 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / generateAddress2 + +# Function: generateAddress2() + +> **generateAddress2**(`from`, `salt`, `initCode`): `Uint8Array` + +Defined in: [packages/util/src/account.ts:473](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L473) + +Generates an address for a contract created using CREATE2. + +## Parameters + +### from + +`Uint8Array` + +The address which is creating this new address + +### salt + +`Uint8Array` + +A salt + +### initCode + +`Uint8Array` + +The init code of the contract being created + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/generateBinaryTreeChunkSuffixes.md b/packages/util/docs/functions/generateBinaryTreeChunkSuffixes.md new file mode 100644 index 00000000000..b95521efa35 --- /dev/null +++ b/packages/util/docs/functions/generateBinaryTreeChunkSuffixes.md @@ -0,0 +1,27 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / generateBinaryTreeChunkSuffixes + +# Function: generateBinaryTreeChunkSuffixes() + +> **generateBinaryTreeChunkSuffixes**(`numChunks`): `number`[] + +Defined in: [packages/util/src/binaryTree.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L304) + +Helper method to generate the suffixes for code chunks for putting code + +## Parameters + +### numChunks + +`number` + +number of chunks to generate suffixes for + +## Returns + +`number`[] + +number[] - an array of numbers corresponding to the code chunks being put diff --git a/packages/util/docs/functions/generateBinaryTreeCodeStems.md b/packages/util/docs/functions/generateBinaryTreeCodeStems.md new file mode 100644 index 00000000000..392b3291f0a --- /dev/null +++ b/packages/util/docs/functions/generateBinaryTreeCodeStems.md @@ -0,0 +1,39 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / generateBinaryTreeCodeStems + +# Function: generateBinaryTreeCodeStems() + +> **generateBinaryTreeCodeStems**(`numChunks`, `address`, `hashFunction`): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [packages/util/src/binaryTree.ts:325](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L325) + +Helper method for generating the code stems necessary for putting code + +## Parameters + +### numChunks + +`number` + +the number of code chunks to be put + +### address + +[`Address`](../classes/Address.md) + +the address of the account getting the code + +### hashFunction + +(`input`) => `Uint8Array` + +an initialized BinaryTreeCrypto object + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] + +an array of stems for putting code diff --git a/packages/util/docs/functions/generateChunkSuffixes.md b/packages/util/docs/functions/generateChunkSuffixes.md new file mode 100644 index 00000000000..22a0036e406 --- /dev/null +++ b/packages/util/docs/functions/generateChunkSuffixes.md @@ -0,0 +1,27 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / generateChunkSuffixes + +# Function: generateChunkSuffixes() + +> **generateChunkSuffixes**(`numChunks`): `number`[] + +Defined in: [packages/util/src/verkle.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L360) + +Helper method to generate the suffixes for code chunks for putting code + +## Parameters + +### numChunks + +`number` + +number of chunks to generate suffixes for + +## Returns + +`number`[] + +number[] - an array of numbers corresponding to the code chunks being put diff --git a/packages/util/docs/functions/generateCodeStems.md b/packages/util/docs/functions/generateCodeStems.md new file mode 100644 index 00000000000..0158c90a7de --- /dev/null +++ b/packages/util/docs/functions/generateCodeStems.md @@ -0,0 +1,39 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / generateCodeStems + +# Function: generateCodeStems() + +> **generateCodeStems**(`numChunks`, `address`, `verkleCrypto`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>[]\> + +Defined in: [packages/util/src/verkle.ts:381](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L381) + +Helper method for generating the code stems necessary for putting code + +## Parameters + +### numChunks + +`number` + +the number of code chunks to be put + +### address + +[`Address`](../classes/Address.md) + +the address of the account getting the code + +### verkleCrypto + +[`VerkleCrypto`](../interfaces/VerkleCrypto.md) + +an initialized [VerkleCrypto](../interfaces/VerkleCrypto.md) object + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>[]\> + +an array of stems for putting code diff --git a/packages/util/docs/functions/getBinarySize.md b/packages/util/docs/functions/getBinarySize.md new file mode 100644 index 00000000000..d792e026634 --- /dev/null +++ b/packages/util/docs/functions/getBinarySize.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getBinarySize + +# Function: getBinarySize() + +> **getBinarySize**(`str`): `number` + +Defined in: [packages/util/src/internal.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L82) + +Get the binary size of a string + +## Parameters + +### str + +`string` + +## Returns + +`number` + +the number of bytes contained within the string diff --git a/packages/util/docs/functions/getBinaryTreeIndicesForCodeChunk.md b/packages/util/docs/functions/getBinaryTreeIndicesForCodeChunk.md new file mode 100644 index 00000000000..075cf21a97b --- /dev/null +++ b/packages/util/docs/functions/getBinaryTreeIndicesForCodeChunk.md @@ -0,0 +1,36 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getBinaryTreeIndicesForCodeChunk + +# Function: getBinaryTreeIndicesForCodeChunk() + +> **getBinaryTreeIndicesForCodeChunk**(`chunkId`): `object` + +Defined in: [packages/util/src/binaryTree.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L156) + +Calculates the position of the code chunks in the BinaryTree tree, determining +both the tree index (the node in the tree) and the subindex (the position within the node). + +## Parameters + +### chunkId + +`number` + +The ID representing a specific chunk. + +## Returns + +`object` + +- An object containing the tree index and subindex + +### subIndex + +> **subIndex**: `number` + +### treeIndex + +> **treeIndex**: `number` diff --git a/packages/util/docs/functions/getBinaryTreeIndicesForStorageSlot.md b/packages/util/docs/functions/getBinaryTreeIndicesForStorageSlot.md new file mode 100644 index 00000000000..eee1487ad38 --- /dev/null +++ b/packages/util/docs/functions/getBinaryTreeIndicesForStorageSlot.md @@ -0,0 +1,36 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getBinaryTreeIndicesForStorageSlot + +# Function: getBinaryTreeIndicesForStorageSlot() + +> **getBinaryTreeIndicesForStorageSlot**(`storageKey`): `object` + +Defined in: [packages/util/src/binaryTree.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L133) + +Calculates the position of the storage key in the BinaryTree tree, determining +both the tree index (the node in the tree) and the subindex (the position within the node). + +## Parameters + +### storageKey + +`bigint` + +The key representing a specific storage slot. + +## Returns + +`object` + +- An object containing the tree index and subindex + +### subIndex + +> **subIndex**: `number` + +### treeIndex + +> **treeIndex**: `bigint` diff --git a/packages/util/docs/functions/getBinaryTreeKey.md b/packages/util/docs/functions/getBinaryTreeKey.md new file mode 100644 index 00000000000..bfd2b64b506 --- /dev/null +++ b/packages/util/docs/functions/getBinaryTreeKey.md @@ -0,0 +1,37 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getBinaryTreeKey + +# Function: getBinaryTreeKey() + +> **getBinaryTreeKey**(`stem`, `leaf`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/binaryTree.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L116) + +## Parameters + +### stem + +`Uint8Array` + +The 31-bytes binary tree stem as a Uint8Array. + +### leaf + +`Uint8Array`\<`ArrayBufferLike`\> | [`BinaryTreeLeafType`](../type-aliases/BinaryTreeLeafType.md) + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +The tree key as a Uint8Array. + +## Dev + +Returns the tree key for a given binary tree stem, and sub index. + +## Dev + +Assumes that the tree node width = 256 diff --git a/packages/util/docs/functions/getBinaryTreeKeyForCodeChunk.md b/packages/util/docs/functions/getBinaryTreeKeyForCodeChunk.md new file mode 100644 index 00000000000..7b9050c00b0 --- /dev/null +++ b/packages/util/docs/functions/getBinaryTreeKeyForCodeChunk.md @@ -0,0 +1,39 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getBinaryTreeKeyForCodeChunk + +# Function: getBinaryTreeKeyForCodeChunk() + +> **getBinaryTreeKeyForCodeChunk**(`address`, `chunkId`, `hashFunction`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/binaryTree.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L169) + +Asynchronously calculates the BinaryTree tree key for the specified code chunk ID. + +## Parameters + +### address + +[`Address`](../classes/Address.md) + +The account address to access code for. + +### chunkId + +`number` + +The ID of the code chunk to retrieve. + +### hashFunction + +(`input`) => `Uint8Array` + +The hash function used for BinaryTree-related operations. + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +- The BinaryTree tree key as a byte array. diff --git a/packages/util/docs/functions/getBinaryTreeKeyForStorageSlot.md b/packages/util/docs/functions/getBinaryTreeKeyForStorageSlot.md new file mode 100644 index 00000000000..c4c422fe8ce --- /dev/null +++ b/packages/util/docs/functions/getBinaryTreeKeyForStorageSlot.md @@ -0,0 +1,39 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getBinaryTreeKeyForStorageSlot + +# Function: getBinaryTreeKeyForStorageSlot() + +> **getBinaryTreeKeyForStorageSlot**(`address`, `storageKey`, `hashFunction`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/binaryTree.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L226) + +Asynchronously calculates the BinaryTree tree key for the specified storage slot. + +## Parameters + +### address + +[`Address`](../classes/Address.md) + +The account address to access code for. + +### storageKey + +`bigint` + +The storage slot key to retrieve the key for. + +### hashFunction + +(`input`) => `Uint8Array` + +The hash function used in the Binary Tree. + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +- The BinaryTree tree key as a byte array. diff --git a/packages/util/docs/functions/getBinaryTreeStem.md b/packages/util/docs/functions/getBinaryTreeStem.md new file mode 100644 index 00000000000..3bccc875e08 --- /dev/null +++ b/packages/util/docs/functions/getBinaryTreeStem.md @@ -0,0 +1,41 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getBinaryTreeStem + +# Function: getBinaryTreeStem() + +> **getBinaryTreeStem**(`hashFunction`, `address`, `treeIndex`): `Uint8Array` + +Defined in: [packages/util/src/binaryTree.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L23) + +## Parameters + +### hashFunction + +(`value`) => `Uint8Array` + +The hashFunction for the binary tree + +### address + +[`Address`](../classes/Address.md) + +The address to generate the tree key for. + +### treeIndex + +The index of the tree to generate the key for. Defaults to 0. + +`number` | `bigint` + +## Returns + +`Uint8Array` + +The 31-bytes binary tree stem as a Uint8Array. + +## Dev + +Returns the 31-bytes binary tree stem for a given address and tree index. diff --git a/packages/util/docs/functions/getBlobs.md b/packages/util/docs/functions/getBlobs.md new file mode 100644 index 00000000000..a780ce55dc5 --- /dev/null +++ b/packages/util/docs/functions/getBlobs.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getBlobs + +# Function: getBlobs() + +> **getBlobs**(`input`): `` `0x${string}` ``[] + +Defined in: [packages/util/src/blobs.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L36) + +## Parameters + +### input + +`string` + +## Returns + +`` `0x${string}` ``[] diff --git a/packages/util/docs/functions/getKeys.md b/packages/util/docs/functions/getKeys.md new file mode 100644 index 00000000000..73ff958f52d --- /dev/null +++ b/packages/util/docs/functions/getKeys.md @@ -0,0 +1,41 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getKeys + +# Function: getKeys() + +> **getKeys**(`params`, `key`, `allowEmpty?`): `string`[] + +Defined in: [packages/util/src/internal.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L183) + +Returns the keys from an array of objects. + +## Parameters + +### params + +`Record`\<`string`, `string`\>[] + +### key + +`string` + +### allowEmpty? + +`boolean` + +## Returns + +`string`[] + +## Example + +```js +getKeys([{a: '1', b: '2'}, {a: '3', b: '4'}], 'a') => ['1', '3'] +```` +@param params +@param key +@param allowEmpty +@returns output just a simple array of output keys diff --git a/packages/util/docs/functions/getProvider.md b/packages/util/docs/functions/getProvider.md new file mode 100644 index 00000000000..77192b25871 --- /dev/null +++ b/packages/util/docs/functions/getProvider.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getProvider + +# Function: getProvider() + +> **getProvider**(`provider`): `string` + +Defined in: [packages/util/src/provider.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L66) + +## Parameters + +### provider + +a URL string or [EthersProvider](../interfaces/EthersProvider.md) + +`string` | [`EthersProvider`](../interfaces/EthersProvider.md) + +## Returns + +`string` + +the extracted URL string for the JSON-RPC Provider diff --git a/packages/util/docs/functions/getVerkleKey.md b/packages/util/docs/functions/getVerkleKey.md new file mode 100644 index 00000000000..133d2c81fdb --- /dev/null +++ b/packages/util/docs/functions/getVerkleKey.md @@ -0,0 +1,37 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getVerkleKey + +# Function: getVerkleKey() + +> **getVerkleKey**(`stem`, `leaf`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/verkle.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L180) + +## Parameters + +### stem + +`Uint8Array` + +The 31-bytes verkle tree stem as a Uint8Array. + +### leaf + +`Uint8Array`\<`ArrayBufferLike`\> | [`VerkleLeafType`](../type-aliases/VerkleLeafType.md) + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> + +The tree key as a Uint8Array. + +## Dev + +Returns the tree key for a given verkle tree stem, and sub index. + +## Dev + +Assumes that the verkle node width = 256 diff --git a/packages/util/docs/functions/getVerkleStem.md b/packages/util/docs/functions/getVerkleStem.md new file mode 100644 index 00000000000..c6806c7df24 --- /dev/null +++ b/packages/util/docs/functions/getVerkleStem.md @@ -0,0 +1,45 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getVerkleStem + +# Function: getVerkleStem() + +> **getVerkleStem**(`verkleCrypto`, `address`, `treeIndex`): `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L59) + +## Parameters + +### verkleCrypto + +[`VerkleCrypto`](../interfaces/VerkleCrypto.md) + +The [VerkleCrypto](../interfaces/VerkleCrypto.md) foreign function interface object from Verkle cryptography + +### address + +[`Address`](../classes/Address.md) + +The address to generate the tree key for. + +### treeIndex + +The index of the tree to generate the key for. Defaults to 0. + +`number` | `bigint` + +## Returns + +`Uint8Array` + +The 31-bytes verkle tree stem as a Uint8Array. + +## Dev + +Returns the 31-bytes verkle tree stem for a given address and tree index. + +## Dev + +Assumes that the verkle node width = 256 diff --git a/packages/util/docs/functions/getVerkleTreeIndicesForCodeChunk.md b/packages/util/docs/functions/getVerkleTreeIndicesForCodeChunk.md new file mode 100644 index 00000000000..ec587b43c17 --- /dev/null +++ b/packages/util/docs/functions/getVerkleTreeIndicesForCodeChunk.md @@ -0,0 +1,36 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getVerkleTreeIndicesForCodeChunk + +# Function: getVerkleTreeIndicesForCodeChunk() + +> **getVerkleTreeIndicesForCodeChunk**(`chunkId`): `object` + +Defined in: [packages/util/src/verkle.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L220) + +Calculates the position of the code chunks in the Verkle tree, determining +both the tree index (the node in the tree) and the subindex (the position within the node). + +## Parameters + +### chunkId + +`number` + +The ID representing a specific chunk. + +## Returns + +`object` + +- An object containing the tree index and subindex + +### subIndex + +> **subIndex**: `number` + +### treeIndex + +> **treeIndex**: `number` diff --git a/packages/util/docs/functions/getVerkleTreeIndicesForStorageSlot.md b/packages/util/docs/functions/getVerkleTreeIndicesForStorageSlot.md new file mode 100644 index 00000000000..19d328df991 --- /dev/null +++ b/packages/util/docs/functions/getVerkleTreeIndicesForStorageSlot.md @@ -0,0 +1,36 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getVerkleTreeIndicesForStorageSlot + +# Function: getVerkleTreeIndicesForStorageSlot() + +> **getVerkleTreeIndicesForStorageSlot**(`storageKey`): `object` + +Defined in: [packages/util/src/verkle.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L197) + +Calculates the position of the storage key in the Verkle tree, determining +both the tree index (the node in the tree) and the subindex (the position within the node). + +## Parameters + +### storageKey + +`bigint` + +The key representing a specific storage slot. + +## Returns + +`object` + +- An object containing the tree index and subindex + +### subIndex + +> **subIndex**: `number` + +### treeIndex + +> **treeIndex**: `bigint` diff --git a/packages/util/docs/functions/getVerkleTreeKeyForCodeChunk.md b/packages/util/docs/functions/getVerkleTreeKeyForCodeChunk.md new file mode 100644 index 00000000000..13130b779cb --- /dev/null +++ b/packages/util/docs/functions/getVerkleTreeKeyForCodeChunk.md @@ -0,0 +1,39 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getVerkleTreeKeyForCodeChunk + +# Function: getVerkleTreeKeyForCodeChunk() + +> **getVerkleTreeKeyForCodeChunk**(`address`, `chunkId`, `verkleCrypto`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/util/src/verkle.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L233) + +Asynchronously calculates the Verkle tree key for the specified code chunk ID. + +## Parameters + +### address + +[`Address`](../classes/Address.md) + +The account address to access code for. + +### chunkId + +`number` + +The ID of the code chunk to retrieve. + +### verkleCrypto + +[`VerkleCrypto`](../interfaces/VerkleCrypto.md) + +The cryptographic object used for Verkle-related operations. + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +- A promise that resolves to the Verkle tree key as a byte array. diff --git a/packages/util/docs/functions/getVerkleTreeKeyForStorageSlot.md b/packages/util/docs/functions/getVerkleTreeKeyForStorageSlot.md new file mode 100644 index 00000000000..92b6d7b6f49 --- /dev/null +++ b/packages/util/docs/functions/getVerkleTreeKeyForStorageSlot.md @@ -0,0 +1,39 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / getVerkleTreeKeyForStorageSlot + +# Function: getVerkleTreeKeyForStorageSlot() + +> **getVerkleTreeKeyForStorageSlot**(`address`, `storageKey`, `verkleCrypto`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +Defined in: [packages/util/src/verkle.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L290) + +Asynchronously calculates the Verkle tree key for the specified storage slot. + +## Parameters + +### address + +[`Address`](../classes/Address.md) + +The account address to access code for. + +### storageKey + +`bigint` + +The storage slot key to retrieve the verkle key for. + +### verkleCrypto + +[`VerkleCrypto`](../interfaces/VerkleCrypto.md) + +The cryptographic object used for Verkle-related operations. + +## Returns + +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> + +- A promise that resolves to the Verkle tree key as a byte array. diff --git a/packages/util/docs/functions/hashPersonalMessage.md b/packages/util/docs/functions/hashPersonalMessage.md new file mode 100644 index 00000000000..c980c876c4a --- /dev/null +++ b/packages/util/docs/functions/hashPersonalMessage.md @@ -0,0 +1,26 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / hashPersonalMessage + +# Function: hashPersonalMessage() + +> **hashPersonalMessage**(`message`): `Uint8Array` + +Defined in: [packages/util/src/signature.ts:198](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L198) + +Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call. +The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign` +call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key +used to produce the signature. + +## Parameters + +### message + +`Uint8Array` + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/hexToBigInt.md b/packages/util/docs/functions/hexToBigInt.md new file mode 100644 index 00000000000..e1ecf41378f --- /dev/null +++ b/packages/util/docs/functions/hexToBigInt.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / hexToBigInt + +# Function: hexToBigInt() + +> **hexToBigInt**(`input`): `bigint` + +Defined in: [packages/util/src/bytes.ts:499](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L499) + +## Parameters + +### input + +`` `0x${string}` `` + +## Returns + +`bigint` diff --git a/packages/util/docs/functions/hexToBytes.md b/packages/util/docs/functions/hexToBytes.md new file mode 100644 index 00000000000..ae41d3ffa9c --- /dev/null +++ b/packages/util/docs/functions/hexToBytes.md @@ -0,0 +1,31 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / hexToBytes + +# Function: hexToBytes() + +> **hexToBytes**(`hex`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L27) + +Converts a [PrefixedHexString](../type-aliases/PrefixedHexString.md) to a Uint8Array + +## Parameters + +### hex + +`` `0x${string}` `` + +The 0x-prefixed hex string to convert + +## Returns + +`Uint8Array` + +The converted bytes + +## Throws + +If the input is not a valid 0x-prefixed hex string diff --git a/packages/util/docs/functions/importPublic.md b/packages/util/docs/functions/importPublic.md new file mode 100644 index 00000000000..ef637d16d81 --- /dev/null +++ b/packages/util/docs/functions/importPublic.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / importPublic + +# Function: importPublic() + +> **importPublic**(`publicKey`): `Uint8Array` + +Defined in: [packages/util/src/account.ts:572](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L572) + +Converts a public key to the Ethereum format. + +## Parameters + +### publicKey + +`Uint8Array` + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/int32ToBytes.md b/packages/util/docs/functions/int32ToBytes.md new file mode 100644 index 00000000000..c9dc33f787c --- /dev/null +++ b/packages/util/docs/functions/int32ToBytes.md @@ -0,0 +1,35 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / int32ToBytes + +# Function: int32ToBytes() + +> **int32ToBytes**(`value`, `littleEndian`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:477](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L477) + +## Parameters + +### value + +`number` + +The 32-bit integer to convert. + +### littleEndian + +`boolean` = `false` + +True for little-endian, undefined or false for big-endian. + +## Returns + +`Uint8Array` + +A Uint8Array of length 4 containing the integer. + +## Notice + +Convert a 32-bit integer to a Uint8Array. diff --git a/packages/util/docs/functions/intToBytes.md b/packages/util/docs/functions/intToBytes.md new file mode 100644 index 00000000000..1f9c6ccdc81 --- /dev/null +++ b/packages/util/docs/functions/intToBytes.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / intToBytes + +# Function: intToBytes() + +> **intToBytes**(`i`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L108) + +Converts an number to a Uint8Array + +## Parameters + +### i + +`number` + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/intToHex.md b/packages/util/docs/functions/intToHex.md new file mode 100644 index 00000000000..e842a6864eb --- /dev/null +++ b/packages/util/docs/functions/intToHex.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / intToHex + +# Function: intToHex() + +> **intToHex**(`i`): `` `0x${string}` `` + +Defined in: [packages/util/src/bytes.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L96) + +Converts a number into a [PrefixedHexString](../type-aliases/PrefixedHexString.md) + +## Parameters + +### i + +`number` + +## Returns + +`` `0x${string}` `` diff --git a/packages/util/docs/functions/intToUnpaddedBytes.md b/packages/util/docs/functions/intToUnpaddedBytes.md new file mode 100644 index 00000000000..ef6f80d1a95 --- /dev/null +++ b/packages/util/docs/functions/intToUnpaddedBytes.md @@ -0,0 +1,26 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / intToUnpaddedBytes + +# Function: intToUnpaddedBytes() + +> **intToUnpaddedBytes**(`value`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:394](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L394) + +Convert value from number to an unpadded Uint8Array +(useful for RLP transport) + +## Parameters + +### value + +`number` + +the bigint to convert + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/isHexString.md b/packages/util/docs/functions/isHexString.md new file mode 100644 index 00000000000..bbb01c3554a --- /dev/null +++ b/packages/util/docs/functions/isHexString.md @@ -0,0 +1,33 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / isHexString + +# Function: isHexString() + +> **isHexString**(`value`, `length?`): `` value is `0x${string}` `` + +Defined in: [packages/util/src/internal.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L36) + +Returns a boolean on whether or not the the input starts with '0x' and matches the optional length + +## Parameters + +### value + +`string` + +the string input value + +### length? + +`number` + +the optional length of the hex string in bytes + +## Returns + +`` value is `0x${string}` `` + +Whether or not the string is a valid PrefixedHexString matching the optional length diff --git a/packages/util/docs/functions/isNestedUint8Array.md b/packages/util/docs/functions/isNestedUint8Array.md new file mode 100644 index 00000000000..60a4d9d5d42 --- /dev/null +++ b/packages/util/docs/functions/isNestedUint8Array.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / isNestedUint8Array + +# Function: isNestedUint8Array() + +> **isNestedUint8Array**(`value`): `value is NestedUint8Array` + +Defined in: [packages/util/src/types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L45) + +## Parameters + +### value + +`unknown` + +## Returns + +`value is NestedUint8Array` diff --git a/packages/util/docs/functions/isValidAddress.md b/packages/util/docs/functions/isValidAddress.md new file mode 100644 index 00000000000..56f74f1e4ba --- /dev/null +++ b/packages/util/docs/functions/isValidAddress.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / isValidAddress + +# Function: isValidAddress() + +> **isValidAddress**(`hexAddress`): `` hexAddress is `0x${string}` `` + +Defined in: [packages/util/src/account.ts:386](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L386) + +Checks if the address is a valid. Accepts checksummed addresses too. + +## Parameters + +### hexAddress + +`string` + +## Returns + +`` hexAddress is `0x${string}` `` diff --git a/packages/util/docs/functions/isValidChecksumAddress.md b/packages/util/docs/functions/isValidChecksumAddress.md new file mode 100644 index 00000000000..cc74df2d7c2 --- /dev/null +++ b/packages/util/docs/functions/isValidChecksumAddress.md @@ -0,0 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / isValidChecksumAddress + +# Function: isValidChecksumAddress() + +> **isValidChecksumAddress**(`hexAddress`, `eip1191ChainId?`): `boolean` + +Defined in: [packages/util/src/account.ts:441](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L441) + +Checks if the address is a valid checksummed address. + +See toChecksumAddress' documentation for details about the eip1191ChainId parameter. + +## Parameters + +### hexAddress + +`string` + +### eip1191ChainId? + +[`BigIntLike`](../type-aliases/BigIntLike.md) + +## Returns + +`boolean` diff --git a/packages/util/docs/functions/isValidPrivate.md b/packages/util/docs/functions/isValidPrivate.md new file mode 100644 index 00000000000..de3b36444d9 --- /dev/null +++ b/packages/util/docs/functions/isValidPrivate.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / isValidPrivate + +# Function: isValidPrivate() + +> **isValidPrivate**(`privateKey`): `boolean` + +Defined in: [packages/util/src/account.ts:497](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L497) + +Checks if the private key satisfies the rules of the curve secp256k1. + +## Parameters + +### privateKey + +`Uint8Array` + +## Returns + +`boolean` diff --git a/packages/util/docs/functions/isValidPublic.md b/packages/util/docs/functions/isValidPublic.md new file mode 100644 index 00000000000..f6aeff97d7a --- /dev/null +++ b/packages/util/docs/functions/isValidPublic.md @@ -0,0 +1,32 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / isValidPublic + +# Function: isValidPublic() + +> **isValidPublic**(`publicKey`, `sanitize`): `boolean` + +Defined in: [packages/util/src/account.ts:507](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L507) + +Checks if the public key satisfies the rules of the curve secp256k1 +and the requirements of Ethereum. + +## Parameters + +### publicKey + +`Uint8Array` + +The two points of an uncompressed key, unless sanitize is enabled + +### sanitize + +`boolean` = `false` + +Accept public keys in other formats + +## Returns + +`boolean` diff --git a/packages/util/docs/functions/isValidSignature.md b/packages/util/docs/functions/isValidSignature.md new file mode 100644 index 00000000000..430df1a7bd0 --- /dev/null +++ b/packages/util/docs/functions/isValidSignature.md @@ -0,0 +1,42 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / isValidSignature + +# Function: isValidSignature() + +> **isValidSignature**(`v`, `r`, `s`, `homesteadOrLater`, `chainId?`): `boolean` + +Defined in: [packages/util/src/signature.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L158) + +Validate a ECDSA signature. +NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions + +## Parameters + +### v + +`bigint` + +### r + +`Uint8Array` + +### s + +`Uint8Array` + +### homesteadOrLater + +`boolean` = `true` + +Indicates whether this is being used on either the homestead hardfork or a later one + +### chainId? + +`bigint` + +## Returns + +`boolean` diff --git a/packages/util/docs/functions/isZeroAddress.md b/packages/util/docs/functions/isZeroAddress.md new file mode 100644 index 00000000000..77e82403a6e --- /dev/null +++ b/packages/util/docs/functions/isZeroAddress.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / isZeroAddress + +# Function: isZeroAddress() + +> **isZeroAddress**(`hexAddress`): `boolean` + +Defined in: [packages/util/src/account.ts:590](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L590) + +Checks if a given address is the zero address. + +## Parameters + +### hexAddress + +`string` + +## Returns + +`boolean` diff --git a/packages/util/docs/functions/matchingBitsLength.md b/packages/util/docs/functions/matchingBitsLength.md new file mode 100644 index 00000000000..aa6c24498cd --- /dev/null +++ b/packages/util/docs/functions/matchingBitsLength.md @@ -0,0 +1,33 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / matchingBitsLength + +# Function: matchingBitsLength() + +> **matchingBitsLength**(`bits1`, `bits2`): `number` + +Defined in: [packages/util/src/bytes.ts:567](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L567) + +Compares two arrays of bits (0 or 1) and returns the count of consecutively matching bits from the start. + +## Parameters + +### bits1 + +`number`[] + +The first array of bits, in bytes or bits. + +### bits2 + +`number`[] + +The second array of bits, in bytes or bits. + +## Returns + +`number` + +The count of consecutively matching bits from the start. diff --git a/packages/util/docs/functions/matchingBytesLength.md b/packages/util/docs/functions/matchingBytesLength.md new file mode 100644 index 00000000000..0d3909064eb --- /dev/null +++ b/packages/util/docs/functions/matchingBytesLength.md @@ -0,0 +1,33 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / matchingBytesLength + +# Function: matchingBytesLength() + +> **matchingBytesLength**(`bytes1`, `bytes2`): `number` + +Defined in: [packages/util/src/bytes.ts:546](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L546) + +Compares two byte arrays and returns the count of consecutively matching items from the start. + +## Parameters + +### bytes1 + +`Uint8Array` + +The first Uint8Array to compare. + +### bytes2 + +`Uint8Array` + +The second Uint8Array to compare. + +## Returns + +`number` + +The count of consecutively matching items from the start. diff --git a/packages/util/docs/functions/padToEven.md b/packages/util/docs/functions/padToEven.md new file mode 100644 index 00000000000..c4d92ede751 --- /dev/null +++ b/packages/util/docs/functions/padToEven.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / padToEven + +# Function: padToEven() + +> **padToEven**(`value`): `string` + +Defined in: [packages/util/src/internal.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L63) + +Pads a `String` to have an even length + +## Parameters + +### value + +`string` + +## Returns + +`string` + +output diff --git a/packages/util/docs/functions/privateToAddress.md b/packages/util/docs/functions/privateToAddress.md new file mode 100644 index 00000000000..40ec17f851b --- /dev/null +++ b/packages/util/docs/functions/privateToAddress.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / privateToAddress + +# Function: privateToAddress() + +> **privateToAddress**(`privateKey`): `Uint8Array` + +Defined in: [packages/util/src/account.ts:565](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L565) + +Returns the ethereum address of a given private key. + +## Parameters + +### privateKey + +`Uint8Array` + +A private key must be 256 bits wide + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/privateToPublic.md b/packages/util/docs/functions/privateToPublic.md new file mode 100644 index 00000000000..8fcb7996389 --- /dev/null +++ b/packages/util/docs/functions/privateToPublic.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / privateToPublic + +# Function: privateToPublic() + +> **privateToPublic**(`privateKey`): `Uint8Array` + +Defined in: [packages/util/src/account.ts:555](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L555) + +Returns the ethereum public key of a given private key. + +## Parameters + +### privateKey + +`Uint8Array` + +A private key must be 256 bits wide + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/pubToAddress.md b/packages/util/docs/functions/pubToAddress.md new file mode 100644 index 00000000000..538c79442ee --- /dev/null +++ b/packages/util/docs/functions/pubToAddress.md @@ -0,0 +1,32 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / pubToAddress + +# Function: pubToAddress() + +> **pubToAddress**(`pubKey`, `sanitize`): `Uint8Array` + +Defined in: [packages/util/src/account.ts:538](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L538) + +Returns the ethereum address of a given public key. +Accepts "Ethereum public keys" and SEC1 encoded keys. + +## Parameters + +### pubKey + +`Uint8Array` + +The two points of an uncompressed key, unless sanitize is enabled + +### sanitize + +`boolean` = `false` + +Accept public keys in other formats + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/randomBytes.md b/packages/util/docs/functions/randomBytes.md new file mode 100644 index 00000000000..ce52dddff13 --- /dev/null +++ b/packages/util/docs/functions/randomBytes.md @@ -0,0 +1,27 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / randomBytes + +# Function: randomBytes() + +> **randomBytes**(`length`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:419](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L419) + +Generates a Uint8Array of random bytes of specified length. + +## Parameters + +### length + +`number` + +The length of the Uint8Array. + +## Returns + +`Uint8Array` + +A Uint8Array of random bytes of specified length. diff --git a/packages/util/docs/functions/setLengthLeft.md b/packages/util/docs/functions/setLengthLeft.md new file mode 100644 index 00000000000..3f252d33708 --- /dev/null +++ b/packages/util/docs/functions/setLengthLeft.md @@ -0,0 +1,32 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / setLengthLeft + +# Function: setLengthLeft() + +> **setLengthLeft**(`msg`, `length`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L153) + +Left Pads a `Uint8Array` with leading zeros till it has `length` bytes. +Or it truncates the beginning if it exceeds. + +## Parameters + +### msg + +`Uint8Array` + +the value to pad + +### length + +`number` + +the number of bytes the output should be + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/setLengthRight.md b/packages/util/docs/functions/setLengthRight.md new file mode 100644 index 00000000000..55f54b139c8 --- /dev/null +++ b/packages/util/docs/functions/setLengthRight.md @@ -0,0 +1,32 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / setLengthRight + +# Function: setLengthRight() + +> **setLengthRight**(`msg`, `length`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L165) + +Right Pads a `Uint8Array` with trailing zeros till it has `length` bytes. +it truncates the end if it exceeds. + +## Parameters + +### msg + +`Uint8Array` + +the value to pad + +### length + +`number` + +the number of bytes the output should be + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/short.md b/packages/util/docs/functions/short.md new file mode 100644 index 00000000000..3584e1f4017 --- /dev/null +++ b/packages/util/docs/functions/short.md @@ -0,0 +1,32 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / short + +# Function: short() + +> **short**(`bytes`, `maxLength`): `string` + +Defined in: [packages/util/src/bytes.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L315) + +Shortens a string or Uint8Array's hex string representation to maxLength (default 50). + +Examples: + +Input: '657468657265756d000000000000000000000000000000000000000000000000' +Output: '657468657265756d0000000000000000000000000000000000…' + +## Parameters + +### bytes + +`string` | `Uint8Array`\<`ArrayBufferLike`\> + +### maxLength + +`number` = `50` + +## Returns + +`string` diff --git a/packages/util/docs/functions/stripHexPrefix.md b/packages/util/docs/functions/stripHexPrefix.md new file mode 100644 index 00000000000..7545bf0ba89 --- /dev/null +++ b/packages/util/docs/functions/stripHexPrefix.md @@ -0,0 +1,27 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / stripHexPrefix + +# Function: stripHexPrefix() + +> **stripHexPrefix**(`str`): `string` + +Defined in: [packages/util/src/internal.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L49) + +Removes '0x' from a given `String` if present + +## Parameters + +### str + +`string` + +the string value + +## Returns + +`string` + +the string without 0x prefix diff --git a/packages/util/docs/functions/toAscii.md b/packages/util/docs/functions/toAscii.md new file mode 100644 index 00000000000..01b37d98f06 --- /dev/null +++ b/packages/util/docs/functions/toAscii.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / toAscii + +# Function: toAscii() + +> **toAscii**(`hex`): `string` + +Defined in: [packages/util/src/internal.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L125) + +Should be called to get ascii from its hex representation + +## Parameters + +### hex + +`string` + +## Returns + +`string` + +ascii string representation of hex value diff --git a/packages/util/docs/functions/toBytes.md b/packages/util/docs/functions/toBytes.md new file mode 100644 index 00000000000..4271ee46139 --- /dev/null +++ b/packages/util/docs/functions/toBytes.md @@ -0,0 +1,27 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / toBytes + +# Function: toBytes() + +> **toBytes**(`v`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L234) + +Attempts to turn a value into a `Uint8Array`. +Inputs supported: `Buffer`, `Uint8Array`, `String` (hex-prefixed), `Number`, null/undefined, `BigInt` and other objects +with a `toArray()` or `toBytes()` method. + +## Parameters + +### v + +[`ToBytesInputTypes`](../type-aliases/ToBytesInputTypes.md) + +the value + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/toChecksumAddress.md b/packages/util/docs/functions/toChecksumAddress.md new file mode 100644 index 00000000000..4d69338c152 --- /dev/null +++ b/packages/util/docs/functions/toChecksumAddress.md @@ -0,0 +1,36 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / toChecksumAddress + +# Function: toChecksumAddress() + +> **toChecksumAddress**(`hexAddress`, `eip1191ChainId?`): `` `0x${string}` `` + +Defined in: [packages/util/src/account.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L408) + +Returns a checksummed address. + +If an eip1191ChainId is provided, the chainId will be included in the checksum calculation. This +has the effect of checksummed addresses for one chain having invalid checksums for others. +For more details see [EIP-1191](https://eips.ethereum.org/EIPS/eip-1191). + +WARNING: Checksums with and without the chainId will differ and the EIP-1191 checksum is not +backwards compatible to the original widely adopted checksum format standard introduced in +[EIP-55](https://eips.ethereum.org/EIPS/eip-55), so this will break in existing applications. +Usage of this EIP is therefore discouraged unless you have a very targeted use case. + +## Parameters + +### hexAddress + +`string` + +### eip1191ChainId? + +[`BigIntLike`](../type-aliases/BigIntLike.md) + +## Returns + +`` `0x${string}` `` diff --git a/packages/util/docs/functions/toCompactSig.md b/packages/util/docs/functions/toCompactSig.md new file mode 100644 index 00000000000..bbac890e39d --- /dev/null +++ b/packages/util/docs/functions/toCompactSig.md @@ -0,0 +1,38 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / toCompactSig + +# Function: toCompactSig() + +> **toCompactSig**(`v`, `r`, `s`, `chainId?`): `string` + +Defined in: [packages/util/src/signature.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L89) + +Convert signature parameters into the format of Compact Signature Representation (EIP-2098). +NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions + +## Parameters + +### v + +`bigint` + +### r + +`Uint8Array` + +### s + +`Uint8Array` + +### chainId? + +`bigint` + +## Returns + +`string` + +Signature diff --git a/packages/util/docs/functions/toRPCSig.md b/packages/util/docs/functions/toRPCSig.md new file mode 100644 index 00000000000..8710b3386d8 --- /dev/null +++ b/packages/util/docs/functions/toRPCSig.md @@ -0,0 +1,38 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / toRPCSig + +# Function: toRPCSig() + +> **toRPCSig**(`v`, `r`, `s`, `chainId?`): `string` + +Defined in: [packages/util/src/signature.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L68) + +Convert signature parameters into the format of `eth_sign` RPC method. +NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions + +## Parameters + +### v + +`bigint` + +### r + +`Uint8Array` + +### s + +`Uint8Array` + +### chainId? + +`bigint` + +## Returns + +`string` + +Signature diff --git a/packages/util/docs/functions/toType.md b/packages/util/docs/functions/toType.md new file mode 100644 index 00000000000..a3935e2a08a --- /dev/null +++ b/packages/util/docs/functions/toType.md @@ -0,0 +1,106 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / toType + +# Function: toType() + +## Call Signature + +> **toType**\<`T`\>(`input`, `outputType`): `null` + +Defined in: [packages/util/src/types.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L83) + +Convert an input to a specified type. +Input of null/undefined returns null/undefined regardless of the output type. + +### Type Parameters + +#### T + +`T` *extends* [`TypeOutput`](../type-aliases/TypeOutput.md) + +### Parameters + +#### input + +`null` + +value to convert + +#### outputType + +`T` + +type to output + +### Returns + +`null` + +## Call Signature + +> **toType**\<`T`\>(`input`, `outputType`): `undefined` + +Defined in: [packages/util/src/types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L84) + +Convert an input to a specified type. +Input of null/undefined returns null/undefined regardless of the output type. + +### Type Parameters + +#### T + +`T` *extends* [`TypeOutput`](../type-aliases/TypeOutput.md) + +### Parameters + +#### input + +`undefined` + +value to convert + +#### outputType + +`T` + +type to output + +### Returns + +`undefined` + +## Call Signature + +> **toType**\<`T`\>(`input`, `outputType`): [`TypeOutputReturnType`](../type-aliases/TypeOutputReturnType.md)\[`T`\] + +Defined in: [packages/util/src/types.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L85) + +Convert an input to a specified type. +Input of null/undefined returns null/undefined regardless of the output type. + +### Type Parameters + +#### T + +`T` *extends* [`TypeOutput`](../type-aliases/TypeOutput.md) + +### Parameters + +#### input + +[`ToBytesInputTypes`](../type-aliases/ToBytesInputTypes.md) + +value to convert + +#### outputType + +`T` + +type to output + +### Returns + +[`TypeOutputReturnType`](../type-aliases/TypeOutputReturnType.md)\[`T`\] diff --git a/packages/util/docs/functions/toUnsigned.md b/packages/util/docs/functions/toUnsigned.md new file mode 100644 index 00000000000..a309e1ebdb1 --- /dev/null +++ b/packages/util/docs/functions/toUnsigned.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / toUnsigned + +# Function: toUnsigned() + +> **toUnsigned**(`num`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L287) + +Converts a `BigInt` to an unsigned integer and returns it as a `Uint8Array`. Assumes 256-bit numbers. + +## Parameters + +### num + +`bigint` + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/unpadArray.md b/packages/util/docs/functions/unpadArray.md new file mode 100644 index 00000000000..3025ec94bed --- /dev/null +++ b/packages/util/docs/functions/unpadArray.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / unpadArray + +# Function: unpadArray() + +> **unpadArray**(`a`): `number`[] + +Defined in: [packages/util/src/bytes.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L201) + +Trims leading zeros from an `Array` (of numbers). + +## Parameters + +### a + +`number`[] + +## Returns + +`number`[] diff --git a/packages/util/docs/functions/unpadBytes.md b/packages/util/docs/functions/unpadBytes.md new file mode 100644 index 00000000000..4d29c835699 --- /dev/null +++ b/packages/util/docs/functions/unpadBytes.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / unpadBytes + +# Function: unpadBytes() + +> **unpadBytes**(`a`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L191) + +Trims leading zeros from a `Uint8Array`. + +## Parameters + +### a + +`Uint8Array` + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/unpadHex.md b/packages/util/docs/functions/unpadHex.md new file mode 100644 index 00000000000..2413360c91f --- /dev/null +++ b/packages/util/docs/functions/unpadHex.md @@ -0,0 +1,23 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / unpadHex + +# Function: unpadHex() + +> **unpadHex**(`a`): `` `0x${string}` `` + +Defined in: [packages/util/src/bytes.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L211) + +Trims leading zeros from a `PrefixedHexString`. + +## Parameters + +### a + +`` `0x${string}` `` + +## Returns + +`` `0x${string}` `` diff --git a/packages/util/docs/functions/unprefixedHexToBytes.md b/packages/util/docs/functions/unprefixedHexToBytes.md new file mode 100644 index 00000000000..cc51b16e29e --- /dev/null +++ b/packages/util/docs/functions/unprefixedHexToBytes.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / unprefixedHexToBytes + +# Function: unprefixedHexToBytes() + +> **unprefixedHexToBytes**(`hex`): `Uint8Array` + +Defined in: [packages/util/src/bytes.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L32) + +## Parameters + +### hex + +`string` + +## Returns + +`Uint8Array` diff --git a/packages/util/docs/functions/utf8ToBytes.md b/packages/util/docs/functions/utf8ToBytes.md new file mode 100644 index 00000000000..bfc153ae65f --- /dev/null +++ b/packages/util/docs/functions/utf8ToBytes.md @@ -0,0 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / utf8ToBytes + +# Function: utf8ToBytes() + +> **utf8ToBytes**(`str`): `Uint8Array` + +Defined in: node\_modules/@noble/hashes/esm/utils.d.ts:44 + +Convert JS string to byte array. + +## Parameters + +### str + +`string` + +## Returns + +`Uint8Array` + +## Example + +```ts +utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) +``` diff --git a/packages/util/docs/functions/validateNoLeadingZeroes.md b/packages/util/docs/functions/validateNoLeadingZeroes.md new file mode 100644 index 00000000000..79259b14a39 --- /dev/null +++ b/packages/util/docs/functions/validateNoLeadingZeroes.md @@ -0,0 +1,35 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / validateNoLeadingZeroes + +# Function: validateNoLeadingZeroes() + +> **validateNoLeadingZeroes**(`values`): `void` + +Defined in: [packages/util/src/bytes.ts:337](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L337) + +Checks provided Uint8Array for leading zeroes and throws if found. + +Examples: + +Valid values: 0x1, 0x, 0x01, 0x1234 +Invalid values: 0x0, 0x00, 0x001, 0x0001 + +Note: This method is useful for validating that RLP encoded integers comply with the rule that all +integer values encoded to RLP must be in the most compact form and contain no leading zero bytes + +## Parameters + +### values + +An object containing string keys and Uint8Array values + +## Returns + +`void` + +## Throws + +if any provided value is found to have leading zero bytes diff --git a/packages/util/docs/functions/verifyVerkleProof.md b/packages/util/docs/functions/verifyVerkleProof.md new file mode 100644 index 00000000000..55a3cc1f880 --- /dev/null +++ b/packages/util/docs/functions/verifyVerkleProof.md @@ -0,0 +1,33 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / verifyVerkleProof + +# Function: verifyVerkleProof() + +> **verifyVerkleProof**(`verkleCrypto`, `executionWitness`): `boolean` + +Defined in: [packages/util/src/verkle.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L84) + +Verifies that the executionWitness is valid for the given prestateRoot. + +## Parameters + +### verkleCrypto + +[`VerkleCrypto`](../interfaces/VerkleCrypto.md) + +The [VerkleCrypto](../interfaces/VerkleCrypto.md) foreign function interface object from Verkle cryptography + +### executionWitness + +[`VerkleExecutionWitness`](../interfaces/VerkleExecutionWitness.md) + +The verkle execution witness. + +## Returns + +`boolean` + +Whether or not the executionWitness belongs to the prestateRoot. diff --git a/packages/util/docs/functions/withdrawalToBytesArray.md b/packages/util/docs/functions/withdrawalToBytesArray.md new file mode 100644 index 00000000000..ae8998db689 --- /dev/null +++ b/packages/util/docs/functions/withdrawalToBytesArray.md @@ -0,0 +1,27 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / withdrawalToBytesArray + +# Function: withdrawalToBytesArray() + +> **withdrawalToBytesArray**(`withdrawal`): [`WithdrawalBytes`](../type-aliases/WithdrawalBytes.md) + +Defined in: [packages/util/src/withdrawal.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L36) + +Convert a withdrawal to a byte array + +## Parameters + +### withdrawal + +the withdrawal to convert + +[`WithdrawalData`](../type-aliases/WithdrawalData.md) | [`Withdrawal`](../classes/Withdrawal.md) + +## Returns + +[`WithdrawalBytes`](../type-aliases/WithdrawalBytes.md) + +byte array of the withdrawal diff --git a/packages/util/docs/functions/zeroAddress.md b/packages/util/docs/functions/zeroAddress.md new file mode 100644 index 00000000000..486dc2e957f --- /dev/null +++ b/packages/util/docs/functions/zeroAddress.md @@ -0,0 +1,17 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / zeroAddress + +# Function: zeroAddress() + +> **zeroAddress**(): `` `0x${string}` `` + +Defined in: [packages/util/src/account.ts:583](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L583) + +Returns the zero address. + +## Returns + +`` `0x${string}` `` diff --git a/packages/util/docs/interfaces/AccountData.md b/packages/util/docs/interfaces/AccountData.md index a48a07da4ce..1038a312b6b 100644 --- a/packages/util/docs/interfaces/AccountData.md +++ b/packages/util/docs/interfaces/AccountData.md @@ -1,52 +1,41 @@ -[@ethereumjs/util](../README.md) / AccountData +[**@ethereumjs/util**](../README.md) -# Interface: AccountData +*** -## Table of contents +[@ethereumjs/util](../README.md) / AccountData -### Properties +# Interface: AccountData -- [balance](AccountData.md#balance) -- [codeHash](AccountData.md#codehash) -- [nonce](AccountData.md#nonce) -- [storageRoot](AccountData.md#storageroot) +Defined in: [packages/util/src/account.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L24) ## Properties -### balance - -• `Optional` **balance**: [`BigIntLike`](../README.md#bigintlike) - -#### Defined in - -[packages/util/src/account.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L24) - -___ +### balance? -### codeHash +> `optional` **balance**: [`BigIntLike`](../type-aliases/BigIntLike.md) -• `Optional` **codeHash**: [`BytesLike`](../README.md#byteslike) +Defined in: [packages/util/src/account.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L26) -#### Defined in +*** -[packages/util/src/account.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L26) +### codeHash? -___ +> `optional` **codeHash**: [`BytesLike`](../type-aliases/BytesLike.md) -### nonce +Defined in: [packages/util/src/account.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L28) -• `Optional` **nonce**: [`BigIntLike`](../README.md#bigintlike) +*** -#### Defined in +### nonce? -[packages/util/src/account.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L23) +> `optional` **nonce**: [`BigIntLike`](../type-aliases/BigIntLike.md) -___ +Defined in: [packages/util/src/account.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L25) -### storageRoot +*** -• `Optional` **storageRoot**: [`BytesLike`](../README.md#byteslike) +### storageRoot? -#### Defined in +> `optional` **storageRoot**: [`BytesLike`](../type-aliases/BytesLike.md) -[packages/util/src/account.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L25) +Defined in: [packages/util/src/account.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L27) diff --git a/packages/util/docs/interfaces/BinaryTreeExecutionWitness.md b/packages/util/docs/interfaces/BinaryTreeExecutionWitness.md new file mode 100644 index 00000000000..9a3ef3b05a4 --- /dev/null +++ b/packages/util/docs/interfaces/BinaryTreeExecutionWitness.md @@ -0,0 +1,45 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BinaryTreeExecutionWitness + +# Interface: BinaryTreeExecutionWitness + +Defined in: [packages/util/src/binaryTree.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L58) + +Experimental, object format could eventual change. +An object that provides the state and proof necessary for binary tree stateless execution + +## Properties + +### parentStateRoot + +> **parentStateRoot**: `` `0x${string}` `` + +Defined in: [packages/util/src/binaryTree.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L62) + +The stateRoot of the parent block + +*** + +### proof + +> **proof**: `any` + +Defined in: [packages/util/src/binaryTree.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L73) + +The proof for the block. +Proves that the provided stateDiff belongs to the canonical binary tree. + +*** + +### stateDiff + +> **stateDiff**: [`BinaryTreeStateDiff`](BinaryTreeStateDiff.md)[] + +Defined in: [packages/util/src/binaryTree.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L68) + +An array of state diffs. +Each item corresponding to state accesses or state modifications of the block. +In the current design, it also contains the resulting state of the block execution (post-state). diff --git a/packages/util/docs/interfaces/BinaryTreeStateDiff.md b/packages/util/docs/interfaces/BinaryTreeStateDiff.md new file mode 100644 index 00000000000..e1ba70a48ea --- /dev/null +++ b/packages/util/docs/interfaces/BinaryTreeStateDiff.md @@ -0,0 +1,37 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BinaryTreeStateDiff + +# Interface: BinaryTreeStateDiff + +Defined in: [packages/util/src/binaryTree.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L42) + +## Properties + +### stem + +> **stem**: `` `0x${string}` `` + +Defined in: [packages/util/src/binaryTree.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L43) + +*** + +### suffixDiffs + +> **suffixDiffs**: `object`[] + +Defined in: [packages/util/src/binaryTree.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L44) + +#### currentValue + +> **currentValue**: `null` \| `` `0x${string}` `` + +#### newValue + +> **newValue**: `null` \| `` `0x${string}` `` + +#### suffix + +> **suffix**: `string` \| `number` diff --git a/packages/util/docs/interfaces/DB.md b/packages/util/docs/interfaces/DB.md index bec4a1348b5..39dc4e43e04 100644 --- a/packages/util/docs/interfaces/DB.md +++ b/packages/util/docs/interfaces/DB.md @@ -1,152 +1,150 @@ -[@ethereumjs/util](../README.md) / DB +[**@ethereumjs/util**](../README.md) + +*** -# Interface: DB +[@ethereumjs/util](../README.md) / DB -## Type parameters +# Interface: DB\ -| Name | Type | -| :------ | :------ | -| `TKey` | extends `Uint8Array` \| `string` \| `number` = `Uint8Array` | -| `TValue` | extends `Uint8Array` \| `string` \| [`DBObject`](../README.md#dbobject) = `Uint8Array` | +Defined in: [packages/util/src/db.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L45) -## Implemented by +## Type Parameters -- [`MapDB`](../classes/MapDB.md) +### TKey -## Table of contents +`TKey` *extends* `Uint8Array` \| `string` \| `number` = `Uint8Array` -### Methods +### TValue -- [batch](DB.md#batch) -- [del](DB.md#del) -- [get](DB.md#get) -- [open](DB.md#open) -- [put](DB.md#put) -- [shallowCopy](DB.md#shallowcopy) +`TValue` *extends* `Uint8Array` \| `string` \| [`DBObject`](../type-aliases/DBObject.md) = `Uint8Array` ## Methods -### batch +### batch() + +> **batch**(`opStack`): `Promise`\<`void`\> -▸ **batch**(`opStack`): `Promise`<`void`\> +Defined in: [packages/util/src/db.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L73) Performs a batch operation on db. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `opStack` | [`BatchDBOp`](../README.md#batchdbop)<`TKey`, `TValue`\>[] | A stack of levelup operations | +##### opStack -#### Returns +[`BatchDBOp`](../type-aliases/BatchDBOp.md)\<`TKey`, `TValue`\>[] + +A stack of levelup operations -`Promise`<`void`\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[packages/util/src/db.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L69) +*** -___ +### del() -### del +> **del**(`key`, `opts?`): `Promise`\<`void`\> -▸ **del**(`key`, `opts?`): `Promise`<`void`\> +Defined in: [packages/util/src/db.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L67) Removes a raw value in the underlying db. #### Parameters -| Name | Type | -| :------ | :------ | -| `key` | `TKey` | -| `opts?` | [`EncodingOpts`](../README.md#encodingopts) | +##### key -#### Returns +`TKey` + +##### opts? + +[`EncodingOpts`](../type-aliases/EncodingOpts.md) -`Promise`<`void`\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[packages/util/src/db.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L63) +*** -___ +### get() -### get +> **get**(`key`, `opts?`): `Promise`\<`undefined` \| `TValue`\> -▸ **get**(`key`, `opts?`): `Promise`<`undefined` \| `TValue`\> +Defined in: [packages/util/src/db.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L54) Retrieves a raw value from db. #### Parameters -| Name | Type | -| :------ | :------ | -| `key` | `TKey` | -| `opts?` | [`EncodingOpts`](../README.md#encodingopts) | +##### key + +`TKey` + +##### opts? + +[`EncodingOpts`](../type-aliases/EncodingOpts.md) #### Returns -`Promise`<`undefined` \| `TValue`\> +`Promise`\<`undefined` \| `TValue`\> A Promise that resolves to `Uint8Array` if a value is found or `undefined` if no value is found. -#### Defined in - -[packages/util/src/db.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L50) +*** -___ +### open() -### open +> **open**(): `Promise`\<`void`\> -▸ **open**(): `Promise`<`void`\> +Defined in: [packages/util/src/db.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L84) Opens the database -- if applicable #### Returns -`Promise`<`void`\> - -#### Defined in +`Promise`\<`void`\> -[packages/util/src/db.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L80) +*** -___ +### put() -### put +> **put**(`key`, `val`, `opts?`): `Promise`\<`void`\> -▸ **put**(`key`, `val`, `opts?`): `Promise`<`void`\> +Defined in: [packages/util/src/db.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L61) Writes a value directly to db. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `TKey` | The key as a `TValue` | -| `val` | `TValue` | - | -| `opts?` | [`EncodingOpts`](../README.md#encodingopts) | - | +##### key -#### Returns +`TKey` + +The key as a `TValue` + +##### val -`Promise`<`void`\> +`TValue` -#### Defined in +##### opts? -[packages/util/src/db.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L57) +[`EncodingOpts`](../type-aliases/EncodingOpts.md) -___ +#### Returns + +`Promise`\<`void`\> + +*** -### shallowCopy +### shallowCopy() -▸ **shallowCopy**(): [`DB`](DB.md)<`TKey`, `TValue`\> +> **shallowCopy**(): `DB`\<`TKey`, `TValue`\> + +Defined in: [packages/util/src/db.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L79) Returns a copy of the DB instance, with a reference to the **same** underlying db instance. #### Returns -[`DB`](DB.md)<`TKey`, `TValue`\> - -#### Defined in - -[packages/util/src/db.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L75) +`DB`\<`TKey`, `TValue`\> diff --git a/packages/util/docs/interfaces/DelBatch.md b/packages/util/docs/interfaces/DelBatch.md index 2a2ee2e113e..3afdf7ce656 100644 --- a/packages/util/docs/interfaces/DelBatch.md +++ b/packages/util/docs/interfaces/DelBatch.md @@ -1,47 +1,39 @@ -[@ethereumjs/util](../README.md) / DelBatch +[**@ethereumjs/util**](../README.md) + +*** -# Interface: DelBatch +[@ethereumjs/util](../README.md) / DelBatch -## Type parameters +# Interface: DelBatch\ -| Name | Type | -| :------ | :------ | -| `TKey` | extends `Uint8Array` \| `string` \| `number` = `Uint8Array` | +Defined in: [packages/util/src/db.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L39) -## Table of contents +## Type Parameters -### Properties +### TKey -- [key](DelBatch.md#key) -- [opts](DelBatch.md#opts) -- [type](DelBatch.md#type) +`TKey` *extends* `Uint8Array` \| `string` \| `number` = `Uint8Array` ## Properties ### key -• **key**: `TKey` +> **key**: `TKey` -#### Defined in +Defined in: [packages/util/src/db.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L41) -[packages/util/src/db.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L37) +*** -___ +### opts? -### opts +> `optional` **opts**: [`EncodingOpts`](../type-aliases/EncodingOpts.md) -• `Optional` **opts**: [`EncodingOpts`](../README.md#encodingopts) +Defined in: [packages/util/src/db.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L42) -#### Defined in - -[packages/util/src/db.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L38) - -___ +*** ### type -• **type**: ``"del"`` - -#### Defined in +> **type**: `"del"` -[packages/util/src/db.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L36) +Defined in: [packages/util/src/db.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L40) diff --git a/packages/util/docs/interfaces/ECDSASignature.md b/packages/util/docs/interfaces/ECDSASignature.md deleted file mode 100644 index 12053f33081..00000000000 --- a/packages/util/docs/interfaces/ECDSASignature.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/util](../README.md) / ECDSASignature - -# Interface: ECDSASignature - -## Table of contents - -### Properties - -- [r](ECDSASignature.md#r) -- [s](ECDSASignature.md#s) -- [v](ECDSASignature.md#v) - -## Properties - -### r - -• **r**: `Uint8Array` - -#### Defined in - -[packages/util/src/signature.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L25) - -___ - -### s - -• **s**: `Uint8Array` - -#### Defined in - -[packages/util/src/signature.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L26) - -___ - -### v - -• **v**: `bigint` - -#### Defined in - -[packages/util/src/signature.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L24) diff --git a/packages/util/docs/interfaces/EthersProvider.md b/packages/util/docs/interfaces/EthersProvider.md index 12ace36c219..6227bd7e3bc 100644 --- a/packages/util/docs/interfaces/EthersProvider.md +++ b/packages/util/docs/interfaces/EthersProvider.md @@ -1,35 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + [@ethereumjs/util](../README.md) / EthersProvider # Interface: EthersProvider -A partial interface for an `ethers` `JsonRpcProvider` +Defined in: [packages/util/src/provider.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L81) + +A partial interface for an `ethers` `JSONRPCProvider` We only use the url string since we do raw `fetch` calls to retrieve the necessary data -## Table of contents - -### Properties - -- [\_getConnection](EthersProvider.md#_getconnection) - ## Properties -### \_getConnection - -• **\_getConnection**: () => { `url`: `string` } - -#### Type declaration +### \_getConnection() -▸ (): `Object` +> **\_getConnection**: () => `object` -##### Returns +Defined in: [packages/util/src/provider.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L82) -`Object` +#### Returns -| Name | Type | -| :------ | :------ | -| `url` | `string` | +`object` -#### Defined in +##### url -[packages/util/src/provider.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L79) +> **url**: `string` diff --git a/packages/util/docs/interfaces/EventMap.md b/packages/util/docs/interfaces/EventMap.md deleted file mode 100644 index 5bd6f71d299..00000000000 --- a/packages/util/docs/interfaces/EventMap.md +++ /dev/null @@ -1,7 +0,0 @@ -[@ethereumjs/util](../README.md) / EventMap - -# Interface: EventMap - -## Indexable - -▪ [event: `string`]: `AsyncListener`<`any`, `any`\> diff --git a/packages/util/docs/interfaces/GenesisState.md b/packages/util/docs/interfaces/GenesisState.md deleted file mode 100644 index ca3ec85eaf6..00000000000 --- a/packages/util/docs/interfaces/GenesisState.md +++ /dev/null @@ -1,30 +0,0 @@ -[@ethereumjs/util](../README.md) / GenesisState - -# Interface: GenesisState - -If you are using a custom chain Common, pass the genesis state. - -Pattern 1 (with genesis state see [GenesisState](GenesisState.md) for format): - -```javascript -{ - '0x0...01': '0x100', // For EoA -} -``` - -Pattern 2 (with complex genesis state, containing contract accounts and storage). -Note that in [AccountState](../README.md#accountstate) there are two -accepted types. This allows to easily insert accounts in the genesis state: - -A complex genesis state with Contract and EoA states would have the following format: - -```javascript -{ - '0x0...01': '0x100', // For EoA - '0x0...02': ['0x1', '0xRUNTIME_BYTECODE', [[storageKey1, storageValue1], [storageKey2, storageValue2]]] // For contracts -} -``` - -## Indexable - -▪ [key: [`PrefixedHexString`](../README.md#prefixedhexstring)]: [`PrefixedHexString`](../README.md#prefixedhexstring) \| [`AccountState`](../README.md#accountstate) diff --git a/packages/util/docs/interfaces/JSONRPCWithdrawal.md b/packages/util/docs/interfaces/JSONRPCWithdrawal.md new file mode 100644 index 00000000000..f004fab1a3b --- /dev/null +++ b/packages/util/docs/interfaces/JSONRPCWithdrawal.md @@ -0,0 +1,44 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / JSONRPCWithdrawal + +# Interface: JSONRPCWithdrawal + +Defined in: [packages/util/src/withdrawal.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L23) + +JSON RPC interface for EIP-4895 withdrawal data with amount in Gwei to +match CL representation and for eventual ssz withdrawalsRoot + +## Properties + +### address + +> **address**: `` `0x${string}` `` + +Defined in: [packages/util/src/withdrawal.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L26) + +*** + +### amount + +> **amount**: `` `0x${string}` `` + +Defined in: [packages/util/src/withdrawal.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L27) + +*** + +### index + +> **index**: `` `0x${string}` `` + +Defined in: [packages/util/src/withdrawal.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L24) + +*** + +### validatorIndex + +> **validatorIndex**: `` `0x${string}` `` + +Defined in: [packages/util/src/withdrawal.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L25) diff --git a/packages/util/docs/interfaces/JsonRpcWithdrawal.md b/packages/util/docs/interfaces/JsonRpcWithdrawal.md deleted file mode 100644 index 1860c7c846c..00000000000 --- a/packages/util/docs/interfaces/JsonRpcWithdrawal.md +++ /dev/null @@ -1,55 +0,0 @@ -[@ethereumjs/util](../README.md) / JsonRpcWithdrawal - -# Interface: JsonRpcWithdrawal - -JSON RPC interface for EIP-4895 withdrawal data with amount in Gwei to -match CL representation and for eventual ssz withdrawalsRoot - -## Table of contents - -### Properties - -- [address](JsonRpcWithdrawal.md#address) -- [amount](JsonRpcWithdrawal.md#amount) -- [index](JsonRpcWithdrawal.md#index) -- [validatorIndex](JsonRpcWithdrawal.md#validatorindex) - -## Properties - -### address - -• **address**: `string` - -#### Defined in - -[packages/util/src/withdrawal.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L26) - -___ - -### amount - -• **amount**: `string` - -#### Defined in - -[packages/util/src/withdrawal.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L27) - -___ - -### index - -• **index**: `string` - -#### Defined in - -[packages/util/src/withdrawal.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L24) - -___ - -### validatorIndex - -• **validatorIndex**: `string` - -#### Defined in - -[packages/util/src/withdrawal.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L25) diff --git a/packages/util/docs/interfaces/KZG.md b/packages/util/docs/interfaces/KZG.md new file mode 100644 index 00000000000..16ca157a0de --- /dev/null +++ b/packages/util/docs/interfaces/KZG.md @@ -0,0 +1,107 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KZG + +# Interface: KZG + +Defined in: [packages/util/src/kzg.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L4) + +Interface for an externally provided kzg library used when creating blob transactions + +## Methods + +### blobToKzgCommitment() + +> **blobToKzgCommitment**(`blob`): `string` + +Defined in: [packages/util/src/kzg.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L5) + +#### Parameters + +##### blob + +`string` + +#### Returns + +`string` + +*** + +### computeBlobProof() + +> **computeBlobProof**(`blob`, `commitment`): `string` + +Defined in: [packages/util/src/kzg.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L6) + +#### Parameters + +##### blob + +`string` + +##### commitment + +`string` + +#### Returns + +`string` + +*** + +### verifyBlobProofBatch() + +> **verifyBlobProofBatch**(`blobs`, `expectedKZGCommitments`, `KZGProofs`): `boolean` + +Defined in: [packages/util/src/kzg.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L8) + +#### Parameters + +##### blobs + +`string`[] + +##### expectedKZGCommitments + +`string`[] + +##### KZGProofs + +`string`[] + +#### Returns + +`boolean` + +*** + +### verifyProof() + +> **verifyProof**(`polynomialKZG`, `z`, `y`, `KZGProof`): `boolean` + +Defined in: [packages/util/src/kzg.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L7) + +#### Parameters + +##### polynomialKZG + +`string` + +##### z + +`string` + +##### y + +`string` + +##### KZGProof + +`string` + +#### Returns + +`boolean` diff --git a/packages/util/docs/interfaces/Kzg.md b/packages/util/docs/interfaces/Kzg.md deleted file mode 100644 index bbe40b4526f..00000000000 --- a/packages/util/docs/interfaces/Kzg.md +++ /dev/null @@ -1,121 +0,0 @@ -[@ethereumjs/util](../README.md) / Kzg - -# Interface: Kzg - -Interface for an externally provided kzg library used when creating blob transactions - -## Table of contents - -### Methods - -- [blobToKzgCommitment](Kzg.md#blobtokzgcommitment) -- [computeBlobKzgProof](Kzg.md#computeblobkzgproof) -- [loadTrustedSetup](Kzg.md#loadtrustedsetup) -- [verifyBlobKzgProofBatch](Kzg.md#verifyblobkzgproofbatch) -- [verifyKzgProof](Kzg.md#verifykzgproof) - -## Methods - -### blobToKzgCommitment - -▸ **blobToKzgCommitment**(`blob`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `blob` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/kzg.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L6) - -___ - -### computeBlobKzgProof - -▸ **computeBlobKzgProof**(`blob`, `commitment`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `blob` | `Uint8Array` | -| `commitment` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/kzg.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L7) - -___ - -### loadTrustedSetup - -▸ **loadTrustedSetup**(`filePath?`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `filePath?` | `string` | - -#### Returns - -`void` - -#### Defined in - -[packages/util/src/kzg.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L5) - -___ - -### verifyBlobKzgProofBatch - -▸ **verifyBlobKzgProofBatch**(`blobs`, `expectedKzgCommitments`, `kzgProofs`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `blobs` | `Uint8Array`[] | -| `expectedKzgCommitments` | `Uint8Array`[] | -| `kzgProofs` | `Uint8Array`[] | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/kzg.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L14) - -___ - -### verifyKzgProof - -▸ **verifyKzgProof**(`polynomialKzg`, `z`, `y`, `kzgProof`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `polynomialKzg` | `Uint8Array` | -| `z` | `Uint8Array` | -| `y` | `Uint8Array` | -| `kzgProof` | `Uint8Array` | - -#### Returns - -`boolean` - -#### Defined in - -[packages/util/src/kzg.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L8) diff --git a/packages/util/docs/interfaces/PartialAccountData.md b/packages/util/docs/interfaces/PartialAccountData.md new file mode 100644 index 00000000000..4b77b1ece88 --- /dev/null +++ b/packages/util/docs/interfaces/PartialAccountData.md @@ -0,0 +1,57 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / PartialAccountData + +# Interface: PartialAccountData + +Defined in: [packages/util/src/account.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L31) + +## Properties + +### balance? + +> `optional` **balance**: `null` \| [`BigIntLike`](../type-aliases/BigIntLike.md) + +Defined in: [packages/util/src/account.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L33) + +*** + +### codeHash? + +> `optional` **codeHash**: `null` \| [`BytesLike`](../type-aliases/BytesLike.md) + +Defined in: [packages/util/src/account.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L35) + +*** + +### codeSize? + +> `optional` **codeSize**: `null` \| [`BigIntLike`](../type-aliases/BigIntLike.md) + +Defined in: [packages/util/src/account.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L36) + +*** + +### nonce? + +> `optional` **nonce**: `null` \| [`BigIntLike`](../type-aliases/BigIntLike.md) + +Defined in: [packages/util/src/account.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L32) + +*** + +### storageRoot? + +> `optional` **storageRoot**: `null` \| [`BytesLike`](../type-aliases/BytesLike.md) + +Defined in: [packages/util/src/account.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L34) + +*** + +### version? + +> `optional` **version**: `null` \| [`BigIntLike`](../type-aliases/BigIntLike.md) + +Defined in: [packages/util/src/account.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L37) diff --git a/packages/util/docs/interfaces/ProverInput.md b/packages/util/docs/interfaces/ProverInput.md new file mode 100644 index 00000000000..9c3ccdcc400 --- /dev/null +++ b/packages/util/docs/interfaces/ProverInput.md @@ -0,0 +1,33 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / ProverInput + +# Interface: ProverInput + +Defined in: [packages/util/src/verkle.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L41) + +## Properties + +### indices + +> **indices**: `number`[] + +Defined in: [packages/util/src/verkle.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L44) + +*** + +### serializedCommitment + +> **serializedCommitment**: `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L42) + +*** + +### vector + +> **vector**: `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [packages/util/src/verkle.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L43) diff --git a/packages/util/docs/interfaces/PutBatch.md b/packages/util/docs/interfaces/PutBatch.md index d96b5e54c75..1d9126c854f 100644 --- a/packages/util/docs/interfaces/PutBatch.md +++ b/packages/util/docs/interfaces/PutBatch.md @@ -1,59 +1,51 @@ +[**@ethereumjs/util**](../README.md) + +*** + [@ethereumjs/util](../README.md) / PutBatch -# Interface: PutBatch +# Interface: PutBatch\ -## Type parameters +Defined in: [packages/util/src/db.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L29) -| Name | Type | -| :------ | :------ | -| `TKey` | extends `Uint8Array` \| `string` \| `number` = `Uint8Array` | -| `TValue` | extends `Uint8Array` \| `string` \| [`DBObject`](../README.md#dbobject) = `Uint8Array` | +## Type Parameters -## Table of contents +### TKey -### Properties +`TKey` *extends* `Uint8Array` \| `string` \| `number` = `Uint8Array` -- [key](PutBatch.md#key) -- [opts](PutBatch.md#opts) -- [type](PutBatch.md#type) -- [value](PutBatch.md#value) +### TValue + +`TValue` *extends* `Uint8Array` \| `string` \| [`DBObject`](../type-aliases/DBObject.md) = `Uint8Array` ## Properties ### key -• **key**: `TKey` - -#### Defined in +> **key**: `TKey` -[packages/util/src/db.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L30) +Defined in: [packages/util/src/db.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L34) -___ +*** -### opts +### opts? -• `Optional` **opts**: [`EncodingOpts`](../README.md#encodingopts) +> `optional` **opts**: [`EncodingOpts`](../type-aliases/EncodingOpts.md) -#### Defined in +Defined in: [packages/util/src/db.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L36) -[packages/util/src/db.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L32) - -___ +*** ### type -• **type**: ``"put"`` - -#### Defined in +> **type**: `"put"` -[packages/util/src/db.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L29) +Defined in: [packages/util/src/db.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L33) -___ +*** ### value -• **value**: `TValue` - -#### Defined in +> **value**: `TValue` -[packages/util/src/db.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L31) +Defined in: [packages/util/src/db.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L35) diff --git a/packages/util/docs/interfaces/RequestJSON.md b/packages/util/docs/interfaces/RequestJSON.md new file mode 100644 index 00000000000..4fcd33b29b1 --- /dev/null +++ b/packages/util/docs/interfaces/RequestJSON.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / RequestJSON + +# Interface: RequestJSON + +Defined in: [packages/util/src/request.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L15) + +## Properties + +### data + +> **data**: `` `0x${string}` `` + +Defined in: [packages/util/src/request.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L17) + +*** + +### type + +> **type**: `` `0x${string}` `` + +Defined in: [packages/util/src/request.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L16) diff --git a/packages/util/docs/interfaces/TransformableToBytes.md b/packages/util/docs/interfaces/TransformableToBytes.md new file mode 100644 index 00000000000..689f275bee4 --- /dev/null +++ b/packages/util/docs/interfaces/TransformableToBytes.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / TransformableToBytes + +# Interface: TransformableToBytes + +Defined in: [packages/util/src/types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L39) + +## Methods + +### toBytes()? + +> `optional` **toBytes**(): `Uint8Array` + +Defined in: [packages/util/src/types.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L40) + +#### Returns + +`Uint8Array` diff --git a/packages/util/docs/interfaces/TransformabletoBytes.md b/packages/util/docs/interfaces/TransformabletoBytes.md deleted file mode 100644 index c38940714b6..00000000000 --- a/packages/util/docs/interfaces/TransformabletoBytes.md +++ /dev/null @@ -1,23 +0,0 @@ -[@ethereumjs/util](../README.md) / TransformabletoBytes - -# Interface: TransformabletoBytes - -## Table of contents - -### Methods - -- [toBytes](TransformabletoBytes.md#tobytes) - -## Methods - -### toBytes - -▸ `Optional` **toBytes**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/types.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L34) diff --git a/packages/util/docs/interfaces/VerifierInput.md b/packages/util/docs/interfaces/VerifierInput.md new file mode 100644 index 00000000000..ac94fa96f95 --- /dev/null +++ b/packages/util/docs/interfaces/VerifierInput.md @@ -0,0 +1,33 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VerifierInput + +# Interface: VerifierInput + +Defined in: [packages/util/src/verkle.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L47) + +## Properties + +### indexValuePairs + +> **indexValuePairs**: `object`[] + +Defined in: [packages/util/src/verkle.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L49) + +#### index + +> **index**: `number` + +#### value + +> **value**: `Uint8Array` + +*** + +### serializedCommitment + +> **serializedCommitment**: `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L48) diff --git a/packages/util/docs/interfaces/VerkleCrypto.md b/packages/util/docs/interfaces/VerkleCrypto.md new file mode 100644 index 00000000000..979cbff2466 --- /dev/null +++ b/packages/util/docs/interfaces/VerkleCrypto.md @@ -0,0 +1,215 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VerkleCrypto + +# Interface: VerkleCrypto + +Defined in: [packages/util/src/verkle.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L23) + +Verkle related constants and helper functions + +Experimental (do not use in production!) + +## Properties + +### commitToScalars() + +> **commitToScalars**: (`vector`) => `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L38) + +#### Parameters + +##### vector + +`Uint8Array`\<`ArrayBufferLike`\>[] + +#### Returns + +`Uint8Array` + +*** + +### createProof() + +> **createProof**: (`bytes`) => `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L36) + +#### Parameters + +##### bytes + +[`ProverInput`](ProverInput.md)[] + +#### Returns + +`Uint8Array` + +*** + +### getTreeKey() + +> **getTreeKey**: (`address`, `treeIndex`, `subIndex`) => `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L24) + +#### Parameters + +##### address + +`Uint8Array` + +##### treeIndex + +`Uint8Array` + +##### subIndex + +`number` + +#### Returns + +`Uint8Array` + +*** + +### getTreeKeyHash() + +> **getTreeKeyHash**: (`address`, `treeIndexLE`) => `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L25) + +#### Parameters + +##### address + +`Uint8Array` + +##### treeIndexLE + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### hashCommitment() + +> **hashCommitment**: (`commitment`) => `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L34) + +#### Parameters + +##### commitment + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### serializeCommitment() + +> **serializeCommitment**: (`commitment`) => `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L35) + +#### Parameters + +##### commitment + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### updateCommitment() + +> **updateCommitment**: (`commitment`, `commitmentIndex`, `oldScalarValue`, `newScalarValue`) => `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L26) + +#### Parameters + +##### commitment + +`Uint8Array` + +##### commitmentIndex + +`number` + +##### oldScalarValue + +`Uint8Array` + +##### newScalarValue + +`Uint8Array` + +#### Returns + +`Uint8Array` + +*** + +### verifyExecutionWitnessPreState() + +> **verifyExecutionWitnessPreState**: (`prestateRoot`, `execution_witness_json`) => `boolean` + +Defined in: [packages/util/src/verkle.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L33) + +#### Parameters + +##### prestateRoot + +`string` + +##### execution\_witness\_json + +`string` + +#### Returns + +`boolean` + +*** + +### verifyProof() + +> **verifyProof**: (`proof`, `verifierInput`) => `boolean` + +Defined in: [packages/util/src/verkle.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L37) + +#### Parameters + +##### proof + +`Uint8Array` + +##### verifierInput + +[`VerifierInput`](VerifierInput.md)[] + +#### Returns + +`boolean` + +*** + +### zeroCommitment + +> **zeroCommitment**: `Uint8Array` + +Defined in: [packages/util/src/verkle.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L32) diff --git a/packages/util/docs/interfaces/VerkleExecutionWitness.md b/packages/util/docs/interfaces/VerkleExecutionWitness.md new file mode 100644 index 00000000000..55fbac1e398 --- /dev/null +++ b/packages/util/docs/interfaces/VerkleExecutionWitness.md @@ -0,0 +1,45 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VerkleExecutionWitness + +# Interface: VerkleExecutionWitness + +Defined in: [packages/util/src/verkle.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L122) + +Experimental, object format could eventual change. +An object that provides the state and proof necessary for verkle stateless execution + +## Properties + +### parentStateRoot + +> **parentStateRoot**: `` `0x${string}` `` + +Defined in: [packages/util/src/verkle.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L126) + +The stateRoot of the parent block + +*** + +### stateDiff + +> **stateDiff**: [`VerkleStateDiff`](VerkleStateDiff.md)[] + +Defined in: [packages/util/src/verkle.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L132) + +An array of state diffs. +Each item corresponding to state accesses or state modifications of the block. +In the current design, it also contains the resulting state of the block execution (post-state). + +*** + +### verkleProof + +> **verkleProof**: [`VerkleProof`](VerkleProof.md) + +Defined in: [packages/util/src/verkle.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L137) + +The verkle proof for the block. +Proves that the provided stateDiff belongs to the canonical verkle tree. diff --git a/packages/util/docs/interfaces/VerkleProof.md b/packages/util/docs/interfaces/VerkleProof.md new file mode 100644 index 00000000000..ddd0951051b --- /dev/null +++ b/packages/util/docs/interfaces/VerkleProof.md @@ -0,0 +1,61 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VerkleProof + +# Interface: VerkleProof + +Defined in: [packages/util/src/verkle.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L97) + +## Properties + +### commitmentsByPath + +> **commitmentsByPath**: `` `0x${string}` ``[] + +Defined in: [packages/util/src/verkle.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L98) + +*** + +### d + +> **d**: `` `0x${string}` `` + +Defined in: [packages/util/src/verkle.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L99) + +*** + +### depthExtensionPresent + +> **depthExtensionPresent**: `` `0x${string}` `` + +Defined in: [packages/util/src/verkle.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L100) + +*** + +### ipaProof + +> **ipaProof**: `object` + +Defined in: [packages/util/src/verkle.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L101) + +#### cl + +> **cl**: `` `0x${string}` ``[] + +#### cr + +> **cr**: `` `0x${string}` ``[] + +#### finalEvaluation + +> **finalEvaluation**: `` `0x${string}` `` + +*** + +### otherStems + +> **otherStems**: `` `0x${string}` ``[] + +Defined in: [packages/util/src/verkle.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L106) diff --git a/packages/util/docs/interfaces/VerkleStateDiff.md b/packages/util/docs/interfaces/VerkleStateDiff.md new file mode 100644 index 00000000000..e72d6a2a93b --- /dev/null +++ b/packages/util/docs/interfaces/VerkleStateDiff.md @@ -0,0 +1,37 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VerkleStateDiff + +# Interface: VerkleStateDiff + +Defined in: [packages/util/src/verkle.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L109) + +## Properties + +### stem + +> **stem**: `` `0x${string}` `` + +Defined in: [packages/util/src/verkle.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L110) + +*** + +### suffixDiffs + +> **suffixDiffs**: `object`[] + +Defined in: [packages/util/src/verkle.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L111) + +#### currentValue + +> **currentValue**: `null` \| `` `0x${string}` `` + +#### newValue + +> **newValue**: `null` \| `` `0x${string}` `` + +#### suffix + +> **suffix**: `string` \| `number` diff --git a/packages/util/docs/type-aliases/AccountBodyBytes.md b/packages/util/docs/type-aliases/AccountBodyBytes.md new file mode 100644 index 00000000000..44786415737 --- /dev/null +++ b/packages/util/docs/type-aliases/AccountBodyBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / AccountBodyBytes + +# Type Alias: AccountBodyBytes + +> **AccountBodyBytes** = \[`Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`\] + +Defined in: [packages/util/src/account.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L40) diff --git a/packages/util/docs/type-aliases/AddressLike.md b/packages/util/docs/type-aliases/AddressLike.md new file mode 100644 index 00000000000..50808b5cb92 --- /dev/null +++ b/packages/util/docs/type-aliases/AddressLike.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / AddressLike + +# Type Alias: AddressLike + +> **AddressLike** = [`Address`](../classes/Address.md) \| `Uint8Array` \| [`PrefixedHexString`](PrefixedHexString.md) + +Defined in: [packages/util/src/types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L37) + +A type that represents an input that can be converted to an Address. diff --git a/packages/util/docs/type-aliases/BatchDBOp.md b/packages/util/docs/type-aliases/BatchDBOp.md new file mode 100644 index 00000000000..319217e8b0f --- /dev/null +++ b/packages/util/docs/type-aliases/BatchDBOp.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BatchDBOp + +# Type Alias: BatchDBOp\ + +> **BatchDBOp**\<`TKey`, `TValue`\> = [`PutBatch`](../interfaces/PutBatch.md)\<`TKey`, `TValue`\> \| [`DelBatch`](../interfaces/DelBatch.md)\<`TKey`\> + +Defined in: [packages/util/src/db.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L4) + +## Type Parameters + +### TKey + +`TKey` *extends* `Uint8Array` \| `string` \| `number` = `Uint8Array` + +### TValue + +`TValue` *extends* `Uint8Array` \| `string` \| [`DBObject`](DBObject.md) = `Uint8Array` diff --git a/packages/util/docs/type-aliases/BigIntLike.md b/packages/util/docs/type-aliases/BigIntLike.md new file mode 100644 index 00000000000..cdbdc67d89c --- /dev/null +++ b/packages/util/docs/type-aliases/BigIntLike.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BigIntLike + +# Type Alias: BigIntLike + +> **BigIntLike** = `bigint` \| [`PrefixedHexString`](PrefixedHexString.md) \| `number` \| `Uint8Array` + +Defined in: [packages/util/src/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L11) diff --git a/packages/util/docs/type-aliases/BinaryTreeLeafBasicData.md b/packages/util/docs/type-aliases/BinaryTreeLeafBasicData.md new file mode 100644 index 00000000000..4cc1489c7f5 --- /dev/null +++ b/packages/util/docs/type-aliases/BinaryTreeLeafBasicData.md @@ -0,0 +1,43 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BinaryTreeLeafBasicData + +# Type Alias: BinaryTreeLeafBasicData + +> **BinaryTreeLeafBasicData** = `object` + +Defined in: [packages/util/src/binaryTree.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L83) + +## Properties + +### balance + +> **balance**: `bigint` + +Defined in: [packages/util/src/binaryTree.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L86) + +*** + +### codeSize + +> **codeSize**: `number` + +Defined in: [packages/util/src/binaryTree.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L87) + +*** + +### nonce + +> **nonce**: `bigint` + +Defined in: [packages/util/src/binaryTree.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L85) + +*** + +### version + +> **version**: `number` + +Defined in: [packages/util/src/binaryTree.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L84) diff --git a/packages/util/docs/type-aliases/BinaryTreeLeafType.md b/packages/util/docs/type-aliases/BinaryTreeLeafType.md new file mode 100644 index 00000000000..16a6ae36421 --- /dev/null +++ b/packages/util/docs/type-aliases/BinaryTreeLeafType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BinaryTreeLeafType + +# Type Alias: BinaryTreeLeafType + +> **BinaryTreeLeafType** = *typeof* [`BinaryTreeLeafType`](../variables/BinaryTreeLeafType.md)\[keyof *typeof* [`BinaryTreeLeafType`](../variables/BinaryTreeLeafType.md)\] + +Defined in: [packages/util/src/binaryTree.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L76) diff --git a/packages/util/docs/type-aliases/BinaryTreeProof.md b/packages/util/docs/type-aliases/BinaryTreeProof.md new file mode 100644 index 00000000000..43bf6cd0472 --- /dev/null +++ b/packages/util/docs/type-aliases/BinaryTreeProof.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BinaryTreeProof + +# Type Alias: BinaryTreeProof + +> **BinaryTreeProof** = `any` + +Defined in: [packages/util/src/binaryTree.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L52) diff --git a/packages/util/docs/type-aliases/BytesLike.md b/packages/util/docs/type-aliases/BytesLike.md new file mode 100644 index 00000000000..a3cb2817d39 --- /dev/null +++ b/packages/util/docs/type-aliases/BytesLike.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BytesLike + +# Type Alias: BytesLike + +> **BytesLike** = `Uint8Array` \| `number`[] \| `number` \| `bigint` \| [`TransformableToBytes`](../interfaces/TransformableToBytes.md) \| [`PrefixedHexString`](PrefixedHexString.md) + +Defined in: [packages/util/src/types.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L16) diff --git a/packages/util/docs/type-aliases/CLRequestType.md b/packages/util/docs/type-aliases/CLRequestType.md new file mode 100644 index 00000000000..d38edb5049d --- /dev/null +++ b/packages/util/docs/type-aliases/CLRequestType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / CLRequestType + +# Type Alias: CLRequestType + +> **CLRequestType** = *typeof* [`CLRequestType`](../variables/CLRequestType.md)\[keyof *typeof* [`CLRequestType`](../variables/CLRequestType.md)\] + +Defined in: [packages/util/src/request.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L7) diff --git a/packages/util/docs/type-aliases/DBObject.md b/packages/util/docs/type-aliases/DBObject.md new file mode 100644 index 00000000000..7e05bc28d07 --- /dev/null +++ b/packages/util/docs/type-aliases/DBObject.md @@ -0,0 +1,15 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / DBObject + +# Type Alias: DBObject + +> **DBObject** = `object` + +Defined in: [packages/util/src/db.ts:1](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L1) + +## Index Signature + +\[`key`: `string`\]: `string` \| `number` \| `string`[] diff --git a/packages/util/docs/type-aliases/EncodingOpts.md b/packages/util/docs/type-aliases/EncodingOpts.md new file mode 100644 index 00000000000..706dc490cea --- /dev/null +++ b/packages/util/docs/type-aliases/EncodingOpts.md @@ -0,0 +1,27 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / EncodingOpts + +# Type Alias: EncodingOpts + +> **EncodingOpts** = `object` + +Defined in: [packages/util/src/db.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L25) + +## Properties + +### keyEncoding? + +> `optional` **keyEncoding**: [`KeyEncoding`](KeyEncoding.md) + +Defined in: [packages/util/src/db.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L26) + +*** + +### valueEncoding? + +> `optional` **valueEncoding**: [`ValueEncoding`](ValueEncoding.md) + +Defined in: [packages/util/src/db.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L27) diff --git a/packages/util/docs/type-aliases/EthereumJSErrorMetaData.md b/packages/util/docs/type-aliases/EthereumJSErrorMetaData.md new file mode 100644 index 00000000000..ef207129bdb --- /dev/null +++ b/packages/util/docs/type-aliases/EthereumJSErrorMetaData.md @@ -0,0 +1,17 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / EthereumJSErrorMetaData + +# Type Alias: EthereumJSErrorMetaData + +> **EthereumJSErrorMetaData** = `Record`\<`string`, `string` \| `number` \| `null`\> + +Defined in: packages/rlp/dist/esm/errors.d.ts:8 + +Generic EthereumJS error class with metadata attached + +Kudos to https://github.com/ChainSafe/lodestar monorepo +for the inspiration :-) +See: https://github.com/ChainSafe/lodestar/blob/unstable/packages/utils/src/errors.ts diff --git a/packages/util/docs/type-aliases/EthereumJSErrorObject.md b/packages/util/docs/type-aliases/EthereumJSErrorObject.md new file mode 100644 index 00000000000..97094d2af55 --- /dev/null +++ b/packages/util/docs/type-aliases/EthereumJSErrorObject.md @@ -0,0 +1,43 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / EthereumJSErrorObject + +# Type Alias: EthereumJSErrorObject + +> **EthereumJSErrorObject** = `object` + +Defined in: packages/rlp/dist/esm/errors.d.ts:9 + +## Properties + +### className + +> **className**: `string` + +Defined in: packages/rlp/dist/esm/errors.d.ts:12 + +*** + +### message + +> **message**: `string` + +Defined in: packages/rlp/dist/esm/errors.d.ts:10 + +*** + +### stack + +> **stack**: `string` + +Defined in: packages/rlp/dist/esm/errors.d.ts:11 + +*** + +### type + +> **type**: [`EthereumJSErrorMetaData`](EthereumJSErrorMetaData.md) + +Defined in: packages/rlp/dist/esm/errors.d.ts:13 diff --git a/packages/util/docs/type-aliases/KeyEncoding.md b/packages/util/docs/type-aliases/KeyEncoding.md new file mode 100644 index 00000000000..425ed0fa4e5 --- /dev/null +++ b/packages/util/docs/type-aliases/KeyEncoding.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KeyEncoding + +# Type Alias: KeyEncoding + +> **KeyEncoding** = *typeof* [`KeyEncoding`](../variables/KeyEncoding.md)\[keyof *typeof* [`KeyEncoding`](../variables/KeyEncoding.md)\] + +Defined in: [packages/util/src/db.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L9) diff --git a/packages/util/docs/type-aliases/NestedUint8Array.md b/packages/util/docs/type-aliases/NestedUint8Array.md new file mode 100644 index 00000000000..22f5e947f93 --- /dev/null +++ b/packages/util/docs/type-aliases/NestedUint8Array.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / NestedUint8Array + +# Type Alias: NestedUint8Array + +> **NestedUint8Array** = (`Uint8Array` \| `NestedUint8Array`)[] + +Defined in: [packages/util/src/types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L43) diff --git a/packages/util/docs/type-aliases/NumericString.md b/packages/util/docs/type-aliases/NumericString.md new file mode 100644 index 00000000000..dd899d3a4ad --- /dev/null +++ b/packages/util/docs/type-aliases/NumericString.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / NumericString + +# Type Alias: NumericString + +> **NumericString** = `` `${number}` `` + +Defined in: [packages/util/src/types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L27) diff --git a/packages/util/docs/type-aliases/PrefixedHexString.md b/packages/util/docs/type-aliases/PrefixedHexString.md new file mode 100644 index 00000000000..9df66869a89 --- /dev/null +++ b/packages/util/docs/type-aliases/PrefixedHexString.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / PrefixedHexString + +# Type Alias: PrefixedHexString + +> **PrefixedHexString** = `` `0x${string}` `` + +Defined in: [packages/util/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L32) diff --git a/packages/util/docs/type-aliases/RequestBytes.md b/packages/util/docs/type-aliases/RequestBytes.md new file mode 100644 index 00000000000..69ce0c5e692 --- /dev/null +++ b/packages/util/docs/type-aliases/RequestBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / RequestBytes + +# Type Alias: RequestBytes + +> **RequestBytes** = `Uint8Array` + +Defined in: [packages/util/src/request.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L5) diff --git a/packages/util/docs/type-aliases/ToBytesInputTypes.md b/packages/util/docs/type-aliases/ToBytesInputTypes.md new file mode 100644 index 00000000000..d2436d298b0 --- /dev/null +++ b/packages/util/docs/type-aliases/ToBytesInputTypes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / ToBytesInputTypes + +# Type Alias: ToBytesInputTypes + +> **ToBytesInputTypes** = [`PrefixedHexString`](PrefixedHexString.md) \| `number` \| `bigint` \| `Uint8Array` \| `number`[] \| [`TransformableToBytes`](../interfaces/TransformableToBytes.md) \| `null` \| `undefined` + +Defined in: [packages/util/src/bytes.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L216) diff --git a/packages/util/docs/type-aliases/TypeOutput.md b/packages/util/docs/type-aliases/TypeOutput.md new file mode 100644 index 00000000000..84f0ac88bc8 --- /dev/null +++ b/packages/util/docs/type-aliases/TypeOutput.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / TypeOutput + +# Type Alias: TypeOutput + +> **TypeOutput** = *typeof* [`TypeOutput`](../variables/TypeOutput.md)\[keyof *typeof* [`TypeOutput`](../variables/TypeOutput.md)\] + +Defined in: [packages/util/src/types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L61) diff --git a/packages/util/docs/type-aliases/TypeOutputReturnType.md b/packages/util/docs/type-aliases/TypeOutputReturnType.md new file mode 100644 index 00000000000..5d41295a583 --- /dev/null +++ b/packages/util/docs/type-aliases/TypeOutputReturnType.md @@ -0,0 +1,43 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / TypeOutputReturnType + +# Type Alias: TypeOutputReturnType + +> **TypeOutputReturnType** = `object` + +Defined in: [packages/util/src/types.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L70) + +## Properties + +### 0 + +> **0**: `number` + +Defined in: [packages/util/src/types.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L71) + +*** + +### 1 + +> **1**: `bigint` + +Defined in: [packages/util/src/types.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L72) + +*** + +### 2 + +> **2**: `Uint8Array` + +Defined in: [packages/util/src/types.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L73) + +*** + +### 3 + +> **3**: [`PrefixedHexString`](PrefixedHexString.md) + +Defined in: [packages/util/src/types.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L74) diff --git a/packages/util/docs/type-aliases/ValueEncoding.md b/packages/util/docs/type-aliases/ValueEncoding.md new file mode 100644 index 00000000000..603e98bce46 --- /dev/null +++ b/packages/util/docs/type-aliases/ValueEncoding.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / ValueEncoding + +# Type Alias: ValueEncoding + +> **ValueEncoding** = *typeof* [`ValueEncoding`](../variables/ValueEncoding.md)\[keyof *typeof* [`ValueEncoding`](../variables/ValueEncoding.md)\] + +Defined in: [packages/util/src/db.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L17) diff --git a/packages/util/docs/type-aliases/VerkleLeafBasicData.md b/packages/util/docs/type-aliases/VerkleLeafBasicData.md new file mode 100644 index 00000000000..adf7a1694db --- /dev/null +++ b/packages/util/docs/type-aliases/VerkleLeafBasicData.md @@ -0,0 +1,43 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VerkleLeafBasicData + +# Type Alias: VerkleLeafBasicData + +> **VerkleLeafBasicData** = `object` + +Defined in: [packages/util/src/verkle.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L147) + +## Properties + +### balance + +> **balance**: `bigint` + +Defined in: [packages/util/src/verkle.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L150) + +*** + +### codeSize + +> **codeSize**: `number` + +Defined in: [packages/util/src/verkle.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L151) + +*** + +### nonce + +> **nonce**: `bigint` + +Defined in: [packages/util/src/verkle.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L149) + +*** + +### version + +> **version**: `number` + +Defined in: [packages/util/src/verkle.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L148) diff --git a/packages/util/docs/type-aliases/VerkleLeafType.md b/packages/util/docs/type-aliases/VerkleLeafType.md new file mode 100644 index 00000000000..6b0e2a6de87 --- /dev/null +++ b/packages/util/docs/type-aliases/VerkleLeafType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VerkleLeafType + +# Type Alias: VerkleLeafType + +> **VerkleLeafType** = *typeof* [`VerkleLeafType`](../variables/VerkleLeafType.md)\[keyof *typeof* [`VerkleLeafType`](../variables/VerkleLeafType.md)\] + +Defined in: [packages/util/src/verkle.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L140) diff --git a/packages/util/docs/type-aliases/WithdrawalBytes.md b/packages/util/docs/type-aliases/WithdrawalBytes.md new file mode 100644 index 00000000000..ddbf2cd8abf --- /dev/null +++ b/packages/util/docs/type-aliases/WithdrawalBytes.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / WithdrawalBytes + +# Type Alias: WithdrawalBytes + +> **WithdrawalBytes** = \[`Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`\] + +Defined in: [packages/util/src/withdrawal.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L30) diff --git a/packages/util/docs/type-aliases/WithdrawalData.md b/packages/util/docs/type-aliases/WithdrawalData.md new file mode 100644 index 00000000000..9d6098443fe --- /dev/null +++ b/packages/util/docs/type-aliases/WithdrawalData.md @@ -0,0 +1,46 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / WithdrawalData + +# Type Alias: WithdrawalData + +> **WithdrawalData** = `object` + +Defined in: [packages/util/src/withdrawal.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L12) + +Flexible input data type for EIP-4895 withdrawal data with amount in Gwei to +match CL representation and for eventual ssz withdrawalsRoot + +## Properties + +### address + +> **address**: [`AddressLike`](AddressLike.md) + +Defined in: [packages/util/src/withdrawal.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L15) + +*** + +### amount + +> **amount**: [`BigIntLike`](BigIntLike.md) + +Defined in: [packages/util/src/withdrawal.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L16) + +*** + +### index + +> **index**: [`BigIntLike`](BigIntLike.md) + +Defined in: [packages/util/src/withdrawal.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L13) + +*** + +### validatorIndex + +> **validatorIndex**: [`BigIntLike`](BigIntLike.md) + +Defined in: [packages/util/src/withdrawal.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L14) diff --git a/packages/util/docs/variables/BIGINT_0.md b/packages/util/docs/variables/BIGINT_0.md new file mode 100644 index 00000000000..9243ee7bd9b --- /dev/null +++ b/packages/util/docs/variables/BIGINT_0.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_0 + +# Variable: BIGINT\_0 + +> `const` **BIGINT\_0**: `bigint` + +Defined in: [packages/util/src/constants.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L85) diff --git a/packages/util/docs/variables/BIGINT_1.md b/packages/util/docs/variables/BIGINT_1.md new file mode 100644 index 00000000000..05192b93a00 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_1.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_1 + +# Variable: BIGINT\_1 + +> `const` **BIGINT\_1**: `bigint` + +Defined in: [packages/util/src/constants.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L86) diff --git a/packages/util/docs/variables/BIGINT_100.md b/packages/util/docs/variables/BIGINT_100.md new file mode 100644 index 00000000000..9110cf843f3 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_100.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_100 + +# Variable: BIGINT\_100 + +> `const` **BIGINT\_100**: `bigint` + +Defined in: [packages/util/src/constants.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L103) diff --git a/packages/util/docs/variables/BIGINT_128.md b/packages/util/docs/variables/BIGINT_128.md new file mode 100644 index 00000000000..9553d00ad75 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_128.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_128 + +# Variable: BIGINT\_128 + +> `const` **BIGINT\_128**: `bigint` + +Defined in: [packages/util/src/constants.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L98) diff --git a/packages/util/docs/variables/BIGINT_160.md b/packages/util/docs/variables/BIGINT_160.md new file mode 100644 index 00000000000..8766d348675 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_160.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_160 + +# Variable: BIGINT\_160 + +> `const` **BIGINT\_160**: `bigint` + +Defined in: [packages/util/src/constants.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L104) diff --git a/packages/util/docs/variables/BIGINT_2.md b/packages/util/docs/variables/BIGINT_2.md new file mode 100644 index 00000000000..541e162e186 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_2.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_2 + +# Variable: BIGINT\_2 + +> `const` **BIGINT\_2**: `bigint` + +Defined in: [packages/util/src/constants.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L87) diff --git a/packages/util/docs/variables/BIGINT_224.md b/packages/util/docs/variables/BIGINT_224.md new file mode 100644 index 00000000000..9d1ab013758 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_224.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_224 + +# Variable: BIGINT\_224 + +> `const` **BIGINT\_224**: `bigint` + +Defined in: [packages/util/src/constants.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L105) diff --git a/packages/util/docs/variables/BIGINT_255.md b/packages/util/docs/variables/BIGINT_255.md new file mode 100644 index 00000000000..43829f74ad5 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_255.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_255 + +# Variable: BIGINT\_255 + +> `const` **BIGINT\_255**: `bigint` + +Defined in: [packages/util/src/constants.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L99) diff --git a/packages/util/docs/variables/BIGINT_256.md b/packages/util/docs/variables/BIGINT_256.md new file mode 100644 index 00000000000..aa67f3883ed --- /dev/null +++ b/packages/util/docs/variables/BIGINT_256.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_256 + +# Variable: BIGINT\_256 + +> `const` **BIGINT\_256**: `bigint` + +Defined in: [packages/util/src/constants.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L100) diff --git a/packages/util/docs/variables/BIGINT_27.md b/packages/util/docs/variables/BIGINT_27.md new file mode 100644 index 00000000000..60e28f19708 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_27.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_27 + +# Variable: BIGINT\_27 + +> `const` **BIGINT\_27**: `bigint` + +Defined in: [packages/util/src/constants.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L92) diff --git a/packages/util/docs/variables/BIGINT_28.md b/packages/util/docs/variables/BIGINT_28.md new file mode 100644 index 00000000000..551e717ee32 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_28.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_28 + +# Variable: BIGINT\_28 + +> `const` **BIGINT\_28**: `bigint` + +Defined in: [packages/util/src/constants.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L93) diff --git a/packages/util/docs/variables/BIGINT_2EXP160.md b/packages/util/docs/variables/BIGINT_2EXP160.md new file mode 100644 index 00000000000..b99010feaeb --- /dev/null +++ b/packages/util/docs/variables/BIGINT_2EXP160.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_2EXP160 + +# Variable: BIGINT\_2EXP160 + +> `const` **BIGINT\_2EXP160**: `bigint` + +Defined in: [packages/util/src/constants.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L107) diff --git a/packages/util/docs/variables/BIGINT_2EXP224.md b/packages/util/docs/variables/BIGINT_2EXP224.md new file mode 100644 index 00000000000..e2489361c50 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_2EXP224.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_2EXP224 + +# Variable: BIGINT\_2EXP224 + +> `const` **BIGINT\_2EXP224**: `bigint` + +Defined in: [packages/util/src/constants.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L108) diff --git a/packages/util/docs/variables/BIGINT_2EXP256.md b/packages/util/docs/variables/BIGINT_2EXP256.md new file mode 100644 index 00000000000..c00513ca6d7 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_2EXP256.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_2EXP256 + +# Variable: BIGINT\_2EXP256 + +> `const` **BIGINT\_2EXP256**: `bigint` + +Defined in: [packages/util/src/constants.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L110) diff --git a/packages/util/docs/variables/BIGINT_2EXP96.md b/packages/util/docs/variables/BIGINT_2EXP96.md new file mode 100644 index 00000000000..b554d9c843a --- /dev/null +++ b/packages/util/docs/variables/BIGINT_2EXP96.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_2EXP96 + +# Variable: BIGINT\_2EXP96 + +> `const` **BIGINT\_2EXP96**: `bigint` + +Defined in: [packages/util/src/constants.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L106) diff --git a/packages/util/docs/variables/BIGINT_3.md b/packages/util/docs/variables/BIGINT_3.md new file mode 100644 index 00000000000..52d70b67007 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_3.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_3 + +# Variable: BIGINT\_3 + +> `const` **BIGINT\_3**: `bigint` + +Defined in: [packages/util/src/constants.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L88) diff --git a/packages/util/docs/variables/BIGINT_31.md b/packages/util/docs/variables/BIGINT_31.md new file mode 100644 index 00000000000..f9ebf30e1cb --- /dev/null +++ b/packages/util/docs/variables/BIGINT_31.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_31 + +# Variable: BIGINT\_31 + +> `const` **BIGINT\_31**: `bigint` + +Defined in: [packages/util/src/constants.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L94) diff --git a/packages/util/docs/variables/BIGINT_32.md b/packages/util/docs/variables/BIGINT_32.md new file mode 100644 index 00000000000..b8fec4e595c --- /dev/null +++ b/packages/util/docs/variables/BIGINT_32.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_32 + +# Variable: BIGINT\_32 + +> `const` **BIGINT\_32**: `bigint` + +Defined in: [packages/util/src/constants.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L95) diff --git a/packages/util/docs/variables/BIGINT_64.md b/packages/util/docs/variables/BIGINT_64.md new file mode 100644 index 00000000000..96a6ff43d2c --- /dev/null +++ b/packages/util/docs/variables/BIGINT_64.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_64 + +# Variable: BIGINT\_64 + +> `const` **BIGINT\_64**: `bigint` + +Defined in: [packages/util/src/constants.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L96) diff --git a/packages/util/docs/variables/BIGINT_7.md b/packages/util/docs/variables/BIGINT_7.md new file mode 100644 index 00000000000..8a87f37540c --- /dev/null +++ b/packages/util/docs/variables/BIGINT_7.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_7 + +# Variable: BIGINT\_7 + +> `const` **BIGINT\_7**: `bigint` + +Defined in: [packages/util/src/constants.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L89) diff --git a/packages/util/docs/variables/BIGINT_8.md b/packages/util/docs/variables/BIGINT_8.md new file mode 100644 index 00000000000..e0830f5900c --- /dev/null +++ b/packages/util/docs/variables/BIGINT_8.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_8 + +# Variable: BIGINT\_8 + +> `const` **BIGINT\_8**: `bigint` + +Defined in: [packages/util/src/constants.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L90) diff --git a/packages/util/docs/variables/BIGINT_96.md b/packages/util/docs/variables/BIGINT_96.md new file mode 100644 index 00000000000..bd0e35dbc5b --- /dev/null +++ b/packages/util/docs/variables/BIGINT_96.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_96 + +# Variable: BIGINT\_96 + +> `const` **BIGINT\_96**: `bigint` + +Defined in: [packages/util/src/constants.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L102) diff --git a/packages/util/docs/variables/BIGINT_NEG1.md b/packages/util/docs/variables/BIGINT_NEG1.md new file mode 100644 index 00000000000..861e37dc453 --- /dev/null +++ b/packages/util/docs/variables/BIGINT_NEG1.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BIGINT\_NEG1 + +# Variable: BIGINT\_NEG1 + +> `const` **BIGINT\_NEG1**: `bigint` + +Defined in: [packages/util/src/constants.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L83) + +BigInt constants diff --git a/packages/util/docs/variables/BINARY_TREE_BALANCE_BYTES_LENGTH.md b/packages/util/docs/variables/BINARY_TREE_BALANCE_BYTES_LENGTH.md new file mode 100644 index 00000000000..8d395c503e2 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_BALANCE_BYTES_LENGTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_BALANCE\_BYTES\_LENGTH + +# Variable: BINARY\_TREE\_BALANCE\_BYTES\_LENGTH + +> `const` **BINARY\_TREE\_BALANCE\_BYTES\_LENGTH**: `16` = `16` + +Defined in: [packages/util/src/binaryTree.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L98) diff --git a/packages/util/docs/variables/BINARY_TREE_BALANCE_OFFSET.md b/packages/util/docs/variables/BINARY_TREE_BALANCE_OFFSET.md new file mode 100644 index 00000000000..2622a13c5c1 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_BALANCE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_BALANCE\_OFFSET + +# Variable: BINARY\_TREE\_BALANCE\_OFFSET + +> `const` **BINARY\_TREE\_BALANCE\_OFFSET**: `16` = `16` + +Defined in: [packages/util/src/binaryTree.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L93) diff --git a/packages/util/docs/variables/BINARY_TREE_BASIC_DATA_LEAF_KEY.md b/packages/util/docs/variables/BINARY_TREE_BASIC_DATA_LEAF_KEY.md new file mode 100644 index 00000000000..1d27cc1acd1 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_BASIC_DATA_LEAF_KEY.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_BASIC\_DATA\_LEAF\_KEY + +# Variable: BINARY\_TREE\_BASIC\_DATA\_LEAF\_KEY + +> `const` **BINARY\_TREE\_BASIC\_DATA\_LEAF\_KEY**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/binaryTree.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L100) diff --git a/packages/util/docs/variables/BINARY_TREE_CODE_CHUNK_SIZE.md b/packages/util/docs/variables/BINARY_TREE_CODE_CHUNK_SIZE.md new file mode 100644 index 00000000000..6e07f4cb805 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_CODE_CHUNK_SIZE.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_CODE\_CHUNK\_SIZE + +# Variable: BINARY\_TREE\_CODE\_CHUNK\_SIZE + +> `const` **BINARY\_TREE\_CODE\_CHUNK\_SIZE**: `31` = `31` + +Defined in: [packages/util/src/binaryTree.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L103) diff --git a/packages/util/docs/variables/BINARY_TREE_CODE_HASH_LEAF_KEY.md b/packages/util/docs/variables/BINARY_TREE_CODE_HASH_LEAF_KEY.md new file mode 100644 index 00000000000..ac1e824d9ce --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_CODE_HASH_LEAF_KEY.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_CODE\_HASH\_LEAF\_KEY + +# Variable: BINARY\_TREE\_CODE\_HASH\_LEAF\_KEY + +> `const` **BINARY\_TREE\_CODE\_HASH\_LEAF\_KEY**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/binaryTree.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L101) diff --git a/packages/util/docs/variables/BINARY_TREE_CODE_OFFSET.md b/packages/util/docs/variables/BINARY_TREE_CODE_OFFSET.md new file mode 100644 index 00000000000..af57568d3ea --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_CODE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_CODE\_OFFSET + +# Variable: BINARY\_TREE\_CODE\_OFFSET + +> `const` **BINARY\_TREE\_CODE\_OFFSET**: `128` = `128` + +Defined in: [packages/util/src/binaryTree.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L105) diff --git a/packages/util/docs/variables/BINARY_TREE_CODE_SIZE_BYTES_LENGTH.md b/packages/util/docs/variables/BINARY_TREE_CODE_SIZE_BYTES_LENGTH.md new file mode 100644 index 00000000000..a3476f83ff3 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_CODE_SIZE_BYTES_LENGTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_CODE\_SIZE\_BYTES\_LENGTH + +# Variable: BINARY\_TREE\_CODE\_SIZE\_BYTES\_LENGTH + +> `const` **BINARY\_TREE\_CODE\_SIZE\_BYTES\_LENGTH**: `3` = `3` + +Defined in: [packages/util/src/binaryTree.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L96) diff --git a/packages/util/docs/variables/BINARY_TREE_CODE_SIZE_OFFSET.md b/packages/util/docs/variables/BINARY_TREE_CODE_SIZE_OFFSET.md new file mode 100644 index 00000000000..f5cab5e1d32 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_CODE_SIZE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_CODE\_SIZE\_OFFSET + +# Variable: BINARY\_TREE\_CODE\_SIZE\_OFFSET + +> `const` **BINARY\_TREE\_CODE\_SIZE\_OFFSET**: `5` = `5` + +Defined in: [packages/util/src/binaryTree.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L91) diff --git a/packages/util/docs/variables/BINARY_TREE_HEADER_STORAGE_OFFSET.md b/packages/util/docs/variables/BINARY_TREE_HEADER_STORAGE_OFFSET.md new file mode 100644 index 00000000000..91652aed0b3 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_HEADER_STORAGE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_HEADER\_STORAGE\_OFFSET + +# Variable: BINARY\_TREE\_HEADER\_STORAGE\_OFFSET + +> `const` **BINARY\_TREE\_HEADER\_STORAGE\_OFFSET**: `64` = `64` + +Defined in: [packages/util/src/binaryTree.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L104) diff --git a/packages/util/docs/variables/BINARY_TREE_MAIN_STORAGE_OFFSET.md b/packages/util/docs/variables/BINARY_TREE_MAIN_STORAGE_OFFSET.md new file mode 100644 index 00000000000..ade17db83a3 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_MAIN_STORAGE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_MAIN\_STORAGE\_OFFSET + +# Variable: BINARY\_TREE\_MAIN\_STORAGE\_OFFSET + +> `const` **BINARY\_TREE\_MAIN\_STORAGE\_OFFSET**: `bigint` + +Defined in: [packages/util/src/binaryTree.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L107) diff --git a/packages/util/docs/variables/BINARY_TREE_NODE_WIDTH.md b/packages/util/docs/variables/BINARY_TREE_NODE_WIDTH.md new file mode 100644 index 00000000000..eea2555e249 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_NODE_WIDTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_NODE\_WIDTH + +# Variable: BINARY\_TREE\_NODE\_WIDTH + +> `const` **BINARY\_TREE\_NODE\_WIDTH**: `256` = `256` + +Defined in: [packages/util/src/binaryTree.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L106) diff --git a/packages/util/docs/variables/BINARY_TREE_NONCE_BYTES_LENGTH.md b/packages/util/docs/variables/BINARY_TREE_NONCE_BYTES_LENGTH.md new file mode 100644 index 00000000000..d94c180d931 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_NONCE_BYTES_LENGTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_NONCE\_BYTES\_LENGTH + +# Variable: BINARY\_TREE\_NONCE\_BYTES\_LENGTH + +> `const` **BINARY\_TREE\_NONCE\_BYTES\_LENGTH**: `8` = `8` + +Defined in: [packages/util/src/binaryTree.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L97) diff --git a/packages/util/docs/variables/BINARY_TREE_NONCE_OFFSET.md b/packages/util/docs/variables/BINARY_TREE_NONCE_OFFSET.md new file mode 100644 index 00000000000..b218f238333 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_NONCE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_NONCE\_OFFSET + +# Variable: BINARY\_TREE\_NONCE\_OFFSET + +> `const` **BINARY\_TREE\_NONCE\_OFFSET**: `8` = `8` + +Defined in: [packages/util/src/binaryTree.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L92) diff --git a/packages/util/docs/variables/BINARY_TREE_VERSION_BYTES_LENGTH.md b/packages/util/docs/variables/BINARY_TREE_VERSION_BYTES_LENGTH.md new file mode 100644 index 00000000000..9f5d688b42e --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_VERSION_BYTES_LENGTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_VERSION\_BYTES\_LENGTH + +# Variable: BINARY\_TREE\_VERSION\_BYTES\_LENGTH + +> `const` **BINARY\_TREE\_VERSION\_BYTES\_LENGTH**: `1` = `1` + +Defined in: [packages/util/src/binaryTree.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L95) diff --git a/packages/util/docs/variables/BINARY_TREE_VERSION_OFFSET.md b/packages/util/docs/variables/BINARY_TREE_VERSION_OFFSET.md new file mode 100644 index 00000000000..147c4ac6712 --- /dev/null +++ b/packages/util/docs/variables/BINARY_TREE_VERSION_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BINARY\_TREE\_VERSION\_OFFSET + +# Variable: BINARY\_TREE\_VERSION\_OFFSET + +> `const` **BINARY\_TREE\_VERSION\_OFFSET**: `0` = `0` + +Defined in: [packages/util/src/binaryTree.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L90) diff --git a/packages/util/docs/variables/BinaryTreeLeafType.md b/packages/util/docs/variables/BinaryTreeLeafType.md new file mode 100644 index 00000000000..d9a46b5c48e --- /dev/null +++ b/packages/util/docs/variables/BinaryTreeLeafType.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / BinaryTreeLeafType + +# Variable: BinaryTreeLeafType + +> **BinaryTreeLeafType**: `object` + +Defined in: [packages/util/src/binaryTree.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/binaryTree.ts#L76) + +## Type declaration + +### BasicData + +> `readonly` **BasicData**: `0` = `0` + +### CodeHash + +> `readonly` **CodeHash**: `1` = `1` diff --git a/packages/util/docs/variables/CLRequestType.md b/packages/util/docs/variables/CLRequestType.md new file mode 100644 index 00000000000..9b826a73be4 --- /dev/null +++ b/packages/util/docs/variables/CLRequestType.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / CLRequestType + +# Variable: CLRequestType + +> **CLRequestType**: `object` + +Defined in: [packages/util/src/request.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/request.ts#L7) + +## Type declaration + +### Consolidation + +> `readonly` **Consolidation**: `2` = `2` + +### Deposit + +> `readonly` **Deposit**: `0` = `0` + +### Withdrawal + +> `readonly` **Withdrawal**: `1` = `1` diff --git a/packages/util/docs/variables/DEFAULT_ERROR_CODE.md b/packages/util/docs/variables/DEFAULT_ERROR_CODE.md new file mode 100644 index 00000000000..cabc22f6b89 --- /dev/null +++ b/packages/util/docs/variables/DEFAULT_ERROR_CODE.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / DEFAULT\_ERROR\_CODE + +# Variable: DEFAULT\_ERROR\_CODE + +> `const` **DEFAULT\_ERROR\_CODE**: `"ETHEREUMJS_DEFAULT_ERROR_CODE"` = `"ETHEREUMJS_DEFAULT_ERROR_CODE"` + +Defined in: packages/rlp/dist/esm/errors.d.ts:15 diff --git a/packages/util/docs/variables/ETHER_TO_WEI.md b/packages/util/docs/variables/ETHER_TO_WEI.md new file mode 100644 index 00000000000..cd64d771452 --- /dev/null +++ b/packages/util/docs/variables/ETHER_TO_WEI.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / ETHER\_TO\_WEI + +# Variable: ETHER\_TO\_WEI + +> `const` **ETHER\_TO\_WEI**: `bigint` + +Defined in: [packages/util/src/units.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L6) diff --git a/packages/util/docs/variables/GWEI_TO_WEI.md b/packages/util/docs/variables/GWEI_TO_WEI.md new file mode 100644 index 00000000000..d7f0e60403d --- /dev/null +++ b/packages/util/docs/variables/GWEI_TO_WEI.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / GWEI\_TO\_WEI + +# Variable: GWEI\_TO\_WEI + +> `const` **GWEI\_TO\_WEI**: `bigint` + +Defined in: [packages/util/src/units.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/units.ts#L5) + +Conversion constants to wei diff --git a/packages/util/docs/variables/KECCAK256_NULL.md b/packages/util/docs/variables/KECCAK256_NULL.md new file mode 100644 index 00000000000..8208ff35b2c --- /dev/null +++ b/packages/util/docs/variables/KECCAK256_NULL.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KECCAK256\_NULL + +# Variable: KECCAK256\_NULL + +> `const` **KECCAK256\_NULL**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/constants.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L45) + +Keccak-256 hash of null diff --git a/packages/util/docs/variables/KECCAK256_NULL_S.md b/packages/util/docs/variables/KECCAK256_NULL_S.md new file mode 100644 index 00000000000..065f0ada051 --- /dev/null +++ b/packages/util/docs/variables/KECCAK256_NULL_S.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KECCAK256\_NULL\_S + +# Variable: KECCAK256\_NULL\_S + +> `const` **KECCAK256\_NULL\_S**: `"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"` = `'0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'` + +Defined in: [packages/util/src/constants.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L40) + +Keccak-256 hash of null diff --git a/packages/util/docs/variables/KECCAK256_RLP.md b/packages/util/docs/variables/KECCAK256_RLP.md new file mode 100644 index 00000000000..50907e5e5f4 --- /dev/null +++ b/packages/util/docs/variables/KECCAK256_RLP.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KECCAK256\_RLP + +# Variable: KECCAK256\_RLP + +> `const` **KECCAK256\_RLP**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/constants.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L66) + +Keccak-256 hash of the RLP of null diff --git a/packages/util/docs/variables/KECCAK256_RLP_ARRAY.md b/packages/util/docs/variables/KECCAK256_RLP_ARRAY.md new file mode 100644 index 00000000000..9df11fa8471 --- /dev/null +++ b/packages/util/docs/variables/KECCAK256_RLP_ARRAY.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KECCAK256\_RLP\_ARRAY + +# Variable: KECCAK256\_RLP\_ARRAY + +> `const` **KECCAK256\_RLP\_ARRAY**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/constants.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L56) + +Keccak-256 of an RLP of an empty array diff --git a/packages/util/docs/variables/KECCAK256_RLP_ARRAY_S.md b/packages/util/docs/variables/KECCAK256_RLP_ARRAY_S.md new file mode 100644 index 00000000000..383a758c6ad --- /dev/null +++ b/packages/util/docs/variables/KECCAK256_RLP_ARRAY_S.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KECCAK256\_RLP\_ARRAY\_S + +# Variable: KECCAK256\_RLP\_ARRAY\_S + +> `const` **KECCAK256\_RLP\_ARRAY\_S**: `"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"` = `'0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'` + +Defined in: [packages/util/src/constants.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L50) + +Keccak-256 of an RLP of an empty array diff --git a/packages/util/docs/variables/KECCAK256_RLP_S.md b/packages/util/docs/variables/KECCAK256_RLP_S.md new file mode 100644 index 00000000000..84780d6a4e3 --- /dev/null +++ b/packages/util/docs/variables/KECCAK256_RLP_S.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KECCAK256\_RLP\_S + +# Variable: KECCAK256\_RLP\_S + +> `const` **KECCAK256\_RLP\_S**: `"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"` = `'0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'` + +Defined in: [packages/util/src/constants.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L61) + +Keccak-256 hash of the RLP of null diff --git a/packages/util/docs/variables/KeyEncoding.md b/packages/util/docs/variables/KeyEncoding.md new file mode 100644 index 00000000000..b70eb674d5b --- /dev/null +++ b/packages/util/docs/variables/KeyEncoding.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / KeyEncoding + +# Variable: KeyEncoding + +> **KeyEncoding**: `object` + +Defined in: [packages/util/src/db.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L9) + +## Type declaration + +### Bytes + +> `readonly` **Bytes**: `"view"` = `'view'` + +### Number + +> `readonly` **Number**: `"number"` = `'number'` + +### String + +> `readonly` **String**: `"string"` = `'string'` diff --git a/packages/util/docs/variables/MAX_INTEGER.md b/packages/util/docs/variables/MAX_INTEGER.md new file mode 100644 index 00000000000..3965b2616be --- /dev/null +++ b/packages/util/docs/variables/MAX_INTEGER.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / MAX\_INTEGER + +# Variable: MAX\_INTEGER + +> `const` **MAX\_INTEGER**: `bigint` + +Defined in: [packages/util/src/constants.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L14) + +The max integer that the evm can handle (2^256-1) diff --git a/packages/util/docs/variables/MAX_INTEGER_BIGINT.md b/packages/util/docs/variables/MAX_INTEGER_BIGINT.md new file mode 100644 index 00000000000..c064c971515 --- /dev/null +++ b/packages/util/docs/variables/MAX_INTEGER_BIGINT.md @@ -0,0 +1,15 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / MAX\_INTEGER\_BIGINT + +# Variable: MAX\_INTEGER\_BIGINT + +> `const` **MAX\_INTEGER\_BIGINT**: `bigint` + +Defined in: [packages/util/src/constants.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L23) + +The max integer that the evm can handle (2^256-1) as a bigint +2^256-1 equals to 340282366920938463463374607431768211455 +We use literal value instead of calculated value for compatibility issue. diff --git a/packages/util/docs/variables/MAX_UINT64.md b/packages/util/docs/variables/MAX_UINT64.md new file mode 100644 index 00000000000..e047eb1d24b --- /dev/null +++ b/packages/util/docs/variables/MAX_UINT64.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / MAX\_UINT64 + +# Variable: MAX\_UINT64 + +> `const` **MAX\_UINT64**: `bigint` + +Defined in: [packages/util/src/constants.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L9) + +2^64-1 diff --git a/packages/util/docs/variables/MAX_WITHDRAWALS_PER_PAYLOAD.md b/packages/util/docs/variables/MAX_WITHDRAWALS_PER_PAYLOAD.md new file mode 100644 index 00000000000..f9da38a1558 --- /dev/null +++ b/packages/util/docs/variables/MAX_WITHDRAWALS_PER_PAYLOAD.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / MAX\_WITHDRAWALS\_PER\_PAYLOAD + +# Variable: MAX\_WITHDRAWALS\_PER\_PAYLOAD + +> `const` **MAX\_WITHDRAWALS\_PER\_PAYLOAD**: `16` = `16` + +Defined in: [packages/util/src/constants.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L75) diff --git a/packages/util/docs/variables/RIPEMD160_ADDRESS_STRING.md b/packages/util/docs/variables/RIPEMD160_ADDRESS_STRING.md new file mode 100644 index 00000000000..9ef3a564675 --- /dev/null +++ b/packages/util/docs/variables/RIPEMD160_ADDRESS_STRING.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / RIPEMD160\_ADDRESS\_STRING + +# Variable: RIPEMD160\_ADDRESS\_STRING + +> `const` **RIPEMD160\_ADDRESS\_STRING**: `"0000000000000000000000000000000000000003"` = `'0000000000000000000000000000000000000003'` + +Defined in: [packages/util/src/constants.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L77) diff --git a/packages/util/docs/variables/RLP_EMPTY_STRING.md b/packages/util/docs/variables/RLP_EMPTY_STRING.md new file mode 100644 index 00000000000..f555f4f7fe3 --- /dev/null +++ b/packages/util/docs/variables/RLP_EMPTY_STRING.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / RLP\_EMPTY\_STRING + +# Variable: RLP\_EMPTY\_STRING + +> `const` **RLP\_EMPTY\_STRING**: `Uint8Array`\<`ArrayBuffer`\> + +Defined in: [packages/util/src/constants.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L73) + +RLP encoded empty string diff --git a/packages/util/docs/variables/SECP256K1_ORDER.md b/packages/util/docs/variables/SECP256K1_ORDER.md new file mode 100644 index 00000000000..64c197f1151 --- /dev/null +++ b/packages/util/docs/variables/SECP256K1_ORDER.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / SECP256K1\_ORDER + +# Variable: SECP256K1\_ORDER + +> `const` **SECP256K1\_ORDER**: `bigint` = `secp256k1.CURVE.n` + +Defined in: [packages/util/src/constants.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L27) diff --git a/packages/util/docs/variables/SECP256K1_ORDER_DIV_2.md b/packages/util/docs/variables/SECP256K1_ORDER_DIV_2.md new file mode 100644 index 00000000000..65b93d60512 --- /dev/null +++ b/packages/util/docs/variables/SECP256K1_ORDER_DIV_2.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / SECP256K1\_ORDER\_DIV\_2 + +# Variable: SECP256K1\_ORDER\_DIV\_2 + +> `const` **SECP256K1\_ORDER\_DIV\_2**: `bigint` + +Defined in: [packages/util/src/constants.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L28) diff --git a/packages/util/docs/variables/SHA256_NULL.md b/packages/util/docs/variables/SHA256_NULL.md new file mode 100644 index 00000000000..d9fe32a808e --- /dev/null +++ b/packages/util/docs/variables/SHA256_NULL.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / SHA256\_NULL + +# Variable: SHA256\_NULL + +> `const` **SHA256\_NULL**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/constants.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L68) diff --git a/packages/util/docs/variables/TWO_POW256.md b/packages/util/docs/variables/TWO_POW256.md new file mode 100644 index 00000000000..53c95d54031 --- /dev/null +++ b/packages/util/docs/variables/TWO_POW256.md @@ -0,0 +1,13 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / TWO\_POW256 + +# Variable: TWO\_POW256 + +> `const` **TWO\_POW256**: `bigint` + +Defined in: [packages/util/src/constants.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L33) + +2^256 diff --git a/packages/util/docs/variables/TypeOutput.md b/packages/util/docs/variables/TypeOutput.md new file mode 100644 index 00000000000..f94413cfa9f --- /dev/null +++ b/packages/util/docs/variables/TypeOutput.md @@ -0,0 +1,29 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / TypeOutput + +# Variable: TypeOutput + +> **TypeOutput**: `object` + +Defined in: [packages/util/src/types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L61) + +## Type declaration + +### BigInt + +> `readonly` **BigInt**: `1` = `1` + +### Number + +> `readonly` **Number**: `0` = `0` + +### PrefixedHexString + +> `readonly` **PrefixedHexString**: `3` = `3` + +### Uint8Array + +> `readonly` **Uint8Array**: `2` = `2` diff --git a/packages/util/docs/variables/VERKLE_BALANCE_BYTES_LENGTH.md b/packages/util/docs/variables/VERKLE_BALANCE_BYTES_LENGTH.md new file mode 100644 index 00000000000..d23f360c320 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_BALANCE_BYTES_LENGTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_BALANCE\_BYTES\_LENGTH + +# Variable: VERKLE\_BALANCE\_BYTES\_LENGTH + +> `const` **VERKLE\_BALANCE\_BYTES\_LENGTH**: `16` = `16` + +Defined in: [packages/util/src/verkle.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L162) diff --git a/packages/util/docs/variables/VERKLE_BALANCE_OFFSET.md b/packages/util/docs/variables/VERKLE_BALANCE_OFFSET.md new file mode 100644 index 00000000000..222a241ca50 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_BALANCE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_BALANCE\_OFFSET + +# Variable: VERKLE\_BALANCE\_OFFSET + +> `const` **VERKLE\_BALANCE\_OFFSET**: `16` = `16` + +Defined in: [packages/util/src/verkle.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L157) diff --git a/packages/util/docs/variables/VERKLE_BASIC_DATA_LEAF_KEY.md b/packages/util/docs/variables/VERKLE_BASIC_DATA_LEAF_KEY.md new file mode 100644 index 00000000000..b468e9071af --- /dev/null +++ b/packages/util/docs/variables/VERKLE_BASIC_DATA_LEAF_KEY.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_BASIC\_DATA\_LEAF\_KEY + +# Variable: VERKLE\_BASIC\_DATA\_LEAF\_KEY + +> `const` **VERKLE\_BASIC\_DATA\_LEAF\_KEY**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/verkle.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L164) diff --git a/packages/util/docs/variables/VERKLE_CODE_CHUNK_SIZE.md b/packages/util/docs/variables/VERKLE_CODE_CHUNK_SIZE.md new file mode 100644 index 00000000000..521216d93cb --- /dev/null +++ b/packages/util/docs/variables/VERKLE_CODE_CHUNK_SIZE.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_CODE\_CHUNK\_SIZE + +# Variable: VERKLE\_CODE\_CHUNK\_SIZE + +> `const` **VERKLE\_CODE\_CHUNK\_SIZE**: `31` = `31` + +Defined in: [packages/util/src/verkle.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L167) diff --git a/packages/util/docs/variables/VERKLE_CODE_HASH_LEAF_KEY.md b/packages/util/docs/variables/VERKLE_CODE_HASH_LEAF_KEY.md new file mode 100644 index 00000000000..618650d5cf7 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_CODE_HASH_LEAF_KEY.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_CODE\_HASH\_LEAF\_KEY + +# Variable: VERKLE\_CODE\_HASH\_LEAF\_KEY + +> `const` **VERKLE\_CODE\_HASH\_LEAF\_KEY**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [packages/util/src/verkle.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L165) diff --git a/packages/util/docs/variables/VERKLE_CODE_OFFSET.md b/packages/util/docs/variables/VERKLE_CODE_OFFSET.md new file mode 100644 index 00000000000..41e11904e01 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_CODE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_CODE\_OFFSET + +# Variable: VERKLE\_CODE\_OFFSET + +> `const` **VERKLE\_CODE\_OFFSET**: `128` = `128` + +Defined in: [packages/util/src/verkle.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L169) diff --git a/packages/util/docs/variables/VERKLE_CODE_SIZE_BYTES_LENGTH.md b/packages/util/docs/variables/VERKLE_CODE_SIZE_BYTES_LENGTH.md new file mode 100644 index 00000000000..c6655420f15 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_CODE_SIZE_BYTES_LENGTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_CODE\_SIZE\_BYTES\_LENGTH + +# Variable: VERKLE\_CODE\_SIZE\_BYTES\_LENGTH + +> `const` **VERKLE\_CODE\_SIZE\_BYTES\_LENGTH**: `3` = `3` + +Defined in: [packages/util/src/verkle.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L160) diff --git a/packages/util/docs/variables/VERKLE_CODE_SIZE_OFFSET.md b/packages/util/docs/variables/VERKLE_CODE_SIZE_OFFSET.md new file mode 100644 index 00000000000..907b25a8b20 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_CODE_SIZE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_CODE\_SIZE\_OFFSET + +# Variable: VERKLE\_CODE\_SIZE\_OFFSET + +> `const` **VERKLE\_CODE\_SIZE\_OFFSET**: `5` = `5` + +Defined in: [packages/util/src/verkle.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L155) diff --git a/packages/util/docs/variables/VERKLE_HEADER_STORAGE_OFFSET.md b/packages/util/docs/variables/VERKLE_HEADER_STORAGE_OFFSET.md new file mode 100644 index 00000000000..ba3e0da7c2d --- /dev/null +++ b/packages/util/docs/variables/VERKLE_HEADER_STORAGE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_HEADER\_STORAGE\_OFFSET + +# Variable: VERKLE\_HEADER\_STORAGE\_OFFSET + +> `const` **VERKLE\_HEADER\_STORAGE\_OFFSET**: `64` = `64` + +Defined in: [packages/util/src/verkle.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L168) diff --git a/packages/util/docs/variables/VERKLE_MAIN_STORAGE_OFFSET.md b/packages/util/docs/variables/VERKLE_MAIN_STORAGE_OFFSET.md new file mode 100644 index 00000000000..052669fa491 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_MAIN_STORAGE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_MAIN\_STORAGE\_OFFSET + +# Variable: VERKLE\_MAIN\_STORAGE\_OFFSET + +> `const` **VERKLE\_MAIN\_STORAGE\_OFFSET**: `bigint` + +Defined in: [packages/util/src/verkle.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L171) diff --git a/packages/util/docs/variables/VERKLE_NODE_WIDTH.md b/packages/util/docs/variables/VERKLE_NODE_WIDTH.md new file mode 100644 index 00000000000..e21155031a7 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_NODE_WIDTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_NODE\_WIDTH + +# Variable: VERKLE\_NODE\_WIDTH + +> `const` **VERKLE\_NODE\_WIDTH**: `256` = `256` + +Defined in: [packages/util/src/verkle.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L170) diff --git a/packages/util/docs/variables/VERKLE_NONCE_BYTES_LENGTH.md b/packages/util/docs/variables/VERKLE_NONCE_BYTES_LENGTH.md new file mode 100644 index 00000000000..a8453fe1b7e --- /dev/null +++ b/packages/util/docs/variables/VERKLE_NONCE_BYTES_LENGTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_NONCE\_BYTES\_LENGTH + +# Variable: VERKLE\_NONCE\_BYTES\_LENGTH + +> `const` **VERKLE\_NONCE\_BYTES\_LENGTH**: `8` = `8` + +Defined in: [packages/util/src/verkle.ts:161](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L161) diff --git a/packages/util/docs/variables/VERKLE_NONCE_OFFSET.md b/packages/util/docs/variables/VERKLE_NONCE_OFFSET.md new file mode 100644 index 00000000000..0f6936b04c3 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_NONCE_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_NONCE\_OFFSET + +# Variable: VERKLE\_NONCE\_OFFSET + +> `const` **VERKLE\_NONCE\_OFFSET**: `8` = `8` + +Defined in: [packages/util/src/verkle.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L156) diff --git a/packages/util/docs/variables/VERKLE_VERSION_BYTES_LENGTH.md b/packages/util/docs/variables/VERKLE_VERSION_BYTES_LENGTH.md new file mode 100644 index 00000000000..c8aa131f00c --- /dev/null +++ b/packages/util/docs/variables/VERKLE_VERSION_BYTES_LENGTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_VERSION\_BYTES\_LENGTH + +# Variable: VERKLE\_VERSION\_BYTES\_LENGTH + +> `const` **VERKLE\_VERSION\_BYTES\_LENGTH**: `1` = `1` + +Defined in: [packages/util/src/verkle.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L159) diff --git a/packages/util/docs/variables/VERKLE_VERSION_OFFSET.md b/packages/util/docs/variables/VERKLE_VERSION_OFFSET.md new file mode 100644 index 00000000000..6c706d7cea1 --- /dev/null +++ b/packages/util/docs/variables/VERKLE_VERSION_OFFSET.md @@ -0,0 +1,11 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VERKLE\_VERSION\_OFFSET + +# Variable: VERKLE\_VERSION\_OFFSET + +> `const` **VERKLE\_VERSION\_OFFSET**: `0` = `0` + +Defined in: [packages/util/src/verkle.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L154) diff --git a/packages/util/docs/variables/ValueEncoding.md b/packages/util/docs/variables/ValueEncoding.md new file mode 100644 index 00000000000..41d8af81ca9 --- /dev/null +++ b/packages/util/docs/variables/ValueEncoding.md @@ -0,0 +1,25 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / ValueEncoding + +# Variable: ValueEncoding + +> **ValueEncoding**: `object` + +Defined in: [packages/util/src/db.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L17) + +## Type declaration + +### Bytes + +> `readonly` **Bytes**: `"view"` = `'view'` + +### JSON + +> `readonly` **JSON**: `"json"` = `'json'` + +### String + +> `readonly` **String**: `"string"` = `'string'` diff --git a/packages/util/docs/variables/VerkleLeafType.md b/packages/util/docs/variables/VerkleLeafType.md new file mode 100644 index 00000000000..77591b17981 --- /dev/null +++ b/packages/util/docs/variables/VerkleLeafType.md @@ -0,0 +1,21 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / VerkleLeafType + +# Variable: VerkleLeafType + +> **VerkleLeafType**: `object` + +Defined in: [packages/util/src/verkle.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/verkle.ts#L140) + +## Type declaration + +### BasicData + +> `readonly` **BasicData**: `0` = `0` + +### CodeHash + +> `readonly` **CodeHash**: `1` = `1` diff --git a/packages/util/docs/variables/bytesToUnprefixedHex.md b/packages/util/docs/variables/bytesToUnprefixedHex.md new file mode 100644 index 00000000000..5598ec03999 --- /dev/null +++ b/packages/util/docs/variables/bytesToUnprefixedHex.md @@ -0,0 +1,31 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / bytesToUnprefixedHex + +# Variable: ~~bytesToUnprefixedHex()~~ + +> `const` **bytesToUnprefixedHex**: (`bytes`) => `string` = `_bytesToUnprefixedHex` + +Defined in: [packages/util/src/bytes.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L19) + +Convert byte array to hex string. + +## Parameters + +### bytes + +`Uint8Array` + +## Returns + +`string` + +## Example + +```ts +bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' +``` + +## Deprecated diff --git a/packages/util/docs/variables/publicToAddress.md b/packages/util/docs/variables/publicToAddress.md new file mode 100644 index 00000000000..b43ed9988cf --- /dev/null +++ b/packages/util/docs/variables/publicToAddress.md @@ -0,0 +1,32 @@ +[**@ethereumjs/util**](../README.md) + +*** + +[@ethereumjs/util](../README.md) / publicToAddress + +# Variable: publicToAddress() + +> `const` **publicToAddress**: (`pubKey`, `sanitize`) => `Uint8Array` = `pubToAddress` + +Defined in: [packages/util/src/account.ts:549](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L549) + +Returns the ethereum address of a given public key. +Accepts "Ethereum public keys" and SEC1 encoded keys. + +## Parameters + +### pubKey + +`Uint8Array` + +The two points of an uncompressed key, unless sanitize is enabled + +### sanitize + +`boolean` = `false` + +Accept public keys in other formats + +## Returns + +`Uint8Array` diff --git a/packages/util/package.json b/packages/util/package.json index 2e3d46928b9..fcfaaf4c006 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -78,7 +78,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "npx typedoc --options typedoc.cjs", + "docs:build": "npx typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- util", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", @@ -95,7 +95,7 @@ }, "dependencies": { "@ethereumjs/rlp": "^10.0.0-rc.1", - "ethereum-cryptography": "^3.1.0" + "ethereum-cryptography": "^3.2.0" }, "devDependencies": { "@paulmillr/trusted-setups": "^0.1.2", diff --git a/packages/util/src/account.ts b/packages/util/src/account.ts index 6a6e30544e3..3f4fa0b4ec4 100644 --- a/packages/util/src/account.ts +++ b/packages/util/src/account.ts @@ -19,7 +19,7 @@ import { EthereumJSErrorWithoutCode } from './errors.ts' import { assertIsBytes, assertIsHexString, assertIsString } from './helpers.ts' import { stripHexPrefix } from './internal.ts' -import type { BigIntLike, BytesLike, PrefixedHexString } from './types.ts' +import type { BigIntLike, BytesLike, NestedUint8Array, PrefixedHexString } from './types.ts' export interface AccountData { nonce?: BigIntLike @@ -39,6 +39,35 @@ export interface PartialAccountData { export type AccountBodyBytes = [Uint8Array, Uint8Array, Uint8Array, Uint8Array] +/** + * Handles the null indicator for RLP encoded accounts + * @returns {null} is the null indicator is 0 + * @returns The unchanged value is the null indicator is 1 + * @throws if the null indicator is > 1 + * @throws if the length of values is < 2 + * @param value The value to convert + * @returns The converted value + */ +function handleNullIndicator(values: NestedUint8Array | Uint8Array): Uint8Array | null { + // Needed if some values are not provided to the array (e.g. partial account RLP) + if (values[0] === undefined) { + return null + } + + const nullIndicator = bytesToInt(values[0] as Uint8Array) + + if (nullIndicator === 0) { + return null + } + if (nullIndicator > 1) { + throw EthereumJSErrorWithoutCode(`Invalid isNullIndicator=${nullIndicator}`) + } + if (values.length < 2) { + throw EthereumJSErrorWithoutCode(`Invalid values length=${values.length}`) + } + return values[1] as Uint8Array +} + /** * Account class to load and maintain the basic account objects. * Supports partial loading and access required for verkle with null @@ -126,8 +155,10 @@ export class Account { /** * This constructor assigns and validates the values. - * Use the static factory methods to assist in creating an Account from varying data types. - * undefined get assigned with the defaults present, but null args are retained as is + * It is not recommended to use this constructor directly. Instead use the static + * factory methods to assist in creating an Account from varying data types. + * undefined get assigned with the defaults, but null args are retained as is + * @deprecated */ constructor( nonce: bigint | null = BIGINT_0, @@ -325,91 +356,26 @@ export function createAccountFromRLP(serialized: Uint8Array) { } export function createPartialAccountFromRLP(serialized: Uint8Array) { - const values = RLP.decode(serialized) as Uint8Array[][] + const values = RLP.decode(serialized) if (!Array.isArray(values)) { throw EthereumJSErrorWithoutCode('Invalid serialized account input. Must be array') } - let nonce = null - if (!Array.isArray(values[0])) { - throw EthereumJSErrorWithoutCode('Invalid partial nonce encoding. Must be array') - } else { - const isNotNullIndicator = bytesToInt(values[0][0]) - if (isNotNullIndicator !== 0 && isNotNullIndicator !== 1) { - throw EthereumJSErrorWithoutCode(`Invalid isNullIndicator=${isNotNullIndicator} for nonce`) - } - if (isNotNullIndicator === 1) { - nonce = bytesToBigInt(values[0][1]) + for (const value of values) { + // Ensure that each array item is an array + if (!Array.isArray(value)) { + throw EthereumJSErrorWithoutCode('Invalid partial encoding. Each item must be an array') } } - let balance = null - if (!Array.isArray(values[1])) { - throw EthereumJSErrorWithoutCode('Invalid partial balance encoding. Must be array') - } else { - const isNotNullIndicator = bytesToInt(values[1][0]) - if (isNotNullIndicator !== 0 && isNotNullIndicator !== 1) { - throw EthereumJSErrorWithoutCode(`Invalid isNullIndicator=${isNotNullIndicator} for balance`) - } - if (isNotNullIndicator === 1) { - balance = bytesToBigInt(values[1][1]) - } - } + const [nonceRaw, balanceRaw, storageRoot, codeHash, codeSizeRaw, versionRaw] = + values.map(handleNullIndicator) - let storageRoot = null - if (!Array.isArray(values[2])) { - throw EthereumJSErrorWithoutCode('Invalid partial storageRoot encoding. Must be array') - } else { - const isNotNullIndicator = bytesToInt(values[2][0]) - if (isNotNullIndicator !== 0 && isNotNullIndicator !== 1) { - throw EthereumJSErrorWithoutCode( - `Invalid isNullIndicator=${isNotNullIndicator} for storageRoot`, - ) - } - if (isNotNullIndicator === 1) { - storageRoot = values[2][1] - } - } - - let codeHash = null - if (!Array.isArray(values[3])) { - throw EthereumJSErrorWithoutCode('Invalid partial codeHash encoding. Must be array') - } else { - const isNotNullIndicator = bytesToInt(values[3][0]) - if (isNotNullIndicator !== 0 && isNotNullIndicator !== 1) { - throw EthereumJSErrorWithoutCode(`Invalid isNullIndicator=${isNotNullIndicator} for codeHash`) - } - if (isNotNullIndicator === 1) { - codeHash = values[3][1] - } - } - - let codeSize = null - if (!Array.isArray(values[4])) { - throw EthereumJSErrorWithoutCode('Invalid partial codeSize encoding. Must be array') - } else { - const isNotNullIndicator = bytesToInt(values[4][0]) - if (isNotNullIndicator !== 0 && isNotNullIndicator !== 1) { - throw EthereumJSErrorWithoutCode(`Invalid isNullIndicator=${isNotNullIndicator} for codeSize`) - } - if (isNotNullIndicator === 1) { - codeSize = bytesToInt(values[4][1]) - } - } - - let version = null - if (!Array.isArray(values[5])) { - throw EthereumJSErrorWithoutCode('Invalid partial version encoding. Must be array') - } else { - const isNotNullIndicator = bytesToInt(values[5][0]) - if (isNotNullIndicator !== 0 && isNotNullIndicator !== 1) { - throw EthereumJSErrorWithoutCode(`Invalid isNullIndicator=${isNotNullIndicator} for version`) - } - if (isNotNullIndicator === 1) { - version = bytesToInt(values[5][1]) - } - } + const nonce = nonceRaw === null ? null : bytesToBigInt(nonceRaw) + const balance = balanceRaw === null ? null : bytesToBigInt(balanceRaw) + const codeSize = codeSizeRaw === null ? null : bytesToInt(codeSizeRaw) + const version = versionRaw === null ? null : bytesToInt(versionRaw) return createPartialAccount({ balance, nonce, storageRoot, codeHash, codeSize, version }) } diff --git a/packages/tx/src/util/authorization.ts b/packages/util/src/authorization.ts similarity index 57% rename from packages/tx/src/util/authorization.ts rename to packages/util/src/authorization.ts index 85bde153a90..51da2bd4364 100644 --- a/packages/tx/src/util/authorization.ts +++ b/packages/util/src/authorization.ts @@ -1,38 +1,37 @@ // Utility helpers to convert authorization lists from the byte format and JSON format and vice versa -import type { Common } from '@ethereumjs/common' -import { RLP } from '@ethereumjs/rlp' +import { EthereumJSErrorWithoutCode, RLP } from '@ethereumjs/rlp' +import { keccak256 } from 'ethereum-cryptography/keccak.js' +import { secp256k1 } from 'ethereum-cryptography/secp256k1.js' +import { publicToAddress } from './account.ts' +import { Address } from './address.ts' import { - Address, - EthereumJSErrorWithoutCode, bigIntToUnpaddedBytes, bytesToBigInt, bytesToHex, concatBytes, - ecrecover, hexToBytes, - publicToAddress, setLengthLeft, unpadBytes, -} from '@ethereumjs/util' -import { keccak256 } from 'ethereum-cryptography/keccak' -import { secp256k1 } from 'ethereum-cryptography/secp256k1' -import { AUTHORITY_SIGNING_MAGIC } from '../constants.ts' +} from './bytes.ts' +import { ecrecover } from './signature.ts' import type { - AuthorizationListBytesItem, - AuthorizationListBytesItemUnsigned, - AuthorizationListItem, - AuthorizationListItemUnsigned, -} from '../types.ts' + EOACode7702AuthorizationListBytesItem, + EOACode7702AuthorizationListBytesItemUnsigned, + EOACode7702AuthorizationListItem, + EOACode7702AuthorizationListItemUnsigned, +} from './types.ts' + +export const EOA_CODE_7702_AUTHORITY_SIGNING_MAGIC = hexToBytes('0x05') /** * Converts an authorization list to a JSON format * @param authorizationList * @returns authorizationList in JSON format */ -export function authorizationListBytesItemToJSON( - authorizationList: AuthorizationListBytesItem, -): AuthorizationListItem { +export function eoaCode7702AuthorizationListBytesItemToJSON( + authorizationList: EOACode7702AuthorizationListBytesItem, +): EOACode7702AuthorizationListItem { const [chainId, address, nonce, yParity, r, s] = authorizationList return { chainId: bytesToHex(chainId), @@ -49,9 +48,9 @@ export function authorizationListBytesItemToJSON( * @param authorizationList * @returns bytes format of the authority list */ -export function authorizationListJSONItemToBytes( - authorizationList: AuthorizationListItem, -): AuthorizationListBytesItem { +export function eoaCode7702AuthorizationListJSONItemToBytes( + authorizationList: EOACode7702AuthorizationListItem, +): EOACode7702AuthorizationListBytesItem { const requiredFields = ['chainId', 'address', 'nonce', 'yParity', 'r', 's'] as const // Validate all required fields are present @@ -74,7 +73,7 @@ export function authorizationListJSONItemToBytes( } /** Authorization signing utility methods */ -function unsignedAuthorizationListToBytes(input: AuthorizationListItemUnsigned) { +function unsignedAuthorizationListToBytes(input: EOACode7702AuthorizationListItemUnsigned) { const { chainId: chainIdHex, address: addressHex, nonce: nonceHex } = input const chainId = hexToBytes(chainIdHex) const address = setLengthLeft(hexToBytes(addressHex), 20) @@ -87,8 +86,8 @@ function unsignedAuthorizationListToBytes(input: AuthorizationListItemUnsigned) * @param input Either the bytes or the object format of the authorization list item * @returns */ -export function authorizationMessageToSign( - input: AuthorizationListItemUnsigned | AuthorizationListBytesItemUnsigned, +export function eoaCode7702AuthorizationMessageToSign( + input: EOACode7702AuthorizationListItemUnsigned | EOACode7702AuthorizationListBytesItemUnsigned, ) { if (Array.isArray(input)) { // The address is validated, the chainId and nonce will be `unpadBytes` such that these are valid @@ -97,12 +96,12 @@ export function authorizationMessageToSign( throw EthereumJSErrorWithoutCode('Cannot sign authority: address length should be 20 bytes') } return concatBytes( - AUTHORITY_SIGNING_MAGIC, + EOA_CODE_7702_AUTHORITY_SIGNING_MAGIC, RLP.encode([unpadBytes(chainId), address, unpadBytes(nonce)]), ) } else { const [chainId, address, nonce] = unsignedAuthorizationListToBytes(input) - return concatBytes(AUTHORITY_SIGNING_MAGIC, RLP.encode([chainId, address, nonce])) + return concatBytes(EOA_CODE_7702_AUTHORITY_SIGNING_MAGIC, RLP.encode([chainId, address, nonce])) } } @@ -111,10 +110,10 @@ export function authorizationMessageToSign( * @param input * @returns */ -export function authorizationHashedMessageToSign( - input: AuthorizationListItemUnsigned | AuthorizationListBytesItemUnsigned, +export function eoaCode7702AuthorizationHashedMessageToSign( + input: EOACode7702AuthorizationListItemUnsigned | EOACode7702AuthorizationListBytesItemUnsigned, ) { - return keccak256(authorizationMessageToSign(input)) + return keccak256(eoaCode7702AuthorizationMessageToSign(input)) } /** @@ -122,15 +121,20 @@ export function authorizationHashedMessageToSign( * To get the JSON format, use `authorizationListBytesToJSON([signed])[0] to convert it` * @param input * @param privateKey + * @param ecSign * @returns */ -export function signAuthorization( - input: AuthorizationListItemUnsigned | AuthorizationListBytesItemUnsigned, +export function eoaCode7702SignAuthorization( + input: EOACode7702AuthorizationListItemUnsigned | EOACode7702AuthorizationListBytesItemUnsigned, privateKey: Uint8Array, - common?: Common, -): AuthorizationListBytesItem { - const msgHash = authorizationHashedMessageToSign(input) - const secp256k1Sign = common?.customCrypto.ecsign ?? secp256k1.sign + ecSign?: ( + msg: Uint8Array, + pk: Uint8Array, + ecSignOpts?: { extraEntropy?: Uint8Array | boolean }, + ) => Pick, 'recovery' | 'r' | 's'>, +): EOACode7702AuthorizationListBytesItem { + const msgHash = eoaCode7702AuthorizationHashedMessageToSign(input) + const secp256k1Sign = ecSign ?? secp256k1.sign const signed = secp256k1Sign(msgHash, privateKey) const [chainId, address, nonce] = Array.isArray(input) ? input @@ -146,12 +150,14 @@ export function signAuthorization( ] } -export function recoverAuthority( - input: AuthorizationListItem | AuthorizationListBytesItem, +export function eoaCode7702RecoverAuthority( + input: EOACode7702AuthorizationListItem | EOACode7702AuthorizationListBytesItem, ): Address { - const inputBytes = Array.isArray(input) ? input : authorizationListJSONItemToBytes(input) + const inputBytes = Array.isArray(input) + ? input + : eoaCode7702AuthorizationListJSONItemToBytes(input) const [chainId, address, nonce, yParity, r, s] = inputBytes - const msgHash = authorizationHashedMessageToSign([chainId, address, nonce]) + const msgHash = eoaCode7702AuthorizationHashedMessageToSign([chainId, address, nonce]) const pubKey = ecrecover(msgHash, bytesToBigInt(yParity), r, s) return new Address(publicToAddress(pubKey)) } diff --git a/packages/util/src/binaryTree.ts b/packages/util/src/binaryTree.ts index 9750fef65bf..59956948407 100644 --- a/packages/util/src/binaryTree.ts +++ b/packages/util/src/binaryTree.ts @@ -7,7 +7,6 @@ import { intToBytes, setLengthLeft, setLengthRight, - toBytes, } from './bytes.ts' import type { Account } from './account.ts' @@ -173,7 +172,7 @@ export const getBinaryTreeKeyForCodeChunk = ( hashFunction: (input: Uint8Array) => Uint8Array, ) => { const { treeIndex, subIndex } = getBinaryTreeIndicesForCodeChunk(chunkId) - return concatBytes(getBinaryTreeStem(hashFunction, address, treeIndex), toBytes(subIndex)) + return concatBytes(getBinaryTreeStem(hashFunction, address, treeIndex), intToBytes(subIndex)) } // This code was written by robots based on the reference implementation in EIP-7864 diff --git a/packages/util/src/bytes.ts b/packages/util/src/bytes.ts index c7dd3834107..bd9d1a20696 100644 --- a/packages/util/src/bytes.ts +++ b/packages/util/src/bytes.ts @@ -24,7 +24,7 @@ export const bytesToUnprefixedHex = _bytesToUnprefixedHex * @returns {Uint8Array} The converted bytes * @throws If the input is not a valid 0x-prefixed hex string */ -export const hexToBytes = (hex: string): Uint8Array => { +export const hexToBytes = (hex: PrefixedHexString): Uint8Array => { if (!hex.startsWith('0x')) throw EthereumJSErrorWithoutCode('input string must be 0x prefixed') return nobleH2B(padToEven(stripHexPrefix(hex))) } @@ -34,8 +34,13 @@ export const unprefixedHexToBytes = (hex: string): Uint8Array => { return nobleH2B(padToEven(hex)) } +/** + * Converts a {@link Uint8Array} to a {@link PrefixedHexString} + * @param {Uint8Array} bytes the bytes to convert + * @returns {PrefixedHexString} the hex string + * @dev Returns `0x` if provided an empty Uint8Array + */ export const bytesToHex = (bytes: Uint8Array): PrefixedHexString => { - if (bytes === undefined || bytes.length === 0) return '0x' const unprefixedHex = bytesToUnprefixedHex(bytes) return `0x${unprefixedHex}` } @@ -92,7 +97,7 @@ export const intToHex = (i: number): PrefixedHexString => { if (!Number.isSafeInteger(i) || i < 0) { throw EthereumJSErrorWithoutCode(`Received an invalid integer type: ${i}`) } - return ('0x' + i.toString(16)) as PrefixedHexString + return `0x${i.toString(16)}` } /** @@ -111,7 +116,7 @@ export const intToBytes = (i: number): Uint8Array => { * @returns {Uint8Array} */ export const bigIntToBytes = (num: bigint, littleEndian = false): Uint8Array => { - const bytes = toBytes(`0x${padToEven(num.toString(16))}`) + const bytes = hexToBytes(`0x${padToEven(num.toString(16))}`) return littleEndian ? bytes.reverse() : bytes } diff --git a/packages/util/src/index.ts b/packages/util/src/index.ts index 1f2337adda6..550eef2a430 100644 --- a/packages/util/src/index.ts +++ b/packages/util/src/index.ts @@ -51,6 +51,7 @@ export * from './types.ts' /** * Export ethjs-util methods */ +export * from './authorization.ts' export * from './binaryTree.ts' export * from './blobs.ts' export { diff --git a/packages/util/src/signature.ts b/packages/util/src/signature.ts index 25cc264400a..8b6eb9fe7ae 100644 --- a/packages/util/src/signature.ts +++ b/packages/util/src/signature.ts @@ -2,12 +2,13 @@ import { keccak256 } from 'ethereum-cryptography/keccak.js' import { secp256k1 } from 'ethereum-cryptography/secp256k1.js' import { + bigIntToBytes, bytesToBigInt, bytesToHex, bytesToInt, concatBytes, + hexToBytes, setLengthLeft, - toBytes, utf8ToBytes, } from './bytes.ts' import { @@ -77,7 +78,7 @@ export const toRPCSig = function ( // geth (and the RPC eth_sign method) uses the 65 byte format used by Bitcoin - return bytesToHex(concatBytes(setLengthLeft(r, 32), setLengthLeft(s, 32), toBytes(v))) + return bytesToHex(concatBytes(setLengthLeft(r, 32), setLengthLeft(s, 32), bigIntToBytes(v))) } /** @@ -117,7 +118,7 @@ export const fromRPCSig = function (sig: PrefixedHexString): { r: Uint8Array s: Uint8Array } { - const bytes: Uint8Array = toBytes(sig) + const bytes: Uint8Array = hexToBytes(sig) let r: Uint8Array let s: Uint8Array diff --git a/packages/util/src/types.ts b/packages/util/src/types.ts index 5af0c0088d6..474c043e911 100644 --- a/packages/util/src/types.ts +++ b/packages/util/src/types.ts @@ -127,3 +127,51 @@ export function toType( throw EthereumJSErrorWithoutCode('unknown outputType') } } + +/** + * EIP-7702 Authorization list types + */ +export type EOACode7702AuthorizationListItemUnsigned = { + chainId: PrefixedHexString + address: PrefixedHexString + nonce: PrefixedHexString +} + +export type EOACode7702AuthorizationListItem = { + yParity: PrefixedHexString + r: PrefixedHexString + s: PrefixedHexString +} & EOACode7702AuthorizationListItemUnsigned + +// Tuple of [chain_id, address, nonce, y_parity, r, s] +export type EOACode7702AuthorizationListBytesItem = [ + Uint8Array, + Uint8Array, + Uint8Array, + Uint8Array, + Uint8Array, + Uint8Array, +] +export type EOACode7702AuthorizationListBytes = EOACode7702AuthorizationListBytesItem[] +export type EOACode7702AuthorizationList = EOACode7702AuthorizationListItem[] + +export type EOACode7702AuthorizationListBytesItemUnsigned = [Uint8Array, Uint8Array, Uint8Array] + +export function isEOACode7702AuthorizationListBytes( + input: EOACode7702AuthorizationListBytes | EOACode7702AuthorizationList, +): input is EOACode7702AuthorizationListBytes { + if (input.length === 0) { + return true + } + const firstItem = input[0] + if (Array.isArray(firstItem)) { + return true + } + return false +} + +export function isEOACode7702AuthorizationList( + input: EOACode7702AuthorizationListBytes | EOACode7702AuthorizationList, +): input is EOACode7702AuthorizationList { + return !isEOACode7702AuthorizationListBytes(input) // This is exactly the same method, except the output is negated. +} diff --git a/packages/util/src/verkle.ts b/packages/util/src/verkle.ts index 7acb0b37792..3de4e9418f6 100644 --- a/packages/util/src/verkle.ts +++ b/packages/util/src/verkle.ts @@ -7,7 +7,6 @@ import { intToBytes, setLengthLeft, setLengthRight, - toBytes, } from './bytes.ts' import type { Account } from './account.ts' @@ -237,7 +236,7 @@ export const getVerkleTreeKeyForCodeChunk = async ( verkleCrypto: VerkleCrypto, ) => { const { treeIndex, subIndex } = getVerkleTreeIndicesForCodeChunk(chunkId) - return concatBytes(getVerkleStem(verkleCrypto, address, treeIndex), toBytes(subIndex)) + return concatBytes(getVerkleStem(verkleCrypto, address, treeIndex), intToBytes(subIndex)) } // This code was written by robots based on the reference implementation in EIP-6800 @@ -295,7 +294,7 @@ export const getVerkleTreeKeyForStorageSlot = async ( ) => { const { treeIndex, subIndex } = getVerkleTreeIndicesForStorageSlot(storageKey) - return concatBytes(getVerkleStem(verkleCrypto, address, treeIndex), toBytes(subIndex)) + return concatBytes(getVerkleStem(verkleCrypto, address, treeIndex), intToBytes(subIndex)) } /** diff --git a/packages/util/test/account.spec.ts b/packages/util/test/account.spec.ts index 79b01bcc9dd..4757413a231 100644 --- a/packages/util/test/account.spec.ts +++ b/packages/util/test/account.spec.ts @@ -9,6 +9,7 @@ import { accountBodyFromSlim, accountBodyToRLP, accountBodyToSlim, + bigIntToBytes, bigIntToUnpaddedBytes, bytesToBigInt, bytesToHex, @@ -33,7 +34,6 @@ import { privateToAddress, privateToPublic, publicToAddress, - toBytes, toChecksumAddress, utf8ToBytes, } from '../src/index.ts' @@ -488,7 +488,7 @@ describe('Utility Functions', () => { it('generateAddress', () => { const addr = generateAddress( utf8ToBytes('990ccf8a0de58091c028d6ff76bb235ee67c1c39'), - toBytes(14), + intToBytes(14), ) assert.equal( bytesToHex(addr), @@ -498,7 +498,10 @@ describe('Utility Functions', () => { }) it('generateAddress with hex prefix', () => { - const addr = generateAddress(toBytes('0x990ccf8a0de58091c028d6ff76bb235ee67c1c39'), toBytes(14)) + const addr = generateAddress( + hexToBytes('0x990ccf8a0de58091c028d6ff76bb235ee67c1c39'), + intToBytes(14), + ) assert.equal( bytesToHex(addr), '0xd658a4b8247c14868f3c512fa5cbb6e458e4a989', @@ -509,7 +512,10 @@ describe('Utility Functions', () => { // cspell:disable it('generateAddress wt.testh nonce 0 (special case)', () => { // cspell:enable - const addr = generateAddress(toBytes('0x990ccf8a0de58091c028d6ff76bb235ee67c1c39'), toBytes(0)) + const addr = generateAddress( + hexToBytes('0x990ccf8a0de58091c028d6ff76bb235ee67c1c39'), + intToBytes(0), + ) assert.equal( bytesToHex(addr), '0xbfa69ba91385206bfdd2d8b9c1a5d6c10097a85b', @@ -524,7 +530,7 @@ describe('Utility Functions', () => { function () { generateAddress( ('0x990ccf8a0de58091c028d6ff76bb235ee67c1c39') as Uint8Array, - toBytes(0), + intToBytes(0), ) }, undefined, @@ -535,7 +541,7 @@ describe('Utility Functions', () => { assert.throws( function () { generateAddress( - toBytes('0x990ccf8a0de58091c028d6ff76bb235ee67c1c39'), + hexToBytes('0x990ccf8a0de58091c028d6ff76bb235ee67c1c39'), (0) as Uint8Array, ) }, @@ -886,7 +892,7 @@ describe('createPartialAccount', () => { describe('createPartialAccountFromRLP', () => { it('should throw an error for invalid serialized account input (non-array)', () => { - const invalidSerialized = toBytes(1n) + const invalidSerialized = bigIntToBytes(1n) assert.throws( () => createPartialAccountFromRLP(invalidSerialized), /Invalid serialized account input/, @@ -897,12 +903,12 @@ describe('createPartialAccountFromRLP', () => { { description: 'should handle a mix of null and non-null values correctly', data: [ - [toBytes(1), toBytes(1)], // Nonce: 1 - [toBytes(0)], // Balance: null - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP - [toBytes(0)], // CodeHash: null - [toBytes(1), toBytes(10)], // CodeSize: 10 - [toBytes(0)], // Version: null + [intToBytes(1), intToBytes(1)], // Nonce: 1 + [intToBytes(0)], // Balance: null + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(0)], // CodeHash: null + [intToBytes(1), intToBytes(10)], // CodeSize: 10 + [intToBytes(0)], // Version: null ], shouldThrow: false, expected: new Account(BigInt(1), null, KECCAK256_RLP, null, 10, null), @@ -911,12 +917,12 @@ describe('createPartialAccountFromRLP', () => { { description: 'should throw when all fields are null', data: [ - [toBytes(0)], // Nonce: null - [toBytes(0)], // Balance: null - [toBytes(0)], // StorageRoot: null - [toBytes(0)], // CodeHash: null - [toBytes(0)], // CodeSize: null - [toBytes(0)], // Version: null + [intToBytes(0)], // Nonce: null + [intToBytes(0)], // Balance: null + [intToBytes(0)], // StorageRoot: null + [intToBytes(0)], // CodeHash: null + [intToBytes(0)], // CodeSize: null + [intToBytes(0)], // Version: null ], shouldThrow: true, expected: null, @@ -925,12 +931,12 @@ describe('createPartialAccountFromRLP', () => { { description: 'should handle all non-null fields correctly', data: [ - [toBytes(1), toBytes(2)], // Nonce: 2 - [toBytes(1), toBytes(1000)], // Balance: 1000 - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP - [toBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP - [toBytes(1), toBytes(50)], // CodeSize: 50 - [toBytes(1), toBytes(1)], // Version: 1 + [intToBytes(1), intToBytes(2)], // Nonce: 2 + [intToBytes(1), intToBytes(1000)], // Balance: 1000 + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP + [intToBytes(1), intToBytes(50)], // CodeSize: 50 + [intToBytes(1), intToBytes(1)], // Version: 1 ], shouldThrow: false, expected: new Account(BigInt(2), BigInt(1000), KECCAK256_RLP, KECCAK256_RLP, 50, 1), @@ -940,12 +946,12 @@ describe('createPartialAccountFromRLP', () => { description: 'should return partial account with non-null fields when isNotNullIndicator is 1', data: [ - [toBytes(1), toBytes(2)], // Nonce: 2 - [toBytes(1), toBytes(1000)], // Balance: 1000 - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP - [toBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP - [toBytes(1), toBytes(50)], // CodeSize: 50 - [toBytes(1), toBytes(1)], // Version: 1 + [intToBytes(1), intToBytes(2)], // Nonce: 2 + [intToBytes(1), intToBytes(1000)], // Balance: 1000 + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP + [intToBytes(1), intToBytes(50)], // CodeSize: 50 + [intToBytes(1), intToBytes(1)], // Version: 1 ], shouldThrow: false, expected: new Account(BigInt(2), BigInt(1000), KECCAK256_RLP, KECCAK256_RLP, 50, 1), @@ -954,12 +960,12 @@ describe('createPartialAccountFromRLP', () => { { description: 'should return a mix of null and non-null fields based on isNotNullIndicator', data: [ - [toBytes(1), toBytes(2)], // Nonce: 2 - [toBytes(0)], // Balance: null - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP - [toBytes(0)], // CodeHash: null - [toBytes(1), toBytes(50)], // CodeSize: 50 - [toBytes(0)], // Version: null + [intToBytes(1), intToBytes(2)], // Nonce: 2 + [intToBytes(0)], // Balance: null + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(0)], // CodeHash: null + [intToBytes(1), intToBytes(50)], // CodeSize: 50 + [intToBytes(0)], // Version: null ], shouldThrow: false, expected: new Account(BigInt(2), null, KECCAK256_RLP, null, 50, null), @@ -969,12 +975,12 @@ describe('createPartialAccountFromRLP', () => { description: 'should handle cases where some fields are non-null and others are null correctly', data: [ - [toBytes(1), toBytes(2)], // Nonce: 2 - [toBytes(0)], // Balance: null - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP - [toBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP - [toBytes(0)], // CodeSize: null - [toBytes(0)], // Version: null + [intToBytes(1), intToBytes(2)], // Nonce: 2 + [intToBytes(0)], // Balance: null + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP + [intToBytes(0)], // CodeSize: null + [intToBytes(0)], // Version: null ], shouldThrow: false, expected: new Account(BigInt(2), null, KECCAK256_RLP, KECCAK256_RLP, null, null), @@ -984,7 +990,7 @@ describe('createPartialAccountFromRLP', () => { description: 'should handle fields with empty arrays (isNullIndicator=0) correctly', data: [ [], // nonce -> empty array => null - [toBytes(1), toBytes(1000)], // balance: 1000 + [intToBytes(1), intToBytes(1000)], // balance: 1000 [], // storageRoot -> null [], // codeHash -> null [], // codeSize -> null @@ -999,84 +1005,84 @@ describe('createPartialAccountFromRLP', () => { data: [KECCAK256_RLP, [], [], [], [], []], shouldThrow: true, expected: null, - errorRegex: /Invalid partial nonce encoding/, + errorRegex: /Invalid partial encoding. Each item must be an array/, }, { description: 'should throw: invalid partial balance encoding', data: [[], KECCAK256_RLP, [], [], [], []], shouldThrow: true, expected: null, - errorRegex: /Invalid partial balance encoding/, + errorRegex: /Invalid partial encoding. Each item must be an array/, }, { description: 'should throw: invalid partial storageRoot encoding', data: [[], [], KECCAK256_RLP, [], [], []], shouldThrow: true, expected: null, - errorRegex: /Invalid partial storageRoot encoding/, + errorRegex: /Invalid partial encoding. Each item must be an array/, }, { description: 'should throw: invalid partial codeHash encoding', data: [[], [], [], KECCAK256_RLP, [], []], shouldThrow: true, expected: null, - errorRegex: /Invalid partial codeHash encoding/, + errorRegex: /Invalid partial encoding. Each item must be an array/, }, { description: 'should throw: invalid partial codeSize encoding', data: [[], [], [], [], KECCAK256_RLP, []], shouldThrow: true, expected: null, - errorRegex: /Invalid partial codeSize encoding/, + errorRegex: /Invalid partial encoding. Each item must be an array/, }, { description: 'should throw: invalid partial version encoding', data: [[], [], [], [], [], KECCAK256_RLP], shouldThrow: true, expected: null, - errorRegex: /Invalid partial version encoding/, + errorRegex: /Invalid partial encoding. Each item must be an array/, }, { description: 'should throw: invalid isNullIndicator=2 for nonce', - data: [[toBytes(2)], [], [], [], [], []], + data: [[intToBytes(2)], [], [], [], [], []], shouldThrow: true, expected: null, - errorRegex: /Invalid isNullIndicator=2 for nonce/, + errorRegex: /Invalid isNullIndicator=2/, }, { description: 'should throw: invalid isNullIndicator=2 for balance', - data: [[], [toBytes(2)], [], [], [], []], + data: [[], [intToBytes(2)], [], [], [], []], shouldThrow: true, expected: null, - errorRegex: /Invalid isNullIndicator=2 for balance/, + errorRegex: /Invalid isNullIndicator=2/, }, { description: 'should throw: invalid isNullIndicator=2 for storageRoot', - data: [[], [], [toBytes(2)], [], [], []], + data: [[], [], [intToBytes(2)], [], [], []], shouldThrow: true, expected: null, - errorRegex: /Invalid isNullIndicator=2 for storageRoot/, + errorRegex: /Invalid isNullIndicator=2/, }, { description: 'should throw: invalid isNullIndicator=2 for codeHash', - data: [[], [], [], [toBytes(2)], [], []], + data: [[], [], [], [intToBytes(2)], [], []], shouldThrow: true, expected: null, - errorRegex: /Invalid isNullIndicator=2 for codeHash/, + errorRegex: /Invalid isNullIndicator=2/, }, { description: 'should throw: invalid isNullIndicator=2 for codeSize', - data: [[], [], [], [], [toBytes(2)], []], + data: [[], [], [], [], [intToBytes(2)], []], shouldThrow: true, expected: null, - errorRegex: /Invalid isNullIndicator=2 for codeSize/, + errorRegex: /Invalid isNullIndicator=2/, }, { description: 'should throw: invalid isNullIndicator=2 for version', - data: [[], [], [], [], [], [toBytes(2)]], + data: [[], [], [], [], [], [intToBytes(2)]], shouldThrow: true, expected: null, - errorRegex: /Invalid isNullIndicator=2 for version/, + errorRegex: /Invalid isNullIndicator=2/, }, ] @@ -1111,23 +1117,23 @@ describe('serializeWithPartialInfo', () => { description: 'should serialize all fields as non-null (isNotNullIndicator=1)', account: new Account(BigInt(2), Units.ether(1), KECCAK256_RLP, KECCAK256_RLP, 50, 1), expectedDecoded: [ - [toBytes(1), bigIntToUnpaddedBytes(BigInt(2))], // Nonce: 2 - [toBytes(1), bigIntToUnpaddedBytes(Units.ether(1))], // Balance: 1000 - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP - [toBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP - [toBytes(1), intToUnpaddedBytes(50)], // CodeSize: 50 - [toBytes(1), intToUnpaddedBytes(1)], // Version: 1 + [intToBytes(1), bigIntToUnpaddedBytes(BigInt(2))], // Nonce: 2 + [intToBytes(1), bigIntToUnpaddedBytes(Units.ether(1))], // Balance: 1000 + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP + [intToBytes(1), intToUnpaddedBytes(50)], // CodeSize: 50 + [intToBytes(1), intToUnpaddedBytes(1)], // Version: 1 ], }, { description: 'should serialize mixed null and non-null fields', account: new Account(BigInt(2), null, KECCAK256_RLP, null, 50, null), expectedDecoded: [ - [toBytes(1), bigIntToUnpaddedBytes(BigInt(2))], // Nonce: 2 + [intToBytes(1), bigIntToUnpaddedBytes(BigInt(2))], // Nonce: 2 [new Uint8Array()], // Balance: null - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP [new Uint8Array()], // CodeHash: null - [toBytes(1), intToUnpaddedBytes(50)], // CodeSize: 50 + [intToBytes(1), intToUnpaddedBytes(50)], // CodeSize: 50 [new Uint8Array()], // Version: null ], }, @@ -1136,24 +1142,24 @@ describe('serializeWithPartialInfo', () => { 'should correctly handle serialization of null hash for storageRoot and codeHash', account: new Account(BigInt(2), Units.ether(1), KECCAK256_RLP, KECCAK256_RLP, 50, 1), expectedDecoded: [ - [toBytes(1), bigIntToUnpaddedBytes(BigInt(2))], // Nonce: 2 - [toBytes(1), bigIntToUnpaddedBytes(Units.ether(1))], // Balance: 1000 - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP - [toBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP - [toBytes(1), intToUnpaddedBytes(50)], // CodeSize: 50 - [toBytes(1), intToUnpaddedBytes(1)], // Version: 1 + [intToBytes(1), bigIntToUnpaddedBytes(BigInt(2))], // Nonce: 2 + [intToBytes(1), bigIntToUnpaddedBytes(Units.ether(1))], // Balance: 1000 + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(1), KECCAK256_RLP], // CodeHash: KECCAK256_RLP + [intToBytes(1), intToUnpaddedBytes(50)], // CodeSize: 50 + [intToBytes(1), intToUnpaddedBytes(1)], // Version: 1 ], }, { description: 'should correctly serialize when only some fields are provided', account: new Account(BigInt(123), null, KECCAK256_RLP, null, null, 42), expectedDecoded: [ - [toBytes(1), bigIntToUnpaddedBytes(BigInt(123))], // Nonce: 123 + [intToBytes(1), bigIntToUnpaddedBytes(BigInt(123))], // Nonce: 123 [new Uint8Array()], // Balance: null - [toBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP + [intToBytes(1), KECCAK256_RLP], // StorageRoot: KECCAK256_RLP [new Uint8Array()], // CodeHash: null [new Uint8Array()], // CodeSize: null - [toBytes(1), intToUnpaddedBytes(42)], // Version: 42 + [intToBytes(1), intToUnpaddedBytes(42)], // Version: 42 ], }, ] diff --git a/packages/util/test/address.spec.ts b/packages/util/test/address.spec.ts index 37d9490303b..bc48d9e01a0 100644 --- a/packages/util/test/address.spec.ts +++ b/packages/util/test/address.spec.ts @@ -11,7 +11,6 @@ import { createZeroAddress, equalsBytes, hexToBytes, - toBytes, } from '../src/index.ts' import { eip1404ExamplesData } from './testdata/eip1014Examples.ts' @@ -26,13 +25,13 @@ describe('Address', () => { assert.throws(() => createAddressFromString(str)) const shortStr = '0x2f015c60e0be116b1f0cd534704db9c92118fb' assert.throws(() => createAddressFromString(shortStr)) - const buf = toBytes(str) + const buf = hexToBytes(str) assert.throws(() => new Address(buf)) }) it('should generate a zero address', () => { const addr = createZeroAddress() - assert.deepEqual(addr.bytes, toBytes(ZERO_ADDR_S)) + assert.deepEqual(addr.bytes, hexToBytes(ZERO_ADDR_S)) assert.equal(addr.toString(), ZERO_ADDR_S) }) diff --git a/packages/tx/test/util/authorization.spec.ts b/packages/util/test/authorization.spec.ts similarity index 52% rename from packages/tx/test/util/authorization.spec.ts rename to packages/util/test/authorization.spec.ts index d0923f6d098..c5695aa60a8 100644 --- a/packages/tx/test/util/authorization.spec.ts +++ b/packages/util/test/authorization.spec.ts @@ -1,28 +1,25 @@ import { RLP } from '@ethereumjs/rlp' -import { - Address, - type PrefixedHexString, - concatBytes, - equalsBytes, - hexToBytes, -} from '@ethereumjs/util' import { keccak256 } from 'ethereum-cryptography/keccak' import { assert, describe, it } from 'vitest' -import { AUTHORITY_SIGNING_MAGIC } from '../../src/constants.ts' +import { Address } from '../src/address.ts' import { - type AuthorizationListBytesItemUnsigned, - type AuthorizationListItem, - type AuthorizationListItemUnsigned, - authorizationHashedMessageToSign, - authorizationListBytesItemToJSON, - authorizationListJSONItemToBytes, - authorizationMessageToSign, - recoverAuthority, - signAuthorization, -} from '../../src/index.ts' + EOA_CODE_7702_AUTHORITY_SIGNING_MAGIC, + eoaCode7702AuthorizationHashedMessageToSign, + eoaCode7702AuthorizationListBytesItemToJSON, + eoaCode7702AuthorizationListJSONItemToBytes, + eoaCode7702AuthorizationMessageToSign, + eoaCode7702RecoverAuthority, + eoaCode7702SignAuthorization, +} from '../src/authorization.ts' +import { concatBytes, equalsBytes, hexToBytes } from '../src/bytes.ts' +import type { + EOACode7702AuthorizationListBytesItemUnsigned, + EOACode7702AuthorizationListItem, + EOACode7702AuthorizationListItemUnsigned, +} from '../src/types.ts' // Taken from execution-spec-tests (tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_address_from_set_code) -const SAMPLE_AUTH = { +const SAMPLE_AUTH: EOACode7702AuthorizationListItem = { chainId: '0x', address: '0x0000000000000000000000000000000000001000', nonce: '0x', @@ -40,40 +37,47 @@ const PRIVATE_KEY = hexToBytes('0x45A915E4D060149EB4365960E6A7A45F33439309306111 const EXPECTED_SIGNER = new Address(hexToBytes('0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b')) describe('Authorization lists', () => { - const item = authorizationListJSONItemToBytes(SAMPLE_AUTH as AuthorizationListItem) + const item = eoaCode7702AuthorizationListJSONItemToBytes(SAMPLE_AUTH) const [chainId, address, nonce] = item - const unsignedBytesItem: AuthorizationListBytesItemUnsigned = [chainId, address, nonce] - const unsignedJSONItem: AuthorizationListItemUnsigned = { - chainId: SAMPLE_AUTH.chainId as PrefixedHexString, - address: SAMPLE_AUTH.address as PrefixedHexString, - nonce: SAMPLE_AUTH.nonce as PrefixedHexString, + const unsignedBytesItem: EOACode7702AuthorizationListBytesItemUnsigned = [chainId, address, nonce] + const unsignedJSONItem: EOACode7702AuthorizationListItemUnsigned = { + chainId: SAMPLE_AUTH.chainId, + address: SAMPLE_AUTH.address, + nonce: SAMPLE_AUTH.nonce, } it('authorizationMessageToSign() / authorizationHashedMessageToSign()', () => { - const expected = concatBytes(AUTHORITY_SIGNING_MAGIC, RLP.encode([chainId, address, nonce])) + const expected = concatBytes( + EOA_CODE_7702_AUTHORITY_SIGNING_MAGIC, + RLP.encode([chainId, address, nonce]), + ) assert.isTrue( - equalsBytes(authorizationMessageToSign(unsignedBytesItem), expected), + equalsBytes(eoaCode7702AuthorizationMessageToSign(unsignedBytesItem), expected), 'msg to sign ok: bytes', ) assert.isTrue( - equalsBytes(authorizationMessageToSign(unsignedJSONItem), expected), + equalsBytes(eoaCode7702AuthorizationMessageToSign(unsignedJSONItem), expected), 'msg to sign ok: json', ) const expectedHash = keccak256(expected) assert.isTrue( - equalsBytes(authorizationHashedMessageToSign(unsignedBytesItem), expectedHash), + equalsBytes(eoaCode7702AuthorizationHashedMessageToSign(unsignedBytesItem), expectedHash), 'hashed msg to sign ok: bytes', ) assert.isTrue( - equalsBytes(authorizationHashedMessageToSign(unsignedJSONItem), expectedHash), + equalsBytes(eoaCode7702AuthorizationHashedMessageToSign(unsignedJSONItem), expectedHash), 'hashed msg to sign ok: json', ) assert.throws( () => { - authorizationMessageToSign([new Uint8Array(), new Uint8Array(19), new Uint8Array()]) + eoaCode7702AuthorizationMessageToSign([ + new Uint8Array(), + new Uint8Array(19), + new Uint8Array(), + ]) }, undefined, undefined, @@ -82,8 +86,8 @@ describe('Authorization lists', () => { }) it('sign() / recoverAuthority()', () => { - const signedFromBytes = signAuthorization(unsignedBytesItem, PRIVATE_KEY) - const signedFromJSON = signAuthorization(unsignedJSONItem, PRIVATE_KEY) + const signedFromBytes = eoaCode7702SignAuthorization(unsignedBytesItem, PRIVATE_KEY) + const signedFromJSON = eoaCode7702SignAuthorization(unsignedJSONItem, PRIVATE_KEY) const signedFromBytes_RLP = RLP.encode(signedFromBytes) const signedFromJSON_RLP = RLP.encode(signedFromJSON) @@ -92,13 +96,13 @@ describe('Authorization lists', () => { assert.isTrue(equalsBytes(signedFromJSON_RLP, EXPECTED_RLP_BYTES), 'signed ok: json') assert.deepEqual( - authorizationListBytesItemToJSON(signedFromBytes), + eoaCode7702AuthorizationListBytesItemToJSON(signedFromBytes), SAMPLE_AUTH, 'json conversion matches expected json', ) - const recoveredBytesAddress = recoverAuthority(signedFromBytes) - const recoveredJSONAddress = recoverAuthority(SAMPLE_AUTH as AuthorizationListItem) + const recoveredBytesAddress = eoaCode7702RecoverAuthority(signedFromBytes) + const recoveredJSONAddress = eoaCode7702RecoverAuthority(SAMPLE_AUTH) assert.isTrue(EXPECTED_SIGNER.equals(recoveredBytesAddress), 'bytes: recovered correct signer') assert.isTrue(EXPECTED_SIGNER.equals(recoveredJSONAddress), 'json: recovered correct signer') diff --git a/packages/util/test/bytes.spec.ts b/packages/util/test/bytes.spec.ts index db50cde211e..521551b6b41 100644 --- a/packages/util/test/bytes.spec.ts +++ b/packages/util/test/bytes.spec.ts @@ -58,9 +58,9 @@ describe('is zero address', () => { describe('unpadBytes', () => { it('should unpad a Uint8Array', () => { - const bytes = toBytes('0x0000000006600') + const bytes = hexToBytes('0x0000000006600') const r = unpadBytes(bytes) - assert.deepEqual(r, toBytes('0x6600')) + assert.deepEqual(r, hexToBytes('0x6600')) }) it('should throw if input is not a Uint8Array', () => { assert.throws(function () { @@ -251,8 +251,10 @@ describe('toBytes', () => { }) it('should fail with non 0x-prefixed hex strings', () => { - assert.throws(() => toBytes('11' as any), '11') - assert.throws(() => toBytes('' as any)) + // @ts-expect-error -- Testing wrong input + assert.throws(() => toBytes('11'), '11') + // @ts-expect-error -- Testing wrong input + assert.throws(() => toBytes('')) assert.throws(() => toBytes('0xR'), '0xR') }) @@ -308,19 +310,19 @@ describe('intToBytes and intToHex', () => { describe('validateNoLeadingZeroes', () => { const noLeadingZeroes = { - a: toBytes('0x123'), + a: hexToBytes('0x123'), } const noLeadingZeroBytes = { - a: toBytes('0x01'), + a: hexToBytes('0x01'), } const leadingZeroBytes = { - a: toBytes('0x001'), + a: hexToBytes('0x001'), } const onlyZeroes = { - a: toBytes('0x0'), + a: hexToBytes('0x0'), } const emptyBuffer = { - a: toBytes('0x'), + a: hexToBytes('0x'), } const undefinedValue = { @@ -364,7 +366,7 @@ describe('validateNoLeadingZeroes', () => { describe('bytesToBigInt', () => { it('should pass on correct input', () => { - const buf = toBytes('0x123') + const buf = hexToBytes('0x123') assert.equal(BigInt(0x123), bytesToBigInt(buf)) }) }) @@ -372,7 +374,7 @@ describe('bytesToBigInt', () => { describe('bigIntToBytes', () => { it('should pass on correct input', () => { const num = BigInt(0x123) - assert.deepEqual(toBytes('0x123'), bigIntToBytes(num)) + assert.deepEqual(hexToBytes('0x123'), bigIntToBytes(num)) }) }) diff --git a/packages/util/test/types.spec.ts b/packages/util/test/types.spec.ts index b2c5b7423ba..5feaaefe492 100644 --- a/packages/util/test/types.spec.ts +++ b/packages/util/test/types.spec.ts @@ -6,9 +6,9 @@ import { bigIntToHex, bytesToBigInt, bytesToHex, + hexToBytes, intToBytes, intToHex, - toBytes, toType, } from '../src/index.ts' @@ -91,7 +91,7 @@ describe('toType', () => { assert.strictEqual(bigIntToHex(result), num) result = toType(num, TypeOutput.Uint8Array) - assert.deepEqual(result, toBytes(num)) + assert.deepEqual(result, hexToBytes(num)) assert.throws(() => { //@ts-expect-error -- Testing invalid input diff --git a/packages/util/typedoc.cjs b/packages/util/typedoc.mjs similarity index 53% rename from packages/util/typedoc.cjs rename to packages/util/typedoc.mjs index 0c5a50bf952..766425d2740 100644 --- a/packages/util/typedoc.cjs +++ b/packages/util/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/*.ts'], diff --git a/packages/verkle/README.md b/packages/verkle/README.md index a7472b380cd..1e490db988e 100644 --- a/packages/verkle/README.md +++ b/packages/verkle/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/verkle +# @ethereumjs/verkle `v10` [![NPM Package][verkle-npm-badge]][verkle-npm-link] [![GitHub Issues][verkle-issues-badge]][verkle-issues-link] @@ -13,6 +13,18 @@ This package is currently in early alpha and is a work in progress. It is not intended for use in production environments, but rather for research and development purposes. Any help in improving the package is very much welcome. +## Table of Contents + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Proofs](#proofs) +- [Browser](#browser) +- [API](#api) +- [Debugging](#debugging) +- [References](#references) +- [EthereumJS](#ethereumjs) +- [License](#license) + ## Installation To obtain the latest version, simply require the project using `npm`: @@ -21,7 +33,7 @@ To obtain the latest version, simply require the project using `npm`: npm install @ethereumjs/verkle ``` -## Usage +## Getting Started ### Initialization diff --git a/packages/verkle/docs/README.md b/packages/verkle/docs/README.md index d6f44f87655..641f5080830 100644 --- a/packages/verkle/docs/README.md +++ b/packages/verkle/docs/README.md @@ -1,372 +1,52 @@ -@ethereumjs/verkle +**@ethereumjs/verkle** -# @ethereumjs/verkle - -## Table of contents - -### Enumerations +*** -- [VerkleNodeType](enums/VerkleNodeType.md) +# @ethereumjs/verkle -### Classes +## Classes - [BaseVerkleNode](classes/BaseVerkleNode.md) - [CheckpointDB](classes/CheckpointDB.md) -- [InternalNode](classes/InternalNode.md) -- [LeafNode](classes/LeafNode.md) -- [PrioritizedTaskExecutor](classes/PrioritizedTaskExecutor.md) +- [InternalVerkleNode](classes/InternalVerkleNode.md) +- [LeafVerkleNode](classes/LeafVerkleNode.md) - [VerkleTree](classes/VerkleTree.md) -- [WalkController](classes/WalkController.md) -### Interfaces +## Interfaces - [CheckpointDBOpts](interfaces/CheckpointDBOpts.md) -- [Fr](interfaces/Fr.md) -- [Point](interfaces/Point.md) +- [ChildNode](interfaces/ChildNode.md) - [TypedVerkleNode](interfaces/TypedVerkleNode.md) - [VerkleNodeInterface](interfaces/VerkleNodeInterface.md) - [VerkleNodeOptions](interfaces/VerkleNodeOptions.md) - [VerkleTreeOpts](interfaces/VerkleTreeOpts.md) -### Type Aliases - -- [Checkpoint](README.md#checkpoint) -- [FoundNodeFunction](README.md#foundnodefunction) -- [Proof](README.md#proof) -- [VerkleNode](README.md#verklenode) -- [VerkleTreeOptsWithDefaults](README.md#verkletreeoptswithdefaults) - -### Variables - -- [NODE\_WIDTH](README.md#node_width) -- [POINT\_IDENTITY](README.md#point_identity) -- [ROOT\_DB\_KEY](README.md#root_db_key) - -### Functions - -- [decodeNode](README.md#decodenode) -- [decodeRawNode](README.md#decoderawnode) -- [getKey](README.md#getkey) -- [getStem](README.md#getstem) -- [isRawNode](README.md#israwnode) -- [matchingBytesLength](README.md#matchingbyteslength) -- [pedersenHash](README.md#pedersenhash) -- [verifyProof](README.md#verifyproof) -- [verifyUpdate](README.md#verifyupdate) - ## Type Aliases -### Checkpoint - -Ƭ **Checkpoint**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `keyValueMap` | `Map`<`string`, `Uint8Array` \| `undefined`\> | -| `root` | `Uint8Array` | - -#### Defined in - -[types.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L104) - -___ - -### FoundNodeFunction - -Ƭ **FoundNodeFunction**: (`nodeRef`: `Uint8Array`, `node`: [`VerkleNode`](README.md#verklenode) \| ``null``, `key`: `Uint8Array`, `walkController`: [`WalkController`](classes/WalkController.md)) => `void` - -#### Type declaration - -▸ (`nodeRef`, `node`, `key`, `walkController`): `void` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `nodeRef` | `Uint8Array` | -| `node` | [`VerkleNode`](README.md#verklenode) \| ``null`` | -| `key` | `Uint8Array` | -| `walkController` | [`WalkController`](classes/WalkController.md) | - -##### Returns - -`void` - -#### Defined in - -[types.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L111) - -___ - -### Proof - -Ƭ **Proof**: `Uint8Array`[] - -#### Defined in - -[types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L61) - -___ - -### VerkleNode - -Ƭ **VerkleNode**: [`TypedVerkleNode`](interfaces/TypedVerkleNode.md)[[`VerkleNodeType`](enums/VerkleNodeType.md)] - -#### Defined in - -[node/types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L15) - -___ - -### VerkleTreeOptsWithDefaults - -Ƭ **VerkleTreeOptsWithDefaults**: [`VerkleTreeOpts`](interfaces/VerkleTreeOpts.md) & { `cacheSize`: `number` ; `useRootPersistence`: `boolean` } - -#### Defined in - -[types.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L87) +- [Checkpoint](type-aliases/Checkpoint.md) +- [Fr](type-aliases/Fr.md) +- [LeafVerkleNodeValue](type-aliases/LeafVerkleNodeValue.md) +- [Proof](type-aliases/Proof.md) +- [VerkleNode](type-aliases/VerkleNode.md) +- [VerkleNodeType](type-aliases/VerkleNodeType.md) ## Variables -### NODE\_WIDTH - -• `Const` **NODE\_WIDTH**: ``256`` - -#### Defined in - -[node/types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L49) - -___ - -### POINT\_IDENTITY - -• `Const` **POINT\_IDENTITY**: [`Point`](interfaces/Point.md) - -#### Defined in - -[util/crypto.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/crypto.ts#L81) - -___ - -### ROOT\_DB\_KEY - -• `Const` **ROOT\_DB\_KEY**: `Uint8Array` - -#### Defined in - -[types.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L118) +- [LeafVerkleNodeValue](variables/LeafVerkleNodeValue.md) +- [NODE\_WIDTH](variables/NODE_WIDTH.md) +- [ROOT\_DB\_KEY](variables/ROOT_DB_KEY.md) +- [VerkleNodeType](variables/VerkleNodeType.md) ## Functions -### decodeNode - -▸ **decodeNode**(`raw`): [`VerkleNode`](README.md#verklenode) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `raw` | `Uint8Array` | - -#### Returns - -[`VerkleNode`](README.md#verklenode) - -#### Defined in - -[node/util.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L20) - -___ - -### decodeRawNode - -▸ **decodeRawNode**(`raw`): [`VerkleNode`](README.md#verklenode) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `raw` | `Uint8Array`[] | - -#### Returns - -[`VerkleNode`](README.md#verklenode) - -#### Defined in - -[node/util.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L7) - -___ - -### getKey - -▸ **getKey**(`stem`, `subIndex`): `Uint8Array` - -**`Dev`** - -Returns the tree key for a given verkle tree stem, and sub index. - -**`Dev`** - -Assumes that the verkle node width = 256 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `stem` | `Uint8Array` | The 31-bytes verkle tree stem as a Uint8Array. | -| `subIndex` | `Uint8Array` | The sub index of the tree to generate the key for as a Uint8Array. | - -#### Returns - -`Uint8Array` - -The tree key as a Uint8Array. - -#### Defined in - -[util/crypto.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/crypto.ts#L67) - -___ - -### getStem - -▸ **getStem**(`address`, `treeIndex?`): `Uint8Array` - -**`Dev`** - -Returns the 31-bytes verkle tree stem for a given address and tree index. - -**`Dev`** - -Assumes that the verkle node width = 256 - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `address` | `Address` | `undefined` | The address to generate the tree key for. | -| `treeIndex` | `number` \| `bigint` | `0` | The index of the tree to generate the key for. Defaults to 0. | - -#### Returns - -`Uint8Array` - -The 31-bytes verkle tree stem as a Uint8Array. - -#### Defined in - -[util/crypto.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/crypto.ts#L43) - -___ - -### isRawNode - -▸ **isRawNode**(`node`): node is Uint8Array[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `node` | `Uint8Array` \| `Uint8Array`[] | - -#### Returns - -node is Uint8Array[] - -#### Defined in - -[node/util.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L28) - -___ - -### matchingBytesLength - -▸ **matchingBytesLength**(`bytes1`, `bytes2`): `number` - -Compares two byte arrays and returns the count of consecutively matching items from the start. - -**`Function`** - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `bytes1` | `Uint8Array` | The first Uint8Array to compare. | -| `bytes2` | `Uint8Array` | The second Uint8Array to compare. | - -#### Returns - -`number` - -The count of consecutively matching items from the start. - -#### Defined in - -[util/bytes.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/bytes.ts#L9) - -___ - -### pedersenHash - -▸ **pedersenHash**(`input`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `input` | `Uint8Array` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[util/crypto.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/crypto.ts#L14) - -___ - -### verifyProof - -▸ **verifyProof**(`root`, `proof`, `keyValues`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | -| `proof` | `Uint8Array` | -| `keyValues` | `Map`<`any`, `any`\> | - -#### Returns - -`Uint8Array` - -#### Defined in - -[util/crypto.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/crypto.ts#L72) - -___ - -### verifyUpdate - -▸ **verifyUpdate**(`root`, `proof`, `keyValues`): `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | -| `proof` | `Uint8Array` | -| `keyValues` | `Map`<`any`, `any`\> | - -#### Returns - -`Uint8Array` - -#### Defined in - -[util/crypto.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/crypto.ts#L28) +- [createCValues](functions/createCValues.md) +- [createDefaultLeafVerkleValues](functions/createDefaultLeafVerkleValues.md) +- [createVerkleTree](functions/createVerkleTree.md) +- [createZeroesLeafValue](functions/createZeroesLeafValue.md) +- [decodeRawVerkleNode](functions/decodeRawVerkleNode.md) +- [decodeVerkleNode](functions/decodeVerkleNode.md) +- [dumpLeafValues](functions/dumpLeafValues.md) +- [dumpNodeHashes](functions/dumpNodeHashes.md) +- [isInternalVerkleNode](functions/isInternalVerkleNode.md) +- [isLeafVerkleNode](functions/isLeafVerkleNode.md) +- [isRawVerkleNode](functions/isRawVerkleNode.md) diff --git a/packages/verkle/docs/classes/BaseVerkleNode.md b/packages/verkle/docs/classes/BaseVerkleNode.md index 32d2438ad0d..de7bcf98ec0 100644 --- a/packages/verkle/docs/classes/BaseVerkleNode.md +++ b/packages/verkle/docs/classes/BaseVerkleNode.md @@ -1,109 +1,61 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + [@ethereumjs/verkle](../README.md) / BaseVerkleNode -# Class: BaseVerkleNode +# Class: `abstract` BaseVerkleNode\ -## Type parameters +Defined in: [node/baseVerkleNode.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L7) -| Name | Type | -| :------ | :------ | -| `T` | extends [`VerkleNodeType`](../enums/VerkleNodeType.md) | +## Extended by -## Hierarchy +- [`InternalVerkleNode`](InternalVerkleNode.md) +- [`LeafVerkleNode`](LeafVerkleNode.md) -- **`BaseVerkleNode`** +## Type Parameters - ↳ [`InternalNode`](InternalNode.md) +### T - ↳ [`LeafNode`](LeafNode.md) +`T` *extends* [`VerkleNodeType`](../type-aliases/VerkleNodeType.md) ## Implements - [`VerkleNodeInterface`](../interfaces/VerkleNodeInterface.md) -## Table of contents - -### Constructors - -- [constructor](BaseVerkleNode.md#constructor) - -### Properties - -- [commitment](BaseVerkleNode.md#commitment) -- [depth](BaseVerkleNode.md#depth) - -### Methods - -- [commit](BaseVerkleNode.md#commit) -- [hash](BaseVerkleNode.md#hash) -- [insert](BaseVerkleNode.md#insert) -- [raw](BaseVerkleNode.md#raw) -- [serialize](BaseVerkleNode.md#serialize) - ## Constructors -### constructor +### Constructor -• **new BaseVerkleNode**<`T`\>(`options`) +> **new BaseVerkleNode**\<`T`\>(`options`): `BaseVerkleNode`\<`T`\> -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`VerkleNodeType`](../enums/VerkleNodeType.md) | +Defined in: [node/baseVerkleNode.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L10) #### Parameters -| Name | Type | -| :------ | :------ | -| `options` | [`VerkleNodeOptions`](../interfaces/VerkleNodeOptions.md)[`T`] | +##### options + +[`VerkleNodeOptions`](../interfaces/VerkleNodeOptions.md)\[`T`\] -#### Defined in +#### Returns -[node/baseVerkleNode.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L11) +`BaseVerkleNode`\<`T`\> ## Properties ### commitment -• **commitment**: [`Point`](../interfaces/Point.md) - -#### Defined in - -[node/baseVerkleNode.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L8) - -___ - -### depth - -• **depth**: `number` +> **commitment**: `Uint8Array` -#### Defined in - -[node/baseVerkleNode.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L9) +Defined in: [node/baseVerkleNode.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L8) ## Methods -### commit - -▸ `Abstract` **commit**(): [`Point`](../interfaces/Point.md) +### hash() -#### Returns +> **hash**(): `Uint8Array` -[`Point`](../interfaces/Point.md) - -#### Implementation of - -[VerkleNodeInterface](../interfaces/VerkleNodeInterface.md).[commit](../interfaces/VerkleNodeInterface.md#commit) - -#### Defined in - -[node/baseVerkleNode.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L16) - -___ - -### hash - -▸ **hash**(): `Uint8Array` +Defined in: [node/baseVerkleNode.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L16) #### Returns @@ -111,53 +63,27 @@ ___ #### Implementation of -[VerkleNodeInterface](../interfaces/VerkleNodeInterface.md).[hash](../interfaces/VerkleNodeInterface.md#hash) +[`VerkleNodeInterface`](../interfaces/VerkleNodeInterface.md).[`hash`](../interfaces/VerkleNodeInterface.md#hash) -#### Defined in +*** -[node/baseVerkleNode.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L19) +### raw() -___ +> `abstract` **raw**(): `Uint8Array`\<`ArrayBufferLike`\>[] -### insert - -▸ `Abstract` **insert**(`key`, `value`, `nodeResolverFn`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | -| `value` | `Uint8Array` | -| `nodeResolverFn` | () => `void` | +Defined in: [node/baseVerkleNode.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L21) #### Returns -`void` - -#### Defined in +`Uint8Array`\<`ArrayBufferLike`\>[] -[node/baseVerkleNode.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L23) +*** -___ +### serialize() -### raw +> **serialize**(): `Uint8Array` -▸ `Abstract` **raw**(): `Uint8Array`[] - -#### Returns - -`Uint8Array`[] - -#### Defined in - -[node/baseVerkleNode.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L25) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` +Defined in: [node/baseVerkleNode.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L26) #### Returns @@ -167,8 +93,4 @@ the RLP serialized node #### Implementation of -[VerkleNodeInterface](../interfaces/VerkleNodeInterface.md).[serialize](../interfaces/VerkleNodeInterface.md#serialize) - -#### Defined in - -[node/baseVerkleNode.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L30) +[`VerkleNodeInterface`](../interfaces/VerkleNodeInterface.md).[`serialize`](../interfaces/VerkleNodeInterface.md#serialize) diff --git a/packages/verkle/docs/classes/CheckpointDB.md b/packages/verkle/docs/classes/CheckpointDB.md index 76bf691d31e..dbc486a7872 100644 --- a/packages/verkle/docs/classes/CheckpointDB.md +++ b/packages/verkle/docs/classes/CheckpointDB.md @@ -1,7 +1,13 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + [@ethereumjs/verkle](../README.md) / CheckpointDB # Class: CheckpointDB +Defined in: [db/checkpoint.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L11) + DB is a thin wrapper around the underlying levelup db, which validates inputs and sets encoding type. @@ -9,226 +15,203 @@ which validates inputs and sets encoding type. - `DB` -## Table of contents +## Constructors -### Constructors +### Constructor -- [constructor](CheckpointDB.md#constructor) +> **new CheckpointDB**(`opts`): `CheckpointDB` -### Properties +Defined in: [db/checkpoint.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L43) -- [\_stats](CheckpointDB.md#_stats) -- [cacheSize](CheckpointDB.md#cachesize) -- [checkpoints](CheckpointDB.md#checkpoints) -- [db](CheckpointDB.md#db) +Initialize a DB instance. -### Methods +#### Parameters -- [batch](CheckpointDB.md#batch) -- [checkpoint](CheckpointDB.md#checkpoint) -- [commit](CheckpointDB.md#commit) -- [del](CheckpointDB.md#del) -- [get](CheckpointDB.md#get) -- [hasCheckpoints](CheckpointDB.md#hascheckpoints) -- [open](CheckpointDB.md#open) -- [put](CheckpointDB.md#put) -- [revert](CheckpointDB.md#revert) -- [setCheckpoints](CheckpointDB.md#setcheckpoints) -- [shallowCopy](CheckpointDB.md#shallowcopy) -- [stats](CheckpointDB.md#stats) +##### opts -## Constructors +[`CheckpointDBOpts`](../interfaces/CheckpointDBOpts.md) -### constructor +#### Returns -• **new CheckpointDB**(`opts`) +`CheckpointDB` -Initialize a DB instance. +## Properties -#### Parameters +### \_stats -| Name | Type | -| :------ | :------ | -| `opts` | [`CheckpointDBOpts`](../interfaces/CheckpointDBOpts.md) | +> **\_stats**: `object` -#### Defined in +Defined in: [db/checkpoint.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L27) -[db/checkpoint.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L43) +#### cache -## Properties +> **cache**: `object` -### \_stats +##### cache.hits -• **\_stats**: `Object` +> **hits**: `number` = `0` -#### Type declaration +##### cache.reads -| Name | Type | -| :------ | :------ | -| `cache` | { `hits`: `number` = 0; `reads`: `number` = 0; `writes`: `number` = 0 } | -| `cache.hits` | `number` | -| `cache.reads` | `number` | -| `cache.writes` | `number` | -| `db` | { `hits`: `number` = 0; `reads`: `number` = 0; `writes`: `number` = 0 } | -| `db.hits` | `number` | -| `db.reads` | `number` | -| `db.writes` | `number` | +> **reads**: `number` = `0` -#### Defined in +##### cache.writes -[db/checkpoint.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L27) +> **writes**: `number` = `0` -___ +#### db -### cacheSize +> **db**: `object` -• `Readonly` **cacheSize**: `number` +##### db.hits -#### Defined in +> **hits**: `number` = `0` -[db/checkpoint.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L14) +##### db.reads -___ +> **reads**: `number` = `0` -### checkpoints +##### db.writes -• **checkpoints**: [`Checkpoint`](../README.md#checkpoint)[] +> **writes**: `number` = `0` -#### Defined in +*** -[db/checkpoint.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L12) +### cacheSize -___ +> `readonly` **cacheSize**: `number` -### db +Defined in: [db/checkpoint.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L14) + +*** + +### checkpoints -• **db**: `DB`<`Uint8Array`, `Uint8Array`\> +> **checkpoints**: [`Checkpoint`](../type-aliases/Checkpoint.md)[] + +Defined in: [db/checkpoint.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L12) + +*** + +### db -#### Defined in +> **db**: `DB`\<`Uint8Array`\<`ArrayBufferLike`\>, `Uint8Array`\<`ArrayBufferLike`\>\> -[db/checkpoint.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L13) +Defined in: [db/checkpoint.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L13) ## Methods -### batch +### batch() -▸ **batch**(`opStack`): `Promise`<`void`\> +> **batch**(`opStack`): `Promise`\<`void`\> -**`Inherit Doc`** +Defined in: [db/checkpoint.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L217) #### Parameters -| Name | Type | -| :------ | :------ | -| `opStack` | `BatchDBOp`<`Uint8Array`, `Uint8Array`\>[] | +##### opStack + +`BatchDBOp`[] #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Implementation of +#### Inherit Doc -DB.batch +#### Implementation of -#### Defined in +`DB.batch` -[db/checkpoint.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L217) +*** -___ +### checkpoint() -### checkpoint +> **checkpoint**(`root`): `void` -▸ **checkpoint**(`root`): `void` +Defined in: [db/checkpoint.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L83) Adds a new checkpoint to the stack #### Parameters -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | +##### root + +`Uint8Array` #### Returns `void` -#### Defined in +*** -[db/checkpoint.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L83) +### commit() -___ +> **commit**(): `Promise`\<`void`\> -### commit - -▸ **commit**(): `Promise`<`void`\> +Defined in: [db/checkpoint.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L90) Commits the latest checkpoint #### Returns -`Promise`<`void`\> - -#### Defined in +`Promise`\<`void`\> -[db/checkpoint.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L90) +*** -___ +### del() -### del +> **del**(`key`): `Promise`\<`void`\> -▸ **del**(`key`): `Promise`<`void`\> - -**`Inherit Doc`** +Defined in: [db/checkpoint.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L195) #### Parameters -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | +##### key -#### Returns +`Uint8Array` -`Promise`<`void`\> +#### Returns -#### Implementation of +`Promise`\<`void`\> -DB.del +#### Inherit Doc -#### Defined in +#### Implementation of -[db/checkpoint.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L195) +`DB.del` -___ +*** -### get +### get() -▸ **get**(`key`): `Promise`<`undefined` \| `Uint8Array`\> +> **get**(`key`): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> -**`Inherit Doc`** +Defined in: [db/checkpoint.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L134) #### Parameters -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | +##### key + +`Uint8Array` #### Returns -`Promise`<`undefined` \| `Uint8Array`\> +`Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\> -#### Implementation of +#### Inherit Doc -DB.get +#### Implementation of -#### Defined in +`DB.get` -[db/checkpoint.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L134) +*** -___ +### hasCheckpoints() -### hasCheckpoints +> **hasCheckpoints**(): `boolean` -▸ **hasCheckpoints**(): `boolean` +Defined in: [db/checkpoint.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L75) Is the DB during a checkpoint phase? @@ -236,141 +219,154 @@ Is the DB during a checkpoint phase? `boolean` -#### Defined in +*** -[db/checkpoint.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L75) +### open() -___ +> **open**(): `Promise`\<`void`\> -### open +Defined in: [db/checkpoint.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L268) -▸ **open**(): `Promise`<`void`\> +Opens the database -- if applicable #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> #### Implementation of -DB.open +`DB.open` + +*** -#### Defined in +### put() -[db/checkpoint.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L267) +> **put**(`key`, `value`): `Promise`\<`void`\> -___ +Defined in: [db/checkpoint.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L173) -### put +#### Parameters -▸ **put**(`key`, `value`): `Promise`<`void`\> +##### key -**`Inherit Doc`** +`Uint8Array` -#### Parameters +##### value -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | -| `value` | `Uint8Array` | +`Uint8Array` #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Implementation of +#### Inherit Doc -DB.put +#### Implementation of -#### Defined in +`DB.put` -[db/checkpoint.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L173) +*** -___ +### revert() -### revert +> **revert**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **revert**(): `Promise`<`Uint8Array`\> +Defined in: [db/checkpoint.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L126) Reverts the latest checkpoint #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -#### Defined in +*** -[db/checkpoint.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L126) +### setCheckpoints() -___ +> **setCheckpoints**(`checkpoints`): `void` -### setCheckpoints - -▸ **setCheckpoints**(`checkpoints`): `void` +Defined in: [db/checkpoint.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L61) Flush the checkpoints and use the given checkpoints instead. #### Parameters -| Name | Type | -| :------ | :------ | -| `checkpoints` | [`Checkpoint`](../README.md#checkpoint)[] | +##### checkpoints + +[`Checkpoint`](../type-aliases/Checkpoint.md)[] #### Returns `void` -#### Defined in +*** -[db/checkpoint.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L61) +### shallowCopy() -___ +> **shallowCopy**(): `CheckpointDB` -### shallowCopy - -▸ **shallowCopy**(): [`CheckpointDB`](CheckpointDB.md) - -**`Inherit Doc`** +Defined in: [db/checkpoint.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L264) #### Returns -[`CheckpointDB`](CheckpointDB.md) +`CheckpointDB` -#### Implementation of +#### Inherit Doc -DB.shallowCopy +#### Implementation of -#### Defined in +`DB.shallowCopy` -[db/checkpoint.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L263) +*** -___ +### stats() -### stats +> **stats**(`reset`): `object` -▸ **stats**(`reset?`): `Object` +Defined in: [db/checkpoint.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L242) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `reset` | `boolean` | `true` | +##### reset + +`boolean` = `true` #### Returns -`Object` +`object` + +##### cache + +> **cache**: `object` + +###### cache.hits + +> **hits**: `number` = `0` + +###### cache.reads + +> **reads**: `number` = `0` + +###### cache.writes + +> **writes**: `number` = `0` + +##### db + +> **db**: `object` + +###### db.hits + +> **hits**: `number` = `0` + +###### db.reads + +> **reads**: `number` = `0` + +###### db.writes -| Name | Type | -| :------ | :------ | -| `cache` | { `hits`: `number` = 0; `reads`: `number` = 0; `writes`: `number` = 0 } | -| `cache.hits` | `number` | -| `cache.reads` | `number` | -| `cache.writes` | `number` | -| `db` | { `hits`: `number` = 0; `reads`: `number` = 0; `writes`: `number` = 0 } | -| `db.hits` | `number` | -| `db.reads` | `number` | -| `db.writes` | `number` | -| `size` | `number` | +> **writes**: `number` = `0` -#### Defined in +##### size -[db/checkpoint.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/db/checkpoint.ts#L241) +> **size**: `number` diff --git a/packages/verkle/docs/classes/InternalNode.md b/packages/verkle/docs/classes/InternalNode.md deleted file mode 100644 index a214dc30bfc..00000000000 --- a/packages/verkle/docs/classes/InternalNode.md +++ /dev/null @@ -1,339 +0,0 @@ -[@ethereumjs/verkle](../README.md) / InternalNode - -# Class: InternalNode - -## Hierarchy - -- [`BaseVerkleNode`](BaseVerkleNode.md)<[`Internal`](../enums/VerkleNodeType.md#internal)\> - - ↳ **`InternalNode`** - -## Table of contents - -### Constructors - -- [constructor](InternalNode.md#constructor) - -### Properties - -- [children](InternalNode.md#children) -- [commitment](InternalNode.md#commitment) -- [copyOnWrite](InternalNode.md#copyonwrite) -- [depth](InternalNode.md#depth) -- [type](InternalNode.md#type) - -### Methods - -- [commit](InternalNode.md#commit) -- [cowChild](InternalNode.md#cowchild) -- [getChildren](InternalNode.md#getchildren) -- [hash](InternalNode.md#hash) -- [insert](InternalNode.md#insert) -- [insertStem](InternalNode.md#insertstem) -- [raw](InternalNode.md#raw) -- [serialize](InternalNode.md#serialize) -- [setChild](InternalNode.md#setchild) -- [create](InternalNode.md#create) -- [fromRawNode](InternalNode.md#fromrawnode) - -## Constructors - -### constructor - -• **new InternalNode**(`options`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | `VerkleInternalNodeOptions` | - -#### Overrides - -[BaseVerkleNode](BaseVerkleNode.md).[constructor](BaseVerkleNode.md#constructor) - -#### Defined in - -[node/internalNode.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L19) - -## Properties - -### children - -• **children**: (``null`` \| [`VerkleNode`](../README.md#verklenode))[] - -#### Defined in - -[node/internalNode.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L14) - -___ - -### commitment - -• **commitment**: [`Point`](../interfaces/Point.md) - -#### Inherited from - -[BaseVerkleNode](BaseVerkleNode.md).[commitment](BaseVerkleNode.md#commitment) - -#### Defined in - -[node/baseVerkleNode.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L8) - -___ - -### copyOnWrite - -• **copyOnWrite**: `Record`<`string`, [`Point`](../interfaces/Point.md)\> - -#### Defined in - -[node/internalNode.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L15) - -___ - -### depth - -• **depth**: `number` - -#### Inherited from - -[BaseVerkleNode](BaseVerkleNode.md).[depth](BaseVerkleNode.md#depth) - -#### Defined in - -[node/baseVerkleNode.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L9) - -___ - -### type - -• **type**: [`VerkleNodeType`](../enums/VerkleNodeType.md) = `VerkleNodeType.Internal` - -#### Defined in - -[node/internalNode.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L16) - -## Methods - -### commit - -▸ **commit**(): [`Point`](../interfaces/Point.md) - -#### Returns - -[`Point`](../interfaces/Point.md) - -#### Overrides - -[BaseVerkleNode](BaseVerkleNode.md).[commit](BaseVerkleNode.md#commit) - -#### Defined in - -[node/internalNode.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L25) - -___ - -### cowChild - -▸ **cowChild**(`_`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_` | `number` | - -#### Returns - -`void` - -#### Defined in - -[node/internalNode.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L29) - -___ - -### getChildren - -▸ **getChildren**(`index`): ``null`` \| [`VerkleNode`](../README.md#verklenode) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `index` | `number` | - -#### Returns - -``null`` \| [`VerkleNode`](../README.md#verklenode) - -#### Defined in - -[node/internalNode.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L63) - -___ - -### hash - -▸ **hash**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Inherited from - -[BaseVerkleNode](BaseVerkleNode.md).[hash](BaseVerkleNode.md#hash) - -#### Defined in - -[node/baseVerkleNode.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L19) - -___ - -### insert - -▸ **insert**(`key`, `value`, `resolver`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | -| `value` | `Uint8Array` | -| `resolver` | () => `void` | - -#### Returns - -`void` - -#### Overrides - -[BaseVerkleNode](BaseVerkleNode.md).[insert](BaseVerkleNode.md#insert) - -#### Defined in - -[node/internalNode.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L67) - -___ - -### insertStem - -▸ **insertStem**(`stem`, `values`, `resolver`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stem` | `Uint8Array` | -| `values` | `Uint8Array`[] | -| `resolver` | () => `void` | - -#### Returns - -`void` - -#### Defined in - -[node/internalNode.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L73) - -___ - -### raw - -▸ **raw**(): `Uint8Array`[] - -#### Returns - -`Uint8Array`[] - -#### Overrides - -[BaseVerkleNode](BaseVerkleNode.md).[raw](BaseVerkleNode.md#raw) - -#### Defined in - -[node/internalNode.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L116) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -the RLP serialized node - -#### Inherited from - -[BaseVerkleNode](BaseVerkleNode.md).[serialize](BaseVerkleNode.md#serialize) - -#### Defined in - -[node/baseVerkleNode.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L30) - -___ - -### setChild - -▸ **setChild**(`index`, `child`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `index` | `number` | -| `child` | [`VerkleNode`](../README.md#verklenode) | - -#### Returns - -`void` - -#### Defined in - -[node/internalNode.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L33) - -___ - -### create - -▸ `Static` **create**(`depth`): [`InternalNode`](InternalNode.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `depth` | `number` | - -#### Returns - -[`InternalNode`](InternalNode.md) - -#### Defined in - -[node/internalNode.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L54) - -___ - -### fromRawNode - -▸ `Static` **fromRawNode**(`rawNode`, `depth`): [`InternalNode`](InternalNode.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `rawNode` | `Uint8Array`[] | -| `depth` | `number` | - -#### Returns - -[`InternalNode`](InternalNode.md) - -#### Defined in - -[node/internalNode.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L37) diff --git a/packages/verkle/docs/classes/InternalVerkleNode.md b/packages/verkle/docs/classes/InternalVerkleNode.md new file mode 100644 index 00000000000..ec4f9e7a0e5 --- /dev/null +++ b/packages/verkle/docs/classes/InternalVerkleNode.md @@ -0,0 +1,199 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / InternalVerkleNode + +# Class: InternalVerkleNode + +Defined in: [node/internalNode.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L8) + +## Extends + +- [`BaseVerkleNode`](BaseVerkleNode.md)\<*typeof* [`Internal`](../variables/VerkleNodeType.md#internal)\> + +## Constructors + +### Constructor + +> **new InternalVerkleNode**(`options`): `InternalVerkleNode` + +Defined in: [node/internalNode.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L13) + +#### Parameters + +##### options + +`InternalVerkleNodeOptions` + +#### Returns + +`InternalVerkleNode` + +#### Overrides + +[`BaseVerkleNode`](BaseVerkleNode.md).[`constructor`](BaseVerkleNode.md#constructor) + +## Properties + +### children + +> **children**: (`null` \| [`ChildNode`](../interfaces/ChildNode.md))[] + +Defined in: [node/internalNode.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L10) + +*** + +### commitment + +> **commitment**: `Uint8Array` + +Defined in: [node/baseVerkleNode.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L8) + +#### Inherited from + +[`BaseVerkleNode`](BaseVerkleNode.md).[`commitment`](BaseVerkleNode.md#commitment) + +*** + +### type + +> **type**: `0` = `VerkleNodeType.Internal` + +Defined in: [node/internalNode.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L11) + +## Methods + +### getChildren() + +> **getChildren**(`index`): `null` \| [`ChildNode`](../interfaces/ChildNode.md) + +Defined in: [node/internalNode.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L76) + +#### Parameters + +##### index + +`number` + +The index in the children array to retrieve the child node commitment from + +#### Returns + +`null` \| [`ChildNode`](../interfaces/ChildNode.md) + +the uncompressed 64byte commitment for the child node at the `index` position in the children array + +*** + +### hash() + +> **hash**(): `Uint8Array` + +Defined in: [node/baseVerkleNode.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L16) + +#### Returns + +`Uint8Array` + +#### Inherited from + +[`BaseVerkleNode`](BaseVerkleNode.md).[`hash`](BaseVerkleNode.md#hash) + +*** + +### raw() + +> **raw**(): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [node/internalNode.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L80) + +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] + +#### Overrides + +[`BaseVerkleNode`](BaseVerkleNode.md).[`raw`](BaseVerkleNode.md#raw) + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [node/baseVerkleNode.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L26) + +#### Returns + +`Uint8Array` + +the RLP serialized node + +#### Inherited from + +[`BaseVerkleNode`](BaseVerkleNode.md).[`serialize`](BaseVerkleNode.md#serialize) + +*** + +### setChild() + +> **setChild**(`childIndex`, `child`): `void` + +Defined in: [node/internalNode.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L19) + +#### Parameters + +##### childIndex + +`number` + +##### child + +`null` | [`ChildNode`](../interfaces/ChildNode.md) + +#### Returns + +`void` + +*** + +### create() + +> `static` **create**(`verkleCrypto`): `InternalVerkleNode` + +Defined in: [node/internalNode.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L62) + +Generates a new Internal node with default commitment + +#### Parameters + +##### verkleCrypto + +`VerkleCrypto` + +#### Returns + +`InternalVerkleNode` + +*** + +### fromRawNode() + +> `static` **fromRawNode**(`rawNode`, `verkleCrypto`): `InternalVerkleNode` + +Defined in: [node/internalNode.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/internalNode.ts#L37) + +#### Parameters + +##### rawNode + +`Uint8Array`\<`ArrayBufferLike`\>[] + +##### verkleCrypto + +`VerkleCrypto` + +#### Returns + +`InternalVerkleNode` diff --git a/packages/verkle/docs/classes/LeafNode.md b/packages/verkle/docs/classes/LeafNode.md deleted file mode 100644 index 67349ed7d45..00000000000 --- a/packages/verkle/docs/classes/LeafNode.md +++ /dev/null @@ -1,362 +0,0 @@ -[@ethereumjs/verkle](../README.md) / LeafNode - -# Class: LeafNode - -## Hierarchy - -- [`BaseVerkleNode`](BaseVerkleNode.md)<[`Leaf`](../enums/VerkleNodeType.md#leaf)\> - - ↳ **`LeafNode`** - -## Table of contents - -### Constructors - -- [constructor](LeafNode.md#constructor) - -### Properties - -- [c1](LeafNode.md#c1) -- [c2](LeafNode.md#c2) -- [commitment](LeafNode.md#commitment) -- [depth](LeafNode.md#depth) -- [stem](LeafNode.md#stem) -- [type](LeafNode.md#type) -- [values](LeafNode.md#values) - -### Methods - -- [commit](LeafNode.md#commit) -- [getValue](LeafNode.md#getvalue) -- [hash](LeafNode.md#hash) -- [insert](LeafNode.md#insert) -- [insertMultiple](LeafNode.md#insertmultiple) -- [insertStem](LeafNode.md#insertstem) -- [raw](LeafNode.md#raw) -- [serialize](LeafNode.md#serialize) -- [setDepth](LeafNode.md#setdepth) -- [create](LeafNode.md#create) -- [fromRawNode](LeafNode.md#fromrawnode) - -## Constructors - -### constructor - -• **new LeafNode**(`options`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | `VerkleLeafNodeOptions` | - -#### Overrides - -[BaseVerkleNode](BaseVerkleNode.md).[constructor](BaseVerkleNode.md#constructor) - -#### Defined in - -[node/leafNode.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L15) - -## Properties - -### c1 - -• **c1**: [`Point`](../interfaces/Point.md) - -#### Defined in - -[node/leafNode.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L11) - -___ - -### c2 - -• **c2**: [`Point`](../interfaces/Point.md) - -#### Defined in - -[node/leafNode.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L12) - -___ - -### commitment - -• **commitment**: [`Point`](../interfaces/Point.md) - -#### Inherited from - -[BaseVerkleNode](BaseVerkleNode.md).[commitment](BaseVerkleNode.md#commitment) - -#### Defined in - -[node/baseVerkleNode.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L8) - -___ - -### depth - -• **depth**: `number` - -#### Inherited from - -[BaseVerkleNode](BaseVerkleNode.md).[depth](BaseVerkleNode.md#depth) - -#### Defined in - -[node/baseVerkleNode.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L9) - -___ - -### stem - -• **stem**: `Uint8Array` - -#### Defined in - -[node/leafNode.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L9) - -___ - -### type - -• **type**: [`VerkleNodeType`](../enums/VerkleNodeType.md) = `VerkleNodeType.Leaf` - -#### Defined in - -[node/leafNode.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L13) - -___ - -### values - -• **values**: `Uint8Array`[] - -#### Defined in - -[node/leafNode.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L10) - -## Methods - -### commit - -▸ **commit**(): [`Point`](../interfaces/Point.md) - -#### Returns - -[`Point`](../interfaces/Point.md) - -#### Overrides - -[BaseVerkleNode](BaseVerkleNode.md).[commit](BaseVerkleNode.md#commit) - -#### Defined in - -[node/leafNode.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L48) - -___ - -### getValue - -▸ **getValue**(`index`): ``null`` \| `Uint8Array` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `index` | `number` | - -#### Returns - -``null`` \| `Uint8Array` - -#### Defined in - -[node/leafNode.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L52) - -___ - -### hash - -▸ **hash**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Inherited from - -[BaseVerkleNode](BaseVerkleNode.md).[hash](BaseVerkleNode.md#hash) - -#### Defined in - -[node/baseVerkleNode.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L19) - -___ - -### insert - -▸ **insert**(`key`, `value`, `nodeResolverFn`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | -| `value` | `Uint8Array` | -| `nodeResolverFn` | () => `void` | - -#### Returns - -`void` - -#### Overrides - -[BaseVerkleNode](BaseVerkleNode.md).[insert](BaseVerkleNode.md#insert) - -#### Defined in - -[node/leafNode.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L56) - -___ - -### insertMultiple - -▸ **insertMultiple**(`key`, `values`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | -| `values` | `Uint8Array`[] | - -#### Returns - -`void` - -#### Defined in - -[node/leafNode.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L62) - -___ - -### insertStem - -▸ **insertStem**(`key`, `value`, `resolver`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | -| `value` | `Uint8Array`[] | -| `resolver` | () => `void` | - -#### Returns - -`void` - -#### Defined in - -[node/leafNode.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L66) - -___ - -### raw - -▸ **raw**(): `Uint8Array`[] - -#### Returns - -`Uint8Array`[] - -#### Overrides - -[BaseVerkleNode](BaseVerkleNode.md).[raw](BaseVerkleNode.md#raw) - -#### Defined in - -[node/leafNode.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L71) - -___ - -### serialize - -▸ **serialize**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -the RLP serialized node - -#### Inherited from - -[BaseVerkleNode](BaseVerkleNode.md).[serialize](BaseVerkleNode.md#serialize) - -#### Defined in - -[node/baseVerkleNode.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L30) - -___ - -### setDepth - -▸ **setDepth**(`depth`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `depth` | `number` | - -#### Returns - -`void` - -#### Defined in - -[node/leafNode.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L82) - -___ - -### create - -▸ `Static` **create**(`stem`, `values`): [`LeafNode`](LeafNode.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stem` | `Uint8Array` | -| `values` | `Uint8Array`[] | - -#### Returns - -[`LeafNode`](LeafNode.md) - -#### Defined in - -[node/leafNode.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L24) - -___ - -### fromRawNode - -▸ `Static` **fromRawNode**(`rawNode`, `depth`): [`LeafNode`](LeafNode.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `rawNode` | `Uint8Array`[] | -| `depth` | `number` | - -#### Returns - -[`LeafNode`](LeafNode.md) - -#### Defined in - -[node/leafNode.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L28) diff --git a/packages/verkle/docs/classes/LeafVerkleNode.md b/packages/verkle/docs/classes/LeafVerkleNode.md new file mode 100644 index 00000000000..091c090c0a3 --- /dev/null +++ b/packages/verkle/docs/classes/LeafVerkleNode.md @@ -0,0 +1,241 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / LeafVerkleNode + +# Class: LeafVerkleNode + +Defined in: [node/leafNode.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L15) + +## Extends + +- [`BaseVerkleNode`](BaseVerkleNode.md)\<*typeof* [`Leaf`](../variables/VerkleNodeType.md#leaf)\> + +## Constructors + +### Constructor + +> **new LeafVerkleNode**(`options`): `LeafVerkleNode` + +Defined in: [node/leafNode.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L22) + +#### Parameters + +##### options + +`LeafVerkleNodeOptions` + +#### Returns + +`LeafVerkleNode` + +#### Overrides + +[`BaseVerkleNode`](BaseVerkleNode.md).[`constructor`](BaseVerkleNode.md#constructor) + +## Properties + +### c1? + +> `optional` **c1**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [node/leafNode.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L18) + +*** + +### c2? + +> `optional` **c2**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [node/leafNode.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L19) + +*** + +### commitment + +> **commitment**: `Uint8Array` + +Defined in: [node/baseVerkleNode.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L8) + +#### Inherited from + +[`BaseVerkleNode`](BaseVerkleNode.md).[`commitment`](BaseVerkleNode.md#commitment) + +*** + +### stem + +> **stem**: `Uint8Array` + +Defined in: [node/leafNode.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L16) + +*** + +### type + +> **type**: `1` = `VerkleNodeType.Leaf` + +Defined in: [node/leafNode.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L20) + +*** + +### values + +> **values**: (`Uint8Array`\<`ArrayBufferLike`\> \| [`LeafVerkleNodeValue`](../type-aliases/LeafVerkleNodeValue.md))[] + +Defined in: [node/leafNode.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L17) + +## Methods + +### getValue() + +> **getValue**(`index`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [node/leafNode.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L132) + +#### Parameters + +##### index + +`number` + +#### Returns + +`undefined` \| `Uint8Array`\<`ArrayBufferLike`\> + +*** + +### hash() + +> **hash**(): `Uint8Array` + +Defined in: [node/baseVerkleNode.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L16) + +#### Returns + +`Uint8Array` + +#### Inherited from + +[`BaseVerkleNode`](BaseVerkleNode.md).[`hash`](BaseVerkleNode.md#hash) + +*** + +### raw() + +> **raw**(): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [node/leafNode.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L181) + +#### Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] + +#### Overrides + +[`BaseVerkleNode`](BaseVerkleNode.md).[`raw`](BaseVerkleNode.md#raw) + +*** + +### serialize() + +> **serialize**(): `Uint8Array` + +Defined in: [node/baseVerkleNode.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/baseVerkleNode.ts#L26) + +#### Returns + +`Uint8Array` + +the RLP serialized node + +#### Inherited from + +[`BaseVerkleNode`](BaseVerkleNode.md).[`serialize`](BaseVerkleNode.md#serialize) + +*** + +### setValue() + +> **setValue**(`index`, `value`): `void` + +Defined in: [node/leafNode.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L150) + +Set the value at the provided index from the values array and update the node commitments + +#### Parameters + +##### index + +`number` + +the index of the specific leaf value to be updated + +##### value + +the value to insert into the leaf value at `index` + +`Uint8Array`\<`ArrayBufferLike`\> | [`LeafVerkleNodeValue`](../type-aliases/LeafVerkleNodeValue.md) + +#### Returns + +`void` + +*** + +### create() + +> `static` **create**(`stem`, `verkleCrypto`, `values?`): `Promise`\<`LeafVerkleNode`\> + +Defined in: [node/leafNode.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L38) + +Create a new leaf node from a stem and values + +#### Parameters + +##### stem + +`Uint8Array` + +the 31 byte stem corresponding to the where the leaf node should be placed in the trie + +##### verkleCrypto + +`VerkleCrypto` + +the verkle cryptography interface + +##### values? + +(`Uint8Array`\<`ArrayBufferLike`\> \| [`LeafVerkleNodeValue`](../type-aliases/LeafVerkleNodeValue.md))[] + +the 256 element array of 32 byte values stored in the leaf node + +#### Returns + +`Promise`\<`LeafVerkleNode`\> + +an instantiated leaf node with commitments defined + +*** + +### fromRawNode() + +> `static` **fromRawNode**(`rawNode`, `verkleCrypto`): `LeafVerkleNode` + +Defined in: [node/leafNode.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/leafNode.ts#L109) + +#### Parameters + +##### rawNode + +`Uint8Array`\<`ArrayBufferLike`\>[] + +##### verkleCrypto + +`VerkleCrypto` + +#### Returns + +`LeafVerkleNode` diff --git a/packages/verkle/docs/classes/PrioritizedTaskExecutor.md b/packages/verkle/docs/classes/PrioritizedTaskExecutor.md deleted file mode 100644 index cdb162e3f4d..00000000000 --- a/packages/verkle/docs/classes/PrioritizedTaskExecutor.md +++ /dev/null @@ -1,3 +0,0 @@ -[@ethereumjs/verkle](../README.md) / PrioritizedTaskExecutor - -# Class: PrioritizedTaskExecutor diff --git a/packages/verkle/docs/classes/VerkleTree.md b/packages/verkle/docs/classes/VerkleTree.md index 68004575f70..825169febde 100644 --- a/packages/verkle/docs/classes/VerkleTree.md +++ b/packages/verkle/docs/classes/VerkleTree.md @@ -1,283 +1,213 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + [@ethereumjs/verkle](../README.md) / VerkleTree # Class: VerkleTree -The basic verkle tree interface, use with `import { VerkleTree } from '@ethereumjs/verkle'`. +Defined in: [verkleTree.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L31) -## Table of contents - -### Constructors - -- [constructor](VerkleTree.md#constructor) - -### Properties - -- [EMPTY\_TREE\_ROOT](VerkleTree.md#empty_tree_root) - -### Methods - -- [batch](VerkleTree.md#batch) -- [checkRoot](VerkleTree.md#checkroot) -- [checkpoint](VerkleTree.md#checkpoint) -- [commit](VerkleTree.md#commit) -- [createProof](VerkleTree.md#createproof) -- [createReadStream](VerkleTree.md#createreadstream) -- [database](VerkleTree.md#database) -- [findLeafNode](VerkleTree.md#findleafnode) -- [findPath](VerkleTree.md#findpath) -- [flushCheckpoints](VerkleTree.md#flushcheckpoints) -- [fromProof](VerkleTree.md#fromproof) -- [get](VerkleTree.md#get) -- [hasCheckpoints](VerkleTree.md#hascheckpoints) -- [lookupNode](VerkleTree.md#lookupnode) -- [persistRoot](VerkleTree.md#persistroot) -- [put](VerkleTree.md#put) -- [revert](VerkleTree.md#revert) -- [root](VerkleTree.md#root) -- [saveStack](VerkleTree.md#savestack) -- [shallowCopy](VerkleTree.md#shallowcopy) -- [verifyProof](VerkleTree.md#verifyproof) -- [walkTree](VerkleTree.md#walktree) -- [create](VerkleTree.md#create) +The basic verkle tree interface, use with `import { VerkleTree } from '@ethereumjs/verkle'`. ## Constructors -### constructor +### Constructor -• **new VerkleTree**(`opts?`) +> **new VerkleTree**(`opts`): `VerkleTree` + +Defined in: [verkleTree.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L55) Creates a new verkle tree. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts?` | [`VerkleTreeOpts`](../interfaces/VerkleTreeOpts.md) | Options for instantiating the verkle tree Note: in most cases, the static [create](VerkleTree.md#create) constructor should be used. It uses the same API but provides sensible defaults | +##### opts + +[`VerkleTreeOpts`](../interfaces/VerkleTreeOpts.md) + +Options for instantiating the verkle tree -#### Defined in +Note: in most cases, the static [createVerkleTree](../functions/createVerkleTree.md) constructor should be used. It uses the same API but provides sensible defaults -[verkleTree.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L50) +#### Returns + +`VerkleTree` ## Properties -### EMPTY\_TREE\_ROOT +### \_opts -• **EMPTY\_TREE\_ROOT**: `Uint8Array` +> **\_opts**: [`VerkleTreeOpts`](../interfaces/VerkleTreeOpts.md) -The root for an empty tree +Defined in: [verkleTree.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L32) -#### Defined in +*** -[verkleTree.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L36) +### EMPTY\_TREE\_ROOT -## Methods +> **EMPTY\_TREE\_ROOT**: `Uint8Array` -### batch +Defined in: [verkleTree.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L35) -▸ **batch**(`ops`): `Promise`<`void`\> +The root for an empty tree -The given hash of operations (key additions or deletions) are executed on the tree -(delete operations are only executed on DB with `deleteFromDB` set to `true`) +## Methods -**`Example`** +### checkpoint() -```ts -const ops = [ - { type: 'del', key: Uint8Array.from('father') } - , { type: 'put', key: Uint8Array.from('name'), value: Uint8Array.from('Yuri Irsenovich Kim') } - , { type: 'put', key: Uint8Array.from('dob'), value: Uint8Array.from('16 February 1941') } - , { type: 'put', key: Uint8Array.from('spouse'), value: Uint8Array.from('Kim Young-sook') } - , { type: 'put', key: Uint8Array.from('occupation'), value: Uint8Array.from('Clown') } -] -await tree.batch(ops) -``` +> **checkpoint**(): `void` -#### Parameters +Defined in: [verkleTree.ts:639](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L639) -| Name | Type | -| :------ | :------ | -| `ops` | `BatchDBOp`<`Uint8Array`, `Uint8Array`\>[] | +Creates a checkpoint that can later be reverted to or committed. +After this is called, all changes can be reverted until `commit` is called. #### Returns -`Promise`<`void`\> - -#### Defined in +`void` -[verkleTree.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L366) +*** -___ +### checkRoot() -### checkRoot +> **checkRoot**(`root`): `Promise`\<`boolean`\> -▸ **checkRoot**(`root`): `Promise`<`boolean`\> +Defined in: [verkleTree.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L115) Checks if a given root exists. #### Parameters -| Name | Type | -| :------ | :------ | -| `root` | `Uint8Array` | - -#### Returns - -`Promise`<`boolean`\> - -#### Defined in - -[verkleTree.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L120) - -___ - -### checkpoint +##### root -▸ **checkpoint**(): `void` - -Creates a checkpoint that can later be reverted to or committed. -After this is called, all changes can be reverted until `commit` is called. +`Uint8Array` #### Returns -`void` - -#### Defined in +`Promise`\<`boolean`\> -[verkleTree.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L465) +*** -___ +### commit() -### commit +> **commit**(): `Promise`\<`void`\> -▸ **commit**(): `Promise`<`void`\> +Defined in: [verkleTree.ts:648](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L648) Commits a checkpoint to disk, if current checkpoint is not nested. If nested, only sets the parent checkpoint as current checkpoint. -**`Throws`** - -If not during a checkpoint phase - #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Defined in +#### Throws -[verkleTree.ts:474](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L474) +If not during a checkpoint phase -___ +*** -### createProof +### createReadStream() -▸ **createProof**(`key`): `Promise`<[`Proof`](../README.md#proof)\> +> **createReadStream**(): `any` -Creates a proof from a tree and key that can be verified using [verifyProof](VerkleTree.md#verifyproof). +Defined in: [verkleTree.ts:589](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L589) -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | `Uint8Array` | +The `data` event is given an `Object` that has two properties; the `key` and the `value`. Both should be Uint8Arrays. #### Returns -`Promise`<[`Proof`](../README.md#proof)\> +`any` -#### Defined in +Returns a [stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_class_stream_readable) of the contents of the `tree` -[verkleTree.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L382) +*** -___ +### createRootNode() -### createReadStream +> **createRootNode**(): `Promise`\<`void`\> -▸ **createReadStream**(): `any` +Defined in: [verkleTree.ts:523](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L523) -The `data` event is given an `Object` that has two properties; the `key` and the `value`. Both should be Uint8Arrays. +Create empty root node for initializing an empty tree. #### Returns -`any` +`Promise`\<`void`\> -Returns a [stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_class_stream_readable) of the contents of the `tree` +*** -#### Defined in +### createVerkleProof() -[verkleTree.ts:406](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L406) +> **createVerkleProof**(`_key`): `Promise`\<[`Proof`](../type-aliases/Proof.md)\> -___ +Defined in: [verkleTree.ts:565](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L565) -### database - -▸ **database**(`db?`): [`CheckpointDB`](CheckpointDB.md) +Creates a proof from a tree and key that can be verified using [VerkleTree.verifyVerkleProof](#verifyverkleproof). #### Parameters -| Name | Type | -| :------ | :------ | -| `db?` | `DB`<`Uint8Array`, `Uint8Array`\> | +##### \_key + +`Uint8Array` #### Returns -[`CheckpointDB`](CheckpointDB.md) +`Promise`\<[`Proof`](../type-aliases/Proof.md)\> -#### Defined in +*** -[verkleTree.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L86) +### del() -___ +> **del**(`stem`, `suffixes`): `Promise`\<`void`\> -### findLeafNode +Defined in: [verkleTree.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L329) -▸ **findLeafNode**(`key`, `throwIfMissing?`): `Promise`<``null`` \| [`LeafNode`](LeafNode.md)\> +#### Parameters -Tries to find the leaf node leading up to the given key, or null if not found. +##### stem -#### Parameters +`Uint8Array` -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `key` | `Uint8Array` | `undefined` | the search key | -| `throwIfMissing` | `boolean` | `false` | if true, throws if any nodes are missing. Used for verifying proofs. (default: false) | +##### suffixes -#### Returns +`number`[] -`Promise`<``null`` \| [`LeafNode`](LeafNode.md)\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[verkleTree.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L267) +*** -___ +### findPath() -### findPath +> **findPath**(`key`): `Promise`\<`Path`\> -▸ **findPath**(`key`, `throwIfMissing?`): `Promise`<`Path`\> +Defined in: [verkleTree.ts:424](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L424) Tries to find a path to the node for the given key. It returns a `stack` of nodes to the closest node. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `key` | `Uint8Array` | `undefined` | the search key | -| `throwIfMissing` | `boolean` | `false` | if true, throws if any nodes are missing. Used for verifying proofs. (default: false) | +##### key -#### Returns +`Uint8Array` + +the search key -`Promise`<`Path`\> +#### Returns -#### Defined in +`Promise`\<`Path`\> -[verkleTree.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L196) +*** -___ +### flushCheckpoints() -### flushCheckpoints +> **flushCheckpoints**(): `void` -▸ **flushCheckpoints**(): `void` +Defined in: [verkleTree.ts:678](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L678) Flushes all checkpoints, restoring the initial checkpoint state. @@ -285,142 +215,124 @@ Flushes all checkpoints, restoring the initial checkpoint state. `void` -#### Defined in - -[verkleTree.ts:504](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L504) +*** -___ +### fromProof() -### fromProof +> **fromProof**(`_proof`): `Promise`\<`void`\> -▸ **fromProof**(`proof`): `Promise`<`void`\> +Defined in: [verkleTree.ts:557](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L557) Saves the nodes from a proof into the tree. #### Parameters -| Name | Type | -| :------ | :------ | -| `proof` | [`Proof`](../README.md#proof) | +##### \_proof -#### Returns +[`Proof`](../type-aliases/Proof.md) -`Promise`<`void`\> +#### Returns -#### Defined in +`Promise`\<`void`\> -[verkleTree.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L374) +*** -___ +### get() -### get +> **get**(`stem`, `suffixes`): `Promise`\<(`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>)[]\> -▸ **get**(`key`, `throwIfMissing?`): `Promise`<``null`` \| `Uint8Array`\> +Defined in: [verkleTree.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L135) -Gets a value given a `key` +Gets values at a given verkle `stem` and set of suffixes #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `key` | `Uint8Array` | `undefined` | the key to search for | -| `throwIfMissing` | `boolean` | `false` | if true, throws if any nodes are missing. Used for verifying proofs. (default: false) | - -#### Returns +##### stem -`Promise`<``null`` \| `Uint8Array`\> +`Uint8Array` -A Promise that resolves to `Uint8Array` if a value was found or `null` if no value was found. +the stem of the leaf node where we're seeking values -#### Defined in +##### suffixes -[verkleTree.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L139) +`number`[] -___ +an array of suffixes corresponding to the values desired -### hasCheckpoints +#### Returns -▸ **hasCheckpoints**(): `boolean` +`Promise`\<(`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>)[]\> -Is the tree during a checkpoint phase? +A Promise that resolves to an array of `Uint8Array`s if a value +was found or `undefined` if no value was found at a given suffixes. -#### Returns - -`boolean` +*** -#### Defined in +### hasCheckpoints() -[verkleTree.ts:457](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L457) +> **hasCheckpoints**(): `boolean` -___ +Defined in: [verkleTree.ts:631](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L631) -### lookupNode +Is the tree during a checkpoint phase? -▸ **lookupNode**(`node`): `Promise`<``null`` \| [`VerkleNode`](../README.md#verklenode)\> +#### Returns -Retrieves a node from db by hash. +`boolean` -#### Parameters +*** -| Name | Type | -| :------ | :------ | -| `node` | `Uint8Array` \| `Uint8Array`[] | +### persistRoot() -#### Returns +> **persistRoot**(): `Promise`\<`void`\> -`Promise`<``null`` \| [`VerkleNode`](../README.md#verklenode)\> +Defined in: [verkleTree.ts:622](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L622) -#### Defined in +Persists the root hash in the underlying database -[verkleTree.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L289) +#### Returns -___ +`Promise`\<`void`\> -### persistRoot +*** -▸ **persistRoot**(): `Promise`<`void`\> +### put() -Persists the root hash in the underlying database +> **put**(`stem`, `suffixes`, `values`): `Promise`\<`void`\> -#### Returns +Defined in: [verkleTree.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L166) -`Promise`<`void`\> +Stores given `values` at the given `stem` and `suffixes` or do a delete if `value` is empty Uint8Array -#### Defined in +#### Parameters -[verkleTree.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L438) +##### stem -___ +`Uint8Array` -### put +##### suffixes -▸ **put**(`key`, `value`): `Promise`<`void`\> +`number`[] -Stores a given `value` at the given `key` or do a delete if `value` is empty -(delete operations are only executed on DB with `deleteFromDB` set to `true`) +array of suffixes at which to store individual values -#### Parameters +##### values -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `Uint8Array` | the key to store the value at | -| `value` | `Uint8Array` | the value to store | +(`0` \| `Uint8Array`\<`ArrayBufferLike`\>)[] = `[]` #### Returns -`Promise`<`void`\> - -A Promise that resolves once value is stored. +`Promise`\<`void`\> -#### Defined in +A Promise that resolves once value(s) are stored. -[verkleTree.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L159) +*** -___ +### revert() -### revert +> **revert**(): `Promise`\<`void`\> -▸ **revert**(): `Promise`<`void`\> +Defined in: [verkleTree.ts:664](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L664) Reverts the tree to the state it was at when `checkpoint` was first called. If during a nested checkpoint, sets root to most recent checkpoint, and sets @@ -428,63 +340,57 @@ parent checkpoint as current. #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Defined in +*** -[verkleTree.ts:490](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L490) +### root() -___ +> **root**(`value?`): `Uint8Array` -### root - -▸ **root**(`value?`): `Uint8Array` +Defined in: [verkleTree.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L96) Gets and/or Sets the current root of the `tree` #### Parameters -| Name | Type | -| :------ | :------ | -| `value?` | ``null`` \| `Uint8Array` | +##### value? + +`null` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns `Uint8Array` -#### Defined in +*** -[verkleTree.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L101) +### saveStack() -___ +> **saveStack**(`putStack`): `Promise`\<`void`\> -### saveStack - -▸ **saveStack**(`key`, `stack`, `opStack`): `Promise`<`void`\> +Defined in: [verkleTree.ts:542](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L542) Saves a stack of nodes to the database. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `Uint8Array` | the key. Should follow the stack | -| `stack` | [`VerkleNode`](../README.md#verklenode)[] | a stack of nodes to the value given by the key | -| `opStack` | `PutBatch`<`Uint8Array`, `Uint8Array`\>[] | a stack of levelup operations to commit at the end of this function | +##### putStack -#### Returns +\[`Uint8Array`\<`ArrayBufferLike`\>, `null` \| [`VerkleNode`](../type-aliases/VerkleNode.md)\][] -`Promise`<`void`\> +an array of tuples of keys (the partial path of the node in the trie) and nodes (VerkleNodes) -#### Defined in +#### Returns + +`Promise`\<`void`\> -[verkleTree.ts:326](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L326) +*** -___ +### shallowCopy() -### shallowCopy +> **shallowCopy**(`includeCheckpoints`): `VerkleTree` -▸ **shallowCopy**(`includeCheckpoints?`): [`VerkleTree`](VerkleTree.md) +Defined in: [verkleTree.ts:605](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L605) Returns a copy of the underlying tree. @@ -497,89 +403,83 @@ being deactivated. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `includeCheckpoints` | `boolean` | `true` | If true and during a checkpoint, the copy will contain the checkpointing metadata and will use the same scratch as underlying db. | - -#### Returns +##### includeCheckpoints -[`VerkleTree`](VerkleTree.md) +`boolean` = `true` -#### Defined in +If true and during a checkpoint, the copy will contain the checkpointing metadata and will use the same scratch as underlying db. -[verkleTree.ts:422](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L422) +#### Returns -___ +`VerkleTree` -### verifyProof +*** -▸ **verifyProof**(`rootHash`, `key`, `proof`): `Promise`<``null`` \| `Uint8Array`\> +### updateParent() -Verifies a proof. +> **updateParent**(`leafNode`, `nearestNode`, `pathToNode`): `Promise`\<`undefined` \| \{ `lastPath`: `Uint8Array`; `node`: [`VerkleNode`](../type-aliases/VerkleNode.md); \}\> -**`Throws`** +Defined in: [verkleTree.ts:341](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L341) -If proof is found to be invalid. +Helper method for updating or creating the parent internal node for a given leaf node #### Parameters -| Name | Type | -| :------ | :------ | -| `rootHash` | `Uint8Array` | -| `key` | `Uint8Array` | -| `proof` | [`Proof`](../README.md#proof) | +##### leafNode -#### Returns +[`LeafVerkleNode`](LeafVerkleNode.md) -`Promise`<``null`` \| `Uint8Array`\> +the child leaf node that will be referenced by the new/updated internal node +returned by this method -The value from the key, or null if valid proof of non-existence. +##### nearestNode -#### Defined in +[`VerkleNode`](../type-aliases/VerkleNode.md) -[verkleTree.ts:394](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L394) +the nearest node to the new leaf node -___ +##### pathToNode -### walkTree +`Uint8Array` -▸ **walkTree**(`root`, `onFound`): `Promise`<`void`\> +the path to `nearestNode` -Walks a tree until finished. +#### Returns -#### Parameters +`Promise`\<`undefined` \| \{ `lastPath`: `Uint8Array`; `node`: [`VerkleNode`](../type-aliases/VerkleNode.md); \}\> -| Name | Type | Description | -| :------ | :------ | :------ | -| `root` | `Uint8Array` | | -| `onFound` | [`FoundNodeFunction`](../README.md#foundnodefunction) | callback to call when a node is found. This schedules new tasks. If no tasks are available, the Promise resolves. | +a tuple of the updated parent node and the path to that parent (i.e. the partial stem of the leaf node that leads to the parent) -#### Returns +*** -`Promise`<`void`\> +### verifyVerkleProof() -Resolves when finished walking tree. +> **verifyVerkleProof**(`_rootHash`, `_key`, `_proof`): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> -#### Defined in +Defined in: [verkleTree.ts:577](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L577) -[verkleTree.ts:258](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L258) +Verifies a proof. -___ +#### Parameters -### create +##### \_rootHash -▸ `Static` **create**(`opts?`): `Promise`<[`VerkleTree`](VerkleTree.md)\> +`Uint8Array` -#### Parameters +##### \_key -| Name | Type | -| :------ | :------ | -| `opts?` | [`VerkleTreeOpts`](../interfaces/VerkleTreeOpts.md) | +`Uint8Array` + +##### \_proof + +[`Proof`](../type-aliases/Proof.md) #### Returns -`Promise`<[`VerkleTree`](VerkleTree.md)\> +`Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\> -#### Defined in +The value from the key, or null if valid proof of non-existence. + +#### Throws -[verkleTree.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/verkleTree.ts#L66) +If proof is found to be invalid. diff --git a/packages/verkle/docs/classes/WalkController.md b/packages/verkle/docs/classes/WalkController.md deleted file mode 100644 index c7b248f0fda..00000000000 --- a/packages/verkle/docs/classes/WalkController.md +++ /dev/null @@ -1,147 +0,0 @@ -[@ethereumjs/verkle](../README.md) / WalkController - -# Class: WalkController - -WalkController is an interface to control how the tree is being traversed. - -## Table of contents - -### Properties - -- [onNode](WalkController.md#onnode) -- [taskExecutor](WalkController.md#taskexecutor) -- [tree](WalkController.md#tree) - -### Methods - -- [allChildren](WalkController.md#allchildren) -- [pushChildrenAtIndex](WalkController.md#pushchildrenatindex) -- [pushNodeToQueue](WalkController.md#pushnodetoqueue) -- [newWalk](WalkController.md#newwalk) - -## Properties - -### onNode - -• `Readonly` **onNode**: [`FoundNodeFunction`](../README.md#foundnodefunction) - -#### Defined in - -[util/walkController.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/walkController.ts#L13) - -___ - -### taskExecutor - -• `Readonly` **taskExecutor**: [`PrioritizedTaskExecutor`](PrioritizedTaskExecutor.md) - -#### Defined in - -[util/walkController.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/walkController.ts#L14) - -___ - -### tree - -• `Readonly` **tree**: [`VerkleTree`](VerkleTree.md) - -#### Defined in - -[util/walkController.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/walkController.ts#L15) - -## Methods - -### allChildren - -▸ **allChildren**(`node`, `key?`): `void` - -Run all children of a node. Priority of these nodes are the key length of the children. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `node` | [`VerkleNode`](../README.md#verklenode) | Node to retrieve all children from of and call onNode on. | -| `key` | `Uint8Array` | The current `key` which would yield the `node` when trying to get this node with a `get` operation. | - -#### Returns - -`void` - -#### Defined in - -[util/walkController.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/walkController.ts#L70) - -___ - -### pushChildrenAtIndex - -▸ **pushChildrenAtIndex**(`node`, `key?`, `childIndex`, `priority?`): `void` - -Push the child of an internal node to the event queue. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `node` | [`InternalNode`](InternalNode.md) | The node to select a children from. Should be an InternalNode. | -| `key` | `Uint8Array` | The current key which leads to the corresponding node. | -| `childIndex` | `number` | The child index to add to the event queue. | -| `priority?` | `number` | Optional priority of the event, defaults to the total key length. | - -#### Returns - -`void` - -#### Defined in - -[util/walkController.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/walkController.ts#L117) - -___ - -### pushNodeToQueue - -▸ **pushNodeToQueue**(`nodeRef`, `key?`, `priority?`): `void` - -Push a node to the queue. If the queue has places left for tasks, the node is executed immediately, otherwise it is queued. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `nodeRef` | `Uint8Array` | Push a node reference to the event queue. This reference is a 32-byte keccak hash of the value corresponding to the `key`. | -| `key` | `Uint8Array` | The current key. | -| `priority?` | `number` | Optional priority, defaults to key length | - -#### Returns - -`void` - -#### Defined in - -[util/walkController.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/walkController.ts#L94) - -___ - -### newWalk - -▸ `Static` **newWalk**(`onNode`, `tree`, `root`, `poolSize?`): `Promise`<`void`\> - -Async function to create and start a new walk over a tree. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `onNode` | [`FoundNodeFunction`](../README.md#foundnodefunction) | The `FoundNodeFunction to call if a node is found. | -| `tree` | [`VerkleTree`](VerkleTree.md) | The tree to walk on. | -| `root` | `Uint8Array` | The root key to walk on. | -| `poolSize?` | `number` | Task execution pool size to prevent OOM errors. Defaults to 500. | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[util/walkController.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util/walkController.ts#L40) diff --git a/packages/verkle/docs/enums/VerkleNodeType.md b/packages/verkle/docs/enums/VerkleNodeType.md deleted file mode 100644 index abe82c0976e..00000000000 --- a/packages/verkle/docs/enums/VerkleNodeType.md +++ /dev/null @@ -1,30 +0,0 @@ -[@ethereumjs/verkle](../README.md) / VerkleNodeType - -# Enumeration: VerkleNodeType - -## Table of contents - -### Enumeration Members - -- [Internal](VerkleNodeType.md#internal) -- [Leaf](VerkleNodeType.md#leaf) - -## Enumeration Members - -### Internal - -• **Internal** = ``0`` - -#### Defined in - -[node/types.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L6) - -___ - -### Leaf - -• **Leaf** = ``1`` - -#### Defined in - -[node/types.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L7) diff --git a/packages/verkle/docs/functions/createCValues.md b/packages/verkle/docs/functions/createCValues.md new file mode 100644 index 00000000000..39b39350fda --- /dev/null +++ b/packages/verkle/docs/functions/createCValues.md @@ -0,0 +1,30 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / createCValues + +# Function: createCValues() + +> **createCValues**(`values`): `Uint8Array`\<`ArrayBufferLike`\>[] + +Defined in: [node/util.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L56) + +Converts 128 32byte values of a leaf node into an array of 256 32 byte values representing +the first and second 16 bytes of each value right padded with zeroes for generating a +commitment for half of a leaf node's values + +## Parameters + +### values + +(`Uint8Array`\<`ArrayBufferLike`\> \| [`LeafVerkleNodeValue`](../type-aliases/LeafVerkleNodeValue.md))[] + +an array of Uint8Arrays representing the first or second set of 128 values +stored by the verkle trie leaf node +Returns an array of 256 32 byte UintArrays with the leaf marker set for each value that is +deleted + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\>[] diff --git a/packages/verkle/docs/functions/createDefaultLeafVerkleValues.md b/packages/verkle/docs/functions/createDefaultLeafVerkleValues.md new file mode 100644 index 00000000000..479965b80df --- /dev/null +++ b/packages/verkle/docs/functions/createDefaultLeafVerkleValues.md @@ -0,0 +1,15 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / createDefaultLeafVerkleValues + +# Function: createDefaultLeafVerkleValues() + +> **createDefaultLeafVerkleValues**(): `any`[] + +Defined in: [node/util.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L44) + +## Returns + +`any`[] diff --git a/packages/verkle/docs/functions/createVerkleTree.md b/packages/verkle/docs/functions/createVerkleTree.md new file mode 100644 index 00000000000..a3cdbeef302 --- /dev/null +++ b/packages/verkle/docs/functions/createVerkleTree.md @@ -0,0 +1,21 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / createVerkleTree + +# Function: createVerkleTree() + +> **createVerkleTree**(`opts?`): `Promise`\<[`VerkleTree`](../classes/VerkleTree.md)\> + +Defined in: [constructors.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/constructors.ts#L9) + +## Parameters + +### opts? + +`Partial`\<[`VerkleTreeOpts`](../interfaces/VerkleTreeOpts.md)\> + +## Returns + +`Promise`\<[`VerkleTree`](../classes/VerkleTree.md)\> diff --git a/packages/verkle/docs/functions/createZeroesLeafValue.md b/packages/verkle/docs/functions/createZeroesLeafValue.md new file mode 100644 index 00000000000..5087b2dfd89 --- /dev/null +++ b/packages/verkle/docs/functions/createZeroesLeafValue.md @@ -0,0 +1,15 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / createZeroesLeafValue + +# Function: createZeroesLeafValue() + +> **createZeroesLeafValue**(): `Uint8Array`\<`ArrayBuffer`\> + +Defined in: [node/util.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L42) + +## Returns + +`Uint8Array`\<`ArrayBuffer`\> diff --git a/packages/verkle/docs/functions/decodeRawVerkleNode.md b/packages/verkle/docs/functions/decodeRawVerkleNode.md new file mode 100644 index 00000000000..a75cc7bfc73 --- /dev/null +++ b/packages/verkle/docs/functions/decodeRawVerkleNode.md @@ -0,0 +1,25 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / decodeRawVerkleNode + +# Function: decodeRawVerkleNode() + +> **decodeRawVerkleNode**(`raw`, `verkleCrypto`): [`VerkleNode`](../type-aliases/VerkleNode.md) + +Defined in: [node/util.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L10) + +## Parameters + +### raw + +`Uint8Array`\<`ArrayBufferLike`\>[] + +### verkleCrypto + +`VerkleCrypto` + +## Returns + +[`VerkleNode`](../type-aliases/VerkleNode.md) diff --git a/packages/verkle/docs/functions/decodeVerkleNode.md b/packages/verkle/docs/functions/decodeVerkleNode.md new file mode 100644 index 00000000000..6faab84e97d --- /dev/null +++ b/packages/verkle/docs/functions/decodeVerkleNode.md @@ -0,0 +1,25 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / decodeVerkleNode + +# Function: decodeVerkleNode() + +> **decodeVerkleNode**(`raw`, `verkleCrypto`): [`VerkleNode`](../type-aliases/VerkleNode.md) + +Defined in: [node/util.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L22) + +## Parameters + +### raw + +`Uint8Array` + +### verkleCrypto + +`VerkleCrypto` + +## Returns + +[`VerkleNode`](../type-aliases/VerkleNode.md) diff --git a/packages/verkle/docs/functions/dumpLeafValues.md b/packages/verkle/docs/functions/dumpLeafValues.md new file mode 100644 index 00000000000..d33eb4157d4 --- /dev/null +++ b/packages/verkle/docs/functions/dumpLeafValues.md @@ -0,0 +1,33 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / dumpLeafValues + +# Function: dumpLeafValues() + +> **dumpLeafValues**(`tree`, `startingNode`): `Promise`\<`undefined` \| \[`` `0x${string}` ``, `` `0x${string}` ``\][]\> + +Defined in: [util.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util.ts#L20) + +Recursively walks down the tree from a given starting node and returns all the leaf values + +## Parameters + +### tree + +[`VerkleTree`](../classes/VerkleTree.md) + +The verkle tree + +### startingNode + +`Uint8Array` + +The starting node + +## Returns + +`Promise`\<`undefined` \| \[`` `0x${string}` ``, `` `0x${string}` ``\][]\> + +An array of key-value pairs containing the tree keys and associated values diff --git a/packages/verkle/docs/functions/dumpNodeHashes.md b/packages/verkle/docs/functions/dumpNodeHashes.md new file mode 100644 index 00000000000..1d8cfeb6854 --- /dev/null +++ b/packages/verkle/docs/functions/dumpNodeHashes.md @@ -0,0 +1,33 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / dumpNodeHashes + +# Function: dumpNodeHashes() + +> **dumpNodeHashes**(`tree`, `startingNode`): `Promise`\<`undefined` \| \[`` `0x${string}` ``, `` `0x${string}` ``\][]\> + +Defined in: [util.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/util.ts#L55) + +Recursively walks down the tree from a given starting node and returns all the node paths and hashes + +## Parameters + +### tree + +[`VerkleTree`](../classes/VerkleTree.md) + +The verkle tree + +### startingNode + +`Uint8Array` + +The starting node + +## Returns + +`Promise`\<`undefined` \| \[`` `0x${string}` ``, `` `0x${string}` ``\][]\> + +An array of key-value pairs containing the tree paths and associated hashes diff --git a/packages/verkle/docs/functions/isInternalVerkleNode.md b/packages/verkle/docs/functions/isInternalVerkleNode.md new file mode 100644 index 00000000000..8d2b7a33cc9 --- /dev/null +++ b/packages/verkle/docs/functions/isInternalVerkleNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / isInternalVerkleNode + +# Function: isInternalVerkleNode() + +> **isInternalVerkleNode**(`node`): `node is InternalVerkleNode` + +Defined in: [node/util.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L38) + +## Parameters + +### node + +[`VerkleNode`](../type-aliases/VerkleNode.md) + +## Returns + +`node is InternalVerkleNode` diff --git a/packages/verkle/docs/functions/isLeafVerkleNode.md b/packages/verkle/docs/functions/isLeafVerkleNode.md new file mode 100644 index 00000000000..463cef23100 --- /dev/null +++ b/packages/verkle/docs/functions/isLeafVerkleNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / isLeafVerkleNode + +# Function: isLeafVerkleNode() + +> **isLeafVerkleNode**(`node`): `node is LeafVerkleNode` + +Defined in: [node/util.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L34) + +## Parameters + +### node + +[`VerkleNode`](../type-aliases/VerkleNode.md) + +## Returns + +`node is LeafVerkleNode` diff --git a/packages/verkle/docs/functions/isRawVerkleNode.md b/packages/verkle/docs/functions/isRawVerkleNode.md new file mode 100644 index 00000000000..90d49cb1eba --- /dev/null +++ b/packages/verkle/docs/functions/isRawVerkleNode.md @@ -0,0 +1,21 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / isRawVerkleNode + +# Function: isRawVerkleNode() + +> **isRawVerkleNode**(`node`): `node is Uint8Array[]` + +Defined in: [node/util.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/util.ts#L30) + +## Parameters + +### node + +`Uint8Array`\<`ArrayBufferLike`\> | `Uint8Array`\<`ArrayBufferLike`\>[] + +## Returns + +`node is Uint8Array[]` diff --git a/packages/verkle/docs/interfaces/CheckpointDBOpts.md b/packages/verkle/docs/interfaces/CheckpointDBOpts.md index 967fe434ebf..ffe77f256ff 100644 --- a/packages/verkle/docs/interfaces/CheckpointDBOpts.md +++ b/packages/verkle/docs/interfaces/CheckpointDBOpts.md @@ -1,34 +1,29 @@ -[@ethereumjs/verkle](../README.md) / CheckpointDBOpts +[**@ethereumjs/verkle**](../README.md) -# Interface: CheckpointDBOpts +*** -## Table of contents +[@ethereumjs/verkle](../README.md) / CheckpointDBOpts -### Properties +# Interface: CheckpointDBOpts -- [cacheSize](CheckpointDBOpts.md#cachesize) -- [db](CheckpointDBOpts.md#db) +Defined in: [types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L38) ## Properties -### cacheSize - -• `Optional` **cacheSize**: `number` +### cacheSize? -Cache size (default: 0) +> `optional` **cacheSize**: `number` -#### Defined in +Defined in: [types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L47) -[types.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L101) +Cache size (default: 0) -___ +*** ### db -• **db**: `DB`<`Uint8Array`, `Uint8Array`\> +> **db**: `DB`\<`Uint8Array`\<`ArrayBufferLike`\>, `Uint8Array`\<`ArrayBufferLike`\>\> -A database instance. +Defined in: [types.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L42) -#### Defined in - -[types.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L96) +A database instance. diff --git a/packages/verkle/docs/interfaces/ChildNode.md b/packages/verkle/docs/interfaces/ChildNode.md new file mode 100644 index 00000000000..1539cf09a27 --- /dev/null +++ b/packages/verkle/docs/interfaces/ChildNode.md @@ -0,0 +1,25 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / ChildNode + +# Interface: ChildNode + +Defined in: [node/types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L13) + +## Properties + +### commitment + +> **commitment**: `Uint8Array` + +Defined in: [node/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L14) + +*** + +### path + +> **path**: `Uint8Array` + +Defined in: [node/types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L15) diff --git a/packages/verkle/docs/interfaces/Fr.md b/packages/verkle/docs/interfaces/Fr.md deleted file mode 100644 index 2e57edb4885..00000000000 --- a/packages/verkle/docs/interfaces/Fr.md +++ /dev/null @@ -1,3 +0,0 @@ -[@ethereumjs/verkle](../README.md) / Fr - -# Interface: Fr diff --git a/packages/verkle/docs/interfaces/Point.md b/packages/verkle/docs/interfaces/Point.md deleted file mode 100644 index 50109e8a42d..00000000000 --- a/packages/verkle/docs/interfaces/Point.md +++ /dev/null @@ -1,300 +0,0 @@ -[@ethereumjs/verkle](../README.md) / Point - -# Interface: Point - -## Table of contents - -### Methods - -- [add](Point.md#add) -- [bytes](Point.md#bytes) -- [bytesUncompressed](Point.md#bytesuncompressed) -- [double](Point.md#double) -- [equal](Point.md#equal) -- [isOnCurve](Point.md#isoncurve) -- [mapToBaseField](Point.md#maptobasefield) -- [mapToScalarField](Point.md#maptoscalarfield) -- [neg](Point.md#neg) -- [normalise](Point.md#normalise) -- [scalarMul](Point.md#scalarmul) -- [set](Point.md#set) -- [setBytes](Point.md#setbytes) -- [setBytesUncompressed](Point.md#setbytesuncompressed) -- [setIdentity](Point.md#setidentity) -- [sub](Point.md#sub) - -## Methods - -### add - -▸ **add**(`point1`, `point2`): [`Point`](Point.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `point1` | [`Point`](Point.md) | -| `point2` | [`Point`](Point.md) | - -#### Returns - -[`Point`](Point.md) - -#### Defined in - -[types.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L41) - -___ - -### bytes - -▸ **bytes**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Defined in - -[types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L13) - -___ - -### bytesUncompressed - -▸ **bytesUncompressed**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Defined in - -[types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L15) - -___ - -### double - -▸ **double**(`point1`): [`Point`](Point.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `point1` | [`Point`](Point.md) | - -#### Returns - -[`Point`](Point.md) - -#### Defined in - -[types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L38) - -___ - -### equal - -▸ **equal**(`secondPoint`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `secondPoint` | [`Point`](Point.md) | - -#### Returns - -`boolean` - -#### Defined in - -[types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L32) - -___ - -### isOnCurve - -▸ **isOnCurve**(): `boolean` - -#### Returns - -`boolean` - -#### Defined in - -[types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L47) - -___ - -### mapToBaseField - -▸ **mapToBaseField**(): [`Point`](Point.md) - -#### Returns - -[`Point`](Point.md) - -#### Defined in - -[types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L26) - -___ - -### mapToScalarField - -▸ **mapToScalarField**(`field`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | [`Fr`](Fr.md) | - -#### Returns - -`void` - -#### Defined in - -[types.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L29) - -___ - -### neg - -▸ **neg**(): [`Point`](Point.md) - -#### Returns - -[`Point`](Point.md) - -#### Defined in - -[types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L55) - -___ - -### normalise - -▸ **normalise**(): `void` - -#### Returns - -`void` - -#### Defined in - -[types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L49) - -___ - -### scalarMul - -▸ **scalarMul**(`point1`, `scalarMont`): [`Point`](Point.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `point1` | [`Point`](Point.md) | -| `scalarMont` | [`Fr`](Fr.md) | - -#### Returns - -[`Point`](Point.md) - -#### Defined in - -[types.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L58) - -___ - -### set - -▸ **set**(): [`Point`](Point.md) - -#### Returns - -[`Point`](Point.md) - -#### Defined in - -[types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L52) - -___ - -### setBytes - -▸ **setBytes**(`bytes`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `bytes` | `Uint8Array` | - -#### Returns - -`void` - -#### Defined in - -[types.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L20) - -___ - -### setBytesUncompressed - -▸ **setBytesUncompressed**(`bytes`, `trusted`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `bytes` | `Uint8Array` | -| `trusted` | `boolean` | - -#### Returns - -`void` - -#### Defined in - -[types.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L23) - -___ - -### setIdentity - -▸ **setIdentity**(): [`Point`](Point.md) - -#### Returns - -[`Point`](Point.md) - -#### Defined in - -[types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L35) - -___ - -### sub - -▸ **sub**(`point1`, `point2`): [`Point`](Point.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `point1` | [`Point`](Point.md) | -| `point2` | [`Point`](Point.md) | - -#### Returns - -[`Point`](Point.md) - -#### Defined in - -[types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L44) diff --git a/packages/verkle/docs/interfaces/TypedVerkleNode.md b/packages/verkle/docs/interfaces/TypedVerkleNode.md index ffa0e038e8c..374b37d65ee 100644 --- a/packages/verkle/docs/interfaces/TypedVerkleNode.md +++ b/packages/verkle/docs/interfaces/TypedVerkleNode.md @@ -1,30 +1,25 @@ -[@ethereumjs/verkle](../README.md) / TypedVerkleNode +[**@ethereumjs/verkle**](../README.md) -# Interface: TypedVerkleNode +*** -## Table of contents +[@ethereumjs/verkle](../README.md) / TypedVerkleNode -### Properties +# Interface: TypedVerkleNode -- [0](TypedVerkleNode.md#0) -- [1](TypedVerkleNode.md#1) +Defined in: [node/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L17) ## Properties ### 0 -• **0**: [`InternalNode`](../classes/InternalNode.md) - -#### Defined in +> **0**: [`InternalVerkleNode`](../classes/InternalVerkleNode.md) -[node/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L11) +Defined in: [node/types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L18) -___ +*** ### 1 -• **1**: [`LeafNode`](../classes/LeafNode.md) - -#### Defined in +> **1**: [`LeafVerkleNode`](../classes/LeafVerkleNode.md) -[node/types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L12) +Defined in: [node/types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L19) diff --git a/packages/verkle/docs/interfaces/VerkleNodeInterface.md b/packages/verkle/docs/interfaces/VerkleNodeInterface.md index 925a518045d..a73ab2508bc 100644 --- a/packages/verkle/docs/interfaces/VerkleNodeInterface.md +++ b/packages/verkle/docs/interfaces/VerkleNodeInterface.md @@ -1,57 +1,33 @@ -[@ethereumjs/verkle](../README.md) / VerkleNodeInterface - -# Interface: VerkleNodeInterface +[**@ethereumjs/verkle**](../README.md) -## Implemented by +*** -- [`BaseVerkleNode`](../classes/BaseVerkleNode.md) - -## Table of contents +[@ethereumjs/verkle](../README.md) / VerkleNodeInterface -### Methods +# Interface: VerkleNodeInterface -- [commit](VerkleNodeInterface.md#commit) -- [hash](VerkleNodeInterface.md#hash) -- [serialize](VerkleNodeInterface.md#serialize) +Defined in: [node/types.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L24) ## Methods -### commit - -▸ **commit**(): [`Point`](Point.md) - -#### Returns +### hash() -[`Point`](Point.md) +> **hash**(): `Uint8Array` -#### Defined in - -[node/types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L18) - -___ - -### hash - -▸ **hash**(): `any` +Defined in: [node/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L25) #### Returns -`any` - -#### Defined in +`Uint8Array` -[node/types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L19) +*** -___ +### serialize() -### serialize +> **serialize**(): `Uint8Array` -▸ **serialize**(): `Uint8Array` +Defined in: [node/types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L26) #### Returns `Uint8Array` - -#### Defined in - -[node/types.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L20) diff --git a/packages/verkle/docs/interfaces/VerkleNodeOptions.md b/packages/verkle/docs/interfaces/VerkleNodeOptions.md index 070465d8705..8b3f761a3f9 100644 --- a/packages/verkle/docs/interfaces/VerkleNodeOptions.md +++ b/packages/verkle/docs/interfaces/VerkleNodeOptions.md @@ -1,30 +1,25 @@ -[@ethereumjs/verkle](../README.md) / VerkleNodeOptions +[**@ethereumjs/verkle**](../README.md) -# Interface: VerkleNodeOptions +*** -## Table of contents +[@ethereumjs/verkle](../README.md) / VerkleNodeOptions -### Properties +# Interface: VerkleNodeOptions -- [0](VerkleNodeOptions.md#0) -- [1](VerkleNodeOptions.md#1) +Defined in: [node/types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L52) ## Properties ### 0 -• **0**: `VerkleInternalNodeOptions` - -#### Defined in +> **0**: `InternalVerkleNodeOptions` -[node/types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L45) +Defined in: [node/types.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L53) -___ +*** ### 1 -• **1**: `VerkleLeafNodeOptions` - -#### Defined in +> **1**: `LeafVerkleNodeOptions` -[node/types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L46) +Defined in: [node/types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L54) diff --git a/packages/verkle/docs/interfaces/VerkleTreeOpts.md b/packages/verkle/docs/interfaces/VerkleTreeOpts.md index 2983d0edc03..64941aaa150 100644 --- a/packages/verkle/docs/interfaces/VerkleTreeOpts.md +++ b/packages/verkle/docs/interfaces/VerkleTreeOpts.md @@ -1,62 +1,61 @@ -[@ethereumjs/verkle](../README.md) / VerkleTreeOpts +[**@ethereumjs/verkle**](../README.md) -# Interface: VerkleTreeOpts +*** -## Table of contents +[@ethereumjs/verkle](../README.md) / VerkleTreeOpts -### Properties +# Interface: VerkleTreeOpts -- [cacheSize](VerkleTreeOpts.md#cachesize) -- [db](VerkleTreeOpts.md#db) -- [root](VerkleTreeOpts.md#root) -- [useRootPersistence](VerkleTreeOpts.md#userootpersistence) +Defined in: [types.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L10) ## Properties ### cacheSize -• `Optional` **cacheSize**: `number` +> **cacheSize**: `number` + +Defined in: [types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L35) LRU cache for tree nodes to allow for faster node retrieval. Default: 0 (deactivated) -#### Defined in - -[types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L84) - -___ +*** ### db -• `Optional` **db**: `DB`<`Uint8Array`, `Uint8Array`\> +> **db**: `DB`\<`Uint8Array`\<`ArrayBufferLike`\>, `Uint8Array`\<`ArrayBufferLike`\>\> -A database instance. +Defined in: [types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L18) -#### Defined in +A database instance. -[types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L67) +*** -___ +### root? -### root +> `optional` **root**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **root**: `Uint8Array` +Defined in: [types.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L23) A `Uint8Array` for the root of a previously stored tree -#### Defined in - -[types.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L72) - -___ +*** ### useRootPersistence -• `Optional` **useRootPersistence**: `boolean` +> **useRootPersistence**: `boolean` + +Defined in: [types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L28) Store the root inside the database after every `write` operation -#### Defined in +*** + +### verkleCrypto + +> **verkleCrypto**: `VerkleCrypto` + +Defined in: [types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L14) -[types.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L77) +An instantiated Verkle Cryptography interface diff --git a/packages/verkle/docs/type-aliases/Checkpoint.md b/packages/verkle/docs/type-aliases/Checkpoint.md new file mode 100644 index 00000000000..559b863e206 --- /dev/null +++ b/packages/verkle/docs/type-aliases/Checkpoint.md @@ -0,0 +1,27 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / Checkpoint + +# Type Alias: Checkpoint + +> **Checkpoint** = `object` + +Defined in: [types.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L50) + +## Properties + +### keyValueMap + +> **keyValueMap**: `Map`\<`string`, `Uint8Array` \| `undefined`\> + +Defined in: [types.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L53) + +*** + +### root + +> **root**: `Uint8Array` + +Defined in: [types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L54) diff --git a/packages/verkle/docs/type-aliases/Fr.md b/packages/verkle/docs/type-aliases/Fr.md new file mode 100644 index 00000000000..56bab0d9aea --- /dev/null +++ b/packages/verkle/docs/type-aliases/Fr.md @@ -0,0 +1,11 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / Fr + +# Type Alias: Fr + +> **Fr** = `object` + +Defined in: [types.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L6) diff --git a/packages/verkle/docs/type-aliases/LeafVerkleNodeValue.md b/packages/verkle/docs/type-aliases/LeafVerkleNodeValue.md new file mode 100644 index 00000000000..13555fc49cb --- /dev/null +++ b/packages/verkle/docs/type-aliases/LeafVerkleNodeValue.md @@ -0,0 +1,11 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / LeafVerkleNodeValue + +# Type Alias: LeafVerkleNodeValue + +> **LeafVerkleNodeValue** = *typeof* [`LeafVerkleNodeValue`](../variables/LeafVerkleNodeValue.md)\[keyof *typeof* [`LeafVerkleNodeValue`](../variables/LeafVerkleNodeValue.md)\] + +Defined in: [node/types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L39) diff --git a/packages/verkle/docs/type-aliases/Proof.md b/packages/verkle/docs/type-aliases/Proof.md new file mode 100644 index 00000000000..16dbda846e4 --- /dev/null +++ b/packages/verkle/docs/type-aliases/Proof.md @@ -0,0 +1,11 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / Proof + +# Type Alias: Proof + +> **Proof** = `Uint8Array`[] + +Defined in: [types.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L8) diff --git a/packages/verkle/docs/type-aliases/VerkleNode.md b/packages/verkle/docs/type-aliases/VerkleNode.md new file mode 100644 index 00000000000..b483ee535e9 --- /dev/null +++ b/packages/verkle/docs/type-aliases/VerkleNode.md @@ -0,0 +1,11 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / VerkleNode + +# Type Alias: VerkleNode + +> **VerkleNode** = [`TypedVerkleNode`](../interfaces/TypedVerkleNode.md)\[[`VerkleNodeType`](VerkleNodeType.md)\] + +Defined in: [node/types.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L22) diff --git a/packages/verkle/docs/type-aliases/VerkleNodeType.md b/packages/verkle/docs/type-aliases/VerkleNodeType.md new file mode 100644 index 00000000000..20b5a746e72 --- /dev/null +++ b/packages/verkle/docs/type-aliases/VerkleNodeType.md @@ -0,0 +1,11 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / VerkleNodeType + +# Type Alias: VerkleNodeType + +> **VerkleNodeType** = *typeof* [`VerkleNodeType`](../variables/VerkleNodeType.md)\[keyof *typeof* [`VerkleNodeType`](../variables/VerkleNodeType.md)\] + +Defined in: [node/types.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L6) diff --git a/packages/verkle/docs/variables/LeafVerkleNodeValue.md b/packages/verkle/docs/variables/LeafVerkleNodeValue.md new file mode 100644 index 00000000000..2b7fd8ac29d --- /dev/null +++ b/packages/verkle/docs/variables/LeafVerkleNodeValue.md @@ -0,0 +1,21 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / LeafVerkleNodeValue + +# Variable: LeafVerkleNodeValue + +> **LeafVerkleNodeValue**: `object` + +Defined in: [node/types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L39) + +## Type declaration + +### Deleted + +> `readonly` **Deleted**: `1` = `1` + +### Untouched + +> `readonly` **Untouched**: `0` = `0` diff --git a/packages/verkle/docs/variables/NODE_WIDTH.md b/packages/verkle/docs/variables/NODE_WIDTH.md new file mode 100644 index 00000000000..6af15be84f1 --- /dev/null +++ b/packages/verkle/docs/variables/NODE_WIDTH.md @@ -0,0 +1,11 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / NODE\_WIDTH + +# Variable: NODE\_WIDTH + +> `const` **NODE\_WIDTH**: `256` = `256` + +Defined in: [node/types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L57) diff --git a/packages/verkle/docs/variables/ROOT_DB_KEY.md b/packages/verkle/docs/variables/ROOT_DB_KEY.md new file mode 100644 index 00000000000..39395e3b459 --- /dev/null +++ b/packages/verkle/docs/variables/ROOT_DB_KEY.md @@ -0,0 +1,11 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / ROOT\_DB\_KEY + +# Variable: ROOT\_DB\_KEY + +> `const` **ROOT\_DB\_KEY**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/types.ts#L57) diff --git a/packages/verkle/docs/variables/VerkleNodeType.md b/packages/verkle/docs/variables/VerkleNodeType.md new file mode 100644 index 00000000000..e46f97b87eb --- /dev/null +++ b/packages/verkle/docs/variables/VerkleNodeType.md @@ -0,0 +1,21 @@ +[**@ethereumjs/verkle**](../README.md) + +*** + +[@ethereumjs/verkle](../README.md) / VerkleNodeType + +# Variable: VerkleNodeType + +> **VerkleNodeType**: `object` + +Defined in: [node/types.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/verkle/src/node/types.ts#L6) + +## Type declaration + +### Internal + +> `readonly` **Internal**: `0` = `0` + +### Leaf + +> `readonly` **Leaf**: `1` = `1` diff --git a/packages/verkle/package.json b/packages/verkle/package.json index df213f20892..13a493ff8b9 100644 --- a/packages/verkle/package.json +++ b/packages/verkle/package.json @@ -40,7 +40,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- verkle", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", diff --git a/packages/verkle/test/util.spec.ts b/packages/verkle/test/util.spec.ts index b72e97e1a81..89fac9627b0 100644 --- a/packages/verkle/test/util.spec.ts +++ b/packages/verkle/test/util.spec.ts @@ -1,11 +1,11 @@ -import { bytesToHex, hexToBytes } from '@ethereumjs/util' +import { type PrefixedHexString, bytesToHex, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' import { createVerkleTree } from '../src/index.ts' import { dumpLeafValues, dumpNodeHashes } from '../src/util.ts' // Values taken from verkle fixtures -const values = [ +const values: PrefixedHexString[][] = [ [ '0x0365b079a274a1808d56484ce5bd97914629907d75767f51439102e22cd50d00', '0x00000000000000000000000000000001000000000000003635c9adc5de9ccbaa', diff --git a/packages/verkle/typedoc.cjs b/packages/verkle/typedoc.cjs deleted file mode 100644 index 701fee055fa..00000000000 --- a/packages/verkle/typedoc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - extends: '../../config/typedoc.cjs', - entryPoints: ['src'], - out: 'docs', - exclude: ['test/**/*.ts'], -} diff --git a/packages/verkle/typedoc.mjs b/packages/verkle/typedoc.mjs new file mode 100644 index 00000000000..4f962d06684 --- /dev/null +++ b/packages/verkle/typedoc.mjs @@ -0,0 +1,6 @@ +export default { + extends: '../../config/typedoc.mjs', + entryPoints: ['src'], + out: 'docs', + exclude: ['test/**/*.ts'], +} diff --git a/packages/vm/README.md b/packages/vm/README.md index a9d4c0d7732..ee9a826be8e 100644 --- a/packages/vm/README.md +++ b/packages/vm/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/vm +# @ethereumjs/vm `v10` [![NPM Package][vm-npm-badge]][vm-npm-link] [![GitHub Issues][vm-issues-badge]][vm-issues-link] @@ -9,14 +9,36 @@ | Execution Context for the Ethereum EVM Implementation. | | ------------------------------------------------------ | -This package provides an Ethereum `mainnet` compatible execution context for the +Ethereum `mainnet` compatible execution context for [@ethereumjs/evm](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/evm) -EVM implementation. - -So beyond bytecode processing this package allows to run or build new Ethereum blocks or single transactions -and update a blockchain state accordingly. - -Note that up till `v5` this package also was the bundled package for the EVM implementation itself. +to build and run blocks and txs and update state. + +- 🦄 All hardforks up till **Pectra** +- 🌴 Tree-shakeable API +- 👷🏼 Controlled dependency set (7 external + `@Noble` crypto) +- 🧩 Flexible EIP on/off engine +- 📲 **EIP-7702** ready +- 📬 Flexible state retrieval (Merkle, RPC,...) +- 🔎 Passes official #Ethereum tests +- 🛵 668KB bundle size (170KB gzipped) +- 🏄🏾‍♂️ WASM-free default + Fully browser ready + +## Table of Contents + +- [Installation](#installation) +- [Usage](#usage) +- [Examples](#examples) +- [Browser](#browser) +- [API](#api) +- [Architecture](#architecture) +- [Setup](#setup) +- [Supported EIPs](#supported-eips) +- [Events](#events) +- [Understanding the VM](#understanding-the-vm) +- [Internal Structure](#internal-structure) +- [Development](#development) +- [EthereumJS](#ethereumjs) +- [License](#license) ## Installation @@ -26,7 +48,7 @@ To obtain the latest version, simply require the project using `npm`: npm install @ethereumjs/vm ``` -**Note:** Starting with the Dencun hardfork `EIP-4844` related functionality will become an integrated part of the EVM functionality with the activation of the point evaluation precompile. It is therefore strongly recommended to _always_ run the EVM with a KZG library installed and initialized, see [KZG Setup](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) for instructions. +**Note:** Starting with the Dencun hardfork `EIP-4844` related functionality has become an integrated part of the EVM functionality with the activation of the point evaluation precompile. For this precompile to work a separate installation of the KGZ library is necessary (we decided not to bundle due to large bundle sizes), see [KZG Setup](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) for instructions. ## Usage @@ -62,8 +84,6 @@ void main() Additionally to the `VM.runTx()` method there is an API method `VM.runBlock()` which allows to run the whole block and execute all included transactions along. -Note: with the switch from v7 to v8 the old direct `new VM()` constructor usage has been fully deprecated and a `VM` can now solely be instantiated with the async static `VM.create()` constructor. This also goes for the underlying `EVM` if you use a custom `EVM`. - ### Building a Block The VM package can also be used to construct a new valid block by executing and then integrating txs one-by-one. @@ -122,14 +142,12 @@ void main() This library by default uses JavaScript implementations for the basic standard crypto primitives like hashing or signature verification (for included txs). See `@ethereumjs/common` [README](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common) for instructions on how to replace with e.g. a more performant WASM implementation by using a shared `common` instance. -## Example +## Examples -This projects contain the following examples: +See the [examples](./examples/) folder for different meaningful examples on how to use the VM package and invoke certain aspects of it, e.g. running a complete block, a certain tx or using event listeners, among others. Some noteworthy examples to point out: 1. [./examples/run-blockchain](./examples/run-blockchain.ts): Loads tests data, including accounts and blocks, and runs all of them in the VM. -1. [./examples/run-solidity-contract](./examples/run-solidity-contract.ts): Compiles a Solidity contract, and calls constant and non-constant functions. - -All of the examples have their own `README.md` explaining how to run them. +2. [./examples/run-solidity-contract](./examples/run-solidity-contract.ts): Compiles a Solidity contract, and calls constant and non-constant functions. ## Browser @@ -186,44 +204,10 @@ With `VM` v6 the previously included `StateManager` has been extracted to its ow ## Setup -### Chain Support - -Starting with `v5.1.0` the VM supports running both `Ethash/PoW` and `Clique/PoA` blocks and transactions. Clique support has been added along the work on PR [#1032](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1032) and follow-up PRs and (block) validation checks and the switch of the execution context now happens correctly. - -### Ethash/PoW Chains - -`@ethereumjs/blockchain` validates the PoW algorithm with `@ethereumjs/ethash` and validates blocks' difficulty to match their canonical difficulty. - -### Clique/PoA Chains - -The following is a simple example for a block run on `Goerli`: - -```ts -// ./examples/runGoerliBlock.ts - -import { createBlockFromRPC } from '@ethereumjs/block' -import { Common } from '@ethereumjs/common' -import { bytesToHex } from '@ethereumjs/util' - -import { createVM, runBlock } from '../src/index.ts' -import { Goerli } from '../test/api/testdata/goerliCommon.ts' +### Chains +Beside the default Proof-of-Stake setup coming with the `Common` library default, the VM also support the execution of both `Ethash/PoW` and `Clique/PoA` blocks and transactions to allow to re-execute blocks from older hardforks or testnets. -import goerliBlock2 from './testData/goerliBlock2.json' - -const main = async () => { - const common = new Common({ chain: Goerli, hardfork: 'london' }) - const vm = await createVM({ common, setHardfork: true }) - - const block = createBlockFromRPC(goerliBlock2, undefined, { common }) - const result = await runBlock(vm, { block, generate: true, skipHeaderValidation: true }) // we skip header validation since we are running a block without the full Ethereum history available - console.log(`The state root for Goerli block 2 is ${bytesToHex(result.stateRoot)}`) -} - -void main() - -``` - -### Hardfork Support +### Hardforks For hardfork support see the [Hardfork Support](../evm#hardfork-support) section from the underlying `@ethereumjs/evm` instance. @@ -242,13 +226,7 @@ const main = async () => { const vm = await createVM({ common }) ``` -### Custom genesis state support - -#### Genesis in v7 (removed genesis dependency) - -Genesis state was huge and had previously been bundled with the `Blockchain` package with the burden going over to the VM, since `Blockchain` is a dependency. - -Starting with the v7 release genesis state has been removed from `blockchain` and moved into its own auxiliary package [@ethereumjs/genesis](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/genesis), from which it can be included if needed (for most - especially VM - use cases it is not necessary), see PR [#2844](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2844). +### Custom Genesis State For initializing a custom genesis state you can use the `genesisState` constructor option in the `Blockchain` and `VM` library in a similar way this had been done in the `Common` library before. @@ -284,13 +262,7 @@ void main() Genesis state can be configured to contain both EOAs as well as (system) contracts with initial storage values set. -#### Genesis in v6 - -For the v6 release responsibility for setting up a custom genesis state moved from the [Common](../common/) library to the `Blockchain` package, see PR [#1924](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1924) for some work context. - -A genesis state can be set along `Blockchain` creation by passing in a custom `genesisBlock` and `genesisState`. For `mainnet` and the official test networks like `sepolia` or `goerli` genesis is already provided with the block data coming from `@ethereumjs/common`. The genesis state is being integrated in the `Blockchain` library (see `genesisStates` folder). - -### EIP Support +## Supported EIPs It is possible to individually activate EIP support in the VM by instantiate the `Common` instance passed with the respective EIPs, e.g.: @@ -298,67 +270,40 @@ with the respective EIPs, e.g.: ```ts // ./examples/vmWithEIPs.ts -import { Common, Mainnet } from '@ethereumjs/common' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { createVM } from '@ethereumjs/vm' const main = async () => { - const common = new Common({ chain: Mainnet, eips: [7702] }) + const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) const vm = await createVM({ common }) - console.log(`EIP 7702 is active in the VM - ${vm.common.isActivatedEIP(7702)}`) + console.log(`EIP 7702 is active in isolation on top of the Cancun HF - ${vm.common.isActivatedEIP(7702)}`) } void main() ``` For a list with supported EIPs see the [@ethereumjs/evm](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/evm) documentation. -### EIP-4844 Shard Blob Transactions Support - -This library supports the blob transaction type introduced with [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844). +### EIP-4844 Shard Blob Transactions Support (Cancun) -### EIP-7702 EAO Code Transactions Support (outdated) +This library supports the blob transaction type introduced with [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844). EIP-4844 comes with a dedicated opcode `BLOBHASH` and has added a new point evaluation precompile at address `0x0a`. -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:** Usage of the point evaluation precompile 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. -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-7702 EAO Code Transactions Support (Prague) -### EIP-7685 Requests Support +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, 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. -This library supports blocks including the following [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) requests: +### EIP-7685 Requests Support (Prague) -- [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`+) +This library supports blocks including [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) requests to the consensus layer. ### 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 integration 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: - -```ts -// ./examples/vmWith4844.ts - -import { Common, Hardfork, Mainnet } from '@ethereumjs/common' - -import { createVM } from '../src/index.ts' - -const main = async () => { - const common = new Common({ chain: Mainnet, hardfork: Hardfork.Shanghai, eips: [4844] }) - const vm = await createVM({ common }) - console.log(`4844 is active in the VM - ${vm.common.isActivatedEIP(4844)}`) -} - -void main() - -``` +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. -EIP-4844 comes with a new opcode `BLOBHASH` and adds a new point evaluation precompile at address `0x14` in the underlying `@ethereumjs/evm` package. +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 a respective Verkle/Stateless hardfork. -**Note:** Usage of the point evaluation precompile 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. +## Events ### Tracing Events @@ -390,7 +335,7 @@ vm.events.on('afterTx', (event) => { Please note that there are additional EVM-specific events in the [@ethereumjs/evm](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/evm) package. -#### Asynchronous event handlers +### Asynchronous event handlers You can perform asynchronous operations from within an event handler and prevent the VM to keep running until they finish. @@ -404,7 +349,7 @@ handler or a function called by it, the exception will bubble into the VM and interrupt it, possibly corrupting its state. It's strongly recommended not to do that. -#### Synchronous event handlers +### Synchronous event handlers If you want to perform synchronous operations, you don't need to receive a function as the handler's second argument, nor call it. diff --git a/packages/vm/docs/README.md b/packages/vm/docs/README.md index 457d77a246e..6bbc81f1196 100644 --- a/packages/vm/docs/README.md +++ b/packages/vm/docs/README.md @@ -1,19 +1,15 @@ -@ethereumjs/vm +**@ethereumjs/vm** -# @ethereumjs/vm - -## Table of contents - -### Enumerations +*** -- [BuildStatus](enums/BuildStatus.md) +# @ethereumjs/vm -### Classes +## Classes - [BlockBuilder](classes/BlockBuilder.md) - [VM](classes/VM.md) -### Interfaces +## Interfaces - [AfterBlockEvent](interfaces/AfterBlockEvent.md) - [AfterTxEvent](interfaces/AfterTxEvent.md) @@ -31,98 +27,22 @@ - [SealBlockOpts](interfaces/SealBlockOpts.md) - [VMOpts](interfaces/VMOpts.md) -### Type Aliases - -- [EVMProfilerOpts](README.md#evmprofileropts) -- [TxReceipt](README.md#txreceipt) -- [VMEvents](README.md#vmevents) -- [VMProfilerOpts](README.md#vmprofileropts) - -### Functions - -- [encodeReceipt](README.md#encodereceipt) - ## Type Aliases -### EVMProfilerOpts - -Ƭ **EVMProfilerOpts**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `enabled` | `boolean` | - -#### Defined in - -[vm/src/types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L67) - -___ - -### TxReceipt - -Ƭ **TxReceipt**: [`PreByzantiumTxReceipt`](interfaces/PreByzantiumTxReceipt.md) \| [`PostByzantiumTxReceipt`](interfaces/PostByzantiumTxReceipt.md) \| [`EIP4844BlobTxReceipt`](interfaces/EIP4844BlobTxReceipt.md) - -#### Defined in - -[vm/src/types.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L8) - -___ +- [BuildStatus](type-aliases/BuildStatus.md) +- [EVMProfilerOpts](type-aliases/EVMProfilerOpts.md) +- [TxReceipt](type-aliases/TxReceipt.md) +- [VMEvent](type-aliases/VMEvent.md) +- [VMProfilerOpts](type-aliases/VMProfilerOpts.md) -### VMEvents +## Variables -Ƭ **VMEvents**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `afterBlock` | (`data`: [`AfterBlockEvent`](interfaces/AfterBlockEvent.md), `resolve?`: (`result?`: `any`) => `void`) => `void` | -| `afterTx` | (`data`: [`AfterTxEvent`](interfaces/AfterTxEvent.md), `resolve?`: (`result?`: `any`) => `void`) => `void` | -| `beforeBlock` | (`data`: `Block`, `resolve?`: (`result?`: `any`) => `void`) => `void` | -| `beforeTx` | (`data`: `TypedTransaction`, `resolve?`: (`result?`: `any`) => `void`) => `void` | - -#### Defined in - -[vm/src/types.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L72) - -___ - -### VMProfilerOpts - -Ƭ **VMProfilerOpts**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `reportAfterBlock?` | `boolean` | -| `reportAfterTx?` | `boolean` | - -#### Defined in - -[vm/src/types.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L79) +- [BuildStatus](variables/BuildStatus.md) +- [paramsVM](variables/paramsVM.md) ## Functions -### encodeReceipt - -▸ **encodeReceipt**(`receipt`, `txType`): `Uint8Array` - -Returns the encoded tx receipt. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `receipt` | [`TxReceipt`](README.md#txreceipt) | -| `txType` | `TransactionType` | - -#### Returns - -`Uint8Array` - -#### Defined in - -[vm/src/runBlock.ts:689](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/runBlock.ts#L689) +- [buildBlock](functions/buildBlock.md) +- [createVM](functions/createVM.md) +- [encodeReceipt](functions/encodeReceipt.md) +- [runBlock](functions/runBlock.md) diff --git a/packages/vm/docs/classes/BlockBuilder.md b/packages/vm/docs/classes/BlockBuilder.md index a5f41a6d0ff..fedaea2d583 100644 --- a/packages/vm/docs/classes/BlockBuilder.md +++ b/packages/vm/docs/classes/BlockBuilder.md @@ -1,108 +1,90 @@ -[@ethereumjs/vm](../README.md) / BlockBuilder - -# Class: BlockBuilder +[**@ethereumjs/vm**](../README.md) -## Table of contents +*** -### Constructors - -- [constructor](BlockBuilder.md#constructor) +[@ethereumjs/vm](../README.md) / BlockBuilder -### Properties +# Class: BlockBuilder -- [blobGasUsed](BlockBuilder.md#blobgasused) -- [gasUsed](BlockBuilder.md#gasused) +Defined in: [vm/src/buildBlock.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L56) -### Accessors +## Constructors -- [minerValue](BlockBuilder.md#minervalue) -- [transactionReceipts](BlockBuilder.md#transactionreceipts) +### Constructor -### Methods +> **new BlockBuilder**(`vm`, `opts`): `BlockBuilder` -- [addTransaction](BlockBuilder.md#addtransaction) -- [build](BlockBuilder.md#build) -- [getStatus](BlockBuilder.md#getstatus) -- [initState](BlockBuilder.md#initstate) -- [logsBloom](BlockBuilder.md#logsbloom) -- [receiptTrie](BlockBuilder.md#receipttrie) -- [revert](BlockBuilder.md#revert) -- [transactionsTrie](BlockBuilder.md#transactionstrie) +Defined in: [vm/src/buildBlock.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L88) -## Constructors +#### Parameters -### constructor +##### vm -• **new BlockBuilder**(`vm`, `opts`) +[`VM`](VM.md) -#### Parameters +##### opts -| Name | Type | -| :------ | :------ | -| `vm` | [`VM`](VM.md) | -| `opts` | [`BuildBlockOpts`](../interfaces/BuildBlockOpts.md) | +[`BuildBlockOpts`](../interfaces/BuildBlockOpts.md) -#### Defined in +#### Returns -[vm/src/buildBlock.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L76) +`BlockBuilder` ## Properties ### blobGasUsed -• **blobGasUsed**: `bigint` = `BIGINT_0` - -The cumulative blob gas used by the blobs in a block +> **blobGasUsed**: `bigint` = `BIGINT_0` -#### Defined in +Defined in: [vm/src/buildBlock.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L64) -[vm/src/buildBlock.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L52) +The cumulative blob gas used by the blobs in a block -___ +*** ### gasUsed -• **gasUsed**: `bigint` = `BIGINT_0` - -The cumulative gas used by the transactions added to the block. +> **gasUsed**: `bigint` = `BIGINT_0` -#### Defined in +Defined in: [vm/src/buildBlock.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L60) -[vm/src/buildBlock.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L48) +The cumulative gas used by the transactions added to the block. ## Accessors ### minerValue -• `get` **minerValue**(): `bigint` +#### Get Signature -#### Returns +> **get** **minerValue**(): `bigint` -`bigint` +Defined in: [vm/src/buildBlock.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L84) -#### Defined in +##### Returns -[vm/src/buildBlock.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L72) +`bigint` -___ +*** ### transactionReceipts -• `get` **transactionReceipts**(): [`TxReceipt`](../README.md#txreceipt)[] +#### Get Signature -#### Returns +> **get** **transactionReceipts**(): [`TxReceipt`](../type-aliases/TxReceipt.md)[] -[`TxReceipt`](../README.md#txreceipt)[] +Defined in: [vm/src/buildBlock.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L80) -#### Defined in +##### Returns -[vm/src/buildBlock.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L68) +[`TxReceipt`](../type-aliases/TxReceipt.md)[] ## Methods -### addTransaction +### addTransaction() + +> **addTransaction**(`tx`, `__namedParameters`): `Promise`\<[`RunTxResult`](../interfaces/RunTxResult.md)\> -▸ **addTransaction**(`tx`, `__namedParameters?`): `Promise`<[`RunTxResult`](../interfaces/RunTxResult.md)\> +Defined in: [vm/src/buildBlock.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L218) Run and add a transaction to the block being built. Please note that this modifies the state of the VM. @@ -111,27 +93,33 @@ the remaining gas in the block. #### Parameters -| Name | Type | -| :------ | :------ | -| `tx` | `TypedTransaction` | -| `__namedParameters` | `Object` | -| `__namedParameters.skipHardForkValidation?` | `boolean` | +##### tx -#### Returns +`TypedTransaction` + +##### \_\_namedParameters + +###### allowNoBlobs? -`Promise`<[`RunTxResult`](../interfaces/RunTxResult.md)\> +`boolean` -#### Defined in +###### skipHardForkValidation? -[vm/src/buildBlock.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L203) +`boolean` -___ +#### Returns + +`Promise`\<[`RunTxResult`](../interfaces/RunTxResult.md)\> + +*** -### build +### build() -▸ **build**(`sealOpts?`): `Promise`<`Block`\> +> **build**(`sealOpts?`): `Promise`\<\{ `block`: `Block`; `requests`: `undefined` \| `CLRequest`\<`CLRequestType`\>[]; \}\> -This method returns the finalized block. +Defined in: [vm/src/buildBlock.ts:320](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L320) + +This method constructs the finalized block, including withdrawals and any CLRequests. It also: - Assigns the reward for miner (PoW) - Commits the checkpoint on the StateManager @@ -141,108 +129,95 @@ which is validated along with the block number and difficulty by ethash. For PoA, please pass `blockOption.cliqueSigner` into the buildBlock constructor, as the signer will be awarded the txs amount spent on gas as they are added. +Note: we add CLRequests here because they can be generated at any time during the +lifecycle of a pending block so need to be provided only when the block is finalized. + #### Parameters -| Name | Type | -| :------ | :------ | -| `sealOpts?` | [`SealBlockOpts`](../interfaces/SealBlockOpts.md) | +##### sealOpts? -#### Returns +[`SealBlockOpts`](../interfaces/SealBlockOpts.md) -`Promise`<`Block`\> +#### Returns -#### Defined in +`Promise`\<\{ `block`: `Block`; `requests`: `undefined` \| `CLRequest`\<`CLRequestType`\>[]; \}\> -[vm/src/buildBlock.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L293) +*** -___ +### getStatus() -### getStatus +> **getStatus**(): `BlockStatus` -▸ **getStatus**(): `BlockStatus` +Defined in: [vm/src/buildBlock.ts:140](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L140) #### Returns `BlockStatus` -#### Defined in - -[vm/src/buildBlock.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L128) +*** -___ +### initState() -### initState +> **initState**(): `Promise`\<`void`\> -▸ **initState**(): `Promise`<`void`\> +Defined in: [vm/src/buildBlock.ts:404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L404) #### Returns -`Promise`<`void`\> +`Promise`\<`void`\> -#### Defined in +*** -[vm/src/buildBlock.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L357) +### logsBloom() -___ +> **logsBloom**(): `Uint8Array`\<`ArrayBufferLike`\> -### logsBloom - -▸ **logsBloom**(): `Uint8Array` +Defined in: [vm/src/buildBlock.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L157) Calculates and returns the logs bloom for the block. #### Returns -`Uint8Array` - -#### Defined in +`Uint8Array`\<`ArrayBufferLike`\> -[vm/src/buildBlock.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L142) +*** -___ +### receiptTrie() -### receiptTrie +> **receiptTrie**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **receiptTrie**(): `Promise`<`Uint8Array`\> +Defined in: [vm/src/buildBlock.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L169) Calculates and returns the receiptTrie for the block. #### Returns -`Promise`<`Uint8Array`\> +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -#### Defined in +*** -[vm/src/buildBlock.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L154) +### revert() -___ +> **revert**(): `Promise`\<`void`\> -### revert - -▸ **revert**(): `Promise`<`void`\> +Defined in: [vm/src/buildBlock.ts:298](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L298) Reverts the checkpoint on the StateManager to reset the state from any transactions that have been run. #### Returns -`Promise`<`void`\> - -#### Defined in +`Promise`\<`void`\> -[vm/src/buildBlock.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L274) +*** -___ +### transactionsTrie() -### transactionsTrie +> **transactionsTrie**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -▸ **transactionsTrie**(): `Promise`<`Uint8Array`\> +Defined in: [vm/src/buildBlock.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L147) Calculates and returns the transactionsTrie for the block. #### Returns -`Promise`<`Uint8Array`\> - -#### Defined in - -[vm/src/buildBlock.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L135) +`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> diff --git a/packages/vm/docs/classes/VM.md b/packages/vm/docs/classes/VM.md index 75a7725c366..35ff9149a96 100644 --- a/packages/vm/docs/classes/VM.md +++ b/packages/vm/docs/classes/VM.md @@ -1,124 +1,95 @@ +[**@ethereumjs/vm**](../README.md) + +*** + [@ethereumjs/vm](../README.md) / VM # Class: VM +Defined in: [vm/src/vm.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L16) + Execution engine which can be used to run a blockchain, individual blocks, individual transactions, or snippets of EVM bytecode. -This class is an AsyncEventEmitter, please consult the README to learn how to use it. +## Constructors + +### Constructor + +> **new VM**(`opts`): `VM` -## Table of contents +Defined in: [vm/src/vm.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L65) -### Properties +Instantiates a new VM Object. -- [blockchain](VM.md#blockchain) -- [common](VM.md#common) -- [events](VM.md#events) -- [evm](VM.md#evm) -- [stateManager](VM.md#statemanager) +#### Parameters + +##### opts + +[`VMOpts`](../interfaces/VMOpts.md) = `{}` + +#### Returns -### Methods +`VM` -- [buildBlock](VM.md#buildblock) -- [errorStr](VM.md#errorstr) -- [runBlock](VM.md#runblock) -- [runTx](VM.md#runtx) -- [shallowCopy](VM.md#shallowcopy) -- [create](VM.md#create) +#### Deprecated + +The direct usage of this constructor is discouraged since +non-finalized async initialization might lead to side effects. Please +use the async [createVM](../functions/createVM.md) constructor instead (same API). ## Properties ### blockchain -• `Readonly` **blockchain**: `BlockchainInterface` - -The blockchain the VM operates on +> `readonly` **blockchain**: `EVMMockBlockchainInterface` -#### Defined in +Defined in: [vm/src/vm.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L25) -[vm/src/vm.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L42) +The blockchain the VM operates on -___ +*** ### common -• `Readonly` **common**: `Common` - -#### Defined in +> `readonly` **common**: `Common` -[vm/src/vm.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L44) +Defined in: [vm/src/vm.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L27) -___ +*** ### events -• `Readonly` **events**: `AsyncEventEmitter`<[`VMEvents`](../README.md#vmevents)\> +> `readonly` **events**: `EventEmitter`\<[`VMEvent`](../type-aliases/VMEvent.md)\> -#### Defined in +Defined in: [vm/src/vm.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L29) -[vm/src/vm.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L46) - -___ +*** ### evm -• `Readonly` **evm**: `EVMInterface` - -The EVM used for bytecode execution +> `readonly` **evm**: `EVMInterface` -#### Defined in +Defined in: [vm/src/vm.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L33) -[vm/src/vm.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L50) +The EVM used for bytecode execution -___ +*** ### stateManager -• `Readonly` **stateManager**: `EVMStateManagerInterface` +> `readonly` **stateManager**: `StateManagerInterface` -The StateManager used by the VM - -#### Defined in +Defined in: [vm/src/vm.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L20) -[vm/src/vm.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L37) +The StateManager used by the VM ## Methods -### buildBlock - -▸ **buildBlock**(`opts`): `Promise`<[`BlockBuilder`](BlockBuilder.md)\> - -Build a block on top of the current state -by adding one transaction at a time. - -Creates a checkpoint on the StateManager and modifies the state -as transactions are run. The checkpoint is committed on [build](BlockBuilder.md#build) -or discarded with [revert](BlockBuilder.md#revert). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`BuildBlockOpts`](../interfaces/BuildBlockOpts.md) | +### errorStr() -#### Returns - -`Promise`<[`BlockBuilder`](BlockBuilder.md)\> - -An instance of [BlockBuilder](BlockBuilder.md) with methods: -- [addTransaction](BlockBuilder.md#addtransaction) -- [build](BlockBuilder.md#build) -- [revert](BlockBuilder.md#revert) - -#### Defined in - -[vm/src/vm.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L222) +> **errorStr**(): `string` -___ - -### errorStr - -▸ **errorStr**(): `string` +Defined in: [vm/src/vm.ts:134](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L134) Return a compact error string representation of the object @@ -126,110 +97,32 @@ Return a compact error string representation of the object `string` -#### Defined in - -[vm/src/vm.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L264) - -___ +*** -### runBlock +### shallowCopy() -▸ **runBlock**(`opts`): `Promise`<[`RunBlockResult`](../interfaces/RunBlockResult.md)\> +> **shallowCopy**(`downlevelCaches`): `Promise`\<`VM`\> -Processes the `block` running all of the transactions it contains and updating the miner's account +Defined in: [vm/src/vm.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L109) -This method modifies the state. If `generate` is `true`, the state modifications will be -reverted if an exception is raised. If it's `false`, it won't revert if the block's header is -invalid. If an error is thrown from an event handler, the state may or may not be reverted. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts` | [`RunBlockOpts`](../interfaces/RunBlockOpts.md) | Default values for options: - `generate`: false | - -#### Returns - -`Promise`<[`RunBlockResult`](../interfaces/RunBlockResult.md)\> - -#### Defined in - -[vm/src/vm.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L191) - -___ - -### runTx - -▸ **runTx**(`opts`): `Promise`<[`RunTxResult`](../interfaces/RunTxResult.md)\> - -Process a transaction. Run the vm. Transfers eth. Checks balances. - -This method modifies the state. If an error is thrown, the modifications are reverted, except -when the error is thrown from an event handler. In the latter case the state may or may not be -reverted. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`RunTxOpts`](../interfaces/RunTxOpts.md) | - -#### Returns - -`Promise`<[`RunTxResult`](../interfaces/RunTxResult.md)\> - -#### Defined in - -[vm/src/vm.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L204) - -___ - -### shallowCopy - -▸ **shallowCopy**(`downlevelCaches?`): `Promise`<[`VM`](VM.md)\> - -Returns a copy of the [VM](VM.md) instance. +Returns a copy of the VM instance. Note that the returned copy will share the same db as the original for the blockchain and the statemanager. Associated caches will be deleted and caches will be re-initialized for a more short-term focused usage, being less memory intense (the statemanager caches will switch to using an ORDERED_MAP cache -datastructure more suitable for short-term usage, the trie node LRU cache will not be activated at all). +data structure more suitable for short-term usage, the trie node LRU cache will not be activated at all). To fine-tune this behavior (if the shallow-copy-returned object has a longer life span e.g.) you can set the `downlevelCaches` option to `false`. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `downlevelCaches` | `boolean` | `true` | Downlevel (so: adopted for short-term usage) associated state caches (default: true) | - -#### Returns - -`Promise`<[`VM`](VM.md)\> +##### downlevelCaches -#### Defined in +`boolean` = `true` -[vm/src/vm.ts:239](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L239) - -___ - -### create - -▸ `Static` **create**(`opts?`): `Promise`<[`VM`](VM.md)\> - -VM async constructor. Creates engine instance and initializes it. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts` | [`VMOpts`](../interfaces/VMOpts.md) | VM engine constructor options | +Downlevel (so: adopted for short-term usage) associated state caches (default: true) #### Returns -`Promise`<[`VM`](VM.md)\> - -#### Defined in - -[vm/src/vm.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L79) +`Promise`\<`VM`\> diff --git a/packages/vm/docs/enums/BuildStatus.md b/packages/vm/docs/enums/BuildStatus.md deleted file mode 100644 index 0dbc4cacb0e..00000000000 --- a/packages/vm/docs/enums/BuildStatus.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/vm](../README.md) / BuildStatus - -# Enumeration: BuildStatus - -## Table of contents - -### Enumeration Members - -- [Build](BuildStatus.md#build) -- [Pending](BuildStatus.md#pending) -- [Reverted](BuildStatus.md#reverted) - -## Enumeration Members - -### Build - -• **Build** = ``"build"`` - -#### Defined in - -[vm/src/buildBlock.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L36) - -___ - -### Pending - -• **Pending** = ``"pending"`` - -#### Defined in - -[vm/src/buildBlock.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L37) - -___ - -### Reverted - -• **Reverted** = ``"reverted"`` - -#### Defined in - -[vm/src/buildBlock.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L35) diff --git a/packages/vm/docs/functions/buildBlock.md b/packages/vm/docs/functions/buildBlock.md new file mode 100644 index 00000000000..0b9cff93e3f --- /dev/null +++ b/packages/vm/docs/functions/buildBlock.md @@ -0,0 +1,37 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / buildBlock + +# Function: buildBlock() + +> **buildBlock**(`vm`, `opts`): `Promise`\<[`BlockBuilder`](../classes/BlockBuilder.md)\> + +Defined in: [vm/src/buildBlock.ts:450](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L450) + +Build a block on top of the current state +by adding one transaction at a time. + +Creates a checkpoint on the StateManager and modifies the state +as transactions are run. The checkpoint is committed on [BlockBuilder.build](../classes/BlockBuilder.md#build) +or discarded with [BlockBuilder.revert](../classes/BlockBuilder.md#revert). + +## Parameters + +### vm + +[`VM`](../classes/VM.md) + +### opts + +[`BuildBlockOpts`](../interfaces/BuildBlockOpts.md) + +## Returns + +`Promise`\<[`BlockBuilder`](../classes/BlockBuilder.md)\> + +An instance of [BlockBuilder](../classes/BlockBuilder.md) with methods: +- [BlockBuilder.addTransaction](../classes/BlockBuilder.md#addtransaction) +- [BlockBuilder.build](../classes/BlockBuilder.md#build) +- [BlockBuilder.revert](../classes/BlockBuilder.md#revert) diff --git a/packages/vm/docs/functions/createVM.md b/packages/vm/docs/functions/createVM.md new file mode 100644 index 00000000000..5c391f9a981 --- /dev/null +++ b/packages/vm/docs/functions/createVM.md @@ -0,0 +1,25 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / createVM + +# Function: createVM() + +> **createVM**(`opts`): `Promise`\<[`VM`](../classes/VM.md)\> + +Defined in: [vm/src/constructors.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/constructors.ts#L21) + +VM async constructor. Creates engine instance and initializes it. + +## Parameters + +### opts + +[`VMOpts`](../interfaces/VMOpts.md) = `{}` + +VM engine constructor options + +## Returns + +`Promise`\<[`VM`](../classes/VM.md)\> diff --git a/packages/vm/docs/functions/encodeReceipt.md b/packages/vm/docs/functions/encodeReceipt.md new file mode 100644 index 00000000000..b659b7a408d --- /dev/null +++ b/packages/vm/docs/functions/encodeReceipt.md @@ -0,0 +1,27 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / encodeReceipt + +# Function: encodeReceipt() + +> **encodeReceipt**(`receipt`, `txType`): `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [vm/src/runBlock.ts:834](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/runBlock.ts#L834) + +Returns the encoded tx receipt. + +## Parameters + +### receipt + +[`TxReceipt`](../type-aliases/TxReceipt.md) + +### txType + +`0` | `1` | `2` | `3` | `4` + +## Returns + +`Uint8Array`\<`ArrayBufferLike`\> diff --git a/packages/vm/docs/functions/runBlock.md b/packages/vm/docs/functions/runBlock.md new file mode 100644 index 00000000000..0b7011aec38 --- /dev/null +++ b/packages/vm/docs/functions/runBlock.md @@ -0,0 +1,34 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / runBlock + +# Function: runBlock() + +> **runBlock**(`vm`, `opts`): `Promise`\<[`RunBlockResult`](../interfaces/RunBlockResult.md)\> + +Defined in: [vm/src/runBlock.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/runBlock.ts#L75) + +Processes the `block` running all of the transactions it contains and updating the miner's account + +vm method modifies the state. If `generate` is `true`, the state modifications will be +reverted if an exception is raised. If it's `false`, it won't revert if the block's header is +invalid. If an error is thrown from an event handler, the state may or may not be reverted. + +## Parameters + +### vm + +[`VM`](../classes/VM.md) + +### opts + +[`RunBlockOpts`](../interfaces/RunBlockOpts.md) + +Default values for options: + - `generate`: false + +## Returns + +`Promise`\<[`RunBlockResult`](../interfaces/RunBlockResult.md)\> diff --git a/packages/vm/docs/interfaces/AfterBlockEvent.md b/packages/vm/docs/interfaces/AfterBlockEvent.md index 3ac5f6475e0..d059bd9b668 100644 --- a/packages/vm/docs/interfaces/AfterBlockEvent.md +++ b/packages/vm/docs/interfaces/AfterBlockEvent.md @@ -1,146 +1,149 @@ -[@ethereumjs/vm](../README.md) / AfterBlockEvent - -# Interface: AfterBlockEvent +[**@ethereumjs/vm**](../README.md) -Result of runBlock +*** -## Hierarchy +[@ethereumjs/vm](../README.md) / AfterBlockEvent -- [`RunBlockResult`](RunBlockResult.md) +# Interface: AfterBlockEvent - ↳ **`AfterBlockEvent`** +Defined in: [vm/src/types.ts:377](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L377) -## Table of contents +Result of [runBlock](../functions/runBlock.md) -### Properties +## Extends -- [block](AfterBlockEvent.md#block) -- [gasUsed](AfterBlockEvent.md#gasused) -- [logsBloom](AfterBlockEvent.md#logsbloom) -- [preimages](AfterBlockEvent.md#preimages) -- [receipts](AfterBlockEvent.md#receipts) -- [receiptsRoot](AfterBlockEvent.md#receiptsroot) -- [results](AfterBlockEvent.md#results) -- [stateRoot](AfterBlockEvent.md#stateroot) +- [`RunBlockResult`](RunBlockResult.md) ## Properties ### block -• **block**: `Block` - -#### Defined in +> **block**: `Block` -[vm/src/types.ts:331](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L331) +Defined in: [vm/src/types.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L379) -___ +*** ### gasUsed -• **gasUsed**: `bigint` +> **gasUsed**: `bigint` + +Defined in: [vm/src/types.ts:335](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L335) The gas used after executing the block #### Inherited from -[RunBlockResult](RunBlockResult.md).[gasUsed](RunBlockResult.md#gasused) - -#### Defined in +[`RunBlockResult`](RunBlockResult.md).[`gasUsed`](RunBlockResult.md#gasused) -[vm/src/types.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L296) - -___ +*** ### logsBloom -• **logsBloom**: `Uint8Array` +> **logsBloom**: `Uint8Array` + +Defined in: [vm/src/types.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L365) The bloom filter of the LOGs (events) after executing the block #### Inherited from -[RunBlockResult](RunBlockResult.md).[logsBloom](RunBlockResult.md#logsbloom) - -#### Defined in +[`RunBlockResult`](RunBlockResult.md).[`logsBloom`](RunBlockResult.md#logsbloom) -[vm/src/types.ts:326](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L326) +*** -___ +### preimages? -### preimages +> `optional` **preimages**: `Map`\<`` `0x${string}` ``, `Uint8Array`\<`ArrayBufferLike`\>\> -• `Optional` **preimages**: `Map`<`string`, `Uint8Array`\> +Defined in: [vm/src/types.ts:351](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L351) Preimages mapping of the touched accounts from the block (see reportPreimages option) #### Inherited from -[RunBlockResult](RunBlockResult.md).[preimages](RunBlockResult.md#preimages) - -#### Defined in - -[vm/src/types.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L312) +[`RunBlockResult`](RunBlockResult.md).[`preimages`](RunBlockResult.md#preimages) -___ +*** ### receipts -• **receipts**: [`TxReceipt`](../README.md#txreceipt)[] +> **receipts**: [`TxReceipt`](../type-aliases/TxReceipt.md)[] + +Defined in: [vm/src/types.ts:343](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L343) Receipts generated for transactions in the block #### Inherited from -[RunBlockResult](RunBlockResult.md).[receipts](RunBlockResult.md#receipts) - -#### Defined in - -[vm/src/types.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L304) +[`RunBlockResult`](RunBlockResult.md).[`receipts`](RunBlockResult.md#receipts) -___ +*** ### receiptsRoot -• **receiptsRoot**: `Uint8Array` +> **receiptsRoot**: `Uint8Array` + +Defined in: [vm/src/types.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L339) The receipt root after executing the block #### Inherited from -[RunBlockResult](RunBlockResult.md).[receiptsRoot](RunBlockResult.md#receiptsroot) +[`RunBlockResult`](RunBlockResult.md).[`receiptsRoot`](RunBlockResult.md#receiptsroot) -#### Defined in +*** -[vm/src/types.ts:300](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L300) +### requests? -___ +> `optional` **requests**: `CLRequest`\<`CLRequestType`\>[] -### results +Defined in: [vm/src/types.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L374) -• **results**: [`RunTxResult`](RunTxResult.md)[] +Any CL requests that were processed in the course of this block -Results of executing the transactions in the block +#### Inherited from + +[`RunBlockResult`](RunBlockResult.md).[`requests`](RunBlockResult.md#requests) + +*** + +### requestsHash? + +> `optional` **requestsHash**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [vm/src/types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L370) + +The requestsHash for any CL requests in the block #### Inherited from -[RunBlockResult](RunBlockResult.md).[results](RunBlockResult.md#results) +[`RunBlockResult`](RunBlockResult.md).[`requestsHash`](RunBlockResult.md#requestshash) -#### Defined in +*** + +### results -[vm/src/types.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L308) +> **results**: [`RunTxResult`](RunTxResult.md)[] -___ +Defined in: [vm/src/types.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L347) + +Results of executing the transactions in the block + +#### Inherited from + +[`RunBlockResult`](RunBlockResult.md).[`results`](RunBlockResult.md#results) + +*** ### stateRoot -• **stateRoot**: `Uint8Array` +> **stateRoot**: `Uint8Array` + +Defined in: [vm/src/types.ts:361](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L361) The stateRoot after executing the block #### Inherited from -[RunBlockResult](RunBlockResult.md).[stateRoot](RunBlockResult.md#stateroot) - -#### Defined in - -[vm/src/types.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L322) +[`RunBlockResult`](RunBlockResult.md).[`stateRoot`](RunBlockResult.md#stateroot) diff --git a/packages/vm/docs/interfaces/AfterTxEvent.md b/packages/vm/docs/interfaces/AfterTxEvent.md index 30f52935635..f0a9d02c01d 100644 --- a/packages/vm/docs/interfaces/AfterTxEvent.md +++ b/packages/vm/docs/interfaces/AfterTxEvent.md @@ -1,197 +1,166 @@ +[**@ethereumjs/vm**](../README.md) + +*** + [@ethereumjs/vm](../README.md) / AfterTxEvent # Interface: AfterTxEvent +Defined in: [vm/src/types.ts:493](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L493) + Execution result of a transaction -## Hierarchy +## Extends - [`RunTxResult`](RunTxResult.md) - ↳ **`AfterTxEvent`** - -## Table of contents - -### Properties - -- [accessList](AfterTxEvent.md#accesslist) -- [amountSpent](AfterTxEvent.md#amountspent) -- [blobGasUsed](AfterTxEvent.md#blobgasused) -- [bloom](AfterTxEvent.md#bloom) -- [createdAddress](AfterTxEvent.md#createdaddress) -- [execResult](AfterTxEvent.md#execresult) -- [gasRefund](AfterTxEvent.md#gasrefund) -- [minerValue](AfterTxEvent.md#minervalue) -- [preimages](AfterTxEvent.md#preimages) -- [receipt](AfterTxEvent.md#receipt) -- [totalGasSpent](AfterTxEvent.md#totalgasspent) -- [transaction](AfterTxEvent.md#transaction) - ## Properties -### accessList +### accessList? + +> `optional` **accessList**: `AccessList` -• `Optional` **accessList**: `AccessList` +Defined in: [vm/src/types.ts:475](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L475) EIP-2930 access list generated for the tx (see `reportAccessList` option) #### Inherited from -[RunTxResult](RunTxResult.md).[accessList](RunTxResult.md#accesslist) - -#### Defined in - -[vm/src/types.ts:427](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L427) +[`RunTxResult`](RunTxResult.md).[`accessList`](RunTxResult.md#accesslist) -___ +*** ### amountSpent -• **amountSpent**: `bigint` +> **amountSpent**: `bigint` + +Defined in: [vm/src/types.ts:453](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L453) The amount of ether used by this transaction #### Inherited from -[RunTxResult](RunTxResult.md).[amountSpent](RunTxResult.md#amountspent) - -#### Defined in +[`RunTxResult`](RunTxResult.md).[`amountSpent`](RunTxResult.md#amountspent) -[vm/src/types.ts:405](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L405) +*** -___ +### blobGasUsed? -### blobGasUsed +> `optional` **blobGasUsed**: `bigint` -• `Optional` **blobGasUsed**: `bigint` +Defined in: [vm/src/types.ts:490](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L490) This is the blob gas units times the fee per blob gas for 4844 transactions #### Inherited from -[RunTxResult](RunTxResult.md).[blobGasUsed](RunTxResult.md#blobgasused) - -#### Defined in +[`RunTxResult`](RunTxResult.md).[`blobGasUsed`](RunTxResult.md#blobgasused) -[vm/src/types.ts:442](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L442) - -___ +*** ### bloom -• **bloom**: `Bloom` +> **bloom**: `Bloom` + +Defined in: [vm/src/types.ts:448](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L448) Bloom filter resulted from transaction #### Inherited from -[RunTxResult](RunTxResult.md).[bloom](RunTxResult.md#bloom) +[`RunTxResult`](RunTxResult.md).[`bloom`](RunTxResult.md#bloom) -#### Defined in +*** -[vm/src/types.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L400) +### createdAddress? -___ +> `optional` **createdAddress**: `Address` -### createdAddress - -• `Optional` **createdAddress**: `Address` +Defined in: evm/dist/esm/types.d.ts:333 Address of created account during transaction, if any #### Inherited from -[RunTxResult](RunTxResult.md).[createdAddress](RunTxResult.md#createdaddress) - -#### Defined in +[`RunTxResult`](RunTxResult.md).[`createdAddress`](RunTxResult.md#createdaddress) -evm/dist/cjs/types.d.ts:248 - -___ +*** ### execResult -• **execResult**: `ExecResult` +> **execResult**: `ExecResult` + +Defined in: evm/dist/esm/types.d.ts:337 Contains the results from running the code, if any, as described in runCode #### Inherited from -[RunTxResult](RunTxResult.md).[execResult](RunTxResult.md#execresult) +[`RunTxResult`](RunTxResult.md).[`execResult`](RunTxResult.md#execresult) -#### Defined in - -evm/dist/cjs/types.d.ts:252 - -___ +*** ### gasRefund -• **gasRefund**: `bigint` +> **gasRefund**: `bigint` + +Defined in: [vm/src/types.ts:470](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L470) The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) #### Inherited from -[RunTxResult](RunTxResult.md).[gasRefund](RunTxResult.md#gasrefund) - -#### Defined in - -[vm/src/types.ts:422](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L422) +[`RunTxResult`](RunTxResult.md).[`gasRefund`](RunTxResult.md#gasrefund) -___ +*** ### minerValue -• **minerValue**: `bigint` +> **minerValue**: `bigint` + +Defined in: [vm/src/types.ts:485](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L485) The value that accrues to the miner by this transaction #### Inherited from -[RunTxResult](RunTxResult.md).[minerValue](RunTxResult.md#minervalue) - -#### Defined in +[`RunTxResult`](RunTxResult.md).[`minerValue`](RunTxResult.md#minervalue) -[vm/src/types.ts:437](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L437) +*** -___ +### preimages? -### preimages +> `optional` **preimages**: `Map`\<`` `0x${string}` ``, `Uint8Array`\<`ArrayBufferLike`\>\> -• `Optional` **preimages**: `Map`<`string`, `Uint8Array`\> +Defined in: [vm/src/types.ts:480](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L480) Preimages mapping of the touched accounts from the tx (see `reportPreimages` option) #### Inherited from -[RunTxResult](RunTxResult.md).[preimages](RunTxResult.md#preimages) - -#### Defined in - -[vm/src/types.ts:432](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L432) +[`RunTxResult`](RunTxResult.md).[`preimages`](RunTxResult.md#preimages) -___ +*** ### receipt -• **receipt**: [`TxReceipt`](../README.md#txreceipt) +> **receipt**: [`TxReceipt`](../type-aliases/TxReceipt.md) + +Defined in: [vm/src/types.ts:458](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L458) The tx receipt #### Inherited from -[RunTxResult](RunTxResult.md).[receipt](RunTxResult.md#receipt) - -#### Defined in - -[vm/src/types.ts:410](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L410) +[`RunTxResult`](RunTxResult.md).[`receipt`](RunTxResult.md#receipt) -___ +*** ### totalGasSpent -• **totalGasSpent**: `bigint` +> **totalGasSpent**: `bigint` + +Defined in: [vm/src/types.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L465) The amount of gas used in this transaction, which is paid for This contains the gas units that have been used on execution, plus the upfront cost, @@ -199,20 +168,14 @@ which consists of calldata cost, intrinsic cost and optionally the access list c #### Inherited from -[RunTxResult](RunTxResult.md).[totalGasSpent](RunTxResult.md#totalgasspent) - -#### Defined in +[`RunTxResult`](RunTxResult.md).[`totalGasSpent`](RunTxResult.md#totalgasspent) -[vm/src/types.ts:417](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L417) - -___ +*** ### transaction -• **transaction**: `TypedTransaction` - -The transaction which just got finished +> **transaction**: `TypedTransaction` -#### Defined in +Defined in: [vm/src/types.ts:497](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L497) -[vm/src/types.ts:449](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L449) +The transaction which just got finished diff --git a/packages/vm/docs/interfaces/ApplyBlockResult.md b/packages/vm/docs/interfaces/ApplyBlockResult.md index 5e31ef993f5..a6484019d13 100644 --- a/packages/vm/docs/interfaces/ApplyBlockResult.md +++ b/packages/vm/docs/interfaces/ApplyBlockResult.md @@ -1,88 +1,71 @@ -[@ethereumjs/vm](../README.md) / ApplyBlockResult +[**@ethereumjs/vm**](../README.md) -# Interface: ApplyBlockResult +*** -Result of applyBlock +[@ethereumjs/vm](../README.md) / ApplyBlockResult -## Table of contents +# Interface: ApplyBlockResult -### Properties +Defined in: [vm/src/types.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L327) -- [bloom](ApplyBlockResult.md#bloom) -- [gasUsed](ApplyBlockResult.md#gasused) -- [preimages](ApplyBlockResult.md#preimages) -- [receipts](ApplyBlockResult.md#receipts) -- [receiptsRoot](ApplyBlockResult.md#receiptsroot) -- [results](ApplyBlockResult.md#results) +Result of applyBlock ## Properties ### bloom -• **bloom**: `Bloom` +> **bloom**: `Bloom` -The Bloom filter - -#### Defined in +Defined in: [vm/src/types.ts:331](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L331) -[vm/src/types.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L292) +The Bloom filter -___ +*** ### gasUsed -• **gasUsed**: `bigint` +> **gasUsed**: `bigint` -The gas used after executing the block +Defined in: [vm/src/types.ts:335](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L335) -#### Defined in +The gas used after executing the block -[vm/src/types.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L296) +*** -___ +### preimages? -### preimages +> `optional` **preimages**: `Map`\<`` `0x${string}` ``, `Uint8Array`\<`ArrayBufferLike`\>\> -• `Optional` **preimages**: `Map`<`string`, `Uint8Array`\> +Defined in: [vm/src/types.ts:351](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L351) Preimages mapping of the touched accounts from the block (see reportPreimages option) -#### Defined in - -[vm/src/types.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L312) - -___ +*** ### receipts -• **receipts**: [`TxReceipt`](../README.md#txreceipt)[] - -Receipts generated for transactions in the block +> **receipts**: [`TxReceipt`](../type-aliases/TxReceipt.md)[] -#### Defined in +Defined in: [vm/src/types.ts:343](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L343) -[vm/src/types.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L304) +Receipts generated for transactions in the block -___ +*** ### receiptsRoot -• **receiptsRoot**: `Uint8Array` +> **receiptsRoot**: `Uint8Array` -The receipt root after executing the block +Defined in: [vm/src/types.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L339) -#### Defined in - -[vm/src/types.ts:300](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L300) +The receipt root after executing the block -___ +*** ### results -• **results**: [`RunTxResult`](RunTxResult.md)[] +> **results**: [`RunTxResult`](RunTxResult.md)[] -Results of executing the transactions in the block +Defined in: [vm/src/types.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L347) -#### Defined in - -[vm/src/types.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L308) +Results of executing the transactions in the block diff --git a/packages/vm/docs/interfaces/BaseTxReceipt.md b/packages/vm/docs/interfaces/BaseTxReceipt.md index 12c8b63a5ff..f08b65c21a1 100644 --- a/packages/vm/docs/interfaces/BaseTxReceipt.md +++ b/packages/vm/docs/interfaces/BaseTxReceipt.md @@ -1,57 +1,46 @@ -[@ethereumjs/vm](../README.md) / BaseTxReceipt - -# Interface: BaseTxReceipt - -Abstract interface with common transaction receipt fields +[**@ethereumjs/vm**](../README.md) -## Hierarchy +*** -- **`BaseTxReceipt`** +[@ethereumjs/vm](../README.md) / BaseTxReceipt - ↳ [`PreByzantiumTxReceipt`](PreByzantiumTxReceipt.md) +# Interface: BaseTxReceipt - ↳ [`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md) +Defined in: [vm/src/types.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L24) -## Table of contents +Abstract interface with common transaction receipt fields -### Properties +## Extended by -- [bitvector](BaseTxReceipt.md#bitvector) -- [cumulativeBlockGasUsed](BaseTxReceipt.md#cumulativeblockgasused) -- [logs](BaseTxReceipt.md#logs) +- [`PreByzantiumTxReceipt`](PreByzantiumTxReceipt.md) +- [`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md) ## Properties ### bitvector -• **bitvector**: `Uint8Array` +> **bitvector**: `Uint8Array` -Bloom bitvector +Defined in: [vm/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L32) -#### Defined in - -[vm/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L21) +Bloom bitvector -___ +*** ### cumulativeBlockGasUsed -• **cumulativeBlockGasUsed**: `bigint` - -Cumulative gas used in the block including this tx +> **cumulativeBlockGasUsed**: `bigint` -#### Defined in +Defined in: [vm/src/types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L28) -[vm/src/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L17) +Cumulative gas used in the block including this tx -___ +*** ### logs -• **logs**: `Log`[] - -Logs emitted +> **logs**: `Log`[] -#### Defined in +Defined in: [vm/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L36) -[vm/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L25) +Logs emitted diff --git a/packages/vm/docs/interfaces/BuildBlockOpts.md b/packages/vm/docs/interfaces/BuildBlockOpts.md index d74beb85841..8762edf6e21 100644 --- a/packages/vm/docs/interfaces/BuildBlockOpts.md +++ b/packages/vm/docs/interfaces/BuildBlockOpts.md @@ -1,61 +1,50 @@ -[@ethereumjs/vm](../README.md) / BuildBlockOpts +[**@ethereumjs/vm**](../README.md) -# Interface: BuildBlockOpts +*** -Options for building a block. +[@ethereumjs/vm](../README.md) / BuildBlockOpts -## Table of contents +# Interface: BuildBlockOpts -### Properties +Defined in: [vm/src/types.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L213) -- [blockOpts](BuildBlockOpts.md#blockopts) -- [headerData](BuildBlockOpts.md#headerdata) -- [parentBlock](BuildBlockOpts.md#parentblock) -- [withdrawals](BuildBlockOpts.md#withdrawals) +Options for building a block. ## Properties -### blockOpts +### blockOpts? -• `Optional` **blockOpts**: [`BuilderOpts`](BuilderOpts.md) +> `optional` **blockOpts**: [`BuilderOpts`](BuilderOpts.md) -The block and builder options to use. +Defined in: [vm/src/types.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L229) -#### Defined in +The block and builder options to use. -[vm/src/types.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L193) +*** -___ +### headerData? -### headerData +> `optional` **headerData**: `HeaderData` -• `Optional` **headerData**: `HeaderData` +Defined in: [vm/src/types.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L223) The block header data to use. Defaults used for any values not provided. -#### Defined in - -[vm/src/types.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L187) - -___ +*** ### parentBlock -• **parentBlock**: `Block` +> **parentBlock**: `Block` -The parent block +Defined in: [vm/src/types.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L217) -#### Defined in - -[vm/src/types.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L181) - -___ +The parent block -### withdrawals +*** -• `Optional` **withdrawals**: `WithdrawalData`[] +### withdrawals? -#### Defined in +> `optional` **withdrawals**: `WithdrawalData`[] -[vm/src/types.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L189) +Defined in: [vm/src/types.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L225) diff --git a/packages/vm/docs/interfaces/BuilderOpts.md b/packages/vm/docs/interfaces/BuilderOpts.md index 6331fb5307e..2d2c616dd27 100644 --- a/packages/vm/docs/interfaces/BuilderOpts.md +++ b/packages/vm/docs/interfaces/BuilderOpts.md @@ -1,32 +1,26 @@ +[**@ethereumjs/vm**](../README.md) + +*** + [@ethereumjs/vm](../README.md) / BuilderOpts # Interface: BuilderOpts +Defined in: [vm/src/types.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L192) + Options for the block builder. -## Hierarchy +## Extends - `BlockOptions` - ↳ **`BuilderOpts`** - -## Table of contents - -### Properties - -- [calcDifficultyFromHeader](BuilderOpts.md#calcdifficultyfromheader) -- [cliqueSigner](BuilderOpts.md#cliquesigner) -- [common](BuilderOpts.md#common) -- [freeze](BuilderOpts.md#freeze) -- [putBlockIntoBlockchain](BuilderOpts.md#putblockintoblockchain) -- [setHardfork](BuilderOpts.md#sethardfork) -- [skipConsensusFormatValidation](BuilderOpts.md#skipconsensusformatvalidation) - ## Properties -### calcDifficultyFromHeader +### calcDifficultyFromHeader? -• `Optional` **calcDifficultyFromHeader**: `BlockHeader` +> `optional` **calcDifficultyFromHeader**: `BlockHeader` + +Defined in: block/dist/esm/types.d.ts:55 If a preceding BlockHeader (usually the parent header) is given the preceding header will be used to calculate the difficulty for this block and the calculated @@ -37,34 +31,26 @@ Note that this option has no effect on networks other than PoW/Ethash networks #### Inherited from -BlockOptions.calcDifficultyFromHeader - -#### Defined in +`BlockOptions.calcDifficultyFromHeader` -block/dist/cjs/types.d.ts:41 +*** -___ +### cliqueSigner? -### cliqueSigner +> `optional` **cliqueSigner**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **cliqueSigner**: `Uint8Array` +Defined in: [vm/src/types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L207) Provide a clique signer's privateKey to seal this block. Will throw if provided on a non-PoA chain. -#### Inherited from - -BlockOptions.cliqueSigner - -#### Defined in - -block/dist/cjs/types.d.ts:58 +*** -___ +### common? -### common +> `optional` **common**: `Common` -• `Optional` **common**: `Common` +Defined in: block/dist/esm/types.d.ts:22 A Common object defining the chain and the hardfork a block/block header belongs to. @@ -78,17 +64,27 @@ Current default hardfork: `merge` #### Inherited from -BlockOptions.common +`BlockOptions.common` + +*** + +### executionWitness? + +> `optional` **executionWitness**: `VerkleExecutionWitness` + +Defined in: block/dist/esm/types.d.ts:72 -#### Defined in +#### Inherited from + +`BlockOptions.executionWitness` -block/dist/cjs/types.d.ts:22 +*** -___ +### freeze? -### freeze +> `optional` **freeze**: `boolean` -• `Optional` **freeze**: `boolean` +Defined in: block/dist/esm/types.d.ts:67 A block object by default gets frozen along initialization. This gives you strong additional security guarantees on the consistency of the block parameters. @@ -102,17 +98,42 @@ Default: true #### Inherited from -BlockOptions.freeze +`BlockOptions.freeze` + +*** + +### params? + +> `optional` **params**: `ParamsDict` -#### Defined in +Defined in: block/dist/esm/types.d.ts:46 -block/dist/cjs/types.d.ts:53 +Block parameters sorted by EIP can be found in the exported `paramsBlock` dictionary, +which is internally passed to the associated `@ethereumjs/common` instance which +manages parameter selection based on the hardfork and EIP settings. -___ +This option allows providing a custom set of parameters. Note that parameters +get fully overwritten, so you need to extend the default parameter dict +to provide the full parameter set. + +It is recommended to deep-clone the params object for this to avoid side effects: + +```ts +const params = JSON.parse(JSON.stringify(paramsBlock)) +params['1']['minGasLimit'] = 3000 // 5000 +``` + +#### Inherited from -### putBlockIntoBlockchain +`BlockOptions.params` -• `Optional` **putBlockIntoBlockchain**: `boolean` +*** + +### putBlockIntoBlockchain? + +> `optional` **putBlockIntoBlockchain**: `boolean` + +Defined in: [vm/src/types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L202) Whether to put the block into the vm's blockchain after building it. This is useful for completing a full cycle when building a block so @@ -122,44 +143,33 @@ the underlying blockchain. Default: true -#### Defined in - -[vm/src/types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L171) +*** -___ +### setHardfork? -### setHardfork +> `optional` **setHardfork**: `boolean` -• `Optional` **setHardfork**: `boolean` \| `BigIntLike` +Defined in: block/dist/esm/types.d.ts:29 Set the hardfork either by timestamp (for HFs from Shanghai onwards) or by block number for older Hfs. -Additionally it is possible to pass in a specific TD value to support live-Merge-HF -transitions. Note that this should only be needed in very rare and specific scenarios. - Default: `false` (HF is set to whatever default HF is set by the Common instance) #### Inherited from -BlockOptions.setHardfork - -#### Defined in +`BlockOptions.setHardfork` -block/dist/cjs/types.d.ts:32 +*** -___ +### skipConsensusFormatValidation? -### skipConsensusFormatValidation +> `optional` **skipConsensusFormatValidation**: `boolean` -• `Optional` **skipConsensusFormatValidation**: `boolean` +Defined in: block/dist/esm/types.d.ts:71 Skip consensus format validation checks on header if set. Defaults to false. #### Inherited from -BlockOptions.skipConsensusFormatValidation - -#### Defined in - -block/dist/cjs/types.d.ts:62 +`BlockOptions.skipConsensusFormatValidation` diff --git a/packages/vm/docs/interfaces/EIP4844BlobTxReceipt.md b/packages/vm/docs/interfaces/EIP4844BlobTxReceipt.md index 35b1b96ecc9..e4a980d44f8 100644 --- a/packages/vm/docs/interfaces/EIP4844BlobTxReceipt.md +++ b/packages/vm/docs/interfaces/EIP4844BlobTxReceipt.md @@ -1,117 +1,98 @@ +[**@ethereumjs/vm**](../README.md) + +*** + [@ethereumjs/vm](../README.md) / EIP4844BlobTxReceipt # Interface: EIP4844BlobTxReceipt +Defined in: [vm/src/types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L61) + Receipt type for Byzantium and beyond replacing the intermediary state root field with a status code field (EIP-658) -## Hierarchy +## Extends - [`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md) - ↳ **`EIP4844BlobTxReceipt`** - -## Table of contents - -### Properties - -- [bitvector](EIP4844BlobTxReceipt.md#bitvector) -- [blobGasPrice](EIP4844BlobTxReceipt.md#blobgasprice) -- [blobGasUsed](EIP4844BlobTxReceipt.md#blobgasused) -- [cumulativeBlockGasUsed](EIP4844BlobTxReceipt.md#cumulativeblockgasused) -- [logs](EIP4844BlobTxReceipt.md#logs) -- [status](EIP4844BlobTxReceipt.md#status) - ## Properties ### bitvector -• **bitvector**: `Uint8Array` +> **bitvector**: `Uint8Array` + +Defined in: [vm/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L32) Bloom bitvector #### Inherited from -[PostByzantiumTxReceipt](PostByzantiumTxReceipt.md).[bitvector](PostByzantiumTxReceipt.md#bitvector) - -#### Defined in - -[vm/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L21) +[`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md).[`bitvector`](PostByzantiumTxReceipt.md#bitvector) -___ +*** ### blobGasPrice -• **blobGasPrice**: `bigint` +> **blobGasPrice**: `bigint` + +Defined in: [vm/src/types.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L75) blob gas price for block transaction was included in -Note: This valus is not included in the `receiptRLP` used for encoding the `receiptsRoot` in a block +Note: This values is not included in the `receiptRLP` used for encoding the `receiptsRoot` in a block and is only provided as part of receipt metadata. -#### Defined in - -[vm/src/types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L64) - -___ +*** ### blobGasUsed -• **blobGasUsed**: `bigint` +> **blobGasUsed**: `bigint` + +Defined in: [vm/src/types.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L68) blob gas consumed by a transaction Note: This value is not included in the receiptRLP used for encoding the receiptsRoot in a block and is only provided as part of receipt metadata. -#### Defined in - -[vm/src/types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L57) - -___ +*** ### cumulativeBlockGasUsed -• **cumulativeBlockGasUsed**: `bigint` +> **cumulativeBlockGasUsed**: `bigint` + +Defined in: [vm/src/types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L28) Cumulative gas used in the block including this tx #### Inherited from -[PostByzantiumTxReceipt](PostByzantiumTxReceipt.md).[cumulativeBlockGasUsed](PostByzantiumTxReceipt.md#cumulativeblockgasused) - -#### Defined in - -[vm/src/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L17) +[`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md).[`cumulativeBlockGasUsed`](PostByzantiumTxReceipt.md#cumulativeblockgasused) -___ +*** ### logs -• **logs**: `Log`[] +> **logs**: `Log`[] + +Defined in: [vm/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L36) Logs emitted #### Inherited from -[PostByzantiumTxReceipt](PostByzantiumTxReceipt.md).[logs](PostByzantiumTxReceipt.md#logs) - -#### Defined in - -[vm/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L25) +[`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md).[`logs`](PostByzantiumTxReceipt.md#logs) -___ +*** ### status -• **status**: ``0`` \| ``1`` +> **status**: `0` \| `1` + +Defined in: [vm/src/types.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L58) Status of transaction, `1` if successful, `0` if an exception occurred #### Inherited from -[PostByzantiumTxReceipt](PostByzantiumTxReceipt.md).[status](PostByzantiumTxReceipt.md#status) - -#### Defined in - -[vm/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L47) +[`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md).[`status`](PostByzantiumTxReceipt.md#status) diff --git a/packages/vm/docs/interfaces/PostByzantiumTxReceipt.md b/packages/vm/docs/interfaces/PostByzantiumTxReceipt.md index 74ff1b97f22..d785e7c0cd4 100644 --- a/packages/vm/docs/interfaces/PostByzantiumTxReceipt.md +++ b/packages/vm/docs/interfaces/PostByzantiumTxReceipt.md @@ -1,83 +1,72 @@ +[**@ethereumjs/vm**](../README.md) + +*** + [@ethereumjs/vm](../README.md) / PostByzantiumTxReceipt # Interface: PostByzantiumTxReceipt +Defined in: [vm/src/types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L54) + Receipt type for Byzantium and beyond replacing the intermediary state root field with a status code field (EIP-658) -## Hierarchy +## Extends - [`BaseTxReceipt`](BaseTxReceipt.md) - ↳ **`PostByzantiumTxReceipt`** - - ↳↳ [`EIP4844BlobTxReceipt`](EIP4844BlobTxReceipt.md) - -## Table of contents +## Extended by -### Properties - -- [bitvector](PostByzantiumTxReceipt.md#bitvector) -- [cumulativeBlockGasUsed](PostByzantiumTxReceipt.md#cumulativeblockgasused) -- [logs](PostByzantiumTxReceipt.md#logs) -- [status](PostByzantiumTxReceipt.md#status) +- [`EIP4844BlobTxReceipt`](EIP4844BlobTxReceipt.md) ## Properties ### bitvector -• **bitvector**: `Uint8Array` +> **bitvector**: `Uint8Array` + +Defined in: [vm/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L32) Bloom bitvector #### Inherited from -[BaseTxReceipt](BaseTxReceipt.md).[bitvector](BaseTxReceipt.md#bitvector) - -#### Defined in - -[vm/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L21) +[`BaseTxReceipt`](BaseTxReceipt.md).[`bitvector`](BaseTxReceipt.md#bitvector) -___ +*** ### cumulativeBlockGasUsed -• **cumulativeBlockGasUsed**: `bigint` +> **cumulativeBlockGasUsed**: `bigint` + +Defined in: [vm/src/types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L28) Cumulative gas used in the block including this tx #### Inherited from -[BaseTxReceipt](BaseTxReceipt.md).[cumulativeBlockGasUsed](BaseTxReceipt.md#cumulativeblockgasused) - -#### Defined in - -[vm/src/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L17) +[`BaseTxReceipt`](BaseTxReceipt.md).[`cumulativeBlockGasUsed`](BaseTxReceipt.md#cumulativeblockgasused) -___ +*** ### logs -• **logs**: `Log`[] +> **logs**: `Log`[] + +Defined in: [vm/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L36) Logs emitted #### Inherited from -[BaseTxReceipt](BaseTxReceipt.md).[logs](BaseTxReceipt.md#logs) - -#### Defined in +[`BaseTxReceipt`](BaseTxReceipt.md).[`logs`](BaseTxReceipt.md#logs) -[vm/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L25) - -___ +*** ### status -• **status**: ``0`` \| ``1`` - -Status of transaction, `1` if successful, `0` if an exception occurred +> **status**: `0` \| `1` -#### Defined in +Defined in: [vm/src/types.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L58) -[vm/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L47) +Status of transaction, `1` if successful, `0` if an exception occurred diff --git a/packages/vm/docs/interfaces/PreByzantiumTxReceipt.md b/packages/vm/docs/interfaces/PreByzantiumTxReceipt.md index 094c7b8f073..674fb1c678c 100644 --- a/packages/vm/docs/interfaces/PreByzantiumTxReceipt.md +++ b/packages/vm/docs/interfaces/PreByzantiumTxReceipt.md @@ -1,81 +1,68 @@ +[**@ethereumjs/vm**](../README.md) + +*** + [@ethereumjs/vm](../README.md) / PreByzantiumTxReceipt # Interface: PreByzantiumTxReceipt +Defined in: [vm/src/types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L43) + Pre-Byzantium receipt type with a field for the intermediary state root -## Hierarchy +## Extends - [`BaseTxReceipt`](BaseTxReceipt.md) - ↳ **`PreByzantiumTxReceipt`** - -## Table of contents - -### Properties - -- [bitvector](PreByzantiumTxReceipt.md#bitvector) -- [cumulativeBlockGasUsed](PreByzantiumTxReceipt.md#cumulativeblockgasused) -- [logs](PreByzantiumTxReceipt.md#logs) -- [stateRoot](PreByzantiumTxReceipt.md#stateroot) - ## Properties ### bitvector -• **bitvector**: `Uint8Array` +> **bitvector**: `Uint8Array` + +Defined in: [vm/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L32) Bloom bitvector #### Inherited from -[BaseTxReceipt](BaseTxReceipt.md).[bitvector](BaseTxReceipt.md#bitvector) - -#### Defined in - -[vm/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L21) +[`BaseTxReceipt`](BaseTxReceipt.md).[`bitvector`](BaseTxReceipt.md#bitvector) -___ +*** ### cumulativeBlockGasUsed -• **cumulativeBlockGasUsed**: `bigint` +> **cumulativeBlockGasUsed**: `bigint` + +Defined in: [vm/src/types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L28) Cumulative gas used in the block including this tx #### Inherited from -[BaseTxReceipt](BaseTxReceipt.md).[cumulativeBlockGasUsed](BaseTxReceipt.md#cumulativeblockgasused) - -#### Defined in - -[vm/src/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L17) +[`BaseTxReceipt`](BaseTxReceipt.md).[`cumulativeBlockGasUsed`](BaseTxReceipt.md#cumulativeblockgasused) -___ +*** ### logs -• **logs**: `Log`[] +> **logs**: `Log`[] + +Defined in: [vm/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L36) Logs emitted #### Inherited from -[BaseTxReceipt](BaseTxReceipt.md).[logs](BaseTxReceipt.md#logs) - -#### Defined in +[`BaseTxReceipt`](BaseTxReceipt.md).[`logs`](BaseTxReceipt.md#logs) -[vm/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L25) - -___ +*** ### stateRoot -• **stateRoot**: `Uint8Array` - -Intermediary state root +> **stateRoot**: `Uint8Array` -#### Defined in +Defined in: [vm/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L47) -[vm/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L36) +Intermediary state root diff --git a/packages/vm/docs/interfaces/RunBlockOpts.md b/packages/vm/docs/interfaces/RunBlockOpts.md index 0c8ac173b32..e0f5f2a71d3 100644 --- a/packages/vm/docs/interfaces/RunBlockOpts.md +++ b/packages/vm/docs/interfaces/RunBlockOpts.md @@ -1,42 +1,32 @@ -[@ethereumjs/vm](../README.md) / RunBlockOpts +[**@ethereumjs/vm**](../README.md) -# Interface: RunBlockOpts +*** -Options for running a block. +[@ethereumjs/vm](../README.md) / RunBlockOpts -## Table of contents +# Interface: RunBlockOpts -### Properties +Defined in: [vm/src/types.ts:252](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L252) -- [block](RunBlockOpts.md#block) -- [clearCache](RunBlockOpts.md#clearcache) -- [generate](RunBlockOpts.md#generate) -- [reportPreimages](RunBlockOpts.md#reportpreimages) -- [root](RunBlockOpts.md#root) -- [setHardfork](RunBlockOpts.md#sethardfork) -- [skipBalance](RunBlockOpts.md#skipbalance) -- [skipBlockValidation](RunBlockOpts.md#skipblockvalidation) -- [skipHardForkValidation](RunBlockOpts.md#skiphardforkvalidation) -- [skipHeaderValidation](RunBlockOpts.md#skipheadervalidation) -- [skipNonce](RunBlockOpts.md#skipnonce) +Options for running a block. ## Properties ### block -• **block**: `Block` +> **block**: `Block` -The @ethereumjs/block to process +Defined in: [vm/src/types.ts:256](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L256) -#### Defined in +The @ethereumjs/block to process -[vm/src/types.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L220) +*** -___ +### clearCache? -### clearCache +> `optional` **clearCache**: `boolean` -• `Optional` **clearCache**: `boolean` +Defined in: [vm/src/types.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L268) Clearing the StateManager cache. @@ -44,131 +34,116 @@ If state root is not reset for whatever reason this can be set to `false` for be Default: true -#### Defined in - -[vm/src/types.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L232) +*** -___ +### generate? -### generate +> `optional` **generate**: `boolean` -• `Optional` **generate**: `boolean` +Defined in: [vm/src/types.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L275) Whether to generate the stateRoot and other related fields. If `true`, `runBlock` will set the fields `stateRoot`, `receiptTrie`, `gasUsed`, and `bloom` (logs bloom) after running the block. If `false`, `runBlock` throws if any fields do not match. Defaults to `false`. -#### Defined in +*** + +### parentStateRoot? + +> `optional` **parentStateRoot**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [vm/src/types.ts:280](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L280) -[vm/src/types.ts:239](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L239) +The stateRoot of the parent. Used for verifying the witness proofs in the context of Verkle. -___ +*** -### reportPreimages +### reportPreimages? -• `Optional` **reportPreimages**: `boolean` +> `optional` **reportPreimages**: `boolean` + +Defined in: [vm/src/types.ts:321](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L321) If true, adds a hashedKey -> preimages mapping of all touched accounts to the `RunTxResult` returned. -#### Defined in - -[vm/src/types.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L282) +*** -___ +### root? -### root +> `optional` **root**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **root**: `Uint8Array` +Defined in: [vm/src/types.ts:260](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L260) Root of the state trie -#### Defined in - -[vm/src/types.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L224) +*** -___ +### setHardfork? -### setHardfork +> `optional` **setHardfork**: `boolean` -• `Optional` **setHardfork**: `boolean` \| `BigIntLike` +Defined in: [vm/src/types.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L315) Set the hardfork either by timestamp (for HFs from Shanghai onwards) or by block number for older Hfs. -Additionally it is possible to pass in a specific TD value to support live-Merge-HF -transitions. Note that this should only be needed in very rare and specific scenarios. - Default: `false` (HF is set to whatever default HF is set by the Common instance) -#### Defined in - -[vm/src/types.ts:276](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L276) +*** -___ +### skipBalance? -### skipBalance +> `optional` **skipBalance**: `boolean` -• `Optional` **skipBalance**: `boolean` +Defined in: [vm/src/types.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L308) If true, checks the balance of the `from` account for the transaction and sets its balance equal equal to the upfront cost (gas limit * gas price + transaction value) -#### Defined in - -[vm/src/types.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L266) +*** -___ +### skipBlockValidation? -### skipBlockValidation +> `optional` **skipBlockValidation**: `boolean` -• `Optional` **skipBlockValidation**: `boolean` +Defined in: [vm/src/types.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L287) If true, will skip "Block validation": Block validation validates the header (with respect to the blockchain), the transactions, the transaction trie and the uncle hash. -#### Defined in +*** -[vm/src/types.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L245) +### skipHardForkValidation? -___ +> `optional` **skipHardForkValidation**: `boolean` -### skipHardForkValidation - -• `Optional` **skipHardForkValidation**: `boolean` +Defined in: [vm/src/types.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L292) If true, skips the hardfork validation of vm, block and tx -#### Defined in - -[vm/src/types.ts:250](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L250) +*** -___ +### skipHeaderValidation? -### skipHeaderValidation +> `optional` **skipHeaderValidation**: `boolean` -• `Optional` **skipHeaderValidation**: `boolean` +Defined in: [vm/src/types.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L299) if true, will skip "Header validation" If the block has been picked from the blockchain to be executed, header has already been validated, and can be skipped especially when consensus of the chain has moved ahead. -#### Defined in - -[vm/src/types.ts:257](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L257) +*** -___ +### skipNonce? -### skipNonce +> `optional` **skipNonce**: `boolean` -• `Optional` **skipNonce**: `boolean` +Defined in: [vm/src/types.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L303) If true, skips the nonce check - -#### Defined in - -[vm/src/types.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L261) diff --git a/packages/vm/docs/interfaces/RunBlockResult.md b/packages/vm/docs/interfaces/RunBlockResult.md index 80896213e91..de0b1f86445 100644 --- a/packages/vm/docs/interfaces/RunBlockResult.md +++ b/packages/vm/docs/interfaces/RunBlockResult.md @@ -1,129 +1,129 @@ -[@ethereumjs/vm](../README.md) / RunBlockResult +[**@ethereumjs/vm**](../README.md) -# Interface: RunBlockResult +*** -Result of runBlock +[@ethereumjs/vm](../README.md) / RunBlockResult -## Hierarchy +# Interface: RunBlockResult -- `Omit`<[`ApplyBlockResult`](ApplyBlockResult.md), ``"bloom"``\> +Defined in: [vm/src/types.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L357) - ↳ **`RunBlockResult`** +Result of [runBlock](../functions/runBlock.md) - ↳↳ [`AfterBlockEvent`](AfterBlockEvent.md) +## Extends -## Table of contents +- `Omit`\<[`ApplyBlockResult`](ApplyBlockResult.md), `"bloom"`\> -### Properties +## Extended by -- [gasUsed](RunBlockResult.md#gasused) -- [logsBloom](RunBlockResult.md#logsbloom) -- [preimages](RunBlockResult.md#preimages) -- [receipts](RunBlockResult.md#receipts) -- [receiptsRoot](RunBlockResult.md#receiptsroot) -- [results](RunBlockResult.md#results) -- [stateRoot](RunBlockResult.md#stateroot) +- [`AfterBlockEvent`](AfterBlockEvent.md) ## Properties ### gasUsed -• **gasUsed**: `bigint` +> **gasUsed**: `bigint` + +Defined in: [vm/src/types.ts:335](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L335) The gas used after executing the block #### Inherited from -Omit.gasUsed - -#### Defined in +`Omit.gasUsed` -[vm/src/types.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L296) - -___ +*** ### logsBloom -• **logsBloom**: `Uint8Array` +> **logsBloom**: `Uint8Array` -The bloom filter of the LOGs (events) after executing the block +Defined in: [vm/src/types.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L365) -#### Defined in +The bloom filter of the LOGs (events) after executing the block -[vm/src/types.ts:326](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L326) +*** -___ +### preimages? -### preimages +> `optional` **preimages**: `Map`\<`` `0x${string}` ``, `Uint8Array`\<`ArrayBufferLike`\>\> -• `Optional` **preimages**: `Map`<`string`, `Uint8Array`\> +Defined in: [vm/src/types.ts:351](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L351) Preimages mapping of the touched accounts from the block (see reportPreimages option) #### Inherited from -Omit.preimages - -#### Defined in +`Omit.preimages` -[vm/src/types.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L312) - -___ +*** ### receipts -• **receipts**: [`TxReceipt`](../README.md#txreceipt)[] +> **receipts**: [`TxReceipt`](../type-aliases/TxReceipt.md)[] + +Defined in: [vm/src/types.ts:343](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L343) Receipts generated for transactions in the block #### Inherited from -Omit.receipts +`Omit.receipts` -#### Defined in - -[vm/src/types.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L304) - -___ +*** ### receiptsRoot -• **receiptsRoot**: `Uint8Array` +> **receiptsRoot**: `Uint8Array` + +Defined in: [vm/src/types.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L339) The receipt root after executing the block #### Inherited from -Omit.receiptsRoot +`Omit.receiptsRoot` -#### Defined in +*** -[vm/src/types.ts:300](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L300) +### requests? -___ +> `optional` **requests**: `CLRequest`\<`CLRequestType`\>[] + +Defined in: [vm/src/types.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L374) + +Any CL requests that were processed in the course of this block + +*** + +### requestsHash? + +> `optional` **requestsHash**: `Uint8Array`\<`ArrayBufferLike`\> + +Defined in: [vm/src/types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L370) + +The requestsHash for any CL requests in the block + +*** ### results -• **results**: [`RunTxResult`](RunTxResult.md)[] +> **results**: [`RunTxResult`](RunTxResult.md)[] + +Defined in: [vm/src/types.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L347) Results of executing the transactions in the block #### Inherited from -Omit.results - -#### Defined in - -[vm/src/types.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L308) +`Omit.results` -___ +*** ### stateRoot -• **stateRoot**: `Uint8Array` +> **stateRoot**: `Uint8Array` -The stateRoot after executing the block - -#### Defined in +Defined in: [vm/src/types.ts:361](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L361) -[vm/src/types.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L322) +The stateRoot after executing the block diff --git a/packages/vm/docs/interfaces/RunTxOpts.md b/packages/vm/docs/interfaces/RunTxOpts.md index 9c9f4b3edc6..891e3aff135 100644 --- a/packages/vm/docs/interfaces/RunTxOpts.md +++ b/packages/vm/docs/interfaces/RunTxOpts.md @@ -1,53 +1,43 @@ -[@ethereumjs/vm](../README.md) / RunTxOpts +[**@ethereumjs/vm**](../README.md) -# Interface: RunTxOpts +*** -Options for the `runTx` method. +[@ethereumjs/vm](../README.md) / RunTxOpts -## Table of contents +# Interface: RunTxOpts -### Properties +Defined in: [vm/src/types.ts:385](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L385) -- [block](RunTxOpts.md#block) -- [blockGasUsed](RunTxOpts.md#blockgasused) -- [reportAccessList](RunTxOpts.md#reportaccesslist) -- [reportPreimages](RunTxOpts.md#reportpreimages) -- [skipBalance](RunTxOpts.md#skipbalance) -- [skipBlockGasLimitValidation](RunTxOpts.md#skipblockgaslimitvalidation) -- [skipHardForkValidation](RunTxOpts.md#skiphardforkvalidation) -- [skipNonce](RunTxOpts.md#skipnonce) -- [tx](RunTxOpts.md#tx) +Options for the `runTx` method. ## Properties -### block +### block? + +> `optional` **block**: `Block` -• `Optional` **block**: `Block` +Defined in: [vm/src/types.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L390) The `@ethereumjs/block` the `tx` belongs to. If omitted, a default blank block will be used. -#### Defined in - -[vm/src/types.ts:342](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L342) +*** -___ +### blockGasUsed? -### blockGasUsed +> `optional` **blockGasUsed**: `bigint` -• `Optional` **blockGasUsed**: `bigint` +Defined in: [vm/src/types.ts:438](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L438) To obtain an accurate tx receipt input the block gas used up until this tx. -#### Defined in +*** -[vm/src/types.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L390) +### reportAccessList? -___ +> `optional` **reportAccessList**: `boolean` -### reportAccessList - -• `Optional` **reportAccessList**: `boolean` +Defined in: [vm/src/types.ts:427](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L427) If true, adds a generated EIP-2930 access list to the `RunTxResult` returned. @@ -58,81 +48,65 @@ be activated (included in `berlin` HF). Note: if this option is used with a custom StateManager implementation StateManager.generateAccessList must be implemented. -#### Defined in - -[vm/src/types.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L379) +*** -___ +### reportPreimages? -### reportPreimages +> `optional` **reportPreimages**: `boolean` -• `Optional` **reportPreimages**: `boolean` +Defined in: [vm/src/types.ts:433](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L433) If true, adds a hashedKey -> preimages mapping of all touched accounts to the `RunTxResult` returned. -#### Defined in +*** -[vm/src/types.ts:385](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L385) +### skipBalance? -___ +> `optional` **skipBalance**: `boolean` -### skipBalance - -• `Optional` **skipBalance**: `boolean` +Defined in: [vm/src/types.ts:403](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L403) Skip balance checks if true. Adds transaction cost to balance to ensure execution doesn't fail. -#### Defined in - -[vm/src/types.ts:355](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L355) +*** -___ +### skipBlockGasLimitValidation? -### skipBlockGasLimitValidation +> `optional` **skipBlockGasLimitValidation**: `boolean` -• `Optional` **skipBlockGasLimitValidation**: `boolean` +Defined in: [vm/src/types.ts:409](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L409) If true, skips the validation of the tx's gas limit against the block's gas limit. -#### Defined in - -[vm/src/types.ts:361](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L361) +*** -___ +### skipHardForkValidation? -### skipHardForkValidation +> `optional` **skipHardForkValidation**: `boolean` -• `Optional` **skipHardForkValidation**: `boolean` +Defined in: [vm/src/types.ts:415](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L415) If true, skips the hardfork validation of vm, block and tx -#### Defined in +*** -[vm/src/types.ts:367](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L367) +### skipNonce? -___ +> `optional` **skipNonce**: `boolean` -### skipNonce - -• `Optional` **skipNonce**: `boolean` +Defined in: [vm/src/types.ts:398](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L398) If true, skips the nonce check -#### Defined in - -[vm/src/types.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L350) - -___ +*** ### tx -• **tx**: `TypedTransaction` - -An `@ethereumjs/tx` to run +> **tx**: `TypedTransaction` -#### Defined in +Defined in: [vm/src/types.ts:394](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L394) -[vm/src/types.ts:346](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L346) +An `@ethereumjs/tx` to run diff --git a/packages/vm/docs/interfaces/RunTxResult.md b/packages/vm/docs/interfaces/RunTxResult.md index aa6bdc146e5..bba7d45d97b 100644 --- a/packages/vm/docs/interfaces/RunTxResult.md +++ b/packages/vm/docs/interfaces/RunTxResult.md @@ -1,171 +1,139 @@ +[**@ethereumjs/vm**](../README.md) + +*** + [@ethereumjs/vm](../README.md) / RunTxResult # Interface: RunTxResult +Defined in: [vm/src/types.ts:444](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L444) + Execution result of a transaction -## Hierarchy +## Extends - `EVMResult` - ↳ **`RunTxResult`** - - ↳↳ [`AfterTxEvent`](AfterTxEvent.md) - -## Table of contents +## Extended by -### Properties - -- [accessList](RunTxResult.md#accesslist) -- [amountSpent](RunTxResult.md#amountspent) -- [blobGasUsed](RunTxResult.md#blobgasused) -- [bloom](RunTxResult.md#bloom) -- [createdAddress](RunTxResult.md#createdaddress) -- [execResult](RunTxResult.md#execresult) -- [gasRefund](RunTxResult.md#gasrefund) -- [minerValue](RunTxResult.md#minervalue) -- [preimages](RunTxResult.md#preimages) -- [receipt](RunTxResult.md#receipt) -- [totalGasSpent](RunTxResult.md#totalgasspent) +- [`AfterTxEvent`](AfterTxEvent.md) ## Properties -### accessList - -• `Optional` **accessList**: `AccessList` +### accessList? -EIP-2930 access list generated for the tx (see `reportAccessList` option) +> `optional` **accessList**: `AccessList` -#### Defined in +Defined in: [vm/src/types.ts:475](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L475) -[vm/src/types.ts:427](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L427) +EIP-2930 access list generated for the tx (see `reportAccessList` option) -___ +*** ### amountSpent -• **amountSpent**: `bigint` +> **amountSpent**: `bigint` -The amount of ether used by this transaction +Defined in: [vm/src/types.ts:453](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L453) -#### Defined in +The amount of ether used by this transaction -[vm/src/types.ts:405](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L405) +*** -___ +### blobGasUsed? -### blobGasUsed +> `optional` **blobGasUsed**: `bigint` -• `Optional` **blobGasUsed**: `bigint` +Defined in: [vm/src/types.ts:490](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L490) This is the blob gas units times the fee per blob gas for 4844 transactions -#### Defined in - -[vm/src/types.ts:442](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L442) - -___ +*** ### bloom -• **bloom**: `Bloom` +> **bloom**: `Bloom` -Bloom filter resulted from transaction +Defined in: [vm/src/types.ts:448](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L448) -#### Defined in +Bloom filter resulted from transaction -[vm/src/types.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L400) +*** -___ +### createdAddress? -### createdAddress +> `optional` **createdAddress**: `Address` -• `Optional` **createdAddress**: `Address` +Defined in: evm/dist/esm/types.d.ts:333 Address of created account during transaction, if any #### Inherited from -EVMResult.createdAddress - -#### Defined in - -evm/dist/cjs/types.d.ts:248 +`EVMResult.createdAddress` -___ +*** ### execResult -• **execResult**: `ExecResult` +> **execResult**: `ExecResult` + +Defined in: evm/dist/esm/types.d.ts:337 Contains the results from running the code, if any, as described in runCode #### Inherited from -EVMResult.execResult - -#### Defined in +`EVMResult.execResult` -evm/dist/cjs/types.d.ts:252 - -___ +*** ### gasRefund -• **gasRefund**: `bigint` - -The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) +> **gasRefund**: `bigint` -#### Defined in +Defined in: [vm/src/types.ts:470](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L470) -[vm/src/types.ts:422](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L422) +The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) -___ +*** ### minerValue -• **minerValue**: `bigint` +> **minerValue**: `bigint` -The value that accrues to the miner by this transaction +Defined in: [vm/src/types.ts:485](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L485) -#### Defined in +The value that accrues to the miner by this transaction -[vm/src/types.ts:437](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L437) +*** -___ +### preimages? -### preimages +> `optional` **preimages**: `Map`\<`` `0x${string}` ``, `Uint8Array`\<`ArrayBufferLike`\>\> -• `Optional` **preimages**: `Map`<`string`, `Uint8Array`\> +Defined in: [vm/src/types.ts:480](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L480) Preimages mapping of the touched accounts from the tx (see `reportPreimages` option) -#### Defined in - -[vm/src/types.ts:432](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L432) - -___ +*** ### receipt -• **receipt**: [`TxReceipt`](../README.md#txreceipt) - -The tx receipt +> **receipt**: [`TxReceipt`](../type-aliases/TxReceipt.md) -#### Defined in +Defined in: [vm/src/types.ts:458](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L458) -[vm/src/types.ts:410](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L410) +The tx receipt -___ +*** ### totalGasSpent -• **totalGasSpent**: `bigint` +> **totalGasSpent**: `bigint` + +Defined in: [vm/src/types.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L465) The amount of gas used in this transaction, which is paid for This contains the gas units that have been used on execution, plus the upfront cost, which consists of calldata cost, intrinsic cost and optionally the access list costs - -#### Defined in - -[vm/src/types.ts:417](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L417) diff --git a/packages/vm/docs/interfaces/SealBlockOpts.md b/packages/vm/docs/interfaces/SealBlockOpts.md index 181cdae7d06..aa6df549614 100644 --- a/packages/vm/docs/interfaces/SealBlockOpts.md +++ b/packages/vm/docs/interfaces/SealBlockOpts.md @@ -1,38 +1,33 @@ -[@ethereumjs/vm](../README.md) / SealBlockOpts +[**@ethereumjs/vm**](../README.md) -# Interface: SealBlockOpts +*** -Options for sealing a block. +[@ethereumjs/vm](../README.md) / SealBlockOpts -## Table of contents +# Interface: SealBlockOpts -### Properties +Defined in: [vm/src/types.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L235) -- [mixHash](SealBlockOpts.md#mixhash) -- [nonce](SealBlockOpts.md#nonce) +Options for sealing a block. ## Properties -### mixHash +### mixHash? + +> `optional` **mixHash**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **mixHash**: `Uint8Array` +Defined in: [vm/src/types.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L246) For PoW, the mixHash. Overrides the value passed in the constructor. -#### Defined in - -[vm/src/types.ts:210](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L210) +*** -___ +### nonce? -### nonce +> `optional` **nonce**: `Uint8Array`\<`ArrayBufferLike`\> -• `Optional` **nonce**: `Uint8Array` +Defined in: [vm/src/types.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L240) For PoW, the nonce. Overrides the value passed in the constructor. - -#### Defined in - -[vm/src/types.ts:204](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L204) diff --git a/packages/vm/docs/interfaces/VMOpts.md b/packages/vm/docs/interfaces/VMOpts.md index 7da1e53df69..35f21aed5f3 100644 --- a/packages/vm/docs/interfaces/VMOpts.md +++ b/packages/vm/docs/interfaces/VMOpts.md @@ -1,27 +1,22 @@ -[@ethereumjs/vm](../README.md) / VMOpts +[**@ethereumjs/vm**](../README.md) -# Interface: VMOpts +*** -Options for instantiating a [VM](../classes/VM.md). +[@ethereumjs/vm](../README.md) / VMOpts -## Table of contents +# Interface: VMOpts -### Properties +Defined in: [vm/src/types.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L99) -- [activatePrecompiles](VMOpts.md#activateprecompiles) -- [blockchain](VMOpts.md#blockchain) -- [common](VMOpts.md#common) -- [evm](VMOpts.md#evm) -- [genesisState](VMOpts.md#genesisstate) -- [profilerOpts](VMOpts.md#profileropts) -- [setHardfork](VMOpts.md#sethardfork) -- [stateManager](VMOpts.md#statemanager) +Options for instantiating a [VM](../classes/VM.md). ## Properties -### activatePrecompiles +### activatePrecompiles? + +> `optional` **activatePrecompiles**: `boolean` -• `Optional` **activatePrecompiles**: `boolean` +Defined in: [vm/src/types.ts:143](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L143) If true, create entries in the state tree for the precompiled contracts, saving some gas the first time each of them is called. @@ -35,27 +30,23 @@ the very first call, which is intended for testing networks. Default: `false` -#### Defined in - -[vm/src/types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L132) +*** -___ +### blockchain? -### blockchain +> `optional` **blockchain**: `EVMMockBlockchainInterface` -• `Optional` **blockchain**: `BlockchainInterface` +Defined in: [vm/src/types.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L129) A Blockchain object for storing/retrieving blocks -#### Defined in +*** -[vm/src/types.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L118) +### common? -___ +> `optional` **common**: `Common` -### common - -• `Optional` **common**: `Common` +Defined in: [vm/src/types.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L121) Use a Common instance if you want to change the chain setup. @@ -64,7 +55,7 @@ if you want to change the chain setup. - `chain`: all chains supported by `Common` or a custom chain - `hardfork`: `mainnet` hardforks up to the `Paris` hardfork -- `eips`: `1559` (usage e.g. `eips: [ 1559, ]`) +- `eips`: `2537` (usage e.g. `eips: [ 2537, ]`) Note: check the associated `@ethereumjs/evm` instance options documentation for supported EIPs. @@ -77,50 +68,67 @@ Default setup if no `Common` instance is provided: - `hardfork`: `paris` - `eips`: `[]` -#### Defined in - -[vm/src/types.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L110) +*** -___ +### evm? -### evm +> `optional` **evm**: `EVMInterface` -• `Optional` **evm**: `EVMInterface` +Defined in: [vm/src/types.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L176) Use a custom EVM to run Messages on. If this is not present, use the default EVM. -#### Defined in +*** -[vm/src/types.ts:153](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L153) +### evmOpts? -___ +> `optional` **evmOpts**: `EVMOpts` -### genesisState +Defined in: [vm/src/types.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L184) -• `Optional` **genesisState**: `GenesisState` +Often there is no need to provide a full custom EVM but only a few options need to be +adopted. This option allows to provide a custom set of EVM options to be passed. -A genesisState to generate canonical genesis for the "in-house" created stateManager if external -stateManager not provided for the VM, defaults to an empty state +Note: This option will throw if used in conjunction with a full custom EVM passed. -#### Defined in +*** -[vm/src/types.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L137) +### params? -___ +> `optional` **params**: `ParamsDict` -### profilerOpts +Defined in: [vm/src/types.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L171) -• `Optional` **profilerOpts**: [`VMProfilerOpts`](../README.md#vmprofileropts) +VM parameters sorted by EIP can be found in the exported `paramsVM` dictionary, +which is internally passed to the associated `@ethereumjs/common` instance which +manages parameter selection based on the hardfork and EIP settings. -#### Defined in +This option allows providing a custom set of parameters. Note that parameters +get fully overwritten, so you need to extend the default parameter dict +to provide the full parameter set. -[vm/src/types.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L155) +It is recommended to deep-clone the params object for this to avoid side effects: -___ +```ts +const params = JSON.parse(JSON.stringify(paramsVM)) +params['1559']['elasticityMultiplier'] = 10 // 2 +``` -### setHardfork +*** -• `Optional` **setHardfork**: `boolean` \| `BigIntLike` +### profilerOpts? + +> `optional` **profilerOpts**: [`VMProfilerOpts`](../type-aliases/VMProfilerOpts.md) + +Defined in: [vm/src/types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L186) + +*** + +### setHardfork? + +> `optional` **setHardfork**: `boolean` \| `BigIntLike` + +Defined in: [vm/src/types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L154) Set the hardfork either by timestamp (for HFs from Shanghai onwards) or by block number for older Hfs. @@ -130,18 +138,12 @@ transitions. Note that this should only be needed in very rare and specific scen Default: `false` (HF is set to whatever default HF is set by the Common instance) -#### Defined in - -[vm/src/types.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L148) +*** -___ +### stateManager? -### stateManager +> `optional` **stateManager**: `StateManagerInterface` -• `Optional` **stateManager**: `EVMStateManagerInterface` +Defined in: [vm/src/types.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L125) A StateManager instance to use as the state store - -#### Defined in - -[vm/src/types.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L114) diff --git a/packages/vm/docs/type-aliases/BuildStatus.md b/packages/vm/docs/type-aliases/BuildStatus.md new file mode 100644 index 00000000000..90b94389a06 --- /dev/null +++ b/packages/vm/docs/type-aliases/BuildStatus.md @@ -0,0 +1,11 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / BuildStatus + +# Type Alias: BuildStatus + +> **BuildStatus** = *typeof* [`BuildStatus`](../variables/BuildStatus.md)\[keyof *typeof* [`BuildStatus`](../variables/BuildStatus.md)\] + +Defined in: [vm/src/buildBlock.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L45) diff --git a/packages/vm/docs/type-aliases/EVMProfilerOpts.md b/packages/vm/docs/type-aliases/EVMProfilerOpts.md new file mode 100644 index 00000000000..ed969bce51a --- /dev/null +++ b/packages/vm/docs/type-aliases/EVMProfilerOpts.md @@ -0,0 +1,19 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / EVMProfilerOpts + +# Type Alias: EVMProfilerOpts + +> **EVMProfilerOpts** = `object` + +Defined in: [vm/src/types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L78) + +## Properties + +### enabled + +> **enabled**: `boolean` + +Defined in: [vm/src/types.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L79) diff --git a/packages/vm/docs/type-aliases/TxReceipt.md b/packages/vm/docs/type-aliases/TxReceipt.md new file mode 100644 index 00000000000..5ef7638c452 --- /dev/null +++ b/packages/vm/docs/type-aliases/TxReceipt.md @@ -0,0 +1,11 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / TxReceipt + +# Type Alias: TxReceipt + +> **TxReceipt** = [`PreByzantiumTxReceipt`](../interfaces/PreByzantiumTxReceipt.md) \| [`PostByzantiumTxReceipt`](../interfaces/PostByzantiumTxReceipt.md) \| [`EIP4844BlobTxReceipt`](../interfaces/EIP4844BlobTxReceipt.md) + +Defined in: [vm/src/types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L19) diff --git a/packages/vm/docs/type-aliases/VMEvent.md b/packages/vm/docs/type-aliases/VMEvent.md new file mode 100644 index 00000000000..4318d0747d7 --- /dev/null +++ b/packages/vm/docs/type-aliases/VMEvent.md @@ -0,0 +1,99 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / VMEvent + +# Type Alias: VMEvent + +> **VMEvent** = `object` + +Defined in: [vm/src/types.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L83) + +## Properties + +### afterBlock() + +> **afterBlock**: (`data`, `resolve?`) => `void` + +Defined in: [vm/src/types.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L85) + +#### Parameters + +##### data + +[`AfterBlockEvent`](../interfaces/AfterBlockEvent.md) + +##### resolve? + +(`result?`) => `void` + +#### Returns + +`void` + +*** + +### afterTx() + +> **afterTx**: (`data`, `resolve?`) => `void` + +Defined in: [vm/src/types.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L87) + +#### Parameters + +##### data + +[`AfterTxEvent`](../interfaces/AfterTxEvent.md) + +##### resolve? + +(`result?`) => `void` + +#### Returns + +`void` + +*** + +### beforeBlock() + +> **beforeBlock**: (`data`, `resolve?`) => `void` + +Defined in: [vm/src/types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L84) + +#### Parameters + +##### data + +`Block` + +##### resolve? + +(`result?`) => `void` + +#### Returns + +`void` + +*** + +### beforeTx() + +> **beforeTx**: (`data`, `resolve?`) => `void` + +Defined in: [vm/src/types.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L86) + +#### Parameters + +##### data + +`TypedTransaction` + +##### resolve? + +(`result?`) => `void` + +#### Returns + +`void` diff --git a/packages/vm/docs/type-aliases/VMProfilerOpts.md b/packages/vm/docs/type-aliases/VMProfilerOpts.md new file mode 100644 index 00000000000..1e2646afc8a --- /dev/null +++ b/packages/vm/docs/type-aliases/VMProfilerOpts.md @@ -0,0 +1,27 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / VMProfilerOpts + +# Type Alias: VMProfilerOpts + +> **VMProfilerOpts** = `object` + +Defined in: [vm/src/types.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L90) + +## Properties + +### reportAfterBlock? + +> `optional` **reportAfterBlock**: `boolean` + +Defined in: [vm/src/types.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L93) + +*** + +### reportAfterTx? + +> `optional` **reportAfterTx**: `boolean` + +Defined in: [vm/src/types.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L92) diff --git a/packages/vm/docs/variables/BuildStatus.md b/packages/vm/docs/variables/BuildStatus.md new file mode 100644 index 00000000000..8e3c709e3b0 --- /dev/null +++ b/packages/vm/docs/variables/BuildStatus.md @@ -0,0 +1,25 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / BuildStatus + +# Variable: BuildStatus + +> **BuildStatus**: `object` + +Defined in: [vm/src/buildBlock.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L45) + +## Type declaration + +### Build + +> `readonly` **Build**: `"build"` = `'build'` + +### Pending + +> `readonly` **Pending**: `"pending"` = `'pending'` + +### Reverted + +> `readonly` **Reverted**: `"reverted"` = `'reverted'` diff --git a/packages/vm/docs/variables/paramsVM.md b/packages/vm/docs/variables/paramsVM.md new file mode 100644 index 00000000000..4dbdf278ef6 --- /dev/null +++ b/packages/vm/docs/variables/paramsVM.md @@ -0,0 +1,11 @@ +[**@ethereumjs/vm**](../README.md) + +*** + +[@ethereumjs/vm](../README.md) / paramsVM + +# Variable: paramsVM + +> `const` **paramsVM**: `ParamsDict` + +Defined in: [vm/src/params.ts:3](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/params.ts#L3) diff --git a/packages/vm/examples/helpers/blockchain-mock-data.json b/packages/vm/examples/helpers/blockchain-mock-data.json deleted file mode 100644 index 7a16b1f9a33..00000000000 --- a/packages/vm/examples/helpers/blockchain-mock-data.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "_info": { - "comment": "", - "filledwith": "cpp-1.3.0+commit.70e7d177.Linux.g++", - "source": "../../tests/src/BlockchainTestsFiller/bcValidBlockTest/SimpleTxFiller.json" - }, - "blocks": [ - { - "blockHeader": { - "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty": "0x020000", - "extraData": "", - "gasLimit": "0x2fefd8", - "gasUsed": "0x5208", - "hash": "0x117545e24e3d1e1836bb92e3d6f3e77ac5b2ecd171a535830bf9b5afb8f522e5", - "mixHash": "0x0a55dc80ced5e71738a5a15e12f63be192a65c5cb257f8ee10c875c9599b5b52", - "nonce": "0xba58e9414abfa06f", - "number": "0x01", - "parentHash": "0x7285abd5b24742f184ad676e31f6054663b3529bc35ea2fcad8a3e0f642a46f7", - "receiptTrie": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2", - "stateRoot": "0xecc60e00b3fe5ce9f6e1a10e5469764daf51f1fe93c22ec3f9a7583a80357217", - "timestamp": "0x59af0178", - "transactionsTrie": "0x53d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dc", - "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "rlp": "0xf90260f901f9a07285abd5b24742f184ad676e31f6054663b3529bc35ea2fcad8a3e0f642a46f7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ecc60e00b3fe5ce9f6e1a10e5469764daf51f1fe93c22ec3f9a7583a80357217a053d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dca0056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088459af017880a00a55dc80ced5e71738a5a15e12f63be192a65c5cb257f8ee10c875c9599b5b5288ba58e9414abfa06ff861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1c0", - "transactions": [ - { - "data": "", - "gasLimit": "0xc350", - "gasPrice": "0x0a", - "nonce": "0x00", - "r": "0xf3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88", - "s": "0x12f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1", - "to": "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", - "v": "0x1b", - "value": "0x0a" - } - ], - "uncleHeaders": [] - } - ], - "genesisBlockHeader": { - "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty": "0x020000", - "extraData": "0x42", - "gasLimit": "0x2fefd8", - "gasUsed": "0x00", - "hash": "0x7285abd5b24742f184ad676e31f6054663b3529bc35ea2fcad8a3e0f642a46f7", - "mixHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "nonce": "0x0102030405060708", - "number": "0x00", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot": "0xcafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7", - "timestamp": "0x54c98c81", - "transactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "genesisRLP": "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421880102030405060708c0c0", - "lastblockhash": "0x117545e24e3d1e1836bb92e3d6f3e77ac5b2ecd171a535830bf9b5afb8f522e5", - "network": "Byzantium", - "postState": { - "0x095e7baea6a6c7c4c2dfeb977efac326af552d87": { - "balance": "0x0a", - "code": "", - "nonce": "0x00", - "storage": {} - }, - "0x8888f1f195afa192cfee860698584c030f4c9db1": { - "balance": "0x29a2241af62f3450", - "code": "", - "nonce": "0x00", - "storage": {} - }, - "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { - "balance": "0x025408afa6", - "code": "", - "nonce": "0x01", - "storage": {} - } - }, - "pre": { - "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { - "balance": "0x02540be400", - "code": "", - "nonce": "0x00", - "storage": {} - } - } -} diff --git a/packages/vm/examples/helpers/blockchain-mock-data.ts b/packages/vm/examples/helpers/blockchain-mock-data.ts new file mode 100644 index 00000000000..b4838cc9f42 --- /dev/null +++ b/packages/vm/examples/helpers/blockchain-mock-data.ts @@ -0,0 +1,96 @@ +export const blockchainMockData = { + _info: { + comment: '', + filledwith: 'cpp-1.3.0+commit.70e7d177.Linux.g++', + source: '../../tests/src/BlockchainTestsFiller/bcValidBlockTest/SimpleTxFiller.json', + }, + blocks: [ + { + blockHeader: { + bloom: + '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + coinbase: '0x8888f1f195afa192cfee860698584c030f4c9db1', + difficulty: '0x020000', + extraData: '', + gasLimit: '0x2fefd8', + gasUsed: '0x5208', + hash: '0x117545e24e3d1e1836bb92e3d6f3e77ac5b2ecd171a535830bf9b5afb8f522e5', + mixHash: '0x0a55dc80ced5e71738a5a15e12f63be192a65c5cb257f8ee10c875c9599b5b52', + nonce: '0xba58e9414abfa06f', + number: '0x01', + parentHash: '0x7285abd5b24742f184ad676e31f6054663b3529bc35ea2fcad8a3e0f642a46f7', + receiptTrie: '0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2', + stateRoot: '0xecc60e00b3fe5ce9f6e1a10e5469764daf51f1fe93c22ec3f9a7583a80357217', + timestamp: '0x59af0178', + transactionsTrie: '0x53d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dc', + uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', + }, + rlp: '0xf90260f901f9a07285abd5b24742f184ad676e31f6054663b3529bc35ea2fcad8a3e0f642a46f7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ecc60e00b3fe5ce9f6e1a10e5469764daf51f1fe93c22ec3f9a7583a80357217a053d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dca0056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088459af017880a00a55dc80ced5e71738a5a15e12f63be192a65c5cb257f8ee10c875c9599b5b5288ba58e9414abfa06ff861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1c0', + transactions: [ + { + data: '', + gasLimit: '0xc350', + gasPrice: '0x0a', + nonce: '0x00', + r: '0xf3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88', + s: '0x12f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1', + to: '0x095e7baea6a6c7c4c2dfeb977efac326af552d87', + v: '0x1b', + value: '0x0a', + }, + ], + uncleHeaders: [], + }, + ], + genesisBlockHeader: { + bloom: + '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + coinbase: '0x8888f1f195afa192cfee860698584c030f4c9db1', + difficulty: '0x020000', + extraData: '0x42', + gasLimit: '0x2fefd8', + gasUsed: '0x00', + hash: '0x7285abd5b24742f184ad676e31f6054663b3529bc35ea2fcad8a3e0f642a46f7', + mixHash: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', + nonce: '0x0102030405060708', + number: '0x00', + parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', + receiptTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', + stateRoot: '0xcafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7', + timestamp: '0x54c98c81', + transactionsTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', + uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', + }, + genesisRLP: + '0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421880102030405060708c0c0', + lastblockhash: '0x117545e24e3d1e1836bb92e3d6f3e77ac5b2ecd171a535830bf9b5afb8f522e5', + network: 'Byzantium', + postState: { + '0x095e7baea6a6c7c4c2dfeb977efac326af552d87': { + balance: '0x0a', + code: '', + nonce: '0x00', + storage: {}, + }, + '0x8888f1f195afa192cfee860698584c030f4c9db1': { + balance: '0x29a2241af62f3450', + code: '', + nonce: '0x00', + storage: {}, + }, + '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b': { + balance: '0x025408afa6', + code: '', + nonce: '0x01', + storage: {}, + }, + }, + pre: { + '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b': { + balance: '0x02540be400', + code: '', + nonce: '0x00', + storage: {}, + }, + }, +} diff --git a/packages/vm/examples/run-blockchain.ts b/packages/vm/examples/run-blockchain.ts index a5350df5c0d..6725bee235d 100644 --- a/packages/vm/examples/run-blockchain.ts +++ b/packages/vm/examples/run-blockchain.ts @@ -10,20 +10,14 @@ import { createBlock, createBlockFromRLP } from '@ethereumjs/block' import { EthashConsensus, createBlockchain } from '@ethereumjs/blockchain' import { Common, ConsensusAlgorithm, ConsensusType, Mainnet } from '@ethereumjs/common' import { Ethash } from '@ethereumjs/ethash' -import { - Address, - bytesToHex, - createAccount, - hexToBytes, - setLengthLeft, - toBytes, -} from '@ethereumjs/util' +import { Address, bytesToHex, createAccount, hexToBytes, setLengthLeft } from '@ethereumjs/util' import { createVM, runBlock } from '@ethereumjs/vm' -import testData from './helpers/blockchain-mock-data.json' +import { blockchainMockData } from './helpers/blockchain-mock-data.ts' -import type { Block } from '@ethereumjs/block' +import type { Block, HeaderData } from '@ethereumjs/block' import type { Blockchain, ConsensusDict } from '@ethereumjs/blockchain' +import type { PrefixedHexString } from '@ethereumjs/util' import type { VM } from '@ethereumjs/vm' async function setupPreConditions(vm: VM, data: any) { @@ -38,31 +32,34 @@ async function setupPreConditions(vm: VM, data: any) { for (const [key, val] of Object.entries(storage)) { const storageKey = setLengthLeft(hexToBytes(key), 32) - const storageVal = hexToBytes(val as string) + const storageVal = hexToBytes(val as PrefixedHexString) await vm.stateManager.putStorage(address, storageKey, storageVal) } - const codeBuf = hexToBytes('0x' + code) + const codeBuf = hexToBytes(`0x${code}`) await vm.stateManager.putCode(address, codeBuf) } await vm.stateManager.commit() } -async function putBlocks(blockchain: Blockchain, common: Common, data: typeof testData) { +async function putBlocks(blockchain: Blockchain, common: Common, data: typeof blockchainMockData) { for (const blockData of data.blocks) { - const blockRlp = toBytes(blockData.rlp) + const blockRlp = hexToBytes(blockData.rlp as PrefixedHexString) const block = createBlockFromRLP(blockRlp, { common }) await blockchain.putBlock(block) } } async function main() { - const common = new Common({ chain: Mainnet, hardfork: testData.network.toLowerCase() }) + const common = new Common({ chain: Mainnet, hardfork: blockchainMockData.network.toLowerCase() }) const validatePow = common.consensusType() === ConsensusType.ProofOfWork const validateBlocks = true - const genesisBlock = createBlock({ header: testData.genesisBlockHeader }, { common }) + const genesisBlock = createBlock( + { header: blockchainMockData.genesisBlockHeader as HeaderData }, + { common }, + ) const consensusDict: ConsensusDict = {} consensusDict[ConsensusAlgorithm.Ethash] = new EthashConsensus(new Ethash()) @@ -76,9 +73,9 @@ async function main() { const vm = await createVM({ blockchain, common }) - await setupPreConditions(vm, testData) + await setupPreConditions(vm, blockchainMockData) - await putBlocks(blockchain, common, testData) + await putBlocks(blockchain, common, blockchainMockData) await blockchain.iterator('vm', async (block: Block, _reorg: boolean) => { const parentBlock = await blockchain!.getBlock(block.header.parentHash) @@ -87,11 +84,11 @@ async function main() { await runBlock(vm, { block, root: parentState, skipHardForkValidation: true }) }) - const blockchainHead = await vm.blockchain.getIteratorHead!() + const blockchainHead = await vm.blockchain['getIteratorHead']() console.log('--- Finished processing the Blockchain ---') console.log('New head:', bytesToHex(blockchainHead.hash())) - console.log('Expected:', testData.lastblockhash) + console.log('Expected:', blockchainMockData.lastblockhash) } void main() diff --git a/packages/vm/examples/run-solidity-contract.ts b/packages/vm/examples/run-solidity-contract.ts index bf102c22df3..e03448eeba1 100644 --- a/packages/vm/examples/run-solidity-contract.ts +++ b/packages/vm/examples/run-solidity-contract.ts @@ -12,7 +12,7 @@ import solc from 'solc' import { getAccountNonce, insertAccount } from './helpers/account-utils.ts' import { buildTransaction, encodeDeployment, encodeFunction } from './helpers/tx-builder.ts' -import type { Address } from '@ethereumjs/util' +import type { Address, PrefixedHexString } from '@ethereumjs/util' import type { VM } from '@ethereumjs/vm' const INITIAL_GREETING = 'Hello, World!' @@ -147,7 +147,8 @@ async function setGreeting( } async function getGreeting(vm: VM, contractAddress: Address, caller: Address) { - const sigHash = new Interface(['function greet()']).getFunction('greet')!.selector + const sigHash = new Interface(['function greet()']).getFunction('greet')! + .selector as PrefixedHexString const greetResult = await vm.evm.runCall({ to: contractAddress, diff --git a/packages/vm/examples/runGoerliBlock.ts b/packages/vm/examples/runGoerliBlock.ts index 4bc191377dc..ce95ed347a9 100644 --- a/packages/vm/examples/runGoerliBlock.ts +++ b/packages/vm/examples/runGoerliBlock.ts @@ -1,20 +1,16 @@ -import type { JSONRPCBlock } from '@ethereumjs/block' -import { createBlockFromRPC } from '@ethereumjs/block' +import { createBlock } from '@ethereumjs/block' import { Common } from '@ethereumjs/common' -import { goerliChainConfig } from '@ethereumjs/testdata' +import { goerliBlocks, goerliChainConfig } from '@ethereumjs/testdata' import { bytesToHex } from '@ethereumjs/util' - -import { createVM, runBlock } from '../src/index.ts' - -import goerliBlock2 from './testData/goerliBlock2.json' +import { createVM, runBlock } from '@ethereumjs/vm' const main = async () => { const common = new Common({ chain: goerliChainConfig, hardfork: 'london' }) const vm = await createVM({ common, setHardfork: true }) - const block = createBlockFromRPC(goerliBlock2 as JSONRPCBlock, undefined, { common }) + const block = createBlock(goerliBlocks[0], { common }) const result = await runBlock(vm, { block, generate: true, skipHeaderValidation: true }) // we skip header validation since we are running a block without the full Ethereum history available - console.log(`The state root for Goerli block 2 is ${bytesToHex(result.stateRoot)}`) + console.log(`The state root for the block is ${bytesToHex(result.stateRoot)}`) } void main() diff --git a/packages/vm/examples/testData/goerliBlock2.json b/packages/vm/examples/testData/goerliBlock2.json deleted file mode 100644 index 53d0febceea..00000000000 --- a/packages/vm/examples/testData/goerliBlock2.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "number": "0x2", - "hash": "0xe675f1362d82cdd1ec260b16fb046c17f61d8a84808150f5d715ccce775f575e", - "transactions": [], - "difficulty": "0x2", - "extraData": "0x506172697479205465636820417574686f726974790000000000000000000000fdd66d441eff7d4116fe987f0f10812fc68b06cc500ff71c492234b9a7b8b2f45597190d97cd85f6daa45ac9518bef9f715f4bd414504b1a21d8c681654055df00", - "gasLimit": "0x9fb00c", - "gasUsed": "0x0", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "miner": "0x0000000000000000000000000000000000000000", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "nonce": "0x0000000000000000", - "parentHash": "0x8f5bab218b6bb34476f51ca588e9f4553a3a7ce5e13a66c660a5283e97e9a85a", - "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "size": "0x25e", - "stateRoot": "0x5d6cded585e73c4e322c30c2f782a336316f17dd85a4863b9d838d2d4b8b3008", - "timestamp": "0x5c53100c", - "totalDifficulty": "0x5", - "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncles": [] -} diff --git a/packages/vm/examples/vmWith4844.ts b/packages/vm/examples/vmWith4844.ts index c96401348fb..85701745199 100644 --- a/packages/vm/examples/vmWith4844.ts +++ b/packages/vm/examples/vmWith4844.ts @@ -1,6 +1,5 @@ import { Common, Hardfork, Mainnet } from '@ethereumjs/common' - -import { createVM } from '../src/index.ts' +import { createVM } from '@ethereumjs/vm' const main = async () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.Shanghai, eips: [4844] }) diff --git a/packages/vm/examples/vmWithEIPs.ts b/packages/vm/examples/vmWithEIPs.ts index 0a8368a1605..e833fcf5533 100644 --- a/packages/vm/examples/vmWithEIPs.ts +++ b/packages/vm/examples/vmWithEIPs.ts @@ -1,9 +1,11 @@ -import { Common, Mainnet } from '@ethereumjs/common' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { createVM } from '@ethereumjs/vm' const main = async () => { - const common = new Common({ chain: Mainnet, eips: [7702] }) + const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) const vm = await createVM({ common }) - console.log(`EIP 7702 is active in the VM - ${vm.common.isActivatedEIP(7702)}`) + console.log( + `EIP 7702 is active in isolation on top of the Cancun HF - ${vm.common.isActivatedEIP(7702)}`, + ) } void main() diff --git a/packages/vm/examples/vmWithGenesisState.ts b/packages/vm/examples/vmWithGenesisState.ts index 63c90c10664..3e03ea76bb2 100644 --- a/packages/vm/examples/vmWithGenesisState.ts +++ b/packages/vm/examples/vmWithGenesisState.ts @@ -8,16 +8,15 @@ const main = async () => { const vm = await createVM() await vm.stateManager.generateCanonicalGenesis!(genesisState) - const account = await vm.stateManager.getAccount( - createAddressFromString('0x000d836201318ec6899a67540690382780743280'), - ) + const accountAddress = '0x000d836201318ec6899a67540690382780743280' + const account = await vm.stateManager.getAccount(createAddressFromString(accountAddress)) if (account === undefined) { throw new Error('Account does not exist: failed to import genesis state') } console.log( - `This balance for account 0x000d836201318ec6899a67540690382780743280 in this chain's genesis state is ${Number( + `This balance for account ${accountAddress} in this chain's genesis state is ${Number( account?.balance, )}`, ) diff --git a/packages/vm/package.json b/packages/vm/package.json index c4cf945c139..40ae74fee0d 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -36,7 +36,7 @@ "build:benchmarks": "npm run build && tsc -p tsconfig.benchmarks.json", "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ./vitest.config.coverage.ts", - "docs:build": "typedoc --options typedoc.cjs", + "docs:build": "typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- vm", "examples:build": "npx embedme README.md", "formatTest": "node ./scripts/formatTest", @@ -69,7 +69,7 @@ "@ethereumjs/util": "^10.0.0-rc.1", "@ethereumjs/verkle": "^10.0.0-dev-rc.1", "debug": "^4.4.0", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "eventemitter3": "^5.0.1" }, "devDependencies": { diff --git a/packages/vm/src/requests.ts b/packages/vm/src/requests.ts index ebe42c7baf4..5f7e387b88f 100644 --- a/packages/vm/src/requests.ts +++ b/packages/vm/src/requests.ts @@ -5,8 +5,8 @@ import { EthereumJSErrorWithoutCode, bigIntToAddressBytes, bigIntToBytes, + bytesToBigInt, bytesToHex, - bytesToInt, concatBytes, createAddressFromString, setLengthLeft, @@ -16,6 +16,18 @@ import type { RunTxResult } from './types.ts' import type { VM } from './vm.ts' const DEPOSIT_TOPIC = '0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5' +const PUBKEY_OFFSET = BigInt(160) +const WITHDRAWAL_CREDENTIALS_OFFSET = BigInt(256) +const AMOUNT_OFFSET = BigInt(320) +const SIGNATURE_OFFSET = BigInt(384) +const INDEX_OFFSET = BigInt(512) +const PUBKEY_SIZE = BigInt(48) +const WITHDRAWAL_CREDENTIALS_SIZE = BigInt(32) +const AMOUNT_SIZE = BigInt(8) +const SIGNATURE_SIZE = BigInt(96) +const INDEX_SIZE = BigInt(8) +const LOG_SIZE = 576 +const LOG_LAYOUT_MISMATCH = 'invalid deposit log: unsupported data layout' /** * This helper method generates a list of all CL requests that can be included in a pending block @@ -158,6 +170,9 @@ const accumulateDepositsRequest = ( } function parseDepositLog(requestData: Uint8Array) { + if (requestData.length !== LOG_SIZE) { + throw EthereumJSErrorWithoutCode(LOG_LAYOUT_MISMATCH) + } // Extracts validator pubkey, withdrawal credential, deposit amount, signature, // and validator index from Deposit Event log. // The event fields are non-indexed so contained in one byte array (log[2]) so parsing is as follows: @@ -166,18 +181,51 @@ function parseDepositLog(requestData: Uint8Array) { // 3. Read 32 bytes starting with the first field position to get the size of the first field // 4. Read the bytes from first field position + 32 + the size of the first field to get the first field value // 5. Repeat steps 3-4 for each field - const pubKeyIdx = bytesToInt(requestData.slice(0, 32)) - const pubKeySize = bytesToInt(requestData.slice(pubKeyIdx, pubKeyIdx + 32)) - const withdrawalCreditsIdx = bytesToInt(requestData.slice(32, 64)) - const withdrawalCreditsSize = bytesToInt( + const pubKeyIdxBigInt = bytesToBigInt(requestData.slice(0, 32)) + const withdrawalCreditsIdxBigInt = bytesToBigInt(requestData.slice(32, 64)) + const amountIdxBigInt = bytesToBigInt(requestData.slice(64, 96)) + const sigIdxBigInt = bytesToBigInt(requestData.slice(96, 128)) + const indexIdxBigInt = bytesToBigInt(requestData.slice(128, 160)) + + if ( + pubKeyIdxBigInt !== PUBKEY_OFFSET || + withdrawalCreditsIdxBigInt !== WITHDRAWAL_CREDENTIALS_OFFSET || + amountIdxBigInt !== AMOUNT_OFFSET || + sigIdxBigInt !== SIGNATURE_OFFSET || + indexIdxBigInt !== INDEX_OFFSET + ) { + throw EthereumJSErrorWithoutCode(LOG_LAYOUT_MISMATCH) + } + + const pubKeyIdx = Number(pubKeyIdxBigInt) + const withdrawalCreditsIdx = Number(withdrawalCreditsIdxBigInt) + const amountIdx = Number(amountIdxBigInt) + const sigIdx = Number(sigIdxBigInt) + const indexIdx = Number(indexIdxBigInt) + + const pubKeySizeBigInt = bytesToBigInt(requestData.slice(pubKeyIdx, pubKeyIdx + 32)) + const withdrawalCreditsSizeBigInt = bytesToBigInt( requestData.slice(withdrawalCreditsIdx, withdrawalCreditsIdx + 32), ) - const amountIdx = bytesToInt(requestData.slice(64, 96)) - const amountSize = bytesToInt(requestData.slice(amountIdx, amountIdx + 32)) - const sigIdx = bytesToInt(requestData.slice(96, 128)) - const sigSize = bytesToInt(requestData.slice(sigIdx, sigIdx + 32)) - const indexIdx = bytesToInt(requestData.slice(128, 160)) - const indexSize = bytesToInt(requestData.slice(indexIdx, indexIdx + 32)) + const amountSizeBigInt = bytesToBigInt(requestData.slice(amountIdx, amountIdx + 32)) + const sigSizeBigInt = bytesToBigInt(requestData.slice(sigIdx, sigIdx + 32)) + const indexSizeBigInt = bytesToBigInt(requestData.slice(indexIdx, indexIdx + 32)) + + if ( + pubKeySizeBigInt !== PUBKEY_SIZE || + withdrawalCreditsSizeBigInt !== WITHDRAWAL_CREDENTIALS_SIZE || + amountSizeBigInt !== AMOUNT_SIZE || + sigSizeBigInt !== SIGNATURE_SIZE || + indexSizeBigInt !== INDEX_SIZE + ) { + throw EthereumJSErrorWithoutCode(LOG_LAYOUT_MISMATCH) + } + + const pubKeySize = Number(pubKeySizeBigInt) + const withdrawalCreditsSize = Number(withdrawalCreditsSizeBigInt) + const amountSize = Number(amountSizeBigInt) + const sigSize = Number(sigSizeBigInt) + const indexSize = Number(indexSizeBigInt) const pubkey = requestData.slice(pubKeyIdx + 32, pubKeyIdx + 32 + pubKeySize) const withdrawalCredentials = requestData.slice( diff --git a/packages/vm/src/runBlock.ts b/packages/vm/src/runBlock.ts index a660c13b5f0..c2299dc349f 100644 --- a/packages/vm/src/runBlock.ts +++ b/packages/vm/src/runBlock.ts @@ -3,7 +3,7 @@ import { ConsensusType, Hardfork } from '@ethereumjs/common' import { type EVM, type EVMInterface, VerkleAccessWitness } from '@ethereumjs/evm' import { MerklePatriciaTrie } from '@ethereumjs/mpt' import { RLP } from '@ethereumjs/rlp' -import { StatelessVerkleStateManager, verifyVerkleStateProof } from '@ethereumjs/statemanager' +import { type StatelessVerkleStateManager, verifyVerkleStateProof } from '@ethereumjs/statemanager' import { TransactionType } from '@ethereumjs/tx' import { Account, @@ -160,10 +160,11 @@ export async function runBlock(vm: VM, opts: RunBlockOpts): Promise { throw Error(`Verkle access witness needed for execution of verkle blocks`) } - if ( - !(vm.stateManager instanceof StatefulVerkleStateManager) && - !(vm.stateManager instanceof StatelessVerkleStateManager) - ) { + // Check if statemanager is a Verkle State Manager (stateless and stateful both have verifyVerklePostState) + if (!('verifyVerklePostState' in vm.stateManager)) { throw EthereumJSErrorWithoutCode(`Verkle State Manager needed for execution of verkle blocks`) } stateAccesses = vm.evm.verkleAccessWitness - txAccesses = new VerkleAccessWitness({ verkleCrypto: vm.stateManager.verkleCrypto }) + txAccesses = new VerkleAccessWitness({ + verkleCrypto: (vm.stateManager as StatelessVerkleStateManager | StatefulVerkleStateManager) + .verkleCrypto, + }) } else if (vm.common.isActivatedEIP(7864)) { if (vm.evm.binaryTreeAccessWitness === undefined) { throw Error(`Binary tree access witness needed for execution of binary tree blocks`) } - if (!(vm.stateManager instanceof StatefulBinaryTreeStateManager)) { + // Check if statemanager is a BinaryTreeStateManager by checking for a method only on BinaryTreeStateManager API + if (!('verifyBinaryPostState' in vm.stateManager)) { throw EthereumJSErrorWithoutCode( `Binary tree State Manager needed for execution of binary tree blocks`, ) @@ -510,7 +512,7 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { // Address to set code to let authority try { - authority = recoverAuthority(data) + authority = eoaCode7702RecoverAuthority(data) } catch { // Invalid signature, continue continue diff --git a/packages/vm/test/api/EIPs/eip-2935-historical-block-hashes.spec.ts b/packages/vm/test/api/EIPs/eip-2935-historical-block-hashes.spec.ts index 49fa30be1e5..cf5874679b2 100644 --- a/packages/vm/test/api/EIPs/eip-2935-historical-block-hashes.spec.ts +++ b/packages/vm/test/api/EIPs/eip-2935-historical-block-hashes.spec.ts @@ -136,7 +136,7 @@ describe('EIP 2935: historical block hashes', () => { const historyAddress = createAddressFromString(deployedToAddress) const historyAddressBigInt = bytesToBigInt(historyAddress.bytes) - const contract2935Code = hexToBytes(contract2935CodeHex as string) + const contract2935Code = hexToBytes(contract2935CodeHex as PrefixedHexString) async function testBlockhashContract(vm: VM, block: Block, i: bigint): Promise { const tx = createLegacyTx({ @@ -284,7 +284,7 @@ describe('EIP 2935: historical block hashes', () => { // Code: RETURN the BLOCKHASH of block i // PUSH(i) BLOCKHASH PUSH(32) MSTORE PUSH(64) PUSH(0) RETURN // Note: need to return a contract with starting zero bytes to avoid non-deployable contracts by EIP 3540 - data: hexToBytes('0x61' + i.toString(16).padStart(4, '0') + '4060205260406000F3'), + data: hexToBytes(`0x61${i.toString(16).padStart(4, '0')}4060205260406000F3`), block: lastBlock, }) diff --git a/packages/vm/test/api/EIPs/eip-3855.spec.ts b/packages/vm/test/api/EIPs/eip-3855.spec.ts index 55a75ef5be4..261112d157f 100644 --- a/packages/vm/test/api/EIPs/eip-3855.spec.ts +++ b/packages/vm/test/api/EIPs/eip-3855.spec.ts @@ -1,8 +1,8 @@ import { Common, Hardfork, Mainnet } from '@ethereumjs/common' -import { EVMErrorMessages } from '@ethereumjs/evm' import { hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' +import { EVMError } from '@ethereumjs/evm' import { createVM } from '../../../src/index.ts' describe('EIP 3855 tests', () => { @@ -65,7 +65,7 @@ describe('EIP 3855 tests', () => { gasLimit: BigInt(10000), }) - assert.equal(result.exceptionError?.error, EVMErrorMessages.STACK_OVERFLOW) + assert.equal(result.exceptionError?.error, EVMError.errorMessages.STACK_OVERFLOW) }) it('push0 is not available if EIP3855 is not activated', async () => { @@ -76,6 +76,6 @@ describe('EIP 3855 tests', () => { gasLimit: BigInt(10000), }) - assert.equal(result.exceptionError!.error, EVMErrorMessages.INVALID_OPCODE) + assert.equal(result.exceptionError!.error, EVMError.errorMessages.INVALID_OPCODE) }) }) diff --git a/packages/vm/test/api/EIPs/eip-4844-blobs.spec.ts b/packages/vm/test/api/EIPs/eip-4844-blobs.spec.ts index 3a2d1d01fb6..b4853a8610e 100644 --- a/packages/vm/test/api/EIPs/eip-4844-blobs.spec.ts +++ b/packages/vm/test/api/EIPs/eip-4844-blobs.spec.ts @@ -100,4 +100,4 @@ describe('EIP4844 tests', () => { assert.deepEqual(result.stateRoot, block.header.stateRoot) assert.deepEqual(result.logsBloom, block.header.logsBloom) }) -}) +}, 20000) diff --git a/packages/vm/test/api/EIPs/eip-7702.spec.ts b/packages/vm/test/api/EIPs/eip-7702.spec.ts index 83222343e03..6c060a629a3 100644 --- a/packages/vm/test/api/EIPs/eip-7702.spec.ts +++ b/packages/vm/test/api/EIPs/eip-7702.spec.ts @@ -20,8 +20,7 @@ import { assert, describe, it } from 'vitest' import { createVM, runTx } from '../../../src/index.ts' -import type { AuthorizationListBytesItem } from '@ethereumjs/tx' -import type { PrefixedHexString } from '@ethereumjs/util' +import type { EOACode7702AuthorizationListBytesItem, PrefixedHexString } from '@ethereumjs/util' import { secp256k1 } from 'ethereum-cryptography/secp256k1' import type { VM } from '../../../src/index.ts' @@ -46,7 +45,7 @@ type GetAuthListOpts = { pkey?: Uint8Array } -function getAuthorizationListItem(opts: GetAuthListOpts): AuthorizationListBytesItem { +function getAuthorizationListItem(opts: GetAuthListOpts): EOACode7702AuthorizationListBytesItem { const actualOpts = { ...{ chainId: 0, pkey: defaultAuthPkey }, ...opts, diff --git a/packages/vm/test/api/buildBlock.spec.ts b/packages/vm/test/api/buildBlock.spec.ts index c8d43bf16e3..b169f4aaddb 100644 --- a/packages/vm/test/api/buildBlock.spec.ts +++ b/packages/vm/test/api/buildBlock.spec.ts @@ -8,6 +8,7 @@ import { EthashConsensus, createBlockchain } from '@ethereumjs/blockchain' import { Common, ConsensusAlgorithm, + type GethGenesis, Hardfork, Mainnet, createCommonFromGethGenesis, @@ -157,7 +158,7 @@ describe('BlockBuilder', () => { epoch: 30000, }, } - const defaultChainData = { + const defaultChainData: GethGenesis = { config: { chainId: 123456, homesteadBlock: 0, @@ -183,6 +184,7 @@ describe('BlockBuilder', () => { gasUsed: '0x0', parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', baseFeePerGas: 7, + alloc: {}, } const A = { @@ -191,7 +193,7 @@ describe('BlockBuilder', () => { } const addr = A.address.toString().slice(2) - const extraData2 = '0x' + '0'.repeat(64) + addr + '0'.repeat(130) + const extraData2 = `0x${'0'.repeat(64)}${addr}${'0'.repeat(130)}` const chainData = { ...defaultChainData, extraData: extraData2, diff --git a/packages/vm/test/api/customChain.spec.ts b/packages/vm/test/api/customChain.spec.ts index da2186bb960..5f7efd8822a 100644 --- a/packages/vm/test/api/customChain.spec.ts +++ b/packages/vm/test/api/customChain.spec.ts @@ -100,7 +100,7 @@ describe('VM initialized with custom state', () => { const callResult = await vm.evm.runCall({ to: createAddressFromString(contractAddress), - data: hexToBytes(calldata), + data: hexToBytes(calldata as PrefixedHexString), caller: createAddressFromPrivateKey(privateKey), }) diff --git a/packages/vm/test/api/events.spec.ts b/packages/vm/test/api/events.spec.ts index 05c8fa27c58..8e032ccb3a4 100644 --- a/packages/vm/test/api/events.spec.ts +++ b/packages/vm/test/api/events.spec.ts @@ -1,12 +1,12 @@ import { Block } from '@ethereumjs/block' import { createFeeMarket1559Tx } from '@ethereumjs/tx' -import { Account, bytesToHex, createAddressFromPrivateKey, toBytes } from '@ethereumjs/util' +import { Account, bytesToHex, createAddressFromPrivateKey, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' import { createVM, runBlock, runTx } from '../../src/index.ts' describe('VM events', () => { - const privKey = toBytes('0xa5737ecdc1b89ca0091647e727ba082ed8953f29182e94adc397210dda643b07') + const privKey = hexToBytes('0xa5737ecdc1b89ca0091647e727ba082ed8953f29182e94adc397210dda643b07') it('should emit the Block before running it', async () => { const vm = await createVM() @@ -129,7 +129,7 @@ describe('VM events', () => { await runTx(vm, { tx, skipBalance: true, skipHardForkValidation: true }) - assert.equal(bytesToHex(emitted.createdAddress), '0x') + assert.equal(bytesToHex(emitted.execResult.returnValue), '0x') }) it('should emit InterpreterStep on each step', async () => { diff --git a/packages/vm/test/api/istanbul/eip-1344.spec.ts b/packages/vm/test/api/istanbul/eip-1344.spec.ts index 1e6b358bdda..3f5971ef016 100644 --- a/packages/vm/test/api/istanbul/eip-1344.spec.ts +++ b/packages/vm/test/api/istanbul/eip-1344.spec.ts @@ -1,5 +1,5 @@ import { Common, Hardfork, Mainnet } from '@ethereumjs/common' -import { EVMErrorMessages } from '@ethereumjs/evm' +import { EVMError } from '@ethereumjs/evm' import { bytesToBigInt, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' @@ -7,7 +7,7 @@ import { createVM } from '../../../src/index.ts' const testCases = [ { chain: Mainnet, hardfork: Hardfork.Istanbul, chainId: BigInt(1) }, - { chain: Mainnet, hardfork: Hardfork.Constantinople, err: EVMErrorMessages.INVALID_OPCODE }, + { chain: Mainnet, hardfork: Hardfork.Constantinople, err: EVMError.errorMessages.INVALID_OPCODE }, ] // CHAINID PUSH8 0x00 MSTORE8 PUSH8 0x01 PUSH8 0x00 RETURN diff --git a/packages/vm/test/api/istanbul/eip-1884.spec.ts b/packages/vm/test/api/istanbul/eip-1884.spec.ts index 6cd2abf5bd0..c5d3ebc9fbf 100644 --- a/packages/vm/test/api/istanbul/eip-1884.spec.ts +++ b/packages/vm/test/api/istanbul/eip-1884.spec.ts @@ -1,5 +1,5 @@ import { Common, Hardfork, Mainnet } from '@ethereumjs/common' -import { EVMErrorMessages } from '@ethereumjs/evm' +import { EVMError } from '@ethereumjs/evm' import { Address, bytesToBigInt, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' @@ -8,7 +8,7 @@ import { createAccountWithDefaults } from '../utils.ts' const testCases = [ { chain: Mainnet, hardfork: Hardfork.Istanbul, selfbalance: '0xf1' }, - { chain: Mainnet, hardfork: Hardfork.Constantinople, err: EVMErrorMessages.INVALID_OPCODE }, + { chain: Mainnet, hardfork: Hardfork.Constantinople, err: EVMError.errorMessages.INVALID_OPCODE }, ] // SELFBALANCE PUSH8 0x00 MSTORE8 PUSH8 0x01 PUSH8 0x00 RETURN diff --git a/packages/vm/test/api/runBlock.spec.ts b/packages/vm/test/api/runBlock.spec.ts index 5eeada1418b..932ed4dca61 100644 --- a/packages/vm/test/api/runBlock.spec.ts +++ b/packages/vm/test/api/runBlock.spec.ts @@ -30,7 +30,6 @@ import { equalsBytes, hexToBytes, privateToAddress, - toBytes, unpadBytes, utf8ToBytes, } from '@ethereumjs/util' @@ -46,8 +45,13 @@ import { blockchainData } from './testdata/blockchain.ts' import { createAccountWithDefaults, setBalance, setupVM } from './utils.ts' import type { Block, BlockBytes } from '@ethereumjs/block' -import type { AuthorizationListBytesItem, TypedTransaction } from '@ethereumjs/tx' -import type { NestedUint8Array, PrefixedHexString, VerkleExecutionWitness } from '@ethereumjs/util' +import type { TypedTransaction } from '@ethereumjs/tx' +import type { + EOACode7702AuthorizationListBytesItem, + NestedUint8Array, + PrefixedHexString, + VerkleExecutionWitness, +} from '@ethereumjs/util' import type { VM } from '../../src/index.ts' import type { AfterBlockEvent, @@ -113,7 +117,7 @@ describe('runBlock() -> successful API parameter usage', async () => { skipHardForkValidation: true, }) - const block3Rlp = toBytes(uncleData.blocks[2].rlp as PrefixedHexString) + const block3Rlp = hexToBytes(uncleData.blocks[2].rlp as PrefixedHexString) const block3 = createBlockFromRLP(block3Rlp, { common }) await runBlock(vm, { block: block3, @@ -611,7 +615,9 @@ describe('runBlock() -> tx types', async () => { pkey?: Uint8Array } - function getAuthorizationListItem(opts: GetAuthListOpts): AuthorizationListBytesItem { + function getAuthorizationListItem( + opts: GetAuthListOpts, + ): EOACode7702AuthorizationListBytesItem { const actualOpts = { ...{ chainId: 0, pkey: defaultAuthPkey }, ...opts, diff --git a/packages/vm/test/api/runTx.spec.ts b/packages/vm/test/api/runTx.spec.ts index c31854d8b80..a0793999042 100644 --- a/packages/vm/test/api/runTx.spec.ts +++ b/packages/vm/test/api/runTx.spec.ts @@ -926,4 +926,4 @@ describe('EIP 4844 transaction tests', () => { assert.equal(res.blobGasUsed, 131072n, 'returns correct blob gas used for 1 blob') Blockchain.prototype.getBlock = oldGetBlockFunction }) -}) +}, 20000) diff --git a/packages/vm/test/api/t8ntool/t8ntool.spec.ts b/packages/vm/test/api/t8ntool/t8ntool.spec.ts index 656a65e2571..90649d1eee9 100644 --- a/packages/vm/test/api/t8ntool/t8ntool.spec.ts +++ b/packages/vm/test/api/t8ntool/t8ntool.spec.ts @@ -3,8 +3,20 @@ import { assert, describe, it } from 'vitest' import { TransitionTool } from '../../t8n/t8ntool.ts' -import type { T8NOptions } from '../../t8n/types.ts' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { MerkleStateManager } from '@ethereumjs/statemanager' +import { createTx } from '@ethereumjs/tx' +import { + Account, + type PrefixedHexString, + createAddressFromPrivateKey, + hexToBytes, + randomBytes, +} from '@ethereumjs/util' +import { createVM, runTx } from '../../../src/index.ts' +import { stepTraceJSON, summaryTraceJSON } from '../../t8n/helpers.ts' +import type { T8NOptions } from '../../t8n/types.ts' const t8nDir = 'test/t8n/testdata/' const args: T8NOptions = { @@ -24,6 +36,7 @@ const args: T8NOptions = { alloc: `output/allocTEST.json`, }, log: false, + trace: false, } // This test is generated using `execution-spec-tests` commit 88cab2521322191b2ec7ef7d548740c0b0a264fc, running: @@ -34,11 +47,173 @@ const args: T8NOptions = { describe('test runner config tests', () => { it('should run t8ntool with inputs and report the expected output', async () => { await TransitionTool.run(args) - const expectedResult = JSON.parse(readFileSync(`${t8nDir}/output/result.json`).toString()) - const expectedAlloc = JSON.parse(readFileSync(`${t8nDir}/output/alloc.json`).toString()) - const reportedResult = JSON.parse(readFileSync(`${t8nDir}/output/resultTEST.json`).toString()) - const reportedAlloc = JSON.parse(readFileSync(`${t8nDir}/output/allocTEST.json`).toString()) + const expectedResult = JSON.parse(readFileSync(`${t8nDir}output/result.json`).toString()) + const expectedAlloc = JSON.parse(readFileSync(`${t8nDir}output/alloc.json`).toString()) + const reportedResult = JSON.parse(readFileSync(`${t8nDir}output/resultTEST.json`).toString()) + const reportedAlloc = JSON.parse(readFileSync(`${t8nDir}output/allocTEST.json`).toString()) assert.deepStrictEqual(reportedResult, expectedResult, 'result matches expected result') assert.deepStrictEqual(reportedAlloc, expectedAlloc, 'alloc matches expected alloc') }) }) +describe('trace tests', async () => { + it('should produce a valid step trace for a legacy contract', async () => { + const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun }) + const sm = new MerkleStateManager({ common }) + const vm = await createVM({ common, stateManager: sm }) + const bytecode = hexToBytes('0x604260005260206000F3') // PUSH1 0x42 PUSH1 0x00 MSTORE PUSH1 0x20 PUSH1 0x00 RETURN + const contractAddress = createAddressFromPrivateKey(randomBytes(32)) + await vm.stateManager.putAccount(contractAddress) + await vm.stateManager.putCode(contractAddress, bytecode) + const trace: string[] = [] + vm.evm.events!.on('step', (step) => { + trace.push(JSON.stringify(stepTraceJSON(step, true))) + }) + vm.events!.on('afterTx', async (event) => { + trace.push(JSON.stringify(await summaryTraceJSON(event, vm))) + }) + const tx = await createTx({ + to: contractAddress, + data: bytecode, + gasLimit: 0xffffffff, + gasPrice: 0xf, + }).sign(randomBytes(32)) + await runTx(vm, { tx, skipBalance: true, skipBlockGasLimitValidation: true, skipNonce: true }) + assert.equal(trace.length, 7, 'trace length is 7') + assert.equal(JSON.parse(trace[6]).gasUsed, 21154) + }) + it('should produce a trace of the correct length', async () => { + const common = new Common({ + hardfork: Hardfork.Osaka, + chain: Mainnet, + }) + const sm = new MerkleStateManager({ common }) + const vm = await createVM({ common, stateManager: sm }) + const code = hexToBytes('0xef000101000402000100030400010000800001305000ef') + + const pk = randomBytes(32) + const caller = createAddressFromPrivateKey(pk) // caller address + const contractAddress = createAddressFromPrivateKey(randomBytes(32)) // contract address + + await vm.stateManager.putCode(contractAddress, code) + await vm.stateManager.putAccount(caller, new Account(BigInt(0), BigInt(0x11111111))) + + const tx = await createTx({ + gasLimit: BigInt(0xffff), + gasPrice: 0x7, + to: contractAddress, + }).sign(pk) + const trace: string[] = [] + vm.evm.events!.on('step', (step) => { + trace.push(JSON.stringify(stepTraceJSON(step, true))) + }) + vm.events!.on('afterTx', async (event) => { + trace.push(JSON.stringify(await summaryTraceJSON(event, vm))) + }) + const result = await runTx(vm, { + tx, + skipBalance: true, + skipNonce: true, + skipBlockGasLimitValidation: true, + }) + assert.equal(result.execResult.executionGasUsed, BigInt(4)) + assert.equal(trace.length, 4) + }) + it('should execute an EOF contract with 2 code sections linked by CALLF', async () => { + const common = new Common({ + hardfork: Hardfork.Osaka, + chain: Mainnet, + }) + const sm = new MerkleStateManager({ common }) + const vm = await createVM({ common, stateManager: sm }) + + // EOF bytecode structure breakdown: + // 'ef0001' - Magic (0xEF) and Version (0x0001) + // + // Header section with section declarations: + // '01' - Type section (0x01) + // '0008' - Type section length (8 bytes) + // '02' - Code section (0x02) + // '0002' - 2 code sections + // '0008' - Code section 0 length (8 bytes) + // '0003' - Code section 1 length (3 bytes) + // '04' - Data section (0x04) + // '0000' - Data section length (0 bytes) + // '00' - Header terminator + // + // Type section for code sections: + // '00' - Section 0: 0 inputs + // '80' - Section 0: 0 outputs (non-returning function) + // '0001' - Section 0: max stack height 1 + // '00' - Section 1: 0 inputs + // '00' - Section 1: 0 outputs + // '0001' - Section 1: max stack height 1 + // + // Code section 0: + // '30' - ADDRESS (0x30) - Push the contract's address to the stack + // '50' - POP (0x50) - Remove the address from the stack + // 'e3' - CALLF (0xE3) - Call code section 1 (0001 is the immediate value) + // '6001' - PUSH1 1 (0x60) - Push value 1 to the stack (this will be executed after RETF) + // '00' - STOP (0x00) - End execution + // + // Code section 1: + // '30' - ADDRESS (0x30) - Push the contract's address to the stack + // '50' - POP (0x50) - Remove the address from the stack + // 'e4' - RETF (0xE4) - Return from function call to section 0, resuming after CALLF + const code = hexToBytes( + ('0xef0001' + + '010008' + + '02' + + '000200080003' + + '040000' + + '00' + + '0080000100000001' + + '3050e30001600100' + + '3050e4') as PrefixedHexString, + ) + + const pk = randomBytes(32) + const caller = createAddressFromPrivateKey(pk) + const contractAddress = createAddressFromPrivateKey(randomBytes(32)) + + await vm.stateManager.putCode(contractAddress, code) + await vm.stateManager.putAccount(caller, new Account(BigInt(0), BigInt(0x11111111))) + + const tx = await createTx({ + gasLimit: BigInt(0xffff), + gasPrice: 0x7, + to: contractAddress, + }).sign(pk) + + const trace: string[] = [] + vm.evm.events!.on('step', (step) => { + trace.push(JSON.stringify(stepTraceJSON(step, true))) + }) + vm.events!.on('afterTx', async (event) => { + trace.push(JSON.stringify(await summaryTraceJSON(event, vm))) + }) + + const result = await runTx(vm, { + tx, + skipBalance: true, + skipNonce: true, + skipBlockGasLimitValidation: true, + }) + + // Expected execution flow: + // 1. ADDRESS in code section 0 + // 2. POP in code section 0 + // 3. CALLF to code section 1 + // 4. ADDRESS in code section 1 + // 5. POP in code section 1 + // 6. RETF back to code section 0 (returns to the instruction after CALLF) + // 7. PUSH1 in code section 0 + // 8. STOP in code section 0 + // Plus the summary trace + assert.strictEqual(trace.length, 9, 'trace length should be 9') + + // The execution should use exactly 19 gas (one for each opcode executed) + assert.strictEqual(result.execResult.executionGasUsed, BigInt(19)) + const immediate = JSON.parse(trace[2]).immediate + assert.strictEqual(immediate, '0x0001') // Verifies that CALLF immediate matches + }) +}) diff --git a/packages/vm/test/t8n/ethereumjs-t8ntool.sh b/packages/vm/test/t8n/ethereumjs-t8ntool.sh index 33ba654005f..dbfbc47c51e 100755 --- a/packages/vm/test/t8n/ethereumjs-t8ntool.sh +++ b/packages/vm/test/t8n/ethereumjs-t8ntool.sh @@ -5,4 +5,4 @@ if [[ "$1" == "--version" ]]; then fi SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) export NODE_OPTIONS="--max-old-space-size=4096" -npx tsx "$SCRIPT_DIR/launchT8N.ts" "$@" \ No newline at end of file +npx tsx --conditions=typescript "$SCRIPT_DIR/launchT8N.ts" "$@" \ No newline at end of file diff --git a/packages/vm/test/t8n/helpers.ts b/packages/vm/test/t8n/helpers.ts index bb3e417b82e..50d4c1ed90c 100644 --- a/packages/vm/test/t8n/helpers.ts +++ b/packages/vm/test/t8n/helpers.ts @@ -1,6 +1,10 @@ import yargs from 'yargs' import { hideBin } from 'yargs/helpers' +import type { InterpreterStep } from '@ethereumjs/evm' +import { bytesToHex } from '@ethereumjs/util' +import type { AfterTxEvent } from '../../src/types.ts' +import type { VM } from '../../src/vm.ts' import type { T8NOptions } from './types.ts' export function getArguments() { @@ -64,6 +68,11 @@ export function getArguments() { type: 'boolean', default: false, }) + .option('trace', { + describe: 'Write EVM traces as JSON to trace--.json', + type: 'boolean', + default: false, + }) .strict() .help().argv @@ -84,7 +93,7 @@ export function getArguments() { reward: BigInt((args as any)['state.reward']), chainid: BigInt((args as any)['state.chainid']), } - + args.trace = (args)['trace'] return args } @@ -124,3 +133,59 @@ export function normalizeNumbers(input: any) { } return input } + +/** + * Formats an individual EVM step trace as a JSON object + * @param step an {@link InterpreterStep} emitted by the EVM `step` event + * @param memory whether to include the memory in the trace + * @returns a JSON object that matches the EIP-7756 trace format + */ +export const stepTraceJSON = (step: InterpreterStep, memory: boolean = false) => { + let hexStack = [] + hexStack = step.stack.map((item: bigint) => { + return '0x' + item.toString(16) + }) + let memWords = undefined + const memSize = Number(step.memoryWordCount) * 8 // memSize is reported in bytes, not words (i.e 32 bytes) + if (memory) { + memWords = [] + for (let i = 0; i < step.memoryWordCount; i++) { + memWords.push(bytesToHex(step.memory.slice(i * 32, (i + 1) * 32))) // memory is returned in 32 byte words + } + } + + const opTrace = { + pc: step.pc, + op: '0x' + step.opcode.code.toString(16), + gas: Number(step.gasLeft), + gasCost: Number(step.opcode.dynamicFee ?? BigInt(step.opcode.fee)), // if `dynamicFee` is set, it includes base fee + memory: memory ? memWords : undefined, + memSize, + stack: hexStack, + depth: step.depth + 1, // Depth starts at 1 - EIP-7756 + refund: Number(step.gasRefund), + opName: step.opcode.name, + section: step.eofSection, + immediate: step.immediate !== undefined ? bytesToHex(step.immediate) : undefined, + functionDepth: step.eofFunctionDepth, + error: step.error !== undefined ? step.error.toString() : undefined, + } + return opTrace +} + +/** + * Formats an individual EVM summary trace as a JSON object + * @param event an {@link AfterTxEvent} emitted by the vm `afterTx` event + * @param vm a {@link VM} instance + * @returns a JSON object that matches the EIP-7756 summary object format + */ +export const summaryTraceJSON = async (event: AfterTxEvent, vm: VM) => { + const summary = { + stateRoot: bytesToHex(await vm.stateManager.getStateRoot()), + output: event.execResult.returnValue.length > 0 ? bytesToHex(event.execResult.returnValue) : '', + gasUsed: Number(event.totalGasSpent), + pass: event.execResult.exceptionError === undefined, + fork: vm.common.hardfork(), + } + return summary +} diff --git a/packages/vm/test/t8n/stateTracker.ts b/packages/vm/test/t8n/stateTracker.ts index 4e98d3966b3..f0932be661f 100644 --- a/packages/vm/test/t8n/stateTracker.ts +++ b/packages/vm/test/t8n/stateTracker.ts @@ -86,7 +86,7 @@ export class StateTracker { outputAlloc[addressString].balance = bigIntToHex(account.balance) outputAlloc[addressString].code = bytesToHex(await this.vm.stateManager.getCode(address)) - const storage = this.allocTracker[addressString].storage + const storage = this.allocTracker[addressString].storage as PrefixedHexString[] outputAlloc[addressString].storage = outputAlloc[addressString].storage ?? {} for (const key of storage) { diff --git a/packages/vm/test/t8n/t8ntool.ts b/packages/vm/test/t8n/t8ntool.ts index e53bdb5a776..cf85ec072b3 100644 --- a/packages/vm/test/t8n/t8ntool.ts +++ b/packages/vm/test/t8n/t8ntool.ts @@ -14,7 +14,7 @@ import { rewardAccount } from '../../src/runBlock.ts' import { getCommon } from '../tester/config.ts' import { makeBlockFromEnv, makeParentBlockHeader, setupPreConditions } from '../util.ts' -import { normalizeNumbers } from './helpers.ts' +import { normalizeNumbers, stepTraceJSON, summaryTraceJSON } from './helpers.ts' import { StateTracker } from './stateTracker.ts' import type { Block } from '@ethereumjs/block' @@ -43,7 +43,7 @@ function getBlockchain(inputEnv: T8NEnv) { if (Number(key) === number) { return { hash() { - return hexToBytes(inputEnv.blockHashes[key]) + return hexToBytes(inputEnv.blockHashes[key] as PrefixedHexString) }, } } @@ -111,6 +111,8 @@ export class TransitionTool { public txsData: TypedTxData[] public inputEnv: T8NEnv + // [txHash, trace] + private traces: [string, string[]][] = [] public common!: Common public vm!: VM @@ -164,6 +166,57 @@ export class TransitionTool { let index = 0 + let trace: any[] = [] + // Tracing + if (args.trace === true) { + this.vm.events.on('beforeTx', () => { + trace = [] + }) + this.vm.evm.events?.on('step', (e) => { + const opTrace = stepTraceJSON(e) + trace.push(JSON.stringify(opTrace)) + }) + + this.vm.events.on('afterTx', async (event) => { + const summary = await summaryTraceJSON(event, this.vm) + trace.push(JSON.stringify(summary)) + this.traces[index] = [bytesToHex(event.transaction.hash()), trace] + this.afterTx(event, index, builder) + }) + + for (const txData of this.txsData) { + try { + const tx = createTx(txData, { common: this.common }) + if (!tx.isValid()) { + throw new Error(tx.getValidationErrors().join(', ')) + } + // Set `allowNoBlobs` to `true`, since the test might not have the blob + // The 4844-tx at this should still be valid, since it has the `blobHashes` field + await builder.addTransaction(tx, { allowNoBlobs: true }) + } catch (e: any) { + this.rejected.push({ + index, + error: e.message, + }) + } + index++ + } + + // Reward miner + + if (args.state.reward !== BigInt(-1)) { + await rewardAccount(this.vm.evm, block.header.coinbase, args.state.reward, this.vm.common) + await this.vm.evm.journal.cleanup() + } + + const result = await builder.build() + + const convertedOutput = this.getOutput(result.block, result.requests) + const alloc = await this.stateTracker.dumpAlloc() + + this.writeOutput(args, convertedOutput, alloc) + } + this.vm.events.on('afterTx', (event) => { this.afterTx(event, index, builder) }) @@ -200,7 +253,6 @@ export class TransitionTool { this.writeOutput(args, convertedOutput, alloc) } - private async setup(args: T8NOptions) { this.common = getCommon(args.state.fork, kzg) @@ -324,8 +376,13 @@ export class TransitionTool { private writeOutput(args: T8NOptions, output: T8NOutput, outputAlloc: T8NAlloc) { const outputResultFilePath = join(args.output.basedir, args.output.result) const outputAllocFilePath = join(args.output.basedir, args.output.alloc) - writeFileSync(outputResultFilePath, JSON.stringify(output)) writeFileSync(outputAllocFilePath, JSON.stringify(outputAlloc)) + if (args.trace === true) { + for (let i = 0; i < this.traces.length; i++) { + const tracePath = join(args.output.basedir, `trace-${i}-${this.traces[i][0]}.jsonl`) + writeFileSync(tracePath, `${this.traces[i][1].join('\n')}`) + } + } } } diff --git a/packages/vm/test/t8n/types.ts b/packages/vm/test/t8n/types.ts index f4891dca8f2..68781d368a0 100644 --- a/packages/vm/test/t8n/types.ts +++ b/packages/vm/test/t8n/types.ts @@ -15,6 +15,7 @@ export type T8NOptions = { alloc: string } log: boolean + trace: boolean } export type T8NAlloc = { diff --git a/packages/vm/test/tester/runners/BlockchainTestsRunner.ts b/packages/vm/test/tester/runners/BlockchainTestsRunner.ts index 91557937781..ef6a2fea525 100644 --- a/packages/vm/test/tester/runners/BlockchainTestsRunner.ts +++ b/packages/vm/test/tester/runners/BlockchainTestsRunner.ts @@ -13,7 +13,6 @@ import { hexToBytes, isHexString, stripHexPrefix, - toBytes, } from '@ethereumjs/util' import { createVerkleTree } from '@ethereumjs/verkle' @@ -84,7 +83,7 @@ export async function runBlockchainTest(options: any, testData: any, t: tape.Tes const genesisBlock = createBlock(blockData, { common }) if (typeof testData.genesisRLP === 'string') { - const rlp = toBytes(testData.genesisRLP) + const rlp = hexToBytes(testData.genesisRLP) t.deepEquals(genesisBlock.serialize(), rlp, 'correct genesis RLP') } diff --git a/packages/vm/typedoc.cjs b/packages/vm/typedoc.mjs similarity index 68% rename from packages/vm/typedoc.cjs rename to packages/vm/typedoc.mjs index 4ba84fef059..664202fc7a0 100644 --- a/packages/vm/typedoc.cjs +++ b/packages/vm/typedoc.mjs @@ -1,5 +1,5 @@ -module.exports = { - extends: '../../config/typedoc.cjs', +export default { + extends: '../../config/typedoc.mjs', entryPoints: ['src'], out: 'docs', exclude: ['test/**/*.ts', 'src/bloom/*.ts', 'src/evm/**', 'src/state/cache.ts'], diff --git a/packages/wallet/README.md b/packages/wallet/README.md index bdd4ba03cc3..1fe2c200a0c 100644 --- a/packages/wallet/README.md +++ b/packages/wallet/README.md @@ -1,4 +1,4 @@ -# @ethereumjs/wallet +# @ethereumjs/wallet `v10` [![NPM Package][npm-badge]][npm-link] [![Actions Status][actions-badge]][actions-link] @@ -26,6 +26,16 @@ Features not supported: - signing transactions - managing storage (neither in node.js or the browser) +## Table of Contents + +- [Installation](#installation) +- [Wallet API](#wallet-api) +- [Thirdparty API](#thirdparty-api) +- [HD Wallet API](#hd-wallet-api) +- [Special Topics](#special-topics) +- [EthereumJS](#ethereumjs) +- [License](#license) + ## Wallet API For information about the Wallet's API, please go to [./docs/classes/wallet.md](./docs/classes/wallet.md). @@ -114,17 +124,9 @@ console.log(wallet.getWallet().getAddressString()) // Should print an Ethereum a Please go to [./docs/classes/ethereumhdkey.md](./docs/classes/ethereumhdkey.md) for more info. -## Provider Engine - -Provider Engine is -[not very actively maintained](https://github.com/MetaMask/web3-provider-engine#web3-providerengine) -and support has been removed along `v1.0.0` release, see -issue [#115](https://github.com/ethereumjs/ethereumjs-wallet/issues/115) for context. - -You can use the the old `src/provider-engine.ts` code (see associated PR) as some boilerplate -for your own integration if needed. +## Special Topics -## Remarks about `toV3` +### Remarks about `toV3` The `options` is an optional object hash, where all the serialization parameters can be fine tuned: @@ -157,7 +159,7 @@ The following settings are favoured by the Go Ethereum implementation and we def - `p`: `1` - `cipher`: `aes-128-ctr` -# EthereumJS +## EthereumJS See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices. diff --git a/packages/wallet/docs/@ethereumjs/namespaces/hdkey/README.md b/packages/wallet/docs/@ethereumjs/namespaces/hdkey/README.md new file mode 100644 index 00000000000..64339180a8b --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/hdkey/README.md @@ -0,0 +1,11 @@ +[**@ethereumjs/wallet**](../../../README.md) + +*** + +[@ethereumjs/wallet](../../../README.md) / hdkey + +# hdkey + +## Classes + +- [EthereumHDKey](classes/EthereumHDKey.md) diff --git a/packages/wallet/docs/@ethereumjs/namespaces/hdkey/classes/EthereumHDKey.md b/packages/wallet/docs/@ethereumjs/namespaces/hdkey/classes/EthereumHDKey.md new file mode 100644 index 00000000000..467b3729330 --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/hdkey/classes/EthereumHDKey.md @@ -0,0 +1,173 @@ +[**@ethereumjs/wallet**](../../../../README.md) + +*** + +[@ethereumjs/wallet](../../../../README.md) / [hdkey](../README.md) / EthereumHDKey + +# Class: EthereumHDKey + +Defined in: [hdkey.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L8) + +## Constructors + +### Constructor + +> **new EthereumHDKey**(`hdkey`): `EthereumHDKey` + +Defined in: [hdkey.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L10) + +#### Parameters + +##### hdkey + +`HDKey` + +#### Returns + +`EthereumHDKey` + +## Methods + +### deriveChild() + +> **deriveChild**(`index`): `EthereumHDKey` + +Defined in: [hdkey.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L61) + +Derive a node based on a child index + +#### Parameters + +##### index + +`number` + +#### Returns + +`EthereumHDKey` + +*** + +### derivePath() + +> **derivePath**(`path`): `EthereumHDKey` + +Defined in: [hdkey.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L54) + +Derives a node based on a path (e.g. m/44'/0'/0/1) + +#### Parameters + +##### path + +`string` + +#### Returns + +`EthereumHDKey` + +*** + +### getWallet() + +> **getWallet**(): [`Wallet`](../../../../classes/Wallet.md) + +Defined in: [hdkey.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L68) + +Return a `Wallet` instance as seen above + +#### Returns + +[`Wallet`](../../../../classes/Wallet.md) + +*** + +### privateExtendedKey() + +> **privateExtendedKey**(): `string` + +Defined in: [hdkey.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L37) + +Returns a BIP32 extended private key (xprv) + +#### Returns + +`string` + +*** + +### publicExtendedKey() + +> **publicExtendedKey**(): `string` + +Defined in: [hdkey.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L47) + +Return a BIP32 extended public key (xpub) + +#### Returns + +`string` + +*** + +### fromExtendedKey() + +> `static` **fromExtendedKey**(`base58Key`): `EthereumHDKey` + +Defined in: [hdkey.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L30) + +Create an instance based on a BIP32 extended private or public key. + +#### Parameters + +##### base58Key + +`string` + +#### Returns + +`EthereumHDKey` + +*** + +### fromMasterSeed() + +> `static` **fromMasterSeed**(`seedBuffer`): `EthereumHDKey` + +Defined in: [hdkey.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L16) + +Creates an instance based on a seed. + +#### Parameters + +##### seedBuffer + +`Uint8Array` + +#### Returns + +`EthereumHDKey` + +*** + +### fromMnemonic() + +> `static` **fromMnemonic**(`mnemonic`, `passphrase?`): `EthereumHDKey` + +Defined in: [hdkey.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L23) + +Creates an instance based on BIP39 mnemonic phrases + +#### Parameters + +##### mnemonic + +`string` + +##### passphrase? + +`string` + +#### Returns + +`EthereumHDKey` diff --git a/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/README.md b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/README.md new file mode 100644 index 00000000000..fca922020f8 --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/README.md @@ -0,0 +1,22 @@ +[**@ethereumjs/wallet**](../../../README.md) + +*** + +[@ethereumjs/wallet](../../../README.md) / thirdparty + +# thirdparty + +## Interfaces + +- [EtherWalletOptions](interfaces/EtherWalletOptions.md) +- [EvpKdfOpts](interfaces/EvpKdfOpts.md) + +## Variables + +- [Thirdparty](variables/Thirdparty.md) + +## Functions + +- [fromEtherCamp](functions/fromEtherCamp.md) +- [fromEtherWallet](functions/fromEtherWallet.md) +- [fromQuorumWallet](functions/fromQuorumWallet.md) diff --git a/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromEtherCamp.md b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromEtherCamp.md new file mode 100644 index 00000000000..21bf62dafe2 --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromEtherCamp.md @@ -0,0 +1,23 @@ +[**@ethereumjs/wallet**](../../../../README.md) + +*** + +[@ethereumjs/wallet](../../../../README.md) / [thirdparty](../README.md) / fromEtherCamp + +# Function: fromEtherCamp() + +> **fromEtherCamp**(`passphrase`): [`Wallet`](../../../../classes/Wallet.md) + +Defined in: [thirdparty.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L175) + +Third Party API: Import a brain wallet used by Ether.Camp + +## Parameters + +### passphrase + +`string` + +## Returns + +[`Wallet`](../../../../classes/Wallet.md) diff --git a/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromEtherWallet.md b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromEtherWallet.md new file mode 100644 index 00000000000..bbc8948837c --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromEtherWallet.md @@ -0,0 +1,25 @@ +[**@ethereumjs/wallet**](../../../../README.md) + +*** + +[@ethereumjs/wallet](../../../../README.md) / [thirdparty](../README.md) / fromEtherWallet + +# Function: fromEtherWallet() + +> **fromEtherWallet**(`input`, `password`): `Promise`\<[`Wallet`](../../../../classes/Wallet.md)\> + +Defined in: [thirdparty.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L126) + +## Parameters + +### input + +`string` | [`EtherWalletOptions`](../interfaces/EtherWalletOptions.md) + +### password + +`string` + +## Returns + +`Promise`\<[`Wallet`](../../../../classes/Wallet.md)\> diff --git a/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromQuorumWallet.md b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromQuorumWallet.md new file mode 100644 index 00000000000..52788ec3ccb --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/functions/fromQuorumWallet.md @@ -0,0 +1,27 @@ +[**@ethereumjs/wallet**](../../../../README.md) + +*** + +[@ethereumjs/wallet](../../../../README.md) / [thirdparty](../README.md) / fromQuorumWallet + +# Function: fromQuorumWallet() + +> **fromQuorumWallet**(`passphrase`, `userid`): [`Wallet`](../../../../classes/Wallet.md) + +Defined in: [thirdparty.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L182) + +Third Party API: Import a brain wallet used by Quorum Wallet + +## Parameters + +### passphrase + +`string` + +### userid + +`string` + +## Returns + +[`Wallet`](../../../../classes/Wallet.md) diff --git a/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/interfaces/EtherWalletOptions.md b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/interfaces/EtherWalletOptions.md new file mode 100644 index 00000000000..f6d78289cd4 --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/interfaces/EtherWalletOptions.md @@ -0,0 +1,57 @@ +[**@ethereumjs/wallet**](../../../../README.md) + +*** + +[@ethereumjs/wallet](../../../../README.md) / [thirdparty](../README.md) / EtherWalletOptions + +# Interface: EtherWalletOptions + +Defined in: [thirdparty.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L112) + +## Properties + +### address + +> **address**: `string` + +Defined in: [thirdparty.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L113) + +*** + +### encrypted + +> **encrypted**: `boolean` + +Defined in: [thirdparty.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L114) + +*** + +### hash + +> **hash**: `string` + +Defined in: [thirdparty.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L116) + +*** + +### locked + +> **locked**: `boolean` + +Defined in: [thirdparty.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L115) + +*** + +### private + +> **private**: `string` + +Defined in: [thirdparty.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L117) + +*** + +### public + +> **public**: `string` + +Defined in: [thirdparty.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L118) diff --git a/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/interfaces/EvpKdfOpts.md b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/interfaces/EvpKdfOpts.md new file mode 100644 index 00000000000..d46ee2231b3 --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/interfaces/EvpKdfOpts.md @@ -0,0 +1,41 @@ +[**@ethereumjs/wallet**](../../../../README.md) + +*** + +[@ethereumjs/wallet](../../../../README.md) / [thirdparty](../README.md) / EvpKdfOpts + +# Interface: EvpKdfOpts + +Defined in: [thirdparty.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L19) + +## Properties + +### count + +> **count**: `number` + +Defined in: [thirdparty.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L20) + +*** + +### digest + +> **digest**: `string` + +Defined in: [thirdparty.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L23) + +*** + +### ivsize + +> **ivsize**: `number` + +Defined in: [thirdparty.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L22) + +*** + +### keysize + +> **keysize**: `number` + +Defined in: [thirdparty.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L21) diff --git a/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/variables/Thirdparty.md b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/variables/Thirdparty.md new file mode 100644 index 00000000000..c22892068fd --- /dev/null +++ b/packages/wallet/docs/@ethereumjs/namespaces/thirdparty/variables/Thirdparty.md @@ -0,0 +1,67 @@ +[**@ethereumjs/wallet**](../../../../README.md) + +*** + +[@ethereumjs/wallet](../../../../README.md) / [thirdparty](../README.md) / Thirdparty + +# Variable: Thirdparty + +> `const` **Thirdparty**: `object` + +Defined in: [thirdparty.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L195) + +## Type declaration + +### fromEtherCamp() + +> **fromEtherCamp**: (`passphrase`) => [`Wallet`](../../../../classes/Wallet.md) + +Third Party API: Import a brain wallet used by Ether.Camp + +#### Parameters + +##### passphrase + +`string` + +#### Returns + +[`Wallet`](../../../../classes/Wallet.md) + +### fromEtherWallet() + +> **fromEtherWallet**: (`input`, `password`) => `Promise`\<[`Wallet`](../../../../classes/Wallet.md)\> + +#### Parameters + +##### input + +`string` | [`EtherWalletOptions`](../interfaces/EtherWalletOptions.md) + +##### password + +`string` + +#### Returns + +`Promise`\<[`Wallet`](../../../../classes/Wallet.md)\> + +### fromQuorumWallet() + +> **fromQuorumWallet**: (`passphrase`, `userid`) => [`Wallet`](../../../../classes/Wallet.md) + +Third Party API: Import a brain wallet used by Quorum Wallet + +#### Parameters + +##### passphrase + +`string` + +##### userid + +`string` + +#### Returns + +[`Wallet`](../../../../classes/Wallet.md) diff --git a/packages/wallet/docs/README.md b/packages/wallet/docs/README.md index 3a6171194f7..f8a03712af9 100644 --- a/packages/wallet/docs/README.md +++ b/packages/wallet/docs/README.md @@ -1,14 +1,22 @@ -@ethereumjs/wallet +**@ethereumjs/wallet** -# @ethereumjs/wallet +*** -## Table of contents +# @ethereumjs/wallet -### Namespaces +## Namespaces -- [hdkey](modules/hdkey.md) -- [thirdparty](modules/thirdparty.md) +- [hdkey](@ethereumjs/namespaces/hdkey/README.md) +- [thirdparty](@ethereumjs/namespaces/thirdparty/README.md) -### Classes +## Classes - [Wallet](classes/Wallet.md) + +## Type Aliases + +- [KDFFunctions](type-aliases/KDFFunctions.md) + +## Variables + +- [KDFFunctions](variables/KDFFunctions.md) diff --git a/packages/wallet/docs/classes/Wallet.md b/packages/wallet/docs/classes/Wallet.md index 3f06b5dae9b..da9639dca49 100644 --- a/packages/wallet/docs/classes/Wallet.md +++ b/packages/wallet/docs/classes/Wallet.md @@ -1,58 +1,42 @@ +[**@ethereumjs/wallet**](../README.md) + +*** + [@ethereumjs/wallet](../README.md) / Wallet # Class: Wallet -## Table of contents - -### Constructors - -- [constructor](Wallet.md#constructor) - -### Methods - -- [getAddress](Wallet.md#getaddress) -- [getAddressString](Wallet.md#getaddressstring) -- [getChecksumAddressString](Wallet.md#getchecksumaddressstring) -- [getPrivateKey](Wallet.md#getprivatekey) -- [getPrivateKeyString](Wallet.md#getprivatekeystring) -- [getPublicKey](Wallet.md#getpublickey) -- [getPublicKeyString](Wallet.md#getpublickeystring) -- [getV3Filename](Wallet.md#getv3filename) -- [toV3](Wallet.md#tov3) -- [toV3String](Wallet.md#tov3string) -- [verifyPublicKey](Wallet.md#verifypublickey) -- [fromEthSale](Wallet.md#fromethsale) -- [fromExtendedPrivateKey](Wallet.md#fromextendedprivatekey) -- [fromExtendedPublicKey](Wallet.md#fromextendedpublickey) -- [fromPrivateKey](Wallet.md#fromprivatekey) -- [fromPublicKey](Wallet.md#frompublickey) -- [fromV1](Wallet.md#fromv1) -- [fromV3](Wallet.md#fromv3) -- [generate](Wallet.md#generate) -- [generateVanityAddress](Wallet.md#generatevanityaddress) +Defined in: [wallet.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L273) ## Constructors -### constructor +### Constructor + +> **new Wallet**(`privateKey?`, `publicKey?`): `Wallet` -• **new Wallet**(`privateKey?`, `publicKey?`) +Defined in: [wallet.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L277) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `privateKey?` | `Uint8Array` | `undefined` | -| `publicKey` | `undefined` \| `Uint8Array` | `undefined` | +##### privateKey? + +`Uint8Array`\<`ArrayBufferLike`\> + +##### publicKey? -#### Defined in +`Uint8Array`\<`ArrayBufferLike`\> -[wallet.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L266) +#### Returns + +`Wallet` ## Methods -### getAddress +### getAddress() + +> **getAddress**(): `Uint8Array` -▸ **getAddress**(): `Uint8Array` +Defined in: [wallet.ts:562](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L562) Returns the wallet's address. @@ -60,48 +44,42 @@ Returns the wallet's address. `Uint8Array` -#### Defined in +*** -[wallet.ts:548](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L548) +### getAddressString() -___ +> **getAddressString**(): `` `0x${string}` `` -### getAddressString - -▸ **getAddressString**(): `string` +Defined in: [wallet.ts:569](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L569) Returns the wallet's address as a "0x" prefixed hex string #### Returns -`string` - -#### Defined in +`` `0x${string}` `` -[wallet.ts:555](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L555) +*** -___ +### getChecksumAddressString() -### getChecksumAddressString +> **getChecksumAddressString**(): `` `0x${string}` `` -▸ **getChecksumAddressString**(): `string` +Defined in: [wallet.ts:577](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L577) Returns the wallet's private key as a "0x" prefixed hex string checksummed according to [EIP 55](https://github.com/ethereum/EIPs/issues/55). #### Returns -`string` - -#### Defined in +`` `0x${string}` `` -[wallet.ts:563](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L563) +*** -___ +### getPrivateKey() -### getPrivateKey +> **getPrivateKey**(): `Uint8Array` -▸ **getPrivateKey**(): `Uint8Array` +Defined in: [wallet.ts:537](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L537) Returns the wallet's private key. @@ -109,29 +87,25 @@ Returns the wallet's private key. `Uint8Array` -#### Defined in +*** -[wallet.ts:523](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L523) +### getPrivateKeyString() -___ +> **getPrivateKeyString**(): `` `0x${string}` `` -### getPrivateKeyString - -▸ **getPrivateKeyString**(): `string` +Defined in: [wallet.ts:541](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L541) #### Returns -`string` - -#### Defined in +`` `0x${string}` `` -[wallet.ts:527](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L527) +*** -___ +### getPublicKey() -### getPublicKey +> **getPublicKey**(): `Uint8Array` -▸ **getPublicKey**(): `Uint8Array` +Defined in: [wallet.ts:548](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L548) Returns the wallet's public key. @@ -139,206 +113,201 @@ Returns the wallet's public key. `Uint8Array` -#### Defined in - -[wallet.ts:534](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L534) +*** -___ +### getPublicKeyString() -### getPublicKeyString +> **getPublicKeyString**(): `` `0x${string}` `` -▸ **getPublicKeyString**(): `string` +Defined in: [wallet.ts:555](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L555) Returns the wallet's public key as a "0x" prefixed hex string #### Returns -`string` +`` `0x${string}` `` -#### Defined in +*** -[wallet.ts:541](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L541) +### getV3Filename() -___ +> **getV3Filename**(`timestamp?`): `string` -### getV3Filename - -▸ **getV3Filename**(`timestamp?`): `string` +Defined in: [wallet.ts:647](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L647) Return the suggested filename for V3 keystores. #### Parameters -| Name | Type | -| :------ | :------ | -| `timestamp?` | `number` | +##### timestamp? + +`number` #### Returns `string` -#### Defined in +*** -[wallet.ts:633](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L633) +### toV3() -___ +> **toV3**(`password`, `opts?`): `Promise`\<`V3Keystore`\> -### toV3 +Defined in: [wallet.ts:587](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L587) -▸ **toV3**(`password`, `opts?`): `Promise`<`V3Keystore`\> - -Returns an Etherem Version 3 Keystore Format object representing the wallet +Returns an Ethereum Version 3 Keystore Format object representing the wallet #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `password` | `string` | The password used to encrypt the Keystore. | -| `opts?` | `Partial`<`V3Params`\> | The options for the keystore. See [its spec](https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition) for more info. | +##### password -#### Returns +`string` + +The password used to encrypt the Keystore. + +##### opts? -`Promise`<`V3Keystore`\> +`Partial`\<`V3Params`\> -#### Defined in +The options for the keystore. See [its spec](https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition) for more info. -[wallet.ts:573](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L573) +#### Returns + +`Promise`\<`V3Keystore`\> + +*** -___ +### toV3String() -### toV3String +> **toV3String**(`password`, `opts?`): `Promise`\<`string`\> -▸ **toV3String**(`password`, `opts?`): `Promise`<`string`\> +Defined in: [wallet.ts:668](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L668) #### Parameters -| Name | Type | -| :------ | :------ | -| `password` | `string` | -| `opts?` | `Partial`<`V3Params`\> | +##### password -#### Returns +`string` -`Promise`<`string`\> +##### opts? -#### Defined in +`Partial`\<`V3Params`\> -[wallet.ts:654](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L654) +#### Returns + +`Promise`\<`string`\> + +*** -___ +### verifyPublicKey() -### verifyPublicKey +> **verifyPublicKey**(`publicKey`): `boolean` -▸ **verifyPublicKey**(`publicKey`): `boolean` +Defined in: [wallet.ts:677](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L677) Verify the publicKey, privateKey pair #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `publicKey` | `Uint8Array` | the public key to verify against the private key of the wallet | +##### publicKey + +`Uint8Array` + +the public key to verify against the private key of the wallet #### Returns `boolean` -#### Defined in - -[wallet.ts:663](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L663) +*** -___ +### fromEthSale() -### fromEthSale +> `static` **fromEthSale**(`input`, `password`): `Promise`\<`Wallet`\> -▸ `Static` **fromEthSale**(`input`, `password`): `Promise`<[`Wallet`](Wallet.md)\> +Defined in: [wallet.ts:479](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L479) #### Parameters -| Name | Type | -| :------ | :------ | -| `input` | `string` \| `EthSaleKeystore` | -| `password` | `string` | +##### input -#### Returns +`string` | `EthSaleKeystore` + +##### password -`Promise`<[`Wallet`](Wallet.md)\> +`string` + +#### Returns -#### Defined in +`Promise`\<`Wallet`\> -[wallet.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L465) +*** -___ +### fromExtendedPrivateKey() -### fromExtendedPrivateKey +> `static` **fromExtendedPrivateKey**(`extendedPrivateKey`): `Wallet` -▸ `Static` **fromExtendedPrivateKey**(`extendedPrivateKey`): [`Wallet`](Wallet.md) +Defined in: [wallet.ts:371](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L371) Create an instance based on a BIP32 extended private key (xprv) #### Parameters -| Name | Type | -| :------ | :------ | -| `extendedPrivateKey` | `string` | +##### extendedPrivateKey -#### Returns +`string` -[`Wallet`](Wallet.md) +#### Returns -#### Defined in +`Wallet` -[wallet.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L357) +*** -___ +### fromExtendedPublicKey() -### fromExtendedPublicKey +> `static` **fromExtendedPublicKey**(`extendedPublicKey`): `Wallet` -▸ `Static` **fromExtendedPublicKey**(`extendedPublicKey`): [`Wallet`](Wallet.md) +Defined in: [wallet.ts:352](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L352) Create an instance based on a BIP32 extended public key (xpub) #### Parameters -| Name | Type | -| :------ | :------ | -| `extendedPublicKey` | `string` | +##### extendedPublicKey -#### Returns +`string` -[`Wallet`](Wallet.md) +#### Returns -#### Defined in +`Wallet` -[wallet.ts:338](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L338) +*** -___ +### fromPrivateKey() -### fromPrivateKey +> `static` **fromPrivateKey**(`privateKey`): `Wallet` -▸ `Static` **fromPrivateKey**(`privateKey`): [`Wallet`](Wallet.md) +Defined in: [wallet.ts:364](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L364) Create an instance based on a raw private key #### Parameters -| Name | Type | -| :------ | :------ | -| `privateKey` | `Uint8Array` | +##### privateKey -#### Returns +`Uint8Array` -[`Wallet`](Wallet.md) +#### Returns -#### Defined in +`Wallet` -[wallet.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L350) +*** -___ +### fromPublicKey() -### fromPublicKey +> `static` **fromPublicKey**(`publicKey`, `nonStrict`): `Wallet` -▸ `Static` **fromPublicKey**(`publicKey`, `nonStrict?`): [`Wallet`](Wallet.md) +Defined in: [wallet.ts:342](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L342) Create an instance based on a public key (certain methods will not be available) @@ -347,106 +316,116 @@ the `nonStrict` flag is set to true. #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `publicKey` | `Uint8Array` | `undefined` | -| `nonStrict` | `boolean` | `false` | +##### publicKey -#### Returns +`Uint8Array` + +##### nonStrict -[`Wallet`](Wallet.md) +`boolean` = `false` -#### Defined in +#### Returns + +`Wallet` -[wallet.ts:328](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L328) +*** -___ +### fromV1() -### fromV1 +> `static` **fromV1**(`input`, `password`): `Promise`\<`Wallet`\> -▸ `Static` **fromV1**(`input`, `password`): `Promise`<[`Wallet`](Wallet.md)\> +Defined in: [wallet.ts:388](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L388) Import a wallet (Version 1 of the Ethereum wallet format). #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `input` | `string` \| `V1Keystore` | A JSON serialized string, or an object representing V1 Keystore. | -| `password` | `string` | The keystore password. | +##### input -#### Returns +A JSON serialized string, or an object representing V1 Keystore. -`Promise`<[`Wallet`](Wallet.md)\> +`string` | `V1Keystore` -#### Defined in +##### password -[wallet.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L374) +`string` -___ +The keystore password. -### fromV3 +#### Returns -▸ `Static` **fromV3**(`input`, `password`, `nonStrict?`): `Promise`<[`Wallet`](Wallet.md)\> +`Promise`\<`Wallet`\> + +*** + +### fromV3() + +> `static` **fromV3**(`input`, `password`, `nonStrict`): `Promise`\<`Wallet`\> + +Defined in: [wallet.ts:421](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L421) Import a wallet (Version 3 of the Ethereum wallet format). Set `nonStrict` true to accept files with mixed-caps. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `input` | `string` \| `V3Keystore` | `undefined` | A JSON serialized string, or an object representing V3 Keystore. | -| `password` | `string` | `undefined` | The keystore password. | -| `nonStrict` | `boolean` | `false` | - | +##### input -#### Returns +A JSON serialized string, or an object representing V3 Keystore. -`Promise`<[`Wallet`](Wallet.md)\> +`string` | `V3Keystore` -#### Defined in +##### password -[wallet.ts:407](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L407) +`string` + +The keystore password. + +##### nonStrict -___ +`boolean` = `false` + +#### Returns -### generate +`Promise`\<`Wallet`\> -▸ `Static` **generate**(`icapDirect?`): [`Wallet`](Wallet.md) +*** + +### generate() + +> `static` **generate**(`icapDirect`): `Wallet` + +Defined in: [wallet.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L304) Create an instance based on a new random key. #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `icapDirect` | `boolean` | `false` | setting this to `true` will generate an address suitable for the `ICAP Direct mode` | +##### icapDirect -#### Returns +`boolean` = `false` -[`Wallet`](Wallet.md) +setting this to `true` will generate an address suitable for the `ICAP Direct mode` -#### Defined in +#### Returns -[wallet.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L290) +`Wallet` -___ +*** -### generateVanityAddress +### generateVanityAddress() -▸ `Static` **generateVanityAddress**(`pattern`): [`Wallet`](Wallet.md) +> `static` **generateVanityAddress**(`pattern`): `Wallet` + +Defined in: [wallet.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L322) Create an instance where the address is valid against the supplied pattern (**this will be very slow**) #### Parameters -| Name | Type | -| :------ | :------ | -| `pattern` | `string` \| `RegExp` | - -#### Returns +##### pattern -[`Wallet`](Wallet.md) +`string` | `RegExp` -#### Defined in +#### Returns -[wallet.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L308) +`Wallet` diff --git a/packages/wallet/docs/classes/hdkey.EthereumHDKey.md b/packages/wallet/docs/classes/hdkey.EthereumHDKey.md deleted file mode 100644 index 6ddff58a2ae..00000000000 --- a/packages/wallet/docs/classes/hdkey.EthereumHDKey.md +++ /dev/null @@ -1,197 +0,0 @@ -[@ethereumjs/wallet](../README.md) / [hdkey](../modules/hdkey.md) / EthereumHDKey - -# Class: EthereumHDKey - -[hdkey](../modules/hdkey.md).EthereumHDKey - -## Table of contents - -### Constructors - -- [constructor](hdkey.EthereumHDKey.md#constructor) - -### Methods - -- [deriveChild](hdkey.EthereumHDKey.md#derivechild) -- [derivePath](hdkey.EthereumHDKey.md#derivepath) -- [getWallet](hdkey.EthereumHDKey.md#getwallet) -- [privateExtendedKey](hdkey.EthereumHDKey.md#privateextendedkey) -- [publicExtendedKey](hdkey.EthereumHDKey.md#publicextendedkey) -- [fromExtendedKey](hdkey.EthereumHDKey.md#fromextendedkey) -- [fromMasterSeed](hdkey.EthereumHDKey.md#frommasterseed) -- [fromMnemonic](hdkey.EthereumHDKey.md#frommnemonic) - -## Constructors - -### constructor - -• **new EthereumHDKey**(`_hdkey`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_hdkey` | `HDKey` | - -#### Defined in - -[hdkey.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L28) - -## Methods - -### deriveChild - -▸ **deriveChild**(`index`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) - -Derive a node based on a child index - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `index` | `number` | - -#### Returns - -[`EthereumHDKey`](hdkey.EthereumHDKey.md) - -#### Defined in - -[hdkey.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L57) - -___ - -### derivePath - -▸ **derivePath**(`path`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) - -Derives a node based on a path (e.g. m/44'/0'/0/1) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `path` | `string` | - -#### Returns - -[`EthereumHDKey`](hdkey.EthereumHDKey.md) - -#### Defined in - -[hdkey.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L50) - -___ - -### getWallet - -▸ **getWallet**(): [`Wallet`](Wallet.md) - -Return a `Wallet` instance as seen above - -#### Returns - -[`Wallet`](Wallet.md) - -#### Defined in - -[hdkey.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L64) - -___ - -### privateExtendedKey - -▸ **privateExtendedKey**(): `string` - -Returns a BIP32 extended private key (xprv) - -#### Returns - -`string` - -#### Defined in - -[hdkey.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L33) - -___ - -### publicExtendedKey - -▸ **publicExtendedKey**(): `string` - -Return a BIP32 extended public key (xpub) - -#### Returns - -`string` - -#### Defined in - -[hdkey.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L43) - -___ - -### fromExtendedKey - -▸ `Static` **fromExtendedKey**(`base58Key`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) - -Create an instance based on a BIP32 extended private or public key. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `base58Key` | `string` | - -#### Returns - -[`EthereumHDKey`](hdkey.EthereumHDKey.md) - -#### Defined in - -[hdkey.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L24) - -___ - -### fromMasterSeed - -▸ `Static` **fromMasterSeed**(`seedBuffer`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) - -Creates an instance based on a seed. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `seedBuffer` | `Uint8Array` | - -#### Returns - -[`EthereumHDKey`](hdkey.EthereumHDKey.md) - -#### Defined in - -[hdkey.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L10) - -___ - -### fromMnemonic - -▸ `Static` **fromMnemonic**(`mnemonic`, `passphrase?`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) - -Creates an instance based on BIP39 mnemonic phrases - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `mnemonic` | `string` | -| `passphrase?` | `string` | - -#### Returns - -[`EthereumHDKey`](hdkey.EthereumHDKey.md) - -#### Defined in - -[hdkey.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L17) diff --git a/packages/wallet/docs/interfaces/thirdparty.EtherWalletOptions.md b/packages/wallet/docs/interfaces/thirdparty.EtherWalletOptions.md deleted file mode 100644 index faa38fb9fb3..00000000000 --- a/packages/wallet/docs/interfaces/thirdparty.EtherWalletOptions.md +++ /dev/null @@ -1,76 +0,0 @@ -[@ethereumjs/wallet](../README.md) / [thirdparty](../modules/thirdparty.md) / EtherWalletOptions - -# Interface: EtherWalletOptions - -[thirdparty](../modules/thirdparty.md).EtherWalletOptions - -## Table of contents - -### Properties - -- [address](thirdparty.EtherWalletOptions.md#address) -- [encrypted](thirdparty.EtherWalletOptions.md#encrypted) -- [hash](thirdparty.EtherWalletOptions.md#hash) -- [locked](thirdparty.EtherWalletOptions.md#locked) -- [private](thirdparty.EtherWalletOptions.md#private) -- [public](thirdparty.EtherWalletOptions.md#public) - -## Properties - -### address - -• **address**: `string` - -#### Defined in - -[thirdparty.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L105) - -___ - -### encrypted - -• **encrypted**: `boolean` - -#### Defined in - -[thirdparty.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L106) - -___ - -### hash - -• **hash**: `string` - -#### Defined in - -[thirdparty.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L108) - -___ - -### locked - -• **locked**: `boolean` - -#### Defined in - -[thirdparty.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L107) - -___ - -### private - -• **private**: `string` - -#### Defined in - -[thirdparty.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L109) - -___ - -### public - -• **public**: `string` - -#### Defined in - -[thirdparty.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L110) diff --git a/packages/wallet/docs/interfaces/thirdparty.EvpKdfOpts.md b/packages/wallet/docs/interfaces/thirdparty.EvpKdfOpts.md deleted file mode 100644 index 158acb2f420..00000000000 --- a/packages/wallet/docs/interfaces/thirdparty.EvpKdfOpts.md +++ /dev/null @@ -1,54 +0,0 @@ -[@ethereumjs/wallet](../README.md) / [thirdparty](../modules/thirdparty.md) / EvpKdfOpts - -# Interface: EvpKdfOpts - -[thirdparty](../modules/thirdparty.md).EvpKdfOpts - -## Table of contents - -### Properties - -- [count](thirdparty.EvpKdfOpts.md#count) -- [digest](thirdparty.EvpKdfOpts.md#digest) -- [ivsize](thirdparty.EvpKdfOpts.md#ivsize) -- [keysize](thirdparty.EvpKdfOpts.md#keysize) - -## Properties - -### count - -• **count**: `number` - -#### Defined in - -[thirdparty.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L13) - -___ - -### digest - -• **digest**: `string` - -#### Defined in - -[thirdparty.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L16) - -___ - -### ivsize - -• **ivsize**: `number` - -#### Defined in - -[thirdparty.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L15) - -___ - -### keysize - -• **keysize**: `number` - -#### Defined in - -[thirdparty.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L14) diff --git a/packages/wallet/docs/modules/hdkey.md b/packages/wallet/docs/modules/hdkey.md deleted file mode 100644 index 1499d5c90cd..00000000000 --- a/packages/wallet/docs/modules/hdkey.md +++ /dev/null @@ -1,9 +0,0 @@ -[@ethereumjs/wallet](../README.md) / hdkey - -# Namespace: hdkey - -## Table of contents - -### Classes - -- [EthereumHDKey](../classes/hdkey.EthereumHDKey.md) diff --git a/packages/wallet/docs/modules/thirdparty.md b/packages/wallet/docs/modules/thirdparty.md deleted file mode 100644 index fba3497760e..00000000000 --- a/packages/wallet/docs/modules/thirdparty.md +++ /dev/null @@ -1,104 +0,0 @@ -[@ethereumjs/wallet](../README.md) / thirdparty - -# Namespace: thirdparty - -## Table of contents - -### Interfaces - -- [EtherWalletOptions](../interfaces/thirdparty.EtherWalletOptions.md) -- [EvpKdfOpts](../interfaces/thirdparty.EvpKdfOpts.md) - -### Variables - -- [Thirdparty](thirdparty.md#thirdparty) - -### Functions - -- [fromEtherCamp](thirdparty.md#fromethercamp) -- [fromEtherWallet](thirdparty.md#frometherwallet) -- [fromQuorumWallet](thirdparty.md#fromquorumwallet) - -## Variables - -### Thirdparty - -• `Const` **Thirdparty**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `fromEtherCamp` | (`passphrase`: `string`) => [`Wallet`](../classes/Wallet.md) | -| `fromEtherWallet` | (`input`: `string` \| [`EtherWalletOptions`](../interfaces/thirdparty.EtherWalletOptions.md), `password`: `string`) => `Promise`<[`Wallet`](../classes/Wallet.md)\> | -| `fromQuorumWallet` | (`passphrase`: `string`, `userid`: `string`) => [`Wallet`](../classes/Wallet.md) | - -#### Defined in - -[thirdparty.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L187) - -## Functions - -### fromEtherCamp - -▸ **fromEtherCamp**(`passphrase`): [`Wallet`](../classes/Wallet.md) - -Third Party API: Import a brain wallet used by Ether.Camp - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `passphrase` | `string` | - -#### Returns - -[`Wallet`](../classes/Wallet.md) - -#### Defined in - -[thirdparty.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L167) - -___ - -### fromEtherWallet - -▸ **fromEtherWallet**(`input`, `password`): `Promise`<[`Wallet`](../classes/Wallet.md)\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `input` | `string` \| [`EtherWalletOptions`](../interfaces/thirdparty.EtherWalletOptions.md) | -| `password` | `string` | - -#### Returns - -`Promise`<[`Wallet`](../classes/Wallet.md)\> - -#### Defined in - -[thirdparty.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L118) - -___ - -### fromQuorumWallet - -▸ **fromQuorumWallet**(`passphrase`, `userid`): [`Wallet`](../classes/Wallet.md) - -Third Party API: Import a brain wallet used by Quorum Wallet - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `passphrase` | `string` | -| `userid` | `string` | - -#### Returns - -[`Wallet`](../classes/Wallet.md) - -#### Defined in - -[thirdparty.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L174) diff --git a/packages/wallet/docs/type-aliases/KDFFunctions.md b/packages/wallet/docs/type-aliases/KDFFunctions.md new file mode 100644 index 00000000000..b3b2d00766b --- /dev/null +++ b/packages/wallet/docs/type-aliases/KDFFunctions.md @@ -0,0 +1,11 @@ +[**@ethereumjs/wallet**](../README.md) + +*** + +[@ethereumjs/wallet](../README.md) / KDFFunctions + +# Type Alias: KDFFunctions + +> **KDFFunctions** = *typeof* [`KDFFunctions`](../variables/KDFFunctions.md)\[keyof *typeof* [`KDFFunctions`](../variables/KDFFunctions.md)\] + +Defined in: [wallet.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L163) diff --git a/packages/wallet/docs/variables/KDFFunctions.md b/packages/wallet/docs/variables/KDFFunctions.md new file mode 100644 index 00000000000..7cf3f023000 --- /dev/null +++ b/packages/wallet/docs/variables/KDFFunctions.md @@ -0,0 +1,21 @@ +[**@ethereumjs/wallet**](../README.md) + +*** + +[@ethereumjs/wallet](../README.md) / KDFFunctions + +# Variable: KDFFunctions + +> **KDFFunctions**: `object` + +Defined in: [wallet.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L163) + +## Type declaration + +### PBKDF + +> `readonly` **PBKDF**: `"pbkdf2"` = `'pbkdf2'` + +### Scrypt + +> `readonly` **Scrypt**: `"scrypt"` = `'scrypt'` diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 2516579ca70..7599f9798aa 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -34,7 +34,7 @@ "clean": "../../config/cli/clean-package.sh", "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "coverage:istanbul": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts", - "docs:build": "npx typedoc --options typedoc.cjs", + "docs:build": "npx typedoc --options typedoc.mjs", "examples": "tsx ../../scripts/examples-runner.ts -- wallet", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config ./eslint.config.mjs .", @@ -52,7 +52,7 @@ "dependencies": { "@ethereumjs/util": "^10.0.0-rc.1", "@scure/base": "^1.2.4", - "ethereum-cryptography": "^3.1.0", + "ethereum-cryptography": "^3.2.0", "js-md5": "^0.8.3", "uuid": "^11.1.0" }, diff --git a/packages/wallet/typedoc.cjs b/packages/wallet/typedoc.cjs deleted file mode 100644 index 701fee055fa..00000000000 --- a/packages/wallet/typedoc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - extends: '../../config/typedoc.cjs', - entryPoints: ['src'], - out: 'docs', - exclude: ['test/**/*.ts'], -} diff --git a/packages/wallet/typedoc.mjs b/packages/wallet/typedoc.mjs new file mode 100644 index 00000000000..4f962d06684 --- /dev/null +++ b/packages/wallet/typedoc.mjs @@ -0,0 +1,6 @@ +export default { + extends: '../../config/typedoc.mjs', + entryPoints: ['src'], + out: 'docs', + exclude: ['test/**/*.ts'], +}