-
Notifications
You must be signed in to change notification settings - Fork 85
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
fix: fix the deprecated L1_Handler transaction hash computation #1132
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1132 +/- ##
==========================================
+ Coverage 74.19% 74.22% +0.02%
==========================================
Files 73 73
Lines 6642 6657 +15
Branches 6642 6657 +15
==========================================
+ Hits 4928 4941 +13
Misses 873 873
- Partials 841 843 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Reviewable status: 0 of 4 files reviewed, 4 unresolved discussions (waiting on @ShahakShama and @Yael-Starkware)
crates/papyrus_common/src/transaction_hash.rs
line 273 at r1 (raw file):
L1HandlerVersions::Deprecated, )?, ];
Consider
Suggestion:
Ok(vec![
get_common_l1_handler_transaction_hash(
transaction,
chain_id,
L1HandlerVersions::PreL1Handler,
)?,
get_common_l1_handler_transaction_hash(
transaction,
chain_id,
L1HandlerVersions::Deprecated,
)?,
])
crates/papyrus_common/src/transaction_hash.rs
line 278 at r1 (raw file):
#[derive(PartialEq)] enum L1HandlerVersions {
Please move the definition up. (maybe right before the first use?)
crates/papyrus_common/src/transaction_hash.rs
line 284 at r1 (raw file):
} fn get_common_l1_handler_transaction_hash(
This function is hard to track and will be harder with more hash versions.
Consider one of the following:
- Splitting the PreL1Handler to a function that doesn't call 'get_common_l1_handler_transaction_hash'.
- Determine the chain_if conditions by
<
instead of=
.
crates/papyrus_common/src/transaction_hash_test.rs
line 35 at r1 (raw file):
#[derive(Deserialize, Serialize)] struct TransactionWithHash {
Rename it?
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.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @Yael-Starkware and @yoavGrs)
crates/papyrus_common/src/transaction_hash.rs
line 279 at r1 (raw file):
#[derive(PartialEq)] enum L1HandlerVersions { PreL1Handler,
Consider AsInvoke instead of PreL1Handler
crates/papyrus_common/src/transaction_hash.rs
line 280 at r1 (raw file):
enum L1HandlerVersions { PreL1Handler, Deprecated,
Deprecated is now not a good name. find another name for it
crates/papyrus_common/src/transaction_hash.rs
line 284 at r1 (raw file):
Previously, yoavGrs wrote…
This function is hard to track and will be harder with more hash versions.
Consider one of the following:
- Splitting the PreL1Handler to a function that doesn't call 'get_common_l1_handler_transaction_hash'.
- Determine the chain_if conditions by
<
instead of=
.
- Whenever there's a branch, stop the chain and store it in a mid variable and do a match to determine what's the next value you should chain
crates/papyrus_common/src/transaction_hash_test.rs
line 35 at r1 (raw file):
Previously, yoavGrs wrote…
Rename it?
Possible name, TransactionTestData
b7e15e8
to
70bbbf1
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.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ShahakShama and @yoavGrs)
crates/papyrus_common/src/transaction_hash.rs
line 273 at r1 (raw file):
Previously, yoavGrs wrote…
Consider
done
crates/papyrus_common/src/transaction_hash.rs
line 278 at r1 (raw file):
Previously, yoavGrs wrote…
Please move the definition up. (maybe right before the first use?)
done
crates/papyrus_common/src/transaction_hash.rs
line 279 at r1 (raw file):
Previously, ShahakShama wrote…
Consider AsInvoke instead of PreL1Handler
done
crates/papyrus_common/src/transaction_hash.rs
line 280 at r1 (raw file):
Previously, ShahakShama wrote…
Deprecated is now not a good name. find another name for it
done
crates/papyrus_common/src/transaction_hash.rs
line 284 at r1 (raw file):
Previously, ShahakShama wrote…
- Whenever there's a branch, stop the chain and store it in a mid variable and do a match to determine what's the next value you should chain
done
crates/papyrus_common/src/transaction_hash_test.rs
line 35 at r1 (raw file):
Previously, ShahakShama wrote…
Possible name, TransactionTestData
done
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.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @yoavGrs)
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.
Reviewed 2 of 4 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Yael-Starkware)
crates/papyrus_common/src/transaction_hash.rs
line 285 at r2 (raw file):
) -> Result<StarkHash, StarknetApiError> { Ok(PedersenHashChain::new() .chain_if(&L1_HANDLER, version > L1HandlerVersions::AsInvoke)
WDYT about a chain_if_else
function, for switching between two options by a condition?
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Yael-Starkware)
7223101
70bbbf1
to
7223101
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.
Reviewable status: 3 of 4 files reviewed, all discussions resolved (waiting on @ShahakShama and @yoavGrs)
crates/papyrus_common/src/transaction_hash.rs
line 285 at r2 (raw file):
Previously, yoavGrs wrote…
WDYT about a
chain_if_else
function, for switching between two options by a condition?
done
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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)
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?
Does this introduce a breaking change?
Other information
This change is