Skip to content

Latest commit

 

History

History
189 lines (129 loc) · 4.82 KB

DEVELOPING.md

File metadata and controls

189 lines (129 loc) · 4.82 KB

Developing

For setting up your environment to develop seda-chain. Shows how to build, run, format, and clean the code base. To learn how to contribute please read here.

Note

Windows is not supported at this time.

Dev-Container

If you are using VSCode and docker you can open the project in a dev-container where all deps will be installed already. Otherwise please see the dev dependencies.

Dev Dependencies

We use clang format to format our protobuf generated code.

  • Linux
    • Please see your distro specific installation tool(i.e apt) and use that to install it.
  • Macos:
    • Using brew: brew install clang-format
    • Using macports: sudo port install clang-format

Docker is used to help make release and static builds locally.

  • Linux
    • Please see your distro specific installation tool(i.e apt) and use that to install it.
  • Macos:
    • Using brew: brew install --cask docker
    • Using macports: sudo port install docker

We use Golang as the language to develop sedad as it has the CosmosSDK.

  • Golang: you can download it from the linked page or:
    • Linux: Use your distribution's package manager.
    • Mac: Use macports or brew.
  • Ensure that $GOPATH and $PATH have been set properly. On a Mac that uses the Z shell, you may have to run the following:
mkdir -p $HOME/go/bin
echo "export GOPATH=$HOME/go" >> ~/.zprofile
echo "export PATH=\$PATH:\$GOPATH/bin" >> ~/.zprofile
echo "export GO111MODULE=on" >> ~/.zprofile
source ~/.zprofile

We use GNU Make to help us built, lint, fmt, and etc for our project.

  • Linux:
    • Your distro likely already comes with this. You can check by running which make.
    • Otherwise please see your distro specific installation tool(i.e apt) and use that to install it.
  • Macos:
    • You can check if it's already installed by which make.
    • Otherwise use brew or macports to install it.

A necessary tool for generating protobuf code.

  • Linux:
    • Please see your distro specific installation tool(i.e apt) and use that to install it.
  • Macos:
    • Using brew: brew install protobuf
    • Using macports: sudo port install protobuf-cpp

Protobuf Sub-Deps

We also need some dependencies to make protobuf work for cosmos.

Buf

The buf tool.

  • Linux:
    • curl -sSL https://github.com/bufbuild/buf/releases/download/v1.28.1/buf-Linux-x86_64 -o buf && chmod +x buf && sudo mv buf /usr/local/bin
  • Macos:
    • Using brew: brew install bufbuild/buf/buf
    • Using macports: sudo port install buf

WasmVM is the library that makes CosmWASM possible.

You can install that by running:

sudo ./scripts/install_wasmvm.sh

Building Using Make

To build the protobuf (only necessary if you made changes in the proto files) you will need to run:

make prot-dep-install
make proto-update-deps
make proto-gen

To build, run:

make build

To install (builds and moves the executable to $GOPATH/bin, which should be in $PATH), run:

make install

Running a Single-node Local Testnet

To run a single-node testnet locally:

make build
BIN=./build/sedad

$BIN tendermint unsafe-reset-all
rm -rf ~/.sedad

$BIN init node0 --default-denom aseda --chain-id seda-1-local

$BIN keys add satoshi --keyring-backend test
$BIN add-genesis-account $($BIN keys show satoshi --keyring-backend test -a) 10000000000000000seda
$BIN gentx satoshi 10000000000000000seda --keyring-backend test --chain-id seda-1-local
$BIN collect-gentxs
$BIN start

Linting & Formatting

To lint and format the protobuf(only necessary if you mess with protobuf):

make proto-fmt
make proto-lint

If you have not install a Go linters runner, install it first:

make lint-install

Run format and run linter for go sided:

make fmt
make lint

Running

After running the make install command you should be able to use sedad --help.

Testing

To run all unit tests:

make test-unit

To see test coverage:

make cover-html

To run end-to-end tests:

GITHUB_TOKEN=<your_github_pat> make test-e2e