protohaechi

module
v0.0.0-...-8c7b936 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: Apache-2.0

README

Haechi

This repo provides an implementation of Haechi in Go. The codebase forks from Tendermint project. To obtain the measured metrics easily, we keep the source codes of Tendermint and inject minimum codes for code tracing. For quick revision and modification, we list the file directories of major implementation, configuration and scripts below:

NOTE: If you have any question, feel free to contact antfinancialyujian@gmail.com.

Table of Contents

1 - Minimum requirement

2 - Installation instructions

3 - Testing instructions

4 - Experimental results

5 - Parameter description

Minimum requirements

Requirement Note
go 1.16

Installation instructions

NOTE: The path should be set correctly because our scripts rely on a relative path.

First, create the repo path. Under your $HOME, execute

$ mkdir go && cd go && mkdir src && cd src && mkdir github.com && cd github.com && mkdir EtherCS && cd EtherCS

Next, under the path $HOME/go/src/github.com/EtherCS, clone the repo and download the dependencies:

$ git clone git@github.com:EtherCS/protohaechi.git
$ cd protohaechi
$ go mod tidy

These command may take a long time the first time you run them.

Testing instructions

Under the repo path (i.e., $GOPATH/src/github.com/EtherCS/protohaechi), follow the two steps:

Step 1. Build
$ make build_test
Step 2. Test
  1. AHL
  • run two shards with four nodes in a terminal
$ ./scripts/haechi/single-machine/run_ahl.sh
  • run client in another terminal to send transactions
$ ./build/ahlclient
  • run a latency client in another terminal for testing latency
$ ./build/ahllatency -beaconport "10057" -beaconip "127.0.0.1" -shardport "20157" -shardip "127.0.0.1" -info "ahl: latency test"
  1. Byshard
  • run two shards with four nodes in a terminal
$ ./scripts/haechi/single-machine/run_byshard.sh
  • run client in another terminal to send transactions
$ ./build/byshardclient
  • run a latency client in another terminal for testing latency
$ ./build/byshardlatency  -beaconport "10057" -beaconip "127.0.0.1" -shardport "20157" -shardip "127.0.0.1" -info "byshard: latency test"
  1. Haechi-sync
  • run two shards with four nodes in a terminal
$ ./scripts/haechi/single-machine/run_haechi_sync.sh
  • run client in another terminal to send transactions
$ ./build/haechisyncclient
  • run a latency client in another terminal for testing latency
$ ./build/haechisynclatency  -beaconport "10057" -beaconip "127.0.0.1" -shardport "20157" -shardip "127.0.0.1" -info "haechi-sync: latency test"
  1. Haechi
  • run two shards with four nodes in a terminal
$ ./scripts/haechi/single-machine/run_haechi.sh
  • run client in another terminal to send transactions
$ ./build/haechiclient
  • run a latency client in another terminal for testing latency
$ ./build/haechilatency -beaconport "10057" -beaconip "127.0.0.1" -shardport "20157" -shardip "127.0.0.1" -info "haechi: latency test"

Experimental results

After running all tests under different parameters, experimental results can be found in the log files ./tmplog with a specific file name. A sample log is:

Haechi: start a block at time 2023-06-06 11:04:38.350497 -0400 EDT m=+46.775439376
2023-06-06T11:04:38-04:00 INFO received proposal module=consensus proposal={"Type":32,"block_id":{"hash":"2DCA1844D7FA7BD768787C8C32E9360D3E43C16B833FAA428C3352DE3CA4BDDB","parts":{"hash":"630199F85CC73C592A14A53AD9406695309472128FF32ABAF8D36613E3CC3148","total":1}},"height":13,"pol_round":-1,"round":0,"signature":"VICrY6DNRFU/ku+HHtwUgxz6aH22WXvH5x3VF6jPaULXAvqNG+BLAva7kNs9tzxe3KRKHwMSm9m6/cM90vPhAw==","timestamp":"2023-06-06T15:04:38.430812Z"}
2023-06-06T11:04:38-04:00 INFO received complete proposal block hash=2DCA1844D7FA7BD768787C8C32E9360D3E43C16B833FAA428C3352DE3CA4BDDB height=13 module=consensus
2023-06-06T11:04:40-04:00 INFO finalizing commit of block hash=2DCA1844D7FA7BD768787C8C32E9360D3E43C16B833FAA428C3352DE3CA4BDDB height=13 module=consensus num_txs=100 root=
2023-06-06T11:04:44-04:00 INFO executed block height=13 module=state num_invalid_txs=0 num_valid_txs=100
2023-06-06T11:04:44-04:00 INFO committed state app_hash= height=13 module=state num_txs=100
Haechi: commit block at time 2023-06-06 11:04:44.293434 -0400 EDT m=+52.718476153

Parameter description

node parameter description
node parameters description default
n shard number 2
m shard size 2
p beacon chain port 10057
i beacon chain ip "127.0.0.1"
s shard chain points "20057,21057"
x shard chain ips "127.0.0.1,127.0.0.1"
client parameter description
client parameters description default
shards shard number 2
size shard size 2
beaconport beacon chain port 10057
beaconip beacon chain ip "127.0.0.1"
shardports shard chain points "20057,21057"
shardips shard chain ips "127.0.0.2,127.0.0.3"
batch batch size per request 10
ratio cross-shard txs ratio 0.8
parallel concurrent request number 100
duration execution duration, s 120

Note: the default maximum number of connections of a node is 900

script parameter description
script parameters description default
h config path configs/EC2-test/shard/30node
n shard number 2
m shard size 2
p beacon chain port 10057
i beacon chain ip "127.0.0.1"
s shard chain points "20057,21057"
x shard chain ips "127.0.0.1,127.0.0.1"
d testing time 120

Directories

Path Synopsis
abci
client
Package abciclient provides an ABCI implementation in Go.
Package abciclient provides an ABCI implementation in Go.
server
Package server is used to start a new ABCI server.
Package server is used to start a new ABCI server.
cmd
merkle
Package merkle computes a deterministic minimal height Merkle tree hash.
Package merkle computes a deterministic minimal height Merkle tree hash.
xchacha20poly1305
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
csconsensus
internal
blocksync
Package blocksync implements two versions of a reactor Service that are responsible for block propagation and gossip between peers.
Package blocksync implements two versions of a reactor Service that are responsible for block propagation and gossip between peers.
blocksync/v2/internal/behavior
Package Behavior provides a mechanism for reactors to report behavior of peers.
Package Behavior provides a mechanism for reactors to report behavior of peers.
evidence
Package evidence handles all evidence storage and gossiping from detection to block proposal.
Package evidence handles all evidence storage and gossiping from detection to block proposal.
inspect
Package inspect provides a tool for investigating the state of a failed Tendermint node.
Package inspect provides a tool for investigating the state of a failed Tendermint node.
libs/flowrate
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
libs/test
nolint:gosec // G404: Use of weak random number generator
nolint:gosec // G404: Use of weak random number generator
mempool/v0
TODO: Better handle abci client errors.
TODO: Better handle abci client errors.
p2p
p2p/pex
Package PEX (Peer exchange) handles all the logic necessary for nodes to share information about their peers to other nodes.
Package PEX (Peer exchange) handles all the logic necessary for nodes to share information about their peers to other nodes.
p2p/upnp
Taken from taipei-torrent.
Taken from taipei-torrent.
rpc/core
Package core defines the Tendermint RPC endpoints.
Package core defines the Tendermint RPC endpoints.
state/indexer
Package indexer defines Tendermint's block and transaction event indexing logic.
Package indexer defines Tendermint's block and transaction event indexing logic.
state/indexer/sink/psql
Package psql implements an event sink backed by a PostgreSQL database.
Package psql implements an event sink backed by a PostgreSQL database.
test/factory
Package factory provides generation code for common structs in Tendermint.
Package factory provides generation code for common structs in Tendermint.
libs
cli
events
Package events - Pub-Sub in go with event caching
Package events - Pub-Sub in go with event caching
json
Package json provides functions for marshaling and unmarshaling JSON in a format that is backwards-compatible with Amino JSON encoding.
Package json provides functions for marshaling and unmarshaling JSON in a format that is backwards-compatible with Amino JSON encoding.
log
net
os
pubsub
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
pubsub/query
Package query implements the custom query format used to filter event subscriptions in Tendermint.
Package query implements the custom query format used to filter event subscriptions in Tendermint.
pubsub/query/syntax
Package syntax defines a scanner and parser for the Tendermint event filter query language.
Package syntax defines a scanner and parser for the Tendermint event filter query language.
package light provides a light client implementation.
package light provides a light client implementation.
mbt
Package mbt provides a test runner for model-based tests
Package mbt provides a test runner for model-based tests
rpc
Package node is the main entry point, where the tendermint node service is constructed and the implementation of that service is defined.
Package node is the main entry point, where the tendermint node service is constructed and the implementation of that service is defined.
Package privval provides different implementations of the types.PrivValidator.
Package privval provides different implementations of the types.PrivValidator.
proto
rpc
jsonrpc
HTTP RPC server supporting calls via uri params, jsonrpc over HTTP, and jsonrpc over websockets
HTTP RPC server supporting calls via uri params, jsonrpc over HTTP, and jsonrpc over websockets
jsonrpc/server
Commons for HTTP handling
Commons for HTTP handling
scripts
confix
Program confix applies fixes to a Tendermint TOML configuration file to update a file created with an older version of Tendermint to a compatible format for a newer version.
Program confix applies fixes to a Tendermint TOML configuration file to update a file created with an older version of Tendermint to a compatible format for a newer version.
keymigrate
Package keymigrate translates all legacy formatted keys to their new components.
Package keymigrate translates all legacy formatted keys to their new components.
scmigrate
Package scmigrate implements a migration for SeenCommit data between 0.34 and 0.35
Package scmigrate implements a migration for SeenCommit data between 0.34 and 0.35
test
app
e2e/app
nolint: gosec
nolint: gosec
e2e/generator
nolint: gosec
nolint: gosec
e2e/node
nolint: goconst
nolint: goconst
e2e/pkg
nolint: gosec
nolint: gosec
e2e/runner
nolint: gosec
nolint: gosec
fuzz/p2p/addrbook
nolint: gosec
nolint: gosec
nolint: gosec
fuzz/p2p/pex/init-corpus
nolint: gosec
nolint: gosec
nolint: gosec
tools

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL