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

Merge pull request #1460 from ethereum-optimism/develop

Develop -> Master PR
parents 8ce22880 16bc3e3a
---
'@eth-optimism/contracts': patch
---
Add a getter to the ERC20 bridge interfaces, to return the address of the corresponding cross domain bridge
---
'@eth-optimism/l2geth': patch
---
Add ROLLUP_ENABLE_ARBITRARY_CONTRACT_DEPLOYMENT_FLAG
......@@ -9,22 +9,15 @@
- 'packages/message-relayer/**/*'
- 'patches/**/*'
A-ci:
M-ci:
- any: ['.github/**/*']
A-contracts:
- any: ['packages/contracts/**/*']
A-geth:
M-l2geth:
- any: ['l2geth/**/*']
A-integration-tests:
M-integration:
- any: ['integration-tests/**/*']
A-ts-packages:
- any: ['packages/**/*']
all: ['!packages/contracts/**/*']
M-batch-submitter:
- any: ['packages/batch-submitter/**/*']
......
......@@ -55,7 +55,7 @@ jobs:
uses: jwalton/gh-docker-logs@v1
with:
images: 'ethereumoptimism/builder,ethereumoptimism/hardhat,ethereumoptimism/deployer,ethereumoptimism/data-transport-layer,ethereumoptimism/l2geth,ethereumoptimism/message-relayer,ethereumoptimism/batch-submitter,ethereumoptimism/l2geth,ethereumoptimism/integration-tests'
dest: '~/logs'
dest: '/home/runner/logs'
- name: Tar logs
if: failure()
......
......@@ -135,6 +135,24 @@ func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, err
}
return callStateManager(input, evm, contract)
}
// Only in the case where EnableArbitraryContractDeployment is
// set, allows codepath to be skipped when it is not set
if EnableArbitraryContractDeployment != nil {
// When the address manager is called
if contract.Address() == WhitelistAddress {
// If the first four bytes match `isDeployerAllowed(address)`
if bytes.Equal(input[0:4], isDeployerAllowedSig) {
// Already checked to make sure this value is not nil
switch *EnableArbitraryContractDeployment {
case EnableArbitraryContractDeploymentTrue:
return AbiBytesTrue, nil
case EnableArbitraryContractDeploymentFalse:
return AbiBytesFalse, nil
}
}
}
}
}
if contract.CodeAddr != nil {
......
package vm
import (
"fmt"
"os"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
// AbiBytesTrue represents the ABI encoding of "true" as a byte slice
var AbiBytesTrue = common.FromHex("0x0000000000000000000000000000000000000000000000000000000000000001")
var (
// AbiBytesTrue represents the ABI encoding of "true" as a byte slice
AbiBytesTrue = common.FromHex("0x0000000000000000000000000000000000000000000000000000000000000001")
// AbiBytesFalse represents the ABI encoding of "false" as a byte slice
var AbiBytesFalse = common.FromHex("0x0000000000000000000000000000000000000000000000000000000000000000")
// AbiBytesFalse represents the ABI encoding of "false" as a byte slice
AbiBytesFalse = common.FromHex("0x0000000000000000000000000000000000000000000000000000000000000000")
// UsingOVM is used to enable or disable functionality necessary for the OVM.
var UsingOVM bool
// UsingOVM is used to enable or disable functionality necessary for the OVM.
UsingOVM bool
// EnableArbitraryContractDeployment is used to override the
// deployer whitelist
EnableArbitraryContractDeployment *bool
// These are aliases to the pointer EnableArbitraryContractDeployment
EnableArbitraryContractDeploymentTrue bool = true
EnableArbitraryContractDeploymentFalse bool = false
WhitelistAddress = common.HexToAddress("0x4200000000000000000000000000000000000002")
isDeployerAllowedSig = crypto.Keccak256([]byte("isDeployerAllowed(address)"))[:4]
)
func init() {
UsingOVM = os.Getenv("USING_OVM") == "true"
value := os.Getenv("ROLLUP_ENABLE_ARBITRARY_CONTRACT_DEPLOYMENT")
if value != "" {
switch value {
case "true":
EnableArbitraryContractDeployment = &EnableArbitraryContractDeploymentTrue
case "false":
EnableArbitraryContractDeployment = &EnableArbitraryContractDeploymentFalse
default:
panic(fmt.Sprintf("Unknown ROLLUP_ENABLE_ARBITRARY_CONTRACT_DEPLOYMENT value: %s", value))
}
}
}
......@@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
......@@ -142,6 +143,10 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co
cfg.MinL2GasLimit = value
}
if vm.EnableArbitraryContractDeployment != nil {
log.Info("Setting arbitrary contract deployment", "value", *vm.EnableArbitraryContractDeployment)
}
service := SyncService{
ctx: ctx,
cancel: cancel,
......
......@@ -33,7 +33,7 @@ contract OVM_L1StandardBridge is iOVM_L1StandardBridge, OVM_CrossDomainEnabled {
* External Contract References *
********************************/
address public l2TokenBridge;
address public override l2TokenBridge;
// Maps L1 token to L2 token to balance of the L1 token deposited
mapping(address => mapping (address => uint256)) public deposits;
......
......@@ -33,7 +33,7 @@ contract OVM_L2StandardBridge is iOVM_L2ERC20Bridge, OVM_CrossDomainEnabled {
* External Contract References *
********************************/
address public l1TokenBridge;
address public override l1TokenBridge;
/***************
* Constructor *
......
......@@ -33,6 +33,12 @@ interface iOVM_L1ERC20Bridge {
* Public Functions *
********************/
/**
* @dev get the address of the corresponding L2 bridge contract.
* @return Address of the corresponding L2 bridge contract.
*/
function l2TokenBridge() external returns(address);
/**
* @dev deposit an amount of the ERC20 to the caller's balance on L2.
* @param _l1Token Address of the L1 ERC20 we are depositing
......
......@@ -43,6 +43,12 @@ interface iOVM_L2ERC20Bridge {
* Public Functions *
********************/
/**
* @dev get the address of the corresponding L1 bridge contract.
* @return Address of the corresponding L1 bridge contract.
*/
function l1TokenBridge() external returns(address);
/**
* @dev initiate a withdraw of some tokens to the caller's account on L1
* @param _l2Token Address of L2 token where withdrawal was initiated.
......
......@@ -25,8 +25,9 @@ import 'hardhat-gas-reporter'
dotenv.config()
const enableGasReport = !!process.env.ENABLE_GAS_REPORT
const privateKey = process.env.PRIVATE_KEY ||
"0x0000000000000000000000000000000000000000000000000000000000000000"; // this is to avoid hardhat error
const privateKey =
process.env.PRIVATE_KEY ||
'0x0000000000000000000000000000000000000000000000000000000000000000' // this is to avoid hardhat error
const config: HardhatUserConfig = {
networks: {
......
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