From 2c368ea66c67ce744b5d959d73ecc24c215c964f Mon Sep 17 00:00:00 2001 From: ScottyPoi Date: Tue, 27 Aug 2024 11:20:56 -0600 Subject: [PATCH] util: rename fromValuesArray to fromBytesArray --- packages/block/test/eip4895block.spec.ts | 4 ++-- packages/block/test/eip7685block.spec.ts | 2 +- packages/block/test/header.spec.ts | 4 ++-- packages/tx/test/base.spec.ts | 4 ++-- packages/tx/test/legacy.spec.ts | 2 +- packages/util/src/withdrawal.ts | 2 +- packages/util/test/withdrawal.spec.ts | 6 +++--- packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts | 6 +++--- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/block/test/eip4895block.spec.ts b/packages/block/test/eip4895block.spec.ts index bac23d4cc1..61c2b98200 100644 --- a/packages/block/test/eip4895block.spec.ts +++ b/packages/block/test/eip4895block.spec.ts @@ -3,7 +3,7 @@ import { RLP } from '@ethereumjs/rlp' import { Address, KECCAK256_RLP, - createWithdrawalFromValuesArray, + createWithdrawalFromBytesArray, hexToBytes, randomBytes, zeros, @@ -40,7 +40,7 @@ describe('EIP4895 tests', () => { // get withdrawalsArray const gethBlockBytesArray = RLP.decode(hexToBytes(`0x${gethWithdrawals8BlockRlp}`)) const withdrawals = (gethBlockBytesArray[3] as WithdrawalBytes[]).map((wa) => - createWithdrawalFromValuesArray(wa), + createWithdrawalFromBytesArray(wa), ) assert.equal(withdrawals.length, 8, '8 withdrawals should have been found') const gethWithdrawalsRoot = (gethBlockBytesArray[0] as Uint8Array[])[16] as Uint8Array diff --git a/packages/block/test/eip7685block.spec.ts b/packages/block/test/eip7685block.spec.ts index ef90625ca3..d45b295381 100644 --- a/packages/block/test/eip7685block.spec.ts +++ b/packages/block/test/eip7685block.spec.ts @@ -109,7 +109,7 @@ describe('7685 tests', () => { }) }) -describe('createWithdrawalFromValuesArray tests', () => { +describe('createWithdrawalFromBytesArray tests', () => { it('should construct a block with empty requests root', () => { const block = createBlockFromBytesArray( [createBlockHeader({}, { common }).raw(), [], [], [], []], diff --git a/packages/block/test/header.spec.ts b/packages/block/test/header.spec.ts index 4964ecfb8e..148bd908bc 100644 --- a/packages/block/test/header.spec.ts +++ b/packages/block/test/header.spec.ts @@ -129,7 +129,7 @@ describe('[Block]: Header functions', () => { } }) - it('Initialization -> createWithdrawalFromValuesArray()', () => { + it('Initialization -> createWithdrawalFromBytesArray()', () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.London }) const zero = new Uint8Array(0) const headerArray = [] @@ -156,7 +156,7 @@ describe('[Block]: Header functions', () => { ) }) - it('Initialization -> createWithdrawalFromValuesArray() -> error cases', () => { + it('Initialization -> createWithdrawalFromBytesArray() -> error cases', () => { const headerArray = Array(22).fill(new Uint8Array(0)) // mock header data (if set to zeros(0) header throws) diff --git a/packages/tx/test/base.spec.ts b/packages/tx/test/base.spec.ts index d9c4d04a7f..713c25b56e 100644 --- a/packages/tx/test/base.spec.ts +++ b/packages/tx/test/base.spec.ts @@ -184,7 +184,7 @@ describe('[BaseTransaction]', () => { } }) - it('createWithdrawalFromValuesArray()', () => { + it('createWithdrawalFromBytesArray()', () => { let rlpData: any = legacyTxs[0].raw() rlpData[0] = toBytes('0x0') try { @@ -270,7 +270,7 @@ describe('[BaseTransaction]', () => { for (const tx of txType.txs) { assert.ok( txType.create.bytesArray(tx.raw() as any, { common }), - `${txType.name}: should do roundtrip raw() -> createWithdrawalFromValuesArray()`, + `${txType.name}: should do roundtrip raw() -> createWithdrawalFromBytesArray()`, ) } } diff --git a/packages/tx/test/legacy.spec.ts b/packages/tx/test/legacy.spec.ts index b950b78b52..1271b948f0 100644 --- a/packages/tx/test/legacy.spec.ts +++ b/packages/tx/test/legacy.spec.ts @@ -99,7 +99,7 @@ describe('[Transaction]', () => { ) }) - it('Initialization -> decode with createWithdrawalFromValuesArray()', () => { + it('Initialization -> decode with createWithdrawalFromBytesArray()', () => { for (const tx of txFixtures.slice(0, 4)) { const txData = tx.raw.map((rawTxData) => hexToBytes(rawTxData as PrefixedHexString)) const pt = createLegacyTxFromBytesArray(txData) diff --git a/packages/util/src/withdrawal.ts b/packages/util/src/withdrawal.ts index 9a4ced48f5..662befbeb3 100644 --- a/packages/util/src/withdrawal.ts +++ b/packages/util/src/withdrawal.ts @@ -72,7 +72,7 @@ export class Withdrawal { } } -export function createWithdrawalFromValuesArray(withdrawalArray: WithdrawalBytes) { +export function createWithdrawalFromBytesArray(withdrawalArray: WithdrawalBytes) { if (withdrawalArray.length !== 4) { throw Error(`Invalid withdrawalArray length expected=4 actual=${withdrawalArray.length}`) } diff --git a/packages/util/test/withdrawal.spec.ts b/packages/util/test/withdrawal.spec.ts index 762872a221..740ec33ced 100644 --- a/packages/util/test/withdrawal.spec.ts +++ b/packages/util/test/withdrawal.spec.ts @@ -5,7 +5,7 @@ import { bigIntToHex, bytesToHex, createWithdrawal, - createWithdrawalFromValuesArray, + createWithdrawalFromBytesArray, hexToBytes, intToHex, withdrawalToBytesArray, @@ -93,9 +93,9 @@ describe('Withdrawal', () => { assert.equal(gethWithdrawalsRlp, withdrawalsDataToRlp, 'The withdrawals to buffer should match') }) - it('createWithdrawalFromValuesArray, toJSON and toValue', () => { + it('createWithdrawalFromBytesArray, toJSON and toValue', () => { const withdrawals = (gethWithdrawalsBuffer as WithdrawalBytes[]).map( - createWithdrawalFromValuesArray, + createWithdrawalFromBytesArray, ) const withdrawalsJson = withdrawals.map((wt) => wt.toJSON()) assert.deepEqual(withdrawalsGethVector, withdrawalsJson, 'Withdrawals json should match') diff --git a/packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts b/packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts index 97e32500dd..6351909c6d 100644 --- a/packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts +++ b/packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts @@ -9,7 +9,7 @@ import { GWEI_TO_WEI, KECCAK256_RLP, bytesToHex, - createWithdrawalFromValuesArray, + createWithdrawalFromBytesArray, hexToBytes, parseGethGenesisState, zeros, @@ -142,7 +142,7 @@ describe('EIP4895 tests', () => { const gethBlockBufferArray = decode(hexToBytes(gethWithdrawals8BlockRlp)) const withdrawals = (gethBlockBufferArray[3] as WithdrawalBytes[]).map((wa) => - createWithdrawalFromValuesArray(wa), + createWithdrawalFromBytesArray(wa), ) assert.equal(withdrawals[0].amount, BigInt(0), 'withdrawal 0 should have 0 amount') let block: Block @@ -215,7 +215,7 @@ describe('EIP4895 tests', () => { const gethBlockBufferArray = decode(hexToBytes(gethWithdrawals8BlockRlp)) const withdrawals = (gethBlockBufferArray[3] as WithdrawalBytes[]).map((wa) => - createWithdrawalFromValuesArray(wa), + createWithdrawalFromBytesArray(wa), ) const td = await blockchain.getTotalDifficulty(genesisBlock.hash())