-
Notifications
You must be signed in to change notification settings - Fork 42
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
Conversation
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.
Let's try to:
- Make
inc_transaction_index
andset_transaction_info
methods takeself
as mutable ref, - Get rid of the RefCell for
TransactionInfo
, - 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>)
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, |
closes #36