QuarkChain / go-ethereum

Official Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
6 stars 2 forks source link

Add external calls within consensus mechanism #88

Open cyl19970726 opened 2 years ago

cyl19970726 commented 2 years ago

Performance test of external call on web3q

Environment

Using Infura

Using Local Node

cyl19970726 commented 2 years ago

w3ip-6 describes the function of externalCall
https://github.com/web3q/W3IPs/pull/14

cyl19970726 commented 2 years ago

ExternalCall Test Plan

Environment

We launch two testnets:

Web3qTestNet:

Three validator node and a json-rpc node

cd data_val_0
rm -rf geth web3q_rinkeby web3q_testnet
cd ..
./geth --web3q_testnet --mine --miner.etherbase=0x96f22a48DcD4dFb99A11560b24bee02F374cA77D --unlock=0x96f22a48DcD4dFb99A11560b24bee02F374cA77D --password=./password.txt --validator.port 33333 --validator.nodekey ./node_key/node0.key  --validator.rpc "http://127.0.0.1:8553" --validator.contract "0xd0844Bd4daB9f3Fbf40f78864771cd61BF929F0a" --validator.chainid 12345 --validator.changeepochid 10000000  --externalcall.callrpc  "http://127.0.0.1:8554"  --externalcall.supportchainid 12345 --datadir ./data_val_0 --ipcdisable console --syncmode=full --snapshot=false  --port 30301  --nodekey ./boot.key
--http  --allow-insecure-unlock

--allow-insecure-unlock --ws --http --http.corsdomain="https://remix.ethereum.org" --http.api web3,eth,debug,personal,net --vmdebug

cd data_val_1
rm -rf geth web3q_rinkeby web3q_testnet
cd ..
./geth --web3q_testnet --mine --miner.etherbase=0x560CD6c5054847c2AFCAae0dd9E34E22E6f47100 --unlock=0x560CD6c5054847c2AFCAae0dd9E34E22E6f47100 --password=./password.txt --validator.port 33334 --validator.nodekey ./node_key/node1.key  -validator.rpc "http://127.0.0.1:8554" --validator.contract "0xd0844Bd4daB9f3Fbf40f78864771cd61BF929F0a" --validator.chainid 12345 --validator.changeepochid 10000000 --datadir ./data_val_1 --ipcdisable console --syncmode=full --snapshot=false --port 30302  --externalcall.callrpc  "http://127.0.0.1:8554"  --externalcall.supportchainid 12345

cd data_val_2
rm -rf geth web3q_rinkeby web3q_testnet
cd ..
./geth --web3q_testnet --mine --miner.etherbase=0x3d2Bf29BaB6ec95422Eb143e856df3B0E775e50c --unlock=0x3d2Bf29BaB6ec95422Eb143e856df3B0E775e50c --password=./password.txt --validator.port 33335 --validator.nodekey ./node_key/node2.key  -validator.rpc "http://127.0.0.1:8555" --validator.contract "0xd0844Bd4daB9f3Fbf40f78864771cd61BF929F0a" --validator.chainid 12345 --validator.changeepochid 10000000 --datadir ./data_val_2 --ipcdisable console --syncmode=full --snapshot=false  --port 30303  --externalcall.callrpc  "http://127.0.0.1:8554"  --externalcall.supportchainid 12345

PrivateTestNet:

Three Miner Node with ethhash consensus.

The genesis.json is follow

{
  "config": {
    "chainId": 12345,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0,
    "istanbulBlock": 0,
    "berlinBlock": 0,
    "ethash": {}
  },
  "difficulty": "1",
  "gasLimit": "8000000",
  "alloc": {
    "709b52445E52Dc90EDAF99712Dfb7ACaDEA8B9bD": { "balance": "300000" },
    "f41c74c9ae680c1aa78f42e5647a62f353b7bdde": { "balance": "400000" }
  }
}

Launch Cli:

============================node_0==================================
./geth account new --datadir node0_data
0x709b52445E52Dc90EDAF99712Dfb7ACaDEA8B9bD

./geth --datadir ./node0_data init genesis.json
./geth --datadir ./node0_data --networkid 1337 --port 30310 --http --http.port 8553 --allow-insecure-unlock --unlock=0x709b52445E52Dc90EDAF99712Dfb7ACaDEA8B9bD  --password=./password.txt --http.corsdomain="https://remix.ethereum.org" --http.api web3,eth,debug,personal,net console

============================node_1==================================
cd ./node1_data
rm -rf history geth
cd ..
./geth --datadir ./node1_data init genesis.json
./geth --datadir ./node1_data --networkid 1337 --mine --port 30311 --http --http.port  8554 --authrpc.port  8561 console

============================node_2==================================
cd ./node2_data
rm -rf history geth
cd ..
./geth account new --datadir node2_data
./geth --datadir ./node2_data init genesis.json
./geth --datadir ./node2_data --networkid 1337 --mine --port 30312 --http --http.port 8555 --authrpc.port  8562 console

============================node_3==================================
cd ./node3_data
rm -rf history geth
cd ..
./geth account new --datadir node3_data
./geth --datadir ./node3_data init genesis.json
./geth --datadir ./node3_data --networkid 1337 --mine --port 30312 --http --http.port 8556 --authrpc.port  8563 console

After that Use console:

admin.nodeInfo.enode
admin.addPeer
0xb08f3338d45b5569428a5237c4c48b665cd325d31c98cdebbc1f6d3bc0a9823d

Condition 1

contract DoSomething{
     event setEmpty();

    function setEmptyValue() public {
        emit setEmpty();
    }
}

Result

Conslution

Condition 2

Block Gas Limit 50000000

Result

 > eth.getBlock(5)
 {
    round: 0,
    signatures: [{
        block_id_flag: 2,
        signature: "Wn01w5BtCq0c15N0bZSVkADnTwbPIrlvqCYtlvzQysYpLRCIIiwso3JPKAUipHLoppFIwIAt8Vc5IxnihM01DAE=",
        timestamp: 1660289319833,
        validator_address: "0x96f22a48dcd4dfb99a11560b24bee02f374ca77d"
    }, {
        block_id_flag: 2,
        signature: "8uAB0EvtHAE41rfOGIUAfqVgDIKGxRst7WjcMgC3ty0e6bPctP6oSl/eHSJRSEFuQRo5q7LbuGdjTTPkdPUHSQE=",
        timestamp: 1660289321178,
        validator_address: "0x560cd6c5054847c2afcaae0dd9e34e22e6f47100"
    }, {
        block_id_flag: 2,
        signature: "5KHXq9K+skSIoJsXBo7PrfWKnoKZ2kEJaviUeiExmdpfOCC4v3wz8UBCIlSd+6aldAYe/Qm4NHneqo7xaXnzMwA=",
        timestamp: 1660289319137,
        validator_address: "0x3d2bf29bab6ec95422eb143e856df3b0e775e50c"
    }]
  },
  difficulty: 1,
  extraData: "0x",
  gasLimit: 49756343,
  gasUsed: 49223906,
  hash: "0x3c12b7189a1cf262d17a1afd793ff997d7453606f006fa3375629b7fcb93b0f6",
  lastCommitHash: "0xcb2c4f5f27ed0ab925efb903064836ef2848133a1a5e72ee863422777e88c6a4",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x3d2bf29bab6ec95422eb143e856df3b0e775e50c",
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nextValidatorPowers: [],
  nextValidators: [],
  nonce: "0x0000000000000000",
  number: 5,
  parentHash: "0x808cc54009a675331f2ac1767cc83be3bf434d22a17eb0fe7d62b72ea24d9c8a",
  receiptsRoot: "0x9fc7d8c5d39cba1cb7a26cba6447775f1cb3cf33645006c838324ecb3cbadd08",
  sha3Uncles: "0x4f833decb49fae7f8efdfd29bbc44682507e8b38650cfc975e1a58e379af8270",
  size: 466119,
  stateRoot: "0xb4026c18df2f06b0bafadb0090d9d4871ad8df3a11a8bfa4be70e77a98d3662e",
  timeMs: 1660289306603,
  timestamp: 1660289306,
  totalDifficulty: 6,
  transactions: ["0x86a3bf799c5abcbb78f7b380df14de7ada28031c00d529694a7479b9c8724505", "0xb11bc249a09c043bdc12dca48357ed18746f93ef1c39140c280a77f6860444e0", "0xb76187d055bf1dc7a843a90a1a720e05f0e0b831c0b192283304344445d60a06", "0x0a3e049bc16d69aca6eea52c99b4c156fd3f1c7da87cc90adc3979bf9d59f2c1", "0x4cf9d61dceb43075c19504ea85dbb04e53091d5a39b4cd08dc13737b1f260e91", "0xb6cb9701d55c8c332bd4107c4a68e89e7e19248ae3974e955b8e5500504b6813", "0x0b4fd7cee4c9de1b51b642246f2915f0b1d064fd29a68cd4d82dc237a6853339", "0xf3f9d9f6867e8746cb1be8be05b3c5788f28125ebbf17b88f4d77401d21d01bf", "0x75561c1c1217d990d3448fb034d5707220f8658430ad9fcc428c677ff028f532", "0xbca7e7d64d5cc2868136ffb3f541a87e80c335816f3f06ee59e8803097a6d94f", "0x0c87f6065349b289baad8d85efca41ab5c9ff2a97b261215cbfa29edf2a30fea", "0xd3d664fe890d79bb33a0e972e73a064441917ccf04ffc7d77b00214a41255ba4", "0x535f6d835525d6f5d2b2cd26b86d920f1d063d84b71c87d506620829b5845f4f", "0x1811eedc73a53cfb25a9df8ce59c2034a1b6e28174a0e28ed980449ff313d963", "0x977d5b105de43df6fcdb97631af6d00c7613a39580e94bb6a04935feefd909c1", "0x9fb690335c75583deb9e5337536f90ff3cea9da5c98be60f08ca8f87ad4e3500", "0x2082408ccd4cea3d22ba7b31694781d434c1504fb22d7b84f975ffd2162ff696", "0x3af87235e297a957413243e4db1f127054eebc70fcc5efa6f1f6805bd7430c14", "0x528481460d02b12c69b5f0dc997d0cb600d2c8d61ee8a6b77f8e1e66dad38370", "0x67c8ac92e878ae131c75a41b3cc8407142dbde0609e06e3d5e3c4416e28183c4", "0xb631cdbfbb277b9c0b4e0ae03a83bf763af335b5f8140f5508d866cef4f14df8", "0x32d3b62e40a369d0d001eecf122c98d88138461f24aee280752d94ab915a15a2", "0x3e3b2dec4fc01ed50acec9ed27d15bfb04b97227e2a5cb26910c5b2592fa1129", "0xb4775b85b4ba13d258d171eb08d709ec230179d3ae9396dd9ab03dadb8312bce", "0x08811d0e9829e3e06dd736aa99ffd3dd652ae995615ae5ec5f945c3c6f6145d5", "0x49a755bdba1eef04ee8bf5ddb3270335fc9950011fc5c792d9567bb2fd925150", "0x1e8e0bb4d97a4da71eba449092abe022ef6ada84710517aea1cef268d5ad2325", "0x8d15dca1fb0d2008c9562c1069655a6c23f3a509f58f2e79987abcd01794eff9", "0xff469dec2458fd69b89c22e491570e3cb10ee78f3869f723c5b71980ac55a3f0", "0x3f9140ec27e18722284926462e1f629b2617eedd9d486f09b39b8a7b0b37146a", "0x0f0c8ec9ed9c6331a4bbec1bff7600baf0237180e875e2da9f8f1c8b909642b1", "0x1841971c4a730d1a2bf7e1345c0c6773a77e4f481568f82999f1e21f54005cd1", "0x854f5fc9d413c69f7bcb21957c5cf3073ddefcd8bc895ef1d1b41f456af18858", "0xeba7de1d953482e4874f65d98884d4f3a0cffba541bf9d84a6fb6cadd49a6469", "0xe4fa160dd22eb13955c9ea9f3af038d5122eab4a75708bcef60dfdf809537ee4", "0x67ddf2fa6774acbc8296f3a4f054d61a11d22cb7ca99ddb6b045e4e56a444802", "0x04fd7ad0109fe142cd253ad9217ae11a5a4b2782d4cf47ae8524906df668d18d", "0x6887aa3da4e65a54784d9234450c88d6cceb31112e88e3fe13ef68eae38c28f7", "0x46ee5d5ab0f6cff1fce448f7e6e9bf93d52dec8c57e81e8bb870c90827cba493", "0x67db198ab7696bba47a44110eedf57d7ceb352af15c4ad0a5cf648bd0781f9ef", "0x43dff0753d90df4f035d21e90d2b25ee58fe19034a1280739e070ee2aa7f5bc2", "0x5be9813126a82fbad1001831afc601d3fa93ff6133ae58c1c424b0b295c073bd", "0x24e9d75ee2a346b38beffbc1d1ff1fb7435c10bb74498ada348cb1baeabb9223"],
  transactionsRoot: "0xee0eb5da93c5a72165a7f8f1fa5d92e26d2e5a80f9661037e07799764c160b43",
  uncles: ["0xd58f05b1b54af5618f8cca68727d13e1e8ec471185a2ed611214a4b8b674eb6a", "0xb3f8bc6a3b62d16c4f8f6e9bcfbd8815dd0b1c9c0ea9ce09373427394e95d148", "0x35f9c418b503c57414d73516b5a6e9a1e67bb8e7a4abc27c5c833e7de511d323", "0x4d5bd6ac56a5ce23fb8103997bebd2e51b0625f92ab931f3c3d047959aff8078", "0x4f0cb77a7033b77332531d5f7273a6432cecdce6509d0ced28bec1a71e523f3a", "0x2a13955cc6688b0ac9ad4dc67b57babcbda35a76ba667b9f51b1a5e2aacf2547", "0x22a3c9679b8dda2b97fab482a2e7ef5165dd7c98be8aff296e7456c765b5f206", "0xab2c055b417675989a6407beaaea99df785e8ba5a85c4ed7b3608f931023998f", "0x274bb8e3a05171fdcf00ae81653fd21e3f4f58f38febb1e10ffb564d0ff9b5bb", "0xb87f64f70f2121bf4d952900d6808401fad53425a1c825ed87cd0913cddfa1c9", "0x2b0b5aa0d0b1fb3452d5252d5231beed6898d4aba0675c49bf74fe6165e93de1", "0x3f31b92a3dd26911e5819f2fa10bf69118b69cddd6059c59997acd25f31954a6", "0x7f41f8cefc4b5f9a36459a7df7514975559d1c50b2613d58dae49f2f9dce753a", "0x3f59df477cc523b8d4cc6b24bd84ee6fada065a315a6efeb6d1659159987f3b1", "0xf2993be1a4234f75dd4f55da66f90be1a0acf535f21283b72239ebaccad8ac97", "0xf5125b0b09f1132349bbe3d2e4fc470a21e06ec46c330c143d032addfc99bae0", "0x6bc224bdacd3b3e1386214e619aff584e9ac78c9afd49477f34883d3a758b442", "0x31aa0f148f40489478d58a024227ac5ea6477d8e111e9c5154131b636f3b289e", "0x78b97a5247c7274b2fb18ef4cc78835542b908e66449e77565d4766813c56386", "0xe194743e47ce2c969531ba8eff11a38886157b43d073ebefd3c3d5a447077aff", "0xd902a36c1ec9622f9f7833249aa8bb283ea404754b0f5d9be036f3ae69f45b10", "0x4ff0a441ac7650441c6ffea6bb0764c183978f929f697e45a914c2e8af865a69", "0xdd03a54c57cef075d2002a78def4062a75f5f3f723887617fd16ba23696bc7c2", "0xe3771ea63b1c03951e2bc4277b85227c0b474914d8a021a8af2bb46ac5e1a938", "0xfd0111704c88010a7343830f1e1b9419983607d8437dfcebdbac7ffbb0d3e60b", "0x4178d95658c81959bced76f287798ebf27900900b7f74692910931fbbe4edf7a", "0x48dac7949fe81d1bb55bc013685203ccdf3b3f76e7e34c467aafd2eca7129404", "0xab74262ce2baf09511d1f53cf1edc829a2ef45d2063544fa7279bcaf1cab91db", "0x26606fbe375028746a16819d23b0e376971f1718895596bfadd507ff3aaf3c47", "0x2e6c9c313b8dd2f3df5dcb1d1844ffe6d95195b988c8e2217c9f35462e440561", "0xebcf69aded4681f3480ad1e2e5518d4e915aa7611943dc609b36bee5d03aa3d2", "0x1462dac026900bc78e6dd260c8647fe29ef5e52305d8b12126a7f9a6ed11da2f", "0x7d6d8437d2bb30d3d7579036e092cb38cce994257eb9a5bc3f9c2d3b40a86cbe", "0xa82efe366d0f1c892b40fb319f1dca5bd739b2ced06408f36bb96e292c507633", "0x4fea6d58a065097aa2602c04c65837912c966834ea5bce224db77eee223c872d", "0x702ddb5f7cb287b61406209b26919c3d748091bff869a41c8f2ba4ff7f91b6ca", "0x1cd7db6b7f265f14bb88b8dd02c405f22ed8bdd6e166fe9918a82114adeec3a7", "0x1fdcbc6f0e42e33cc25879c6982cb940bc844ceb51be58d776e9be53fe5a177d", "0x024f9b5ca331b18817b9c7c678b8c7cc9dd2bedf01c1b12f72850167f6436115", "0xa411c160de6225a4e380a59653699b2feec222c0ca0d115d6cb3564a54f980f1", "0x52e1f27c8c1c81f74cd3b5fbd3acd7ac3b5ae1e58904491a1563847897727273", "0x3b078c0cacceb22ac4dbbf2f4a704c8f57c288e825d5aa9e279e5c97697f09b5", "0x45a6f836e30141b798a3a5261c8aea2c6daa22ec587ca06e7b85866b218d39ef"]
}

Condition 3

Block Gas Limit 100000000

TxsCount ExternalCall times Produce Block Time round gasUsed
1 50 5224 0 1,144,742
2 100 5528 0 2,289,484
3 150 5485 0 3,434,226
4 200 5393 0 4,578,968
5 250 5534 0 5,723,710
6 300 5652 0 6,868,452
7 350 5814 0 8,013,194
8 400 5766 0 9,157,936
9 450 5915 0 10,302,678
10 500 6111 0 11,447,420
15 750 6572 0 17,171,130
20 1000 6882 0 22,894,840
30 1500 7402 0 34,342,260
40 2000 8295 0 45,789,680
50 2500 9159 0 57,237,100
60 3000 10143 0 68,684,520
70 3500 16381 1 80,131,940
80 4000 19020 1 91,579,360
90 4500 21000 1 103,026,780
100 5000 26338 3 114,474,200
110 5500 37835 4 125,921,620
120 6000 48551 5 137,369,040
130 6500 76052 5 148,816,460
140 7000 75195 5 160,263,880