Commit 0c3b866b authored by Madhur Shrimal's avatar Madhur Shrimal Committed by GitHub

Merge branch 'ethereum-optimism:develop' into madhur/tx-metrics

parents 7c2dfa62 44eec0de
[submodule "tests"] [submodule "tests"]
path = l2geth/tests/testdata path = l2geth/tests/testdata
url = https://github.com/ethereum/tests url = https://github.com/ethereum/tests
[submodule "packages/contracts-periphery/lib/multicall"]
path = packages/contracts-periphery/lib/multicall
url = https://github.com/mds1/multicall
[submodule "lib/multicall"]
branch = v3.1.0
...@@ -9,21 +9,25 @@ import ( ...@@ -9,21 +9,25 @@ import (
"sync" "sync"
"time" "time"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/optimism/op-chain-ops/util"
"github.com/ethereum-optimism/optimism/op-bindings/bindings" "github.com/ethereum-optimism/optimism/op-bindings/bindings"
legacy_bindings "github.com/ethereum-optimism/optimism/op-bindings/legacy-bindings" legacy_bindings "github.com/ethereum-optimism/optimism/op-bindings/legacy-bindings"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum-optimism/optimism/op-chain-ops/util"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
"github.com/urfave/cli/v2"
) )
func main() { func main() {
log.Root().SetHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(isatty.IsTerminal(os.Stderr.Fd()))))
app := cli.NewApp() app := cli.NewApp()
app.Name = "rollover" app.Name = "rollover"
app.Usage = "Commands for assisting in the rollover of the system" app.Usage = "Commands for assisting in the rollover of the system"
...@@ -149,6 +153,9 @@ func main() { ...@@ -149,6 +153,9 @@ func main() {
return err return err
} }
log.Info("Remaining deposits that must be submitted", "count", finalPending) log.Info("Remaining deposits that must be submitted", "count", finalPending)
if finalPending.Cmp(common.Big0) == 0 {
log.Info("All deposits have been batch submitted")
}
return nil return nil
}, },
}, },
...@@ -183,11 +190,11 @@ func main() { ...@@ -183,11 +190,11 @@ func main() {
log.Info("Waiting for CanonicalTransactionChain") log.Info("Waiting for CanonicalTransactionChain")
wg.Add(1) wg.Add(1)
go waitForTotalElements(&wg, ctc, clients.L2Client) go waitForTotalElements(&wg, ctc, clients.L2Client, "CanonicalTransactionChain")
log.Info("Waiting for StateCommitmentChain") log.Info("Waiting for StateCommitmentChain")
wg.Add(1) wg.Add(1)
go waitForTotalElements(&wg, scc, clients.L2Client) go waitForTotalElements(&wg, scc, clients.L2Client, "StateCommitmentChain")
wg.Wait() wg.Wait()
log.Info("All batches have been submitted") log.Info("All batches have been submitted")
...@@ -210,7 +217,7 @@ type RollupContract interface { ...@@ -210,7 +217,7 @@ type RollupContract interface {
} }
// waitForTotalElements will poll to see // waitForTotalElements will poll to see
func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *ethclient.Client) { func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *ethclient.Client, name string) {
defer wg.Done() defer wg.Done()
for { for {
...@@ -228,9 +235,16 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e ...@@ -228,9 +235,16 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e
} }
if totalElements.Uint64() == bn { if totalElements.Uint64() == bn {
log.Info("Total elements matches block number", "name", name, "count", bn)
return return
} }
log.Info("Waiting for elements to be submitted", "count", totalElements.Uint64()-bn, "height", bn, "total-elements", totalElements.Uint64()) log.Info(
"Waiting for elements to be submitted",
"name", name,
"count", totalElements.Uint64()-bn,
"height", bn,
"total-elements", totalElements.Uint64(),
)
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
} }
......
...@@ -39,21 +39,21 @@ func NewClients(ctx *cli.Context) (*Clients, error) { ...@@ -39,21 +39,21 @@ func NewClients(ctx *cli.Context) (*Clients, error) {
l1RpcURL := ctx.String("l1-rpc-url") l1RpcURL := ctx.String("l1-rpc-url")
l1Client, err := ethclient.Dial(l1RpcURL) l1Client, err := ethclient.Dial(l1RpcURL)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("cannot dial L1: %w", err)
} }
l1ChainID, err := l1Client.ChainID(context.Background()) l1ChainID, err := l1Client.ChainID(context.Background())
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("cannot fetch L1 chainid: %w", err)
} }
l2RpcURL := ctx.String("l2-rpc-url") l2RpcURL := ctx.String("l2-rpc-url")
l2Client, err := ethclient.Dial(l2RpcURL) l2Client, err := ethclient.Dial(l2RpcURL)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("cannot dial L2: %w", err)
} }
l2ChainID, err := l2Client.ChainID(context.Background()) l2ChainID, err := l2Client.ChainID(context.Background())
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("cannot fetch L2 chainid: %w", err)
} }
l1RpcClient, err := rpc.DialContext(context.Background(), l1RpcURL) l1RpcClient, err := rpc.DialContext(context.Background(), l1RpcURL)
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Multicall3 } from "multicall/src/Multicall3.sol";
/**
* Just exists so we can compile this contract.
*/
contract MulticallContractCompiler {
}
...@@ -6,40 +6,54 @@ import { ...@@ -6,40 +6,54 @@ import {
ERC721BurnableUpgradeable ERC721BurnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol"; } from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
import { AttestationStation } from "./AttestationStation.sol"; import { AttestationStation } from "./AttestationStation.sol";
import { OptimistAllowlist } from "./OptimistAllowlist.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
/** /**
* @author Optimism Collective * @author Optimism Collective
* @author Gitcoin * @author Gitcoin
* @title Optimist * @title Optimist
* @notice A Soul Bound Token for real humans only(tm). * @notice A Soul Bound Token for real humans only(tm).
*/ */
contract Optimist is ERC721BurnableUpgradeable, Semver { contract Optimist is ERC721BurnableUpgradeable, Semver {
/**
* @notice Attestation key used by the attestor to attest the baseURI.
*/
bytes32 public constant BASE_URI_ATTESTATION_KEY = bytes32("optimist.base-uri");
/**
* @notice Attestor who attests to baseURI.
*/
address public immutable BASE_URI_ATTESTOR;
/** /**
* @notice Address of the AttestationStation contract. * @notice Address of the AttestationStation contract.
*/ */
AttestationStation public immutable ATTESTATION_STATION; AttestationStation public immutable ATTESTATION_STATION;
/** /**
* @notice Attestor who attests to baseURI and allowlist. * @notice Address of the OptimistAllowlist contract.
*/ */
address public immutable ATTESTOR; OptimistAllowlist public immutable OPTIMIST_ALLOWLIST;
/** /**
* @custom:semver 1.0.0 * @custom:semver 2.0.0
* @param _name Token name. * @param _name Token name.
* @param _symbol Token symbol. * @param _symbol Token symbol.
* @param _attestor Address of the attestor. * @param _baseURIAttestor Address of the baseURI attestor.
* @param _attestationStation Address of the AttestationStation contract. * @param _attestationStation Address of the AttestationStation contract.
* @param _optimistAllowlist Address of the OptimistAllowlist contract
*/ */
constructor( constructor(
string memory _name, string memory _name,
string memory _symbol, string memory _symbol,
address _attestor, address _baseURIAttestor,
AttestationStation _attestationStation AttestationStation _attestationStation,
) Semver(1, 0, 0) { OptimistAllowlist _optimistAllowlist
ATTESTOR = _attestor; ) Semver(2, 0, 0) {
BASE_URI_ATTESTOR = _baseURIAttestor;
ATTESTATION_STATION = _attestationStation; ATTESTATION_STATION = _attestationStation;
OPTIMIST_ALLOWLIST = _optimistAllowlist;
initialize(_name, _symbol); initialize(_name, _symbol);
} }
...@@ -76,7 +90,7 @@ contract Optimist is ERC721BurnableUpgradeable, Semver { ...@@ -76,7 +90,7 @@ contract Optimist is ERC721BurnableUpgradeable, Semver {
string( string(
abi.encodePacked( abi.encodePacked(
ATTESTATION_STATION.attestations( ATTESTATION_STATION.attestations(
ATTESTOR, BASE_URI_ATTESTOR,
address(this), address(this),
bytes32("optimist.base-uri") bytes32("optimist.base-uri")
) )
...@@ -105,17 +119,15 @@ contract Optimist is ERC721BurnableUpgradeable, Semver { ...@@ -105,17 +119,15 @@ contract Optimist is ERC721BurnableUpgradeable, Semver {
} }
/** /**
* @notice Checks whether a given address is allowed to mint the Optimist NFT yet. Since the * @notice Checks OptimistAllowlist to determine whether a given address is allowed to mint
* Optimist NFT will also be used as part of the Citizens House, mints are currently * the Optimist NFT. Since the Optimist NFT will also be used as part of the
* restricted. Eventually anyone will be able to mint. * Citizens House, mints are currently restricted. Eventually anyone will be able
* to mint.
* *
* @return Whether or not the address is allowed to mint yet. * @return Whether or not the address is allowed to mint yet.
*/ */
function isOnAllowList(address _recipient) public view returns (bool) { function isOnAllowList(address _recipient) public view returns (bool) {
return return OPTIMIST_ALLOWLIST.isAllowedToMint(_recipient);
ATTESTATION_STATION
.attestations(ATTESTOR, _recipient, bytes32("optimist.can-mint"))
.length > 0;
} }
/** /**
......
...@@ -16,9 +16,13 @@ remappings = [ ...@@ -16,9 +16,13 @@ remappings = [
'@rari-capital/solmate/=node_modules/@rari-capital/solmate', '@rari-capital/solmate/=node_modules/@rari-capital/solmate',
'forge-std/=node_modules/forge-std/src', 'forge-std/=node_modules/forge-std/src',
'ds-test/=node_modules/ds-test/src', 'ds-test/=node_modules/ds-test/src',
'multicall/=lib/multicall',
'@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/', '@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/',
'@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/', '@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/',
'@eth-optimism/contracts-bedrock/=../../node_modules/@eth-optimism/contracts-bedrock', '@eth-optimism/contracts-bedrock/=../../node_modules/@eth-optimism/contracts-bedrock',
] ]
# The metadata hash can be removed from the bytecode by setting "none" # The metadata hash can be removed from the bytecode by setting "none"
bytecode_hash = "none" bytecode_hash = "none"
libs = ["node_modules", "lib"]
# Required to use `deployCode` to deploy the multicall contract which has incompatible version
fs_permissions = [{ access = "read", path = "./forge-artifacts/Multicall3.sol/Multicall3.json"}]
Subproject commit a1fa0644fa412cd3237ef7081458ecb2ffad7dbe
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