diff --git a/ledger/alonzo/genesis.go b/ledger/alonzo/genesis.go index c597c353..cb480b66 100644 --- a/ledger/alonzo/genesis.go +++ b/ledger/alonzo/genesis.go @@ -66,10 +66,10 @@ func (g *AlonzoGenesis) NormalizeCostModels() error { } func (c *CostModel) UnmarshalJSON(data []byte) error { - tmpMap := make(map[string]interface{}) + tmpMap := make(map[string]any) if err := json.Unmarshal(data, &tmpMap); err != nil { // Try to unmarshal as array first - var tmpArray []interface{} + var tmpArray []any if arrayErr := json.Unmarshal(data, &tmpArray); arrayErr == nil { *c = make(CostModel) for i, v := range tmpArray { @@ -95,7 +95,7 @@ func (c *CostModel) UnmarshalJSON(data []byte) error { return nil } -func toInt(v interface{}) (int, error) { +func toInt(v any) (int, error) { switch val := v.(type) { case float64: if val > float64(math.MaxInt) || val < float64(math.MinInt) { diff --git a/ledger/alonzo/pparams_test.go b/ledger/alonzo/pparams_test.go index ca94da63..96d41a2c 100644 --- a/ledger/alonzo/pparams_test.go +++ b/ledger/alonzo/pparams_test.go @@ -224,7 +224,7 @@ func TestCostModelArrayFormat(t *testing.T) { } func TestScientificNotationInCostModels(t *testing.T) { - costModel := map[string]interface{}{ + costModel := map[string]any{ "0": 2.477736e+06, // Changed from param1 to 0 "1": 1.5e6, // Changed from param2 to 1 "2": 1000000, // Changed from param3 to 2 @@ -442,7 +442,7 @@ func TestAlonzoUtxorpc(t *testing.T) { } } -func toJSON(v interface{}) string { +func toJSON(v any) string { b, err := json.Marshal(v) if err != nil { panic(fmt.Sprintf("failed to marshal JSON: %v", err))