Skip to content
Open
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
2 changes: 1 addition & 1 deletion cli/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (cb *CLIBuilder) InterceptConfigsPreRunHandler(
cmd *cobra.Command,
logger *phuslu.Logger,
customAppConfigTemplate string,
customAppConfig interface{},
customAppConfig any,
cmtConfig *cmtcfg.Config,
) error {
return config.SetupCommand(
Expand Down
4 changes: 2 additions & 2 deletions cli/commands/genesis/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ func writeGenesisAllocToFile(
}

// Unmarshal existing genesis using json.Number to preserve integer precision
var existingGenesis map[string]interface{}
var existingGenesis map[string]any
decoder := json.NewDecoder(bytes.NewReader(existingBz))
decoder.UseNumber()
if err = decoder.Decode(&existingGenesis); err != nil {
return err
}

// Get existing alloc.
alloc, ok := existingGenesis[allocsKey].(map[string]interface{})
alloc, ok := existingGenesis[allocsKey].(map[string]any)
if !ok {
return errors.New("invalid alloc format in genesis file")
}
Expand Down
26 changes: 13 additions & 13 deletions cli/commands/genesis/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ func setupMockGenesis(t *testing.T, tmpDir string) string {
depositAddr := common.Address(chainSpec.DepositContractAddress())

mockGenesisPath := filepath.Join(tmpDir, "genesis.json")
mockGenesis := map[string]interface{}{
"alloc": map[string]interface{}{
depositAddr.Hex(): map[string]interface{}{
mockGenesis := map[string]any{
"alloc": map[string]any{
depositAddr.Hex(): map[string]any{
"balance": "0x0",
"code": "0x1234",
},
Expand All @@ -113,12 +113,12 @@ func setupMockCLGenesis(t *testing.T, tmpDir string) string {
require.NoError(t, os.MkdirAll(configDir, 0o755))
mockCLGenesisPath := filepath.Join(configDir, "genesis.json")

mockCLGenesis := map[string]interface{}{
"app_state": map[string]interface{}{
"beacon": map[string]interface{}{
"deposits": []interface{}{
map[string]interface{}{
"data": map[string]interface{}{
mockCLGenesis := map[string]any{
"app_state": map[string]any{
"beacon": map[string]any{
"deposits": []any{
map[string]any{
"data": map[string]any{
"amount": "32000000000",
"pubkey": "0x1234",
"withdrawal_address": "0x5678",
Expand Down Expand Up @@ -147,16 +147,16 @@ func verifyStorageOutput(t *testing.T, genesisPath string) {
outputBz, err := afero.ReadFile(afero.NewOsFs(), genesisPath)
require.NoError(t, err)

var output map[string]interface{}
var output map[string]any
err = json.Unmarshal(outputBz, &output)
require.NoError(t, err)

// Check that the deposit contract storage was set correctly
alloc, ok := output["alloc"].(map[string]interface{})
alloc, ok := output["alloc"].(map[string]any)
require.True(t, ok)
depositContract, ok := alloc[depositAddr.Hex()].(map[string]interface{})
depositContract, ok := alloc[depositAddr.Hex()].(map[string]any)
require.True(t, ok)
storage, ok := depositContract["storage"].(map[string]interface{})
storage, ok := depositContract["storage"].(map[string]any)
require.True(t, ok)

// Verify storage slots
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/server/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
type (
// AppOptions, usually implemented by Viper, holds the configuration for the application.
AppOptions interface {
Get(string) interface{}
Get(string) any
}

// AppCreator is a function that allows us to lazily initialize an application using various
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const (

// AppOptions is from the SDK, we should look to remove its usage.
type AppOptions interface {
Get(string) interface{}
Get(string) any
}

// DefaultConfig returns the default configuration for a BeaconKit chain.
Expand Down
2 changes: 1 addition & 1 deletion config/config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func SetConfigTemplate(customTemplate string) error {

// WriteConfigFile renders config using the template and writes it to
// configFilePath.
func WriteConfigFile(configFilePath string, config interface{}) error {
func WriteConfigFile(configFilePath string, config any) error {
var buffer bytes.Buffer

if err := configTemplate.Execute(&buffer, config); err != nil {
Expand Down
16 changes: 8 additions & 8 deletions config/spec/creator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ import (

// dummyAppOptions is a simple implementation of the AppOptions interface for testing.
type dummyAppOptions struct {
values map[string]interface{}
values map[string]any
}

func (d dummyAppOptions) Get(key string) interface{} {
func (d dummyAppOptions) Get(key string) any {
return d.values[key]
}

func TestCreateChainSpec_Devnet(t *testing.T) {
t.Parallel()

// Set the app opts to force the devnet branch.
opts := dummyAppOptions{values: map[string]interface{}{
opts := dummyAppOptions{values: map[string]any{
flags.ChainSpec: "devnet",
}}
cs, err := spec.Create(opts)
Expand All @@ -59,7 +59,7 @@ func TestCreateChainSpec_Testnet(t *testing.T) {
t.Parallel()

// Set the app opts to force the testnet branch.
opts := dummyAppOptions{values: map[string]interface{}{
opts := dummyAppOptions{values: map[string]any{
flags.ChainSpec: "testnet",
}}
cs, err := spec.Create(opts)
Expand All @@ -74,7 +74,7 @@ func TestCreateChainSpec_Mainnet(t *testing.T) {
t.Parallel()

// Set the app opts to force the mainnet branch.
opts := dummyAppOptions{values: map[string]interface{}{
opts := dummyAppOptions{values: map[string]any{
flags.ChainSpec: "mainnet",
}}
cs, err := spec.Create(opts)
Expand All @@ -89,7 +89,7 @@ func TestCreateChainSpec_Default_NoSpecFlag(t *testing.T) {
t.Parallel()

// Provide an empty app opts so that no spec flag is present.
opts := dummyAppOptions{values: map[string]interface{}{}}
opts := dummyAppOptions{values: map[string]any{}}
cs, err := spec.Create(opts)
require.NoError(t, err)
mainnetSpec, err := spec.MainnetChainSpec()
Expand All @@ -101,7 +101,7 @@ func TestCreateChainSpec_File(t *testing.T) {
t.Parallel()

// Provide a non-empty value for the custom spec file of mainnet.
opts := dummyAppOptions{values: map[string]interface{}{
opts := dummyAppOptions{values: map[string]any{
flags.ChainSpec: "file",
flags.ChainSpecFilePath: "../../testing/networks/80094/spec.toml",
}}
Expand Down Expand Up @@ -180,7 +180,7 @@ consensus-enable-height = 2
specFile := filepath.Join(tempDir, tt.name+".toml")
require.NoError(t, os.WriteFile(specFile, []byte(tt.specContent), 0600))

opts := dummyAppOptions{values: map[string]interface{}{
opts := dummyAppOptions{values: map[string]any{
flags.ChainSpec: "file",
flags.ChainSpecFilePath: specFile,
}}
Expand Down
8 changes: 4 additions & 4 deletions config/viper/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func NumericToDomainTypeFunc() mapstructure.DecodeHookFunc {
return func(
f reflect.Type,
t reflect.Type,
data interface{},
) (interface{}, error) {
data any,
) (any, error) {
var dt common.DomainType
if t != reflect.TypeOf(dt) {
return data, nil
Expand Down Expand Up @@ -92,8 +92,8 @@ func stringTo[T any](
return func(
f reflect.Type,
t reflect.Type,
data interface{},
) (interface{}, error) {
data any,
) (any, error) {
if f.Kind() != reflect.String {
return data, nil
}
Expand Down
4 changes: 2 additions & 2 deletions execution/client/ethclient/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func (s *Client) SubscribeFilterLogs(
return nil, errors.New("not implemented")
}

func toFilterArg(q ethereum.FilterQuery) (interface{}, error) {
arg := map[string]interface{}{
func toFilterArg(q ethereum.FilterQuery) (any, error) {
arg := map[string]any{
"address": q.Addresses,
"topics": q.Topics,
}
Expand Down
2 changes: 1 addition & 1 deletion node-api/middleware/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type CustomValidator struct {
}

// Validate validates the given interface.
func (cv *CustomValidator) Validate(i interface{}) error {
func (cv *CustomValidator) Validate(i any) error {
if err := cv.Validator.Struct(i); err != nil {
var validationErrors validator.ValidationErrors
hasValidationErrors := errors.As(err, &validationErrors)
Expand Down
2 changes: 1 addition & 1 deletion node-core/services/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (s *Registry) RegisterService(service Basic) error {
// to a service currently stored in the service registry. This ensures the
// input argument is set to the right pointer that refers to the originally
// registered service.
func (s *Registry) FetchService(service interface{}) error {
func (s *Registry) FetchService(service any) error {
serviceType := reflect.TypeOf(service)
if serviceType.Kind() != reflect.Ptr ||
serviceType.Elem().Kind() != reflect.Ptr {
Expand Down
2 changes: 1 addition & 1 deletion primitives/crypto/sha256/sha256.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
// sha256Pool is a pool of sha256 hash functions.
//
//nolint:gochecknoglobals // needed for pool.
var sha256Pool = sync.Pool{New: func() interface{} {
var sha256Pool = sync.Pool{New: func() any {
return sha256.New()
}}

Expand Down
4 changes: 2 additions & 2 deletions state-transition/core/state_processor_withdrawals.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ func verifyWithdrawalConditions(st *state.StateDB, validator *ctypes.Validator)

// withdrawalFields returns the structured fields for logging any WithdrawalRequest.
// error is optional
func withdrawalFields(req *ctypes.WithdrawalRequest, err error) []interface{} {
logFields := []interface{}{
func withdrawalFields(req *ctypes.WithdrawalRequest, err error) []any {
logFields := []any{
"source_address", req.SourceAddress.String(),
"validator_pubkey", req.ValidatorPubKey.String(),
"amount", req.Amount,
Expand Down
4 changes: 2 additions & 2 deletions testing/e2e/e2e_comet_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (s *BeaconKitE2ESuite) TestABCIInfo() {
wg.Wait()

// Check for errors.
errorsMap.Range(func(key, value interface{}) bool {
errorsMap.Range(func(key, value any) bool {
name := key.(string) //nolint:errcheck // Safe to ignore.
err := value.(error) //nolint:errcheck // Safe to ignore.
s.Require().NoError(err, "Error getting ABCI info from node %s", name)
Expand All @@ -83,7 +83,7 @@ func (s *BeaconKitE2ESuite) TestABCIInfo() {

// Collect heights into a map for comparison.
heights := make(map[string]int64)
heightsMap.Range(func(key, value interface{}) bool {
heightsMap.Range(func(key, value any) bool {
name := key.(string) //nolint:errcheck // Safe to ignore.
height := value.(int64) //nolint:errcheck // Safe to ignore.
heights[name] = height
Expand Down
6 changes: 3 additions & 3 deletions testing/e2e/suite/types/service_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *WrappedServiceContext) Start(
ctx context.Context,
enclaveContext *enclaves.EnclaveContext,
) (*enclaves.StarlarkRunResult, error) {
res, err := s.RunHelper(ctx, "start_service", map[string]interface{}{
res, err := s.RunHelper(ctx, "start_service", map[string]any{
"service_name": s.GetServiceName(),
})
if err != nil {
Expand All @@ -97,15 +97,15 @@ func (s *WrappedServiceContext) Start(
func (s *WrappedServiceContext) Stop(
ctx context.Context,
) (*enclaves.StarlarkRunResult, error) {
return s.RunHelper(ctx, "stop_service", map[string]interface{}{
return s.RunHelper(ctx, "stop_service", map[string]any{
"service_name": s.GetServiceName(),
})
}

func (s *WrappedServiceContext) RunHelper(
ctx context.Context,
mainFunctionName string,
args map[string]interface{},
args map[string]any,
) (*enclaves.StarlarkRunResult, error) {
jsonBytes, err := json.Marshal(args)
if err != nil {
Expand Down