Skip to content

Commit

Permalink
bump ci to v22 only
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed May 10, 2024
1 parent 38f04b0 commit 83b3f1c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ jobs:
strategy:
matrix:
node:
- 18
- 20
- 22
steps:
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
with:
Expand Down
14 changes: 8 additions & 6 deletions test/rlp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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]);
});
Expand Down
15 changes: 8 additions & 7 deletions test/tx.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -147,8 +147,8 @@ const SKIPPED_ERRORS = {
'TransactionWithLeadingZerosValue',
'TransactionWithLeadingZerosNonce',
'TransactionWithRvaluePrefixed00BigInt',
]
}
],
};

function log(...args) {
console.log(
Expand Down Expand Up @@ -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);
});
Expand All @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion test/vectors
Submodule vectors updated 1 files
+213 −213 eth-tests-tx-vectors.js

0 comments on commit 83b3f1c

Please sign in to comment.