Skip to content

Commit

Permalink
feat: add Shelley protocol parameters support
Browse files Browse the repository at this point in the history
Signed-off-by: Ales Verbic <[email protected]>
  • Loading branch information
verbotenj committed Apr 17, 2024
1 parent aca581f commit 192c1ad
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion ledger/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 192c1ad

Please sign in to comment.