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

[scmd]Support jpst template expression in command line and starcoin testsuit #3583

Merged
merged 7 commits into from
Aug 3, 2022

Conversation

jolestar
Copy link
Member

@jolestar jolestar commented Jul 29, 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 #3576

What is the new behavior?

starcoin% chain list-block
starcoin% chain get-block {{$.chain[0].ok[0].block_hash}}

#StarcoinFramework checkpoint
Scenario Outline: [cmd] starcoin-framework checkpoint
Then cmd: "dev get-coin"
Then cmd: "account unlock"
Then cmd: "account execute-function --function 0x1::CheckpointScript::checkpoint -b"
Then cmd: "dev call-api chain.get_block_by_number [1,{\"raw\":true}]"
Then cmd: "account execute-function --function 0x1::CheckpointScript::update_state_root --arg {{$.dev[1].ok.raw.header}} -b"
Then cmd: "dev call --function 0x1::Block::latest_state_root"
Then assert: "{{$.dev[2].ok[1]}} == {{$.dev[1].ok.header.state_root}}"

@baichuan3 @WGB5445 可以暂时用这种方式来测试 Checkpoint 这样的合约

Other information

@jolestar jolestar requested review from LemonHX, pause125 and nanne007 and removed request for LemonHX and pause125 July 29, 2022 11:54
@codecov
Copy link

codecov bot commented Jul 31, 2022

Codecov Report

Merging #3583 (b0f005a) into master (3a0c707) will decrease coverage by 0.13%.
The diff coverage is 9.53%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3583      +/-   ##
==========================================
- Coverage   29.05%   28.93%   -0.12%     
==========================================
  Files         589      589              
  Lines       49814    49864      +50     
  Branches    23441    23462      +21     
==========================================
- Hits        14468    14421      -47     
- Misses      21138    21302     +164     
+ Partials    14208    14141      -67     
Flag Coverage Δ
unittests 28.93% <9.53%> (-0.12%) ⬇️

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

Impacted Files Coverage Δ
cmd/starcoin/src/account/execute_script_cmd.rs 0.00% <0.00%> (ø)
...tarcoin/src/account/execute_script_function_cmd.rs 0.00% <0.00%> (ø)
cmd/starcoin/src/account/sign_multisig_txn_cmd.rs 0.00% <0.00%> (ø)
cmd/starcoin/src/dev/package_cmd.rs 0.00% <0.00%> (ø)
cmd/starcoin/src/dev/tests.rs 14.20% <0.00%> (ø)
commons/scmd/src/context.rs 0.00% <ø> (ø)
commons/scmd/src/result.rs 0.00% <0.00%> (ø)
rpc/api/src/types.rs 14.07% <0.00%> (+0.12%) ⬆️
types/src/lib.rs 45.46% <40.00%> (-54.54%) ⬇️
vm/natives/src/account.rs 12.50% <0.00%> (-12.50%) ⬇️
... and 77 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 3a0c707...b0f005a. Read the comment docs.

@github-actions
Copy link

Benchmark for 1a6fbde

Click to view benchmark
Test Base PR %
accumulator_append 603.2±29.78µs 601.8±10.39µs -0.23%
block_apply/block_apply_10 632.9±1.44ms 636.7±3.18ms +0.60%
block_apply/block_apply_1000 64.3±0.06s 64.7±0.03s +0.62%
get_with_proof/db_store 36.3±0.25µs 36.5±0.22µs +0.55%
get_with_proof/mem_store 31.5±0.22µs 31.6±0.14µs +0.32%
put_and_commit/db_store/1 96.2±5.07µs 96.2±4.69µs 0.00%
put_and_commit/db_store/10 858.9±40.64µs 867.6±39.53µs +1.01%
put_and_commit/db_store/100 7.4±0.29ms 7.3±0.30ms -1.35%
put_and_commit/db_store/5 438.2±21.13µs 439.9±22.72µs +0.39%
put_and_commit/db_store/50 3.8±0.15ms 3.8±0.16ms 0.00%
put_and_commit/mem_store/1 61.6±5.73µs 61.7±5.73µs +0.16%
put_and_commit/mem_store/10 575.7±46.48µs 575.4±47.41µs -0.05%
put_and_commit/mem_store/100 5.6±0.34ms 5.7±0.83ms +1.79%
put_and_commit/mem_store/5 291.2±24.56µs 290.9±24.94µs -0.10%
put_and_commit/mem_store/50 2.8±0.19ms 2.8±0.18ms 0.00%
query_block/query_block_in(10)_times(100) 5.4±0.24ms 5.3±0.29ms -1.85%
query_block/query_block_in(10)_times(1000) 54.5±1.74ms 54.4±1.13ms -0.18%
query_block/query_block_in(10)_times(10000) 551.4±13.42ms 541.5±16.20ms -1.80%
query_block/query_block_in(1000)_times(100) 979.0±18.53µs 976.4±6.30µs -0.27%
query_block/query_block_in(1000)_times(1000) 9.8±0.15ms 9.7±0.06ms -1.02%
query_block/query_block_in(1000)_times(10000) 97.3±0.53ms 98.4±3.27ms +1.13%
storage_transaction 1073.7±284.19µs 1069.2±275.57µs -0.42%
vm/transaction_execution/1 710.2±3.21ms 719.1±2.93ms +1.25%
vm/transaction_execution/10 176.9±0.55ms 178.7±0.32ms +1.02%
vm/transaction_execution/20 152.6±0.26ms 155.6±4.17ms +1.97%
vm/transaction_execution/5 234.0±1.14ms 236.5±0.38ms +1.07%
vm/transaction_execution/50 168.3±1.74ms 169.1±1.06ms +0.48%

@jolestar jolestar requested a review from sanlee42 as a code owner July 31, 2022 15:16
@github-actions
Copy link

Benchmark for 10880b9

Click to view benchmark
Test Base PR %
accumulator_append 602.4±28.42µs 606.9±30.15µs +0.75%
block_apply/block_apply_10 633.1±2.21ms 634.1±1.53ms +0.16%
block_apply/block_apply_1000 64.6±0.03s 64.3±0.03s -0.46%
get_with_proof/db_store 36.8±0.28µs 36.5±0.50µs -0.82%
get_with_proof/mem_store 31.6±0.53µs 31.9±0.23µs +0.95%
put_and_commit/db_store/1 98.2±5.17µs 96.5±4.97µs -1.73%
put_and_commit/db_store/10 865.9±40.82µs 863.1±41.94µs -0.32%
put_and_commit/db_store/100 7.4±0.33ms 7.3±0.29ms -1.35%
put_and_commit/db_store/5 443.4±22.03µs 440.3±20.41µs -0.70%
put_and_commit/db_store/50 3.8±0.16ms 3.8±0.15ms 0.00%
put_and_commit/mem_store/1 62.4±5.67µs 61.7±5.58µs -1.12%
put_and_commit/mem_store/10 585.3±48.86µs 577.9±46.68µs -1.26%
put_and_commit/mem_store/100 5.7±0.82ms 5.6±0.34ms -1.75%
put_and_commit/mem_store/5 296.0±25.75µs 292.0±25.17µs -1.35%
put_and_commit/mem_store/50 2.9±0.20ms 2.8±0.18ms -3.45%
query_block/query_block_in(10)_times(100) 5.4±0.11ms 5.4±0.18ms 0.00%
query_block/query_block_in(10)_times(1000) 54.9±2.03ms 55.3±1.96ms +0.73%
query_block/query_block_in(10)_times(10000) 540.4±13.25ms 545.5±15.35ms +0.94%
query_block/query_block_in(1000)_times(100) 978.9±8.83µs 962.9±14.39µs -1.63%
query_block/query_block_in(1000)_times(1000) 9.8±0.06ms 9.6±0.09ms -2.04%
query_block/query_block_in(1000)_times(10000) 97.7±0.73ms 96.4±1.06ms -1.33%
storage_transaction 1071.4±272.98µs 1053.6±240.36µs -1.66%
vm/transaction_execution/1 710.0±1.70ms 710.6±1.35ms +0.08%
vm/transaction_execution/10 177.1±0.54ms 176.9±0.50ms -0.11%
vm/transaction_execution/20 153.0±0.90ms 152.8±0.82ms -0.13%
vm/transaction_execution/5 233.9±0.64ms 233.6±0.75ms -0.13%
vm/transaction_execution/50 167.1±0.59ms 167.6±2.49ms +0.30%

@jolestar jolestar requested a review from yourmoonlight as a code owner July 31, 2022 19:07
@jolestar jolestar changed the title [scmd]Support jpst template expression in command line [scmd]Support jpst template expression in command line and starcoin testsuit Jul 31, 2022
@jolestar jolestar requested review from baichuan3 and WGB5445 July 31, 2022 19:14
@baichuan3
Copy link

上面的Scenario Outline: [cmd] starcoin-framework checkpoint ,
可以直接在集成测试里使用? @jolestar

@jolestar
Copy link
Member Author

jolestar commented Aug 1, 2022

上面的Scenario Outline: [cmd] starcoin-framework checkpoint , 可以直接在集成测试里使用? @jolestar

对,但不是 mpm 的集成测试, mpm 的集成测试还不行。可以在 starcoin console 里或者 starcoin/testsuite/features/cmd.feature 文件里写

@WGB5445
Copy link
Contributor

WGB5445 commented Aug 1, 2022

在 console 里直接使用

account execute-function --function 0x1::CheckpointScript::update_state_root --arg {{$.dev[1].ok.raw.header}} -b

出现 The argument '--arg <transaction-args>' requires a value but none was supplied @jolestar

@jolestar
Copy link
Member Author

jolestar commented Aug 1, 2022

在 console 里直接使用

account execute-function --function 0x1::CheckpointScript::update_state_root --arg {{$.dev[1].ok.raw.header}} -b

出现 The argument '--arg <transaction-args>' requires a value but none was supplied @jolestar

要按上面的命令顺序执行

@jiangying000
Copy link
Collaborator

jiangying000 commented Aug 1, 2022

image
versionhistoryhelp 是没有记录在history的吗,刚才试了这三个命令历史里面没存

@jolestar
Copy link
Member Author

jolestar commented Aug 1, 2022

versionhistoryhelp 是没有记录在history的吗,刚才试了这三个命令历史里面没存 image

嗯,这几个命令是 console 内置的命令,没有存在历史里。

types/src/lib.rs Outdated Show resolved Hide resolved
types/src/lib.rs Show resolved Hide resolved
@jiangying000
Copy link
Collaborator

versionhistoryhelp 是没有记录在history的吗,刚才试了这三个命令历史里面没存 image

嗯,这几个命令是 console 内置的命令,没有存在历史里。

感觉可以考虑把内置命令也记录为历史,一般的shell好像都是这样的

@github-actions
Copy link

github-actions bot commented Aug 1, 2022

Benchmark for f762601

Click to view benchmark
Test Base PR %
accumulator_append 596.1±10.78µs 601.6±27.18µs +0.92%
block_apply/block_apply_10 629.5±1.50ms 629.5±2.92ms 0.00%
block_apply/block_apply_1000 64.2±0.04s 64.3±0.16s +0.16%
get_with_proof/db_store 36.5±0.25µs 36.8±0.21µs +0.82%
get_with_proof/mem_store 31.5±0.22µs 31.3±0.18µs -0.63%
put_and_commit/db_store/1 97.1±4.85µs 97.3±4.98µs +0.21%
put_and_commit/db_store/10 861.5±39.33µs 864.0±41.16µs +0.29%
put_and_commit/db_store/100 7.4±0.31ms 7.3±0.29ms -1.35%
put_and_commit/db_store/5 442.0±21.85µs 441.0±23.34µs -0.23%
put_and_commit/db_store/50 3.8±0.17ms 3.8±0.16ms 0.00%
put_and_commit/mem_store/1 61.5±5.54µs 61.5±5.67µs 0.00%
put_and_commit/mem_store/10 580.5±49.36µs 573.1±46.83µs -1.27%
put_and_commit/mem_store/100 5.7±0.82ms 5.6±0.34ms -1.75%
put_and_commit/mem_store/5 292.2±25.51µs 290.0±24.62µs -0.75%
put_and_commit/mem_store/50 2.8±0.18ms 2.8±0.18ms 0.00%
query_block/query_block_in(10)_times(100) 5.3±0.20ms 5.4±0.13ms +1.89%
query_block/query_block_in(10)_times(1000) 54.6±1.58ms 53.9±0.93ms -1.28%
query_block/query_block_in(10)_times(10000) 538.7±13.20ms 538.5±15.89ms -0.04%
query_block/query_block_in(1000)_times(100) 969.9±11.29µs 981.2±6.70µs +1.17%
query_block/query_block_in(1000)_times(1000) 9.6±0.12ms 9.8±0.08ms +2.08%
query_block/query_block_in(1000)_times(10000) 96.4±0.71ms 98.4±0.88ms +2.07%
storage_transaction 1098.5±274.74µs 1102.0±271.36µs +0.32%
vm/transaction_execution/1 716.1±2.47ms 706.5±1.68ms -1.34%
vm/transaction_execution/10 178.1±1.47ms 176.7±2.09ms -0.79%
vm/transaction_execution/20 153.4±0.87ms 152.1±0.82ms -0.85%
vm/transaction_execution/5 235.2±0.52ms 232.4±0.82ms -1.19%
vm/transaction_execution/50 168.0±0.79ms 166.1±0.31ms -1.13%

@jolestar
Copy link
Member Author

jolestar commented Aug 2, 2022

versionhistoryhelp 是没有记录在history的吗,刚才试了这三个命令历史里面没存 image

嗯,这几个命令是 console 内置的命令,没有存在历史里。

感觉可以考虑把内置命令也记录为历史,一般的shell好像都是这样的

下次重构的时候看下,历史记录那块因为有些命令要跳过历史记录,做的不太优雅,一直想重构一下。不过感觉这些命令记录到历史记录里貌似也没啥用😅

@pause125
Copy link
Collaborator

pause125 commented Aug 2, 2022

versionhistoryhelp 是没有记录在history的吗,刚才试了这三个命令历史里面没存 image

嗯,这几个命令是 console 内置的命令,没有存在历史里。

感觉可以考虑把内置命令也记录为历史,一般的shell好像都是这样的

下次重构的时候看下,历史记录那块因为有些命令要跳过历史记录,做的不太优雅,一直想重构一下。不过感觉这些命令记录到历史记录里貌似也没啥用😅

可以翻历史历史命令来重新运行或者修改,还是要方便些

@jolestar
Copy link
Member Author

jolestar commented Aug 3, 2022

可以翻历史历史命令来重新运行或者修改,还是要方便些

@0xpause @jiangying000 都加到历史命令里去了

@github-actions
Copy link

github-actions bot commented Aug 3, 2022

Benchmark for c56f500

Click to view benchmark
Test Base PR %
accumulator_append 602.8±30.16µs 601.6±30.71µs -0.20%
block_apply/block_apply_10 633.4±8.18ms 640.3±1.93ms +1.09%
block_apply/block_apply_1000 64.4±0.05s 64.8±0.10s +0.62%
get_with_proof/db_store 36.2±0.19µs 37.1±0.27µs +2.49%
get_with_proof/mem_store 31.5±0.18µs 32.2±0.25µs +2.22%
put_and_commit/db_store/1 95.6±4.70µs 95.5±4.95µs -0.10%
put_and_commit/db_store/10 852.9±38.74µs 849.8±42.68µs -0.36%
put_and_commit/db_store/100 7.4±0.29ms 7.3±0.32ms -1.35%
put_and_commit/db_store/5 449.5±22.99µs 435.1±21.53µs -3.20%
put_and_commit/db_store/50 3.8±0.16ms 3.8±0.17ms 0.00%
put_and_commit/mem_store/1 61.4±5.66µs 61.4±5.64µs 0.00%
put_and_commit/mem_store/10 574.2±46.81µs 574.5±46.56µs +0.05%
put_and_commit/mem_store/100 5.7±0.83ms 5.7±0.82ms 0.00%
put_and_commit/mem_store/5 291.9±25.31µs 291.2±24.28µs -0.24%
put_and_commit/mem_store/50 2.8±0.18ms 2.8±0.19ms 0.00%
query_block/query_block_in(10)_times(100) 5.4±0.11ms 5.4±0.23ms 0.00%
query_block/query_block_in(10)_times(1000) 54.8±2.25ms 54.8±2.20ms 0.00%
query_block/query_block_in(10)_times(10000) 554.4±13.77ms 543.7±19.12ms -1.93%
query_block/query_block_in(1000)_times(100) 987.5±6.97µs 993.8±13.04µs +0.64%
query_block/query_block_in(1000)_times(1000) 9.9±0.12ms 9.9±0.04ms 0.00%
query_block/query_block_in(1000)_times(10000) 98.6±0.69ms 99.3±0.74ms +0.71%
storage_transaction 1072.2±278.80µs 1064.3±272.22µs -0.74%
vm/transaction_execution/1 707.7±0.81ms 710.7±5.03ms +0.42%
vm/transaction_execution/10 176.8±1.02ms 177.4±2.39ms +0.34%
vm/transaction_execution/20 152.5±0.83ms 152.5±0.85ms 0.00%
vm/transaction_execution/5 233.0±0.59ms 236.1±6.65ms +1.33%
vm/transaction_execution/50 167.1±1.34ms 166.9±0.48ms -0.12%

@jolestar jolestar enabled auto-merge (squash) August 3, 2022 16:30
@jolestar
Copy link
Member Author

jolestar commented Aug 3, 2022

@lerencao @templexxx @0xpause @jiangying000 帮忙看看没问题就合并了吧

@jolestar jolestar merged commit 8aa6bf2 into master Aug 3, 2022
@jolestar jolestar deleted the scmd_jpst branch August 3, 2022 17:06
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]Starcoin console support jpst
5 participants