mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
refactor/internal (#1216)
* refactor: update import paths in gateway handlers * refactor: remove obsolete devtools Makefile and README * build: optimize build process for improved efficiency * refactor: remove obsolete pkl files related to Matrix and Sonr network configurations * refactor: move embed code to x/dwn/types
This commit is contained in:
@@ -3,6 +3,6 @@ name = "cz_conventional_commits"
|
|||||||
tag_format = "v$version"
|
tag_format = "v$version"
|
||||||
version_scheme = "semver"
|
version_scheme = "semver"
|
||||||
version = "0.5.27"
|
version = "0.5.27"
|
||||||
update_changelog_on_bump = true
|
update_changelog_on_bump = false
|
||||||
major_version_zero = true
|
major_version_zero = true
|
||||||
changelog_file = "./docs/docs/changelog.md"
|
changelog_file = "CHANGELOG.md"
|
||||||
|
|||||||
@@ -75,8 +75,6 @@ ldflags := $(strip $(ldflags))
|
|||||||
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
|
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
|
||||||
|
|
||||||
# The below include contains the tools and runsim targets.
|
# The below include contains the tools and runsim targets.
|
||||||
include contrib/devtools/Makefile
|
|
||||||
|
|
||||||
all: install lint test
|
all: install lint test
|
||||||
|
|
||||||
build: go.sum
|
build: go.sum
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ tasks:
|
|||||||
dir: .github/scripts
|
dir: .github/scripts
|
||||||
cmds:
|
cmds:
|
||||||
- sh new_issue.sh
|
- sh new_issue.sh
|
||||||
|
|
||||||
pkl-gen:
|
pkl-gen:
|
||||||
desc: Generate PKL files
|
desc: Generate PKL files
|
||||||
silent: true
|
silent: true
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/medama-io/go-useragent"
|
"github.com/medama-io/go-useragent"
|
||||||
"github.com/onsonr/sonr/crypto/mpc"
|
"github.com/onsonr/sonr/internal/crypto/mpc"
|
||||||
|
"github.com/onsonr/sonr/internal/common"
|
||||||
"github.com/onsonr/sonr/internal/config/hway"
|
"github.com/onsonr/sonr/internal/config/hway"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
||||||
"github.com/onsonr/sonr/pkg/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GatewayContext struct {
|
type GatewayContext struct {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package context
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/pkg/common"
|
"github.com/onsonr/sonr/internal/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ParamsBank returns the bank params
|
// ParamsBank returns the bank params
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
gocontext "context"
|
gocontext "context"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/onsonr/sonr/pkg/common"
|
"github.com/onsonr/sonr/internal/common"
|
||||||
"github.com/segmentio/ksuid"
|
"github.com/segmentio/ksuid"
|
||||||
"lukechampine.com/blake3"
|
"lukechampine.com/blake3"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package context
|
package context
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/onsonr/sonr/crypto/mpc"
|
"github.com/onsonr/sonr/internal/crypto/mpc"
|
||||||
"github.com/onsonr/sonr/pkg/common"
|
"github.com/onsonr/sonr/internal/common"
|
||||||
"lukechampine.com/blake3"
|
"lukechampine.com/blake3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import (
|
|||||||
echomiddleware "github.com/labstack/echo/v4/middleware"
|
echomiddleware "github.com/labstack/echo/v4/middleware"
|
||||||
"github.com/onsonr/sonr/app/gateway/context"
|
"github.com/onsonr/sonr/app/gateway/context"
|
||||||
"github.com/onsonr/sonr/app/gateway/handlers"
|
"github.com/onsonr/sonr/app/gateway/handlers"
|
||||||
|
"github.com/onsonr/sonr/internal/common"
|
||||||
config "github.com/onsonr/sonr/internal/config/hway"
|
config "github.com/onsonr/sonr/internal/config/hway"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
||||||
"github.com/onsonr/sonr/pkg/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Gateway = *echo.Echo
|
type Gateway = *echo.Echo
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/onsonr/sonr/app/gateway/context"
|
"github.com/onsonr/sonr/app/gateway/context"
|
||||||
"github.com/onsonr/sonr/app/gateway/islands"
|
"github.com/onsonr/sonr/app/gateway/islands"
|
||||||
"github.com/onsonr/sonr/app/gateway/views"
|
"github.com/onsonr/sonr/app/gateway/views"
|
||||||
|
"github.com/onsonr/sonr/internal/common"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
||||||
"github.com/onsonr/sonr/pkg/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterHandler(g *echo.Group) {
|
func RegisterHandler(g *echo.Group) {
|
||||||
|
|||||||
+1
-1
@@ -7,8 +7,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/pkg/common"
|
|
||||||
"github.com/onsonr/sonr/app/gateway"
|
"github.com/onsonr/sonr/app/gateway"
|
||||||
|
"github.com/onsonr/sonr/internal/common"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
###
|
|
||||||
# Find OS and Go environment
|
|
||||||
# GO contains the Go binary
|
|
||||||
# FS contains the OS file separator
|
|
||||||
###
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
GO := $(shell where go.exe 2> NUL)
|
|
||||||
FS := "\\"
|
|
||||||
else
|
|
||||||
GO := $(shell command -v go 2> /dev/null)
|
|
||||||
FS := "/"
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(GO),)
|
|
||||||
$(error could not find go. Is it in PATH? $(GO))
|
|
||||||
endif
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### Functions ###
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
go_get = $(if $(findstring Windows_NT,$(OS)),\
|
|
||||||
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS) ( mkdir $(GITHUBDIR)$(FS)$(1) ) else (cd .) &\
|
|
||||||
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS)$(2)$(FS) ( cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2) ) else (cd .) &\
|
|
||||||
,\
|
|
||||||
mkdir -p $(GITHUBDIR)$(FS)$(1) &&\
|
|
||||||
(test ! -d $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2)) || true &&\
|
|
||||||
)\
|
|
||||||
cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && git fetch origin && git checkout -q $(3)
|
|
||||||
|
|
||||||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
||||||
mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd)
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### Tools ###
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
BIN ?= $(PREFIX)/bin
|
|
||||||
UNAME_S ?= $(shell uname -s)
|
|
||||||
UNAME_M ?= $(shell uname -m)
|
|
||||||
|
|
||||||
GOPATH ?= $(shell $(GO) env GOPATH)
|
|
||||||
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com
|
|
||||||
|
|
||||||
BUF_VERSION ?= 0.11.0
|
|
||||||
|
|
||||||
TOOLS_DESTDIR ?= $(GOPATH)/bin
|
|
||||||
STATIK = $(TOOLS_DESTDIR)/statik
|
|
||||||
RUNSIM = $(TOOLS_DESTDIR)/runsim
|
|
||||||
GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint
|
|
||||||
|
|
||||||
tools: tools-stamp
|
|
||||||
tools-stamp: statik runsim golangci-lint
|
|
||||||
# Create dummy file to satisfy dependency and avoid
|
|
||||||
# rebuilding when this Makefile target is hit twice
|
|
||||||
# in a row.
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
statik: $(STATIK)
|
|
||||||
$(STATIK):
|
|
||||||
@echo "Installing statik..."
|
|
||||||
@(cd /tmp && go install github.com/rakyll/statik@v0.1.6)
|
|
||||||
|
|
||||||
# Install the runsim binary with a temporary workaround of entering an outside
|
|
||||||
# directory as the "go get" command ignores the -mod option and will polute the
|
|
||||||
# go.{mod, sum} files.
|
|
||||||
#
|
|
||||||
# ref: https://github.com/golang/go/issues/30515
|
|
||||||
runsim: $(RUNSIM)
|
|
||||||
$(RUNSIM):
|
|
||||||
@echo "Installing runsim..."
|
|
||||||
@(cd /tmp && go install github.com/cosmos/tools/cmd/runsim@v1.0.0)
|
|
||||||
|
|
||||||
golangci-lint: $(GOLANGCI_LINT)
|
|
||||||
$(GOLANGCI_LINT):
|
|
||||||
@echo "Installing golangci-lint..."
|
|
||||||
@(cd /tmp && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.0)
|
|
||||||
|
|
||||||
tools-clean:
|
|
||||||
rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM)
|
|
||||||
rm -f tools-stamp
|
|
||||||
|
|
||||||
.PHONY: tools-clean statik runsim
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
## Contributors
|
|
||||||
|
|
||||||
Thanks to the entire Cosmos SDK team and the contributors who put their efforts into making simulation testing
|
|
||||||
easier to implement. 🤗
|
|
||||||
|
|
||||||
https://github.com/cosmos/cosmos-sdk/blob/master/contrib/devtools/Makefile
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
-- Switch to postgres database first
|
|
||||||
\c postgres;
|
|
||||||
|
|
||||||
-- Terminate existing connections
|
|
||||||
SELECT pg_terminate_backend(pid)
|
|
||||||
FROM pg_stat_activity
|
|
||||||
WHERE datname = 'chainindex'
|
|
||||||
AND pid <> pg_backend_pid();
|
|
||||||
|
|
||||||
-- Drop and recreate database and user
|
|
||||||
DROP DATABASE IF EXISTS chainindex;
|
|
||||||
DROP USER IF EXISTS chainindex_user;
|
|
||||||
|
|
||||||
CREATE USER chainindex_user WITH PASSWORD 'chainindex_password123';
|
|
||||||
CREATE DATABASE chainindex;
|
|
||||||
|
|
||||||
-- Connect to the new database
|
|
||||||
\c chainindex;
|
|
||||||
|
|
||||||
-- Create the blocks table
|
|
||||||
CREATE TABLE blocks (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
height BIGINT NOT NULL,
|
|
||||||
chain_id VARCHAR NOT NULL,
|
|
||||||
created_at TIMESTAMPTZ NOT NULL,
|
|
||||||
UNIQUE (height, chain_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE INDEX idx_blocks_height_chain ON blocks(height, chain_id);
|
|
||||||
|
|
||||||
CREATE TABLE tx_results (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
block_id BIGINT NOT NULL REFERENCES blocks(rowid),
|
|
||||||
index INTEGER NOT NULL,
|
|
||||||
created_at TIMESTAMPTZ NOT NULL,
|
|
||||||
tx_hash VARCHAR NOT NULL,
|
|
||||||
tx_result BYTEA NOT NULL,
|
|
||||||
UNIQUE (block_id, index)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE events (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
block_id BIGINT NOT NULL REFERENCES blocks(rowid),
|
|
||||||
tx_id BIGINT NULL REFERENCES tx_results(rowid),
|
|
||||||
type VARCHAR NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE attributes (
|
|
||||||
event_id BIGINT NOT NULL REFERENCES events(rowid),
|
|
||||||
key VARCHAR NOT NULL,
|
|
||||||
composite_key VARCHAR NOT NULL,
|
|
||||||
value VARCHAR NULL,
|
|
||||||
UNIQUE (event_id, key)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE VIEW event_attributes AS
|
|
||||||
SELECT block_id, tx_id, type, key, composite_key, value
|
|
||||||
FROM events LEFT JOIN attributes ON (events.rowid = attributes.event_id);
|
|
||||||
|
|
||||||
CREATE VIEW block_events AS
|
|
||||||
SELECT blocks.rowid as block_id, height, chain_id, type, key, composite_key, value
|
|
||||||
FROM blocks JOIN event_attributes ON (blocks.rowid = event_attributes.block_id)
|
|
||||||
WHERE event_attributes.tx_id IS NULL;
|
|
||||||
|
|
||||||
CREATE VIEW tx_events AS
|
|
||||||
SELECT height, index, chain_id, type, key, composite_key, value, tx_results.created_at
|
|
||||||
FROM blocks JOIN tx_results ON (blocks.rowid = tx_results.block_id)
|
|
||||||
JOIN event_attributes ON (tx_results.rowid = event_attributes.tx_id)
|
|
||||||
WHERE event_attributes.tx_id IS NOT NULL;
|
|
||||||
|
|
||||||
-- Grant all necessary privileges
|
|
||||||
GRANT ALL PRIVILEGES ON DATABASE chainindex TO chainindex_user;
|
|
||||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO chainindex_user;
|
|
||||||
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO chainindex_user;
|
|
||||||
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO chainindex_user;
|
|
||||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO chainindex_user;
|
|
||||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO chainindex_user;
|
|
||||||
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
This file defines the database schema for the PostgresQL ("psql") event sink
|
|
||||||
implementation in CometBFT. The operator must create a database and install
|
|
||||||
this schema before using the database to index events.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-- First, ensure we're connected to the chainindex database
|
|
||||||
\c chainindex;
|
|
||||||
|
|
||||||
-- The blocks table records metadata about each block.
|
|
||||||
-- The block record does not include its events or transactions (see tx_results).
|
|
||||||
CREATE TABLE blocks (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
|
|
||||||
height BIGINT NOT NULL,
|
|
||||||
chain_id VARCHAR NOT NULL,
|
|
||||||
|
|
||||||
-- When this block header was logged into the sink, in UTC.
|
|
||||||
created_at TIMESTAMPTZ NOT NULL,
|
|
||||||
|
|
||||||
UNIQUE (height, chain_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Index blocks by height and chain, since we need to resolve block IDs when
|
|
||||||
-- indexing transaction records and transaction events.
|
|
||||||
CREATE INDEX idx_blocks_height_chain ON blocks(height, chain_id);
|
|
||||||
|
|
||||||
-- The tx_results table records metadata about transaction results. Note that
|
|
||||||
-- the events from a transaction are stored separately.
|
|
||||||
CREATE TABLE tx_results (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
|
|
||||||
-- The block to which this transaction belongs.
|
|
||||||
block_id BIGINT NOT NULL REFERENCES blocks(rowid),
|
|
||||||
-- The sequential index of the transaction within the block.
|
|
||||||
index INTEGER NOT NULL,
|
|
||||||
-- When this result record was logged into the sink, in UTC.
|
|
||||||
created_at TIMESTAMPTZ NOT NULL,
|
|
||||||
-- The hex-encoded hash of the transaction.
|
|
||||||
tx_hash VARCHAR NOT NULL,
|
|
||||||
-- The protobuf wire encoding of the TxResult message.
|
|
||||||
tx_result BYTEA NOT NULL,
|
|
||||||
|
|
||||||
UNIQUE (block_id, index)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- The events table records events. All events (both block and transaction) are
|
|
||||||
-- associated with a block ID; transaction events also have a transaction ID.
|
|
||||||
CREATE TABLE events (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
|
|
||||||
-- The block and transaction this event belongs to.
|
|
||||||
-- If tx_id is NULL, this is a block event.
|
|
||||||
block_id BIGINT NOT NULL REFERENCES blocks(rowid),
|
|
||||||
tx_id BIGINT NULL REFERENCES tx_results(rowid),
|
|
||||||
|
|
||||||
-- The application-defined type label for the event.
|
|
||||||
type VARCHAR NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
-- The attributes table records event attributes.
|
|
||||||
CREATE TABLE attributes (
|
|
||||||
event_id BIGINT NOT NULL REFERENCES events(rowid),
|
|
||||||
key VARCHAR NOT NULL, -- bare key
|
|
||||||
composite_key VARCHAR NOT NULL, -- composed type.key
|
|
||||||
value VARCHAR NULL,
|
|
||||||
|
|
||||||
UNIQUE (event_id, key)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- A joined view of events and their attributes. Events that do not have any
|
|
||||||
-- attributes are represented as a single row with empty key and value fields.
|
|
||||||
CREATE VIEW event_attributes AS
|
|
||||||
SELECT block_id, tx_id, type, key, composite_key, value
|
|
||||||
FROM events LEFT JOIN attributes ON (events.rowid = attributes.event_id);
|
|
||||||
|
|
||||||
-- A joined view of all block events (those having tx_id NULL).
|
|
||||||
CREATE VIEW block_events AS
|
|
||||||
SELECT blocks.rowid as block_id, height, chain_id, type, key, composite_key, value
|
|
||||||
FROM blocks JOIN event_attributes ON (blocks.rowid = event_attributes.block_id)
|
|
||||||
WHERE event_attributes.tx_id IS NULL;
|
|
||||||
|
|
||||||
-- A joined view of all transaction events.
|
|
||||||
CREATE VIEW tx_events AS
|
|
||||||
SELECT height, index, chain_id, type, key, composite_key, value, tx_results.created_at
|
|
||||||
FROM blocks JOIN tx_results ON (blocks.rowid = tx_results.block_id)
|
|
||||||
JOIN event_attributes ON (tx_results.rowid = event_attributes.tx_id)
|
|
||||||
WHERE event_attributes.tx_id IS NOT NULL;
|
|
||||||
|
|
||||||
-- Grant privileges for each database to their respective users
|
|
||||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO chainindex_user;
|
|
||||||
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO chainindex_user;
|
|
||||||
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO chainindex_user;
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
-- Connect to postgres default database
|
|
||||||
\c postgres;
|
|
||||||
|
|
||||||
-- Create databases
|
|
||||||
CREATE DATABASE chainindex;
|
|
||||||
CREATE DATABASE highway;
|
|
||||||
CREATE DATABASE matrixhs;
|
|
||||||
|
|
||||||
-- Create users with passwords
|
|
||||||
CREATE USER chainindex_user WITH PASSWORD 'chainindex_password123';
|
|
||||||
CREATE USER highway_user WITH PASSWORD 'highway_password123';
|
|
||||||
CREATE USER matrixhs_user WITH PASSWORD 'matrixhs_password123';
|
|
||||||
|
|
||||||
-- Grant privileges for each database to their respective users
|
|
||||||
\c chainindex;
|
|
||||||
GRANT ALL PRIVILEGES ON DATABASE chainindex TO chainindex_user;
|
|
||||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO chainindex_user;
|
|
||||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO chainindex_user;
|
|
||||||
|
|
||||||
\c highway;
|
|
||||||
GRANT ALL PRIVILEGES ON DATABASE highway TO highway_user;
|
|
||||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO highway_user;
|
|
||||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO highway_user;
|
|
||||||
|
|
||||||
\c matrixhs;
|
|
||||||
GRANT ALL PRIVILEGES ON DATABASE matrixhs TO matrixhs_user;
|
|
||||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO matrixhs_user;
|
|
||||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO matrixhs_user;
|
|
||||||
|
|
||||||
@@ -1,232 +0,0 @@
|
|||||||
{
|
|
||||||
"lockfile_version": "1",
|
|
||||||
"packages": {
|
|
||||||
"ipfs@latest": {
|
|
||||||
"last_modified": "2023-02-24T09:01:09Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/7d0ed7f2e5aea07ab22ccb338d27fbe347ed2f11#ipfs",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "0.17.0"
|
|
||||||
},
|
|
||||||
"postgresql@latest": {
|
|
||||||
"last_modified": "2024-12-08T19:40:50Z",
|
|
||||||
"plugin_version": "0.0.2",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/dd51f52372a20a93c219e8216fe528a648ffcbf4#postgresql",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "16.5",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/6l498xrh9z690js5zmd3p2ps0r00ri9p-postgresql-16.5",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "man",
|
|
||||||
"path": "/nix/store/5yiw867cz810zi0z2yg5y794w2sy8kzq-postgresql-16.5-man",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "dev",
|
|
||||||
"path": "/nix/store/9mc2nq9m18x0l7c1gyasp064cf2894vx-postgresql-16.5-dev"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "doc",
|
|
||||||
"path": "/nix/store/lxqw2xsh0vm11rcz5wayhskb8w9wjlih-postgresql-16.5-doc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lib",
|
|
||||||
"path": "/nix/store/c3a1ij8vyxv5fyg7qp6la2mn54jn84sn-postgresql-16.5-lib"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/6l498xrh9z690js5zmd3p2ps0r00ri9p-postgresql-16.5"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/vjcavy1l0s1l0frjag900239cpmvj17f-postgresql-16.5",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "man",
|
|
||||||
"path": "/nix/store/4l4a2044a6mb79sm46679ifappmj8vgc-postgresql-16.5-man",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "debug",
|
|
||||||
"path": "/nix/store/zlw8cxkzf9a43mmplsp88dbjy8adbjkx-postgresql-16.5-debug"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "dev",
|
|
||||||
"path": "/nix/store/8mbabq6zp86a1gm2nf109pa1dvgp8s02-postgresql-16.5-dev"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "doc",
|
|
||||||
"path": "/nix/store/1sa3z90r6hrcfsd4hy4rxbwzbw6aa4p6-postgresql-16.5-doc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lib",
|
|
||||||
"path": "/nix/store/gr06jpjpxzqkpyyhg1f7v9mmy1f9qzgp-postgresql-16.5-lib"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/vjcavy1l0s1l0frjag900239cpmvj17f-postgresql-16.5"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/808d9axcd5q934lsi3l5v3x8phks9wc4-postgresql-16.5",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "man",
|
|
||||||
"path": "/nix/store/8njx7dcc3gj9j46cn5lfc8knd52hvl7k-postgresql-16.5-man",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "dev",
|
|
||||||
"path": "/nix/store/pn22i14qpv3yxmaacd5yfcqxpqm3grlq-postgresql-16.5-dev"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "doc",
|
|
||||||
"path": "/nix/store/kd05cfbhaiiihdx6kkrjdyrywgjzfnqj-postgresql-16.5-doc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lib",
|
|
||||||
"path": "/nix/store/1gnp8q95nfjna56sllv66jbf6hshi6bd-postgresql-16.5-lib"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/808d9axcd5q934lsi3l5v3x8phks9wc4-postgresql-16.5"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/0z5iwcvalafm3j2c5pfhllsfbxrbyzf4-postgresql-16.5",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "man",
|
|
||||||
"path": "/nix/store/0q9yki1d9czy7i7mly8gy3ffjvc3hkqv-postgresql-16.5-man",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "debug",
|
|
||||||
"path": "/nix/store/zvysixjns32iz6qlkr8s5b70cw50l0qy-postgresql-16.5-debug"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "dev",
|
|
||||||
"path": "/nix/store/207n898zbi7mb5scjaf532v78c3rll9f-postgresql-16.5-dev"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "doc",
|
|
||||||
"path": "/nix/store/7ip3havx020h3527y7cqdl8l39p3g67b-postgresql-16.5-doc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lib",
|
|
||||||
"path": "/nix/store/qi2zbhdnzdci7i0a6g64mbkk8wnzznlh-postgresql-16.5-lib"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/0z5iwcvalafm3j2c5pfhllsfbxrbyzf4-postgresql-16.5"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"process-compose@latest": {
|
|
||||||
"last_modified": "2024-12-04T16:45:45Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/2f9d395f057a50f8076f633c10519035fce8d773#process-compose",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "1.40.1",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/iz6ckcr1s8vy71b3wqvs680g2mwpf9jk-process-compose-1.40.1",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/iz6ckcr1s8vy71b3wqvs680g2mwpf9jk-process-compose-1.40.1"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/7jw864z6wlzcirsz8fgaj2bw0f22izch-process-compose-1.40.1",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/7jw864z6wlzcirsz8fgaj2bw0f22izch-process-compose-1.40.1"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/mrdrciqg6zjrblgjaya6bxqd57knf09r-process-compose-1.40.1",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/mrdrciqg6zjrblgjaya6bxqd57knf09r-process-compose-1.40.1"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/0vq97wmm879440n8plsk1yjc1g28ai85-process-compose-1.40.1",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/0vq97wmm879440n8plsk1yjc1g28ai85-process-compose-1.40.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tigerbeetle@latest": {
|
|
||||||
"last_modified": "2024-12-17T11:43:56Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/4989a246d7a390a859852baddb1013f825435cee#tigerbeetle",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "0.16.17",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/89c3g9b3sscjv6nk01zq4h901gm15l7v-tigerbeetle-0.16.17",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/89c3g9b3sscjv6nk01zq4h901gm15l7v-tigerbeetle-0.16.17"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/16l13g01n0vxim291x79apxdhxfg66rh-tigerbeetle-0.16.17",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/16l13g01n0vxim291x79apxdhxfg66rh-tigerbeetle-0.16.17"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/8di9nxpw06kcvzfyhpbwc46y16qjp9gr-tigerbeetle-0.16.17",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/8di9nxpw06kcvzfyhpbwc46y16qjp9gr-tigerbeetle-0.16.17"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/4kldrqg1wm877p4kx4n2ddifq5klxhix-tigerbeetle-0.16.17",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/4kldrqg1wm877p4kx4n2ddifq5klxhix-tigerbeetle-0.16.17"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"cosmossdk.io/core/header"
|
"cosmossdk.io/core/header"
|
||||||
"cosmossdk.io/core/store"
|
"cosmossdk.io/core/store"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/pkg/chain/branch"
|
"github.com/onsonr/sonr/internal/chain/branch"
|
||||||
"github.com/onsonr/sonr/pkg/chain/log"
|
"github.com/onsonr/sonr/internal/chain/log"
|
||||||
"github.com/onsonr/sonr/pkg/chain/router"
|
"github.com/onsonr/sonr/internal/chain/router"
|
||||||
"github.com/onsonr/sonr/pkg/chain/transaction"
|
"github.com/onsonr/sonr/internal/chain/transaction"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Environment is used to get all services to their respective module.
|
// Environment is used to get all services to their respective module.
|
||||||
@@ -3,7 +3,7 @@ package router
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/pkg/chain/transaction"
|
"github.com/onsonr/sonr/internal/chain/transaction"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Service is the interface that wraps the basic methods for a router.
|
// Service is the interface that wraps the basic methods for a router.
|
||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/golang-jwt/jwt"
|
"github.com/golang-jwt/jwt"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/onsonr/sonr/crypto/keys"
|
"github.com/onsonr/sonr/internal/crypto/keys"
|
||||||
"github.com/onsonr/sonr/crypto/ucan"
|
"github.com/onsonr/sonr/internal/crypto/ucan"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IPFSTokenStore interface {
|
type IPFSTokenStore interface {
|
||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
type structMarshal struct {
|
type structMarshal struct {
|
||||||
+1
-1
@@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewAccumulator100(t *testing.T) {
|
func TestNewAccumulator100(t *testing.T) {
|
||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SecretKey is the secret alpha only held by the accumulator manager.
|
// SecretKey is the secret alpha only held by the accumulator manager.
|
||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSecretKeyMarshal(t *testing.T) {
|
func TestSecretKeyMarshal(t *testing.T) {
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// dad constructs two polynomials - dA(x) and dD(x)
|
// dad constructs two polynomials - dA(x) and dD(x)
|
||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEvaluatePolyG1(t *testing.T) {
|
func TestEvaluatePolyG1(t *testing.T) {
|
||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
type proofParamsMarshal struct {
|
type proofParamsMarshal struct {
|
||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProofParamsMarshal(t *testing.T) {
|
func TestProofParamsMarshal(t *testing.T) {
|
||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MembershipWitness contains the witness c and the value y respect to the accumulator state.
|
// MembershipWitness contains the witness c and the value y respect to the accumulator state.
|
||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_Membership_Witness_New(t *testing.T) {
|
func Test_Membership_Witness_New(t *testing.T) {
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// generators contains a list of points to be used as generators for bulletproofs.
|
// generators contains a list of points to be used as generators for bulletproofs.
|
||||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGeneratorsHappyPath(t *testing.T) {
|
func TestGeneratorsHappyPath(t *testing.T) {
|
||||||
@@ -9,7 +9,7 @@ package bulletproof
|
|||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// innerProduct takes two lists of scalars (a, b) and performs the dot product returning a single scalar.
|
// innerProduct takes two lists of scalars (a, b) and performs the dot product returning a single scalar.
|
||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInnerProductHappyPath(t *testing.T) {
|
func TestInnerProductHappyPath(t *testing.T) {
|
||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InnerProductProver is the struct used to create InnerProductProofs
|
// InnerProductProver is the struct used to create InnerProductProofs
|
||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIPPHappyPath(t *testing.T) {
|
func TestIPPHappyPath(t *testing.T) {
|
||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InnerProductVerifier is the struct used to verify inner product proofs
|
// InnerProductVerifier is the struct used to verify inner product proofs
|
||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIPPVerifyHappyPath(t *testing.T) {
|
func TestIPPVerifyHappyPath(t *testing.T) {
|
||||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BatchProve proves that a list of scalars v are in the range n.
|
// BatchProve proves that a list of scalars v are in the range n.
|
||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeBatchProverHappyPath(t *testing.T) {
|
func TestRangeBatchProverHappyPath(t *testing.T) {
|
||||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VerifyBatched verifies a given batched range proof.
|
// VerifyBatched verifies a given batched range proof.
|
||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeBatchVerifyHappyPath(t *testing.T) {
|
func TestRangeBatchVerifyHappyPath(t *testing.T) {
|
||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeProver is the struct used to create RangeProofs
|
// RangeProver is the struct used to create RangeProofs
|
||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeProverHappyPath(t *testing.T) {
|
func TestRangeProverHappyPath(t *testing.T) {
|
||||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeVerifier is the struct used to verify RangeProofs
|
// RangeVerifier is the struct used to verify RangeProofs
|
||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves"
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeVerifyHappyPath(t *testing.T) {
|
func TestRangeVerifyHappyPath(t *testing.T) {
|
||||||
+1
-1
@@ -19,7 +19,7 @@ import (
|
|||||||
bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377"
|
bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core"
|
"github.com/onsonr/sonr/internal/crypto/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// See 'r' = https://eprint.iacr.org/2018/962.pdf Figure 16
|
// See 'r' = https://eprint.iacr.org/2018/962.pdf Figure 16
|
||||||
+3
-3
@@ -13,9 +13,9 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var bls12381modulus = bhex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab")
|
var bls12381modulus = bhex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab")
|
||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -12,10 +12,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core"
|
"github.com/onsonr/sonr/internal/crypto/core"
|
||||||
|
|
||||||
"github.com/dustinxie/ecc"
|
"github.com/dustinxie/ecc"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var curveNameToID = map[string]byte{
|
var curveNameToID = map[string]byte{
|
||||||
@@ -15,8 +15,8 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core"
|
"github.com/onsonr/sonr/internal/crypto/core"
|
||||||
tt "github.com/onsonr/sonr/crypto/internal"
|
tt "github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIsIdentity(t *testing.T) {
|
func TestIsIdentity(t *testing.T) {
|
||||||
@@ -18,9 +18,9 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/bwesterb/go-ristretto"
|
"github.com/bwesterb/go-ristretto"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core"
|
"github.com/onsonr/sonr/internal/crypto/core"
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EcScalar interface {
|
type EcScalar interface {
|
||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/bwesterb/go-ristretto"
|
"github.com/bwesterb/go-ristretto"
|
||||||
ed "github.com/bwesterb/go-ristretto/edwards25519"
|
ed "github.com/bwesterb/go-ristretto/edwards25519"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ScalarEd25519 struct {
|
type ScalarEd25519 struct {
|
||||||
+1
-1
@@ -15,7 +15,7 @@ import (
|
|||||||
ed "filippo.io/edwards25519"
|
ed "filippo.io/edwards25519"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestScalarEd25519Random(t *testing.T) {
|
func TestScalarEd25519Random(t *testing.T) {
|
||||||
+2
-2
@@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
|
|
||||||
mod "github.com/onsonr/sonr/crypto/core"
|
mod "github.com/onsonr/sonr/internal/crypto/core"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkK256(b *testing.B) {
|
func BenchmarkK256(b *testing.B) {
|
||||||
@@ -15,11 +15,11 @@ import (
|
|||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
secp256k1 "github.com/onsonr/sonr/crypto/core/curves/native/k256"
|
secp256k1 "github.com/onsonr/sonr/internal/crypto/core/curves/native/k256"
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native/k256/fp"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256/fp"
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native/k256/fq"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256/fq"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
+1
-1
@@ -3,7 +3,7 @@ package bls12381
|
|||||||
import (
|
import (
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var fqModulusBytes = [native.FieldBytes]byte{0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x5b, 0xfe, 0xff, 0x02, 0xa4, 0xbd, 0x53, 0x05, 0xd8, 0xa1, 0x09, 0x08, 0xd8, 0x39, 0x33, 0x48, 0x7d, 0x9d, 0x29, 0x53, 0xa7, 0xed, 0x73}
|
var fqModulusBytes = [native.FieldBytes]byte{0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x5b, 0xfe, 0xff, 0x02, 0xa4, 0xbd, 0x53, 0x05, 0xd8, 0xa1, 0x09, 0x08, 0xd8, 0x39, 0x33, 0x48, 0x7d, 0x9d, 0x29, 0x53, 0xa7, 0xed, 0x73}
|
||||||
+2
-2
@@ -6,8 +6,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fp field element mod p
|
// fp field element mod p
|
||||||
+1
-1
@@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFpSetOne(t *testing.T) {
|
func TestFpSetOne(t *testing.T) {
|
||||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fq [native.FieldLimbs]uint64
|
type Fq [native.FieldLimbs]uint64
|
||||||
+2
-2
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFqSetOne(t *testing.T) {
|
func TestFqSetOne(t *testing.T) {
|
||||||
+2
-2
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestG1IsOnCurve(t *testing.T) {
|
func TestG1IsOnCurve(t *testing.T) {
|
||||||
+2
-2
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestG2IsOnCurve(t *testing.T) {
|
func TestG2IsOnCurve(t *testing.T) {
|
||||||
+2
-2
@@ -3,8 +3,8 @@ package bls12381
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GtFieldBytes is the number of bytes needed to represent this field
|
// GtFieldBytes is the number of bytes needed to represent this field
|
||||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSinglePairing(t *testing.T) {
|
func TestSinglePairing(t *testing.T) {
|
||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FieldLimbs is the number of limbs needed to represent this field
|
// FieldLimbs is the number of limbs needed to represent this field
|
||||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
+2
-2
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFpSetOne(t *testing.T) {
|
func TestFpSetOne(t *testing.T) {
|
||||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
+2
-2
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/crypto/core/curves/native"
|
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/crypto/internal"
|
"github.com/onsonr/sonr/internal/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFqSetOne(t *testing.T) {
|
func TestFqSetOne(t *testing.T) {
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user