Skip to content
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

Namada gas estimation #32

Merged
merged 5 commits into from
Jun 21, 2024
Merged

Namada gas estimation #32

merged 5 commits into from
Jun 21, 2024

Conversation

yito88
Copy link
Member

@yito88 yito88 commented Jun 7, 2024

closes #30

@yito88 yito88 requested a review from sug0 June 7, 2024 09:37
Comment on lines 76 to 78
// Estimate the fee with dry-run
let (fee_token, gas_limit, fee_amount) =
self.estimate_fee(tx.clone(), &tx_args, signing_data)?;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all nodes should be required to enable dry running txs via their exposed RPC servers, since these may pose a DoS vector. estimate_fee should be expected to fail with a nonexistent RPC error, at which point we could fallback to another gas estimation mechanism (e.g. median values that have been benchmarked during a release).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I'll fix it.

@yito88 yito88 requested a review from sug0 June 18, 2024 14:19
Copy link

@sug0 sug0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good, for now. In the future, it might be good to provide some other source to estimate gas limits from, namely tables of tx code hashes to gas estimates or something.

@yito88 yito88 merged commit 246e288 into 1.8.2-namada Jun 21, 2024
31 of 32 checks passed
@yito88 yito88 deleted the yuji/gas-estimation branch June 21, 2024 13:17
yito88 added a commit that referenced this pull request Jul 1, 2024
* gas estimation

* add error

* adjust gas

* fix script

* use the default gas setting when gas estimation failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants