-
Notifications
You must be signed in to change notification settings - Fork 289
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
rm VMAdapter #4191
rm VMAdapter #4191
Conversation
WalkthroughThe changes involve modifications to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant StarcoinVM
participant TransactionProcessor
User->>StarcoinVM: Submit Transaction
StarcoinVM->>TransactionProcessor: Process Transaction
TransactionProcessor-->>StarcoinVM: Return Result
StarcoinVM-->>User: Send Transaction Output
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- vm/vm-runtime/src/parallel_executor/vm_wrapper.rs (1 hunks)
- vm/vm-runtime/src/starcoin_vm.rs (6 hunks)
- vm/vm-runtime/src/vm_adapter/mod.rs (1 hunks)
Files skipped from review due to trivial changes (1)
- vm/vm-runtime/src/parallel_executor/vm_wrapper.rs
Additional comments not posted (8)
vm/vm-runtime/src/vm_adapter/mod.rs (4)
6-8
: LGTM!The changes to the public use declarations are approved. Directly importing specific types from
starcoin_vm_types
instead of the entireadapter_common
module suggests a more focused approach to managing dependencies.
10-14
: LGTM!The new enum
PreprocessedTransaction
is a great addition. It enhances type safety and clarity of the transaction processing logic by clearly encapsulating different transaction types.
16-26
: LGTM!The new function
preprocess_transaction
is a valuable addition. It improves the handling of different transaction types and streamlines the processing logic by clearly delineating how each transaction is treated.
Line range hint
1-26
: Overall, the changes in this file are excellent!The modifications reflect a more structured approach to transaction management within the module, enhancing both clarity and functionality. The removal of the
adapter_common
module from the public use declarations, the introduction of thePreprocessedTransaction
enum, and the addition of thepreprocess_transaction
function all contribute to a cleaner and more focused design.Great work on improving the transaction processing logic!
vm/vm-runtime/src/starcoin_vm.rs (4)
81-91
: LGTM!The code changes are approved.
93-102
: LGTM!The code changes are approved.
1491-1513
: LGTM!The code changes are approved.
1515-1526
: LGTM!The code changes are approved.
let sender = txn.sender().to_string(); | ||
let (vm_status, output) = self.execute_user_transaction(data_cache, *txn.clone()); | ||
// XXX FIXME YSG | ||
// let gas_unit_price = transaction.gas_unit_price(); think about gas_used OutOfGas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the TODO comment.
The TODO comment indicates that the gas_used
logic needs to be fixed to handle OutOfGas
scenarios.
Do you want me to open a GitHub issue to track this task? I can also help brainstorm potential solutions if needed.
|
||
pub(crate) fn should_restart_execution(output: &TransactionOutput) -> bool { | ||
// XXX FIXME YSG if GasSchedule.move UpgradeEvent | ||
for event in output.events() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the TODO comment.
The TODO comment indicates that the logic to determine if execution should be restarted needs to be fixed to handle GasSchedule
changes.
Do you want me to open a GitHub issue to track this task? I can also help brainstorm potential solutions if needed.
Ok(match txn { | ||
PreprocessedTransaction::UserTransaction(txn) => { | ||
let sender = txn.sender().to_string(); | ||
let (vm_status, output) = self.execute_user_transaction(data_cache, *txn.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the TODO comment.
The TODO comment indicates that the sender string logic needs to be fixed.
Do you want me to open a GitHub issue to track this task? I can also help brainstorm potential solutions if needed.
} | ||
PreprocessedTransaction::BlockMetadata(block_meta) => { | ||
let (vm_status, output) = | ||
match self.process_block_metadata(data_cache, block_meta.clone()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the TODO comment.
The TODO comment indicates that the match logic needs to be fixed.
Do you want me to open a GitHub issue to track this task? I can also help brainstorm potential solutions if needed.
8d4cea0
to
9b757f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (2)
vm/vm-runtime/src/starcoin_vm.rs (2)
1491-1513
: Overall structure looks good, but address the TODO comments.The overall structure of the function, with matching on the transaction type and executing accordingly, looks good.
However, please address the following TODO comments:
- Review the gas unit price logic to handle
OutOfGas
scenarios.- Fix the sender string logic.
1515-1526
: Overall logic looks good, but address the TODO comment.The overall logic of the function, with checking for specific events and their creator address to determine if execution should be restarted, looks good.
However, please address the following TODO comment:
- Review and fix the logic for checking the
GasSchedule
andUpgradeEvent
.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- vm/vm-runtime/src/parallel_executor/vm_wrapper.rs (1 hunks)
- vm/vm-runtime/src/starcoin_vm.rs (6 hunks)
- vm/vm-runtime/src/vm_adapter/mod.rs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- vm/vm-runtime/src/parallel_executor/vm_wrapper.rs
Additional comments not posted (5)
vm/vm-runtime/src/vm_adapter/mod.rs (3)
5-6
: LGTM!The changes to the public use declarations are approved. Removing the
adapter_common
module and directly importing specific types fromstarcoin_vm_types
suggests a more focused approach to handling transaction types.
10-14
: LGTM!The new enum
PreprocessedTransaction
is approved. It enhances the type safety and clarity of the transaction processing logic by encapsulating theUserTransaction
andBlockMetadata
variants.
16-26
: LGTM!The new function
preprocess_transaction
is approved. It improves the handling of different transaction types and streamlines the processing logic by clearly delineating how each transaction is treated.vm/vm-runtime/src/starcoin_vm.rs (2)
81-91
: LGTM!The code changes are approved.
93-102
: LGTM!The code changes are approved.
Benchmark for d5c3c19Click to view benchmark
|
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
New Features
PreprocessedTransaction
enum for better type safety.StarcoinVM
.Bug Fixes
Refactor
Documentation