feat(rt-next): make instantiate public - #188
Conversation
|
|
||
| /// Single instantiation of a [Contract] | ||
| #[derive(Debug, Copy, Clone)] | ||
| #[repr(transparent)] |
There was a problem hiding this comment.
is there any specific reason to use #[repr(transparent)]?
I wouldn't usually add this unless this is going through some unsafe code somewhere that requires the layout (like a transmute)
Not necessarily saying this is wrong though
There was a problem hiding this comment.
Mostly just a habit. I use it as a hint to the compiler, but also the developer that this is a thin newtype wrapper
ecioppettini
left a comment
There was a problem hiding this comment.
Not really sure about the #[repr(transparent)] thing (left a comment in that line)
Besides that this looks reasonable to me (and even that is mainly nitpicking, so I would be fine with that being merged anyway)
Make `Contract::instantiate` public and have it return a new `repr(transparent)` `ContractInstance` wrapper around the wasmtime `Instance`. Move `create_utxo`, `load_utxo` and `call_coordination_script` onto `ContractInstance` and drop the `Contract`-level convenience wrappers, so callers instantiate explicitly and the runtime keeps track of the instance. Assisted-by: anthropic:claude-fable-5 Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
e204614 to
bab7d79
Compare
removed it, merging! |
Make
Contract::instantiatepublic and have it return a newrepr(transparent)ContractInstancewrapper around the wasmtimeInstance. Movecreate_utxo,load_utxoandcall_coordination_scriptontoContractInstanceand drop theContract-level convenience wrappers, so callers instantiate explicitly and the runtime keeps track of the instance.This addresses #185 (comment)