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

[rpc] Add raw state proof and transaction proof API #3516

Merged
merged 3 commits into from
Jul 6, 2022
Merged

Conversation

jolestar
Copy link
Member

@jolestar jolestar commented Jul 6, 2022

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: resolve #3512

What is the new behavior?

chain get-txn-proof --block-hash 0x155fff75365299de34f6c17a941936f4873ff6a6ce263a38d51cc49bcdd05002 --transaction-global-index 0 --raw

{
  "ok": "0x20155fff75365299de34f6c17a941936f4873ff6a6ce263a38d51cc49bcdd05002000000000000000020f3c2f9e3810816d6e461a5f5b977b551f213591b1dadd415b79d70e01977ed8f201ee14fb341b111b6fcd822f97a6b718b88e6dcd930d69e7b7620e1f4f31a2afc20e4cfa4eb2c77f101827938725e4cb76fa4cb1f282845ae268fe064425471859c000000000000000000000000000000000000000000000000"
}
state get-proof 0x1/0/Account --raw

Other information

@jolestar jolestar requested a review from sanlee42 as a code owner July 6, 2022 11:42
@codecov
Copy link

codecov bot commented Jul 6, 2022

Codecov Report

Merging #3516 (6ca01ad) into master (ec44d09) will decrease coverage by 0.30%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3516      +/-   ##
==========================================
- Coverage   29.65%   29.36%   -0.29%     
==========================================
  Files         588      588              
  Lines       49567    49672     +105     
  Branches    23346    23394      +48     
==========================================
- Hits        14694    14581     -113     
- Misses      20596    20841     +245     
+ Partials    14277    14250      -27     
Flag Coverage Δ
unittests 29.36% <0.00%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/starcoin/src/chain/get_txn_proof_cmd.rs 0.00% <0.00%> (ø)
cmd/starcoin/src/state/get_proof_cmd.rs 0.00% <0.00%> (ø)
rpc/api/src/chain/mod.rs 11.54% <0.00%> (-0.96%) ⬇️
rpc/api/src/state/mod.rs 31.58% <0.00%> (-2.70%) ⬇️
rpc/client/src/lib.rs 11.34% <0.00%> (-0.50%) ⬇️
rpc/server/src/module/chain_rpc.rs 3.19% <0.00%> (-0.21%) ⬇️
rpc/server/src/module/state_rpc.rs 5.21% <0.00%> (-0.47%) ⬇️
vm/types/src/language_storage_ext.rs 29.17% <0.00%> (-12.50%) ⬇️
network-p2p/src/transport.rs 15.10% <0.00%> (-11.32%) ⬇️
vm/types/src/on_chain_config/vm_config.rs 35.00% <0.00%> (-10.00%) ⬇️
... and 84 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec44d09...6ca01ad. Read the comment docs.

@jolestar jolestar marked this pull request as draft July 6, 2022 12:19
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Benchmark for ad7ebe3

Click to view benchmark
Test Base PR %
accumulator_append 591.6±8.66µs 597.5±13.02µs +1.00%
block_apply/block_apply_10 265.7±1.53ms 268.1±0.89ms +0.90%
block_apply/block_apply_1000 27.3±0.04s 27.1±0.03s -0.73%
get_with_proof/db_store 36.6±0.29µs 36.8±0.24µs +0.55%
get_with_proof/mem_store 31.6±0.23µs 31.8±0.45µs +0.63%
put_and_commit/db_store/1 95.4±4.77µs 95.7±5.55µs +0.31%
put_and_commit/db_store/10 847.7±40.40µs 854.4±39.36µs +0.79%
put_and_commit/db_store/100 7.3±0.31ms 7.3±0.31ms 0.00%
put_and_commit/db_store/5 439.7±22.66µs 443.9±23.42µs +0.96%
put_and_commit/db_store/50 3.8±0.17ms 3.8±0.17ms 0.00%
put_and_commit/mem_store/1 62.2±5.67µs 61.7±5.63µs -0.80%
put_and_commit/mem_store/10 581.0±49.74µs 580.2±48.91µs -0.14%
put_and_commit/mem_store/100 5.7±0.83ms 5.7±0.82ms 0.00%
put_and_commit/mem_store/5 294.4±25.41µs 290.7±24.36µs -1.26%
put_and_commit/mem_store/50 2.8±0.18ms 2.8±0.19ms 0.00%
query_block/query_block_in(10)_times(100) 3.8±0.15ms 3.9±0.09ms +2.63%
query_block/query_block_in(10)_times(1000) 39.5±0.84ms 39.2±1.07ms -0.76%
query_block/query_block_in(10)_times(10000) 389.3±5.83ms 384.0±5.90ms -1.36%
query_block/query_block_in(1000)_times(100) 953.6±5.15µs 945.7±13.72µs -0.83%
query_block/query_block_in(1000)_times(1000) 9.5±0.09ms 9.4±0.06ms -1.05%
query_block/query_block_in(1000)_times(10000) 96.0±0.88ms 94.4±0.79ms -1.67%
storage_transaction 1050.7±284.72µs 1103.9±373.38µs +5.06%
vm/transaction_execution/1 312.2±0.69ms 313.3±1.05ms +0.35%
vm/transaction_execution/10 98.8±0.67ms 99.2±0.95ms +0.40%
vm/transaction_execution/20 92.2±0.53ms 92.5±1.14ms +0.33%
vm/transaction_execution/5 120.2±0.43ms 120.4±0.22ms +0.17%
vm/transaction_execution/50 108.4±0.45ms 106.8±0.45ms -1.48%

@jolestar jolestar marked this pull request as ready for review July 6, 2022 13:42
@jolestar jolestar changed the title [rpc] Add raw_proof to StateWithProofView [rpc] Add raw state proof and transaction proof API Jul 6, 2022
@jolestar
Copy link
Member Author

jolestar commented Jul 6, 2022

@muzixinly 接口支持返回 raw proof,可以直接把 hex 作为 vector 传递到 Move 中,通过 BCS 反序列化解析出来。

@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Benchmark for d8844ac

Click to view benchmark
Test Base PR %
accumulator_append 598.3±12.73µs 588.3±11.06µs -1.67%
block_apply/block_apply_10 266.1±0.47ms 263.5±0.41ms -0.98%
block_apply/block_apply_1000 27.1±0.02s 27.0±0.03s -0.37%
get_with_proof/db_store 36.0±0.22µs 36.3±0.28µs +0.83%
get_with_proof/mem_store 31.2±0.38µs 31.3±0.18µs +0.32%
put_and_commit/db_store/1 94.7±4.94µs 95.4±4.62µs +0.74%
put_and_commit/db_store/10 847.1±41.31µs 853.6±39.31µs +0.77%
put_and_commit/db_store/100 7.3±0.32ms 7.3±0.31ms 0.00%
put_and_commit/db_store/5 432.8±22.32µs 437.7±21.28µs +1.13%
put_and_commit/db_store/50 3.8±0.17ms 3.8±0.17ms 0.00%
put_and_commit/mem_store/1 61.5±5.64µs 61.8±5.64µs +0.49%
put_and_commit/mem_store/10 573.8±46.89µs 576.7±47.60µs +0.51%
put_and_commit/mem_store/100 5.7±0.83ms 5.7±0.83ms 0.00%
put_and_commit/mem_store/5 290.0±24.55µs 293.3±25.66µs +1.14%
put_and_commit/mem_store/50 2.8±0.18ms 2.8±0.18ms 0.00%
query_block/query_block_in(10)_times(100) 3.9±0.12ms 3.9±0.09ms 0.00%
query_block/query_block_in(10)_times(1000) 39.4±1.33ms 38.9±1.15ms -1.27%
query_block/query_block_in(10)_times(10000) 390.6±3.93ms 395.3±5.38ms +1.20%
query_block/query_block_in(1000)_times(100) 956.8±5.75µs 949.6±9.87µs -0.75%
query_block/query_block_in(1000)_times(1000) 9.6±0.08ms 9.5±0.05ms -1.04%
query_block/query_block_in(1000)_times(10000) 96.6±0.99ms 94.9±1.09ms -1.76%
storage_transaction 1065.3±332.32µs 1065.8±300.90µs +0.05%
vm/transaction_execution/1 313.6±3.62ms 310.7±0.56ms -0.92%
vm/transaction_execution/10 98.2±0.36ms 98.3±0.25ms +0.10%
vm/transaction_execution/20 91.6±0.32ms 91.7±0.45ms +0.11%
vm/transaction_execution/5 119.7±0.57ms 119.8±0.65ms +0.08%
vm/transaction_execution/50 106.0±0.29ms 106.2±0.56ms +0.19%

@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Benchmark for 8cb9e85

Click to view benchmark
Test Base PR %
accumulator_append 590.6±10.40µs 590.2±9.31µs -0.07%
block_apply/block_apply_10 264.9±0.78ms 270.7±2.78ms +2.19%
block_apply/block_apply_1000 27.1±0.02s 27.7±0.03s +2.21%
get_with_proof/db_store 36.5±0.22µs 36.4±0.22µs -0.27%
get_with_proof/mem_store 31.4±0.69µs 31.3±0.18µs -0.32%
put_and_commit/db_store/1 95.0±4.95µs 94.2±4.93µs -0.84%
put_and_commit/db_store/10 857.5±39.08µs 852.9±39.30µs -0.54%
put_and_commit/db_store/100 7.4±0.31ms 7.3±0.32ms -1.35%
put_and_commit/db_store/5 438.5±23.58µs 435.0±20.64µs -0.80%
put_and_commit/db_store/50 3.8±0.17ms 3.8±0.17ms 0.00%
put_and_commit/mem_store/1 61.8±5.65µs 61.6±5.68µs -0.32%
put_and_commit/mem_store/10 576.5±47.12µs 575.7±48.64µs -0.14%
put_and_commit/mem_store/100 5.7±0.83ms 5.7±0.86ms 0.00%
put_and_commit/mem_store/5 291.2±24.69µs 290.0±25.06µs -0.41%
put_and_commit/mem_store/50 2.8±0.19ms 2.9±0.19ms +3.57%
query_block/query_block_in(10)_times(100) 4.0±0.25ms 3.9±0.09ms -2.50%
query_block/query_block_in(10)_times(1000) 39.1±0.52ms 39.1±0.83ms 0.00%
query_block/query_block_in(10)_times(10000) 389.6±6.69ms 391.2±7.62ms +0.41%
query_block/query_block_in(1000)_times(100) 960.5±6.06µs 958.4±13.84µs -0.22%
query_block/query_block_in(1000)_times(1000) 9.6±0.06ms 9.5±0.09ms -1.04%
query_block/query_block_in(1000)_times(10000) 95.6±0.56ms 96.2±0.97ms +0.63%
storage_transaction 1066.5±333.64µs 1059.8±292.76µs -0.63%
vm/transaction_execution/1 312.1±0.64ms 311.6±0.59ms -0.16%
vm/transaction_execution/10 98.4±0.09ms 98.4±0.35ms 0.00%
vm/transaction_execution/20 92.6±1.90ms 92.1±1.20ms -0.54%
vm/transaction_execution/5 120.3±0.57ms 120.1±0.82ms -0.17%
vm/transaction_execution/50 106.5±0.27ms 106.3±0.85ms -0.19%

@jolestar jolestar merged commit 6c0546e into master Jul 6, 2022
@jolestar jolestar deleted the raw_proof branch July 6, 2022 15:57
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

Successfully merging this pull request may close these issues.

[Feature Request] Provide a raw view to StateProof and TransactionProof
4 participants