forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b9e34e3
Showing
522 changed files
with
70,992 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -ev | ||
|
||
bash <(curl -s https://codecov.io/bash) | ||
|
||
docker tag $DOCKERHUB_REPO:$COMMIT $DOCKERHUB_REPO:travis-$TRAVIS_BUILD_NUMBER | ||
|
||
if [ "${TRAVIS_EVENT_TYPE}" == "push" ] && [ "${TRAVIS_BRANCH}" == "platform" ]; then | ||
docker tag $DOCKERHUB_REPO:$COMMIT $DOCKERHUB_REPO:$TRAVIS_BRANCH | ||
fi | ||
|
||
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin | ||
docker push $DOCKERHUB_REPO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -ev | ||
|
||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | ||
sudo apt-get update | ||
sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce | ||
# hack to address problem with using DOCKER_BUILDKIT=1, inspired by: | ||
# * https://github.com/rootless-containers/usernetes/blob/master/.travis.yml | ||
# | ||
# links discussing the issue: | ||
# * https://github.com/moby/buildkit/issues/606#issuecomment-453959632 | ||
# * https://travis-ci.community/t/docker-builds-are-broken-if-buildkit-is-used-docker-buildkit-1/2994 | ||
# * https://github.com/moby/moby/issues/39120 | ||
sudo docker --version | ||
sudo cat /etc/docker/daemon.json | ||
sudo rm -f /etc/docker/daemon.json | ||
sudo systemctl restart docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
codecov: | ||
branch: platform | ||
|
||
coverage: | ||
range: 60..100 | ||
round: down | ||
precision: 5 | ||
status: | ||
project: | ||
default: | ||
threshold: 5% | ||
patch: | ||
default: | ||
threshold: 50% | ||
|
||
comment: | ||
layout: "header, diff, changes, sunburst, uncovered" | ||
behavior: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior. | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Operating System** | ||
Which OS you used to reveal the bug. | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
*.log | ||
*~ | ||
.DS_Store | ||
|
||
awscpu | ||
|
||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
*.profile | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
*logs/ | ||
|
||
.vscode* | ||
|
||
*.pb* | ||
*.ava | ||
|
||
db* | ||
*cpu[0-9]* | ||
*mem[0-9]* | ||
*lock[0-9]* | ||
*.profile | ||
*.swp | ||
*.aux | ||
*.fdb* | ||
*.fls | ||
*.gz | ||
|
||
.coverage | ||
|
||
bin/ | ||
build/ | ||
|
||
*/mykey/staker.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
dist: bionic | ||
language: go | ||
services: | ||
- docker | ||
env: | ||
global: | ||
- CODECOV_TOKEN="8c18c993-fc6e-4706-998b-01ddc7987804" | ||
- GECKO_HOME=/go/src/github.com/ava-labs/gecko/ | ||
- COMMIT=${TRAVIS_COMMIT::8} | ||
- DOCKERHUB_REPO=avaplatform/gecko | ||
- secure: "L/A9+re0NEKP6EV6H9RcTGiDhX3WMvsiWrkRKDYKqnviqbjY30RK6EM4vvjrM4Lrw2QwsO3YKgnku3+zioE/TxEZFkpkbjNUXru0nYBrWAg1TKVsDXnYaIZkHUejfryST3E8N7F4Hx6zCtGEO0sEdUeKuT+MNUIuHezHooTgGzDjMogm70EWMFjQHc7VucTJu7dWU1RBPjovWQ0q9qflrtCpbrvXFIiihQQ1PQha1Q2C4wLakKuLbhhSafue90Mnyss0blaPHy/tyewcASJu4vsGTKRBn0DzttlkNTwuD6+nKrbmJY0ohunnkVFzYjrZAw1gyN+DCDb/lPbz4ZDItKPwrIUPEtL5xuUOrxUZPUh+0io3Q2d6rjaqkdGjd1KQXzbnW1mn0BxX3d3b2UpIqhBn9umYYjHBKnMuoRiTK33b7U9+LF3K84+tEvVDCPeHs/mw6Inp5jGRSravnM6yPQ6feGzogs4+3EMzZXxnkngKFKCsnd67Oe9xfV9amOU2aQAx4jaAwlPjEpBEkUa8YKx3lPznvmUk1QsNCUbLjdSl5JBaXojLJoiuPbj29hp4S5AXXgn+3Hvwk3ndcFCxi6/l1W9mjYSOtFqg3EAUdF4EgnA/ykQg9ZokkoKY0+qgOzG2bKOAYuCDWeGr7P1apToh00ccsQXL81nVPiq7uDw=" | ||
- secure: "zfTm7tJBYiPYrli76d4Ep6Lc2TJQ8Xv//+7OoqTA/aIf6YJDHe05f2GFTWAHG2iOIix/yjwHYwnhyIW66eWPb+Ujejnmh4eXlYZFufX9J5jUpDpbFu/+ybOLgE1Tmr0je0ycneSMe/NAaS74nWU1wnP34/cEE4sYL7TJyhwbeEtgz3cbSWwkpdvHFbXCjSOA196jdIYYUwsnqU9yycAG+2WUSk3DHHzzdtMrh/UOH2r1VFyp5US0zmbW90WkWX+o3TIlzZJgTUGQRNnWKq95Mrh1EQotxgL6CJ8NkfY4bVAGAhusPjdjscJsHxfY93WRMH64TzPYYp0zdibatH0ztyhnZPXVKqv+AIIVTEW+xWv5V18kTQAd1uBW103NFacbgXhIGWtbFcN9g1+ws29HROMclYs7ci6+72Qnq0eL55huqSyFx6+InhYwn+LfJmaBcGW4wx1umdp505M0obZ4ghlyn6b0pDYmqsu1XyBC3mjUTFbwlQmWE2Fize4L5o+DdH4ZDc9japF9ntxIMvO+b3nOicr7tplY2AGp61bB89o3dUAFlN5mDaEJotiAuFk5mo244rY1FjSzyGiKkA3M9TkTIbgcbN098hOJoMCYybH7yqiPwNnZiFvUuYjHuC5D1kIYBWuqqO0iVcbIZn0rV2jyzbVFlhFVk2clTZGhkrY=" | ||
before_install: .ci/before_install.sh | ||
install: DOCKER_BUILDKIT=1 docker build --progress plain --ssh default -t $DOCKERHUB_REPO:$COMMIT . | ||
script: docker run --rm -v "$PWD:$GECKO_HOME" $DOCKERHUB_REPO:$COMMIT bash "$GECKO_HOME/scripts/build_test.sh" | ||
after_success: .ci/after_success.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# syntax=docker/dockerfile:experimental | ||
|
||
FROM golang:1.13.4-buster | ||
|
||
RUN apt-get update && apt-get install -y libssl-dev libuv1-dev curl cmake | ||
|
||
RUN mkdir -p /go/src/github.com/ava-labs | ||
|
||
# Because downloading ethereum takes long it is done separately, so that the docker | ||
# layer, when cached can be re-used | ||
RUN go get -t -v github.com/ava-labs/go-ethereum | ||
|
||
WORKDIR $GOPATH/src/github.com/ava-labs/ | ||
COPY . gecko | ||
|
||
WORKDIR $GOPATH/src/github.com/ava-labs/gecko | ||
RUN ./scripts/build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2020, Ava Labs, Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# gecko | ||
|
||
## Installation | ||
|
||
AVA is an incredibly lightweight protocol, so the minimum computer requirements are quite modest. | ||
|
||
- Hardware: 2 GHz or faster CPU, 3 GB RAM, 250 MB hard disk. | ||
- OS: Ubuntu >= 18.04 or Mac OS X >= Catalina. | ||
- Software: [Go](https://golang.org/doc/install) version >= 1.13.X and set up [`$GOPATH`](https://github.com/golang/go/wiki/SettingGOPATH). | ||
- Network: IPv4 or IPv6 network connection, with an open public port. | ||
|
||
### Native Install | ||
|
||
Ubuntu users need the following libraries: | ||
|
||
* libssl-dev | ||
* libuv1-dev | ||
* cmake | ||
* make | ||
* curl | ||
* g++ | ||
|
||
Install the libraries: | ||
|
||
```sh | ||
sudo apt-get install libssl-dev libuv1-dev cmake make curl g++ | ||
``` | ||
|
||
#### Downloading Gecko Source Code | ||
|
||
Clone the Gecko repository: | ||
|
||
```sh | ||
cd $GOPATH | ||
mkdir -p src/github.com/ava-labs | ||
cd src/github.com/ava-labs | ||
git clone https://github.com/ava-labs/gecko.git | ||
cd gecko | ||
``` | ||
|
||
#### Building the Gecko Executable | ||
|
||
Build Gecko using the build script: | ||
|
||
```sh | ||
./scripts/build.sh | ||
``` | ||
|
||
The Gecko binary, named `ava`, is in the `build` directory. | ||
|
||
### Docker Install | ||
|
||
- Make sure you have docker installed on your machine (so commands like `docker run` etc. are available). | ||
- Build the docker image of latest gecko branch by `scripts/build_image.sh`. | ||
- Check the built image by `docker image ls`, you should see some image tagged | ||
`gecko-xxxxxxxx`, where `xxxxxxxx` is the commit id of the Gecko source it was built from. | ||
- Test Gecko by `docker run -ti -p 9651:9651 gecko-xxxxxxxx /gecko/build/ava | ||
--public-ip=127.0.0.1 --snow-sample-size=1 --snow-quorum-size=1 --staking-tls-enabled=false`. (For a production deployment, | ||
you may want to extend the docker image with required credentials for | ||
staking and TLS.) | ||
|
||
## Running Gecko and Creating a Local Test Network | ||
|
||
To create your own local test network, run: | ||
|
||
```sh | ||
./build/ava --public-ip=127.0.0.1 --snow-sample-size=1 --snow-quorum-size=1 --staking-tls-enabled=false | ||
``` | ||
|
||
This launches an AVA network with one node. | ||
|
||
You should see some pretty ASCII art and log messages. | ||
You may see a few warnings. These are OK. | ||
|
||
You can use `Ctrl + C` to kill the node. | ||
|
||
If you want to specify your log level. You should set `--log-level` to one of the following values, in decreasing order of logging. | ||
* `--log-level=verbo` | ||
* `--log-level=debug` | ||
* `--log-level=info` | ||
* `--log-level=warn` | ||
* `--log-level=error` | ||
* `--log-level=fatal` | ||
* `--log-level=off` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// (c) 2019-2020, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package admin | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/ava-labs/gecko/ids" | ||
) | ||
|
||
// GetChainAliasesArgs are the arguments for Admin.GetChainAliases API call | ||
type GetChainAliasesArgs struct{ ChainID string } | ||
|
||
// GetChainAliasesReply are the arguments for Admin.GetChainAliases API call | ||
type GetChainAliasesReply struct{ Aliases []string } | ||
|
||
// GetChainAliases returns the aliases of the chain | ||
// whose string representation is [args.ChainID] | ||
func (service *Admin) GetChainAliases(r *http.Request, args *GetChainAliasesArgs, reply *GetChainAliasesReply) error { | ||
ID, err := ids.FromString(args.ChainID) | ||
if err != nil { | ||
return err | ||
} | ||
reply.Aliases = service.chainManager.Aliases(ID) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// (c) 2019-2020, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package admin | ||
|
||
import ( | ||
"sort" | ||
|
||
"github.com/ava-labs/gecko/utils" | ||
) | ||
|
||
// Peerable can return a group of peers | ||
type Peerable interface{ Peers() []utils.IPDesc } | ||
|
||
// Networking provides helper methods for tracking the current network state | ||
type Networking struct{ peers Peerable } | ||
|
||
// Peers returns the current peers | ||
func (n *Networking) Peers() ([]string, error) { | ||
ipDescs := n.peers.Peers() | ||
ips := make([]string, len(ipDescs)) | ||
for i, ipDesc := range ipDescs { | ||
ips[i] = ipDesc.String() | ||
} | ||
sort.Strings(ips) | ||
return ips, nil | ||
} |
Oops, something went wrong.