diff --git a/core/block_validator.go b/core/block_validator.go index fdd415d640..136d321c20 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -164,11 +164,11 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error { func debugGsSummary(gasSummaries map[int]*state.GasSummary, block *types.Block) { for txIndex, s := range gasSummaries { if s == nil { - log.Error("GasSummary debug, gs is nil", "blockNumber", block.NumberU64(), "txIndex", txIndex) - fmt.Printf("GasSummary, block:%d, txIndex:%d, is nil\n", block.NumberU64(), txIndex) + log.Error("[DEBUG invalid gas used], gs is nil", "blockNumber", block.NumberU64(), "txIndex", txIndex) + fmt.Printf("[DEBUG invalid gas used], block:%d, txIndex:%d, is nil\n", block.NumberU64(), txIndex) } else { - log.Error("GasSummary debug, gs collected", "blockNumber", block.NumberU64(), "txIndex", txIndex, "gasSummary", s.Debug()) - fmt.Printf("GasSummary, block:%d, txIndex:%d, gasSummary:%s\n", block.NumberU64(), txIndex, s.Debug()) + log.Error("[DEBUG invalid gas used], gs collected", "blockNumber", block.NumberU64(), "txIndex", txIndex, "gasSummary", s.Debug()) + fmt.Printf("[DEBUG invalid gas used], block:%d, txIndex:%d, gasSummary:%s\n", block.NumberU64(), txIndex, s.Debug()) } } } diff --git a/core/blockchain.go b/core/blockchain.go index 16b05ccc10..ec0aa2524e 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1949,11 +1949,13 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) // Process block using the parent state as reference point pstart = time.Now() + fmt.Printf("[DEBUG invalid gas used] block %d, gas used %d\n", block.NumberU64(), block.GasUsed()) receipts, logs, usedGas, err = bc.processor.Process(block, statedb, bc.vmConfig) if err == FallbackToSerialProcessorErr { bc.UseSerialProcessor() receipts, logs, usedGas, err = bc.processor.Process(block, statedb, bc.vmConfig) } + fmt.Printf("[DEBUG invalid gas used] block %d, gas used %d\n", block.NumberU64(), block.GasUsed()) if err != nil { bc.reportBlock(block, receipts, err) followupInterrupt.Store(true) diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 73741cbc46..bd48ca72d4 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -17,6 +17,8 @@ package vm import ( + "fmt" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/core/types" @@ -199,6 +201,7 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) ( } else if sLen > operation.maxStack { return nil, &ErrStackOverflow{stackLen: sLen, limit: operation.maxStack} } + fmt.Printf("[DEBUG invalid gas used] from:%s, to:%s, op:%s, cost:%d\n", contract.caller.Address(), contract.self.Address(), op.String(), cost) if !contract.UseGas(cost) { return nil, ErrOutOfGas }