Skip to content

Commit

Permalink
Add endorsements with DAL (#32)
Browse files Browse the repository at this point in the history
Add endorsements with DAL
  • Loading branch information
dmirgaleev authored May 3, 2024
1 parent 14ffa82 commit 7ba4ea8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions node/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 19 additions & 4 deletions node/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"`
Expand Down Expand Up @@ -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 -
Expand Down

0 comments on commit 7ba4ea8

Please sign in to comment.