diff --git a/package.json b/package.json index 336b86329e..f571f1a003 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ }, "dependencies": { "@ethersproject/bignumber": "^5.1.1", - "@ethersproject/bytes": "^5.0.8", "async-mutex": "^0.4.0", "ethers": "^5.1.0", "ethers-v6": "npm:ethers@^6.11.1" diff --git a/src/lib/message/ParentToChildMessage.ts b/src/lib/message/ParentToChildMessage.ts index 6bbc5a10dd..dace3146a5 100644 --- a/src/lib/message/ParentToChildMessage.ts +++ b/src/lib/message/ParentToChildMessage.ts @@ -21,7 +21,6 @@ import { Provider } from '@ethersproject/abstract-provider' import { Signer } from '@ethersproject/abstract-signer' import { ContractTransaction } from '@ethersproject/contracts' import { BigNumber } from '@ethersproject/bignumber' -import { concat } from '@ethersproject/bytes' import { ZeroAddress, toBeArray, @@ -29,6 +28,7 @@ import { zeroPadValue, getAddress, keccak256, + concat, } from 'ethers-v6' import { ArbRetryableTx__factory } from '../abi/factories/ArbRetryableTx__factory' diff --git a/src/lib/message/messageDataParser.ts b/src/lib/message/messageDataParser.ts index 0193b2a618..5626cfdf03 100644 --- a/src/lib/message/messageDataParser.ts +++ b/src/lib/message/messageDataParser.ts @@ -1,7 +1,6 @@ -import { getAddress } from 'ethers-v6' +import { getAddress, zeroPadValue } from 'ethers-v6' import { defaultAbiCoder } from '@ethersproject/abi' import { BigNumber } from '@ethersproject/bignumber' -import { hexZeroPad } from '@ethersproject/bytes' export class SubmitRetryableMessageDataParser { /** @@ -28,7 +27,7 @@ export class SubmitRetryableMessageDataParser { ) as BigNumber[] const addressFromBigNumber = (bn: BigNumber) => - getAddress(hexZeroPad(bn.toHexString(), 20)) + getAddress(zeroPadValue(bn.toHexString(), 20)) const destAddress = addressFromBigNumber(parsed[0]) const l2CallValue = parsed[1] diff --git a/src/lib/utils/byte_serialize_params.ts b/src/lib/utils/byte_serialize_params.ts index 02c9e93a45..2df3d6f53f 100644 --- a/src/lib/utils/byte_serialize_params.ts +++ b/src/lib/utils/byte_serialize_params.ts @@ -48,8 +48,13 @@ Arbitrum SDK includes methods for [serializing parameters](https://developer.off import { Provider } from '@ethersproject/abstract-provider' import { Signer } from '@ethersproject/abstract-signer' -import { isAddress as _isAddress } from 'ethers-v6' -import { concat, hexZeroPad } from '@ethersproject/bytes' +import { + isAddress as _isAddress, + concat, + toBeArray, + zeroPadValue, +} from 'ethers-v6' + import { BigNumber } from '@ethersproject/bignumber' import { ArbAddressTable__factory } from '../abi/factories/ArbAddressTable__factory' @@ -112,7 +117,7 @@ const isAddress = (input: PrimativeType) => typeof input === 'string' && _isAddress(input) const toUint = (val: PrimativeType, bytes: BytesNumber) => - hexZeroPad(BigNumber.from(val).toHexString(), bytes) + zeroPadValue(BigNumber.from(val).toHexString(), bytes) // outputs string suitable for formatting const formatPrimative = (value: PrimativeType) => { @@ -186,5 +191,5 @@ export const serializeParams = async ( } } } - return concat(formattedParams) + return toBeArray(concat(formattedParams)) } diff --git a/tests/fork/inbox.test.ts b/tests/fork/inbox.test.ts index fd3df901be..15e5259909 100644 --- a/tests/fork/inbox.test.ts +++ b/tests/fork/inbox.test.ts @@ -29,7 +29,7 @@ import { SequencerInbox__factory } from '../../src/lib/abi/factories/SequencerIn import { InboxTools } from '../../src' import { ethers, network } from 'hardhat' -import { hexZeroPad } from '@ethersproject/bytes' +import { zeroPadValue } from 'ethers-v6' import { ArbitrumNetwork, getArbitrumNetwork, @@ -217,7 +217,7 @@ describe('Inbox tools', () => { txParams.gasLimit, txParams.maxFeePerGas, txParams.nonce, - hexZeroPad(txParams.to, 32), + zeroPadValue(txParams.to, 32), txParams.value, '0x', ] diff --git a/tests/integration/retryableData.test.ts b/tests/integration/retryableData.test.ts index 170e4836b4..a81768dccf 100644 --- a/tests/integration/retryableData.test.ts +++ b/tests/integration/retryableData.test.ts @@ -18,7 +18,7 @@ import { assert, expect } from 'chai' import { BigNumber } from '@ethersproject/bignumber' -import { hexlify } from '@ethersproject/bytes' +import { hexlify } from 'ethers-v6' import { TestERC20__factory } from '../../src/lib/abi/factories/TestERC20__factory' import { fundParentSigner, skipIfMainnet } from './testHelpers' import { RetryableDataTools } from '../../src' diff --git a/tests/unit/addressAlias.test.ts b/tests/unit/addressAlias.test.ts index 6189ba6d0d..b9f40512a6 100644 --- a/tests/unit/addressAlias.test.ts +++ b/tests/unit/addressAlias.test.ts @@ -21,8 +21,7 @@ import { expect } from 'chai' import { Address } from '../../src/lib/dataEntities/address' import { BigNumber } from 'ethers' import { ADDRESS_ALIAS_OFFSET } from '../../src/lib/dataEntities/constants' -import { hexZeroPad } from '@ethersproject/bytes' -import { getAddress } from 'ethers-v6' +import { getAddress, zeroPadValue } from 'ethers-v6' const offset = BigNumber.from(ADDRESS_ALIAS_OFFSET) const maxAddr = BigNumber.from('0xffffffffffffffffffffffffffffffffffffffff') @@ -49,7 +48,7 @@ describe('Address', () => { it('does alias correctly below offset', async () => { // 0xeeeeffffffffffffffffffffffffffffffffeee4 - const belowOffset = hexZeroPad( + const belowOffset = zeroPadValue( maxAddr.sub(offset).sub(10).toHexString(), 20 ) @@ -63,7 +62,7 @@ describe('Address', () => { it('does alias correctly on', async () => { // 0xeeeeffffffffffffffffffffffffffffffffeeee - const onOffset = hexZeroPad(maxAddr.sub(offset).add(0).toHexString(), 20) + const onOffset = zeroPadValue(maxAddr.sub(offset).add(0).toHexString(), 20) testApplyUndo( getAddress(onOffset), @@ -74,7 +73,7 @@ describe('Address', () => { it('does alias correctly above offset', async () => { // 0xeeeeffffffffffffffffffffffffffffffffeef8 - const aboveOffset = hexZeroPad( + const aboveOffset = zeroPadValue( maxAddr.sub(offset).add(10).toHexString(), 20 ) diff --git a/yarn.lock b/yarn.lock index 93131977d0..8c77f9336b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -450,7 +450,7 @@ "@ethersproject/logger" "^5.7.0" bn.js "^5.2.1" -"@ethersproject/bytes@5.6.1", "@ethersproject/bytes@^5.0.8": +"@ethersproject/bytes@5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.1.tgz#24f916e411f82a8a60412344bf4a813b917eefe7" integrity sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g==