This repository has been archived by the owner on Aug 14, 2023. It is now read-only.
Extending svm-codec
with the Envelope
#458
Labels
svm-codec
with the Envelope
#458
As discussed in the AA Transactions & SVM Integration
The
Envelope
will consist of the following fields:version
- For versioning (to ease introducing new changes in the future).Right now, we'll only accept the value 0x0 (for Genesis)
We can use a variable length-integer encoding here.
Or allocate a fixed number of bytes
type
- The Transaction type (Deploy / Spawn / Call
)A single byte seems the right choice.
principal
- TheAddress
of the Account paying for the Gas.This will consume 20 bytes.
amount
- For funding.This field will be of type 64-bit integer (Big-Endian order).
We can use a variable length-integer encoding here.
tx_nonce
- For the tx nonce.I think can use a variable length-integer encoding here (encoding up to say 128 bit).
The number 128-bit should suffice for any imaginable Generalized Nonce Scheme to be implemented.
gas_limit
- Maximum units of Gas to be paid.This field will be of type 64-bit integer (Big-Endian order).
We can use a variable length-integer encoding here.
gas_fee
- Fee per Unit of Gas.This field will be of type 64-bit integer (Big-Endian order).
We can use a variable length-integer encoding here.
Notes
Envelope
type under thesvm-types
https://github.com/spacemeshos/svm/blob/master/crates/types/src/transaction/envelope.rs
It should be extended to have the
version
andtype
fields as well.svm-codec
right now we have some working implementation for theEnvelope
.svm/crates/codec/src/codec.rs
Line 137 in 6edb73d
When it was implemented we've thought about the encoding between
go-svm
and SVM.Since we've decided that SVM will own the encoding of the
Envelope
the implementation might changeto be more compact. (and of course, it should adjust to include
version and
type` as well).Message
type to SVM under: https://github.com/spacemeshos/svm/tree/master/crates/types/src/transactionThe
Message
will be anenum
that will hold one of theMessage
types:Now we could implement the
Codec
trait forMessage
.This implementation will look on the
transaction type
and delegate the rest of the work to the current implementations ofTemplate/SpawnAccunt/Transaction
types.SpawnAccount
to simplySpawn
.Transaction
, if it'll be renamed toCall
we need to also rename this type:https://github.com/spacemeshos/svm/blob/master/crates/runtime/src/runtime/call.rs
Transaction
name will be free again we could have:Codec
trait forTransaction
So decoding a
Transaction
will involve first decoding theEnvelope
part and then theMessage
part.@lrettig FYI
The text was updated successfully, but these errors were encountered: