diff --git a/packages/core-utils/src/app/misc.ts b/packages/core-utils/src/app/misc.ts index b22163b78f362..d6828f9f06b3c 100644 --- a/packages/core-utils/src/app/misc.ts +++ b/packages/core-utils/src/app/misc.ts @@ -290,22 +290,3 @@ export const runInDomain = async ( export const getCurrentTime = (): number => { return Math.round(Date.now() / 1000) } -/** - * Encodes a transaction in RLP format, using a random signature - * @param {object} Transaction object - */ -export const rlpEncodeTransactionWithRandomSig = ( - transaction: object -): string => { - return RLP.encode([ - hexlify(transaction['nonce']), - hexlify(transaction['gasPrice']), - hexlify(transaction['gasLimit']), - hexlify(transaction['to']), - hexlify(transaction['value']), - hexlify(transaction['data']), - '0x11', // v - '0x' + '11'.repeat(32), // r - '0x' + '11'.repeat(32), // s - ]) -} diff --git a/packages/rollup-full-node/src/app/test-web3-rpc-handler.ts b/packages/rollup-full-node/src/app/test-web3-rpc-handler.ts index 838ffde486764..21dcf6e5457d1 100644 --- a/packages/rollup-full-node/src/app/test-web3-rpc-handler.ts +++ b/packages/rollup-full-node/src/app/test-web3-rpc-handler.ts @@ -3,7 +3,6 @@ import { getLogger, numberToHexString, castToNumber, - rlpEncodeTransactionWithRandomSig, } from '@eth-optimism/core-utils' import { GAS_LIMIT } from '@eth-optimism/ovm' import { JsonRpcProvider } from 'ethers/providers' @@ -144,16 +143,18 @@ export class TestWeb3Handler extends DefaultWeb3Handler { if (!ovmTx.to) { ovmTx.to = '0x' } - if (!ovmTx.gasPrice) { - ovmTx.gasPrice = 0 - } - if (!ovmTx.gasLimit) { + if (!ovmTx.gas) { ovmTx.gasLimit = GAS_LIMIT + } else { + ovmTx.gasLimit = ovmTx.gas + delete ovmTx.gas } + const ovmTxFrom = ovmTx.from + delete ovmTx.from ovmTx.value = 0 return this.sendRawTransaction( - rlpEncodeTransactionWithRandomSig(ovmTx), - ovmTx.from + await this.getNewWallet().sign(ovmTx), + ovmTxFrom ) } diff --git a/packages/rollup-full-node/test/app/web-rpc-handler.spec.ts b/packages/rollup-full-node/test/app/web-rpc-handler.spec.ts index 055f5290e5e77..3abbe91b9b98b 100644 --- a/packages/rollup-full-node/test/app/web-rpc-handler.spec.ts +++ b/packages/rollup-full-node/test/app/web-rpc-handler.spec.ts @@ -5,21 +5,12 @@ import { add0x, getLogger, keccak256, - numberToHexString, JSONRPC_ERRORS, - ZERO_ADDRESS, hexStrToBuf, } from '@eth-optimism/core-utils' import { CHAIN_ID } from '@eth-optimism/ovm' -import { - ethers, - ContractFactory, - Wallet, - Contract, - utils, - providers, -} from 'ethers' +import { ethers, ContractFactory, Wallet, Contract, utils } from 'ethers' import { resolve } from 'path' import * as rimraf from 'rimraf' import * as fs from 'fs'