Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor tests and test EXTCODECOPY Failure Behavior #25

Merged
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/core-utils/src/app/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ export const hexStrToBuf = (hexString: string): Buffer => {
return Buffer.from(remove0x(hexString), 'hex')
}

/**
* Converts a hex string to a JavaScript Number
* @param hexString the hex string to be converted
* @returns the hexString as a JavaScript Number.
*/
export const hexStrToNumber = (hexString: string): number => {
return parseInt(remove0x(hexString), 16)
}

/**
* Converts the provided buffer into a hex string.
* @param buff The buffer.
Expand Down
1 change: 1 addition & 0 deletions packages/ovm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"ethereum-waffle": "2.1.0",
"ethers": "^4.0.37",
"ethlint": "^1.2.5",
"lodash": "^4.17.15",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kiiinda am a fan of not requiring lodash because it technically doesn't have to be used & adds weight to the package. That said, I also do really enjoy programming with lodash. Maybe if we only used lodash for testing functions & added it only to devDependencies then it'd be a no brainer? Either way, this is not a strong opinion so I'm personally fine with keeping lodash usage exactly as is.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed we shouldn't add dependencies unless their benefit outweighs the cost. I was using native reduce but fromPairs made it a bit more readable. I moved it to a devDependency so we can punt on that decision for now. I also added it to a list of things we can discuss as a team while we're all in person next week! 😄 -> TypeScript/Solidity Style Guide Discussion

"mathjs": "^6.6.0",
"merkletreejs": "^0.1.7",
"openzeppelin-solidity": "^2.2.0"
Expand Down
1 change: 0 additions & 1 deletion packages/ovm/src/app/ovm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
StorageElement,
StorageSlot,
StorageValue,
Transaction,
TransactionLog,
TransactionReceipt,
TransactionResult,
Expand Down
2 changes: 1 addition & 1 deletion packages/ovm/src/app/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* External Imports */
import { getLogger, ZERO_ADDRESS } from '@eth-optimism/core-utils'
import { Contract, ethers } from 'ethers'
import { ethers } from 'ethers'
import { Log, TransactionReceipt } from 'ethers/providers'
/* Contract Imports */

Expand Down
1 change: 0 additions & 1 deletion packages/ovm/src/types/ovm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Address,
StorageSlot,
StorageValue,
Transaction,
TransactionResult,
} from '@eth-optimism/rollup-core'

Expand Down
6 changes: 2 additions & 4 deletions packages/ovm/test/app/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Contract, ethers } from 'ethers'
import { add0x, ZERO_ADDRESS, TestUtils } from '@eth-optimism/core-utils'
import { add0x, ZERO_ADDRESS } from '@eth-optimism/core-utils'
/* Contract Imports */
import { getWallets } from 'ethereum-waffle'
import { TransactionReceipt, JsonRpcProvider, Log } from 'ethers/providers'
import { TransactionReceipt } from 'ethers/providers'
import {
convertInternalLogsToOvmLogs,
getOvmTransactionMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import '../setup'
/* External Imports */
import { createMockProvider, deployContract, getWallets } from 'ethereum-waffle'
import { getLogger } from '@eth-optimism/core-utils'
import { Address } from '@eth-optimism/rollup-core'
import { utils } from 'ethers'

/* Contract Imports */
Expand Down
Loading