forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract execution trace from EVM execution and provide subscription A…
…PI (ethereum#19) * Create go.yml * Merge from zkrollup and fix conflict * go mod tidy * fix worker_test test case * fix worker_test test case * Delete go.yml * add log content, enable memory trace * add tracer pool handler * Add comments and format code * add evmTrace subscribe api * Move the evmTrace struct. * Fix miner bug. * upgrade evmTrace api * fix bug about evmTracesByHash api * Fix the bug about block.timestamp and remove unnecessary copy. * Update eth/filters/api.go Co-authored-by: Haichen Shen <[email protected]> * Upgrade comments. * Delete useless code in test file * Update miner/worker.go Co-authored-by: Haichen Shen <[email protected]> * Change the return result to BlockResult. * Change return type. * Change blockResult to blockResults. * Add ReturnValue. * Update core/rawdb/l2trace.go Co-authored-by: Haichen Shen <[email protected]> * Update core/rawdb/l2trace.go Co-authored-by: Haichen Shen <[email protected]> * Update core/types/l2trace.go Co-authored-by: Haichen Shen <[email protected]> * Add indent to the comment and rm json encoding flag. * Rm json encoding flag. * Update core/rawdb/l2trace.go Co-authored-by: Haichen Shen <[email protected]> * Rm json encoding flag. * Update ethclient/ethclient.go Co-authored-by: HAOYUatHZ <[email protected]> * Update eth/filters/api.go Co-authored-by: HAOYUatHZ <[email protected]> * Use as the blockResult prefix flag. * Update eth/filters/filter_system.go Co-authored-by: Haichen Shen <[email protected]> * Update eth/filters/filter_system.go Co-authored-by: Haichen Shen <[email protected]> * Update ethclient/ethclient.go Co-authored-by: Haichen Shen <[email protected]> * Update eth/filters/api.go Co-authored-by: Haichen Shen <[email protected]> Co-authored-by: Haichen Shen <[email protected]> Co-authored-by: HAOYUatHZ <[email protected]>
- Loading branch information
1 parent
b4d6088
commit 7745fd5
Showing
21 changed files
with
770 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,4 @@ profile.cov | |
/dashboard/assets/package-lock.json | ||
|
||
**/yarn-error.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package rawdb | ||
|
||
import ( | ||
"github.com/scroll-tech/go-ethereum/common" | ||
"github.com/scroll-tech/go-ethereum/core/types" | ||
"github.com/scroll-tech/go-ethereum/ethdb" | ||
"github.com/scroll-tech/go-ethereum/log" | ||
"github.com/scroll-tech/go-ethereum/rlp" | ||
) | ||
|
||
// ReadBlockResult retrieves all data required by roller. | ||
func ReadBlockResult(db ethdb.Reader, hash common.Hash) *types.BlockResult { | ||
data, _ := db.Get(blockResultKey(hash)) | ||
if len(data) == 0 { | ||
return nil | ||
} | ||
var blockResult types.BlockResult | ||
if err := rlp.DecodeBytes(data, &blockResult); err != nil { | ||
log.Error("Failed to decode BlockResult", "err", err) | ||
return nil | ||
} | ||
return &blockResult | ||
} | ||
|
||
// WriteBlockResult stores blockResult into leveldb. | ||
func WriteBlockResult(db ethdb.KeyValueWriter, hash common.Hash, blockResult *types.BlockResult) { | ||
bytes, err := rlp.EncodeToBytes(blockResult) | ||
if err != nil { | ||
log.Crit("Failed to RLP encode BlockResult", "err", err) | ||
} | ||
db.Put(blockResultKey(hash), bytes) | ||
} | ||
|
||
// DeleteBlockResult removes blockResult with a block hash. | ||
func DeleteBlockResult(db ethdb.KeyValueWriter, hash common.Hash) { | ||
if err := db.Delete(blockResultKey(hash)); err != nil { | ||
log.Crit("Failed to delete BlockResult", "err", err) | ||
} | ||
} |
Oops, something went wrong.