Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New chain fork code crashes in block tests #850

Closed
Gustav-Simonsson opened this issue May 4, 2015 · 5 comments
Closed

New chain fork code crashes in block tests #850

Gustav-Simonsson opened this issue May 4, 2015 · 5 comments
Assignees

Comments

@Gustav-Simonsson
Copy link

Looks like a off-by-one here: https://github.com/ethereum/go-ethereum/blob/develop/core/chain_manager.go#L575

> geth blocktest /home/gs/eth/tests/BlockTests/bcUncleTest.json 

   Welcome to the
      FRONTIER

----------------- Running Block Test "oneUncleGeneration2"
I0504 11:48:26.891498    5671 backend.go:193] Protocol Version: 60, Network Id: 0
I0504 11:48:26.891688    5671 backend.go:203] Blockchain DB Version: 2
I0504 11:48:26.893056    5671 chain_manager.go:235] Last block (#0) fd4af92a79c7fc2fd8bf0d342f2e832e1d4f485c85b9152d2039e03bc604fdca TD=0
I0504 11:48:26.893584    5671 ethash.go:94] Making cache for epoch: 0 (0) (0000000000000000000000000000000000000000000000000000000000000000)
I0504 11:48:28.048266    5671 ethash.go:99] Took: 1.154580887s
I0504 11:48:28.053199    5671 backend.go:403] Server started
I0504 11:48:28.053497    5671 ethash.go:94] Making cache for epoch: 0 (0) (0000000000000000000000000000000000000000000000000000000000000000)
I0504 11:48:29.201999    5671 ethash.go:99] Took: 1.148398724s
I0504 11:48:29.207903    5671 chain_manager.go:628] imported 1 block(s) (0 queued 0 ignored) in 5.692392ms. #1 [50471440 / 50471440]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4b5d0a]

goroutine 1 [running]:
github.com/ethereum/go-ethereum/core/types.(*Block).Hash(0x0, 0x0, 0x0, 0x0, 0x0)
    /home/gs/go/src/github.com/ethereum/go-ethereum/core/types/block.go:319 +0xca
github.com/ethereum/go-ethereum/core.(*ChainManager).InsertChain(0xc2080bd950, 0xc2080c7448, 0x1, 0x1, 0x0, 0x0, 0x0)
    /home/gs/go/src/github.com/ethereum/go-ethereum/core/chain_manager.go:575 +0x130b
github.com/ethereum/go-ethereum/tests.(*BlockTest).TryBlocksInsert(0xc2081b0640, 0xc2080bd950, 0x0, 0x0)
    /home/gs/go/src/github.com/ethereum/go-ethereum/tests/block_test_util.go:165 +0x2ef
main.runOneBlockTest(0xc2080821c0, 0xc2081b0640, 0xc2080c7748, 0x0, 0x0)
    /home/gs/go/src/github.com/ethereum/go-ethereum/cmd/geth/blocktest.go:112 +0x2fd
main.runBlockTest(0xc2080821c0)
@obscuren
Copy link
Contributor

obscuren commented May 4, 2015

I just checked and it appears that the previous block can not be found using the GetBlockByNumber. Did you do anything differently for the tests?

@obscuren
Copy link
Contributor

obscuren commented May 4, 2015

block:

I0504 12:28:01.121473   97305 chain_manager.go:631] imported 1 block(s) (0 queued 0 ignored) in 5.705345ms. #1 [50471440 / 50471440]
Block(#2): Size: 612.00 B TD: 262208 {
MinerHash: 27fbaba84d1a6a24e407af4755e736c5dd1b38781009fd29d73a25369a36381a
Header(faf46c175ab6e958dba9190557b36b072ccc76a6ccc76af6e09eb76418af9c80):
[
    ParentHash:     50471440735fab181157f681bec6f3c6143ece9da3567bb5a98751bd0d92d872
    UncleHash:      1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
    Coinbase:       8888f1f195afa192cfee860698584c030f4c9db1
    Root:           a2a5e3d96e902272adb58e90c364f7b92684c539e0ded77356cf33d966f917fe
    TxSha           d0fa6c13f704258be01fef48588ccd57fcb0cff7ffe9d66d49f6abc33a4bfb65
    ReceiptSha:     5a750181d80a2b69fac54c1b2f7a37ebc4666ea5320e25db6603b90958686b27
    Bloom:          00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    Difficulty:     131136
    Number:         2
    GasLimit:       3141592
    GasUsed:        21000
    Time:           1429521876
    Extra:
    MixDigest:          e6ef43d0623e75a53d4765853ced0dfb7732c21982da99968b742709acfb2753
    Nonce:          e0eb0c0afe18aa0f
]
Transactions:
[
    TX(a3691a54bfc425cceb22ba52917678d7ff94f221b859aebb59677b54e728e0ee)
    Contract: false
    From:     a94f5374fce5edbc8e2a8697c15331677e6ebf0b
    To:       095e7baea6a6c7c4c2dfeb977efac326af552d87
    Nonce:    1
    GasPrice: 1
    GasLimit  314159
    Value:    10
    Data:     0x
    V:        0x1c
    R:        0x1b6fed1b62694205e8a14aef67d0da4e508ca36f12f61def385a56d893564d48
    S:        0xbc085e190f0be43565356495433bea725be6a5148a246315e1614d9cd19ce99
    Hex:      f86001018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca01b6fed1b62694205e8a14aef67d0da4e508ca36f12f61def385a56d893564d48a00bc085e190f0be43565356495433bea725be6a5148a246315e1614d9cd19ce99
]
Uncles:
[]
}

self.getBlockByNumber(block.Number() - 1):

<nil>

self.GetBlock(block.ParentHash()):

Block(#1): Size: 612.00 B TD: 131072 {
MinerHash: 8e861bccc3c5b4f259b94c54ec588fb9e22fc93cb9b615416d47a1da204bd3d9
Header(50471440735fab181157f681bec6f3c6143ece9da3567bb5a98751bd0d92d872):
[
    ParentHash:     3ca4b1cb8594cc146df2d746536b670c09c4c2edb81298748b6b0c3c2ef83965
    UncleHash:      1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
    Coinbase:       8888f1f195afa192cfee860698584c030f4c9db1
    Root:           2c15e8b5cb6cf880faa558c76c02a591e181ef2c4450ad92e53ae6c21093dc70
    TxSha           869af6e174056213a0039b95bb91ef272548985ae20487d746af666d02e2074c
    ReceiptSha:     e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313
    Bloom:          00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    Difficulty:     131072
    Number:         1
    GasLimit:       3141592
    GasUsed:        21000
    Time:           1429521875
    Extra:
    MixDigest:          ba521732117b319c6b2edf47a5a1a933a246212d643700bb5ce838aa31f2fde0
    Nonce:          23914144df6d8b42
]
Transactions:
[
    TX(2f66c552d2f9014630b86c8d9f141a365ced7dffb95c3b9db6ef10448627f417)
    Contract: false
    From:     a94f5374fce5edbc8e2a8697c15331677e6ebf0b
    To:       095e7baea6a6c7c4c2dfeb977efac326af552d87
    Nonce:    0
    GasPrice: 1
    GasLimit  314159
    Value:    10
    Data:     0x
    V:        0x1b
    R:        0xd26e4915e9dd8af52ba47600da9660ebdc0c39911ebe9672418fc173fe0ad0fa
    S:        0x45aa2e72f5cce8bac030601844de212df77479e01abadf02f2ce107acc525735
    Hex:      f86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0d26e4915e9dd8af52ba47600da9660ebdc0c39911ebe9672418fc173fe0ad0faa045aa2e72f5cce8bac030601844de212df77479e01abadf02f2ce107acc525735
]
Uncles:
[]
}

@Gustav-Simonsson Gustav-Simonsson self-assigned this May 4, 2015
@Gustav-Simonsson
Copy link
Author

Fix: #857

@obscuren
Copy link
Contributor

obscuren commented May 6, 2015

Could you point me to fix in #857? I can only find a couple of name changes and comment moves.

@Gustav-Simonsson
Copy link
Author

New PR which resolves the DoS vulnerability but still needs a proper fix for the underlying missing block number problem: #865

@obscuren obscuren closed this as completed May 6, 2015
tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this issue Jan 20, 2022
* Adds isReserveLow contract helper

* Checks if the reserve needs to be funded

Co-authored-by: jfoutts-celo <57463555+jfoutts-celo@users.noreply.github.com>
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue May 2, 2022
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Jun 9, 2023
* added script to update the bor version across all the locations

* minor update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants