-
Notifications
You must be signed in to change notification settings - Fork 1
SVM Transactions Signatures #72
Comments
Thanks Yaron! Made a couple of tiny fixes in the pseudocode, hope that's okay. Some questions:
Can we refer to these as For the multisig case, here we're assuming that there are two distinct signatures (blobs), one per pubkey. What if we wanted to do some form of signature aggregation, e.g., BLS, such that there's only a single signature blob?
|
I agree about being more precise. We can interchangeably use the terms So when saying a The signature of |
I think the term In the single-sig example you made signatures 64 bytes long and then in the multisig example 32 bytes long. It was a little confusing for me, especially since |
Minor terminology comment: Can we please change term |
I actually like |
Sorry, @avive has asked first to rename to |
done |
|
made obsolete by current implemenation spacemeshos/go-spacemesh#3220 |
SVM Transaction Signatures
Overview
This SMIP extends the AA Transactions & SVM Integration and SVM Raw Transaction Ranges SMIPs.
It outlines how to support in the SVM infrastructure-level different Signatures Schemes.
It's highly recommended to read both SMIPs before reading this one.
Goals and Motivation
The introduction of Account Unification to Spacemesh opened doors to extend the system with features that otherwise had to be part of the protocol. One of the implications is being able to shift the Transactions Signatures Schemes implementation to the
Template
level.We want each
Template
to be able to have its Signature Schemes.One
Template
might use aSingle Signature Scheme
while the other might applyMultiSig 2-3 Scheme
.High-level design
The
Signatures Schemes
verification will take place within theverify
method of aTemplate
.Each
Template
may decide about its verification algorithm. Almost anyTemplate
will apply some form of Digital Signatures (DS) as part of theirverify
.In theory, a
Template
might choose to always returntrue
in itsverify
logic - in such a case, noSignature Data
will be involved.The number of parties signing the
Transaction
and the exact algorithms used will be different betweenTemplates
.Any
Template
using DS will involve signing theTransaction
(in its binary format) digitally.Terminology-wise, the
Signatures Data
is part of theMessage
part of anyTransaction
. (i.eDeploy/Spawn/Call
),That being said, we need to distinguish between:
Transaction
, excluding theSignatures Data
.Transaction
, including theSignatures Data
.This distinction is crucial and can easily be mistaken.
When referring to a
Transaction
, we need to know the context - whether it includes theSignatures Data
or not.For example, when sending a
Transaction
over the network, we infer that theSignatures Data
is part of the transmitted data. In other cases, it might require an explicit mention of whether theSignatures Data
are available or not.We'll call the
Signatures Data
in their binary form thesigdata
(using the same convention as incalldata/verifydata/returndata
).From the infrastructure standpoint, it's just a blob of bytes. But, in general, it is a list of
Signatures Data
that theverify
knows how to interpret. That being said, it's advised not to use any fancy ABI here. Instead, the most straightforward implementation will be concatenating theSignatures Data
one next to another.Then the
verify
code will grab eachSignature
by its offsets within thesigdata
. These offsets could be hardcoded within the code. Thesigdata
will be accessible in the Wasm Memory in the same manner as in other similars such assvm_tx_range
The best way to describe the whole mechanism is by examples.
Say we have a
Single Signature Scheme
with64 byte-long
signatures and32 byte-long
public keys.In that case, the code of the
verify
could be similar to this pseudo-code:A few notes:
svm_tx_sigdata_range
Should return a tuple containing the memory range holding thesigdata
.section_id
- The additionalsection_id
to part of the host functions is explained at SVM Code Reuse between Templates.svm_sig_verify
- this is the host function that should be implemented as a result of this SMIP.In practice, there might be more than one
Digital Signatures Verification
host function.Now, let's see what the
verify
of aMultiSig 2-3
might look like in pseudo-code:A few notes:
svm_load256
doesn't exist at the time of writing this SMIP.It seems likely that
svm_load256
,svm_store256
, and similars will have to be added to SVM. (and SVM SDK and SVM ABI).verify
expects two numbers, each pointing to the correspondingPublic Key
variables stored at theImmutable Storage Section.
The code assumes that the three public keys provided to the constructor (as part of the
Account Spawn
) are located atvariables=0,1
and2
under theImmutable Storage Section
.That's why the code asserts that each input is within the range
0..3
(exclusive).sigdata
holding the signatures is distinguished from the rest of the Transaction.The inputs to
verify
(pk_idx1
andpk_idx2
) are stored in theverifydata
buffer.sigdata
contains two public keys, one after the other.It means that the first public key will be located as offset zero of the
sigdata
, and the second one will start atoffset=32
of thesigdata
.Questions/concerns
TBD
Stakeholders and reviewers
@noamnelke
@lrettig
@neysofu
@avive
@moshababo
The text was updated successfully, but these errors were encountered: