Skip to content

Commit

Permalink
Yoda now builds 🥳
Browse files Browse the repository at this point in the history
  • Loading branch information
Satchitananda committed Nov 27, 2023
1 parent 8bdf804 commit 18d796e
Show file tree
Hide file tree
Showing 80 changed files with 1,700 additions and 1,444 deletions.
33 changes: 20 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
BINDIR ?= $(GOPATH)/bin
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
DOCKER := docker
DOCKER_BUF := docker run --rm -v $(cwd):/workspace --workdir /workspace bufbuild/buf

DEB_BIN_DIR ?= /usr/local/bin
DEB_LIB_DIR ?= /usr/lib
Expand Down Expand Up @@ -34,6 +34,9 @@ build: go.sum
go build -mod=readonly -o ./build/odind $(BUILD_FLAGS) ./cmd/odind
go build -mod=readonly -o ./build/yoda $(BUILD_FLAGS) ./cmd/yoda

build-yoda: go.sum
go build -mod=readonly -o ./build/yoda $(BUILD_FLAGS) ./cmd/yoda

faucet: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/faucet

Expand Down Expand Up @@ -63,30 +66,34 @@ test:
### Protobuf ###
###############################################################################

protoVer=0.13.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-all: proto-format proto-lint proto-gen

proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh
@$(protoImage) sh ./scripts/protocgen.sh

proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@$(protoImage) sh ./scripts/protoc-swagger-gen.sh
$(MAKE) update-swagger-docs

proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;

# This generates the SDK's custom wrapper for google.protobuf.Any. It should only be run manually when needed
proto-gen-any:
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen-any.sh

proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh
$(DOCKER) run --rm -v $(pwd):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen-any.sh

proto-lint:
@$(DOCKER_BUF) check lint --error-format=json
@$(protoImage) buf lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=master
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main


TM_URL = https://raw.githubusercontent.com/cometbft/cometbft
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
Expand Down
2 changes: 1 addition & 1 deletion client/grpc/oracle/proof/proof.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 client/grpc/oracle/proof/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/cometbft/cometbft/crypto/tmhash"
"github.com/stretchr/testify/require"

oracletypes "github.com/bandprotocol/chain/v2/x/oracle/types"
oracletypes "github.com/ODIN-PROTOCOL/odin-core/x/oracle/types"
)

func hexToBytes(hexstr string) []byte {
Expand Down
2 changes: 1 addition & 1 deletion client/grpc/oracle/proof/result.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package proof

import (
oracletypes "github.com/bandprotocol/chain/v2/x/oracle/types"
oracletypes "github.com/ODIN-PROTOCOL/odin-core/x/oracle/types"
)

// ResultEthereum is an Ethereum version of Result for solidity ABI-encoding.
Expand Down
7 changes: 3 additions & 4 deletions client/grpc/oracle/proof/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/grpc-ecosystem/grpc-gateway/runtime"

"github.com/bandprotocol/chain/v2/x/oracle/types"
oracletypes "github.com/bandprotocol/chain/v2/x/oracle/types"
types "github.com/ODIN-PROTOCOL/odin-core/x/oracle/types"
)

// RegisterProofService registers the node gRPC service on the provided gRPC router.
Expand Down Expand Up @@ -89,7 +88,7 @@ func (s proofServer) Proof(ctx context.Context, req *QueryProofRequest) (*QueryP
}

// Unmarshal the value into a Result object
var rs oracletypes.Result
var rs types.Result
types.ModuleCdc.MustUnmarshal(value, &rs)

// Create an OracleDataProof object with the relevant information
Expand Down Expand Up @@ -195,7 +194,7 @@ func (s proofServer) MultiProof(ctx context.Context, req *QueryMultiProofRequest
}

// Unmarshal the value into a Result object
var rs oracletypes.Result
var rs types.Result
types.ModuleCdc.MustUnmarshal(value, &rs)

// Create an OracleDataProof object with the relevant information
Expand Down
4 changes: 1 addition & 3 deletions proto/auction/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ import "gogoproto/gogo.proto";
import "auction/params.proto";

// GenesisState defines the oracle module's genesis state.
message GenesisState {
Params params = 1 [ (gogoproto.nullable) = false ];
}
message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; }
4 changes: 2 additions & 2 deletions proto/auction/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "cosmos/base/v1beta1/coin.proto";
import "google/protobuf/any.proto";
import "coinswap/params.proto";


// Params is the data structure that keeps the parameters of the auction module.
message Params {
option (gogoproto.equal) = false;
Expand All @@ -18,5 +17,6 @@ message Params {
(gogoproto.nullable) = false
];
// ExchangeRate is a rate for buying coins throw the auction
repeated coinswap.Exchange exchange_rates = 2 [(gogoproto.nullable) = false];
repeated coinswap.Exchange exchange_rates = 2
[ (gogoproto.nullable) = false ];
}
7 changes: 4 additions & 3 deletions proto/auction/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ service Query {
option (google.api.http).get = "/auction/params";
}

rpc AuctionStatus(QueryAuctionStatusRequest) returns (QueryAuctionStatusResponse) {
rpc AuctionStatus(QueryAuctionStatusRequest)
returns (QueryAuctionStatusResponse) {
option (google.api.http).get = "/auction/status";
}
}
Expand All @@ -24,13 +25,13 @@ message QueryParamsRequest {}

// QueryCountsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
Params params = 1 [ (gogoproto.nullable) = false ];
}

// QueryAuctionStatusRequest is request type for the Query/Status RPC method.
message QueryAuctionStatusRequest {}

// QueryAuctionStatusResponse is response type for the Query/Status RPC method.
message QueryAuctionStatusResponse {
AuctionStatus auction_status = 1 [(gogoproto.nullable) = false];
AuctionStatus auction_status = 1 [ (gogoproto.nullable) = false ];
}
4 changes: 1 addition & 3 deletions proto/auction/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

// Msg defines the auction Msg service.
service Msg {
rpc BuyCoins(MsgBuyCoins) returns (MsgBuyCoinsResponse);
}
service Msg { rpc BuyCoins(MsgBuyCoins) returns (MsgBuyCoinsResponse); }

message MsgBuyCoins {
option (gogoproto.equal) = true;
Expand Down
5 changes: 5 additions & 0 deletions proto/buf.gen.doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: v1
plugins:
- name: doc
out: ../docs/proto
opt: ../docs/proto/protodoc-markdown.tmpl,proto-docs.md
8 changes: 8 additions & 0 deletions proto/buf.gen.gogo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
plugins:
- name: gocosmos
out: ..
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
- name: grpc-gateway
out: ..
opt: logtostderr=true,allow_colon_final_segments=true
23 changes: 23 additions & 0 deletions proto/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: cosmos
repository: cosmos-proto
commit: 1935555c206d4afb9e94615dfd0fad31
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
- remote: buf.build
owner: cosmos
repository: cosmos-sdk
commit: 954f7b05f38440fc8250134b15adec47
digest: shake256:2ab4404fd04a7d1d52df0e2d0f2d477a3d83ffd88d876957bf3fedfd702c8e52833d65b3ce1d89a3c5adf2aab512616b0e4f51d8463f07eda9a8a3317ee3ac54
- remote: buf.build
owner: cosmos
repository: gogo-proto
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 75b4300737fb4efca0831636be94e517
digest: shake256:d865f55b8ceb838c90c28b09894ab43d07f42551108c23760004a6a4e28fe24d3a1f7380a3c9278edb329a338a9cc5db8ad9f394de548e70d534e98504972d67
7 changes: 7 additions & 0 deletions proto/buf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Protobufs

This is the public protocol buffers API for [bandd](https://github.com/bandprotocol/chain).

## Download

The `buf` CLI comes with an export command. Use `buf export -h` for details
21 changes: 21 additions & 0 deletions proto/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: v1
name: buf.build/bandprotocol/chain
deps:
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/cosmos-sdk:v0.47.0
- buf.build/cosmos/gogo-proto
breaking:
use:
- FILE
lint:
use:
- DEFAULT
- COMMENTS
- FILE_LOWER_SNAKE_CASE
except:
- UNARY_RPC
- COMMENT_FIELD
- SERVICE_SUFFIX
- PACKAGE_VERSION_SUFFIX
- RPC_REQUEST_STANDARD_NAME
- PACKAGE_DIRECTORY_MATCH
4 changes: 1 addition & 3 deletions proto/coinswap/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

// Msg defines the coinswap Msg service.
service Msg {
rpc Exchange(MsgExchange) returns (MsgExchangeResponse);
}
service Msg { rpc Exchange(MsgExchange) returns (MsgExchangeResponse); }

message MsgExchange {
option (gogoproto.equal) = true;
Expand Down
3 changes: 2 additions & 1 deletion proto/mint/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ message GenesisState {
// mint_pool defines the pool of eligible accounts and treasury pool
MintPool mint_pool = 3 [ (gogoproto.nullable) = false ];

string module_coins_account = 4 [ (gogoproto.moretags) = "yaml:\"module_coins_account\"" ];
string module_coins_account = 4
[ (gogoproto.moretags) = "yaml:\"module_coins_account\"" ];
}
5 changes: 2 additions & 3 deletions proto/mint/mint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ message AllowedDenom {

// little version of coin
string token_unit_denom = 1
[ (gogoproto.moretags) = "yaml:\"token_unit_denom\"" ];
[ (gogoproto.moretags) = "yaml:\"token_unit_denom\"" ];
// large version of coin
string token_denom = 2
[ (gogoproto.moretags) = "yaml:\"token_denom\"" ];
string token_denom = 2 [ (gogoproto.moretags) = "yaml:\"token_denom\"" ];
}
17 changes: 6 additions & 11 deletions proto/mint/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,10 @@ message QueryAnnualProvisionsResponse {

// QueryIntegrationAddressRequest is request type for the
// Query/QueryEthIntegrationAddress RPC method.
message QueryIntegrationAddressRequest {
string network_name = 1;
}
message QueryIntegrationAddressRequest { string network_name = 1; }
// QueryIntegrationAddressResponse is response type for the
// Query/QueryEthIntegrationAddress RPC method.
message QueryIntegrationAddressResponse {
string integration_address = 1;
}
message QueryIntegrationAddressResponse { string integration_address = 1; }

// QueryTreasuryPoolRequest is request type for the Query/QueryTreasuryPool RPC
// method.
Expand All @@ -97,15 +93,14 @@ message QueryTreasuryPoolResponse {
];
}

// QueryCurrentMintVolumeRequest is request type for the Query/QueryCurrentMintVolume RPC
// method.
// QueryCurrentMintVolumeRequest is request type for the
// Query/QueryCurrentMintVolume RPC method.
message QueryCurrentMintVolumeRequest {}
// QueryCurrentMintVolumeResponse is response type for the Query/QueryCurrentMintVolume
// RPC method.
// QueryCurrentMintVolumeResponse is response type for the
// Query/QueryCurrentMintVolume RPC method.
message QueryCurrentMintVolumeResponse {
repeated cosmos.base.v1beta1.Coin current_mint_volume = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false
];
}

3 changes: 1 addition & 2 deletions proto/mint/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ service Msg {
rpc WithdrawCoinsToAccFromTreasury(MsgWithdrawCoinsToAccFromTreasury)
returns (MsgWithdrawCoinsToAccFromTreasuryResponse);
// MintCoins defines a method for minting from mint module.
rpc MintCoins(MsgMintCoins)
returns (MsgMintCoinsResponse);
rpc MintCoins(MsgMintCoins) returns (MsgMintCoinsResponse);
}

// MsgWithdrawCoinsToAccFromTreasury is a message for withdrawing from mint
Expand Down
3 changes: 2 additions & 1 deletion proto/oracle/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ message GenesisState {
repeated DataSource data_sources = 2 [ (gogoproto.nullable) = false ];
repeated OracleScript oracle_scripts = 3 [ (gogoproto.nullable) = false ];
OraclePool oracle_pool = 4 [ (gogoproto.nullable) = false ];
string module_coins_account = 5 [ (gogoproto.moretags) = "yaml:\"module_coins_account\"" ];
string module_coins_account = 5
[ (gogoproto.moretags) = "yaml:\"module_coins_account\"" ];
}
Loading

0 comments on commit 18d796e

Please sign in to comment.