Open y-pakorn opened 2 years ago
The workaround, for now, is to mutate the inner struct through interior mutability and pass a pointer as a trait object instead.
I don't fully understand the issue. Isn't MemoryStorageWithGas
compatible to dyn Storage
because of impl Storage for MemoryStorageWithGas
?
Maybe you can raise this issue on the new cw-multi-test
repo and figure out your problem and any possible solutions there before we change the standard lib. This is much more stable and cw-multi-test
a lot more experimental / flexible
This will also help with the remaining point in #2157
Is it possible to add a downcast function to traits like
Api
,Storage
, andQuerier
? So that custom implementation of those traits can be cast back to the original type.I'm running into problems trying to use my custom storage with gas meter for testing and can't cast back to my original type to use the function since the
dyn Storage
is used everywhere incw-multi-test
.Something like this (and maybe enforce to be used only in
test
target) would be nice?