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(rpc/v08): add l1_data_gas to v3 transaction resource bounds #2385

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/gateway-types/src/reply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,14 @@ pub mod transaction {
pub l1_gas: ResourceBound,
#[serde(rename = "L2_GAS")]
pub l2_gas: ResourceBound,
// Introduced in Starknet v0.13.4. This has to be optional because not sending it to the
// gateway is not equivalent to sending an explicit zero bound.
#[serde(
default,
skip_serializing_if = "Option::is_none",
rename = "L1_DATA_GAS"
)]
pub l1_data_gas: Option<ResourceBound>,
}

impl From<ResourceBounds> for pathfinder_common::transaction::ResourceBounds {
Expand All @@ -816,6 +824,8 @@ pub mod transaction {
Self {
l1_gas: value.l1_gas.into(),
l2_gas: value.l2_gas.into(),
// TODO: add this when adding support for Starknet 0.13.4
l1_data_gas: None,
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions crates/rpc/fixtures/0.6.0/broadcasted_transactions.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@
],
"nonce": "0x8",
"resource_bounds": {
"l1_data_gas": {
"max_amount": "0x3333",
"max_price_per_unit": "0x4444"
},
"l1_gas": {
"max_amount": "0x1111",
"max_price_per_unit": "0x2222"
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/src/method/add_declare_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ mod tests {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: None,
},
tip: Tip(0),
paymaster_data: vec![],
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/src/method/add_deploy_account_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ mod tests {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: None,
},
tip: Tip(0),
paymaster_data: vec![],
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/src/method/add_invoke_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ mod tests {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: None,
},
tip: Tip(0),
paymaster_data: vec![],
Expand Down
9 changes: 9 additions & 0 deletions crates/rpc/src/v02/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub mod syncing;
pub struct ResourceBounds {
pub l1_gas: ResourceBound,
pub l2_gas: ResourceBound,
#[serde(skip_serializing_if = "Option::is_none")]
pub l1_data_gas: Option<ResourceBound>,
}

impl crate::dto::DeserializeForVersion for ResourceBounds {
Expand All @@ -21,6 +23,7 @@ impl crate::dto::DeserializeForVersion for ResourceBounds {
Ok(Self {
l1_gas: value.deserialize("l1_gas")?,
l2_gas: value.deserialize("l2_gas")?,
l1_data_gas: value.deserialize_optional("l1_data_gas")?,
})
})
}
Expand Down Expand Up @@ -907,6 +910,7 @@ pub mod request {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: None,
},
tip: Tip(0x1234),
paymaster_data: vec![
Expand Down Expand Up @@ -976,6 +980,7 @@ pub mod request {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: None,
},
tip: Tip(0x1234),
paymaster_data: vec![
Expand Down Expand Up @@ -1006,6 +1011,10 @@ pub mod request {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: Some(ResourceBound {
max_amount: ResourceAmount(0x3333),
max_price_per_unit: ResourcePricePerUnit(0x4444),
}),
},
tip: Tip(0x1234),
paymaster_data: vec![
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/src/v06/method/add_declare_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ mod tests {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: None,
},
tip: Tip(0),
paymaster_data: vec![],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ mod tests {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: None,
},
tip: Tip(0),
paymaster_data: vec![],
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/src/v06/method/add_invoke_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ mod tests {
max_amount: ResourceAmount(0),
max_price_per_unit: ResourcePricePerUnit(0),
},
l1_data_gas: None,
},
tip: Tip(0),
paymaster_data: vec![],
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/src/v06/method/simulate_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ pub(crate) mod tests {
max_amount: ResourceAmount(10000),
max_price_per_unit: ResourcePricePerUnit(100000000),
},
l1_data_gas: None,
},
tip: Tip(0),
paymaster_data: vec![],
Expand Down
Loading