Skip to content

Commit 7d18c22

Browse files
committed
fix: rename last_value
1 parent 9ea0a9c commit 7d18c22

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

crates/services/gas_price_service/src/v1/da_source_adapter/block_committer_costs.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ trait BlockCommitterApi: Send + Sync {
3434
/// which receives data from the block committer (only http api for now)
3535
pub struct BlockCommitterDaBlockCosts<BlockCommitter> {
3636
client: BlockCommitter,
37-
last_value: Option<RawDaBlockCosts>,
37+
last_raw_da_block_costs: Option<RawDaBlockCosts>,
3838
}
3939

4040
#[derive(Debug, Deserialize, Serialize, Clone, Default, PartialEq)]
@@ -54,7 +54,10 @@ pub struct RawDaBlockCosts {
5454
impl<BlockCommitter> BlockCommitterDaBlockCosts<BlockCommitter> {
5555
/// Create a new instance of the block committer da block costs source
5656
pub fn new(client: BlockCommitter, last_value: Option<RawDaBlockCosts>) -> Self {
57-
Self { client, last_value }
57+
Self {
58+
client,
59+
last_raw_da_block_costs: last_value,
60+
}
5861
}
5962
}
6063

@@ -66,7 +69,7 @@ where
6669
async fn request_da_block_cost(&mut self) -> DaBlockCostsResult<DaBlockCosts> {
6770
let response;
6871

69-
if let Some(last_value) = &self.last_value {
72+
if let Some(last_value) = &self.last_raw_da_block_costs {
7073
response = self
7174
.client
7275
.get_costs_by_seqno(last_value.sequence_number + 1)
@@ -78,7 +81,7 @@ where
7881

7982
if let Some(response) = response {
8083
let res;
81-
if let Some(last_value) = &self.last_value {
84+
if let Some(last_value) = &self.last_raw_da_block_costs {
8285
res = DaBlockCosts {
8386
l2_block_range: response.blocks_range.clone(),
8487
blob_size_bytes: response
@@ -97,7 +100,7 @@ where
97100
blob_cost_wei: response.total_cost,
98101
};
99102
}
100-
self.last_value = Some(response.clone());
103+
self.last_raw_da_block_costs = Some(response.clone());
101104
Ok(res)
102105
} else {
103106
Err(anyhow!("No response from block committer"))
@@ -232,7 +235,7 @@ mod tests {
232235

233236
// then
234237
assert_eq!(actual, expected);
235-
assert!(block_committer.last_value.is_some());
238+
assert!(block_committer.last_raw_da_block_costs.is_some());
236239
}
237240

238241
#[tokio::test]
@@ -262,7 +265,7 @@ mod tests {
262265

263266
// then
264267
assert!(result.is_err());
265-
assert!(block_committer.last_value.is_none());
268+
assert!(block_committer.last_raw_da_block_costs.is_none());
266269
}
267270

268271
struct UnderflowingMockBlockCommitterApi {

0 commit comments

Comments
 (0)