forked from cerc-io/laconicd-deprecated
Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acfe52b6b6 | ||
|
|
241936d74a | ||
|
|
c9c0de0a06 | ||
|
|
b694034198 | ||
|
|
edeeb49614 | ||
|
|
c5cfc35f48 | ||
|
|
474a4d89da | ||
|
|
72ec75a857 | ||
|
|
ca8c83999c | ||
|
|
474371531d | ||
|
|
e7eac028a2 | ||
|
|
bdb0586e01 | ||
|
|
e119d27ca0 | ||
|
|
055e323f3b | ||
|
|
9ea31b81f5 | ||
|
|
d4b13e2859 | ||
|
|
9f31e1b556 | ||
|
|
c0a197da92 |
+144
-86
@@ -15,33 +15,17 @@ jobs:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
|
||||
|
||||
install-tparse:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v2.1.4
|
||||
with:
|
||||
go-version: 1.18
|
||||
- name: Display Go Version
|
||||
run: go version
|
||||
- name: Install tparse
|
||||
run: |
|
||||
export GO111MODULE="on" && go install github.com/mfridman/tparse@latest
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/go/bin
|
||||
key: ${{ runner.os }}-go-tparse-binary
|
||||
|
||||
test-unit-cover:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v2.1.4
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.0.1
|
||||
- uses: technote-space/get-diff-action@v6.1.1
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.sol
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
@@ -49,7 +33,7 @@ jobs:
|
||||
run: |
|
||||
make test-unit-cover
|
||||
if: env.GIT_DIFF
|
||||
- uses: codecov/codecov-action@v2.1.0
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage.txt
|
||||
fail_ci_if_error: true
|
||||
@@ -59,87 +43,33 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/setup-go@v2.1.4
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.0.1
|
||||
- uses: technote-space/get-diff-action@v6.1.1
|
||||
id: git_diff
|
||||
with:
|
||||
SUFFIX_FILTER: |
|
||||
.go
|
||||
.mod
|
||||
.sum
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: test-importer
|
||||
run: |
|
||||
make test-import
|
||||
if: env.GIT_DIFF
|
||||
|
||||
test-solidity:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 240
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
batch: ['1-3', '2-3', '3-3']
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.18
|
||||
- uses: technote-space/get-diff-action@v6.0.1
|
||||
id: git_diff
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.sol
|
||||
**/**.go
|
||||
tests/solidity/**/*.js
|
||||
tests/solidity/**/*.sh
|
||||
go.mod
|
||||
go.sum
|
||||
- name: test-solidity
|
||||
run: |
|
||||
./scripts/run-solidity-tests.sh --batch=${{ matrix.batch }}
|
||||
if: env.GIT_DIFF
|
||||
|
||||
liveness-test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v2.1.4
|
||||
with:
|
||||
go-version: 1.18
|
||||
- uses: technote-space/get-diff-action@v6.0.1
|
||||
id: git_diff
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Install Starport
|
||||
run: |
|
||||
curl https://get.starport.network/starport! | bash
|
||||
if: env.GIT_DIFF
|
||||
- name: Start Local Network via Starport
|
||||
run: |
|
||||
starport chain serve --reset-once -v -c ./starport.yml > starport.out 2>&1 &
|
||||
if: env.GIT_DIFF
|
||||
- name: Test Local Network Liveness
|
||||
run: |
|
||||
sleep 2m
|
||||
./contrib/scripts/test_localnet_liveness.sh 100 5 50 localhost
|
||||
if: env.GIT_DIFF
|
||||
|
||||
test-rpc:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/setup-go@v2.1.4
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.0.1
|
||||
- uses: technote-space/get-diff-action@v6.1.1
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.sol
|
||||
@@ -155,11 +85,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/setup-go@v2.1.4
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.0.1
|
||||
- uses: technote-space/get-diff-action@v6.1.1
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.sol
|
||||
@@ -170,3 +101,130 @@ jobs:
|
||||
run: |
|
||||
make test-integration
|
||||
if: env.GIT_DIFF
|
||||
|
||||
# integration_tests:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - uses: cachix/install-nix-action@v18
|
||||
# - uses: cachix/cachix-action@v11
|
||||
# with:
|
||||
# name: ethermint
|
||||
# signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
|
||||
# - uses: technote-space/get-diff-action@v6.1.1
|
||||
# with:
|
||||
# PATTERNS: |
|
||||
# **/**.sol
|
||||
# **/**.go
|
||||
# go.mod
|
||||
# go.sum
|
||||
# tests/integration_tests/**
|
||||
# - name: Run integration tests
|
||||
# run: make run-integration-tests
|
||||
# if: env.GIT_DIFF
|
||||
# - name: 'Tar debug files'
|
||||
# if: failure()
|
||||
# run: tar cfz debug_files.tar.gz -C /tmp/pytest-of-runner .
|
||||
# - uses: actions/upload-artifact@v3
|
||||
# if: failure()
|
||||
# with:
|
||||
# name: debug-files
|
||||
# path: debug_files.tar.gz
|
||||
# if-no-files-found: ignore
|
||||
|
||||
upload-cache:
|
||||
if: github.event_name == 'push'
|
||||
needs: ["integration_tests"]
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v18
|
||||
- uses: cachix/cachix-action@v11
|
||||
with:
|
||||
name: ethermint
|
||||
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
|
||||
- name: 'instantiate integration test env'
|
||||
run: nix-store -r $(nix-instantiate tests/integration_tests/shell.nix)
|
||||
|
||||
test-sim-nondeterminism:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.1
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Test simulation nondeterminism
|
||||
run: |
|
||||
make test-sim-nondeterminism
|
||||
if: env.GIT_DIFF
|
||||
|
||||
test-sim-random-genesis-fast:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.1
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Test simulation with random genesis
|
||||
run: |
|
||||
make test-sim-random-genesis-fast
|
||||
if: env.GIT_DIFF
|
||||
|
||||
test-sim-import-export:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.1
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Simulation of import and export genesis
|
||||
run: |
|
||||
make test-sim-import-export
|
||||
if: env.GIT_DIFF
|
||||
|
||||
test-sim-after-import:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.1
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Test simulation after import
|
||||
run: |
|
||||
make test-sim-after-import
|
||||
if: env.GIT_DIFF
|
||||
@@ -1,78 +1,30 @@
|
||||
<!--
|
||||
parent:
|
||||
order: false
|
||||
-->
|
||||
|
||||
<div align="center">
|
||||
<h1> Ethermint </h1>
|
||||
<h1> Laconic Network </h1>
|
||||
</div>
|
||||
|
||||

|
||||

|
||||
|
||||
<div align="center">
|
||||
<a href="https://github.com/evmos/ethermint/releases/latest">
|
||||
<img alt="Version" src="https://img.shields.io/github/tag/tharsis/ethermint.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/evmos/ethermint/blob/main/LICENSE">
|
||||
<img alt="License: Apache-2.0" src="https://img.shields.io/github/license/tharsis/ethermint.svg" />
|
||||
</a>
|
||||
<a href="https://pkg.go.dev/github.com/evmos/ethermint">
|
||||
<img alt="GoDoc" src="https://godoc.org/github.com/evmos/ethermint?status.svg" />
|
||||
</a>
|
||||
<a href="https://goreportcard.com/report/github.com/evmos/ethermint">
|
||||
<img alt="Go report card" src="https://goreportcard.com/badge/github.com/evmos/ethermint"/>
|
||||
</a>
|
||||
<a href="https://bestpractices.coreinfrastructure.org/projects/5018">
|
||||
<img alt="Lines of code" src="https://img.shields.io/tokei/lines/github/tharsis/ethermint">
|
||||
</a>
|
||||
</div>
|
||||
<div align="center">
|
||||
<a href="https://discord.gg/trje9XuAmy">
|
||||
<img alt="Discord" src="https://img.shields.io/discord/809048090249134080.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/evmos/ethermint/actions?query=branch%3Amain+workflow%3ALint">
|
||||
<img alt="Lint Status" src="https://github.com/evmos/ethermint/actions/workflows/lint.yml/badge.svg?branch=main" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/tharsis/ethermint">
|
||||
<img alt="Code Coverage" src="https://codecov.io/gh/tharsis/ethermint/branch/main/graph/badge.svg" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Ethermint is a scalable and interoperable Ethereum library, built on Proof-of-Stake with fast-finality using the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/) which runs on top of [Tendermint Core](https://github.com/tendermint/tendermint) consensus engine.
|
||||
The Source of Proof. Laconic is a next generation data availability & verifiability layer with cryptographic proofs, powering internet-scale Web3 applications, built on Proof-of-Stake with fast-finality using the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/) which runs on top of [Tendermint Core](https://github.com/tendermint/tendermint) consensus engine.
|
||||
|
||||
**Note**: Requires [Go 1.18+](https://golang.org/dl/)
|
||||
|
||||
## Installation
|
||||
|
||||
For prerequisites and detailed build instructions please read the Evmos [Installation](https://evmos.dev/quickstart/installation.html) instructions. Once the dependencies are installed, run:
|
||||
|
||||
```bash
|
||||
make install
|
||||
```
|
||||
|
||||
Or check out the latest [release](https://github.com/evmos/ethermint/releases).
|
||||
|
||||
## Quick Start
|
||||
|
||||
To learn how the Ethermint works from a high-level perspective, go to the [Introduction](https://evmos.dev/intro/overview.html) section from the documentation. You can also check the instructions to [Run a Node](https://evmos.dev/quickstart/run_node.html).
|
||||
|
||||
For an example on how Ethermint can be used on any Cosmos-SDK chain, please refer to [Evmos](https://www.github.com/tharsis/evmos).
|
||||
|
||||
## Community
|
||||
|
||||
The following chat channels and forums are a great spot to ask questions about Ethermint:
|
||||
|
||||
- [Evmos Twitter](https://twitter.com/EvmosOrg)
|
||||
- [Evmos Discord](https://discord.gg/trje9XuAmy)
|
||||
- [Evmos Telegram](https://t.me/EvmosOrg)
|
||||
- [Tharsis Twitter](https://twitter.com/TharsisHQ)
|
||||
- [Laconic Twitter](https://twitter.com/laconicnetwork)
|
||||
- [Discord](https://discord.com/invite/ukhbBemyxY)
|
||||
- [Website](https://laconic.com)
|
||||
|
||||
## Contributing
|
||||
|
||||
Looking for a good place to start contributing? Check out some [`good first issues`](https://github.com/evmos/ethermint/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
|
||||
Looking for a good place to start contributing? Check out some [`good first issues`](https://github.com/cerc-io/laconicd/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
|
||||
|
||||
For additional instructions, standards and style guides, please refer to the [Contributing](./CONTRIBUTING.md) document.
|
||||
|
||||
## Careers
|
||||
|
||||
See our open positions on [Cosmos Jobs](https://jobs.cosmos.network/project/evmos-d0sk1uxuh-remote/), [Notion](https://tharsis.notion.site), or feel free to [reach out](mailto:careers@thars.is) via email.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
@@ -15,6 +15,7 @@ require (
|
||||
github.com/deckarep/golang-set v1.8.0
|
||||
github.com/ethereum/go-ethereum v1.10.19
|
||||
github.com/gibson042/canonicaljson-go v1.0.3
|
||||
github.com/go-chi/chi/v5 v5.0.7
|
||||
github.com/gogo/protobuf v1.3.3
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/gorilla/mux v1.8.0
|
||||
|
||||
@@ -393,6 +393,8 @@ github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjX
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
|
||||
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
|
||||
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
|
||||
github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8=
|
||||
github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
package gql
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// GraphiQL is an in-browser IDE for exploring GraphiQL APIs.
|
||||
// This handler returns GraphiQL when requested.
|
||||
//
|
||||
// For more information, see https://github.com/graphql/graphiql.
|
||||
|
||||
func respond(w http.ResponseWriter, body []byte, code int) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
w.WriteHeader(code)
|
||||
_, _ = w.Write(body)
|
||||
}
|
||||
|
||||
func errorJSON(msg string) []byte {
|
||||
buf := bytes.Buffer{}
|
||||
fmt.Fprintf(&buf, `{"error": "%s"}`, msg)
|
||||
return buf.Bytes()
|
||||
}
|
||||
|
||||
func PlaygroundHandler(apiURL string) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != "GET" {
|
||||
respond(w, errorJSON("only GET requests are supported"), http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
err := page.Execute(w, map[string]interface{}{
|
||||
"apiURL": apiURL,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html
|
||||
var page = template.Must(template.New("graphiql").Parse(`
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>GraphiQL</title>
|
||||
<style>
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#graphiql {
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--
|
||||
This GraphiQL example depends on Promise and fetch, which are available in
|
||||
modern browsers, but can be "polyfilled" for older browsers.
|
||||
GraphiQL itself depends on React DOM.
|
||||
If you do not want to rely on a CDN, you can host these files locally or
|
||||
include them directly in your favored resource bundler.
|
||||
-->
|
||||
<script
|
||||
src="https://unpkg.com/react@17/umd/react.development.js"
|
||||
integrity="sha512-Vf2xGDzpqUOEIKO+X2rgTLWPY+65++WPwCHkX2nFMu9IcstumPsf/uKKRd5prX3wOu8Q0GBylRpsDB26R6ExOg=="
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"
|
||||
integrity="sha512-Wr9OKCTtq1anK0hq5bY3X/AvDI5EflDSAh0mE9gma+4hl+kXdTJPKZ3TwLMBcrgUeoY0s3dq9JjhCQc7vddtFg=="
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
<!--
|
||||
These two files can be found in the npm module, however you may wish to
|
||||
copy them directly into your environment, or perhaps include them in your
|
||||
favored resource bundler.
|
||||
-->
|
||||
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="graphiql">Loading...</div>
|
||||
<script
|
||||
src="https://unpkg.com/graphiql/graphiql.min.js"
|
||||
type="application/javascript"
|
||||
></script>
|
||||
<script>
|
||||
// https://github.com/graphql/graphiql/blob/main/packages/graphiql/resources/renderExample.js
|
||||
|
||||
// Parse the search string to get url parameters.
|
||||
var search = window.location.search;
|
||||
var parameters = {};
|
||||
search
|
||||
.substr(1)
|
||||
.split('&')
|
||||
.forEach(function (entry) {
|
||||
var eq = entry.indexOf('=');
|
||||
if (eq >= 0) {
|
||||
parameters[decodeURIComponent(entry.slice(0, eq))] = decodeURIComponent(
|
||||
entry.slice(eq + 1),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// When the query and variables string is edited, update the URL bar so
|
||||
// that it can be easily shared.
|
||||
function onEditQuery(newQuery) {
|
||||
parameters.query = newQuery;
|
||||
updateURL();
|
||||
}
|
||||
|
||||
function onEditVariables(newVariables) {
|
||||
parameters.variables = newVariables;
|
||||
updateURL();
|
||||
}
|
||||
|
||||
function onEditHeaders(newHeaders) {
|
||||
parameters.headers = newHeaders;
|
||||
updateURL();
|
||||
}
|
||||
|
||||
function onTabChange(tabsState) {
|
||||
const activeTab = tabsState.tabs[tabsState.activeTabIndex];
|
||||
parameters.query = activeTab.query;
|
||||
parameters.variables = activeTab.variables;
|
||||
parameters.headers = activeTab.headers;
|
||||
updateURL();
|
||||
}
|
||||
|
||||
function updateURL() {
|
||||
var newSearch =
|
||||
'?' +
|
||||
Object.keys(parameters)
|
||||
.filter(function (key) {
|
||||
return Boolean(parameters[key]);
|
||||
})
|
||||
.map(function (key) {
|
||||
return (
|
||||
encodeURIComponent(key) + '=' + encodeURIComponent(parameters[key])
|
||||
);
|
||||
})
|
||||
.join('&');
|
||||
history.replaceState(null, null, newSearch);
|
||||
}
|
||||
|
||||
// Render <GraphiQL /> into the body.
|
||||
// See the README in the top level of this module to learn more about
|
||||
// how you can customize GraphiQL by providing different values or
|
||||
// additional child elements.
|
||||
ReactDOM.render(
|
||||
React.createElement(GraphiQL, {
|
||||
fetcher: GraphiQL.createFetcher({
|
||||
// subscriptionUrl: 'ws://localhost:8081/subscriptions',
|
||||
url: {{.apiURL}}
|
||||
}),
|
||||
query: parameters.query,
|
||||
variables: parameters.variables,
|
||||
headers: parameters.headers,
|
||||
defaultHeaders: parameters.defaultHeaders,
|
||||
onEditQuery: onEditQuery,
|
||||
onEditVariables: onEditVariables,
|
||||
onEditHeaders: onEditHeaders,
|
||||
defaultEditorToolsVisibility: true,
|
||||
isHeadersEditorEnabled: true,
|
||||
shouldPersistHeaders: true,
|
||||
onTabChange,
|
||||
}),
|
||||
document.getElementById('graphiql'),
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
`))
|
||||
+18
-7
@@ -5,9 +5,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/99designs/gqlgen/graphql/handler"
|
||||
"github.com/99designs/gqlgen/graphql/playground"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/rs/cors"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
@@ -16,6 +17,16 @@ func Server(ctx client.Context) {
|
||||
if !viper.GetBool("gql-server") {
|
||||
return
|
||||
}
|
||||
|
||||
router := chi.NewRouter()
|
||||
|
||||
// Add CORS middleware around every request
|
||||
// See https://github.com/rs/cors for full option listing
|
||||
router.Use(cors.New(cors.Options{
|
||||
AllowedOrigins: []string{"*"},
|
||||
Debug: false,
|
||||
}).Handler)
|
||||
|
||||
logFile := viper.GetString("log-file")
|
||||
|
||||
port := viper.GetString("gql-port")
|
||||
@@ -25,20 +36,20 @@ func Server(ctx client.Context) {
|
||||
logFile: logFile,
|
||||
}}))
|
||||
|
||||
http.Handle("/", playground.Handler("GraphQL playground", "/api"))
|
||||
router.Handle("/", PlaygroundHandler("/api"))
|
||||
|
||||
if viper.GetBool("gql-playground") {
|
||||
apiBase := viper.GetString("gql-playground-api-base")
|
||||
|
||||
http.Handle("/webui", playground.Handler("GraphQL playground", apiBase+"/api"))
|
||||
http.Handle("/console", playground.Handler("GraphQL playground", apiBase+"/graphql"))
|
||||
router.Handle("/webui", PlaygroundHandler(apiBase+"/api"))
|
||||
router.Handle("/console", PlaygroundHandler(apiBase+"/graphql"))
|
||||
}
|
||||
|
||||
http.Handle("/api", srv)
|
||||
http.Handle("/graphql", srv)
|
||||
router.Handle("/api", srv)
|
||||
router.Handle("/graphql", srv)
|
||||
|
||||
log.Info("Connect to GraphQL playground", "url", fmt.Sprintf("http://localhost:%s", port))
|
||||
err := http.ListenAndServe(":"+port, nil) //nolint: all
|
||||
err := http.ListenAndServe(":"+port, router) //nolint: all
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -111,4 +111,4 @@ if [[ $1 == "pending" ]]; then
|
||||
fi
|
||||
|
||||
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
|
||||
laconicd start --pruning=nothing --evm.tracer=json $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001aphoton --json-rpc.api eth,txpool,personal,net,debug,web3,miner --api.enable
|
||||
laconicd start --pruning=nothing --evm.tracer=json $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001aphoton --json-rpc.api eth,txpool,personal,net,debug,web3,miner --api.enable --gql-server --gql-playground
|
||||
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
dotenv: .env
|
||||
ethermint_9000-1:
|
||||
cmd: laconicd
|
||||
start-flags: "--trace"
|
||||
app-config:
|
||||
minimum-gas-prices: 0aphoton
|
||||
index-events:
|
||||
- ethereum_tx.ethereumTxHash
|
||||
json-rpc:
|
||||
address: "0.0.0.0:{EVMRPC_PORT}"
|
||||
ws-address: "0.0.0.0:{EVMRPC_PORT_WS}"
|
||||
api: "eth,net,web3,debug"
|
||||
validators:
|
||||
- coins: 1000000000000000000stake,10000000000000000000000aphoton
|
||||
staked: 1000000000000000000stake
|
||||
mnemonic: ${VALIDATOR1_MNEMONIC}
|
||||
- coins: 1000000000000000000stake,10000000000000000000000aphoton
|
||||
staked: 1000000000000000000stake
|
||||
mnemonic: ${VALIDATOR2_MNEMONIC}
|
||||
accounts:
|
||||
- name: community
|
||||
coins: 10000000000000000000000aphoton
|
||||
mnemonic: ${COMMUNITY_MNEMONIC}
|
||||
- name: signer1
|
||||
coins: 20000000000000000000000aphoton
|
||||
mnemonic: ${SIGNER1_MNEMONIC}
|
||||
- name: signer2
|
||||
coins: 30000000000000000000000aphoton
|
||||
mnemonic: ${SIGNER2_MNEMONIC}
|
||||
|
||||
genesis:
|
||||
consensus_params:
|
||||
block:
|
||||
max_bytes: "1048576"
|
||||
max_gas: "81500000"
|
||||
app_state:
|
||||
evm:
|
||||
params:
|
||||
evm_denom: aphoton
|
||||
gov:
|
||||
voting_params:
|
||||
voting_period: "10s"
|
||||
deposit_params:
|
||||
max_deposit_period: "10s"
|
||||
min_deposit:
|
||||
- denom: "aphoton"
|
||||
amount: "1"
|
||||
transfer:
|
||||
params:
|
||||
receive_enabled: true
|
||||
send_enabled: true
|
||||
feemarket:
|
||||
params:
|
||||
no_base_fee: false
|
||||
base_fee: "100000000000"
|
||||
min_gas_multiplier: "0"
|
||||
@@ -1,19 +1,19 @@
|
||||
# Validator Guide for laconic_81337-4 Testnet
|
||||
# Validator Guide for laconic_81337-5 Testnet
|
||||
|
||||
## Hardware Prerequisites
|
||||
|
||||
### Supported
|
||||
|
||||
- **Operating System (OS):** Ubuntu 20.04
|
||||
- **CPU:** 1 core
|
||||
- **RAM:** 2GB
|
||||
- **CPU:** 2 core
|
||||
- **RAM:** 8GB
|
||||
- **Storage:** 25GB SSD
|
||||
|
||||
### Recommended
|
||||
|
||||
- **Operating System (OS):** Ubuntu 20.04
|
||||
- **CPU:** 2 core
|
||||
- **RAM:** 4GB
|
||||
- **RAM:** 8GB
|
||||
- **Storage:** 50GB SSD
|
||||
|
||||
## Network Prerequisites
|
||||
@@ -21,9 +21,15 @@
|
||||
- **TCP 26656** for Peer-to-Peer Network Communication
|
||||
- **TCP 26660** for Prometheus Metrics (doesn't have to be exposed publicly)
|
||||
|
||||
# Validator Setup
|
||||
# Blockchain client Setup
|
||||
|
||||
## Install required software packages
|
||||
There are two options of running a laconicd
|
||||
1. As a systemd service
|
||||
2. In a docker container
|
||||
|
||||
## Systemd service
|
||||
Skip this section if you use docker
|
||||
### Install required software packages
|
||||
|
||||
```sh
|
||||
# Update Ubuntu
|
||||
@@ -36,14 +42,14 @@ sudo apt install git curl build-essential make jq -y
|
||||
|
||||
---
|
||||
|
||||
## Install Go
|
||||
### Install Go
|
||||
|
||||
```sh
|
||||
# Remove any existing installation of `go`
|
||||
sudo rm -rf /usr/local/go
|
||||
|
||||
# Install Go version 1.17.2
|
||||
curl https://dl.google.com/go/go1.17.2.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -
|
||||
# Install Go version 1.18.8
|
||||
curl https://dl.google.com/go/go1.18.8.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -
|
||||
|
||||
# Update env variables to include go
|
||||
cat <<'EOF' >>$HOME/.profile
|
||||
@@ -66,7 +72,7 @@ go version
|
||||
|
||||
---
|
||||
|
||||
## Install `laconic`
|
||||
### Install `laconic`
|
||||
|
||||
```sh
|
||||
git clone https://github.com/cerc-io/laconicd.git
|
||||
@@ -74,7 +80,7 @@ cd laconicd
|
||||
|
||||
# Checkout main branch
|
||||
git fetch --all
|
||||
git checkout main
|
||||
git checkout v0.6.0
|
||||
|
||||
# Build and install laconic
|
||||
make install
|
||||
@@ -96,45 +102,36 @@ server_name: laconicd
|
||||
|
||||
---
|
||||
|
||||
## Initialize Validator Node
|
||||
## Docker container
|
||||
|
||||
**Not required if you have already initialized before**
|
||||
|
||||
```sh
|
||||
# Initialize the validator node
|
||||
laconicd init <your-node-moniker> --chain-id laconic_81337-4
|
||||
```
|
||||
|
||||
Running the above commands will initialize the validator node with default configuration. The config files will be saved in the default location (`~/.laconicd/config`).
|
||||
|
||||
**NOTE:** Backup your node and validator keys. You will need to use these keys at a later point in time.
|
||||
There are different commands to initialize a validator and to run a validator node.
|
||||
See "Docker" section in corresponding chapters.
|
||||
It is important to mount a host directory (`~/.laconicd` in this documentation) to `/root/.laconicd` directory inside the container, so all blockchain data, configuration and keys persist between container restarts.
|
||||
For running a validator node it is also required to publish container's port 26656 and (optionally) 26660 to the host.
|
||||
|
||||
---
|
||||
|
||||
## Overwrite Validator Initialization from previous testnet
|
||||
# Initialize Validator Node
|
||||
|
||||
**Required for `laconic_81337-4`**
|
||||
**Not required if you have already initialized before**
|
||||
|
||||
First we have to reset the previous genesis state (only because the `laconic_81337-3` testnet failed) whereafter we can initialize the validator node for `laconic_81337-4`
|
||||
Make sure the directory `~/.laconicd` does not exist or is empty
|
||||
|
||||
---
|
||||
>**Docker**<br/>
|
||||
>In order to run the below commands in a docker container:
|
||||
>```sh
|
||||
>docker run -ti -v ~/.laconicd:/root/.laconicd \
|
||||
>git.vdb.to/cerc-io/laconicd/laconicd:v0.6.0 /bin/sh
|
||||
>```
|
||||
---
|
||||
|
||||
```sh
|
||||
# Stop your node (in case it was still running)
|
||||
systemctl stop laconicd
|
||||
|
||||
# Keep a backup of your old validator directory
|
||||
cp -a ~/.laconicd ~/backup-laconic_81337-2
|
||||
|
||||
# Reset the state of your validator
|
||||
laconicd tendermint unsafe-reset-all --home $HOME/.laconicd
|
||||
|
||||
# Remove your previous genesis transactions
|
||||
rm $HOME/.laconicd/config/gentx/gentx*.json
|
||||
|
||||
# Overwrite your genesis state with the new chain-id
|
||||
laconicd init --overwrite <your-node-moniker> --chain-id laconic_81337-4
|
||||
# Initialize the validator node
|
||||
laconicd init <your-node-moniker> --chain-id laconic_81337-5
|
||||
```
|
||||
|
||||
Running the above commands will re-initialize the validator node with default configuration. The config files will be saved in the default location (`~/.laconicd/config`).
|
||||
Running the above commands will initialize the validator node with default configuration. The config files will be saved in the default location (`~/.laconicd/config`).
|
||||
|
||||
**NOTE:** Backup your node and validator keys. You will need to use these keys at a later point in time.
|
||||
|
||||
@@ -171,11 +168,12 @@ Create Your `gentx` transaction file
|
||||
```sh
|
||||
laconicd gentx <key-name> 12900000000000000000000achk \
|
||||
--pubkey=$(laconicd tendermint show-validator) \
|
||||
--chain-id="laconic_81337-4" \
|
||||
--chain-id="laconic_81337-5" \
|
||||
--moniker="<your-moniker-name>" \
|
||||
--website="<your-validator-website>" \
|
||||
--details="<your-validator-description>" \
|
||||
--identity="<your-keybase-public-key>" \
|
||||
--ip="<your-node-public-ip-address>" \
|
||||
--commission-rate="0.10" \
|
||||
--commission-max-rate="0.20" \
|
||||
--commission-max-change-rate="0.01" \
|
||||
@@ -192,18 +190,18 @@ laconicd gentx <key-name> 12900000000000000000000achk \
|
||||
|
||||
## Submit Your gentx
|
||||
|
||||
Submit your `gentx` file to the [https://github.com/cerc-io/laconic-testnet]() repository in the following format:
|
||||
Submit your `gentx` file to the [https://github.com/cerc-io/laconic-testnet](https://github.com/cerc-io/laconic-testnet) repository in the following format:
|
||||
`<validator-moniker>-gentx.json`
|
||||
|
||||
**NOTE:** (Do NOT use spaces in the file name)
|
||||
|
||||
To submit the gentx file, follow the below process:
|
||||
|
||||
- Fork the [https://github.com/cerc-io/laconic-testnet]() repository
|
||||
- Upload your gentx file in the `laconic_81337-4/config/gentxs` folder
|
||||
- Submit Pull Request to [https://github.com/cerc-io/laconic-testnet]() with name `ADD <your-moniker> gentx`
|
||||
- Fork the [https://github.com/cerc-io/laconic-testnet](https://github.com/cerc-io/laconic-testnet) repository
|
||||
- Upload your gentx file in the `laconic_81337-5/config/gentxs` folder
|
||||
- Submit Pull Request to [https://github.com/cerc-io/laconic-testnet](https://github.com/cerc-io/laconic-testnet) with name `ADD <your-moniker> gentx`
|
||||
|
||||
The genesis file will be published in the `laconic_81337-4/config/` folder within the [https://github.com/cerc-io/laconic-testnet]() repository.
|
||||
The genesis file will be published in the `laconic_81337-5/config/` folder within the [https://github.com/cerc-io/laconic-testnet](https://github.com/cerc-io/laconic-testnet) repository.
|
||||
|
||||
# CONTINUE WITH BELOW STEPS ONLY AFTER GENESIS FILE HAS BEEN PUBLISHED
|
||||
|
||||
@@ -213,11 +211,16 @@ The genesis file will be published in the `laconic_81337-4/config/` folder withi
|
||||
# Set seed & peers variable
|
||||
seeds="<seeds node list here>"
|
||||
peers="<peers node list here>"
|
||||
external_address="<node public IP address>"
|
||||
moniker="<your moniker>"
|
||||
|
||||
# Update seeds, persistent_peers and prometheus parameters in config.toml
|
||||
sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/; s/^persistent_peers *=.*/persistent_peers = \"$peers\"/; s/^prometheus *=.*/prometheus = true/" $HOME/.laconicd/config/config.toml
|
||||
sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/; s/^persistent_peers *=.*/persistent_peers = \"$peers\"/; s/^prometheus *=.*/prometheus = true/; s/^moniker *=.*/moniker = \"$moniker\"/; s/^external_address *=.*/external_address = \"tcp:\/\/$external_address:26656\"/" $HOME/.laconicd/config/config.toml
|
||||
```
|
||||
---
|
||||
|
||||
# Create systemd validator service
|
||||
## Create systemd validator service (skip for Docker)
|
||||
```sh
|
||||
sudo tee /etc/systemd/system/laconicd.service > /dev/null <<EOF
|
||||
[Unit]
|
||||
Description=laconicd Daemon
|
||||
@@ -225,7 +228,7 @@ After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=$USER
|
||||
ExecStart=$(which laconicd) start --mode validator --gql-playground --gql-server --log_level=warn
|
||||
ExecStart=$(which laconicd) start --gql-playground --gql-server --log_level=warn
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
LimitNOFILE=65535
|
||||
@@ -246,9 +249,7 @@ Check status of service
|
||||
sudo systemctl status laconicd
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Helpful Commands
|
||||
### Helpful Commands for systemd service
|
||||
|
||||
```sh
|
||||
# Check logs
|
||||
@@ -263,12 +264,47 @@ journalctl --since "1 day ago" -u laconicd
|
||||
# Check logs with follow flag
|
||||
journalctl -f -u laconicd
|
||||
|
||||
```
|
||||
---
|
||||
## Run validator node in Docker container
|
||||
### Create docker container
|
||||
In this example the Tendermint RPC and Prometheus metrics ports are exposed only to localhost. You may want to change 127.0.0.1 to private or public network interface of your host if you need to access these ports remotely.
|
||||
|
||||
```sh
|
||||
docker create --name laconic-testnet-5 -v ~/.laconicd:/root/.laconicd -p 26656:26656 -p 127.0.0.1:26657:26657 -p 127.0.0.1:26660:26660 git.vdb.to/cerc-io/laconicd/laconicd:v0.6.0 laconicd start --gql-playground --gql-server --log_level=warn
|
||||
```
|
||||
|
||||
### Run validator node
|
||||
|
||||
```sh
|
||||
docker start laconic-testnet-5
|
||||
```
|
||||
|
||||
### Check validator node logs
|
||||
|
||||
```sh
|
||||
docker logs laconic-testnet-5
|
||||
```
|
||||
|
||||
### Run shell inside docker container
|
||||
|
||||
```sh
|
||||
docker exec -ti laconic-testnet-5 /bin/sh
|
||||
```
|
||||
---
|
||||
## Helpful commands
|
||||
|
||||
```sh
|
||||
# Check discovered peers
|
||||
curl http://localhost:26657/net_info
|
||||
|
||||
# Check network consensus state
|
||||
curl http://localhost:26657/consensus_state
|
||||
|
||||
# Check the sync status of your validator node
|
||||
# Check the sync status of your validator node (for docker need to run shell inside the container fist)
|
||||
laconicd status | jq .SyncInfo
|
||||
```
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand" // #nosec G702
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
@@ -19,6 +20,9 @@ import (
|
||||
|
||||
"github.com/cerc-io/laconicd/x/auction/client/cli"
|
||||
"github.com/cerc-io/laconicd/x/auction/keeper"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
|
||||
"github.com/cerc-io/laconicd/x/auction/simulation"
|
||||
"github.com/cerc-io/laconicd/x/auction/types"
|
||||
)
|
||||
|
||||
@@ -140,3 +144,25 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
||||
gs := ExportGenesis(ctx, am.keeper)
|
||||
return cdc.MustMarshalJSON(&gs)
|
||||
}
|
||||
|
||||
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
|
||||
simulation.RandomizedGenState(simState)
|
||||
}
|
||||
|
||||
// WeightedOperations returns the all the fee market module operations with their respective weights.
|
||||
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RandomizedParams creates randomized fee market param changes for the simulator.
|
||||
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterStoreDecoder registers a decoder for fee market module's types
|
||||
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {}
|
||||
|
||||
// ProposalContents doesn't return any content functions for governance proposals.
|
||||
func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package simulation
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
"github.com/cerc-io/laconicd/x/auction/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// RandomizedGenState generates a random GenesisState
|
||||
func RandomizedGenState(simState *module.SimulationState) {
|
||||
auctionParams := types.NewParams(time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
)
|
||||
|
||||
auctionGenesis := types.NewGenesisState(auctionParams, []*types.Auction{})
|
||||
|
||||
bz, err := json.MarshalIndent(auctionGenesis, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
||||
|
||||
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(auctionGenesis)
|
||||
}
|
||||
@@ -4,6 +4,14 @@ package types
|
||||
// chain config values.
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: DefaultParams(),
|
||||
Params: DefaultParams(),
|
||||
Auctions: []*Auction{},
|
||||
}
|
||||
}
|
||||
|
||||
func NewGenesisState(params Params, auctions []*Auction) *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: params,
|
||||
Auctions: auctions,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,14 @@ var (
|
||||
|
||||
var _ types.ParamSet = &Params{}
|
||||
|
||||
func NewParams() Params {
|
||||
return DefaultParams()
|
||||
func NewParams(commitsDuration time.Duration, revealsDuration time.Duration, commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params {
|
||||
return Params{
|
||||
CommitsDuration: commitsDuration,
|
||||
RevealsDuration: revealsDuration,
|
||||
CommitFee: commitFee,
|
||||
RevealFee: revealFee,
|
||||
MinimumBid: minimumBid,
|
||||
}
|
||||
}
|
||||
|
||||
// ParamKeyTable - ParamTable for bond module.
|
||||
|
||||
@@ -4,15 +4,18 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand" // #nosec G702
|
||||
|
||||
"github.com/cerc-io/laconicd/x/bond/client/cli"
|
||||
"github.com/cerc-io/laconicd/x/bond/keeper"
|
||||
"github.com/cerc-io/laconicd/x/bond/simulation"
|
||||
"github.com/cerc-io/laconicd/x/bond/types"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -99,6 +102,28 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
||||
return cdc.MustMarshalJSON(&gs)
|
||||
}
|
||||
|
||||
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
|
||||
simulation.RandomizedGenState(simState)
|
||||
}
|
||||
|
||||
// WeightedOperations returns the all the fee market module operations with their respective weights.
|
||||
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RandomizedParams creates randomized fee market param changes for the simulator.
|
||||
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterStoreDecoder registers a decoder for fee market module's types
|
||||
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {}
|
||||
|
||||
// ProposalContents doesn't return any content functions for governance proposals.
|
||||
func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (am AppModule) RegisterInvariants(registry sdk.InvariantRegistry) {
|
||||
keeper.RegisterInvariants(registry, am.keeper)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package simulation
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
"github.com/cerc-io/laconicd/x/bond/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// RandomizedGenState generates a random GenesisState
|
||||
func RandomizedGenState(simState *module.SimulationState) {
|
||||
bondParams := types.NewParams(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))))
|
||||
bondGenesis := types.NewGenesisState(bondParams, []*types.Bond{})
|
||||
|
||||
bz, err := json.MarshalIndent(bondGenesis, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
||||
|
||||
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(bondGenesis)
|
||||
}
|
||||
@@ -5,5 +5,13 @@ package types
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: DefaultParams(),
|
||||
Bonds: []*Bond{},
|
||||
}
|
||||
}
|
||||
|
||||
func NewGenesisState(params Params, bonds []*Bond) *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: params,
|
||||
Bonds: bonds,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ func (k Keeper) GetRecord(ctx sdk.Context, id string) (record types.Record) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
result := store.Get(GetRecordIndexKey(id))
|
||||
k.cdc.MustUnmarshal(result, &record)
|
||||
return record
|
||||
return recordObjToRecord(store, record)
|
||||
}
|
||||
|
||||
// ListRecords - get all records.
|
||||
|
||||
@@ -4,15 +4,18 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand" // #nosec G702
|
||||
|
||||
"github.com/cerc-io/laconicd/x/nameservice/client/cli"
|
||||
"github.com/cerc-io/laconicd/x/nameservice/keeper"
|
||||
"github.com/cerc-io/laconicd/x/nameservice/simulation"
|
||||
"github.com/cerc-io/laconicd/x/nameservice/types"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -89,6 +92,28 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
||||
return cdc.MustMarshalJSON(&gs)
|
||||
}
|
||||
|
||||
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
|
||||
simulation.RandomizedGenState(simState)
|
||||
}
|
||||
|
||||
// WeightedOperations returns the all the fee market module operations with their respective weights.
|
||||
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RandomizedParams creates randomized fee market param changes for the simulator.
|
||||
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterStoreDecoder registers a decoder for fee market module's types
|
||||
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {}
|
||||
|
||||
// ProposalContents doesn't return any content functions for governance proposals.
|
||||
func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (am AppModule) RegisterInvariants(registry sdk.InvariantRegistry) {
|
||||
keeper.RegisterInvariants(registry, am.keeper)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package simulation
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
"github.com/cerc-io/laconicd/x/nameservice/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// RandomizedGenState generates a random GenesisState
|
||||
func RandomizedGenState(simState *module.SimulationState) {
|
||||
nameserviceParams := types.NewParams(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
false,
|
||||
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
)
|
||||
|
||||
nameserviceGenesis := types.NewGenesisState(nameserviceParams, []types.Record{}, []types.AuthorityEntry{}, []types.NameEntry{})
|
||||
|
||||
bz, err := json.MarshalIndent(nameserviceGenesis, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
||||
|
||||
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&nameserviceGenesis)
|
||||
}
|
||||
@@ -13,7 +13,10 @@ func NewGenesisState(params Params, records []Record, authorities []AuthorityEnt
|
||||
// chain config values.
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: DefaultParams(),
|
||||
Params: DefaultParams(),
|
||||
Records: []Record{},
|
||||
Authorities: []AuthorityEntry{},
|
||||
Names: []NameEntry{},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user