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

Increment transaction index #158

Closed
wants to merge 13 commits into from
Closed

Conversation

DariuszDepta
Copy link
Member

@DariuszDepta DariuszDepta commented Mar 27, 2024

closes #36

@DariuszDepta DariuszDepta added this to the 2.1.0 milestone Mar 27, 2024
@DariuszDepta DariuszDepta self-assigned this Mar 27, 2024
Copy link

@kulikthebird kulikthebird left a comment

Choose a reason for hiding this comment

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

Let's try to:

  1. Make inc_transaction_index and set_transaction_info methods take self as mutable ref,
  2. Get rid of the RefCell for TransactionInfo,
  3. Change the transactional method into something like:
pub fn transactional<F, G, T, ExecC, QueryC>(base: &mut dyn Storage, action: F, increment: G, wasm: &mut dyn Wasm<ExecC, QueryC>) -> AnyResult<T>
where
    F: FnOnce(&mut dyn Storage, &dyn Storage, &mut dyn Wasm<ExecC, QueryC>) -> AnyResult<T>,
    G: FnOnce(&mut dyn Wasm<ExecC, QueryC>),
{
    let mut cache = StorageTransaction::new(base);
    let res = action(&mut cache, base, wasm)?;
    cache.prepare().commit(base);
    increment(wasm);
    Ok(res)
}

EDIT: Or instead of FnOnce(&mut dyn Wasm<ExecC, QueryC>) => FnOnce(&mut Router<Bank, Custom, Wasm, Staking, Distr, Ibc, Gov, Stargate>)

@DariuszDepta DariuszDepta removed this from the 2.1.0 milestone Apr 5, 2024
@DariuszDepta
Copy link
Member Author

To implement this functionality properly, some more (re)design work is needed in MultiTest. As this change has a low priority, I am closing this PR without merging,

@DariuszDepta DariuszDepta deleted the increment-transaction-index branch April 5, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increment transaction index in TransactionInfo
2 participants