From 7ba4ea8352247790b85a3009839fb944e6a251ba Mon Sep 17 00:00:00 2001 From: Dmitry Mirgaleev <35151170+dmirgaleev@users.noreply.github.com> Date: Fri, 3 May 2024 19:13:14 +0300 Subject: [PATCH] Add endorsements with DAL (#32) Add endorsements with DAL --- node/consts.go | 1 + node/operations.go | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/node/consts.go b/node/consts.go index 3c01e2b..da8adf3 100644 --- a/node/consts.go +++ b/node/consts.go @@ -13,6 +13,7 @@ const ( KindDoubleEndorsing = "double_endorsement_evidence" KindEndorsement = "endorsement" KindEndorsementWithSlot = "endorsement_with_slot" + KindEndorsementWithDal = "endorsement_with_dal" KindOrigination = "origination" KindProposal = "proposals" KindReveal = "reveal" diff --git a/node/operations.go b/node/operations.go index 7d8e56a..accb8e6 100644 --- a/node/operations.go +++ b/node/operations.go @@ -10,7 +10,7 @@ import ( // OperationConstraint - type OperationConstraint interface { AccountActivation | Ballot | Delegation | DoubleBakingEvidence | - DoubleEndorsementEvidence | Endorsement | EndorsementWithSlot | + DoubleEndorsementEvidence | Endorsement | EndorsementWithSlot | EndorsementWithDal | Origination | Proposal | Reveal | SeedNonceRevelation | Transaction | RegisterGlobalConstant | DoublePreendorsementEvidence | SetDepositsLimit | Preendorsement | Event | VdfRevelation | TxRollupCommit | TxRollupOrigination | @@ -60,6 +60,8 @@ func (op *Operation) UnmarshalJSON(data []byte) error { err = parseOperation[Endorsement](data, op) case KindEndorsementWithSlot: err = parseOperation[EndorsementWithSlot](data, op) + case KindEndorsementWithDal: + err = parseOperation[EndorsementWithDal](data, op) case KindOrigination: err = parseOperation[Origination](data, op) case KindProposal: @@ -174,6 +176,17 @@ type EndorsementWithSlot struct { Metadata *EndorsementMetadata `json:"metadata,omitempty"` } +// EndorsementWithDal - +type EndorsementWithDal struct { + Kind string `json:"kind"` + Slot uint64 `json:"slot"` + Level uint64 `json:"level"` + Round int64 `json:"round"` + BlockPayloadHash string `json:"block_payload_hash"` + DalAttestation string `json:"dal_attestation"` + Metadata *EndorsementMetadata `json:"metadata"` +} + // Preendorsement - type Preendorsement struct { Slot uint64 `json:"slot"` @@ -331,9 +344,11 @@ type OnlyBalanceUpdatesMetadata struct { // EndorsementMetadata - type EndorsementMetadata struct { - BalanceUpdates []BalanceUpdate `json:"balance_updates"` - Delegate string `json:"delegate"` - Slots []int `json:"slots"` + Delegate string `json:"delegate"` + EndorsementPower int `json:"endorsement_power"` + ConsensusKey string `json:"consensus_key"` + BalanceUpdates []BalanceUpdate `json:"balance_updates,omitempty"` + Slots []int `json:"slots,omitempty"` } // OperationResult -