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

wasm_planner support gas fees & add ICS20 withdrawal #3198

Conversation

Valentine1898
Copy link
Contributor

@Valentine1898 Valentine1898 temporarily deployed to smoke-test October 17, 2023 00:10 — with GitHub Actions Inactive
@Valentine1898 Valentine1898 marked this pull request as ready for review October 17, 2023 10:58
@Valentine1898 Valentine1898 temporarily deployed to smoke-test October 17, 2023 12:16 — with GitHub Actions Inactive
# Conflicts:
#	crates/proto/src/gen/proto_descriptor.bin.no_lfs
#	crates/wasm/src/wasm_planner.rs
@Valentine1898 Valentine1898 temporarily deployed to smoke-test October 19, 2023 09:12 — with GitHub Actions Inactive
@@ -172,6 +191,12 @@ impl WasmPlanner {
pub async fn plan(&mut self, refund_address: JsValue) -> WasmResult<JsValue> {
utils::set_panic_hook();

// Calculate the gas that needs to be paid for the transaction based on the configured gas prices.
// Note that _paying the fee might incur an additional `Spend` action_, thus increasing the fee,
// so we slightly overpay here and then capture the excess as change later during `plan_with_spendable_and_votable_notes`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is overpaying what is being done in plci as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's just copied from pcli

/// Calculate gas cost-based fees and add to the transaction plan.
///
/// This function should be called once.
pub fn add_gas_fees(&mut self) -> &mut Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having this be a separate call that needs to be done at the end, why not put it inside set_gas_prices and it gets done as someone adds the gas price?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add_gas_fees depends on the actions that have been added to the plan. We must ensure that new actions cannot be added after add_gas_fees() is executed, so it is better to do it once at the end. And yes, this solution is also inherited from pcli

@Valentine1898 Valentine1898 temporarily deployed to smoke-test October 23, 2023 13:54 — with GitHub Actions Inactive
@grod220 grod220 merged commit 7aefd27 into penumbra-zone:main Oct 23, 2023
8 checks passed
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