Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.
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
20 changes: 20 additions & 0 deletions .github/workflows/uci-go-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: UCI

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true

jobs:
go-lint:
name: Go
uses: sei-protocol/uci/.github/workflows/go-lint.yml@v0.0.1
4 changes: 2 additions & 2 deletions client/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (ctx Context) PrintBytes(o []byte) error {
// will be JSON encoded using ctx.Codec. An error is returned upon failure.
func (ctx Context) PrintProto(toPrint proto.Message) error {
// always serialize JSON initially because proto json can't be directly YAML encoded
out, err := ctx.Codec.MarshalJSON(toPrint)
out, err := ctx.Codec.MarshalAsJSON(toPrint)
if err != nil {
return err
}
Expand All @@ -287,7 +287,7 @@ func (ctx Context) PrintProto(toPrint proto.Message) error {
// and uses amino JSON encoding.
// Deprecated: It will be removed in the near future!
func (ctx Context) PrintObjectLegacy(toPrint interface{}) error {
out, err := ctx.LegacyAmino.MarshalJSON(toPrint)
out, err := ctx.LegacyAmino.MarshalAsJSON(toPrint)
if err != nil {
return err
}
Expand Down
6 changes: 2 additions & 4 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions client/grpc/tmservice/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *IntegrationTestSuite) TearDownSuite() {
s.network.Cleanup()
}

func (s IntegrationTestSuite) TestQueryNodeInfo() {
func (s *IntegrationTestSuite) TestQueryNodeInfo() {
val := s.network.Validators[0]

res, err := s.queryClient.GetNodeInfo(context.Background(), &tmservice.GetNodeInfoRequest{})
Expand All @@ -58,11 +58,11 @@ func (s IntegrationTestSuite) TestQueryNodeInfo() {
s.Require().NoError(err)

var getInfoRes tmservice.GetNodeInfoResponse
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(restRes, &getInfoRes))
s.Require().NoError(val.ClientCtx.Codec.UnmarshalAsJSON(restRes, &getInfoRes))
s.Require().Equal(getInfoRes.ApplicationVersion.AppName, version.NewInfo().AppName)
}

func (s IntegrationTestSuite) TestQuerySyncing() {
func (s *IntegrationTestSuite) TestQuerySyncing() {
val := s.network.Validators[0]

_, err := s.queryClient.GetSyncing(context.Background(), &tmservice.GetSyncingRequest{})
Expand All @@ -71,10 +71,10 @@ func (s IntegrationTestSuite) TestQuerySyncing() {
restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/base/tendermint/v1beta1/syncing", val.APIAddress))
s.Require().NoError(err)
var syncingRes tmservice.GetSyncingResponse
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(restRes, &syncingRes))
s.Require().NoError(val.ClientCtx.Codec.UnmarshalAsJSON(restRes, &syncingRes))
}

func (s IntegrationTestSuite) TestQueryLatestBlock() {
func (s *IntegrationTestSuite) TestQueryLatestBlock() {
val := s.network.Validators[0]

_, err := s.queryClient.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{})
Expand All @@ -83,21 +83,21 @@ func (s IntegrationTestSuite) TestQueryLatestBlock() {
restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/base/tendermint/v1beta1/blocks/latest", val.APIAddress))
s.Require().NoError(err)
var blockInfoRes tmservice.GetLatestBlockResponse
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(restRes, &blockInfoRes))
s.Require().NoError(val.ClientCtx.Codec.UnmarshalAsJSON(restRes, &blockInfoRes))
}

func (s IntegrationTestSuite) TestQueryBlockByHeight() {
func (s *IntegrationTestSuite) TestQueryBlockByHeight() {
val := s.network.Validators[0]
_, err := s.queryClient.GetBlockByHeight(context.Background(), &tmservice.GetBlockByHeightRequest{Height: 1})
s.Require().NoError(err)

restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/base/tendermint/v1beta1/blocks/%d", val.APIAddress, 1))
s.Require().NoError(err)
var blockInfoRes tmservice.GetBlockByHeightResponse
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(restRes, &blockInfoRes))
s.Require().NoError(val.ClientCtx.Codec.UnmarshalAsJSON(restRes, &blockInfoRes))
}

func (s IntegrationTestSuite) TestQueryLatestValidatorSet() {
func (s *IntegrationTestSuite) TestQueryLatestValidatorSet() {
val := s.network.Validators[0]

// nil pagination
Expand Down Expand Up @@ -125,14 +125,14 @@ func (s IntegrationTestSuite) TestQueryLatestValidatorSet() {
restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/base/tendermint/v1beta1/validatorsets/latest?pagination.offset=%d&pagination.limit=%d", val.APIAddress, 0, 1))
s.Require().NoError(err)
var validatorSetRes tmservice.GetLatestValidatorSetResponse
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(restRes, &validatorSetRes))
s.Require().NoError(val.ClientCtx.Codec.UnmarshalAsJSON(restRes, &validatorSetRes))
s.Require().Equal(1, len(validatorSetRes.Validators))
anyPub, err := codectypes.NewAnyWithValue(val.PubKey)
s.Require().NoError(err)
s.Require().Equal(validatorSetRes.Validators[0].PubKey, anyPub)
}

func (s IntegrationTestSuite) TestLatestValidatorSet_GRPC() {
func (s *IntegrationTestSuite) TestLatestValidatorSet_GRPC() {
vals := s.network.Validators
testCases := []struct {
name string
Expand Down Expand Up @@ -163,7 +163,7 @@ func (s IntegrationTestSuite) TestLatestValidatorSet_GRPC() {
}
}

func (s IntegrationTestSuite) TestLatestValidatorSet_GRPCGateway() {
func (s *IntegrationTestSuite) TestLatestValidatorSet_GRPCGateway() {
vals := s.network.Validators
testCases := []struct {
name string
Expand All @@ -184,7 +184,7 @@ func (s IntegrationTestSuite) TestLatestValidatorSet_GRPCGateway() {
s.Require().Contains(string(res), tc.expErrMsg)
} else {
var result tmservice.GetLatestValidatorSetResponse
err = vals[0].ClientCtx.Codec.UnmarshalJSON(res, &result)
err = vals[0].ClientCtx.Codec.UnmarshalAsJSON(res, &result)
s.Require().NoError(err)
s.Require().Equal(uint64(len(vals)), result.Pagination.Total)
anyPub, err := codectypes.NewAnyWithValue(vals[0].PubKey)
Expand All @@ -195,7 +195,7 @@ func (s IntegrationTestSuite) TestLatestValidatorSet_GRPCGateway() {
}
}

func (s IntegrationTestSuite) TestValidatorSetByHeight_GRPC() {
func (s *IntegrationTestSuite) TestValidatorSetByHeight_GRPC() {
vals := s.network.Validators
testCases := []struct {
name string
Expand Down Expand Up @@ -224,7 +224,7 @@ func (s IntegrationTestSuite) TestValidatorSetByHeight_GRPC() {
}
}

func (s IntegrationTestSuite) TestValidatorSetByHeight_GRPCGateway() {
func (s *IntegrationTestSuite) TestValidatorSetByHeight_GRPCGateway() {
vals := s.network.Validators
testCases := []struct {
name string
Expand All @@ -246,7 +246,7 @@ func (s IntegrationTestSuite) TestValidatorSetByHeight_GRPCGateway() {
s.Require().Contains(string(res), tc.expErrMsg)
} else {
var result tmservice.GetValidatorSetByHeightResponse
err = vals[0].ClientCtx.Codec.UnmarshalJSON(res, &result)
err = vals[0].ClientCtx.Codec.UnmarshalAsJSON(res, &result)
s.Require().NoError(err)
s.Require().Equal(uint64(len(vals)), result.Pagination.Total)
}
Expand Down
1 change: 1 addition & 0 deletions client/grpc_query_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build norace
// +build norace

package client_test
Expand Down
2 changes: 1 addition & 1 deletion client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func printCreate(cmd *cobra.Command, info keyring.Info, showMnemonic bool, mnemo
out.Mnemonic = mnemonic
}

jsonString, err := KeysCdc.MarshalJSON(out)
jsonString, err := KeysCdc.MarshalAsJSON(out)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion client/keys/add_ledger_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build ledger test_ledger_mock
//go:build ledger || test_ledger_mock
// +build ledger test_ledger_mock

package keys

Expand Down
4 changes: 2 additions & 2 deletions client/keys/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ func init() {

// marshal keys
func MarshalJSON(o interface{}) ([]byte, error) {
return KeysCdc.MarshalJSON(o)
return KeysCdc.MarshalAsJSON(o)
}

// unmarshal json
func UnmarshalJSON(bz []byte, ptr interface{}) error {
return KeysCdc.UnmarshalJSON(bz, ptr)
return KeysCdc.UnmarshalAsJSON(bz, ptr)
}
14 changes: 7 additions & 7 deletions client/keys/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ type testCases struct {
func getTestCases() testCases {
return testCases{
// nolint:govet
[]keyring.KeyOutput{
{"A", "B", "C", "", "D", "E"},
{"A", "B", "C", "", "D", ""},
{"", "B", "C", "", "D", ""},
{"", "", "", "", "", ""},
Keys: []keyring.KeyOutput{
{Name: "A", Type: "B", Address: "C", PubKey: "D", Mnemonic: "E"},
{Name: "A", Type: "B", Address: "C", PubKey: "D"},
{Type: "B", Address: "C", PubKey: "D"},
{},
},
make([]keyring.KeyOutput, 4),
[][]byte{
Answers: make([]keyring.KeyOutput, 4),
JSON: [][]byte{
[]byte(`{"name":"A","type":"B","address":"C","evm_address":"","pubkey":"D","mnemonic":"E"}`),
[]byte(`{"name":"A","type":"B","address":"C","evm_address":"","pubkey":"D"}`),
[]byte(`{"name":"","type":"B","address":"C","evm_address":"","pubkey":"D"}`),
Expand Down
2 changes: 1 addition & 1 deletion client/keys/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func displayParseKeyInfo(w io.Writer, stringer fmt.Stringer, output string) {
out, err = yaml.Marshal(&stringer)

case OutputFormatJSON:
out, err = KeysCdc.MarshalJSON(stringer)
out, err = KeysCdc.MarshalAsJSON(stringer)
}

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions client/keys/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func printKeyInfo(w io.Writer, keyInfo cryptokeyring.Info, bechKeyOut bechKeyOut
printTextInfos(w, []cryptokeyring.KeyOutput{ko})

case OutputFormatJSON:
out, err := KeysCdc.MarshalJSON(ko)
out, err := KeysCdc.MarshalAsJSON(ko)
if err != nil {
panic(err)
}
Expand All @@ -55,7 +55,7 @@ func printInfos(w io.Writer, infos []cryptokeyring.Info, output string) {
printTextInfos(w, kos)

case OutputFormatJSON:
out, err := KeysCdc.MarshalJSON(kos)
out, err := KeysCdc.MarshalAsJSON(kos)
if err != nil {
panic(err)
}
Expand Down
1 change: 1 addition & 0 deletions client/query_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build norace
// +build norace

package client_test
Expand Down
2 changes: 1 addition & 1 deletion client/rpc/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func getBlock(clientCtx client.Context, height *int64) ([]byte, error) {
return nil, err
}

return legacy.Cdc.MarshalJSON(res)
return legacy.Cdc.MarshalAsJSON(res)
}

// get the current blockchain height
Expand Down
2 changes: 1 addition & 1 deletion client/rpc/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s *IntegrationTestSuite) TestLatestBlocks() {
s.Require().NoError(err)

var result ctypes.ResultBlock
err = legacy.Cdc.UnmarshalJSON(res, &result)
err = legacy.Cdc.UnmarshalAsJSON(res, &result)
s.Require().NoError(err)
}

Expand Down
2 changes: 1 addition & 1 deletion client/rpc/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func StatusCommand() *cobra.Command {
},
}

output, err := clientCtx.LegacyAmino.MarshalJSON(statusWithPk)
output, err := clientCtx.LegacyAmino.MarshalAsJSON(statusWithPk)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion client/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func WriteGeneratedTxResponse(
return
}

output, err := clientCtx.LegacyAmino.MarshalJSON(stdTx)
output, err := clientCtx.LegacyAmino.MarshalAsJSON(stdTx)
if rest.CheckInternalServerError(w, err) {
return
}
Expand Down
14 changes: 7 additions & 7 deletions codec/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func RegisterEvidences(cdc *LegacyAmino) {
// via an Amino codec. It returns an error if it cannot serialize or indent as
// JSON.
func MarshalJSONIndent(cdc *LegacyAmino, obj interface{}) ([]byte, error) {
bz, err := cdc.MarshalJSON(obj)
bz, err := cdc.MarshalAsJSON(obj)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -139,8 +139,8 @@ func (cdc *LegacyAmino) MustUnmarshalLengthPrefixed(bz []byte, ptr interface{})
}
}

// MarshalJSON implements codec.Codec interface
func (cdc *LegacyAmino) MarshalJSON(o interface{}) ([]byte, error) {
// MarshalAsJSON implements codec.Codec interface
func (cdc *LegacyAmino) MarshalAsJSON(o interface{}) ([]byte, error) {
err := cdc.jsonMarshalAnys(o)
if err != nil {
return nil, err
Expand All @@ -149,15 +149,15 @@ func (cdc *LegacyAmino) MarshalJSON(o interface{}) ([]byte, error) {
}

func (cdc *LegacyAmino) MustMarshalJSON(o interface{}) []byte {
bz, err := cdc.MarshalJSON(o)
bz, err := cdc.MarshalAsJSON(o)
if err != nil {
panic(err)
}
return bz
}

// UnmarshalJSON implements codec.Codec interface
func (cdc *LegacyAmino) UnmarshalJSON(bz []byte, ptr interface{}) error {
// UnmarshalAsJSON implements codec.Codec interface
func (cdc *LegacyAmino) UnmarshalAsJSON(bz []byte, ptr interface{}) error {
err := cdc.Amino.UnmarshalJSON(bz, ptr)
if err != nil {
return err
Expand All @@ -166,7 +166,7 @@ func (cdc *LegacyAmino) UnmarshalJSON(bz []byte, ptr interface{}) error {
}

func (cdc *LegacyAmino) MustUnmarshalJSON(bz []byte, ptr interface{}) {
err := cdc.UnmarshalJSON(bz, ptr)
err := cdc.UnmarshalAsJSON(bz, ptr)
if err != nil {
panic(err)
}
Expand Down
22 changes: 12 additions & 10 deletions codec/amino_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func (ac *AminoCodec) MustUnmarshalLengthPrefixed(bz []byte, ptr ProtoMarshaler)

// MarshalJSON implements JSONCodec.MarshalJSON method,
// it marshals to JSON using legacy amino codec.
func (ac *AminoCodec) MarshalJSON(o proto.Message) ([]byte, error) {
return ac.LegacyAmino.MarshalJSON(o)
func (ac *AminoCodec) MarshalAsJSON(o proto.Message) ([]byte, error) {
return ac.LegacyAmino.MarshalAsJSON(o)
}

// MustMarshalJSON implements JSONCodec.MustMarshalJSON method,
Expand All @@ -71,8 +71,8 @@ func (ac *AminoCodec) MustMarshalJSON(o proto.Message) []byte {

// UnmarshalJSON implements JSONCodec.UnmarshalJSON method,
// it unmarshals from JSON using legacy amino codec.
func (ac *AminoCodec) UnmarshalJSON(bz []byte, ptr proto.Message) error {
return ac.LegacyAmino.UnmarshalJSON(bz, ptr)
func (ac *AminoCodec) UnmarshalAsJSON(bz []byte, ptr proto.Message) error {
return ac.LegacyAmino.UnmarshalAsJSON(bz, ptr)
}

// MustUnmarshalJSON implements JSONCodec.MustUnmarshalJSON method,
Expand All @@ -96,8 +96,9 @@ func (ac *AminoCodec) MarshalInterface(i proto.Message) ([]byte, error) {
// NOTE: to unmarshal a concrete type, you should use Unmarshal instead
//
// Example:
// var x MyInterface
// err := cdc.UnmarshalInterface(bz, &x)
//
// var x MyInterface
// err := cdc.UnmarshalInterface(bz, &x)
func (ac *AminoCodec) UnmarshalInterface(bz []byte, ptr interface{}) error {
return ac.LegacyAmino.Unmarshal(bz, ptr)
}
Expand All @@ -109,16 +110,17 @@ func (ac *AminoCodec) MarshalInterfaceJSON(i proto.Message) ([]byte, error) {
if err := assertNotNil(i); err != nil {
return nil, err
}
return ac.LegacyAmino.MarshalJSON(i)
return ac.LegacyAmino.MarshalAsJSON(i)
}

// UnmarshalInterfaceJSON is a convenience function for amino unmarshaling interfaces.
// `ptr` must be a pointer to an interface.
// NOTE: to unmarshal a concrete type, you should use UnmarshalJSON instead
//
// Example:
// var x MyInterface
// err := cdc.UnmarshalInterfaceJSON(bz, &x)
//
// var x MyInterface
// err := cdc.UnmarshalInterfaceJSON(bz, &x)
func (ac *AminoCodec) UnmarshalInterfaceJSON(bz []byte, ptr interface{}) error {
return ac.LegacyAmino.UnmarshalJSON(bz, ptr)
return ac.LegacyAmino.UnmarshalAsJSON(bz, ptr)
}
Loading
Loading