diff --git a/.github/workflows/bun-support.yml b/.github/workflows/bun-support.yml new file mode 100644 index 0000000000..5e91dc4bdd --- /dev/null +++ b/.github/workflows/bun-support.yml @@ -0,0 +1,83 @@ +name: Bun Support +#on: +# schedule: +# - cron: 0 0 * * * +# workflow_dispatch: + +on: + push: + branches: [master, develop] + tags: ['*'] + pull_request: + types: [opened, reopened, synchronize] + workflow_dispatch: + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: oven-sh/setup-bun@v1 + + - run: bunx ci --omit=peer + + - name: Test Block + run: bunx vitest run test + working-directory: packages/block + + - name: Test Blockchain + run: bunx vitest run test + working-directory: packages/blockchain + + # Client not working yet in Bun (expected), 2024-01-08 + # - name: Test Client + # run: bunx vitest run test + # working-directory: packages/client + + - name: Test Common + run: bunx vitest run test + working-directory: packages/common + + - name: Test Devp2p + run: bunx vitest run test + working-directory: packages/devp2p + + - name: Test Ethash + run: bunx vitest run test + working-directory: packages/ethash + + - name: Test EVM + run: bunx vitest run test + working-directory: packages/evm + + - name: Test RLP + run: bunx vitest run test + working-directory: packages/rlp + + - name: Test StateManager + run: bunx vitest run test + working-directory: packages/statemanager + + - name: Test Trie + run: bunx vitest run test + working-directory: packages/trie + + - name: Test Tx + run: bunx vitest run test + working-directory: packages/tx + + - name: Test Util + run: bunx vitest run test + working-directory: packages/util + + - name: Test VM + run: bunx vitest run test + working-directory: packages/vm + + - name: Test Wallet + run: bunx vitest run test + working-directory: packages/wallet diff --git a/packages/block/README.md b/packages/block/README.md index 561690e6b0..6c261d4cd8 100644 --- a/packages/block/README.md +++ b/packages/block/README.md @@ -21,6 +21,34 @@ npm install @ethereumjs/block **Note:** If you want to work with `EIP-4844` related functionality, you will have additional manual installation steps for the **KZG setup**, see related section below. +## Runtime Support + +### Node.js + +The current version of this library supports Node `18` and `20` (recommended). Node.js is the main supported platform which is also used internally for development and testing. + +TypeScript examples in the [examples](./examples/) folder can be run using [tsx](https://github.com/privatenumber/tsx) like the following: + +```shell +tsx examples/simple.ts +``` + +### Bun + +This library has been tested to run with [Bun](https://bun.sh/) [v1.0](https://bun.sh/blog/bun-v1.0) or higher. Note that Bun is still in very active development and a production usage is not recommended (by the Bun team itself) in many cases. + +Example run using Bun: + +```shell +bun run examples/simple.ts +``` + +### Browser + +This library targets to run in modern browsers which support the JavaScript [ES2020](https://www.w3schools.com/js/js_2020.asp) feature set. There is a dedicated ESM build provided and imports can be done using the normal ES6 [module import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) syntax. + +For browser usage see the dedicated [example](./examples/browser.html) (with usage instructions). + ## Usage ### Introduction @@ -302,12 +330,6 @@ const block = Block.fromBlockData( console.log(`Proof-of-Stake (default) block created with hardfork=${block.common.hardfork()}`) ``` -## Browser - -With the breaking release round in Summer 2023 we have added hybrid ESM/CJS builds for all our libraries (see section below) and have eliminated many of the caveats which had previously prevented a frictionless browser usage. - -It is now 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). - ## API ### Docs