You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever you try to use the Call::new_in API, Self must be bound by TopLevelStorage + BorrowMut<Self>, which means that you end up with a lot of &mut (impl TopLevelStorage + BorrowMut<Self>) instead of a receiver argument.
This is not great, and would definitely be surprising to devs. It is my understanding that it is safe to do unsafe impl TopLevelStorage for X where X is used as a field of the entrypoint contract, and is marked as #[borrow]. I think this is safe because when routing calls to the "sub-contract" (?), it effectively becomes the top-level storage because of #[borrow].
Is this mental model correct? Should this unsafe impl block be handled by #[borrow]?
The text was updated successfully, but these errors were encountered:
Whenever you try to use the
Call::new_in
API,Self
must be bound byTopLevelStorage + BorrowMut<Self>
, which means that you end up with a lot of&mut (impl TopLevelStorage + BorrowMut<Self>)
instead of a receiver argument.This is not great, and would definitely be surprising to devs. It is my understanding that it is safe to do
unsafe impl TopLevelStorage for X
whereX
is used as a field of the entrypoint contract, and is marked as#[borrow]
. I think this is safe because when routing calls to the "sub-contract" (?), it effectively becomes the top-level storage because of#[borrow]
.Is this mental model correct? Should this
unsafe impl
block be handled by#[borrow]
?The text was updated successfully, but these errors were encountered: