From 09e703281c214f9af40a8f19f4e882c7fd4355c2 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Wed, 1 Sep 2021 14:34:52 -0700 Subject: [PATCH 01/20] Add js generation --- ci/after_success.sh | 29 +++++++++++++++++++++++++++++ ci/build.sh | 15 ++++++--------- koinos/contracts/pow/pow.proto | 2 -- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/ci/after_success.sh b/ci/after_success.sh index fc12434..d28b914 100755 --- a/ci/after_success.sh +++ b/ci/after_success.sh @@ -54,4 +54,33 @@ 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 fi diff --git a/ci/build.sh b/ci/build.sh index 7573840..436562c 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -3,13 +3,10 @@ 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 -mkdir -p build/cpp build/go - -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 +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'` diff --git a/koinos/contracts/pow/pow.proto b/koinos/contracts/pow/pow.proto index 99e5a14..dd46dfa 100644 --- a/koinos/contracts/pow/pow.proto +++ b/koinos/contracts/pow/pow.proto @@ -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; From 7859f59fb12ed1ce72894b00ecc51b71ed7ecea6 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Wed, 1 Sep 2021 15:22:14 -0700 Subject: [PATCH 02/20] Cleanup koinos-proto-js feature branches --- .github/workflows/branch-cleanup.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/branch-cleanup.yml b/.github/workflows/branch-cleanup.yml index 4ae08eb..a76f6de 100644 --- a/.github/workflows/branch-cleanup.yml +++ b/.github/workflows/branch-cleanup.yml @@ -21,3 +21,9 @@ jobs: pushd koinos-proto-golang git push https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-golang.git --delete ${{ github.event.ref }} popd + + git clone https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-js.git + + pushd koinos-proto-js + git push https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-js.git --delete ${{ github.event.ref }} + popd From c62bcf5a1bf30afab5875e22e628826959458e3a Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 2 Sep 2021 13:30:43 -0700 Subject: [PATCH 03/20] Changes for chain --- koinos/block_store/block_store.proto | 2 +- koinos/chain/chain.proto | 2 +- koinos/protocol/protocol.proto | 6 ++++-- koinos/rpc/chain/chain_rpc.proto | 6 +++--- koinos/rpc/mempool/mempool_rpc.proto | 2 +- koinos/rpc/transaction_store/transaction_store_rpc.proto | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/koinos/block_store/block_store.proto b/koinos/block_store/block_store.proto index 0cf0771..3d696c0 100644 --- a/koinos/block_store/block_store.proto +++ b/koinos/block_store/block_store.proto @@ -1,6 +1,6 @@ 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"; diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index 45fd0b6..13037f4 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -235,6 +235,6 @@ message get_account_nonce_args { bytes account = 1; } -message get_account_nonce_result { +message get_account_nonce_return { uint64 nonce = 1; } diff --git a/koinos/protocol/protocol.proto b/koinos/protocol/protocol.proto index ed86c7e..800a765 100644 --- a/koinos/protocol/protocol.proto +++ b/koinos/protocol/protocol.proto @@ -9,8 +9,10 @@ message contract_call_bundle { } message system_call_target { - uint32 thunk_id = 1; - contract_call_bundle system_call_bundle = 2; + oneof target { + uint32 thunk_id = 1; + contract_call_bundle system_call_bundle = 2; + } } message upload_contract_operation { diff --git a/koinos/rpc/chain/chain_rpc.proto b/koinos/rpc/chain/chain_rpc.proto index 7008911..89a9212 100644 --- a/koinos/rpc/chain/chain_rpc.proto +++ b/koinos/rpc/chain/chain_rpc.proto @@ -28,7 +28,7 @@ message get_head_info_request {} message get_head_info_response { block_topology head_topology = 1; - uint64 get_last_irreversible_block = 2; + uint64 last_irreversible_block = 2; } message get_chain_id_request {} @@ -46,7 +46,7 @@ message get_fork_heads_response { message read_contract_request { bytes contract_id = 1; - uint32 entrypoint = 2; + uint32 entry_point = 2; bytes args = 3; } @@ -79,7 +79,7 @@ message chain_rpc_request { message chain_rpc_response { oneof response { rpc.reserved_rpc reserved = 1; - rpc.error_response chain_error = 2; + rpc.error_response error = 2; submit_block_response submit_block = 3; submit_transaction_response submit_transaction = 4; get_head_info_response get_head_info = 5; diff --git a/koinos/rpc/mempool/mempool_rpc.proto b/koinos/rpc/mempool/mempool_rpc.proto index bc34fef..91c3b08 100644 --- a/koinos/rpc/mempool/mempool_rpc.proto +++ b/koinos/rpc/mempool/mempool_rpc.proto @@ -35,7 +35,7 @@ message mempool_rpc_request { message mempool_rpc_response { oneof response { rpc.reserved_rpc reserved = 1; - rpc.error_response mempool_error = 2; + rpc.error_response error = 2; check_pending_account_resources_response check_pending_account_resources = 3; get_pending_transactions_response get_pending_transactions = 4; } diff --git a/koinos/rpc/transaction_store/transaction_store_rpc.proto b/koinos/rpc/transaction_store/transaction_store_rpc.proto index 79faaa8..26efaf1 100644 --- a/koinos/rpc/transaction_store/transaction_store_rpc.proto +++ b/koinos/rpc/transaction_store/transaction_store_rpc.proto @@ -24,7 +24,7 @@ message transaction_store_request { message transaction_store_response { oneof response { rpc.reserved_rpc reserved = 1; - rpc.error_response transaction_store_error = 2; + rpc.error_response error = 2; get_transactions_by_id_response get_transactions_by_id = 3; } } From c8585202363f218c0298622a685d12b44cdc6f9d Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 2 Sep 2021 13:36:04 -0700 Subject: [PATCH 04/20] Fix build --- koinos/rpc/block_store/block_store_rpc.proto | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/koinos/rpc/block_store/block_store_rpc.proto b/koinos/rpc/block_store/block_store_rpc.proto index 8f1787d..37e6c10 100644 --- a/koinos/rpc/block_store/block_store_rpc.proto +++ b/koinos/rpc/block_store/block_store_rpc.proto @@ -5,7 +5,6 @@ option go_package = "github.com/koinos/koinos-proto-golang/koinos/rpc/block_stor import "koinos/block_store/block_store.proto"; import "koinos/common.proto"; -import "koinos/protocol/protocol.proto"; import "koinos/rpc/rpc.proto"; message get_blocks_by_id_request { @@ -15,7 +14,7 @@ message get_blocks_by_id_request { } message get_blocks_by_id_response { - repeated block_item block_items = 1; + repeated .koinos.block_store.block_item block_items = 1; } message get_blocks_by_height_request { @@ -27,11 +26,11 @@ message get_blocks_by_height_request { } message get_blocks_by_height_response { - repeated block_item block_items = 1; + repeated .koinos.block_store.block_item block_items = 1; } message add_block_request { - block_item block_to_add = 1; + .koinos.block_store.block_item block_to_add = 1; } message add_block_response {} From c9dc3891cd306b7f90b084e99dd315748ed49dbb Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 2 Sep 2021 13:45:44 -0700 Subject: [PATCH 05/20] Fix add_block_request again --- koinos/rpc/block_store/block_store_rpc.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koinos/rpc/block_store/block_store_rpc.proto b/koinos/rpc/block_store/block_store_rpc.proto index 37e6c10..492ec24 100644 --- a/koinos/rpc/block_store/block_store_rpc.proto +++ b/koinos/rpc/block_store/block_store_rpc.proto @@ -30,7 +30,7 @@ message get_blocks_by_height_response { } message add_block_request { - .koinos.block_store.block_item block_to_add = 1; + protocol.block block_to_add = 1; } message add_block_response {} From d797ef5374f5800604ef3937069b44a526b3a423 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 2 Sep 2021 13:55:19 -0700 Subject: [PATCH 06/20] Really fix it --- koinos/rpc/block_store/block_store_rpc.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/koinos/rpc/block_store/block_store_rpc.proto b/koinos/rpc/block_store/block_store_rpc.proto index 492ec24..951da12 100644 --- a/koinos/rpc/block_store/block_store_rpc.proto +++ b/koinos/rpc/block_store/block_store_rpc.proto @@ -5,6 +5,7 @@ option go_package = "github.com/koinos/koinos-proto-golang/koinos/rpc/block_stor import "koinos/block_store/block_store.proto"; import "koinos/common.proto"; +import "koinos/protocol/protocol.proto"; import "koinos/rpc/rpc.proto"; message get_blocks_by_id_request { From 3a17d41c9279f0a37d81860f192e35b29c2dd8ff Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 2 Sep 2021 14:00:20 -0700 Subject: [PATCH 07/20] Add head block time to head_info --- koinos/chain/chain.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index 13037f4..2ae303d 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -13,7 +13,8 @@ enum privilege { message head_info { block_topology head_topology = 1; - uint64 last_irreversible_block = 2; + uint64 head_block_time = 2; + uint64 last_irreversible_block = 3; } message prints_args { From a1775e3505ee597126e929916af7b887fd5bd4d8 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 2 Sep 2021 14:19:49 -0700 Subject: [PATCH 08/20] entrypoint -> entry_point --- koinos/chain/chain.proto | 4 ++-- koinos/protocol/protocol.proto | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index 2ae303d..a6e0956 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -114,7 +114,7 @@ message db_get_prev_object_return { message execute_contract_args { bytes contract_id = 1; - uint32 entrypoint = 2; + uint32 entry_point = 2; bytes args = 3; } @@ -125,7 +125,7 @@ message execute_contract_return { message get_entry_point_args {} message get_entry_point_return { - uint32 entrypoint = 1; + uint32 entry_point = 1; } message get_contract_args_size_args {} diff --git a/koinos/protocol/protocol.proto b/koinos/protocol/protocol.proto index 800a765..f5c9879 100644 --- a/koinos/protocol/protocol.proto +++ b/koinos/protocol/protocol.proto @@ -5,7 +5,7 @@ option go_package = "github.com/koinos/koinos-proto-golang/koinos/protocol"; message contract_call_bundle { bytes contract_id = 1; - uint32 entrypoint = 2; + uint32 entry_point = 2; } message system_call_target { @@ -22,7 +22,7 @@ message upload_contract_operation { message call_contract_operation { bytes contract_id = 1; - uint32 entrypoint = 2; + uint32 entry_point = 2; bytes args = 3; } From 1609a032a33580914540fd0922d660ad186cd33e Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 2 Sep 2021 14:48:30 -0700 Subject: [PATCH 09/20] Add verify_merkle_root_return --- koinos/chain/chain.proto | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index a6e0956..ad5b24b 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -41,6 +41,10 @@ message verify_merkle_root_args { repeated bytes hashes = 2; } +message verify_merkle_root_return { + bool result = 1; +} + message apply_block_args { protocol.block block = 1; bool check_passive_data = 2; From f6a58d9e08c1e4a13b58b439ad7ef30350234eb6 Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Thu, 2 Sep 2021 18:11:55 -0400 Subject: [PATCH 10/20] Rename system call ID to call_contract --- koinos/chain/chain.proto | 4 ++-- koinos/protocol/system_call_ids.proto | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index ad5b24b..c9c96fe 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -116,13 +116,13 @@ message db_get_prev_object_return { bytes result = 3; } -message execute_contract_args { +message call_contract_args { bytes contract_id = 1; uint32 entry_point = 2; bytes args = 3; } -message execute_contract_return { +message call_contract_return { bytes result = 1; } diff --git a/koinos/protocol/system_call_ids.proto b/koinos/protocol/system_call_ids.proto index c04c32a..b34ede5 100644 --- a/koinos/protocol/system_call_ids.proto +++ b/koinos/protocol/system_call_ids.proto @@ -10,13 +10,13 @@ enum system_call_id { apply_block = 3; apply_transaction = 4; apply_upload_contract_operation = 5; - apply_execute_contract_operation = 6; + apply_call_contract_operation = 6; apply_set_system_call_operation = 7; db_put_object = 8; db_get_object = 9; db_get_next_object = 10; db_get_prev_object = 11; - execute_contract = 12; + call_contract = 12; get_entry_point = 13; get_contract_args_size = 14; get_contract_args = 15; @@ -35,6 +35,5 @@ enum system_call_id { require_authority = 28; get_transaction_signature = 29; get_contract_id = 30; - get_head_block_time = 31; - get_account_nonce = 32; + get_account_nonce = 31; } From c954109bb60e43c54f4d88945e4a5da877d0692e Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 2 Sep 2021 15:20:19 -0700 Subject: [PATCH 11/20] Add apply_set_system_call_operation_return --- koinos/chain/chain.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index c9c96fe..1772d86 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -76,6 +76,8 @@ message apply_set_system_call_operation_args { protocol.set_system_call_operation op = 1; } +message apply_set_system_call_operation_return {} + message db_put_object_args { bytes space = 1; bytes key = 2; From eeb8fa531ab498aa143c56df591d949d3286e6a8 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Fri, 3 Sep 2021 10:53:42 -0700 Subject: [PATCH 12/20] active and passive data stored as bytes in the schema --- koinos/protocol/protocol.proto | 36 ++++------------------------------ 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/koinos/protocol/protocol.proto b/koinos/protocol/protocol.proto index f5c9879..c46e7c4 100644 --- a/koinos/protocol/protocol.proto +++ b/koinos/protocol/protocol.proto @@ -47,24 +47,10 @@ message active_transaction_data { message passive_transaction_data {} -message transaction_active_data { - oneof data { - active_transaction_data native = 1; - bytes blob = 2; - } -} - -message transaction_passive_data { - oneof data { - passive_transaction_data native = 1; - bytes blob = 2; - } -} - message transaction { bytes id = 1; - transaction_active_data active = 2; - transaction_passive_data passive = 3; + bytes active = 2; + bytes passive = 3; bytes signature_data = 4; } @@ -82,20 +68,6 @@ message block_header { uint64 timestamp = 3; } -message block_active_data { - oneof data { - active_block_data native = 1; - bytes blob = 2; - } -} - -message block_passive_data { - oneof data { - passive_block_data native = 1; - bytes blob = 2; - } -} - // Topological constraints: Constraints for a new block b that builds on a given block a // // b.header.previous_block == a.block_id @@ -111,8 +83,8 @@ message block_passive_data { message block { bytes id = 1; block_header header = 2; - block_active_data active = 3; - block_passive_data passive = 4; + bytes active = 3; + bytes passive = 4; bytes signature_data = 5; repeated transaction transactions = 6; } From 8362761ad7fc348f3ab64a4078a4fc263e23dc8d Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Fri, 3 Sep 2021 11:13:53 -0700 Subject: [PATCH 13/20] result -> value for single field returns --- koinos/chain/chain.proto | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index 1772d86..21ba819 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -33,7 +33,7 @@ message verify_block_signature_args { } message verify_block_signature_return { - bool result = 1; + bool value = 1; } message verify_merkle_root_args { @@ -42,7 +42,7 @@ message verify_merkle_root_args { } message verify_merkle_root_return { - bool result = 1; + bool value = 1; } message apply_block_args { @@ -85,7 +85,7 @@ message db_put_object_args { } message db_put_object_return { - bool result = 1; + bool value = 1; } message db_get_object_args { @@ -95,7 +95,7 @@ message db_get_object_args { } message db_get_object_return { - bytes result = 3; + bytes value = 3; } message db_get_next_object_args { @@ -105,7 +105,7 @@ message db_get_next_object_args { } message db_get_next_object_return { - bytes result = 3; + bytes value = 3; } message db_get_prev_object_args { @@ -115,7 +115,7 @@ message db_get_prev_object_args { } message db_get_prev_object_return { - bytes result = 3; + bytes value = 3; } message call_contract_args { @@ -125,13 +125,13 @@ message call_contract_args { } message call_contract_return { - bytes result = 1; + bytes value = 1; } message get_entry_point_args {} message get_entry_point_return { - uint32 entry_point = 1; + uint32 value = 1; } message get_contract_args_size_args {} @@ -243,5 +243,5 @@ message get_account_nonce_args { } message get_account_nonce_return { - uint64 nonce = 1; + uint64 value = 1; } From ed121ed4fad262101e2aef0f0dc54f4196bd398f Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Tue, 7 Sep 2021 10:56:39 -0700 Subject: [PATCH 14/20] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ba201c3..1220140 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,4 @@ 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) From 774776e42711b5bf6e67142d7ca96919bb7c240b Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Tue, 7 Sep 2021 10:57:11 -0700 Subject: [PATCH 15/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1220140..9705488 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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. From 126de6c728f317d5ed9f63c43cd529c3542d07c2 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Tue, 7 Sep 2021 11:13:19 -0700 Subject: [PATCH 16/20] Revert get_last_irreversible_block_return to return a block height --- koinos/chain/chain.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index 21ba819..928954e 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -210,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; } message get_caller_args {} From 037b20046828e20754ff56c3314966d52202125b Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Tue, 7 Sep 2021 12:23:26 -0700 Subject: [PATCH 17/20] RPC request/response names are now consistent --- koinos/rpc/chain/chain_rpc.proto | 4 ++-- koinos/rpc/mempool/mempool_rpc.proto | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koinos/rpc/chain/chain_rpc.proto b/koinos/rpc/chain/chain_rpc.proto index 89a9212..31188e7 100644 --- a/koinos/rpc/chain/chain_rpc.proto +++ b/koinos/rpc/chain/chain_rpc.proto @@ -63,7 +63,7 @@ message get_account_nonce_response { uint64 nonce = 1; } -message chain_rpc_request { +message chain_request { oneof request { rpc.reserved_rpc reserved = 1; submit_block_request submit_block = 2; @@ -76,7 +76,7 @@ message chain_rpc_request { } } -message chain_rpc_response { +message chain_response { oneof response { rpc.reserved_rpc reserved = 1; rpc.error_response error = 2; diff --git a/koinos/rpc/mempool/mempool_rpc.proto b/koinos/rpc/mempool/mempool_rpc.proto index 91c3b08..7c85a42 100644 --- a/koinos/rpc/mempool/mempool_rpc.proto +++ b/koinos/rpc/mempool/mempool_rpc.proto @@ -24,7 +24,7 @@ message get_pending_transactions_response { repeated protocol.transaction transactions = 1; } -message mempool_rpc_request { +message mempool_request { oneof request { rpc.reserved_rpc reserved = 1; check_pending_account_resources_request check_pending_account_resources = 2; @@ -32,7 +32,7 @@ message mempool_rpc_request { } } -message mempool_rpc_response { +message mempool_response { oneof response { rpc.reserved_rpc reserved = 1; rpc.error_response error = 2; From 4ff52006dba113bf2f67cce72d8245bda3bb1e95 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 9 Sep 2021 13:48:29 -0700 Subject: [PATCH 18/20] Build eams --- .github/workflows/branch-cleanup.yml | 24 ++++++++---------------- .travis.yml | 3 +++ ci/after_success.sh | 23 +++++++++++++++++++++++ ci/build.sh | 20 +++++++++++++++----- ci/install.sh | 13 +++++++++++++ koinos/block_store/block_store.proto | 6 +++--- koinos/chain/chain.proto | 6 +++--- 7 files changed, 68 insertions(+), 27 deletions(-) diff --git a/.github/workflows/branch-cleanup.yml b/.github/workflows/branch-cleanup.yml index a76f6de..bcc1e41 100644 --- a/.github/workflows/branch-cleanup.yml +++ b/.github/workflows/branch-cleanup.yml @@ -10,20 +10,12 @@ jobs: KOINOS_CI_TOKEN: ${{ secrets.KOINOS_CI_TOKEN }} steps: - run: | - git clone https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-cpp.git + for lang in cpp golang js embedded-cpp + do + repo=koinos-proto-$lang + git clone https://$KOINOS_CI_TOKEN@github.com/koinos/`echo $repo`.git - pushd koinos-proto-cpp - git push https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-cpp.git --delete ${{ github.event.ref }} - popd - - git clone https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-golang.git - - pushd koinos-proto-golang - git push https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-golang.git --delete ${{ github.event.ref }} - popd - - git clone https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-js.git - - pushd koinos-proto-js - git push https://$KOINOS_CI_TOKEN@github.com/koinos/koinos-proto-js.git --delete ${{ github.event.ref }} - popd + pushd $repo + git push https://$KOINOS_CI_TOKEN@github.com/koinos/`echo $repo`.git --delete ${{ github.event.ref }} + popd + done diff --git a/.travis.yml b/.travis.yml index e7b822c..66f9537 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: c++ cache: + packages: + - python3 ccache: true jobs: @@ -10,6 +12,7 @@ jobs: env: - PROTOBUF_VERSION="3.14.0" - GO_VERSION="1.16.6" + - PB_EMBEDDED_CPP_VERSION="2.2.1" install: - source ci/install.sh diff --git a/ci/after_success.sh b/ci/after_success.sh index d28b914..75f6791 100755 --- a/ci/after_success.sh +++ b/ci/after_success.sh @@ -83,4 +83,27 @@ if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then #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 diff --git a/ci/build.sh b/ci/build.sh index 436562c..cdda029 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -3,10 +3,20 @@ set -e set -x -mkdir -p build/cpp build/go build/js +mkdir -p build/cpp build/go build/js build/eams 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'` + --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'` + +pushd EmbeddedProto + +../protobuf/bin/protoc --experimental_allow_proto3_optional \ + --plugin=protoc-gen-eams \ + --eams_out=../build/eams \ + -I.. \ + `find ../koinos -name '*.proto'` + +popd diff --git a/ci/install.sh b/ci/install.sh index ea15a17..fac3414 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -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 diff --git a/koinos/block_store/block_store.proto b/koinos/block_store/block_store.proto index 3d696c0..78ef4c3 100644 --- a/koinos/block_store/block_store.proto +++ b/koinos/block_store/block_store.proto @@ -8,14 +8,14 @@ import "koinos/protocol/protocol.proto"; message block_item { bytes block_id = 1; uint64 block_height = 2; - 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; protocol.block block = 3; - optional protocol.block_receipt receipt = 4; + protocol.block_receipt receipt = 4; //optional repeated bytes previous_block_ids = 5; } diff --git a/koinos/chain/chain.proto b/koinos/chain/chain.proto index 928954e..49645e6 100644 --- a/koinos/chain/chain.proto +++ b/koinos/chain/chain.proto @@ -91,7 +91,7 @@ message db_put_object_return { message db_get_object_args { bytes space = 1; bytes key = 2; - optional uint32 object_size_hint = 3; + uint32 object_size_hint = 3; // optional } message db_get_object_return { @@ -101,7 +101,7 @@ message db_get_object_return { message db_get_next_object_args { bytes space = 1; bytes key = 2; - optional uint32 object_size_hint = 3; + uint32 object_size_hint = 3; // optional } message db_get_next_object_return { @@ -111,7 +111,7 @@ message db_get_next_object_return { message db_get_prev_object_args { bytes space = 1; bytes key = 2; - optional uint32 object_size_hint = 3; + uint32 object_size_hint = 3; // optional } message db_get_prev_object_return { From 90ba645469b8ce7864a42f17581ac60e76a7cf5d Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Mon, 13 Sep 2021 20:15:39 -0400 Subject: [PATCH 19/20] Bump Protobuf to 3.17.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e7b822c..f5c490c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ jobs: - os: linux dist: focal env: - - PROTOBUF_VERSION="3.14.0" + - PROTOBUF_VERSION="3.17.3" - GO_VERSION="1.16.6" install: From d699f2a2ef384ecdd8bcbe1f6b1f87bf7ee0013a Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Mon, 13 Sep 2021 20:44:26 -0400 Subject: [PATCH 20/20] Bump embedded proto to 2.3.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 391aade..52b7fb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ jobs: env: - PROTOBUF_VERSION="3.17.3" - GO_VERSION="1.16.6" - - PB_EMBEDDED_CPP_VERSION="2.2.1" + - PB_EMBEDDED_CPP_VERSION="2.3.0" install: - source ci/install.sh