diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2017-05-13 03:35:45 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2017-05-18 15:05:58 +0800 |
commit | a5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5 (patch) | |
tree | 251d24c632d746ad32af6874fe115b1e86ae9b03 /core | |
parent | e6aff513dbe04b105db1ae44501c1732a7ab7af3 (diff) | |
download | dexon-a5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5.tar dexon-a5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5.tar.gz dexon-a5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5.tar.bz2 dexon-a5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5.tar.lz dexon-a5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5.tar.xz dexon-a5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5.tar.zst dexon-a5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5.zip |
consensus, core, core/vm, parems: review fixes
Diffstat (limited to 'core')
-rw-r--r-- | core/chain_makers.go | 3 | ||||
-rw-r--r-- | core/types/transaction_signing.go | 11 | ||||
-rw-r--r-- | core/vm/interpreter.go | 12 | ||||
-rw-r--r-- | core/vm/jump_table.go | 10 |
4 files changed, 13 insertions, 23 deletions
diff --git a/core/chain_makers.go b/core/chain_makers.go index 967744282..c81239607 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -209,9 +209,6 @@ func makeHeader(config *params.ChainConfig, parent *types.Block, state *state.St } else { time = new(big.Int).Add(parent.Time(), big.NewInt(10)) // block time is fixed at 10 seconds } - parentHeader := parent.Header() - // adjust the parent time - parentHeader.Time = new(big.Int).Sub(time, big.NewInt(10)) return &types.Header{ Root: state.IntermediateRoot(config.IsEIP158(parent.Number())), diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 25c08a580..b0f3275b2 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -108,17 +108,6 @@ type Signer interface { Equal(Signer) bool } -/* -// WithSignature returns a new transaction with the given signature. This signature -// needs to be in the [R || S || V] format where V is 0 or 1. -func (s EIP86Signer) WithSignature(tx *Transaction, sig []byte) (*Transaction, error) { -} - -// Hash returns the hash to be signed by the sender. -// It does not uniquely identify the transaction. -func (s EIP86Signer) Hash(tx *Transaction) common.Hash {} -*/ - // EIP155Transaction implements TransactionInterface using the // EIP155 rules type EIP155Signer struct { diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 07971f876..e54c72575 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -45,7 +45,7 @@ type Config struct { DisableGasMetering bool // Enable recording of SHA3/keccak preimages EnablePreimageRecording bool - // JumpTable contains the in instruction table. This + // JumpTable contains the EVM instruction table. This // may me left uninitialised and will be set the default // table. JumpTable [256]operation @@ -74,7 +74,7 @@ func NewInterpreter(evm *EVM, cfg Config) *Interpreter { case evm.ChainConfig().IsHomestead(evm.BlockNumber): cfg.JumpTable = homesteadInstructionSet default: - cfg.JumpTable = baseInstructionSet + cfg.JumpTable = frontierInstructionSet } } @@ -131,14 +131,14 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret } }() - log.Debug("in running contract", "hash", codehash[:]) + log.Debug("interpreter running contract", "hash", codehash[:]) tstart := time.Now() - defer log.Debug("in finished running contract", "hash", codehash[:], "elapsed", time.Since(tstart)) + defer log.Debug("interpreter finished running contract", "hash", codehash[:], "elapsed", time.Since(tstart)) // The Interpreter main run loop (contextual). This loop runs until either an // explicit STOP, RETURN or SELFDESTRUCT is executed, an error occurred during - // the execution of one of the operations or until the in.done is set by - // the parent context.Context. + // the execution of one of the operations or until the done flag is set by the + // parent context. for atomic.LoadInt32(&in.evm.abort) == 0 { // Get the memory location of pc op = contract.GetOp(pc) diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index c4a1430b2..a6d49166e 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -56,12 +56,14 @@ type operation struct { } var ( - baseInstructionSet = NewBaseInstructionSet() + frontierInstructionSet = NewFrontierInstructionSet() homesteadInstructionSet = NewHomesteadInstructionSet() ) +// NewHomesteadInstructionSet returns the frontier and homestead +// instructions that can be executed during the homestead phase. func NewHomesteadInstructionSet() [256]operation { - instructionSet := NewBaseInstructionSet() + instructionSet := NewFrontierInstructionSet() instructionSet[DELEGATECALL] = operation{ execute: opDelegateCall, gasCost: gasDelegateCall, @@ -72,7 +74,9 @@ func NewHomesteadInstructionSet() [256]operation { return instructionSet } -func NewBaseInstructionSet() [256]operation { +// NewFrontierInstructionSet returns the frontier instructions +// that can be executed during the frontier phase. +func NewFrontierInstructionSet() [256]operation { return [256]operation{ STOP: { execute: opStop, |