-
Notifications
You must be signed in to change notification settings - Fork 96
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: add csv data source #54
base: develop
Are you sure you want to change the base?
Conversation
Benchmark results for
|
Date (UTC) | 2024-07-13T11:11:36+00:00 |
Commit | 6b219c85845d6d99c7e91391feb50f48973998b2 |
Base SHA | db634fcb90a6b2fc484e19f02a59a5b74ffeefa2 |
Significant changes
None
) -> Order { | ||
let uuid_bytes = uuid_num.to_be_bytes(); | ||
let tx_with_blobs = TransactionSignedEcRecoveredWithBlobs::new_no_blobs(tx).unwrap(); | ||
let bundle = Bundle { |
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.
Bundle creation is tricky (didn't have time to correct it :().
You should create it with a dummy hash/uuid (Default::default()) and then call hash_slow().
// The csv datasource is one with 10 batches, where batch is a list of transactions | ||
// Since we don't have full "real" blocks, we'll just use the block number to determine the batch | ||
// Thus the usage of mod 10 is just to determine the batch number that we get transactions from, e.g. block 100 corresponds to 0, 101 to 1, 109 to 9, etc. | ||
let batch_number = block.block_number % 10; |
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.
this 10 should be a constant.
Maybe also some function like batch_number_from_u64() to isolate the % 10?
let mut reader = Reader::from_reader(file); | ||
let mut batches: HashMap<u64, Vec<TransactionSignedEcRecovered>> = HashMap::new(); | ||
|
||
for result in reader.records() { |
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.
result -> record
|
||
for result in reader.records() { | ||
let record = result?; | ||
if record.len() != 2 { |
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.
0,1,and 2 could be constants also documenting the format
eg:
/// col 1 contains bla bla
const COL_RAW_RLP_RX = 1
Is col 0 an arbitrary number? Is this some block number?
π Summary
Adds the ability to load orders from a csv
π‘ Motivation and Context
For backtesting bundles
β I have completed the following steps:
make lint
make test