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

[Feature] RPC blocks support positive sequence #3824

Merged
merged 13 commits into from
Dec 28, 2022
Merged

[Feature] RPC blocks support positive sequence #3824

merged 13 commits into from
Dec 28, 2022

Conversation

WGB5445
Copy link
Contributor

@WGB5445 WGB5445 commented Dec 27, 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: #3799

@github-actions
Copy link

Benchmark for 1f0cd01

Click to view benchmark
Test Base PR %
accumulator_append 605.7±29.13µs 607.5±29.27µs +0.30%
block_apply/block_apply_10 792.8±1.38ms 793.5±1.79ms +0.09%
block_apply/block_apply_1000 81.1±0.03s 80.6±0.08s -0.62%
get_with_proof/db_store 36.4±0.23µs 36.7±0.57µs +0.82%
get_with_proof/mem_store 31.5±0.28µs 31.6±0.41µs +0.32%
put_and_commit/db_store/1 95.1±4.72µs 95.7±4.98µs +0.63%
put_and_commit/db_store/10 856.0±37.24µs 861.1±40.38µs +0.60%
put_and_commit/db_store/100 7.4±0.29ms 7.3±0.30ms -1.35%
put_and_commit/db_store/5 437.5±21.64µs 439.2±21.42µs +0.39%
put_and_commit/db_store/50 3.8±0.16ms 3.8±0.16ms 0.00%
put_and_commit/mem_store/1 61.8±5.67µs 61.9±5.57µs +0.16%
put_and_commit/mem_store/10 576.7±47.02µs 579.2±48.99µs +0.43%
put_and_commit/mem_store/100 5.7±0.82ms 5.7±0.83ms 0.00%
put_and_commit/mem_store/5 293.5±26.28µs 290.5±24.40µs -1.02%
put_and_commit/mem_store/50 2.8±0.18ms 2.8±0.18ms 0.00%
query_block/query_block_in(10)_times(100) 6.9±0.32ms 7.0±0.35ms +1.45%
query_block/query_block_in(10)_times(1000) 70.5±1.98ms 69.7±2.71ms -1.13%
query_block/query_block_in(10)_times(10000) 703.7±21.82ms 707.3±18.94ms +0.51%
query_block/query_block_in(1000)_times(100) 1000.9±16.50µs 1000.4±17.09µs -0.05%
query_block/query_block_in(1000)_times(1000) 10.1±0.15ms 10.0±0.11ms -0.99%
query_block/query_block_in(1000)_times(10000) 100.3±0.73ms 98.7±1.18ms -1.60%
storage_transaction 1138.1±395.48µs 1132.2±378.30µs -0.52%
vm/transaction_execution/1 902.0±2.97ms 902.7±2.14ms +0.08%
vm/transaction_execution/10 228.8±0.54ms 228.8±0.67ms 0.00%
vm/transaction_execution/20 197.2±0.60ms 196.6±0.39ms -0.30%
vm/transaction_execution/5 301.1±0.79ms 300.9±1.13ms -0.07%
vm/transaction_execution/50 213.4±1.85ms 212.7±0.55ms -0.33%

@nkysg nkysg requested a review from welbon December 28, 2022 00:56
@codecov
Copy link

codecov bot commented Dec 28, 2022

Codecov Report

Merging #3824 (48b0df4) into master (d57b055) will increase coverage by 0.07%.
The diff coverage is 8.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3824      +/-   ##
==========================================
+ Coverage   53.13%   53.20%   +0.07%     
==========================================
  Files         595      595              
  Lines       64668    64700      +32     
==========================================
+ Hits        34353    34415      +62     
+ Misses      30315    30285      -30     
Flag Coverage Δ
unittests 53.20% <8.52%> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
chain/api/src/message.rs 0.00% <ø> (ø)
chain/api/src/service.rs 17.98% <0.00%> (-0.08%) ⬇️
chain/service/src/chain_service.rs 35.02% <0.00%> (-0.59%) ⬇️
chain/src/chain.rs 65.08% <0.00%> (-0.74%) ⬇️
cmd/starcoin/src/chain/list_block_cmd.rs 0.00% <0.00%> (ø)
config/src/lib.rs 60.59% <ø> (ø)
rpc/client/src/lib.rs 0.11% <0.00%> (-<0.01%) ⬇️
rpc/server/src/module/chain_rpc.rs 3.26% <0.00%> (-0.01%) ⬇️
...rcoin-transactional-test-harness/src/fork_chain.rs 0.00% <0.00%> (ø)
rpc/api/src/chain/mod.rs 100.00% <100.00%> (ø)
... and 16 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 d57b055...48b0df4. Read the comment docs.

@github-actions
Copy link

Benchmark for a6fb853

Click to view benchmark
Test Base PR %
accumulator_append 610.6±27.59µs 613.3±28.77µs +0.44%
block_apply/block_apply_10 799.8±1.32ms 794.4±2.73ms -0.68%
block_apply/block_apply_1000 81.5±0.02s 80.9±0.03s -0.74%
get_with_proof/db_store 36.8±0.57µs 36.3±0.29µs -1.36%
get_with_proof/mem_store 31.8±0.19µs 31.6±0.20µs -0.63%
put_and_commit/db_store/1 95.7±4.98µs 96.0±5.11µs +0.31%
put_and_commit/db_store/10 856.1±40.84µs 857.7±40.17µs +0.19%
put_and_commit/db_store/100 7.3±0.31ms 7.3±0.30ms 0.00%
put_and_commit/db_store/5 441.3±23.00µs 440.8±23.60µs -0.11%
put_and_commit/db_store/50 3.8±0.16ms 3.8±0.16ms 0.00%
put_and_commit/mem_store/1 61.6±5.62µs 61.7±5.59µs +0.16%
put_and_commit/mem_store/10 580.7±47.07µs 576.5±46.79µs -0.72%
put_and_commit/mem_store/100 5.7±0.83ms 5.6±0.34ms -1.75%
put_and_commit/mem_store/5 294.4±24.52µs 291.5±24.26µs -0.99%
put_and_commit/mem_store/50 2.9±0.18ms 2.8±0.18ms -3.45%
query_block/query_block_in(10)_times(100) 6.9±0.51ms 6.9±0.32ms 0.00%
query_block/query_block_in(10)_times(1000) 68.9±2.39ms 70.9±2.53ms +2.90%
query_block/query_block_in(10)_times(10000) 694.1±20.18ms 703.2±19.02ms +1.31%
query_block/query_block_in(1000)_times(100) 990.3±15.54µs 1009.7±9.14µs +1.96%
query_block/query_block_in(1000)_times(1000) 9.9±0.12ms 10.1±0.17ms +2.02%
query_block/query_block_in(1000)_times(10000) 99.6±2.29ms 101.2±1.08ms +1.61%
storage_transaction 1023.7±347.84µs 1156.5±384.33µs +12.97%
vm/transaction_execution/1 905.5±1.30ms 903.0±1.75ms -0.28%
vm/transaction_execution/10 230.3±2.53ms 228.8±0.61ms -0.65%
vm/transaction_execution/20 198.1±1.13ms 197.2±0.94ms -0.45%
vm/transaction_execution/5 302.9±1.62ms 301.1±1.08ms -0.59%
vm/transaction_execution/50 214.0±0.99ms 212.9±0.69ms -0.51%

@@ -36,7 +36,12 @@ pub trait ChainReader {
fn get_block_by_number(&self, number: BlockNumber) -> Result<Option<Block>>;
/// Get latest `count` blocks before `number`. if `number` is absent, use head block number.
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的相关注释也修改下吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

let blocks = mock_chain
.head()
.get_blocks_by_number(Some(9), false, u64::max_value())?;
assert_eq!(blocks.len(), 2);
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里需要加个Some(9), true, 3 类似这种测试用例吗

@nkysg nkysg linked an issue Dec 28, 2022 that may be closed by this pull request
@github-actions
Copy link

Benchmark for 8afdd8a

Click to view benchmark
Test Base PR %
accumulator_append 608.1±31.61µs 604.9±28.44µs -0.53%
block_apply/block_apply_10 795.5±3.06ms 796.7±1.20ms +0.15%
block_apply/block_apply_1000 81.1±0.05s 81.2±0.04s +0.12%
get_with_proof/db_store 36.5±0.31µs 37.7±0.33µs +3.29%
get_with_proof/mem_store 31.7±0.61µs 32.3±0.23µs +1.89%
put_and_commit/db_store/1 95.7±5.02µs 96.0±4.99µs +0.31%
put_and_commit/db_store/10 852.8±38.24µs 860.8±39.01µs +0.94%
put_and_commit/db_store/100 7.4±0.32ms 7.4±0.31ms 0.00%
put_and_commit/db_store/5 443.0±23.04µs 444.1±22.48µs +0.25%
put_and_commit/db_store/50 3.9±0.25ms 3.8±0.17ms -2.56%
put_and_commit/mem_store/1 62.0±5.70µs 61.6±5.67µs -0.65%
put_and_commit/mem_store/10 577.8±47.78µs 580.5±49.04µs +0.47%
put_and_commit/mem_store/100 5.7±0.83ms 5.7±0.83ms 0.00%
put_and_commit/mem_store/5 293.6±25.67µs 293.4±25.46µs -0.07%
put_and_commit/mem_store/50 2.8±0.18ms 2.8±0.18ms 0.00%
query_block/query_block_in(10)_times(100) 7.0±0.41ms 6.9±0.14ms -1.43%
query_block/query_block_in(10)_times(1000) 70.7±3.60ms 69.9±1.87ms -1.13%
query_block/query_block_in(10)_times(10000) 697.3±16.58ms 698.5±15.91ms +0.17%
query_block/query_block_in(1000)_times(100) 1006.5±10.49µs 989.3±20.70µs -1.71%
query_block/query_block_in(1000)_times(1000) 10.0±0.09ms 9.9±0.06ms -1.00%
query_block/query_block_in(1000)_times(10000) 101.1±1.88ms 98.1±1.96ms -2.97%
storage_transaction 998.1±289.75µs 1021.6±313.99µs +2.35%
vm/transaction_execution/1 906.0±2.82ms 904.1±1.22ms -0.21%
vm/transaction_execution/10 229.5±1.08ms 228.4±0.82ms -0.48%
vm/transaction_execution/20 197.7±0.70ms 196.9±0.69ms -0.40%
vm/transaction_execution/5 303.0±1.03ms 300.9±1.02ms -0.69%
vm/transaction_execution/50 215.1±1.37ms 214.5±3.82ms -0.28%

@nkysg nkysg merged commit ce4b2c9 into master Dec 28, 2022
@nkysg nkysg deleted the rpc_blocks branch December 28, 2022 13:31
@github-actions
Copy link

Benchmark for 2a5b85f

Click to view benchmark
Test Base PR %
accumulator_append 613.2±28.47µs 604.8±10.03µs -1.37%
block_apply/block_apply_10 792.9±1.41ms 794.7±1.99ms +0.23%
block_apply/block_apply_1000 80.5±0.06s 81.3±0.31s +0.99%
get_with_proof/db_store 36.6±0.26µs 36.4±0.27µs -0.55%
get_with_proof/mem_store 31.6±0.23µs 31.9±0.27µs +0.95%
put_and_commit/db_store/1 96.5±4.93µs 95.9±5.09µs -0.62%
put_and_commit/db_store/10 860.1±40.90µs 860.7±41.97µs +0.07%
put_and_commit/db_store/100 7.4±0.32ms 7.4±0.29ms 0.00%
put_and_commit/db_store/5 449.1±44.41µs 440.5±22.76µs -1.91%
put_and_commit/db_store/50 3.8±0.17ms 3.8±0.16ms 0.00%
put_and_commit/mem_store/1 61.9±5.70µs 61.8±5.63µs -0.16%
put_and_commit/mem_store/10 576.1±47.54µs 576.9±47.07µs +0.14%
put_and_commit/mem_store/100 5.7±0.83ms 5.7±0.84ms 0.00%
put_and_commit/mem_store/5 291.9±25.01µs 293.5±25.57µs +0.55%
put_and_commit/mem_store/50 2.8±0.19ms 2.9±0.19ms +3.57%
query_block/query_block_in(10)_times(100) 7.0±0.32ms 6.9±0.31ms -1.43%
query_block/query_block_in(10)_times(1000) 70.0±1.74ms 68.9±4.05ms -1.57%
query_block/query_block_in(10)_times(10000) 703.3±19.74ms 692.3±23.02ms -1.56%
query_block/query_block_in(1000)_times(100) 987.2±8.88µs 1004.9±13.90µs +1.79%
query_block/query_block_in(1000)_times(1000) 9.9±0.11ms 10.1±0.19ms +2.02%
query_block/query_block_in(1000)_times(10000) 99.9±1.15ms 100.5±1.90ms +0.60%
storage_transaction 984.5±276.88µs 985.6±279.08µs +0.11%
vm/transaction_execution/1 903.8±1.09ms 907.5±6.00ms +0.41%
vm/transaction_execution/10 229.1±0.67ms 230.0±1.99ms +0.39%
vm/transaction_execution/20 197.4±0.87ms 198.3±1.26ms +0.46%
vm/transaction_execution/5 301.7±0.69ms 302.1±1.00ms +0.13%
vm/transaction_execution/50 213.5±0.96ms 214.1±0.77ms +0.28%

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]chain.get_blocks_by_number接口优化
4 participants