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

feat!: use total_gas and total_fee from tx status #1574

Merged
merged 26 commits into from
Feb 24, 2025

Conversation

hal3e
Copy link
Contributor

@hal3e hal3e commented Jan 15, 2025

closes: #1394

Release notes

In this PR we expose the tx status from succeeded translations in our higher level APIs. The user can use the (if available) tx_status and tx_id from the following transaction APIs

  • deployment
  • transfers
  • force transfers to contract
  • withdrawals to base layer
  • blob upload
  • contract, script and predicate calls/simulations

Note that the TransactionCost's field gas_used was renamed to script_gas and a new field total_gas is added.

Summary

The GasValidation trait is removed. This trait was used to make sure that the script_gas_limit is set correctly. The script_gas_limit is either:

  • 0 if there is no script code,
  • set by the user,
  • estimated by our builders
    so an additional check before sending the tx is redundant - By removing it we have one less dry run before sending the tx.

Breaking Changes

  • Removed get_response_from method from CallHandlers
  • CallResponse refactored and added tx_status: Success field
  • Method get_response accepts TxStatus instead of Vec<Receipts>
  • Method new is removed form CallResponse
  • GasValidation trait is removed from transaction builders
  • Accounts transfer method returns Result<TxResponse>
  • Accounts force_transfer_to_contract method returns Result<TxResponse>
  • Accounts withdraw_to_base_layer method returns Result<WithdrawToBaseResponse>
  • Executable<Loader>'s upload_blob returns Result<Option<TxResponse>>
  • Contract's deploy and deploy_if_not_exists return Result<DeployResponse> and Response<Option<DeployResponse>> respectively
    -TransactionCost's field gas_used renamed to script_gas

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@hal3e hal3e self-assigned this Jan 15, 2025
@hal3e hal3e added the tech-debt Improves code quality or safety label Jan 15, 2025
@hal3e hal3e changed the title feat: use total_gas and total_fee from tx status feat!: use total_gas and total_fee from tx status Feb 4, 2025
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
@segfault-magnet segfault-magnet self-requested a review February 16, 2025 13:05
@hal3e hal3e requested a review from MujkicA February 24, 2025 10:10
@hal3e hal3e merged commit 8ac1ce9 into master Feb 24, 2025
45 checks passed
@hal3e hal3e deleted the hal3e/total-fee-from-status branch February 24, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Improves code quality or safety
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore: use total_fee from the transaction status once refactoring exposes it
4 participants