starcoinorg / starcoin

Starcoin - A Move smart contract blockchain network that scales by layering
Apache License 2.0
1.38k stars 289 forks source link

Reset dag chain #4227

Closed jackzhhuang closed 1 month ago

jackzhhuang commented 1 month ago

Pull request type

Please check the type of change your PR introduces:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

-

-

Other information

Summary by CodeRabbit

coderabbitai[bot] commented 1 month ago

[!CAUTION]

Review failed

The head commit changed during the review from d1436a90782784aa3246d54eb04954a30c554636 to c5b928664894ad79faac98589c92126275cd67e3.

Walkthrough

The changes introduce two new public methods in the BlockDAG struct: save_dag_state_directly, which enables direct insertion of a DagState into the state store, and reachability_service, which provides access to the MTReachabilityService. The visibility of the reachability_service field in the GhostdagManager struct is updated to public. The reset method in the WriteBlockChainService is modified for block deletion using a reachability service. Additionally, Kubernetes configuration for the starcoin application is updated.

Changes

File Change Summary
flexidag/src/blockdag.rs Added pub fn save_dag_state_directly(&self, hash: Hash, state: DagState) -> anyhow::Result<()> and pub fn reachability_service(&self) -> MTReachabilityService<DbReachabilityStore> methods.
flexidag/src/ghostdag/protocol.rs Changed visibility of reachability_service from pub(super) to pub in GhostdagManager.
sync/src/block_connector/write_block_chain.rs Modified reset method logic for block deletion using reachability service.
sync/src/parallel/executor.rs Updated waiting_for_parents method to include Arc<dyn Store> parameter and enhanced error handling.
kube/manifest/starcoin-halley.yaml Updated container image to starcoin/starcoin:dag-master, added node selector starcoin/node-pool: seed-pool.

Possibly related PRs

Suggested reviewers

Poem

🐇 In the land of blocks and chains so bright,
A reachability service comes to light.
With methods new and fields made clear,
The ghosts of blocks now draw near.
So hop along, let's celebrate,
For cleaner code, we won't be late! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
github-actions[bot] commented 1 month ago

Benchmark for 2166046

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | accumulator_append | 897.8±197.77µs | 892.2±202.55µs | -0.62% | | block_apply/block_apply_10 | 407.0±39.78ms | **380.7±13.08ms** | **-6.46%** | | block_apply/block_apply_1000 | **45.0±3.38s** | 45.4±3.12s | **+0.89%** | | get_with_proof/db_store | 52.6±9.78µs | **46.2±3.55µs** | **-12.17%** | | get_with_proof/mem_store | 36.0±1.74µs | 35.8±1.70µs | -0.56% | | put_and_commit/db_store/1 | **123.2±11.28µs** | 200.7±33.47µs | **+62.91%** | | put_and_commit/db_store/10 | 1123.0±126.92µs | 1111.7±116.67µs | -1.01% | | put_and_commit/db_store/100 | 11.3±1.72ms | 10.3±1.40ms | -8.85% | | put_and_commit/db_store/5 | 639.2±94.47µs | 607.7±86.08µs | -4.93% | | put_and_commit/db_store/50 | 5.6±0.44ms | **5.1±0.46ms** | **-8.93%** | | put_and_commit/mem_store/1 | 78.9±11.72µs | **70.6±6.97µs** | **-10.52%** | | put_and_commit/mem_store/10 | 681.9±85.94µs | 668.0±76.66µs | -2.04% | | put_and_commit/mem_store/100 | 6.9±0.65ms | 6.5±0.51ms | -5.80% | | put_and_commit/mem_store/5 | **348.7±39.95µs** | 388.7±77.08µs | **+11.47%** | | put_and_commit/mem_store/50 | 3.5±0.40ms | 3.3±0.30ms | -5.71% | | query_block/query_block_in(10)_times(100) | 8.7±0.43ms | **8.2±0.14ms** | **-5.75%** | | query_block/query_block_in(10)_times(1000) | 84.4±5.82ms | 82.9±3.70ms | -1.78% | | query_block/query_block_in(10)_times(10000) | 853.3±32.03ms | 858.3±47.13ms | +0.59% | | query_block/query_block_in(1000)_times(100) | 1698.1±271.63µs | **1264.5±69.60µs** | **-25.53%** | | query_block/query_block_in(1000)_times(1000) | 14.7±1.37ms | **12.7±0.38ms** | **-13.61%** | | query_block/query_block_in(1000)_times(10000) | 138.4±6.21ms | **128.2±10.83ms** | **-7.37%** | | storage_transaction | 1108.2±369.92µs | 1151.4±422.48µs | +3.90% | | vm/transaction_execution/1 | 470.4±59.96ms | 455.0±41.46ms | -3.27% | | vm/transaction_execution/10 | 169.9±35.40ms | **135.3±5.77ms** | **-20.36%** | | vm/transaction_execution/20 | 152.6±13.37ms | **126.1±10.31ms** | **-17.37%** | | vm/transaction_execution/5 | 166.4±9.08ms | 167.3±13.11ms | +0.54% | | vm/transaction_execution/50 | 164.7±17.37ms | **147.4±12.42ms** | **-10.50%** |
github-actions[bot] commented 1 month ago

Benchmark for 5d25a4e

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | accumulator_append | 827.5±206.58µs | 776.6±96.39µs | -6.15% | | block_apply/block_apply_10 | 379.5±14.82ms | **366.4±6.55ms** | **-3.45%** | | block_apply/block_apply_1000 | **40.4±0.99s** | 40.7±1.27s | **+0.74%** | | get_with_proof/db_store | 44.0±4.17µs | 43.2±3.46µs | -1.82% | | get_with_proof/mem_store | 38.1±8.11µs | **35.8±1.96µs** | **-6.04%** | | put_and_commit/db_store/1 | 117.7±9.02µs | 116.4±6.54µs | -1.10% | | put_and_commit/db_store/10 | 1047.4±59.13µs | 1027.2±104.50µs | -1.93% | | put_and_commit/db_store/100 | 10.1±0.56ms | 9.8±1.06ms | -2.97% | | put_and_commit/db_store/5 | 549.9±51.13µs | 539.2±37.61µs | -1.95% | | put_and_commit/db_store/50 | 5.1±0.42ms | 5.1±0.57ms | 0.00% | | put_and_commit/mem_store/1 | 73.8±11.04µs | 70.3±7.21µs | -4.74% | | put_and_commit/mem_store/10 | 674.8±66.24µs | 653.3±67.41µs | -3.19% | | put_and_commit/mem_store/100 | 7.0±1.17ms | 6.5±0.62ms | -7.14% | | put_and_commit/mem_store/5 | 342.4±59.12µs | 332.2±34.31µs | -2.98% | | put_and_commit/mem_store/50 | 3.2±0.36ms | 3.3±0.53ms | +3.13% | | query_block/query_block_in(10)_times(100) | **8.3±0.43ms** | 8.8±0.76ms | **+6.02%** | | query_block/query_block_in(10)_times(1000) | 83.3±3.30ms | 85.6±4.04ms | +2.76% | | query_block/query_block_in(10)_times(10000) | 1096.2±389.15ms | **815.5±12.13ms** | **-25.61%** | | query_block/query_block_in(1000)_times(100) | **1190.4±36.50µs** | 1269.2±114.42µs | **+6.62%** | | query_block/query_block_in(1000)_times(1000) | **11.8±0.88ms** | 13.3±1.33ms | **+12.71%** | | query_block/query_block_in(1000)_times(10000) | **115.7±3.13ms** | 124.2±5.21ms | **+7.35%** | | storage_transaction | 1128.7±449.35µs | 1140.9±472.39µs | +1.08% | | vm/transaction_execution/1 | 410.8±19.04ms | 413.2±15.23ms | +0.58% | | vm/transaction_execution/10 | **134.0±6.63ms** | 168.3±24.17ms | **+25.60%** | | vm/transaction_execution/20 | **119.4±4.05ms** | 133.5±10.16ms | **+11.81%** | | vm/transaction_execution/5 | 170.0±10.32ms | **159.8±7.15ms** | **-6.00%** | | vm/transaction_execution/50 | 146.8±10.12ms | 141.9±6.22ms | -3.34% |
github-actions[bot] commented 1 month ago

Benchmark for 1eff680

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | accumulator_append | 847.5±211.31µs | 1025.3±213.10µs | +20.98% | | block_apply/block_apply_10 | 388.1±21.80ms | **372.8±9.98ms** | **-3.94%** | | block_apply/block_apply_1000 | 45.3±3.04s | **41.7±1.22s** | **-7.95%** | | get_with_proof/db_store | 44.1±3.73µs | 43.9±4.32µs | -0.45% | | get_with_proof/mem_store | 38.8±6.97µs | 36.4±3.34µs | -6.19% | | put_and_commit/db_store/1 | 127.4±18.87µs | 121.5±18.20µs | -4.63% | | put_and_commit/db_store/10 | 1168.4±133.39µs | 1096.8±101.23µs | -6.13% | | put_and_commit/db_store/100 | 10.2±0.97ms | 9.8±0.74ms | -3.92% | | put_and_commit/db_store/5 | 534.1±63.80µs | 555.5±66.68µs | +4.01% | | put_and_commit/db_store/50 | 5.1±0.37ms | 5.4±0.95ms | +5.88% | | put_and_commit/mem_store/1 | 71.5±11.64µs | 75.4±13.13µs | +5.45% | | put_and_commit/mem_store/10 | 645.6±55.67µs | 673.5±80.70µs | +4.32% | | put_and_commit/mem_store/100 | 6.7±0.87ms | 6.7±1.24ms | 0.00% | | put_and_commit/mem_store/5 | 331.3±34.66µs | 344.5±54.44µs | +3.98% | | put_and_commit/mem_store/50 | 3.3±0.40ms | 3.3±0.59ms | 0.00% | | query_block/query_block_in(10)_times(100) | 9.3±1.26ms | 9.1±1.15ms | -2.15% | | query_block/query_block_in(10)_times(1000) | 87.8±4.63ms | **82.4±4.69ms** | **-6.15%** | | query_block/query_block_in(10)_times(10000) | **825.4±37.71ms** | 1089.2±180.34ms | **+31.96%** | | query_block/query_block_in(1000)_times(100) | 1317.7±80.76µs | 1254.0±141.72µs | -4.83% | | query_block/query_block_in(1000)_times(1000) | 12.7±1.00ms | 13.0±1.54ms | +2.36% | | query_block/query_block_in(1000)_times(10000) | 134.3±15.06ms | **119.7±3.46ms** | **-10.87%** | | storage_transaction | 1121.9±441.75µs | 1088.6±477.46µs | -2.97% | | vm/transaction_execution/1 | **416.9±20.63ms** | 489.1±36.16ms | **+17.32%** | | vm/transaction_execution/10 | 140.4±13.43ms | **131.3±4.79ms** | **-6.48%** | | vm/transaction_execution/20 | 127.9±11.06ms | 133.5±9.77ms | +4.38% | | vm/transaction_execution/5 | 169.7±14.59ms | 171.7±21.59ms | +1.18% | | vm/transaction_execution/50 | 148.0±10.86ms | 157.3±17.74ms | +6.28% |
github-actions[bot] commented 1 month ago

Benchmark for 7c0ab44

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | accumulator_append | 900.4±184.98µs | 898.1±180.83µs | -0.26% | | block_apply/block_apply_10 | **378.5±11.93ms** | 424.3±28.61ms | **+12.10%** | | block_apply/block_apply_1000 | **44.1±1.68s** | 45.1±3.38s | **+2.27%** | | get_with_proof/db_store | **43.9±1.96µs** | 46.1±5.54µs | **+5.01%** | | get_with_proof/mem_store | **36.0±1.06µs** | 42.7±8.74µs | **+18.61%** | | put_and_commit/db_store/1 | 128.2±16.36µs | 142.2±29.51µs | +10.92% | | put_and_commit/db_store/10 | 1109.1±142.58µs | 1105.3±149.13µs | -0.34% | | put_and_commit/db_store/100 | 12.2±2.79ms | **9.8±0.61ms** | **-19.67%** | | put_and_commit/db_store/5 | **587.7±120.54µs** | 709.1±126.63µs | **+20.66%** | | put_and_commit/db_store/50 | 6.0±0.98ms | 5.4±0.60ms | -10.00% | | put_and_commit/mem_store/1 | 72.5±10.86µs | 82.8±16.99µs | +14.21% | | put_and_commit/mem_store/10 | 693.5±111.79µs | 690.0±81.34µs | -0.50% | | put_and_commit/mem_store/100 | 6.9±0.79ms | 6.6±0.86ms | -4.35% | | put_and_commit/mem_store/5 | 358.0±54.40µs | 366.1±69.70µs | +2.26% | | put_and_commit/mem_store/50 | 3.9±0.63ms | **3.4±0.44ms** | **-12.82%** | | query_block/query_block_in(10)_times(100) | 9.8±1.72ms | **8.6±0.49ms** | **-12.24%** | | query_block/query_block_in(10)_times(1000) | 85.9±9.78ms | 83.9±5.45ms | -2.33% | | query_block/query_block_in(10)_times(10000) | **952.0±64.57ms** | 1176.1±339.36ms | **+23.54%** | | query_block/query_block_in(1000)_times(100) | 1397.4±96.25µs | 1403.6±159.84µs | +0.44% | | query_block/query_block_in(1000)_times(1000) | 14.6±2.67ms | 14.1±2.37ms | -3.42% | | query_block/query_block_in(1000)_times(10000) | 132.7±5.79ms | 134.9±17.16ms | +1.66% | | storage_transaction | 1132.6±425.72µs | 1235.1±511.71µs | +9.05% | | vm/transaction_execution/1 | 470.1±35.16ms | 478.2±51.26ms | +1.72% | | vm/transaction_execution/10 | 133.5±8.35ms | 140.1±8.16ms | +4.94% | | vm/transaction_execution/20 | 134.7±10.61ms | 131.0±11.10ms | -2.75% | | vm/transaction_execution/5 | 180.8±21.55ms | **169.3±9.03ms** | **-6.36%** | | vm/transaction_execution/50 | 147.2±11.74ms | 148.1±9.01ms | +0.61% |
github-actions[bot] commented 1 month ago

Benchmark for 3c0cbe0

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | accumulator_append | 1023.2±231.25µs | 1002.1±258.07µs | -2.06% | | block_apply/block_apply_10 | 494.6±72.72ms | **388.5±15.02ms** | **-21.45%** | | block_apply/block_apply_1000 | 49.6±3.97s | **48.0±3.38s** | **-3.23%** | | get_with_proof/db_store | 50.3±9.74µs | **43.8±1.80µs** | **-12.92%** | | get_with_proof/mem_store | 36.6±5.58µs | 37.9±3.61µs | +3.55% | | put_and_commit/db_store/1 | 161.6±34.41µs | **123.4±13.75µs** | **-23.64%** | | put_and_commit/db_store/10 | 1374.2±258.65µs | 1386.6±199.07µs | +0.90% | | put_and_commit/db_store/100 | 11.4±1.78ms | **10.3±0.83ms** | **-9.65%** | | put_and_commit/db_store/5 | 924.2±101.95µs | **690.3±112.43µs** | **-25.31%** | | put_and_commit/db_store/50 | 5.4±0.61ms | 5.4±0.77ms | 0.00% | | put_and_commit/mem_store/1 | 75.8±15.79µs | 74.6±10.41µs | -1.58% | | put_and_commit/mem_store/10 | 887.6±179.76µs | **690.3±78.54µs** | **-22.23%** | | put_and_commit/mem_store/100 | 7.3±1.38ms | 6.7±0.88ms | -8.22% | | put_and_commit/mem_store/5 | 390.7±65.15µs | 403.4±72.24µs | +3.25% | | put_and_commit/mem_store/50 | 4.0±0.85ms | 3.8±0.72ms | -5.00% | | query_block/query_block_in(10)_times(100) | **8.9±1.27ms** | 10.2±2.53ms | **+14.61%** | | query_block/query_block_in(10)_times(1000) | 99.6±22.42ms | **88.4±7.21ms** | **-11.24%** | | query_block/query_block_in(10)_times(10000) | 1106.8±175.62ms | **925.2±83.59ms** | **-16.41%** | | query_block/query_block_in(1000)_times(100) | 1475.0±186.12µs | 1604.4±385.50µs | +8.77% | | query_block/query_block_in(1000)_times(1000) | **13.0±0.89ms** | 16.2±3.65ms | **+24.62%** | | query_block/query_block_in(1000)_times(10000) | 138.1±15.39ms | 129.1±11.37ms | -6.52% | | storage_transaction | 1288.9±433.89µs | 999.1±326.62µs | -22.48% | | vm/transaction_execution/1 | 527.8±79.31ms | 549.6±90.62ms | +4.13% | | vm/transaction_execution/10 | **168.6±9.60ms** | 205.3±8.21ms | **+21.77%** | | vm/transaction_execution/20 | **130.5±8.30ms** | 164.3±12.86ms | **+25.90%** | | vm/transaction_execution/5 | 193.3±16.29ms | 202.7±48.18ms | +4.86% | | vm/transaction_execution/50 | **151.7±11.59ms** | 170.6±17.11ms | **+12.46%** |