This is an automated email from the ASF dual-hosted git repository.
junchao pushed a commit to branch smart_contract_merge
in repository https://gitbox.apache.org/repos/asf/incubator-resilientdb.git
commit 99d2028581e9d57a65d9499a2f414d5eb52efde9
Merge: 23a3103a 3d2d9348
Author: junchao <junchao@localhost>
AuthorDate: Thu Feb 13 12:28:26 2025 -0700
merge master
.bazelversion | 1 +
.github/workflows/build-push.yml | 19 +
.github/workflows/build.yml | 33 +-
.github/workflows/license.yml | 37 +
.github/workflows/loc.yml | 33 +-
.github/workflows/main.yml | 19 +
.github/workflows/ut.yml | 31 +-
.gitignore | 2 +
.licenserc.yaml | 31 +
BUILD.bazel | 19 +
CHANGELOG.md | 35 +
CODE_OF_CONDUCT.md | 19 +
DISCLAIMER-WIP | 22 +
Docker/Dockerfile | 23 +-
Docker/Dockerfile_mac | 19 +
INSTALL.sh | 24 +-
INSTALL/README.md | 62 +
INSTALL/bazel/install_bazel.sh | 27 +
INSTALL/protobuf/install_protobuf.sh | 20 +
INSTALL_MAC.sh | 21 -
LICENSE | 34 +
NOTICE | 3 +-
README.md | 57 +-
WORKSPACE | 43 +-
api/BUILD | 38 +
api/README.md | 66 ++
api/ip_address.config | 1 +
api/kv_operation.py | 46 +
api/pybind_kv_service.cpp | 66 ++
chain/state/BUILD | 18 +
chain/storage/BUILD | 33 +-
chain/storage/kv_storage_test.cpp | 8 +-
chain/storage/proto/BUILD | 28 +-
chain/storage/proto/kv.proto | 19 +
chain/storage/proto/leveldb_config.proto | 19 +
chain/storage/proto/rocksdb_config.proto | 11 -
chain/storage/rocksdb.cpp | 291 -----
chain/storage/rocksdb.h | 80 --
chain/storage/setting/BUILD | 32 +-
common/BUILD | 25 +
common/crypto/BUILD | 19 +
common/crypto/hash.cpp | 34 +-
common/crypto/hash.h | 34 +-
common/crypto/hash_test.cpp | 34 +-
common/crypto/key_generator.cpp | 34 +-
common/crypto/key_generator.h | 34 +-
common/crypto/mock_signature_verifier.h | 34 +-
common/crypto/signature_utils.cpp | 34 +-
common/crypto/signature_utils.h | 34 +-
common/crypto/signature_verifier.cpp | 34 +-
common/crypto/signature_verifier.h | 34 +-
common/crypto/signature_verifier_interface.cpp | 34 +-
common/crypto/signature_verifier_interface.h | 34 +-
common/crypto/signature_verifier_test.cpp | 34 +-
common/proto/BUILD | 18 +
common/proto/signature_info.proto | 19 +
common/test/BUILD | 19 +
common/test/json_test.cpp | 34 +-
common/test/test.proto | 19 +
common/test/test_macros.h | 34 +-
common/utils/BUILD | 18 +
common/utils/utils.cpp | 34 +-
common/utils/utils.h | 34 +-
dev/.rat-excludes | 19 +
dev/check-license | 86 ++
documents/doxygen/DoxygenLayout.xml | 16 +
documents/doxygen/doxygen_html_style.css | 16 +
documents/file/prometheus.yml | 23 +-
entrypoint.sh | 21 +-
executor/common/BUILD | 18 +
executor/contract/executor/BUILD | 18 +
executor/contract/executor/contract_executor.cpp | 6 +
executor/contract/executor/contract_executor.h | 1 +
executor/contract/executor/test_data/BUILD | 18 +
executor/contract/manager/BUILD | 18 +
executor/contract/manager/address_manager.cpp | 4 +
executor/contract/manager/address_manager.h | 2 +-
executor/contract/manager/test_data/BUILD | 18 +
executor/kv/BUILD | 18 +
executor/utxo/executor/BUILD | 18 +
executor/utxo/manager/BUILD | 18 +
interface/common/BUILD | 19 +
interface/common/resdb_state_accessor.cpp | 21 +-
interface/common/resdb_state_accessor.h | 2 +-
interface/common/resdb_state_accessor_test.cpp | 14 +-
interface/common/resdb_txn_accessor.cpp | 41 +
interface/common/resdb_txn_accessor.h | 1 +
interface/common/resdb_txn_accessor_test.cpp | 7 +-
interface/contract/BUILD | 18 +
interface/contract/contract_client.cpp | 13 +
interface/contract/contract_client.h | 1 +
interface/kv/BUILD | 18 +
interface/rdbc/BUILD | 18 +
interface/utxo/BUILD | 18 +
monitoring/README.md | 19 +
monitoring/prometheus/prometheus.yml | 29 +-
node_modules/@actions/core/README.md | 146 ---
node_modules/@actions/core/lib/command.d.ts | 16 -
node_modules/@actions/core/lib/command.js | 78 --
node_modules/@actions/core/lib/command.js.map | 1 -
node_modules/@actions/core/lib/core.d.ts | 116 --
node_modules/@actions/core/lib/core.js | 209 ----
node_modules/@actions/core/lib/core.js.map | 1 -
node_modules/@actions/core/package.json | 67 --
node_modules/badgen/LICENSE.md | 5 -
node_modules/badgen/README.md | 83 --
node_modules/badgen/dist/calc-text-width.d.ts | 1 -
node_modules/badgen/dist/color-presets.d.ts | 14 -
node_modules/badgen/dist/index.d.ts | 19 -
node_modules/badgen/dist/index.js | 2 -
node_modules/badgen/dist/index.js.map | 1 -
node_modules/badgen/package.json | 65 --
node_modules/badgen/tsconfig.json | 18 -
node_modules/balanced-match/.npmignore | 5 -
node_modules/balanced-match/LICENSE.md | 21 -
node_modules/balanced-match/README.md | 91 --
node_modules/balanced-match/index.js | 59 -
node_modules/balanced-match/package.json | 77 --
node_modules/brace-expansion/LICENSE | 21 -
node_modules/brace-expansion/README.md | 129 ---
node_modules/brace-expansion/index.js | 201 ----
node_modules/brace-expansion/package.json | 75 --
node_modules/concat-map/.travis.yml | 4 -
node_modules/concat-map/LICENSE | 18 -
node_modules/concat-map/README.markdown | 62 -
node_modules/concat-map/example/map.js | 6 -
node_modules/concat-map/index.js | 13 -
node_modules/concat-map/package.json | 88 --
node_modules/concat-map/test/map.js | 39 -
node_modules/fs.realpath/LICENSE | 43 -
node_modules/fs.realpath/README.md | 33 -
node_modules/fs.realpath/index.js | 66 --
node_modules/fs.realpath/old.js | 303 -----
node_modules/fs.realpath/package.json | 59 -
node_modules/glob-gitignore/HISTORY.md | 1 -
node_modules/glob-gitignore/LICENSE | 21 -
node_modules/glob-gitignore/README.md | 121 --
node_modules/glob-gitignore/package.json | 85 --
node_modules/glob-gitignore/src/glob.js | 68 --
node_modules/glob-gitignore/src/index.js | 15 -
node_modules/glob-gitignore/src/sync.js | 50 -
node_modules/glob-gitignore/src/util.js | 137 ---
node_modules/glob/LICENSE | 21 -
node_modules/glob/README.md | 375 -------
node_modules/glob/changelog.md | 67 --
node_modules/glob/common.js | 240 ----
node_modules/glob/glob.js | 790 -------------
node_modules/glob/package.json | 80 --
node_modules/glob/sync.js | 486 --------
node_modules/ignore/CHANGELOG.md | 32 -
node_modules/ignore/LICENSE-MIT | 21 -
node_modules/ignore/README.md | 386 -------
node_modules/ignore/index.d.ts | 63 --
node_modules/ignore/index.js | 568 ----------
node_modules/ignore/legacy.js | 476 --------
node_modules/ignore/package.json | 98 --
node_modules/inflight/LICENSE | 15 -
node_modules/inflight/README.md | 37 -
node_modules/inflight/inflight.js | 54 -
node_modules/inflight/package.json | 58 -
node_modules/inherits/LICENSE | 16 -
node_modules/inherits/README.md | 42 -
node_modules/inherits/inherits.js | 9 -
node_modules/inherits/inherits_browser.js | 27 -
node_modules/inherits/package.json | 61 -
node_modules/lodash.difference/LICENSE | 47 -
node_modules/lodash.difference/README.md | 18 -
node_modules/lodash.difference/index.js | 1170 -------------------
node_modules/lodash.difference/package.json | 69 --
node_modules/lodash.union/LICENSE | 47 -
node_modules/lodash.union/README.md | 18 -
node_modules/lodash.union/index.js | 1181 --------------------
node_modules/lodash.union/package.json | 69 --
node_modules/make-array/README.md | 61 -
node_modules/make-array/index.js | 71 --
node_modules/make-array/package.json | 69 --
node_modules/minimatch/LICENSE | 15 -
node_modules/minimatch/README.md | 209 ----
node_modules/minimatch/minimatch.js | 923 ---------------
node_modules/minimatch/package.json | 63 --
node_modules/once/LICENSE | 15 -
node_modules/once/README.md | 79 --
node_modules/once/once.js | 42 -
node_modules/once/package.json | 67 --
node_modules/path-is-absolute/index.js | 20 -
node_modules/path-is-absolute/license | 21 -
node_modules/path-is-absolute/package.json | 75 --
node_modules/path-is-absolute/readme.md | 59 -
node_modules/util.inherits/HISTORY.md | 1 -
node_modules/util.inherits/README.md | 45 -
node_modules/util.inherits/index.js | 47 -
node_modules/util.inherits/package.json | 81 --
node_modules/wrappy/LICENSE | 15 -
node_modules/wrappy/README.md | 36 -
node_modules/wrappy/package.json | 59 -
node_modules/wrappy/wrappy.js | 33 -
platform/common/data_comm/BUILD | 18 +
platform/common/network/BUILD | 18 +
platform/common/queue/BUILD | 18 +
platform/config/BUILD | 18 +
platform/consensus/checkpoint/BUILD | 18 +
platform/consensus/execution/BUILD | 18 +
.../consensus/execution/transaction_executor.cpp | 17 +
platform/consensus/ordering/common/BUILD | 29 +
.../consensus/ordering/poe/proto/algorithm/BUILD | 29 +
.../ordering/poe/proto/algorithm/protocol_base.cpp | 65 ++
.../ordering/poe/proto/algorithm/protocol_base.h | 87 ++
.../consensus/ordering/poe/proto/framework/BUILD | 66 ++
.../ordering/poe/proto/framework/consensus.cpp | 168 +++
.../ordering/poe/proto/framework/consensus.h | 78 ++
.../poe/proto/framework/performance_manager.cpp | 276 +++++
.../poe/proto/framework/performance_manager.h | 97 ++
.../poe/proto/framework/response_manager.cpp | 236 ++++
.../poe/proto/framework/response_manager.h | 79 ++
.../poe/proto/framework/transaction_utils.cpp | 46 +-
.../poe/proto/framework/transaction_utils.h | 34 +-
platform/consensus/recovery/BUILD | 18 +
platform/consensus/recovery/recovery.cpp | 5 +-
platform/networkstrate/BUILD | 18 +
platform/networkstrate/README.md | 19 +
platform/networkstrate/async_acceptor.cpp | 4 +
platform/networkstrate/consensus_manager.cpp | 141 ++-
platform/networkstrate/consensus_manager.h | 4 +
platform/networkstrate/replica_communicator.cpp | 2 +-
platform/proto/BUILD | 20 +-
platform/proto/broadcast.proto | 19 +
platform/proto/checkpoint_info.proto | 19 +
platform/proto/client_test.proto | 19 +
platform/proto/logging.proto | 19 +
platform/proto/network_type.proto | 19 +
platform/proto/replica_info.proto | 23 +-
platform/proto/resdb.proto | 28 +
platform/proto/system_info_data.proto | 19 +
platform/proto/viewchange_message.proto | 19 +
platform/rdbc/BUILD | 18 +
platform/statistic/BUILD | 25 +
platform/statistic/README.md | 19 +
platform/statistic/stats.cpp | 228 +++-
platform/statistic/stats.h | 57 +
platform/statistic/test_server.sh | 8 -
platform/test/BUILD | 19 +
platform/test/proto/BUILD | 19 +
platform/test/proto/resdb_test.proto | 19 +
platform/test/test_data/BUILD | 19 +
proto/contract/BUILD | 19 +
proto/contract/account.proto | 19 +
proto/contract/contract.proto | 19 +
proto/contract/func_params.proto | 19 +
proto/contract/rpc.proto | 27 +
proto/kv/BUILD | 18 +
proto/kv/kv.proto | 19 +
proto/utxo/BUILD | 19 +
proto/utxo/config.proto | 19 +
proto/utxo/rpc.proto | 19 +
proto/utxo/utxo.proto | 19 +
script.js | 123 ++
scripts/format.sh | 20 +
service/contract/BUILD | 18 +
service/kv/BUILD | 21 +-
service/kv/kv_service.cpp | 9 +-
service/tools/config/generate_config.sh | 92 ++
service/tools/config/server/server.config | 10 +-
service/tools/contract/README.md | 19 +
service/tools/contract/api_tools/BUILD | 19 +
.../tools/contract/api_tools/contract_tools.cpp | 44 +-
.../contract/api_tools/example_contract/compile.sh | 18 +
.../service_tools/start_contract_service.sh | 21 +
service/tools/kv/api_tools/BUILD | 19 +
service/tools/kv/api_tools/kv_client_txn_tools.cpp | 2 -
service/tools/kv/server_tools/generate_config.sh | 34 +
service/tools/kv/server_tools/start_kv_service.sh | 18 +
.../kv/server_tools/start_kv_service_monitoring.sh | 18 +
service/tools/utxo/README.md | 18 +
.../tools/utxo/service_tools/start_utxo_service.sh | 18 +
service/tools/utxo/wallet_tool/cpp/BUILD | 19 +
service/tools/utxo/wallet_tool/cpp/addr_utils.cpp | 33 +-
service/tools/utxo/wallet_tool/cpp/addr_utils.h | 33 +-
service/tools/utxo/wallet_tool/cpp/key_utils.cpp | 33 +-
service/tools/utxo/wallet_tool/cpp/key_utils.h | 33 +-
service/tools/utxo/wallet_tool/py/BUILD | 19 +
service/tools/utxo/wallet_tool/pybind/BUILD | 19 +
.../utxo/wallet_tool/pybind/wallet_tools_py.cpp | 33 +-
service/tools/utxo/wallet_tool/test/BUILD | 19 +
service/utils/BUILD | 19 +
service/utxo/BUILD | 19 +
service/utxo/start_contract_server.sh | 18 +
third_party/BUILD | 40 +-
third_party/asio.BUILD | 23 +-
third_party/civetweb.BUILD | 22 +
third_party/crow.BUILD | 23 +-
third_party/date.BUILD | 25 +-
third_party/eEVM.BUILD | 25 +-
third_party/json.BUILD | 23 +-
third_party/leveldb.BUILD | 25 +-
action.yml => third_party/loc_script/action.yml | 19 +
{src => third_party/loc_script/src}/index.js | 3 +-
third_party/prometheus.BUILD | 22 +
third_party/rapidjson.BUILD | 22 +
third_party/rocksdb.BUILD | 98 --
third_party/snappy.BUILD | 25 +-
third_party/z.BUILD | 26 +-
third_party/zlib.BUILD | 25 +-
third_party/zstd.BUILD | 5 -
tools/BUILD | 19 +
tools/generate_certificate.sh | 18 +
tools/generate_client.sh | 18 +
tools/generate_cluster.sh | 19 +-
tools/generate_key.sh | 18 +
tools/resdb_state_accessor_tools.cpp | 6 +-
309 files changed, 5303 insertions(+), 12743 deletions(-)
diff --cc executor/contract/executor/contract_executor.h
index 489f822f,a5002598..1800d8e1
--- a/executor/contract/executor/contract_executor.h
+++ b/executor/contract/executor/contract_executor.h
@@@ -40,10 -40,8 +40,11 @@@ class ContractTransactionManager : publ
absl::StatusOr<Account> CreateAccount();
absl::StatusOr<Contract> Deploy(const Request& request);
absl::StatusOr<std::string> Execute(const Request& request);
+ absl::Status AddAddress(const Request& request);
+ absl::StatusOr<std::string> GetBalance(const Request& request);
+ absl::StatusOr<std::string> SetBalance(const Request& request);
+
private:
std::unique_ptr<ContractManager> contract_manager_;
std::unique_ptr<AddressManager> address_manager_;
diff --cc platform/consensus/execution/transaction_executor.cpp
index 1f98babd,fd24da3a..48b0bd48
--- a/platform/consensus/execution/transaction_executor.cpp
+++ b/platform/consensus/execution/transaction_executor.cpp
@@@ -251,7 -184,10 +251,13 @@@ void TransactionExecutor::OnlyExecute(s
// LOG(INFO) << " get request batch size:"
// << batch_request.user_requests_size()<<" proxy
// id:"<<request->proxy_id();
++<<<<<<< HEAD
++=======
+ // std::unique_ptr<BatchUserResponse> batch_response =
+ // std::make_unique<BatchUserResponse>();
++>>>>>>> master
std::unique_ptr<BatchUserResponse> response;
+ global_stats_->GetTransactionDetails(batch_request);
if (transaction_manager_) {
response = transaction_manager_->ExecuteBatch(batch_request);
}
@@@ -262,142 -198,47 +268,153 @@@
void TransactionExecutor::Execute(std::unique_ptr<Request> request,
bool need_execute) {
- // Execute the request, then send the response back to the user.
- BatchUserRequest batch_request;
- if (!batch_request.ParseFromString(request->data())) {
- LOG(ERROR) << "parse data fail";
+ uint64_t uid = request->uid();
+ int64_t seq = request->seq();
+ RegisterExecute(request->seq());
+ std::unique_ptr<BatchUserRequest> batch_request = nullptr;
+ std::unique_ptr<std::vector<std::unique_ptr<google::protobuf::Message>>>
data;
+ std::vector<std::unique_ptr<google::protobuf::Message>> * data_p = nullptr;
+ BatchUserRequest* batch_request_p = nullptr;
+
+ bool need_gc = false;
+
+ if (request->uid() > 0) {
+ bool current_f = SetFlag(uid, Start_Execute);
+ if (!current_f) {
+ global_stats_->ConsumeTransactions(1);
+ std::unique_ptr<std::future<int>> data_f = GetFuture(uid);
+ //LOG(ERROR)<<"wait prepare:"<<uid;
+ {
+ data_f->get();
+ }
+ //LOG(ERROR)<<"wait prepare done:"<<uid;
+
+ // prepare is done
+ //LOG(ERROR)<<"prepare is done:"<<uid;
+ {
+ int64_t start_time = GetCurrentTime();
+ std::unique_lock<std::mutex> lk(fd_mutex_[uid % mod]);
+ if(req_[uid % mod][uid] == nullptr){
+ LOG(ERROR)<<"data is empty:"<<uid;
+ }
+ assert(req_[uid % mod][uid] != nullptr);
+ //batch_request = std::move(req_[uid % mod][uid]);
+ batch_request_p = req_[uid % mod][uid].get();
+ auto it = data_[uid % mod].find(uid);
+ if (it != data_[uid % mod].end()) {
+ assert(it->second!=nullptr);
+ data_p = it->second.get();
+ //data = std::move(it->second);
+ }
+ int64_t end_time = GetCurrentTime();
+ if (end_time - start_time > 1000) {
+ LOG(ERROR) << "get data done:" << uid
+ << " wait time:" << (end_time - start_time);
+ }
+ }
+ ClearPromise(uid);
+ need_gc = true;
+ } else {
+ global_stats_->AddNewTransactions(1);
+ //LOG(ERROR)<<"commit start:"<<uid;
+ // LOG(ERROR)<<" prepare not start:"<<uid;
+ }
}
- batch_request.set_seq(request->seq());
- batch_request.set_hash(request->hash());
- batch_request.set_proxy_id(request->proxy_id());
- if (request->has_committed_certs()) {
- *batch_request.mutable_committed_certs() = request->committed_certs();
+
+ // Execute the request, then send the response back to the user.
+ if (batch_request_p == nullptr) {
+ batch_request = std::make_unique<BatchUserRequest>();
+ if (!batch_request->ParseFromString(request->data())) {
+ LOG(ERROR) << "parse data fail";
+ }
+ batch_request->set_hash(request->hash());
+ if (request->has_committed_certs()) {
+ *batch_request->mutable_committed_certs() = request->committed_certs();
+ }
+ batch_request->set_seq(request->seq());
+ batch_request->set_proxy_id(request->proxy_id());
+ batch_request_p = batch_request.get();
+ // LOG(ERROR)<<"get data from req:";
+ } else {
+ assert(batch_request_p);
+ batch_request_p->set_seq(request->seq());
+ batch_request_p->set_proxy_id(request->proxy_id());
+ // LOG(ERROR)<<" get from cache:"<<uid;
}
+ assert(batch_request_p);
// LOG(INFO) << " get request batch size:"
- // << batch_request.user_requests_size()<<" proxy
- // id:"<<request->proxy_id()<<" need execute:"<<need_execute;
- // std::unique_ptr<BatchUserResponse> batch_response =
- // std::make_unique<BatchUserResponse>();
+ // << batch_request.user_requests_size()<<" proxy id:"
+ // <<request->proxy_id()<<" need execute:"<<need_execute;
std::unique_ptr<BatchUserResponse> response;
++<<<<<<< HEAD
+ // need_execute = false;
++=======
+ global_stats_->GetTransactionDetails(batch_request);
++>>>>>>> master
if (transaction_manager_ && need_execute) {
- response = transaction_manager_->ExecuteBatch(batch_request);
- }
+ if (execute_thread_num_ == 1) {
+ response = transaction_manager_->ExecuteBatch(*batch_request_p);
+ } else {
+ std::vector<std::unique_ptr<std::string>> response_v;
+
+ if(data_p == nullptr) {
+ int64_t start_time = GetCurrentTime();
+ data = std::move(transaction_manager_->Prepare(*batch_request_p));
+ int64_t end_time = GetCurrentTime();
+ if (end_time - start_time > 10) {
+ // LOG(ERROR)<<"exec data done:"<<uid<<" wait
+ // time:"<<(end_time-start_time);
+ }
+ data_p = data.get();
+ }
- if (duplicate_manager_) {
- duplicate_manager_->AddExecuted(batch_request.hash(),
batch_request.seq());
+ WaitForExecute(request->seq());
+ if(data_p->empty() || (*data_p)[0] == nullptr){
+ response =
transaction_manager_->ExecuteBatch(*batch_request_p);
+ }
+ else {
+ response_v =
transaction_manager_->ExecuteBatchData(*data_p);
+ }
+ FinishExecute(request->seq());
+
+ if(response == nullptr){
+ response = std::make_unique<BatchUserResponse>();
+ for (auto& s : response_v) {
+ response->add_response()->swap(*s);
+ }
+ }
+ }
}
+ // LOG(ERROR)<<" CF = :"<<(cf==1)<<" uid:"<<uid;
- global_stats_->IncTotalRequest(batch_request.user_requests_size());
if (response == nullptr) {
response = std::make_unique<BatchUserResponse>();
}
-
+ global_stats_->IncTotalRequest(batch_request_p->user_requests_size());
+ response->set_proxy_id(batch_request_p->proxy_id());
+ response->set_createtime(batch_request_p->createtime() +
request->queuing_time());
+ response->set_local_id(batch_request_p->local_id());
+ global_stats_->AddCommitDelay(GetCurrentTime()- response->createtime());
+
++<<<<<<< HEAD
+ response->set_seq(request->seq());
++=======
+ response->set_proxy_id(batch_request.proxy_id());
+ response->set_createtime(batch_request.createtime());
+ response->set_local_id(batch_request.local_id());
+ response->set_hash(batch_request.hash());
++>>>>>>> master
- post_exec_func_(std::move(request), std::move(response));
+ if (post_exec_func_) {
+ post_exec_func_(std::move(request), std::move(response));
+ }
global_stats_->IncExecuteDone();
+ if(need_gc){
+ gc_queue_.Push(std::make_unique<int64_t>(uid));
+ }
}
void TransactionExecutor::SetDuplicateManager(DuplicateManager* manager) {
diff --cc platform/consensus/ordering/poe/proto/algorithm/BUILD
index 00000000,0d7c5d19..0d7c5d19
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/algorithm/BUILD
+++ b/platform/consensus/ordering/poe/proto/algorithm/BUILD
diff --cc platform/consensus/ordering/poe/proto/algorithm/protocol_base.cpp
index 00000000,cababed4..cababed4
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/algorithm/protocol_base.cpp
+++ b/platform/consensus/ordering/poe/proto/algorithm/protocol_base.cpp
diff --cc platform/consensus/ordering/poe/proto/algorithm/protocol_base.h
index 00000000,f8e47052..f8e47052
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/algorithm/protocol_base.h
+++ b/platform/consensus/ordering/poe/proto/algorithm/protocol_base.h
diff --cc platform/consensus/ordering/poe/proto/framework/BUILD
index 00000000,c56c9260..c56c9260
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/framework/BUILD
+++ b/platform/consensus/ordering/poe/proto/framework/BUILD
diff --cc platform/consensus/ordering/poe/proto/framework/consensus.cpp
index 00000000,93e00cc8..93e00cc8
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/framework/consensus.cpp
+++ b/platform/consensus/ordering/poe/proto/framework/consensus.cpp
diff --cc platform/consensus/ordering/poe/proto/framework/consensus.h
index 00000000,2f2884b8..2f2884b8
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/framework/consensus.h
+++ b/platform/consensus/ordering/poe/proto/framework/consensus.h
diff --cc
platform/consensus/ordering/poe/proto/framework/performance_manager.cpp
index 00000000,c07088f1..c07088f1
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/framework/performance_manager.cpp
+++ b/platform/consensus/ordering/poe/proto/framework/performance_manager.cpp
diff --cc platform/consensus/ordering/poe/proto/framework/performance_manager.h
index 00000000,a34f0573..a34f0573
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/framework/performance_manager.h
+++ b/platform/consensus/ordering/poe/proto/framework/performance_manager.h
diff --cc platform/consensus/ordering/poe/proto/framework/response_manager.cpp
index 00000000,18eb065a..18eb065a
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/framework/response_manager.cpp
+++ b/platform/consensus/ordering/poe/proto/framework/response_manager.cpp
diff --cc platform/consensus/ordering/poe/proto/framework/response_manager.h
index 00000000,fef43dd8..fef43dd8
mode 000000,100644..100644
--- a/platform/consensus/ordering/poe/proto/framework/response_manager.h
+++ b/platform/consensus/ordering/poe/proto/framework/response_manager.h
diff --cc platform/networkstrate/async_acceptor.cpp
index 387e98e5,b61a510b..113a3d86
--- a/platform/networkstrate/async_acceptor.cpp
+++ b/platform/networkstrate/async_acceptor.cpp
@@@ -77,8 -77,7 +77,12 @@@ void AsyncAcceptor::Session::ReadDone(
delete recv_buffer_;
} else {
data_size_ = *reinterpret_cast<size_t*>(recv_buffer_);
++<<<<<<< HEAD
+ /*
+ if (data_size_ > 1e6) {
++=======
+ if (data_size_ > 1e10) {
++>>>>>>> master
LOG(ERROR) << "read data size:" << data_size_
<< " data size:" << sizeof(data_size_) << " close socket";
Close();
diff --cc platform/proto/resdb.proto
index 41e2b84a,ac60498a..bd427b48
--- a/platform/proto/resdb.proto
+++ b/platform/proto/resdb.proto
@@@ -69,7 -88,6 +88,10 @@@ message Request
int64 uid = 23;
int64 create_time = 24;
int64 commit_time = 25;
++<<<<<<< HEAD
+ bytes data_hash = 26;
++=======
++>>>>>>> master
}
// The response message containing response
diff --cc platform/statistic/stats.h
index a07cbc20,0ca8dd1e..8cee9f0f
--- a/platform/statistic/stats.h
+++ b/platform/statistic/stats.h
@@@ -32,25 -68,18 +68,36 @@@ class Stats
void Stop();
+ void RetrieveProgress();
+ void SetProps(int replica_id, std::string ip, int port, bool resview_flag,
+ bool faulty_flag);
+ void SetPrimaryId(int primary_id);
+ void RecordStateTime(std::string state);
+ void GetTransactionDetails(BatchUserRequest batch_request);
+ void SendSummary();
+ void CrowRoute();
+ bool IsFaulty();
+ void ChangePrimary(int primary_id);
+
void AddLatency(uint64_t run_time);
+ void AddQueuingLatency(uint64_t run_time);
+ void AddRoundLatency(uint64_t run_time);
+ void AddCommitLatency(uint64_t run_time);
+ void AddCommitQueuingLatency(uint64_t run_time);
+ void AddVerifyLatency(uint64_t run_time);
+ void AddExecuteQueuingLatency(uint64_t run_time);
+ void AddExecuteLatency(uint64_t run_time);
+ void AddCommitRuntime(uint64_t run_time);
+ void AddCommitRoundLatency(uint64_t run_time);
+ void AddCommitWaitingLatency(uint64_t run_time);
+ void AddCommitDelay(uint64_t run_time);
+ void AddExecutePrepareDelay(uint64_t run_time);
+ void AddCommitInterval(uint64_t run_time);
+ void AddCommitTxn(int num);
+ void AddCommitBlock(int num);
+ void AddBlockSize(int size);
+ void AddCommitRatio(uint64_t num);
+ void AddExecuteDelay(uint64_t run_time);
void Monitor();
void MonitorGlobal();
@@@ -111,26 -137,19 +158,36 @@@
std::atomic<uint64_t> run_req_run_time_;
std::atomic<uint64_t> seq_gap_;
std::atomic<uint64_t> total_request_, total_geo_request_, geo_request_;
+ std::atomic<uint64_t> num_transactions_, num_transactions_time_,
num_consumed_transactions_, num_consumed_transactions_time_;
+ std::atomic<uint64_t> queuing_num_, queuing_time_, round_num_, round_time_,
commit_num_, commit_time_;
+ std::atomic<uint64_t> execute_queuing_num_, execute_queuing_time_,
verify_num_, verify_time_;
+ std::atomic<uint64_t> execute_num_, execute_time_;
+ std::atomic<uint64_t> commit_running_num_, commit_running_time_;
+ std::atomic<uint64_t> commit_queuing_num_, commit_queuing_time_;
+ std::atomic<uint64_t> commit_round_num_, commit_round_time_;
+ std::atomic<uint64_t> commit_txn_num_, commit_txn_time_;
+ std::atomic<uint64_t> commit_block_num_, commit_block_time_;
+ std::atomic<uint64_t> commit_delay_num_, commit_delay_time_;
+ std::atomic<uint64_t> commit_waiting_num_, commit_waiting_time_;
+ std::atomic<uint64_t> execute_prepare_num_, execute_prepare_time_;
+ std::atomic<uint64_t> commit_interval_num_, commit_interval_time_;
+ std::atomic<uint64_t> block_size_num_, block_size_;
+ std::atomic<uint64_t> commit_ratio_num_, commit_ratio_time_;
+ std::atomic<uint64_t> execute_delay_num_, execute_delay_time_;
int monitor_sleep_time_ = 5; // default 5s.
+ std::thread crow_thread_;
+ bool enable_resview;
+ bool enable_faulty_switch_;
+ VisualData transaction_summary_;
+ std::atomic<bool> make_faulty_;
+ std::atomic<uint64_t> prev_num_prepare_;
+ std::atomic<uint64_t> prev_num_commit_;
+ nlohmann::json summary_json_;
+ nlohmann::json consensus_history_;
+
std::unique_ptr<PrometheusHandler> prometheus_;
+
};
} // namespace resdb
diff --cc proto/contract/rpc.proto
index ecbc332f,8df1dd40..4c89e259
--- a/proto/contract/rpc.proto
+++ b/proto/contract/rpc.proto
@@@ -12,8 -31,7 +31,12 @@@ message Request
CREATE_ACCOUNT = 1; // deploy contract
DEPLOY = 2; // deploy contract
EXECUTE = 3; // execute contract
++<<<<<<< HEAD
+ GETBALANCE = 4; // get balance directly (key-value)
+ SETBALANCE = 5; // set balance directly (key-value)
++=======
+ ADD_ADDRESS = 4; // add address
++>>>>>>> master
};
CMD cmd = 1;
@@@ -23,11 -39,7 +46,15 @@@
optional DeployInfo deploy_info = 3;
optional string contract_address = 4;
optional Params func_params = 5;
++<<<<<<< HEAD
+
+ // for key-value
+ optional string account = 6;
+ // hex string
+ optional string balance = 7;
++=======
+ optional string external_address = 6;
++>>>>>>> master
}
diff --cc service/tools/contract/api_tools/contract_tools.cpp
index 72e7a73e,0271b312..a6393cff
--- a/service/tools/contract/api_tools/contract_tools.cpp
+++ b/service/tools/contract/api_tools/contract_tools.cpp
@@@ -19,11 -19,9 +19,15 @@@
#include <glog/logging.h>
+#include <getopt.h>
+#include <nlohmann/json.hpp>
#include <boost/algorithm/string.hpp>
#include <vector>
++<<<<<<< HEAD
+#include <fstream>
++=======
+ #include <unistd.h> // For getopt
++>>>>>>> master
#include "interface/contract/contract_client.h"
#include "platform/config/resdb_config_utils.h"
@@@ -32,21 -30,21 +36,32 @@@ using resdb::GenerateResDBConfig
using resdb::ResDBConfig;
using resdb::contract::ContractClient;
+
+
void ShowUsage() {
printf(
- "<cmd> -c <config> -m <caller address> -n <contract name> -p <contact "
- "path> -a <params> \n");
+ "<cmd> -c <config> -m <caller address> -n <contract name> -p <contract "
+ "path> -a <params> -e <external address>\n");
exit(0);
}
++<<<<<<< HEAD
+static struct option long_options[] = {
+ { "cmd", required_argument, NULL, 'm'},
+ { "config_file", required_argument, NULL, 'f'},
+ { 0, 0, 0, 0 }
+};
+
++=======
+ void AddAddress(ContractClient* client, const std::string& external_address) {
+ absl::Status status = client->AddExternalAddress(external_address);
+ if (!status.ok()) {
+ printf("Add address failed\n");
+ } else {
+ printf("Address added successfully\n");
+ }
+ }
++>>>>>>> master
void CreateAccount(ContractClient* client) {
auto account = client->CreateAccount();
@@@ -83,50 -81,43 +98,62 @@@ void ExecuteContract(ContractClient* cl
LOG(ERROR) << "execute result:\n" << *output;
}
+nlohmann::json ReadJSConfig(const std::string& config_path) {
+
+ std::ifstream contract_fstream(config_path);
+ if (!contract_fstream) {
+ throw std::runtime_error( "Unable to open config file "+config_path);
+ }
+
+ return nlohmann::json::parse(contract_fstream);
+}
+
+std::string GetValue(const nlohmann::json& js, std::string key){
+if(!js.contains(key)){
+ printf("need %s\n", key.c_str());
+ exit(0);
+ }
+ return js[key];
+}
+
+
int main(int argc, char** argv) {
++<<<<<<< HEAD
+ if (argc < 2) {
+ printf("<cmd> -c [config]\n");
++=======
+ if (argc < 3) {
+ ShowUsage();
++>>>>>>> master
return 0;
}
- std::string cmd = argv[1];
+
+ std::string config_file;
+
+ std::string cmd;
std::string caller_address, contract_name, contract_path, params,
- contract_address, func_name;
+ contract_address, func_name, external_address; // Added
external_address
int c;
+ int option_index;
std::string client_config_file;
++<<<<<<< HEAD
+ while ((c = getopt_long(argc, argv, "c:h", long_options, &option_index)) !=
-1) {
++=======
+ while ((c = getopt(argc, argv, "m:c:a:n:p:h:f:s:e:")) != -1) { // Added
'e:'
++>>>>>>> master
switch (c) {
- case 'm':
- caller_address = optarg;
- break;
- case 'c':
- client_config_file = optarg;
- break;
- case 'n':
- contract_name = optarg;
+ case -1:
break;
case 'f':
- func_name = optarg;
- break;
- case 'p':
- contract_path = optarg;
- break;
- case 'a':
- params = optarg;
+ config_file = optarg;
break;
- case 's':
- contract_address = optarg;
+ case 'c':
+ client_config_file = optarg;
break;
+ case 'e':
+ external_address = optarg; // Handle the 'e' option
+ break;
case 'h':
ShowUsage();
break;
@@@ -142,17 -134,11 +172,19 @@@
ContractClient client(config);
- if (cmd == "create") {
+ if (cmd == "create_account") {
CreateAccount(&client);
+ } else if (cmd == "add_address") {
+ AddAddress(&client, external_address);
} else if (cmd == "deploy") {
+
+ contract_path = GetValue(js, "contract_path");
+ contract_name = GetValue(js, "contract_name");
+ contract_address = GetValue(js, "contract_address");
+ params = GetValue(js, "init_params");
+
+ printf("contract path %s cmd %s contract name %s caller_address %s init
params %s\n", contract_path.c_str(), cmd.c_str(), contract_name.c_str(),
contract_address.c_str(), params.c_str());
+
std::vector<std::string> init_params;
boost::split(init_params, params, boost::is_any_of(","));
@@@ -175,6 -155,7 +207,12 @@@
ExecuteContract(&client, caller_address, contract_address, func_name,
func_params);
+ } else {
+ ShowUsage();
}
-}
++<<<<<<< HEAD
+}
+
++=======
++}
++>>>>>>> master
diff --cc service/tools/contract/service_tools/start_contract_service.sh
index dad26d75,28438d75..fa290c6b
--- a/service/tools/contract/service_tools/start_contract_service.sh
+++ b/service/tools/contract/service_tools/start_contract_service.sh
@@@ -1,3 -1,21 +1,24 @@@
++<<<<<<< HEAD
++=======
+ #
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+ #
++>>>>>>> master
killall -9 contract_service
SERVER_PATH=./bazel-bin/service/contract/contract_service