-
Notifications
You must be signed in to change notification settings - Fork 14
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
improve gas estimation #267
Conversation
636735a
to
97ea7de
Compare
MaspTxRef::MaspSection(masp_tx_id) => { | ||
transaction | ||
.get_masp_section(&masp_tx_id) | ||
.map(|bundle| bundle.clone().into_data().sapling_bundle().map(|bundle| bundle.shielded_spends.len() + bundle.shielded_outputs.len()).unwrap_or_default()).unwrap_or_default() as u64 |
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.
Here and down below it might be nice to also account for the length of the shielded_converts
vector since conversions affect the gas cost too. But let me know, maybe this would make the indexer algorithm too overfitted on the details of masp txs
@@ -459,13 +462,36 @@ impl Transaction { | |||
acc | |||
}); | |||
|
|||
let notes = masp_refs.clone().into_iter().map(|masp_ref| { | |||
match masp_ref { | |||
MaspTxRef::MaspSection(masp_tx_id) => { |
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.
I believe we should check if this specific masp ref belongs to this inner tx
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.
Yes so, we'd need to check if the inner tx we are currently analyzing is a successful masp tx and if so pop from the head of the masp_refs
vector the next element and run the match
expression here above. It's a bit unlucky cause the events don't carry the exact inner tx index of that masp data (it's not needed when constructing the local state of a shielded wallet) so we kind of have to do this manually in here. We should have the batch
event somewhere here so that we can check the exit code of this inner tx. Understanding if it is a masp tx could be slightly more complex: we'd need to deserialize the tx data and see if it is a transfer, ibc transfer or neither. If none, then this is not a masp tx. If it is either a transfer or an ibc transfer we should check if it contains the pointer to the same MaspTxRef
that we expect: if so we extract, otherwise we skip
Closing this in favor of #275 |
No description provided.