Commit ca9dfdab authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into refcell/cannon-style-touchups

parents 3111a0fa c6afad83
......@@ -72,30 +72,28 @@ def main():
def deploy_contracts(paths):
def internal():
wait_up(8545)
wait_for_rpc_server('127.0.0.1:8545')
res = eth_accounts('127.0.0.1:8545')
wait_up(8545)
wait_for_rpc_server('127.0.0.1:8545')
res = eth_accounts('127.0.0.1:8545')
response = json.loads(res)
account = response['result'][0]
response = json.loads(res)
account = response['result'][0]
fqn = 'scripts/Deploy.s.sol:Deploy'
run_command([
'forge', 'script', fqn, '--sender', account,
'--rpc-url', 'http://127.0.0.1:8545', '--broadcast',
'--unlocked'
], env={}, cwd=paths.contracts_bedrock_dir)
fqn = 'scripts/Deploy.s.sol:Deploy'
run_command([
'forge', 'script', fqn, '--sender', account,
'--rpc-url', 'http://127.0.0.1:8545', '--broadcast',
'--unlocked'
], env={}, cwd=paths.contracts_bedrock_dir)
shutil.copy(paths.l1_deployments_path, paths.addresses_json_path)
shutil.copy(paths.l1_deployments_path, paths.addresses_json_path)
log.info('Syncing contracts.')
run_command([
'forge', 'script', fqn, '--sig', 'sync()',
'--rpc-url', 'http://127.0.0.1:8545'
], env={}, cwd=paths.contracts_bedrock_dir)
log.info('Syncing contracts.')
run_command([
'forge', 'script', fqn, '--sig', 'sync()',
'--rpc-url', 'http://127.0.0.1:8545'
], env={}, cwd=paths.contracts_bedrock_dir)
return internal
def devnet_l1_genesis(paths):
......@@ -105,7 +103,7 @@ def devnet_l1_genesis(paths):
'--verbosity', '4', '--gcmode', 'archive', '--dev.gaslimit', '30000000'
])
forge = multiprocessing.Process(target=deploy_contracts(paths))
forge = multiprocessing.Process(target=deploy_contracts, args=(paths,))
forge.start()
forge.join()
......
......@@ -91,8 +91,9 @@ type Proof struct {
StateData hexutil.Bytes `json:"state-data"`
ProofData hexutil.Bytes `json:"proof-data"`
OracleKey hexutil.Bytes `json:"oracle-key,omitempty"`
OracleValue hexutil.Bytes `json:"oracle-value,omitempty"`
OracleKey hexutil.Bytes `json:"oracle-key,omitempty"`
OracleValue hexutil.Bytes `json:"oracle-value,omitempty"`
OracleOffset uint32 `json:"oracle-offset,omitempty"`
StepInput hexutil.Bytes `json:"step-input"`
OracleInput hexutil.Bytes `json:"oracle-input"`
......@@ -304,7 +305,7 @@ func Run(ctx *cli.Context) error {
}
if snapshotAt(state) {
if err := writeJSON[*mipsevm.State](fmt.Sprintf(snapshotFmt, step), state, false); err != nil {
if err := writeJSON(fmt.Sprintf(snapshotFmt, step), state, false); err != nil {
return fmt.Errorf("failed to write state snapshot: %w", err)
}
}
......@@ -332,8 +333,9 @@ func Run(ctx *cli.Context) error {
proof.OracleInput = inp
proof.OracleKey = witness.PreimageKey[:]
proof.OracleValue = witness.PreimageValue
proof.OracleOffset = witness.PreimageOffset
}
if err := writeJSON[*Proof](fmt.Sprintf(proofFmt, step), proof, true); err != nil {
if err := writeJSON(fmt.Sprintf(proofFmt, step), proof, true); err != nil {
return fmt.Errorf("failed to write proof data: %w", err)
}
} else {
......@@ -344,7 +346,7 @@ func Run(ctx *cli.Context) error {
}
}
if err := writeJSON[*mipsevm.State](ctx.Path(RunOutputFlag.Name), state, true); err != nil {
if err := writeJSON(ctx.Path(RunOutputFlag.Name), state, true); err != nil {
return fmt.Errorf("failed to write state output: %w", err)
}
return nil
......
......@@ -21,11 +21,12 @@ const (
)
type proofData struct {
ClaimValue hexutil.Bytes `json:"post"`
StateData hexutil.Bytes `json:"state-data"`
ProofData hexutil.Bytes `json:"proof-data"`
OracleKey hexutil.Bytes `json:"oracle-key,omitempty"`
OracleValue hexutil.Bytes `json:"oracle-value,omitempty"`
ClaimValue hexutil.Bytes `json:"post"`
StateData hexutil.Bytes `json:"state-data"`
ProofData hexutil.Bytes `json:"proof-data"`
OracleKey hexutil.Bytes `json:"oracle-key,omitempty"`
OracleValue hexutil.Bytes `json:"oracle-value,omitempty"`
OracleOffset uint32 `json:"oracle-offset,omitempty"`
}
type ProofGenerator interface {
......@@ -52,7 +53,7 @@ func (p *CannonTraceProvider) GetOracleData(ctx context.Context, i uint64) (*typ
if err != nil {
return nil, err
}
data := types.NewPreimageOracleData(proof.OracleKey, proof.OracleValue)
data := types.NewPreimageOracleData(proof.OracleKey, proof.OracleValue, proof.OracleOffset)
return &data, nil
}
......
......@@ -2,6 +2,8 @@ package cannon
import (
"context"
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
......@@ -9,14 +11,15 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
)
// cannonUpdater is a [types.OracleUpdater] that exposes a method
// to update onchain cannon oracles with required data.
type cannonUpdater struct {
logger log.Logger
txMgr txmgr.TxManager
log log.Logger
txMgr txmgr.TxManager
fdgAbi abi.ABI
fdgAddr common.Address
......@@ -42,8 +45,8 @@ func NewOracleUpdater(
}
return &cannonUpdater{
logger: logger,
txMgr: txMgr,
log: logger,
txMgr: txMgr,
fdgAbi: *fdgAbi,
fdgAddr: fdgAddr,
......@@ -55,5 +58,67 @@ func NewOracleUpdater(
// UpdateOracle updates the oracle with the given data.
func (u *cannonUpdater) UpdateOracle(ctx context.Context, data types.PreimageOracleData) error {
panic("oracle updates not implemented")
if data.IsLocal {
return u.sendLocalOracleData(ctx, data)
}
return u.sendGlobalOracleData(ctx, data)
}
// sendLocalOracleData sends the local oracle data to the [txmgr].
func (u *cannonUpdater) sendLocalOracleData(ctx context.Context, data types.PreimageOracleData) error {
txData, err := u.BuildLocalOracleData(data)
if err != nil {
return fmt.Errorf("local oracle tx data build: %w", err)
}
return u.sendTxAndWait(ctx, u.fdgAddr, txData)
}
// sendGlobalOracleData sends the global oracle data to the [txmgr].
func (u *cannonUpdater) sendGlobalOracleData(ctx context.Context, data types.PreimageOracleData) error {
txData, err := u.BuildGlobalOracleData(data)
if err != nil {
return fmt.Errorf("global oracle tx data build: %w", err)
}
return u.sendTxAndWait(ctx, u.fdgAddr, txData)
}
// BuildLocalOracleData takes the local preimage key and data
// and creates tx data to load the key, data pair into the
// PreimageOracle contract from the FaultDisputeGame contract call.
func (u *cannonUpdater) BuildLocalOracleData(data types.PreimageOracleData) ([]byte, error) {
return u.fdgAbi.Pack(
"addLocalData",
data.GetIdent(),
big.NewInt(int64(data.OracleOffset)),
)
}
// BuildGlobalOracleData takes the global preimage key and data
// and creates tx data to load the key, data pair into the
// PreimageOracle contract.
func (u *cannonUpdater) BuildGlobalOracleData(data types.PreimageOracleData) ([]byte, error) {
return u.preimageOracleAbi.Pack(
"loadKeccak256PreimagePart",
big.NewInt(int64(data.OracleOffset)),
data.GetPreimageWithoutSize(),
)
}
// sendTxAndWait sends a transaction through the [txmgr] and waits for a receipt.
// This sets the tx GasLimit to 0, performing gas estimation online through the [txmgr].
func (u *cannonUpdater) sendTxAndWait(ctx context.Context, addr common.Address, txData []byte) error {
receipt, err := u.txMgr.Send(ctx, txmgr.TxCandidate{
To: &addr,
TxData: txData,
GasLimit: 0,
})
if err != nil {
return err
}
if receipt.Status == ethtypes.ReceiptStatusFailed {
u.log.Error("Responder tx successfully published but reverted", "tx_hash", receipt.TxHash)
} else {
u.log.Debug("Responder tx successfully published", "tx_hash", receipt.TxHash)
}
return nil
}
......@@ -6,6 +6,7 @@ import (
"math/big"
"testing"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
......@@ -13,6 +14,7 @@ import (
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
......@@ -25,14 +27,15 @@ var (
)
type mockTxManager struct {
from common.Address
sends int
calls int
sendFails bool
from common.Address
sends int
failedSends int
sendFails bool
}
func (m *mockTxManager) Send(ctx context.Context, candidate txmgr.TxCandidate) (*ethtypes.Receipt, error) {
if m.sendFails {
m.failedSends++
return nil, mockSendError
}
m.sends++
......@@ -44,11 +47,7 @@ func (m *mockTxManager) Send(ctx context.Context, candidate txmgr.TxCandidate) (
}
func (m *mockTxManager) Call(_ context.Context, _ ethereum.CallMsg, _ *big.Int) ([]byte, error) {
if m.sendFails {
return nil, mockSendError
}
m.calls++
return []byte{}, nil
panic("not implemented")
}
func (m *mockTxManager) BlockNumber(ctx context.Context) (uint64, error) {
......@@ -74,14 +73,68 @@ func newTestCannonUpdater(t *testing.T, sendFails bool) (*cannonUpdater, *mockTx
// UpdateOracle function.
func TestCannonUpdater_UpdateOracle(t *testing.T) {
t.Run("succeeds", func(t *testing.T) {
_, _ = newTestCannonUpdater(t, false)
// require.Nil(t, updater.UpdateOracle(context.Background(), types.PreimageOracleData{}))
// require.Equal(t, 1, mockTxMgr.calls)
updater, mockTxMgr := newTestCannonUpdater(t, false)
require.Nil(t, updater.UpdateOracle(context.Background(), types.PreimageOracleData{
OracleData: common.Hex2Bytes("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"),
}))
require.Equal(t, 1, mockTxMgr.sends)
})
t.Run("send fails", func(t *testing.T) {
_, _ = newTestCannonUpdater(t, true)
// require.Error(t, updater.UpdateOracle(context.Background(), types.PreimageOracleData{}))
// require.Equal(t, 1, mockTxMgr.calls)
updater, mockTxMgr := newTestCannonUpdater(t, true)
require.Error(t, updater.UpdateOracle(context.Background(), types.PreimageOracleData{
OracleData: common.Hex2Bytes("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"),
}))
require.Equal(t, 1, mockTxMgr.failedSends)
})
}
// TestCannonUpdater_BuildLocalOracleData tests the [cannonUpdater]
// builds a valid tx candidate for a local oracle update.
func TestCannonUpdater_BuildLocalOracleData(t *testing.T) {
updater, _ := newTestCannonUpdater(t, false)
oracleData := types.PreimageOracleData{
OracleKey: common.Hex2Bytes("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
OracleData: common.Hex2Bytes("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"),
OracleOffset: 7,
}
txData, err := updater.BuildLocalOracleData(oracleData)
require.NoError(t, err)
var addLocalDataBytes4 = crypto.Keccak256([]byte("addLocalData(uint256,uint256)"))[:4]
// Pack the tx data manually.
var expected []byte
expected = append(expected, addLocalDataBytes4...)
expected = append(expected, common.Hex2Bytes("00aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")...)
expected = append(expected, common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000007")...)
require.Equal(t, expected, txData)
}
// TestCannonUpdater_BuildGlobalOracleData tests the [cannonUpdater]
// builds a valid tx candidate for a global oracle update.
func TestCannonUpdater_BuildGlobalOracleData(t *testing.T) {
updater, _ := newTestCannonUpdater(t, false)
oracleData := types.PreimageOracleData{
OracleKey: common.Hex2Bytes("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
OracleData: common.Hex2Bytes("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"),
OracleOffset: 7,
}
txData, err := updater.BuildGlobalOracleData(oracleData)
require.NoError(t, err)
var loadKeccak256PreimagePartBytes4 = crypto.Keccak256([]byte("loadKeccak256PreimagePart(uint256,bytes)"))[:4]
// Pack the tx data manually.
var expected []byte
expected = append(expected, loadKeccak256PreimagePartBytes4...)
expected = append(expected, common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000007")...)
expected = append(expected, common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000040")...)
expected = append(expected, common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000018")...)
expected = append(expected, common.Hex2Bytes("cccccccccccccccccccccccccccccccccccccccccccccccc0000000000000000")...)
require.Equal(t, expected, txData)
}
......@@ -37,6 +37,6 @@ func (a *alphabetWithProofProvider) GetOracleData(ctx context.Context, i uint64)
if a.OracleError != nil {
return &types.PreimageOracleData{}, a.OracleError
}
data := types.NewPreimageOracleData([]byte{byte(i)}, []byte{byte(i)})
data := types.NewPreimageOracleData([]byte{byte(i)}, []byte{byte(i)}, uint32(i))
return &data, nil
}
......@@ -3,6 +3,7 @@ package types
import (
"context"
"errors"
"math/big"
"github.com/ethereum/go-ethereum/common"
)
......@@ -22,17 +23,34 @@ const (
// PreimageOracleData encapsulates the preimage oracle data
// to load into the onchain oracle.
type PreimageOracleData struct {
IsLocal bool
OracleKey []byte
OracleData []byte
IsLocal bool
OracleKey []byte
OracleData []byte
OracleOffset uint32
}
// GetType returns the type for the preimage oracle data.
func (p *PreimageOracleData) GetType() *big.Int {
return big.NewInt(int64(p.OracleKey[0]))
}
// GetIdent returns the ident for the preimage oracle data.
func (p *PreimageOracleData) GetIdent() *big.Int {
return big.NewInt(0).SetBytes(p.OracleKey[1:])
}
// GetPreimageWithoutSize returns the preimage for the preimage oracle data.
func (p *PreimageOracleData) GetPreimageWithoutSize() []byte {
return p.OracleData[8:]
}
// NewPreimageOracleData creates a new [PreimageOracleData] instance.
func NewPreimageOracleData(key []byte, data []byte) PreimageOracleData {
func NewPreimageOracleData(key []byte, data []byte, offset uint32) PreimageOracleData {
return PreimageOracleData{
IsLocal: len(key) > 0 && key[0] == byte(1),
OracleKey: key,
OracleData: data,
IsLocal: len(key) > 0 && key[0] == byte(1),
OracleKey: key,
OracleData: data,
OracleOffset: offset,
}
}
......
......@@ -8,16 +8,18 @@ import (
func TestNewPreimageOracleData(t *testing.T) {
t.Run("LocalData", func(t *testing.T) {
data := NewPreimageOracleData([]byte{1, 2, 3}, []byte{4, 5, 6})
data := NewPreimageOracleData([]byte{1, 2, 3}, []byte{4, 5, 6}, 7)
require.True(t, data.IsLocal)
require.Equal(t, []byte{1, 2, 3}, data.OracleKey)
require.Equal(t, []byte{4, 5, 6}, data.OracleData)
require.Equal(t, uint32(7), data.OracleOffset)
})
t.Run("GlobalData", func(t *testing.T) {
data := NewPreimageOracleData([]byte{0, 2, 3}, []byte{4, 5, 6})
data := NewPreimageOracleData([]byte{0, 2, 3}, []byte{4, 5, 6}, 7)
require.False(t, data.IsLocal)
require.Equal(t, []byte{0, 2, 3}, data.OracleKey)
require.Equal(t, []byte{4, 5, 6}, data.OracleData)
require.Equal(t, uint32(7), data.OracleOffset)
})
}
......@@ -109,6 +109,14 @@ contract Deploy is Deployer {
vm.stopBroadcast();
}
/// @notice Modifier that will only allow a function to be called on devnet.
modifier onlyDevnet() {
uint256 chainid = block.chainid;
if (chainid == Chains.LocalDevnet || chainid == Chains.GethDevnet) {
_;
}
}
/// @notice Deploy the AddressManager
function deployAddressManager() broadcast() public returns (address) {
AddressManager manager = new AddressManager();
......@@ -250,22 +258,19 @@ contract Deploy is Deployer {
}
/// @notice Deploy the DisputeGameFactoryProxy
function deployDisputeGameFactoryProxy() broadcast() public returns (address) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
function deployDisputeGameFactoryProxy() onlyDevnet broadcast() public returns (address) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
save("DisputeGameFactoryProxy", address(proxy));
console.log("DisputeGameFactoryProxy deployed at %s", address(proxy));
save("DisputeGameFactoryProxy", address(proxy));
console.log("DisputeGameFactoryProxy deployed at %s", address(proxy));
return address(proxy);
}
return address(0);
return address(proxy);
}
/// @notice Deploy the L1CrossDomainMessenger
......@@ -351,39 +356,30 @@ contract Deploy is Deployer {
}
/// @notice Deploy the DisputeGameFactory
function deployDisputeGameFactory() broadcast() public returns (address) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory factory = new DisputeGameFactory();
save("DisputeGameFactory", address(factory));
console.log("DisputeGameFactory deployed at %s", address(factory));
function deployDisputeGameFactory() onlyDevnet broadcast() public returns (address) {
DisputeGameFactory factory = new DisputeGameFactory();
save("DisputeGameFactory", address(factory));
console.log("DisputeGameFactory deployed at %s", address(factory));
return address(factory);
}
return address(0);
return address(factory);
}
/// @notice Deploy the PreimageOracle
function deployPreimageOracle() broadcast() public returns (address) {
if (block.chainid == 900) {
PreimageOracle preimageOracle = new PreimageOracle();
save("PreimageOracle", address(preimageOracle));
console.log("PreimageOracle deployed at %s", address(preimageOracle));
function deployPreimageOracle() onlyDevnet broadcast() public returns (address) {
PreimageOracle preimageOracle = new PreimageOracle();
save("PreimageOracle", address(preimageOracle));
console.log("PreimageOracle deployed at %s", address(preimageOracle));
return address(preimageOracle);
}
return address(0);
return address(preimageOracle);
}
/// @notice Deploy Mips
function deployMips() broadcast() public returns (address) {
if (block.chainid == 900) {
MIPS mips = new MIPS();
save("Mips", address(mips));
console.log("Mips deployed at %s", address(mips));
function deployMips() onlyDevnet broadcast() public returns (address) {
MIPS mips = new MIPS();
save("Mips", address(mips));
console.log("MIPS deployed at %s", address(mips));
return address(mips);
}
return address(0);
return address(mips);
}
/// @notice Deploy the SystemConfig
......@@ -470,24 +466,22 @@ contract Deploy is Deployer {
}
/// @notice Initialize the DisputeGameFactory
function initializeDisputeGameFactory() broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address disputeGameFactoryProxy = mustGetAddress("DisputeGameFactoryProxy");
address disputeGameFactory = mustGetAddress("DisputeGameFactory");
proxyAdmin.upgradeAndCall({
_proxy: payable(disputeGameFactoryProxy),
_implementation: disputeGameFactory,
_data: abi.encodeCall(
DisputeGameFactory.initialize,
(msg.sender)
)
});
function initializeDisputeGameFactory() onlyDevnet broadcast() public {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address disputeGameFactoryProxy = mustGetAddress("DisputeGameFactoryProxy");
address disputeGameFactory = mustGetAddress("DisputeGameFactory");
string memory version = DisputeGameFactory(disputeGameFactoryProxy).version();
console.log("DisputeGameFactory version: %s", version);
}
proxyAdmin.upgradeAndCall({
_proxy: payable(disputeGameFactoryProxy),
_implementation: disputeGameFactory,
_data: abi.encodeCall(
DisputeGameFactory.initialize,
(msg.sender)
)
});
string memory version = DisputeGameFactory(disputeGameFactoryProxy).version();
console.log("DisputeGameFactory version: %s", version);
}
/// @notice Initialize the SystemConfig
......@@ -704,34 +698,30 @@ contract Deploy is Deployer {
}
/// @notice Transfer ownership of the DisputeGameFactory contract to the final system owner
function transferDisputeGameFactoryOwnership() broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory disputeGameFactory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
address owner = disputeGameFactory.owner();
address finalSystemOwner = cfg.finalSystemOwner();
if (owner != finalSystemOwner) {
disputeGameFactory.transferOwnership(finalSystemOwner);
console.log("DisputeGameFactory ownership transferred to: %s", finalSystemOwner);
}
function transferDisputeGameFactoryOwnership() onlyDevnet broadcast() public {
DisputeGameFactory disputeGameFactory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
address owner = disputeGameFactory.owner();
address finalSystemOwner = cfg.finalSystemOwner();
if (owner != finalSystemOwner) {
disputeGameFactory.transferOwnership(finalSystemOwner);
console.log("DisputeGameFactory ownership transferred to: %s", finalSystemOwner);
}
}
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
function setFaultGameImplementation() broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
IBigStepper faultVm = IBigStepper(new AlphabetVM(absolutePrestate));
if (address(factory.gameImpls(GameTypes.FAULT)) == address(0)) {
factory.setImplementation(GameTypes.FAULT, new FaultDisputeGame({
_absolutePrestate: absolutePrestate,
_maxGameDepth: cfg.faultGameMaxDepth(),
_gameDuration: Duration.wrap(uint64(cfg.faultGameMaxDuration())),
_vm: faultVm,
_l2oo: L2OutputOracle(mustGetAddress("L2OutputOracleProxy"))
}));
console.log("DisputeGameFactory: set `FaultDisputeGame` implementation");
}
function setFaultGameImplementation() onlyDevnet broadcast() public {
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
IBigStepper faultVm = IBigStepper(new AlphabetVM(absolutePrestate));
if (address(factory.gameImpls(GameTypes.FAULT)) == address(0)) {
factory.setImplementation(GameTypes.FAULT, new FaultDisputeGame({
_absolutePrestate: absolutePrestate,
_maxGameDepth: cfg.faultGameMaxDepth(),
_gameDuration: Duration.wrap(uint64(cfg.faultGameMaxDuration())),
_vm: faultVm,
_l2oo: L2OutputOracle(mustGetAddress("L2OutputOracleProxy"))
}));
console.log("DisputeGameFactory: set `FaultDisputeGame` implementation");
}
}
}
......
......@@ -49,7 +49,7 @@ const setupProxyContract = async (
console.log(`Setting implementation to ${targetImplAddress}`)
// The signer needs to be the current admin, otherwise we don't have permission
// to update the implmentation or admin
// to update the implementation or admin
assert(
signerAddress === currentAdmin,
'the passed signer is not the admin, cannot update implementation'
......@@ -89,7 +89,7 @@ const setupProxyContract = async (
console.log(`Setting admin to ${targetProxyOwnerAddress}`)
// The signer needs to be the current admin, otherwise we don't have permission
// to update the implmentation or admin
// to update the implementation or admin
assert(
signerAddress === currentAdmin,
'proxyOwnerSigner is not the admin, cannot update admin'
......
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