Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add Allegra protocol parameters support #588

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ledger/allegra.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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