-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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(gas_price_service_v1): define RunnableTask for GasPriceServiceV1 #2416
Merged
Merged
Changes from 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6dc5ed7
feat(gas_price_service_v1): define RunnableTask for GasPriceServiceV1
rymnc b6149d1
chore: changelog
rymnc 8a912c4
test: this test is broken
rymnc c9d7ed7
test: different args
rymnc 7a65574
fix: broken test
rymnc d576665
Merge branch 'master' into feat/gas-price-service-v1-impl
rymnc b4d8855
chore: process block size and fees
rymnc 0a358f6
chore: clean setting of metadata etc
rymnc 49a309a
fix: fmt
rymnc c516ea9
chore: remove l2 block being sent
rymnc 53291a5
fix: remove pinning
rymnc 2291207
fix: refactor init algo fn
rymnc 8ae983f
chore: add test for AlgorithmV1 changes
rymnc b2a94d8
chore: new tests for mitch
rymnc db04ae1
Merge branch 'master' into feat/gas-price-service-v1-impl
rymnc 1e3b3f5
fix spelling
AurelienFT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod algorithm; | ||
pub mod da_source_service; | ||
pub mod metadata; | ||
pub mod service; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,12 +21,12 @@ trait BlockCommitterApi: Send + Sync { | |
/// Used to get the costs for a specific seqno | ||
async fn get_costs_by_seqno( | ||
&self, | ||
number: u64, | ||
number: u32, | ||
) -> DaBlockCostsResult<Option<RawDaBlockCosts>>; | ||
/// Used to get the costs for a range of blocks (inclusive) | ||
async fn get_cost_bundles_by_range( | ||
&self, | ||
range: core::ops::Range<u64>, | ||
range: core::ops::Range<u32>, | ||
) -> DaBlockCostsResult<Vec<Option<RawDaBlockCosts>>>; | ||
} | ||
|
||
|
@@ -40,9 +40,9 @@ pub struct BlockCommitterDaBlockCosts<BlockCommitter> { | |
#[derive(Debug, Deserialize, Serialize, Clone, Default, PartialEq)] | ||
pub struct RawDaBlockCosts { | ||
/// Sequence number (Monotonically increasing nonce) | ||
pub sequence_number: u64, | ||
pub sequence_number: u32, | ||
/// The range of blocks that the costs apply to | ||
pub blocks_range: core::ops::Range<u64>, | ||
pub blocks_range: core::ops::Range<u32>, | ||
/// The DA block height of the last transaction for the range of blocks | ||
pub da_block_height: DaBlockHeight, | ||
/// Rolling sum cost of posting blobs (wei) | ||
|
@@ -143,7 +143,7 @@ impl BlockCommitterApi for BlockCommitterHttpApi { | |
|
||
async fn get_costs_by_seqno( | ||
&self, | ||
number: u64, | ||
number: u32, | ||
) -> DaBlockCostsResult<Option<RawDaBlockCosts>> { | ||
let response = self | ||
.client | ||
|
@@ -157,7 +157,7 @@ impl BlockCommitterApi for BlockCommitterHttpApi { | |
|
||
async fn get_cost_bundles_by_range( | ||
&self, | ||
range: core::ops::Range<u64>, | ||
range: core::ops::Range<u32>, | ||
) -> DaBlockCostsResult<Vec<Option<RawDaBlockCosts>>> { | ||
let response = self | ||
.client | ||
|
@@ -192,23 +192,24 @@ mod tests { | |
} | ||
async fn get_costs_by_seqno( | ||
&self, | ||
seq_no: u64, | ||
seq_no: u32, | ||
) -> DaBlockCostsResult<Option<RawDaBlockCosts>> { | ||
// arbitrary logic to generate a new value | ||
let mut value = self.value.clone(); | ||
if let Some(value) = &mut value { | ||
value.sequence_number = seq_no; | ||
value.blocks_range = | ||
value.blocks_range.end * seq_no..value.blocks_range.end * seq_no + 10; | ||
value.da_block_height = value.da_block_height + (seq_no + 1).into(); | ||
value.da_block_height = | ||
value.da_block_height + ((seq_no + 1) as u64).into(); | ||
value.total_cost += 1; | ||
value.total_size_bytes += 1; | ||
} | ||
Comment on lines
197
to
207
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a lot of unchecked arithmetic and casting going on here. How do you feel about switching to checked and |
||
Ok(value) | ||
} | ||
async fn get_cost_bundles_by_range( | ||
&self, | ||
_: core::ops::Range<u64>, | ||
_: core::ops::Range<u32>, | ||
) -> DaBlockCostsResult<Vec<Option<RawDaBlockCosts>>> { | ||
Ok(vec![self.value.clone()]) | ||
} | ||
|
@@ -286,7 +287,7 @@ mod tests { | |
} | ||
async fn get_costs_by_seqno( | ||
&self, | ||
seq_no: u64, | ||
seq_no: u32, | ||
) -> DaBlockCostsResult<Option<RawDaBlockCosts>> { | ||
// arbitrary logic to generate a new value | ||
let mut value = self.value.clone(); | ||
|
@@ -301,7 +302,7 @@ mod tests { | |
} | ||
async fn get_cost_bundles_by_range( | ||
&self, | ||
_: core::ops::Range<u64>, | ||
_: core::ops::Range<u32>, | ||
) -> DaBlockCostsResult<Vec<Option<RawDaBlockCosts>>> { | ||
Ok(vec![self.value.clone()]) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We'll need to change this to just be a vec with these changes:
#2415