Musicoin / go-musicoin

:link: Go-version of Musicoin blockchain wallet and consensus
GNU Lesser General Public License v3.0
161 stars 57 forks source link

Fix mcip-3 consensus, align uncle reward with parity #43

Closed 5chdn closed 7 years ago

5chdn commented 7 years ago

uncle rewards should respect the new miner reward after mcip-3.

this should align with https://github.com/paritytech/parity/commit/f292915e547434e56a1f015b317f4166a411c275

please test carefully :)

5chdn commented 7 years ago

would love to test it but it does not build with go 1.9 :(

immartian commented 7 years ago

Ya, I'm actually working toward v1.8±

5chdn commented 7 years ago

I you could run a node with this code and fork block set to 120 I could point a parity node at it to test. Ping me on gitter if you have time.

5chdn commented 7 years ago

We did not pass 1200000 yet. But I would advice to include uncle reward calculation in this formula.

5chdn commented 7 years ago

Could you run a node with these rules somewhere and change transition to > 120?

immartian commented 7 years ago

I will run up the node. The problem is, we have released the previous build and many miners have deployed. It's not easy to let them change to new logic before such short notice.

5chdn commented 7 years ago

ok, what's the exact date of the fork?

trying to convince you to run tests for more than a week now. I would do it but lack a go version old enough to build this. xD

immartian commented 7 years ago

I'm going to running it up, if not tonight here, then next morning.
Not for this 1200000 fork, but need to hardfork again in near future, we may add some thing more if tested.

immartian commented 7 years ago

build error:

core/state_processor.go:124: reward declared and not used

5chdn commented 7 years ago

Can you change := to = in L124 and try again?

immartian commented 7 years ago

Doing so, just wanted to keep it's consistency from source. never mind.

immartian commented 7 years ago

gmc running hardfork at >1200:

"enode://be9462cf81bd0d3020f749352c799524a39def1e9a915e9e30ba15a5b8a4554a39594f7e765c8ce147f177c26d0e1ecf175bed7a785c14bd6c5b37411c4feb1b@35.184.194.32:30303"

5chdn commented 7 years ago

"enode://be9462cf81bd0d3020f749352c799524a39def1e9a915e9e30ba15a5b8a4554a39594f7e765c8ce147f177c26d0e1ecf175bed7a785c14bd6c5b37411c4feb1b@35.184.194.32:30303"

Is that running this branch or master?

5chdn commented 7 years ago

GMC of this PR:

E0929 19:49:01.463678 core/blockchain.go:1170] Bad block #1201 (0x16f4f41bfbd40de3038f683456d89bcef8c70683e04a91cb74af534b47acc8f8)
E0929 19:49:01.463691 core/blockchain.go:1171]     invalid merkle root: header=aa77717d964656979f0d9febce4fde1ff2d0a045c7c2d34cfd572d9f1ee31116 computed=ce5b54eececc4d3fc18aa58fa6e49a07272660b5a2e8971a84f905230ce4521c

Parity

2017-09-29 19:48:52  Stage 5 block verification failed for #1201 (16f4…c8f8)
Error: Block(InvalidStateRoot(Mismatch { expected: aa77717d964656979f0d9febce4fde1ff2d0a045c7c2d34cfd572d9f1ee31116, found: f30fb48e14a383c0bda98ce16066ba59d22f601741ad5ecca6c95dbc51ee1eb7 }))
5chdn commented 7 years ago

Yeah that's because it's connected to the main musicoin network.

Can you remove the chaindata, turn on the miner, and change --networkid to 7762955?

5chdn commented 7 years ago

Cant make parity 1.8 talk to this ancient go version. I'm a bit exhausted.

You should either upgrade to the latest go-ethereum codebase or abondon go-musicoin altogether. Can help you with the parity-side but the current state of go-musicoin is terrifying ... :unamused: :sweat_smile:

5chdn commented 7 years ago

https://github.com/paritytech/parity/commit/939354cefe1b9907647bbb429782c84b02180b1a#diff-0a229ee5988e1a97f1bb37dbb2f7028d

5chdn commented 7 years ago

Parity should be ready. Can't test because my local GMC node want talk to Parity :cry:

immartian commented 7 years ago

ok, I will change networkid to 7762955 and run a miner up.

immartian commented 7 years ago

"enode://f6753e58fceb1990beca2d3e69ce9e021e78a3d634ba424516a1d7f9bb0c2139c28b1834e56d342efedf3d715f121d4e5454de6f862d69a949676d58f91dcafa@35.184.194.32:30303"

Varunram commented 7 years ago

@5chdn I think that Go1.8 introduced a set of regulations involving the directory structure that go-musiocin does not align with. I think along with the next hard fork, we must make this compatible with Go1.8+ by changing directory structures, although it will be a bit difficult.

5chdn commented 7 years ago

You should "go" straight for Go 1.9 :)

5chdn commented 7 years ago

Why not update to the latest go-ethereum code base and schedule or hard forks at the same block?

immartian commented 7 years ago

We need a long strategy on this, to maintain only one client, either go-ethereum or parity.

5chdn commented 7 years ago

"enode://f6753e58fceb1990beca2d3e69ce9e021e78a3d634ba424516a1d7f9bb0c2139c28b1834e56d342efedf3d715f121d4e5454de6f862d69a949676d58f91dcafa@35.184.194.32:30303"

Sorry, but I cant connect my GMC to yours. Which block is this node forking on? 121? 1201?

I1002 10:52:53.913636 p2p/server.go:313] Starting Server I1002 10:52:53.913947 p2p/server.go:556] Listening on [::]:30303 I1002 10:52:53.914919 node/node.go:296] IPC endpoint opened: /home/user/.musicoin/gmc.ipc I1002 10:57:23.914167 eth/downloader/downloader.go:319] Block synchronisation started E1002 10:57:30.732365 core/blockchain.go:1170] Bad block #121 (0x38e79922679d9418eef1171a7eedbb7d1ad46fb9710831bf3774d1727f4534d2) E1002 10:57:30.732408 core/blockchain.go:1171] invalid merkle root: header=a80dba54188d56b4213f12e9001249707e3bbcf8c412a076f6d2f535f7b7b580 computed=59042b04ca43e52d8bca149e6651e452d58b72173c83521797b3542bfee99d9b E1002 10:57:58.348955 core/blockchain.go:1170] Bad block #121 (0x38e79922679d9418eef1171a7eedbb7d1ad46fb9710831bf3774d1727f4534d2) E1002 10:57:58.349002 core/blockchain.go:1171] invalid merkle root: header=a80dba54188d56b4213f12e9001249707e3bbcf8c412a076f6d2f535f7b7b580 computed=59042b04ca43e52d8bca149e6651e452d58b72173c83521797b3542bfee99d9b

^ this is GMC with ubi block > 120.

immartian commented 7 years ago

I set to 1201, let me change it to 121 accordingly.

5chdn commented 7 years ago

I set to 1201, let me change it to 121 accordingly.

E1002 11:03:06.534921 core/blockchain.go:1170] Bad block #1201 (0xe97147a678169fa852c05e4c9a627fa34c57a23b5749ae96cdbfd3dc2c22fc1d)
E1002 11:03:06.535035 core/blockchain.go:1171]     invalid merkle root: header=c849582f8c4cd4497e8b00f586290291af1154bbe72dae834d0caa3c7df8065f computed=a1528b3131459206063c070e0043830ab1eb69df3f7087c9a96b71e0421b18ee

Can you just push your GMC to some branch here so we can makes sure we are on the same tree? Can't get 1201 to work either.

5chdn commented 7 years ago

And please remove your chaindata, I suspect your node is synced with the musicoin main chain.

immartian commented 7 years ago

I don't think it's on mainchain, because it mined itself to #2582 or sth. But i'm pushing a branch to check.

immartian commented 7 years ago

https://github.com/Musicoin/go-musicoin/tree/fork1201 oh i see the problem. my bad.

5chdn commented 7 years ago

could you run a fork based on master, I'm trying align parity with your version.

immartian commented 7 years ago

ok, wait... will update here.

immartian commented 7 years ago

Seems RMC on main chain met some difficult mismatch:

im@ether:~/lab/musicoin/rmc/target/release$ ./rmc --chain rmc.json ui
2017-10-03 00:47:23  Starting Parity/v1.7.0-unstable-7786d36-20170905/x86_64-linux-gnu/rustc1.18.0-nightly
2017-10-03 00:47:23  State DB configuration: fast +Trace
2017-10-03 00:47:23  Operating mode: active
2017-10-03 00:47:23  Configured for Musicoin using Ethash engine

Open: http://127.0.0.1:8180/#/auth?token=d5OV-nctI-fajy-3pIm
to authorize your browser.
Or use the generated token:
d5OV-nctI-fajy-3pIm
2017-10-03 00:47:28  Public node URL: enode://281bb8588e3c247dbea612b5ca5fb80c99673d57c90c259ada0c7127171e557361b388422b4df32c7c92ef533881a0c61ce37df2c572ac6d21aa31dd55d6226a@172.17.0.1:30303
[11308:11347:1003/004728.978753:ERROR:browser_gpu_channel_host_factory.cc(103)] Failed to launch GPU process.
Created new window in existing browser session.
2017-10-03 00:47:38  Syncing #1149999 c40a…69c7     0 blk/s    0 tx/s   0 Mgas/s      0+    0 Qed  #1149999    0/ 3/25 peers   144 MiB db    1 MiB chain  0 bytes queue   10 KiB sync  RPC:  1 conn, 11 req/s,  99 µs
2017-10-03 00:47:41  Stage 3 block verification failed for #1150000 (5f4a…7281)
Error: Block(InvalidDifficulty(Mismatch { expected: 15948772865750, found: 15940989179628 }))
2017-10-03 00:47:43  Syncing #1149999 c40a…69c7     0 blk/s    0 tx/s   0 Mgas/s     33+    0 Qed  #1150463    2/11/25 peers   144 MiB db    1 MiB chain  139 KiB queue  190 KiB sync  RPC:  1 conn,  7 req/s, 118 µs