aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorNick Johnson <arachnid@notdot.net>2017-01-17 19:19:50 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-01-17 19:19:50 +0800
commit17d92233d9e64b642fed9a992556f7ff7d6fda18 (patch)
treee655a85d9d31c3377aef21b441c8b2c44df0aeff /eth
parent26d385c18b5eb003d9a69ff618c78acbe594db44 (diff)
downloadgo-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.tar
go-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.tar.gz
go-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.tar.bz2
go-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.tar.lz
go-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.tar.xz
go-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.tar.zst
go-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.zip
cmd/geth, core: add support for recording SHA3 preimages (#3543)
Diffstat (limited to 'eth')
-rw-r--r--eth/api.go6
-rw-r--r--eth/backend.go6
-rw-r--r--eth/handler_test.go3
-rw-r--r--eth/helper_test.go3
4 files changed, 13 insertions, 5 deletions
diff --git a/eth/api.go b/eth/api.go
index 023e9a9bb..07df0b79e 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -560,3 +560,9 @@ func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, txHash common.
}
return nil, errors.New("database inconsistency")
}
+
+// Preimage is a debug API function that returns the preimage for a sha3 hash, if known.
+func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
+ db := core.PreimageTable(api.eth.ChainDb())
+ return db.Get(hash.Bytes())
+}
diff --git a/eth/backend.go b/eth/backend.go
index dec8c0c6e..02514c25b 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -33,6 +33,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/eth/gasprice"
@@ -97,8 +98,7 @@ type Config struct {
GpobaseStepUp int
GpobaseCorrectionFactor int
- EnableJit bool
- ForceJit bool
+ EnablePreimageRecording bool
TestGenesisBlock *types.Block // Genesis block to seed the chain database with (testing only!)
TestGenesisState ethdb.Database // Genesis state to seed the database with (testing only!)
@@ -218,7 +218,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
glog.V(logger.Info).Infoln("Chain config:", eth.chainConfig)
- eth.blockchain, err = core.NewBlockChain(chainDb, eth.chainConfig, eth.pow, eth.EventMux())
+ eth.blockchain, err = core.NewBlockChain(chainDb, eth.chainConfig, eth.pow, eth.EventMux(), vm.Config{EnablePreimageRecording: config.EnablePreimageRecording})
if err != nil {
if err == core.ErrNoGenesis {
return nil, fmt.Errorf(`No chain found. Please initialise a new chain using the "init" subcommand.`)
diff --git a/eth/handler_test.go b/eth/handler_test.go
index 22a4ddf50..8a5d7173b 100644
--- a/eth/handler_test.go
+++ b/eth/handler_test.go
@@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/ethdb"
@@ -469,7 +470,7 @@ func testDAOChallenge(t *testing.T, localForked, remoteForked bool, timeout bool
db, _ = ethdb.NewMemDatabase()
genesis = core.WriteGenesisBlockForTesting(db)
config = &params.ChainConfig{DAOForkBlock: big.NewInt(1), DAOForkSupport: localForked}
- blockchain, _ = core.NewBlockChain(db, config, pow, evmux)
+ blockchain, _ = core.NewBlockChain(db, config, pow, evmux, vm.Config{})
)
pm, err := NewProtocolManager(config, false, NetworkId, 1000, evmux, new(testTxPool), pow, blockchain, db)
if err != nil {
diff --git a/eth/helper_test.go b/eth/helper_test.go
index a718a6d21..0861c884b 100644
--- a/eth/helper_test.go
+++ b/eth/helper_test.go
@@ -30,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
@@ -56,7 +57,7 @@ func newTestProtocolManager(fastSync bool, blocks int, generator func(int, *core
db, _ = ethdb.NewMemDatabase()
genesis = core.WriteGenesisBlockForTesting(db, testBank)
chainConfig = &params.ChainConfig{HomesteadBlock: big.NewInt(0)} // homestead set to 0 because of chain maker
- blockchain, _ = core.NewBlockChain(db, chainConfig, pow, evmux)
+ blockchain, _ = core.NewBlockChain(db, chainConfig, pow, evmux, vm.Config{})
)
chain, _ := core.GenerateChain(chainConfig, genesis, db, blocks, generator)
if _, err := blockchain.InsertChain(chain); err != nil {