Skip to content

Commit b9e34e3

Browse files
init repo
0 parents  commit b9e34e3

522 files changed

Lines changed: 70992 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/after_success.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
5+
bash <(curl -s https://codecov.io/bash)
6+
7+
docker tag $DOCKERHUB_REPO:$COMMIT $DOCKERHUB_REPO:travis-$TRAVIS_BUILD_NUMBER
8+
9+
if [ "${TRAVIS_EVENT_TYPE}" == "push" ] && [ "${TRAVIS_BRANCH}" == "platform" ]; then
10+
docker tag $DOCKERHUB_REPO:$COMMIT $DOCKERHUB_REPO:$TRAVIS_BRANCH
11+
fi
12+
13+
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
14+
docker push $DOCKERHUB_REPO

.ci/before_install.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
5+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
6+
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
7+
sudo apt-get update
8+
sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
9+
# hack to address problem with using DOCKER_BUILDKIT=1, inspired by:
10+
# * https://github.com/rootless-containers/usernetes/blob/master/.travis.yml
11+
#
12+
# links discussing the issue:
13+
# * https://github.com/moby/buildkit/issues/606#issuecomment-453959632
14+
# * https://travis-ci.community/t/docker-builds-are-broken-if-buildkit-is-used-docker-buildkit-1/2994
15+
# * https://github.com/moby/moby/issues/39120
16+
sudo docker --version
17+
sudo cat /etc/docker/daemon.json
18+
sudo rm -f /etc/docker/daemon.json
19+
sudo systemctl restart docker

.codecov.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
codecov:
2+
branch: platform
3+
4+
coverage:
5+
range: 60..100
6+
round: down
7+
precision: 5
8+
status:
9+
project:
10+
default:
11+
threshold: 5%
12+
patch:
13+
default:
14+
threshold: 50%
15+
16+
comment:
17+
layout: "header, diff, changes, sunburst, uncovered"
18+
behavior: default
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior.
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Screenshots**
20+
If applicable, add screenshots to help explain your problem.
21+
22+
**Operating System**
23+
Which OS you used to reveal the bug.
24+
25+
**Additional context**
26+
Add any other context about the problem here.

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
*.log
2+
*~
3+
.DS_Store
4+
5+
awscpu
6+
7+
# Binaries for programs and plugins
8+
*.exe
9+
*.exe~
10+
*.dll
11+
*.so
12+
*.dylib
13+
*.profile
14+
15+
# Test binary, build with `go test -c`
16+
*.test
17+
18+
# Output of the go coverage tool, specifically when used with LiteIDE
19+
*.out
20+
21+
*logs/
22+
23+
.vscode*
24+
25+
*.pb*
26+
*.ava
27+
28+
db*
29+
*cpu[0-9]*
30+
*mem[0-9]*
31+
*lock[0-9]*
32+
*.profile
33+
*.swp
34+
*.aux
35+
*.fdb*
36+
*.fls
37+
*.gz
38+
*.pdf
39+
40+
.coverage
41+
42+
bin/
43+
build/
44+
45+
*/mykey/staker.*

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
dist: bionic
2+
language: go
3+
services:
4+
- docker
5+
env:
6+
global:
7+
- CODECOV_TOKEN="8c18c993-fc6e-4706-998b-01ddc7987804"
8+
- GECKO_HOME=/go/src/github.com/ava-labs/gecko/
9+
- COMMIT=${TRAVIS_COMMIT::8}
10+
- DOCKERHUB_REPO=avaplatform/gecko
11+
- secure: "L/A9+re0NEKP6EV6H9RcTGiDhX3WMvsiWrkRKDYKqnviqbjY30RK6EM4vvjrM4Lrw2QwsO3YKgnku3+zioE/TxEZFkpkbjNUXru0nYBrWAg1TKVsDXnYaIZkHUejfryST3E8N7F4Hx6zCtGEO0sEdUeKuT+MNUIuHezHooTgGzDjMogm70EWMFjQHc7VucTJu7dWU1RBPjovWQ0q9qflrtCpbrvXFIiihQQ1PQha1Q2C4wLakKuLbhhSafue90Mnyss0blaPHy/tyewcASJu4vsGTKRBn0DzttlkNTwuD6+nKrbmJY0ohunnkVFzYjrZAw1gyN+DCDb/lPbz4ZDItKPwrIUPEtL5xuUOrxUZPUh+0io3Q2d6rjaqkdGjd1KQXzbnW1mn0BxX3d3b2UpIqhBn9umYYjHBKnMuoRiTK33b7U9+LF3K84+tEvVDCPeHs/mw6Inp5jGRSravnM6yPQ6feGzogs4+3EMzZXxnkngKFKCsnd67Oe9xfV9amOU2aQAx4jaAwlPjEpBEkUa8YKx3lPznvmUk1QsNCUbLjdSl5JBaXojLJoiuPbj29hp4S5AXXgn+3Hvwk3ndcFCxi6/l1W9mjYSOtFqg3EAUdF4EgnA/ykQg9ZokkoKY0+qgOzG2bKOAYuCDWeGr7P1apToh00ccsQXL81nVPiq7uDw="
12+
- secure: "zfTm7tJBYiPYrli76d4Ep6Lc2TJQ8Xv//+7OoqTA/aIf6YJDHe05f2GFTWAHG2iOIix/yjwHYwnhyIW66eWPb+Ujejnmh4eXlYZFufX9J5jUpDpbFu/+ybOLgE1Tmr0je0ycneSMe/NAaS74nWU1wnP34/cEE4sYL7TJyhwbeEtgz3cbSWwkpdvHFbXCjSOA196jdIYYUwsnqU9yycAG+2WUSk3DHHzzdtMrh/UOH2r1VFyp5US0zmbW90WkWX+o3TIlzZJgTUGQRNnWKq95Mrh1EQotxgL6CJ8NkfY4bVAGAhusPjdjscJsHxfY93WRMH64TzPYYp0zdibatH0ztyhnZPXVKqv+AIIVTEW+xWv5V18kTQAd1uBW103NFacbgXhIGWtbFcN9g1+ws29HROMclYs7ci6+72Qnq0eL55huqSyFx6+InhYwn+LfJmaBcGW4wx1umdp505M0obZ4ghlyn6b0pDYmqsu1XyBC3mjUTFbwlQmWE2Fize4L5o+DdH4ZDc9japF9ntxIMvO+b3nOicr7tplY2AGp61bB89o3dUAFlN5mDaEJotiAuFk5mo244rY1FjSzyGiKkA3M9TkTIbgcbN098hOJoMCYybH7yqiPwNnZiFvUuYjHuC5D1kIYBWuqqO0iVcbIZn0rV2jyzbVFlhFVk2clTZGhkrY="
13+
before_install: .ci/before_install.sh
14+
install: DOCKER_BUILDKIT=1 docker build --progress plain --ssh default -t $DOCKERHUB_REPO:$COMMIT .
15+
script: docker run --rm -v "$PWD:$GECKO_HOME" $DOCKERHUB_REPO:$COMMIT bash "$GECKO_HOME/scripts/build_test.sh"
16+
after_success: .ci/after_success.sh

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# syntax=docker/dockerfile:experimental
2+
3+
FROM golang:1.13.4-buster
4+
5+
RUN apt-get update && apt-get install -y libssl-dev libuv1-dev curl cmake
6+
7+
RUN mkdir -p /go/src/github.com/ava-labs
8+
9+
# Because downloading ethereum takes long it is done separately, so that the docker
10+
# layer, when cached can be re-used
11+
RUN go get -t -v github.com/ava-labs/go-ethereum
12+
13+
WORKDIR $GOPATH/src/github.com/ava-labs/
14+
COPY . gecko
15+
16+
WORKDIR $GOPATH/src/github.com/ava-labs/gecko
17+
RUN ./scripts/build.sh

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2020, Ava Labs, Inc.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# gecko
2+
3+
## Installation
4+
5+
AVA is an incredibly lightweight protocol, so the minimum computer requirements are quite modest.
6+
7+
- Hardware: 2 GHz or faster CPU, 3 GB RAM, 250 MB hard disk.
8+
- OS: Ubuntu >= 18.04 or Mac OS X >= Catalina.
9+
- Software: [Go](https://golang.org/doc/install) version >= 1.13.X and set up [`$GOPATH`](https://github.com/golang/go/wiki/SettingGOPATH).
10+
- Network: IPv4 or IPv6 network connection, with an open public port.
11+
12+
### Native Install
13+
14+
Ubuntu users need the following libraries:
15+
16+
* libssl-dev
17+
* libuv1-dev
18+
* cmake
19+
* make
20+
* curl
21+
* g++
22+
23+
Install the libraries:
24+
25+
```sh
26+
sudo apt-get install libssl-dev libuv1-dev cmake make curl g++
27+
```
28+
29+
#### Downloading Gecko Source Code
30+
31+
Clone the Gecko repository:
32+
33+
```sh
34+
cd $GOPATH
35+
mkdir -p src/github.com/ava-labs
36+
cd src/github.com/ava-labs
37+
git clone https://github.com/ava-labs/gecko.git
38+
cd gecko
39+
```
40+
41+
#### Building the Gecko Executable
42+
43+
Build Gecko using the build script:
44+
45+
```sh
46+
./scripts/build.sh
47+
```
48+
49+
The Gecko binary, named `ava`, is in the `build` directory.
50+
51+
### Docker Install
52+
53+
- Make sure you have docker installed on your machine (so commands like `docker run` etc. are available).
54+
- Build the docker image of latest gecko branch by `scripts/build_image.sh`.
55+
- Check the built image by `docker image ls`, you should see some image tagged
56+
`gecko-xxxxxxxx`, where `xxxxxxxx` is the commit id of the Gecko source it was built from.
57+
- Test Gecko by `docker run -ti -p 9651:9651 gecko-xxxxxxxx /gecko/build/ava
58+
--public-ip=127.0.0.1 --snow-sample-size=1 --snow-quorum-size=1 --staking-tls-enabled=false`. (For a production deployment,
59+
you may want to extend the docker image with required credentials for
60+
staking and TLS.)
61+
62+
## Running Gecko and Creating a Local Test Network
63+
64+
To create your own local test network, run:
65+
66+
```sh
67+
./build/ava --public-ip=127.0.0.1 --snow-sample-size=1 --snow-quorum-size=1 --staking-tls-enabled=false
68+
```
69+
70+
This launches an AVA network with one node.
71+
72+
You should see some pretty ASCII art and log messages.
73+
You may see a few warnings. These are OK.
74+
75+
You can use `Ctrl + C` to kill the node.
76+
77+
If you want to specify your log level. You should set `--log-level` to one of the following values, in decreasing order of logging.
78+
* `--log-level=verbo`
79+
* `--log-level=debug`
80+
* `--log-level=info`
81+
* `--log-level=warn`
82+
* `--log-level=error`
83+
* `--log-level=fatal`
84+
* `--log-level=off`

api/admin/chain.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
2+
// See the file LICENSE for licensing terms.
3+
4+
package admin
5+
6+
import (
7+
"net/http"
8+
9+
"github.com/ava-labs/gecko/ids"
10+
)
11+
12+
// GetChainAliasesArgs are the arguments for Admin.GetChainAliases API call
13+
type GetChainAliasesArgs struct{ ChainID string }
14+
15+
// GetChainAliasesReply are the arguments for Admin.GetChainAliases API call
16+
type GetChainAliasesReply struct{ Aliases []string }
17+
18+
// GetChainAliases returns the aliases of the chain
19+
// whose string representation is [args.ChainID]
20+
func (service *Admin) GetChainAliases(r *http.Request, args *GetChainAliasesArgs, reply *GetChainAliasesReply) error {
21+
ID, err := ids.FromString(args.ChainID)
22+
if err != nil {
23+
return err
24+
}
25+
reply.Aliases = service.chainManager.Aliases(ID)
26+
return nil
27+
}

0 commit comments

Comments
 (0)