Skip to content

Commit

Permalink
Merge branch 'master' into js_uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
youkaicountry committed Sep 14, 2021
2 parents 3deed96 + 869076f commit 767bf21
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 95 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/branch-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ jobs:
KOINOS_CI_TOKEN: ${{ secrets.KOINOS_CI_TOKEN }}
steps:
- run: |
git clone https://[email protected]/koinos/koinos-proto-cpp.git
for lang in cpp golang js embedded-cpp
do
repo=koinos-proto-$lang
git clone https://[email protected]/koinos/`echo $repo`.git
pushd koinos-proto-cpp
git push https://[email protected]/koinos/koinos-proto-cpp.git --delete ${{ github.event.ref }}
popd
git clone https://[email protected]/koinos/koinos-proto-golang.git
pushd koinos-proto-golang
git push https://[email protected]/koinos/koinos-proto-golang.git --delete ${{ github.event.ref }}
popd
pushd $repo
git push https://[email protected]/koinos/`echo $repo`.git --delete ${{ github.event.ref }}
popd
done
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
language: c++

cache:
packages:
- python3
ccache: true

jobs:
include:
- os: linux
dist: focal
env:
- PROTOBUF_VERSION="3.14.0"
- PROTOBUF_VERSION="3.17.3"
- GO_VERSION="1.16.6"
- PB_EMBEDDED_CPP_VERSION="2.3.0"

install:
- source ci/install.sh
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Koinos Proto

Koinos Proto contains Koinos Cap'n Proto schema definitions.
Koinos Proto contains Koinos Protocol Buffers schema definitions.

Changes to the schema are automatically propagated to language repos.

Generated languages:

- [C++](https://github.com/koinos/koinos-proto-cpp)
- [Golang](https://github.com/koinos/koinos-proto-golang)
- [JavaScript](https://github.com/koinos/koinos-proto-js)
52 changes: 52 additions & 0 deletions ci/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,56 @@ if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
fi

popd


#js
git clone https://${GITHUB_USER_TOKEN}@github.com/koinos/koinos-proto-js.git

pushd koinos-proto-js

if [ "$TRAVIS_BRANCH" != "master" ]; then
git checkout -b $TRAVIS_BRANCH
fi

mkdir -p koinos

rsync -rvm --include "*.js" --include "*/" --exclude "*" $TRAVIS_BUILD_DIR/build/js/ ./

git add .

if [ "$TRAVIS_BRANCH" == "master" ]; then
npm version patch -git-tag-version false
fi

if ! git diff --cached --quiet --exit-code; then
git commit -m "Update for koinos-proto commit $COMMIT_HASH"
git push --force https://${GITHUB_USER_TOKEN}@github.com/koinos/koinos-proto-js.git $TRAVIS_BRANCH
fi

#TODO: Publish

popd


#embedded-cpp
git clone https://${GITHUB_USER_TOKEN}@github.com/koinos/koinos-proto-embedded-cpp.git

pushd koinos-proto-embedded-cpp

if [ "$TRAVIS_BRANCH" != "master" ]; then
git checkout -b $TRAVIS_BRANCH
fi

mkdir -p libraries/koinos/generated
mkdir -p libraries/koinos/src

rsync -rvm --include "*.h" --include "*/" --exclude "*" $TRAVIS_BUILD_DIR/build/eams/ ./libraries/koinos/generated/
rsync -rvm --include "*.h" --include "*.cpp" --include "*/" --exclude "*" $TRAVIS_BUILD_DIR/EmbeddedProto/src/ ./libraries/koinos/src/

git add .

if ! git diff --cached --quiet --exit-code; then
git commit -m "Update for koinos-proto commit $COMMIT_HASH"
git push --force https://${GITHUB_USER_TOKEN}@github.com/koinos/koinos-proto-embedded-cpp.git $TRAVIS_BRANCH
fi
fi
23 changes: 15 additions & 8 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
set -e
set -x

#source ~/.gimme/envs/go$GO_VERSION.env
#
#GOPATH=`go env GOPATH`
#PATH=$PATH:$GOPATH
mkdir -p build/cpp build/go build/js build/eams

mkdir -p build/cpp build/go
protobuf/bin/protoc --experimental_allow_proto3_optional \
--cpp_out=build/cpp/ \
--go_out=build/go/ \
--js_out=library=koinos_proto,one_output_file_per_input_file,binary:build/js \
`find koinos -name '*.proto'`

for proto in $(find koinos -name '*.proto'); do
protobuf/bin/protoc --experimental_allow_proto3_optional --cpp_out=build/cpp/ --go_out=build/go/ $proto
done
pushd EmbeddedProto

../protobuf/bin/protoc --experimental_allow_proto3_optional \
--plugin=protoc-gen-eams \
--eams_out=../build/eams \
-I.. \
`find ../koinos -name '*.proto'`

popd
13 changes: 13 additions & 0 deletions ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_V
unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -d protobuf

go install google.golang.org/protobuf/cmd/protoc-gen-go@latest

# For some reason, this needs to be installed manually...
sudo apt install python3.8-venv

git clone --recursive https://github.com/Embedded-AMS/EmbeddedProto
pushd EmbeddedProto

git checkout $PB_EMBEDDED_CPP_VERSION
./setup.sh

pwd

popd
8 changes: 4 additions & 4 deletions koinos/block_store/block_store.proto
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
syntax = "proto3";

package koinos.rpc.block_store;
package koinos.block_store;
option go_package = "github.com/koinos/koinos-proto-golang/koinos/rpc/block_store";

import "koinos/protocol/protocol.proto";

message block_item {
bytes block_id = 1;
uint64 block_height = 2 [jstype = JS_STRING];
optional protocol.block block = 3;
optional protocol.block_receipt receipt = 4;
protocol.block block = 3; //optional
protocol.block_receipt receipt = 4; //optional
}

message block_record {
bytes block_id = 1;
uint64 block_height = 2 [jstype = JS_STRING];
protocol.block block = 3;
optional protocol.block_receipt receipt = 4;
protocol.block_receipt receipt = 4; //optional
repeated bytes previous_block_ids = 5;
}
41 changes: 24 additions & 17 deletions koinos/chain/chain.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ enum privilege {

message head_info {
block_topology head_topology = 1;
uint64 last_irreversible_block = 2 [jstype = JS_STRING];
uint64 head_block_time = 2 [jstype = JS_STRING];
uint64 last_irreversible_block = 3 [jstype = JS_STRING];
}

message prints_args {
Expand All @@ -32,14 +33,18 @@ message verify_block_signature_args {
}

message verify_block_signature_return {
bool result = 1;
bool value = 1;
}

message verify_merkle_root_args {
bytes root = 1;
repeated bytes hashes = 2;
}

message verify_merkle_root_return {
bool value = 1;
}

message apply_block_args {
protocol.block block = 1;
bool check_passive_data = 2;
Expand Down Expand Up @@ -71,60 +76,62 @@ message apply_set_system_call_operation_args {
protocol.set_system_call_operation op = 1;
}

message apply_set_system_call_operation_return {}

message put_object_args {
bytes space = 1;
bytes key = 2;
bytes obj = 3;
}

message put_object_return {
bool result = 1;
bool value = 1;
}

message get_object_args {
bytes space = 1;
bytes key = 2;
optional uint32 object_size_hint = 3;
uint32 object_size_hint = 3; // optional
}

message get_object_return {
bytes result = 3;
bytes value = 3;
}

message get_next_object_args {
bytes space = 1;
bytes key = 2;
optional uint32 object_size_hint = 3;
uint32 object_size_hint = 3; // optional
}

message get_next_object_return {
bytes result = 3;
bytes value = 3;
}

message get_prev_object_args {
bytes space = 1;
bytes key = 2;
optional uint32 object_size_hint = 3;
uint32 object_size_hint = 3; // optional
}

message get_prev_object_return {
bytes result = 3;
bytes value = 3;
}

message execute_contract_args {
message call_contract_args {
bytes contract_id = 1;
uint32 entrypoint = 2;
uint32 entry_point = 2;
bytes args = 3;
}

message execute_contract_return {
bytes result = 1;
message call_contract_return {
bytes value = 1;
}

message get_entry_point_args {}

message get_entry_point_return {
uint32 entrypoint = 1;
uint32 value = 1;
}

message get_contract_args_size_args {}
Expand Down Expand Up @@ -203,7 +210,7 @@ message get_transaction_resource_limit_return {
message get_last_irreversible_block_args {}

message get_last_irreversible_block_return {
block_topology value = 1;
uint64 value = 1 [jstype = JS_STRING];
}

message get_caller_args {}
Expand Down Expand Up @@ -235,6 +242,6 @@ message get_account_nonce_args {
bytes account = 1;
}

message get_account_nonce_result {
uint64 nonce = 1 [jstype = JS_STRING];
message get_account_nonce_return {
uint64 value = 1 [jstype = JS_STRING];
}
2 changes: 0 additions & 2 deletions koinos/contracts/pow/pow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ syntax = "proto3";
package koinos.contracts.pow;
option go_package = "github.com/koinos/koinos-proto-golang/koinos/contracts/pow";

import "koinos/common.proto";

message difficulty_metadata {
bytes target = 1;
uint64 last_block_time = 2 [jstype = JS_STRING];
Expand Down
Loading

0 comments on commit 767bf21

Please sign in to comment.