diff options
author | Jhih-Ming Huang <jm.huang@cobinhood.com> | 2019-03-08 20:25:54 +0800 |
---|---|---|
committer | Jhih-Ming Huang <jm.huang@cobinhood.com> | 2019-05-06 10:44:04 +0800 |
commit | 9faecc847b803e248a5b4d3d256a90b6c55fd26f (patch) | |
tree | 844e157a038037f957d33bd739eefb3405d02acf | |
parent | ba3337841485beb022d75e9182b380a192c420e2 (diff) | |
download | dexon-9faecc847b803e248a5b4d3d256a90b6c55fd26f.tar dexon-9faecc847b803e248a5b4d3d256a90b6c55fd26f.tar.gz dexon-9faecc847b803e248a5b4d3d256a90b6c55fd26f.tar.bz2 dexon-9faecc847b803e248a5b4d3d256a90b6c55fd26f.tar.lz dexon-9faecc847b803e248a5b4d3d256a90b6c55fd26f.tar.xz dexon-9faecc847b803e248a5b4d3d256a90b6c55fd26f.tar.zst dexon-9faecc847b803e248a5b4d3d256a90b6c55fd26f.zip |
remove dexon/crypto/sha3 pkg.
-rw-r--r-- | core/tx_pool.go | 6 | ||||
-rw-r--r-- | core/vm/evm/oracle_contracts.go | 4 | ||||
-rw-r--r-- | core/vm/tools/transaction.go | 5 | ||||
-rw-r--r-- | dex/app_test.go | 4 | ||||
-rw-r--r-- | eth/tracers/tracers_test.go | 2 | ||||
-rw-r--r-- | tests/state_test.go | 2 |
6 files changed, 12 insertions, 11 deletions
diff --git a/core/tx_pool.go b/core/tx_pool.go index e7dbab0d2..df11224e7 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -30,7 +30,7 @@ import ( "github.com/dexon-foundation/dexon/common/prque" "github.com/dexon-foundation/dexon/core/state" "github.com/dexon-foundation/dexon/core/types" - "github.com/dexon-foundation/dexon/core/vm" + "github.com/dexon-foundation/dexon/core/vm/evm" "github.com/dexon-foundation/dexon/event" "github.com/dexon-foundation/dexon/log" "github.com/dexon-foundation/dexon/metrics" @@ -397,7 +397,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) { } else { round -= dexCore.ConfigRoundShift } - state := &vm.GovernanceState{StateDB: statedb} + state := &evm.GovernanceState{StateDB: statedb} height := state.RoundHeight(new(big.Int).SetUint64((round))).Uint64() block := pool.chain.GetBlockByNumber(height) if block == nil { @@ -409,7 +409,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) { log.Error("Failed to get txpool state for min gas price", "err", err) panic("cannot get state for new round's min gas price") } - govState := &vm.GovernanceState{StateDB: configState} + govState := &evm.GovernanceState{StateDB: configState} pool.setGovPrice(govState.MinGasPrice()) } diff --git a/core/vm/evm/oracle_contracts.go b/core/vm/evm/oracle_contracts.go index 4a13198e2..29a1b1621 100644 --- a/core/vm/evm/oracle_contracts.go +++ b/core/vm/evm/oracle_contracts.go @@ -1736,7 +1736,7 @@ func (g *GovernanceContract) register( } caller := g.contract.Caller() - value := g.contract.Value() + value := g.contract.Value offset := g.state.NodesOffsetByAddress(caller) // Can not register if already registered. @@ -1782,7 +1782,7 @@ func (g *GovernanceContract) register( func (g *GovernanceContract) stake() ([]byte, error) { caller := g.contract.Caller() - value := g.contract.Value() + value := g.contract.Value if big.NewInt(0).Cmp(value) == 0 { return nil, errExecutionReverted diff --git a/core/vm/tools/transaction.go b/core/vm/tools/transaction.go index 1ff36a36e..4a230f443 100644 --- a/core/vm/tools/transaction.go +++ b/core/vm/tools/transaction.go @@ -8,10 +8,11 @@ import ( "math/big" "sync/atomic" + "golang.org/x/crypto/sha3" + "github.com/dexon-foundation/dexon/common" "github.com/dexon-foundation/dexon/common/hexutil" "github.com/dexon-foundation/dexon/crypto" - "github.com/dexon-foundation/dexon/crypto/sha3" "github.com/dexon-foundation/dexon/rlp" ) @@ -248,7 +249,7 @@ func (tx *Transaction) Hash() common.Hash { return v } func rlpHash(x interface{}) (h common.Hash) { - hw := sha3.NewKeccak256() + hw := sha3.NewLegacyKeccak256() rlp.Encode(hw, x) hw.Sum(h[:0]) return h diff --git a/dex/app_test.go b/dex/app_test.go index a62d9001f..e4a46b116 100644 --- a/dex/app_test.go +++ b/dex/app_test.go @@ -20,7 +20,7 @@ import ( "github.com/dexon-foundation/dexon/core" "github.com/dexon-foundation/dexon/core/rawdb" "github.com/dexon-foundation/dexon/core/types" - "github.com/dexon-foundation/dexon/core/vm" + "github.com/dexon-foundation/dexon/core/vm/evm" "github.com/dexon-foundation/dexon/crypto" "github.com/dexon-foundation/dexon/ethdb" "github.com/dexon-foundation/dexon/event" @@ -2326,7 +2326,7 @@ func newDexon(masterKey *ecdsa.PrivateKey, accountNum int) (*Dexon, []*ecdsa.Pri } config := Config{PrivateKey: masterKey} - vmConfig := vm.Config{IsBlockProposer: true} + vmConfig := evm.Config{IsBlockProposer: true} engine := dexcon.New() diff --git a/eth/tracers/tracers_test.go b/eth/tracers/tracers_test.go index 1f2f44b5a..0e41a6dd3 100644 --- a/eth/tracers/tracers_test.go +++ b/eth/tracers/tracers_test.go @@ -179,7 +179,7 @@ func TestPrestateTracerCreate2(t *testing.T) { if err != nil { t.Fatalf("failed to create call tracer: %v", err) } - evm := vm.NewEVM(context, statedb, params.MainnetChainConfig, vm.Config{Debug: true, Tracer: tracer}) + evm := evm.NewEVM(context, statedb, params.MainnetChainConfig, evm.Config{Debug: true, Tracer: tracer}) msg, err := tx.AsMessage(signer) if err != nil { diff --git a/tests/state_test.go b/tests/state_test.go index 78b2853fb..5868610cf 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -95,7 +95,7 @@ func withTrace(t *testing.T, gasLimit uint64, test func(evm.Config) error) { } buf := new(bytes.Buffer) w := bufio.NewWriter(buf) - tracer := vm.NewJSONLogger(&evm.LogConfig{DisableMemory: true}, w) + tracer := evm.NewJSONLogger(&evm.LogConfig{DisableMemory: true}, w) err2 := test(evm.Config{Debug: true, Tracer: tracer}) if !reflect.DeepEqual(err, err2) { t.Errorf("different error for second run: %v", err2) |