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

native VP pre/post with storage_api::StorageRead trait lifetime issue #828

Closed
tzemanovic opened this issue Nov 25, 2022 · 1 comment · Fixed by #966
Closed

native VP pre/post with storage_api::StorageRead trait lifetime issue #828

tzemanovic opened this issue Nov 25, 2022 · 1 comment · Fixed by #966
Assignees
Labels
bug Something isn't working

Comments

@tzemanovic
Copy link
Member

trying to use a function such as

pub fn with_storage<S>(storage: &S) -> storage_api::Result<Something> {
  storage.read(some_key)
}

with native VP context .pre()/.post() currently fails with e.g. with_storage(&ctx.pre()):

error: implementation of `namada_core::ledger::storage_api::StorageRead` is not general enough
   = note: `ledger::native_vp::CtxPreStorageRead<'_, 'a, DB, H, CA>` must implement `namada_core::ledger::storage_api::StorageRead<'0>`, for any lifetime `'0`...
   = note: ...but `namada_core::ledger::storage_api::StorageRead<'_>` is actually implemented for the type `ledger::native_vp::CtxPreStorageRead<'_, '_, DB, H, CA>`

This looks like it's related to rust-lang/rust#70263, but hopefully rewriting StorageRead with GATs to avoid the explicit lifetime should get us around it.

@tzemanovic tzemanovic added the bug Something isn't working label Nov 25, 2022
@tzemanovic
Copy link
Member Author

wait for #736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant