Use explicit container types with Scrypto! Leverage the Rust compiler's type checking to increase security and productivity when developing Radix blueprints.
Currently the resources are bound in a 'static HashMap. This works fine for simple use cases and in many settings as it matches the lifetime of a transaction.
But, for a component that could have methods called on multiple instances in the same transaction, a single mapping for the entire transaction may not be accurate. Instead there needs to be a mapping per component. We don't want to store this mapping on-ledger in generally, though maybe we could (optionally).
Need to see if the Radix Engine spins up a separate process per function/method call or not. If separate, everything is fine with the current implementation. If not, we need options:
One option is a map of maps, the first level indexed on the component address, and the second level matching what currently exists. However, getting the current component without it being passed directly could be tricky.
Might require patching the dispatcher to store the current component or reference to the current map.
Or maybe Decode on the component could be overridden
or hooked via a custom type stored in the component. This would take up some space (unless we could do some matching with PhantomData) but could be minimal. -- this method is closest to just storing the entire mapping on-ledger so maybe this provides a consistent interface with levels of complexity/difficulty that can be adjusted later