Skip to content

Commit

Permalink
feat:add Allegra protocol parameters support
Browse files Browse the repository at this point in the history
Signed-off-by: Ales Verbic <verbotenj@blinklabs.io>
  • Loading branch information
verbotenj committed Apr 18, 2024
1 parent 7df13a3 commit 3c52422
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ledger/allegra.go
Expand Up @@ -114,6 +114,11 @@ func (h *AllegraBlockHeader) Era() Era {

type AllegraTransactionBody struct {
ShelleyTransactionBody
Update struct {
cbor.StructAsArray
ProtocolParamUpdates map[Blake2b224]AllegraProtocolParameterUpdate
Epoch uint64
} `cbor:"6,keyasint,omitempty"`
ValidityIntervalStart uint64 `cbor:"8,keyasint,omitempty"`
}

Expand Down Expand Up @@ -191,6 +196,14 @@ func (t *AllegraTransaction) Cbor() []byte {
return cborData
}

type AllegraProtocolParameters struct {
ShelleyProtocolParameters
}

type AllegraProtocolParameterUpdate struct {
ShelleyProtocolParameterUpdate
}

func NewAllegraBlockFromCbor(data []byte) (*AllegraBlock, error) {
var allegraBlock AllegraBlock
if _, err := cbor.Decode(data, &allegraBlock); err != nil {
Expand Down
6 changes: 6 additions & 0 deletions protocol/localstatequery/client.go
Expand Up @@ -354,6 +354,12 @@ func (c *Client) GetCurrentProtocolParams() (CurrentProtocolParamsResult, error)
return nil, err
}
return result[0], nil
case ledger.EraIdAllegra:
result := []ledger.AllegraProtocolParameters{}
if err := c.runQuery(query, &result); err != nil {
return nil, err
}
return result[0], nil
case ledger.EraIdShelley:
result := []ledger.ShelleyProtocolParameters{}
if err := c.runQuery(query, &result); err != nil {
Expand Down

0 comments on commit 3c52422

Please sign in to comment.