-
Notifications
You must be signed in to change notification settings - Fork 293
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
wasm_planner support gas fees & add ICS20 withdrawal #3198
Conversation
# Conflicts: # crates/proto/src/gen/proto_descriptor.bin.no_lfs # crates/wasm/src/wasm_planner.rs
@@ -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`. |
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.
Is overpaying what is being done in plci as well?
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.
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 { |
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.
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?
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.
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
#3194
#3178