Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7a46a73
feat: Add ChugSplash config parsing via Handlebars (#739)
smartcontracts May 3, 2021
77f7253
feat[contracts]: Add storage slot parsing functions for chugsplash (#…
smartcontracts May 4, 2021
1e4b42e
feat[contracts]: ChugSplash action bundling logic (#719)
smartcontracts May 4, 2021
d5e15f8
refactor[contracts]: Turn ExecutionManagerWrapper into a predeployed …
smartcontracts May 7, 2021
7dc15c8
maintenance[contracts]: use dashes in chain container names (#819)
smartcontracts May 10, 2021
e02ff12
feat[contracts]: ChugSplash tooling to generate complete action bundl…
smartcontracts May 11, 2021
45032d2
feat[contracts]: Add L2ChugSplashDeployer contract to manage L2 deplo…
smartcontracts May 12, 2021
d2c7489
feat[contracts]: temporarily disable EOA upgrades (#857)
smartcontracts May 13, 2021
07427ae
feat[contracts]: Update Lib_AddressManager.AddressSet event to speed …
smartcontracts May 13, 2021
138063b
feat[contracts]: enable initiating L2 upgrade via L1 to L2 message (…
smartcontracts May 17, 2021
245892b
Reduce gas costs of deposits (#667)
elenadimitrova May 12, 2021
bf28648
optimism: bump gaslimit to 10 million #870 (#871)
tynes May 19, 2021
cfa757a
fix: use correct contract name in tests (#921)
smartcontracts May 19, 2021
8d477be
fix[contracts]: remove upgrade cancellation functions (#904)
smartcontracts May 19, 2021
b9c5e81
fix: disable upgradability from ECDSA Account (#885)
karlfloersch May 20, 2021
64e8d28
l2geth: remove `SignatureHashType` (#752)
tynes May 20, 2021
b496ff7
feat[contracts]: introduce OVM_GasPriceOracle (#912)
smartcontracts May 20, 2021
b3fba19
fix: configure max gas limit to 11m (#928)
gakonst May 20, 2021
466827d
feat[contracts]: add ability to pause EM during upgrades (#892)
smartcontracts May 20, 2021
bf47ff3
feat: add OVM Upgrade Functions with stub executor
ben-chain Apr 22, 2021
8ecec48
test: smocked unit tests for upgrade paths
ben-chain Apr 23, 2021
cf7feb6
feat(l2geth): support putAccountCode
ben-chain Apr 23, 2021
79f41ca
test: integration test unathenticated executor
ben-chain Apr 23, 2021
58485e1
chore: lint
ben-chain May 5, 2021
3b569ab
chore: address PR feedback
ben-chain May 6, 2021
8a14a07
chore: remove duplicate fn definition
gakonst May 20, 2021
87bf27d
replace UpgradeExecutor with ChugSplashDeployer
smartcontracts May 21, 2021
c6660ac
remove test focus
smartcontracts May 21, 2021
bce9676
lint: fix
smartcontracts May 21, 2021
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
5 changes: 5 additions & 0 deletions .changeset/chatty-walls-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': minor
---

Disables EOA contract upgrades until further notice
5 changes: 5 additions & 0 deletions .changeset/chilled-tables-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

Add L2ChugSplashDeployer contract and tests
6 changes: 6 additions & 0 deletions .changeset/eight-bobcats-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@eth-optimism/batch-submitter': patch
'@eth-optimism/contracts': patch
---

Use dashes instead of colons in contract names
6 changes: 6 additions & 0 deletions .changeset/flat-bananas-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@eth-optimism/contracts': minor
'@eth-optimism/data-transport-layer': minor
---

Update AddressSet event to speed search up a bit. Breaks AddressSet API.
5 changes: 5 additions & 0 deletions .changeset/polite-wasps-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

enables l2 upgrades to be initiated by an l1 to l2 message
5 changes: 5 additions & 0 deletions .changeset/rude-comics-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

Removed upgrade cancellation functions
5 changes: 5 additions & 0 deletions .changeset/seven-carpets-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

Introduces the congestion price oracle contract
5 changes: 5 additions & 0 deletions .changeset/sharp-roses-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

Disable upgradability from the ECDSA account instead of the EOA proxy.
5 changes: 5 additions & 0 deletions .changeset/six-seals-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/l2geth': patch
---

Removes the SignatureHashType from l2geth as it is deprecated and no longer required.
2 changes: 1 addition & 1 deletion integration-tests/contracts/SimpleStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ contract ICrossDomainMessenger {
}

contract SimpleStorage {
bytes32 public value;
address public msgSender;
address public xDomainSender;
bytes32 public value;
uint256 public totalCount;

function setValue(bytes32 newValue) public {
Expand Down
9 changes: 9 additions & 0 deletions integration-tests/contracts/code-tests/ReturnOne.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.0;

contract ReturnOne {
function get() external pure returns(uint256) {
return 1;
}
}
9 changes: 9 additions & 0 deletions integration-tests/contracts/code-tests/ReturnTwo.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.0;

contract ReturnTwo {
function get() external pure returns(uint256) {
return 2;
}
}
7 changes: 6 additions & 1 deletion integration-tests/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ const config: HardhatUserConfig = {
ovm: true,
},
},
solidity: '0.7.6',
solidity: {
version: '0.7.6',
settings: {
optimizer: { enabled: true, runs: 1 },
},
},
ovm: {
solcVersion: '0.7.6',
},
Expand Down
158 changes: 158 additions & 0 deletions integration-tests/test/ovm-self-upgrades.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { expect } from 'chai'

/* Imports: External */
import hre, { ethers } from 'hardhat'
import { Wallet, Contract, ContractFactory } from 'ethers'
import {
getContractInterface,
predeploys,
ChugSplashAction,
getChugSplashActionBundle,
isSetStorageAction,
} from '@eth-optimism/contracts'
import { getRandomAddress } from '@eth-optimism/core-utils'

/* Imports: Internal */
import { OptimismEnv } from './shared/env'
import { fundUser, l2Provider, OVM_ETH_ADDRESS } from './shared/utils'

const applyAndVerifyUpgrade = async (
L2ChugSplashDeployer: Contract,
actions: ChugSplashAction[]
) => {
const bundle = getChugSplashActionBundle(actions)

const tx1 = await L2ChugSplashDeployer.approveTransactionBundle(
bundle.root,
bundle.actions.length
)
await tx1.wait()

for (const action of bundle.actions) {
const tx2 = await L2ChugSplashDeployer.executeAction(
action.action,
action.proof
)
await tx2.wait()
}

for (const action of actions) {
if (isSetStorageAction(action)) {
expect(
await l2Provider.getStorageAt(action.target, action.key)
).to.deep.equal(action.value)
} else {
expect(await l2Provider.getCode(action.target)).to.deep.equal(action.code)
}
}
}

describe('OVM Self-Upgrades', async () => {
let l2Wallet: Wallet
before(async () => {
const env = await OptimismEnv.new()
// For simplicity, this is the default wallet that (at least for now) controls upgrades when
// running the system locally.
l2Wallet = new ethers.Wallet('0x' + 'FF'.repeat(64), l2Provider)
await fundUser(
env.watcher,
env.gateway,
hre.ethers.utils.parseEther('10'),
l2Wallet.address
)
})

let L2ChugSplashDeployer: Contract
before(async () => {
L2ChugSplashDeployer = new Contract(
predeploys.L2ChugSplashDeployer,
getContractInterface('L2ChugSplashDeployer'),
l2Wallet
)
})

describe('setStorage and setCode are correctly applied according to geth RPC', () => {
it('Should execute a basic storage upgrade', async () => {
await applyAndVerifyUpgrade(L2ChugSplashDeployer, [
{
target: OVM_ETH_ADDRESS,
key:
'0x1234123412341234123412341234123412341234123412341234123412341234',
value:
'0x6789123412341234123412341234123412341234123412341234678967896789',
},
])
})

it('Should execute a basic upgrade overwriting existing deployed code', async () => {
// Deploy a dummy contract to overwrite.
const factory = await hre.ethers.getContractFactory('SimpleStorage')
const contract = await factory.connect(l2Wallet).deploy()
await contract.deployTransaction.wait()

await applyAndVerifyUpgrade(L2ChugSplashDeployer, [
{
target: contract.address,
code:
'0x1234123412341234123412341234123412341234123412341234123412341234',
},
])
})

it('Should execute a basic code upgrade which is not overwriting an existing account', async () => {
await applyAndVerifyUpgrade(L2ChugSplashDeployer, [
{
target: getRandomAddress(),
code:
'0x1234123412341234123412341234123412341234123412341234123412341234',
},
])
})
})

describe('Contracts upgraded with setStorage and setCode behave as expected', () => {
it('code with updated storage returns the new storage', async () => {
const factory = await hre.ethers.getContractFactory('SimpleStorage')
const contract = await factory.connect(l2Wallet).deploy()
await contract.deployTransaction.wait()

expect(await contract.value()).to.eq(ethers.constants.HashZero)

const newValue = '0x' + '00'.repeat(31) + '01'

await applyAndVerifyUpgrade(L2ChugSplashDeployer, [
{
target: contract.address,
key: ethers.constants.HashZero,
value: newValue,
},
])

const valueAfter = await contract.value()
expect(valueAfter).to.eq(newValue)
})

it('code with an updated constant returns the new constant', async () => {
const factory1 = await hre.ethers.getContractFactory('ReturnOne')
const contract1 = await factory1.connect(l2Wallet).deploy()
await contract1.deployTransaction.wait()

const factory2 = await hre.ethers.getContractFactory('ReturnTwo')
const contract2 = await factory2.connect(l2Wallet).deploy()
await contract2.deployTransaction.wait()

const one = await contract1.get()
expect(one.toNumber()).to.eq(1)

await applyAndVerifyUpgrade(L2ChugSplashDeployer, [
{
target: contract1.address,
code: await l2Provider.getCode(contract2.address),
},
])

const two = await contract1.get()
expect(two.toNumber()).to.eq(2)
})
})
})
2 changes: 0 additions & 2 deletions integration-tests/test/queue-ingestion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ describe('Queue Ingestion', () => {
// The `to` addresses are defined in the previous test and
// increment sequentially.
expect(tx.to).to.be.equal('0x' + `${i}`.repeat(40))
// The transaction type is EIP155
expect(tx.txType).to.be.equal('EIP155')
// The queue origin is Layer 1
expect(tx.queueOrigin).to.be.equal('l1')
// the L1TxOrigin is equal to the Layer one from
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/test/rpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ describe('Basic RPC tests', () => {
await result.wait()

const transaction = (await provider.getTransaction(result.hash)) as any
expect(transaction.txType).to.equal('EIP155')
expect(transaction.queueOrigin).to.equal('sequencer')
expect(transaction.transactionIndex).to.be.eq(0)
expect(transaction.gasLimit).to.be.deep.eq(BigNumber.from(tx.gasLimit))
Expand All @@ -246,7 +245,6 @@ describe('Basic RPC tests', () => {
expect(block.number).to.not.equal(0)
expect(typeof block.stateRoot).to.equal('string')
expect(block.transactions.length).to.equal(1)
expect(block.transactions[0].txType).to.equal('EIP155')
expect(block.transactions[0].queueOrigin).to.equal('sequencer')
expect(block.transactions[0].l1TxOrigin).to.equal(null)
})
Expand Down
7 changes: 3 additions & 4 deletions l2geth/accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,9 @@ func (m callmsg) Gas() uint64 { return m.CallMsg.Gas }
func (m callmsg) Value() *big.Int { return m.CallMsg.Value }
func (m callmsg) Data() []byte { return m.CallMsg.Data }

func (m callmsg) L1MessageSender() *common.Address { return m.CallMsg.L1MessageSender }
func (m callmsg) L1BlockNumber() *big.Int { return m.CallMsg.L1BlockNumber }
func (m callmsg) QueueOrigin() *big.Int { return m.CallMsg.QueueOrigin }
func (m callmsg) SignatureHashType() types.SignatureHashType { return m.CallMsg.SignatureHashType }
func (m callmsg) L1MessageSender() *common.Address { return m.CallMsg.L1MessageSender }
func (m callmsg) L1BlockNumber() *big.Int { return m.CallMsg.L1BlockNumber }
func (m callmsg) QueueOrigin() *big.Int { return m.CallMsg.QueueOrigin }

// filterBackend implements filters.Backend to support filtering for logs without
// taking bloom-bits acceleration structures into account.
Expand Down
10 changes: 2 additions & 8 deletions l2geth/core/rawdb/accessors_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ func TestBlockMetaStorage(t *testing.T) {

index1 := uint64(1)
tx1 := types.NewTransaction(1, common.HexToAddress("0x1"), big.NewInt(1), 1, big.NewInt(1), nil)
tx1Meta := types.NewTransactionMeta(nil, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, &index1, nil, nil)
tx1Meta := types.NewTransactionMeta(nil, 0, nil, types.QueueOriginSequencer, &index1, nil, nil)
tx1.SetTransactionMeta(tx1Meta)

WriteTransactionMeta(db, index1, tx1.GetMeta())
Expand All @@ -442,9 +442,6 @@ func TestBlockMetaStorage(t *testing.T) {
if meta.L1BlockNumber != nil {
t.Fatalf("Could not recover L1BlockNumber")
}
if meta.SignatureHashType != types.SighashEIP155 {
t.Fatalf("Could not recover sighash type")
}
if meta.Index == nil {
t.Fatalf("Could not recover index")
}
Expand All @@ -464,7 +461,7 @@ func TestBlockMetaStorage(t *testing.T) {

index2 := uint64(2)
tx2 := types.NewTransaction(2, common.HexToAddress("0x02"), big.NewInt(2), 2, big.NewInt(2), nil)
tx2Meta := types.NewTransactionMeta(l1BlockNumber, 0, &addr, types.SighashEthSign, types.QueueOriginSequencer, nil, nil, nil)
tx2Meta := types.NewTransactionMeta(l1BlockNumber, 0, &addr, types.QueueOriginSequencer, nil, nil, nil)
tx2.SetTransactionMeta(tx2Meta)

WriteTransactionMeta(db, index2, tx2.GetMeta())
Expand All @@ -477,7 +474,4 @@ func TestBlockMetaStorage(t *testing.T) {
if meta2.L1BlockNumber.Cmp(l1BlockNumber) != 0 {
t.Fatalf("Could not recover L1BlockNumber")
}
if meta2.SignatureHashType != types.SighashEthSign {
t.Fatalf("Could not recover sighash type")
}
}
6 changes: 3 additions & 3 deletions l2geth/core/rawdb/accessors_indexes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ func TestLookupStorage(t *testing.T) {
l1BlockNumber2 := big.NewInt(2)

tx1 := types.NewTransaction(1, common.BytesToAddress([]byte{0x11}), big.NewInt(111), 1111, big.NewInt(11111), []byte{0x11, 0x11, 0x11})
tx1Meta := types.NewTransactionMeta(l1BlockNumber1, 0, &sender1, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil)
tx1Meta := types.NewTransactionMeta(l1BlockNumber1, 0, &sender1, types.QueueOriginSequencer, nil, nil, nil)
tx1.SetTransactionMeta(tx1Meta)

tx2 := types.NewTransaction(2, common.BytesToAddress([]byte{0x22}), big.NewInt(222), 2222, big.NewInt(22222), []byte{0x22, 0x22, 0x22})
tx2Meta := types.NewTransactionMeta(l1BlockNumber2, 0, &sender2, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil)
tx2Meta := types.NewTransactionMeta(l1BlockNumber2, 0, &sender2, types.QueueOriginSequencer, nil, nil, nil)
tx2.SetTransactionMeta(tx2Meta)

tx3 := types.NewTransaction(3, common.BytesToAddress([]byte{0x33}), big.NewInt(333), 3333, big.NewInt(33333), []byte{0x33, 0x33, 0x33})
tx3Meta := types.NewTransactionMeta(l1BlockNumber1, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil)
tx3Meta := types.NewTransactionMeta(l1BlockNumber1, 0, nil, types.QueueOriginSequencer, nil, nil, nil)
tx3.SetTransactionMeta(tx3Meta)

txs := []*types.Transaction{tx1, tx2, tx3}
Expand Down
1 change: 0 additions & 1 deletion l2geth/core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ type Message interface {
L1MessageSender() *common.Address
L1BlockNumber() *big.Int
QueueOrigin() *big.Int
SignatureHashType() types.SignatureHashType
}

// IntrinsicGas computes the 'intrinsic gas' for a message with the given data.
Expand Down
1 change: 0 additions & 1 deletion l2geth/core/state_transition_ovm.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func modMessage(
msg.L1MessageSender(),
msg.L1BlockNumber(),
queueOrigin,
msg.SignatureHashType(),
)

return outmsg, nil
Expand Down
Loading