diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-08-30 16:19:10 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-10-04 07:13:54 +0800 |
commit | 361082ec4b942aea7c01fcb1be1782cb68b6fe3a (patch) | |
tree | d3ed9276cc61d314a6de14de1a61ea2c2d9a70b2 /core/types | |
parent | f7a71996fbbe9cea4445600ffa3c232a6cf42803 (diff) | |
download | go-tangerine-361082ec4b942aea7c01fcb1be1782cb68b6fe3a.tar go-tangerine-361082ec4b942aea7c01fcb1be1782cb68b6fe3a.tar.gz go-tangerine-361082ec4b942aea7c01fcb1be1782cb68b6fe3a.tar.bz2 go-tangerine-361082ec4b942aea7c01fcb1be1782cb68b6fe3a.tar.lz go-tangerine-361082ec4b942aea7c01fcb1be1782cb68b6fe3a.tar.xz go-tangerine-361082ec4b942aea7c01fcb1be1782cb68b6fe3a.tar.zst go-tangerine-361082ec4b942aea7c01fcb1be1782cb68b6fe3a.zip |
cmd/evm, core/vm, test: refactored VM and core
* Moved `vm.Transfer` to `core` package and changed execution to call
`env.Transfer` instead of `core.Transfer` directly.
* core/vm: byte code VM moved to jump table instead of switch
* Moved `vm.Transfer` to `core` package and changed execution to call
`env.Transfer` instead of `core.Transfer` directly.
* Byte code VM now shares the same code as the JITVM
* Renamed Context to Contract
* Changed initialiser of state transition & unexported methods
* Removed the Execution object and refactor `Call`, `CallCode` &
`Create` in to their own functions instead of being methods.
* Removed the hard dep on the state for the VM. The VM now
depends on a Database interface returned by the environment. In the
process the core now depends less on the statedb by usage of the env
* Moved `Log` from package `core/state` to package `core/vm`.
Diffstat (limited to 'core/types')
-rw-r--r-- | core/types/bloom9.go | 4 | ||||
-rw-r--r-- | core/types/common.go | 8 | ||||
-rw-r--r-- | core/types/receipt.go | 14 |
3 files changed, 13 insertions, 13 deletions
diff --git a/core/types/bloom9.go b/core/types/bloom9.go index 0629b31d4..f87ae58e6 100644 --- a/core/types/bloom9.go +++ b/core/types/bloom9.go @@ -20,7 +20,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" ) @@ -37,7 +37,7 @@ func CreateBloom(receipts Receipts) Bloom { return BytesToBloom(bin.Bytes()) } -func LogsBloom(logs state.Logs) *big.Int { +func LogsBloom(logs vm.Logs) *big.Int { bin := new(big.Int) for _, log := range logs { data := make([]common.Hash, len(log.Topics)) diff --git a/core/types/common.go b/core/types/common.go index de6efcd86..dc428c00c 100644 --- a/core/types/common.go +++ b/core/types/common.go @@ -19,14 +19,14 @@ package types import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "fmt" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" ) type BlockProcessor interface { - Process(*Block) (state.Logs, Receipts, error) + Process(*Block) (vm.Logs, Receipts, error) } const bloomLength = 256 diff --git a/core/types/receipt.go b/core/types/receipt.go index e01d69005..bcb4bd8a5 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -23,7 +23,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/rlp" ) @@ -33,7 +33,7 @@ type Receipt struct { Bloom Bloom TxHash common.Hash ContractAddress common.Address - logs state.Logs + logs vm.Logs GasUsed *big.Int } @@ -41,11 +41,11 @@ func NewReceipt(root []byte, cumalativeGasUsed *big.Int) *Receipt { return &Receipt{PostState: common.CopyBytes(root), CumulativeGasUsed: new(big.Int).Set(cumalativeGasUsed)} } -func (self *Receipt) SetLogs(logs state.Logs) { +func (self *Receipt) SetLogs(logs vm.Logs) { self.logs = logs } -func (self *Receipt) Logs() state.Logs { +func (self *Receipt) Logs() vm.Logs { return self.logs } @@ -60,7 +60,7 @@ func (self *Receipt) DecodeRLP(s *rlp.Stream) error { Bloom Bloom TxHash common.Hash ContractAddress common.Address - Logs state.Logs + Logs vm.Logs GasUsed *big.Int } if err := s.Decode(&r); err != nil { @@ -74,9 +74,9 @@ func (self *Receipt) DecodeRLP(s *rlp.Stream) error { type ReceiptForStorage Receipt func (self *ReceiptForStorage) EncodeRLP(w io.Writer) error { - storageLogs := make([]*state.LogForStorage, len(self.logs)) + storageLogs := make([]*vm.LogForStorage, len(self.logs)) for i, log := range self.logs { - storageLogs[i] = (*state.LogForStorage)(log) + storageLogs[i] = (*vm.LogForStorage)(log) } return rlp.Encode(w, []interface{}{self.PostState, self.CumulativeGasUsed, self.Bloom, self.TxHash, self.ContractAddress, storageLogs, self.GasUsed}) } |