Skip to content

Commit

Permalink
fix/optimize various utils (#946)
Browse files Browse the repository at this point in the history
* tuning benchmark utils

* bump chaindev

* fix `make dbench_xx`

* to be compatible with MacOS and FreeBSD

* sync with the `chaindev` crate

* fix feature settings

* fix bench scripts

* fix `make bench_xxxK`

* bump chaindev

* fix the core dump issue under make v4.4
  • Loading branch information
ktmlm authored May 3, 2023
1 parent 3ccb850 commit 09e5983
Show file tree
Hide file tree
Showing 14 changed files with 93 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ checkpoint.toml
checkpoint*
proof_tree
proof_tree.1

wallet_mobile_ffi.h
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

## Change log

#### v0.3.38-release
#### v0.3.38-release
- Features:
- Prism++: Support any type of FRC20 and nft to UTXO
- Bugfix:
- Fix transaction serialization error
- Fix evm nonce increase when tx error.

#### v0.3.30-release

- EVM upgrading and optimization in TPS.
Expand Down
26 changes: 16 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
#
#

all: build_release_goleveldb
all: fmt lint build_release_goleveldb

export CARGO_NET_GIT_FETCH_WITH_CLI = true
export STATIC_CHAIN_DEV_BASE_DIR_SUFFIX = findora

export PROTOC = $(shell which protoc)

export STAKING_INITIAL_VALIDATOR_CONFIG = $(shell pwd)/src/ledger/src/staking/init/staking_config.json
export STAKING_INITIAL_VALIDATOR_CONFIG_DEBUG_ENV = $(shell pwd)/src/ledger/src/staking/init/staking_config_debug_env.json
export STAKING_INITIAL_VALIDATOR_CONFIG := $(shell pwd)/src/ledger/src/staking/init/staking_config.json
export STAKING_INITIAL_VALIDATOR_CONFIG_DEBUG_ENV := $(shell pwd)/src/ledger/src/staking/init/staking_config_debug_env.json

FIN_DEBUG ?= /tmp/findora
export ENABLE_QUERY_SERVICE = true
Expand All @@ -30,26 +28,34 @@ subdirs = $(bin_dir) $(lib_dir)
WASM_PKG = wasm.tar.gz
lib_files = ./$(WASM_PKG)

UNAME_S := $(shell uname -s)

ifeq ($(UNAME_S), Linux)
CP := cp --remove-destination
else
CP := cp -f
endif

define pack
- rm -rf $(1)
mkdir $(1)
cd $(1); for i in $(subdirs); do mkdir $$i; done
cp -f \
$(CP) \
${CARGO_TARGET_DIR}/$(2)/$(1)/findorad \
${CARGO_TARGET_DIR}/$(2)/$(1)/abcid \
${CARGO_TARGET_DIR}/$(2)/$(1)/fn \
${CARGO_TARGET_DIR}/$(2)/$(1)/stt \
${CARGO_TARGET_DIR}/$(2)/$(1)/staking_cfg_generator \
$(shell go env GOPATH)/bin/tendermint \
$(1)/$(bin_dir)/
cp -f $(1)/$(bin_dir)/* ~/.cargo/bin/
$(CP) $(1)/$(bin_dir)/* ~/.cargo/bin/
cd $(1)/$(bin_dir)/ && ./findorad pack
cp -f /tmp/findorad $(1)/$(bin_dir)/
cp -f /tmp/findorad ~/.cargo/bin/
$(CP) /tmp/findorad $(1)/$(bin_dir)/
$(CP) /tmp/findorad ~/.cargo/bin/
endef

install: stop_all build_release_goleveldb
cp -f release/bin/* /usr/local/bin/
$(CP) release/bin/* /usr/local/bin/
bash -x tools/systemd_services/install.sh $(EXTERNAL_ADDRESS)

stop_all:
Expand Down
4 changes: 2 additions & 2 deletions docs/benchmarks/evm.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
> Hardwares:
> - 1 x [AMD EPYC 7773X, CPU 64 core, Memory 128 GB, Disk nvme ssd(raid0, 2 members)]
>
> Typography: 6 nodes(5 full nodes, 1 seed node) running on the same machine
> Typography: 6 nodes(5 full nodes, 1 bootstrap node) running on the same machine
**==>>** `make bench_50k`:

Expand Down Expand Up @@ -100,7 +100,7 @@ TODO
> - 1 x [AMD Ryzen 9 5900X, CPU 12 core, Memory 32 GB, Disk nvme ssd(single)]
> - 1 x [AMD Ryzen 7 5700G, CPU 8 core, Memory 32 GB, Disk nvme ssd(single)]
>
> Typography: 6 nodes(5 full nodes, 1 seed node) running on 3 different machines
> Typography: 6 nodes(5 full nodes, 1 bootstrap node) running on 3 different machines
`make dbench_50k`:

Expand Down
2 changes: 1 addition & 1 deletion docs/staking/workflow_mermaid.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ sequenceDiagram

### Inner Details

- **TODO**
- **TODO**
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
mod tests;

use eth_pairings::public_interface::{perform_operation, ApiError, OperationType};
use evm::executor::stack::{PrecompileFailure, PrecompileOutput};
use evm::executor::stack::{PrecompileFailure, PrecompileOutput};
use evm::{
// Context,
ExitError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
lazy_static = "1.4.0"
evm-exporter = { package = "evm-exporter", git = "https://github.com/FindoraNetwork/enterprise-web3.git", tag = "1.0.0"}
ethereum = { version = "0.12.0", default-features = false, features = ["with-serde"] }
primitive-types = "0.11.1"
primitive-types = "0.11.1"
redis = { version = "0.21", default-features = false, features = [ "tls", "r2d2" ] }
r2d2 = { version = "0.8.8"}
ruc = "1.0"
4 changes: 2 additions & 2 deletions src/components/finutils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sha2 = "0.10"

zei = { git = "https://github.com/FindoraNetwork/zei", branch = "stable-main" }
ruc = "1.0"
rucv3 = { package = "ruc", version = "3.0" }
rucv4 = { package = "ruc", version = "4.0" }
nix = "0.25"

ledger = { path = "../../ledger" }
Expand All @@ -41,7 +41,7 @@ tendermint-rpc = { git = "https://github.com/FindoraNetwork/tendermint-rs", feat

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# chaindev = { path = "../../../../chaindev" }
chaindev = { git = "https://github.com/rust-util-collections/chaindev", tag = "tm33v13" }
chaindev = { git = "https://github.com/rust-util-collections/chaindev", tag = "tm33v21", default-features = false, features = ["tendermint_based", "vsdb_sled_engine"] }

[dev-dependencies]

Expand Down
4 changes: 2 additions & 2 deletions src/components/finutils/src/common/ddev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ and you have set the ssh public key of your local machine on each of them:

Create and start a distributed cluster:
```shell
# this distributed cluster has 4 validator nodes and 1 seed node
# this distributed cluster has 4 validator nodes and 1 bootstrap node
fn ddev create --hosts '10.0.0.2#alice,10.0.0.3#bob,10.0.0.4#jack'
```

Expand Down Expand Up @@ -158,7 +158,7 @@ We can use `tree -F -L 2 /tmp/__CHAIN_DEV__/ubuntu/bob/__D_DEV__` to check their
Let's check the inner structure of 'DEFAULT', `tree -F -L 1 /tmp/__CHAIN_DEV__/ubuntu/bob/__D_DEV__/envs/DEFAULT`:
```
/tmp/__CHAIN_DEV__/ubuntu/bob/__D_DEV__/envs/DEFAULT/
├── 0/ # seed node of this ENV, can *not* be removed dynamicly
├── 0/ # bootstrap node of this ENV, can *not* be removed dynamicly
├── 1/ # the first validator node of this ENV, can *not* be removed dynamicly
├── 2/ # the second validator node of this ENV, can be removed dynamicly
├── 8/ # ...
Expand Down
2 changes: 1 addition & 1 deletion src/components/finutils/src/common/ddev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use chaindev::tm_ddev::{
};
use init::{BankAccount, InitialValidator};
use lazy_static::lazy_static;
use rucv3::*;
use rucv4::*;
use serde::{Deserialize, Serialize};
use std::{env, fmt::Write, thread};

Expand Down
8 changes: 4 additions & 4 deletions src/components/finutils/src/common/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ Below is the information of a custom ENV named 'MyEnv', `fn dev -e MyEnv`:
"tendermint_bin_path": "/tmp/tendermint-v0.33.8",
"tendermint_extra_opts": "validator",
"block_interval_in_seconds": 1.0,
"seed_nodes": {
"bootstrap_nodes": {
"0": {
"id": 0,
"tendermint_node_id": "4663d3cb408a56218cbc470a3ef5b3756ae865a7",
"node_home_dir": "/tmp/__CHAIN_DEV__/7773x/fh/__DEV__/envs/MyEnv/0",
"kind": "Seed",
"kind": "Bootstrap",
"ports": {
"web3_http_service": 40490,
"web3_websocket_service": 28126,
Expand Down Expand Up @@ -312,7 +312,7 @@ Below is the information of a custom ENV named 'MyEnv', `fn dev -e MyEnv`:
"pub_key": "yU5Uw5XHeQ5ZJ7KP2U48T3qhD1pPhtm0dbPxmcjB9UA=",
"sec_key": "v1Tyw6TUhgpYbU_j0EArUSA_GQaufem4lnbOjoG-uBw="
},
"xfr_mnemonic": "sister talk breeze brave mammal laundry clinic age mutual quarter never coffee witness fiscal school mom ancient rival erode raccoon seed addict unknown balcony",
"xfr_mnemonic": "sister talk breeze brave mammal laundry clinic age mutual quarter never coffee witness fiscal school mom ancient rival erode raccoon bootstrap addict unknown balcony",
"xfr_wallet_addr": "fra1e989fsu4causukf8k28ajn3ufaa2zr66f7rdndr4k0cenjxp74qqqhf5e5"
},
{
Expand Down Expand Up @@ -490,7 +490,7 @@ We can use `tree -F -L 2 /tmp/__FINDORA_DEV__` to check their structures:
Let's check the inner structure of 'DEFAULT', `tree -F -L 1 /tmp/__CHAIN_DEV__/ubuntu/bob/__DEV__/envs/DEFAULT`:
```
/tmp/__CHAIN_DEV__/ubuntu/bob/__DEV__/envs/DEFAULT/
├── 0/ # seed node of this ENV, can *not* be removed dynamicly
├── 0/ # bootstrap node of this ENV, can *not* be removed dynamicly
├── 1/ # the first validator node of this ENV, can *not* be removed dynamicly
├── 2/ # the second validator node of this ENV, can be removed dynamicly
├── 3/ # the third validator node, similar with the second one
Expand Down
2 changes: 1 addition & 1 deletion src/components/finutils/src/common/dev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use chaindev::tm_dev::{
self, CustomOps, EnvMeta, EnvName, EnvOpts, Node, NodeOptsGenerator, Op,
};
use init::{BankAccount, InitialValidator};
use rucv3::*;
use rucv4::*;
use serde::{Deserialize, Serialize};
use std::{fmt::Write, thread};

Expand Down
10 changes: 5 additions & 5 deletions src/components/finutils/src/common/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,14 @@ fn get_seq_id() -> Result<u64> {

let url = format!("{}:8668/global_state", get_serv_addr().c(d!())?);

attohttpc::get(url)
attohttpc::get(&url)
.send()
.c(d!())?
.c(d!(url))?
.error_for_status()
.c(d!())?
.c(d!(url))?
.bytes()
.c(d!())
.and_then(|b| serde_json::from_slice::<Resp>(&b).c(d!()))
.c(d!(url))
.and_then(|b| serde_json::from_slice::<Resp>(&b).c(d!(url)))
.map(|resp| resp.1)
}

Expand Down
Loading

0 comments on commit 09e5983

Please sign in to comment.