-
Notifications
You must be signed in to change notification settings - Fork 723
Feat/blocksimulate endpoint #6724
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
base: develop
Are you sure you want to change the base?
Changes from all commits
c0ab371
33fd1e2
de360c6
736c416
efc925e
bf25dfb
a2232de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -564,6 +564,7 @@ impl StacksChainState { | |
| } | ||
|
|
||
| StacksChainState::account_debit(clarity_tx, &payer_account.principal, fee); | ||
|
|
||
| Ok(fee) | ||
| } | ||
|
|
||
|
|
@@ -1568,6 +1569,8 @@ impl StacksChainState { | |
| debug!("Process transaction {} ({})", tx.txid(), tx.payload.name()); | ||
| let epoch = clarity_block.get_epoch(); | ||
|
|
||
| let no_fees = clarity_block.block.no_fees; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct me if I'm wrong, but the purpose of this endpoint is to faithfully re-execute a block. The block will almost certainly contain transactions for transferring assets between accounts (including STX). Disabling fee payment along with the commensurate nonce increment would likely invalidate or otherwise alter the execution of transactions, leading to an unfaithful block re-execution. Can you help me understand what purpose is served by this feature?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The block simulator allows you to execute "brand-new" transactions in a block (mainly as a quick-test mechanism). The (current) main usage is to run contract deploys and calls at specific heights (for example i am using it as the base for some integration tests for the python bindings). It happens sometime (especially when randomly generating keys) that having STXs is convoluted (in practice you are running your functions in the past). For this reason having the ability to run stuff "for free" is quite handy. Obviously if it does pose some risk it is definitely a feature that can be removed without harming the main goal of the patch. |
||
|
|
||
| StacksChainState::process_transaction_precheck(&clarity_block.config, tx, epoch)?; | ||
|
|
||
| // what version of Clarity did the transaction caller want? And, is it valid now? | ||
|
|
@@ -1592,7 +1595,10 @@ impl StacksChainState { | |
|
|
||
| let payer_address = payer_account.principal.clone(); | ||
| let payer_nonce = payer_account.nonce; | ||
| StacksChainState::pay_transaction_fee(&mut transaction, fee, payer_account)?; | ||
|
|
||
| if !no_fees { | ||
| StacksChainState::pay_transaction_fee(&mut transaction, fee, payer_account)?; | ||
| } | ||
|
|
||
| // origin balance may have changed (e.g. if the origin paid the tx fee), so reload the account | ||
| let origin_account = | ||
|
|
@@ -1633,8 +1639,10 @@ impl StacksChainState { | |
| None, | ||
| )?; | ||
|
|
||
| let new_payer_account = StacksChainState::get_payer_account(&mut transaction, tx); | ||
| StacksChainState::pay_transaction_fee(&mut transaction, fee, new_payer_account)?; | ||
| if !no_fees { | ||
| let new_payer_account = StacksChainState::get_payer_account(&mut transaction, tx); | ||
| StacksChainState::pay_transaction_fee(&mut transaction, fee, new_payer_account)?; | ||
| } | ||
|
|
||
| // update the account nonces | ||
| StacksChainState::update_account_nonce( | ||
|
|
||
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.
"trnsactions"