Commit e34f3159 authored by luxq's avatar luxq

initial commit

parents
Pipeline #658 failed with stages
MIT License
Copyright (c) 2022 CaduceusMetaverseProtocol
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Protobuf generated go files
PROTO_GO_FILES = $(shell find . -path -prune -o -type f -name '*.pb.go' -print | grep -v vendor)
#PROTO_GO_FILES = $(patsubst %.proto, %.pb.go, $(PROTO_FILES))
DEST=${PWD}
BIN=protocol
.PHONY: all build generate deps clean lint
all: build generate lint
build: $(PROTO_GO_FILES)
@buf build
lint: generate main.go
@go build -o $(BIN)
generate:
@buf generate
deps:
@go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
@go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
@go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
@go install github.com/bufbuild/buf/cmd/buf@v1.9.0
@go install github.com/gogo/protobuf/proto
@go install github.com/gogo/protobuf/jsonpb
@go install github.com/gogo/protobuf/protoc-gen-gogo
@go install github.com/gogo/protobuf/gogoproto
clean:
@rm -f $(PROTO_GO_FILES) $(BIN)
@rm -rf gen
This diff is collapsed.
# OdysseusProtocol
Define base protocol-buffer.
Please read [Guide](ProtobufStyle.md) first when you modify the *.proto* files.
## Modules
// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
// http://github.com/gogo/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto2";
package gogoproto;
import "google/protobuf/descriptor.proto";
option java_package = "com.google.protobuf";
option java_outer_classname = "GoGoProtos";
option go_package = "github.com/gogo/protobuf/gogoproto";
extend google.protobuf.EnumOptions {
optional bool goproto_enum_prefix = 62001;
optional bool goproto_enum_stringer = 62021;
optional bool enum_stringer = 62022;
optional string enum_customname = 62023;
optional bool enumdecl = 62024;
}
extend google.protobuf.EnumValueOptions {
optional string enumvalue_customname = 66001;
}
extend google.protobuf.FileOptions {
optional bool goproto_getters_all = 63001;
optional bool goproto_enum_prefix_all = 63002;
optional bool goproto_stringer_all = 63003;
optional bool verbose_equal_all = 63004;
optional bool face_all = 63005;
optional bool gostring_all = 63006;
optional bool populate_all = 63007;
optional bool stringer_all = 63008;
optional bool onlyone_all = 63009;
optional bool equal_all = 63013;
optional bool description_all = 63014;
optional bool testgen_all = 63015;
optional bool benchgen_all = 63016;
optional bool marshaler_all = 63017;
optional bool unmarshaler_all = 63018;
optional bool stable_marshaler_all = 63019;
optional bool sizer_all = 63020;
optional bool goproto_enum_stringer_all = 63021;
optional bool enum_stringer_all = 63022;
optional bool unsafe_marshaler_all = 63023;
optional bool unsafe_unmarshaler_all = 63024;
optional bool goproto_extensions_map_all = 63025;
optional bool goproto_unrecognized_all = 63026;
optional bool gogoproto_import = 63027;
optional bool protosizer_all = 63028;
optional bool compare_all = 63029;
optional bool typedecl_all = 63030;
optional bool enumdecl_all = 63031;
optional bool goproto_registration = 63032;
optional bool messagename_all = 63033;
optional bool goproto_sizecache_all = 63034;
optional bool goproto_unkeyed_all = 63035;
}
extend google.protobuf.MessageOptions {
optional bool goproto_getters = 64001;
optional bool goproto_stringer = 64003;
optional bool verbose_equal = 64004;
optional bool face = 64005;
optional bool gostring = 64006;
optional bool populate = 64007;
optional bool stringer = 67008;
optional bool onlyone = 64009;
optional bool equal = 64013;
optional bool description = 64014;
optional bool testgen = 64015;
optional bool benchgen = 64016;
optional bool marshaler = 64017;
optional bool unmarshaler = 64018;
optional bool stable_marshaler = 64019;
optional bool sizer = 64020;
optional bool unsafe_marshaler = 64023;
optional bool unsafe_unmarshaler = 64024;
optional bool goproto_extensions_map = 64025;
optional bool goproto_unrecognized = 64026;
optional bool protosizer = 64028;
optional bool compare = 64029;
optional bool typedecl = 64030;
optional bool messagename = 64033;
optional bool goproto_sizecache = 64034;
optional bool goproto_unkeyed = 64035;
}
extend google.protobuf.FieldOptions {
optional bool nullable = 65001;
optional bool embed = 65002;
optional string customtype = 65003;
optional string customname = 65004;
optional string jsontag = 65005;
optional string moretags = 65006;
optional string casttype = 65007;
optional string castkey = 65008;
optional string castvalue = 65009;
optional bool stdtime = 65010;
optional bool stdduration = 65011;
optional bool wktpointer = 65012;
}
syntax = "proto3";
package base.v1;
import "google/protobuf/timestamp.proto";
import "base/v1/resource.proto";
import "base/gogo.proto";
option (gogoproto.messagename_all) = true;
message MetaTxBase {
// tx_type used to type tx.
uint32 tx_type = 1;
BigInt chain_id = 2[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.BigInt"];
uint64 nonce = 3;
BigInt gas_price = 4[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.BigInt"];
uint64 gas = 5;
Address to = 6[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.Address"];
BigInt value = 7[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.BigInt"];
bytes data = 8;
AccessList access_list = 9;
BigInt v = 10[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.BigInt"];
BigInt r = 11[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.BigInt"];
BigInt s = 12[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.BigInt"];
Address from = 13[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.Address"];
//google.protobuf.Timestamp receive_time = 14; `protobuf:"bytes,1,opt,name=Name,proto3"`
// expire block used to ignore execute tx when it is packaged in expired_block.
BigInt expired_block = 15[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.BigInt"];
Hash tx_hash = 16[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.Hash"];
}
message MetaBigInt {
BigInt value = 1[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.BigInt"];
}
message MetaHash{
Hash hash = 1 [(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.Hash"];
}
message MetaAddress {
Address address = 1[(gogoproto.customtype) = "github.com/CaduceusMetaverseProtocol/MetaTypes/types.Address"];
}
syntax = "proto3";
package base.v1;
import "google/protobuf/descriptor.proto";
extend google.protobuf.FieldOptions {
uint32 bytes_size = 50000; // define bytes data size.
}
\ No newline at end of file
syntax = "proto3";
package base.v1;
import "google/protobuf/timestamp.proto";
import "base/gogo.proto";
message Bytes32 {
bytes data = 1;
}
message BigInt {
bytes data = 1;
}
message Hash {
bytes hash = 1;
}
message Address {
bytes address = 1;
}
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: gogo
repository: protobuf
commit: 5461a3dfa9d941da82028ab185dc2a0e
digest: shake256:37c7c75224982038cb1abf45b481ef06716c1f806ffaa162018d0df092bd11a2a9b62c2d0dc0a2ae43beff86b6014fc0eb8c594ffd84d52ade4b08fca901eadc
version: v1
deps:
- buf.build/gogo/protobuf
breaking:
use:
- FILE
lint:
use:
- DEFAULT
version: v1
managed:
enabled: true
go_package_prefix:
default: github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go
except:
- buf.build/gogo/protobuf
plugins:
- name: gogo
out: gen/proto/go
opt:
- paths=source_relative
- Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types
- Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types
- Mgoogle/protobuf=github.com/gogo/protobuf/types
- name: go-grpc
out: gen/proto/go
opt: paths=source_relative
- name: grpc-gateway
out: gen/proto/go
opt: paths=source_relative
version: v1
directories:
- baseapi
- scheduler
- nodemanager
version: v1
deps:
- buf.build/gogo/protobuf
# - buf.build/googleapis/googleapis
# - buf.build/acme/paymentapis
breaking:
use:
- FILE
lint:
use:
- DEFAULT
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: akm
repository: go-proto-validators
commit: a44ea8db53b94cb4a1915a5818e77c9c
digest: shake256:e21d4efad7ee9da1369251b19d0c115b6d00ffa0d221bbe8233aee81e6bba0515ae43515997ccb4abf9eafbf297159fcf1078fe302454095911502ded5365512
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 463926e7ee924d46ad0a726e1cf4eacd
digest: shake256:7a6bf5a98f98787fc2dabcc93a3eb7b12cdc549a6bbdcb0c6d58b546fcbc707853916200d6f2d36ebd8b84babcca3202ea041d7ac54da7f7407f3edebd34ad19
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
syntax = "proto3";
package nodemanager.v1;
import "base/v1/meta.proto";
// The standard BatchGet request definition.
message BatchCheckTxRequest {
repeated base.v1.MetaTxBase txs = 1;
}
// The standard BatchGet response definition.
message BatchCheckTxResponse {
// The retrieved shelves.
repeated base.v1.MetaProofTx checked_txs = 1;
}
syntax = "proto3";
package nodemanager.v1;
syntax = "proto3";
package nodemanager.v1;
import "nodemanager/v1/request_response.proto";
service NodeManagerService {
rpc BatchCheckTx(BatchCheckTxRequest) returns (BatchCheckTxResponse) {}
}
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: akm
repository: go-proto-validators
commit: a44ea8db53b94cb4a1915a5818e77c9c
digest: shake256:e21d4efad7ee9da1369251b19d0c115b6d00ffa0d221bbe8233aee81e6bba0515ae43515997ccb4abf9eafbf297159fcf1078fe302454095911502ded5365512
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 463926e7ee924d46ad0a726e1cf4eacd
digest: shake256:7a6bf5a98f98787fc2dabcc93a3eb7b12cdc549a6bbdcb0c6d58b546fcbc707853916200d6f2d36ebd8b84babcca3202ea041d7ac54da7f7407f3edebd34ad19
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
syntax = "proto3";
package scheduler.v1;
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "scheduler/v1/resource.proto";
syntax = "proto3";
package scheduler.v1;
import "base/v1/resource.proto";
syntax = "proto3";
package scheduler.v1;
import "google/protobuf/empty.proto";
import "scheduler/v1/request_response.proto";
import "scheduler/v1/web3.proto";
import "base/v1/eth_blocks.proto";
service SchedulerService {
// block info service
rpc BlockNumber(google.protobuf.Empty) returns (HeightResponse) {};
rpc BlockTransactionCountByHash(BlockTransactionCountByHashRequest) returns (BlockTransactionCountByHashResponse) {};
// subscribe service
rpc SubscribeNewTx(google.protobuf.Empty) returns (stream SubscribeNewTxResponse) {}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment