From d104962aad990b83d48742d6369586f8960f9c36 Mon Sep 17 00:00:00 2001 From: colmazia Date: Tue, 19 Sep 2023 15:15:16 +0700 Subject: [PATCH 1/8] revisit-todo --- app/app.go | 3 ++- testing/chain.go | 3 +-- testing/endpoint.go | 5 ----- x/oracle/client/cli/tx.go | 1 - x/oracle/ibc_test.go | 2 +- x/oracle/module.go | 6 ++---- yoda/executor/executor.go | 1 - yoda/gas.go | 1 - 8 files changed, 6 insertions(+), 16 deletions(-) diff --git a/app/app.go b/app/app.go index f88253c91..9ddf6f3c6 100644 --- a/app/app.go +++ b/app/app.go @@ -605,8 +605,8 @@ func NewBandApp( // NOTE: Oracle module must occur before distr as it takes some fee to distribute to active oracle validators. // NOTE: During begin block slashing happens after distr.BeginBlocker so that there is nothing left // over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant. + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) - // TODO: Recheck all Begin/End block logic order app.mm.SetOrderBeginBlockers( upgradetypes.ModuleName, capabilitytypes.ModuleName, @@ -657,6 +657,7 @@ func NewBandApp( consensusparamtypes.ModuleName, globalfeetypes.ModuleName, ) + // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. diff --git a/testing/chain.go b/testing/chain.go index 78cdd9d00..0c54401c7 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -1,4 +1,4 @@ -// 0.47 TODO: consider importing directly from ibc instead of forking +// TODO: consider importing directly from ibc instead of forking package ibctesting import ( @@ -79,7 +79,6 @@ type TestChain struct { // Time management is handled by the Coordinator in order to ensure synchrony between chains. // Each update of any chain increments the block header time for all chains by 5 seconds. func NewTestChain(t *testing.T, coord *Coordinator, chainID string) *TestChain { - // TODO: change sender signers := make([]tmtypes.PrivValidator, valSize) validators := make([]*tmtypes.Validator, valSize) genesisAccount := make([]authtypes.GenesisAccount, valSize) diff --git a/testing/endpoint.go b/testing/endpoint.go index bfec5d45e..aea165765 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -101,11 +101,6 @@ func (endpoint *Endpoint) CreateClient() (err error) { UpgradePath, ) consensusState = endpoint.Counterparty.Chain.LastHeader.ConsensusState() - case exported.Solomachine: - // TODO - // solo := NewSolomachine(chain.t, endpoint.Chain.Codec, clientID, "", 1) - // clientState = solo.ClientState() - // consensusState = solo.ConsensusState() default: err = fmt.Errorf("client type %s is not supported", endpoint.ClientConfig.GetClientType()) diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go index 8b894f363..1ae9ae164 100644 --- a/x/oracle/client/cli/tx.go +++ b/x/oracle/client/cli/tx.go @@ -307,7 +307,6 @@ $ %s tx oracle edit-data-source 1 --name coingecko-price --description The scrip return err } - // TODO: Support do-not-modify fee coinStr, err := cmd.Flags().GetString(flagFee) if err != nil { return err diff --git a/x/oracle/ibc_test.go b/x/oracle/ibc_test.go index 90c0b8a59..e83ac189f 100644 --- a/x/oracle/ibc_test.go +++ b/x/oracle/ibc_test.go @@ -1,4 +1,4 @@ -// 0.47 TODO: write this test file by importing testing directly from ibc +// TODO: write this test file by importing testing directly from ibc package oracle_test import ( diff --git a/x/oracle/module.go b/x/oracle/module.go index 48c5986ef..e7729b8a7 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -96,10 +96,8 @@ func NewAppModule(k keeper.Keeper, ss exported.Subspace) AppModule { } } -// RegisterInvariants is a noop function to satisfy SDK AppModule interface. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { - // TODO -} +// RegisterInvariants is a no-op function to satisfy SDK AppModule interface. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { diff --git a/yoda/executor/executor.go b/yoda/executor/executor.go index 86251e5c3..2e809894b 100644 --- a/yoda/executor/executor.go +++ b/yoda/executor/executor.go @@ -46,7 +46,6 @@ func NewExecutor(executor string) (exec Executor, err error) { return nil, fmt.Errorf("Invalid executor name: %s, base: %s", name, base) } - // TODO: Remove hardcode in test execution res, err := exec.Exec(testProgram, "TEST_ARG", map[string]interface{}{ "BAND_CHAIN_ID": "test-chain-id", "BAND_VALIDATOR": "test-validator", diff --git a/yoda/gas.go b/yoda/gas.go index 42e5cf1e9..fbcbcb429 100644 --- a/yoda/gas.go +++ b/yoda/gas.go @@ -120,7 +120,6 @@ func estimateAuthAnteHandlerGas(c *Context, msgs []sdk.Msg) uint64 { } func estimateGas(c *Context, l *Logger, msgs []sdk.Msg, feeEstimations []FeeEstimationData) uint64 { - // TODO: Add authz validation / remove check reporter base gas gas := estimateAuthAnteHandlerGas(c, msgs) for i, msg := range msgs { From 0b9a4a863a81d9d20fc1509c27e1d6bd7d71ee40 Mon Sep 17 00:00:00 2001 From: colmazia Date: Tue, 19 Sep 2023 16:32:16 +0700 Subject: [PATCH 2/8] revise readme.md --- README.md | 70 ++++--------------------------------------- x/globalfee/README.md | 2 +- yoda/README.md | 49 +++++------------------------- 3 files changed, 15 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index f15e7a202..d56072268 100644 --- a/README.md +++ b/README.md @@ -21,77 +21,19 @@ BandChain - Decentralized Data Delivery Network

Documentation »
-
- Whitepaper - · - Technical Specifications - · - Developer Documentation - · - Client Library


## What is BandChain? -BandChain is a **cross-chain data oracle platform** that aggregates and connects real-world data and APIs to smart contracts. It is designed to be **compatible with most smart contract and blockchain development frameworks**. It does the heavy lifting jobs of pulling data from external sources, aggregating them, and packaging them into the format that’s easy to use and verified efficiently across multiple blockchains. +BandChain is a **cross-chain data oracle platform** that aggregates and connects real-world data and APIs to smart contracts. It is designed to be **compatible with most smart contract and blockchain development frameworks**. It does the heavy lifting jobs of pulling data from external sources, aggregating them, and packaging them into the format that’s easy to use and verifiable efficiently across multiple blockchains. Band's flexible oracle design allows developers to **query any data** including real-world events, sports, weather, random numbers and more. Developers can create custom-made oracles using WebAssembly to connect smart contracts with traditional web APIs within minutes. ## Installation -### Building from source - -We recommend the following for running a BandChain Validator: - -- **2 or more** CPU cores -- **8 GB** of RAM (16 GB in case on participate in mainnet upgrade) -- At least **100GB** of disk storage - -**Step 1. Install Golang** - -Go v1.18+ or higher is required for BandChain. - -If you haven't already, install Golang by following the [official docs](https://golang.org/doc/install). Make sure that your GOPATH and GOBIN environment variables are properly set up. - -**Step 2. Get BandChain source code** - -Use `git` to retrieve BandChain from the [official repo](https://github.com/bandprotocol/chain), and checkout the master branch, which contains the latest stable release. That should install the `bandd` binary. - -```bash -git clone https://github.com/bandprotocol/chain -cd chain && git checkout v2.3.0 -make install -``` - -**Step 3. Verify your installation** - -Using `bandd version` command to verify that your `bandd` has been build successfully. - -``` -bandd version --long -name: bandchain -server_name: bandd -version: 2.3.0 -commit: 4fe19638b33043eed4dec9861cda40962fb5b2a7 -build_tags: ledger -go: go version go1.18.3 darwin/amd64 -build_deps: -... -``` - -### Setting Up Yoda — The Oracle Daemon - -BandChain validators are also responsible for responding to oracle data requests. Whenever someone submits a request message to BandChain, the chain will autonomously choose a subset of active oracle validators to perform the data query. - -The validators are chosen submit a report message to BandChain within a given timeframe as specified by a chain parameter (100 blocks in mainnet). We provide a program called yoda to do this task for you. For more information on the data request process, please see [here](https://docs.bandchain.org/whitepaper/system-overview.html#oracle-data-request). - -Yoda uses an external executor to resolve requests to data sources. Currently, it supports [AWS Lambda](https://aws.amazon.com/lambda/) and [Google Cloud Function](https://cloud.google.com/functions) (through the REST interface). In future releases, `yoda` will support more executors and allow you to specify multiple executors to add redundancy. - -You also need to set up `yoda` and activate oracle status. Here’s the [documentation](https://github.com/bandprotocol/bandchain/wiki/Instruction-for-apply-to-be-an-oracle-validator-on-Guanyu-mainnet) to get started. - -That’s it! You can verify that your validator is now an oracle provider via cli by using ` bandd query oracle validator `. Your yoda process must be responding to oracle requests assigned to your node. If the process misses a request, your oracle provider status will automatically get deactivated and you must send MsgActivate to activate again after a 10-minute waiting period and make sure that yoda is up. +Please refer to [this documentation](https://docs.bandchain.org/node-validators/run-node/joining-mainnet/installation) for the most up-to-date installation guide. ## Resources @@ -105,12 +47,12 @@ That’s it! You can verify that your validator is now an oracle provider via cl - [Cosmoscan Mainnet](https://cosmoscan.io) - [Big Dipper](https://band.bigdipper.live/) - Testnet: - - [CosmoScan Testnet](https://laozi-testnet2.cosmoscan.io) + - [CosmoScan Testnet](https://laozi-testnet6.cosmoscan.io) ## Community - [Official Website](https://bandprotocol.com) -- [Telegram](https://100.band/tg) +- [Telegram](https://t.me/bandprotocol) - [Twitter](https://twitter.com/bandprotocol) - [Developer Discord](https://100x.band/discord) @@ -118,6 +60,6 @@ That’s it! You can verify that your validator is now an oracle provider via cl BandChain is licensed under the terms of the GPL 3.0 License unless otherwise specified in the LICENSE file at module's root. -We highly encourage participation from the community to help with D3N development. If you are interested in developing with D3N or have suggestion for protocol improvements, please open an issue, submit a pull request, or [drop as a line]. +We highly encourage participation from the community to help with D3N development. If you are interested in developing with D3N or have suggestions for protocol improvements, please open an issue, submit a pull request, or [drop as a line]. -[drop as a line]: mailto:connect@bandprotocol.com +[drop us a line]: mailto:connect@bandprotocol.com diff --git a/x/globalfee/README.md b/x/globalfee/README.md index c8828f7c3..dcda53fe1 100644 --- a/x/globalfee/README.md +++ b/x/globalfee/README.md @@ -1,4 +1,4 @@ # Global fee module -This module is the fork version of globalfee module from [Gaia](https://github.com/cosmos/gaia) and [TGrade](https://github.com/confio/tgrade) with modifications to use with the Oracle module and Cosmos-SDK 0.46.x version. All credits and big thanks go to the original authors. +This module is the fork version of globalfee module from [Gaia](https://github.com/cosmos/gaia) and [TGrade](https://github.com/confio/tgrade) with modifications to use with the Oracle module and Cosmos-SDK 0.47.x version. All credits and big thanks go to the original authors. diff --git a/yoda/README.md b/yoda/README.md index de7c71ad1..c6045fc6d 100644 --- a/yoda/README.md +++ b/yoda/README.md @@ -1,48 +1,15 @@ -### Yoda +# Yoda -## Prepare environment +## Introduction -1. Install PostgresSQL `brew install postgresql` -2. Install Golang -3. Install Rust -4. Install Docker -5. run `cd owasm/chaintests/bitcoin_block_count/` -6. run `wasm-pack build .` -7. `make install` in chain directory -8. Open 3 tabs on cmd -9. run `docker pull bandprotocol/runtime:1.0.2` +Yoda is a program that is used by BandChain's validator nodes to automatically fulfill data for oracle requests. -## How to install and run Yoda +Since a subset of validators who are selected for a data request must return the data they received from running the specified data source(s), each of them have to send a `MsgReportData` transaction to BandChain in order to fulfill their duty. -1. Open first cmd tab for running the BandChain -2. Open second cmd tab for running the Yoda -3. Open third cmd tab for running the BandChain CLI +Although the transaction can be sent manually by user, it is not convenient, and would be rather time-consuming. Furthermore, most data providers already have APIs that can be used to query data automatically by another software. Therefore, we have developed Yoda to help validators to automatically query data from data providers by executing data source script, then submit the result to fulfill the request. -### How to run BandChain on development mode +For more detail about Yoda, please follows this [link](https://docs.bandchain.org/node-validators/yoda) -1. Go to chain directory -2. Setup your PostgresSQL user, port and database name on `start_bandd.sh` -3. run `chmod +x scripts/start_bandd.sh` to change the access permission of start_bandd.script -4. run `./scripts/start_bandd.sh` to start BandChain -5. If fail, try owasm pack build then run script again. +## Installation -``` -cd ../owasm/chaintests/bitcoin_block_count/ -wasm-pack build . -cd ../../../chain -``` - -### How to run Yoda - -1. Go to chain directory -2. run `chmod +x scripts/start_yoda.sh` to change the access permission of start_yoda.script -3. run `./scripts/start_yoda.sh validator [number of reporter]` to start Yoda - -### Try to request data BandChain - -After we have `BandChain` and `Yoda` running, now we can request data on BandChain. -Example of requesting data on BandChain - -``` -bandd tx oracle request 1 -c 0000000342544300000000000003e8 1 1 --chain-id bandchain --gas 3000000 --keyring-backend test --fee-limit 10uband --from requester -``` +Please refer to [this documentation](https://docs.bandchain.org/node-validators/run-node/joining-mainnet/installation#step-5-setup-yoda) for the most up-to-date installation guide. From bbcf763e8c38cd847f399910c5d94bff4e2529d7 Mon Sep 17 00:00:00 2001 From: colmazia Date: Wed, 20 Sep 2023 16:00:54 +0700 Subject: [PATCH 3/8] bring building_from_source back to readme for local build ref --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index d56072268..94f169e37 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,45 @@ Band's flexible oracle design allows developers to **query any data** including Please refer to [this documentation](https://docs.bandchain.org/node-validators/run-node/joining-mainnet/installation) for the most up-to-date installation guide. +## Building from source + +We recommend the following for running a BandChain Validator: + +- **2 or more** CPU cores +- **8 GB** of RAM (16 GB in case on participate in mainnet upgrade) +- At least **100GB** of disk storage + +**Step 1. Install Golang** + +Go v1.18+ or higher is required for BandChain. + +If you haven't already, install Golang by following the [official docs](https://golang.org/doc/install). Make sure that your GOPATH and GOBIN environment variables are properly set up. + +**Step 2. Get BandChain source code** + +Use `git` to retrieve BandChain from the [official repo](https://github.com/bandprotocol/chain), and checkout the master branch, which contains the latest stable release. That should install the `bandd` binary. + +```bash +git clone https://github.com/bandprotocol/chain +cd chain && git checkout v2.3.0 +make install +``` + +**Step 3. Verify your installation** + +Using `bandd version` command to verify that your `bandd` has been build successfully. + +``` +name: bandchain +server_name: bandd +version: 2.5.4 +commit: e6548bbf4793829bb8e711e5ed89ba4afc710ded +build_tags: netgo,ledger +go: go version go1.19.1 darwin/amd64 +build_deps: +... +``` + ## Resources - Developer From 19f45721ae8dd52b79a00086766ce1341fd7056b Mon Sep 17 00:00:00 2001 From: colmazia Date: Wed, 20 Sep 2023 17:09:21 +0700 Subject: [PATCH 4/8] bring back solomachine todo --- testing/endpoint.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testing/endpoint.go b/testing/endpoint.go index aea165765..cfe128048 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -101,6 +101,11 @@ func (endpoint *Endpoint) CreateClient() (err error) { UpgradePath, ) consensusState = endpoint.Counterparty.Chain.LastHeader.ConsensusState() + case exported.Solomachine: + // TODO + // solo := NewSolomachine(endpoint.Chain.T, endpoint.Chain.Codec, clientID, "", 1) + // clientState = solo.ClientState() + // consensusState = solo.ConsensusState() default: err = fmt.Errorf("client type %s is not supported", endpoint.ClientConfig.GetClientType()) From b7605b4c033b95acb7699050d93ab2ba269a4416 Mon Sep 17 00:00:00 2001 From: colmazia Date: Thu, 21 Sep 2023 16:04:00 +0700 Subject: [PATCH 5/8] add useful scripts section in readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 94f169e37..15cf2f678 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,12 @@ build_deps: ... ``` +## Useful scripts + +- `scripts/generate_genesis.sh` to create/reset the default genesis file +- `scripts/start_bandd.sh` to start the bandd binary +- `scripts/start_yoda.sh` to start yoda with reporter(s) + ## Resources - Developer From f20ee5ef97c33bc514b08987e68cf7a51c1d8285 Mon Sep 17 00:00:00 2001 From: colmazia Date: Thu, 21 Sep 2023 16:14:50 +0700 Subject: [PATCH 6/8] remark for development --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15cf2f678..e95471041 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ build_deps: ... ``` -## Useful scripts +## Useful scripts for development - `scripts/generate_genesis.sh` to create/reset the default genesis file - `scripts/start_bandd.sh` to start the bandd binary From ffae1e982f79610ee6422d06c17b8186cac03fe2 Mon Sep 17 00:00:00 2001 From: colmazia Date: Tue, 28 Nov 2023 13:38:35 +0700 Subject: [PATCH 7/8] update discord link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e95471041..1cc28c2b4 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ build_deps: - [Official Website](https://bandprotocol.com) - [Telegram](https://t.me/bandprotocol) - [Twitter](https://twitter.com/bandprotocol) -- [Developer Discord](https://100x.band/discord) +- [Developer Discord](https://discord.com/invite/3t4bsY7) ## License & Contributing From f6ef7054daa56a0c6d538267dfb636ba890f1867 Mon Sep 17 00:00:00 2001 From: Kitipong Sirirueangsakul Date: Mon, 29 Jan 2024 10:31:38 +0700 Subject: [PATCH 8/8] add arm commands --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 1cc28c2b4..9a46f4489 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,12 @@ build_deps: ... ``` +If you are using Mac ARM architecture (M1, M2) and face the issue of GMP library, you can run this. +``` +brew update && brew install gmp +sudo ln -s /opt/homebrew/lib/libgmp.10.dylib /usr/local/lib/ +``` + ## Useful scripts for development - `scripts/generate_genesis.sh` to create/reset the default genesis file