diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 408405d..e6e4a7d 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -9,8 +9,7 @@ jobs: strategy: matrix: node: - - 18 - - 20 + - 22 steps: - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 with: diff --git a/test/rlp.test.js b/test/rlp.test.js index f4df611..952f66e 100644 --- a/test/rlp.test.js +++ b/test/rlp.test.js @@ -5,10 +5,10 @@ import { RLP } from '../lib/esm/rlp.js'; import { ethHex, ethHexNoLeadingZero } from '../lib/esm/utils.js'; import { ENCODE_TESTS, DECODE_TESTS, INVALID } from './vectors/monorepo/rlp.js'; import { getEthersVectors, getViemVectors } from './util.js'; -import { default as RLP_TEST } from './vectors/ethereum-tests/RLPTests/rlptest.json' assert { type: 'json' }; -import { default as INVALID_RLP } from './vectors/ethereum-tests/RLPTests/invalidRLPTest.json' assert { type: 'json' }; -import { default as RANDOM_RLP } from './vectors/ethereum-tests/RLPTests/RandomRLPTests/example.json' assert { type: 'json' }; -import { default as EIP2930 } from './vectors/monorepo/eip2930blockRLP.json' assert { type: 'json' }; +import { default as RLP_TEST } from './vectors/ethereum-tests/RLPTests/rlptest.json' with { type: 'json' }; +import { default as INVALID_RLP } from './vectors/ethereum-tests/RLPTests/invalidRLPTest.json' with { type: 'json' }; +import { default as RANDOM_RLP } from './vectors/ethereum-tests/RLPTests/RandomRLPTests/example.json' with { type: 'json' }; +import { default as EIP2930 } from './vectors/monorepo/eip2930blockRLP.json' with { type: 'json' }; const VIEM_RLP = getViemVectors('rlp.json.gz'); const ETHERS_RLP = getEthersVectors('rlp.json.gz'); @@ -17,10 +17,12 @@ describe('RLP', () => { describe('@ethereumjs/rlp', () => { should('encode basic', () => { for (const [k, v] of Object.entries(ENCODE_TESTS)) - for (const inp of v) deepStrictEqual(ethHexNoLeadingZero.encode(RLP.encode(inp)), `0x${k}`, 'encode'); + for (const inp of v) + deepStrictEqual(ethHexNoLeadingZero.encode(RLP.encode(inp)), `0x${k}`, 'encode'); }); should('decode basic', () => { - const toArr = (elm) => (Array.isArray(elm) ? elm.map(toArr) : ethHexNoLeadingZero.encode(elm)); + const toArr = (elm) => + Array.isArray(elm) ? elm.map(toArr) : ethHexNoLeadingZero.encode(elm); for (const k in DECODE_TESTS) deepStrictEqual(toArr(RLP.decode(ethHexNoLeadingZero.decode(k))), DECODE_TESTS[k]); }); diff --git a/test/tx.test.js b/test/tx.test.js index 0ebe5ed..70ae0fa 100644 --- a/test/tx.test.js +++ b/test/tx.test.js @@ -4,8 +4,8 @@ import { describe, should } from 'micro-should'; import { addr, Transaction, messenger } from '../lib/esm/index.js'; import { RawTx, RlpTx, __tests } from '../lib/esm/tx.js'; import { add0x, createDecimal, ethHex, formatters } from '../lib/esm/utils.js'; -import { default as TX_VECTORS } from './vectors/transactions.json' assert { type: 'json' }; -import { default as EIP155_VECTORS } from './vectors/eips/eip155.json' assert { type: 'json' }; +import { default as TX_VECTORS } from './vectors/transactions.json' with { type: 'json' }; +import { default as EIP155_VECTORS } from './vectors/eips/eip155.json' with { type: 'json' }; import * as ethTests from './vectors/eth-tests-tx-vectors.js'; import { getEthersVectors, getViemVectors } from './util.js'; @@ -147,8 +147,8 @@ const SKIPPED_ERRORS = { 'TransactionWithLeadingZerosValue', 'TransactionWithLeadingZerosNonce', 'TransactionWithRvaluePrefixed00BigInt', - ] -} + ], +}; function log(...args) { console.log( @@ -753,7 +753,8 @@ describe('messenger', () => { const privateKey = '0x43ff8d9ae58f6f2ef437bd3543362d1d842ecca3b6cc578b46e862b47fd60020'; const address = '0xba20188aE2Bc7dd72eD8d0c4936154a49b17f08A'; const msg = 'noble'; - const sig = '0x425fbe7b4d5078c4f6538f6ae13c385874ce31478324feacf1795e2403bedc3d6e8204d3cc870c95bad45bdfa6e1f631044c8886d0ff8af93923f9bc051b16841b'; + const sig = + '0x425fbe7b4d5078c4f6538f6ae13c385874ce31478324feacf1795e2403bedc3d6e8204d3cc870c95bad45bdfa6e1f631044c8886d0ff8af93923f9bc051b16841b'; deepStrictEqual(messenger.sign(msg, privateKey), sig); deepStrictEqual(messenger.verify(sig, msg, address), true); }); @@ -765,8 +766,8 @@ describe('messenger', () => { const isValid = messenger.verify(sig, msg, address); deepStrictEqual(isValid, true, i); } - }) -}) + }); +}); // ESM is broken. import url from 'node:url'; diff --git a/test/vectors b/test/vectors index 5e230e0..5c55a6a 160000 --- a/test/vectors +++ b/test/vectors @@ -1 +1 @@ -Subproject commit 5e230e052ffb84e05e3be3139a23f76d17741fa6 +Subproject commit 5c55a6ab8d2a2d3c87e3f1abfe876a8b280e41aa