forked from cerc-io/ipld-eth-server
Compare commits
19
Commits
v3.2.2
...
v4.0.3-alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa4428b167 | ||
|
|
221114cf56 | ||
|
|
491939b35f | ||
|
|
a3d2e71ca6 | ||
|
|
81884d4826 | ||
|
|
389ba2e360 | ||
|
|
8ea4d1e40d | ||
|
|
ace12fbc35 | ||
|
|
8b8f644b2a | ||
|
|
8bfcce95ca | ||
|
|
0b12c3c329 | ||
|
|
037131528c | ||
|
|
04096fab0c | ||
|
|
dc14656bbc | ||
|
|
9676690a2d | ||
|
|
36e590c092 | ||
|
|
384d939dc2 | ||
|
|
24a45a3f00 | ||
|
|
867323a1ab |
@@ -8,22 +8,30 @@ temp_dir=$(mktemp -d)
|
|||||||
cd $temp_dir
|
cd $temp_dir
|
||||||
git clone -b $(cat /tmp/git_head_ref) "https://github.com/$(cat /tmp/git_repository).git"
|
git clone -b $(cat /tmp/git_head_ref) "https://github.com/$(cat /tmp/git_repository).git"
|
||||||
cd ipld-eth-server
|
cd ipld-eth-server
|
||||||
|
mkdir -p out
|
||||||
|
|
||||||
## Remove the branch and github related info. This way future runs wont be confused.
|
## Remove the branch and github related info. This way future runs wont be confused.
|
||||||
rm -f /tmp/git_head_ref /tmp/git_repository
|
rm -f /tmp/git_head_ref /tmp/git_repository
|
||||||
|
|
||||||
# Spin up DB
|
# Remove existing docker-tsdb directory
|
||||||
docker-compose -f docker-compose.yml up -d ipld-eth-db
|
rm -rf out/docker-tsdb/
|
||||||
trap "docker-compose down --remove-orphans; cd $start_dir ; rm -r $temp_dir" SIGINT SIGTERM ERR
|
|
||||||
sleep 10
|
# Copy over files to setup TimescaleDB
|
||||||
|
ID=$(docker create vulcanize/ipld-eth-db:v4.1.1-alpha)
|
||||||
|
docker cp $ID:/app/docker-tsdb out/docker-tsdb/
|
||||||
|
docker rm -v $ID
|
||||||
|
|
||||||
|
# Spin up TimescaleDB
|
||||||
|
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml up ipld-eth-db
|
||||||
|
trap "docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes; cd $start_dir ; rm -r $temp_dir" SIGINT SIGTERM ERR
|
||||||
|
sleep 45
|
||||||
|
|
||||||
# Remove old logs so there's no confusion, then run test
|
# Remove old logs so there's no confusion, then run test
|
||||||
rm -f /tmp/test.log /tmp/return_test.txt
|
rm -f /tmp/test.log /tmp/return_test.txt
|
||||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test > /tmp/test.log
|
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8066 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing_v4 make test > /tmp/test.log
|
||||||
echo $? > /tmp/return_test.txt
|
echo $? > /tmp/return_test.txt
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
docker-compose -f docker-compose.yml down -v --remove-orphans
|
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes
|
||||||
cd $start_dir
|
cd $start_dir
|
||||||
rm -fr $temp_dir
|
rm -fr $temp_dir
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ jobs:
|
|||||||
chmod 400 /tmp/key
|
chmod 400 /tmp/key
|
||||||
cat /tmp/git_repository
|
cat /tmp/git_repository
|
||||||
cat /tmp/git_head_ref
|
cat /tmp/git_head_ref
|
||||||
echo
|
|
||||||
|
|
||||||
- name: Raw SCP
|
- name: Raw SCP
|
||||||
run: |
|
run: |
|
||||||
@@ -69,8 +68,9 @@ jobs:
|
|||||||
integrationtest:
|
integrationtest:
|
||||||
name: Run integration tests
|
name: Run integration tests
|
||||||
env:
|
env:
|
||||||
STACK_ORCHESTRATOR_REF: fcbc74451c5494664fe21f765e89c9c6565c07cb
|
STACK_ORCHESTRATOR_REF: 418957a1f745c921b21286c13bb033f922a91ae9
|
||||||
GO_ETHEREUM_REF: 498101102c891c4f8c3cab5649158c642ee1fd6b
|
GO_ETHEREUM_REF: "v1.10.18-statediff-4.0.2-alpha"
|
||||||
|
IPLD_ETH_DB_REF: 91d30b9ea1acecd0a7f4307390a98bf3e289b8d7
|
||||||
GOPATH: /tmp/go
|
GOPATH: /tmp/go
|
||||||
DB_WRITE: true
|
DB_WRITE: true
|
||||||
ETH_FORWARD_ETH_CALLS: false
|
ETH_FORWARD_ETH_CALLS: false
|
||||||
@@ -97,14 +97,26 @@ jobs:
|
|||||||
ref: ${{ env.GO_ETHEREUM_REF }}
|
ref: ${{ env.GO_ETHEREUM_REF }}
|
||||||
repository: vulcanize/go-ethereum
|
repository: vulcanize/go-ethereum
|
||||||
path: "./go-ethereum/"
|
path: "./go-ethereum/"
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ env.IPLD_ETH_DB_REF }}
|
||||||
|
repository: vulcanize/ipld-eth-db
|
||||||
|
path: "./ipld-eth-db/"
|
||||||
- name: Create config file
|
- name: Create config file
|
||||||
run: |
|
run: |
|
||||||
echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh
|
echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh
|
||||||
|
echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ >> ./config.sh
|
||||||
echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh
|
echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh
|
||||||
|
echo vulcanize_test_contract=$GITHUB_WORKSPACE/ipld-eth-server/test/contract >> ./config.sh
|
||||||
echo db_write=$DB_WRITE >> ./config.sh
|
echo db_write=$DB_WRITE >> ./config.sh
|
||||||
echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh
|
echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh
|
||||||
echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh
|
echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh
|
||||||
echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh
|
echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh
|
||||||
|
echo ipld_eth_server_db_dependency=access-node >> ./config.sh
|
||||||
|
echo go_ethereum_db_dependency=access-node >> ./config.sh
|
||||||
|
echo connecting_db_name=vulcanize_testing_v4 >> ./config.sh
|
||||||
|
echo watched_address_gap_filler_enabled=false >> ./config.sh
|
||||||
|
echo watched_address_gap_filler_interval=5 >> ./config.sh
|
||||||
cat ./config.sh
|
cat ./config.sh
|
||||||
- name: Build geth
|
- name: Build geth
|
||||||
run: |
|
run: |
|
||||||
@@ -115,9 +127,11 @@ jobs:
|
|||||||
- name: Run docker compose
|
- name: Run docker compose
|
||||||
run: |
|
run: |
|
||||||
docker-compose \
|
docker-compose \
|
||||||
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-db.yml" \
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-migration.yml" \
|
||||||
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \
|
||||||
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \
|
||||||
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-contract.yml" \
|
||||||
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-timescale-db.yml" \
|
||||||
--env-file "$GITHUB_WORKSPACE/config.sh" \
|
--env-file "$GITHUB_WORKSPACE/config.sh" \
|
||||||
up -d --build
|
up -d --build
|
||||||
- name: Test
|
- name: Test
|
||||||
@@ -130,8 +144,9 @@ jobs:
|
|||||||
integrationtest_forwardethcalls:
|
integrationtest_forwardethcalls:
|
||||||
name: Run integration tests for direct proxy fall-through of eth_calls
|
name: Run integration tests for direct proxy fall-through of eth_calls
|
||||||
env:
|
env:
|
||||||
STACK_ORCHESTRATOR_REF: fcbc74451c5494664fe21f765e89c9c6565c07cb
|
STACK_ORCHESTRATOR_REF: 418957a1f745c921b21286c13bb033f922a91ae9
|
||||||
GO_ETHEREUM_REF: 498101102c891c4f8c3cab5649158c642ee1fd6b
|
GO_ETHEREUM_REF: "v1.10.18-statediff-4.0.2-alpha"
|
||||||
|
IPLD_ETH_DB_REF: 91d30b9ea1acecd0a7f4307390a98bf3e289b8d7
|
||||||
GOPATH: /tmp/go
|
GOPATH: /tmp/go
|
||||||
DB_WRITE: false
|
DB_WRITE: false
|
||||||
ETH_FORWARD_ETH_CALLS: true
|
ETH_FORWARD_ETH_CALLS: true
|
||||||
@@ -158,14 +173,26 @@ jobs:
|
|||||||
ref: ${{ env.GO_ETHEREUM_REF }}
|
ref: ${{ env.GO_ETHEREUM_REF }}
|
||||||
repository: vulcanize/go-ethereum
|
repository: vulcanize/go-ethereum
|
||||||
path: "./go-ethereum/"
|
path: "./go-ethereum/"
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ env.IPLD_ETH_DB_REF }}
|
||||||
|
repository: vulcanize/ipld-eth-db
|
||||||
|
path: "./ipld-eth-db/"
|
||||||
- name: Create config file
|
- name: Create config file
|
||||||
run: |
|
run: |
|
||||||
echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh
|
echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh
|
||||||
|
echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ >> ./config.sh
|
||||||
echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh
|
echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh
|
||||||
|
echo vulcanize_test_contract=$GITHUB_WORKSPACE/ipld-eth-server/test/contract >>./config.sh
|
||||||
echo db_write=$DB_WRITE >> ./config.sh
|
echo db_write=$DB_WRITE >> ./config.sh
|
||||||
echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh
|
echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh
|
||||||
echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh
|
echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh
|
||||||
echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh
|
echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh
|
||||||
|
echo ipld_eth_server_db_dependency=access-node >> ./config.sh
|
||||||
|
echo go_ethereum_db_dependency=access-node >> ./config.sh
|
||||||
|
echo connecting_db_name=vulcanize_testing_v4 >> ./config.sh
|
||||||
|
echo watched_address_gap_filler_enabled=false >> ./config.sh
|
||||||
|
echo watched_address_gap_filler_interval=5 >> ./config.sh
|
||||||
cat ./config.sh
|
cat ./config.sh
|
||||||
- name: Build geth
|
- name: Build geth
|
||||||
run: |
|
run: |
|
||||||
@@ -176,9 +203,11 @@ jobs:
|
|||||||
- name: Run docker compose
|
- name: Run docker compose
|
||||||
run: |
|
run: |
|
||||||
docker-compose \
|
docker-compose \
|
||||||
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-db.yml" \
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-migration.yml" \
|
||||||
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \
|
||||||
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \
|
||||||
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-contract.yml" \
|
||||||
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-timescale-db.yml" \
|
||||||
--env-file "$GITHUB_WORKSPACE/config.sh" \
|
--env-file "$GITHUB_WORKSPACE/config.sh" \
|
||||||
up -d --build
|
up -d --build
|
||||||
- name: Test
|
- name: Test
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ External dependency
|
|||||||
## Install
|
## Install
|
||||||
Start by downloading ipld-eth-server and moving into the repo:
|
Start by downloading ipld-eth-server and moving into the repo:
|
||||||
|
|
||||||
`GO111MODULE=off go get -d github.com/vulcanize/ipld-eth-server/v3`
|
`GO111MODULE=off go get -d github.com/vulcanize/ipld-eth-server/v4`
|
||||||
|
|
||||||
`cd $GOPATH/src/github.com/vulcanize/ipld-eth-server/v3@v3.x.x`
|
`cd $GOPATH/src/github.com/vulcanize/ipld-eth-server/v4@v4.x.x`
|
||||||
|
|
||||||
Then, build the binary:
|
Then, build the binary:
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/prom"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/prom"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
+5
-5
@@ -32,11 +32,11 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"github.com/vulcanize/gap-filler/pkg/mux"
|
"github.com/vulcanize/gap-filler/pkg/mux"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/graphql"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/graphql"
|
||||||
srpc "github.com/vulcanize/ipld-eth-server/v3/pkg/rpc"
|
srpc "github.com/vulcanize/ipld-eth-server/v4/pkg/rpc"
|
||||||
s "github.com/vulcanize/ipld-eth-server/v3/pkg/serve"
|
s "github.com/vulcanize/ipld-eth-server/v4/pkg/serve"
|
||||||
v "github.com/vulcanize/ipld-eth-server/v3/version"
|
v "github.com/vulcanize/ipld-eth-server/v4/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrNoRpcEndpoints = errors.New("no rpc endpoints is available")
|
var ErrNoRpcEndpoints = errors.New("no rpc endpoints is available")
|
||||||
|
|||||||
+3
-3
@@ -27,9 +27,9 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/client"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/client"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
w "github.com/vulcanize/ipld-eth-server/v3/pkg/serve"
|
w "github.com/vulcanize/ipld-eth-server/v4/pkg/serve"
|
||||||
)
|
)
|
||||||
|
|
||||||
// subscribeCmd represents the subscribe command
|
// subscribeCmd represents the subscribe command
|
||||||
|
|||||||
+3
-3
@@ -22,10 +22,10 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
validator "github.com/vulcanize/eth-ipfs-state-validator/v3/pkg"
|
validator "github.com/vulcanize/eth-ipfs-state-validator/v4/pkg"
|
||||||
ipfsethdb "github.com/vulcanize/ipfs-ethdb/v3/postgres"
|
ipfsethdb "github.com/vulcanize/ipfs-ethdb/v4/postgres"
|
||||||
|
|
||||||
s "github.com/vulcanize/ipld-eth-server/v3/pkg/serve"
|
s "github.com/vulcanize/ipld-eth-server/v4/pkg/serve"
|
||||||
)
|
)
|
||||||
|
|
||||||
const GroupName = "statedb-validate"
|
const GroupName = "statedb-validate"
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
v "github.com/vulcanize/ipld-eth-server/v3/version"
|
v "github.com/vulcanize/ipld-eth-server/v4/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// versionCmd represents the version command
|
// versionCmd represents the version command
|
||||||
|
|||||||
+9
-10
@@ -2,17 +2,16 @@ version: '3.2'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
ipld-eth-db:
|
ipld-eth-db:
|
||||||
restart: always
|
restart: on-failure
|
||||||
image: vulcanize/ipld-eth-db:v3.2.0
|
depends_on:
|
||||||
|
- access-node
|
||||||
|
image: vulcanize/ipld-eth-db:v4.1.1-alpha
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: "vdbm"
|
DATABASE_USER: "vdbm"
|
||||||
POSTGRES_DB: "vulcanize_testing"
|
DATABASE_NAME: "vulcanize_testing_v4"
|
||||||
POSTGRES_PASSWORD: "password"
|
DATABASE_PASSWORD: "password"
|
||||||
volumes:
|
DATABASE_HOSTNAME: "access-node"
|
||||||
- vdb_db_eth_server:/var/lib/postgresql/data
|
DATABASE_PORT: 5432
|
||||||
ports:
|
|
||||||
- "127.0.0.1:8077:5432"
|
|
||||||
command: ["postgres", "-c", "log_statement=all"]
|
|
||||||
|
|
||||||
eth-server:
|
eth-server:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ An example of how to subscribe to a real-time Ethereum data feed from ipld-eth-s
|
|||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/client"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/client"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/watch"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
config, _ := eth.NewEthSubscriptionConfig()
|
config, _ := eth.NewEthSubscriptionConfig()
|
||||||
@@ -160,9 +160,9 @@ An example of how to subscribe to a real-time Bitcoin data feed from ipld-eth-se
|
|||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/btc"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/btc"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/client"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/client"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/watch"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
config, _ := btc.NewBtcSubscriptionConfig()
|
config, _ := btc.NewBtcSubscriptionConfig()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module github.com/vulcanize/ipld-eth-server/v3
|
module github.com/vulcanize/ipld-eth-server/v4
|
||||||
|
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
@@ -9,11 +9,9 @@ require (
|
|||||||
github.com/ipfs/go-cid v0.0.7
|
github.com/ipfs/go-cid v0.0.7
|
||||||
github.com/ipfs/go-ipfs-blockstore v1.0.1
|
github.com/ipfs/go-ipfs-blockstore v1.0.1
|
||||||
github.com/ipfs/go-ipfs-ds-help v1.0.0
|
github.com/ipfs/go-ipfs-ds-help v1.0.0
|
||||||
github.com/ipfs/go-ipld-format v0.2.0
|
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
|
||||||
github.com/jmoiron/sqlx v1.3.5
|
github.com/jmoiron/sqlx v1.3.5
|
||||||
github.com/joho/godotenv v1.4.0
|
github.com/joho/godotenv v1.4.0
|
||||||
github.com/lib/pq v1.10.5
|
github.com/lib/pq v1.10.6
|
||||||
github.com/machinebox/graphql v0.2.2
|
github.com/machinebox/graphql v0.2.2
|
||||||
github.com/mailgun/groupcache/v2 v2.3.0
|
github.com/mailgun/groupcache/v2 v2.3.0
|
||||||
github.com/multiformats/go-multihash v0.1.0
|
github.com/multiformats/go-multihash v0.1.0
|
||||||
@@ -23,17 +21,16 @@ require (
|
|||||||
github.com/sirupsen/logrus v1.8.1
|
github.com/sirupsen/logrus v1.8.1
|
||||||
github.com/spf13/cobra v1.4.0
|
github.com/spf13/cobra v1.4.0
|
||||||
github.com/spf13/viper v1.11.0
|
github.com/spf13/viper v1.11.0
|
||||||
github.com/thoas/go-funk v0.9.2 // indirect
|
github.com/vulcanize/eth-ipfs-state-validator/v4 v4.0.1-alpha
|
||||||
github.com/vulcanize/eth-ipfs-state-validator/v3 v3.0.2
|
|
||||||
github.com/vulcanize/gap-filler v0.3.1
|
github.com/vulcanize/gap-filler v0.3.1
|
||||||
github.com/vulcanize/ipfs-ethdb/v3 v3.0.3
|
github.com/vulcanize/ipfs-ethdb/v4 v4.0.1-alpha
|
||||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
|
||||||
gorm.io/driver/postgres v1.3.7
|
gorm.io/driver/postgres v1.3.7
|
||||||
gorm.io/gorm v1.23.5
|
gorm.io/gorm v1.23.5
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc // indirect
|
bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc // indirect
|
||||||
|
github.com/ClickHouse/clickhouse-go v1.5.4 // indirect
|
||||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
||||||
github.com/Stebalien/go-bitfield v0.0.1 // indirect
|
github.com/Stebalien/go-bitfield v0.0.1 // indirect
|
||||||
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
|
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
|
||||||
@@ -46,6 +43,7 @@ require (
|
|||||||
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
|
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.1.1 // indirect
|
github.com/cespare/xxhash/v2 v2.1.1 // indirect
|
||||||
github.com/cheekybits/genny v1.0.0 // indirect
|
github.com/cheekybits/genny v1.0.0 // indirect
|
||||||
|
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect
|
||||||
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
|
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
|
||||||
github.com/cskr/pubsub v1.0.2 // indirect
|
github.com/cskr/pubsub v1.0.2 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
@@ -53,6 +51,7 @@ require (
|
|||||||
github.com/deckarep/golang-set v1.8.0 // indirect
|
github.com/deckarep/golang-set v1.8.0 // indirect
|
||||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||||
github.com/deepmap/oapi-codegen v1.8.2 // indirect
|
github.com/deepmap/oapi-codegen v1.8.2 // indirect
|
||||||
|
github.com/denisenkom/go-mssqldb v0.12.2 // indirect
|
||||||
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
||||||
github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 // indirect
|
github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 // indirect
|
||||||
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
|
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
|
||||||
@@ -63,10 +62,13 @@ require (
|
|||||||
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
|
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
|
||||||
github.com/georgysavva/scany v0.2.9 // indirect
|
github.com/georgysavva/scany v0.2.9 // indirect
|
||||||
github.com/go-ole/go-ole v1.2.1 // indirect
|
github.com/go-ole/go-ole v1.2.1 // indirect
|
||||||
|
github.com/go-sql-driver/mysql v1.6.0 // indirect
|
||||||
github.com/go-stack/stack v1.8.0 // indirect
|
github.com/go-stack/stack v1.8.0 // indirect
|
||||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
|
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
github.com/golang-jwt/jwt/v4 v4.3.0 // indirect
|
github.com/golang-jwt/jwt/v4 v4.3.0 // indirect
|
||||||
|
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
|
||||||
|
github.com/golang-sql/sqlexp v0.1.0 // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/gopacket v1.1.19 // indirect
|
github.com/google/gopacket v1.1.19 // indirect
|
||||||
@@ -111,6 +113,7 @@ require (
|
|||||||
github.com/ipfs/go-ipfs-routing v0.1.0 // indirect
|
github.com/ipfs/go-ipfs-routing v0.1.0 // indirect
|
||||||
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
|
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
|
||||||
github.com/ipfs/go-ipld-cbor v0.0.5 // indirect
|
github.com/ipfs/go-ipld-cbor v0.0.5 // indirect
|
||||||
|
github.com/ipfs/go-ipld-format v0.2.0 // indirect
|
||||||
github.com/ipfs/go-ipld-legacy v0.1.0 // indirect
|
github.com/ipfs/go-ipld-legacy v0.1.0 // indirect
|
||||||
github.com/ipfs/go-ipns v0.1.2 // indirect
|
github.com/ipfs/go-ipns v0.1.2 // indirect
|
||||||
github.com/ipfs/go-log v1.0.5 // indirect
|
github.com/ipfs/go-log v1.0.5 // indirect
|
||||||
@@ -141,6 +144,7 @@ require (
|
|||||||
github.com/jbenet/goprocess v0.1.4 // indirect
|
github.com/jbenet/goprocess v0.1.4 // indirect
|
||||||
github.com/jinzhu/copier v0.2.4 // indirect
|
github.com/jinzhu/copier v0.2.4 // indirect
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
|
github.com/jinzhu/now v1.1.4 // indirect
|
||||||
github.com/klauspost/compress v1.11.7 // indirect
|
github.com/klauspost/compress v1.11.7 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
||||||
github.com/koron/go-ssdp v0.0.2 // indirect
|
github.com/koron/go-ssdp v0.0.2 // indirect
|
||||||
@@ -201,6 +205,7 @@ require (
|
|||||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||||
github.com/miekg/dns v1.1.43 // indirect
|
github.com/miekg/dns v1.1.43 // indirect
|
||||||
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
|
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
|
||||||
@@ -230,6 +235,7 @@ require (
|
|||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect
|
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect
|
||||||
|
github.com/pressly/goose v2.7.0+incompatible // indirect
|
||||||
github.com/prometheus/client_model v0.2.0 // indirect
|
github.com/prometheus/client_model v0.2.0 // indirect
|
||||||
github.com/prometheus/common v0.30.0 // indirect
|
github.com/prometheus/common v0.30.0 // indirect
|
||||||
github.com/prometheus/procfs v0.7.3 // indirect
|
github.com/prometheus/procfs v0.7.3 // indirect
|
||||||
@@ -249,6 +255,7 @@ require (
|
|||||||
github.com/stretchr/testify v1.7.1 // indirect
|
github.com/stretchr/testify v1.7.1 // indirect
|
||||||
github.com/subosito/gotenv v1.2.0 // indirect
|
github.com/subosito/gotenv v1.2.0 // indirect
|
||||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
|
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
|
||||||
|
github.com/thoas/go-funk v0.9.2 // indirect
|
||||||
github.com/tklauser/go-sysconf v0.3.5 // indirect
|
github.com/tklauser/go-sysconf v0.3.5 // indirect
|
||||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||||
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef // indirect
|
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef // indirect
|
||||||
@@ -260,6 +267,7 @@ require (
|
|||||||
github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 // indirect
|
github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 // indirect
|
||||||
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect
|
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect
|
||||||
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
|
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
|
||||||
|
github.com/ziutek/mymysql v1.5.4 // indirect
|
||||||
go.opencensus.io v0.23.0 // indirect
|
go.opencensus.io v0.23.0 // indirect
|
||||||
go.opentelemetry.io/otel v0.20.0 // indirect
|
go.opentelemetry.io/otel v0.20.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v0.20.0 // indirect
|
go.opentelemetry.io/otel/metric v0.20.0 // indirect
|
||||||
@@ -270,6 +278,7 @@ require (
|
|||||||
go.uber.org/multierr v1.7.0 // indirect
|
go.uber.org/multierr v1.7.0 // indirect
|
||||||
go.uber.org/zap v1.19.0 // indirect
|
go.uber.org/zap v1.19.0 // indirect
|
||||||
go4.org v0.0.0-20200411211856-f5505b9728dd // indirect
|
go4.org v0.0.0-20200411211856-f5505b9728dd // indirect
|
||||||
|
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
||||||
golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57 // indirect
|
golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57 // indirect
|
||||||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
|
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||||
@@ -288,4 +297,4 @@ require (
|
|||||||
lukechampine.com/blake3 v1.1.6 // indirect
|
lukechampine.com/blake3 v1.1.6 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/ethereum/go-ethereum v1.10.18 => github.com/vulcanize/go-ethereum v1.10.18-statediff-3.2.2
|
replace github.com/ethereum/go-ethereum v1.10.18 => github.com/vulcanize/go-ethereum v1.10.18-statediff-4.0.2-alpha
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIo
|
|||||||
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
|
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
|
||||||
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
|
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
|
||||||
github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc=
|
github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc=
|
||||||
|
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM=
|
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM=
|
||||||
|
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0=
|
||||||
|
github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I=
|
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo=
|
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo=
|
||||||
github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4=
|
github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4=
|
||||||
@@ -73,6 +76,8 @@ github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6L
|
|||||||
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
|
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
|
github.com/ClickHouse/clickhouse-go v1.5.4 h1:cKjXeYLNWVJIx2J1K6H2CqyRmfwVJVY1OV1coaaFcI0=
|
||||||
|
github.com/ClickHouse/clickhouse-go v1.5.4/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
|
||||||
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||||
github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y=
|
github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y=
|
||||||
@@ -136,6 +141,7 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
|
|||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
|
github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4=
|
||||||
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
|
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
|
||||||
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
|
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
|
||||||
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
||||||
@@ -193,6 +199,8 @@ github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4
|
|||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U=
|
github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U=
|
||||||
github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304=
|
github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304=
|
||||||
|
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg=
|
||||||
|
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||||
@@ -252,6 +260,8 @@ github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE
|
|||||||
github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=
|
github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=
|
||||||
github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw=
|
github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw=
|
||||||
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||||
|
github.com/denisenkom/go-mssqldb v0.12.2 h1:1OcPn5GBIobjWNd+8yjfHNIaFX14B1pWI3F9HZy5KXw=
|
||||||
|
github.com/denisenkom/go-mssqldb v0.12.2/go.mod h1:lnIw1mZukFRZDJYQ0Pb833QS2IaC3l5HkEfra2LJ+sk=
|
||||||
github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ=
|
github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ=
|
||||||
github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
||||||
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
||||||
@@ -382,6 +392,10 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69
|
|||||||
github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog=
|
github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog=
|
||||||
github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||||
|
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
|
||||||
|
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||||
|
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
|
||||||
|
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||||
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
@@ -875,9 +889,8 @@ github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZ
|
|||||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||||
|
github.com/jinzhu/now v1.1.4 h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas=
|
||||||
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
|
||||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
|
||||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||||
@@ -958,6 +971,8 @@ github.com/lib/pq v1.4.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
|||||||
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
github.com/lib/pq v1.10.5 h1:J+gdV2cUmX7ZqL2B0lFcW0m+egaHC2V3lpO8nWxyYiQ=
|
github.com/lib/pq v1.10.5 h1:J+gdV2cUmX7ZqL2B0lFcW0m+egaHC2V3lpO8nWxyYiQ=
|
||||||
github.com/lib/pq v1.10.5/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
github.com/lib/pq v1.10.5/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
|
github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs=
|
||||||
|
github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ=
|
github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ=
|
||||||
github.com/libp2p/go-addr-util v0.0.2/go.mod h1:Ecd6Fb3yIuLzq4bD7VcywcVSBtefcAwnUISBM3WG15E=
|
github.com/libp2p/go-addr-util v0.0.2/go.mod h1:Ecd6Fb3yIuLzq4bD7VcywcVSBtefcAwnUISBM3WG15E=
|
||||||
github.com/libp2p/go-addr-util v0.1.0 h1:acKsntI33w2bTU7tC9a0SaPimJGfSI0bFKC18ChxeVI=
|
github.com/libp2p/go-addr-util v0.1.0 h1:acKsntI33w2bTU7tC9a0SaPimJGfSI0bFKC18ChxeVI=
|
||||||
@@ -1353,6 +1368,8 @@ github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsO
|
|||||||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||||
github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw=
|
github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw=
|
||||||
github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
|
github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
@@ -1546,6 +1563,7 @@ github.com/pganalyze/pg_query_go/v2 v2.1.0/go.mod h1:XAxmVqz1tEGqizcQ3YSdN90vCOH
|
|||||||
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||||
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
|
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
|
||||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||||
|
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
@@ -1561,6 +1579,8 @@ github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXx
|
|||||||
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e h1:ZOcivgkkFRnjfoTcGsDq3UQYiBmekwLA+qg0OjyB/ls=
|
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e h1:ZOcivgkkFRnjfoTcGsDq3UQYiBmekwLA+qg0OjyB/ls=
|
||||||
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
||||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||||
|
github.com/pressly/goose v2.7.0+incompatible h1:PWejVEv07LCerQEzMMeAtjuyCKbyprZ/LBa6K5P0OCQ=
|
||||||
|
github.com/pressly/goose v2.7.0+incompatible/go.mod h1:m+QHWCqxR3k8D9l7qfzuC/djtlfzxr34mozWDYEu1z8=
|
||||||
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
||||||
@@ -1775,14 +1795,14 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
|
|||||||
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||||
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
|
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
|
||||||
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
|
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
|
||||||
github.com/vulcanize/eth-ipfs-state-validator/v3 v3.0.2 h1:YZ24WFrrnTC3of2EFfMIQsGUCk1hkDu++l0TIw6RrFw=
|
github.com/vulcanize/eth-ipfs-state-validator/v4 v4.0.1-alpha h1:3q3siR+ZzbpJ7b0LsMsVyHj7/PJYNf+0XM48LinLUTw=
|
||||||
github.com/vulcanize/eth-ipfs-state-validator/v3 v3.0.2/go.mod h1:PrVSnKWJhnbCYUAIHESAwnXITN5df3IBckmkmQIBv7o=
|
github.com/vulcanize/eth-ipfs-state-validator/v4 v4.0.1-alpha/go.mod h1:L+0oYQrOUXO7vly1WNT9CUi1ydk5+JEW70q6EqLS4SI=
|
||||||
github.com/vulcanize/gap-filler v0.3.1 h1:N5d+jCJo/VTWFvBSbTD7biRhK/OqDZzi1tgA85SIBKs=
|
github.com/vulcanize/gap-filler v0.3.1 h1:N5d+jCJo/VTWFvBSbTD7biRhK/OqDZzi1tgA85SIBKs=
|
||||||
github.com/vulcanize/gap-filler v0.3.1/go.mod h1:qowG1cgshVpBqMokiWro/1xhh0uypw7oAu8FQ42JMy4=
|
github.com/vulcanize/gap-filler v0.3.1/go.mod h1:qowG1cgshVpBqMokiWro/1xhh0uypw7oAu8FQ42JMy4=
|
||||||
github.com/vulcanize/go-ethereum v1.10.18-statediff-3.2.2 h1:hAZFOtnfdHtVgiwtcNFZDxCEN01c4W5Xsw+1K/IlHBA=
|
github.com/vulcanize/go-ethereum v1.10.18-statediff-4.0.2-alpha h1:gTcfBHoaRpsRbP1/dnurg5LFUaqsQMTNqs4R4S2wm9U=
|
||||||
github.com/vulcanize/go-ethereum v1.10.18-statediff-3.2.2/go.mod h1:HelXH7UT1uWdb+St6UAj4pPf93GOggjIV7pVbrWIZ3o=
|
github.com/vulcanize/go-ethereum v1.10.18-statediff-4.0.2-alpha/go.mod h1:HelXH7UT1uWdb+St6UAj4pPf93GOggjIV7pVbrWIZ3o=
|
||||||
github.com/vulcanize/ipfs-ethdb/v3 v3.0.3 h1:KyNMtSKZk2ZuU+mwAv/SdNEeigFkCxvsTDqxHDpwUL8=
|
github.com/vulcanize/ipfs-ethdb/v4 v4.0.1-alpha h1:VxZONVJMxAC6vLhmlQsC3zhmY0D2A3DUoGAn8az6pXY=
|
||||||
github.com/vulcanize/ipfs-ethdb/v3 v3.0.3/go.mod h1:hi3c5YadpoJc0A6Du9OzEAhGxtk0S1pTSAY/rApvuA0=
|
github.com/vulcanize/ipfs-ethdb/v4 v4.0.1-alpha/go.mod h1:K2ayGLsvsHcm+4A9oD3mwMLElNjw7yn70h+KXo6JdrU=
|
||||||
github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE=
|
github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE=
|
||||||
github.com/warpfork/go-testmark v0.3.0 h1:Q81c4u7hT+BR5kNfNQhEF0VT2pmL7+Kk0wD+ORYl7iA=
|
github.com/warpfork/go-testmark v0.3.0 h1:Q81c4u7hT+BR5kNfNQhEF0VT2pmL7+Kk0wD+ORYl7iA=
|
||||||
github.com/warpfork/go-testmark v0.3.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0=
|
github.com/warpfork/go-testmark v0.3.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0=
|
||||||
@@ -1825,6 +1845,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
|
|||||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||||
|
github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
|
||||||
|
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
|
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
|
||||||
@@ -1918,6 +1940,7 @@ golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPh
|
|||||||
golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||||
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||||
@@ -1930,6 +1953,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
|
|||||||
golang.org/x/crypto v0.0.0-20210813211128-0a44fdfbc16e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210813211128-0a44fdfbc16e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
|
||||||
|
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM=
|
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM=
|
||||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/cmd"
|
"github.com/vulcanize/ipld-eth-server/v4/cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ import (
|
|||||||
|
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/serve"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/serve"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client is used to subscribe to the ipld-eth-server ipld data stream
|
// Client is used to subscribe to the ipld-eth-server ipld data stream
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/statediff"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// APIName is the namespace for the watcher's eth api
|
// APIName is the namespace for the watcher's eth api
|
||||||
|
|||||||
+4
-4
@@ -36,10 +36,10 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth/test_helpers"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
ethServerShared "github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
ethServerShared "github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
+22
-11
@@ -43,12 +43,12 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/trie"
|
"github.com/ethereum/go-ethereum/trie"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
validator "github.com/vulcanize/eth-ipfs-state-validator/v3/pkg"
|
validator "github.com/vulcanize/eth-ipfs-state-validator/v4/pkg"
|
||||||
ipfsethdb "github.com/vulcanize/ipfs-ethdb/v3/postgres"
|
ipfsethdb "github.com/vulcanize/ipfs-ethdb/v4/postgres"
|
||||||
|
|
||||||
ethServerShared "github.com/ethereum/go-ethereum/statediff/indexer/shared"
|
ethServerShared "github.com/ethereum/go-ethereum/statediff/indexer/shared"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -59,31 +59,42 @@ var (
|
|||||||
|
|
||||||
// errMissingSignature is returned if a block's extra-data section doesn't seem
|
// errMissingSignature is returned if a block's extra-data section doesn't seem
|
||||||
// to contain a 65 byte secp256k1 signature.
|
// to contain a 65 byte secp256k1 signature.
|
||||||
errMissingSignature = errors.New("extra-data 65 byte signature suffix missing")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RetrieveCanonicalBlockHashByNumber = `SELECT block_hash FROM eth.header_cids
|
RetrieveCanonicalBlockHashByNumber = `SELECT block_hash FROM eth.header_cids
|
||||||
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
header_cids.mh_key = blocks.key
|
||||||
|
AND header_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = (SELECT canonical_header_hash($1))`
|
WHERE block_hash = (SELECT canonical_header_hash($1))`
|
||||||
RetrieveCanonicalHeaderByNumber = `SELECT cid, data FROM eth.header_cids
|
RetrieveCanonicalHeaderByNumber = `SELECT cid, data FROM eth.header_cids
|
||||||
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
header_cids.mh_key = blocks.key
|
||||||
|
AND header_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = (SELECT canonical_header_hash($1))`
|
WHERE block_hash = (SELECT canonical_header_hash($1))`
|
||||||
RetrieveTD = `SELECT CAST(td as Text) FROM eth.header_cids
|
RetrieveTD = `SELECT CAST(td as Text) FROM eth.header_cids
|
||||||
WHERE header_cids.block_hash = $1`
|
WHERE header_cids.block_hash = $1`
|
||||||
RetrieveRPCTransaction = `SELECT blocks.data, block_hash, block_number, index FROM public.blocks, eth.transaction_cids, eth.header_cids
|
RetrieveRPCTransaction = `SELECT blocks.data, block_hash, transaction_cids.block_number, index
|
||||||
|
FROM public.blocks, eth.transaction_cids, eth.header_cids
|
||||||
WHERE blocks.key = transaction_cids.mh_key
|
WHERE blocks.key = transaction_cids.mh_key
|
||||||
|
AND blocks.block_number = transaction_cids.block_number
|
||||||
AND transaction_cids.header_id = header_cids.block_hash
|
AND transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number
|
||||||
AND transaction_cids.tx_hash = $1`
|
AND transaction_cids.tx_hash = $1`
|
||||||
RetrieveCodeHashByLeafKeyAndBlockHash = `SELECT code_hash FROM eth.state_accounts, eth.state_cids, eth.header_cids
|
RetrieveCodeHashByLeafKeyAndBlockHash = `SELECT code_hash FROM eth.state_accounts, eth.state_cids, eth.header_cids
|
||||||
WHERE state_accounts.header_id = state_cids.header_id AND state_accounts.state_path = state_cids.state_path
|
WHERE state_accounts.header_id = state_cids.header_id
|
||||||
|
AND state_accounts.state_path = state_cids.state_path
|
||||||
|
AND state_accounts.block_number = state_cids.block_number
|
||||||
AND state_cids.header_id = header_cids.block_hash
|
AND state_cids.header_id = header_cids.block_hash
|
||||||
|
AND state_cids.block_number = header_cids.block_number
|
||||||
AND state_leaf_key = $1
|
AND state_leaf_key = $1
|
||||||
AND block_number <= (SELECT block_number
|
AND header_cids.block_number <= (SELECT block_number
|
||||||
FROM eth.header_cids
|
FROM eth.header_cids
|
||||||
WHERE block_hash = $2)
|
WHERE block_hash = $2)
|
||||||
AND header_cids.block_hash = (SELECT canonical_header_hash(block_number))
|
AND header_cids.block_hash = (SELECT canonical_header_hash(header_cids.block_number))
|
||||||
ORDER BY block_number DESC
|
ORDER BY header_cids.block_number DESC
|
||||||
LIMIT 1`
|
LIMIT 1`
|
||||||
RetrieveCodeByMhKey = `SELECT data FROM public.blocks WHERE key = $1`
|
RetrieveCodeByMhKey = `SELECT data FROM public.blocks WHERE key = $1`
|
||||||
)
|
)
|
||||||
|
|||||||
+71
-35
@@ -19,6 +19,7 @@ package eth
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
@@ -29,7 +30,7 @@ import (
|
|||||||
"gorm.io/driver/postgres"
|
"gorm.io/driver/postgres"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Retriever interface for substituting mocks in tests
|
// Retriever interface for substituting mocks in tests
|
||||||
@@ -57,7 +58,7 @@ func (IPLDModelRecord) TableName() string {
|
|||||||
type HeaderCIDRecord struct {
|
type HeaderCIDRecord struct {
|
||||||
CID string `gorm:"column:cid"`
|
CID string `gorm:"column:cid"`
|
||||||
BlockHash string `gorm:"primaryKey"`
|
BlockHash string `gorm:"primaryKey"`
|
||||||
BlockNumber string
|
BlockNumber string `gorm:"primaryKey"`
|
||||||
ParentHash string
|
ParentHash string
|
||||||
Timestamp uint64
|
Timestamp uint64
|
||||||
StateRoot string
|
StateRoot string
|
||||||
@@ -70,8 +71,8 @@ type HeaderCIDRecord struct {
|
|||||||
|
|
||||||
// gorm doesn't check if foreign key exists in database.
|
// gorm doesn't check if foreign key exists in database.
|
||||||
// It is required to eager load relations using preload.
|
// It is required to eager load relations using preload.
|
||||||
TransactionCIDs []TransactionCIDRecord `gorm:"foreignKey:HeaderID;references:BlockHash"`
|
TransactionCIDs []TransactionCIDRecord `gorm:"foreignKey:HeaderID,BlockNumber;references:BlockHash,BlockNumber"`
|
||||||
IPLD IPLDModelRecord `gorm:"foreignKey:MhKey;references:Key"`
|
IPLD IPLDModelRecord `gorm:"foreignKey:MhKey,BlockNumber;references:Key,BlockNumber"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName overrides the table name used by HeaderCIDRecord
|
// TableName overrides the table name used by HeaderCIDRecord
|
||||||
@@ -82,12 +83,13 @@ func (HeaderCIDRecord) TableName() string {
|
|||||||
type TransactionCIDRecord struct {
|
type TransactionCIDRecord struct {
|
||||||
CID string `gorm:"column:cid"`
|
CID string `gorm:"column:cid"`
|
||||||
TxHash string `gorm:"primaryKey"`
|
TxHash string `gorm:"primaryKey"`
|
||||||
|
BlockNumber string `gorm:"primaryKey"`
|
||||||
HeaderID string `gorm:"column:header_id"`
|
HeaderID string `gorm:"column:header_id"`
|
||||||
Index int64
|
Index int64
|
||||||
Src string
|
Src string
|
||||||
Dst string
|
Dst string
|
||||||
MhKey string
|
MhKey string
|
||||||
IPLD IPLDModelRecord `gorm:"foreignKey:MhKey;references:Key"`
|
IPLD IPLDModelRecord `gorm:"foreignKey:MhKey,BlockNumber;references:Key,BlockNumber"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName overrides the table name used by TransactionCIDRecord
|
// TableName overrides the table name used by TransactionCIDRecord
|
||||||
@@ -231,8 +233,8 @@ func (ecr *CIDRetriever) RetrieveHeaderCIDs(tx *sqlx.Tx, blockNumber int64) ([]m
|
|||||||
log.Debug("retrieving header cids for block ", blockNumber)
|
log.Debug("retrieving header cids for block ", blockNumber)
|
||||||
headers := make([]models.HeaderModel, 0)
|
headers := make([]models.HeaderModel, 0)
|
||||||
pgStr := `SELECT CAST(block_number as Text), block_hash, parent_hash, cid, mh_key, CAST(td as Text), node_id,
|
pgStr := `SELECT CAST(block_number as Text), block_hash, parent_hash, cid, mh_key, CAST(td as Text), node_id,
|
||||||
CAST(reward as Text), state_root, uncle_root, tx_root, receipt_root, bloom, timestamp, times_validated,
|
CAST(reward as Text), state_root, uncle_root,tx_root, receipt_root, bloom, timestamp, times_validated, coinbase
|
||||||
coinbase FROM eth.header_cids
|
FROM eth.header_cids
|
||||||
WHERE block_number = $1`
|
WHERE block_number = $1`
|
||||||
return headers, tx.Select(&headers, pgStr, blockNumber)
|
return headers, tx.Select(&headers, pgStr, blockNumber)
|
||||||
}
|
}
|
||||||
@@ -241,7 +243,8 @@ func (ecr *CIDRetriever) RetrieveHeaderCIDs(tx *sqlx.Tx, blockNumber int64) ([]m
|
|||||||
func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID string) ([]models.UncleModel, error) {
|
func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID string) ([]models.UncleModel, error) {
|
||||||
log.Debug("retrieving uncle cids for block id ", headerID)
|
log.Debug("retrieving uncle cids for block id ", headerID)
|
||||||
headers := make([]models.UncleModel, 0)
|
headers := make([]models.UncleModel, 0)
|
||||||
pgStr := `SELECT header_id,block_hash,parent_hash,cid,mh_key, CAST(reward as text) FROM eth.uncle_cids
|
pgStr := `SELECT CAST(block_number as Text), header_id, block_hash, parent_hash, cid, mh_key, CAST(reward as text)
|
||||||
|
FROM eth.uncle_cids
|
||||||
WHERE header_id = $1`
|
WHERE header_id = $1`
|
||||||
return headers, tx.Select(&headers, pgStr, headerID)
|
return headers, tx.Select(&headers, pgStr, headerID)
|
||||||
}
|
}
|
||||||
@@ -253,9 +256,14 @@ func (ecr *CIDRetriever) RetrieveTxCIDs(tx *sqlx.Tx, txFilter TxFilter, headerID
|
|||||||
args := make([]interface{}, 0, 3)
|
args := make([]interface{}, 0, 3)
|
||||||
results := make([]models.TxModel, 0)
|
results := make([]models.TxModel, 0)
|
||||||
id := 1
|
id := 1
|
||||||
pgStr := fmt.Sprintf(`SELECT transaction_cids.tx_hash, transaction_cids.header_id,transaction_cids.cid, transaction_cids.mh_key,
|
pgStr := fmt.Sprintf(`SELECT CAST(transaction_cids.block_number as Text), transaction_cids.tx_hash,
|
||||||
transaction_cids.dst, transaction_cids.src, transaction_cids.index, transaction_cids.tx_data
|
transaction_cids.header_id,transaction_cids.cid, transaction_cids.mh_key, transaction_cids.dst,
|
||||||
FROM eth.transaction_cids INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.block_hash)
|
transaction_cids.src, transaction_cids.index, transaction_cids.tx_data
|
||||||
|
FROM eth.transaction_cids
|
||||||
|
INNER JOIN eth.header_cids ON (
|
||||||
|
transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
WHERE header_cids.block_hash = $%d`, id)
|
WHERE header_cids.block_hash = $%d`, id)
|
||||||
args = append(args, headerID)
|
args = append(args, headerID)
|
||||||
id++
|
id++
|
||||||
@@ -355,11 +363,13 @@ func receiptFilterConditions(id *int, pgStr string, args []interface{}, rctFilte
|
|||||||
func (ecr *CIDRetriever) RetrieveRctCIDsByHeaderID(tx *sqlx.Tx, rctFilter ReceiptFilter, headerID string, trxHashes []string) ([]models.ReceiptModel, error) {
|
func (ecr *CIDRetriever) RetrieveRctCIDsByHeaderID(tx *sqlx.Tx, rctFilter ReceiptFilter, headerID string, trxHashes []string) ([]models.ReceiptModel, error) {
|
||||||
log.Debug("retrieving receipt cids for header id ", headerID)
|
log.Debug("retrieving receipt cids for header id ", headerID)
|
||||||
args := make([]interface{}, 0, 4)
|
args := make([]interface{}, 0, 4)
|
||||||
pgStr := `SELECT receipt_cids.tx_id, receipt_cids.leaf_cid, receipt_cids.leaf_mh_key,
|
pgStr := `SELECT CAST(receipt_cids.block_number as Text), receipt_cids.tx_id, receipt_cids.leaf_cid,
|
||||||
receipt_cids.contract, receipt_cids.contract_hash
|
receipt_cids.leaf_mh_key, receipt_cids.contract, receipt_cids.contract_hash
|
||||||
FROM eth.receipt_cids, eth.transaction_cids, eth.header_cids
|
FROM eth.receipt_cids, eth.transaction_cids, eth.header_cids
|
||||||
WHERE receipt_cids.tx_id = transaction_cids.tx_hash
|
WHERE receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
AND transaction_cids.header_id = header_cids.block_hash
|
AND transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number
|
||||||
AND header_cids.block_hash = $1`
|
AND header_cids.block_hash = $1`
|
||||||
id := 2
|
id := 2
|
||||||
args = append(args, headerID)
|
args = append(args, headerID)
|
||||||
@@ -371,20 +381,25 @@ func (ecr *CIDRetriever) RetrieveRctCIDsByHeaderID(tx *sqlx.Tx, rctFilter Receip
|
|||||||
return receiptCIDs, tx.Select(&receiptCIDs, pgStr, args...)
|
return receiptCIDs, tx.Select(&receiptCIDs, pgStr, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveFilteredGQLLogs retrieves and returns all the log cIDs provided blockHash that conform to the provided
|
// RetrieveFilteredGQLLogs retrieves and returns all the log CIDs provided blockHash that conform to the provided
|
||||||
// filter parameters.
|
// filter parameters.
|
||||||
func (ecr *CIDRetriever) RetrieveFilteredGQLLogs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockHash *common.Hash) ([]LogResult, error) {
|
func (ecr *CIDRetriever) RetrieveFilteredGQLLogs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockHash *common.Hash) ([]LogResult, error) {
|
||||||
log.Debug("retrieving log cids for receipt ids")
|
log.Debug("retrieving log cids for receipt ids")
|
||||||
args := make([]interface{}, 0, 4)
|
args := make([]interface{}, 0, 4)
|
||||||
id := 1
|
id := 1
|
||||||
pgStr := `SELECT eth.log_cids.leaf_cid, eth.log_cids.index, eth.log_cids.rct_id,
|
pgStr := `SELECT CAST(eth.log_cids.block_number as Text), eth.log_cids.leaf_cid, eth.log_cids.index, eth.log_cids.rct_id,
|
||||||
eth.log_cids.address, eth.log_cids.topic0, eth.log_cids.topic1, eth.log_cids.topic2, eth.log_cids.topic3,
|
eth.log_cids.address, eth.log_cids.topic0, eth.log_cids.topic1, eth.log_cids.topic2, eth.log_cids.topic3,
|
||||||
eth.log_cids.log_data, eth.transaction_cids.tx_hash, data, eth.receipt_cids.leaf_cid as cid, eth.receipt_cids.post_status
|
eth.log_cids.log_data, eth.transaction_cids.tx_hash, data, eth.receipt_cids.leaf_cid as cid, eth.receipt_cids.post_status
|
||||||
FROM eth.log_cids, eth.receipt_cids, eth.transaction_cids, eth.header_cids, public.blocks
|
FROM eth.log_cids, eth.receipt_cids, eth.transaction_cids, eth.header_cids, public.blocks
|
||||||
WHERE eth.log_cids.rct_id = receipt_cids.tx_id
|
WHERE eth.log_cids.rct_id = receipt_cids.tx_id
|
||||||
|
AND eth.log_cids.block_number = eth.receipt_cids.block_number
|
||||||
AND receipt_cids.tx_id = transaction_cids.tx_hash
|
AND receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
AND transaction_cids.header_id = header_cids.block_hash
|
AND transaction_cids.header_id = header_cids.block_hash
|
||||||
AND log_cids.leaf_mh_key = blocks.key AND header_cids.block_hash = $1`
|
AND transaction_cids.block_number = header_cids.block_number
|
||||||
|
AND log_cids.leaf_mh_key = blocks.key
|
||||||
|
AND log_cids.block_number = blocks.block_number
|
||||||
|
AND header_cids.block_hash = $1`
|
||||||
|
|
||||||
args = append(args, blockHash.String())
|
args = append(args, blockHash.String())
|
||||||
id++
|
id++
|
||||||
@@ -406,14 +421,17 @@ func (ecr *CIDRetriever) RetrieveFilteredGQLLogs(tx *sqlx.Tx, rctFilter ReceiptF
|
|||||||
func (ecr *CIDRetriever) RetrieveFilteredLog(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash *common.Hash) ([]LogResult, error) {
|
func (ecr *CIDRetriever) RetrieveFilteredLog(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash *common.Hash) ([]LogResult, error) {
|
||||||
log.Debug("retrieving log cids for receipt ids")
|
log.Debug("retrieving log cids for receipt ids")
|
||||||
args := make([]interface{}, 0, 4)
|
args := make([]interface{}, 0, 4)
|
||||||
pgStr := `SELECT eth.log_cids.leaf_cid, eth.log_cids.index, eth.log_cids.rct_id,
|
pgStr := `SELECT CAST(eth.log_cids.block_number as Text), eth.log_cids.leaf_cid, eth.log_cids.index, eth.log_cids.rct_id,
|
||||||
eth.log_cids.address, eth.log_cids.topic0, eth.log_cids.topic1, eth.log_cids.topic2, eth.log_cids.topic3,
|
eth.log_cids.address, eth.log_cids.topic0, eth.log_cids.topic1, eth.log_cids.topic2, eth.log_cids.topic3,
|
||||||
eth.log_cids.log_data, eth.transaction_cids.tx_hash, eth.transaction_cids.index as txn_index,
|
eth.log_cids.log_data, eth.transaction_cids.tx_hash, eth.transaction_cids.index as txn_index,
|
||||||
header_cids.block_hash, CAST(header_cids.block_number as Text)
|
header_cids.block_hash, CAST(header_cids.block_number as Text)
|
||||||
FROM eth.log_cids, eth.receipt_cids, eth.transaction_cids, eth.header_cids
|
FROM eth.log_cids, eth.receipt_cids, eth.transaction_cids, eth.header_cids
|
||||||
WHERE eth.log_cids.rct_id = receipt_cids.tx_id
|
WHERE eth.log_cids.rct_id = receipt_cids.tx_id
|
||||||
|
AND eth.log_cids.block_number = eth.receipt_cids.block_number
|
||||||
AND receipt_cids.tx_id = transaction_cids.tx_hash
|
AND receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
AND transaction_cids.header_id = header_cids.block_hash`
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
|
AND transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number`
|
||||||
id := 1
|
id := 1
|
||||||
if blockNumber > 0 {
|
if blockNumber > 0 {
|
||||||
pgStr += fmt.Sprintf(` AND header_cids.block_number = $%d`, id)
|
pgStr += fmt.Sprintf(` AND header_cids.block_number = $%d`, id)
|
||||||
@@ -443,10 +461,13 @@ func (ecr *CIDRetriever) RetrieveFilteredLog(tx *sqlx.Tx, rctFilter ReceiptFilte
|
|||||||
func (ecr *CIDRetriever) RetrieveRctCIDs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash *common.Hash, txHashes []string) ([]models.ReceiptModel, error) {
|
func (ecr *CIDRetriever) RetrieveRctCIDs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash *common.Hash, txHashes []string) ([]models.ReceiptModel, error) {
|
||||||
log.Debug("retrieving receipt cids for block ", blockNumber)
|
log.Debug("retrieving receipt cids for block ", blockNumber)
|
||||||
args := make([]interface{}, 0, 5)
|
args := make([]interface{}, 0, 5)
|
||||||
pgStr := `SELECT receipt_cids.tx_id, receipt_cids.leaf_cid, receipt_cids.leaf_mh_key, receipt_cids.tx_id
|
pgStr := `SELECT CAST(receipt_cids.block_number as Text), receipt_cids.tx_id, receipt_cids.leaf_cid,
|
||||||
|
receipt_cids.leaf_mh_key,
|
||||||
FROM eth.receipt_cids, eth.transaction_cids, eth.header_cids
|
FROM eth.receipt_cids, eth.transaction_cids, eth.header_cids
|
||||||
WHERE receipt_cids.tx_id = transaction_cids.tx_hash
|
WHERE receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
AND transaction_cids.header_id = header_cids.block_hash`
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
|
AND transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number`
|
||||||
id := 1
|
id := 1
|
||||||
if blockNumber > 0 {
|
if blockNumber > 0 {
|
||||||
pgStr += fmt.Sprintf(` AND header_cids.block_number = $%d`, id)
|
pgStr += fmt.Sprintf(` AND header_cids.block_number = $%d`, id)
|
||||||
@@ -479,9 +500,13 @@ func hasTopics(topics [][]string) bool {
|
|||||||
func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter, headerID string) ([]models.StateNodeModel, error) {
|
func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter, headerID string) ([]models.StateNodeModel, error) {
|
||||||
log.Debug("retrieving state cids for header id ", headerID)
|
log.Debug("retrieving state cids for header id ", headerID)
|
||||||
args := make([]interface{}, 0, 2)
|
args := make([]interface{}, 0, 2)
|
||||||
pgStr := `SELECT state_cids.header_id,
|
pgStr := `SELECT CAST(state_cids.block_number as Text), state_cids.header_id,
|
||||||
state_cids.state_leaf_key, state_cids.node_type, state_cids.cid, state_cids.mh_key, state_cids.state_path
|
state_cids.state_leaf_key, state_cids.node_type, state_cids.cid, state_cids.mh_key, state_cids.state_path
|
||||||
FROM eth.state_cids INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash)
|
FROM eth.state_cids
|
||||||
|
INNER JOIN eth.header_cids ON (
|
||||||
|
state_cids.header_id = header_cids.block_hash
|
||||||
|
AND state_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
WHERE header_cids.block_hash = $1`
|
WHERE header_cids.block_hash = $1`
|
||||||
args = append(args, headerID)
|
args = append(args, headerID)
|
||||||
addrLen := len(stateFilter.Addresses)
|
addrLen := len(stateFilter.Addresses)
|
||||||
@@ -504,11 +529,15 @@ func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter,
|
|||||||
func (ecr *CIDRetriever) RetrieveStorageCIDs(tx *sqlx.Tx, storageFilter StorageFilter, headerID string) ([]models.StorageNodeWithStateKeyModel, error) {
|
func (ecr *CIDRetriever) RetrieveStorageCIDs(tx *sqlx.Tx, storageFilter StorageFilter, headerID string) ([]models.StorageNodeWithStateKeyModel, error) {
|
||||||
log.Debug("retrieving storage cids for header id ", headerID)
|
log.Debug("retrieving storage cids for header id ", headerID)
|
||||||
args := make([]interface{}, 0, 3)
|
args := make([]interface{}, 0, 3)
|
||||||
pgStr := `SELECT storage_cids.header_id, storage_cids.storage_leaf_key, storage_cids.node_type,
|
pgStr := `SELECT CAST(storage_cids.block_number as Text), storage_cids.header_id, storage_cids.storage_leaf_key,
|
||||||
storage_cids.cid, storage_cids.mh_key, storage_cids.storage_path, storage_cids.state_path, state_cids.state_leaf_key
|
storage_cids.node_type, storage_cids.cid, storage_cids.mh_key, storage_cids.storage_path, storage_cids.state_path,
|
||||||
|
state_cids.state_leaf_key
|
||||||
FROM eth.storage_cids, eth.state_cids, eth.header_cids
|
FROM eth.storage_cids, eth.state_cids, eth.header_cids
|
||||||
WHERE storage_cids.header_id = state_cids.header_id AND storage_cids.state_path = state_cids.state_path
|
WHERE storage_cids.header_id = state_cids.header_id
|
||||||
|
AND storage_cids.state_path = state_cids.state_path
|
||||||
|
AND storage_cids.block_number = state_cids.block_number
|
||||||
AND state_cids.header_id = header_cids.block_hash
|
AND state_cids.header_id = header_cids.block_hash
|
||||||
|
AND state_cids.block_number = header_cids.block_number
|
||||||
AND header_cids.block_hash = $1`
|
AND header_cids.block_hash = $1`
|
||||||
args = append(args, headerID)
|
args = append(args, headerID)
|
||||||
id := 2
|
id := 2
|
||||||
@@ -559,6 +588,10 @@ func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (models.Head
|
|||||||
log.Error("header cid retrieval error")
|
log.Error("header cid retrieval error")
|
||||||
return models.HeaderModel{}, nil, nil, nil, err
|
return models.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
blockNumber, err := strconv.ParseInt(headerCID.BlockNumber, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return models.HeaderModel{}, nil, nil, nil, err
|
||||||
|
}
|
||||||
var uncleCIDs []models.UncleModel
|
var uncleCIDs []models.UncleModel
|
||||||
uncleCIDs, err = ecr.RetrieveUncleCIDsByHeaderID(tx, headerCID.BlockHash)
|
uncleCIDs, err = ecr.RetrieveUncleCIDsByHeaderID(tx, headerCID.BlockHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -566,7 +599,7 @@ func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (models.Head
|
|||||||
return models.HeaderModel{}, nil, nil, nil, err
|
return models.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
var txCIDs []models.TxModel
|
var txCIDs []models.TxModel
|
||||||
txCIDs, err = ecr.RetrieveTxCIDsByHeaderID(tx, headerCID.BlockHash)
|
txCIDs, err = ecr.RetrieveTxCIDsByHeaderID(tx, headerCID.BlockHash, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("tx cid retrieval error")
|
log.Error("tx cid retrieval error")
|
||||||
return models.HeaderModel{}, nil, nil, nil, err
|
return models.HeaderModel{}, nil, nil, nil, err
|
||||||
@@ -619,7 +652,7 @@ func (ecr *CIDRetriever) RetrieveBlockByNumber(blockNumber int64) (models.Header
|
|||||||
return models.HeaderModel{}, nil, nil, nil, err
|
return models.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
var txCIDs []models.TxModel
|
var txCIDs []models.TxModel
|
||||||
txCIDs, err = ecr.RetrieveTxCIDsByHeaderID(tx, headerCID[0].BlockHash)
|
txCIDs, err = ecr.RetrieveTxCIDsByHeaderID(tx, headerCID[0].BlockHash, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("tx cid retrieval error")
|
log.Error("tx cid retrieval error")
|
||||||
return models.HeaderModel{}, nil, nil, nil, err
|
return models.HeaderModel{}, nil, nil, nil, err
|
||||||
@@ -647,23 +680,26 @@ func (ecr *CIDRetriever) RetrieveHeaderCIDByHash(tx *sqlx.Tx, blockHash common.H
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveTxCIDsByHeaderID retrieves all tx CIDs for the given header id
|
// RetrieveTxCIDsByHeaderID retrieves all tx CIDs for the given header id
|
||||||
func (ecr *CIDRetriever) RetrieveTxCIDsByHeaderID(tx *sqlx.Tx, headerID string) ([]models.TxModel, error) {
|
func (ecr *CIDRetriever) RetrieveTxCIDsByHeaderID(tx *sqlx.Tx, headerID string, blockNumber int64) ([]models.TxModel, error) {
|
||||||
log.Debug("retrieving tx cids for block id ", headerID)
|
log.Debug("retrieving tx cids for block id ", headerID)
|
||||||
pgStr := `SELECT * FROM eth.transaction_cids
|
pgStr := `SELECT CAST(block_number as Text), header_id, index, tx_hash, cid, mh_key,
|
||||||
WHERE header_id = $1
|
dst, src, tx_data, tx_type, value
|
||||||
|
FROM eth.transaction_cids
|
||||||
|
WHERE header_id = $1 AND block_number = $2
|
||||||
ORDER BY index`
|
ORDER BY index`
|
||||||
var txCIDs []models.TxModel
|
var txCIDs []models.TxModel
|
||||||
return txCIDs, tx.Select(&txCIDs, pgStr, headerID)
|
return txCIDs, tx.Select(&txCIDs, pgStr, headerID, blockNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveReceiptCIDsByTxIDs retrieves receipt CIDs by their associated tx IDs
|
// RetrieveReceiptCIDsByTxIDs retrieves receipt CIDs by their associated tx IDs
|
||||||
func (ecr *CIDRetriever) RetrieveReceiptCIDsByTxIDs(tx *sqlx.Tx, txHashes []string) ([]models.ReceiptModel, error) {
|
func (ecr *CIDRetriever) RetrieveReceiptCIDsByTxIDs(tx *sqlx.Tx, txHashes []string) ([]models.ReceiptModel, error) {
|
||||||
log.Debugf("retrieving receipt cids for tx hashes %v", txHashes)
|
log.Debugf("retrieving receipt cids for tx hashes %v", txHashes)
|
||||||
pgStr := `SELECT receipt_cids.tx_id, receipt_cids.leaf_cid, receipt_cids.leaf_mh_key,
|
pgStr := `SELECT CAST(receipt_cids.block_number as Text), receipt_cids.tx_id, receipt_cids.leaf_cid, receipt_cids.leaf_mh_key,
|
||||||
receipt_cids.contract, receipt_cids.contract_hash
|
receipt_cids.contract, receipt_cids.contract_hash
|
||||||
FROM eth.receipt_cids, eth.transaction_cids
|
FROM eth.receipt_cids, eth.transaction_cids
|
||||||
WHERE tx_id = ANY($1)
|
WHERE tx_id = ANY($1)
|
||||||
AND receipt_cids.tx_id = transaction_cids.tx_hash
|
AND receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
ORDER BY transaction_cids.index`
|
ORDER BY transaction_cids.index`
|
||||||
var rctCIDs []models.ReceiptModel
|
var rctCIDs []models.ReceiptModel
|
||||||
return rctCIDs, tx.Select(&rctCIDs, pgStr, pq.Array(txHashes))
|
return rctCIDs, tx.Select(&rctCIDs, pgStr, pq.Array(txHashes))
|
||||||
@@ -678,8 +714,8 @@ func (ecr *CIDRetriever) RetrieveHeaderAndTxCIDsByBlockNumber(blockNumber int64)
|
|||||||
// https://github.com/go-gorm/gorm/issues/4083#issuecomment-778883283
|
// https://github.com/go-gorm/gorm/issues/4083#issuecomment-778883283
|
||||||
// Will use join for TransactionCIDs once preload for 1:N is supported.
|
// Will use join for TransactionCIDs once preload for 1:N is supported.
|
||||||
err := ecr.gormDB.Preload("TransactionCIDs", func(tx *gorm.DB) *gorm.DB {
|
err := ecr.gormDB.Preload("TransactionCIDs", func(tx *gorm.DB) *gorm.DB {
|
||||||
return tx.Select("cid", "tx_hash", "index", "src", "dst", "header_id")
|
return tx.Select("cid", "tx_hash", "index", "src", "dst", "header_id", "block_number")
|
||||||
}).Joins("IPLD").Find(&headerCIDs, "block_number = ?", blockNumber).Error
|
}).Joins("IPLD").Find(&headerCIDs, "header_cids.block_number = ?", blockNumber).Error
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("header cid retrieval error")
|
log.Error("header cid retrieval error")
|
||||||
@@ -698,7 +734,7 @@ func (ecr *CIDRetriever) RetrieveHeaderAndTxCIDsByBlockHash(blockHash common.Has
|
|||||||
// https://github.com/go-gorm/gorm/issues/4083#issuecomment-778883283
|
// https://github.com/go-gorm/gorm/issues/4083#issuecomment-778883283
|
||||||
// Will use join for TransactionCIDs once preload for 1:N is supported.
|
// Will use join for TransactionCIDs once preload for 1:N is supported.
|
||||||
err := ecr.gormDB.Preload("TransactionCIDs", func(tx *gorm.DB) *gorm.DB {
|
err := ecr.gormDB.Preload("TransactionCIDs", func(tx *gorm.DB) *gorm.DB {
|
||||||
return tx.Select("cid", "tx_hash", "index", "src", "dst", "header_id")
|
return tx.Select("cid", "tx_hash", "index", "src", "dst", "header_id", "block_number")
|
||||||
}).Joins("IPLD").First(&headerCID, "block_hash = ?", blockHash.String()).Error
|
}).Joins("IPLD").First(&headerCID, "block_hash = ?", blockHash.String()).Error
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth/test_helpers"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -249,6 +249,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
AND header_cids.block_number = $1
|
AND header_cids.block_number = $1
|
||||||
ORDER BY transaction_cids.index`
|
ORDER BY transaction_cids.index`
|
||||||
err := db.Select(&expectedRctCIDsAndLeafNodes, pgStr, test_helpers.BlockNumber.Uint64())
|
err := db.Select(&expectedRctCIDsAndLeafNodes, pgStr, test_helpers.BlockNumber.Uint64())
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
cids, empty, err := retriever.Retrieve(openFilter, 1)
|
cids, empty, err := retriever.Retrieve(openFilter, 1)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
@@ -412,6 +413,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(len(cids7[0].StorageNodes)).To(Equal(0))
|
Expect(len(cids7[0].StorageNodes)).To(Equal(0))
|
||||||
Expect(len(cids7[0].StateNodes)).To(Equal(1))
|
Expect(len(cids7[0].StateNodes)).To(Equal(1))
|
||||||
Expect(cids7[0].StateNodes[0]).To(Equal(models.StateNodeModel{
|
Expect(cids7[0].StateNodes[0]).To(Equal(models.StateNodeModel{
|
||||||
|
BlockNumber: "1",
|
||||||
HeaderID: cids7[0].StateNodes[0].HeaderID,
|
HeaderID: cids7[0].StateNodes[0].HeaderID,
|
||||||
NodeType: 2,
|
NodeType: 2,
|
||||||
StateKey: common.BytesToHash(test_helpers.AccountLeafKey).Hex(),
|
StateKey: common.BytesToHash(test_helpers.AccountLeafKey).Hex(),
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth/test_helpers"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
ethServerShared "github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
ethServerShared "github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ func (s *ResponseFilterer) filterHeaders(headerFilter HeaderFilter, response *IP
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
response.Header = models.IPLDModel{
|
response.Header = models.IPLDModel{
|
||||||
|
BlockNumber: payload.Block.Number().String(),
|
||||||
Data: headerRLP,
|
Data: headerRLP,
|
||||||
Key: cid.String(),
|
Key: cid.String(),
|
||||||
}
|
}
|
||||||
@@ -97,6 +98,7 @@ func (s *ResponseFilterer) filterHeaders(headerFilter HeaderFilter, response *IP
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
response.Uncles[i] = models.IPLDModel{
|
response.Uncles[i] = models.IPLDModel{
|
||||||
|
BlockNumber: uncle.Number.String(),
|
||||||
Data: uncleRlp,
|
Data: uncleRlp,
|
||||||
Key: cid.String(),
|
Key: cid.String(),
|
||||||
}
|
}
|
||||||
@@ -183,6 +185,7 @@ func (s *ResponseFilterer) filerReceipts(receiptFilter ReceiptFilter, response *
|
|||||||
// TODO: Verify this filter logic.
|
// TODO: Verify this filter logic.
|
||||||
if checkReceipts(receipt, receiptFilter.Topics, topics, receiptFilter.LogAddresses, contracts, trxHashes) {
|
if checkReceipts(receipt, receiptFilter.Topics, topics, receiptFilter.LogAddresses, contracts, trxHashes) {
|
||||||
response.Receipts = append(response.Receipts, models.IPLDModel{
|
response.Receipts = append(response.Receipts, models.IPLDModel{
|
||||||
|
BlockNumber: payload.Block.Number().String(),
|
||||||
Data: rctIPLDData[idx],
|
Data: rctIPLDData[idx],
|
||||||
Key: rctLeafCID[idx].String(),
|
Key: rctLeafCID[idx].String(),
|
||||||
})
|
})
|
||||||
@@ -282,6 +285,7 @@ func (s *ResponseFilterer) filterStateAndStorage(stateFilter StateFilter, storag
|
|||||||
StateLeafKey: common.BytesToHash(stateNode.LeafKey),
|
StateLeafKey: common.BytesToHash(stateNode.LeafKey),
|
||||||
Path: stateNode.Path,
|
Path: stateNode.Path,
|
||||||
IPLD: models.IPLDModel{
|
IPLD: models.IPLDModel{
|
||||||
|
BlockNumber: payload.Block.Number().String(),
|
||||||
Data: stateNode.NodeValue,
|
Data: stateNode.NodeValue,
|
||||||
Key: cid.String(),
|
Key: cid.String(),
|
||||||
},
|
},
|
||||||
@@ -300,6 +304,7 @@ func (s *ResponseFilterer) filterStateAndStorage(stateFilter StateFilter, storag
|
|||||||
StateLeafKey: common.BytesToHash(stateNode.LeafKey),
|
StateLeafKey: common.BytesToHash(stateNode.LeafKey),
|
||||||
StorageLeafKey: common.BytesToHash(storageNode.LeafKey),
|
StorageLeafKey: common.BytesToHash(storageNode.LeafKey),
|
||||||
IPLD: models.IPLDModel{
|
IPLD: models.IPLDModel{
|
||||||
|
BlockNumber: payload.Block.Number().String(),
|
||||||
Data: storageNode.NodeValue,
|
Data: storageNode.NodeValue,
|
||||||
Key: cid.String(),
|
Key: cid.String(),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth/test_helpers"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -61,12 +61,14 @@ var _ = Describe("Filterer", func() {
|
|||||||
Expect(stateNode.Type).To(Equal(sdtypes.Leaf))
|
Expect(stateNode.Type).To(Equal(sdtypes.Leaf))
|
||||||
if bytes.Equal(stateNode.StateLeafKey.Bytes(), test_helpers.AccountLeafKey) {
|
if bytes.Equal(stateNode.StateLeafKey.Bytes(), test_helpers.AccountLeafKey) {
|
||||||
Expect(stateNode.IPLD).To(Equal(models.IPLDModel{
|
Expect(stateNode.IPLD).To(Equal(models.IPLDModel{
|
||||||
|
BlockNumber: test_helpers.BlockNumber.String(),
|
||||||
Data: test_helpers.State2IPLD.RawData(),
|
Data: test_helpers.State2IPLD.RawData(),
|
||||||
Key: test_helpers.State2IPLD.Cid().String(),
|
Key: test_helpers.State2IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
if bytes.Equal(stateNode.StateLeafKey.Bytes(), test_helpers.ContractLeafKey) {
|
if bytes.Equal(stateNode.StateLeafKey.Bytes(), test_helpers.ContractLeafKey) {
|
||||||
Expect(stateNode.IPLD).To(Equal(models.IPLDModel{
|
Expect(stateNode.IPLD).To(Equal(models.IPLDModel{
|
||||||
|
BlockNumber: test_helpers.BlockNumber.String(),
|
||||||
Data: test_helpers.State1IPLD.RawData(),
|
Data: test_helpers.State1IPLD.RawData(),
|
||||||
Key: test_helpers.State1IPLD.Cid().String(),
|
Key: test_helpers.State1IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
@@ -87,6 +89,7 @@ var _ = Describe("Filterer", func() {
|
|||||||
Expect(len(iplds1.StateNodes)).To(Equal(0))
|
Expect(len(iplds1.StateNodes)).To(Equal(0))
|
||||||
Expect(len(iplds1.Receipts)).To(Equal(1))
|
Expect(len(iplds1.Receipts)).To(Equal(1))
|
||||||
Expect(iplds1.Receipts[0]).To(Equal(models.IPLDModel{
|
Expect(iplds1.Receipts[0]).To(Equal(models.IPLDModel{
|
||||||
|
BlockNumber: test_helpers.BlockNumber.String(),
|
||||||
Data: test_helpers.Rct1IPLD,
|
Data: test_helpers.Rct1IPLD,
|
||||||
Key: test_helpers.Rct1CID.String(),
|
Key: test_helpers.Rct1CID.String(),
|
||||||
}))
|
}))
|
||||||
@@ -102,6 +105,7 @@ var _ = Describe("Filterer", func() {
|
|||||||
Expect(len(iplds2.StateNodes)).To(Equal(0))
|
Expect(len(iplds2.StateNodes)).To(Equal(0))
|
||||||
Expect(len(iplds2.Receipts)).To(Equal(1))
|
Expect(len(iplds2.Receipts)).To(Equal(1))
|
||||||
Expect(iplds2.Receipts[0]).To(Equal(models.IPLDModel{
|
Expect(iplds2.Receipts[0]).To(Equal(models.IPLDModel{
|
||||||
|
BlockNumber: test_helpers.BlockNumber.String(),
|
||||||
Data: test_helpers.Rct1IPLD,
|
Data: test_helpers.Rct1IPLD,
|
||||||
Key: test_helpers.Rct1CID.String(),
|
Key: test_helpers.Rct1CID.String(),
|
||||||
}))
|
}))
|
||||||
@@ -117,6 +121,7 @@ var _ = Describe("Filterer", func() {
|
|||||||
Expect(len(iplds3.StateNodes)).To(Equal(0))
|
Expect(len(iplds3.StateNodes)).To(Equal(0))
|
||||||
Expect(len(iplds3.Receipts)).To(Equal(1))
|
Expect(len(iplds3.Receipts)).To(Equal(1))
|
||||||
Expect(iplds3.Receipts[0]).To(Equal(models.IPLDModel{
|
Expect(iplds3.Receipts[0]).To(Equal(models.IPLDModel{
|
||||||
|
BlockNumber: test_helpers.BlockNumber.String(),
|
||||||
Data: test_helpers.Rct1IPLD,
|
Data: test_helpers.Rct1IPLD,
|
||||||
Key: test_helpers.Rct1CID.String(),
|
Key: test_helpers.Rct1CID.String(),
|
||||||
}))
|
}))
|
||||||
@@ -132,6 +137,7 @@ var _ = Describe("Filterer", func() {
|
|||||||
Expect(len(iplds4.StateNodes)).To(Equal(0))
|
Expect(len(iplds4.StateNodes)).To(Equal(0))
|
||||||
Expect(len(iplds4.Receipts)).To(Equal(1))
|
Expect(len(iplds4.Receipts)).To(Equal(1))
|
||||||
Expect(iplds4.Receipts[0]).To(Equal(models.IPLDModel{
|
Expect(iplds4.Receipts[0]).To(Equal(models.IPLDModel{
|
||||||
|
BlockNumber: test_helpers.BlockNumber.String(),
|
||||||
Data: test_helpers.Rct2IPLD,
|
Data: test_helpers.Rct2IPLD,
|
||||||
Key: test_helpers.Rct2CID.String(),
|
Key: test_helpers.Rct2CID.String(),
|
||||||
}))
|
}))
|
||||||
@@ -165,6 +171,7 @@ var _ = Describe("Filterer", func() {
|
|||||||
Expect(len(iplds6.StateNodes)).To(Equal(0))
|
Expect(len(iplds6.StateNodes)).To(Equal(0))
|
||||||
Expect(len(iplds6.Receipts)).To(Equal(1))
|
Expect(len(iplds6.Receipts)).To(Equal(1))
|
||||||
Expect(iplds4.Receipts[0]).To(Equal(models.IPLDModel{
|
Expect(iplds4.Receipts[0]).To(Equal(models.IPLDModel{
|
||||||
|
BlockNumber: test_helpers.BlockNumber.String(),
|
||||||
Data: test_helpers.Rct2IPLD,
|
Data: test_helpers.Rct2IPLD,
|
||||||
Key: test_helpers.Rct2CID.String(),
|
Key: test_helpers.Rct2CID.String(),
|
||||||
}))
|
}))
|
||||||
@@ -181,6 +188,7 @@ var _ = Describe("Filterer", func() {
|
|||||||
Expect(len(iplds7.StateNodes)).To(Equal(1))
|
Expect(len(iplds7.StateNodes)).To(Equal(1))
|
||||||
Expect(iplds7.StateNodes[0].StateLeafKey.Bytes()).To(Equal(test_helpers.AccountLeafKey))
|
Expect(iplds7.StateNodes[0].StateLeafKey.Bytes()).To(Equal(test_helpers.AccountLeafKey))
|
||||||
Expect(iplds7.StateNodes[0].IPLD).To(Equal(models.IPLDModel{
|
Expect(iplds7.StateNodes[0].IPLD).To(Equal(models.IPLDModel{
|
||||||
|
BlockNumber: test_helpers.BlockNumber.String(),
|
||||||
Data: test_helpers.State2IPLD.RawData(),
|
Data: test_helpers.State2IPLD.RawData(),
|
||||||
Key: test_helpers.State2IPLD.Cid().String(),
|
Key: test_helpers.State2IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
|
|||||||
+39
-7
@@ -20,12 +20,13 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/statediff/indexer/models"
|
"github.com/ethereum/go-ethereum/statediff/indexer/models"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Fetcher interface for substituting mocks in tests
|
// Fetcher interface for substituting mocks in tests
|
||||||
@@ -102,11 +103,17 @@ func (f *IPLDFetcher) Fetch(cids CIDWrapper) (*IPLDs, error) {
|
|||||||
// FetchHeader fetches header
|
// FetchHeader fetches header
|
||||||
func (f *IPLDFetcher) FetchHeader(tx *sqlx.Tx, c models.HeaderModel) (models.IPLDModel, error) {
|
func (f *IPLDFetcher) FetchHeader(tx *sqlx.Tx, c models.HeaderModel) (models.IPLDModel, error) {
|
||||||
log.Debug("fetching header ipld")
|
log.Debug("fetching header ipld")
|
||||||
headerBytes, err := shared.FetchIPLDByMhKey(tx, c.MhKey)
|
blockNumber, err := strconv.ParseUint(c.BlockNumber, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return models.IPLDModel{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
headerBytes, err := shared.FetchIPLDByMhKeyAndBlockNumber(tx, c.MhKey, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return models.IPLDModel{}, err
|
return models.IPLDModel{}, err
|
||||||
}
|
}
|
||||||
return models.IPLDModel{
|
return models.IPLDModel{
|
||||||
|
BlockNumber: c.BlockNumber,
|
||||||
Data: headerBytes,
|
Data: headerBytes,
|
||||||
Key: c.CID,
|
Key: c.CID,
|
||||||
}, nil
|
}, nil
|
||||||
@@ -117,11 +124,16 @@ func (f *IPLDFetcher) FetchUncles(tx *sqlx.Tx, cids []models.UncleModel) ([]mode
|
|||||||
log.Debug("fetching uncle iplds")
|
log.Debug("fetching uncle iplds")
|
||||||
uncleIPLDs := make([]models.IPLDModel, len(cids))
|
uncleIPLDs := make([]models.IPLDModel, len(cids))
|
||||||
for i, c := range cids {
|
for i, c := range cids {
|
||||||
uncleBytes, err := shared.FetchIPLDByMhKey(tx, c.MhKey)
|
blockNumber, err := strconv.ParseUint(c.BlockNumber, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
uncleBytes, err := shared.FetchIPLDByMhKeyAndBlockNumber(tx, c.MhKey, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
uncleIPLDs[i] = models.IPLDModel{
|
uncleIPLDs[i] = models.IPLDModel{
|
||||||
|
BlockNumber: c.BlockNumber,
|
||||||
Data: uncleBytes,
|
Data: uncleBytes,
|
||||||
Key: c.CID,
|
Key: c.CID,
|
||||||
}
|
}
|
||||||
@@ -134,11 +146,16 @@ func (f *IPLDFetcher) FetchTrxs(tx *sqlx.Tx, cids []models.TxModel) ([]models.IP
|
|||||||
log.Debug("fetching transaction iplds")
|
log.Debug("fetching transaction iplds")
|
||||||
trxIPLDs := make([]models.IPLDModel, len(cids))
|
trxIPLDs := make([]models.IPLDModel, len(cids))
|
||||||
for i, c := range cids {
|
for i, c := range cids {
|
||||||
txBytes, err := shared.FetchIPLDByMhKey(tx, c.MhKey)
|
blockNumber, err := strconv.ParseUint(c.BlockNumber, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
txBytes, err := shared.FetchIPLDByMhKeyAndBlockNumber(tx, c.MhKey, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
trxIPLDs[i] = models.IPLDModel{
|
trxIPLDs[i] = models.IPLDModel{
|
||||||
|
BlockNumber: c.BlockNumber,
|
||||||
Data: txBytes,
|
Data: txBytes,
|
||||||
Key: c.CID,
|
Key: c.CID,
|
||||||
}
|
}
|
||||||
@@ -151,12 +168,17 @@ func (f *IPLDFetcher) FetchRcts(tx *sqlx.Tx, cids []models.ReceiptModel) ([]mode
|
|||||||
log.Debug("fetching receipt iplds")
|
log.Debug("fetching receipt iplds")
|
||||||
rctIPLDs := make([]models.IPLDModel, len(cids))
|
rctIPLDs := make([]models.IPLDModel, len(cids))
|
||||||
for i, c := range cids {
|
for i, c := range cids {
|
||||||
rctBytes, err := shared.FetchIPLDByMhKey(tx, c.LeafMhKey)
|
blockNumber, err := strconv.ParseUint(c.BlockNumber, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
rctBytes, err := shared.FetchIPLDByMhKeyAndBlockNumber(tx, c.LeafMhKey, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
//nodeVal, err := DecodeLeafNode(rctBytes)
|
//nodeVal, err := DecodeLeafNode(rctBytes)
|
||||||
rctIPLDs[i] = models.IPLDModel{
|
rctIPLDs[i] = models.IPLDModel{
|
||||||
|
BlockNumber: c.BlockNumber,
|
||||||
Data: rctBytes,
|
Data: rctBytes,
|
||||||
Key: c.LeafCID,
|
Key: c.LeafCID,
|
||||||
}
|
}
|
||||||
@@ -172,12 +194,17 @@ func (f *IPLDFetcher) FetchState(tx *sqlx.Tx, cids []models.StateNodeModel) ([]S
|
|||||||
if stateNode.CID == "" {
|
if stateNode.CID == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
stateBytes, err := shared.FetchIPLDByMhKey(tx, stateNode.MhKey)
|
blockNumber, err := strconv.ParseUint(stateNode.BlockNumber, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
stateBytes, err := shared.FetchIPLDByMhKeyAndBlockNumber(tx, stateNode.MhKey, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
stateNodes = append(stateNodes, StateNode{
|
stateNodes = append(stateNodes, StateNode{
|
||||||
IPLD: models.IPLDModel{
|
IPLD: models.IPLDModel{
|
||||||
|
BlockNumber: stateNode.BlockNumber,
|
||||||
Data: stateBytes,
|
Data: stateBytes,
|
||||||
Key: stateNode.CID,
|
Key: stateNode.CID,
|
||||||
},
|
},
|
||||||
@@ -197,12 +224,17 @@ func (f *IPLDFetcher) FetchStorage(tx *sqlx.Tx, cids []models.StorageNodeWithSta
|
|||||||
if storageNode.CID == "" || storageNode.StateKey == "" {
|
if storageNode.CID == "" || storageNode.StateKey == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
storageBytes, err := shared.FetchIPLDByMhKey(tx, storageNode.MhKey)
|
blockNumber, err := strconv.ParseUint(storageNode.BlockNumber, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
storageBytes, err := shared.FetchIPLDByMhKeyAndBlockNumber(tx, storageNode.MhKey, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
storageNodes = append(storageNodes, StorageNode{
|
storageNodes = append(storageNodes, StorageNode{
|
||||||
IPLD: models.IPLDModel{
|
IPLD: models.IPLDModel{
|
||||||
|
BlockNumber: storageNode.BlockNumber,
|
||||||
Data: storageBytes,
|
Data: storageBytes,
|
||||||
Key: storageNode.CID,
|
Key: storageNode.CID,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth/test_helpers"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("IPLDFetcher", func() {
|
var _ = Describe("IPLDFetcher", func() {
|
||||||
|
|||||||
+140
-39
@@ -36,93 +36,180 @@ const (
|
|||||||
|
|
||||||
RetrieveHeadersByHashesPgStr = `SELECT cid, data
|
RetrieveHeadersByHashesPgStr = `SELECT cid, data
|
||||||
FROM eth.header_cids
|
FROM eth.header_cids
|
||||||
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
header_cids.mh_key = blocks.key
|
||||||
|
AND header_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = ANY($1::VARCHAR(66)[])`
|
WHERE block_hash = ANY($1::VARCHAR(66)[])`
|
||||||
RetrieveHeadersByBlockNumberPgStr = `SELECT cid, data
|
RetrieveHeadersByBlockNumberPgStr = `SELECT cid, data
|
||||||
FROM eth.header_cids
|
FROM eth.header_cids
|
||||||
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
header_cids.mh_key = blocks.key
|
||||||
|
AND header_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_number = $1`
|
WHERE block_number = $1`
|
||||||
RetrieveHeaderByHashPgStr = `SELECT cid, data
|
RetrieveHeaderByHashPgStr = `SELECT cid, data
|
||||||
FROM eth.header_cids
|
FROM eth.header_cids
|
||||||
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
header_cids.mh_key = blocks.key
|
||||||
|
AND header_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = $1`
|
WHERE block_hash = $1`
|
||||||
RetrieveUnclesByHashesPgStr = `SELECT cid, data
|
RetrieveUnclesByHashesPgStr = `SELECT cid, data
|
||||||
FROM eth.uncle_cids
|
FROM eth.uncle_cids
|
||||||
INNER JOIN public.blocks ON (uncle_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
uncle_cids.mh_key = blocks.key
|
||||||
|
AND uncle_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = ANY($1::VARCHAR(66)[])`
|
WHERE block_hash = ANY($1::VARCHAR(66)[])`
|
||||||
RetrieveUnclesByBlockHashPgStr = `SELECT uncle_cids.cid, data
|
RetrieveUnclesByBlockHashPgStr = `SELECT uncle_cids.cid, data
|
||||||
FROM eth.uncle_cids
|
FROM eth.uncle_cids
|
||||||
INNER JOIN eth.header_cids ON (uncle_cids.header_id = header_cids.block_hash)
|
INNER JOIN eth.header_cids ON (
|
||||||
INNER JOIN public.blocks ON (uncle_cids.mh_key = blocks.key)
|
uncle_cids.header_id = header_cids.block_hash
|
||||||
|
AND uncle_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
uncle_cids.mh_key = blocks.key
|
||||||
|
AND uncle_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = $1`
|
WHERE block_hash = $1`
|
||||||
RetrieveUnclesByBlockNumberPgStr = `SELECT uncle_cids.cid, data
|
RetrieveUnclesByBlockNumberPgStr = `SELECT uncle_cids.cid, data
|
||||||
FROM eth.uncle_cids
|
FROM eth.uncle_cids
|
||||||
INNER JOIN eth.header_cids ON (uncle_cids.header_id = header_cids.block_hash)
|
INNER JOIN eth.header_cids ON (
|
||||||
INNER JOIN public.blocks ON (uncle_cids.mh_key = blocks.key)
|
uncle_cids.header_id = header_cids.block_hash
|
||||||
|
AND uncle_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
uncle_cids.mh_key = blocks.key
|
||||||
|
AND uncle_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_number = $1`
|
WHERE block_number = $1`
|
||||||
RetrieveUncleByHashPgStr = `SELECT cid, data
|
RetrieveUncleByHashPgStr = `SELECT cid, data
|
||||||
FROM eth.uncle_cids
|
FROM eth.uncle_cids
|
||||||
INNER JOIN public.blocks ON (uncle_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
uncle_cids.mh_key = blocks.key
|
||||||
|
AND uncle_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = $1`
|
WHERE block_hash = $1`
|
||||||
RetrieveTransactionsByHashesPgStr = `SELECT cid, data
|
RetrieveTransactionsByHashesPgStr = `SELECT cid, data
|
||||||
FROM eth.transaction_cids
|
FROM eth.transaction_cids
|
||||||
INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
transaction_cids.mh_key = blocks.key
|
||||||
|
AND transaction_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE tx_hash = ANY($1::VARCHAR(66)[])`
|
WHERE tx_hash = ANY($1::VARCHAR(66)[])`
|
||||||
RetrieveTransactionsByBlockHashPgStr = `SELECT transaction_cids.cid, data
|
RetrieveTransactionsByBlockHashPgStr = `SELECT transaction_cids.cid, data
|
||||||
FROM eth.transaction_cids
|
FROM eth.transaction_cids
|
||||||
INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.block_hash)
|
INNER JOIN eth.header_cids ON (
|
||||||
INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key)
|
transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
transaction_cids.mh_key = blocks.key
|
||||||
|
AND transaction_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = $1
|
WHERE block_hash = $1
|
||||||
ORDER BY eth.transaction_cids.index ASC`
|
ORDER BY eth.transaction_cids.index ASC`
|
||||||
RetrieveTransactionsByBlockNumberPgStr = `SELECT transaction_cids.cid, data
|
RetrieveTransactionsByBlockNumberPgStr = `SELECT transaction_cids.cid, data
|
||||||
FROM eth.transaction_cids
|
FROM eth.transaction_cids
|
||||||
INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.block_hash)
|
INNER JOIN eth.header_cids ON (
|
||||||
INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key)
|
transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
transaction_cids.mh_key = blocks.key
|
||||||
|
AND transaction_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_number = $1
|
WHERE block_number = $1
|
||||||
ORDER BY eth.transaction_cids.index ASC`
|
ORDER BY eth.transaction_cids.index ASC`
|
||||||
RetrieveTransactionByHashPgStr = `SELECT cid, data
|
RetrieveTransactionByHashPgStr = `SELECT cid, data
|
||||||
FROM eth.transaction_cids
|
FROM eth.transaction_cids
|
||||||
INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key)
|
INNER JOIN public.blocks ON (
|
||||||
|
transaction_cids.mh_key = blocks.key
|
||||||
|
AND transaction_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE tx_hash = $1`
|
WHERE tx_hash = $1`
|
||||||
RetrieveReceiptsByTxHashesPgStr = `SELECT receipt_cids.leaf_cid, data
|
RetrieveReceiptsByTxHashesPgStr = `SELECT receipt_cids.leaf_cid, data
|
||||||
FROM eth.receipt_cids
|
FROM eth.receipt_cids
|
||||||
INNER JOIN eth.transaction_cids ON (receipt_cids.tx_id = transaction_cids.tx_hash)
|
INNER JOIN eth.transaction_cids ON (
|
||||||
INNER JOIN public.blocks ON (receipt_cids.leaf_mh_key = blocks.key)
|
receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
receipt_cids.leaf_mh_key = blocks.key
|
||||||
|
AND receipt_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE tx_hash = ANY($1::VARCHAR(66)[])`
|
WHERE tx_hash = ANY($1::VARCHAR(66)[])`
|
||||||
RetrieveReceiptsByBlockHashPgStr = `SELECT receipt_cids.leaf_cid, data, eth.transaction_cids.tx_hash
|
RetrieveReceiptsByBlockHashPgStr = `SELECT receipt_cids.leaf_cid, data, eth.transaction_cids.tx_hash
|
||||||
FROM eth.receipt_cids
|
FROM eth.receipt_cids
|
||||||
INNER JOIN eth.transaction_cids ON (receipt_cids.tx_id = transaction_cids.tx_hash)
|
INNER JOIN eth.transaction_cids ON (
|
||||||
INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.block_hash)
|
receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
INNER JOIN public.blocks ON (receipt_cids.leaf_mh_key = blocks.key)
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN eth.header_cids ON (
|
||||||
|
transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
receipt_cids.leaf_mh_key = blocks.key
|
||||||
|
AND receipt_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_hash = $1
|
WHERE block_hash = $1
|
||||||
ORDER BY eth.transaction_cids.index ASC`
|
ORDER BY eth.transaction_cids.index ASC`
|
||||||
RetrieveReceiptsByBlockNumberPgStr = `SELECT receipt_cids.leaf_cid, data
|
RetrieveReceiptsByBlockNumberPgStr = `SELECT receipt_cids.leaf_cid, data
|
||||||
FROM eth.receipt_cids
|
FROM eth.receipt_cids
|
||||||
INNER JOIN eth.transaction_cids ON (receipt_cids.tx_id = transaction_cids.tx_hash)
|
INNER JOIN eth.transaction_cids ON (
|
||||||
INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.block_hash)
|
receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
INNER JOIN public.blocks ON (receipt_cids.leaf_mh_key = blocks.key)
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN eth.header_cids ON (
|
||||||
|
transaction_cids.header_id = header_cids.block_hash
|
||||||
|
AND transaction_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
receipt_cids.leaf_mh_key = blocks.key
|
||||||
|
AND receipt_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE block_number = $1
|
WHERE block_number = $1
|
||||||
ORDER BY eth.transaction_cids.index ASC`
|
ORDER BY eth.transaction_cids.index ASC`
|
||||||
RetrieveReceiptByTxHashPgStr = `SELECT receipt_cids.leaf_cid, data
|
RetrieveReceiptByTxHashPgStr = `SELECT receipt_cids.leaf_cid, data
|
||||||
FROM eth.receipt_cids
|
FROM eth.receipt_cids
|
||||||
INNER JOIN eth.transaction_cids ON (receipt_cids.tx_id = transaction_cids.tx_hash)
|
INNER JOIN eth.transaction_cids ON (
|
||||||
INNER JOIN public.blocks ON (receipt_cids.leaf_mh_key = blocks.key)
|
receipt_cids.tx_id = transaction_cids.tx_hash
|
||||||
|
AND receipt_cids.block_number = transaction_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
receipt_cids.leaf_mh_key = blocks.key
|
||||||
|
AND receipt_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE tx_hash = $1`
|
WHERE tx_hash = $1`
|
||||||
RetrieveAccountByLeafKeyAndBlockHashPgStr = `SELECT state_cids.cid, data, state_cids.node_type
|
RetrieveAccountByLeafKeyAndBlockHashPgStr = `SELECT state_cids.cid, data, state_cids.node_type
|
||||||
FROM eth.state_cids
|
FROM eth.state_cids
|
||||||
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash)
|
INNER JOIN eth.header_cids ON (
|
||||||
INNER JOIN public.blocks ON (state_cids.mh_key = blocks.key)
|
state_cids.header_id = header_cids.block_hash
|
||||||
|
AND state_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
state_cids.mh_key = blocks.key
|
||||||
|
AND state_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE state_leaf_key = $1
|
WHERE state_leaf_key = $1
|
||||||
AND block_number <= (SELECT block_number
|
AND header_cids.block_number <= (SELECT block_number
|
||||||
FROM eth.header_cids
|
FROM eth.header_cids
|
||||||
WHERE block_hash = $2)
|
WHERE block_hash = $2)
|
||||||
AND header_cids.block_hash = (SELECT canonical_header_hash(block_number))
|
AND header_cids.block_hash = (SELECT canonical_header_hash(header_cids.block_number))
|
||||||
ORDER BY block_number DESC
|
ORDER BY header_cids.block_number DESC
|
||||||
LIMIT 1`
|
LIMIT 1`
|
||||||
RetrieveAccountByLeafKeyAndBlockNumberPgStr = `SELECT state_cids.cid, data, state_cids.node_type
|
RetrieveAccountByLeafKeyAndBlockNumberPgStr = `SELECT state_cids.cid, data, state_cids.node_type
|
||||||
FROM eth.state_cids
|
FROM eth.state_cids
|
||||||
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash)
|
INNER JOIN eth.header_cids ON (
|
||||||
INNER JOIN public.blocks ON (state_cids.mh_key = blocks.key)
|
state_cids.header_id = header_cids.block_hash
|
||||||
|
AND state_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
state_cids.mh_key = blocks.key
|
||||||
|
AND state_cids.block_number = blocks.block_number
|
||||||
|
)
|
||||||
WHERE state_leaf_key = $1
|
WHERE state_leaf_key = $1
|
||||||
AND block_number <= $2
|
AND block_number <= $2
|
||||||
ORDER BY block_number DESC
|
ORDER BY block_number DESC
|
||||||
@@ -132,9 +219,16 @@ const (
|
|||||||
INNER JOIN eth.state_cids ON (
|
INNER JOIN eth.state_cids ON (
|
||||||
storage_cids.header_id = state_cids.header_id
|
storage_cids.header_id = state_cids.header_id
|
||||||
AND storage_cids.state_path = state_cids.state_path
|
AND storage_cids.state_path = state_cids.state_path
|
||||||
|
AND storage_cids.block_number = state_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN eth.header_cids ON (
|
||||||
|
state_cids.header_id = header_cids.block_hash
|
||||||
|
AND state_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
storage_cids.mh_key = blocks.key
|
||||||
|
AND storage_cids.block_number = blocks.block_number
|
||||||
)
|
)
|
||||||
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash)
|
|
||||||
INNER JOIN public.blocks ON (storage_cids.mh_key = blocks.key)
|
|
||||||
WHERE state_leaf_key = $1
|
WHERE state_leaf_key = $1
|
||||||
AND storage_leaf_key = $2
|
AND storage_leaf_key = $2
|
||||||
AND block_number <= $3
|
AND block_number <= $3
|
||||||
@@ -145,16 +239,23 @@ const (
|
|||||||
INNER JOIN eth.state_cids ON (
|
INNER JOIN eth.state_cids ON (
|
||||||
storage_cids.header_id = state_cids.header_id
|
storage_cids.header_id = state_cids.header_id
|
||||||
AND storage_cids.state_path = state_cids.state_path
|
AND storage_cids.state_path = state_cids.state_path
|
||||||
|
AND storage_cids.block_number = state_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN eth.header_cids ON (
|
||||||
|
state_cids.header_id = header_cids.block_hash
|
||||||
|
AND state_cids.block_number = header_cids.block_number
|
||||||
|
)
|
||||||
|
INNER JOIN public.blocks ON (
|
||||||
|
storage_cids.mh_key = blocks.key
|
||||||
|
AND storage_cids.block_number = blocks.block_number
|
||||||
)
|
)
|
||||||
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash)
|
|
||||||
INNER JOIN public.blocks ON (storage_cids.mh_key = blocks.key)
|
|
||||||
WHERE state_leaf_key = $1
|
WHERE state_leaf_key = $1
|
||||||
AND storage_leaf_key = $2
|
AND storage_leaf_key = $2
|
||||||
AND block_number <= (SELECT block_number
|
AND header_cids.block_number <= (SELECT block_number
|
||||||
FROM eth.header_cids
|
FROM eth.header_cids
|
||||||
WHERE block_hash = $3)
|
WHERE block_hash = $3)
|
||||||
AND header_cids.block_hash = (SELECT canonical_header_hash(block_number))
|
AND header_cids.block_hash = (SELECT canonical_header_hash(header_cids.block_number))
|
||||||
ORDER BY block_number DESC
|
ORDER BY header_cids.block_number DESC
|
||||||
LIMIT 1`
|
LIMIT 1`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import (
|
|||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test variables
|
// Test variables
|
||||||
@@ -231,6 +231,7 @@ var (
|
|||||||
}
|
}
|
||||||
MockTrxMetaPostPublsh = []models.TxModel{
|
MockTrxMetaPostPublsh = []models.TxModel{
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
CID: Trx1CID.String(), // This is empty until we go to publish to ipfs
|
CID: Trx1CID.String(), // This is empty until we go to publish to ipfs
|
||||||
MhKey: Trx1MhKey,
|
MhKey: Trx1MhKey,
|
||||||
Src: SenderAddr.Hex(),
|
Src: SenderAddr.Hex(),
|
||||||
@@ -240,6 +241,7 @@ var (
|
|||||||
Data: []byte{},
|
Data: []byte{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
CID: Trx2CID.String(),
|
CID: Trx2CID.String(),
|
||||||
MhKey: Trx2MhKey,
|
MhKey: Trx2MhKey,
|
||||||
Src: SenderAddr.Hex(),
|
Src: SenderAddr.Hex(),
|
||||||
@@ -249,6 +251,7 @@ var (
|
|||||||
Data: []byte{},
|
Data: []byte{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
CID: Trx3CID.String(),
|
CID: Trx3CID.String(),
|
||||||
MhKey: Trx3MhKey,
|
MhKey: Trx3MhKey,
|
||||||
Src: SenderAddr.Hex(),
|
Src: SenderAddr.Hex(),
|
||||||
@@ -258,6 +261,7 @@ var (
|
|||||||
Data: MockContractByteCode,
|
Data: MockContractByteCode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
CID: Trx4CID.String(),
|
CID: Trx4CID.String(),
|
||||||
MhKey: Trx4MhKey,
|
MhKey: Trx4MhKey,
|
||||||
Src: SenderAddr.Hex(),
|
Src: SenderAddr.Hex(),
|
||||||
@@ -296,24 +300,28 @@ var (
|
|||||||
|
|
||||||
MockRctMetaPostPublish = []models.ReceiptModel{
|
MockRctMetaPostPublish = []models.ReceiptModel{
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
LeafCID: Rct1CID.String(),
|
LeafCID: Rct1CID.String(),
|
||||||
LeafMhKey: Rct1MhKey,
|
LeafMhKey: Rct1MhKey,
|
||||||
Contract: "",
|
Contract: "",
|
||||||
ContractHash: "",
|
ContractHash: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
LeafCID: Rct2CID.String(),
|
LeafCID: Rct2CID.String(),
|
||||||
LeafMhKey: Rct2MhKey,
|
LeafMhKey: Rct2MhKey,
|
||||||
Contract: "",
|
Contract: "",
|
||||||
ContractHash: "",
|
ContractHash: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
LeafCID: Rct3CID.String(),
|
LeafCID: Rct3CID.String(),
|
||||||
LeafMhKey: Rct3MhKey,
|
LeafMhKey: Rct3MhKey,
|
||||||
Contract: ContractAddress.String(),
|
Contract: ContractAddress.String(),
|
||||||
ContractHash: ContractHash,
|
ContractHash: ContractHash,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
LeafCID: Rct4CID.String(),
|
LeafCID: Rct4CID.String(),
|
||||||
LeafMhKey: Rct4MhKey,
|
LeafMhKey: Rct4MhKey,
|
||||||
Contract: "",
|
Contract: "",
|
||||||
@@ -391,6 +399,7 @@ var (
|
|||||||
}
|
}
|
||||||
MockStateMetaPostPublish = []models.StateNodeModel{
|
MockStateMetaPostPublish = []models.StateNodeModel{
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
CID: State1CID.String(),
|
CID: State1CID.String(),
|
||||||
MhKey: State1MhKey,
|
MhKey: State1MhKey,
|
||||||
Path: []byte{'\x06'},
|
Path: []byte{'\x06'},
|
||||||
@@ -398,6 +407,7 @@ var (
|
|||||||
StateKey: common.BytesToHash(ContractLeafKey).Hex(),
|
StateKey: common.BytesToHash(ContractLeafKey).Hex(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
CID: State2CID.String(),
|
CID: State2CID.String(),
|
||||||
MhKey: State2MhKey,
|
MhKey: State2MhKey,
|
||||||
Path: []byte{'\x0c'},
|
Path: []byte{'\x0c'},
|
||||||
@@ -461,6 +471,7 @@ var (
|
|||||||
StateNodes: MockStateMetaPostPublish,
|
StateNodes: MockStateMetaPostPublish,
|
||||||
StorageNodes: []models.StorageNodeWithStateKeyModel{
|
StorageNodes: []models.StorageNodeWithStateKeyModel{
|
||||||
{
|
{
|
||||||
|
BlockNumber: "1",
|
||||||
Path: []byte{},
|
Path: []byte{},
|
||||||
CID: StorageCID.String(),
|
CID: StorageCID.String(),
|
||||||
MhKey: StorageMhKey,
|
MhKey: StorageMhKey,
|
||||||
@@ -483,41 +494,50 @@ var (
|
|||||||
MockIPLDs = eth.IPLDs{
|
MockIPLDs = eth.IPLDs{
|
||||||
BlockNumber: new(big.Int).Set(BlockNumber),
|
BlockNumber: new(big.Int).Set(BlockNumber),
|
||||||
Header: models.IPLDModel{
|
Header: models.IPLDModel{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: HeaderIPLD.RawData(),
|
Data: HeaderIPLD.RawData(),
|
||||||
Key: HeaderIPLD.Cid().String(),
|
Key: HeaderIPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
Transactions: []models.IPLDModel{
|
Transactions: []models.IPLDModel{
|
||||||
{
|
{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: Trx1IPLD.RawData(),
|
Data: Trx1IPLD.RawData(),
|
||||||
Key: Trx1IPLD.Cid().String(),
|
Key: Trx1IPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: Trx2IPLD.RawData(),
|
Data: Trx2IPLD.RawData(),
|
||||||
Key: Trx2IPLD.Cid().String(),
|
Key: Trx2IPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: Trx3IPLD.RawData(),
|
Data: Trx3IPLD.RawData(),
|
||||||
Key: Trx3IPLD.Cid().String(),
|
Key: Trx3IPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: Trx4IPLD.RawData(),
|
Data: Trx4IPLD.RawData(),
|
||||||
Key: Trx4IPLD.Cid().String(),
|
Key: Trx4IPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Receipts: []models.IPLDModel{
|
Receipts: []models.IPLDModel{
|
||||||
{
|
{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: Rct1IPLD,
|
Data: Rct1IPLD,
|
||||||
Key: Rct1CID.String(),
|
Key: Rct1CID.String(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: Rct2IPLD,
|
Data: Rct2IPLD,
|
||||||
Key: Rct2CID.String(),
|
Key: Rct2CID.String(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: Rct3IPLD,
|
Data: Rct3IPLD,
|
||||||
Key: Rct3CID.String(),
|
Key: Rct3CID.String(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: Rct4IPLD,
|
Data: Rct4IPLD,
|
||||||
Key: Rct4CID.String(),
|
Key: Rct4CID.String(),
|
||||||
},
|
},
|
||||||
@@ -527,6 +547,7 @@ var (
|
|||||||
StateLeafKey: common.BytesToHash(ContractLeafKey),
|
StateLeafKey: common.BytesToHash(ContractLeafKey),
|
||||||
Type: sdtypes.Leaf,
|
Type: sdtypes.Leaf,
|
||||||
IPLD: models.IPLDModel{
|
IPLD: models.IPLDModel{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: State1IPLD.RawData(),
|
Data: State1IPLD.RawData(),
|
||||||
Key: State1IPLD.Cid().String(),
|
Key: State1IPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
@@ -536,6 +557,7 @@ var (
|
|||||||
StateLeafKey: common.BytesToHash(AccountLeafKey),
|
StateLeafKey: common.BytesToHash(AccountLeafKey),
|
||||||
Type: sdtypes.Leaf,
|
Type: sdtypes.Leaf,
|
||||||
IPLD: models.IPLDModel{
|
IPLD: models.IPLDModel{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: State2IPLD.RawData(),
|
Data: State2IPLD.RawData(),
|
||||||
Key: State2IPLD.Cid().String(),
|
Key: State2IPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
@@ -548,6 +570,7 @@ var (
|
|||||||
StorageLeafKey: common.BytesToHash(StorageLeafKey),
|
StorageLeafKey: common.BytesToHash(StorageLeafKey),
|
||||||
Type: sdtypes.Leaf,
|
Type: sdtypes.Leaf,
|
||||||
IPLD: models.IPLDModel{
|
IPLD: models.IPLDModel{
|
||||||
|
BlockNumber: BlockNumber.String(),
|
||||||
Data: StorageIPLD.RawData(),
|
Data: StorageIPLD.RawData(),
|
||||||
Key: StorageIPLD.Cid().String(),
|
Key: StorageIPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth/test_helpers"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/graphql"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/graphql"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
ethServerShared "github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
ethServerShared "github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("GraphQL", func() {
|
var _ = Describe("GraphQL", func() {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import (
|
|||||||
"github.com/graph-gophers/graphql-go/relay"
|
"github.com/graph-gophers/graphql-go/relay"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Service encapsulates a GraphQL service.
|
// Service encapsulates a GraphQL service.
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/net"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("API", func() {
|
var _ = Describe("API", func() {
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/p2p/netutil"
|
"github.com/ethereum/go-ethereum/p2p/netutil"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/prom"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/prom"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/node"
|
"github.com/ethereum/go-ethereum/node"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/prom"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/prom"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StartWSEndpoint starts a websocket endpoint.
|
// StartWSEndpoint starts a websocket endpoint.
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/statediff/types"
|
"github.com/ethereum/go-ethereum/statediff/types"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// APIName is the namespace used for the state diffing service API
|
// APIName is the namespace used for the state diffing service API
|
||||||
|
|||||||
+2
-2
@@ -32,8 +32,8 @@ import (
|
|||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/prom"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/prom"
|
||||||
ethServerShared "github.com/vulcanize/ipld-eth-server/v3/pkg/shared"
|
ethServerShared "github.com/vulcanize/ipld-eth-server/v4/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Env variables
|
// Env variables
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ import (
|
|||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/net"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
+4
-38
@@ -18,11 +18,9 @@ package shared
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/statediff/indexer/ipld"
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
||||||
dshelp "github.com/ipfs/go-ipfs-ds-help"
|
dshelp "github.com/ipfs/go-ipfs-ds-help"
|
||||||
node "github.com/ipfs/go-ipld-format"
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@@ -50,31 +48,11 @@ func Rollback(tx *sqlx.Tx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublishIPLD is used to insert an ipld into Postgres blockstore with the provided tx
|
// FetchIPLDByMhKeyAndBlockNumber is used to retrieve an ipld from Postgres blockstore with the provided tx, mhkey string and blockNumber
|
||||||
func PublishIPLD(tx *sqlx.Tx, i node.Node) error {
|
func FetchIPLDByMhKeyAndBlockNumber(tx *sqlx.Tx, mhKey string, blockNumber uint64) ([]byte, error) {
|
||||||
dbKey := dshelp.MultihashToDsKey(i.Cid().Hash())
|
pgStr := `SELECT data FROM public.blocks WHERE key = $1 AND block_number = $2`
|
||||||
prefixedKey := blockstore.BlockPrefix.String() + dbKey.String()
|
|
||||||
raw := i.RawData()
|
|
||||||
_, err := tx.Exec(`INSERT INTO public.blocks (key, data) VALUES ($1, $2) ON CONFLICT (key) DO NOTHING`, prefixedKey, raw)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// FetchIPLD is used to retrieve an ipld from Postgres blockstore with the provided tx and cid string
|
|
||||||
func FetchIPLD(tx *sqlx.Tx, cid string) ([]byte, error) {
|
|
||||||
mhKey, err := MultihashKeyFromCIDString(cid)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
pgStr := `SELECT data FROM public.blocks WHERE key = $1`
|
|
||||||
var block []byte
|
var block []byte
|
||||||
return block, tx.Get(&block, pgStr, mhKey)
|
return block, tx.Get(&block, pgStr, mhKey, blockNumber)
|
||||||
}
|
|
||||||
|
|
||||||
// FetchIPLDByMhKey is used to retrieve an ipld from Postgres blockstore with the provided tx and mhkey string
|
|
||||||
func FetchIPLDByMhKey(tx *sqlx.Tx, mhKey string) ([]byte, error) {
|
|
||||||
pgStr := `SELECT data FROM public.blocks WHERE key = $1`
|
|
||||||
var block []byte
|
|
||||||
return block, tx.Get(&block, pgStr, mhKey)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MultihashKeyFromCID converts a cid into a blockstore-prefixed multihash db key string
|
// MultihashKeyFromCID converts a cid into a blockstore-prefixed multihash db key string
|
||||||
@@ -92,15 +70,3 @@ func MultihashKeyFromCIDString(c string) (string, error) {
|
|||||||
dbKey := dshelp.MultihashToDsKey(dc.Hash())
|
dbKey := dshelp.MultihashToDsKey(dc.Hash())
|
||||||
return blockstore.BlockPrefix.String() + dbKey.String(), nil
|
return blockstore.BlockPrefix.String() + dbKey.String(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublishRaw derives a cid from raw bytes and provided codec and multihash type, and writes it to the db tx
|
|
||||||
func PublishRaw(tx *sqlx.Tx, codec, mh uint64, raw []byte) (string, error) {
|
|
||||||
c, err := ipld.RawdataToCid(codec, raw, mh)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
dbKey := dshelp.MultihashToDsKey(c.Hash())
|
|
||||||
prefixedKey := blockstore.BlockPrefix.String() + dbKey.String()
|
|
||||||
_, err = tx.Exec(`INSERT INTO public.blocks (key, data) VALUES ($1, $2) ON CONFLICT (key) DO NOTHING`, prefixedKey, raw)
|
|
||||||
return c.String(), err
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -58,8 +58,12 @@ func SetupDB() *sqlx.DB {
|
|||||||
func TearDownDB(db *sqlx.DB) {
|
func TearDownDB(db *sqlx.DB) {
|
||||||
tx, err := db.Beginx()
|
tx, err := db.Beginx()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
_, err = tx.Exec(`DELETE FROM nodes`)
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
_, err = tx.Exec(`DELETE FROM eth.header_cids`)
|
_, err = tx.Exec(`DELETE FROM eth.header_cids`)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
_, err = tx.Exec(`DELETE FROM eth.uncle_cids`)
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
_, err = tx.Exec(`DELETE FROM eth.transaction_cids`)
|
_, err = tx.Exec(`DELETE FROM eth.transaction_cids`)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
_, err = tx.Exec(`DELETE FROM eth.receipt_cids`)
|
_, err = tx.Exec(`DELETE FROM eth.receipt_cids`)
|
||||||
@@ -68,6 +72,10 @@ func TearDownDB(db *sqlx.DB) {
|
|||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
_, err = tx.Exec(`DELETE FROM eth.storage_cids`)
|
_, err = tx.Exec(`DELETE FROM eth.storage_cids`)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
_, err = tx.Exec(`DELETE FROM eth.state_accounts`)
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
_, err = tx.Exec(`DELETE FROM eth.access_list_elements`)
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
_, err = tx.Exec(`DELETE FROM blocks`)
|
_, err = tx.Exec(`DELETE FROM blocks`)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
_, err = tx.Exec(`DELETE FROM eth.log_cids`)
|
_, err = tx.Exec(`DELETE FROM eth.log_cids`)
|
||||||
|
|||||||
@@ -1,8 +1,26 @@
|
|||||||
# Clear up existing docker images and volume.
|
#!/bin/bash
|
||||||
docker-compose down --remove-orphans --volumes
|
|
||||||
|
|
||||||
docker-compose -f docker-compose.yml up -d ipld-eth-db
|
set -e
|
||||||
sleep 10
|
|
||||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test
|
|
||||||
|
|
||||||
docker-compose down --remove-orphans --volumes
|
mkdir -p out
|
||||||
|
|
||||||
|
# Remove existing docker-tsdb directory
|
||||||
|
rm -rf out/docker-tsdb/
|
||||||
|
|
||||||
|
# Copy over files to setup TimescaleDB
|
||||||
|
ID=$(docker create vulcanize/ipld-eth-db:v4.1.1-alpha)
|
||||||
|
docker cp $ID:/app/docker-tsdb out/docker-tsdb/
|
||||||
|
docker rm -v $ID
|
||||||
|
|
||||||
|
# Spin up TimescaleDB
|
||||||
|
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml up ipld-eth-db
|
||||||
|
trap "docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes; rm -rf out/" SIGINT SIGTERM ERR
|
||||||
|
sleep 45
|
||||||
|
|
||||||
|
# Run unit tests
|
||||||
|
go clean -testcache
|
||||||
|
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8066 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing_v4 make test
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes
|
||||||
|
rm -rf out/
|
||||||
|
|||||||
+44
-7
@@ -2,18 +2,24 @@
|
|||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
- Clone [stack-orchestrator](https://github.com/vulcanize/stack-orchestrator) and [go-ethereum](https://github.com/vulcanize/go-ethereum) repositories.
|
- Clone [stack-orchestrator](https://github.com/vulcanize/stack-orchestrator), [ipld-eth-db](https://github.com/vulcanize/ipld-eth-db) [go-ethereum](https://github.com/vulcanize/go-ethereum) repositories.
|
||||||
|
|
||||||
- Checkout [v3 release](https://github.com/vulcanize/go-ethereum/releases/tag/v1.10.17-statediff-3.2.1) in go-ethereum repo.
|
- Checkout [v4 release](https://github.com/vulcanize/ipld-eth-db/releases/tag/v4.1.1-alpha) in ipld-eth-db repo.
|
||||||
|
```bash
|
||||||
|
# In ipld-eth-db repo.
|
||||||
|
git checkout v4.1.1-alpha
|
||||||
|
```
|
||||||
|
|
||||||
|
- Checkout [v4 release](https://github.com/vulcanize/go-ethereum/releases/tag/v1.10.18-statediff-4.0.2-alpha) in go-ethereum repo.
|
||||||
```bash
|
```bash
|
||||||
# In go-ethereum repo.
|
# In go-ethereum repo.
|
||||||
git checkout v1.10.17-statediff-3.2.1
|
git checkout v1.10.18-statediff-4.0.2-alpha
|
||||||
```
|
```
|
||||||
|
|
||||||
- Checkout working commit in stack-orchestrator repo.
|
- Checkout working commit in stack-orchestrator repo.
|
||||||
```bash
|
```bash
|
||||||
# In stack-orchestrator repo.
|
# In stack-orchestrator repo.
|
||||||
git checkout fcbc74451c5494664fe21f765e89c9c6565c07cb
|
git checkout 418957a1f745c921b21286c13bb033f922a91ae9
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
@@ -27,43 +33,68 @@
|
|||||||
|
|
||||||
- Run integration tests:
|
- Run integration tests:
|
||||||
|
|
||||||
- Update (Replace existing content) config file [config.sh](https://github.com/vulcanize/stack-orchestrator/blob/main/config.sh) in stack-orchestrator repo:
|
- In stack-orchestrator repo, create config file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd helper-scripts
|
||||||
|
|
||||||
|
./create-config.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
A `config.sh` will be created in the root directory.
|
||||||
|
|
||||||
|
- Update/Edit the generated config file with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Path to ipld-eth-server repo.
|
||||||
|
vulcanize_ipld_eth_db=~/ipld-eth-db/
|
||||||
|
|
||||||
# Path to go-ethereum repo.
|
# Path to go-ethereum repo.
|
||||||
vulcanize_go_ethereum=~/go-ethereum/
|
vulcanize_go_ethereum=~/go-ethereum/
|
||||||
|
|
||||||
# Path to ipld-eth-server repo.
|
# Path to ipld-eth-server repo.
|
||||||
vulcanize_ipld_eth_server=~/ipld-eth-server/
|
vulcanize_ipld_eth_server=~/ipld-eth-server/
|
||||||
|
|
||||||
|
# Path to test contract.
|
||||||
|
vulcanize_test_contract=~/ipld-eth-server/test/contract
|
||||||
|
|
||||||
db_write=true
|
db_write=true
|
||||||
eth_forward_eth_calls=false
|
eth_forward_eth_calls=false
|
||||||
eth_proxy_on_error=false
|
eth_proxy_on_error=false
|
||||||
eth_http_path="go-ethereum:8545"
|
eth_http_path="go-ethereum:8545"
|
||||||
|
ipld_eth_server_db_dependency=access-node
|
||||||
|
go_ethereum_db_dependency=access-node
|
||||||
|
connecting_db_name=vulcanize_testing_v4
|
||||||
```
|
```
|
||||||
|
|
||||||
- Run stack-orchestrator:
|
- Run stack-orchestrator:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# In stack-orchestrator root directory.
|
# In stack-orchestrator root directory.
|
||||||
cd helper-scripts
|
cd helper-scripts
|
||||||
|
|
||||||
./wrapper.sh \
|
./wrapper.sh \
|
||||||
-e docker \
|
-e docker \
|
||||||
-d ../docker/latest/docker-compose-db.yml \
|
-d ../docker/latest/docker-compose-timescale-db.yml \
|
||||||
|
-d ../docker/local/docker-compose-db-migration.yml \
|
||||||
-d ../docker/local/docker-compose-go-ethereum.yml \
|
-d ../docker/local/docker-compose-go-ethereum.yml \
|
||||||
-d ../docker/local/docker-compose-ipld-eth-server.yml \
|
-d ../docker/local/docker-compose-ipld-eth-server.yml \
|
||||||
|
-d ../docker/local/docker-compose-contract.yml \
|
||||||
-v remove \
|
-v remove \
|
||||||
-p ../config.sh
|
-p ../config.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
- Run test:
|
- Run test:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# In ipld-eth-server root directory.
|
# In ipld-eth-server root directory.
|
||||||
./scripts/run_integration_test.sh
|
./scripts/run_integration_test.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
- Update `config.sh` file:
|
- Update stack-orchestrator `config.sh` file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
@@ -73,10 +104,16 @@
|
|||||||
# Path to ipld-eth-server repo.
|
# Path to ipld-eth-server repo.
|
||||||
vulcanize_ipld_eth_server=~/ipld-eth-server/
|
vulcanize_ipld_eth_server=~/ipld-eth-server/
|
||||||
|
|
||||||
|
# Path to test contract.
|
||||||
|
vulcanize_test_contract=~/ipld-eth-server/test/contract
|
||||||
|
|
||||||
db_write=false
|
db_write=false
|
||||||
eth_forward_eth_calls=true
|
eth_forward_eth_calls=true
|
||||||
eth_proxy_on_error=false
|
eth_proxy_on_error=false
|
||||||
eth_http_path="go-ethereum:8545"
|
eth_http_path="go-ethereum:8545"
|
||||||
|
ipld_eth_server_db_dependency=access-node
|
||||||
|
go_ethereum_db_dependency=access-node
|
||||||
|
connecting_db_name=vulcanize_testing_v4
|
||||||
```
|
```
|
||||||
|
|
||||||
- Stop the stack-orchestrator and start again using the same command
|
- Stop the stack-orchestrator and start again using the same command
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
integration "github.com/vulcanize/ipld-eth-server/v3/test"
|
integration "github.com/vulcanize/ipld-eth-server/v4/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Integration test", func() {
|
var _ = Describe("Integration test", func() {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/v3/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/v4/pkg/eth"
|
||||||
integration "github.com/vulcanize/ipld-eth-server/v3/test"
|
integration "github.com/vulcanize/ipld-eth-server/v4/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
const nonExistingBlockHash = "0x111111111111111111111111111111111111111111111111111111111111111"
|
const nonExistingBlockHash = "0x111111111111111111111111111111111111111111111111111111111111111"
|
||||||
|
|||||||
@@ -10,11 +10,10 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/ethereum/go-ethereum/statediff/types"
|
|
||||||
sdtypes "github.com/ethereum/go-ethereum/statediff/types"
|
sdtypes "github.com/ethereum/go-ethereum/statediff/types"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
integration "github.com/vulcanize/ipld-eth-server/v3/test"
|
integration "github.com/vulcanize/ipld-eth-server/v4/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -226,8 +225,8 @@ var _ = Describe("WatchAddress integration test", func() {
|
|||||||
|
|
||||||
Context("one contract being watched", func() {
|
Context("one contract being watched", func() {
|
||||||
It("indexes state only for the watched contract", func() {
|
It("indexes state only for the watched contract", func() {
|
||||||
operation := types.Add
|
operation := sdtypes.Add
|
||||||
args := []types.WatchAddressArg{
|
args := []sdtypes.WatchAddressArg{
|
||||||
{
|
{
|
||||||
Address: contract1.Address,
|
Address: contract1.Address,
|
||||||
CreatedAt: uint64(contract1.BlockNumber),
|
CreatedAt: uint64(contract1.BlockNumber),
|
||||||
@@ -308,8 +307,8 @@ var _ = Describe("WatchAddress integration test", func() {
|
|||||||
|
|
||||||
Context("contract added to a non-empty watch-list", func() {
|
Context("contract added to a non-empty watch-list", func() {
|
||||||
It("indexes state only for the watched contracts", func() {
|
It("indexes state only for the watched contracts", func() {
|
||||||
operation := types.Add
|
operation := sdtypes.Add
|
||||||
args := []types.WatchAddressArg{
|
args := []sdtypes.WatchAddressArg{
|
||||||
{
|
{
|
||||||
Address: contract2.Address,
|
Address: contract2.Address,
|
||||||
CreatedAt: uint64(contract2.BlockNumber),
|
CreatedAt: uint64(contract2.BlockNumber),
|
||||||
@@ -392,8 +391,8 @@ var _ = Describe("WatchAddress integration test", func() {
|
|||||||
|
|
||||||
Context("contract removed from the watch-list", func() {
|
Context("contract removed from the watch-list", func() {
|
||||||
It("indexes state only for the watched contract", func() {
|
It("indexes state only for the watched contract", func() {
|
||||||
operation := types.Remove
|
operation := sdtypes.Remove
|
||||||
args := []types.WatchAddressArg{
|
args := []sdtypes.WatchAddressArg{
|
||||||
{
|
{
|
||||||
Address: contract1.Address,
|
Address: contract1.Address,
|
||||||
CreatedAt: uint64(contract1.BlockNumber),
|
CreatedAt: uint64(contract1.BlockNumber),
|
||||||
@@ -474,8 +473,8 @@ var _ = Describe("WatchAddress integration test", func() {
|
|||||||
|
|
||||||
Context("list of watched addresses set", func() {
|
Context("list of watched addresses set", func() {
|
||||||
It("indexes state only for the watched contracts", func() {
|
It("indexes state only for the watched contracts", func() {
|
||||||
operation := types.Set
|
operation := sdtypes.Set
|
||||||
args := []types.WatchAddressArg{
|
args := []sdtypes.WatchAddressArg{
|
||||||
{
|
{
|
||||||
Address: contract1.Address,
|
Address: contract1.Address,
|
||||||
CreatedAt: uint64(contract1.BlockNumber),
|
CreatedAt: uint64(contract1.BlockNumber),
|
||||||
@@ -562,8 +561,8 @@ var _ = Describe("WatchAddress integration test", func() {
|
|||||||
|
|
||||||
Context("list of watched addresses cleared", func() {
|
Context("list of watched addresses cleared", func() {
|
||||||
It("indexes state for all the contracts", func() {
|
It("indexes state for all the contracts", func() {
|
||||||
operation := types.Clear
|
operation := sdtypes.Clear
|
||||||
args := []types.WatchAddressArg{}
|
args := []sdtypes.WatchAddressArg{}
|
||||||
ipldErr := ipldRPCClient.Call(nil, ipldMethod, operation, args)
|
ipldErr := ipldRPCClient.Call(nil, ipldMethod, operation, args)
|
||||||
Expect(ipldErr).ToNot(HaveOccurred())
|
Expect(ipldErr).ToNot(HaveOccurred())
|
||||||
|
|
||||||
@@ -656,7 +655,7 @@ var _ = Describe("WatchAddress integration test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("returns an error on args of invalid type", func() {
|
It("returns an error on args of invalid type", func() {
|
||||||
operation := types.Add
|
operation := sdtypes.Add
|
||||||
args := []string{"WrongArg"}
|
args := []string{"WrongArg"}
|
||||||
|
|
||||||
gethErr := gethRPCClient.Call(nil, gethMethod, operation, args)
|
gethErr := gethRPCClient.Call(nil, gethMethod, operation, args)
|
||||||
|
|||||||
Reference in New Issue
Block a user