Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

multivm/sputnikvm.RequireBlockhash: ensure block exists in db #586

Merged
merged 3 commits into from
May 10, 2018

Conversation

whilei
Copy link
Contributor

@whilei whilei commented May 9, 2018

Fixes

panic: runtime error: invalid memory address or nil pointer dereference                                   
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xaa0fa7]                                    

goroutine 188627 [running]:                          
sync/atomic.(*Value).Load(...)                       
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/core/types/block.go:398                 
github.com/ethereumproject/go-ethereum/core/types.(*Block).Hash(0x0, 0x0, 0x0, 0x0, 0x0)                  
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/core/types/block.go:398 +0x67           
github.com/ethereumproject/go-ethereum/core.ApplyMultiVmTransaction(0xc420427b90, 0xc421808360, 0xc43418aaa0, 0xc42bec9700, 0xc42b1b98c0, 0xc42a789400, 0xc43418a940, 0x160, 0x150, 0x10aa560, ...)                 
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/core/multivm_processor.go:122 +0x20c2   
github.com/ethereumproject/go-ethereum/core.(*StateProcessor).Process(0xc4217d23c0, 0xc433af3b00, 0xc42bec9700, 0x54154a23db5020e, 0x862a8d08c2cd782f, 0x0, 0x0, 0x0, 0x0, 0x0, ...)                                
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/core/state_processor.go:97 +0x45e       
github.com/ethereumproject/go-ethereum/core.(*BlockChain).InsertChain(0xc421808360, 0xc42c6e2000, 0x800, 0x800, 0x0, 0x0, 0x0)                                                                                      
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/core/blockchain.go:1573 +0x1ddc         
github.com/ethereumproject/go-ethereum/eth.(*ProtocolManager).insertChain(0xc420130340, 0xc42c6e2000, 0x800, 0x800, 0x1cc40c0, 0x1cc40c0, 0xc43568d440)                                                             
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/eth/handler.go:181 +0x51                
github.com/ethereumproject/go-ethereum/eth.(*ProtocolManager).(github.com/ethereumproject/go-ethereum/eth.insertChain)-fm(0xc42c6e2000, 0x800, 0x800, 0x0, 0x0, 0x0)                                                
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/eth/handler.go:158 +0x48                
github.com/ethereumproject/go-ethereum/eth/downloader.(*Downloader).importBlockResults(0xc42197c000, 0xc436c16000, 0x1800, 0x1800, 0x0, 0x0)                                                                        
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/eth/downloader/downloader.go:1422 +0x17f
github.com/ethereumproject/go-ethereum/eth/downloader.(*Downloader).processFullSyncContent(0xc42197c000, 0xc428187798, 0x0)                                                                                         
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/eth/downloader/downloader.go:1397 +0x74 
github.com/ethereumproject/go-ethereum/eth/downloader.(*Downloader).(github.com/ethereumproject/go-ethereum/eth/downloader.processFullSyncContent)-fm(0x8, 0x12205f0)                                               
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/eth/downloader/downloader.go:550 +0x2a  
github.com/ethereumproject/go-ethereum/eth/downloader.(*Downloader).spawnSync.func1(0xc430c274e0, 0xc430caaae0, 0xc430bc1a20)                                                                                       
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/eth/downloader/downloader.go:568 +0x51  
created by github.com/ethereumproject/go-ethereum/eth/downloader.(*Downloader).spawnSync                  
        /home/tomek/go/src/github.com/ethereumproject/go-ethereum/eth/downloader/downloader.go:568 +0xc7

from #585

whilei added 2 commits May 9, 2018 08:49
solution: ensure loaded block reference is not nil and accurate

Fixes #585
solution: rename, adding tiny prefix for legibility
@whilei whilei requested review from tzdybal and sorpaas May 9, 2018 00:02
@tzdybal
Copy link
Contributor

tzdybal commented May 9, 2018

This is a cure only for symptom, not for the cause ;)

But I guess that replicating logic from default EVM is the right way to go.

@sorpaas
Copy link
Contributor

sorpaas commented May 9, 2018

On this line (https://github.com/ethereumproject/go-ethereum/pull/586/files#diff-77eb77f8c5d169125764797d711f0d5eR123) you'll need to commit an empty blockhash even when the block is not found. Otherwise the client will stuck in a loop trying to fetch the next blockhash.

solution: commit empty hash if no required block exists in db
@sorpaas
Copy link
Contributor

sorpaas commented May 10, 2018

lgtm

@whilei
Copy link
Contributor Author

whilei commented May 10, 2018

Thanks @sorpaas :)

@whilei whilei merged commit 55fb00b into master May 10, 2018
@soc1c soc1c deleted the fix/svm-processor-blockhash-nil-pointer branch June 19, 2019 12:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants