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

Minor improvements to Account package #1224

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

immrsd
Copy link
Collaborator

@immrsd immrsd commented Nov 19, 2024

PR Checklist

  • Tests
  • Documentation
  • Added entry to CHANGELOG.md
  • Tried the feature on a public network

@immrsd immrsd self-assigned this Nov 19, 2024
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.02%. Comparing base (20d5d92) to head (8906e79).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1224      +/-   ##
==========================================
- Coverage   92.06%   92.02%   -0.04%     
==========================================
  Files          49       49              
  Lines        1399     1392       -7     
==========================================
- Hits         1288     1281       -7     
  Misses        111      111              
Files with missing lines Coverage Δ
...kages/access/src/accesscontrol/accesscontrol.cairo 73.33% <ø> (ø)
packages/account/src/account.cairo 97.91% <100.00%> (-0.20%) ⬇️
packages/account/src/eth_account.cairo 98.11% <100.00%> (-0.17%) ⬇️
packages/account/src/extensions/src9/src9.cairo 91.66% <ø> (ø)
packages/account/src/utils.cairo 90.90% <100.00%> (+3.40%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20d5d92...8906e79. Read the comment docs.

---- 🚨 Try these New Features:

Copy link
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

} else {
assert(MIN_TRANSACTION_VERSION <= tx_version, Errors::INVALID_TX_VERSION);
}
assert(is_tx_version_valid(), Errors::INVALID_TX_VERSION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some non-blocking comments regarding the changelog. Otherwise, LGTM!

Comment on lines -79 to +76
// Check tx version
let tx_info = get_tx_info().unbox();
let tx_version: u256 = tx_info.version.into();
// Check if tx is a query
if (tx_version >= QUERY_OFFSET) {
assert(
QUERY_OFFSET + MIN_TRANSACTION_VERSION <= tx_version, Errors::INVALID_TX_VERSION
);
} else {
assert(MIN_TRANSACTION_VERSION <= tx_version, Errors::INVALID_TX_VERSION);
}
assert(is_tx_version_valid(), Errors::INVALID_TX_VERSION);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

pub fn execute_calls(mut calls: Span<Call>) -> Array<Span<felt252>> {
pub fn execute_calls(calls: Span<Call>) -> Array<Span<felt252>> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we list this under Changed (not breaking) in the changelog?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, same with __execute__

Comment on lines +25 to +33
/// If the transaction is a simulation (version >= `QUERY_OFFSET`), it must be
/// greater than or equal to `QUERY_OFFSET` + `MIN_TRANSACTION_VERSION` to be considered valid.
/// Otherwise, it must be greater than or equal to `MIN_TRANSACTION_VERSION`.
pub fn is_tx_version_valid() -> bool {
let tx_info = starknet::get_tx_info().unbox();
let tx_version = tx_info.version.into();
if tx_version >= QUERY_OFFSET {
QUERY_OFFSET + MIN_TRANSACTION_VERSION <= tx_version
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add this to the changelog as well since it's pub

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.

3 participants