-
Notifications
You must be signed in to change notification settings - Fork 21
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
chore: split transaction file part one fields dedicated file #1732
base: main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @ArniStarkware and the rest of your teammates on Graphite |
Artifacts upload triggered. View details here |
dcd1085
to
e0a8262
Compare
Artifacts upload triggered. View details here |
e0a8262
to
1474378
Compare
Artifacts upload triggered. View details here |
1474378
to
794b619
Compare
Artifacts upload triggered. View details here |
Benchmark movements: |
794b619
to
c415283
Compare
Artifacts upload triggered. View details here |
Benchmark movements: |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1732 +/- ##
===========================================
+ Coverage 40.10% 62.50% +22.39%
===========================================
Files 26 331 +305
Lines 1895 35458 +33563
Branches 1895 35458 +33563
===========================================
+ Hits 760 22163 +21403
- Misses 1100 11406 +10306
- Partials 35 1889 +1854 ☔ View full report in Codecov by Sentry. |
c415283
to
795d02e
Compare
Artifacts upload triggered. View details here |
795d02e
to
b22dc1a
Compare
Artifacts upload triggered. View details here |
Benchmark movements: |
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 116 files reviewed, 4 unresolved discussions (waiting on @ArniStarkware and @dorimedini-starkware)
crates/starknet_api/src/transaction.rs
line 118 at r1 (raw file):
} }
Please move this struct as well.
crates/starknet_api/src/transaction.rs
line 716 at r1 (raw file):
#[serde(flatten)] pub output: TransactionOutput, }
This as well?
Code quote:
/// A transaction receipt.
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
pub struct TransactionReceipt {
pub transaction_hash: TransactionHash,
pub block_hash: BlockHash,
pub block_number: BlockNumber,
#[serde(flatten)]
pub output: TransactionOutput,
}
crates/starknet_api/src/transaction.rs
line 843 at r1 (raw file):
#[derive( Debug, Default, Copy, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord, )]
these as well?
Code quote:
#[derive(Debug, Default, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct MessageToL2 {
pub from_address: EthAddress,
pub payload: L1ToL2Payload,
}
/// An L2 to L1 message.
#[derive(Debug, Default, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct MessageToL1 {
pub from_address: ContractAddress,
pub to_address: EthAddress,
pub payload: L2ToL1Payload,
}
/// The payload of [`MessageToL2`].
#[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct L1ToL2Payload(pub Vec<Felt>);
/// The payload of [`MessageToL1`].
#[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct L2ToL1Payload(pub Vec<Felt>);
/// An event.
#[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct Event {
// TODO: Add a TransactionHash element to this struct, and then remove EventLeafElements.
pub from_address: ContractAddress,
#[serde(flatten)]
pub content: EventContent,
}
/// An event content.
#[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct EventContent {
pub keys: Vec<EventKey>,
pub data: EventData,
}
/// An event key.
#[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct EventKey(pub Felt);
/// An event data.
#[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct EventData(pub Vec<Felt>);
/// The index of a transaction in [BlockBody](`crate::block::BlockBody`).
#[derive(
Debug, Default, Copy, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord,
)]
pub struct TransactionOffsetInBlock(pub usize);
/// The index of an event in [TransactionOutput](`crate::transaction::TransactionOutput`).
#[derive(
Debug, Default, Copy, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord,
)]
crates/starknet_api/src/transaction/fields.rs
line 1 at r1 (raw file):
use std::collections::BTreeMap;
What do you think about these names? Are they better names?
transaction_components.rs
transaction_structs.rs
transaction_inner.rs
Code quote:
use std::collections::BTreeMap;
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 116 files reviewed, 4 unresolved discussions (waiting on @dorimedini-starkware and @MohammadNassar1)
crates/starknet_api/src/transaction.rs
line 118 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Please move this struct as well.
I thought about it!
- Let us not deal with this in this PR - it is big enough as it is.
- This struct is used only for transaction hash calculation - as an add on to transaction version. I think this one should be in a different file related to transaction hash.
crates/starknet_api/src/transaction.rs
line 716 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
This as well?
This is not a field related to transactions. This is used as an output of the execution.
crates/starknet_api/src/transaction.rs
line 843 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
these as well?
About almost all structs mentioned - I suggest creating a file for L1<-> L2 messages in a different PR.
About TransactionOffsetInBlock
- I suspect it is closer related to TransactionReceipt
- as they are both related to execution output (I think... I am not sure - I am sure these are not fields of a transaction).
crates/starknet_api/src/transaction/fields.rs
line 1 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
What do you think about these names? Are they better names?
transaction_components.rs
transaction_structs.rs
transaction_inner.rs
transaction_components.rs
is my favorite so far.
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 116 files reviewed, 6 unresolved discussions (waiting on @dorimedini-starkware and @MohammadNassar1)
crates/starknet_api/src/transaction/fields.rs
line 16 at r1 (raw file):
// TODO(Noa, 14/11/2023): Replace QUERY_VERSION_BASE_BIT with a lazy calculation. // pub static QUERY_VERSION_BASE: Lazy<Felt> = ... pub const QUERY_VERSION_BASE_BIT: u32 = 128;
Related to tx version and tx hash...
Code quote:
// TODO(Noa, 14/11/2023): Replace QUERY_VERSION_BASE_BIT with a lazy calculation.
// pub static QUERY_VERSION_BASE: Lazy<Felt> = ...
pub const QUERY_VERSION_BASE_BIT: u32 = 128;
crates/starknet_api/src/transaction/fields.rs
line 129 at r1 (raw file):
/// [TransactionVersion] constant that's equal to 3. pub const THREE: Self = { Self(Felt::THREE) }; }
Related to tx version and tx hash...
Code quote:
/// A transaction version.
#[derive(
Debug,
Copy,
Clone,
Default,
Eq,
PartialEq,
Hash,
Deserialize,
Serialize,
PartialOrd,
Ord,
derive_more::Deref,
)]
pub struct TransactionVersion(pub Felt);
impl TransactionVersion {
/// [TransactionVersion] constant that's equal to 0.
pub const ZERO: Self = { Self(Felt::ZERO) };
/// [TransactionVersion] constant that's equal to 1.
pub const ONE: Self = { Self(Felt::ONE) };
/// [TransactionVersion] constant that's equal to 2.
pub const TWO: Self = { Self(Felt::TWO) };
/// [TransactionVersion] constant that's equal to 3.
pub const THREE: Self = { Self(Felt::THREE) };
}
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 116 files reviewed, 6 unresolved discussions (waiting on @ArniStarkware and @dorimedini-starkware)
crates/starknet_api/src/transaction.rs
line 118 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
I thought about it!
- Let us not deal with this in this PR - it is big enough as it is.
- This struct is used only for transaction hash calculation - as an add on to transaction version. I think this one should be in a different file related to transaction hash.
Sounds good.
crates/starknet_api/src/transaction.rs
line 716 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
This is not a field related to transactions. This is used as an output of the execution.
Agree.
crates/starknet_api/src/transaction.rs
line 843 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
About almost all structs mentioned - I suggest creating a file for L1<-> L2 messages in a different PR.
About
TransactionOffsetInBlock
- I suspect it is closer related toTransactionReceipt
- as they are both related to execution output (I think... I am not sure - I am sure these are not fields of a transaction).
Why do we need a new file for l1 messages
?
Why it's different from other fields (e.g. fee).
I agree that TxOffset..
is unrelated.
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 116 files reviewed, 5 unresolved discussions (waiting on @dorimedini-starkware and @MohammadNassar1)
crates/starknet_api/src/transaction.rs
line 118 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Sounds good.
Done.
crates/starknet_api/src/transaction.rs
line 716 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Agree.
Done.
crates/starknet_api/src/transaction.rs
line 843 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Why do we need a new file for
l1 messages
?
Why it's different from other fields (e.g. fee).I agree that
TxOffset..
is unrelated.
About something like l1 messages
:
I am not an expert about these type of fields which is why:
- I did not want to move them to this file if I was not sure they belonged there.
- Again - this PR is big enough as it is - let us deal with them in a different PR.
Added a TODO.
crates/starknet_api/src/transaction/fields.rs
line 1 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
transaction_components.rs
is my favorite so far.
In rust - members of a struct are called fields.
@ShahakShama seems to prefer this name. Other people I asked don't have any input.
b22dc1a
to
d667cfa
Compare
d667cfa
to
7cc2daf
Compare
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Benchmark movements: full_committer_flow performance regressed! |
7cc2daf
to
19723b1
Compare
Artifacts upload triggered. View details here |
Benchmark movements: |
19723b1
to
4e59211
Compare
4e59211
to
3da583c
Compare
Artifacts upload triggered. View details here |
3da583c
to
36cfdfe
Compare
Artifacts upload triggered. View details here |
Previously, ArniStarkware (Arnon Hod) wrote…
Now not a part of this PR. In a Future PR we will handle:
|
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 117 files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware and @MohammadNassar1)
crates/starknet_api/src/transaction/fields.rs
line 129 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Related to tx version and tx hash...
Now not a part of this PR. In a future PR we will have a file dedicated to tx version.
36cfdfe
to
bb70300
Compare
Artifacts upload triggered. View details here |
Benchmark movements: |
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 116 files at r3, 117 of 117 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dorimedini-starkware)
crates/l1-provider/src/lib.rs
line 45 at r4 (raw file):
todo!( "Purges txs from internal buffers, if was proposer clear staging buffer, reset state to Pending until we get proposing/validating notice from consensus."
What's this change?
Code quote:
"Purges txs from internal buffers, if was proposer clear staging buffer,
reset state to Pending until we get proposing/validating notice from consensus."
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 @ArniStarkware and @dorimedini-starkware)
bb70300
to
cdd768f
Compare
Artifacts upload triggered. View details here |
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 r5.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on @dorimedini-starkware)
crates/l1-provider/src/lib.rs
line 45 at r4 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
What's this change?
The autoformatter added this change. Reverting.
Out of scope for this PR.
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 all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @dorimedini-starkware)
chore: split transaction file part one fields dedicated file
chore: remove public imports from starknet api transaction