Commit c2a04893 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

fix: abi encoded tx (#1049)

* contracts: don't double rlp decode

* chore: add changeset

* lint: fix

* deps: update

* linting: cleanup

* feat: contracts: use selector

* fix: contracts: use typescript

* contracts: use interface
parent 01646a0a
---
'@eth-optimism/contracts': patch
---
Do not RLP decode the transaction in the OVM_ECDSAContractAccount
...@@ -49,12 +49,12 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ...@@ -49,12 +49,12 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
/** /**
* Executes a signed transaction. * Executes a signed transaction.
* @param _encodedTransaction Signed EIP155 transaction. * @param _transaction Signed EIP155 transaction.
* @return Whether or not the call returned (rather than reverted). * @return Whether or not the call returned (rather than reverted).
* @return Data returned by the call. * @return Data returned by the call.
*/ */
function execute( function execute(
bytes memory _encodedTransaction Lib_EIP155Tx.EIP155Tx memory _transaction
) )
override override
public public
...@@ -63,23 +63,22 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ...@@ -63,23 +63,22 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
bytes memory bytes memory
) )
{ {
// Attempt to decode the transaction.
Lib_EIP155Tx.EIP155Tx memory transaction = Lib_EIP155Tx.decode(
_encodedTransaction,
Lib_ExecutionManagerWrapper.ovmCHAINID()
);
// Address of this contract within the ovm (ovmADDRESS) should be the same as the // Address of this contract within the ovm (ovmADDRESS) should be the same as the
// recovered address of the user who signed this message. This is how we manage to shim // recovered address of the user who signed this message. This is how we manage to shim
// account abstraction even though the user isn't a contract. // account abstraction even though the user isn't a contract.
require( require(
transaction.sender() == Lib_ExecutionManagerWrapper.ovmADDRESS(), _transaction.sender() == Lib_ExecutionManagerWrapper.ovmADDRESS(),
"Signature provided for EOA transaction execution is invalid." "Signature provided for EOA transaction execution is invalid."
); );
require(
_transaction.chainId == Lib_ExecutionManagerWrapper.ovmCHAINID(),
"Transaction signed with wrong chain ID"
);
// Need to make sure that the transaction nonce is right. // Need to make sure that the transaction nonce is right.
require( require(
transaction.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(), _transaction.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(),
"Transaction nonce does not match the expected nonce." "Transaction nonce does not match the expected nonce."
); );
...@@ -94,20 +93,20 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ...@@ -94,20 +93,20 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
require( require(
OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer( OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer(
Lib_PredeployAddresses.SEQUENCER_FEE_WALLET, Lib_PredeployAddresses.SEQUENCER_FEE_WALLET,
SafeMath.mul(transaction.gasLimit, transaction.gasPrice) SafeMath.mul(_transaction.gasLimit, _transaction.gasPrice)
), ),
"Fee was not transferred to relayer." "Fee was not transferred to relayer."
); );
if (transaction.isCreate) { if (_transaction.isCreate) {
// TEMPORARY: Disable value transfer for contract creations. // TEMPORARY: Disable value transfer for contract creations.
require( require(
transaction.value == 0, _transaction.value == 0,
"Value transfer in contract creation not supported." "Value transfer in contract creation not supported."
); );
(address created, bytes memory revertdata) = Lib_ExecutionManagerWrapper.ovmCREATE( (address created, bytes memory revertdata) = Lib_ExecutionManagerWrapper.ovmCREATE(
transaction.data _transaction.data
); );
// Return true if the contract creation succeeded, false w/ revertdata otherwise. // Return true if the contract creation succeeded, false w/ revertdata otherwise.
...@@ -123,17 +122,17 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ...@@ -123,17 +122,17 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
Lib_ExecutionManagerWrapper.ovmINCREMENTNONCE(); Lib_ExecutionManagerWrapper.ovmINCREMENTNONCE();
// Value transfer currently only supported for CALL but not for CREATE. // Value transfer currently only supported for CALL but not for CREATE.
if (transaction.value > 0) { if (_transaction.value > 0) {
// TEMPORARY: Block value transfer if the transaction has input data. // TEMPORARY: Block value transfer if the transaction has input data.
require( require(
transaction.data.length == 0, _transaction.data.length == 0,
"Value is nonzero but input data was provided." "Value is nonzero but input data was provided."
); );
require( require(
OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer( OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer(
transaction.to, _transaction.to,
transaction.value _transaction.value
), ),
"Value could not be transferred to recipient." "Value could not be transferred to recipient."
); );
...@@ -144,11 +143,11 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ...@@ -144,11 +143,11 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
// so that they don't have to pay any fees to the sequencer. Function will remain disabled // so that they don't have to pay any fees to the sequencer. Function will remain disabled
// until a robust solution is in place. // until a robust solution is in place.
require( require(
transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(), _transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(),
"Calls to self are disabled until upgradability is re-enabled." "Calls to self are disabled until upgradability is re-enabled."
); );
return transaction.to.call(transaction.data); return _transaction.to.call(_transaction.data);
} }
} }
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0; pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Library Imports */ /* Library Imports */
import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol";
import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol"; import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol";
import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContractAccount.sol";
/** /**
* @title OVM_SequencerEntrypoint * @title OVM_SequencerEntrypoint
...@@ -63,10 +65,7 @@ contract OVM_SequencerEntrypoint { ...@@ -63,10 +65,7 @@ contract OVM_SequencerEntrypoint {
// Forward the transaction over to the EOA. // Forward the transaction over to the EOA.
(bool success, bytes memory returndata) = target.call( (bool success, bytes memory returndata) = target.call(
abi.encodeWithSignature( abi.encodeWithSelector(iOVM_ECDSAContractAccount.execute.selector, transaction)
"execute(bytes)",
encodedTx
)
); );
if (success) { if (success) {
......
...@@ -3,7 +3,7 @@ pragma solidity >0.5.0 <0.8.0; ...@@ -3,7 +3,7 @@ pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
/* Library Imports */ /* Library Imports */
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol";
/** /**
* @title iOVM_ECDSAContractAccount * @title iOVM_ECDSAContractAccount
...@@ -15,7 +15,7 @@ interface iOVM_ECDSAContractAccount { ...@@ -15,7 +15,7 @@ interface iOVM_ECDSAContractAccount {
********************/ ********************/
function execute( function execute(
bytes memory _encodedTransaction Lib_EIP155Tx.EIP155Tx memory _transaction
) )
external external
returns ( returns (
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
"@codechecks/client": "0.1.10-beta", "@codechecks/client": "0.1.10-beta",
"@eth-optimism/hardhat-ovm": "^0.2.2", "@eth-optimism/hardhat-ovm": "^0.2.2",
"@eth-optimism/smock": "^1.1.3", "@eth-optimism/smock": "^1.1.3",
"@ethersproject/transactions": "^5.0.31",
"@nomiclabs/hardhat-ethers": "^2.0.1", "@nomiclabs/hardhat-ethers": "^2.0.1",
"@nomiclabs/hardhat-waffle": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/contracts": "^3.3.0", "@openzeppelin/contracts": "^3.3.0",
......
...@@ -7,7 +7,7 @@ import { MockContract, smockit } from '@eth-optimism/smock' ...@@ -7,7 +7,7 @@ import { MockContract, smockit } from '@eth-optimism/smock'
import { toPlainObject } from 'lodash' import { toPlainObject } from 'lodash'
/* Internal Imports */ /* Internal Imports */
import { DEFAULT_EIP155_TX } from '../../../helpers' import { LibEIP155TxStruct, DEFAULT_EIP155_TX } from '../../../helpers'
import { predeploys } from '../../../../src' import { predeploys } from '../../../../src'
describe('OVM_ECDSAContractAccount', () => { describe('OVM_ECDSAContractAccount', () => {
...@@ -54,14 +54,18 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -54,14 +54,18 @@ describe('OVM_ECDSAContractAccount', () => {
const transaction = DEFAULT_EIP155_TX const transaction = DEFAULT_EIP155_TX
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
await OVM_ECDSAContractAccount.execute(encodedTransaction) await OVM_ECDSAContractAccount.execute(
LibEIP155TxStruct(encodedTransaction)
)
}) })
it(`should ovmCREATE if EIP155Transaction.to is zero address`, async () => { it(`should ovmCREATE if EIP155Transaction.to is zero address`, async () => {
const transaction = { ...DEFAULT_EIP155_TX, to: '' } const transaction = { ...DEFAULT_EIP155_TX, to: '' }
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
await OVM_ECDSAContractAccount.execute(encodedTransaction) await OVM_ECDSAContractAccount.execute(
LibEIP155TxStruct(encodedTransaction)
)
const ovmCREATE: any = const ovmCREATE: any =
Mock__OVM_ExecutionManager.smocked.ovmCREATE.calls[0] Mock__OVM_ExecutionManager.smocked.ovmCREATE.calls[0]
...@@ -76,7 +80,7 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -76,7 +80,7 @@ describe('OVM_ECDSAContractAccount', () => {
) )
await expect( await expect(
OVM_ECDSAContractAccount.execute(encodedTransaction) OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction))
).to.be.revertedWith( ).to.be.revertedWith(
'Signature provided for EOA transaction execution is invalid.' 'Signature provided for EOA transaction execution is invalid.'
) )
...@@ -87,7 +91,7 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -87,7 +91,7 @@ describe('OVM_ECDSAContractAccount', () => {
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
await expect( await expect(
OVM_ECDSAContractAccount.execute(encodedTransaction) OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction))
).to.be.revertedWith( ).to.be.revertedWith(
'Transaction nonce does not match the expected nonce.' 'Transaction nonce does not match the expected nonce.'
) )
...@@ -98,10 +102,8 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -98,10 +102,8 @@ describe('OVM_ECDSAContractAccount', () => {
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
await expect( await expect(
OVM_ECDSAContractAccount.execute(encodedTransaction) OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction))
).to.be.revertedWith( ).to.be.revertedWith('Transaction signed with wrong chain ID')
'Lib_EIP155Tx: Transaction signed with wrong chain ID'
)
}) })
// TEMPORARY: Skip gas checks for minnet. // TEMPORARY: Skip gas checks for minnet.
...@@ -109,8 +111,9 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -109,8 +111,9 @@ describe('OVM_ECDSAContractAccount', () => {
const transaction = { ...DEFAULT_EIP155_TX, gasLimit: 200000000 } const transaction = { ...DEFAULT_EIP155_TX, gasLimit: 200000000 }
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
const tx = LibEIP155TxStruct(encodedTransaction)
await expect( await expect(
OVM_ECDSAContractAccount.execute(encodedTransaction, { OVM_ECDSAContractAccount.execute(tx, {
gasLimit: 40000000, gasLimit: 40000000,
}) })
).to.be.revertedWith('Gas is not sufficient to execute the transaction.') ).to.be.revertedWith('Gas is not sufficient to execute the transaction.')
...@@ -122,16 +125,19 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -122,16 +125,19 @@ describe('OVM_ECDSAContractAccount', () => {
Mock__OVM_ETH.smocked.transfer.will.return.with(false) Mock__OVM_ETH.smocked.transfer.will.return.with(false)
await expect( const tx = LibEIP155TxStruct(encodedTransaction)
OVM_ECDSAContractAccount.execute(encodedTransaction) await expect(OVM_ECDSAContractAccount.execute(tx)).to.be.revertedWith(
).to.be.revertedWith('Fee was not transferred to relayer.') 'Fee was not transferred to relayer.'
)
}) })
it(`should transfer value if value is greater than 0`, async () => { it(`should transfer value if value is greater than 0`, async () => {
const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x' } const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x' }
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
await OVM_ECDSAContractAccount.execute(encodedTransaction) await OVM_ECDSAContractAccount.execute(
LibEIP155TxStruct(encodedTransaction)
)
// First call transfers fee, second transfers value (since value > 0). // First call transfers fee, second transfers value (since value > 0).
expect( expect(
...@@ -155,7 +161,7 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -155,7 +161,7 @@ describe('OVM_ECDSAContractAccount', () => {
}) })
await expect( await expect(
OVM_ECDSAContractAccount.execute(encodedTransaction) OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction))
).to.be.revertedWith('Value could not be transferred to recipient.') ).to.be.revertedWith('Value could not be transferred to recipient.')
}) })
...@@ -164,7 +170,7 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -164,7 +170,7 @@ describe('OVM_ECDSAContractAccount', () => {
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
await expect( await expect(
OVM_ECDSAContractAccount.execute(encodedTransaction) OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction))
).to.be.revertedWith('Value transfer in contract creation not supported.') ).to.be.revertedWith('Value transfer in contract creation not supported.')
}) })
...@@ -173,7 +179,7 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -173,7 +179,7 @@ describe('OVM_ECDSAContractAccount', () => {
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
await expect( await expect(
OVM_ECDSAContractAccount.execute(encodedTransaction) OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction))
).to.be.revertedWith('Value is nonzero but input data was provided.') ).to.be.revertedWith('Value is nonzero but input data was provided.')
}) })
...@@ -184,7 +190,7 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -184,7 +190,7 @@ describe('OVM_ECDSAContractAccount', () => {
const encodedTransaction = await wallet.signTransaction(transaction) const encodedTransaction = await wallet.signTransaction(transaction)
await expect( await expect(
OVM_ECDSAContractAccount.execute(encodedTransaction) OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction))
).to.be.revertedWith( ).to.be.revertedWith(
'Calls to self are disabled until upgradability is re-enabled.' 'Calls to self are disabled until upgradability is re-enabled.'
) )
......
import { expect } from '../../../setup' import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers, waffle } from 'hardhat'
import { ContractFactory, Contract, Signer } from 'ethers' import { ContractFactory, Contract, Signer, Wallet } from 'ethers'
import { MockContract, smockit } from '@eth-optimism/smock' import { MockContract, smockit } from '@eth-optimism/smock'
import { toPlainObject } from 'lodash' import { toPlainObject } from 'lodash'
/* Internal Imports */ /* Internal Imports */
import { getContractInterface, predeploys } from '../../../../src' import { getContractInterface, predeploys } from '../../../../src'
import { DEFAULT_EIP155_TX, LibEIP155TxStruct } from '../../../helpers'
describe('OVM_ProxyEOA', () => { describe('OVM_ProxyEOA', () => {
let signer: Signer let signer: Signer
let wallet: Wallet
before(async () => { before(async () => {
;[signer] = await ethers.getSigners() ;[signer] = await ethers.getSigners()
const provider = waffle.provider
;[wallet] = provider.getWallets()
}) })
let Mock__OVM_ExecutionManager: MockContract let Mock__OVM_ExecutionManager: MockContract
...@@ -67,9 +71,12 @@ describe('OVM_ProxyEOA', () => { ...@@ -67,9 +71,12 @@ describe('OVM_ProxyEOA', () => {
describe('fallback()', () => { describe('fallback()', () => {
it(`should call delegateCall with right calldata`, async () => { it(`should call delegateCall with right calldata`, async () => {
const transaction = { ...DEFAULT_EIP155_TX }
const encodedTransaction = await wallet.signTransaction(transaction)
const data = Mock__OVM_ECDSAContractAccount.interface.encodeFunctionData( const data = Mock__OVM_ECDSAContractAccount.interface.encodeFunctionData(
'execute', 'execute',
['0x12341234'] [LibEIP155TxStruct(encodedTransaction)]
) )
await signer.sendTransaction({ await signer.sendTransaction({
...@@ -77,11 +84,18 @@ describe('OVM_ProxyEOA', () => { ...@@ -77,11 +84,18 @@ describe('OVM_ProxyEOA', () => {
data, data,
}) })
expect( const call = toPlainObject(
toPlainObject(Mock__OVM_ECDSAContractAccount.smocked.execute.calls[0]) Mock__OVM_ECDSAContractAccount.smocked.execute.calls[0]
).to.deep.include({ )
_encodedTransaction: '0x12341234', const _transaction = call._transaction
})
expect(_transaction[0]).to.deep.equal(transaction.nonce)
expect(_transaction.nonce).to.deep.equal(transaction.nonce)
expect(_transaction.gasPrice).to.deep.equal(transaction.gasPrice)
expect(_transaction.gasLimit).to.deep.equal(transaction.gasLimit)
expect(_transaction.to).to.deep.equal(transaction.to)
expect(_transaction.data).to.deep.equal(transaction.data)
expect(_transaction.isCreate).to.deep.equal(false)
}) })
it.skip(`should return data from fallback`, async () => { it.skip(`should return data from fallback`, async () => {
......
...@@ -7,8 +7,12 @@ import { smockit, MockContract, unbind } from '@eth-optimism/smock' ...@@ -7,8 +7,12 @@ import { smockit, MockContract, unbind } from '@eth-optimism/smock'
import { toPlainObject } from 'lodash' import { toPlainObject } from 'lodash'
/* Internal Imports */ /* Internal Imports */
import { DEFAULT_EIP155_TX } from '../../../helpers' import { DEFAULT_EIP155_TX, LibEIP155TxStruct } from '../../../helpers'
import { getContractInterface, predeploys } from '../../../../src' import {
getContractInterface,
predeploys,
getContractFactory,
} from '../../../../src'
describe('OVM_SequencerEntrypoint', () => { describe('OVM_SequencerEntrypoint', () => {
const iOVM_ECDSAContractAccount = getContractInterface( const iOVM_ECDSAContractAccount = getContractInterface(
...@@ -84,11 +88,16 @@ describe('OVM_SequencerEntrypoint', () => { ...@@ -84,11 +88,16 @@ describe('OVM_SequencerEntrypoint', () => {
data: encodedTransaction, data: encodedTransaction,
}) })
expect( const call = toPlainObject(Mock__wallet.smocked.execute.calls[0])
toPlainObject(Mock__wallet.smocked.execute.calls[0]) const _transaction = call._transaction
).to.deep.include({
_encodedTransaction: encodedTransaction, expect(_transaction[0]).to.deep.equal(transaction.nonce)
}) expect(_transaction.nonce).to.deep.equal(transaction.nonce)
expect(_transaction.gasPrice).to.deep.equal(transaction.gasPrice)
expect(_transaction.gasLimit).to.deep.equal(transaction.gasLimit)
expect(_transaction.to).to.deep.equal(transaction.to)
expect(_transaction.data).to.deep.equal(transaction.data)
expect(_transaction.isCreate).to.deep.equal(false)
}) })
it('should send correct calldata if tx is a create', async () => { it('should send correct calldata if tx is a create', async () => {
...@@ -104,11 +113,16 @@ describe('OVM_SequencerEntrypoint', () => { ...@@ -104,11 +113,16 @@ describe('OVM_SequencerEntrypoint', () => {
data: encodedTransaction, data: encodedTransaction,
}) })
expect( const call = toPlainObject(Mock__wallet.smocked.execute.calls[0])
toPlainObject(Mock__wallet.smocked.execute.calls[0]) const _transaction = call._transaction
).to.deep.include({
_encodedTransaction: encodedTransaction, expect(_transaction[0]).to.deep.equal(transaction.nonce)
}) expect(_transaction.nonce).to.deep.equal(transaction.nonce)
expect(_transaction.gasPrice).to.deep.equal(transaction.gasPrice)
expect(_transaction.gasLimit).to.deep.equal(transaction.gasLimit)
expect(_transaction.to).to.deep.equal(ethers.constants.AddressZero)
expect(_transaction.data).to.deep.equal(transaction.data)
expect(_transaction.isCreate).to.deep.equal(true)
}) })
}) })
}) })
/* External Imports */ /* External Imports */
import { BigNumber } from 'ethers' import { BigNumber, constants } from 'ethers'
import { parse, Transaction } from '@ethersproject/transactions'
export interface OVMAccount { export interface OVMAccount {
nonce: number | BigNumber nonce: number | BigNumber
...@@ -8,3 +9,24 @@ export interface OVMAccount { ...@@ -8,3 +9,24 @@ export interface OVMAccount {
codeHash: string codeHash: string
ethAddress: string ethAddress: string
} }
export const LibEIP155TxStruct = (tx: Transaction | string): Array<any> => {
if (typeof tx === 'string') {
tx = parse(tx)
}
const values = [
tx.nonce,
tx.gasPrice,
tx.gasLimit,
tx.to ? tx.to : constants.AddressZero,
tx.value,
tx.data,
tx.v % 256,
tx.r,
tx.s,
tx.chainId,
tx.v === 0 ? 0 : tx.v - 2 * tx.chainId - 35,
tx.to === null,
]
return values
}
...@@ -481,6 +481,17 @@ ...@@ -481,6 +481,17 @@
"@ethersproject/logger" "^5.1.0" "@ethersproject/logger" "^5.1.0"
"@ethersproject/rlp" "^5.1.0" "@ethersproject/rlp" "^5.1.0"
"@ethersproject/address@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.3.0.tgz#e53b69eacebf332e8175de814c5e6507d6932518"
integrity sha512-29TgjzEBK+gUEUAOfWCG7s9IxLNLCqvr+oDSk6L9TXD0VLvZJKhJV479tKQqheVA81OeGxfpdxYtUVH8hqlCvA==
dependencies:
"@ethersproject/bignumber" "^5.3.0"
"@ethersproject/bytes" "^5.3.0"
"@ethersproject/keccak256" "^5.3.0"
"@ethersproject/logger" "^5.3.0"
"@ethersproject/rlp" "^5.3.0"
"@ethersproject/base64@5.1.0", "@ethersproject/base64@^5.0.0", "@ethersproject/base64@^5.1.0": "@ethersproject/base64@5.1.0", "@ethersproject/base64@^5.0.0", "@ethersproject/base64@^5.1.0":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.1.0.tgz#27240c174d0a4e13f6eae87416fd876caf7f42b6" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.1.0.tgz#27240c174d0a4e13f6eae87416fd876caf7f42b6"
...@@ -505,6 +516,15 @@ ...@@ -505,6 +516,15 @@
"@ethersproject/logger" "^5.1.0" "@ethersproject/logger" "^5.1.0"
bn.js "^4.4.0" bn.js "^4.4.0"
"@ethersproject/bignumber@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.3.0.tgz#74ab2ec9c3bda4e344920565720a6ee9c794e9db"
integrity sha512-5xguJ+Q1/zRMgHgDCaqAexx/8DwDVLRemw2i6uR8KyGjwGdXI8f32QZZ1cKGucBN6ekJvpUpHy6XAuQnTv0mPA==
dependencies:
"@ethersproject/bytes" "^5.3.0"
"@ethersproject/logger" "^5.3.0"
bn.js "^4.11.9"
"@ethersproject/bytes@5.1.0", "@ethersproject/bytes@>=5.0.0-beta.129", "@ethersproject/bytes@^5.0.0", "@ethersproject/bytes@^5.0.2", "@ethersproject/bytes@^5.1.0": "@ethersproject/bytes@5.1.0", "@ethersproject/bytes@>=5.0.0-beta.129", "@ethersproject/bytes@^5.0.0", "@ethersproject/bytes@^5.0.2", "@ethersproject/bytes@^5.1.0":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.1.0.tgz#55dfa9c4c21df1b1b538be3accb50fb76d5facfd" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.1.0.tgz#55dfa9c4c21df1b1b538be3accb50fb76d5facfd"
...@@ -512,6 +532,13 @@ ...@@ -512,6 +532,13 @@
dependencies: dependencies:
"@ethersproject/logger" "^5.1.0" "@ethersproject/logger" "^5.1.0"
"@ethersproject/bytes@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.3.0.tgz#473e0da7f831d535b2002be05e6f4ca3729a1bc9"
integrity sha512-rqLJjdVqCcn7glPer7Fxh87PRqlnRScVAoxcIP3PmOUNApMWJ6yRdOFfo2KvPAdO7Le3yEI1o0YW+Yvr7XCYvw==
dependencies:
"@ethersproject/logger" "^5.3.0"
"@ethersproject/constants@5.1.0", "@ethersproject/constants@>=5.0.0-beta.128", "@ethersproject/constants@^5.0.0", "@ethersproject/constants@^5.1.0": "@ethersproject/constants@5.1.0", "@ethersproject/constants@>=5.0.0-beta.128", "@ethersproject/constants@^5.0.0", "@ethersproject/constants@^5.1.0":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.1.0.tgz#4e7da6367ea0e9be87585d8b09f3fccf384b1452" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.1.0.tgz#4e7da6367ea0e9be87585d8b09f3fccf384b1452"
...@@ -519,6 +546,13 @@ ...@@ -519,6 +546,13 @@
dependencies: dependencies:
"@ethersproject/bignumber" "^5.1.0" "@ethersproject/bignumber" "^5.1.0"
"@ethersproject/constants@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.3.0.tgz#a5d6d86c0eec2c64c3024479609493b9afb3fc77"
integrity sha512-4y1feNOwEpgjAfiCFWOHznvv6qUF/H6uI0UKp8xdhftb+H+FbKflXg1pOgH5qs4Sr7EYBL+zPyPb+YD5g1aEyw==
dependencies:
"@ethersproject/bignumber" "^5.3.0"
"@ethersproject/contracts@5.1.0", "@ethersproject/contracts@^5.0.0", "@ethersproject/contracts@^5.0.2", "@ethersproject/contracts@^5.0.5": "@ethersproject/contracts@5.1.0", "@ethersproject/contracts@^5.0.0", "@ethersproject/contracts@^5.0.2", "@ethersproject/contracts@^5.0.5":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.1.0.tgz#f7c3451f1af77e029005733ccab3419d07d23f6b" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.1.0.tgz#f7c3451f1af77e029005733ccab3419d07d23f6b"
...@@ -606,11 +640,24 @@ ...@@ -606,11 +640,24 @@
"@ethersproject/bytes" "^5.1.0" "@ethersproject/bytes" "^5.1.0"
js-sha3 "0.5.7" js-sha3 "0.5.7"
"@ethersproject/keccak256@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.3.0.tgz#fb5cd36bdfd6fa02e2ea84964078a9fc6bd731be"
integrity sha512-Gv2YqgIUmRbYVNIibafT0qGaeGYLIA/EdWHJ7JcVxVSs2vyxafGxOJ5VpSBHWeOIsE6OOaCelYowhuuTicgdFQ==
dependencies:
"@ethersproject/bytes" "^5.3.0"
js-sha3 "0.5.7"
"@ethersproject/logger@5.1.0", "@ethersproject/logger@>=5.0.0-beta.129", "@ethersproject/logger@^5.0.0", "@ethersproject/logger@^5.1.0": "@ethersproject/logger@5.1.0", "@ethersproject/logger@>=5.0.0-beta.129", "@ethersproject/logger@^5.0.0", "@ethersproject/logger@^5.1.0":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.1.0.tgz#4cdeeefac029373349d5818f39c31b82cc6d9bbf" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.1.0.tgz#4cdeeefac029373349d5818f39c31b82cc6d9bbf"
integrity sha512-wtUaD1lBX10HBXjjKV9VHCBnTdUaKQnQ2XSET1ezglqLdPdllNOIlLfhyCRqXm5xwcjExVI5ETokOYfjPtaAlw== integrity sha512-wtUaD1lBX10HBXjjKV9VHCBnTdUaKQnQ2XSET1ezglqLdPdllNOIlLfhyCRqXm5xwcjExVI5ETokOYfjPtaAlw==
"@ethersproject/logger@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.3.0.tgz#7a69fa1d4ca0d4b7138da1627eb152f763d84dd0"
integrity sha512-8bwJ2gxJGkZZnpQSq5uSiZSJjyVTWmlGft4oH8vxHdvO1Asy4TwVepAhPgxIQIMxXZFUNMych1YjIV4oQ4I7dA==
"@ethersproject/networks@5.1.0", "@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.1.0": "@ethersproject/networks@5.1.0", "@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.1.0":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.1.0.tgz#f537290cb05aa6dc5e81e910926c04cfd5814bca" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.1.0.tgz#f537290cb05aa6dc5e81e910926c04cfd5814bca"
...@@ -633,6 +680,13 @@ ...@@ -633,6 +680,13 @@
dependencies: dependencies:
"@ethersproject/logger" "^5.1.0" "@ethersproject/logger" "^5.1.0"
"@ethersproject/properties@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.3.0.tgz#feef4c4babeb7c10a6b3449575016f4ad2c092b2"
integrity sha512-PaHxJyM5/bfusk6vr3yP//JMnm4UEojpzuWGTmtL5X4uNhNnFNvlYilZLyDr4I9cTkIbipCMsAuIcXWsmdRnEw==
dependencies:
"@ethersproject/logger" "^5.3.0"
"@ethersproject/providers@5.1.0", "@ethersproject/providers@^5.0.0", "@ethersproject/providers@^5.0.14", "@ethersproject/providers@^5.0.21", "@ethersproject/providers@^5.0.24", "@ethersproject/providers@^5.0.5": "@ethersproject/providers@5.1.0", "@ethersproject/providers@^5.0.0", "@ethersproject/providers@^5.0.14", "@ethersproject/providers@^5.0.21", "@ethersproject/providers@^5.0.24", "@ethersproject/providers@^5.0.5":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.1.0.tgz#27695a02cfafa370428cde1c7a4abab13afb6a35" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.1.0.tgz#27695a02cfafa370428cde1c7a4abab13afb6a35"
...@@ -674,6 +728,14 @@ ...@@ -674,6 +728,14 @@
"@ethersproject/bytes" "^5.1.0" "@ethersproject/bytes" "^5.1.0"
"@ethersproject/logger" "^5.1.0" "@ethersproject/logger" "^5.1.0"
"@ethersproject/rlp@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.3.0.tgz#7cb93a7b5dfa69163894153c9d4b0d936f333188"
integrity sha512-oI0joYpsRanl9guDubaW+1NbcpK0vJ3F/6Wpcanzcnqq+oaW9O5E98liwkEDPcb16BUTLIJ+ZF8GPIHYxJ/5Pw==
dependencies:
"@ethersproject/bytes" "^5.3.0"
"@ethersproject/logger" "^5.3.0"
"@ethersproject/sha2@5.1.0", "@ethersproject/sha2@^5.0.0", "@ethersproject/sha2@^5.1.0": "@ethersproject/sha2@5.1.0", "@ethersproject/sha2@^5.0.0", "@ethersproject/sha2@^5.1.0":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.1.0.tgz#6ca42d1a26884b3e32ffa943fe6494af7211506c" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.1.0.tgz#6ca42d1a26884b3e32ffa943fe6494af7211506c"
...@@ -694,6 +756,18 @@ ...@@ -694,6 +756,18 @@
bn.js "^4.4.0" bn.js "^4.4.0"
elliptic "6.5.4" elliptic "6.5.4"
"@ethersproject/signing-key@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.3.0.tgz#a96c88f8173e1abedfa35de32d3e5db7c48e5259"
integrity sha512-+DX/GwHAd0ok1bgedV1cKO0zfK7P/9aEyNoaYiRsGHpCecN7mhLqcdoUiUzE7Uz86LBsxm5ssK0qA1kBB47fbQ==
dependencies:
"@ethersproject/bytes" "^5.3.0"
"@ethersproject/logger" "^5.3.0"
"@ethersproject/properties" "^5.3.0"
bn.js "^4.11.9"
elliptic "6.5.4"
hash.js "1.1.7"
"@ethersproject/solidity@5.1.0", "@ethersproject/solidity@^5.0.0", "@ethersproject/solidity@^5.0.2": "@ethersproject/solidity@5.1.0", "@ethersproject/solidity@^5.0.0", "@ethersproject/solidity@^5.0.2":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.1.0.tgz#095a9c75244edccb26c452c155736d363399b954" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.1.0.tgz#095a9c75244edccb26c452c155736d363399b954"
...@@ -744,6 +818,21 @@ ...@@ -744,6 +818,21 @@
"@ethersproject/rlp" "^5.1.0" "@ethersproject/rlp" "^5.1.0"
"@ethersproject/signing-key" "^5.1.0" "@ethersproject/signing-key" "^5.1.0"
"@ethersproject/transactions@^5.0.31":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.3.0.tgz#49b86f2bafa4d0bdf8e596578fc795ee47c50458"
integrity sha512-cdfK8VVyW2oEBCXhURG0WQ6AICL/r6Gmjh0e4Bvbv6MCn/GBd8FeBH3rtl7ho+AW50csMKeGv3m3K1HSHB2jMQ==
dependencies:
"@ethersproject/address" "^5.3.0"
"@ethersproject/bignumber" "^5.3.0"
"@ethersproject/bytes" "^5.3.0"
"@ethersproject/constants" "^5.3.0"
"@ethersproject/keccak256" "^5.3.0"
"@ethersproject/logger" "^5.3.0"
"@ethersproject/properties" "^5.3.0"
"@ethersproject/rlp" "^5.3.0"
"@ethersproject/signing-key" "^5.3.0"
"@ethersproject/units@5.1.0", "@ethersproject/units@^5.0.0": "@ethersproject/units@5.1.0", "@ethersproject/units@^5.0.0":
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.1.0.tgz#b6ab3430ebc22adc3cb4839516496f167bee3ad5" resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.1.0.tgz#b6ab3430ebc22adc3cb4839516496f167bee3ad5"
...@@ -7269,7 +7358,7 @@ hash.js@1.1.3: ...@@ -7269,7 +7358,7 @@ hash.js@1.1.3:
inherits "^2.0.3" inherits "^2.0.3"
minimalistic-assert "^1.0.0" minimalistic-assert "^1.0.0"
hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7:
version "1.1.7" version "1.1.7"
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment