Skip to content

Commit

Permalink
update third party protos
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Feb 29, 2024
1 parent f61d6cd commit bbc1fb6
Show file tree
Hide file tree
Showing 212 changed files with 5,721 additions and 2,858 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ replace (
// TODO[1760]: wasm: Put this CosmWasm/wasmd replace back with an updated version (or delete it).
// github.com/CosmWasm/wasmd => github.com/provenance-io/wasmd v0.30.0-pio-5
// TODO[1760]: sdk: Put this replace back with an updated version of the sdk from our fork.
github.com/cosmos/cosmos-sdk => github.com/provenance-io/cosmos-sdk v0.50.5-0.20240222214016-afb9dceecf36
github.com/cosmos/cosmos-sdk => github.com/provenance-io/cosmos-sdk v0.50.5-nullpointer0x00-msg-router
// TODO[1760]: ibc: Put this ibc-go replace back with an updated version (or delete it).
// github.com/cosmos/ibc-go/v6 => github.com/provenance-io/ibc-go/v6 v6.2.0-pio-1
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/provenance-io/cosmos-sdk v0.50.5-0.20240222214016-afb9dceecf36 h1:RII2eoui1aIt8Dkc+3LkSoceTjQtdc8v2mEad68XXtk=
github.com/provenance-io/cosmos-sdk v0.50.5-0.20240222214016-afb9dceecf36/go.mod h1:UbShFs6P8Ly29xxJvkNGaNaL/UGj5a686NRtb1Cqra0=
github.com/provenance-io/cosmos-sdk v0.50.5-nullpointer0x00-msg-router h1:DznZMkfRr23Q4CZXR9WBgP8zfn9fQf5xiqK4kaQqZXs=
github.com/provenance-io/cosmos-sdk v0.50.5-nullpointer0x00-msg-router/go.mod h1:UbShFs6P8Ly29xxJvkNGaNaL/UGj5a686NRtb1Cqra0=
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
Expand Down
32 changes: 16 additions & 16 deletions scripts/proto-update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ EOF
DEST="${1:-$( cd "$( dirname "${BASH_SOURCE:-$0}" )/.."; pwd -P )/third_party}"

# Retrieve versions from go.mod (single source of truth)
CONFIO_PROTO_URL="https://raw.githubusercontent.com/confio/ics23/go/$( go list -m github.com/confio/ics23/go | sed 's:.* ::' )/proofs.proto"
ICS23_PROTO_URL="https://raw.githubusercontent.com/cosmos/ics23/go/$( go list -m github.com/cosmos/ics23/go | sed 's:.* ::' )/proto/cosmos/ics23/v1/proofs.proto"
GOGO_PROTO_URL="https://raw.githubusercontent.com/regen-network/protobuf/$( go list -m github.com/gogo/protobuf | sed 's:.* ::' )/gogoproto/gogo.proto"
COSMOS_PROTO_URL="raw.githubusercontent.com/cosmos/cosmos-proto/$( go list -m github.com/cosmos/cosmos-proto | sed 's:.* ::' )/proto/cosmos_proto/cosmos.proto"
COSMWASM_V1BETA1_TARBALL_URL='github.com/CosmWasm/wasmd/tarball/v0.17.0' # Backwards compatibility. Needed to serialize/deserialize older wasmd protos.
COSMWASM_CUR_TARBALL_URL="$( go list -m github.com/CosmWasm/wasmd | sed 's:.* => ::; s: :/tarball/:;' )"
IBC_PORT_V1_QUERY_URL='https://raw.githubusercontent.com/cosmos/ibc-go/v2.3.1/proto/ibc/core/port/v1/query.proto' # Backwards compatibility.
# TODO[1760]: proto: Ensure this ibc-go is correct.
IBC_GO_TARBALL_URL="$( go list -m github.com/cosmos/ibc-go/v8 | sed 's:.* => ::; s: :/tarball/:; s:/v8::;')"
COSMOS_TARBALL_URL="$( go list -m github.com/cosmos/cosmos-sdk | sed 's:.* => ::; s: :/tarball/:;' )"
# TODO[1760]: proto: Get the cometbft tarball instead of tendermint.
TM_TARBALL_URL="$( go list -m github.com/tendermint/tendermint | sed 's:.* => ::; s: :/tarball/:;' )"
COMETBFT_TARBALL_URL="$( go list -m github.com/cometbft/cometbft | sed 's:.* => ::; s: :/tarball/:;' )"

# gnu tar on ubuntu requires the '--wildcards' flag
tar='tar zx --strip-components 1'
Expand All @@ -43,9 +41,9 @@ cd "$DEST"
PROTO_EXPR='*/proto/**/*.proto'

# Refresh third_party protos
CONFIO_FILE='proto/proofs.proto'
rm -f "$CONFIO_FILE" "$CONFIO_FILE.orig"
curl -f -sSL "$CONFIO_PROTO_URL" -o "$CONFIO_FILE.orig" --create-dirs
ICS23_FILE='proto/proofs.proto'
rm -f "$ICS23_FILE"
curl -f -sSL "$ICS23_PROTO_URL" -o "$ICS23_FILE" --create-dirs

GOGO_FILE='proto/gogoproto/gogo.proto'
rm -f "$GOGO_FILE"
Expand All @@ -70,16 +68,18 @@ rm -rf 'proto/cosmos'
curl -f -sSL "$COSMOS_TARBALL_URL" | $tar --exclude='*/third_party' --exclude='*/testutil' "$PROTO_EXPR"

rm -rf 'proto/tendermint'
curl -f -sSL "$TM_TARBALL_URL" | $tar --exclude='*/third_party' "$PROTO_EXPR"
curl -f -sSL "$COMETBFT_TARBALL_URL" | $tar --exclude='*/third_party' "$PROTO_EXPR"


# TODO[1760]: Do we still need this? since confio moved to cosmos?
## insert go, java package option into proofs.proto file
## Issue link: https://github.com/confio/ics23/issues/32 (instead of a simple sed we need 4 lines cause bsd sed -i is incompatible)
# See: https://github.com/koalaman/shellcheck/wiki/SC2129
{
head -n3 "$CONFIO_FILE.orig"
printf 'option go_package = "github.com/confio/ics23/go";\n'
printf 'option java_package = "tech.confio.ics23";\n'
printf 'option java_multiple_files = true;\n'
tail -n+4 "$CONFIO_FILE.orig"
} > "$CONFIO_FILE"
rm "$CONFIO_FILE.orig"
# {
# head -n3 "$ICS23_FILE.orig"
# printf 'option go_package = "github.com/confio/ics23/go";\n'
# printf 'option java_package = "tech.confio.ics23";\n'
# printf 'option java_multiple_files = true;\n'
# tail -n+4 "$ICS23_FILE.orig"
# } > "$ICS23_FILE"
# rm "$ICS23_FILE.orig"
84 changes: 84 additions & 0 deletions third_party/proto/amino/amino.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
syntax = "proto3";

package amino;

import "google/protobuf/descriptor.proto";

// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated.
// We need this right now because gogoproto codegen needs to import the extension.
option go_package = "github.com/cosmos/cosmos-sdk/types/tx/amino";

extend google.protobuf.MessageOptions {
// name is the string used when registering a concrete
// type into the Amino type registry, via the Amino codec's
// `RegisterConcrete()` method. This string MUST be at most 39
// characters long, or else the message will be rejected by the
// Ledger hardware device.
string name = 11110001;

// encoding describes the encoding format used by Amino for the given
// message. The field type is chosen to be a string for
// flexibility, but it should ideally be short and expected to be
// machine-readable, for example "base64" or "utf8_json". We
// highly recommend to use underscores for word separation instead of spaces.
//
// If left empty, then the Amino encoding is expected to be the same as the
// Protobuf one.
//
// This annotation should not be confused with the `encoding`
// one which operates on the field level.
string message_encoding = 11110002;
}

extend google.protobuf.FieldOptions {
// encoding describes the encoding format used by Amino for
// the given field. The field type is chosen to be a string for
// flexibility, but it should ideally be short and expected to be
// machine-readable, for example "base64" or "utf8_json". We
// highly recommend to use underscores for word separation instead of spaces.
//
// If left empty, then the Amino encoding is expected to be the same as the
// Protobuf one.
//
// This annotation should not be confused with the
// `message_encoding` one which operates on the message level.
string encoding = 11110003;

// field_name sets a different field name (i.e. key name) in
// the amino JSON object for the given field.
//
// Example:
//
// message Foo {
// string bar = 1 [(amino.field_name) = "baz"];
// }
//
// Then the Amino encoding of Foo will be:
// `{"baz":"some value"}`
string field_name = 11110004;

// dont_omitempty sets the field in the JSON object even if
// its value is empty, i.e. equal to the Golang zero value. To learn what
// the zero values are, see https://go.dev/ref/spec#The_zero_value.
//
// Fields default to `omitempty`, which is the default behavior when this
// annotation is unset. When set to true, then the field value in the
// JSON object will be set, i.e. not `undefined`.
//
// Example:
//
// message Foo {
// string bar = 1;
// string baz = 2 [(amino.dont_omitempty) = true];
// }
//
// f := Foo{};
// out := AminoJSONEncoder(&f);
// out == {"baz":""}
bool dont_omitempty = 11110005;

// oneof_name sets the type name for the given field oneof field. This is used
// by the Amino JSON encoder to encode the type of the oneof field, and must be the same string in
// the RegisterConcrete() method usage used to register the concrete type.
string oneof_name = 11110006;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
syntax = "proto3";
package cosmos.capability.v1beta1;

option go_package = "github.com/cosmos/cosmos-sdk/x/capability/types";
package capability.v1;

import "gogoproto/gogo.proto";
import "amino/amino.proto";

option go_package = "github.com/cosmos/ibc-go/modules/capability/types";

// Capability defines an implementation of an object capability. The index
// provided to a Capability must be globally unique.
Expand All @@ -26,5 +28,5 @@ message Owner {
// CapabilityOwners defines a set of owners of a single Capability. The set of
// owners must be unique.
message CapabilityOwners {
repeated Owner owners = 1 [(gogoproto.nullable) = false];
repeated Owner owners = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
syntax = "proto3";
package cosmos.capability.v1beta1;

package capability.v1;

import "gogoproto/gogo.proto";
import "cosmos/capability/v1beta1/capability.proto";
import "capability/v1/capability.proto";
import "amino/amino.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/capability/types";
option go_package = "github.com/cosmos/ibc-go/modules/capability/types";

// GenesisOwners defines the capability owners with their corresponding index.
message GenesisOwners {
// index is the index of the capability owner.
uint64 index = 1;

// index_owners are the owners at the given index.
CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false];
CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

// GenesisState defines the capability module's genesis state.
Expand All @@ -22,5 +24,5 @@ message GenesisState {

// owners represents a map from index to owners of the capability index
// index key is string to allow amino marshalling.
repeated GenesisOwners owners = 2 [(gogoproto.nullable) = false];
repeated GenesisOwners owners = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}
13 changes: 0 additions & 13 deletions third_party/proto/cosmos/app/module/v1alpha1/module.proto

This file was deleted.

65 changes: 65 additions & 0 deletions third_party/proto/cosmos/app/runtime/v1alpha1/module.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
syntax = "proto3";

package cosmos.app.runtime.v1alpha1;

import "cosmos/app/v1alpha1/module.proto";

// Module is the config object for the runtime module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/runtime"
use_package: {name: "cosmos.app.v1alpha1"}
};

// app_name is the name of the app.
string app_name = 1;

// begin_blockers specifies the module names of begin blockers
// to call in the order in which they should be called. If this is left empty
// no begin blocker will be registered.
repeated string begin_blockers = 2;

// end_blockers specifies the module names of the end blockers
// to call in the order in which they should be called. If this is left empty
// no end blocker will be registered.
repeated string end_blockers = 3;

// init_genesis specifies the module names of init genesis functions
// to call in the order in which they should be called. If this is left empty
// no init genesis function will be registered.
repeated string init_genesis = 4;

// export_genesis specifies the order in which to export module genesis data.
// If this is left empty, the init_genesis order will be used for export genesis
// if it is specified.
repeated string export_genesis = 5;

// override_store_keys is an optional list of overrides for the module store keys
// to be used in keeper construction.
repeated StoreKeyConfig override_store_keys = 6;

// order_migrations defines the order in which module migrations are performed.
// If this is left empty, it uses the default migration order.
// https://pkg.go.dev/github.com/cosmos/[email protected]/types/module#DefaultMigrationsOrder
repeated string order_migrations = 7;

// precommiters specifies the module names of the precommiters
// to call in the order in which they should be called. If this is left empty
// no precommit function will be registered.
repeated string precommiters = 8;

// prepare_check_staters specifies the module names of the prepare_check_staters
// to call in the order in which they should be called. If this is left empty
// no preparecheckstate function will be registered.
repeated string prepare_check_staters = 9;
}

// StoreKeyConfig may be supplied to override the default module store key, which
// is the module name.
message StoreKeyConfig {
// name of the module to override the store key of
string module_name = 1;

// the kv store key to use instead of the module name.
string kv_store_key = 2;
}
19 changes: 19 additions & 0 deletions third_party/proto/cosmos/app/v1alpha1/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import "google/protobuf/any.proto";
message Config {
// modules are the module configurations for the app.
repeated ModuleConfig modules = 1;

// golang_bindings specifies explicit interface to implementation type bindings which
// depinject uses to resolve interface inputs to provider functions. The scope of this
// field's configuration is global (not module specific).
repeated GolangBinding golang_bindings = 2;
}

// ModuleConfig is a module configuration for an app.
Expand All @@ -33,4 +38,18 @@ message ModuleConfig {
// config is the config object for the module. Module config messages should
// define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension.
google.protobuf.Any config = 2;

// golang_bindings specifies explicit interface to implementation type bindings which
// depinject uses to resolve interface inputs to provider functions. The scope of this
// field's configuration is module specific.
repeated GolangBinding golang_bindings = 3;
}

// GolangBinding is an explicit interface type to implementing type binding for dependency injection.
message GolangBinding {
// interface_type is the interface type which will be bound to a specific implementation type
string interface_type = 1;

// implementation is the implementing type which will be supplied when an input of type interface is requested
string implementation = 2;
}
2 changes: 1 addition & 1 deletion third_party/proto/cosmos/app/v1alpha1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message PackageReference {
//
// When a new version of a module is released and items are added to existing
// .proto files, these definitions should contain comments of the form
// "Since Revision N" where N is an integer revision.
// "Since: Revision N" where N is an integer revision.
//
// When the module runtime starts up, it will check the pinned proto
// image and panic if there are runtime protobuf definitions that are not
Expand Down
31 changes: 31 additions & 0 deletions third_party/proto/cosmos/auth/module/v1/module.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";

package cosmos.auth.module.v1;

import "cosmos/app/v1alpha1/module.proto";

// Module is the config object for the auth module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/x/auth"
};

// bech32_prefix is the bech32 account prefix for the app.
string bech32_prefix = 1;

// module_account_permissions are module account permissions.
repeated ModuleAccountPermission module_account_permissions = 2;

// authority defines the custom module authority. If not set, defaults to the governance module.
string authority = 3;
}

// ModuleAccountPermission represents permissions for a module account.
message ModuleAccountPermission {
// account is the name of the module.
string account = 1;

// permissions are the permissions this module has. Currently recognized
// values are minter, burner and staking.
repeated string permissions = 2;
}
Loading

0 comments on commit bbc1fb6

Please sign in to comment.