From 192c1adc957117b563c015ea44c44f4c738b00f1 Mon Sep 17 00:00:00 2001 From: Ales Verbic Date: Sun, 14 Apr 2024 17:18:04 -0400 Subject: [PATCH] feat: add Shelley protocol parameters support Signed-off-by: Ales Verbic --- ledger/shelley.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ledger/shelley.go b/ledger/shelley.go index 82150c06..55f661b9 100644 --- a/ledger/shelley.go +++ b/ledger/shelley.go @@ -175,7 +175,7 @@ type ShelleyTransactionBody struct { Withdrawals cbor.Value `cbor:"5,keyasint,omitempty"` Update struct { cbor.StructAsArray - ProtocolParamUpdates cbor.Value + ProtocolParamUpdates map[Blake2b224]ShelleyProtocolParameterUpdate Epoch uint64 } `cbor:"6,keyasint,omitempty"` MetadataHash Blake2b256 `cbor:"7,keyasint,omitempty"` @@ -397,6 +397,25 @@ func (t *ShelleyTransaction) Cbor() []byte { return cborData } +type ShelleyProtocolParameterUpdate struct { + MinFeeA uint `cbor:"0,keyasint"` + MinFeeB uint `cbor:"1,keyasint"` + MaxBlockBodySize uint `cbor:"2,keyasint"` + MaxTxSize uint `cbor:"3,keyasint"` + MaxBlockHeaderSize uint `cbor:"4,keyasint"` + KeyDeposit uint `cbor:"5,keyasint"` + PoolDeposit uint `cbor:"6,keyasint"` + MaxEpoch uint `cbor:"7,keyasint"` + NOpt uint `cbor:"8,keyasint"` + A0 *cbor.Rat `cbor:"9,keyasint"` + Rho *cbor.Rat `cbor:"10,keyasint"` + Tau *cbor.Rat `cbor:"11,keyasint"` + DDecentralization *cbor.Rat `cbor:"12,keyasint"` + Nonce *cbor.Rat `cbor:"13,keyasint"` + ProtocolVersion []uint `cbor:"14,keyasint"` + MinUtxoValue uint `cbor:"15,keyasint"` +} + func NewShelleyBlockFromCbor(data []byte) (*ShelleyBlock, error) { var shelleyBlock ShelleyBlock if _, err := cbor.Decode(data, &shelleyBlock); err != nil {