First, we'll need the FuncEnv to have access to the transaction in its binary format.
One option is to make sure that FuncEnv::new will receive tx: Arc<[u8]> as a parameter (or other Smart-Pointer).
Maybe we could also get rid of the Envelope parameter and only rely on the tx (I'm not sure about it, anyhow it's an implementation detail internal to SVM).
The Transaction Offsets will primarily be used in the context of verify (or authorize if we'll end up having that as well).
It means we could make it a lazy field.
Depends on: #457
Wo so we've got the
svm_codec::tx_offsets
API returning usHashMap<TxPart, (usize, usize)>
when given the binary Transaction.Now we need to keep this data in the
FuncEnv
https://github.com/spacemeshos/svm/blob/master/crates/runtime/src/func_env.rsFirst, we'll need the
FuncEnv
to have access to the transaction in its binary format. One option is to make sure thatFuncEnv::new
will receivetx: Arc<[u8]>
as a parameter (or other Smart-Pointer).Maybe we could also get rid of the
Envelope
parameter and only rely on thetx
(I'm not sure about it, anyhow it's an implementation detail internal to SVM).The
Transaction Offsets
will primarily be used in the context ofverify
(orauthorize
if we'll end up having that as well). It means we could make it a lazy field.So this issue can extend
Inner
here: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/runtime/src/func_env.rs#L101to have:
And each relevant host function interested in these
tx_offsets
will have something similar to this code: