Skip to content

Commit

Permalink
Merge branch 'main' into alex/system_tests_wip
Browse files Browse the repository at this point in the history
* main:
  fix: Implement gogoproto customtype to secp256r1 keys (#20027)
  fix(x/epochs): avoid invalid epoch duration in simulation (#20030)
  fix(x/bank): align query with multi denoms for send-enabled (#20028)
  refactor(x/slashing)!: remove Accounts String (#20026)
  refactor(x/evidence)!: remove Address.String() (#20016)
  chore: make telemetry consistent (#20025)
  chore: prepare x/tx changelog (#20015)
  build(deps): Bump actions/add-to-project from 1.0.0 to 1.0.1 (#20018)
  feat(x/bank): support depinject for send restrictions (#20014)
  feat: Conditionally emit metrics based on enablement (#19903)
  fix(store): fix the typo (#20011)
  docs(x/feegrant): fix allowance typo (#20000)
  chore(confix): update latest config value (#20012)
  • Loading branch information
alpe committed Apr 15, 2024
2 parents 2729722 + 037cf98 commit 1297157
Show file tree
Hide file tree
Showing 51 changed files with 517 additions and 104 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i

### Improvements

* (telemetry) [#19903](https://github.com/cosmos/cosmos-sdk/pull/19903) Conditionally emit metrics based on enablement.
* **Introduction of `Now` Function**: Added a new function called `Now` to the telemetry package. It returns the current system time if telemetry is enabled, or a zero time if telemetry is not enabled.
* **Atomic Global Variable**: Implemented an atomic global variable to manage the state of telemetry's enablement. This ensures thread safety for the telemetry state.
* **Conditional Telemetry Emission**: All telemetry functions have been updated to emit metrics only when telemetry is enabled. They perform a check with `isTelemetryEnabled()` and return early if telemetry is disabled, minimizing unnecessary operations and overhead.
* (types) [#19869](https://github.com/cosmos/cosmos-sdk/pull/19869) Removed `Any` type from `codec/types` and replaced it with an alias for `cosmos/gogoproto/types/any`.
* (server) [#19854](https://github.com/cosmos/cosmos-sdk/pull/19854) Add customizability to start command.
* Add `StartCmdOptions` in `server.AddCommands` instead of `servertypes.ModuleInitFlags`. To set custom flags set them in the `StartCmdOptions` struct on the `AddFlags` field.
Expand Down Expand Up @@ -109,6 +113,8 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* [#19833](https://github.com/cosmos/cosmos-sdk/pull/19833) Fix some places in which we call Remove inside a Walk.
* [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov).
* (baseapp) [#19970](https://github.com/cosmos/cosmos-sdk/pull/19970) Fix default config values to use no-op mempool as default.
* (crypto) [#20027](https://github.com/cosmos/cosmos-sdk/pull/20027) secp256r1 keys now implement gogoproto's customtype interface.
* (x/bank) [#20028](https://github.com/cosmos/cosmos-sdk/pull/20028) Align query with multi denoms for send-enabled.

### API Breaking Changes

Expand Down
175 changes: 157 additions & 18 deletions api/cosmos/bank/module/v1/module.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/cosmos/feegrant/v1beta1/query_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (app *BaseApp) Query(_ context.Context, req *abci.RequestQuery) (resp *abci

telemetry.IncrCounter(1, "query", "count")
telemetry.IncrCounter(1, "query", req.Path)
defer telemetry.MeasureSince(time.Now(), req.Path)
defer telemetry.MeasureSince(telemetry.Now(), req.Path)

if req.Path == QueryPathBroadcastTx {
return sdkerrors.QueryResult(errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "can't route a broadcast tx message"), app.trace), nil
Expand Down
2 changes: 1 addition & 1 deletion client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29488,7 +29488,7 @@ paths:
- Query
/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}:
get:
summary: Allowance returns granted allwance to the grantee by the granter.
summary: Allowance returns granted allowance to the grantee by the granter.
operationId: Allowance
responses:
'200':
Expand Down
2 changes: 1 addition & 1 deletion client/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/log v1.3.1 // indirect
cosmossdk.io/math v1.3.0 // indirect
cosmossdk.io/math v1.3.0
cosmossdk.io/store v1.0.2 // indirect
cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 // indirect
cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000
Expand Down
25 changes: 25 additions & 0 deletions crypto/keys/secp256r1/privkey.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package secp256r1

import (
"encoding/base64"

"github.com/cosmos/cosmos-sdk/crypto/keys/internal/ecdsa"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
)

var _ customProtobufType = (*ecdsaSK)(nil)

// GenPrivKey generates a new secp256r1 private key. It uses operating system randomness.
func GenPrivKey() (*PrivKey, error) {
key, err := ecdsa.GenPrivKey(secp256r1)
Expand Down Expand Up @@ -52,6 +56,27 @@ type ecdsaSK struct {
ecdsa.PrivKey
}

// Marshal implements customProtobufType.
func (sk ecdsaSK) Marshal() ([]byte, error) {
return sk.PrivKey.Bytes(), nil
}

// MarshalJSON implements customProtobufType.
func (sk ecdsaSK) MarshalJSON() ([]byte, error) {
b64 := base64.StdEncoding.EncodeToString(sk.PrivKey.Bytes())
return []byte(b64), nil
}

// UnmarshalJSON implements customProtobufType.
func (sk *ecdsaSK) UnmarshalJSON(data []byte) error {
bz, err := base64.StdEncoding.DecodeString(string(data))
if err != nil {
return err
}

return sk.PrivKey.Unmarshal(bz, secp256r1, fieldSize)
}

// Size implements proto.Marshaler interface
func (sk *ecdsaSK) Size() int {
if sk == nil {
Expand Down
Loading

0 comments on commit 1297157

Please sign in to comment.