-
Notifications
You must be signed in to change notification settings - Fork 119
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
add FromAddres
dimension & take it from cli parameter, filter txs
by from_address
& to_address
#111
add FromAddres
dimension & take it from cli parameter, filter txs
by from_address
& to_address
#111
Conversation
None | ||
}; | ||
Ok((block, receipt, query.exclude_failed)) | ||
let receipts: Vec<Option<_>> = |
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.
if the receipts were collected after filtering, this would require collecting less data and would simply the filtering code
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.
that will be much more efficient, but it will require get_tx_receipts_in_block
function to take additional transactions: Vec<H160>
parameter if eth_getBlockReceipts
fails because currently the function reuses block.transactions
as fallback... :D I will refactor it in 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.
applied in 27181e4
@@ -388,6 +404,7 @@ impl Partition { | |||
} | |||
|
|||
/// return Vec of dimensions defined in partitions | |||
// NOTE: this function is not exhaustive |
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.
what is meant by these notes?
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.
The commented points are branches that take or return Dim
but does not emit type error even all of its variants are properly handled. For example, adding a variant for Dim
does not guarantee Dim::all_dims()
function to return every variant of the enum because the programmer would have to manually write the additional variant. These codes - for me - felt error-prone because a new commiter is hard to know every part of the codebase that requires additional code for added variant. I meant this for not exhaustive
.
hi. this is looking good. left 2 comments to your Q's:
|
I think this works as a self contained pr or if you wanted to add the other datasets that would also work |
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.
It would be better to take this PR as self contained because I need this feature more urgent for txs
than other datasets... :) I will come with additional PRs for erc transfers and trace datasets.
@@ -388,6 +404,7 @@ impl Partition { | |||
} | |||
|
|||
/// return Vec of dimensions defined in partitions | |||
// NOTE: this function is not exhaustive |
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.
The commented points are branches that take or return Dim
but does not emit type error even all of its variants are properly handled. For example, adding a variant for Dim
does not guarantee Dim::all_dims()
function to return every variant of the enum because the programmer would have to manually write the additional variant. These codes - for me - felt error-prone because a new commiter is hard to know every part of the codebase that requires additional code for added variant. I meant this for not exhaustive
.
None | ||
}; | ||
Ok((block, receipt, query.exclude_failed)) | ||
let receipts: Vec<Option<_>> = |
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.
that will be much more efficient, but it will require get_tx_receipts_in_block
function to take additional transactions: Vec<H160>
parameter if eth_getBlockReceipts
fails because currently the function reuses block.transactions
as fallback... :D I will refactor it in this PR.
oh I see the issue with the ordering now. thats a bit tricky maybe only use eth_getBlockReceipts if filters are NOT being used. because filters probably mean a tiny subset of the data is relevant, and the benefits of eth_getBlockReceipts disappear |
basically use and if there are filters, use the fallback code inside of // fallback to `eth_getTransactionReceipt`
let mut tasks = Vec::new();
for tx in &block.transactions {
let tx_hash = tx.hash;
let fetcher = self.fetcher.clone();
let task = task::spawn(async move {
match fetcher.get_transaction_receipt(tx_hash).await? {
Some(receipt) => Ok(receipt),
None => {
Err(CollectError::CollectError("could not find tx receipt".to_string()))
}
}
});
tasks.push(task);
}
let mut receipts = Vec::new();
for task in tasks {
match task.await {
Ok(receipt) => receipts.push(receipt?),
Err(e) => return Err(CollectError::TaskFailed(e)),
}
}
Ok(receipts) (could pull this out of everything else looks good. and keeping it self contained sgtm |
awesome. great feature to have |
Motivation
Partially solves #97. for
erc*_transfers
andtrace
-related calls, comments needed.Solution
from_address
from cli parameter to query & request paramscollect()
may need separation of filters that are supported natively by RPC calls vs manually supported by cryo.txs
dataset to filter result inextract()
layerRequest for comments
from_address
andto_address
dimension to represent contract interaction appropriate? I think this is not a big problem because these datasets are derived fromlogs
but there may be a case that causes name collision between tx's from/to. Alternatives like sender/recipient may be considered?trace
related datasets only carry tx hash and will require additional transaction by hash / full block call to fetch from / to address. This may be implemented just liketxs
dataset that optionally calls receipt only ifexclude_failed
option is present orgas_used
parameter is required.PR Checklist