You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the first step in allowing extensions to activation transactions in the go-spacemesh protocol.
Description
To allow adding additional data and removing redundancy from Activation Transactions (ATXs) for upcoming features, we need to introduce an ATX versioning scheme that allows new versions of ATXs in a non-backwards compatible way.
// ActivationTx is a full, signed activation transaction. It includes (or references) everything a miner needs to prove
// they are eligible to actively participate in the Spacemesh protocol in the next epoch.
typeActivationTxstruct {
InnerActivationTx
SmesherIDNodeID
SignatureEdSignature
goldenbool
}
needs to be retired in serving dual purpose as a) encoding an ATX going over the wire and b) as representation of an ATX in services that need it.
Instead it needs to be split in a type that is uses solely to be encoded with go-scale to be sent over the wire during sync and gossip and a type that is used in services and as a representation of the data stored in the state database.
Additionally the ATX ID needs to be changed for v2 to allow more efficient encoding of Malfeasance proofs. For this the ID needs to be set to the root of a binary tree that is formed from the fields of the ATX (or their hashes). This way a malfeasance proof only needs the ATX ID and the relevant fields for the proof, the rest can be represented by the hashes of branches with fields that are not relevant for the proof, which should make Malfeasance proofs smaller and more flexible than they are at at the moment.
Acceptance criteria
ActivationTx is reduced to the following domain type:
typeActivationTxstruct {
ID types.ATXIDPrevATX types.ATXID// PosATX types.ATXID // unsure if needed, only add to domain type if helpful in some placeNode types.NodeIDCoinbase types.AddressNumUnitsuint32// represents "effective numunits"NumTicksuint64BaseHeightuint64Nonce types.VRFPostIndexMaliciousbool
}
func (aActivationTx) Weight() uint64 {
returna.NumUnits*a.NumTicks
}
func (aActivationTx) Height() uint64 {
returna.BaseHeight+a.NumTicks
}
The algorithm for calculating the ATXID in v2 ATXs is changed from concatenating the publication epoch to the hash of the go-scale encoded ATX to instead using the root of a tree comprised of the fields of the ATX (or their respective hashes).
The wire types for ATXs can be defined in the activation package, while the domain type will probably need to stay in the common/types package. No package besides the activation package should encode or decode wire types.
This means that sql packages need to store all domain relevant fields as columns in the atxs table in the DB and must not encode or decode the binary ATX blob, which is still stored and can be fetched for things linke checkpoint and sync but packages accessing the ATX blob should treat them as opaque and pass them along to functions like the activation.Handler which does the decoding and validation.
Other packages needing access to an ATX should use the domain type which is reduced to only relevant fields (as below)
The atxsdata.ATX type should be removed again and replaced by the new domain type which replaces its purpose.
…5784)
## Motivation
Part of #5774
Split ActivationTx into:
- a type used for encoding and signing, serialized into blobs and sent "over the wire" (`package wire`),
- a type meant for use in the rest of the code (`package types`) - this is not serialized anywhere and is free to change at any time.
…5784)
## Motivation
Part of #5774
Split ActivationTx into:
- a type used for encoding and signing, serialized into blobs and sent "over the wire" (`package wire`),
- a type meant for use in the rest of the code (`package types`) - this is not serialized anywhere and is free to change at any time.
Motivation
This is the first step in allowing extensions to activation transactions in the go-spacemesh protocol.
Description
To allow adding additional data and removing redundancy from Activation Transactions (ATXs) for upcoming features, we need to introduce an ATX versioning scheme that allows new versions of ATXs in a non-backwards compatible way.
The current
ActivationTx
ingo-spacemesh/common/types/activation.go
Lines 189 to 198 in dd9de0f
Instead it needs to be split in a type that is uses solely to be encoded with
go-scale
to be sent over the wire during sync and gossip and a type that is used in services and as a representation of the data stored in the state database.Additionally the ATX ID needs to be changed for v2 to allow more efficient encoding of Malfeasance proofs. For this the ID needs to be set to the root of a binary tree that is formed from the fields of the ATX (or their hashes). This way a malfeasance proof only needs the ATX ID and the relevant fields for the proof, the rest can be represented by the hashes of branches with fields that are not relevant for the proof, which should make Malfeasance proofs smaller and more flexible than they are at at the moment.
Acceptance criteria
ActivationTx
is reduced to the following domain type:ATXID
in v2 ATXs is changed from concatenating the publication epoch to the hash of thego-scale
encoded ATX to instead using the root of a tree comprised of the fields of the ATX (or their respective hashes).activation
package, while the domain type will probably need to stay in thecommon/types
package. No package besides theactivation
package should encode or decode wire types.sql
packages need to store all domain relevant fields as columns in theatxs
table in the DB and must not encode or decode the binary ATX blob, which is still stored and can be fetched for things linke checkpoint and sync but packages accessing the ATX blob should treat them as opaque and pass them along to functions like theactivation.Handler
which does the decoding and validation.atxsdata.ATX
type should be removed again and replaced by the new domain type which replaces its purpose.Implementation hints
merkle-tree
implementation in https://github.com/spacemeshos/merkle-tree that is used for PoET can probably be re-used.The text was updated successfully, but these errors were encountered: