Skip to content

Commit

Permalink
Merge branch 'develop' into chore/libzkp-v0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak authored Jun 21, 2024
2 parents fd778e7 + f40dca0 commit 48b6780
Show file tree
Hide file tree
Showing 23 changed files with 87 additions and 1,566 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/docker-arm64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker

on:
workflow_dispatch: {}

jobs:
build-and-push-arm64-image:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- aarch64

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU
if: matrix.arch == 'aarch64'
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build docker image
uses: docker/build-push-action@v2
with:
platforms: linux/arm64
context: .
file: Dockerfile
push: true
tags: scrolltech/l2geth:${{github.ref_name}}-arm64-ubuntu
7 changes: 0 additions & 7 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/scroll-tech/go-ethereum/cmd/utils"
"github.com/scroll-tech/go-ethereum/eth/catalyst"
"github.com/scroll-tech/go-ethereum/eth/ethconfig"
"github.com/scroll-tech/go-ethereum/internal/debug"
"github.com/scroll-tech/go-ethereum/internal/ethapi"
"github.com/scroll-tech/go-ethereum/log"
"github.com/scroll-tech/go-ethereum/metrics"
Expand Down Expand Up @@ -149,7 +148,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
if ctx.GlobalIsSet(utils.EthStatsURLFlag.Name) {
cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name)
}
applyTraceConfig(ctx, &cfg.Eth)
applyMetricConfig(ctx, &cfg)

return stack, cfg
Expand Down Expand Up @@ -213,11 +211,6 @@ func dumpConfig(ctx *cli.Context) error {
return nil
}

func applyTraceConfig(ctx *cli.Context, cfg *ethconfig.Config) {
subCfg := debug.ConfigTrace(ctx)
cfg.MPTWitness = subCfg.MPTWitness
}

func applyMetricConfig(ctx *cli.Context, cfg *gethConfig) {
if ctx.GlobalIsSet(utils.MetricsEnabledFlag.Name) {
cfg.Metrics.Enabled = ctx.GlobalBool(utils.MetricsEnabledFlag.Name)
Expand Down
3 changes: 0 additions & 3 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
"github.com/scroll-tech/go-ethereum/metrics"
"github.com/scroll-tech/go-ethereum/params"
"github.com/scroll-tech/go-ethereum/trie"
"github.com/scroll-tech/go-ethereum/trie/zkproof"
)

var (
Expand Down Expand Up @@ -135,7 +134,6 @@ type CacheConfig struct {
TrieTimeLimit time.Duration // Time limit after which to flush the current in-memory trie to disk
SnapshotLimit int // Memory allowance (MB) to use for caching snapshot entries in memory
Preimages bool // Whether to store preimage of trie key to the disk
MPTWitness int // How to generate witness data for mpt circuit, 0: nothing, 1: natural

SnapshotWait bool // Wait for snapshot construction on startup. TODO(karalabe): This is a dirty hack for testing, nuke it
}
Expand All @@ -148,7 +146,6 @@ var defaultCacheConfig = &CacheConfig{
TrieTimeLimit: 5 * time.Minute,
SnapshotLimit: 256,
SnapshotWait: true,
MPTWitness: int(zkproof.MPTWitnessNothing),
}

// BlockChain represents the canonical chain given a database with a genesis
Expand Down
14 changes: 6 additions & 8 deletions core/types/l2trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type BlockTrace struct {
StorageTrace *StorageTrace `json:"storageTrace"`
TxStorageTraces []*StorageTrace `json:"txStorageTraces,omitempty"`
ExecutionResults []*ExecutionResult `json:"executionResults"`
MPTWitness *json.RawMessage `json:"mptwitness,omitempty"`
WithdrawTrieRoot common.Hash `json:"withdraw_trie_root,omitempty"`
StartL1QueueIndex uint64 `json:"startL1QueueIndex"`
}
Expand Down Expand Up @@ -131,13 +130,12 @@ type ExtraData struct {
}

type AccountWrapper struct {
Address common.Address `json:"address"`
Nonce uint64 `json:"nonce"`
Balance *hexutil.Big `json:"balance"`
KeccakCodeHash common.Hash `json:"keccakCodeHash,omitempty"`
PoseidonCodeHash common.Hash `json:"poseidonCodeHash,omitempty"`
CodeSize uint64 `json:"codeSize"`
Storage *StorageWrapper `json:"storage,omitempty"` // StorageWrapper can be empty if irrelated to storage operation
Address common.Address `json:"address"`
Nonce uint64 `json:"nonce"`
Balance *hexutil.Big `json:"balance"`
KeccakCodeHash common.Hash `json:"keccakCodeHash,omitempty"`
PoseidonCodeHash common.Hash `json:"poseidonCodeHash,omitempty"`
CodeSize uint64 `json:"codeSize"`
}

// StorageWrapper while key & value can also be retrieved from StructLogRes.Storage,
Expand Down
4 changes: 0 additions & 4 deletions core/vm/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ func (l *StructLogger) CaptureState(pc uint64, op OpCode, gas, cost uint64, scop
if !l.cfg.DisableStorage {
structLog.Storage = l.storage[contractAddress].Copy()
}

if err := traceStorage(l, scope, structLog.getOrInitExtraData()); err != nil {
log.Error("Failed to trace data", "opcode", op.String(), "err", err)
}
}
if l.cfg.EnableReturnData {
structLog.ReturnData.Write(rData)
Expand Down
27 changes: 0 additions & 27 deletions core/vm/logger_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ func traceContractCode(l *StructLogger, scope *ScopeContext, extraData *types.Ex
return nil
}

// traceStorage get contract's storage at storage_address
func traceStorage(l *StructLogger, scope *ScopeContext, extraData *types.ExtraData) error {
if scope.Stack.len() == 0 {
return nil
}
key := common.Hash(scope.Stack.peek().Bytes32())
storage := getWrappedAccountForStorage(l, scope.Contract.Address(), key)
extraData.StateList = append(extraData.StateList, storage)

return nil
}

// traceContractAccount gets the contract's account
func traceContractAccount(l *StructLogger, scope *ScopeContext, extraData *types.ExtraData) error {
// Get account state.
Expand Down Expand Up @@ -113,21 +101,6 @@ func getWrappedAccountForAddr(l *StructLogger, address common.Address) *types.Ac
}
}

func getWrappedAccountForStorage(l *StructLogger, address common.Address, key common.Hash) *types.AccountWrapper {
return &types.AccountWrapper{
Address: address,
Nonce: l.env.StateDB.GetNonce(address),
Balance: (*hexutil.Big)(l.env.StateDB.GetBalance(address)),
KeccakCodeHash: l.env.StateDB.GetKeccakCodeHash(address),
PoseidonCodeHash: l.env.StateDB.GetPoseidonCodeHash(address),
CodeSize: l.env.StateDB.GetCodeSize(address),
Storage: &types.StorageWrapper{
Key: key.String(),
Value: l.env.StateDB.GetState(address, key).String(),
},
}
}

func getCodeForAddr(l *StructLogger, address common.Address) []byte {
return l.env.StateDB.GetCode(address)
}
1 change: 0 additions & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func New(stack *node.Node, config *ethconfig.Config, l1Client sync_service.EthCl
TrieTimeLimit: config.TrieTimeout,
SnapshotLimit: config.SnapshotCache,
Preimages: config.Preimages,
MPTWitness: config.MPTWitness,
}
)
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, chainConfig, eth.engine, vmConfig, eth.shouldPreserve, &config.TxLookupLimit)
Expand Down
3 changes: 0 additions & 3 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ type Config struct {
// Arrow Glacier block override (TODO: remove after the fork)
OverrideArrowGlacier *big.Int `toml:",omitempty"`

// Trace option
MPTWitness int

// Check circuit capacity in block validator
CheckCircuitCapacity bool

Expand Down
6 changes: 0 additions & 6 deletions eth/ethconfig/gen_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions internal/debug/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ var (
Name: "trace",
Usage: "Write execution trace to the given file",
}
// mpt witness settings
mptWitnessFlag = cli.IntFlag{
Name: "trace.mptwitness",
Usage: "Output witness for mpt circuit with Specified order (default = no output, 1 = by executing order",
Value: 0,
}
)

// Flags holds all command-line flags required for debugging.
Expand All @@ -113,7 +107,6 @@ var Flags = []cli.Flag{
blockprofilerateFlag,
cpuprofileFlag,
traceFlag,
mptWitnessFlag,
}

var glogger *log.GlogHandler
Expand All @@ -127,14 +120,11 @@ func init() {
// TraceConfig export options about trace
type TraceConfig struct {
TracePath string
// Trace option
MPTWitness int
}

func ConfigTrace(ctx *cli.Context) *TraceConfig {
cfg := new(TraceConfig)
cfg.TracePath = ctx.GlobalString(traceFlag.Name)
cfg.MPTWitness = ctx.GlobalInt(mptWitnessFlag.Name)

return cfg
}
Expand Down
Loading

0 comments on commit 48b6780

Please sign in to comment.