Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Add Callisto support #9534

Merged
merged 9 commits into from
Oct 11, 2018
Merged

Add Callisto support #9534

merged 9 commits into from
Oct 11, 2018

Conversation

yograterol
Copy link
Contributor

@yograterol yograterol commented Sep 12, 2018

Continuing #9445

Callisto info

Website: https://callisto.network
Whitepaper: https://whitepaper.callisto.network

Chain

Mainnet -> callisto

The code has little changes to run Callisto with Treasury and Stake funds.

Known issues in master:

In block #200000 get this issue:

Error: Error(Block(InvalidDifficulty(Mismatch { expected: 14050308711650, found: 14050308711649 })), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })

14050308711650 vs 14050308711649, just 1 of diff.

All bootnodes run Geth 1.8.11.

Update about this issue

In stable channel the issue is gone. Sync without problem after block #200000

Solved

Removing EIP-649, client is working in version 2.2.0

@parity-cla-bot
Copy link

It looks like @yograterol signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

@5chdn 5chdn added A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. M2-config 📂 Chain specifications and node configurations. labels Sep 12, 2018
@5chdn 5chdn added this to the 2.2 milestone Sep 12, 2018
@5chdn
Copy link
Contributor

5chdn commented Sep 12, 2018

I don't seem to get this working beyond genesis

❯ parity --chain callisto.json        
2018-09-12 09:32:54  Starting Parity/v1.11.10-stable-31720e6151-20180830/x86_64-linux-gnu/rustc1.28.0
2018-09-12 09:32:54  Keys path /home/user/.local/share/io.parity.ethereum/keys/Callisto
2018-09-12 09:32:54  DB path /home/user/.local/share/io.parity.ethereum/chains/callisto/db/1b2904ad30128c93
2018-09-12 09:32:54  Path to dapps /home/user/.local/share/io.parity.ethereum/dapps
2018-09-12 09:32:54  State DB configuration: fast
2018-09-12 09:32:54  Operating mode: active
2018-09-12 09:32:54  Configured for Callisto using Ethash engine
2018-09-12 09:32:59  Public node URL: enode://fd713358a4590b17e45c42bc374b5b1a43f63aed35211aedfffb8d68476b58fb9f96edb836de1b6b1f0ff393b5f4272c011d2fffc6491a106c0b65a63a87d8d3@192.168.1.44:30303
2018-09-12 09:33:01  Stage 5 block verification failed for #1 (0x2f65…85ff)
Error: Error(Block(InvalidStateRoot(Mismatch { expected: 0x3c0ad8734c52ae50933b37940da4ad56e4e65e92e063729b35109c80b80f04e6, found: 0xad1b1dd219e2f8c47ea013e39c16b660a601b8d590ca4603145355984f4a4ad8 })), State { next_error: None, backtrace: None })
2018-09-12 09:33:04  Syncing       #0 0x8227…d2c4     0 blk/s    0 tx/s   0 Mgas/s      0+    0 Qed        #0    1/25 peers   8 KiB chain 7 KiB db 0 bytes queue 244 KiB sync  RPC:  0 conn,  0 req/s,   0 µs

Also, please use block reward contract as documented here: https://wiki.parity.io/Block-Reward-Contract

EIP-649 was replaced recently, see #9480

Same discussion as in #9529

5chdn
5chdn previously requested changes Sep 12, 2018
Copy link
Contributor

@5chdn 5chdn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

callisto_treasury_reward: None,
callisto_stake_address: None,
callisto_stake_reward: None,
>>>>>>> Add Callisto Mainnet support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge failure ^

@yograterol
Copy link
Contributor Author

I don't seem to get this working beyond genesis

It's working well now.

EIP-649 was replaced recently, see #9480

@5chdn removed EIP-649.

Also, please use block reward contract as documented here: https://wiki.parity.io/Block-Reward-Contract

We have a Hard fork 1 after Nov 11, so, we need to send another update to Parity with the new reward scheme, can we implement the smart contract there?

BTW, blockRewardContractCode work? To avoid deploy it with blockRewardContractTransition.

@5chdn
Copy link
Contributor

5chdn commented Sep 13, 2018

~
❯ ethereum/pull/9534 

~/ethereum/pull/9534
❯ wget https://raw.githubusercontent.com/paritytech/parity-ethereum/b81e5d1c9063e4017a8ad4648880320427b4ad5f/ethcore/res/ethereum/callisto.json
--2018-09-13 09:58:46--  https://raw.githubusercontent.com/paritytech/parity-ethereum/b81e5d1c9063e4017a8ad4648880320427b4ad5f/ethcore/res/ethereum/callisto.json
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.12.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.12.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4738 (4.6K) [text/plain]
Saving to: ‘callisto.json.1’

callisto.json.1                                             100%[==========================================================================================================================================>]   4.63K  --.-KB/s    in 0s      

2018-09-13 09:58:46 (23.3 MB/s) - ‘callisto.json.1’ saved [4738/4738]


~/ethereum/pull/9534
❯ parity --chain callisto.json.1 
2018-09-13 09:58:55  Starting Parity/v1.11.10-stable-31720e6151-20180830/x86_64-linux-gnu/rustc1.28.0
2018-09-13 09:58:55  Keys path /home/user/.local/share/io.parity.ethereum/keys/Callisto
2018-09-13 09:58:55  DB path /home/user/.local/share/io.parity.ethereum/chains/callisto/db/1b2904ad30128c93
2018-09-13 09:58:55  Path to dapps /home/user/.local/share/io.parity.ethereum/dapps
2018-09-13 09:58:55  State DB configuration: fast
2018-09-13 09:58:55  Operating mode: active
2018-09-13 09:58:55  Configured for Callisto using Ethash engine
2018-09-13 09:58:55  Public node URL: enode://fd713358a4590b17e45c42bc374b5b1a43f63aed35211aedfffb8d68476b58fb9f96edb836de1b6b1f0ff393b5f4272c011d2fffc6491a106c0b65a63a87d8d3@192.168.1.135:30303
2018-09-13 09:59:02  Stage 5 block verification failed for #1 (0x2f65…85ff)
Error: Error(Block(InvalidStateRoot(Mismatch { expected: 0x3c0ad8734c52ae50933b37940da4ad56e4e65e92e063729b35109c80b80f04e6, found: 0xad1b1dd219e2f8c47ea013e39c16b660a601b8d590ca4603145355984f4a4ad8 })), State { next_error: None, backtrace: None })
^C2018-09-13 09:59:08  Finishing work, please wait...

~/ethereum/pull/9534 14s
❯ parity --chain callisto.json.1 db kill
2018-09-13 09:59:13  Database deleted.

~/ethereum/pull/9534
❯ parity --chain callisto.json.1        
2018-09-13 09:59:15  Starting Parity/v1.11.10-stable-31720e6151-20180830/x86_64-linux-gnu/rustc1.28.0
2018-09-13 09:59:15  Keys path /home/user/.local/share/io.parity.ethereum/keys/Callisto
2018-09-13 09:59:15  DB path /home/user/.local/share/io.parity.ethereum/chains/callisto/db/1b2904ad30128c93
2018-09-13 09:59:15  Path to dapps /home/user/.local/share/io.parity.ethereum/dapps
2018-09-13 09:59:15  State DB configuration: fast
2018-09-13 09:59:15  Operating mode: active
2018-09-13 09:59:15  Configured for Callisto using Ethash engine
2018-09-13 09:59:15  Public node URL: enode://fd713358a4590b17e45c42bc374b5b1a43f63aed35211aedfffb8d68476b58fb9f96edb836de1b6b1f0ff393b5f4272c011d2fffc6491a106c0b65a63a87d8d3@192.168.1.135:30303
2018-09-13 09:59:22  Stage 5 block verification failed for #1 (0x2f65…85ff)
Error: Error(Block(InvalidStateRoot(Mismatch { expected: 0x3c0ad8734c52ae50933b37940da4ad56e4e65e92e063729b35109c80b80f04e6, found: 0xad1b1dd219e2f8c47ea013e39c16b660a601b8d590ca4603145355984f4a4ad8 })), State { next_error: None, backtrace: None })
2018-09-13 09:59:50     0/25 peers   8 KiB chain 7 KiB db 0 bytes queue 19 KiB sync  RPC:  0 conn,  0 req/s,   0 µs

@yograterol
Copy link
Contributor Author

@5chdn in latest stable binary Callisto doesn't work because the version doesn't have this function https://github.com/paritytech/parity-ethereum/pull/9534/files#diff-0a229ee5988e1a97f1bb37dbb2f7028dR317

@yograterol
Copy link
Contributor Author

@5chdn ack

@sorpaas
Copy link
Collaborator

sorpaas commented Sep 18, 2018

We have a Hard fork 1 after Nov 11, so, we need to send another update to Parity with the new reward scheme, can we implement the smart contract there?

Yes. Just make sure the contract is backward-compatible.

BTW, blockRewardContractCode work?

Yes!

@5chdn
Copy link
Contributor

5chdn commented Sep 18, 2018

tests failing, please rebase on master.

@yograterol
Copy link
Contributor Author

@sorpaas got it.

@5chdn rebased.

@andresilva
Copy link
Contributor

You can find an example of using the block reward contract in #9605 to implement the Musicoin block reward logic, there's also a gist there with instructions on how to build the contract.

@andresilva
Copy link
Contributor

It seems you can use pretty much everything from the MusicoinBlockReward contract just updating the addresses and reward amounts. And you also need to add this logic to calculate the author reward (musicoin doesn't reward the author for including uncles):

let n_uncles = LiveBlock::uncles(&*block).len();
let mut result_block_reward = reward + reward.shr(5) * U256::from(n_uncles);

@yograterol
Copy link
Contributor Author

@andresilva thanks I will implement it so

@yograterol
Copy link
Contributor Author

I did the smart contract https://github.com/EthereumCommonwealth/block-reward/blob/master/contracts/CallistoBlockReward.sol

I'm testing right now the client with the mainnet blockchain.

@5chdn
Copy link
Contributor

5chdn commented Sep 29, 2018

please rebase on master

@yograterol
Copy link
Contributor Author

image

@5chdn, It works well.

I'm not sure if I should remove the existing code for reward in ethash.rs

@5chdn 5chdn added A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. labels Sep 29, 2018
@5chdn 5chdn added A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. and removed A0-pleasereview 🤓 Pull request needs code review. labels Oct 3, 2018
@yograterol
Copy link
Contributor Author

@5chdn I'm not sure what is the bug.

Parity 2.1.1

2018-10-07 03:48:56 UTC Starting Parity-Ethereum/v2.1.1-unstable-8e347b260-20180921/x86_64-linux-gnu/rustc1.29.1
2018-10-07 03:48:56 UTC Keys path /home/yograterol/.local/share/io.parity.ethereum/keys/callisto
2018-10-07 03:48:56 UTC DB path /home/yograterol/.local/share/io.parity.ethereum/chains/callisto/db/1b2904ad30128c93
2018-10-07 03:48:56 UTC State DB configuration: fast
2018-10-07 03:48:56 UTC Operating mode: active
2018-10-07 03:48:56 UTC Configured for Callisto using Ethash engine
2018-10-07 03:49:01 UTC Public node URL: enode://5b34df5fc28ea5435c14105cb43c5ae66d8cba97501a805a632061402a62aa03527378c24192d313e2910ef2ea4566598d50dd2a63b909c6633eb13f908afe04@192.99.16.147:30303
2018-10-07 03:49:03 UTC Stage 5 block verification failed for #1 (0x2f65…85ff)
Error: Error(Block(InvalidStateRoot(Mismatch { expected: 0x3c0ad8734c52ae50933b37940da4ad56e4e65e92e063729b35109c80b80f04e6, found: 0xb6fc3cdf0bcbd52b9138f7e9243633aa9d2055b2a65115040e776bfc61ff9d3e })), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })
2018-10-07 03:49:03 UTC
Bad block detected: ()
RLP: f90213f9020ea082270b80fc90beb005505a9ef95039639968a0e81b2904ad30128c93d713d2c4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794183394f52b2c8c034835edba3bcececa6f60b5a8a03c0ad8734c52ae50933b37940da4ad56e4e65e92e063729b35109c80b80f04e6a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083079d0001839e895580845ad20a6c97d683010804846765746886676f312e3130856c696e7578a04d3ddf0d686c92b70342631aa223d65e845350db8214bd2db6ea7b081300f928886306b610331ebc79c0c0
Header: Header { parent_hash: 0x82270b80fc90beb005505a9ef95039639968a0e81b2904ad30128c93d713d2c4, timestamp: 1523714668, number: 1, author: 0x183394f52b2c8c034835edba3bcececa6f60b5a8, transactions_root: 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421, uncles_hash: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, extra_data: [214, 131, 1, 8, 4, 132, 103, 101, 116, 104, 134, 103, 111, 49, 46, 49, 48, 133, 108, 105, 110, 117, 120], state_root: 0x3c0ad8734c52ae50933b37940da4ad56e4e65e92e063729b35109c80b80f04e6, receipts_root: 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421, log_bloom: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, gas_used: 0, gas_limit: 10389845, difficulty: 498944, seal: [[160, 77, 61, 223, 13, 104, 108, 146, 183, 3, 66, 99, 26, 162, 35, 214, 94, 132, 83, 80, 219, 130, 20, 189, 45, 182, 234, 123, 8, 19, 0, 249, 40], [136, 99, 6, 182, 16, 51, 30, 188, 121]], hash: Some(0x2f6504653badf9442b344212fd3099343534daa707a457698bb5665dac3285ff) }
Uncles:
Transactions:```

Same chain file with Parity 2.2

```yograterol@yograterol:~/parity-ethereum/target/release$ ./parity --chain callisto.json
2018-10-07 03:22:29 UTC Starting Parity-Ethereum/v2.2.0-unstable-4f278ba71-20181005/x86_64-linux-gnu/rustc1.29.1
2018-10-07 03:22:29 UTC Keys path /home/yograterol/.local/share/io.parity.ethereum/keys/callisto
2018-10-07 03:22:29 UTC DB path /home/yograterol/.local/share/io.parity.ethereum/chains/callisto/db/1b2904ad30128c93
2018-10-07 03:22:29 UTC State DB configuration: fast
2018-10-07 03:22:29 UTC Operating mode: active
2018-10-07 03:22:29 UTC Configured for Callisto using Ethash engine
2018-10-07 03:22:34 UTC Public node URL: enode://5b34df5fc28ea5435c14105cb43c5ae66d8cba97501a805a632061402a62aa03527378c24192d313e2910ef2ea4566598d50dd2a63b909c6633eb13f908afe04@192.99.16.147:30303
2018-10-07 03:22:39 UTC Syncing      #69 0xeeff…1705     6.91 blk/s 3418.4 tx/s   71 Mgas/s     43+   57 Qed      #347    7/25 peers   5 MiB chain 27 MiB db 41 MiB queue 28 MiB sync  RPC:  0 conn,    0 req/s,    0 µs
2018-10-07 03:22:49 UTC Syncing     #381 0x6bee…c201    32.47 blk/s 17894.4 tx/s  375 Mgas/s     42+   37 Qed      #477    7/25 peers   0 bytes chain 121 MiB db 36 MiB queue 99 MiB sync  RPC:  0 conn,    0 req/s,    0 µs
2018-10-07 03:22:59 UTC Syncing     #616 0xa534…5f25    23.55 blk/s 14823.0 tx/s  311 Mgas/s     33+  124 Qed      #785    7/25 peers   0 bytes chain 120 MiB db 70 MiB queue 44 MiB sync  RPC:  0 conn,    0 req/s,    0 µs
2018-10-07 03:23:09 UTC Syncing     #887 0x571e…d4fa    27.12 blk/s 19313.3 tx/s  405 Mgas/s      0+   26 Qed      #938    7/25 peers   77 KiB chain 120 MiB db 12 MiB queue 109 MiB sync  RPC:  0 conn,    0 req/s,    0 µs
2018-10-07 03:23:19 UTC Syncing    #1025 0x142f…c799    14.22 blk/s 11177.0 tx/s  234 Mgas/s      6+  225 Qed     #1270    7/25 peers   5 MiB chain 124 MiB db 96 MiB queue 1 MiB sync  RPC:  0 conn,    0 req/s,    0 µs```

Both compiled on Linux.

@andresilva
Copy link
Contributor

There are some chainspec differences between 2.1 and 2.2, namely the difficulty bomb delays (#9480), so for the chainspec in this PR to work in 2.1 the chainspec needs to replace "difficultyBombDelays": { "20": 3000000 } with "eip649Transition": 20. Still, even with that change it doesn't seem to be working on 2.1 and I haven't figured out why yet. @sorpaas any idea of what could have changed between 2.1 and current master?

@sorpaas
Copy link
Collaborator

sorpaas commented Oct 8, 2018

@yograterol Instead of trying to use a release build with a config file, would you mind to try to build with current branch? Also can you post the config file you're using (as stated in #9534 (comment))?

@5chdn
Copy link
Contributor

5chdn commented Oct 9, 2018

Seems to work with master. Unsure what's causing the failure on beta, Constantinople?

@andresilva
Copy link
Contributor

Just remembered what the issue is, beta still doesn't have #9603.

@5chdn 5chdn added A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging. and removed A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. labels Oct 11, 2018
Copy link
Contributor

@5chdn 5chdn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works as long as we do not backport it :)

@5chdn 5chdn added the B7-releasenotes 📜 Changes should be mentioned in the release notes of the next minor version release. label Oct 11, 2018
@5chdn 5chdn merged commit 2511bc2 into openethereum:master Oct 11, 2018
@andresilva andresilva added A8-looksgood 🦄 Pull request is reviewed well. and removed A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging. labels Oct 11, 2018
@yograterol
Copy link
Contributor Author

Thanks!

@yograterol
Copy link
Contributor Author

@5chdn I tested the chain file with the latest beta of parity and works well. 2.1.2

@andresilva
Copy link
Contributor

@yograterol Yes, #9603 was backported to 2.1.2. 👍

@5chdn
Copy link
Contributor

5chdn commented Oct 17, 2018

Cool

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. B7-releasenotes 📜 Changes should be mentioned in the release notes of the next minor version release. M2-config 📂 Chain specifications and node configurations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants