aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/CONTRIBUTING.md (renamed from CONTRIBUTING.md)0
-rw-r--r--.github/ISSUE_TEMPLATE.md20
-rw-r--r--cmd/utils/cmd.go3
-rw-r--r--core/block_validator.go6
-rw-r--r--core/blockchain.go2
-rw-r--r--core/blockchain_test.go16
-rw-r--r--core/chain_makers.go4
-rw-r--r--core/state/managed_state.go2
-rw-r--r--core/state/state_test.go2
-rw-r--r--core/state_processor.go2
-rw-r--r--core/tx_pool.go6
-rw-r--r--core/tx_pool_test.go4
-rw-r--r--core/types.go2
-rw-r--r--core/types/block.go2
-rw-r--r--core/types/transaction.go4
-rw-r--r--core/vm/asm.go2
-rw-r--r--core/vm/doc.go2
-rw-r--r--core/vm/environment.go6
-rw-r--r--core/vm/jit.go6
-rw-r--r--core/vm/jit_test.go2
-rw-r--r--core/vm/jit_util.go2
-rw-r--r--core/vm/runtime/runtime.go2
-rw-r--r--core/vm/vm.go8
-rw-r--r--core/vm/vm_jit.go6
-rw-r--r--core/vm_env.go2
-rw-r--r--eth/api.go20
-rw-r--r--eth/downloader/api.go2
-rw-r--r--eth/downloader/downloader.go14
-rw-r--r--eth/downloader/downloader_test.go6
-rw-r--r--eth/downloader/queue.go2
-rw-r--r--eth/fetcher/fetcher.go6
-rw-r--r--eth/filters/api.go2
-rw-r--r--eth/filters/filter_system_test.go2
-rw-r--r--eth/handler.go2
-rw-r--r--eth/handler_test.go4
-rw-r--r--eth/metrics.go2
-rw-r--r--internal/debug/flags.go1
-rw-r--r--internal/debug/loudpanic.go27
-rw-r--r--internal/debug/loudpanic_fallback.go24
39 files changed, 150 insertions, 77 deletions
diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 829bf5d43..829bf5d43 100644
--- a/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 000000000..6c1cb9f9a
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,20 @@
+#### System information
+
+Geth version: `geth version`
+OS & Version: Windows/Linux/OSX
+Commit hash : (if `develop`)
+
+#### Expected behaviour
+
+
+#### Actual behaviour
+
+
+#### Steps to reproduce the behaviour
+
+
+#### Backtrace
+
+````
+[backtrace]
+````
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index a0d60a583..7d299026b 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -29,6 +29,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/internal/debug"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/node"
@@ -130,7 +131,7 @@ func StartNode(stack *node.Node) {
}
}
glog.V(logger.Error).Infof("Force quitting: this might not end so well.")
- panic("boom")
+ debug.LoudPanic("boom")
}()
}
diff --git a/core/block_validator.go b/core/block_validator.go
index 73c33d8dd..4d710ae3f 100644
--- a/core/block_validator.go
+++ b/core/block_validator.go
@@ -58,7 +58,7 @@ func NewBlockValidator(blockchain *BlockChain, pow pow.PoW) *BlockValidator {
// the block header's transaction and uncle roots.
//
// ValidateBlock does not validate the header's pow. The pow work validated
-// seperately so we can process them in paralel.
+// separately so we can process them in parallel.
//
// ValidateBlock also validates and makes sure that any previous state (or present)
// state that might or might not be present is checked to make sure that fast
@@ -106,7 +106,7 @@ func (v *BlockValidator) ValidateBlock(block *types.Block) error {
// ValidateState validates the various changes that happen after a state
// transition, such as amount of used gas, the receipt roots and the state root
-// itself. ValidateState returns a database batch if the validation was a succes
+// itself. ValidateState returns a database batch if the validation was a success
// otherwise nil and an error is returned.
func (v *BlockValidator) ValidateState(block, parent *types.Block, statedb *state.StateDB, receipts types.Receipts, usedGas *big.Int) (err error) {
header := block.Header()
@@ -297,7 +297,7 @@ func calcDifficultyHomestead(time, parentTime uint64, parentNumber, parentDiff *
periodCount := new(big.Int).Add(parentNumber, common.Big1)
periodCount.Div(periodCount, ExpDiffPeriod)
- // the exponential factor, commonly refered to as "the bomb"
+ // the exponential factor, commonly referred to as "the bomb"
// diff = diff + 2^(periodCount - 2)
if periodCount.Cmp(common.Big1) > 0 {
y.Sub(periodCount, common.Big2)
diff --git a/core/blockchain.go b/core/blockchain.go
index be04b2c67..534318ecd 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -775,7 +775,7 @@ func (self *BlockChain) WriteBlock(block *types.Block) (status WriteStatus, err
// Second clause in the if statement reduces the vulnerability to selfish mining.
// Please refer to http://www.cs.cornell.edu/~ie53/publications/btcProcFC.pdf
if externTd.Cmp(localTd) > 0 || (externTd.Cmp(localTd) == 0 && mrand.Float64() < 0.5) {
- // Reorganize the chain if the parent is not the head block
+ // Reorganise the chain if the parent is not the head block
if block.ParentHash() != self.currentBlock.Hash() {
if err := self.reorg(self.currentBlock, block); err != nil {
return NonStatTy, err
diff --git a/core/blockchain_test.go b/core/blockchain_test.go
index 310751cca..df979578e 100644
--- a/core/blockchain_test.go
+++ b/core/blockchain_test.go
@@ -168,7 +168,7 @@ func testHeaderChainImport(chain []*types.Header, blockchain *BlockChain) error
if err := blockchain.Validator().ValidateHeader(header, blockchain.GetHeader(header.ParentHash), false); err != nil {
return err
}
- // Manually insert the header into the database, but don't reorganize (allows subsequent testing)
+ // Manually insert the header into the database, but don't reorganise (allows subsequent testing)
blockchain.mu.Lock()
WriteTd(blockchain.chainDb, header.Hash(), new(big.Int).Add(header.Difficulty, blockchain.GetTd(header.ParentHash)))
WriteHeader(blockchain.chainDb, header)
@@ -491,7 +491,7 @@ func chm(genesis *types.Block, db ethdb.Database) *BlockChain {
return bc
}
-// Tests that reorganizing a long difficult chain after a short easy one
+// Tests that reorganising a long difficult chain after a short easy one
// overwrites the canonical numbers and links in the database.
func TestReorgLongHeaders(t *testing.T) { testReorgLong(t, false) }
func TestReorgLongBlocks(t *testing.T) { testReorgLong(t, true) }
@@ -500,7 +500,7 @@ func testReorgLong(t *testing.T, full bool) {
testReorg(t, []int{1, 2, 4}, []int{1, 2, 3, 4}, 10, full)
}
-// Tests that reorganizing a short difficult chain after a long easy one
+// Tests that reorganising a short difficult chain after a long easy one
// overwrites the canonical numbers and links in the database.
func TestReorgShortHeaders(t *testing.T) { testReorgShort(t, false) }
func TestReorgShortBlocks(t *testing.T) { testReorgShort(t, true) }
@@ -578,7 +578,7 @@ func testBadHashes(t *testing.T, full bool) {
}
}
-// Tests that bad hashes are detected on boot, and the chan rolled back to a
+// Tests that bad hashes are detected on boot, and the chain rolled back to a
// good state prior to the bad hash.
func TestReorgBadHeaderHashes(t *testing.T) { testReorgBadHashes(t, false) }
func TestReorgBadBlockHashes(t *testing.T) { testReorgBadHashes(t, true) }
@@ -589,7 +589,7 @@ func testReorgBadHashes(t *testing.T, full bool) {
genesis, _ := WriteTestNetGenesisBlock(db)
bc := chm(genesis, db)
- // Create a chain, import and ban aferwards
+ // Create a chain, import and ban afterwards
headers := makeHeaderChainWithDiff(genesis, []int{1, 2, 3, 4}, 10)
blocks := makeBlockChainWithDiff(genesis, []int{1, 2, 3, 4}, 10)
@@ -858,7 +858,7 @@ func TestLightVsFastVsFullChainHeads(t *testing.T) {
assert(t, "light", light, height/2, 0, 0)
}
-// Tests that chain reorganizations handle transaction removals and reinsertions.
+// Tests that chain reorganisations handle transaction removals and reinsertions.
func TestChainTxReorgs(t *testing.T) {
params.MinGasLimit = big.NewInt(125000) // Minimum the gas limit may ever be.
params.GenesisGasLimit = big.NewInt(3141592) // Gas limit of the Genesis block.
@@ -889,7 +889,7 @@ func TestChainTxReorgs(t *testing.T) {
var pastDrop, freshDrop *types.Transaction
// Create three transactions that will be added in the forked chain:
- // - pastAdd: transaction added before the reorganiztion is detected
+ // - pastAdd: transaction added before the reorganization is detected
// - freshAdd: transaction added at the exact block the reorg is detected
// - futureAdd: transaction added after the reorg has already finished
var pastAdd, freshAdd, futureAdd *types.Transaction
@@ -1086,7 +1086,7 @@ done:
// make sure no more events are fired
select {
case e := <-subs.Chan():
- t.Errorf("unexectped event fired: %v", e)
+ t.Errorf("unexpected event fired: %v", e)
case <-time.After(250 * time.Millisecond):
}
diff --git a/core/chain_makers.go b/core/chain_makers.go
index c62618e6c..0e1ca5fff 100644
--- a/core/chain_makers.go
+++ b/core/chain_makers.go
@@ -108,7 +108,7 @@ func (b *BlockGen) Number() *big.Int {
// backing transaction.
//
// AddUncheckedReceipts will cause consensus failures when used during real
-// chain processing. This is best used in conjuction with raw block insertion.
+// chain processing. This is best used in conjunction with raw block insertion.
func (b *BlockGen) AddUncheckedReceipt(receipt *types.Receipt) {
b.receipts = append(b.receipts, receipt)
}
@@ -215,7 +215,7 @@ func makeHeader(parent *types.Block, state *state.StateDB) *types.Header {
// chain. Depending on the full flag, if creates either a full block chain or a
// header only chain.
func newCanonical(n int, full bool) (ethdb.Database, *BlockChain, error) {
- // Create te new chain database
+ // Create the new chain database
db, _ := ethdb.NewMemDatabase()
evmux := &event.TypeMux{}
diff --git a/core/state/managed_state.go b/core/state/managed_state.go
index 4df047979..f8e2f2b87 100644
--- a/core/state/managed_state.go
+++ b/core/state/managed_state.go
@@ -82,7 +82,7 @@ func (ms *ManagedState) NewNonce(addr common.Address) uint64 {
return uint64(len(account.nonces)-1) + account.nstart
}
-// GetNonce returns the canonical nonce for the managed or unmanged account
+// GetNonce returns the canonical nonce for the managed or unmanaged account
func (ms *ManagedState) GetNonce(addr common.Address) uint64 {
ms.mu.RLock()
defer ms.mu.RUnlock()
diff --git a/core/state/state_test.go b/core/state/state_test.go
index 7ce341c36..a45eddd0d 100644
--- a/core/state/state_test.go
+++ b/core/state/state_test.go
@@ -102,7 +102,7 @@ func (s *StateSuite) TestSnapshot(c *checker.C) {
data1 := common.BytesToHash([]byte{42})
data2 := common.BytesToHash([]byte{43})
- // set inital state object value
+ // set initial state object value
s.state.SetState(stateobjaddr, storageaddr, data1)
// get snapshot of current state
snapshot := s.state.Copy()
diff --git a/core/state_processor.go b/core/state_processor.go
index b9793b157..3ca36a43a 100644
--- a/core/state_processor.go
+++ b/core/state_processor.go
@@ -55,7 +55,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB) (ty
return receipts, allLogs, totalUsedGas, err
}
-// ApplyTransaction attemps to apply a transaction to the given state database
+// ApplyTransaction attempts to apply a transaction to the given state database
// and uses the input parameters for its environment.
//
// ApplyTransactions returns the generated receipts and vm logs during the
diff --git a/core/tx_pool.go b/core/tx_pool.go
index b8fb4cd35..f4e964bf7 100644
--- a/core/tx_pool.go
+++ b/core/tx_pool.go
@@ -60,8 +60,8 @@ type stateFn func() (*state.StateDB, error)
// current state) and future transactions. Transactions move between those
// two states over time as they are received and processed.
type TxPool struct {
- quit chan bool // Quiting channel
- currentState stateFn // The state function which will allow us to do some pre checkes
+ quit chan bool // Quitting channel
+ currentState stateFn // The state function which will allow us to do some pre checks
pendingState *state.ManagedState
gasLimit func() *big.Int // The current gas limit function callback
minGasPrice *big.Int
@@ -357,7 +357,7 @@ func (self *TxPool) AddTransactions(txs []*types.Transaction) {
}
}
- // check and validate the queueue
+ // check and validate the queue
self.checkQueue()
}
diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go
index 811e40111..fa1a740dc 100644
--- a/core/tx_pool_test.go
+++ b/core/tx_pool_test.go
@@ -331,7 +331,7 @@ func TestTransactionDropping(t *testing.T) {
// Tests that if a transaction is dropped from the current pending pool (e.g. out
// of fund), all consecutive (still valid, but not executable) transactions are
-// postponed back into the future queue to prevent broadcating them.
+// postponed back into the future queue to prevent broadcasting them.
func TestTransactionPostponing(t *testing.T) {
// Create a test account and fund it
pool, key := setupTxPool()
@@ -366,7 +366,7 @@ func TestTransactionPostponing(t *testing.T) {
if len(pool.queue[account]) != 0 {
t.Errorf("queued transaction mismatch: have %d, want %d", len(pool.queue), 0)
}
- // Reduce the balance of the account, and check that transactions are reorganized
+ // Reduce the balance of the account, and check that transactions are reorganised
state.AddBalance(account, big.NewInt(-750))
pool.resetState()
diff --git a/core/types.go b/core/types.go
index 60eb15662..022528374 100644
--- a/core/types.go
+++ b/core/types.go
@@ -39,7 +39,7 @@ import (
// if it failed to do so.
//
// ValidateState validates the given statedb and optionally the receipts and
-// gas used. The implementor should decide what to do with the given input.
+// gas used. The implementer should decide what to do with the given input.
type Validator interface {
HeaderValidator
ValidateBlock(block *types.Block) error
diff --git a/core/types/block.go b/core/types/block.go
index 5536e0ea8..5e6a9019d 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -34,7 +34,7 @@ import (
)
// A BlockNonce is a 64-bit hash which proves (combined with the
-// mix-hash) that a suffcient amount of computation has been carried
+// mix-hash) that a sufficient amount of computation has been carried
// out on a block.
type BlockNonce [8]byte
diff --git a/core/types/transaction.go b/core/types/transaction.go
index 37715ee53..b99d3a716 100644
--- a/core/types/transaction.go
+++ b/core/types/transaction.go
@@ -158,7 +158,7 @@ func (tx *Transaction) Size() common.StorageSize {
}
// From returns the address derived from the signature (V, R, S) using secp256k1
-// eliptic curve and an error if it failed deriving or upon an incorrect
+// elliptic curve and an error if it failed deriving or upon an incorrect
// signature.
//
// From Uses the homestead consensus rules to determine whether the signature is
@@ -176,7 +176,7 @@ func (tx *Transaction) From() (common.Address, error) {
}
// FromFrontier returns the address derived from the signature (V, R, S) using
-// secp256k1 eliptic curve and an error if it failed deriving or upon an
+// secp256k1 elliptic curve and an error if it failed deriving or upon an
// incorrect signature.
//
// FromFrantier uses the frontier consensus rules to determine whether the
diff --git a/core/vm/asm.go b/core/vm/asm.go
index 065d3eb97..b248838a7 100644
--- a/core/vm/asm.go
+++ b/core/vm/asm.go
@@ -23,7 +23,7 @@ import (
"github.com/ethereum/go-ethereum/common"
)
-// Dissassemble dissassembles the byte code and returns the string
+// Disassemble disassembles the byte code and returns the string
// representation (human readable opcodes).
func Disassemble(script []byte) (asm []string) {
pc := new(big.Int)
diff --git a/core/vm/doc.go b/core/vm/doc.go
index debbdb35e..de7fa6021 100644
--- a/core/vm/doc.go
+++ b/core/vm/doc.go
@@ -20,7 +20,7 @@ Package vm implements the Ethereum Virtual Machine.
The vm package implements two EVMs, a byte code VM and a JIT VM. The BC
(Byte Code) VM loops over a set of bytes and executes them according to the set
of rules defined in the Ethereum yellow paper. When the BC VM is invoked it
-invokes the JIT VM in a seperate goroutine and compiles the byte code in JIT
+invokes the JIT VM in a separate goroutine and compiles the byte code in JIT
instructions.
The JIT VM, when invoked, loops around a set of pre-defined instructions until
diff --git a/core/vm/environment.go b/core/vm/environment.go
index a58e3ba2b..d5d21a45b 100644
--- a/core/vm/environment.go
+++ b/core/vm/environment.go
@@ -34,9 +34,9 @@ type Environment interface {
MakeSnapshot() Database
// Set database to previous snapshot
SetSnapshot(Database)
- // Address of the original invoker (first occurance of the VM invoker)
+ // Address of the original invoker (first occurrence of the VM invoker)
Origin() common.Address
- // The block number this VM is invoken on
+ // The block number this VM is invoked on
BlockNumber() *big.Int
// The n'th hash ago from this block number
GetHash(uint64) common.Hash
@@ -101,7 +101,7 @@ type Database interface {
IsDeleted(common.Address) bool
}
-// StructLog is emited to the Environment each cycle and lists information about the curent internal state
+// StructLog is emitted to the Environment each cycle and lists information about the current internal state
// prior to the execution of the statement.
type StructLog struct {
Pc uint64
diff --git a/core/vm/jit.go b/core/vm/jit.go
index 5404730c1..71ffcf0f6 100644
--- a/core/vm/jit.go
+++ b/core/vm/jit.go
@@ -300,7 +300,7 @@ func CompileProgram(program *Program) (err error) {
return nil
}
-// RunProgram runs the program given the enviroment and contract and returns an
+// RunProgram runs the program given the environment and contract and returns an
// error if the execution failed (non-consensus)
func RunProgram(program *Program, env Environment, contract *Contract, input []byte) ([]byte, error) {
return runProgram(program, 0, NewMemory(), newstack(), env, contract, input)
@@ -346,7 +346,7 @@ func runProgram(program *Program, pcstart uint64, mem *Memory, stack *stack, env
return nil, nil
}
-// validDest checks if the given distination is a valid one given the
+// validDest checks if the given destination is a valid one given the
// destination table of the program
func validDest(dests map[uint64]struct{}, dest *big.Int) bool {
// PC cannot go beyond len(code) and certainly can't be bigger than 64bits.
@@ -416,7 +416,7 @@ func jitCalculateGasAndSize(env Environment, contract *Contract, instr instructi
// This checks for 3 scenario's and calculates gas accordingly
// 1. From a zero-value address to a non-zero value (NEW VALUE)
// 2. From a non-zero value address to a zero-value address (DELETE)
- // 3. From a nen-zero to a non-zero (CHANGE)
+ // 3. From a non-zero to a non-zero (CHANGE)
if common.EmptyHash(val) && !common.EmptyHash(common.BigToHash(y)) {
g = params.SstoreSetGas
} else if !common.EmptyHash(val) && common.EmptyHash(common.BigToHash(y)) {
diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go
index 4174c666f..19261827b 100644
--- a/core/vm/jit_test.go
+++ b/core/vm/jit_test.go
@@ -77,7 +77,7 @@ func TestCompiling(t *testing.T) {
}
if len(prog.instructions) != 1 {
- t.Error("exected 1 compiled instruction, got", len(prog.instructions))
+ t.Error("expected 1 compiled instruction, got", len(prog.instructions))
}
}
diff --git a/core/vm/jit_util.go b/core/vm/jit_util.go
index 0d3d6d701..72e9ccf8f 100644
--- a/core/vm/jit_util.go
+++ b/core/vm/jit_util.go
@@ -41,7 +41,7 @@ func Parse(code []byte) (opcodes []OpCode) {
// MatchFn searcher for match in the given input and calls matcheFn if it finds
// an appropriate match. matcherFn yields the starting position in the input.
-// MatchFn will continue to search for a match until it reacher the end of the
+// MatchFn will continue to search for a match until it reaches the end of the
// buffer or if matcherFn return false.
func MatchFn(input, match []OpCode, matcherFn func(int) bool) {
// short circuit if either input or match is empty or if the match is
diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go
index 565ce7b73..3e6057142 100644
--- a/core/vm/runtime/runtime.go
+++ b/core/vm/runtime/runtime.go
@@ -27,7 +27,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
)
-// Config is a basic type specifing certain configuration flags for running
+// Config is a basic type specifying certain configuration flags for running
// the EVM.
type Config struct {
Difficulty *big.Int
diff --git a/core/vm/vm.go b/core/vm/vm.go
index d45d136b5..95d27c64c 100644
--- a/core/vm/vm.go
+++ b/core/vm/vm.go
@@ -63,7 +63,7 @@ func (self *Vm) Run(contract *Contract, input []byte) (ret []byte, err error) {
)
if EnableJit {
// If the JIT is enabled check the status of the JIT program,
- // if it doesn't exist compile a new program in a seperate
+ // if it doesn't exist compile a new program in a separate
// goroutine or wait for compilation to finish if the JIT is
// forced.
switch GetProgramStatus(codehash) {
@@ -80,7 +80,7 @@ func (self *Vm) Run(contract *Contract, input []byte) (ret []byte, err error) {
glog.V(logger.Info).Infoln("error compiling program", err)
} else {
// create and compile the program. Compilation
- // is done in a seperate goroutine
+ // is done in a separate goroutine
program = NewProgram(contract.Code)
go func() {
err := CompileProgram(program)
@@ -103,7 +103,7 @@ func (self *Vm) Run(contract *Contract, input []byte) (ret []byte, err error) {
stack = newstack() // local stack
statedb = self.env.Db() // current state
// For optimisation reason we're using uint64 as the program counter.
- // It's theoretically possible to go above 2^64. The YP defines the PC to be uint256. Pratically much less so feasible.
+ // It's theoretically possible to go above 2^64. The YP defines the PC to be uint256. Practically much less so feasible.
pc = uint64(0) // program counter
// jump evaluates and checks whether the given jump destination is a valid one
@@ -271,7 +271,7 @@ func calculateGasAndSize(env Environment, contract *Contract, caller ContractRef
// This checks for 3 scenario's and calculates gas accordingly
// 1. From a zero-value address to a non-zero value (NEW VALUE)
// 2. From a non-zero value address to a zero-value address (DELETE)
- // 3. From a nen-zero to a non-zero (CHANGE)
+ // 3. From a non-zero to a non-zero (CHANGE)
if common.EmptyHash(val) && !common.EmptyHash(common.BigToHash(y)) {
// 0 => non 0
g = params.SstoreSetGas
diff --git a/core/vm/vm_jit.go b/core/vm/vm_jit.go
index 589c30fa8..f6e4a515b 100644
--- a/core/vm/vm_jit.go
+++ b/core/vm/vm_jit.go
@@ -138,7 +138,7 @@ func llvm2big(m *i256) *big.Int {
}
// llvm2bytesRef creates a []byte slice that references byte buffer on LLVM side (as of that not controller by GC)
-// User must asure that referenced memory is available to Go until the data is copied or not needed any more
+// User must ensure that referenced memory is available to Go until the data is copied or not needed any more
func llvm2bytesRef(data *byte, length uint64) []byte {
if length == 0 {
return nil
@@ -171,7 +171,7 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
// TODO: Move it to Env.Call() or sth
if Precompiled[string(me.Address())] != nil {
- // if it's address of precopiled contract
+ // if it's address of precompiled contract
// fallback to standard VM
stdVm := New(self.env)
return stdVm.Run(me, caller, code, value, gas, price, callData)
@@ -348,7 +348,7 @@ func env_create(_vm unsafe.Pointer, _gas *int64, _value unsafe.Pointer, initData
gas := big.NewInt(*_gas)
ret, suberr, ref := vm.env.Create(vm.me, nil, initData, gas, vm.price, value)
if suberr == nil {
- dataGas := big.NewInt(int64(len(ret))) // TODO: Nto the best design. env.Create can do it, it has the reference to gas counter
+ dataGas := big.NewInt(int64(len(ret))) // TODO: Not the best design. env.Create can do it, it has the reference to gas counter
dataGas.Mul(dataGas, params.CreateDataGas)
gas.Sub(gas, dataGas)
*result = hash2llvm(ref.Address())
diff --git a/core/vm_env.go b/core/vm_env.go
index db29cc32c..7b9a1a0f9 100644
--- a/core/vm_env.go
+++ b/core/vm_env.go
@@ -25,7 +25,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
)
-// GetHashFn returns a function for which the VM env can query block hashes thru
+// GetHashFn returns a function for which the VM env can query block hashes through
// up to the limit defined by the Yellow Paper and uses the given block chain
// to query for information.
func GetHashFn(ref common.Hash, chain *BlockChain) func(n uint64) common.Hash {
diff --git a/eth/api.go b/eth/api.go
index 38b67a07a..487d24ae7 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -51,7 +51,7 @@ const defaultGas = uint64(90000)
// blockByNumber is a commonly used helper function which retrieves and returns
// the block for the given block number, capable of handling two special blocks:
-// rpc.LatestBlockNumber adn rpc.PendingBlockNumber. It returns nil when no block
+// rpc.LatestBlockNumber and rpc.PendingBlockNumber. It returns nil when no block
// could be found.
func blockByNumber(m *miner.Miner, bc *core.BlockChain, blockNr rpc.BlockNumber) *types.Block {
// Pending block is only known by the miner
@@ -67,7 +67,7 @@ func blockByNumber(m *miner.Miner, bc *core.BlockChain, blockNr rpc.BlockNumber)
// stateAndBlockByNumber is a commonly used helper function which retrieves and
// returns the state and containing block for the given block number, capable of
-// handling two special states: rpc.LatestBlockNumber adn rpc.PendingBlockNumber.
+// handling two special states: rpc.LatestBlockNumber and rpc.PendingBlockNumber.
// It returns nil when no block or state could be found.
func stateAndBlockByNumber(m *miner.Miner, bc *core.BlockChain, blockNr rpc.BlockNumber, chainDb ethdb.Database) (*state.StateDB, *types.Block, error) {
// Pending state is only known by the miner
@@ -90,7 +90,7 @@ type PublicEthereumAPI struct {
gpo *GasPriceOracle
}
-// NewPublicEthereumAPI creates a new Etheruem protocol API.
+// NewPublicEthereumAPI creates a new Ethereum protocol API.
func NewPublicEthereumAPI(e *Ethereum) *PublicEthereumAPI {
return &PublicEthereumAPI{e, NewGasPriceOracle(e)}
}
@@ -148,7 +148,7 @@ func (s *PublicEthereumAPI) Hashrate() *rpc.HexNumber {
return rpc.NewHexNumber(s.e.Miner().HashRate())
}
-// Syncing returns false in case the node is currently not synching with the network. It can be up to date or has not
+// Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not
// yet received the latest block headers from its pears. In case it is synchronizing:
// - startingBlock: block number this node started to synchronise from
// - currentBlock: block number this node is currently importing
@@ -600,7 +600,7 @@ func (s *PublicBlockChainAPI) GetStorageAt(address common.Address, key string, b
return state.GetState(address, common.HexToHash(key)).Hex(), nil
}
-// callmsg is the message type used for call transations.
+// callmsg is the message type used for call transactions.
type callmsg struct {
from *state.StateObject
to *common.Address
@@ -678,7 +678,7 @@ func (s *PublicBlockChainAPI) doCall(args CallArgs, blockNr rpc.BlockNumber) (st
}
// Call executes the given transaction on the state for the given block number.
-// It doesn't make and changes in the state/blockchain and is usefull to execute and retrieve values.
+// It doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.
func (s *PublicBlockChainAPI) Call(args CallArgs, blockNr rpc.BlockNumber) (string, error) {
result, _, err := s.doCall(args, blockNr)
return result, err
@@ -1545,7 +1545,7 @@ func (api *PrivateDebugAPI) SetHead(number uint64) {
api.eth.BlockChain().SetHead(number)
}
-// StructLogRes stores a structured log emitted by the evm while replaying a
+// StructLogRes stores a structured log emitted by the EVM while replaying a
// transaction in debug mode
type structLogRes struct {
Pc uint64 `json:"pc"`
@@ -1558,7 +1558,7 @@ type structLogRes struct {
Storage map[string]string `json:"storage"`
}
-// TransactionExecutionRes groups all structured logs emitted by the evm
+// TransactionExecutionRes groups all structured logs emitted by the EVM
// while replaying a transaction in debug mode as well as the amount of
// gas used and the return value
type TransactionExecutionResult struct {
@@ -1614,7 +1614,7 @@ func (s *PrivateDebugAPI) doReplayTransaction(txHash common.Hash) ([]vm.StructLo
return vmenv.StructLogs(), ret, gas, nil
}
-// Executes a transaction and returns the structured logs of the evm
+// Executes a transaction and returns the structured logs of the EVM
// gathered during the execution
func (s *PrivateDebugAPI) ReplayTransaction(txHash common.Hash, stackDepth int, memorySize int, storageSize int) (*TransactionExecutionResult, error) {
@@ -1690,7 +1690,7 @@ type PublicNetAPI struct {
networkVersion int
}
-// NewPublicNetAPI creates a new net api instance.
+// NewPublicNetAPI creates a new net API instance.
func NewPublicNetAPI(net *p2p.Server, networkVersion int) *PublicNetAPI {
return &PublicNetAPI{net, networkVersion}
}
diff --git a/eth/downloader/api.go b/eth/downloader/api.go
index 6df911fee..13d0ed46e 100644
--- a/eth/downloader/api.go
+++ b/eth/downloader/api.go
@@ -20,7 +20,7 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)
-// PublicDownloaderAPI provides an API which gives informatoin about the current synchronisation status.
+// PublicDownloaderAPI provides an API which gives information about the current synchronisation status.
// It offers only methods that operates on data that can be available to anyone without security risks.
type PublicDownloaderAPI struct {
d *Downloader
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index 143d8bde7..f50a71cf1 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -197,7 +197,7 @@ func New(stateDb ethdb.Database, mux *event.TypeMux, hasHeader headerCheckFn, ha
// block where synchronisation started at (may have failed/suspended); the block
// or header sync is currently at; and the latest known block which the sync targets.
//
-// In addition, during the state download phase of fast synchonisation the number
+// In addition, during the state download phase of fast synchronisation the number
// of processed and the total number of known states are also returned. Otherwise
// these are zero.
func (d *Downloader) Progress() (uint64, uint64, uint64, uint64, uint64) {
@@ -280,7 +280,7 @@ func (d *Downloader) Synchronise(id string, head common.Hash, td *big.Int, mode
// it will use the best peer possible and synchronize if it's TD is higher than our own. If any of the
// checks fail an error will be returned. This method is synchronous
func (d *Downloader) synchronise(id string, hash common.Hash, td *big.Int, mode SyncMode) error {
- // Mock out the synchonisation if testing
+ // Mock out the synchronisation if testing
if d.synchroniseMock != nil {
return d.synchroniseMock(id, hash)
}
@@ -534,7 +534,7 @@ func (d *Downloader) fetchHeight61(p *peer) (uint64, error) {
// findAncestor61 tries to locate the common ancestor block of the local chain and
// a remote peers blockchain. In the general case when our node was in sync and
// on the correct chain, checking the top N blocks should already get us a match.
-// In the rare scenario when we ended up on a long reorganization (i.e. none of
+// In the rare scenario when we ended up on a long reorganisation (i.e. none of
// the head blocks match), we do a binary search to find the common ancestor.
func (d *Downloader) findAncestor61(p *peer) (uint64, error) {
glog.V(logger.Debug).Infof("%v: looking for common ancestor", p)
@@ -709,7 +709,7 @@ func (d *Downloader) fetchHashes61(p *peer, td *big.Int, from uint64) error {
}
// If no hashes were retrieved at all, the peer violated it's TD promise that it had a
// better chain compared to ours. The only exception is if it's promised blocks were
- // already imported by other means (e.g. fecher):
+ // already imported by other means (e.g. fetcher):
//
// R <remote peer>, L <local node>: Both at block 10
// R: Mine block 11, and propagate it to L
@@ -960,7 +960,7 @@ func (d *Downloader) fetchHeight(p *peer) (uint64, error) {
// findAncestor tries to locate the common ancestor link of the local chain and
// a remote peers blockchain. In the general case when our node was in sync and
// on the correct chain, checking the top N links should already get us a match.
-// In the rare scenario when we ended up on a long reorganization (i.e. none of
+// In the rare scenario when we ended up on a long reorganisation (i.e. none of
// the head links match), we do a binary search to find the common ancestor.
func (d *Downloader) findAncestor(p *peer) (uint64, error) {
glog.V(logger.Debug).Infof("%v: looking for common ancestor", p)
@@ -1180,7 +1180,7 @@ func (d *Downloader) fetchHeaders(p *peer, td *big.Int, from uint64) error {
}
// If no headers were retrieved at all, the peer violated it's TD promise that it had a
// better chain compared to ours. The only exception is if it's promised blocks were
- // already imported by other means (e.g. fecher):
+ // already imported by other means (e.g. fetcher):
//
// R <remote peer>, L <local node>: Both at block 10
// R: Mine block 11, and propagate it to L
@@ -1621,7 +1621,7 @@ func (d *Downloader) DeliverBlocks(id string, blocks []*types.Block) (err error)
return d.deliver(id, d.blockCh, &blockPack{id, blocks}, blockInMeter, blockDropMeter)
}
-// DeliverHeaders injects a new batch of blck headers received from a remote
+// DeliverHeaders injects a new batch of block headers received from a remote
// node into the download schedule.
func (d *Downloader) DeliverHeaders(id string, headers []*types.Header) (err error) {
return d.deliver(id, d.headerCh, &headerPack{id, headers}, headerInMeter, headerDropMeter)
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go
index ff57fe167..e66a90264 100644
--- a/eth/downloader/downloader_test.go
+++ b/eth/downloader/downloader_test.go
@@ -277,7 +277,7 @@ func (dl *downloadTester) insertHeaders(headers []*types.Header, checkFreq int)
dl.lock.Lock()
defer dl.lock.Unlock()
- // Do a quick check, as the blockchain.InsertHeaderChain doesn't insert anthing in case of errors
+ // Do a quick check, as the blockchain.InsertHeaderChain doesn't insert anything in case of errors
if _, ok := dl.ownHeaders[headers[0].ParentHash]; !ok {
return 0, errors.New("unknown parent")
}
@@ -958,7 +958,7 @@ func testMultiSynchronisation(t *testing.T, protocol int, mode SyncMode) {
}
// Tests that synchronisations behave well in multi-version protocol environments
-// and not wreak havok on other nodes in the network.
+// and not wreak havoc on other nodes in the network.
func TestMultiProtoSynchronisation61(t *testing.T) { testMultiProtoSync(t, 61, FullSync) }
func TestMultiProtoSynchronisation62(t *testing.T) { testMultiProtoSync(t, 62, FullSync) }
func TestMultiProtoSynchronisation63Full(t *testing.T) { testMultiProtoSync(t, 63, FullSync) }
@@ -1188,7 +1188,7 @@ func testInvalidHeaderRollback(t *testing.T, protocol int, mode SyncMode) {
// Synchronise with the valid peer and make sure sync succeeds. Since the last
// rollback should also disable fast syncing for this process, verify that we
// did a fresh full sync. Note, we can't assert anything about the receipts
- // since we won't purge the database of them, hence we can't use asserOwnChain.
+ // since we won't purge the database of them, hence we can't use assertOwnChain.
tester.newPeer("valid", protocol, hashes, headers, blocks, receipts)
if err := tester.sync("valid", nil, mode); err != nil {
t.Fatalf("failed to synchronise blocks: %v", err)
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index bc9428ecf..f86bae144 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -976,7 +976,7 @@ func (q *queue) DeliverNodeData(id string, data [][]byte, callback func(error, i
accepted, errs := 0, make([]error, 0)
process := []trie.SyncResult{}
for _, blob := range data {
- // Skip any state trie entires that were not requested
+ // Skip any state trie entries that were not requested
hash := common.BytesToHash(crypto.Keccak256(blob))
if _, ok := request.Hashes[hash]; !ok {
errs = append(errs, fmt.Errorf("non-requested state data %x", hash))
diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go
index d88d91982..9300717c3 100644
--- a/eth/fetcher/fetcher.go
+++ b/eth/fetcher/fetcher.go
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-// Package fetcher contains the block announcement based synchonisation.
+// Package fetcher contains the block announcement based synchronisation.
package fetcher
import (
@@ -34,7 +34,7 @@ import (
const (
arriveTimeout = 500 * time.Millisecond // Time allowance before an announced block is explicitly requested
gatherSlack = 100 * time.Millisecond // Interval used to collate almost-expired announces with fetches
- fetchTimeout = 5 * time.Second // Maximum alloted time to return an explicitly requested block
+ fetchTimeout = 5 * time.Second // Maximum allotted time to return an explicitly requested block
maxUncleDist = 7 // Maximum allowed backward distance from the chain head
maxQueueDist = 32 // Maximum allowed distance from the chain head to queue
hashLimit = 256 // Maximum number of unique blocks a peer may have announced
@@ -176,7 +176,7 @@ func New(getBlock blockRetrievalFn, validateBlock blockValidatorFn, broadcastBlo
}
}
-// Start boots up the announcement based synchoniser, accepting and processing
+// Start boots up the announcement based synchroniser, accepting and processing
// hash notifications and block fetches until termination requested.
func (f *Fetcher) Start() {
go f.loop()
diff --git a/eth/filters/api.go b/eth/filters/api.go
index 6cd184b80..e6a1ce3ab 100644
--- a/eth/filters/api.go
+++ b/eth/filters/api.go
@@ -47,7 +47,7 @@ const (
logFilterTy
)
-// PublicFilterAPI offers support to create and manage filters. This will allow externa clients to retrieve various
+// PublicFilterAPI offers support to create and manage filters. This will allow external clients to retrieve various
// information related to the Ethereum protocol such als blocks, transactions and logs.
type PublicFilterAPI struct {
mux *event.TypeMux
diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go
index 3ad7dd9cb..7904d7d33 100644
--- a/eth/filters/filter_system_test.go
+++ b/eth/filters/filter_system_test.go
@@ -96,6 +96,6 @@ func TestCallbacks(t *testing.T) {
select {
case <-pendingLogDone:
case <-failTimer.C:
- t.Error("pending log filter failed to trigger (timout)")
+ t.Error("pending log filter failed to trigger (timeout)")
}
}
diff --git a/eth/handler.go b/eth/handler.go
index f11a69550..2c5cae479 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -590,7 +590,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
}
case msg.Code == NewBlockHashesMsg:
- // Retrieve and deseralize the remote new block hashes notification
+ // Retrieve and deserialize the remote new block hashes notification
type announce struct {
Hash common.Hash
Number uint64
diff --git a/eth/handler_test.go b/eth/handler_test.go
index e5974c23c..8a0dd21b7 100644
--- a/eth/handler_test.go
+++ b/eth/handler_test.go
@@ -427,7 +427,7 @@ func testGetNodeData(t *testing.T, protocol int) {
acc1Addr := crypto.PubkeyToAddress(acc1Key.PublicKey)
acc2Addr := crypto.PubkeyToAddress(acc2Key.PublicKey)
- // Create a chain generator with some simple transactions (blatantly stolen from @fjl/chain_makerts_test)
+ // Create a chain generator with some simple transactions (blatantly stolen from @fjl/chain_markets_test)
generator := func(i int, block *core.BlockGen) {
switch i {
case 0:
@@ -518,7 +518,7 @@ func testGetReceipt(t *testing.T, protocol int) {
acc1Addr := crypto.PubkeyToAddress(acc1Key.PublicKey)
acc2Addr := crypto.PubkeyToAddress(acc2Key.PublicKey)
- // Create a chain generator with some simple transactions (blatantly stolen from @fjl/chain_makerts_test)
+ // Create a chain generator with some simple transactions (blatantly stolen from @fjl/chain_markets_test)
generator := func(i int, block *core.BlockGen) {
switch i {
case 0:
diff --git a/eth/metrics.go b/eth/metrics.go
index 8231a06ff..e1a89d3a9 100644
--- a/eth/metrics.go
+++ b/eth/metrics.go
@@ -72,7 +72,7 @@ type meteredMsgReadWriter struct {
}
// newMeteredMsgWriter wraps a p2p MsgReadWriter with metering support. If the
-// metrics system is disabled, this fucntion returns the original object.
+// metrics system is disabled, this function returns the original object.
func newMeteredMsgWriter(rw p2p.MsgReadWriter) p2p.MsgReadWriter {
if !metrics.Enabled {
return rw
diff --git a/internal/debug/flags.go b/internal/debug/flags.go
index 22e524cd6..76f32561a 100644
--- a/internal/debug/flags.go
+++ b/internal/debug/flags.go
@@ -55,6 +55,7 @@ var (
memprofilerateFlag = cli.IntFlag{
Name: "memprofilerate",
Usage: "Turn on memory profiling with the given rate",
+ Value: runtime.MemProfileRate,
}
blockprofilerateFlag = cli.IntFlag{
Name: "blockprofilerate",
diff --git a/internal/debug/loudpanic.go b/internal/debug/loudpanic.go
new file mode 100644
index 000000000..572ebcefa
--- /dev/null
+++ b/internal/debug/loudpanic.go
@@ -0,0 +1,27 @@
+// Copyright 2016 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
+
+// +build go1.6
+
+package debug
+
+import "runtime/debug"
+
+// LoudPanic panics in a way that gets all goroutine stacks printed on stderr.
+func LoudPanic(x interface{}) {
+ debug.SetTraceback("all")
+ panic(x)
+}
diff --git a/internal/debug/loudpanic_fallback.go b/internal/debug/loudpanic_fallback.go
new file mode 100644
index 000000000..4ce4985da
--- /dev/null
+++ b/internal/debug/loudpanic_fallback.go
@@ -0,0 +1,24 @@
+// Copyright 2016 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
+
+// +build !go1.6
+
+package debug
+
+// LoudPanic panics in a way that gets all goroutine stacks printed on stderr.
+func LoudPanic(x interface{}) {
+ panic(x)
+}