Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into feat/649/cachedSafetyChecking
Browse files Browse the repository at this point in the history
Revision 1 of safety cache
  • Loading branch information
maurelian committed Mar 3, 2021
2 parents f1bd300 + 1f4d013 commit 18dfb9c
Show file tree
Hide file tree
Showing 32 changed files with 158 additions and 178 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## v0.1.10
Adds extensible ERC20Gateway and Improve CI.

- dev: Apply linting to all test files
- Test gas consumption of EM.run()
- Extensible deposit withdraw
- Update OVM_L2DepositedERC20.sol
- Commit state dumps to regenesis repo for new tags
- Update OVM_ChainStorageContainer.sol
- Update OVM_ECDSAContractAccount.sol
- Update OVM_CanonicalTransactionChain.sol
- Reset Context on invalid gaslimit
- [Fix] CI on merge
- [Fix] Run integration tests in forked context

## v0.1.9

Standardized ETH and ERC20 Gateways.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eth-optimism/contracts",
"version": "0.1.9",
"version": "0.1.10",
"main": "build/src/index.js",
"files": [
"build/**/*.js",
Expand Down
2 changes: 1 addition & 1 deletion src/contract-deployment/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* External Imports */
import { Signer, Contract, ContractFactory } from 'ethers'
import { Contract } from 'ethers'

/* Internal Imports */
import { RollupDeployConfig, makeContractDeployConfig } from './config'
Expand Down
12 changes: 6 additions & 6 deletions test/bond.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function mineBlock(provider: any, timestamp: number): Promise<void> {

describe('BondManager', () => {
const provider = waffle.provider
let wallets = provider.getWallets()
const wallets = provider.getWallets()

let bondManager: Contract
let token: Contract
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('BondManager', () => {
const timestamp = withdrawalTimestamp + ONE_WEEK
await mineBlock(deployer.provider, timestamp)

const balanceBefore = await token.balanceOf(sender)
balanceBefore = await token.balanceOf(sender)
await bondManager.finalizeWithdrawal()
const bond = await bondManager.bonds(sender)
expect(bond.state).to.eq(State.NOT_COLLATERALIZED)
Expand Down Expand Up @@ -333,12 +333,12 @@ describe('BondManager', () => {

describe('same publisher commits fraud multiple times', async () => {
let timestamp: number
let root1 =
const root1 =
'0x0000000000000000000000000000000000000000000000000000000000000000'
let ts1 = 100
let root2 =
const ts1 = 100
const root2 =
'0x0000000000000000000000000000000000000000000000000000000000000001'
let ts2 = 110
const ts2 = 110

beforeEach(async () => {
await fraudVerifier.finalize(root2, sender, ts2)
Expand Down
6 changes: 3 additions & 3 deletions test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { expect } from '../../../setup'
import { ethers, waffle } from 'hardhat'
import { ContractFactory, Contract, Wallet } from 'ethers'
import { MockContract, smockit } from '@eth-optimism/smock'
import { NON_ZERO_ADDRESS, ZERO_ADDRESS } from '../../../helpers/constants'

/* Internal Imports */
import { NON_ZERO_ADDRESS } from '../../../helpers/constants'
import {
serializeNativeTransaction,
signNativeTransaction,
DEFAULT_EIP155_TX,
serializeEthSignTransaction,
signEthSignMessage,
EIP155Transaction,
} from '../../../helpers'
import { defaultAbiCoder } from 'ethers/lib/utils'

const callPrecompile = async (
Helper_PrecompileCaller: Contract,
Expand Down
12 changes: 3 additions & 9 deletions test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@ import { expect } from '../../../setup'
import { ethers, waffle } from 'hardhat'
import { ContractFactory, Contract, Wallet } from 'ethers'
import { MockContract, smockit } from '@eth-optimism/smock'
import { NON_ZERO_ADDRESS } from '../../../helpers/constants'
import { AbiCoder, keccak256 } from 'ethers/lib/utils'
import {
DEFAULT_EIP155_TX,
remove0x,
serializeNativeTransaction,
signNativeTransaction,
} from '../../../helpers'
import { getContractInterface } from '../../../../src'

/* Internal Imports */
import { remove0x } from '../../../helpers'

const callPrecompile = async (
Helper_PrecompileCaller: Contract,
Expand Down
11 changes: 2 additions & 9 deletions test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import { expect } from '../../../../setup'

/* External Imports */
import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, BigNumber } from 'ethers'
import {
smockit,
MockContract,
smoddit,
ModifiableContract,
} from '@eth-optimism/smock'
import { Signer, ContractFactory, Contract } from 'ethers'
import { smockit, MockContract, smoddit } from '@eth-optimism/smock'

/* Internal Imports */
import { NON_ZERO_ADDRESS, ZERO_ADDRESS } from '../../../../helpers'
Expand All @@ -28,7 +23,6 @@ describe('OVM_L1ERC20Gateway', () => {
let Mock__OVM_L2DepositedERC20: MockContract
let Factory__L1ERC20: ContractFactory
let L1ERC20: Contract
const initialSupply = 1_000
before(async () => {
;[alice, bob] = await ethers.getSigners()

Expand Down Expand Up @@ -145,7 +139,6 @@ describe('OVM_L1ERC20Gateway', () => {
const INITIAL_DEPOSITER_BALANCE = 100_000
let depositer: string
const depositAmount = 1_000
let L1ERC20: Contract

beforeEach(async () => {
// Deploy the L1 ERC20 token, Alice will receive the full initialSupply
Expand Down
9 changes: 2 additions & 7 deletions test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import { expect } from '../../../../setup'

/* External Imports */
import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, BigNumber, providers } from 'ethers'
import {
smockit,
MockContract,
smoddit,
ModifiableContract,
} from '@eth-optimism/smock'
import { Signer, Contract } from 'ethers'
import { smockit, MockContract } from '@eth-optimism/smock'

/* Internal Imports */
import {
Expand Down
16 changes: 3 additions & 13 deletions test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '../../../../setup'

/* External Imports */
import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, BigNumber } from 'ethers'
import { Signer, ContractFactory, Contract } from 'ethers'
import {
smockit,
MockContract,
Expand All @@ -13,8 +13,6 @@ import {
/* Internal Imports */
import { NON_ZERO_ADDRESS, ZERO_ADDRESS } from '../../../../helpers'

const decimals = 1

const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated'
const ERR_INVALID_X_DOMAIN_MSG_SENDER =
'OVM_XCHAIN: wrong sender of cross-domain message'
Expand Down Expand Up @@ -50,11 +48,7 @@ describe('OVM_L2DepositedERC20', () => {
// Deploy the contract under test
OVM_L2DepositedERC20 = await (
await ethers.getContractFactory('OVM_L2DepositedERC20')
).deploy(
Mock__OVM_L2CrossDomainMessenger.address,
'ovmWETH',
'oWETH'
)
).deploy(Mock__OVM_L2CrossDomainMessenger.address, 'ovmWETH', 'oWETH')

// initialize the L2 Gateway with the L1G ateway addrss
await OVM_L2DepositedERC20.init(MOCK_L1GATEWAY_ADDRESS)
Expand Down Expand Up @@ -116,11 +110,7 @@ describe('OVM_L2DepositedERC20', () => {
// Deploy a smodded gateway so we can give some balances to withdraw
SmoddedL2Gateway = await (
await smoddit('OVM_L2DepositedERC20', alice)
).deploy(
Mock__OVM_L2CrossDomainMessenger.address,
'ovmWETH',
'oWETH'
)
).deploy(Mock__OVM_L2CrossDomainMessenger.address, 'ovmWETH', 'oWETH')
await SmoddedL2Gateway.init(MOCK_L1GATEWAY_ADDRESS)

// Populate the initial state with a total supply and some money in alice's balance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
makeAddressManager,
setProxyTarget,
NON_NULL_BYTES32,
ZERO_ADDRESS,
NON_ZERO_ADDRESS,
NULL_BYTES32,
DUMMY_BATCH_HEADERS,
Expand Down Expand Up @@ -232,7 +231,7 @@ describe('OVM_L1CrossDomainMessenger', () => {
true
)

const proof = {
const proof1 = {
stateRoot: NULL_BYTES32,
stateRootBatchHeader: DUMMY_BATCH_HEADERS[0],
stateRootProof: DUMMY_BATCH_PROOFS[0],
Expand All @@ -246,7 +245,7 @@ describe('OVM_L1CrossDomainMessenger', () => {
sender,
message,
0,
proof
proof1
)
).to.be.revertedWith('Provided message could not be verified.')
})
Expand All @@ -256,7 +255,7 @@ describe('OVM_L1CrossDomainMessenger', () => {
false
)

const proof = {
const proof1 = {
stateRoot: NULL_BYTES32,
stateRootBatchHeader: DUMMY_BATCH_HEADERS[0],
stateRootProof: DUMMY_BATCH_PROOFS[0],
Expand All @@ -270,7 +269,7 @@ describe('OVM_L1CrossDomainMessenger', () => {
sender,
message,
0,
proof
proof1
)
).to.be.revertedWith('Provided message could not be verified.')
})
Expand Down
12 changes: 7 additions & 5 deletions test/contracts/OVM/bridge/base/OVM_L1MultiMessageRelayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
DUMMY_BATCH_PROOFS,
toHexString,
} from '../../../../helpers'
import { sign } from 'crypto'

describe('OVM_L1MultiMessageRelayer', () => {
let signer: Signer
Expand Down Expand Up @@ -54,7 +53,7 @@ describe('OVM_L1MultiMessageRelayer', () => {
)

// define a dummy proof to satisfy the abi
let dummyProof = {
const dummyProof = {
stateRoot: NON_NULL_BYTES32,
stateRootBatchHeader: DUMMY_BATCH_HEADERS[0],
stateRootProof: DUMMY_BATCH_PROOFS[0],
Expand All @@ -63,27 +62,30 @@ describe('OVM_L1MultiMessageRelayer', () => {
}

// create a few dummy messages to relay
let m1 = {
const m1 = {
target: '0x1100000000000000000000000000000000000000',
message: NON_NULL_BYTES32,
sender: '0x2200000000000000000000000000000000000000',
messageNonce: 1,
proof: dummyProof,
}
let m2 = {

const m2 = {
target: '0x1100000000000000000000000000000000000000',
message: NON_NULL_BYTES32,
sender: '0x2200000000000000000000000000000000000000',
messageNonce: 2,
proof: dummyProof,
}
let m3 = {

const m3 = {
target: '0x1100000000000000000000000000000000000000',
message: NON_NULL_BYTES32,
sender: '0x2200000000000000000000000000000000000000',
messageNonce: 2,
proof: dummyProof,
}

messages = [m1, m2, m3]
})

Expand Down
Loading

0 comments on commit 18dfb9c

Please sign in to comment.