Compare commits
26 Commits
roy/graphq
...
main
Author | SHA1 | Date | |
---|---|---|---|
81c0402803 | |||
322d6f188b | |||
1ea6d6b647 | |||
d65dcce302 | |||
1833b14e25 | |||
02991c7135 | |||
348ae680c6 | |||
965d7dbb66 | |||
e7bab9b971 | |||
28b9207bbe | |||
055cfb2255 | |||
776799ea02 | |||
9c240f1a0c | |||
ec70c9f36b | |||
ed81bba3ed | |||
ae07fc0147 | |||
588c52c0b2 | |||
c407145c31 | |||
8077a7a85a | |||
47d086111d | |||
880367d5df | |||
0adc932400 | |||
d57743bfd5 | |||
20a6828bb5 | |||
976a97234f | |||
072b174c9b |
@ -1,5 +1,7 @@
|
||||
# localnet-setup
|
||||
localnet-setup
|
||||
Dockerfile
|
||||
|
||||
# build
|
||||
build
|
||||
**/node_modules
|
||||
init.sh
|
||||
|
||||
build
|
||||
localnet-setup
|
17
.gitea/workflows/build.yml
Normal file
17
.gitea/workflows/build.yml
Normal file
@ -0,0 +1,17 @@
|
||||
name: Build
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.21
|
||||
check-latest: true
|
||||
- run: |
|
||||
make build
|
20
.gitea/workflows/deploy-contract.yml
Normal file
20
.gitea/workflows/deploy-contract.yml
Normal file
@ -0,0 +1,20 @@
|
||||
name: Deploy Contract
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.21
|
||||
check-latest: true
|
||||
- name: Test contract
|
||||
run: |
|
||||
make contract-tools
|
||||
# This seems to be an empty placeholder.
|
||||
make test-contract
|
@ -20,7 +20,7 @@ jobs:
|
||||
- name: Tag docker image
|
||||
run: docker tag git.vdb.to/cerc-io/laconicd/laconicd:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/laconicd/laconicd:${{steps.vars.outputs.tag}}
|
||||
- name: Docker Login
|
||||
run: echo ${{ secrets.GITEA_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin
|
||||
run: echo ${{ secrets.CICD_PUBLISH_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin
|
||||
- name: Docker Push
|
||||
run: docker push git.vdb.to/cerc-io/laconicd/laconicd:${{steps.vars.outputs.sha}}
|
||||
- name: Docker Push TAGGED
|
@ -15,14 +15,14 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
go-version: 1.21
|
||||
check-latest: true
|
||||
- name: release dry run
|
||||
run: make release-dry-run
|
||||
- name: setup release environment
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.CICD_PUBLISH_TOKEN }}
|
||||
run: |-
|
||||
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env
|
||||
echo 'GITHUB_TOKEN=${{secrets.CICD_PUBLISH_TOKEN}}' > .release-env
|
||||
- name: release publish
|
||||
run: make release
|
@ -16,37 +16,27 @@ jobs:
|
||||
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
go-version: 1.21
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- uses: golangci/golangci-lint-action@v3.3.1
|
||||
with:
|
||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||
version: latest
|
||||
args: --timeout 10m
|
||||
github-token: ${{ secrets.github_token }}
|
||||
# Check only if there are differences in the source code
|
||||
if: env.GIT_DIFF
|
||||
|
||||
python-lint:
|
||||
# For compatibility with Gitea
|
||||
env:
|
||||
USER: root
|
||||
name: Run flake8 on python integration tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v18
|
||||
- uses: cachix/install-nix-action@v20
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
name: ethermint
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.py
|
||||
- run: |
|
||||
nix-shell -I nixpkgs=./nix -p test-env --run "make lint-py"
|
||||
if: env.GIT_DIFF
|
21
.gitea/workflows/test-importer.yml
Normal file
21
.gitea/workflows/test-importer.yml
Normal file
@ -0,0 +1,21 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
test-importer:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.21
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- name: test-importer
|
||||
run: |
|
||||
make test-import
|
21
.gitea/workflows/test-rpc.yml
Normal file
21
.gitea/workflows/test-rpc.yml
Normal file
@ -0,0 +1,21 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
test-rpc:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.21
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- name: Test rpc endpoint
|
||||
run: |
|
||||
make test-rpc
|
40
.gitea/workflows/test-sdk-auction.yml
Normal file
40
.gitea/workflows/test-sdk-auction.yml
Normal file
@ -0,0 +1,40 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconic-sdk
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconic-sdk/"
|
||||
repository: cerc-io/laconic-sdk
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
|
||||
- name: Build laconicd container
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
|
||||
- name: Build laconic-sdk container
|
||||
working-directory: laconic-sdk
|
||||
run: ./scripts/build-sdk-test-container.sh
|
||||
|
||||
- name: Start containers (auctions enabled)
|
||||
working-directory: tests/sdk_tests
|
||||
env:
|
||||
TEST_AUCTION_ENABLED: true
|
||||
run: docker compose up -d
|
||||
|
||||
- name: Run auction tests
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./run-tests.sh test:auctions
|
40
.gitea/workflows/test-sdk-nameservice.yml
Normal file
40
.gitea/workflows/test-sdk-nameservice.yml
Normal file
@ -0,0 +1,40 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconic-sdk
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconic-sdk/"
|
||||
repository: cerc-io/laconic-sdk
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
|
||||
- name: Build laconicd container
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
|
||||
- name: Build laconic-sdk container
|
||||
working-directory: laconic-sdk
|
||||
run: ./scripts/build-sdk-test-container.sh
|
||||
|
||||
- name: Start containers (expiry enabled)
|
||||
working-directory: tests/sdk_tests
|
||||
env:
|
||||
TEST_REGISTRY_EXPIRY: true
|
||||
run: docker compose up -d
|
||||
|
||||
- name: Run nameservice expiry tests
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./run-tests.sh test:nameservice-expiry
|
38
.gitea/workflows/test-sdk.yml
Normal file
38
.gitea/workflows/test-sdk.yml
Normal file
@ -0,0 +1,38 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconic-sdk
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconic-sdk/"
|
||||
repository: cerc-io/laconic-sdk
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
|
||||
- name: Build laconicd container
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
|
||||
- name: Build laconic-sdk container
|
||||
working-directory: laconic-sdk
|
||||
run: ./scripts/build-sdk-test-container.sh
|
||||
|
||||
- name: Start containers
|
||||
working-directory: tests/sdk_tests
|
||||
run: docker compose up -d
|
||||
|
||||
- name: Run tests
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./run-tests.sh
|
23
.gitea/workflows/test-unit.yml
Normal file
23
.gitea/workflows/test-unit.yml
Normal file
@ -0,0 +1,23 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
test-unit:
|
||||
# This test case doesn't work in CI, run as root.
|
||||
env:
|
||||
SKIP_UNIT_TESTS: TestInitConfigNonNotExistError
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.21
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- name: Test
|
||||
run: |
|
||||
make test-unit
|
5
.github/CODEOWNERS
vendored
5
.github/CODEOWNERS
vendored
@ -1,5 +0,0 @@
|
||||
# CODEOWNERS: https://help.github.com/articles/about-codeowners/
|
||||
|
||||
# Primary (global) repo maintainers
|
||||
|
||||
* @evmos/core-engineering
|
18
.github/ISSUE_TEMPLATE/bug-report.md
vendored
18
.github/ISSUE_TEMPLATE/bug-report.md
vendored
@ -1,18 +0,0 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: create a bug report
|
||||
---
|
||||
|
||||
__System info:__ [Include Ethermint commit, operating system name, and other relevant details]
|
||||
|
||||
__Steps to reproduce:__
|
||||
|
||||
1. [First Step]
|
||||
2. [Second Step]
|
||||
3. [and so on...]
|
||||
|
||||
__Expected behavior:__ [What you expected to happen]
|
||||
|
||||
__Actual behavior:__ [What actually happened]
|
||||
|
||||
__Additional info:__ [Include gist of relevant config, logs, etc.]
|
15
.github/ISSUE_TEMPLATE/feature-request.md
vendored
15
.github/ISSUE_TEMPLATE/feature-request.md
vendored
@ -1,15 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Opening a feature request kicks off a discussion
|
||||
|
||||
---
|
||||
|
||||
__Proposal:__ [Description of the feature]
|
||||
|
||||
__Current behavior:__ [What currently happens]
|
||||
|
||||
__Desired behavior:__ [What you would like to happen]
|
||||
|
||||
__Use case:__ [Why is this important (helps with prioritizing requests)]
|
||||
|
||||
Requests may be closed if we're not actively planning to work on them.
|
34
.github/PULL_REQUEST_TEMPLATE.md
vendored
34
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,34 +0,0 @@
|
||||
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
|
||||
v ✰ Thanks for creating a PR! ✰
|
||||
v Before smashing the submit button please review the checkboxes.
|
||||
v If a checkbox is n/a - please still include it but + a little note why
|
||||
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -->
|
||||
|
||||
Closes: #XXX
|
||||
|
||||
## Description
|
||||
|
||||
<!-- Add a description of the changes that this PR introduces and the files that
|
||||
are the most critical to review.
|
||||
-->
|
||||
|
||||
______
|
||||
|
||||
For contributor use:
|
||||
|
||||
- [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
|
||||
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
|
||||
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
|
||||
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
|
||||
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
|
||||
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
|
||||
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
|
||||
- [ ] Re-reviewed `Files changed` in the Github PR explorer
|
||||
|
||||
______
|
||||
|
||||
For admin use:
|
||||
|
||||
- [ ] Added appropriate labels to PR (ex. `WIP`, `R4R`, `docs`, etc)
|
||||
- [ ] Reviewers assigned
|
||||
- [ ] Squashed all commits, uses message "Merge pull request #XYZ: [title]" ([coding standards](https://github.com/tendermint/coding/blob/master/README.md#merging-a-pr))
|
37
.github/labeler.yml
vendored
37
.github/labeler.yml
vendored
@ -1,37 +0,0 @@
|
||||
"C:Crypto":
|
||||
- crypto/**/*
|
||||
"C:Encoding":
|
||||
- encoding/**/*
|
||||
"C:JSON-RPC":
|
||||
- ethereum/rpc/**/*
|
||||
"C:Proto":
|
||||
- proto/**/*
|
||||
- third_party/**/*
|
||||
- /**/*.pb.go
|
||||
- /**/*.pb.gw.go
|
||||
"C:Types":
|
||||
- types/**/*
|
||||
"C:x/evm":
|
||||
- x/evm/**/*/
|
||||
"Type: Build":
|
||||
- Makefile
|
||||
- Dockerfile
|
||||
- docker-compose.yml
|
||||
- scripts/*
|
||||
- config.yml
|
||||
"Type: CI":
|
||||
- .github/**/*.yml
|
||||
- buf.yaml
|
||||
- .mergify.yml
|
||||
- .golangci.yml
|
||||
"C:CLI":
|
||||
- client/**/*
|
||||
- x/*/client/**/*
|
||||
"Type: Tests":
|
||||
- tests/**/*
|
||||
- /**/*/*_test.go
|
||||
"Type: Docs":
|
||||
- docs/**/*
|
||||
- x/*/spec/**/*
|
||||
"Type: ADR":
|
||||
- docs/architecture/**/*
|
33
.github/workflows/build.yml
vendored
33
.github/workflows/build.yml
vendored
@ -1,33 +0,0 @@
|
||||
name: Build
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
cleanup-runs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
check-latest: true
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
id: git_diff
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- run: |
|
||||
make build
|
||||
if: env.GIT_DIFF
|
84
.github/workflows/codeql-analysis.yml
vendored
84
.github/workflows/codeql-analysis.yml
vendored
@ -1,84 +0,0 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ main ]
|
||||
schedule:
|
||||
- cron: '37 21 * * 4'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'go' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.sol
|
||||
**/**.go
|
||||
**/**.ts
|
||||
**/**.js
|
||||
go.mod
|
||||
go.sum
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality
|
||||
if: env.GIT_DIFF
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
if: env.GIT_DIFF
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
if: env.GIT_DIFF
|
28
.github/workflows/dependencies.yml
vendored
28
.github/workflows/dependencies.yml
vendored
@ -1,28 +0,0 @@
|
||||
name: "Dependency Review"
|
||||
on: pull_request
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
dependency-review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
check-latest: true
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: "Dependency Review"
|
||||
uses: actions/dependency-review-action@v3
|
||||
if: env.GIT_DIFF
|
||||
- name: "Go vulnerability check"
|
||||
run: make vulncheck
|
||||
if: env.GIT_DIFF
|
38
.github/workflows/deploy-contract.yml
vendored
38
.github/workflows/deploy-contract.yml
vendored
@ -1,38 +0,0 @@
|
||||
name: Deploy Contract
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
cleanup-runs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
id: git_diff
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.sol
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Test contract
|
||||
run: |
|
||||
sudo make contract-tools
|
||||
sudo make test-contract
|
||||
if: env.GIT_DIFF
|
29
.github/workflows/issues-notion-sync.yml
vendored
29
.github/workflows/issues-notion-sync.yml
vendored
@ -1,29 +0,0 @@
|
||||
name: Notion Sync
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
issues:
|
||||
types:
|
||||
[
|
||||
opened,
|
||||
edited,
|
||||
labeled,
|
||||
unlabeled,
|
||||
assigned,
|
||||
unassigned,
|
||||
milestoned,
|
||||
demilestoned,
|
||||
reopened,
|
||||
closed,
|
||||
]
|
||||
|
||||
jobs:
|
||||
notion_job:
|
||||
runs-on: ubuntu-latest
|
||||
name: Add GitHub Issues to Notion
|
||||
steps:
|
||||
- name: Add GitHub Issues to Notion
|
||||
uses: vulcanize/notion-github-action@v1.2.4-issueid
|
||||
with:
|
||||
notion-token: ${{ secrets.NOTION_TOKEN }}
|
||||
notion-db: ${{ secrets.NOTION_DATABASE }}
|
14
.github/workflows/labeler.yml
vendored
14
.github/workflows/labeler.yml
vendored
@ -1,14 +0,0 @@
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v4
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
37
.github/workflows/security.yml
vendored
37
.github/workflows/security.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: Run Gosec
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
Gosec:
|
||||
permissions:
|
||||
security-events: write
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v3
|
||||
- name: Get Diff
|
||||
uses: technote-space/get-diff-action@v6.1.2
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/*.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Run Gosec Security Scanner
|
||||
uses: cosmos/gosec@master
|
||||
with:
|
||||
# we let the report trigger content trigger a failure using the GitHub Security features.
|
||||
args: '-no-fail -fmt sarif -out results.sarif -exclude=G701,G703 ./...'
|
||||
if: "env.GIT_DIFF_FILTERED != ''"
|
||||
- name: Upload SARIF file
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
# Path to SARIF file relative to the root of the repository
|
||||
sarif_file: results.sarif
|
||||
if: "env.GIT_DIFF_FILTERED != ''"
|
45
.github/workflows/semgrep.yml
vendored
45
.github/workflows/semgrep.yml
vendored
@ -1,45 +0,0 @@
|
||||
name: Semgrep
|
||||
on:
|
||||
# Scan changed files in PRs, block on new issues only (existing issues ignored)
|
||||
pull_request: {}
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/workflows/semgrep.yml
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
jobs:
|
||||
# Update from: https://semgrep.dev/docs/semgrep-ci/sample-ci-configs/#github-actions
|
||||
semgrep:
|
||||
name: Scan
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: returntocorp/semgrep
|
||||
if: (github.actor != 'dependabot[bot]')
|
||||
steps:
|
||||
- name: Permission issue fix
|
||||
run: git config --global --add safe.directory /__w/laconicd/laconicd
|
||||
- uses: actions/checkout@v3
|
||||
- name: Get Diff
|
||||
uses: technote-space/get-diff-action@v6.1.2
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/*.go
|
||||
**/*.js
|
||||
**/*.ts
|
||||
**/*.sol
|
||||
go.mod
|
||||
go.sum
|
||||
- uses: actions/checkout@v3
|
||||
- run: semgrep scan --sarif --output=semgrep.sarif --config auto
|
||||
env:
|
||||
# Upload findings to GitHub Advanced Security Dashboard [step 1/2]
|
||||
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
|
||||
if: "env.GIT_DIFF_FILTERED != ''"
|
||||
# Upload findings to GitHub Advanced Security Dashboard [step 2/2]
|
||||
- name: Upload SARIF file
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: semgrep.sarif
|
||||
if: "env.GIT_DIFF_FILTERED != ''"
|
21
.github/workflows/stale.yml
vendored
21
.github/workflows/stale.yml
vendored
@ -1,21 +0,0 @@
|
||||
name: "Close stale issues & pull requests"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-pr-message: "This pull request has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed in 7 days-before-close if no further activity occurs."
|
||||
stale-issue-message: "This issue is stale because it has been open 45 days with no activity. Remove `Status: Stale` label or comment or this will be closed in 7 days."
|
||||
days-before-stale: 45
|
||||
days-before-close: 7
|
||||
exempt-issue-labels: "Status: Blocked, Type: Bug, pinned, automerge"
|
||||
exempt-pr-labels: "Status: Blocked, Type: Bug, pinned, automerge"
|
||||
stale-pr-label: "Status: Stale"
|
||||
stale-issue-label: "Status: Stale"
|
176
.github/workflows/test.yml
vendored
176
.github/workflows/test.yml
vendored
@ -1,176 +0,0 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
cleanup-runs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
|
||||
|
||||
test-unit-cover:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Test and Create Coverage Report
|
||||
run: |
|
||||
make test-unit-cover
|
||||
if: env.GIT_DIFF
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage.txt
|
||||
fail_ci_if_error: false
|
||||
if: env.GIT_DIFF
|
||||
|
||||
test-importer:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
id: git_diff
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: test-importer
|
||||
run: |
|
||||
make test-import
|
||||
if: env.GIT_DIFF
|
||||
|
||||
test-rpc:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6.1.2
|
||||
with:
|
||||
PATTERNS: |
|
||||
**/**.sol
|
||||
**/**.go
|
||||
go.mod
|
||||
go.sum
|
||||
- name: Test rpc endpoint
|
||||
run: |
|
||||
make test-rpc
|
||||
if: env.GIT_DIFF
|
||||
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconic-sdk
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconic-sdk/"
|
||||
repository: cerc-io/laconic-sdk
|
||||
fetch-depth: 0
|
||||
ref: jest_timeout
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
- name: build containers scripts
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh && ./build-sdk-test-container.sh
|
||||
- name: start containers
|
||||
working-directory: tests/sdk_tests
|
||||
run: docker compose up -d
|
||||
- name: run-tests.sh
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./run-tests.sh
|
||||
- name: reset containers for auction tests
|
||||
working-directory: tests/sdk_tests
|
||||
if: always()
|
||||
run: docker compose down
|
||||
- name: start auction containers
|
||||
working-directory: tests/sdk_tests
|
||||
run: docker compose -f docker-compose-auctions.yml up -d
|
||||
- name: run-acution-tests.sh
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./run-auction-tests.sh
|
||||
- name: reset containers for nameservice tests
|
||||
working-directory: tests/sdk_tests
|
||||
if: always()
|
||||
run: docker compose -f docker-compose-auctions.yml down
|
||||
- name: start auction containers
|
||||
working-directory: tests/sdk_tests
|
||||
run: docker compose -f docker-compose-nameservice.yml up -d
|
||||
- name: run-nameservice-expiry-tests.sh
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./run-nameservice-expiry-tests.sh
|
||||
- name: reset containers for nameservice tests
|
||||
working-directory: tests/sdk_tests
|
||||
if: always()
|
||||
run: docker compose -f docker-compose-nameservice.yml down
|
||||
|
||||
# integration_tests:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - uses: cachix/install-nix-action@v18
|
||||
# - uses: cachix/cachix-action@v12
|
||||
# with:
|
||||
# name: ethermint
|
||||
# signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
|
||||
# - uses: technote-space/get-diff-action@v6.1.2
|
||||
# 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@v12
|
||||
# with:
|
||||
# name: ethermint
|
||||
# signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
|
||||
# - name: 'instantiate integration test env'
|
||||
# run: nix-store -r "$(nix-instantiate tests/integration_tests/shell.nix)"
|
@ -6,14 +6,13 @@ run:
|
||||
linters:
|
||||
enable:
|
||||
- bodyclose
|
||||
- depguard
|
||||
# - depguard # 20231120 disable until https://github.com/golangci/golangci-lint/issues/3906 is released
|
||||
- dogsled
|
||||
- dupl
|
||||
- errcheck
|
||||
- goconst
|
||||
- gocritic
|
||||
- gofumpt
|
||||
- revive
|
||||
# - revive # 20231120 overly sensitive unused detection
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
|
12
Dockerfile
12
Dockerfile
@ -1,14 +1,14 @@
|
||||
FROM golang:alpine AS build-env
|
||||
|
||||
# Set up dependencies
|
||||
ENV PACKAGES git build-base
|
||||
# Install dependencies
|
||||
RUN apk add --update git build-base linux-headers
|
||||
|
||||
# Set working directory for the build
|
||||
WORKDIR /go/src/github.com/cerc-io/laconicd
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --update $PACKAGES
|
||||
RUN apk add linux-headers
|
||||
# Cache Go modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Add source files
|
||||
COPY . .
|
||||
@ -21,10 +21,10 @@ FROM alpine:3.17.0
|
||||
|
||||
# Install ca-certificates
|
||||
RUN apk add --update ca-certificates jq curl
|
||||
WORKDIR /
|
||||
|
||||
# Copy over binaries from the build-env
|
||||
COPY --from=build-env /go/src/github.com/cerc-io/laconicd/build/laconicd /usr/bin/laconicd
|
||||
|
||||
WORKDIR /
|
||||
# Run laconicd by default
|
||||
CMD ["laconicd"]
|
||||
|
14
Makefile
14
Makefile
@ -72,7 +72,7 @@ ifeq ($(ENABLE_ROCKSDB),true)
|
||||
BUILD_TAGS += rocksdb_build
|
||||
test_tags += rocksdb_build
|
||||
else
|
||||
$(warning RocksDB support is disabled; to build and test with RocksDB support, set ENABLE_ROCKSDB=true)
|
||||
$(info RocksDB support is disabled; to build and test with RocksDB support, set ENABLE_ROCKSDB=true)
|
||||
endif
|
||||
|
||||
# DB backend selection
|
||||
@ -145,7 +145,7 @@ docker-build:
|
||||
# update old container
|
||||
docker rm laconicd || true
|
||||
# create a new container from the latest image
|
||||
docker create --name laconic -t -i cerc-io/laconicd:latest laconicd
|
||||
docker create --name laconic -t -i ${DOCKER_IMAGE}:${DOCKER_TAG} laconicd
|
||||
# move the binaries to the ./build directory
|
||||
mkdir -p ./build/
|
||||
docker cp laconic:/usr/bin/laconicd ./build/
|
||||
@ -237,7 +237,7 @@ endif
|
||||
|
||||
ifeq (, $(shell which go-bindata))
|
||||
@echo "Installing go-bindata..."
|
||||
@go get github.com/kevinburke/go-bindata/go-bindata
|
||||
@go get github.com/kevinburke/go-bindata/go-bindata@v3
|
||||
else
|
||||
@echo "go-bindata already installed; skipping..."
|
||||
endif
|
||||
@ -316,7 +316,7 @@ TEST_TARGETS := test-unit test-unit-cover test-race
|
||||
# Test runs-specific rules. To add a new test target, just add
|
||||
# a new rule, customise ARGS or TEST_PACKAGES ad libitum, and
|
||||
# append the new rule to the TEST_TARGETS list.
|
||||
test-unit: ARGS=-timeout=10m -race
|
||||
test-unit: ARGS=-timeout=10m -race -test.v -skip $(SKIP_UNIT_TESTS)
|
||||
test-unit: TEST_PACKAGES=$(PACKAGES_UNIT)
|
||||
|
||||
test-race: ARGS=-race
|
||||
@ -334,10 +334,10 @@ else
|
||||
endif
|
||||
|
||||
test-import:
|
||||
go test -run TestImporterTestSuite -v --vet=off github.com/cerc-io/laconicd/tests/importer
|
||||
go test -run TestImporterTestSuite -timeout=20m -v --vet=off github.com/cerc-io/laconicd/tests/importer
|
||||
|
||||
test-rpc:
|
||||
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true"
|
||||
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 10 -m "rpc" -r "true"
|
||||
|
||||
run-integration-tests:
|
||||
@nix-shell ./tests/integration_tests/shell.nix --run ./scripts/run-integration-tests.sh
|
||||
@ -389,7 +389,7 @@ format-fix:
|
||||
###############################################################################
|
||||
|
||||
# ------
|
||||
# NOTE: Link to the tendermintdev/sdk-proto-gen docker images:
|
||||
# NOTE: Link to the tendermintdev/sdk-proto-gen docker images:
|
||||
# https://hub.docker.com/r/tendermintdev/sdk-proto-gen/tags
|
||||
#
|
||||
protoVer=v0.7
|
||||
|
@ -24,6 +24,8 @@ import (
|
||||
"github.com/ethereum/go-ethereum/signer/core/apitypes"
|
||||
)
|
||||
|
||||
const bytesStr = "bytes"
|
||||
|
||||
// WrapTxToTypedData is an ultimate method that wraps Amino-encoded Cosmos Tx JSON data
|
||||
// into an EIP712-compatible TypedData request.
|
||||
func WrapTxToTypedData(
|
||||
@ -33,7 +35,6 @@ func WrapTxToTypedData(
|
||||
data []byte,
|
||||
feeDelegation *FeeDelegationOptions,
|
||||
) (apitypes.TypedData, error) {
|
||||
|
||||
domain := apitypes.TypedDataDomain{
|
||||
Name: "Cosmos Web3",
|
||||
Version: "1.0.0",
|
||||
@ -298,7 +299,7 @@ func traverseFields(
|
||||
}
|
||||
// convert uint8[] to bytes
|
||||
if fieldType.Kind() == reflect.Uint8 {
|
||||
ethTyp = "bytes"
|
||||
ethTyp = bytesStr
|
||||
}
|
||||
}
|
||||
if prefix == typeDefPrefix {
|
||||
@ -448,7 +449,7 @@ func typToEth(typ reflect.Type) string {
|
||||
ethName := typToEth(typ.Elem())
|
||||
if len(ethName) > 0 {
|
||||
if ethName == "uint8" {
|
||||
return "bytes"
|
||||
return bytesStr
|
||||
}
|
||||
return ethName + "[]"
|
||||
}
|
||||
@ -495,7 +496,9 @@ func patchTxData(data map[string]any, schema apitypes.Types, rootType string) er
|
||||
for _, field := range schema[rootType] {
|
||||
encType := field.Type
|
||||
encValue := data[field.Name]
|
||||
if encType[len(encType)-1:] == "]" {
|
||||
|
||||
switch {
|
||||
case encType[len(encType)-1:] == "]":
|
||||
arrayValue, ok := encValue.([]interface{})
|
||||
if !ok {
|
||||
return dataMismatchError(encType, encValue)
|
||||
@ -523,8 +526,7 @@ func patchTxData(data map[string]any, schema apitypes.Types, rootType string) er
|
||||
arrayValue[i] = converted
|
||||
}
|
||||
}
|
||||
|
||||
} else if schema[encType] != nil {
|
||||
case schema[encType] != nil:
|
||||
mapValue, ok := encValue.(map[string]interface{})
|
||||
if !ok {
|
||||
return dataMismatchError(encType, encValue)
|
||||
@ -533,7 +535,7 @@ func patchTxData(data map[string]any, schema apitypes.Types, rootType string) er
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
converted, err := handleConversion(encType, encValue)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -545,8 +547,7 @@ func patchTxData(data map[string]any, schema apitypes.Types, rootType string) er
|
||||
}
|
||||
|
||||
func handleConversion(encType string, encValue any) (any, error) {
|
||||
switch encType {
|
||||
case "bytes":
|
||||
if encType == bytesStr {
|
||||
// Protobuf encodes byte strings in base64
|
||||
if v, ok := encValue.(string); ok {
|
||||
return base64.StdEncoding.DecodeString(v)
|
||||
|
1
go.mod
1
go.mod
@ -134,6 +134,7 @@ require (
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/jmhodges/levigo v1.0.0 // indirect
|
||||
github.com/kevinburke/go-bindata v3.24.0+incompatible // indirect
|
||||
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
|
||||
github.com/klauspost/compress v1.15.11 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
||||
|
6
go.sum
6
go.sum
@ -836,6 +836,12 @@ github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E
|
||||
github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0=
|
||||
github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
|
||||
github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
|
||||
github.com/kevinburke/go-bindata v1.1.0 h1:JZ8XIdxtkAszuYkgf17qwQzcU/RgsGSVLSULJdN+5bU=
|
||||
github.com/kevinburke/go-bindata v1.1.0/go.mod h1:UJ72WTOoRKzbz+vwtKgARJwsy+1ZGUukVBUCc197TJo=
|
||||
github.com/kevinburke/go-bindata v3.22.0+incompatible h1:/JmqEhIWQ7GRScV0WjX/0tqBrC5D21ALg0H0U/KZ/ts=
|
||||
github.com/kevinburke/go-bindata v3.22.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM=
|
||||
github.com/kevinburke/go-bindata v3.24.0+incompatible h1:qajFA3D0pH94OTLU4zcCCKCDgR+Zr2cZK/RPJHDdFoY=
|
||||
github.com/kevinburke/go-bindata v3.24.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM=
|
||||
github.com/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM=
|
||||
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM=
|
||||
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc=
|
||||
|
@ -121,7 +121,7 @@ func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueI
|
||||
res, err := nsQueryClient.ListRecords(
|
||||
context.Background(),
|
||||
®istrytypes.QueryListRecordsRequest{
|
||||
Attributes: toRpcAttributes(attributes),
|
||||
Attributes: toRPCAttributes(attributes),
|
||||
All: (all != nil && *all),
|
||||
},
|
||||
)
|
||||
|
24
gql/util.go
24
gql/util.go
@ -256,43 +256,43 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au
|
||||
return &gqlAuction, nil
|
||||
}
|
||||
|
||||
func toRpcValue(value *ValueInput) *registrytypes.QueryListRecordsRequest_ValueInput {
|
||||
func toRPCValue(value *ValueInput) *registrytypes.QueryListRecordsRequest_ValueInput {
|
||||
var rpcval registrytypes.QueryListRecordsRequest_ValueInput
|
||||
|
||||
switch {
|
||||
case value == nil:
|
||||
return nil
|
||||
case value.Int != nil:
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Int{int64(*value.Int)}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Int{Int: int64(*value.Int)}
|
||||
case value.Float != nil:
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Float{*value.Float}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Float{Float: *value.Float}
|
||||
case value.String != nil:
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_String_{*value.String}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_String_{String_: *value.String}
|
||||
case value.Boolean != nil:
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Boolean{*value.Boolean}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Boolean{Boolean: *value.Boolean}
|
||||
case value.Link != nil:
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Link{value.Link.String()}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Link{Link: value.Link.String()}
|
||||
case value.Array != nil:
|
||||
var contents registrytypes.QueryListRecordsRequest_ArrayInput
|
||||
for _, val := range value.Array {
|
||||
contents.Values = append(contents.Values, toRpcValue(val))
|
||||
contents.Values = append(contents.Values, toRPCValue(val))
|
||||
}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Array{&contents}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Array{Array: &contents}
|
||||
case value.Map != nil:
|
||||
var contents registrytypes.QueryListRecordsRequest_MapInput
|
||||
for _, kv := range value.Map {
|
||||
contents.Values[kv.Key] = toRpcValue(kv.Value)
|
||||
contents.Values[kv.Key] = toRPCValue(kv.Value)
|
||||
}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Map{&contents}
|
||||
rpcval.Value = ®istrytypes.QueryListRecordsRequest_ValueInput_Map{Map: &contents}
|
||||
}
|
||||
return &rpcval
|
||||
}
|
||||
|
||||
func toRpcAttributes(attrs []*KeyValueInput) []*registrytypes.QueryListRecordsRequest_KeyValueInput {
|
||||
func toRPCAttributes(attrs []*KeyValueInput) []*registrytypes.QueryListRecordsRequest_KeyValueInput {
|
||||
kvPairs := []*registrytypes.QueryListRecordsRequest_KeyValueInput{}
|
||||
|
||||
for _, value := range attrs {
|
||||
parsedValue := toRpcValue(value.Value)
|
||||
parsedValue := toRPCValue(value.Value)
|
||||
kvPair := ®istrytypes.QueryListRecordsRequest_KeyValueInput{
|
||||
Key: value.Key,
|
||||
Value: parsedValue,
|
||||
|
211
init.sh
211
init.sh
@ -5,110 +5,137 @@ CHAINID="laconic_9000-1"
|
||||
MONIKER="localtestnet"
|
||||
KEYRING="test"
|
||||
KEYALGO="eth_secp256k1"
|
||||
LOGLEVEL="info"
|
||||
LOGLEVEL="${LOGLEVEL:-info}"
|
||||
# trace evm
|
||||
TRACE="--trace"
|
||||
# TRACE=""
|
||||
|
||||
# validate dependencies are installed
|
||||
command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; }
|
||||
if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
||||
# validate dependencies are installed
|
||||
command -v jq > /dev/null 2>&1 || {
|
||||
echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# remove existing daemon and client
|
||||
rm -rf ~/.laconic*
|
||||
# remove existing daemon and client
|
||||
rm -rf $HOME/.laconicd/*
|
||||
rm -rf $HOME/.laconic/*
|
||||
|
||||
make install
|
||||
|
||||
laconicd config keyring-backend $KEYRING
|
||||
laconicd config chain-id $CHAINID
|
||||
|
||||
# if $KEY exists it should be deleted
|
||||
laconicd keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO
|
||||
|
||||
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
|
||||
laconicd init $MONIKER --chain-id $CHAINID
|
||||
|
||||
# Change parameter token denominations to aphoton
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
# Custom modules
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["record_rent"]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_rent"]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_auction_commit_fee"]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_auction_reveal_fee"]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_auction_minimum_bid"]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
|
||||
if [[ "$TEST_REGISTRY_EXPIRY" == "true" ]]; then
|
||||
echo "Setting timers for expiry tests."
|
||||
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["record_rent_duration"]="60s"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_grace_period"]="60s"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_rent_duration"]="60s"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
fi
|
||||
|
||||
if [[ "$TEST_AUCTION_ENABLED" == "true" ]]; then
|
||||
echo "Enabling auction and setting timers."
|
||||
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_auction_enabled"]=true' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_rent_duration"]="60s"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_grace_period"]="300s"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_auction_commits_duration"]="60s"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["registry"]["params"]["authority_auction_reveals_duration"]="60s"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
fi
|
||||
|
||||
# increase block time (?)
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.consensus_params["block"]["time_iota_ms"]="1000"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
|
||||
# Set gas limit in genesis
|
||||
cat $HOME/.laconicd/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
|
||||
# disable produce empty block
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
|
||||
else
|
||||
sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
|
||||
fi
|
||||
|
||||
if [[ $1 == "pending" ]]; then
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME/.laconicd/config/config.toml
|
||||
else
|
||||
sed -i 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME/.laconicd/config/config.toml
|
||||
sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME/.laconicd/config/config.toml
|
||||
if [ -n "`which make`" ]; then
|
||||
make install
|
||||
fi
|
||||
fi
|
||||
|
||||
# Allocate genesis accounts (cosmos formatted addresses)
|
||||
laconicd add-genesis-account $KEY 100000000000000000000000000aphoton --keyring-backend $KEYRING
|
||||
laconicd config keyring-backend $KEYRING
|
||||
laconicd config chain-id $CHAINID
|
||||
|
||||
# Sign genesis transaction
|
||||
laconicd gentx $KEY 1000000000000000000000aphoton --keyring-backend $KEYRING --chain-id $CHAINID
|
||||
# if $KEY exists it should be deleted
|
||||
laconicd keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO
|
||||
|
||||
# Collect genesis tx
|
||||
laconicd collect-gentxs
|
||||
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
|
||||
laconicd init $MONIKER --chain-id $CHAINID
|
||||
|
||||
# Run this to ensure everything worked and that the genesis file is setup correctly
|
||||
laconicd validate-genesis
|
||||
update_genesis() {
|
||||
jq "$1" $HOME/.laconicd/config/genesis.json > $HOME/.laconicd/config/tmp_genesis.json &&
|
||||
mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
||||
}
|
||||
|
||||
if [[ $1 == "pending" ]]; then
|
||||
echo "pending mode is on, please wait for the first block committed."
|
||||
# Change parameter token denominations to aphoton
|
||||
update_genesis '.app_state["staking"]["params"]["bond_denom"]="aphoton"'
|
||||
update_genesis '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"'
|
||||
update_genesis '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"'
|
||||
update_genesis '.app_state["mint"]["params"]["mint_denom"]="aphoton"'
|
||||
# Custom modules
|
||||
update_genesis '.app_state["registry"]["params"]["record_rent"]["denom"]="aphoton"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_rent"]["denom"]="aphoton"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_auction_commit_fee"]["denom"]="aphoton"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_auction_reveal_fee"]["denom"]="aphoton"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_auction_minimum_bid"]["denom"]="aphoton"'
|
||||
|
||||
if [[ "$TEST_REGISTRY_EXPIRY" == "true" ]]; then
|
||||
echo "Setting timers for expiry tests."
|
||||
|
||||
update_genesis '.app_state["registry"]["params"]["record_rent_duration"]="60s"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_grace_period"]="60s"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_rent_duration"]="60s"'
|
||||
fi
|
||||
|
||||
if [[ "$TEST_AUCTION_ENABLED" == "true" ]]; then
|
||||
echo "Enabling auction and setting timers."
|
||||
|
||||
update_genesis '.app_state["registry"]["params"]["authority_auction_enabled"]=true'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_rent_duration"]="60s"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_grace_period"]="300s"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_auction_commits_duration"]="60s"'
|
||||
update_genesis '.app_state["registry"]["params"]["authority_auction_reveals_duration"]="60s"'
|
||||
fi
|
||||
|
||||
# increase block time (?)
|
||||
update_genesis '.consensus_params["block"]["time_iota_ms"]="1000"'
|
||||
|
||||
# Set gas limit in genesis
|
||||
update_genesis '.consensus_params["block"]["max_gas"]="10000000"'
|
||||
|
||||
# disable produce empty block
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
|
||||
else
|
||||
sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
|
||||
fi
|
||||
|
||||
if [[ "$1" == "pending" ]]; then
|
||||
alias sed-i="sed -i"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
alias sed-i="sed -i ''"
|
||||
fi
|
||||
sed-i \
|
||||
-e 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' \
|
||||
-e 's/timeout_propose = "3s"/timeout_propose = "30s"/g' \
|
||||
-e 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' \
|
||||
-e 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' \
|
||||
-e 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' \
|
||||
-e 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' \
|
||||
-e 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' \
|
||||
-e 's/timeout_commit = "5s"/timeout_commit = "150s"/g' \
|
||||
-e 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' \
|
||||
$HOME/.laconicd/config/config.toml
|
||||
fi
|
||||
|
||||
# Enable telemetry (prometheus metrics: http://localhost:1317/metrics?format=prometheus)
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' 's/enabled = false/enabled = true/g' $HOME/.laconicd/config/app.toml
|
||||
sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $HOME/.laconicd/config/app.toml
|
||||
sed -i '' 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml
|
||||
else
|
||||
sed -i 's/enabled = false/enabled = true/g' $HOME/.laconicd/config/app.toml
|
||||
sed -i 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $HOME/.laconicd/config/app.toml
|
||||
sed -i 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml
|
||||
fi
|
||||
|
||||
# Allocate genesis accounts (cosmos formatted addresses)
|
||||
laconicd add-genesis-account $KEY 100000000000000000000000000aphoton --keyring-backend $KEYRING
|
||||
|
||||
# Sign genesis transaction
|
||||
laconicd gentx $KEY 1000000000000000000000aphoton --keyring-backend $KEYRING --chain-id $CHAINID
|
||||
|
||||
# Collect genesis tx
|
||||
laconicd collect-gentxs
|
||||
|
||||
# Run this to ensure everything worked and that the genesis file is setup correctly
|
||||
laconicd validate-genesis
|
||||
|
||||
if [[ "$1" == "pending" ]]; then
|
||||
echo "pending mode is on, please wait for the first block committed."
|
||||
fi
|
||||
else
|
||||
echo "Using existing database at $HOME/.laconicd. To replace, run '`basename $0` clean'"
|
||||
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 --gql-server --gql-playground
|
||||
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
|
||||
|
@ -77,6 +77,7 @@ message QueryListRecordsRequest {
|
||||
map<string, ValueInput> values = 1;
|
||||
}
|
||||
message ValueInput {
|
||||
// Type of record attribute value
|
||||
oneof value {
|
||||
string string = 1;
|
||||
int64 int = 2;
|
||||
|
@ -5,7 +5,6 @@ import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
||||
|
||||
@ -56,7 +55,7 @@ message Params {
|
||||
];
|
||||
}
|
||||
|
||||
// Params defines the registry module records
|
||||
// Record defines a registry record
|
||||
message Record {
|
||||
string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""];
|
||||
string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
||||
@ -69,7 +68,7 @@ message Record {
|
||||
string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""];
|
||||
}
|
||||
|
||||
// AuthorityEntry defines the registry module AuthorityEntries
|
||||
// AuthorityEntry defines a registry authority
|
||||
message AuthorityEntry {
|
||||
string name = 1;
|
||||
NameAuthority entry = 2;
|
||||
@ -99,7 +98,7 @@ message NameEntry {
|
||||
NameRecord entry = 2;
|
||||
}
|
||||
|
||||
// NameRecord
|
||||
// NameRecord defines a versioned name record
|
||||
message NameRecord {
|
||||
NameRecordEntry latest = 1;
|
||||
repeated NameRecordEntry history = 2;
|
||||
@ -131,4 +130,4 @@ message BlockChangeSet {
|
||||
message AuctionBidInfo {
|
||||
string auction_id = 1 [(gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\""];
|
||||
string bidder_address = 2 [(gogoproto.moretags) = "json:\"bidderAddress\" yaml:\"bidderAddress\""];
|
||||
}
|
||||
}
|
||||
|
@ -94,11 +94,10 @@ func (s *websocketsServer) Start() {
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
/* #nosec G114 -- http functions have no support for timeouts */
|
||||
if s.certFile == "" || s.keyFile == "" {
|
||||
err = http.ListenAndServe(s.wsAddr, ws)
|
||||
err = http.ListenAndServe(s.wsAddr, ws) /* #nosec G114 -- http functions have no support for timeouts */
|
||||
} else {
|
||||
err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws)
|
||||
err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws) // #nosec G114
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
48
scripts/create-and-fund-account.sh
Executable file
48
scripts/create-and-fund-account.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
## This script generates a new account keypair, transfers funds to it, and creates
|
||||
## a bond with those funds. The amount of can be optionally specified, else a
|
||||
## default value estimated to be sufficient for about 5000 records.
|
||||
##
|
||||
## The `laconic` CLI and a valid config file for it are required. The default location
|
||||
## for the config file is `~/.laconic/config.yml`, but this can be controlled with
|
||||
## the environment variable LACONIC_CONFIG. A `userKey` for a source account with
|
||||
## sufficient funds available must be present in this file for the funds transfer
|
||||
## to succeed.
|
||||
##
|
||||
## Example:
|
||||
##
|
||||
## $ scripts/create-and-fund-account.sh 1000000000
|
||||
## {
|
||||
## "name": "68334d7175fd4f86befa4902657e5270",
|
||||
## "type": "local",
|
||||
## "address": "ethm15r5x94km0swq55aszwd7hnr9wksq7wmr38xes7",
|
||||
## "pubkey": "AuKqlSldJJXj4gYMFt2HeX9DJ3aUosYA7n6zBz9Tg7/i",
|
||||
## "mnemonic": "umbrella bean special unaware accident giant distance mix ghost feel possible cost road grant endless man maple derive rebuild learn mask water attract resist",
|
||||
## "bond": "3d3a73f09115d289d330781455e6eac217305dc4a20e19bde808011fe3775a93",
|
||||
## "balance": 1000000000,
|
||||
## "privkey": "480880fde7aff1461da584b436cb3a84692413c84623fda78e127bb4e704ce76"
|
||||
## }
|
||||
##
|
||||
|
||||
AVG_RECORD_PHOTON=1000000
|
||||
NUM_RECORDS=5000
|
||||
BOND_OVERHEAD=200000
|
||||
KEYNAME=`uuidgen | tr -d '-'`
|
||||
KEYRING_DIR=`mktemp -d`
|
||||
KEYRING=test
|
||||
LACONIC_CONFIG=${LACONIC_CONFIG:-$HOME/.laconic/config.yml}
|
||||
BOND_AMOUNT=${1:-$((AVG_RECORD_PHOTON * NUM_RECORDS))}
|
||||
|
||||
ACCOUNT_JSON=$(laconicd keys add $KEYNAME --keyring-backend $KEYRING --algo eth_secp256k1 --keyring-dir $KEYRING_DIR --output json)
|
||||
PRIVATE_KEY=$(yes | laconicd keys export $KEYNAME --keyring-backend $KEYRING --keyring-dir $KEYRING_DIR --unarmored-hex --unsafe)
|
||||
PUB_KEY=$(echo $ACCOUNT_JSON | jq -r ".pubkey | fromjson | .key")
|
||||
|
||||
laconicd keys delete $KEYNAME --keyring-backend $KEYRING --keyring-dir $KEYRING_DIR -y 2> /dev/null
|
||||
rm -rf $KEYRING_DIR
|
||||
|
||||
laconic -c $LACONIC_CONFIG cns tokens send --address $(echo $ACCOUNT_JSON | jq -r '.address') --type aphoton --quantity $((BOND_AMOUNT + BOND_OVERHEAD)) > /dev/null
|
||||
BOND_ID=$(laconic -c $LACONIC_CONFIG cns bond create --user-key $PRIVATE_KEY --type aphoton --quantity $BOND_AMOUNT | jq -r '.bondId')
|
||||
|
||||
echo $ACCOUNT_JSON | jq ".bond = \"$BOND_ID\"" | jq ".balance = $BOND_AMOUNT" | jq ".privkey = \"$PRIVATE_KEY\"" | jq ".pubkey = \"$PUB_KEY\""
|
@ -146,7 +146,7 @@ echo "done sleeping"
|
||||
set +e
|
||||
|
||||
if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then
|
||||
time_out=300s
|
||||
time_out=900s
|
||||
if [[ $TEST == "pending" ]]; then
|
||||
time_out=60m0s
|
||||
fi
|
||||
|
@ -1,52 +0,0 @@
|
||||
# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile
|
||||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
||||
ARG VARIANT=16-bullseye
|
||||
FROM node:${VARIANT}
|
||||
|
||||
ARG USERNAME=node
|
||||
ARG NPM_GLOBAL=/usr/local/share/npm-global
|
||||
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
|
||||
RUN \
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
|
||||
&& usermod -a -G npm ${USERNAME} \
|
||||
&& umask 0002 \
|
||||
&& mkdir -p ${NPM_GLOBAL} \
|
||||
&& touch /usr/local/etc/npmrc \
|
||||
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
|
||||
&& chmod g+s ${NPM_GLOBAL} \
|
||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
||||
# Install eslint
|
||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
||||
&& npm cache clean --force > /dev/null 2>&1
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
||||
# [Optional] Uncomment if you want to install an additional version of node using nvm
|
||||
# ARG EXTRA_NODE_VERSION=10
|
||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
||||
|
||||
WORKDIR /
|
||||
COPY entrypoint.sh .
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
# Placeholder CMD : generally this will be overridden at run time like :
|
||||
# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build'
|
||||
CMD node --version
|
||||
|
||||
# Temp hack, clone the laconic-sdk repo here
|
||||
WORKDIR /app
|
||||
RUN \
|
||||
git clone https://github.com/cerc-io/laconic-sdk.git \
|
||||
&& cd laconic-sdk \
|
||||
&& yarn install
|
||||
|
||||
WORKDIR /app/laconic-sdk
|
@ -1,3 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
docker build -t cerc-io/laconicd:local-test ../../
|
||||
|
||||
docker build -t cerc/laconicd:local ../.. --progress=plain
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
docker build -t cerc-io/laconic-sdk-tester:local-test -f Dockerfile-sdk .
|
||||
|
@ -1,31 +0,0 @@
|
||||
services:
|
||||
laconicd:
|
||||
restart: unless-stopped
|
||||
image: cerc-io/laconicd:local-test
|
||||
environment:
|
||||
- TEST_AUCTION_ENABLED=true
|
||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
||||
volumes:
|
||||
- ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
||||
interval: 1s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
ports:
|
||||
- "6060"
|
||||
- "26657"
|
||||
- "26656"
|
||||
- "9473"
|
||||
- "8545"
|
||||
- "8546"
|
||||
- "9090"
|
||||
- "9091"
|
||||
- "1317"
|
||||
|
||||
sdk-test-runner:
|
||||
image: cerc-io/laconic-sdk-tester:local-test
|
||||
depends_on:
|
||||
laconicd:
|
||||
condition: service_healthy
|
||||
command: tail -F /dev/null
|
@ -1,31 +0,0 @@
|
||||
services:
|
||||
laconicd:
|
||||
restart: unless-stopped
|
||||
image: cerc-io/laconicd:local-test
|
||||
environment:
|
||||
- TEST_REGISTRY_EXPIRY=true
|
||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
||||
volumes:
|
||||
- ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
||||
interval: 1s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
ports:
|
||||
- "6060"
|
||||
- "26657"
|
||||
- "26656"
|
||||
- "9473"
|
||||
- "8545"
|
||||
- "8546"
|
||||
- "9090"
|
||||
- "9091"
|
||||
- "1317"
|
||||
|
||||
sdk-test-runner:
|
||||
image: cerc-io/laconic-sdk-tester:local-test
|
||||
depends_on:
|
||||
laconicd:
|
||||
condition: service_healthy
|
||||
command: tail -F /dev/null
|
@ -1,10 +1,14 @@
|
||||
services:
|
||||
laconicd:
|
||||
restart: unless-stopped
|
||||
image: cerc-io/laconicd:local-test
|
||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
||||
image: cerc/laconicd:local
|
||||
entrypoint: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
||||
environment:
|
||||
- TEST_AUCTION_ENABLED
|
||||
- TEST_REGISTRY_EXPIRY
|
||||
- LOGLEVEL
|
||||
volumes:
|
||||
- ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||
- ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
||||
interval: 1s
|
||||
@ -22,7 +26,7 @@ services:
|
||||
- "1317"
|
||||
|
||||
sdk-test-runner:
|
||||
image: cerc-io/laconic-sdk-tester:local-test
|
||||
image: cerc/laconic-sdk-tester:local
|
||||
depends_on:
|
||||
laconicd:
|
||||
condition: service_healthy
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec "$@"
|
||||
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
# Get the key from laconicd
|
||||
laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
|
||||
# Set parameters for the test suite
|
||||
cosmos_chain_id=laconic_9000-1
|
||||
laconicd_rest_endpoint=http://laconicd:1317
|
||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
||||
# Run tests
|
||||
docker network inspect sdk_tests_default
|
||||
sleep 30s
|
||||
docker logs sdk_tests-laconicd-1
|
||||
|
||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:auctions"
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
# Get the key from laconicd
|
||||
laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
|
||||
# Set parameters for the test suite
|
||||
cosmos_chain_id=laconic_9000-1
|
||||
laconicd_rest_endpoint=http://laconicd:1317
|
||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
||||
# Run tests
|
||||
docker network inspect sdk_tests_default
|
||||
sleep 30s
|
||||
docker logs sdk_tests-laconicd-1
|
||||
|
||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:nameservice-expiry"
|
@ -1,18 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Forwards all args to yarn on the sdk-test-runner container
|
||||
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
yarn_args=("--inspect-brk=8888")
|
||||
yarn_args+=("${@:-test}")
|
||||
|
||||
# Get the key from laconicd
|
||||
laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
|
||||
laconicd_key=$(
|
||||
yes | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe
|
||||
)
|
||||
# Set parameters for the test suite
|
||||
cosmos_chain_id=laconic_9000-1
|
||||
laconicd_rest_endpoint=http://laconicd:1317
|
||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
||||
# Run tests
|
||||
docker network inspect sdk_tests_default
|
||||
sleep 30s
|
||||
docker logs laconicd
|
||||
docker compose exec laconicd sh -c "curl http://127.0.0.1:9473/api"
|
||||
docker compose exec laconicd sh -c "curl http://localhost:9473/api"
|
||||
|
||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test"
|
||||
docker compose exec laconicd sh -c "curl --retry 10 --retry-delay 3 --retry-connrefused http://127.0.0.1:9473/api"
|
||||
|
||||
# Run tests
|
||||
docker compose exec \
|
||||
-e COSMOS_CHAIN_ID="$cosmos_chain_id" \
|
||||
-e LACONICD_REST_ENDPOINT="$laconicd_rest_endpoint" \
|
||||
-e LACONICD_GQL_ENDPOINT="$laconicd_gql_endpoint" \
|
||||
-e PRIVATE_KEY="$laconicd_key" \
|
||||
sdk-test-runner yarn run "${yarn_args[@]}"
|
||||
|
@ -519,6 +519,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
||||
|
||||
l.Log("starting test network...")
|
||||
for _, v := range network.Validators {
|
||||
l.Log("starting validator:", v.Moniker)
|
||||
err := startInProcess(cfg, v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
20
utils/context.go
Normal file
20
utils/context.go
Normal file
@ -0,0 +1,20 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func CtxWithCustomKVGasConfig(ctx *sdk.Context) *sdk.Context {
|
||||
updatedCtx := ctx.WithKVGasConfig(storetypes.GasConfig{
|
||||
HasCost: 0,
|
||||
DeleteCost: 0,
|
||||
ReadCostFlat: 0,
|
||||
ReadCostPerByte: 0,
|
||||
WriteCostFlat: 0,
|
||||
WriteCostPerByte: 0,
|
||||
IterNextCostFlat: 0,
|
||||
})
|
||||
|
||||
return &updatedCtx
|
||||
}
|
@ -15,6 +15,7 @@ import (
|
||||
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
params "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
wnsUtils "github.com/cerc-io/laconicd/utils"
|
||||
)
|
||||
@ -78,6 +79,11 @@ func NewKeeper(accountKeeper auth.AccountKeeper,
|
||||
}
|
||||
}
|
||||
|
||||
// Logger returns a module-specific logger.
|
||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", types.ModuleName)
|
||||
}
|
||||
|
||||
func (k *Keeper) SetUsageKeepers(usageKeepers []types.AuctionUsageKeeper) {
|
||||
k.usageKeepers = usageKeepers
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/cerc-io/laconicd/utils"
|
||||
"github.com/cerc-io/laconicd/x/auction/types"
|
||||
)
|
||||
|
||||
@ -20,6 +22,7 @@ var _ types.MsgServer = msgServer{}
|
||||
|
||||
func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction) (*types.MsgCreateAuctionResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
@ -46,13 +49,15 @@ func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction)
|
||||
),
|
||||
})
|
||||
|
||||
s.logTxGasConsumed(ctx, "CreateAuction")
|
||||
|
||||
return &types.MsgCreateAuctionResponse{Auction: resp}, nil
|
||||
}
|
||||
|
||||
// CommitBid is the command for committing a bid
|
||||
//nolint: all
|
||||
func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
@ -77,13 +82,15 @@ func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types
|
||||
),
|
||||
})
|
||||
|
||||
s.logTxGasConsumed(ctx, "CommitBid")
|
||||
|
||||
return &types.MsgCommitBidResponse{Bid: resp}, nil
|
||||
}
|
||||
|
||||
//RevealBid is the command for revealing a bid
|
||||
//nolint: all
|
||||
// RevealBid is the command for revealing a bid
|
||||
func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
@ -108,5 +115,12 @@ func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types
|
||||
),
|
||||
})
|
||||
|
||||
s.logTxGasConsumed(ctx, "RevealBid")
|
||||
|
||||
return &types.MsgRevealBidResponse{Auction: resp}, nil
|
||||
}
|
||||
|
||||
func (s msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
||||
s.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
||||
}
|
||||
|
337
x/auction/types/tx.pb.gw.go
generated
Normal file
337
x/auction/types/tx.pb.gw.go
generated
Normal file
@ -0,0 +1,337 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: vulcanize/auction/v1beta1/tx.proto
|
||||
|
||||
/*
|
||||
Package types is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package types
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/descriptor"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
var _ = metadata.Join
|
||||
|
||||
var (
|
||||
filter_Msg_CreateAuction_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_CreateAuction_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgCreateAuction
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CreateAuction_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.CreateAuction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_CreateAuction_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgCreateAuction
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CreateAuction_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.CreateAuction(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_CommitBid_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_CommitBid_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgCommitBid
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CommitBid_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.CommitBid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_CommitBid_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgCommitBid
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CommitBid_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.CommitBid(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_RevealBid_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_RevealBid_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgRevealBid
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_RevealBid_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.RevealBid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_RevealBid_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgRevealBid
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_RevealBid_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.RevealBid(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
|
||||
// UnaryRPC :call MsgServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead.
|
||||
func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error {
|
||||
|
||||
mux.Handle("POST", pattern_Msg_CreateAuction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_CreateAuction_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_CreateAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_CommitBid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_CommitBid_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_CommitBid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_RevealBid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_RevealBid_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_RevealBid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterMsgHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterMsgHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterMsgHandler registers the http handlers for service Msg to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn))
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerClient registers the http handlers for service Msg
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "MsgClient" to call the correct interceptors.
|
||||
func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error {
|
||||
|
||||
mux.Handle("POST", pattern_Msg_CreateAuction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_CreateAuction_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_CreateAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_CommitBid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_CommitBid_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_CommitBid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_RevealBid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_RevealBid_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_RevealBid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Msg_CreateAuction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "create_auction"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_CommitBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "commit_bid"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_RevealBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "reveal_bid"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Msg_CreateAuction_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_CommitBid_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_RevealBid_0 = runtime.ForwardResponseMessage
|
||||
)
|
@ -14,6 +14,7 @@ import (
|
||||
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
)
|
||||
|
||||
// prefixIDToBondIndex is the prefix for ID -> Bond index in the KVStore.
|
||||
@ -62,6 +63,11 @@ func NewKeeper(cdc codec.BinaryCodec,
|
||||
}
|
||||
}
|
||||
|
||||
// Logger returns a module-specific logger.
|
||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", types.ModuleName)
|
||||
}
|
||||
|
||||
// Generates Bond ID -> Bond index key.
|
||||
func getBondIndexKey(id string) []byte {
|
||||
return append(prefixIDToBondIndex, []byte(id)...)
|
||||
|
@ -2,9 +2,12 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/cerc-io/laconicd/x/bond/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/cerc-io/laconicd/utils"
|
||||
"github.com/cerc-io/laconicd/x/bond/types"
|
||||
)
|
||||
|
||||
type msgServer struct {
|
||||
@ -20,6 +23,8 @@ var _ types.MsgServer = msgServer{}
|
||||
|
||||
func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*types.MsgCreateBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -42,12 +47,15 @@ func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*typ
|
||||
),
|
||||
})
|
||||
|
||||
k.logTxGasConsumed(ctx, "CreateBond")
|
||||
|
||||
return &types.MsgCreateBondResponse{}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -72,12 +80,15 @@ func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*typ
|
||||
),
|
||||
})
|
||||
|
||||
k.logTxGasConsumed(ctx, "RefillBond")
|
||||
|
||||
return &types.MsgRefillBondResponse{}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -102,11 +113,15 @@ func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (
|
||||
),
|
||||
})
|
||||
|
||||
k.logTxGasConsumed(ctx, "WithdrawBond")
|
||||
|
||||
return &types.MsgWithdrawBondResponse{}, nil
|
||||
}
|
||||
|
||||
func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*types.MsgCancelBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -129,5 +144,12 @@ func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*typ
|
||||
),
|
||||
})
|
||||
|
||||
k.logTxGasConsumed(ctx, "CancelBond")
|
||||
|
||||
return &types.MsgCancelBondResponse{}, nil
|
||||
}
|
||||
|
||||
func (k msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
||||
k.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
||||
}
|
||||
|
420
x/bond/types/tx.pb.gw.go
generated
Normal file
420
x/bond/types/tx.pb.gw.go
generated
Normal file
@ -0,0 +1,420 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: vulcanize/bond/v1beta1/tx.proto
|
||||
|
||||
/*
|
||||
Package types is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package types
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/descriptor"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
var _ = metadata.Join
|
||||
|
||||
var (
|
||||
filter_Msg_CreateBond_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_CreateBond_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgCreateBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CreateBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.CreateBond(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_CreateBond_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgCreateBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CreateBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.CreateBond(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_RefillBond_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_RefillBond_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgRefillBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_RefillBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.RefillBond(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_RefillBond_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgRefillBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_RefillBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.RefillBond(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_WithdrawBond_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_WithdrawBond_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgWithdrawBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_WithdrawBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.WithdrawBond(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_WithdrawBond_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgWithdrawBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_WithdrawBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.WithdrawBond(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_CancelBond_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_CancelBond_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgCancelBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CancelBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.CancelBond(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_CancelBond_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgCancelBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CancelBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.CancelBond(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
|
||||
// UnaryRPC :call MsgServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead.
|
||||
func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error {
|
||||
|
||||
mux.Handle("POST", pattern_Msg_CreateBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_CreateBond_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_CreateBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_RefillBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_RefillBond_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_RefillBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_WithdrawBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_WithdrawBond_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_WithdrawBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_CancelBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_CancelBond_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_CancelBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterMsgHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterMsgHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterMsgHandler registers the http handlers for service Msg to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn))
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerClient registers the http handlers for service Msg
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "MsgClient" to call the correct interceptors.
|
||||
func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error {
|
||||
|
||||
mux.Handle("POST", pattern_Msg_CreateBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_CreateBond_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_CreateBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_RefillBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_RefillBond_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_RefillBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_WithdrawBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_WithdrawBond_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_WithdrawBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_CancelBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_CancelBond_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_CancelBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Msg_CreateBond_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "create_bond"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_RefillBond_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "refill_bond"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_WithdrawBond_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "withdraw_bond"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_CancelBond_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "cancel_bond"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Msg_CreateBond_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_RefillBond_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_WithdrawBond_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_CancelBond_0 = runtime.ForwardResponseMessage
|
||||
)
|
@ -32,11 +32,10 @@ import (
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
// #nosec 101
|
||||
const (
|
||||
OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer"
|
||||
OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract"
|
||||
OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract"
|
||||
OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" // #nosec G101
|
||||
OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" // #nosec G101
|
||||
OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" // #nosec G101
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -15,6 +15,8 @@ import (
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
)
|
||||
|
||||
const badPath = "/asdasd"
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryParams() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
@ -28,7 +30,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryParams() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqURL + "/asdasd",
|
||||
reqURL + badPath,
|
||||
true,
|
||||
"",
|
||||
},
|
||||
@ -42,7 +44,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryParams() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -75,7 +78,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
reqUrl + badPath,
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
@ -110,11 +113,11 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(authorityName)
|
||||
tc.url = fmt.Sprintf(tc.url, authorityName)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
tc.preRun(authorityName)
|
||||
tc.url = fmt.Sprintf(tc.url, authorityName)
|
||||
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -131,7 +134,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqURL := val.APIAddress + "/vulcanize/registry/v1beta1/lookup?crn=%s"
|
||||
reqURL := val.APIAddress + "/vulcanize/registry/v1beta1/lookup"
|
||||
authorityName := "QueryLookUp"
|
||||
|
||||
testCases := []struct {
|
||||
@ -143,7 +146,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqURL + "/asdasd",
|
||||
reqURL + badPath,
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
@ -151,7 +154,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqURL,
|
||||
fmt.Sprintf(reqURL+"?crn=crn://%s/", authorityName),
|
||||
false,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
@ -163,11 +166,9 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(authorityName)
|
||||
tc.url = fmt.Sprintf(reqURL, fmt.Sprintf("crn://%s/", authorityName))
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
tc.preRun(authorityName)
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
if tc.expectErr {
|
||||
sr.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
@ -195,7 +196,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
reqUrl + badPath,
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
@ -233,12 +234,11 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(s.bondID)
|
||||
}
|
||||
tc.preRun(s.bondID)
|
||||
// wait 12 seconds for records expires
|
||||
time.Sleep(time.Second * 12)
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -267,7 +267,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
reqUrl + badPath,
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
@ -303,13 +303,12 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun("QueryAuthorityExpiryQueue")
|
||||
}
|
||||
tc.preRun("QueryAuthorityExpiryQueue")
|
||||
// wait 12 seconds to name authorites expires
|
||||
time.Sleep(time.Second * 12)
|
||||
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -339,7 +338,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
reqUrl + badPath,
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
@ -377,10 +376,9 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(s.bondID)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
tc.preRun(s.bondID)
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -409,7 +407,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqURL + "/asdasd",
|
||||
reqURL + badPath,
|
||||
true,
|
||||
"",
|
||||
func(bondId string) string {
|
||||
@ -443,12 +441,11 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
var recordID string
|
||||
if !tc.expectErr {
|
||||
recordID = tc.preRun(s.bondID)
|
||||
tc.url = fmt.Sprintf(reqURL, recordID)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
recordID := tc.preRun(s.bondID)
|
||||
tc.url = fmt.Sprintf(reqURL, recordID)
|
||||
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -478,7 +475,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqURL + "/asdasd",
|
||||
reqURL + badPath,
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
@ -498,11 +495,11 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(s.bondID)
|
||||
tc.url = fmt.Sprintf(reqURL, s.bondID)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
tc.preRun(s.bondID)
|
||||
tc.url = fmt.Sprintf(reqURL, s.bondID)
|
||||
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -532,7 +529,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRegistryModuleBalance() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqURL + "/asdasd",
|
||||
reqURL + badPath,
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
@ -552,10 +549,9 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRegistryModuleBalance() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(s.bondID)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
tc.preRun(s.bondID)
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -583,7 +579,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryNamesList() {
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqURL + "/asdasd",
|
||||
reqURL + badPath,
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
@ -603,10 +599,9 @@ func (s *IntegrationTestSuite) TestGRPCQueryNamesList() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun("ListNameRecords")
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
tc.preRun("ListNameRecords")
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.NoError(err)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
@ -643,5 +638,5 @@ func createRecord(bondID string, s *IntegrationTestSuite) {
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
sr.Zero(d.Code, d.RawLog)
|
||||
}
|
||||
|
@ -538,9 +538,6 @@ func createNameRecord(authorityName string, s *IntegrationTestSuite) {
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
|
||||
// creating the bond
|
||||
CreateBond(s)
|
||||
|
||||
// Get the bond-id
|
||||
bondID := GetBondID(s)
|
||||
|
||||
|
@ -101,42 +101,23 @@ func CreateBond(s *IntegrationTestSuite) {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
"create bond",
|
||||
[]string{
|
||||
fmt.Sprintf("100000000000%s", s.cfg.BondDenom),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
},
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := bondcli.NewCreateBondCmd()
|
||||
args := []string{
|
||||
fmt.Sprintf("100000000000%s", s.cfg.BondDenom),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := bondcli.NewCreateBondCmd()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
})
|
||||
}
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
|
||||
func GetBondID(s *IntegrationTestSuite) string {
|
||||
@ -160,6 +141,11 @@ func (s *IntegrationTestSuite) TestGetCmdSetRecord() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
|
||||
bondID := GetBondID(s)
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/service_provider_example.yml"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
@ -179,6 +165,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetRecord() {
|
||||
{
|
||||
"success",
|
||||
[]string{
|
||||
payloadPath, bondID,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
@ -191,17 +178,6 @@ func (s *IntegrationTestSuite) TestGetCmdSetRecord() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
if !tc.err {
|
||||
// create the bond
|
||||
CreateBond(s)
|
||||
// get the bond id from bond list
|
||||
bondID := GetBondID(s)
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/service_provider_example.yml"
|
||||
|
||||
tc.args = append([]string{payloadPath, bondID}, tc.args...)
|
||||
}
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetRecord()
|
||||
|
||||
@ -341,9 +317,6 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
|
||||
// creating the bond
|
||||
CreateBond(s)
|
||||
|
||||
// Get the bond-id
|
||||
bondID := GetBondID(s)
|
||||
|
||||
@ -369,9 +342,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
if !tc.err {
|
||||
tc.preRun(authorityName)
|
||||
}
|
||||
tc.preRun(authorityName)
|
||||
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetName()
|
||||
@ -394,6 +365,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
authorityName := "TestGetCmdSetAuthorityBond"
|
||||
bondID := GetBondID(s)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
@ -417,6 +389,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
|
||||
{
|
||||
"success with name and bond-id",
|
||||
[]string{
|
||||
authorityName, bondID,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
@ -449,15 +422,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
if !tc.err {
|
||||
// reserve the name
|
||||
tc.preRun(authorityName)
|
||||
// creating the bond
|
||||
CreateBond(s)
|
||||
// getting the bond-id
|
||||
bondID := GetBondID(s)
|
||||
tc.args = append([]string{authorityName, bondID}, tc.args...)
|
||||
}
|
||||
tc.preRun(authorityName)
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetAuthorityBond()
|
||||
|
||||
@ -501,6 +466,7 @@ func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
|
||||
{
|
||||
"successfully delete name",
|
||||
[]string{
|
||||
fmt.Sprintf("crn://%s/", authorityName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
@ -516,10 +482,8 @@ func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
|
||||
|
||||
for _, tc := range testCasesForDeletingName {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
if !tc.err {
|
||||
tc.preRun(authorityName, s)
|
||||
tc.args = append([]string{fmt.Sprintf("crn://%s/", authorityName)}, tc.args...)
|
||||
}
|
||||
tc.preRun(authorityName, s)
|
||||
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdDeleteName()
|
||||
|
||||
@ -574,8 +538,6 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() {
|
||||
},
|
||||
false,
|
||||
func(s *IntegrationTestSuite) string {
|
||||
// create the bond
|
||||
CreateBond(s)
|
||||
// get the bond id from bond list
|
||||
bondID := GetBondID(s)
|
||||
dir, err := os.Getwd()
|
||||
@ -816,8 +778,6 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() {
|
||||
},
|
||||
false,
|
||||
func(s *IntegrationTestSuite) (string, string) {
|
||||
// create the bond
|
||||
CreateBond(s)
|
||||
// get the bond id from bond list
|
||||
bondID := GetBondID(s)
|
||||
dir, err := os.Getwd()
|
||||
|
7
x/registry/helpers/examples/general_record_example.yml
Normal file
7
x/registry/helpers/examples/general_record_example.yml
Normal file
@ -0,0 +1,7 @@
|
||||
record:
|
||||
type: GeneralRecord
|
||||
name: foo
|
||||
version: 1.0.0
|
||||
tags:
|
||||
- tagA
|
||||
- tagB
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
|
||||
"github.com/cerc-io/laconicd/x/registry/client/cli"
|
||||
"github.com/cerc-io/laconicd/x/registry/helpers"
|
||||
@ -39,6 +40,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() {
|
||||
examples := []string{
|
||||
"/../helpers/examples/service_provider_example.yml",
|
||||
"/../helpers/examples/website_registration_example.yml",
|
||||
"/../helpers/examples/general_record_example.yml",
|
||||
}
|
||||
testCases := []struct {
|
||||
msg string
|
||||
@ -59,7 +61,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() {
|
||||
®istrytypes.QueryListRecordsRequest{},
|
||||
true,
|
||||
false,
|
||||
2,
|
||||
3,
|
||||
},
|
||||
{
|
||||
"Filter with type",
|
||||
@ -78,6 +80,69 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() {
|
||||
false,
|
||||
1,
|
||||
},
|
||||
// Skip the following test as querying with recursive values not supported (PR https://git.vdb.to/cerc-io/laconicd/pulls/112)
|
||||
// See function RecordsFromAttributes (QueryValueToJSON call) in the registry keeper implementation (x/registry/keeper/keeper.go)
|
||||
// {
|
||||
// "Filter with tag (extant) (https://git.vdb.to/cerc-io/laconicd/issues/129)",
|
||||
// ®istrytypes.QueryListRecordsRequest{
|
||||
// Attributes: []*registrytypes.QueryListRecordsRequest_KeyValueInput{
|
||||
// {
|
||||
// Key: "tags",
|
||||
// // Value: ®istrytypes.QueryListRecordsRequest_ValueInput{
|
||||
// // Value: ®istrytypes.QueryListRecordsRequest_ValueInput_String_{"tagA"},
|
||||
// // },
|
||||
// Value: ®istrytypes.QueryListRecordsRequest_ValueInput{
|
||||
// Value: ®istrytypes.QueryListRecordsRequest_ValueInput_Array{Array: ®istrytypes.QueryListRecordsRequest_ArrayInput{
|
||||
// Values: []*registrytypes.QueryListRecordsRequest_ValueInput{
|
||||
// {
|
||||
// Value: ®istrytypes.QueryListRecordsRequest_ValueInput_String_{"tagA"},
|
||||
// },
|
||||
// },
|
||||
// }},
|
||||
// },
|
||||
// // Throws: "Recursive query values are not supported"
|
||||
// },
|
||||
// },
|
||||
// All: true,
|
||||
// },
|
||||
// true,
|
||||
// false,
|
||||
// 1,
|
||||
// },
|
||||
{
|
||||
"Filter with tag (non-existent) (https://git.vdb.to/cerc-io/laconicd/issues/129)",
|
||||
®istrytypes.QueryListRecordsRequest{
|
||||
Attributes: []*registrytypes.QueryListRecordsRequest_KeyValueInput{
|
||||
{
|
||||
Key: "tags",
|
||||
Value: ®istrytypes.QueryListRecordsRequest_ValueInput{
|
||||
Value: ®istrytypes.QueryListRecordsRequest_ValueInput_String_{"NOEXIST"},
|
||||
},
|
||||
},
|
||||
},
|
||||
All: true,
|
||||
},
|
||||
true,
|
||||
false,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"Filter test for key collision (https://git.vdb.to/cerc-io/laconicd/issues/122)",
|
||||
®istrytypes.QueryListRecordsRequest{
|
||||
Attributes: []*registrytypes.QueryListRecordsRequest_KeyValueInput{
|
||||
{
|
||||
Key: "typ",
|
||||
Value: ®istrytypes.QueryListRecordsRequest_ValueInput{
|
||||
Value: ®istrytypes.QueryListRecordsRequest_ValueInput_String_{"eWebsiteRegistrationRecord"},
|
||||
},
|
||||
},
|
||||
},
|
||||
All: true,
|
||||
},
|
||||
true,
|
||||
false,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"Filter with attributes ServiceProviderRegistration",
|
||||
®istrytypes.QueryListRecordsRequest{
|
||||
@ -120,7 +185,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() {
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.Equal(test.noOfRecords, len(resp.GetRecords()))
|
||||
if test.createRecords {
|
||||
if test.createRecords && test.noOfRecords > 0 {
|
||||
recordId = resp.GetRecords()[0].GetId()
|
||||
sr.NotZero(resp.GetRecords())
|
||||
sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId())
|
||||
@ -131,11 +196,26 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() {
|
||||
for _, attr := range test.req.GetAttributes() {
|
||||
enc, err := keeper.QueryValueToJSON(attr.Value)
|
||||
sr.NoError(err)
|
||||
expected := helpers.MustUnmarshalJSON[any](enc)
|
||||
if attr.Key[:4] == "x500" {
|
||||
sr.Equal(expected, recAttr["x500"].(map[string]interface{})[attr.Key[4:]])
|
||||
av := helpers.MustUnmarshalJSON[any](enc)
|
||||
|
||||
if nil != av && nil != recAttr[attr.Key] &&
|
||||
reflect.Slice == reflect.TypeOf(recAttr[attr.Key]).Kind() &&
|
||||
reflect.Slice != reflect.TypeOf(av).Kind() {
|
||||
found := false
|
||||
allValues := recAttr[attr.Key].([]interface{})
|
||||
for i := range allValues {
|
||||
if av == allValues[i] {
|
||||
fmt.Printf("Found %s in %s", allValues[i], recAttr[attr.Key])
|
||||
found = true
|
||||
}
|
||||
}
|
||||
sr.Equal(true, found, fmt.Sprintf("Unable to find %s in %s", av, recAttr[attr.Key]))
|
||||
} else {
|
||||
sr.Equal(expected, recAttr[attr.Key])
|
||||
if attr.Key[:4] == "x500" {
|
||||
sr.Equal(av, recAttr["x500"].(map[string]interface{})[attr.Key[4:]])
|
||||
} else {
|
||||
sr.Equal(av, recAttr[attr.Key])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,11 @@ func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeep
|
||||
}
|
||||
}
|
||||
|
||||
// logger returns a module-specific logger.
|
||||
// Logger returns a module-specific logger.
|
||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return logger(ctx)
|
||||
}
|
||||
|
||||
func logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", types.ModuleName)
|
||||
}
|
||||
@ -193,22 +197,37 @@ func QueryValueToJSON(input *types.QueryListRecordsRequest_ValueInput) ([]byte,
|
||||
|
||||
switch value := input.GetValue().(type) {
|
||||
case *types.QueryListRecordsRequest_ValueInput_String_:
|
||||
nb.AssignString(value.String_)
|
||||
err := nb.AssignString(value.String_)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case *types.QueryListRecordsRequest_ValueInput_Int:
|
||||
nb.AssignInt(value.Int)
|
||||
err := nb.AssignInt(value.Int)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case *types.QueryListRecordsRequest_ValueInput_Float:
|
||||
nb.AssignFloat(value.Float)
|
||||
err := nb.AssignFloat(value.Float)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case *types.QueryListRecordsRequest_ValueInput_Boolean:
|
||||
nb.AssignBool(value.Boolean)
|
||||
err := nb.AssignBool(value.Boolean)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case *types.QueryListRecordsRequest_ValueInput_Link:
|
||||
link := cidlink.Link{Cid: cid.MustParse(value.Link)}
|
||||
nb.AssignLink(link)
|
||||
err := nb.AssignLink(link)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case *types.QueryListRecordsRequest_ValueInput_Array:
|
||||
return nil, fmt.Errorf("Recursive query values are not supported")
|
||||
return nil, fmt.Errorf("recursive query values are not supported")
|
||||
case *types.QueryListRecordsRequest_ValueInput_Map:
|
||||
return nil, fmt.Errorf("Recursive query values are not supported")
|
||||
return nil, fmt.Errorf("recursive query values are not supported")
|
||||
default:
|
||||
return nil, fmt.Errorf("Value has unexpected type %T", value)
|
||||
return nil, fmt.Errorf("value has unexpected type %T", value)
|
||||
}
|
||||
|
||||
n := nb.Build()
|
||||
@ -329,8 +348,7 @@ func (k Keeper) processRecord(ctx sdk.Context, record *types.ReadableRecord, isR
|
||||
}
|
||||
k.PutRecord(ctx, recordObj)
|
||||
|
||||
// TODO process type here
|
||||
// recordType, ok := record.Attributes["type"].(string)
|
||||
// TODO look up/validate record type here
|
||||
|
||||
if err := k.processAttributes(ctx, record.Attributes, record.ID, ""); err != nil {
|
||||
return err
|
||||
@ -374,7 +392,7 @@ func (k Keeper) processAttributes(ctx sdk.Context, attrs types.AttributeMap, id
|
||||
}
|
||||
n := nb.Build()
|
||||
if n.Kind() != ipld.Kind_Map {
|
||||
return fmt.Errorf("Record attributes must be a map, not %T", n.Kind())
|
||||
return fmt.Errorf("record attributes must be a map, not %T", n.Kind())
|
||||
}
|
||||
|
||||
return k.processAttributeMap(ctx, n, id, prefix)
|
||||
@ -382,6 +400,7 @@ func (k Keeper) processAttributes(ctx sdk.Context, attrs types.AttributeMap, id
|
||||
|
||||
func (k Keeper) processAttributeMap(ctx sdk.Context, n ipld.Node, id string, prefix string) error {
|
||||
for it := n.MapIterator(); !it.Done(); {
|
||||
//nolint:misspell
|
||||
keynode, valuenode, err := it.Next()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -392,7 +411,10 @@ func (k Keeper) processAttributeMap(ctx sdk.Context, n ipld.Node, id string, pre
|
||||
}
|
||||
|
||||
if valuenode.Kind() == ipld.Kind_Map {
|
||||
k.processAttributeMap(ctx, valuenode, id, key)
|
||||
err := k.processAttributeMap(ctx, valuenode, id, key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
var buf bytes.Buffer
|
||||
if err := dagjson.Encode(valuenode, &buf); err != nil {
|
||||
@ -409,7 +431,7 @@ func (k Keeper) processAttributeMap(ctx sdk.Context, n ipld.Node, id string, pre
|
||||
}
|
||||
|
||||
func GetAttributesIndexKey(key string, suffix []byte) []byte {
|
||||
keyString := fmt.Sprintf("%s%s", key, suffix)
|
||||
keyString := fmt.Sprintf("%s=%s", key, suffix)
|
||||
return append(PrefixAttributesIndex, []byte(keyString)...)
|
||||
}
|
||||
|
||||
@ -435,7 +457,8 @@ func (k Keeper) GetAttributeMapping(ctx sdk.Context, key []byte) ([]string, erro
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
|
||||
if !store.Has(key) {
|
||||
return nil, fmt.Errorf("store doesn't have key")
|
||||
k.Logger(ctx).Debug(fmt.Sprintf("store doesn't have key: %q", key))
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
var recordIds []string
|
||||
|
@ -2,9 +2,12 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/cerc-io/laconicd/x/registry/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/cerc-io/laconicd/utils"
|
||||
"github.com/cerc-io/laconicd/x/registry/types"
|
||||
)
|
||||
|
||||
type msgServer struct {
|
||||
@ -20,16 +23,14 @@ var _ types.MsgServer = msgServer{}
|
||||
|
||||
func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types.MsgSetRecordResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
record, err := m.Keeper.ProcessSetRecord(ctx, types.MsgSetRecord{
|
||||
BondId: msg.GetBondId(),
|
||||
Signer: msg.GetSigner(),
|
||||
Payload: msg.GetPayload(),
|
||||
})
|
||||
record, err := m.Keeper.ProcessSetRecord(ctx, *msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -48,12 +49,15 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "SetRecord")
|
||||
|
||||
return &types.MsgSetRecordResponse{Id: record.ID}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -75,11 +79,16 @@ func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.Msg
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "SetName")
|
||||
|
||||
return &types.MsgSetNameResponse{}, nil
|
||||
}
|
||||
|
||||
func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority) (*types.MsgReserveAuthorityResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -105,12 +114,16 @@ func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "ReserveName")
|
||||
|
||||
return &types.MsgReserveAuthorityResponse{}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -132,11 +145,16 @@ func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorit
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "SetAuthorityBond")
|
||||
|
||||
return &types.MsgSetAuthorityBondResponse{}, nil
|
||||
}
|
||||
|
||||
func (m msgServer) DeleteName(c context.Context, msg *types.MsgDeleteNameAuthority) (*types.MsgDeleteNameAuthorityResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -157,11 +175,16 @@ func (m msgServer) DeleteName(c context.Context, msg *types.MsgDeleteNameAuthori
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "DeleteName")
|
||||
|
||||
return &types.MsgDeleteNameAuthorityResponse{}, nil
|
||||
}
|
||||
|
||||
func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*types.MsgRenewRecordResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -182,12 +205,16 @@ func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*t
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "RenewRecord")
|
||||
|
||||
return &types.MsgRenewRecordResponse{}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -210,11 +237,16 @@ func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond)
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "AssociateBond")
|
||||
|
||||
return &types.MsgAssociateBondResponse{}, nil
|
||||
}
|
||||
|
||||
func (m msgServer) DissociateBond(c context.Context, msg *types.MsgDissociateBond) (*types.MsgDissociateBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -235,11 +267,16 @@ func (m msgServer) DissociateBond(c context.Context, msg *types.MsgDissociateBon
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "DissociateBond")
|
||||
|
||||
return &types.MsgDissociateBondResponse{}, nil
|
||||
}
|
||||
|
||||
func (m msgServer) DissociateRecords(c context.Context, msg *types.MsgDissociateRecords) (*types.MsgDissociateRecordsResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -260,11 +297,16 @@ func (m msgServer) DissociateRecords(c context.Context, msg *types.MsgDissociate
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "DissociateRecords")
|
||||
|
||||
return &types.MsgDissociateRecordsResponse{}, nil
|
||||
}
|
||||
|
||||
func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssociateRecords) (*types.MsgReAssociateRecordsResponse, error) { //nolint: all
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -286,5 +328,13 @@ func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssocia
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||
),
|
||||
})
|
||||
|
||||
m.logTxGasConsumed(ctx, "ReAssociateRecords")
|
||||
|
||||
return &types.MsgReAssociateRecordsResponse{}, nil
|
||||
}
|
||||
|
||||
func (m msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
||||
m.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ func (k Keeper) ProcessAuthorityExpiryQueue(ctx sdk.Context) {
|
||||
k.SetNameAuthority(ctx, name, &authority)
|
||||
k.DeleteAuthorityExpiryQueue(ctx, name, authority)
|
||||
|
||||
logger(ctx).Info(fmt.Sprintf("Marking authority expired as no bond present: %s", name))
|
||||
k.Logger(ctx).Info(fmt.Sprintf("Marking authority expired as no bond present: %s", name))
|
||||
|
||||
return
|
||||
}
|
||||
@ -672,7 +672,7 @@ func (k Keeper) AuthorityExpiryQueueIterator(ctx sdk.Context, endTime time.Time)
|
||||
|
||||
// TryTakeAuthorityRent tries to take rent from the authority bond.
|
||||
func (k Keeper) TryTakeAuthorityRent(ctx sdk.Context, name string, authority types.NameAuthority) {
|
||||
logger(ctx).Info(fmt.Sprintf("Trying to take rent for authority: %s", name))
|
||||
k.Logger(ctx).Info(fmt.Sprintf("Trying to take rent for authority: %s", name))
|
||||
|
||||
params := k.GetParams(ctx)
|
||||
rent := params.AuthorityRent
|
||||
@ -684,7 +684,7 @@ func (k Keeper) TryTakeAuthorityRent(ctx sdk.Context, name string, authority typ
|
||||
k.SetNameAuthority(ctx, name, &authority)
|
||||
k.DeleteAuthorityExpiryQueue(ctx, name, authority)
|
||||
|
||||
logger(ctx).Info(fmt.Sprintf("Insufficient funds in owner account to pay authority rent, marking as expired: %s", name))
|
||||
k.Logger(ctx).Info(fmt.Sprintf("Insufficient funds in owner account to pay authority rent, marking as expired: %s", name))
|
||||
|
||||
return
|
||||
}
|
||||
@ -699,7 +699,7 @@ func (k Keeper) TryTakeAuthorityRent(ctx sdk.Context, name string, authority typ
|
||||
k.SetNameAuthority(ctx, name, &authority)
|
||||
k.AddBondToAuthorityIndexEntry(ctx, authority.BondId, name)
|
||||
|
||||
logger(ctx).Info(fmt.Sprintf("Authority rent paid successfully: %s", name))
|
||||
k.Logger(ctx).Info(fmt.Sprintf("Authority rent paid successfully: %s", name))
|
||||
}
|
||||
|
||||
// ListNameAuthorityRecords - get all name authority records.
|
||||
|
918
x/registry/types/tx.pb.gw.go
generated
Normal file
918
x/registry/types/tx.pb.gw.go
generated
Normal file
@ -0,0 +1,918 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: vulcanize/registry/v1beta1/tx.proto
|
||||
|
||||
/*
|
||||
Package types is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package types
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/descriptor"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
var _ = metadata.Join
|
||||
|
||||
var (
|
||||
filter_Msg_SetRecord_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_SetRecord_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgSetRecord
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_SetRecord_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.SetRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_SetRecord_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgSetRecord
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_SetRecord_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.SetRecord(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_RenewRecord_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_RenewRecord_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgRenewRecord
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_RenewRecord_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.RenewRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_RenewRecord_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgRenewRecord
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_RenewRecord_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.RenewRecord(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_AssociateBond_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_AssociateBond_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgAssociateBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_AssociateBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.AssociateBond(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_AssociateBond_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgAssociateBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_AssociateBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.AssociateBond(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_DissociateBond_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_DissociateBond_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgDissociateBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_DissociateBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.DissociateBond(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_DissociateBond_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgDissociateBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_DissociateBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.DissociateBond(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_DissociateRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_DissociateRecords_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgDissociateRecords
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_DissociateRecords_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.DissociateRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_DissociateRecords_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgDissociateRecords
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_DissociateRecords_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.DissociateRecords(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_ReAssociateRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_ReAssociateRecords_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgReAssociateRecords
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_ReAssociateRecords_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ReAssociateRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_ReAssociateRecords_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgReAssociateRecords
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_ReAssociateRecords_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ReAssociateRecords(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_SetName_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_SetName_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgSetName
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_SetName_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.SetName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_SetName_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgSetName
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_SetName_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.SetName(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_ReserveName_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_ReserveName_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgReserveAuthority
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_ReserveName_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ReserveName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_ReserveName_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgReserveAuthority
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_ReserveName_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ReserveName(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_DeleteName_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_DeleteName_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgDeleteNameAuthority
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_DeleteName_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.DeleteName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_DeleteName_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgDeleteNameAuthority
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_DeleteName_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.DeleteName(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Msg_SetAuthorityBond_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Msg_SetAuthorityBond_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgSetAuthorityBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_SetAuthorityBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.SetAuthorityBond(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Msg_SetAuthorityBond_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq MsgSetAuthorityBond
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_SetAuthorityBond_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.SetAuthorityBond(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
|
||||
// UnaryRPC :call MsgServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead.
|
||||
func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error {
|
||||
|
||||
mux.Handle("POST", pattern_Msg_SetRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_SetRecord_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_SetRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_RenewRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_RenewRecord_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_RenewRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_AssociateBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_AssociateBond_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_AssociateBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_DissociateBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_DissociateBond_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_DissociateBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_DissociateRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_DissociateRecords_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_DissociateRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_ReAssociateRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_ReAssociateRecords_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_ReAssociateRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_SetName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_SetName_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_SetName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_ReserveName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_ReserveName_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_ReserveName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_DeleteName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_DeleteName_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_DeleteName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_SetAuthorityBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Msg_SetAuthorityBond_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_SetAuthorityBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterMsgHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterMsgHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterMsgHandler registers the http handlers for service Msg to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn))
|
||||
}
|
||||
|
||||
// RegisterMsgHandlerClient registers the http handlers for service Msg
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "MsgClient" to call the correct interceptors.
|
||||
func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error {
|
||||
|
||||
mux.Handle("POST", pattern_Msg_SetRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_SetRecord_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_SetRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_RenewRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_RenewRecord_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_RenewRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_AssociateBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_AssociateBond_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_AssociateBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_DissociateBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_DissociateBond_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_DissociateBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_DissociateRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_DissociateRecords_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_DissociateRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_ReAssociateRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_ReAssociateRecords_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_ReAssociateRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_SetName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_SetName_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_SetName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_ReserveName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_ReserveName_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_ReserveName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_DeleteName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_DeleteName_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_DeleteName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Msg_SetAuthorityBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Msg_SetAuthorityBond_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Msg_SetAuthorityBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Msg_SetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "set_record"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_RenewRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "renew_record"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_AssociateBond_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "associate_bond"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_DissociateBond_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "dissociate_bond"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_DissociateRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "dissociate_records"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_ReAssociateRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "reassociate_records"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_SetName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "set_name"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_ReserveName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "reserve_name"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_DeleteName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "delete_name"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Msg_SetAuthorityBond_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "registry", "v1beta1", "set_authority_bond"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Msg_SetRecord_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_RenewRecord_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_AssociateBond_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_DissociateBond_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_DissociateRecords_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_ReAssociateRecords_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_SetName_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_ReserveName_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_DeleteName_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Msg_SetAuthorityBond_0 = runtime.ForwardResponseMessage
|
||||
)
|
@ -99,7 +99,7 @@ func (r *Record) ToReadableRecord() ReadableRecord {
|
||||
func (r *ReadableRecord) CanonicalJSON() []byte {
|
||||
bytes, err := canonicaljson.Marshal(r.Attributes)
|
||||
if err != nil {
|
||||
panic("error marshalling record: " + err.Error())
|
||||
panic("error marshaling record: " + err.Error())
|
||||
}
|
||||
|
||||
return bytes
|
||||
|
Loading…
Reference in New Issue
Block a user