Skip to content
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
4 changes: 3 additions & 1 deletion ledger/allegra/pparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ type AllegraProtocolParameters struct {
shelley.ShelleyProtocolParameters
}

func (p *AllegraProtocolParameters) Update(paramUpdate *AllegraProtocolParameterUpdate) {
func (p *AllegraProtocolParameters) Update(
paramUpdate *AllegraProtocolParameterUpdate,
) {
p.ShelleyProtocolParameters.Update(
&paramUpdate.ShelleyProtocolParameterUpdate,
)
Expand Down
6 changes: 5 additions & 1 deletion ledger/allegra/pparams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ func TestAllegraProtocolParamsUpdate(t *testing.T) {
tmpParams := testDef.startParams
tmpParams.Update(&tmpUpdate)
if !reflect.DeepEqual(tmpParams, testDef.expectedParams) {
t.Fatalf("did not get expected params:\n got: %#v\n wanted: %#v", tmpParams, testDef.expectedParams)
t.Fatalf(
"did not get expected params:\n got: %#v\n wanted: %#v",
tmpParams,
testDef.expectedParams,
)
}
}
}
7 changes: 5 additions & 2 deletions ledger/alonzo/pparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ type AlonzoProtocolParameters struct {
MaxCollateralInputs uint
}

func (p *AlonzoProtocolParameters) Update(paramUpdate *AlonzoProtocolParameterUpdate) {
func (p *AlonzoProtocolParameters) Update(
paramUpdate *AlonzoProtocolParameterUpdate,
) {
p.MaryProtocolParameters.Update(
&paramUpdate.MaryProtocolParameterUpdate,
)
Expand Down Expand Up @@ -81,7 +83,8 @@ func (p *AlonzoProtocolParameters) UpdateFromGenesis(genesis *AlonzoGenesis) {
Mem: genesis.MaxBlockExUnits.Mem,
Steps: genesis.MaxBlockExUnits.Steps,
}
if genesis.ExecutionPrices.Mem != nil && genesis.ExecutionPrices.Steps != nil {
if genesis.ExecutionPrices.Mem != nil &&
genesis.ExecutionPrices.Steps != nil {
p.ExecutionCosts = common.ExUnitPrice{
MemPrice: &cbor.Rat{Rat: genesis.ExecutionPrices.Mem.Rat},
StepPrice: &cbor.Rat{Rat: genesis.ExecutionPrices.Steps.Rat},
Expand Down
28 changes: 22 additions & 6 deletions ledger/alonzo/pparams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ func TestAlonzoProtocolParamsUpdate(t *testing.T) {
MaryProtocolParameters: mary.MaryProtocolParameters{
AllegraProtocolParameters: allegra.AllegraProtocolParameters{
ShelleyProtocolParameters: shelley.ShelleyProtocolParameters{
Decentralization: &cbor.Rat{Rat: new(big.Rat).SetInt64(1)},
Decentralization: &cbor.Rat{
Rat: new(big.Rat).SetInt64(1),
},
},
},
},
Expand Down Expand Up @@ -119,7 +121,11 @@ func TestAlonzoProtocolParamsUpdate(t *testing.T) {
tmpParams := testDef.startParams
tmpParams.Update(&tmpUpdate)
if !reflect.DeepEqual(tmpParams, testDef.expectedParams) {
t.Fatalf("did not get expected params:\n got: %#v\n wanted: %#v", tmpParams, testDef.expectedParams)
t.Fatalf(
"did not get expected params:\n got: %#v\n wanted: %#v",
tmpParams,
testDef.expectedParams,
)
}
}
}
Expand All @@ -135,7 +141,9 @@ func TestAlonzoProtocolParamsUpdateFromGenesis(t *testing.T) {
MaryProtocolParameters: mary.MaryProtocolParameters{
AllegraProtocolParameters: allegra.AllegraProtocolParameters{
ShelleyProtocolParameters: shelley.ShelleyProtocolParameters{
Decentralization: &cbor.Rat{Rat: new(big.Rat).SetInt64(1)},
Decentralization: &cbor.Rat{
Rat: new(big.Rat).SetInt64(1),
},
},
},
},
Expand All @@ -145,7 +153,9 @@ func TestAlonzoProtocolParamsUpdateFromGenesis(t *testing.T) {
MaryProtocolParameters: mary.MaryProtocolParameters{
AllegraProtocolParameters: allegra.AllegraProtocolParameters{
ShelleyProtocolParameters: shelley.ShelleyProtocolParameters{
Decentralization: &cbor.Rat{Rat: new(big.Rat).SetInt64(1)},
Decentralization: &cbor.Rat{
Rat: new(big.Rat).SetInt64(1),
},
},
},
},
Expand All @@ -154,14 +164,20 @@ func TestAlonzoProtocolParamsUpdateFromGenesis(t *testing.T) {
},
}
for _, testDef := range testDefs {
tmpGenesis, err := alonzo.NewAlonzoGenesisFromReader(strings.NewReader(testDef.genesisJson))
tmpGenesis, err := alonzo.NewAlonzoGenesisFromReader(
strings.NewReader(testDef.genesisJson),
)
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
tmpParams := testDef.startParams
tmpParams.UpdateFromGenesis(&tmpGenesis)
if !reflect.DeepEqual(tmpParams, testDef.expectedParams) {
t.Fatalf("did not get expected params:\n got: %#v\n wanted: %#v", tmpParams, testDef.expectedParams)
t.Fatalf(
"did not get expected params:\n got: %#v\n wanted: %#v",
tmpParams,
testDef.expectedParams,
)
}
}
}
4 changes: 3 additions & 1 deletion ledger/babbage/pparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ type BabbageProtocolParameters struct {
MaxCollateralInputs uint
}

func (p *BabbageProtocolParameters) Update(paramUpdate *BabbageProtocolParameterUpdate) {
func (p *BabbageProtocolParameters) Update(
paramUpdate *BabbageProtocolParameterUpdate,
) {
if paramUpdate.MinFeeA != nil {
p.MinFeeA = *paramUpdate.MinFeeA
}
Expand Down
Loading