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

Commit

Permalink
feat: v0.3.0 release candidate (#603)
Browse files Browse the repository at this point in the history
* feat: Attempt to decode txs as RLP first (#563)

Co-authored-by: smartcontracts <smartcontracts@doge.org>

* l2geth: remove eth_sendRawEthSignTransaction endpoint (#589)

* feat[contracts]: Use standard RLP transaction format (#566)

* feat[contracts]: Use standard RLP transaction format

* fix[l2geth]: Encode transaction as RLP

* fix: Correct gas estimation in integration tests

* fix: Correct gas estimation in integration tests

* Update packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol

Co-authored-by: ben-chain <ben@pseudonym.party>

* fix[contracts]: Use isCreate instead of checking target address

* fix[contracts]: Minor optimization in SequencerEntrypoint

* fix[contracts]: Pass max gas to contract call in EOA contract

Co-authored-by: ben-chain <ben@pseudonym.party>

* feat[contracts]: Make ProxyEOA compatible with eip1967 (#592)

* feat[contracts]: Make ProxyEOA compatible with eip1967

* fix[contracts]: Fix bug introduced by indirect constant

* chore[contracts]: Add changeset

* Update .changeset/old-cycles-invite.md

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* l2geth: remove ovmsigner (#591)

* l2geth: remove ovmsigner

Also reduce the diff

Co-authored-by: smartcontracts

* l2geth: add changeset

* l2geth: set rlp encoded tx in txmeta in RPC layer (ethereum-optimism#644)

* l2geth: set rlp encoded tx in txmeta in RPC layer

* l2geth: remove extra setter of txmeta

* chore: add changeset

* feat: Have ExecutionManager pass data upwards (ethereum-optimism#643)

* feat[contracts]: Make ExecutionManager return data

* fix[l2geth]: fix linting error

* fix[contracts]: Fix build error

* fix[contracts]: fix failing unit tests

* Add changeset

Co-authored-by: Karl Floersch <karl@karlfloersch.com>

* rpc: only allow txs with no calldata when there is value (ethereum-optimism#645)

* l2geth: api checks for 0 value

* chore: add changeset

* l2geth: remove check for specific gasprice

* feat[contracts]: Add value transfer support to ECDSAContractAccount (ethereum-optimism#619)

* feat[contracts]: Use standard RLP transaction format (#566)

* feat[contracts]: Use standard RLP transaction format

* fix[l2geth]: Encode transaction as RLP

* fix: Correct gas estimation in integration tests

* fix: Correct gas estimation in integration tests

* Update packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol

Co-authored-by: ben-chain <ben@pseudonym.party>

* fix[contracts]: Use isCreate instead of checking target address

* fix[contracts]: Minor optimization in SequencerEntrypoint

* fix[contracts]: Pass max gas to contract call in EOA contract

Co-authored-by: ben-chain <ben@pseudonym.party>

* feat[contracts]: Add value transfer to contract account

* fix[contracts]: Tweak transfer logic and add tests

* fix[geth]: Remove logic that rejects value gt 0 txs

* fix: nonce issue in rpc tests

* fix: use correct wallet in rpc value tests

* Update rpc.spec.ts

* cleanup: remove double definition

* chore: add changeset

* chore: add changeset

* tests: delete dead test

* l2geth: log the tx value

* l2geth: pass through zero value at top level

* test: receipt passes

* test: more specifically set balance

Co-authored-by: ben-chain <ben@pseudonym.party>
Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com>

* dtl: remove legacy encoding (ethereum-optimism#618)

* dtl: remove legacy decoding

* tests: remove dead test

* chore: add changeset

* Add Goerli v3 deployment (ethereum-optimism#651)

* Add Goerli v3 deployment

* Add Goerli v3 to README

* dtlL fix syncing off by one (ethereum-optimism#687)

* dtl: syncing off by one error

* chore: add changeset

* dtl: index the value field (ethereum-optimism#686)

* chore: add changeset

* chore: add changeset

* dtl: pass through value field

* core-utils: update and test toRpcString

* lint: fix

* l2geth: parse value fields

* chore: add changeset

* rpc: gas fixes (ethereum-optimism#695)

* l2geth: prevent fees lower than 21000

* l2geth: remove old check for too high tx gaslimit

* tests: update to use new min gas estimated value

* chore: add changeset

* test: update expected values

* test: remove dead test

* examples: fix waffle example + gas changes in tests (ethereum-optimism#724)

* examples: fix waffle example

* tests: update gas price in assertion

* chore: add changeset

* l2geth: estimate gas assertion in decimal

* test: use configurable key

* ops: delete extra whitespace (ethereum-optimism#731)

* fix: prevent eth sendtransaction (ethereum-optimism#725)

* api: prevent unsafe calls

* api: fill in txmeta

* chore: add changeset

* chore: add changeset

* l2geth + contracts:  standard interface for systems contracts and userland contracts (ethereum-optimism#721)

* l2geth: fix call returndata parsing

* contracts: standardize simulateMessage and run to return bytes

* chore: add changeset

* chore: add changeset

* l2geth: more simple decoding

* contracts: remove named arguments

* chore: fix linter errors

* Add contract deployment to Kovan (ethereum-optimism#715)

* fix: remove type check in rollup client (ethereum-optimism#750)

* l2geth: remove tx type check in client

* chore: add changeset

* dtl: prevent null reference in L1 handler (ethereum-optimism#757)

* dtl: prevent reference of null value

* chore: add changeset

* test: eth_call exceptions (ethereum-optimism#800)

* feat[l2geth]: Pass up contract revert reasons during DoEstimateGas (ethereum-optimism#774)

* wip: Starting work on geth revert reasons during estimate gas

fix: error in comment

fix: I got things backwards

fix: Use UnpackValues instead of Unpack

Update l2geth/accounts/abi/abi.go

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* Add integration test for reverts

fix: build error

* chore: Add changeset

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* chore: add changeset (ethereum-optimism#831)

* Migrate ETH between gateways (ethereum-optimism#778)

* add migrate ETH functionality

* contracts: add eth gateway docstring (ethereum-optimism#832)

Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com>

Co-authored-by: smartcontracts <smartcontracts@doge.org>
Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com>
Co-authored-by: smartcontracts <kelvinfichter@gmail.com>
Co-authored-by: ben-chain <ben@pseudonym.party>
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
Co-authored-by: Maurelian <maurelian@protonmail.ch>
Co-authored-by: Kevin Ho <kevinjho1996@gmail.com>
  • Loading branch information
8 people committed May 10, 2021
1 parent 4c113ad commit 67c5456
Show file tree
Hide file tree
Showing 117 changed files with 16,099 additions and 1,655 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-keys-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/data-transport-layer": patch
---

Parse and index the value field in the data transport layer
5 changes: 5 additions & 0 deletions .changeset/blue-needles-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/data-transport-layer": patch
---

Account for the off by one with regards to the l2geth block number and the CTC index
5 changes: 5 additions & 0 deletions .changeset/brown-bananas-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/l2geth": patch
---

Add value parsing to the rollup client
5 changes: 5 additions & 0 deletions .changeset/chilly-grapes-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/l2geth": patch
---

Removes the extra setting of the txmeta in the syncservice and instead sets the raw tx in the txmeta at the rpc layer
5 changes: 5 additions & 0 deletions .changeset/curly-pumas-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/l2geth': patch
---

Fill in the raw transaction into the txmeta in the `eth_sendTransaction` codepath
6 changes: 6 additions & 0 deletions .changeset/early-hats-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@eth-optimism/integration-tests': patch
'@eth-optimism/l2geth': patch
---

Add support for parsed revert reasons in DoEstimateGas
6 changes: 6 additions & 0 deletions .changeset/eight-beers-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@eth-optimism/integration-tests": patch
"@eth-optimism/l2geth": patch
---

Update minimum response from estimate gas
7 changes: 7 additions & 0 deletions .changeset/fuzzy-gorillas-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@eth-optimism/integration-tests": patch
"@eth-optimism/l2geth": patch
"@eth-optimism/contracts": patch
---

Add value transfer support to ECDSAContractAccount
5 changes: 5 additions & 0 deletions .changeset/good-poets-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/l2geth': patch
---

Ignore the deprecated type field in the API
5 changes: 5 additions & 0 deletions .changeset/great-clouds-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/l2geth": patch
---

Return bytes from both ExecutionManager.run and ExecutionManager.simulateMessage and be sure to properly ABI decode the return values and the nested (bool, returndata)
5 changes: 5 additions & 0 deletions .changeset/grumpy-bananas-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/data-transport-layer": patch
---

Remove legacy transaction deserialization to support RLP batch encoding
5 changes: 5 additions & 0 deletions .changeset/kind-plants-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/l2geth': patch
---

Block access to RPCs related to signing transactions
5 changes: 5 additions & 0 deletions .changeset/light-needles-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/integration-tests': patch
---

Update expected gas prices based on minimum of 21k value
6 changes: 6 additions & 0 deletions .changeset/mean-comics-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@eth-optimism/l2geth": patch
"@eth-optimism/contracts": patch
---

Add ExecutionManager return data & RLP encoding
5 changes: 5 additions & 0 deletions .changeset/old-cycles-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/contracts": patch
---

Makes ProxyEOA compatible with EIP1967, not backwards compatible since the storage slot changes.
5 changes: 5 additions & 0 deletions .changeset/sharp-flowers-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/l2geth": patch
---

Update gas related things in the RPC to allow transactions with high gas limits and prevent gas estimations from being too small
10 changes: 10 additions & 0 deletions .changeset/six-ties-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@eth-optimism/l2geth': minor
'@eth-optimism/contracts': minor
'@eth-optimism/data-transport-layer': minor
'@eth-optimism/batch-submitter': minor
'@eth-optimism/hardhat-ovm': minor
'@eth-optimism/message-relayer': minor
---

Updates to use RLP encoded transactions in batches for the `v0.3.0` release
5 changes: 5 additions & 0 deletions .changeset/ten-keys-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/l2geth": patch
---

Remove the OVMSigner
5 changes: 5 additions & 0 deletions .changeset/thirty-radios-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/l2geth": patch
---

Prevent 0 value transactions with calldata via RPC
5 changes: 5 additions & 0 deletions .changeset/tough-lamps-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/core-utils": patch
---

Update toRpcHexString to accept ethers.BigNumber and add tests
5 changes: 5 additions & 0 deletions .changeset/violet-comics-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/data-transport-layer': patch
---

Prevent access of null value in L1 transaction deserialization
5 changes: 5 additions & 0 deletions .changeset/weak-suits-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eth-optimism/contracts": patch
---

Update ABI of simulateMessage to match run
64 changes: 31 additions & 33 deletions examples/waffle/test/erc20.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,26 @@ const { getArtifact } = require('./getArtifact')

use(solidity)

const config = {
l2Url: process.env.L2_URL || 'http://127.0.0.1:8545',
l1Url: process.env.L1_URL || 'http://127.0.0.1:9545',
useL2: process.env.TARGET === 'OVM',
privateKey: process.env.PRIVATE_KEY || '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
}

describe('ERC20 smart contract', () => {
let ERC20,
provider,
wallet,
walletTo,
walletEmpty,
walletAddress,
walletToAddress,
walletEmptyAddress

const privateKey = ethers.Wallet.createRandom().privateKey
const privateKeyEmpty = ethers.Wallet.createRandom().privateKey
const useL2 = process.env.TARGET === 'OVM'

if (useL2 == true) {
provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545')
provider

if (config.useL2) {
provider = new ethers.providers.JsonRpcProvider(config.l2Url)
provider.pollingInterval = 100
provider.getGasPrice = async () => ethers.BigNumber.from(0)
} else {
provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:9545')
provider = new ethers.providers.JsonRpcProvider(config.l1Url)
}

walletTo = new ethers.Wallet(privateKey, provider)
walletEmpty = new ethers.Wallet(privateKeyEmpty, provider)
const wallet = new ethers.Wallet(config.privateKey).connect(provider)

// parameters to use for our test coin
const COIN_NAME = 'OVM Test Coin'
Expand All @@ -41,12 +37,7 @@ describe('ERC20 smart contract', () => {

describe('when using a deployed contract instance', () => {
before(async () => {
wallet = await provider.getSigner(0)
walletAddress = await wallet.getAddress()
walletToAddress = await walletTo.getAddress()
walletEmptyAddress = await walletEmpty.getAddress()

const Artifact__ERC20 = getArtifact(useL2)
const Artifact__ERC20 = getArtifact(config.useL2)
const Factory__ERC20 = new ethers.ContractFactory(
Artifact__ERC20.abi,
Artifact__ERC20.bytecode,
Expand All @@ -64,7 +55,8 @@ describe('ERC20 smart contract', () => {
})

it('should assigns initial balance', async () => {
expect(await ERC20.balanceOf(walletAddress)).to.equal(1000)
const address = await wallet.getAddress()
expect(await ERC20.balanceOf(address)).to.equal(1000)
})

it('should correctly set vanity information', async () => {
Expand All @@ -79,29 +71,35 @@ describe('ERC20 smart contract', () => {
})

it('should transfer amount to destination account', async () => {
const tx = await ERC20.connect(wallet).transfer(walletToAddress, 7)
const freshWallet = ethers.Wallet.createRandom()
const destination = await freshWallet.getAddress()
const tx = await ERC20.connect(wallet).transfer(destination, 7)
await tx.wait()
const walletToBalance = await ERC20.balanceOf(walletToAddress)
const walletToBalance = await ERC20.balanceOf(destination)
expect(walletToBalance.toString()).to.equal('7')
})

it('should emit Transfer event', async () => {
const tx = ERC20.connect(wallet).transfer(walletToAddress, 7)
const address = await wallet.getAddress()
const tx = ERC20.connect(wallet).transfer(address, 7)
await expect(tx)
.to.emit(ERC20, 'Transfer')
.withArgs(walletAddress, walletToAddress, 7)
.withArgs(address, address, 7)
})

it('should not transfer above the amount', async () => {
const walletToBalanceBefore = await ERC20.balanceOf(walletToAddress)
await expect(ERC20.transfer(walletToAddress, 1007)).to.be.reverted
const walletToBalanceAfter = await ERC20.balanceOf(walletToAddress)
const address = await wallet.getAddress()
const walletToBalanceBefore = await ERC20.balanceOf(address)
await expect(ERC20.transfer(address, 1007)).to.be.reverted
const walletToBalanceAfter = await ERC20.balanceOf(address)
expect(walletToBalanceBefore).to.eq(walletToBalanceAfter)
})

it('should not transfer from empty account', async () => {
const ERC20FromOtherWallet = ERC20.connect(walletEmpty)
await expect(ERC20FromOtherWallet.transfer(walletEmptyAddress, 1)).to.be
const emptyWallet = ethers.Wallet.createRandom()
const address = await emptyWallet.getAddress()
const ERC20FromOtherWallet = ERC20.connect(emptyWallet)
await expect(ERC20FromOtherWallet.transfer(address, 1)).to.be
.reverted
})
})
Expand Down
10 changes: 10 additions & 0 deletions integration-tests/contracts/ConstructorReverter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import { Reverter } from './Reverter.sol';

contract ConstructorReverter is Reverter {
constructor() {
doRevert();
}
}
2 changes: 1 addition & 1 deletion integration-tests/contracts/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract ERC20 {
}

function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
require(balances[msg.sender] >= _value, "insufficient balance");
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
Expand Down
10 changes: 10 additions & 0 deletions integration-tests/contracts/Reverter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

contract Reverter {
string constant public revertMessage = "This is a simple reversion.";

function doRevert() public pure {
revert(revertMessage);
}
}
1 change: 1 addition & 0 deletions integration-tests/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { HardhatUserConfig } from 'hardhat/types'

// Hardhat plugins
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-waffle'
import '@eth-optimism/hardhat-ovm'
import 'hardhat-gas-reporter'

Expand Down
1 change: 1 addition & 0 deletions integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@eth-optimism/hardhat-ovm": "^0.1.1",
"@ethersproject/providers": "^5.0.24",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@types/chai-as-promised": "^7.1.3",
"@types/chai": "^4.2.17",
"@types/mocha": "^8.2.2",
Expand Down
11 changes: 10 additions & 1 deletion integration-tests/test/erc20.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { Contract, ContractFactory, Wallet } from 'ethers'
import { ethers } from 'hardhat'
import { expect } from 'chai'
import chai, { expect } from 'chai'
import { GWEI } from './shared/utils'
import { OptimismEnv } from './shared/env'
import { solidity } from 'ethereum-waffle'

chai.use(solidity)

describe('Basic ERC20 interactions', async () => {
const initialAmount = 1000
Expand Down Expand Up @@ -79,4 +82,10 @@ describe('Basic ERC20 interactions', async () => {
expect(receiverBalance.toNumber()).to.equal(100)
expect(senderBalance.toNumber()).to.equal(900)
})

it('should revert if trying to transfer too much', async () => {
await expect(
ERC20.transfer(other.address, initialAmount * 2)
).to.be.revertedWith('insufficient balance')
})
})
9 changes: 0 additions & 9 deletions integration-tests/test/fee-payment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,4 @@ describe('Fee Payment Integration Tests', async () => {
tx.gasPrice.mul(tx.gasLimit).add(amount)
)
})

it('sequencer rejects transaction with a non-multiple-of-1M gasPrice', async () => {
const gasPrice = BigNumber.from(1_000_000 - 1)
await expect(
env.ovmEth.transfer(other, 0, { gasPrice })
).to.be.eventually.rejectedWith(
'Gas price must be a multiple of 1,000,000 wei'
)
})
})
4 changes: 2 additions & 2 deletions integration-tests/test/native-eth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ describe('Native ETH Integration Tests', async () => {
const amount = utils.parseEther('0.5')
const addr = '0x' + '1234'.repeat(10)
const gas = await env.ovmEth.estimateGas.transfer(addr, amount)
expect(gas).to.be.deep.eq(BigNumber.from(17344))
expect(gas).to.be.deep.eq(BigNumber.from(21000))
})

it('Should estimate gas for ETH withdraw', async () => {
const amount = utils.parseEther('0.5')
const gas = await env.ovmEth.estimateGas.withdraw(amount)
expect(gas).to.be.deep.eq(BigNumber.from(14400))
expect(gas).to.be.deep.eq(BigNumber.from(21000))
})
})

Expand Down
Loading

0 comments on commit 67c5456

Please sign in to comment.