Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

bug: estimate_fee should keep state changes between two tx when doing bulk estimate #1202

Closed
tdelabro opened this issue Oct 19, 2023 · 0 comments · Fixed by #1240
Closed
Assignees
Labels
backlog Ready to be picked bug Something isn't working

Comments

@tdelabro
Copy link
Collaborator

Bug Report

Madara version: 0.4.0

Current behavior:

The RPC route estimate_fee receives a vec of tx to estimate.
We spawn one instance of the runtime for each tx.
This means that the state is reset between each estimated transaction.

Expected behavior:

The state should not reset. Tx number n should be executed on a state changed by tx number n-1

Steps to reproduce:

Call estimate fee with multiple tx from the same account, while increasing the nonce for each tx.
It will fail because the second will have nonce = 1 when the runtime expect nonce = 0.

Related code:

the loop in crates/client/rpc/src/lib.rs, fn estimate_fee: for tx in request {...} should happen inside crates/pallets/starknet/src/lib.rs, fn estimate_fee.

it's signature should be changed to:

    pub fn estimate_fee(transaction: Vec<UserTransaction>) -> Result<Vec<(u64, u64)>, DispatchError>;

Other information:

@tdelabro tdelabro added bug Something isn't working backlog Ready to be picked labels Oct 19, 2023
@lana-shanghai lana-shanghai self-assigned this Oct 19, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backlog Ready to be picked bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants