From 612192cf86743b159659ce382ac56076e2b045cb Mon Sep 17 00:00:00 2001 From: jangko Date: Sat, 16 May 2020 13:18:05 +0700 Subject: [PATCH] block witness: switch uint encoding to uvarint LEB128 encoding --- .../1_keys_0_storage_extended_touched.json | 6 +- .../1_keys_0_storage_extended_untouched.json | 6 +- .../fixtures/1_keys_0_storage_simple.json | 4 +- stateless/fixtures/1_keys_1_storage.json | 6 +- .../fixtures/1_keys_1_storage_untouched.json | 6 +- stateless/fixtures/1_keys_30_storage.json | 6 +- stateless/fixtures/30_keys_0_storage.json | 156 ++++++++--------- stateless/fixtures/30_keys_30_storage.json | 162 +++++++++--------- stateless/json_from_tree.nim | 36 +++- stateless/test_witness_json.nim | 2 +- stateless/tree_from_witness.nim | 60 +++++-- stateless/witness_from_tree.nim | 36 +++- 12 files changed, 280 insertions(+), 206 deletions(-) diff --git a/stateless/fixtures/1_keys_0_storage_extended_touched.json b/stateless/fixtures/1_keys_0_storage_extended_touched.json index 807255e45..c34c1d63d 100644 --- a/stateless/fixtures/1_keys_0_storage_extended_touched.json +++ b/stateless/fixtures/1_keys_0_storage_extended_touched.json @@ -8,10 +8,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x720ef0ee74f1b3b8252eb3270d484b223f775810", - "balance": "0x3886e813098fc1b3ffd126f9497f5c570f82cfc0fb9b3466c8124a5e2cf3a133", - "nonce": "0x00000000000000000000000000000000000000000000000056dd64d09a2ac1ad", + "balance": "0xb3c2cee7e2cb9289c8cdd1d9b99ff0e7829fdce2f5afd2fca6a2ff9f9bf8e38493d09bc403", + "nonce": "0xad83abd1899ad9ee56", "codeType": "0x00", - "codeLen": "0x0000003d", + "codeLen": "0x3d", "code": "0x09ddefda93a915fe9ac8998e195a5fe0bb85a2474e676551e8978cba5b5ea3af0dc90606fd0e6d4f07b0262ada94b579676f51e4226b2dc456be061e99", "storage": [ { diff --git a/stateless/fixtures/1_keys_0_storage_extended_untouched.json b/stateless/fixtures/1_keys_0_storage_extended_untouched.json index 75bce3f39..bddc4cb0d 100644 --- a/stateless/fixtures/1_keys_0_storage_extended_untouched.json +++ b/stateless/fixtures/1_keys_0_storage_extended_untouched.json @@ -8,10 +8,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x205aea15c1e739b4acdae0cc3b57c34f55907a73", - "balance": "0x674f431a1b20188b16000137d50ed2d4a2bb921f43bbef4d099250163c42528c", - "nonce": "0x000000000000000000000000000000000000000000000000cead972e584734a3", + "balance": "0x8ca589e2e38294c9899abddfbbe887c9bbc5d296eda1f59b8180d8d88883c88d9a86bdba06", + "nonce": "0xa3e99cc2e5e5e5d6ce01", "codeType": "0x01", - "codeLen": "0x0000005e", + "codeLen": "0x5e", "codeHash": { "nodeType": "0x03", "data": "0x8dd74346f58c605477239378ca66f42e8a75b9cc8aea3287ad30c8a5932a92da" diff --git a/stateless/fixtures/1_keys_0_storage_simple.json b/stateless/fixtures/1_keys_0_storage_simple.json index a17a869a7..8c9de7f12 100644 --- a/stateless/fixtures/1_keys_0_storage_simple.json +++ b/stateless/fixtures/1_keys_0_storage_simple.json @@ -8,8 +8,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77", - "balance": "0xe8b24dc9385b1dcad704974b2ce4ede595594dd70d72de713c2ab7ff3e31fc0c", - "nonce": "0x0000000000000000000000000000000000000000000000005eb7a6f01f20fa63", + "balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e", + "nonce": "0xe3f483f981dee9db5e", "debugDepth": "0x00", "debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4" } diff --git a/stateless/fixtures/1_keys_1_storage.json b/stateless/fixtures/1_keys_1_storage.json index 9c2ca786d..d98aa938b 100644 --- a/stateless/fixtures/1_keys_1_storage.json +++ b/stateless/fixtures/1_keys_1_storage.json @@ -8,10 +8,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x2a425b119d8bfa8fdb9852f731aaacec27ea76b1", - "balance": "0xc658f54abbd8739eca0f2067116e395edfc3d2961af34a4e42c261ab28776a6e", - "nonce": "0x000000000000000000000000000000000000000000000000d69f8b58337e75e5", + "balance": "0xeed4ddc3b2b598e1c29ca99aafc3a5e9c3bffbcae3adc4b3a09ea8f6b98ef6ddcaeae3b20c", + "nonce": "0xe5ebf99b83ebe2cfd601", "codeType": "0x00", - "codeLen": "0x00000040", + "codeLen": "0x40", "code": "0x3841c4b026645417401c750b610b3571de8fa8c219933057df4d1b890091a67b2480d3e07459bfa475156f691e0c56c2558c3d01370d15b7f5ceb6f672770899", "storage": [ { diff --git a/stateless/fixtures/1_keys_1_storage_untouched.json b/stateless/fixtures/1_keys_1_storage_untouched.json index 989b05c9b..0959d8162 100644 --- a/stateless/fixtures/1_keys_1_storage_untouched.json +++ b/stateless/fixtures/1_keys_1_storage_untouched.json @@ -8,10 +8,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x1f6d2e14d36e46ed0ffd4bc8f7a99c215c37a987", - "balance": "0xafa0c589b3bfba6603024d4a891fdc82ed2f3b366224536aa7096f700d7f61b9", - "nonce": "0x00000000000000000000000000000000000000000000000011b728ae6a01f54f", + "balance": "0xb9c3fdeb80eedb84a7d5cda2a2cccd9dafda8be4fda3a2a5cd848cb0a6f7efd9898b83fd0a", + "nonce": "0xcfea87d0e695cadb11", "codeType": "0x01", - "codeLen": "0x00000042", + "codeLen": "0x42", "codeHash": { "nodeType": "0x03", "data": "0x8617fb2d49a06427c5982b03b581f1c7c9bfa7ab4da2e67ca665f21ecc2f70f4" diff --git a/stateless/fixtures/1_keys_30_storage.json b/stateless/fixtures/1_keys_30_storage.json index bd896e236..434228b81 100644 --- a/stateless/fixtures/1_keys_30_storage.json +++ b/stateless/fixtures/1_keys_30_storage.json @@ -8,10 +8,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x06852d62c3a302f0cec4a92908f1040f6c1a9357", - "balance": "0x00f2eb881340b5631ae774251783b5bd8404433c01c1c91694616140350c5ef5", - "nonce": "0x000000000000000000000000000000000000000000000000aa9a63db44f791ce", + "balance": "0xf5bdb1a883a8d8b094ada48e9c80cfa18488f6adbbf0c592f4ceeb98d696d08988d7cb07", + "nonce": "0xcea3dea7b4fb98cdaa01", "codeType": "0x00", - "codeLen": "0x0000001a", + "codeLen": "0x1a", "code": "0xd0936ffd3b2a2867f12c8251f72b4997b3080d0f168d34860cb8", "storage": [ { diff --git a/stateless/fixtures/30_keys_0_storage.json b/stateless/fixtures/30_keys_0_storage.json index 83fd3cf1c..15afb6e10 100644 --- a/stateless/fixtures/30_keys_0_storage.json +++ b/stateless/fixtures/30_keys_0_storage.json @@ -20,10 +20,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x7e82a56264733a213ffcdd5a218bd999da849257", - "balance": "0x7a996af814a77977c7b3d42148cd269a32bb27322aa2ed63914fd1bcff6db423", - "nonce": "0x0000000000000000000000000000000000000000000000006d2722840f6e0831", + "balance": "0xa3e8b6fbcfb7f4a791c7b597aac5cc93bbe5e8b4d299d290d4e79ebe97efa98af8d5e5d407", + "nonce": "0xb190b8fbc0d0c8936d", "codeType": "0x00", - "codeLen": "0x0000001c", + "codeLen": "0x1c", "code": "0x55ef5ace99c1023203252cdf1ffa0bb23ac3d37a1eba1da733ee43ab", "storage": [ { @@ -38,8 +38,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x5e3eea97a4565105f98032ef418d883eef902a1f", - "balance": "0x336e794c749fc3b0bba22203e21feb61ce3bff14bd30b3b985a8d39e51c848b5", - "nonce": "0x00000000000000000000000000000000000000000000000003942097698394e2", + "balance": "0xb591a18ee5f3b4d485f3ce85d397c5ffbb9c87dbfec3f881a2c4ee85bbf8a7baccf2b99b03", + "nonce": "0xe2a98eccf69288ca03", "debugDepth": "0x02", "debugHash": "0x0df000b5883e85bfc2bd0f2af715b607a3c8201065719beb4b0f3576cf42954a" }, @@ -47,8 +47,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x4e53d140f9555fba626103f37741849fa64e9de1", - "balance": "0x14843bee6b32132a814a3e1907fd5ed22b1154af1f955adadfb14208bf556e7b", - "nonce": "0x000000000000000000000000000000000000000000000000a8f6930d79cb1972", + "balance": "0xfbdcd5fa8bc1d0d8dfb5ebaaf9e3abaa91d6c8f6d5ffc18cbe9485d4b2c2ccb5eef790a401", + "nonce": "0xf2b2acced7e1a4fba801", "debugDepth": "0x02", "debugHash": "0x589041613b78de52cd96f1e7defa29a80f9fb58001bb757f33a31ba86f1a2838" }, @@ -62,8 +62,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x8c095521efe5fa9541e286f4747ea2153c0c6e87", - "balance": "0x5c0e53967216c54751c70e978506f3c140d54170b760572e2e0316b65afeed22", - "nonce": "0x00000000000000000000000000000000000000000000000098b40acc694abbfd", + "balance": "0xa2dafbd7e5d6c581aedcdc82f696dca0d581859eefa0e1cb8e8ec7bad4d885b996a7b9e005", + "nonce": "0xfdf7aacac6d982da9801", "debugDepth": "0x02", "debugHash": "0x1010d6c54f31785bfb342a7baac249957fefd79fef1c691f51f2c90a8cd28a82" }, @@ -71,10 +71,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x0d9a1172cfdfc7cb8db0ebf9c74f8bc816d1594f", - "balance": "0x99c1043ba3a27edd0d2d43778b7d7e8e133b07a8ef67578cc8e235c5750d7902", - "nonce": "0x000000000000000000000000000000000000000000000000026b039d7097e282", + "balance": "0x82f2b5a8d7b88df1c899debaf69dea83bba6b8f4d7efe2bbc3dab4e8edcfe8d1bb8884ce09", + "nonce": "0x82c5df84d7f3c0b502", "codeType": "0x00", - "codeLen": "0x00000071", + "codeLen": "0x71", "code": "0x7fac9431579dea7e21b894993c8eace8238fe594ce4de5ba6b17dbe4059c9c0ac7ccdeb5cb8dc7d4b8535832c5e1a01001c200ac8c14fc3a6085cd45bd178f094746ef5bd2f2b07782b1a92c120e7e994699001e2c7127a91df8c18a8f118bb3c6b7f8c7f14916ec94726ade5756f4e692", "storage": [ { @@ -98,10 +98,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xffa97a82be3512beda8de06865e8ca5a9c7f86a8", - "balance": "0xd30216f2d3c1de0896abc818b50323291ab1d90b440287d77c19cf5f4989d022", - "nonce": "0x0000000000000000000000000000000000000000000000007a53c2ec2e343bdd", + "balance": "0xa2a0a7ccf4ebf38cfcae9f94c0e8c2ecb1b5a499b2a0ad8cc8d7dac4e0bbf0e9f2ad88980d", + "nonce": "0xddf7d0f1c2ddf0a97a", "codeType": "0x01", - "codeLen": "0x00000035", + "codeLen": "0x35", "codeHash": { "nodeType": "0x03", "data": "0x287a92b81f6a48744403ad694e309b7e06865b02685644bfcc739afb46ee0cf8" @@ -122,8 +122,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x2b2e60e1321308f0ca88b430a0a8882a7f2c804c", - "balance": "0x76ba25e0249aa3e5a09162de83e52812d33226d53d751e4d22fb8d549d49447b", - "nonce": "0x000000000000000000000000000000000000000000000000fcd7c6c2b6339f49", + "balance": "0xfb88a5eac9aae3fda29af9a8d7a7b593b2a6cbc0d2fca0efe2a282adbed4a692e0cbe8b507", + "nonce": "0xc9beceb1abd8f1ebfc01", "debugDepth": "0x02", "debugHash": "0x114ead6a99a020b05538a991a984997dbb7ae5587f666a84d549cf8bf3fe0569" }, @@ -131,10 +131,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x200bf417f0def72a080fcab1ffa05d2830e688cc", - "balance": "0x3633b28bd1f4cae4b3f74ce2003fb880baf8b8bb7bbda8c506cfc9725aba272e", - "nonce": "0x000000000000000000000000000000000000000000000000ff1d12045bd27104", + "balance": "0xaecee8d5a5aef2e7868aa3edbbefaedcf8f582c4fb8780f1cceecfa5ae99fde88be5ceb103", + "nonce": "0x84e2c9dec5c0c48eff01", "codeType": "0x01", - "codeLen": "0x00000000", + "codeLen": "0x00", "codeHash": { "nodeType": "0x03", "data": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" @@ -152,10 +152,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x21650b3a41a04a687a787e7699c1e9154204dd72", - "balance": "0x57b969d83662950a310763db21087b5a76e7e61f61345765c7e75887136e7d00", - "nonce": "0x000000000000000000000000000000000000000000000000f6a5ca0b25d1fccf", + "balance": "0x80fab99bf190d6f3c7cbdda293ec87f3e7ede9da87a1c8ede38ec4d1d0d2989bd8d3e5bd05", + "nonce": "0xcff9c7aeb2c1f2d2f601", "codeType": "0x00", - "codeLen": "0x00000074", + "codeLen": "0x74", "code": "0x8846e1571b671559b35c69c83a21b831fac866552aa0f9bcdafb892aa1dfc3d630e4bc04b06968d8efb0801884df61f5f433e5f98e8b3f37c333f531559079868e0d4b1676007477857548c83c902cdd86889a6f75050e9e5e4cf545979dd333616b3d3d38ea4585df4123fcf416f1d7922d8f1a", "storage": [ { @@ -170,10 +170,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x9bd73033c374e374b0c377a5230ba96d2ac74acb", - "balance": "0x960ae12bb73a686670bdd8d3cd66080512ff4590d718f4f9c2352138519902a7", - "nonce": "0x000000000000000000000000000000000000000000000000d9e97b56137ad0b0", + "balance": "0xa785e48c85a7c89ac2f3d3c7f19ae4a2ffa594c0e0acf3e9d8fbc2b386cdcedbabc2abb009", + "nonce": "0xb0a1eb9be1eadef4d901", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x03", @@ -193,10 +193,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xa4339d77b9e78b3da6c525dabe94361d359accb7", - "balance": "0xb191545ded54a11de9ef20cb4381a0cd0b4bda7ffa800dd9965dc41fb572fbe1", - "nonce": "0x000000000000000000000000000000000000000000000000131df77292d94f76", + "balance": "0xe1f7cbabfb83f1ae96b3b780a8ff9fedcb96b4869af0d0e5a0dea7ef9194d5f6dda8c58c0b", + "nonce": "0xf69ee596a9eefd8e13", "codeType": "0x00", - "codeLen": "0x00000073", + "codeLen": "0x73", "code": "0x81e13a7f3dac825c46ae3d5c78183347460a5be6d6c74a6db406581a1c768e8ca6956037a767bbb646f52acfccbe7df13fb547df5421b9ef338d975cbbd1ae1c7b30660941f380bc70c4129f9164e017082f13ef5e5c4d20b27131e1dfd3028a48ab165ccdd73d497a2be10c1dea936badba90", "storage": [ { @@ -211,8 +211,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x25fbbd3025c0d58df78959aa62625df228accae5", - "balance": "0x44d58eadc6a2d9b12f597cc2d3662b91115728c1bb8fc9c31008901d479badc3", - "nonce": "0x000000000000000000000000000000000000000000000000eef0145fb3f6f91f", + "balance": "0xc3dbeebcd483a4849086a7feb8b7b094d7a2c4dce2ecb4e1fcb2bd899bdba8e3ad9dd6a604", + "nonce": "0x9ff2db9ffb8b85f8ee01", "debugDepth": "0x02", "debugHash": "0x3d1eb4951424196849d3fb044c0f7fb6fc8ec6535df8b43f66bb42115a2ffe30" }, @@ -226,10 +226,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x5a82d40f3a15434eca11825c21b250e4a795526a", - "balance": "0x364e2cd28cc9f90c50f6a07bfed7b37a6cf2039a56d81f3b9504c30ce4fe44bb", - "nonce": "0x000000000000000000000000000000000000000000000000ba3bd4c614bfbdc2", + "balance": "0xbb89f9a7cee1b08295f7fcc0edcae681f2d9e99bfbdaffbda0edc3e290bfb2c6d2d9b8b203", + "nonce": "0xc2fbfea5e198f59dba01", "codeType": "0x00", - "codeLen": "0x00000023", + "codeLen": "0x23", "code": "0x491b0781509547a5312567a6cf15f01c2722df7b30bfbc92ffd323acbeafb470c144fd", "storage": [ { @@ -247,10 +247,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x68350d559adf571cb37c531f8ff3adbda04575f3", - "balance": "0x94cd8525745598d904117172a0d33690441886b533553787e53ca07d115573af", - "nonce": "0x00000000000000000000000000000000000000000000000038a498c239cda654", + "balance": "0xafe7d58ad18fa89ee58fdea9b5a6adc39888c1b4b39aa8b9f1a290c88db395baa58ab6a609", + "nonce": "0xd4ccb6cea398a6d238", "codeType": "0x01", - "codeLen": "0x0000002d", + "codeLen": "0x2d", "codeHash": { "nodeType": "0x03", "data": "0xb8c8feb51d228c6228d812f867798c339f275abb0caa7b287b84d5cda7628190" @@ -268,8 +268,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x3d90a6de4db54512c71781c5d69d945034f86a85", - "balance": "0xd34ffe707adf22f44323368c1e8ca97f9d141ec4f1ee601f869441aa4adc86db", - "nonce": "0x000000000000000000000000000000000000000000000000f17537ccd90e2f95", + "balance": "0xdb8df2d6a4b590ca86bf80f39e9eb18f94bafecbcad187c6b6c68ca2afe4b7bdf0fcbf9a0d", + "nonce": "0x95dfb8c8cdf9cdbaf101", "debugDepth": "0x02", "debugHash": "0x1492b6fd1a6655bb8c6bc0b89b36308316d6d15edb78e0f1edc213dc6d30bb5b" }, @@ -283,10 +283,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x8659163d026652d6e1f7ca0661222619f337e77c", - "balance": "0x7eff258e7b0dfcaaaa5419c85949262e32adbaa32c34d3487eddb2a7f474d25f", - "nonce": "0x000000000000000000000000000000000000000000000000be47a48eddea262c", + "balance": "0xdfa4d3a3ffd4eceefe90cda6c3e5a8ddade5b8b192a996e499a8a9d5cabfc3bd8ecbfcf707", + "nonce": "0xaccca8efed91e9a3be01", "codeType": "0x00", - "codeLen": "0x0000005a", + "codeLen": "0x5a", "code": "0x361e7dec35956b2930c232cd6eace370710e5699a1ba8149ac1ebe4d6cbeb6a72c7c4563cc02e1779618c9f9b9b60651d70d2c0789b2b2d729582822243a2e31f74f7ec9c2e23ffa9477b73291c913f46a54d70100d420c6a55f", "storage": [ { @@ -301,8 +301,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0xb2adbc8a2593561d490c3e9ae84971b1805f9458", - "balance": "0x5d9c6977f519b3797627af18dfff6bea347dcc68e105a36e8ab713a59308623c", - "nonce": "0x00000000000000000000000000000000000000000000000081d4f5e66b298aa6", + "balance": "0xbcc4a198d9f4c4db8add8dad909c9ae6fde8a8dff6ffb78cafcfd8cbb7b6c6faf7d2f1ec05", + "nonce": "0xa695a6d9e6bcbdea8101", "debugDepth": "0x02", "debugHash": "0x7d7e4c6477332ec28b116e0e45f64c89a193bc7be23b6f59f3842b0ee9fdbec1" }, @@ -316,10 +316,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xc61222cc7e65887ce773e993a802d66d94bba0f9", - "balance": "0x9481d26d0343af16b122f092d43ffe9c7d7aef384cf5aea7406bd7032b22aecb", - "nonce": "0x000000000000000000000000000000000000000000000000959aeee7a10fa078", + "balance": "0xcbdd8ad9b2e0f5b5c0cebaadcf89cef7fafaf1f4ff87b5c9f0c5c4b5f1f5d081eda487a409", + "nonce": "0xf8c0be88fadcbbcd9501", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x02", @@ -336,10 +336,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xe611fcf90e8484fd09f0cfd38bc53c82b006dd9e", - "balance": "0xf54b9cde0dcc5a86826e759b20905edfcfd2228be5830668260929caf78fde9c", - "nonce": "0x00000000000000000000000000000000000000000000000083582adca31e212a", + "balance": "0x9cbdbfbcafb9ca84a6d09998d8fca291d29ffff68592c8cdf5dc89b4a88bf386deb9aeaa0f", + "nonce": "0xaac2f898cadb8aac8301", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x03", @@ -359,10 +359,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x125324c1125eea8cbfe6c6417b5db7d0213b07d0", - "balance": "0xb86d1d159ee22193b274a5b06d94aba8c5ecdc9510ccd36ecf7797ca7659c553", - "nonce": "0x00000000000000000000000000000000000000000000000083c85c39ad2920d9", + "balance": "0xd38ae7b2a7f9e5bbcfddcde68ca2a5eeec8ba3ddcab29bd8a5e9c99d99c4b8cf95bab4c30b", + "nonce": "0xd9c1a4e99a8797e48301", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x02", @@ -379,8 +379,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0xfb3ead2e001376237f144fb21279ded073a795dc", - "balance": "0x0d70edda29b2098aad3801323234b3c358dbe4147850b8b34041963955fffed0", - "nonce": "0x0000000000000000000000000000000000000000000000000787d3d3895f4377", + "balance": "0xd0fdffaf95c7e5a0c0e6e285858f85f2dbb18d9ecbc68c9981f0b4d598c1ec94dadbc36b", + "nonce": "0xf786fdcab8faf4c307", "debugDepth": "0x02", "debugHash": "0xf212c3dc84a139f1a38077a337a3b16da4837d4c0e3e62b7265a08c9040f6dae" }, @@ -394,8 +394,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x6bfbdf61b0350adf2d9bfb95566b9a44ff8498a3", - "balance": "0xf62e9889bbe10e664356c68d932b2a774f3cd5db824055bd4d581f4e1eeac94e", - "nonce": "0x000000000000000000000000000000000000000000000000e67976bc191b0aac", + "balance": "0xce92abf7e1e987accdfad682a4f0f6eabc9eddd3b2e5e4c6c6ad8db2e6a1f8dd89b1bab10f", + "nonce": "0xac95ecc8c1d7ddbce601", "debugDepth": "0x02", "debugHash": "0xc0c71493b2cdf9344b47c525ac7abb6f0f3737dcbd352df4166008f6da889842" }, @@ -403,10 +403,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xf6bdbc998413b9aba0ad47481126f04652f174a9", - "balance": "0xf4ee476b3cb0b4895fa5bbe20fd88627ebf0cb56dab9455403df489c6ac2e2c3", - "nonce": "0x000000000000000000000000000000000000000000000000bcd7ce50c8df728d", + "balance": "0xc3c58bd6c693d2ef83a895caabdbd5e5f0d79fb188fb83f1bbcbfecac896ac9eeb8eb9a70f", + "nonce": "0x8de5fdc68ccaf3ebbc01", "codeType": "0x01", - "codeLen": "0x0000001e", + "codeLen": "0x1e", "codeHash": { "nodeType": "0x03", "data": "0xdc480c80186f0489d6fa64a296dbd719668fa828c2049ba669219cf219a792fb" @@ -427,10 +427,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xed0747eab87cddcbcfed24fc0b4efad5f42850aa", - "balance": "0x0e6840571ef8a7306721837df0d6328e2cf5bfe6309e4112969c9509d83cfee2", - "nonce": "0x000000000000000000000000000000000000000000000000ca5808221a874337", + "balance": "0xe2fdf3c19da1a5ce96a584f289c6f9dff5d9b894e39afcbe83c39c83f394be8fd780a173", + "nonce": "0xb7869dd4a18482acca01", "codeType": "0x01", - "codeLen": "0x00000000", + "codeLen": "0x00", "codeHash": { "nodeType": "0x03", "data": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" @@ -457,10 +457,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x6237190cfd2f7a51e4ef8da5dd65b740e7b9d2b0", - "balance": "0x5335b6b3adf67c9080458f6cd38c95356fec2a89f5140c76dd4b6153f1d5577b", - "nonce": "0x00000000000000000000000000000000000000000000000069339d5594ad24ca", + "balance": "0xfbaed58ebfaad8a5ddedb1a0d1bea295ecdfd5a9c9f1b4b68f8b8184c9cffdd6b3edd69905", + "nonce": "0xcac9b4a5d9aae79969", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x03", @@ -474,8 +474,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x73d940cb1e6963a1234c2ae1ebae388cbfc6666c", - "balance": "0xc4a565bc992ed6d9c615f66991e03e640a4b7aa31ed2bc809735ecf556aa0c31", - "nonce": "0x00000000000000000000000000000000000000000000000070c6412714045596", + "balance": "0xb198a8b5d59efb9a9781f295ede3a8bdcb9490f383bce4b4f6ab98ceeddacbccbccb95a50c", + "nonce": "0x96ab91a0f1a490e370", "debugDepth": "0x02", "debugHash": "0x044e8b1beeda914bdf5cc888275af44de4517204745111d4feb8f755fdf8ce05" }, @@ -489,8 +489,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x7c55aa59700a5ef1440452f6a6e97af67796fc63", - "balance": "0xcad867521873bbc7e9726ee7b5fc8fdba32c59896e774651462c22eb20897611", - "nonce": "0x00000000000000000000000000000000000000000000000055b8eed400107543", + "balance": "0x91eca584b2dd8896c6a299bae7ade2acacc6eefec8bfedf3eee4a5bfbcf79c8cd2cee1d60c", + "nonce": "0xc3eac180c0dabbdc55", "debugDepth": "0x02", "debugHash": "0x33b835c937442c856fdfd5a0f9ca61e57b50359ac4551d70532db20ee3d7aa63" }, @@ -504,10 +504,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x66c622e5d6fb2aa939459dd2092f09fdc4a9bc89", - "balance": "0x06f0874e47e3b7393a99393c7fcc7bbc1bdeed97bc945891512603c1e3a0ba3b", - "nonce": "0x000000000000000000000000000000000000000000000000ef3ab2cf98149b1d", + "balance": "0xbbf4829d9ef88093d1a2e2a2c9f7e5f6deb7f0ddc7f99f9eb9b2eac9f3f6f8a3ce8ec237", + "nonce": "0x9db6d2c0f9d9ac9def01", "codeType": "0x01", - "codeLen": "0x00000000", + "codeLen": "0x00", "codeHash": { "nodeType": "0x03", "data": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" @@ -525,10 +525,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xfeac1e36a9ea61bfa477edf9193312e11e9211a5", - "balance": "0x2aa68f0d65af5a06a82d2178d8c4bb77a08ead6d891bf530f9e74f685dd32bc0", - "nonce": "0x0000000000000000000000000000000000000000000000007394e2b20ca1af9e", + "balance": "0xc0d7ccee85edd3f3f9e1d4df91b1dbd68ec1dedbcb98b6bca1daa0b5a0ebebb28d9e9ad502", + "nonce": "0x9edf86e5a0d6b8ca73", "codeType": "0x00", - "codeLen": "0x0000005c", + "codeLen": "0x5c", "code": "0x2e12ba0c7dbbf09e0ef55fb3e40fcaf5c46d36a0fee73c811443f9a6126e3ea2b8d251dbeb47e5366b7e6e89ce4a7c21026523942f8fc0b707122c6ab170422a2419444ba035d710825b6e2a8a687678dd01fb23fd259020863e155d", "storage": [ { @@ -543,8 +543,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x6b786876ea119d95258e9f4b11a08c6f18a20721", - "balance": "0x2140038c63f3e9b1262fb3e5c3e74a3078b8fd6b6c2b366be58f7166a4637fb7", - "nonce": "0x00000000000000000000000000000000000000000000000050daf04f68841116", + "balance": "0xb7ff8da3eaacdcc7e5d7d9d9c2eddafeb8f1c1d1f4fcf0f2b3df98899bfdfcb18c87808a02", + "nonce": "0x96a290c4f689bced50", "debugDepth": "0x02", "debugHash": "0x978e501b6422b28254c8bddb760622c0eea111ee008a915481b48aaa986426a1" } diff --git a/stateless/fixtures/30_keys_30_storage.json b/stateless/fixtures/30_keys_30_storage.json index 5c7c80c05..45ca7f9a9 100644 --- a/stateless/fixtures/30_keys_30_storage.json +++ b/stateless/fixtures/30_keys_30_storage.json @@ -20,10 +20,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x9778e7c07b6ce13d655e5c841d817b24a915efa8", - "balance": "0xb145fe44a412e44e195f76eb0e3fe06cc5251865c3deb2398d1b791e336b687d", - "nonce": "0x00000000000000000000000000000000000000000000000022c66d3dedd3ec3f", + "balance": "0xfdd0ad9be3a3de8d8df3c8f5bdb8998ca58ab383fec7c3f5f6bee5f0c4dc84d2c4fc978a0b", + "nonce": "0xbfd8cfeedea79be322", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x00", @@ -315,10 +315,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x98dbaf5b8dc8774ea0939c6855d7359bbe11c90c", - "balance": "0xd7d57ce05eb0b3a7fb952cf710bf038e0f97302395d83afb525923e7f52634e0", - "nonce": "0x000000000000000000000000000000000000000000000000f35528f0d244bf29", + "balance": "0xe0e998a9fffcc8acd2f6ebc1ddf28898979fb89cf097c4fbacaaeebfba96acafe0f9d5be0d", + "nonce": "0xa9fe92928d9ecaaaf301", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x00", @@ -611,10 +611,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x2584609905e5fe526fd97dab09e51aaaa8fd98af", - "balance": "0xf189c554b73b67691dc0e95cde9cba6d8e6ee858a5c6e68accd66d77c0228a86", - "nonce": "0x000000000000000000000000000000000000000000000000a4becf157a7fd70f", + "balance": "0x86958a81fcae9bebcc959ab7dc9496f4ee9cb6d3cbd3b7aee981f7c8f6eccedbd48aa78c0f", + "nonce": "0x8faeffd3d7e2b3dfa401", "codeType": "0x01", - "codeLen": "0x00000000", + "codeLen": "0x00", "codeHash": { "nodeType": "0x03", "data": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" @@ -928,8 +928,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x2597dda4860fc4c24a0a8a5d99b83842779933dc", - "balance": "0xf4ebffd5cb09ecb4fc9a636da1efec0391af53f3be88a3b6e894b105db9f163d", - "nonce": "0x00000000000000000000000000000000000000000000000019e9fcfb33cdeb5c", + "balance": "0xbdacfcdcdda0accae8ed8ec5e8f7fca9afa38ee0febde8b6e3b4f2a7cbbdc2e5d5ffafa70f", + "nonce": "0xdcd6b79eb39ffff419", "debugDepth": "0x03", "debugHash": "0x2d165b2deb3c2f29c63ed2ed384100fd33a6988cb418f89fcb28c6ceaeb79b90" }, @@ -943,10 +943,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x3fac75bc4028066e43d06fe16174213be1190819", - "balance": "0x507eda9ecee2608afb4676e412d342f96fc2a0ecc5c2552e1109709a65c47772", - "nonce": "0x000000000000000000000000000000000000000000000000b5ca24bd99384670", + "balance": "0xf2ee91aea693dc8491dcd492dc98bbd0c2dfe597b4da84f2f68cedd788ccb8e79eb5fb8305", + "nonce": "0xf08ce1c9d99789e5b501", "codeType": "0x00", - "codeLen": "0x00000032", + "codeLen": "0x32", "code": "0x8b9ccebdd2452e3e4e9964adc51e039db23221fba6ad8bc58f84fec8ee2556be43d7be6e87ca81f0cd38b33e768cb5673f8d", "storage": [ { @@ -1265,10 +1265,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x93ac420a70f0f7e34d9cfdd9e79de8d0125f4c3e", - "balance": "0x3b69dadb7e1a7ec3de9e6b995bff8fca43a7fdcd700b5282f72415b94513dc22", - "nonce": "0x00000000000000000000000000000000000000000000000004177e3c40a79556", + "balance": "0xa2b8cfa894b78592f785cada80aef3fea787a9fef8ffd6ccebbcfa9eeccf86bfdbb5a7db03", + "nonce": "0xd6aa9e85c4c7df8b04", "codeType": "0x01", - "codeLen": "0x00000015", + "codeLen": "0x15", "codeHash": { "nodeType": "0x03", "data": "0x23498601ddd86ed9ff9dba5e3cb583dc45233d3788d2264537136284e347cea4" @@ -1286,8 +1286,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x62cf6597d7a4467b8882612f35f9ee5dc64cb1d4", - "balance": "0x4173e49529575d85e3ef146b9d6a867ffbee5bc9006fc864d4907eb89fcdf5a1", - "nonce": "0x000000000000000000000000000000000000000000000000a18542b2649b6b07", + "balance": "0xa1ebb7fe89d79fc8d4c9a1fe86a0f2adeef7ffb3a8ade7b594de8fafd8ebd59495c9cf8b04", + "nonce": "0x87d6eda4a6d6d0c2a101", "debugDepth": "0x01", "debugHash": "0xa6c68ae3207032d9803e400141716d97d30c6dff75593a434189b7536236e825" }, @@ -1301,10 +1301,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xc5a49553156ece311959c6b5f3fbb07e420189ee", - "balance": "0x7c04d7e45e69cd903867b5b07351a47063e99f8d648bb9f6b160f86aa65e8950", - "nonce": "0x0000000000000000000000000000000000000000000000003c7c3711f7cdd212", + "balance": "0xd092fab2aa8dbeb0b1ede7ddc8ace3cfe9c7c1a39aea9cd8b5cfe181d9b99aafe4af93e007", + "nonce": "0x92a4b7be9fe28dbe3c", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x00", @@ -1614,8 +1614,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x03aecb7651ed1438e4a843b689a02b263b7ea4bb", - "balance": "0xd6401dd76665abac687ce482e03c8ba4ade357a409cb529819e28b7e8b443478", - "nonce": "0x000000000000000000000000000000000000000000000000037f678546a9defe", + "balance": "0xf8e890dae8efa2f199b0cada9c81e9abe3db92ddc887b8c1e4f9a1e3bab599b3d7bb80b20d", + "nonce": "0xfebda7b5d4f0d9bf03", "debugDepth": "0x02", "debugHash": "0xbd6bad472a3d724b807b3130e3c28c0e783b4b70e32685a710a6d4766ffe1276" }, @@ -1629,10 +1629,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x7c72d706df495e340460dc6e3861d722fdfbfcc9", - "balance": "0xd220937e7c1d74f69c601427b4a086d745ff4426bc095d7c3ec804e69b827f54", - "nonce": "0x000000000000000000000000000000000000000000000000ad3ad9ec20962447", + "balance": "0xd4fe89dce99c81e4bef8f5cac0d789a2ff8bddb68894ed9394c0f1b4cfae87befea682910d", + "nonce": "0xc7c8d884c2bdb69dad01", "codeType": "0x01", - "codeLen": "0x00000000", + "codeLen": "0x00", "codeHash": { "nodeType": "0x03", "data": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" @@ -1650,10 +1650,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x5b0c9f2dc9e276044228585c70d77f1b1e54d2ae", - "balance": "0xab6529d42abff8c81dab652737b4323adc0434f280ca85e0577df1f84878d66f", - "nonce": "0x0000000000000000000000000000000000000000000000001f9bf2e9d412eb9d", + "balance": "0xeface3c384bffcbed7c097d48cd0bc9a84b8eb91c3f6cd93e5d6f6c08cffaf95d4d394db0a", + "nonce": "0x9dd7cba09dddfccd1f", "codeType": "0x00", - "codeLen": "0x0000007c", + "codeLen": "0x7c", "code": "0x85cda91d26c9865833e9cfc0eee476fae47dfd56a90b0b2dffbcb5639bd67271642f5fa86ac23f0e4a7ae12bb86b3b9863393ffd1d198f1bb72680045e9ac1e6f7e686ccb3ed77227ddbef33f94398db5b19dbc8d9d8569d6d1ec1a7fa2205e62b2c5a470ae8620051c8097aec2e4d970661a5383984492c68f54f38", "storage": [ { @@ -1674,10 +1674,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xdcf2269fbdd13cbcea4ab83c253fd91f9c9234c7", - "balance": "0xf1baaeccde261412b08c9c9b368d48c2cdc9ebd3e17e80ebc56d1e153fad0e67", - "nonce": "0x0000000000000000000000000000000000000000000000004662e451e772d6cc", + "balance": "0xe79cb4fdd3c2c7b6c5d783f497fcf4f5c99b8bc6d4d1cdcd9c99c295c1c289efccddea8d0f", + "nonce": "0xccadcbbb9e8ab9b146", "codeType": "0x01", - "codeLen": "0x00000000", + "codeLen": "0x00", "codeHash": { "nodeType": "0x03", "data": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" @@ -1961,10 +1961,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xc63b86995cc1bd0c01bfb80ff3e6d3589cb83ba2", - "balance": "0x97f530b1ebbf88c37a784cb783e76871a9ff9b9fe57d58017057dabe7f2f8504", - "nonce": "0x00000000000000000000000000000000000000000000000093693ac1337d414b", + "balance": "0x848abef9e7d7f6abf082e0ead7fce7cdffd3c6c3f6fce0dbccf0e99b8cf1eff5b1e1d4bf09", + "nonce": "0xcb82f59b93d8ceb49301", "codeType": "0x00", - "codeLen": "0x00000090", + "codeLen": "0x9001", "code": "0xbf05532cfe1de725023395e2e1f8bd37bcd42e5cbd06b4e068dd77027bef07939bcad63b74f4e41a7713d52c939777836a020fb60af2cea885fff6ad77da4816a80ca10f8e7c0c4ec77c24ac474fffcd18bdc658ae56017d41b8dda186325cd945d2d4c327449b84c60187b1fc01835eac03c39fb4b227d616f243ccc0aed92b61cf2be2bbaf59aa3ced6c763c36a940", "storage": [ { @@ -1979,10 +1979,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x37f25e0f7d48b6382d09f822b574050e186b3640", - "balance": "0xf9c5b953ef16da7574401cd40b4ba053dbc29cdace37554c9cefdecb5c803d26", - "nonce": "0x00000000000000000000000000000000000000000000000041f5bcd8075216e2", + "balance": "0xa6fa80e4b5d9f7f79c99d5bae3d9b6cec2b7cf82bae982ea9c80d1aba7dbc5f7d3f296ce0f", + "nonce": "0xe2adc8ba809beffa41", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x00", @@ -2286,8 +2286,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0xb5138abb1e4d9c5db604b86b770e6d6e5451cb80", - "balance": "0xdd93c7426bdb7e92b0f30300a9cf4d45f2000bead788970a0b7022977812ccad", - "nonce": "0x00000000000000000000000000000000000000000000000098c5436323581b83", + "balance": "0xad99cbc0f7d288b88b94dcc4f8dafa8580e497eaf4b9aa8083e6c395e9eff6b5c28ecfec0d", + "nonce": "0x83b7e09ab2ecd0e29801", "debugDepth": "0x03", "debugHash": "0xd157d809860f62fb9098e78a08b7b249c08df0da8f1fb57b4e3357fb075b9881" }, @@ -2295,10 +2295,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xe448811bca560c51d35adf8f21c468bed3f867ac", - "balance": "0x2c635ce623515a6b4919191e68041769c5c46bab31418b835dca94e9cb53c942", - "nonce": "0x0000000000000000000000000000000000000000000000007cd01e0bf04c7939", + "balance": "0xc292cfda9c9da5e5dd86ae8c94e6eab5c48ba7bbc1809a8f99b2a4daa6abd491e6b98de302", + "nonce": "0xb9f2b182bfc187e87c", "codeType": "0x01", - "codeLen": "0x00000015", + "codeLen": "0x15", "codeHash": { "nodeType": "0x03", "data": "0x7e465fad9958600f50923e98a8b7837a38806ce1c930ed72a55d4fc45bcbcfb0" @@ -2316,10 +2316,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x996e4feef6d34c45724b16fe0890d8962373b758", - "balance": "0x96a578474de44e1faea4bc3904f86f917dcbca19557e09e01266e72a93539e40", - "nonce": "0x000000000000000000000000000000000000000000000000877bbed17601abf0", + "balance": "0xc0bcce9aa9e5b9b392c0a7f0d7aa86e5cbfbc5fc869fc19cbcc9bafde189f9a6c7f095b509", + "nonce": "0xf0d786b097daefbd8701", "codeType": "0x00", - "codeLen": "0x00000000", + "codeLen": "0x00", "storage": [ { "nodeType": "0x00", @@ -2623,8 +2623,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x724585a52f5680cf9032b235983e07375ae03680", - "balance": "0xe77f1f6285727d9e4e14dad9fae294bd22bde8fbeef2ea65362c5b815f4db06b", - "nonce": "0x0000000000000000000000000000000000000000000000008c959fd22816c865", + "balance": "0xebe0b6fa95f09696b6caa997effdbef4bdc5f4a5a9dcfeecdaa9b8f2d9cfdcc2e2befcbb0e", + "nonce": "0xe590dbc0a2fae7ca8c01", "debugDepth": "0x02", "debugHash": "0x06c48449255ac5e071c9f0ddf3264a2466cf42c43ca642a5b47267a8e4ac61fd" }, @@ -2632,10 +2632,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x3bc4c43af3c522427b7bb14bd66500b86c990aa5", - "balance": "0xca7b395b6967fcce10f5b4c429e142806e033f27727ab985ab5fd2bff6ff9959", - "nonce": "0x000000000000000000000000000000000000000000000000b3ac8b9dc43ed0cf", + "balance": "0xd9b2feb7ffd7f4afab8be6d5a7eec99f83dc819494bc8ae2b4ebc3f0ccffd9b4dbf2ecd30c", + "nonce": "0xcfa1fba1dcf3a2d6b301", "codeType": "0x01", - "codeLen": "0x00000018", + "codeLen": "0x18", "codeHash": { "nodeType": "0x03", "data": "0x534a40cbc0af7b3942b32a942ecdcdfc2187009e4b1a10a8a7662d2079ed445e" @@ -2659,10 +2659,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x47d6b7a05922529f2f459c6b4f90c8dc6e4854c3", - "balance": "0xe6f64a1c792445b398a19f2fcd2a6ebd6ce462c8c57056c93ba66a05c860b31b", - "nonce": "0x000000000000000000000000000000000000000000000000d26c7653eb14bfb9", + "balance": "0x9be682c3dcc09ad3bb92db82d798b2b1e4d9f5f5a6a5f3979fc3e29cdb88c9bc9c94d9b70e", + "nonce": "0xb9ffd2d8beca9db6d201", "codeType": "0x01", - "codeLen": "0x00000052", + "codeLen": "0x52", "codeHash": { "nodeType": "0x03", "data": "0x0695fd3aa1803a54e7b801137497c9b1384a577d9fa98890e0d773aa6646f4b6" @@ -2680,8 +2680,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x3844a8ed9faf6abaf2f997ff7c91538190b15bcb", - "balance": "0xc4ac1715d6dfd598903511ad0c8b40db19bd50d409571d0aa86ae62f2b584c35", - "nonce": "0x000000000000000000000000000000000000000000000000b483e727b4361422", + "balance": "0xb598e1daf2c5b9b5a895f4b89581b5a8bdb3ec86b491c3d691eac0c4d9fab7eb95aeb0a50c", + "nonce": "0xa2a8d8a1fbe4f9c1b401", "debugDepth": "0x02", "debugHash": "0x051866bf87791feb67613e6a4df2e3f98305187508d1321e8d0851800527e024" }, @@ -2689,8 +2689,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x5ef4b2ea37ea89c3cdf4977de5c8339ce17f659e", - "balance": "0xfc169ab61f880bbe52574b0a1d341c25c77ff2bf752d8486a4956184b1e390a7", - "nonce": "0x0000000000000000000000000000000000000000000000008721b28325bba7c9", + "balance": "0xa7a18e8fcbb0d8caa48d92ecd2eeaff9ff8e97e1c1a68785cbaec9f2bb81e28fb6b5dae00f", + "nonce": "0xc9cfeeadb2d0ec908701", "debugDepth": "0x01", "debugHash": "0x1579e585155014c0e682643b33569f5c79aa76e486845c435968aa996a7d9be8" }, @@ -2698,8 +2698,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x91a850dbf40a43113b3da5170a7cbe8f8a15e126", - "balance": "0x24482efb29b2a0f2fa3d9fa97ef0e4aee552337d13ffd0790aa9961b5f9d15c4", - "nonce": "0x000000000000000000000000000000000000000000000000932a349360f9d332", + "balance": "0xc4abf4fcb5c3e5d48af2c1febfa2df99d2cabba58ededfd49ffbe8978fd4ec94fbdda0a202", + "nonce": "0xb2a6e787b6928d959301", "debugDepth": "0x01", "debugHash": "0xd9302aa1333c3211729c26b2ec2e9feada720f43d8226d65d8bbe62a18aa5020" }, @@ -2713,10 +2713,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xb943a6d6f009f5c44cb04f455aba68177bb0cfe8", - "balance": "0xe081f9b3c7d8e27abba599df7b417e605488fae6290bc761ceaf3f7f8ca9e669", - "nonce": "0x0000000000000000000000000000000000000000000000000ef633aa2c29abbf", + "balance": "0xe9cca7e5f8efcfd7cec39dde90c5b9fd88a981f397e8deef99cbeed5a79cf6e3b3f387840e", + "nonce": "0xbfd7a6e1a2f58cfb0e", "codeType": "0x01", - "codeLen": "0x00000024", + "codeLen": "0x24", "codeHash": { "nodeType": "0x03", "data": "0x0328a45bf123177d32d8340501f91ef50d6aaf1e2d488752b49fb7d112e7e18b" @@ -2734,10 +2734,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xe8e9736b328369d09bdf324ccb7e79cf54aa4d19", - "balance": "0xe438280b53709036bf8a6635186e2d72adf55f04cc3ebdee15a9f0b0337cdb4d", - "nonce": "0x000000000000000000000000000000000000000000000000ba4fa84dc8ac50c8", + "balance": "0xcdb6f39b8396fcd495dcf7f5c399c1aff5dbcaebe28dc69ae694feb58392dca98bd0e0a10e", + "nonce": "0xc8a1b1c5dc89eaa7ba01", "codeType": "0x00", - "codeLen": "0x00000040", + "codeLen": "0x40", "code": "0xa4bb9f38d5e9eecbfcf5541a1593fd784502a31e57d612f039831b3f71de1d7843a5c79b05c7cfe13bcc89d2bd251101bc948fef2e88960122ba6a292a8f8d4b", "storage": [ { @@ -2752,8 +2752,8 @@ "nodeType": "0x02", "accountType": "0x00", "address": "0x070aef02f7ba5cd82e234e30833efb083977d624", - "balance": "0xcce92658afab9d6c3852f1cdb02ed4b61135b6da403d3a237c2704097dc5b9be", - "nonce": "0x0000000000000000000000000000000000000000000000003fe0eab3191551b8", + "balance": "0xbef396ee9781c193fcc6e8e983c8b6dbb5a2d8a5ed85ece6f1a5e1e1d6f3ead7d8cca4e70c", + "nonce": "0xb8a3d5c8b1d6baf03f", "debugDepth": "0x02", "debugHash": "0x1477130ad8a4b8a9424bdd3211db501328c9113547d74dbc27193e8845a0ee56" }, @@ -2767,10 +2767,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xec15e9fa0710999d5d0428de21bec3498051c320", - "balance": "0xe8163aa57c5abc3b1751b833f02cdf831dd6bf43d6a70d99db88b63da0c0fbb2", - "nonce": "0x000000000000000000000000000000000000000000000000bcec50db6f52275c", + "balance": "0xb2f78386dac7adc4dbb3b6b8eafad0dfd6bb8cfccd85fc99b8a3ddd8c3d796bea5f5d8c00e", + "nonce": "0xdccec8fab69b94f6bc01", "codeType": "0x00", - "codeLen": "0x00000044", + "codeLen": "0x44", "code": "0x07f35186ccdf94ab120469adeb7ae991b3c5a5760b5dec74199b2b039d99b58089ea2e4991635571c4fd941c44d07371073a31c7d1ab6dcfa66ef4498032c05999df1bca", "storage": [ { @@ -2785,10 +2785,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0x4f4f02b85743e51eeb9b29fab6f1bdcf905d7144", - "balance": "0x43898b257fe8c811721eba924127e798be1c927f7a757e59ff73ee109598c462", - "nonce": "0x000000000000000000000000000000000000000000000000dffbb09f716ee315", + "balance": "0xe288e3ac89c2fbb9ffb3f9aba7ef9fc99cfce2bcfea490c9babdc88b8199fabfa596a69c04", + "nonce": "0x95c6bb8bf793ecfddf01", "codeType": "0x01", - "codeLen": "0x00000072", + "codeLen": "0x72", "codeHash": { "nodeType": "0x03", "data": "0x354b47d208104e085f8dd993f6f38b4d4251295e0892eb65006a3d8a49192f02" @@ -2819,10 +2819,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xf8001bf89b36c33418001a4ffca6d9e92d5644b3", - "balance": "0x38667f701899dfb2bc9d7fe55d953c3713cf28827a10e01734fe30af8b63a023", - "nonce": "0x000000000000000000000000000000000000000000000000742a009db8dd6f26", + "balance": "0xa3c08edbf8958cffb4ae8087a1cfa094cfa7dce1d3b2d7f2ffbaf295fbbba68cf0fe99c303", + "nonce": "0xa6def5c6db93809574", "codeType": "0x00", - "codeLen": "0x0000002b", + "codeLen": "0x2b", "code": "0x02fda5416a060c44144177500c89d032760a6cb2f05ac3e407f105cf0f3f16eee3473e01954c6c5913a217", "storage": [ { @@ -2837,10 +2837,10 @@ "nodeType": "0x02", "accountType": "0x01", "address": "0xc5c77c90d656ff719e6da32e245c4359447dca94", - "balance": "0x480492ccb0d9662720393c0d29f189c99a9566b446f560f0b4aa464ee68407bc", - "nonce": "0x0000000000000000000000000000000000000000000000003479097d234505a8", + "balance": "0xbc8f90b4eec991d5b4e183abef88adb395b5a6ce98beca86bcf280b9e2acb6d8cca592c004", + "nonce": "0xa88b949ad2afc2bc34", "codeType": "0x00", - "codeLen": "0x00000044", + "codeLen": "0x44", "code": "0xa69cd7135ed78016acf0a51c78ef016fd1be53551417c67c30696bb182a2f121fe930efa000435b95fdbda0269f16572cfd73598e753254e7b030a5ae7a8c1897d4310a3", "storage": [ { diff --git a/stateless/json_from_tree.nim b/stateless/json_from_tree.nim index 3b2e1329f..df791cb8c 100644 --- a/stateless/json_from_tree.nim +++ b/stateless/json_from_tree.nim @@ -93,6 +93,32 @@ template writeU32(wb: var WitnessBuilder, x: untyped, name: string) = template writeByte(wb: var WitnessBuilder, x: untyped, name: string) = writeByte(wb, byte(x), name) +proc writeUVarint[T](wb: var WitnessBuilder, x: T, name: string) = + # LEB128 varint encoding + var data: array[50, byte] + var len = 0 + + template writeByte(x) = + data[len] = x.byte + inc len + + var value = x + while true: + when T is UInt256: + var b = value.truncate(int) and 0x7F # low order 7 bits of value + else: + var b = value and 0x7F # low order 7 bits of value + value = value shr 7 + if value != 0: # more bytes to come + b = b or 0x80 # set high order bit of b + writeByte(b) + if value == 0: break + + wb.write(data.toOpenArray(0, len-1), name) + +template writeUVarint32(wb: var WitnessBuilder, x: untyped, name: string) = + wb.writeUVarint(uint32(x), name) + proc writeNibbles(wb: var WitnessBuilder; n: NibblesSeq) = # convert the NibblesSeq into left aligned byte seq # perhaps we can optimize it if the NibblesSeq already left aligned @@ -150,7 +176,7 @@ proc writeByteCode(wb: var WitnessBuilder, kd: KeyData, acc: Account) = let code = get(wb.db, contractHashKey(acc.codeHash).toOpenArray) if wfEIP170 in wb.flags and code.len > EIP170_CODE_SIZE_LIMIT: raise newException(ContractCodeError, "code len exceed EIP170 code size limit") - wb.writeU32(code.len, "codeLen") + wb.writeUVarint32(code.len, "codeLen") wb.writeHashNode(acc.codeHash.data, "codeHash") # no need to write 'code' here return @@ -158,14 +184,14 @@ proc writeByteCode(wb: var WitnessBuilder, kd: KeyData, acc: Account) = wb.writeByte(CodeTouched, "codeType") if acc.codeHash == blankStringHash: # no code - wb.writeU32(0'u32, "codeLen") + wb.writeUVarint32(0'u32, "codeLen") return # the account have code and the EVM use it let code = get(wb.db, contractHashKey(acc.codeHash).toOpenArray) if wfEIP170 in wb.flags and code.len > EIP170_CODE_SIZE_LIMIT: raise newException(ContractCodeError, "code len exceed EIP170 code size limit") - wb.writeU32(code.len, "codeLen") + wb.writeUVarint32(code.len, "codeLen") wb.write(code, "code") proc writeStorage(wb: var WitnessBuilder, kd: KeyData, acc: Account) = @@ -197,8 +223,8 @@ proc writeAccountNode(wb: var WitnessBuilder, kd: KeyData, acc: Account, node: o wb.writeByte(accountType, "accountType") wb.write(kd.address, "address") - wb.write(acc.balance.toBytesBE, "balance") - wb.write(acc.nonce.u256.toBytesBE, "nonce") + wb.writeUVarint(acc.balance, "balance") + wb.writeUVarint(acc.nonce, "nonce") if accountType != SimpleAccountType: wb.writeByteCode(kd, acc) diff --git a/stateless/test_witness_json.nim b/stateless/test_witness_json.nim index f58d0cacf..2b758bf8c 100644 --- a/stateless/test_witness_json.nim +++ b/stateless/test_witness_json.nim @@ -44,7 +44,7 @@ proc processByteCode(t: var Tester, x: JsonNode) = of "0x00": let codeLen = x["codeLen"].getStr() t.write(codeLen) - if codeLen != "0x00000000": + if codeLen != "0x00": t.write(x["code"]) of "0x01": t.write(x["codeLen"]) diff --git a/stateless/tree_from_witness.nim b/stateless/tree_from_witness.nim index b15686567..f0f09f33c 100644 --- a/stateless/tree_from_witness.nim +++ b/stateless/tree_from_witness.nim @@ -119,6 +119,30 @@ template safeReadBytes(t: var TreeBuilder, length: int, body: untyped) = else: raise newException(ParsingError, "Failed when try to read " & $length & " bytes") +proc readUVarint32(t: var TreeBuilder): uint32 = + # LEB128 varint encoding + var shift = 0 + while true: + let b = t.safeReadByte() + result = result or ((b and 0x7F).uint32 shl shift) + if (0x80 and b) == 0: + break + inc(shift, 7) + if shift > 28: + raise newException(ParsingError, "Failed when try to uvarint32") + +proc readUVarint256(t: var TreeBuilder): UInt256 = + # LEB128 varint encoding + var shift = 0 + while true: + let b = t.safeReadByte() + result = result or ((b and 0x7F).u256 shl shift) + if (0x80 and b) == 0: + break + inc(shift, 7) + if shift > 252: + raise newException(ParsingError, "Failed when try to uvarint256") + proc toKeccak(r: var NodeKey, x: openArray[byte]) {.inline.} = r.data[0..31] = x[0..31] r.usedBytes = 32 @@ -321,7 +345,7 @@ proc readAddress(t: var TreeBuilder): Hash256 = t.keys.add AccountAndSlots(address: address) proc readCodeLen(t: var TreeBuilder): int = - let codeLen = t.safeReadU32() + let codeLen = t.readUVarint32() if wfEIP170 in t.flags and codeLen > EIP170_CODE_SIZE_LIMIT: raise newException(ContractCodeError, "code len exceed EIP170 code size limit: " & $codeLen) t.keys[^1].codeLen = codeLen.int @@ -368,27 +392,25 @@ proc accountNode(t: var TreeBuilder, depth: int): NodeKey = var r = initRlpList(2) r.hexPrefixLeaf(addressHash.data, depth) - safeReadBytes(t, 64): - var acc = Account( - balance: UInt256.fromBytesBE(t.read(32), false), - # TODO: why nonce must be 32 bytes, isn't 64 bit uint enough? - nonce: UInt256.fromBytesBE(t.read(32), false).truncate(AccountNonce) - ) + var acc = Account( + balance: t.readUVarint256(), + nonce: t.readUVarint256().truncate(AccountNonce) + ) - case accountType - of SimpleAccountType: - acc.codeHash = blankStringHash - acc.storageRoot = emptyRlpHash - of ExtendedAccountType: - t.readByteCode(acc) + case accountType + of SimpleAccountType: + acc.codeHash = blankStringHash + acc.storageRoot = emptyRlpHash + of ExtendedAccountType: + t.readByteCode(acc) - # switch to account storage parsing mode - # and reset the depth - let storageRoot = t.treeNode(0, storageMode = true) - doAssert(storageRoot.usedBytes == 32) - acc.storageRoot.data = storageRoot.data + # switch to account storage parsing mode + # and reset the depth + let storageRoot = t.treeNode(0, storageMode = true) + doAssert(storageRoot.usedBytes == 32) + acc.storageRoot.data = storageRoot.data - r.append rlp.encode(acc) + r.append rlp.encode(acc) let nodeRes = r.finish result = t.toNodeKey(nodeRes) diff --git a/stateless/witness_from_tree.nim b/stateless/witness_from_tree.nim index b89c8c780..f80814259 100644 --- a/stateless/witness_from_tree.nim +++ b/stateless/witness_from_tree.nim @@ -63,6 +63,32 @@ template writeU32(wb: var WitnessBuilder, x: untyped) = template writeByte(wb: var WitnessBuilder, x: untyped) = wb.write(byte(x)) +proc writeUVarint(wb: var WitnessBuilder, x: SomeUnsignedInt) = + # LEB128 varint encoding + var value = x + while true: + var b = value and 0x7F # low order 7 bits of value + value = value shr 7 + if value != 0: # more bytes to come + b = b or 0x80 # set high order bit of b + wb.writeByte(b) + if value == 0: break + +template writeUVarint32(wb: var WitnessBuilder, x: untyped) = + wb.writeUVarint(uint32(x)) + +proc writeUVarint(wb: var WitnessBuilder, x: UInt256) = + # LEB128 varint encoding + var value = x + while true: + # we don't truncate to byte here, int will be faster + var b = value.truncate(int) and 0x7F # low order 7 bits of value + value = value shr 7 + if value != 0: # more bytes to come + b = b or 0x80 # set high order bit of b + wb.writeByte(b) + if value == 0: break + proc writeNibbles(wb: var WitnessBuilder; n: NibblesSeq, withLen: bool = true) = # convert the NibblesSeq into left aligned byte seq # perhaps we can optimize it if the NibblesSeq already left aligned @@ -128,7 +154,7 @@ proc writeByteCode(wb: var WitnessBuilder, kd: KeyData, acc: Account) = let code = get(wb.db, contractHashKey(acc.codeHash).toOpenArray) if wfEIP170 in wb.flags and code.len > EIP170_CODE_SIZE_LIMIT: raise newException(ContractCodeError, "code len exceed EIP170 code size limit") - wb.writeU32(code.len) + wb.writeUVarint32(code.len) wb.writeHashNode(acc.codeHash.data) # no need to write 'code' here return @@ -136,14 +162,14 @@ proc writeByteCode(wb: var WitnessBuilder, kd: KeyData, acc: Account) = wb.writeByte(CodeTouched) if acc.codeHash == blankStringHash: # no code - wb.writeU32(0'u32) + wb.writeUVarint32(0'u32) return # the account have code and the EVM use it let code = get(wb.db, contractHashKey(acc.codeHash).toOpenArray) if wfEIP170 in wb.flags and code.len > EIP170_CODE_SIZE_LIMIT: raise newException(ContractCodeError, "code len exceed EIP170 code size limit") - wb.writeU32(code.len) + wb.writeUVarint32(code.len) wb.write(code) proc writeStorage(wb: var WitnessBuilder, kd: KeyData, acc: Account) = @@ -182,8 +208,8 @@ proc writeAccountNode(wb: var WitnessBuilder, kd: KeyData, acc: Account, wb.writeByte(accountType) wb.write(kd.address) - wb.write(acc.balance.toBytesBE) - wb.write(acc.nonce.u256.toBytesBE) + wb.writeUVarint(acc.balance) + wb.writeUVarint(acc.nonce) if accountType != SimpleAccountType: wb.writeByteCode(kd, acc)