commit
ce706d0b07
@ -66,10 +66,15 @@ The corresponding CLI flags can be found with the `./ipld-eth-server serve --hel
|
|||||||
ipcPath = "~/.vulcanize/vulcanize.ipc" # $SERVER_IPC_PATH
|
ipcPath = "~/.vulcanize/vulcanize.ipc" # $SERVER_IPC_PATH
|
||||||
wsPath = "127.0.0.1:8081" # $SERVER_WS_PATH
|
wsPath = "127.0.0.1:8081" # $SERVER_WS_PATH
|
||||||
httpPath = "127.0.0.1:8082" # $SERVER_HTTP_PATH
|
httpPath = "127.0.0.1:8082" # $SERVER_HTTP_PATH
|
||||||
|
|
||||||
|
[ethereum]
|
||||||
|
chainID = "1" # $ETH_CHAIN_ID
|
||||||
|
defaultSender = "" # $ETH_DEFAULT_SENDER_ADDR
|
||||||
```
|
```
|
||||||
|
|
||||||
The `database` fields are for connecting to a Postgres database that has been/is being populated by [ipld-eth-indexer](https://github.com/vulcanize/ipld-eth-indexer).
|
The `database` fields are for connecting to a Postgres database that has been/is being populated by [ipld-eth-indexer](https://github.com/vulcanize/ipld-eth-indexer).
|
||||||
The `server` fields set the paths for exposing the ipld-eth-server endpoints
|
The `server` fields set the paths for exposing the ipld-eth-server endpoints
|
||||||
|
The `ethereum` fields set the chainID and default sender address to use for EVM simulation
|
||||||
|
|
||||||
|
|
||||||
### Endpoints
|
### Endpoints
|
||||||
|
18
cmd/serve.go
18
cmd/serve.go
@ -100,22 +100,16 @@ func init() {
|
|||||||
serveCmd.PersistentFlags().String("server-http-path", "", "vdb server http path")
|
serveCmd.PersistentFlags().String("server-http-path", "", "vdb server http path")
|
||||||
serveCmd.PersistentFlags().String("server-ipc-path", "", "vdb server ipc path")
|
serveCmd.PersistentFlags().String("server-ipc-path", "", "vdb server ipc path")
|
||||||
|
|
||||||
serveCmd.PersistentFlags().String("eth-ws-path", "", "ws url for ethereum node")
|
serveCmd.PersistentFlags().String("eth-chain-id", "1", "eth chain id")
|
||||||
serveCmd.PersistentFlags().String("eth-http-path", "", "http url for ethereum node")
|
serveCmd.PersistentFlags().String("eth-default-sender", "", "default sender address")
|
||||||
serveCmd.PersistentFlags().String("eth-node-id", "", "eth node id")
|
serveCmd.PersistentFlags().String("eth-rpc-gas-cap", "", "rpc gas cap (for eth_Call execution)")
|
||||||
serveCmd.PersistentFlags().String("eth-client-name", "", "eth client name")
|
|
||||||
serveCmd.PersistentFlags().String("eth-genesis-block", "", "eth genesis block hash")
|
|
||||||
serveCmd.PersistentFlags().String("eth-network-id", "", "eth network id")
|
|
||||||
|
|
||||||
// and their bindings
|
// and their bindings
|
||||||
viper.BindPFlag("server.wsPath", serveCmd.PersistentFlags().Lookup("server-ws-path"))
|
viper.BindPFlag("server.wsPath", serveCmd.PersistentFlags().Lookup("server-ws-path"))
|
||||||
viper.BindPFlag("server.httpPath", serveCmd.PersistentFlags().Lookup("server-http-path"))
|
viper.BindPFlag("server.httpPath", serveCmd.PersistentFlags().Lookup("server-http-path"))
|
||||||
viper.BindPFlag("server.ipcPath", serveCmd.PersistentFlags().Lookup("server-ipc-path"))
|
viper.BindPFlag("server.ipcPath", serveCmd.PersistentFlags().Lookup("server-ipc-path"))
|
||||||
|
|
||||||
viper.BindPFlag("ethereum.wsPath", serveCmd.PersistentFlags().Lookup("eth-ws-path"))
|
viper.BindPFlag("ethereum.chainID", rootCmd.PersistentFlags().Lookup("eth-chain-id"))
|
||||||
viper.BindPFlag("ethereum.httpPath", serveCmd.PersistentFlags().Lookup("eth-http-path"))
|
viper.BindPFlag("ethereum.defaultSender", rootCmd.PersistentFlags().Lookup("eth-default-sender"))
|
||||||
viper.BindPFlag("ethereum.nodeID", serveCmd.PersistentFlags().Lookup("eth-node-id"))
|
viper.BindPFlag("ethereum.rpcGasCap", rootCmd.PersistentFlags().Lookup("eth-rpc-gas-cap"))
|
||||||
viper.BindPFlag("ethereum.clientName", serveCmd.PersistentFlags().Lookup("eth-client-name"))
|
|
||||||
viper.BindPFlag("ethereum.genesisBlock", serveCmd.PersistentFlags().Lookup("eth-genesis-block"))
|
|
||||||
viper.BindPFlag("ethereum.networkID", serveCmd.PersistentFlags().Lookup("eth-network-id"))
|
|
||||||
}
|
}
|
||||||
|
69
db/migrations/00013_potgraphile_triggers.sql
Normal file
69
db/migrations/00013_potgraphile_triggers.sql
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
-- +goose Up
|
||||||
|
-- +goose StatementBegin
|
||||||
|
CREATE FUNCTION eth.graphql_subscription() returns TRIGGER as $$
|
||||||
|
declare
|
||||||
|
table_name text = TG_ARGV[0];
|
||||||
|
attribute text = TG_ARGV[1];
|
||||||
|
id text;
|
||||||
|
begin
|
||||||
|
execute 'select $1.' || quote_ident(attribute)
|
||||||
|
using new
|
||||||
|
into id;
|
||||||
|
perform pg_notify('postgraphile:' || table_name,
|
||||||
|
json_build_object(
|
||||||
|
'__node__', json_build_array(
|
||||||
|
table_name,
|
||||||
|
id
|
||||||
|
)
|
||||||
|
)::text
|
||||||
|
);
|
||||||
|
return new;
|
||||||
|
end;
|
||||||
|
$$ language plpgsql;
|
||||||
|
-- +goose StatementEnd
|
||||||
|
|
||||||
|
CREATE TRIGGER header_cids_ai
|
||||||
|
after INSERT ON eth.header_cids
|
||||||
|
for each row
|
||||||
|
execute procedure eth.graphql_subscription('header_cids', 'id');
|
||||||
|
|
||||||
|
CREATE TRIGGER receipt_cids_ai
|
||||||
|
after INSERT ON eth.receipt_cids
|
||||||
|
for each row
|
||||||
|
execute procedure eth.graphql_subscription('receipt_cids', 'id');
|
||||||
|
|
||||||
|
CREATE TRIGGER state_accounts_ai
|
||||||
|
after INSERT ON eth.state_accounts
|
||||||
|
for each row
|
||||||
|
execute procedure eth.graphql_subscription('state_accounts', 'id');
|
||||||
|
|
||||||
|
CREATE TRIGGER state_cids_ai
|
||||||
|
after INSERT ON eth.state_cids
|
||||||
|
for each row
|
||||||
|
execute procedure eth.graphql_subscription('state_cids', 'id');
|
||||||
|
|
||||||
|
CREATE TRIGGER storage_cids_ai
|
||||||
|
after INSERT ON eth.storage_cids
|
||||||
|
for each row
|
||||||
|
execute procedure eth.graphql_subscription('storage_cids', 'id');
|
||||||
|
|
||||||
|
CREATE TRIGGER transaction_cids_ai
|
||||||
|
after INSERT ON eth.transaction_cids
|
||||||
|
for each row
|
||||||
|
execute procedure eth.graphql_subscription('transaction_cids', 'id');
|
||||||
|
|
||||||
|
CREATE TRIGGER uncle_cids_ai
|
||||||
|
after INSERT ON eth.uncle_cids
|
||||||
|
for each row
|
||||||
|
execute procedure eth.graphql_subscription('uncle_cids', 'id');
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TRIGGER uncle_cids_ai ON eth.uncle_cids;
|
||||||
|
DROP TRIGGER transaction_cids_ai ON eth.transaction_cids;
|
||||||
|
DROP TRIGGER storage_cids_ai ON eth.storage_cids;
|
||||||
|
DROP TRIGGER state_cids_ai ON eth.state_cids;
|
||||||
|
DROP TRIGGER state_accounts_ai ON eth.state_accounts;
|
||||||
|
DROP TRIGGER receipt_cids_ai ON eth.receipt_cids;
|
||||||
|
DROP TRIGGER header_cids_ai ON eth.header_cids;
|
||||||
|
|
||||||
|
DROP FUNCTION eth.graphql_subscription();
|
121
db/migrations/00014_create_cid_indexes.sql
Normal file
121
db/migrations/00014_create_cid_indexes.sql
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
-- +goose Up
|
||||||
|
-- header indexes
|
||||||
|
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
|
||||||
|
|
||||||
|
CREATE INDEX block_hash_index ON eth.header_cids USING btree (block_hash);
|
||||||
|
|
||||||
|
CREATE INDEX header_cid_index ON eth.header_cids USING btree (cid);
|
||||||
|
|
||||||
|
CREATE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
|
||||||
|
|
||||||
|
CREATE INDEX timestamp_index ON eth.header_cids USING brin (timestamp);
|
||||||
|
|
||||||
|
-- transaction indexes
|
||||||
|
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
||||||
|
|
||||||
|
CREATE INDEX tx_hash_index ON eth.transaction_cids USING btree (tx_hash);
|
||||||
|
|
||||||
|
CREATE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
|
||||||
|
|
||||||
|
CREATE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
|
||||||
|
|
||||||
|
CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
|
||||||
|
|
||||||
|
-- receipt indexes
|
||||||
|
CREATE INDEX rct_tx_id_index ON eth.receipt_cids USING btree (tx_id);
|
||||||
|
|
||||||
|
CREATE INDEX rct_cid_index ON eth.receipt_cids USING btree (cid);
|
||||||
|
|
||||||
|
CREATE INDEX rct_mh_index ON eth.receipt_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
CREATE INDEX rct_contract_index ON eth.receipt_cids USING btree (contract);
|
||||||
|
|
||||||
|
CREATE INDEX rct_contract_hash_index ON eth.receipt_cids USING btree (contract_hash);
|
||||||
|
|
||||||
|
CREATE INDEX rct_topic0_index ON eth.receipt_cids USING gin (topic0s);
|
||||||
|
|
||||||
|
CREATE INDEX rct_topic1_index ON eth.receipt_cids USING gin (topic1s);
|
||||||
|
|
||||||
|
CREATE INDEX rct_topic2_index ON eth.receipt_cids USING gin (topic2s);
|
||||||
|
|
||||||
|
CREATE INDEX rct_topic3_index ON eth.receipt_cids USING gin (topic3s);
|
||||||
|
|
||||||
|
CREATE INDEX rct_log_contract_index ON eth.receipt_cids USING gin (log_contracts);
|
||||||
|
|
||||||
|
-- state node indexes
|
||||||
|
CREATE INDEX state_header_id_index ON eth.state_cids USING btree (header_id);
|
||||||
|
|
||||||
|
CREATE INDEX state_leaf_key_index ON eth.state_cids USING btree (state_leaf_key);
|
||||||
|
|
||||||
|
CREATE INDEX state_cid_index ON eth.state_cids USING btree (cid);
|
||||||
|
|
||||||
|
CREATE INDEX state_mh_index ON eth.state_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
CREATE INDEX state_path_index ON eth.state_cids USING btree (state_path);
|
||||||
|
|
||||||
|
-- storage node indexes
|
||||||
|
CREATE INDEX storage_state_id_index ON eth.storage_cids USING btree (state_id);
|
||||||
|
|
||||||
|
CREATE INDEX storage_leaf_key_index ON eth.storage_cids USING btree (storage_leaf_key);
|
||||||
|
|
||||||
|
CREATE INDEX storage_cid_index ON eth.storage_cids USING btree (cid);
|
||||||
|
|
||||||
|
CREATE INDEX storage_mh_index ON eth.storage_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
CREATE INDEX storage_path_index ON eth.storage_cids USING btree (storage_path);
|
||||||
|
|
||||||
|
-- state accounts indexes
|
||||||
|
CREATE INDEX account_state_id_index ON eth.state_accounts USING btree (state_id);
|
||||||
|
|
||||||
|
CREATE INDEX storage_root_index ON eth.state_accounts USING btree (storage_root);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
-- state account indexes
|
||||||
|
DROP INDEX eth.storage_root_index;
|
||||||
|
DROP INDEX eth.account_state_id_index;
|
||||||
|
|
||||||
|
-- storage node indexes
|
||||||
|
DROP INDEX eth.storage_path_index;
|
||||||
|
DROP INDEX eth.storage_mh_index;
|
||||||
|
DROP INDEX eth.storage_cid_index;
|
||||||
|
DROP INDEX eth.storage_leaf_key_index;
|
||||||
|
DROP INDEX eth.storage_state_id_index;
|
||||||
|
|
||||||
|
-- state node indexes
|
||||||
|
DROP INDEX eth.state_path_index;
|
||||||
|
DROP INDEX eth.state_mh_index;
|
||||||
|
DROP INDEX eth.state_cid_index;
|
||||||
|
DROP INDEX eth.state_leaf_key_index;
|
||||||
|
DROP INDEX eth.state_header_id_index;
|
||||||
|
|
||||||
|
-- receipt indexes
|
||||||
|
DROP INDEX eth.rct_log_contract_index;
|
||||||
|
DROP INDEX eth.rct_topic3_index;
|
||||||
|
DROP INDEX eth.rct_topic2_index;
|
||||||
|
DROP INDEX eth.rct_topic1_index;
|
||||||
|
DROP INDEX eth.rct_topic0_index;
|
||||||
|
DROP INDEX eth.rct_contract_hash_index;
|
||||||
|
DROP INDEX eth.rct_contract_index;
|
||||||
|
DROP INDEX eth.rct_mh_index;
|
||||||
|
DROP INDEX eth.rct_cid_index;
|
||||||
|
DROP INDEX eth.rct_tx_id_index;
|
||||||
|
|
||||||
|
-- transaction indexes
|
||||||
|
DROP INDEX eth.tx_src_index;
|
||||||
|
DROP INDEX eth.tx_dst_index;
|
||||||
|
DROP INDEX eth.tx_mh_index;
|
||||||
|
DROP INDEX eth.tx_cid_index;
|
||||||
|
DROP INDEX eth.tx_hash_index;
|
||||||
|
DROP INDEX eth.tx_header_id_index;
|
||||||
|
|
||||||
|
-- header indexes
|
||||||
|
DROP INDEX eth.timestamp_index;
|
||||||
|
DROP INDEX eth.state_root_index;
|
||||||
|
DROP INDEX eth.header_mh_index;
|
||||||
|
DROP INDEX eth.header_cid_index;
|
||||||
|
DROP INDEX eth.block_hash_index;
|
||||||
|
DROP INDEX eth.block_number_index;
|
@ -0,0 +1,48 @@
|
|||||||
|
-- +goose Up
|
||||||
|
-- +goose StatementBegin
|
||||||
|
-- returns the number of child headers that reference backwards to the header with the provided hash
|
||||||
|
CREATE OR REPLACE FUNCTION header_weight(hash VARCHAR(66)) RETURNS BIGINT
|
||||||
|
AS $$
|
||||||
|
WITH RECURSIVE validator AS (
|
||||||
|
SELECT block_hash, parent_hash, block_number
|
||||||
|
FROM eth.header_cids
|
||||||
|
WHERE block_hash = hash
|
||||||
|
UNION
|
||||||
|
SELECT eth.header_cids.block_hash, eth.header_cids.parent_hash, eth.header_cids.block_number
|
||||||
|
FROM eth.header_cids
|
||||||
|
INNER JOIN validator
|
||||||
|
ON eth.header_cids.parent_hash = validator.block_hash
|
||||||
|
AND eth.header_cids.block_number = validator.block_number + 1
|
||||||
|
)
|
||||||
|
SELECT COUNT(*) FROM validator;
|
||||||
|
$$ LANGUAGE SQL;
|
||||||
|
-- +goose StatementEnd
|
||||||
|
|
||||||
|
-- +goose StatementBegin
|
||||||
|
-- returns the id for the header at the provided height which is heaviest
|
||||||
|
CREATE OR REPLACE FUNCTION canonical_header(height BIGINT) RETURNS INT AS
|
||||||
|
$BODY$
|
||||||
|
DECLARE
|
||||||
|
current_weight INT;
|
||||||
|
heaviest_weight INT DEFAULT 0;
|
||||||
|
heaviest_id INT;
|
||||||
|
r eth.header_cids%ROWTYPE;
|
||||||
|
BEGIN
|
||||||
|
FOR r IN SELECT * FROM eth.header_cids
|
||||||
|
WHERE block_number = height
|
||||||
|
LOOP
|
||||||
|
SELECT INTO current_weight * FROM header_weight(r.block_hash);
|
||||||
|
IF current_weight > heaviest_weight THEN
|
||||||
|
heaviest_weight := current_weight;
|
||||||
|
heaviest_id := r.id;
|
||||||
|
END IF;
|
||||||
|
END LOOP;
|
||||||
|
RETURN heaviest_id;
|
||||||
|
END
|
||||||
|
$BODY$
|
||||||
|
LANGUAGE 'plpgsql';
|
||||||
|
-- +goose StatementEnd
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP FUNCTION header_weight;
|
||||||
|
DROP FUNCTION canonical_header;
|
7
db/migrations/00016_remove_deployment_from_tx_cids.sql
Normal file
7
db/migrations/00016_remove_deployment_from_tx_cids.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
-- +goose Up
|
||||||
|
ALTER TABLE eth.transaction_cids
|
||||||
|
DROP COLUMN deployment;
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
ALTER TABLE eth.transaction_cids
|
||||||
|
ADD COLUMN deployment BOOL NOT NULL DEFAULT FALSE;
|
25
db/migrations/00017_state_and_storage_ids_use_big_serial.sql
Normal file
25
db/migrations/00017_state_and_storage_ids_use_big_serial.sql
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
-- +goose Up
|
||||||
|
ALTER TABLE eth.storage_cids
|
||||||
|
ALTER COLUMN state_id TYPE BIGINT;
|
||||||
|
|
||||||
|
ALTER TABLE eth.state_accounts
|
||||||
|
ALTER COLUMN state_id TYPE BIGINT;
|
||||||
|
|
||||||
|
ALTER TABLE eth.state_cids
|
||||||
|
ALTER COLUMN id TYPE BIGINT;
|
||||||
|
|
||||||
|
ALTER TABLE eth.storage_cids
|
||||||
|
ALTER COLUMN id TYPE BIGINT;
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
ALTER TABLE eth.storage_cids
|
||||||
|
ALTER COLUMN id TYPE INTEGER;
|
||||||
|
|
||||||
|
ALTER TABLE eth.state_cids
|
||||||
|
ALTER COLUMN id TYPE INTEGER;
|
||||||
|
|
||||||
|
ALTER TABLE eth.state_accounts
|
||||||
|
ALTER COLUMN state_id TYPE INTEGER;
|
||||||
|
|
||||||
|
ALTER TABLE eth.storage_cids
|
||||||
|
ALTER COLUMN state_id TYPE INTEGER;
|
375
db/schema.sql
375
db/schema.sql
@ -23,6 +23,83 @@ SET row_security = off;
|
|||||||
CREATE SCHEMA eth;
|
CREATE SCHEMA eth;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: graphql_subscription(); Type: FUNCTION; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE FUNCTION eth.graphql_subscription() RETURNS trigger
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $_$
|
||||||
|
declare
|
||||||
|
table_name text = TG_ARGV[0];
|
||||||
|
attribute text = TG_ARGV[1];
|
||||||
|
id text;
|
||||||
|
begin
|
||||||
|
execute 'select $1.' || quote_ident(attribute)
|
||||||
|
using new
|
||||||
|
into id;
|
||||||
|
perform pg_notify('postgraphile:' || table_name,
|
||||||
|
json_build_object(
|
||||||
|
'__node__', json_build_array(
|
||||||
|
table_name,
|
||||||
|
id
|
||||||
|
)
|
||||||
|
)::text
|
||||||
|
);
|
||||||
|
return new;
|
||||||
|
end;
|
||||||
|
$_$;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: canonical_header(bigint); Type: FUNCTION; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE FUNCTION public.canonical_header(height bigint) RETURNS integer
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
DECLARE
|
||||||
|
current_weight INT;
|
||||||
|
heaviest_weight INT DEFAULT 0;
|
||||||
|
heaviest_id INT;
|
||||||
|
r eth.header_cids%ROWTYPE;
|
||||||
|
BEGIN
|
||||||
|
FOR r IN SELECT * FROM eth.header_cids
|
||||||
|
WHERE block_number = height
|
||||||
|
LOOP
|
||||||
|
SELECT INTO current_weight * FROM header_weight(r.block_hash);
|
||||||
|
IF current_weight > heaviest_weight THEN
|
||||||
|
heaviest_weight := current_weight;
|
||||||
|
heaviest_id := r.id;
|
||||||
|
END IF;
|
||||||
|
END LOOP;
|
||||||
|
RETURN heaviest_id;
|
||||||
|
END
|
||||||
|
$$;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: header_weight(character varying); Type: FUNCTION; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE FUNCTION public.header_weight(hash character varying) RETURNS bigint
|
||||||
|
LANGUAGE sql
|
||||||
|
AS $$
|
||||||
|
WITH RECURSIVE validator AS (
|
||||||
|
SELECT block_hash, parent_hash, block_number
|
||||||
|
FROM eth.header_cids
|
||||||
|
WHERE block_hash = hash
|
||||||
|
UNION
|
||||||
|
SELECT eth.header_cids.block_hash, eth.header_cids.parent_hash, eth.header_cids.block_number
|
||||||
|
FROM eth.header_cids
|
||||||
|
INNER JOIN validator
|
||||||
|
ON eth.header_cids.parent_hash = validator.block_hash
|
||||||
|
AND eth.header_cids.block_number = validator.block_number + 1
|
||||||
|
)
|
||||||
|
SELECT COUNT(*) FROM validator;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
|
||||||
SET default_tablespace = '';
|
SET default_tablespace = '';
|
||||||
|
|
||||||
SET default_table_access_method = heap;
|
SET default_table_access_method = heap;
|
||||||
@ -130,7 +207,7 @@ ALTER SEQUENCE eth.receipt_cids_id_seq OWNED BY eth.receipt_cids.id;
|
|||||||
|
|
||||||
CREATE TABLE eth.state_accounts (
|
CREATE TABLE eth.state_accounts (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
state_id integer NOT NULL,
|
state_id bigint NOT NULL,
|
||||||
balance numeric NOT NULL,
|
balance numeric NOT NULL,
|
||||||
nonce integer NOT NULL,
|
nonce integer NOT NULL,
|
||||||
code_hash bytea NOT NULL,
|
code_hash bytea NOT NULL,
|
||||||
@ -163,7 +240,7 @@ ALTER SEQUENCE eth.state_accounts_id_seq OWNED BY eth.state_accounts.id;
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE eth.state_cids (
|
CREATE TABLE eth.state_cids (
|
||||||
id integer NOT NULL,
|
id bigint NOT NULL,
|
||||||
header_id integer NOT NULL,
|
header_id integer NOT NULL,
|
||||||
state_leaf_key character varying(66),
|
state_leaf_key character varying(66),
|
||||||
cid text NOT NULL,
|
cid text NOT NULL,
|
||||||
@ -199,8 +276,8 @@ ALTER SEQUENCE eth.state_cids_id_seq OWNED BY eth.state_cids.id;
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE eth.storage_cids (
|
CREATE TABLE eth.storage_cids (
|
||||||
id integer NOT NULL,
|
id bigint NOT NULL,
|
||||||
state_id integer NOT NULL,
|
state_id bigint NOT NULL,
|
||||||
storage_leaf_key character varying(66),
|
storage_leaf_key character varying(66),
|
||||||
cid text NOT NULL,
|
cid text NOT NULL,
|
||||||
mh_key text NOT NULL,
|
mh_key text NOT NULL,
|
||||||
@ -243,7 +320,6 @@ CREATE TABLE eth.transaction_cids (
|
|||||||
mh_key text NOT NULL,
|
mh_key text NOT NULL,
|
||||||
dst character varying(66) NOT NULL,
|
dst character varying(66) NOT NULL,
|
||||||
src character varying(66) NOT NULL,
|
src character varying(66) NOT NULL,
|
||||||
deployment boolean NOT NULL,
|
|
||||||
tx_data bytea
|
tx_data bytea
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -362,7 +438,7 @@ CREATE TABLE public.nodes (
|
|||||||
genesis_block character varying(66),
|
genesis_block character varying(66),
|
||||||
network_id character varying,
|
network_id character varying,
|
||||||
node_id character varying(128),
|
node_id character varying(128),
|
||||||
chain_id integer
|
chain_id integer DEFAULT 1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -607,6 +683,293 @@ ALTER TABLE ONLY public.nodes
|
|||||||
ADD CONSTRAINT nodes_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT nodes_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: account_state_id_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX account_state_id_index ON eth.state_accounts USING btree (state_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: block_hash_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX block_hash_index ON eth.header_cids USING btree (block_hash);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: header_cid_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX header_cid_index ON eth.header_cids USING btree (cid);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: header_mh_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_cid_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_cid_index ON eth.receipt_cids USING btree (cid);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_contract_hash_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_contract_hash_index ON eth.receipt_cids USING btree (contract_hash);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_contract_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_contract_index ON eth.receipt_cids USING btree (contract);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_log_contract_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_log_contract_index ON eth.receipt_cids USING gin (log_contracts);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_mh_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_mh_index ON eth.receipt_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_topic0_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_topic0_index ON eth.receipt_cids USING gin (topic0s);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_topic1_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_topic1_index ON eth.receipt_cids USING gin (topic1s);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_topic2_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_topic2_index ON eth.receipt_cids USING gin (topic2s);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_topic3_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_topic3_index ON eth.receipt_cids USING gin (topic3s);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: rct_tx_id_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX rct_tx_id_index ON eth.receipt_cids USING btree (tx_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: state_cid_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX state_cid_index ON eth.state_cids USING btree (cid);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: state_header_id_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX state_header_id_index ON eth.state_cids USING btree (header_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: state_leaf_key_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX state_leaf_key_index ON eth.state_cids USING btree (state_leaf_key);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: state_mh_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX state_mh_index ON eth.state_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: state_path_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX state_path_index ON eth.state_cids USING btree (state_path);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: state_root_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: storage_cid_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX storage_cid_index ON eth.storage_cids USING btree (cid);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: storage_leaf_key_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX storage_leaf_key_index ON eth.storage_cids USING btree (storage_leaf_key);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: storage_mh_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX storage_mh_index ON eth.storage_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: storage_path_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX storage_path_index ON eth.storage_cids USING btree (storage_path);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: storage_root_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX storage_root_index ON eth.state_accounts USING btree (storage_root);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: storage_state_id_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX storage_state_id_index ON eth.storage_cids USING btree (state_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: timestamp_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX timestamp_index ON eth.header_cids USING brin ("timestamp");
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: tx_cid_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: tx_dst_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: tx_hash_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX tx_hash_index ON eth.transaction_cids USING btree (tx_hash);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: tx_header_id_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: tx_mh_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: tx_src_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: header_cids header_cids_ai; Type: TRIGGER; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TRIGGER header_cids_ai AFTER INSERT ON eth.header_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription('header_cids', 'id');
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: receipt_cids receipt_cids_ai; Type: TRIGGER; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TRIGGER receipt_cids_ai AFTER INSERT ON eth.receipt_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription('receipt_cids', 'id');
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: state_accounts state_accounts_ai; Type: TRIGGER; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TRIGGER state_accounts_ai AFTER INSERT ON eth.state_accounts FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription('state_accounts', 'id');
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: state_cids state_cids_ai; Type: TRIGGER; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TRIGGER state_cids_ai AFTER INSERT ON eth.state_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription('state_cids', 'id');
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: storage_cids storage_cids_ai; Type: TRIGGER; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TRIGGER storage_cids_ai AFTER INSERT ON eth.storage_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription('storage_cids', 'id');
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction_cids transaction_cids_ai; Type: TRIGGER; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TRIGGER transaction_cids_ai AFTER INSERT ON eth.transaction_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription('transaction_cids', 'id');
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: uncle_cids uncle_cids_ai; Type: TRIGGER; Schema: eth; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TRIGGER uncle_cids_ai AFTER INSERT ON eth.uncle_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription('uncle_cids', 'id');
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: header_cids header_cids_mh_key_fkey; Type: FK CONSTRAINT; Schema: eth; Owner: -
|
-- Name: header_cids header_cids_mh_key_fkey; Type: FK CONSTRAINT; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -12,3 +12,8 @@
|
|||||||
ipcPath = "~/.vulcanize/vulcanize.ipc" # $SERVER_IPC_PATH
|
ipcPath = "~/.vulcanize/vulcanize.ipc" # $SERVER_IPC_PATH
|
||||||
wsPath = "127.0.0.1:8081" # $SERVER_WS_PATH
|
wsPath = "127.0.0.1:8081" # $SERVER_WS_PATH
|
||||||
httpPath = "127.0.0.1:8082" # $SERVER_HTTP_PATH
|
httpPath = "127.0.0.1:8082" # $SERVER_HTTP_PATH
|
||||||
|
|
||||||
|
[ethereum]
|
||||||
|
chainID = "1" # $ETH_CHAIN_ID
|
||||||
|
defaultSender = "" # $ETH_DEFAULT_SENDER_ADDR
|
||||||
|
rpcGasCap = "1000000000000" # $ETH_RPC_GAS_CAP
|
17
go.mod
17
go.mod
@ -4,30 +4,21 @@ go 1.13
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/ethereum/go-ethereum v1.9.11
|
github.com/ethereum/go-ethereum v1.9.11
|
||||||
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
|
||||||
github.com/ipfs/go-block-format v0.0.2
|
github.com/ipfs/go-block-format v0.0.2
|
||||||
github.com/ipfs/go-cid v0.0.5
|
github.com/ipfs/go-cid v0.0.5
|
||||||
github.com/ipfs/go-ipfs-blockstore v1.0.0
|
github.com/ipfs/go-ipfs-blockstore v1.0.0
|
||||||
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/ipfs/go-ipld-format v0.2.0
|
||||||
github.com/jmoiron/sqlx v1.2.0
|
github.com/jmoiron/sqlx v1.2.0
|
||||||
github.com/lib/pq v1.8.0
|
github.com/lib/pq v1.5.2
|
||||||
github.com/mattn/go-sqlite3 v1.14.4 // indirect
|
|
||||||
github.com/multiformats/go-multihash v0.0.13
|
github.com/multiformats/go-multihash v0.0.13
|
||||||
github.com/nxadm/tail v1.4.5 // indirect
|
github.com/onsi/ginkgo v1.12.1
|
||||||
github.com/onsi/ginkgo v1.14.2
|
|
||||||
github.com/onsi/gomega v1.10.1
|
github.com/onsi/gomega v1.10.1
|
||||||
github.com/pressly/goose v2.6.0+incompatible // indirect
|
|
||||||
github.com/sirupsen/logrus v1.6.0
|
github.com/sirupsen/logrus v1.6.0
|
||||||
github.com/spf13/cobra v1.0.0
|
github.com/spf13/cobra v1.0.0
|
||||||
github.com/spf13/viper v1.7.0
|
github.com/spf13/viper v1.7.0
|
||||||
github.com/vulcanize/ipld-eth-indexer v0.5.0-alpha
|
github.com/vulcanize/ipld-eth-indexer v0.6.0-alpha
|
||||||
github.com/vulcanize/pg-ipfs-ethdb v0.0.1-alpha
|
github.com/vulcanize/pg-ipfs-ethdb v0.0.1-alpha
|
||||||
github.com/ziutek/mymysql v1.5.4 // indirect
|
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
|
|
||||||
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13 // indirect
|
|
||||||
golang.org/x/tools v0.0.0-20201019175715-b894a3290fff // indirect
|
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/ethereum/go-ethereum v1.9.11 => github.com/vulcanize/go-ethereum v1.9.11-statediff-0.0.5
|
replace github.com/ethereum/go-ethereum v1.9.11 => github.com/vulcanize/go-ethereum v1.9.11-statediff-0.0.8
|
||||||
|
93
go.sum
93
go.sum
@ -35,13 +35,11 @@ github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxB
|
|||||||
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
|
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
|
||||||
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
||||||
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 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
|
||||||
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/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=
|
||||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||||
github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
|
github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
|
||||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
|
|
||||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||||
github.com/Stebalien/go-bitfield v0.0.0-20180330043415-076a62f9ce6e/go.mod h1:3oM7gXIttpYDAJXpVNnSCiUMYBLIZ6cb1t+Ip982MRo=
|
github.com/Stebalien/go-bitfield v0.0.0-20180330043415-076a62f9ce6e/go.mod h1:3oM7gXIttpYDAJXpVNnSCiUMYBLIZ6cb1t+Ip982MRo=
|
||||||
github.com/Stebalien/go-bitfield v0.0.1/go.mod h1:GNjFpasyUVkHMsfEOk8EFLJ9syQ6SI+XWrX9Wf2XH0s=
|
github.com/Stebalien/go-bitfield v0.0.1/go.mod h1:GNjFpasyUVkHMsfEOk8EFLJ9syQ6SI+XWrX9Wf2XH0s=
|
||||||
@ -54,7 +52,6 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
|
|||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5/go.mod h1:Y2QMoi1vgtOIfc+6DhrMOGkLoGzqSV2rKp4Sm+opsyA=
|
github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5/go.mod h1:Y2QMoi1vgtOIfc+6DhrMOGkLoGzqSV2rKp4Sm+opsyA=
|
||||||
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
|
|
||||||
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
|
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
|
||||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||||
github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847 h1:rtI0fD4oG/8eVokGVPYJEW1F88p1ZNgXiEIs9thEE4A=
|
github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847 h1:rtI0fD4oG/8eVokGVPYJEW1F88p1ZNgXiEIs9thEE4A=
|
||||||
@ -79,7 +76,6 @@ github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcug
|
|||||||
github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
|
github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
|
||||||
github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
|
github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
|
||||||
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
|
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
|
||||||
github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw=
|
|
||||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||||
github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||||
@ -92,7 +88,6 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE
|
|||||||
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
||||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||||
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||||
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
|
|
||||||
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
|
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
|
||||||
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
|
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
|
||||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||||
@ -113,15 +108,10 @@ github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7
|
|||||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||||
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
||||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||||
github.com/cosiner/argv v0.1.0 h1:BVDiEL32lwHukgJKP87btEPenzrrHUjajs/8yzaqcXg=
|
|
||||||
github.com/cosiner/argv v0.1.0/go.mod h1:EusR6TucWKX+zFgtdUsKT2Cvg45K5rtpCcWz4hK06d8=
|
|
||||||
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
|
|
||||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
|
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE=
|
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
|
||||||
github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis=
|
github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis=
|
||||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -166,23 +156,15 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
|
|||||||
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||||
github.com/go-bindata/go-bindata/v3 v3.1.3/go.mod h1:1/zrpXsLD8YDIbhZRqXzm1Ghc7NhEvIN9+Z6R5/xH4I=
|
github.com/go-bindata/go-bindata/v3 v3.1.3/go.mod h1:1/zrpXsLD8YDIbhZRqXzm1Ghc7NhEvIN9+Z6R5/xH4I=
|
||||||
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
|
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
|
||||||
github.com/go-delve/delve v1.5.0 h1:gQsRvFdR0BGk19NROQZsAv6iG4w5QIZoJlxJeEUBb0c=
|
|
||||||
github.com/go-delve/delve v1.5.0/go.mod h1:c6b3a1Gry6x8a4LGCe/CWzrocrfaHvkUxCj3k4bvSUQ=
|
|
||||||
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk=
|
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
|
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E=
|
|
||||||
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
|
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
|
||||||
github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
|
github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
|
||||||
github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk=
|
|
||||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
|
||||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
@ -219,10 +201,7 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
|
|||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-dap v0.2.0 h1:whjIGQRumwbR40qRU7CEKuFLmePUUc2s4Nt9DoXXxWk=
|
|
||||||
github.com/google/go-dap v0.2.0/go.mod h1:5q8aYQFnHOAZEMP+6vmq25HKYAEwE+LF5yh7JKrrhSQ=
|
|
||||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
@ -238,7 +217,6 @@ github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE0
|
|||||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4=
|
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
@ -286,7 +264,6 @@ github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324/go.mod h1:MZ2ZmwcBpvOo
|
|||||||
github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo=
|
github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo=
|
||||||
github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc=
|
github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc=
|
||||||
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
|
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
|
||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
|
github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
|
||||||
github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI=
|
github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI=
|
||||||
@ -451,7 +428,6 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
|
|||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||||
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
|
||||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
@ -463,25 +439,19 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL
|
|||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
|
github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
|
||||||
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
|
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
|
||||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
github.com/lib/pq v1.5.2 h1:yTSXVswvWUOQ3k1sd7vJfDrbSl8lKuscqFJRqjC0ifw=
|
github.com/lib/pq v1.5.2 h1:yTSXVswvWUOQ3k1sd7vJfDrbSl8lKuscqFJRqjC0ifw=
|
||||||
github.com/lib/pq v1.5.2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.5.2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg=
|
|
||||||
github.com/lib/pq v1.8.0/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-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ=
|
github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ=
|
||||||
github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM=
|
github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM=
|
||||||
@ -696,7 +666,6 @@ github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN
|
|||||||
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI=
|
github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI=
|
||||||
github.com/marten-seemann/qtls v0.9.1/go.mod h1:T1MmAdDPyISzxlK6kjRr0pcZFBVd1OZbBb/j3cvzHhk=
|
github.com/marten-seemann/qtls v0.9.1/go.mod h1:T1MmAdDPyISzxlK6kjRr0pcZFBVd1OZbBb/j3cvzHhk=
|
||||||
github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||||
@ -716,10 +685,7 @@ github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
|
|||||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
|
github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
|
||||||
github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||||
github.com/mattn/go-sqlite3 v1.9.0 h1:pDRiWfl+++eC2FEFRy6jXmQlvp4Yh3z1MJKg4UeYM/4=
|
|
||||||
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
github.com/mattn/go-sqlite3 v1.14.4 h1:4rQjbDxdu9fSgI/r3KN72G3c2goxknAqHHgPWWs8UlI=
|
|
||||||
github.com/mattn/go-sqlite3 v1.14.4/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
|
|
||||||
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=
|
||||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||||
@ -803,8 +769,6 @@ github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJE
|
|||||||
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
|
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
|
||||||
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
||||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||||
github.com/nxadm/tail v1.4.5 h1:obHEce3upls1IBn1gTw/o7bCv7OJb6Ib/o7wNO+4eKw=
|
|
||||||
github.com/nxadm/tail v1.4.5/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
|
||||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||||
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||||
github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c h1:1RHs3tNxjXGHeul8z2t6H2N2TlAqpKe5yryJztRx4Jk=
|
github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c h1:1RHs3tNxjXGHeul8z2t6H2N2TlAqpKe5yryJztRx4Jk=
|
||||||
@ -816,8 +780,6 @@ github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+
|
|||||||
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||||
github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ=
|
github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ=
|
||||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||||
github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M=
|
|
||||||
github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
|
||||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
@ -834,20 +796,15 @@ github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222 h1:goeTyGkArOZIVOMA0d
|
|||||||
github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
|
github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
|
||||||
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
||||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
|
||||||
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM=
|
|
||||||
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
|
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
|
||||||
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=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
||||||
github.com/polydawn/refmt v0.0.0-20190408063855-01bf1e26dd14/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
github.com/polydawn/refmt v0.0.0-20190408063855-01bf1e26dd14/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.6.0+incompatible h1:3f8zIQ8rfgP9tyI0Hmcs2YNAqUCL1c+diLe3iU8Qd/k=
|
|
||||||
github.com/pressly/goose v2.6.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=
|
||||||
@ -884,9 +841,7 @@ github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9Ac
|
|||||||
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
|
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
|
||||||
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
||||||
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ=
|
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ=
|
||||||
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
|
|
||||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||||
@ -911,7 +866,6 @@ github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b
|
|||||||
github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ=
|
github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ=
|
||||||
github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk=
|
github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk=
|
||||||
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
|
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
|
||||||
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
|
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
|
||||||
@ -920,12 +874,10 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
|
|||||||
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
|
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
|
||||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8=
|
|
||||||
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU=
|
github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
|
||||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY=
|
github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY=
|
||||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||||
@ -941,13 +893,11 @@ github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
|
|||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
|
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
|
||||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
|
||||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||||
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
|
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
|
||||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||||
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
|
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
|
||||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||||
github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
|
||||||
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
||||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||||
@ -966,7 +916,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
|||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||||
@ -986,10 +935,14 @@ github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49u
|
|||||||
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/go-ethereum v1.9.11-statediff-0.0.5 h1:U+BqhjRLR22e9OEm8cgWC3Eq3bh8G6azjNpXeenfCG4=
|
github.com/vulcanize/go-ethereum v1.9.11-statediff-0.0.5 h1:U+BqhjRLR22e9OEm8cgWC3Eq3bh8G6azjNpXeenfCG4=
|
||||||
github.com/vulcanize/go-ethereum v1.9.11-statediff-0.0.5/go.mod h1:7oC0Ni6dosMv5pxMigm6s0hN8g4haJMBnqmmo0D9YfQ=
|
github.com/vulcanize/go-ethereum v1.9.11-statediff-0.0.5/go.mod h1:7oC0Ni6dosMv5pxMigm6s0hN8g4haJMBnqmmo0D9YfQ=
|
||||||
|
github.com/vulcanize/go-ethereum v1.9.11-statediff-0.0.8 h1:7TK52k55uvSl+1SCKYYFelzH1NrpvEcDrpeU9nUDIpI=
|
||||||
|
github.com/vulcanize/go-ethereum v1.9.11-statediff-0.0.8/go.mod h1:7oC0Ni6dosMv5pxMigm6s0hN8g4haJMBnqmmo0D9YfQ=
|
||||||
github.com/vulcanize/ipld-eth-indexer v0.2.0-alpha h1:+XVaC7TsA0K278YWpfqdrNxwgC6hY6fBaN8w2/e1Lts=
|
github.com/vulcanize/ipld-eth-indexer v0.2.0-alpha h1:+XVaC7TsA0K278YWpfqdrNxwgC6hY6fBaN8w2/e1Lts=
|
||||||
github.com/vulcanize/ipld-eth-indexer v0.2.0-alpha/go.mod h1:SuMBscFfcBHYlQuzDDd4by+R0S3gaAFjrOU+uQfAefE=
|
github.com/vulcanize/ipld-eth-indexer v0.2.0-alpha/go.mod h1:SuMBscFfcBHYlQuzDDd4by+R0S3gaAFjrOU+uQfAefE=
|
||||||
github.com/vulcanize/ipld-eth-indexer v0.5.0-alpha h1:oAydMHiDKvEskXx7LoWx+YgP7DR5ZvdzxWVaapZessY=
|
github.com/vulcanize/ipld-eth-indexer v0.4.0-alpha h1:DXZ/hF65uegvh70YZTcPM6InMUxGkWxee6awyLcrhDg=
|
||||||
github.com/vulcanize/ipld-eth-indexer v0.5.0-alpha/go.mod h1:b5omhuUptuY0lVinadh+gmQ8GpBSLeV4FnUasqB/txQ=
|
github.com/vulcanize/ipld-eth-indexer v0.4.0-alpha/go.mod h1:SuMBscFfcBHYlQuzDDd4by+R0S3gaAFjrOU+uQfAefE=
|
||||||
|
github.com/vulcanize/ipld-eth-indexer v0.6.0-alpha h1:CNZfwHokF3tcYKCsWKoyRqmyDh1quw0v/e5Jf2dD7uc=
|
||||||
|
github.com/vulcanize/ipld-eth-indexer v0.6.0-alpha/go.mod h1:6eYAh+NiZyfpexdhLm9ZMCPspvJd0IE5k8+lGoaZtUQ=
|
||||||
github.com/vulcanize/pg-ipfs-ethdb v0.0.1-alpha h1:Y7j0Hw1jgVVOg+eUGUr7OgH+gOBID0DwbsfZV1KoL7I=
|
github.com/vulcanize/pg-ipfs-ethdb v0.0.1-alpha h1:Y7j0Hw1jgVVOg+eUGUr7OgH+gOBID0DwbsfZV1KoL7I=
|
||||||
github.com/vulcanize/pg-ipfs-ethdb v0.0.1-alpha/go.mod h1:OuqE4r2LGWAtDVx3s1yaAzDcwy+LEAqrWaE1L8UfrGY=
|
github.com/vulcanize/pg-ipfs-ethdb v0.0.1-alpha/go.mod h1:OuqE4r2LGWAtDVx3s1yaAzDcwy+LEAqrWaE1L8UfrGY=
|
||||||
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=
|
||||||
@ -1019,9 +972,6 @@ github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+m
|
|||||||
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
|
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
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.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
||||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||||
@ -1029,8 +979,6 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
|||||||
go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA=
|
go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA=
|
||||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
go.starlark.net v0.0.0-20190702223751-32f345186213 h1:lkYv5AKwvvduv5XWP6szk/bvvgO6aDeUujhZQXIFTes=
|
|
||||||
go.starlark.net v0.0.0-20190702223751-32f345186213/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg=
|
|
||||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||||
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
|
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
|
||||||
@ -1043,15 +991,12 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/
|
|||||||
go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
||||||
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
|
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
|
||||||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
||||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
|
|
||||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||||
go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo=
|
go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo=
|
||||||
go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
|
go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
|
||||||
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
||||||
go4.org v0.0.0-20200104003542-c7e774b10ea0/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
go4.org v0.0.0-20200104003542-c7e774b10ea0/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
||||||
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4 h1:QlVATYS7JBoZMVaf+cNjb90WD/beKVHnIxFKT4QaHVI=
|
|
||||||
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
|
|
||||||
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
|
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
|
||||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
@ -1076,8 +1021,6 @@ golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPh
|
|||||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5 h1:Q7tZBpemrlsc2I7IyODzhtallWRSm4Q0d09pL6XbQtU=
|
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5 h1:Q7tZBpemrlsc2I7IyODzhtallWRSm4Q0d09pL6XbQtU=
|
||||||
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
@ -1093,16 +1036,12 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl
|
|||||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE=
|
|
||||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
|
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
@ -1135,8 +1074,6 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/
|
|||||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE=
|
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE=
|
||||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
|
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
@ -1150,7 +1087,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
|
|||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -1193,9 +1129,6 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8=
|
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8=
|
||||||
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13 h1:5jaG59Zhd+8ZXe8C+lgiAGqkOaZBruqrWclLkgAww34=
|
|
||||||
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
@ -1230,20 +1163,12 @@ golang.org/x/tools v0.0.0-20191030062658-86caa796c7ab/go.mod h1:b+2E5dAYhXwXZwtn
|
|||||||
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20191114200427-caa0b0f7d508/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191114200427-caa0b0f7d508/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20191127201027-ecd32218bd7f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425 h1:VvQyQJN0tSuecqgcIxMWnnfG5kSmgy9KZR9sW3W5QeA=
|
|
||||||
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20201019175715-b894a3290fff h1:HiwHyqQ9ttqCHuTa++R4wNxOg6MY1hduSDT8j2aXoMM=
|
|
||||||
golang.org/x/tools v0.0.0-20201019175715-b894a3290fff/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y=
|
google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y=
|
||||||
@ -1257,9 +1182,7 @@ google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
|
|||||||
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I=
|
|
||||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
@ -1290,7 +1213,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
|
|||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||||
@ -1298,7 +1220,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy
|
|||||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||||
gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno=
|
gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno=
|
||||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
|
|
||||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
|
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
|
||||||
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns=
|
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns=
|
||||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||||
@ -1322,10 +1243,8 @@ honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWh
|
|||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
|
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
|
||||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||||
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
|
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
|
||||||
|
162
pkg/eth/api.go
162
pkg/eth/api.go
@ -18,16 +18,23 @@ package eth
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"time"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum"
|
"github.com/ethereum/go-ethereum"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// APIName is the namespace for the watcher's eth api
|
// APIName is the namespace for the watcher's eth api
|
||||||
@ -195,3 +202,152 @@ func (pea *PublicEthAPI) GetTransactionByHash(ctx context.Context, hash common.H
|
|||||||
// Transaction unknown, return as such
|
// Transaction unknown, return as such
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call executes the given transaction on the state for the given block number.
|
||||||
|
//
|
||||||
|
// Additionally, the caller can specify a batch of contract for fields overriding.
|
||||||
|
//
|
||||||
|
// Note, this function doesn't make and changes in the state/blockchain and is
|
||||||
|
// useful to execute and retrieve values.
|
||||||
|
func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *map[common.Address]account) (hexutil.Bytes, error) {
|
||||||
|
var accounts map[common.Address]account
|
||||||
|
if overrides != nil {
|
||||||
|
accounts = *overrides
|
||||||
|
}
|
||||||
|
result, _, failed, err := DoCall(ctx, pea.B, args, blockNrOrHash, accounts, 5*time.Second, pea.B.Config.RPCGasCap)
|
||||||
|
if failed && err == nil {
|
||||||
|
return nil, errors.New("eth_call failed without error")
|
||||||
|
}
|
||||||
|
return (hexutil.Bytes)(result), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// CallArgs represents the arguments for a call.
|
||||||
|
type CallArgs struct {
|
||||||
|
From *common.Address `json:"from"`
|
||||||
|
To *common.Address `json:"to"`
|
||||||
|
Gas *hexutil.Uint64 `json:"gas"`
|
||||||
|
GasPrice *hexutil.Big `json:"gasPrice"`
|
||||||
|
Value *hexutil.Big `json:"value"`
|
||||||
|
Data *hexutil.Bytes `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// account indicates the overriding fields of account during the execution of
|
||||||
|
// a message call.
|
||||||
|
// Note, state and stateDiff can't be specified at the same time. If state is
|
||||||
|
// set, message execution will only use the data in the given state. Otherwise
|
||||||
|
// if statDiff is set, all diff will be applied first and then execute the call
|
||||||
|
// message.
|
||||||
|
type account struct {
|
||||||
|
Nonce *hexutil.Uint64 `json:"nonce"`
|
||||||
|
Code *hexutil.Bytes `json:"code"`
|
||||||
|
Balance **hexutil.Big `json:"balance"`
|
||||||
|
State *map[common.Hash]common.Hash `json:"state"`
|
||||||
|
StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func DoCall(ctx context.Context, b *Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides map[common.Address]account, timeout time.Duration, globalGasCap *big.Int) ([]byte, uint64, bool, error) {
|
||||||
|
defer func(start time.Time) {
|
||||||
|
logrus.Debugf("Executing EVM call finished %s runtime %s", time.Now().String(), time.Since(start).String())
|
||||||
|
}(time.Now())
|
||||||
|
state, header, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
|
||||||
|
if state == nil || err != nil {
|
||||||
|
return nil, 0, false, err
|
||||||
|
}
|
||||||
|
// Set sender address or use a default if none specified
|
||||||
|
var addr common.Address
|
||||||
|
if args.From == nil {
|
||||||
|
if b.Config.DefaultSender != nil {
|
||||||
|
addr = *b.Config.DefaultSender
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addr = *args.From
|
||||||
|
}
|
||||||
|
// Override the fields of specified contracts before execution.
|
||||||
|
for addr, account := range overrides {
|
||||||
|
// Override account nonce.
|
||||||
|
if account.Nonce != nil {
|
||||||
|
state.SetNonce(addr, uint64(*account.Nonce))
|
||||||
|
}
|
||||||
|
// Override account(contract) code.
|
||||||
|
if account.Code != nil {
|
||||||
|
state.SetCode(addr, *account.Code)
|
||||||
|
}
|
||||||
|
// Override account balance.
|
||||||
|
if account.Balance != nil {
|
||||||
|
state.SetBalance(addr, (*big.Int)(*account.Balance))
|
||||||
|
}
|
||||||
|
if account.State != nil && account.StateDiff != nil {
|
||||||
|
return nil, 0, false, fmt.Errorf("account %s has both 'state' and 'stateDiff'", addr.Hex())
|
||||||
|
}
|
||||||
|
// Replace entire state if caller requires.
|
||||||
|
if account.State != nil {
|
||||||
|
state.SetStorage(addr, *account.State)
|
||||||
|
}
|
||||||
|
// Apply state diff into specified accounts.
|
||||||
|
if account.StateDiff != nil {
|
||||||
|
for key, value := range *account.StateDiff {
|
||||||
|
state.SetState(addr, key, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Set default gas & gas price if none were set
|
||||||
|
gas := uint64(math.MaxUint64 / 2)
|
||||||
|
if args.Gas != nil {
|
||||||
|
gas = uint64(*args.Gas)
|
||||||
|
}
|
||||||
|
if globalGasCap != nil && globalGasCap.Uint64() < gas {
|
||||||
|
logrus.Warnf("Caller gas above allowance, capping; requested: %d, cap: %d", gas, globalGasCap)
|
||||||
|
gas = globalGasCap.Uint64()
|
||||||
|
}
|
||||||
|
gasPrice := new(big.Int).SetUint64(params.GWei)
|
||||||
|
if args.GasPrice != nil {
|
||||||
|
gasPrice = args.GasPrice.ToInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
value := new(big.Int)
|
||||||
|
if args.Value != nil {
|
||||||
|
value = args.Value.ToInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
var data []byte
|
||||||
|
if args.Data != nil {
|
||||||
|
data = []byte(*args.Data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new call message
|
||||||
|
msg := types.NewMessage(addr, args.To, 0, value, gas, gasPrice, data, false)
|
||||||
|
|
||||||
|
// Setup context so it may be cancelled the call has completed
|
||||||
|
// or, in case of unmetered gas, setup a context with a timeout.
|
||||||
|
var cancel context.CancelFunc
|
||||||
|
if timeout > 0 {
|
||||||
|
ctx, cancel = context.WithTimeout(ctx, timeout)
|
||||||
|
} else {
|
||||||
|
ctx, cancel = context.WithCancel(ctx)
|
||||||
|
}
|
||||||
|
// Make sure the context is cancelled when the call has completed
|
||||||
|
// this makes sure resources are cleaned up.
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
// Get a new instance of the EVM.
|
||||||
|
evm, err := b.GetEVM(ctx, msg, state, header)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, false, err
|
||||||
|
}
|
||||||
|
// Wait for the context to be done and cancel the evm. Even if the
|
||||||
|
// EVM has finished, cancelling may be done (repeatedly)
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
evm.Cancel()
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Setup the gas pool (also for unmetered requests)
|
||||||
|
// and apply the message.
|
||||||
|
gp := new(core.GasPool).AddGas(math.MaxUint64)
|
||||||
|
res, gas, failed, err := core.ApplyMessage(evm, msg, gp)
|
||||||
|
// If the timer caused an abort, return an appropriate error message
|
||||||
|
if evm.Cancelled() {
|
||||||
|
return nil, 0, false, fmt.Errorf("execution aborted (timeout = %v)", timeout)
|
||||||
|
}
|
||||||
|
return res, gas, failed, err
|
||||||
|
}
|
||||||
|
@ -25,67 +25,64 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/eth/mocks"
|
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
expectedBlock = map[string]interface{}{
|
expectedBlock = map[string]interface{}{
|
||||||
"number": (*hexutil.Big)(mocks.MockBlock.Number()),
|
"number": (*hexutil.Big)(test_helpers.MockBlock.Number()),
|
||||||
"hash": mocks.MockBlock.Hash(),
|
"hash": test_helpers.MockBlock.Hash(),
|
||||||
"parentHash": mocks.MockBlock.ParentHash(),
|
"parentHash": test_helpers.MockBlock.ParentHash(),
|
||||||
"nonce": mocks.MockBlock.Header().Nonce,
|
"nonce": test_helpers.MockBlock.Header().Nonce,
|
||||||
"mixHash": mocks.MockBlock.MixDigest(),
|
"mixHash": test_helpers.MockBlock.MixDigest(),
|
||||||
"sha3Uncles": mocks.MockBlock.UncleHash(),
|
"sha3Uncles": test_helpers.MockBlock.UncleHash(),
|
||||||
"logsBloom": mocks.MockBlock.Bloom(),
|
"logsBloom": test_helpers.MockBlock.Bloom(),
|
||||||
"stateRoot": mocks.MockBlock.Root(),
|
"stateRoot": test_helpers.MockBlock.Root(),
|
||||||
"miner": mocks.MockBlock.Coinbase(),
|
"miner": test_helpers.MockBlock.Coinbase(),
|
||||||
"difficulty": (*hexutil.Big)(mocks.MockBlock.Difficulty()),
|
"difficulty": (*hexutil.Big)(test_helpers.MockBlock.Difficulty()),
|
||||||
"extraData": hexutil.Bytes(mocks.MockBlock.Header().Extra),
|
"extraData": hexutil.Bytes(test_helpers.MockBlock.Header().Extra),
|
||||||
"gasLimit": hexutil.Uint64(mocks.MockBlock.GasLimit()),
|
"gasLimit": hexutil.Uint64(test_helpers.MockBlock.GasLimit()),
|
||||||
"gasUsed": hexutil.Uint64(mocks.MockBlock.GasUsed()),
|
"gasUsed": hexutil.Uint64(test_helpers.MockBlock.GasUsed()),
|
||||||
"timestamp": hexutil.Uint64(mocks.MockBlock.Time()),
|
"timestamp": hexutil.Uint64(test_helpers.MockBlock.Time()),
|
||||||
"transactionsRoot": mocks.MockBlock.TxHash(),
|
"transactionsRoot": test_helpers.MockBlock.TxHash(),
|
||||||
"receiptsRoot": mocks.MockBlock.ReceiptHash(),
|
"receiptsRoot": test_helpers.MockBlock.ReceiptHash(),
|
||||||
"totalDifficulty": (*hexutil.Big)(mocks.MockBlock.Difficulty()),
|
"totalDifficulty": (*hexutil.Big)(test_helpers.MockBlock.Difficulty()),
|
||||||
"size": hexutil.Uint64(mocks.MockBlock.Size()),
|
"size": hexutil.Uint64(test_helpers.MockBlock.Size()),
|
||||||
}
|
}
|
||||||
expectedHeader = map[string]interface{}{
|
expectedHeader = map[string]interface{}{
|
||||||
"number": (*hexutil.Big)(mocks.MockBlock.Header().Number),
|
"number": (*hexutil.Big)(test_helpers.MockBlock.Header().Number),
|
||||||
"hash": mocks.MockBlock.Header().Hash(),
|
"hash": test_helpers.MockBlock.Header().Hash(),
|
||||||
"parentHash": mocks.MockBlock.Header().ParentHash,
|
"parentHash": test_helpers.MockBlock.Header().ParentHash,
|
||||||
"nonce": mocks.MockBlock.Header().Nonce,
|
"nonce": test_helpers.MockBlock.Header().Nonce,
|
||||||
"mixHash": mocks.MockBlock.Header().MixDigest,
|
"mixHash": test_helpers.MockBlock.Header().MixDigest,
|
||||||
"sha3Uncles": mocks.MockBlock.Header().UncleHash,
|
"sha3Uncles": test_helpers.MockBlock.Header().UncleHash,
|
||||||
"logsBloom": mocks.MockBlock.Header().Bloom,
|
"logsBloom": test_helpers.MockBlock.Header().Bloom,
|
||||||
"stateRoot": mocks.MockBlock.Header().Root,
|
"stateRoot": test_helpers.MockBlock.Header().Root,
|
||||||
"miner": mocks.MockBlock.Header().Coinbase,
|
"miner": test_helpers.MockBlock.Header().Coinbase,
|
||||||
"difficulty": (*hexutil.Big)(mocks.MockBlock.Header().Difficulty),
|
"difficulty": (*hexutil.Big)(test_helpers.MockBlock.Header().Difficulty),
|
||||||
"extraData": hexutil.Bytes(mocks.MockBlock.Header().Extra),
|
"extraData": hexutil.Bytes(test_helpers.MockBlock.Header().Extra),
|
||||||
"size": hexutil.Uint64(mocks.MockBlock.Header().Size()),
|
"size": hexutil.Uint64(test_helpers.MockBlock.Header().Size()),
|
||||||
"gasLimit": hexutil.Uint64(mocks.MockBlock.Header().GasLimit),
|
"gasLimit": hexutil.Uint64(test_helpers.MockBlock.Header().GasLimit),
|
||||||
"gasUsed": hexutil.Uint64(mocks.MockBlock.Header().GasUsed),
|
"gasUsed": hexutil.Uint64(test_helpers.MockBlock.Header().GasUsed),
|
||||||
"timestamp": hexutil.Uint64(mocks.MockBlock.Header().Time),
|
"timestamp": hexutil.Uint64(test_helpers.MockBlock.Header().Time),
|
||||||
"transactionsRoot": mocks.MockBlock.Header().TxHash,
|
"transactionsRoot": test_helpers.MockBlock.Header().TxHash,
|
||||||
"receiptsRoot": mocks.MockBlock.Header().ReceiptHash,
|
"receiptsRoot": test_helpers.MockBlock.Header().ReceiptHash,
|
||||||
"totalDifficulty": (*hexutil.Big)(mocks.MockBlock.Header().Difficulty),
|
"totalDifficulty": (*hexutil.Big)(test_helpers.MockBlock.Header().Difficulty),
|
||||||
}
|
}
|
||||||
expectedTransaction = eth.NewRPCTransaction(mocks.MockTransactions[0], mocks.MockBlock.Hash(), mocks.MockBlock.NumberU64(), 0)
|
expectedTransaction = eth.NewRPCTransaction(test_helpers.MockTransactions[0], test_helpers.MockBlock.Hash(), test_helpers.MockBlock.NumberU64(), 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("API", func() {
|
var _ = Describe("API", func() {
|
||||||
var (
|
var (
|
||||||
db *postgres.DB
|
db *postgres.DB
|
||||||
retriever *eth.CIDRetriever
|
|
||||||
fetcher *eth.IPLDFetcher
|
|
||||||
indexAndPublisher *eth2.IPLDPublisher
|
indexAndPublisher *eth2.IPLDPublisher
|
||||||
backend *eth.Backend
|
backend *eth.Backend
|
||||||
api *eth.PublicEthAPI
|
api *eth.PublicEthAPI
|
||||||
@ -94,18 +91,13 @@ var _ = Describe("API", func() {
|
|||||||
var err error
|
var err error
|
||||||
db, err = shared.SetupDB()
|
db, err = shared.SetupDB()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
retriever = eth.NewCIDRetriever(db)
|
|
||||||
fetcher = eth.NewIPLDFetcher(db)
|
|
||||||
indexAndPublisher = eth2.NewIPLDPublisher(db)
|
indexAndPublisher = eth2.NewIPLDPublisher(db)
|
||||||
backend = ð.Backend{
|
backend, err = eth.NewEthBackend(db, ð.Config{})
|
||||||
Retriever: retriever,
|
|
||||||
Fetcher: fetcher,
|
|
||||||
DB: db,
|
|
||||||
}
|
|
||||||
api = eth.NewPublicEthAPI(backend)
|
|
||||||
err = indexAndPublisher.Publish(mocks.MockConvertedPayload)
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
uncles := mocks.MockBlock.Uncles()
|
api = eth.NewPublicEthAPI(backend)
|
||||||
|
err = indexAndPublisher.Publish(test_helpers.MockConvertedPayload)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
uncles := test_helpers.MockBlock.Uncles()
|
||||||
uncleHashes := make([]common.Hash, len(uncles))
|
uncleHashes := make([]common.Hash, len(uncles))
|
||||||
for i, uncle := range uncles {
|
for i, uncle := range uncles {
|
||||||
uncleHashes[i] = uncle.Hash()
|
uncleHashes[i] = uncle.Hash()
|
||||||
@ -120,13 +112,13 @@ var _ = Describe("API", func() {
|
|||||||
bn := api.BlockNumber()
|
bn := api.BlockNumber()
|
||||||
ubn := (uint64)(bn)
|
ubn := (uint64)(bn)
|
||||||
subn := strconv.FormatUint(ubn, 10)
|
subn := strconv.FormatUint(ubn, 10)
|
||||||
Expect(subn).To(Equal(mocks.MockCIDPayload.HeaderCID.BlockNumber))
|
Expect(subn).To(Equal(test_helpers.BlockNumber.String()))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Describe("GetTransactionByHash", func() {
|
Describe("GetTransactionByHash", func() {
|
||||||
It("Retrieves a transaction by hash", func() {
|
It("Retrieves a transaction by hash", func() {
|
||||||
hash := mocks.MockTransactions[0].Hash()
|
hash := test_helpers.MockTransactions[0].Hash()
|
||||||
tx, err := api.GetTransactionByHash(context.Background(), hash)
|
tx, err := api.GetTransactionByHash(context.Background(), hash)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(tx).To(Equal(expectedTransaction))
|
Expect(tx).To(Equal(expectedTransaction))
|
||||||
@ -136,12 +128,12 @@ var _ = Describe("API", func() {
|
|||||||
Describe("GetBlockByNumber", func() {
|
Describe("GetBlockByNumber", func() {
|
||||||
It("Retrieves a block by number", func() {
|
It("Retrieves a block by number", func() {
|
||||||
// without full txs
|
// without full txs
|
||||||
number, err := strconv.ParseInt(mocks.MockCIDPayload.HeaderCID.BlockNumber, 10, 64)
|
number, err := strconv.ParseInt(test_helpers.BlockNumber.String(), 10, 64)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
block, err := api.GetBlockByNumber(context.Background(), rpc.BlockNumber(number), false)
|
block, err := api.GetBlockByNumber(context.Background(), rpc.BlockNumber(number), false)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
transactionHashes := make([]interface{}, len(mocks.MockBlock.Transactions()))
|
transactionHashes := make([]interface{}, len(test_helpers.MockBlock.Transactions()))
|
||||||
for i, trx := range mocks.MockBlock.Transactions() {
|
for i, trx := range test_helpers.MockBlock.Transactions() {
|
||||||
transactionHashes[i] = trx.Hash()
|
transactionHashes[i] = trx.Hash()
|
||||||
}
|
}
|
||||||
expectedBlock["transactions"] = transactionHashes
|
expectedBlock["transactions"] = transactionHashes
|
||||||
@ -151,9 +143,9 @@ var _ = Describe("API", func() {
|
|||||||
// with full txs
|
// with full txs
|
||||||
block, err = api.GetBlockByNumber(context.Background(), rpc.BlockNumber(number), true)
|
block, err = api.GetBlockByNumber(context.Background(), rpc.BlockNumber(number), true)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
transactions := make([]interface{}, len(mocks.MockBlock.Transactions()))
|
transactions := make([]interface{}, len(test_helpers.MockBlock.Transactions()))
|
||||||
for i, trx := range mocks.MockBlock.Transactions() {
|
for i, trx := range test_helpers.MockBlock.Transactions() {
|
||||||
transactions[i] = eth.NewRPCTransactionFromBlockHash(mocks.MockBlock, trx.Hash())
|
transactions[i] = eth.NewRPCTransactionFromBlockHash(test_helpers.MockBlock, trx.Hash())
|
||||||
}
|
}
|
||||||
expectedBlock["transactions"] = transactions
|
expectedBlock["transactions"] = transactions
|
||||||
for key, val := range expectedBlock {
|
for key, val := range expectedBlock {
|
||||||
@ -164,7 +156,7 @@ var _ = Describe("API", func() {
|
|||||||
|
|
||||||
Describe("GetHeaderByNumber", func() {
|
Describe("GetHeaderByNumber", func() {
|
||||||
It("Retrieves a header by number", func() {
|
It("Retrieves a header by number", func() {
|
||||||
number, err := strconv.ParseInt(mocks.MockCIDPayload.HeaderCID.BlockNumber, 10, 64)
|
number, err := strconv.ParseInt(test_helpers.BlockNumber.String(), 10, 64)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
header, err := api.GetHeaderByNumber(context.Background(), rpc.BlockNumber(number))
|
header, err := api.GetHeaderByNumber(context.Background(), rpc.BlockNumber(number))
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -172,11 +164,11 @@ var _ = Describe("API", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Throws an error if a header cannot be found", func() {
|
It("Throws an error if a header cannot be found", func() {
|
||||||
number, err := strconv.ParseInt(mocks.MockCIDPayload.HeaderCID.BlockNumber, 10, 64)
|
number, err := strconv.ParseInt(test_helpers.BlockNumber.String(), 10, 64)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
header, err := api.GetHeaderByNumber(context.Background(), rpc.BlockNumber(number+1))
|
header, err := api.GetHeaderByNumber(context.Background(), rpc.BlockNumber(number+1))
|
||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
Expect(err.Error()).To(ContainSubstring("header at block %d is not available", number+1))
|
Expect(err.Error()).To(ContainSubstring("sql: no rows in result set"))
|
||||||
Expect(header).To(BeNil())
|
Expect(header).To(BeNil())
|
||||||
_, err = api.B.DB.Beginx()
|
_, err = api.B.DB.Beginx()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -186,10 +178,10 @@ var _ = Describe("API", func() {
|
|||||||
Describe("GetBlockByHash", func() {
|
Describe("GetBlockByHash", func() {
|
||||||
It("Retrieves a block by hash", func() {
|
It("Retrieves a block by hash", func() {
|
||||||
// without full txs
|
// without full txs
|
||||||
block, err := api.GetBlockByHash(context.Background(), mocks.MockBlock.Hash(), false)
|
block, err := api.GetBlockByHash(context.Background(), test_helpers.MockBlock.Hash(), false)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
transactionHashes := make([]interface{}, len(mocks.MockBlock.Transactions()))
|
transactionHashes := make([]interface{}, len(test_helpers.MockBlock.Transactions()))
|
||||||
for i, trx := range mocks.MockBlock.Transactions() {
|
for i, trx := range test_helpers.MockBlock.Transactions() {
|
||||||
transactionHashes[i] = trx.Hash()
|
transactionHashes[i] = trx.Hash()
|
||||||
}
|
}
|
||||||
expectedBlock["transactions"] = transactionHashes
|
expectedBlock["transactions"] = transactionHashes
|
||||||
@ -197,11 +189,11 @@ var _ = Describe("API", func() {
|
|||||||
Expect(val).To(Equal(block[key]))
|
Expect(val).To(Equal(block[key]))
|
||||||
}
|
}
|
||||||
// with full txs
|
// with full txs
|
||||||
block, err = api.GetBlockByHash(context.Background(), mocks.MockBlock.Hash(), true)
|
block, err = api.GetBlockByHash(context.Background(), test_helpers.MockBlock.Hash(), true)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
transactions := make([]interface{}, len(mocks.MockBlock.Transactions()))
|
transactions := make([]interface{}, len(test_helpers.MockBlock.Transactions()))
|
||||||
for i, trx := range mocks.MockBlock.Transactions() {
|
for i, trx := range test_helpers.MockBlock.Transactions() {
|
||||||
transactions[i] = eth.NewRPCTransactionFromBlockHash(mocks.MockBlock, trx.Hash())
|
transactions[i] = eth.NewRPCTransactionFromBlockHash(test_helpers.MockBlock, trx.Hash())
|
||||||
}
|
}
|
||||||
expectedBlock["transactions"] = transactions
|
expectedBlock["transactions"] = transactions
|
||||||
for key, val := range expectedBlock {
|
for key, val := range expectedBlock {
|
||||||
@ -211,20 +203,20 @@ var _ = Describe("API", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Describe("GetLogs", func() {
|
Describe("GetLogs", func() {
|
||||||
It("Retrieves receipt logs that match the provided topcis within the provided range", func() {
|
It("Retrieves receipt logs that match the provided topics within the provided range", func() {
|
||||||
crit := ethereum.FilterQuery{
|
crit := ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
{
|
{
|
||||||
common.HexToHash("0x04"),
|
common.HexToHash("0x04"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err := api.GetLogs(context.Background(), crit)
|
logs, err := api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -233,13 +225,13 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x05"),
|
common.HexToHash("0x05"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(2))
|
Expect(len(logs)).To(Equal(2))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1, mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1, test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -248,13 +240,13 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x06"),
|
common.HexToHash("0x06"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -265,8 +257,8 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x07"),
|
common.HexToHash("0x07"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -281,13 +273,13 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x06"),
|
common.HexToHash("0x06"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -298,13 +290,13 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x07"),
|
common.HexToHash("0x07"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -316,13 +308,13 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x07"),
|
common.HexToHash("0x07"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -335,13 +327,13 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x07"),
|
common.HexToHash("0x07"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(2))
|
Expect(len(logs)).To(Equal(2))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1, mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1, test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -350,13 +342,13 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x07"),
|
common.HexToHash("0x07"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -365,27 +357,27 @@ var _ = Describe("API", func() {
|
|||||||
common.HexToHash("0x06"),
|
common.HexToHash("0x06"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
Topics: [][]common.Hash{},
|
Topics: [][]common.Hash{},
|
||||||
FromBlock: mocks.MockBlock.Number(),
|
FromBlock: test_helpers.MockBlock.Number(),
|
||||||
ToBlock: mocks.MockBlock.Number(),
|
ToBlock: test_helpers.MockBlock.Number(),
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(2))
|
Expect(len(logs)).To(Equal(2))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1, mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1, test_helpers.MockLog2}))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Uses the provided blockhash if one is provided", func() {
|
It("Uses the provided blockhash if one is provided", func() {
|
||||||
hash := mocks.MockBlock.Hash()
|
hash := test_helpers.MockBlock.Hash()
|
||||||
crit := ethereum.FilterQuery{
|
crit := ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
@ -398,7 +390,7 @@ var _ = Describe("API", func() {
|
|||||||
logs, err := api.GetLogs(context.Background(), crit)
|
logs, err := api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
@ -414,7 +406,7 @@ var _ = Describe("API", func() {
|
|||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
@ -428,7 +420,7 @@ var _ = Describe("API", func() {
|
|||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
@ -444,7 +436,7 @@ var _ = Describe("API", func() {
|
|||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
@ -476,7 +468,7 @@ var _ = Describe("API", func() {
|
|||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
@ -490,7 +482,7 @@ var _ = Describe("API", func() {
|
|||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(2))
|
Expect(len(logs)).To(Equal(2))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1, mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1, test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
@ -508,7 +500,7 @@ var _ = Describe("API", func() {
|
|||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(2))
|
Expect(len(logs)).To(Equal(2))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1, mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1, test_helpers.MockLog2}))
|
||||||
|
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
@ -517,15 +509,15 @@ var _ = Describe("API", func() {
|
|||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(2))
|
Expect(len(logs)).To(Equal(2))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1, mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1, test_helpers.MockLog2}))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Filters on contract address if any are provided", func() {
|
It("Filters on contract address if any are provided", func() {
|
||||||
hash := mocks.MockBlock.Hash()
|
hash := test_helpers.MockBlock.Hash()
|
||||||
crit := ethereum.FilterQuery{
|
crit := ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
Addresses: []common.Address{
|
Addresses: []common.Address{
|
||||||
mocks.Address,
|
test_helpers.Address,
|
||||||
},
|
},
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
{
|
{
|
||||||
@ -541,14 +533,14 @@ var _ = Describe("API", func() {
|
|||||||
logs, err := api.GetLogs(context.Background(), crit)
|
logs, err := api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(1))
|
Expect(len(logs)).To(Equal(1))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1}))
|
||||||
|
|
||||||
hash = mocks.MockBlock.Hash()
|
hash = test_helpers.MockBlock.Hash()
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
Addresses: []common.Address{
|
Addresses: []common.Address{
|
||||||
mocks.Address,
|
test_helpers.Address,
|
||||||
mocks.AnotherAddress,
|
test_helpers.AnotherAddress,
|
||||||
},
|
},
|
||||||
Topics: [][]common.Hash{
|
Topics: [][]common.Hash{
|
||||||
{
|
{
|
||||||
@ -564,20 +556,20 @@ var _ = Describe("API", func() {
|
|||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(2))
|
Expect(len(logs)).To(Equal(2))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1, mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1, test_helpers.MockLog2}))
|
||||||
|
|
||||||
hash = mocks.MockBlock.Hash()
|
hash = test_helpers.MockBlock.Hash()
|
||||||
crit = ethereum.FilterQuery{
|
crit = ethereum.FilterQuery{
|
||||||
BlockHash: &hash,
|
BlockHash: &hash,
|
||||||
Addresses: []common.Address{
|
Addresses: []common.Address{
|
||||||
mocks.Address,
|
test_helpers.Address,
|
||||||
mocks.AnotherAddress,
|
test_helpers.AnotherAddress,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
logs, err = api.GetLogs(context.Background(), crit)
|
logs, err = api.GetLogs(context.Background(), crit)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(logs)).To(Equal(2))
|
Expect(len(logs)).To(Equal(2))
|
||||||
Expect(logs).To(Equal([]*types.Log{mocks.MockLog1, mocks.MockLog2}))
|
Expect(logs).To(Equal([]*types.Log{test_helpers.MockLog1, test_helpers.MockLog2}))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -19,13 +19,19 @@ package eth
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
"github.com/ethereum/go-ethereum/common/math"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
ipfsethdb "github.com/vulcanize/pg-ipfs-ethdb"
|
ipfsethdb "github.com/vulcanize/pg-ipfs-ethdb"
|
||||||
@ -37,25 +43,56 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
errPendingBlockNumber = errors.New("pending block number not supported")
|
errPendingBlockNumber = errors.New("pending block number not supported")
|
||||||
|
errNegativeBlockNumber = errors.New("negative block number not supported")
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
RetrieveCanonicalBlockHashByNumber = `SELECT block_hash FROM eth.header_cids
|
||||||
|
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
||||||
|
WHERE id = (SELECT canonical_header($1))`
|
||||||
|
RetrieveCanonicalHeaderByNumber = `SELECT cid, data FROM eth.header_cids
|
||||||
|
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
||||||
|
WHERE id = (SELECT canonical_header($1))`
|
||||||
)
|
)
|
||||||
|
|
||||||
type Backend struct {
|
type Backend struct {
|
||||||
|
// underlying postgres db
|
||||||
|
DB *postgres.DB
|
||||||
|
|
||||||
|
// postgres db interfaces
|
||||||
Retriever *CIDRetriever
|
Retriever *CIDRetriever
|
||||||
Fetcher *IPLDFetcher
|
Fetcher *IPLDFetcher
|
||||||
DB *postgres.DB
|
IPLDRetriever *IPLDRetriever
|
||||||
|
|
||||||
|
// ethereum interfaces
|
||||||
EthDB ethdb.Database
|
EthDB ethdb.Database
|
||||||
|
StateDatabase state.Database
|
||||||
|
|
||||||
|
Config *Config
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEthBackend(db *postgres.DB) (*Backend, error) {
|
type Config struct {
|
||||||
|
ChainConfig *params.ChainConfig
|
||||||
|
VmConfig vm.Config
|
||||||
|
DefaultSender *common.Address
|
||||||
|
RPCGasCap *big.Int
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewEthBackend(db *postgres.DB, c *Config) (*Backend, error) {
|
||||||
r := NewCIDRetriever(db)
|
r := NewCIDRetriever(db)
|
||||||
|
ethDB := ipfsethdb.NewDatabase(db.DB)
|
||||||
return &Backend{
|
return &Backend{
|
||||||
|
DB: db,
|
||||||
Retriever: r,
|
Retriever: r,
|
||||||
Fetcher: NewIPLDFetcher(db),
|
Fetcher: NewIPLDFetcher(db),
|
||||||
DB: db,
|
IPLDRetriever: NewIPLDRetriever(db),
|
||||||
EthDB: ipfsethdb.NewDatabase(db.DB),
|
EthDB: ethDB,
|
||||||
|
StateDatabase: state.NewDatabase(ethDB),
|
||||||
|
Config: c,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HeaderByNumber gets the canonical header for the provided block number
|
||||||
func (b *Backend) HeaderByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Header, error) {
|
func (b *Backend) HeaderByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Header, error) {
|
||||||
var err error
|
var err error
|
||||||
number := blockNumber.Int64()
|
number := blockNumber.Int64()
|
||||||
@ -65,23 +102,38 @@ func (b *Backend) HeaderByNumber(ctx context.Context, blockNumber rpc.BlockNumbe
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if blockNumber == rpc.EarliestBlockNumber {
|
||||||
|
number, err = b.Retriever.RetrieveFirstBlockNumber()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
if blockNumber == rpc.PendingBlockNumber {
|
if blockNumber == rpc.PendingBlockNumber {
|
||||||
return nil, errPendingBlockNumber
|
return nil, errPendingBlockNumber
|
||||||
}
|
}
|
||||||
|
if number < 0 {
|
||||||
var headerBytes []byte
|
return nil, errNegativeBlockNumber
|
||||||
pgStr := `SELECT DISTINCT ON (block_number) data
|
|
||||||
FROM public.blocks INNER JOIN eth.header_cids ON (header_cids.mh_key = blocks.key)
|
|
||||||
WHERE block_number = $1
|
|
||||||
ORDER BY block_number, times_validated DESC`
|
|
||||||
if err := b.DB.Get(&headerBytes, pgStr, number); err != nil {
|
|
||||||
return nil, fmt.Errorf("header at block %d is not available; err %s", number, err.Error())
|
|
||||||
}
|
}
|
||||||
|
_, canonicalHeaderRLP, err := b.GetCanonicalHeader(uint64(number))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
header := new(types.Header)
|
header := new(types.Header)
|
||||||
return header, rlp.DecodeBytes(headerBytes, header)
|
return header, rlp.DecodeBytes(canonicalHeaderRLP, header)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTd retrieves and returns the total difficulty at the given block hash
|
// HeaderByHash gets the header for the provided block hash
|
||||||
|
func (b *Backend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) {
|
||||||
|
_, headerRLP, err := b.IPLDRetriever.RetrieveHeaderByHash(hash)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
header := new(types.Header)
|
||||||
|
return header, rlp.DecodeBytes(headerRLP, header)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTd gets the total difficulty at the given block hash
|
||||||
func (b *Backend) GetTd(blockHash common.Hash) (*big.Int, error) {
|
func (b *Backend) GetTd(blockHash common.Hash) (*big.Int, error) {
|
||||||
pgStr := `SELECT td FROM eth.header_cids
|
pgStr := `SELECT td FROM eth.header_cids
|
||||||
WHERE header_cids.block_hash = $1`
|
WHERE header_cids.block_hash = $1`
|
||||||
@ -99,13 +151,8 @@ func (b *Backend) GetTd(blockHash common.Hash) (*big.Int, error) {
|
|||||||
|
|
||||||
// GetLogs returns all the logs for the given block hash
|
// GetLogs returns all the logs for the given block hash
|
||||||
func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
|
func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
|
||||||
pgStr := `SELECT blocks.data FROM public.blocks, eth.receipt_cids, eth.transaction_cids, eth.header_cids
|
_, receiptBytes, err := b.IPLDRetriever.RetrieveReceiptsByBlockHash(hash)
|
||||||
WHERE header_cids.block_hash = $1
|
if err != nil {
|
||||||
AND receipt_cids.tx_id = transaction_cids.id
|
|
||||||
AND transaction_cids.header_id = header_cids.id
|
|
||||||
ORDER BY transaction_cids.index ASC`
|
|
||||||
var receiptBytes [][]byte
|
|
||||||
if err := b.DB.Select(&receiptBytes, pgStr, hash.Hex()); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
logs := make([][]*types.Log, len(receiptBytes))
|
logs := make([][]*types.Log, len(receiptBytes))
|
||||||
@ -120,8 +167,6 @@ func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BlockByNumber returns the requested canonical block.
|
// BlockByNumber returns the requested canonical block.
|
||||||
// Since the ipld-eth-server database can contain forked blocks, it is recommended to fetch BlockByHash as
|
|
||||||
// fetching by number can return non-deterministic results (returns the first block found at that height)
|
|
||||||
func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Block, error) {
|
func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Block, error) {
|
||||||
var err error
|
var err error
|
||||||
number := blockNumber.Int64()
|
number := blockNumber.Int64()
|
||||||
@ -131,11 +176,26 @@ func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if blockNumber == rpc.EarliestBlockNumber {
|
||||||
|
number, err = b.Retriever.RetrieveFirstBlockNumber()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
if blockNumber == rpc.PendingBlockNumber {
|
if blockNumber == rpc.PendingBlockNumber {
|
||||||
return nil, errPendingBlockNumber
|
return nil, errPendingBlockNumber
|
||||||
}
|
}
|
||||||
|
if number < 0 {
|
||||||
|
return nil, errNegativeBlockNumber
|
||||||
|
}
|
||||||
|
// Get the canonical hash
|
||||||
|
canonicalHash := b.GetCanonicalHash(uint64(number))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
// Retrieve all the CIDs for the block
|
// Retrieve all the CIDs for the block
|
||||||
headerCID, uncleCIDs, txCIDs, rctCIDs, err := b.Retriever.RetrieveBlockByNumber(number)
|
// TODO: optimize this by retrieving iplds directly rather than the cids first (this is remanent from when we fetched iplds through ipfs blockservice interface)
|
||||||
|
headerCID, uncleCIDs, txCIDs, rctCIDs, err := b.Retriever.RetrieveBlockByHash(canonicalHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -510,3 +570,85 @@ func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StateAndHeaderByNumberOrHash returns the statedb and header for the provided block number or hash
|
||||||
|
func (b *Backend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error) {
|
||||||
|
if blockNr, ok := blockNrOrHash.Number(); ok {
|
||||||
|
return b.StateAndHeaderByNumber(ctx, blockNr)
|
||||||
|
}
|
||||||
|
if hash, ok := blockNrOrHash.Hash(); ok {
|
||||||
|
header, err := b.HeaderByHash(ctx, hash)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
if header == nil {
|
||||||
|
return nil, nil, errors.New("header for hash not found")
|
||||||
|
}
|
||||||
|
if blockNrOrHash.RequireCanonical && b.GetCanonicalHash(header.Number.Uint64()) != hash {
|
||||||
|
return nil, nil, errors.New("hash is not currently canonical")
|
||||||
|
}
|
||||||
|
stateDb, err := state.New(header.Root, b.StateDatabase)
|
||||||
|
return stateDb, header, err
|
||||||
|
}
|
||||||
|
return nil, nil, errors.New("invalid arguments; neither block nor hash specified")
|
||||||
|
}
|
||||||
|
|
||||||
|
// StateAndHeaderByNumber returns the statedb and header for a provided block number
|
||||||
|
func (b *Backend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error) {
|
||||||
|
// Pending state is only known by the miner
|
||||||
|
if number == rpc.PendingBlockNumber {
|
||||||
|
return nil, nil, errPendingBlockNumber
|
||||||
|
}
|
||||||
|
// Otherwise resolve the block number and return its state
|
||||||
|
header, err := b.HeaderByNumber(ctx, number)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
if header == nil {
|
||||||
|
return nil, nil, errors.New("header not found")
|
||||||
|
}
|
||||||
|
stateDb, err := state.New(header.Root, b.StateDatabase)
|
||||||
|
return stateDb, header, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCanonicalHash gets the canonical hash for the provided number, if there is one
|
||||||
|
func (b *Backend) GetCanonicalHash(number uint64) common.Hash {
|
||||||
|
var hashResult string
|
||||||
|
if err := b.DB.Get(&hashResult, RetrieveCanonicalBlockHashByNumber, number); err != nil {
|
||||||
|
return common.Hash{}
|
||||||
|
}
|
||||||
|
return common.HexToHash(hashResult)
|
||||||
|
}
|
||||||
|
|
||||||
|
type rowResult struct {
|
||||||
|
CID string
|
||||||
|
Data []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCanonicalHeader gets the canonical header for the provided number, if there is one
|
||||||
|
func (b *Backend) GetCanonicalHeader(number uint64) (string, []byte, error) {
|
||||||
|
headerResult := new(rowResult)
|
||||||
|
return headerResult.CID, headerResult.Data, b.DB.QueryRowx(RetrieveCanonicalHeaderByNumber, number).StructScan(headerResult)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEVM constructs and returns a vm.EVM
|
||||||
|
func (b *Backend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header) (*vm.EVM, error) {
|
||||||
|
state.SetBalance(msg.From(), math.MaxBig256)
|
||||||
|
c := core.NewEVMContext(msg, header, b, nil)
|
||||||
|
return vm.NewEVM(c, state, b.Config.ChainConfig, b.Config.VmConfig), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Engine satisfied the ChainContext interface
|
||||||
|
func (b *Backend) Engine() consensus.Engine {
|
||||||
|
// TODO: we need to support more than just ethash based engines
|
||||||
|
return ethash.NewFaker()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHeader satisfied the ChainContext interface
|
||||||
|
func (b *Backend) GetHeader(hash common.Hash, height uint64) *types.Header {
|
||||||
|
header, err := b.HeaderByHash(context.Background(), hash)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return header
|
||||||
|
}
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/lib/pq"
|
"github.com/lib/pq"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
||||||
@ -164,18 +164,18 @@ func (ecr *CIDRetriever) Retrieve(filter SubscriptionSettings, blockNumber int64
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveHeaderCIDs retrieves and returns all of the header cids at the provided blockheight
|
// RetrieveHeaderCIDs retrieves and returns all of the header cids at the provided blockheight
|
||||||
func (ecr *CIDRetriever) RetrieveHeaderCIDs(tx *sqlx.Tx, blockNumber int64) ([]eth2.HeaderModel, error) {
|
func (ecr *CIDRetriever) RetrieveHeaderCIDs(tx *sqlx.Tx, blockNumber int64) ([]eth.HeaderModel, error) {
|
||||||
log.Debug("retrieving header cids for block ", blockNumber)
|
log.Debug("retrieving header cids for block ", blockNumber)
|
||||||
headers := make([]eth2.HeaderModel, 0)
|
headers := make([]eth.HeaderModel, 0)
|
||||||
pgStr := `SELECT * FROM eth.header_cids
|
pgStr := `SELECT * 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveUncleCIDsByHeaderID retrieves and returns all of the uncle cids for the provided header
|
// RetrieveUncleCIDsByHeaderID retrieves and returns all of the uncle cids for the provided header
|
||||||
func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID int64) ([]eth2.UncleModel, error) {
|
func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID int64) ([]eth.UncleModel, error) {
|
||||||
log.Debug("retrieving uncle cids for block id ", headerID)
|
log.Debug("retrieving uncle cids for block id ", headerID)
|
||||||
headers := make([]eth2.UncleModel, 0)
|
headers := make([]eth.UncleModel, 0)
|
||||||
pgStr := `SELECT * FROM eth.uncle_cids
|
pgStr := `SELECT * 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)
|
||||||
@ -183,15 +183,14 @@ func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID int64
|
|||||||
|
|
||||||
// RetrieveTxCIDs retrieves and returns all of the trx cids at the provided blockheight that conform to the provided filter parameters
|
// RetrieveTxCIDs retrieves and returns all of the trx cids at the provided blockheight that conform to the provided filter parameters
|
||||||
// also returns the ids for the returned transaction cids
|
// also returns the ids for the returned transaction cids
|
||||||
func (ecr *CIDRetriever) RetrieveTxCIDs(tx *sqlx.Tx, txFilter TxFilter, headerID int64) ([]eth2.TxModel, error) {
|
func (ecr *CIDRetriever) RetrieveTxCIDs(tx *sqlx.Tx, txFilter TxFilter, headerID int64) ([]eth.TxModel, error) {
|
||||||
log.Debug("retrieving transaction cids for header id ", headerID)
|
log.Debug("retrieving transaction cids for header id ", headerID)
|
||||||
args := make([]interface{}, 0, 3)
|
args := make([]interface{}, 0, 3)
|
||||||
results := make([]eth2.TxModel, 0)
|
results := make([]eth.TxModel, 0)
|
||||||
id := 1
|
id := 1
|
||||||
pgStr := fmt.Sprintf(`SELECT transaction_cids.id, transaction_cids.header_id,
|
pgStr := fmt.Sprintf(`SELECT transaction_cids.id, transaction_cids.header_id,
|
||||||
transaction_cids.tx_hash, transaction_cids.cid, transaction_cids.mh_key,
|
transaction_cids.tx_hash, transaction_cids.cid, transaction_cids.mh_key,
|
||||||
transaction_cids.dst, transaction_cids.src, transaction_cids.index,
|
transaction_cids.dst, transaction_cids.src, transaction_cids.index, transaction_cids.tx_data
|
||||||
transaction_cids.tx_data, transaction_cids.deployment
|
|
||||||
FROM eth.transaction_cids INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.id)
|
FROM eth.transaction_cids INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.id)
|
||||||
WHERE header_cids.id = $%d`, id)
|
WHERE header_cids.id = $%d`, id)
|
||||||
args = append(args, headerID)
|
args = append(args, headerID)
|
||||||
@ -211,7 +210,7 @@ func (ecr *CIDRetriever) RetrieveTxCIDs(tx *sqlx.Tx, txFilter TxFilter, headerID
|
|||||||
|
|
||||||
// RetrieveRctCIDsByHeaderID retrieves and returns all of the rct cids at the provided header ID that conform to the provided
|
// RetrieveRctCIDsByHeaderID retrieves and returns all of the rct cids at the provided header ID that conform to the provided
|
||||||
// filter parameters and correspond to the provided tx ids
|
// filter parameters and correspond to the provided tx ids
|
||||||
func (ecr *CIDRetriever) RetrieveRctCIDsByHeaderID(tx *sqlx.Tx, rctFilter ReceiptFilter, headerID int64, trxIds []int64) ([]eth2.ReceiptModel, error) {
|
func (ecr *CIDRetriever) RetrieveRctCIDsByHeaderID(tx *sqlx.Tx, rctFilter ReceiptFilter, headerID int64, trxIds []int64) ([]eth.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.id, receipt_cids.tx_id, receipt_cids.cid, receipt_cids.mh_key,
|
pgStr := `SELECT receipt_cids.id, receipt_cids.tx_id, receipt_cids.cid, receipt_cids.mh_key,
|
||||||
@ -285,13 +284,13 @@ func (ecr *CIDRetriever) RetrieveRctCIDsByHeaderID(tx *sqlx.Tx, rctFilter Receip
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pgStr += ` ORDER BY transaction_cids.index`
|
pgStr += ` ORDER BY transaction_cids.index`
|
||||||
receiptCids := make([]eth2.ReceiptModel, 0)
|
receiptCids := make([]eth.ReceiptModel, 0)
|
||||||
return receiptCids, tx.Select(&receiptCids, pgStr, args...)
|
return receiptCids, tx.Select(&receiptCids, pgStr, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveRctCIDs retrieves and returns all of the rct cids at the provided blockheight or block hash that conform to the provided
|
// RetrieveRctCIDs retrieves and returns all of the rct cids at the provided blockheight or block hash that conform to the provided
|
||||||
// filter parameters and correspond to the provided tx ids
|
// filter parameters and correspond to the provided tx ids
|
||||||
func (ecr *CIDRetriever) RetrieveRctCIDs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash *common.Hash, trxIds []int64) ([]eth2.ReceiptModel, error) {
|
func (ecr *CIDRetriever) RetrieveRctCIDs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash *common.Hash, trxIds []int64) ([]eth.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.id, receipt_cids.tx_id, receipt_cids.cid, receipt_cids.mh_key,
|
pgStr := `SELECT receipt_cids.id, receipt_cids.tx_id, receipt_cids.cid, receipt_cids.mh_key,
|
||||||
@ -373,7 +372,7 @@ func (ecr *CIDRetriever) RetrieveRctCIDs(tx *sqlx.Tx, rctFilter ReceiptFilter, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pgStr += ` ORDER BY transaction_cids.index`
|
pgStr += ` ORDER BY transaction_cids.index`
|
||||||
receiptCids := make([]eth2.ReceiptModel, 0)
|
receiptCids := make([]eth.ReceiptModel, 0)
|
||||||
return receiptCids, tx.Select(&receiptCids, pgStr, args...)
|
return receiptCids, tx.Select(&receiptCids, pgStr, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +386,7 @@ func hasTopics(topics [][]string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveStateCIDs retrieves and returns all of the state node cids at the provided header ID that conform to the provided filter parameters
|
// RetrieveStateCIDs retrieves and returns all of the state node cids at the provided header ID that conform to the provided filter parameters
|
||||||
func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter, headerID int64) ([]eth2.StateNodeModel, error) {
|
func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter, headerID int64) ([]eth.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.id, state_cids.header_id,
|
pgStr := `SELECT state_cids.id, state_cids.header_id,
|
||||||
@ -407,12 +406,12 @@ func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter,
|
|||||||
if !stateFilter.IntermediateNodes {
|
if !stateFilter.IntermediateNodes {
|
||||||
pgStr += ` AND state_cids.node_type = 2`
|
pgStr += ` AND state_cids.node_type = 2`
|
||||||
}
|
}
|
||||||
stateNodeCIDs := make([]eth2.StateNodeModel, 0)
|
stateNodeCIDs := make([]eth.StateNodeModel, 0)
|
||||||
return stateNodeCIDs, tx.Select(&stateNodeCIDs, pgStr, args...)
|
return stateNodeCIDs, tx.Select(&stateNodeCIDs, pgStr, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveStorageCIDs retrieves and returns all of the storage node cids at the provided header id that conform to the provided filter parameters
|
// RetrieveStorageCIDs retrieves and returns all of the storage node cids at the provided header id that conform to the provided filter parameters
|
||||||
func (ecr *CIDRetriever) RetrieveStorageCIDs(tx *sqlx.Tx, storageFilter StorageFilter, headerID int64) ([]eth2.StorageNodeWithStateKeyModel, error) {
|
func (ecr *CIDRetriever) RetrieveStorageCIDs(tx *sqlx.Tx, storageFilter StorageFilter, headerID int64) ([]eth.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.id, storage_cids.state_id, storage_cids.storage_leaf_key, storage_cids.node_type,
|
pgStr := `SELECT storage_cids.id, storage_cids.state_id, storage_cids.storage_leaf_key, storage_cids.node_type,
|
||||||
@ -440,18 +439,18 @@ func (ecr *CIDRetriever) RetrieveStorageCIDs(tx *sqlx.Tx, storageFilter StorageF
|
|||||||
if !storageFilter.IntermediateNodes {
|
if !storageFilter.IntermediateNodes {
|
||||||
pgStr += ` AND storage_cids.node_type = 2`
|
pgStr += ` AND storage_cids.node_type = 2`
|
||||||
}
|
}
|
||||||
storageNodeCIDs := make([]eth2.StorageNodeWithStateKeyModel, 0)
|
storageNodeCIDs := make([]eth.StorageNodeWithStateKeyModel, 0)
|
||||||
return storageNodeCIDs, tx.Select(&storageNodeCIDs, pgStr, args...)
|
return storageNodeCIDs, tx.Select(&storageNodeCIDs, pgStr, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveBlockByHash returns all of the CIDs needed to compose an entire block, for a given block hash
|
// RetrieveBlockByHash returns all of the CIDs needed to compose an entire block, for a given block hash
|
||||||
func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (eth2.HeaderModel, []eth2.UncleModel, []eth2.TxModel, []eth2.ReceiptModel, error) {
|
func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (eth.HeaderModel, []eth.UncleModel, []eth.TxModel, []eth.ReceiptModel, error) {
|
||||||
log.Debug("retrieving block cids for block hash ", blockHash.String())
|
log.Debug("retrieving block cids for block hash ", blockHash.String())
|
||||||
|
|
||||||
// Begin new db tx
|
// Begin new db tx
|
||||||
tx, err := ecr.db.Beginx()
|
tx, err := ecr.db.Beginx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, err
|
return eth.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if p := recover(); p != nil {
|
if p := recover(); p != nil {
|
||||||
@ -467,17 +466,17 @@ func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (eth2.Header
|
|||||||
headerCID, err := ecr.RetrieveHeaderCIDByHash(tx, blockHash)
|
headerCID, err := ecr.RetrieveHeaderCIDByHash(tx, blockHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("header cid retrieval error")
|
log.Error("header cid retrieval error")
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, err
|
return eth.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
uncleCIDs, err := ecr.RetrieveUncleCIDsByHeaderID(tx, headerCID.ID)
|
uncleCIDs, err := ecr.RetrieveUncleCIDsByHeaderID(tx, headerCID.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("uncle cid retrieval error")
|
log.Error("uncle cid retrieval error")
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, err
|
return eth.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
txCIDs, err := ecr.RetrieveTxCIDsByHeaderID(tx, headerCID.ID)
|
txCIDs, err := ecr.RetrieveTxCIDsByHeaderID(tx, headerCID.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("tx cid retrieval error")
|
log.Error("tx cid retrieval error")
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, err
|
return eth.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
txIDs := make([]int64, len(txCIDs))
|
txIDs := make([]int64, len(txCIDs))
|
||||||
for i, txCID := range txCIDs {
|
for i, txCID := range txCIDs {
|
||||||
@ -491,13 +490,13 @@ func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (eth2.Header
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveBlockByNumber returns all of the CIDs needed to compose an entire block, for a given block number
|
// RetrieveBlockByNumber returns all of the CIDs needed to compose an entire block, for a given block number
|
||||||
func (ecr *CIDRetriever) RetrieveBlockByNumber(blockNumber int64) (eth2.HeaderModel, []eth2.UncleModel, []eth2.TxModel, []eth2.ReceiptModel, error) {
|
func (ecr *CIDRetriever) RetrieveBlockByNumber(blockNumber int64) (eth.HeaderModel, []eth.UncleModel, []eth.TxModel, []eth.ReceiptModel, error) {
|
||||||
log.Debug("retrieving block cids for block number ", blockNumber)
|
log.Debug("retrieving block cids for block number ", blockNumber)
|
||||||
|
|
||||||
// Begin new db tx
|
// Begin new db tx
|
||||||
tx, err := ecr.db.Beginx()
|
tx, err := ecr.db.Beginx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, err
|
return eth.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if p := recover(); p != nil {
|
if p := recover(); p != nil {
|
||||||
@ -513,20 +512,20 @@ func (ecr *CIDRetriever) RetrieveBlockByNumber(blockNumber int64) (eth2.HeaderMo
|
|||||||
headerCID, err := ecr.RetrieveHeaderCIDs(tx, blockNumber)
|
headerCID, err := ecr.RetrieveHeaderCIDs(tx, blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("header cid retrieval error")
|
log.Error("header cid retrieval error")
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, err
|
return eth.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
if len(headerCID) < 1 {
|
if len(headerCID) < 1 {
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, fmt.Errorf("header cid retrieval error, no header CIDs found at block %d", blockNumber)
|
return eth.HeaderModel{}, nil, nil, nil, fmt.Errorf("header cid retrieval error, no header CIDs found at block %d", blockNumber)
|
||||||
}
|
}
|
||||||
uncleCIDs, err := ecr.RetrieveUncleCIDsByHeaderID(tx, headerCID[0].ID)
|
uncleCIDs, err := ecr.RetrieveUncleCIDsByHeaderID(tx, headerCID[0].ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("uncle cid retrieval error")
|
log.Error("uncle cid retrieval error")
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, err
|
return eth.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
txCIDs, err := ecr.RetrieveTxCIDsByHeaderID(tx, headerCID[0].ID)
|
txCIDs, err := ecr.RetrieveTxCIDsByHeaderID(tx, headerCID[0].ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("tx cid retrieval error")
|
log.Error("tx cid retrieval error")
|
||||||
return eth2.HeaderModel{}, nil, nil, nil, err
|
return eth.HeaderModel{}, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
txIDs := make([]int64, len(txCIDs))
|
txIDs := make([]int64, len(txCIDs))
|
||||||
for i, txCID := range txCIDs {
|
for i, txCID := range txCIDs {
|
||||||
@ -540,26 +539,26 @@ func (ecr *CIDRetriever) RetrieveBlockByNumber(blockNumber int64) (eth2.HeaderMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RetrieveHeaderCIDByHash returns the header for the given block hash
|
// RetrieveHeaderCIDByHash returns the header for the given block hash
|
||||||
func (ecr *CIDRetriever) RetrieveHeaderCIDByHash(tx *sqlx.Tx, blockHash common.Hash) (eth2.HeaderModel, error) {
|
func (ecr *CIDRetriever) RetrieveHeaderCIDByHash(tx *sqlx.Tx, blockHash common.Hash) (eth.HeaderModel, error) {
|
||||||
log.Debug("retrieving header cids for block hash ", blockHash.String())
|
log.Debug("retrieving header cids for block hash ", blockHash.String())
|
||||||
pgStr := `SELECT * FROM eth.header_cids
|
pgStr := `SELECT * FROM eth.header_cids
|
||||||
WHERE block_hash = $1`
|
WHERE block_hash = $1`
|
||||||
var headerCID eth2.HeaderModel
|
var headerCID eth.HeaderModel
|
||||||
return headerCID, tx.Get(&headerCID, pgStr, blockHash.String())
|
return headerCID, tx.Get(&headerCID, pgStr, blockHash.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 int64) ([]eth2.TxModel, error) {
|
func (ecr *CIDRetriever) RetrieveTxCIDsByHeaderID(tx *sqlx.Tx, headerID int64) ([]eth.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 * FROM eth.transaction_cids
|
||||||
WHERE header_id = $1
|
WHERE header_id = $1
|
||||||
ORDER BY index`
|
ORDER BY index`
|
||||||
var txCIDs []eth2.TxModel
|
var txCIDs []eth.TxModel
|
||||||
return txCIDs, tx.Select(&txCIDs, pgStr, headerID)
|
return txCIDs, tx.Select(&txCIDs, pgStr, headerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, txIDs []int64) ([]eth2.ReceiptModel, error) {
|
func (ecr *CIDRetriever) RetrieveReceiptCIDsByTxIDs(tx *sqlx.Tx, txIDs []int64) ([]eth.ReceiptModel, error) {
|
||||||
log.Debugf("retrieving receipt cids for tx ids %v", txIDs)
|
log.Debugf("retrieving receipt cids for tx ids %v", txIDs)
|
||||||
pgStr := `SELECT receipt_cids.id, receipt_cids.tx_id, receipt_cids.cid, receipt_cids.mh_key,
|
pgStr := `SELECT receipt_cids.id, receipt_cids.tx_id, receipt_cids.cid, receipt_cids.mh_key,
|
||||||
receipt_cids.contract, receipt_cids.contract_hash, receipt_cids.topic0s, receipt_cids.topic1s,
|
receipt_cids.contract, receipt_cids.contract_hash, receipt_cids.topic0s, receipt_cids.topic1s,
|
||||||
@ -568,6 +567,6 @@ func (ecr *CIDRetriever) RetrieveReceiptCIDsByTxIDs(tx *sqlx.Tx, txIDs []int64)
|
|||||||
WHERE tx_id = ANY($1::INTEGER[])
|
WHERE tx_id = ANY($1::INTEGER[])
|
||||||
AND receipt_cids.tx_id = transaction_cids.id
|
AND receipt_cids.tx_id = transaction_cids.id
|
||||||
ORDER BY transaction_cids.index`
|
ORDER BY transaction_cids.index`
|
||||||
var rctCIDs []eth2.ReceiptModel
|
var rctCIDs []eth.ReceiptModel
|
||||||
return rctCIDs, tx.Select(&rctCIDs, pgStr, pq.Array(txIDs))
|
return rctCIDs, tx.Select(&rctCIDs, pgStr, pq.Array(txIDs))
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package eth_test
|
package eth_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth/mocks"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
@ -26,10 +25,10 @@ import (
|
|||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
mocks2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth/mocks"
|
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ var (
|
|||||||
Off: true,
|
Off: true,
|
||||||
},
|
},
|
||||||
ReceiptFilter: eth.ReceiptFilter{
|
ReceiptFilter: eth.ReceiptFilter{
|
||||||
LogAddresses: []string{mocks2.Address.String()},
|
LogAddresses: []string{test_helpers.Address.String()},
|
||||||
},
|
},
|
||||||
StateFilter: eth.StateFilter{
|
StateFilter: eth.StateFilter{
|
||||||
Off: true,
|
Off: true,
|
||||||
@ -95,7 +94,7 @@ var (
|
|||||||
{"0x0000000000000000000000000000000000000000000000000000000000000004"},
|
{"0x0000000000000000000000000000000000000000000000000000000000000004"},
|
||||||
{"0x0000000000000000000000000000000000000000000000000000000000000006"},
|
{"0x0000000000000000000000000000000000000000000000000000000000000006"},
|
||||||
},
|
},
|
||||||
LogAddresses: []string{mocks2.Address.String()},
|
LogAddresses: []string{test_helpers.Address.String()},
|
||||||
},
|
},
|
||||||
StateFilter: eth.StateFilter{
|
StateFilter: eth.StateFilter{
|
||||||
Off: true,
|
Off: true,
|
||||||
@ -116,9 +115,9 @@ var (
|
|||||||
ReceiptFilter: eth.ReceiptFilter{
|
ReceiptFilter: eth.ReceiptFilter{
|
||||||
Topics: [][]string{
|
Topics: [][]string{
|
||||||
{"0x0000000000000000000000000000000000000000000000000000000000000004"},
|
{"0x0000000000000000000000000000000000000000000000000000000000000004"},
|
||||||
{"0x0000000000000000000000000000000000000000000000000000000000000007"}, // This topic won't match on the mocks2.Address.String() contract receipt
|
{"0x0000000000000000000000000000000000000000000000000000000000000007"}, // This topic won't match on the mocks.Address.String() contract receipt
|
||||||
},
|
},
|
||||||
LogAddresses: []string{mocks2.Address.String()},
|
LogAddresses: []string{test_helpers.Address.String()},
|
||||||
},
|
},
|
||||||
StateFilter: eth.StateFilter{
|
StateFilter: eth.StateFilter{
|
||||||
Off: true,
|
Off: true,
|
||||||
@ -138,7 +137,7 @@ var (
|
|||||||
},
|
},
|
||||||
ReceiptFilter: eth.ReceiptFilter{
|
ReceiptFilter: eth.ReceiptFilter{
|
||||||
Topics: [][]string{{"0x0000000000000000000000000000000000000000000000000000000000000005"}},
|
Topics: [][]string{{"0x0000000000000000000000000000000000000000000000000000000000000005"}},
|
||||||
LogAddresses: []string{mocks2.Address.String(), mocks2.AnotherAddress.String()},
|
LogAddresses: []string{test_helpers.Address.String(), test_helpers.AnotherAddress.String()},
|
||||||
},
|
},
|
||||||
StateFilter: eth.StateFilter{
|
StateFilter: eth.StateFilter{
|
||||||
Off: true,
|
Off: true,
|
||||||
@ -173,7 +172,7 @@ var (
|
|||||||
Off: true,
|
Off: true,
|
||||||
},
|
},
|
||||||
TxFilter: eth.TxFilter{
|
TxFilter: eth.TxFilter{
|
||||||
Dst: []string{mocks2.AnotherAddress.String()}, // We only filter for one of the trxs so we will only get the one corresponding receipt
|
Dst: []string{test_helpers.AnotherAddress.String()}, // We only filter for one of the trxs so we will only get the one corresponding receipt
|
||||||
},
|
},
|
||||||
ReceiptFilter: eth.ReceiptFilter{
|
ReceiptFilter: eth.ReceiptFilter{
|
||||||
MatchTxs: true,
|
MatchTxs: true,
|
||||||
@ -200,7 +199,7 @@ var (
|
|||||||
Off: true,
|
Off: true,
|
||||||
},
|
},
|
||||||
StateFilter: eth.StateFilter{
|
StateFilter: eth.StateFilter{
|
||||||
Addresses: []string{mocks2.AccountAddresss.Hex()},
|
Addresses: []string{test_helpers.AccountAddresss.Hex()},
|
||||||
},
|
},
|
||||||
StorageFilter: eth.StorageFilter{
|
StorageFilter: eth.StorageFilter{
|
||||||
Off: true,
|
Off: true,
|
||||||
@ -227,7 +226,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
|
|
||||||
Describe("Retrieve", func() {
|
Describe("Retrieve", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
err := repo.Publish(mocks.MockConvertedPayload)
|
err := repo.Publish(test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
})
|
})
|
||||||
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
@ -235,34 +234,34 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
Expect(len(cids)).To(Equal(1))
|
Expect(len(cids)).To(Equal(1))
|
||||||
Expect(cids[0].BlockNumber).To(Equal(mocks.MockCIDWrapper.BlockNumber))
|
Expect(cids[0].BlockNumber).To(Equal(test_helpers.MockCIDWrapper.BlockNumber))
|
||||||
expectedHeaderCID := mocks.MockCIDWrapper.Header
|
expectedHeaderCID := test_helpers.MockCIDWrapper.Header
|
||||||
expectedHeaderCID.ID = cids[0].Header.ID
|
expectedHeaderCID.ID = cids[0].Header.ID
|
||||||
expectedHeaderCID.NodeID = cids[0].Header.NodeID
|
expectedHeaderCID.NodeID = cids[0].Header.NodeID
|
||||||
Expect(cids[0].Header).To(Equal(expectedHeaderCID))
|
Expect(cids[0].Header).To(Equal(expectedHeaderCID))
|
||||||
Expect(len(cids[0].Transactions)).To(Equal(3))
|
Expect(len(cids[0].Transactions)).To(Equal(3))
|
||||||
Expect(eth.TxModelsContainsCID(cids[0].Transactions, mocks.MockCIDWrapper.Transactions[0].CID)).To(BeTrue())
|
Expect(eth.TxModelsContainsCID(cids[0].Transactions, test_helpers.MockCIDWrapper.Transactions[0].CID)).To(BeTrue())
|
||||||
Expect(eth.TxModelsContainsCID(cids[0].Transactions, mocks.MockCIDWrapper.Transactions[1].CID)).To(BeTrue())
|
Expect(eth.TxModelsContainsCID(cids[0].Transactions, test_helpers.MockCIDWrapper.Transactions[1].CID)).To(BeTrue())
|
||||||
Expect(eth.TxModelsContainsCID(cids[0].Transactions, mocks.MockCIDWrapper.Transactions[2].CID)).To(BeTrue())
|
Expect(eth.TxModelsContainsCID(cids[0].Transactions, test_helpers.MockCIDWrapper.Transactions[2].CID)).To(BeTrue())
|
||||||
Expect(len(cids[0].Receipts)).To(Equal(3))
|
Expect(len(cids[0].Receipts)).To(Equal(3))
|
||||||
Expect(eth.ReceiptModelsContainsCID(cids[0].Receipts, mocks.MockCIDWrapper.Receipts[0].CID)).To(BeTrue())
|
Expect(eth.ReceiptModelsContainsCID(cids[0].Receipts, test_helpers.MockCIDWrapper.Receipts[0].CID)).To(BeTrue())
|
||||||
Expect(eth.ReceiptModelsContainsCID(cids[0].Receipts, mocks.MockCIDWrapper.Receipts[1].CID)).To(BeTrue())
|
Expect(eth.ReceiptModelsContainsCID(cids[0].Receipts, test_helpers.MockCIDWrapper.Receipts[1].CID)).To(BeTrue())
|
||||||
Expect(eth.ReceiptModelsContainsCID(cids[0].Receipts, mocks.MockCIDWrapper.Receipts[2].CID)).To(BeTrue())
|
Expect(eth.ReceiptModelsContainsCID(cids[0].Receipts, test_helpers.MockCIDWrapper.Receipts[2].CID)).To(BeTrue())
|
||||||
Expect(len(cids[0].StateNodes)).To(Equal(2))
|
Expect(len(cids[0].StateNodes)).To(Equal(2))
|
||||||
for _, stateNode := range cids[0].StateNodes {
|
for _, stateNode := range cids[0].StateNodes {
|
||||||
if stateNode.CID == mocks2.State1CID.String() {
|
if stateNode.CID == test_helpers.State1CID.String() {
|
||||||
Expect(stateNode.StateKey).To(Equal(common.BytesToHash(mocks.ContractLeafKey).Hex()))
|
Expect(stateNode.StateKey).To(Equal(common.BytesToHash(test_helpers.ContractLeafKey).Hex()))
|
||||||
Expect(stateNode.NodeType).To(Equal(2))
|
Expect(stateNode.NodeType).To(Equal(2))
|
||||||
Expect(stateNode.Path).To(Equal([]byte{'\x06'}))
|
Expect(stateNode.Path).To(Equal([]byte{'\x06'}))
|
||||||
}
|
}
|
||||||
if stateNode.CID == mocks2.State2CID.String() {
|
if stateNode.CID == test_helpers.State2CID.String() {
|
||||||
Expect(stateNode.StateKey).To(Equal(common.BytesToHash(mocks.AccountLeafKey).Hex()))
|
Expect(stateNode.StateKey).To(Equal(common.BytesToHash(test_helpers.AccountLeafKey).Hex()))
|
||||||
Expect(stateNode.NodeType).To(Equal(2))
|
Expect(stateNode.NodeType).To(Equal(2))
|
||||||
Expect(stateNode.Path).To(Equal([]byte{'\x0c'}))
|
Expect(stateNode.Path).To(Equal([]byte{'\x0c'}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expect(len(cids[0].StorageNodes)).To(Equal(1))
|
Expect(len(cids[0].StorageNodes)).To(Equal(1))
|
||||||
expectedStorageNodeCIDs := mocks.MockCIDWrapper.StorageNodes
|
expectedStorageNodeCIDs := test_helpers.MockCIDWrapper.StorageNodes
|
||||||
expectedStorageNodeCIDs[0].ID = cids[0].StorageNodes[0].ID
|
expectedStorageNodeCIDs[0].ID = cids[0].StorageNodes[0].ID
|
||||||
expectedStorageNodeCIDs[0].StateID = cids[0].StorageNodes[0].StateID
|
expectedStorageNodeCIDs[0].StateID = cids[0].StorageNodes[0].StateID
|
||||||
Expect(cids[0].StorageNodes).To(Equal(expectedStorageNodeCIDs))
|
Expect(cids[0].StorageNodes).To(Equal(expectedStorageNodeCIDs))
|
||||||
@ -273,13 +272,13 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
Expect(len(cids1)).To(Equal(1))
|
Expect(len(cids1)).To(Equal(1))
|
||||||
Expect(cids1[0].BlockNumber).To(Equal(mocks.MockCIDWrapper.BlockNumber))
|
Expect(cids1[0].BlockNumber).To(Equal(test_helpers.MockCIDWrapper.BlockNumber))
|
||||||
Expect(cids1[0].Header).To(Equal(eth2.HeaderModel{}))
|
Expect(cids1[0].Header).To(Equal(eth2.HeaderModel{}))
|
||||||
Expect(len(cids1[0].Transactions)).To(Equal(0))
|
Expect(len(cids1[0].Transactions)).To(Equal(0))
|
||||||
Expect(len(cids1[0].StateNodes)).To(Equal(0))
|
Expect(len(cids1[0].StateNodes)).To(Equal(0))
|
||||||
Expect(len(cids1[0].StorageNodes)).To(Equal(0))
|
Expect(len(cids1[0].StorageNodes)).To(Equal(0))
|
||||||
Expect(len(cids1[0].Receipts)).To(Equal(1))
|
Expect(len(cids1[0].Receipts)).To(Equal(1))
|
||||||
expectedReceiptCID := mocks.MockCIDWrapper.Receipts[0]
|
expectedReceiptCID := test_helpers.MockCIDWrapper.Receipts[0]
|
||||||
expectedReceiptCID.ID = cids1[0].Receipts[0].ID
|
expectedReceiptCID.ID = cids1[0].Receipts[0].ID
|
||||||
expectedReceiptCID.TxID = cids1[0].Receipts[0].TxID
|
expectedReceiptCID.TxID = cids1[0].Receipts[0].TxID
|
||||||
Expect(cids1[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
Expect(cids1[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
||||||
@ -288,13 +287,13 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
Expect(len(cids2)).To(Equal(1))
|
Expect(len(cids2)).To(Equal(1))
|
||||||
Expect(cids2[0].BlockNumber).To(Equal(mocks.MockCIDWrapper.BlockNumber))
|
Expect(cids2[0].BlockNumber).To(Equal(test_helpers.MockCIDWrapper.BlockNumber))
|
||||||
Expect(cids2[0].Header).To(Equal(eth2.HeaderModel{}))
|
Expect(cids2[0].Header).To(Equal(eth2.HeaderModel{}))
|
||||||
Expect(len(cids2[0].Transactions)).To(Equal(0))
|
Expect(len(cids2[0].Transactions)).To(Equal(0))
|
||||||
Expect(len(cids2[0].StateNodes)).To(Equal(0))
|
Expect(len(cids2[0].StateNodes)).To(Equal(0))
|
||||||
Expect(len(cids2[0].StorageNodes)).To(Equal(0))
|
Expect(len(cids2[0].StorageNodes)).To(Equal(0))
|
||||||
Expect(len(cids2[0].Receipts)).To(Equal(1))
|
Expect(len(cids2[0].Receipts)).To(Equal(1))
|
||||||
expectedReceiptCID = mocks.MockCIDWrapper.Receipts[0]
|
expectedReceiptCID = test_helpers.MockCIDWrapper.Receipts[0]
|
||||||
expectedReceiptCID.ID = cids2[0].Receipts[0].ID
|
expectedReceiptCID.ID = cids2[0].Receipts[0].ID
|
||||||
expectedReceiptCID.TxID = cids2[0].Receipts[0].TxID
|
expectedReceiptCID.TxID = cids2[0].Receipts[0].TxID
|
||||||
Expect(cids2[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
Expect(cids2[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
||||||
@ -303,13 +302,13 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
Expect(len(cids3)).To(Equal(1))
|
Expect(len(cids3)).To(Equal(1))
|
||||||
Expect(cids3[0].BlockNumber).To(Equal(mocks.MockCIDWrapper.BlockNumber))
|
Expect(cids3[0].BlockNumber).To(Equal(test_helpers.MockCIDWrapper.BlockNumber))
|
||||||
Expect(cids3[0].Header).To(Equal(eth2.HeaderModel{}))
|
Expect(cids3[0].Header).To(Equal(eth2.HeaderModel{}))
|
||||||
Expect(len(cids3[0].Transactions)).To(Equal(0))
|
Expect(len(cids3[0].Transactions)).To(Equal(0))
|
||||||
Expect(len(cids3[0].StateNodes)).To(Equal(0))
|
Expect(len(cids3[0].StateNodes)).To(Equal(0))
|
||||||
Expect(len(cids3[0].StorageNodes)).To(Equal(0))
|
Expect(len(cids3[0].StorageNodes)).To(Equal(0))
|
||||||
Expect(len(cids3[0].Receipts)).To(Equal(1))
|
Expect(len(cids3[0].Receipts)).To(Equal(1))
|
||||||
expectedReceiptCID = mocks.MockCIDWrapper.Receipts[0]
|
expectedReceiptCID = test_helpers.MockCIDWrapper.Receipts[0]
|
||||||
expectedReceiptCID.ID = cids3[0].Receipts[0].ID
|
expectedReceiptCID.ID = cids3[0].Receipts[0].ID
|
||||||
expectedReceiptCID.TxID = cids3[0].Receipts[0].TxID
|
expectedReceiptCID.TxID = cids3[0].Receipts[0].TxID
|
||||||
Expect(cids3[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
Expect(cids3[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
||||||
@ -318,13 +317,13 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
Expect(len(cids4)).To(Equal(1))
|
Expect(len(cids4)).To(Equal(1))
|
||||||
Expect(cids4[0].BlockNumber).To(Equal(mocks.MockCIDWrapper.BlockNumber))
|
Expect(cids4[0].BlockNumber).To(Equal(test_helpers.MockCIDWrapper.BlockNumber))
|
||||||
Expect(cids4[0].Header).To(Equal(eth2.HeaderModel{}))
|
Expect(cids4[0].Header).To(Equal(eth2.HeaderModel{}))
|
||||||
Expect(len(cids4[0].Transactions)).To(Equal(0))
|
Expect(len(cids4[0].Transactions)).To(Equal(0))
|
||||||
Expect(len(cids4[0].StateNodes)).To(Equal(0))
|
Expect(len(cids4[0].StateNodes)).To(Equal(0))
|
||||||
Expect(len(cids4[0].StorageNodes)).To(Equal(0))
|
Expect(len(cids4[0].StorageNodes)).To(Equal(0))
|
||||||
Expect(len(cids4[0].Receipts)).To(Equal(1))
|
Expect(len(cids4[0].Receipts)).To(Equal(1))
|
||||||
expectedReceiptCID = mocks.MockCIDWrapper.Receipts[1]
|
expectedReceiptCID = test_helpers.MockCIDWrapper.Receipts[1]
|
||||||
expectedReceiptCID.ID = cids4[0].Receipts[0].ID
|
expectedReceiptCID.ID = cids4[0].Receipts[0].ID
|
||||||
expectedReceiptCID.TxID = cids4[0].Receipts[0].TxID
|
expectedReceiptCID.TxID = cids4[0].Receipts[0].TxID
|
||||||
Expect(cids4[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
Expect(cids4[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
||||||
@ -333,34 +332,34 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
Expect(len(cids5)).To(Equal(1))
|
Expect(len(cids5)).To(Equal(1))
|
||||||
Expect(cids5[0].BlockNumber).To(Equal(mocks.MockCIDWrapper.BlockNumber))
|
Expect(cids5[0].BlockNumber).To(Equal(test_helpers.MockCIDWrapper.BlockNumber))
|
||||||
Expect(cids5[0].Header).To(Equal(eth2.HeaderModel{}))
|
Expect(cids5[0].Header).To(Equal(eth2.HeaderModel{}))
|
||||||
Expect(len(cids5[0].Transactions)).To(Equal(3))
|
Expect(len(cids5[0].Transactions)).To(Equal(3))
|
||||||
Expect(eth.TxModelsContainsCID(cids5[0].Transactions, mocks.Trx1CID.String())).To(BeTrue())
|
Expect(eth.TxModelsContainsCID(cids5[0].Transactions, test_helpers.Trx1CID.String())).To(BeTrue())
|
||||||
Expect(eth.TxModelsContainsCID(cids5[0].Transactions, mocks.Trx2CID.String())).To(BeTrue())
|
Expect(eth.TxModelsContainsCID(cids5[0].Transactions, test_helpers.Trx2CID.String())).To(BeTrue())
|
||||||
Expect(eth.TxModelsContainsCID(cids5[0].Transactions, mocks.Trx3CID.String())).To(BeTrue())
|
Expect(eth.TxModelsContainsCID(cids5[0].Transactions, test_helpers.Trx3CID.String())).To(BeTrue())
|
||||||
Expect(len(cids5[0].StateNodes)).To(Equal(0))
|
Expect(len(cids5[0].StateNodes)).To(Equal(0))
|
||||||
Expect(len(cids5[0].StorageNodes)).To(Equal(0))
|
Expect(len(cids5[0].StorageNodes)).To(Equal(0))
|
||||||
Expect(len(cids5[0].Receipts)).To(Equal(3))
|
Expect(len(cids5[0].Receipts)).To(Equal(3))
|
||||||
Expect(eth.ReceiptModelsContainsCID(cids5[0].Receipts, mocks.Rct1CID.String())).To(BeTrue())
|
Expect(eth.ReceiptModelsContainsCID(cids5[0].Receipts, test_helpers.Rct1CID.String())).To(BeTrue())
|
||||||
Expect(eth.ReceiptModelsContainsCID(cids5[0].Receipts, mocks.Rct2CID.String())).To(BeTrue())
|
Expect(eth.ReceiptModelsContainsCID(cids5[0].Receipts, test_helpers.Rct2CID.String())).To(BeTrue())
|
||||||
Expect(eth.ReceiptModelsContainsCID(cids5[0].Receipts, mocks.Rct3CID.String())).To(BeTrue())
|
Expect(eth.ReceiptModelsContainsCID(cids5[0].Receipts, test_helpers.Rct3CID.String())).To(BeTrue())
|
||||||
|
|
||||||
cids6, empty, err := retriever.Retrieve(rctsForSelectCollectedTrxs, 1)
|
cids6, empty, err := retriever.Retrieve(rctsForSelectCollectedTrxs, 1)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
Expect(len(cids6)).To(Equal(1))
|
Expect(len(cids6)).To(Equal(1))
|
||||||
Expect(cids6[0].BlockNumber).To(Equal(mocks.MockCIDWrapper.BlockNumber))
|
Expect(cids6[0].BlockNumber).To(Equal(test_helpers.MockCIDWrapper.BlockNumber))
|
||||||
Expect(cids6[0].Header).To(Equal(eth2.HeaderModel{}))
|
Expect(cids6[0].Header).To(Equal(eth2.HeaderModel{}))
|
||||||
Expect(len(cids6[0].Transactions)).To(Equal(1))
|
Expect(len(cids6[0].Transactions)).To(Equal(1))
|
||||||
expectedTxCID := mocks.MockCIDWrapper.Transactions[1]
|
expectedTxCID := test_helpers.MockCIDWrapper.Transactions[1]
|
||||||
expectedTxCID.ID = cids6[0].Transactions[0].ID
|
expectedTxCID.ID = cids6[0].Transactions[0].ID
|
||||||
expectedTxCID.HeaderID = cids6[0].Transactions[0].HeaderID
|
expectedTxCID.HeaderID = cids6[0].Transactions[0].HeaderID
|
||||||
Expect(cids6[0].Transactions[0]).To(Equal(expectedTxCID))
|
Expect(cids6[0].Transactions[0]).To(Equal(expectedTxCID))
|
||||||
Expect(len(cids6[0].StateNodes)).To(Equal(0))
|
Expect(len(cids6[0].StateNodes)).To(Equal(0))
|
||||||
Expect(len(cids6[0].StorageNodes)).To(Equal(0))
|
Expect(len(cids6[0].StorageNodes)).To(Equal(0))
|
||||||
Expect(len(cids6[0].Receipts)).To(Equal(1))
|
Expect(len(cids6[0].Receipts)).To(Equal(1))
|
||||||
expectedReceiptCID = mocks.MockCIDWrapper.Receipts[1]
|
expectedReceiptCID = test_helpers.MockCIDWrapper.Receipts[1]
|
||||||
expectedReceiptCID.ID = cids6[0].Receipts[0].ID
|
expectedReceiptCID.ID = cids6[0].Receipts[0].ID
|
||||||
expectedReceiptCID.TxID = cids6[0].Receipts[0].TxID
|
expectedReceiptCID.TxID = cids6[0].Receipts[0].TxID
|
||||||
Expect(cids6[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
Expect(cids6[0].Receipts[0]).To(Equal(expectedReceiptCID))
|
||||||
@ -369,7 +368,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(empty).ToNot(BeTrue())
|
Expect(empty).ToNot(BeTrue())
|
||||||
Expect(len(cids7)).To(Equal(1))
|
Expect(len(cids7)).To(Equal(1))
|
||||||
Expect(cids7[0].BlockNumber).To(Equal(mocks.MockCIDWrapper.BlockNumber))
|
Expect(cids7[0].BlockNumber).To(Equal(test_helpers.MockCIDWrapper.BlockNumber))
|
||||||
Expect(cids7[0].Header).To(Equal(eth2.HeaderModel{}))
|
Expect(cids7[0].Header).To(Equal(eth2.HeaderModel{}))
|
||||||
Expect(len(cids7[0].Transactions)).To(Equal(0))
|
Expect(len(cids7[0].Transactions)).To(Equal(0))
|
||||||
Expect(len(cids7[0].Receipts)).To(Equal(0))
|
Expect(len(cids7[0].Receipts)).To(Equal(0))
|
||||||
@ -379,9 +378,9 @@ var _ = Describe("Retriever", func() {
|
|||||||
ID: cids7[0].StateNodes[0].ID,
|
ID: cids7[0].StateNodes[0].ID,
|
||||||
HeaderID: cids7[0].StateNodes[0].HeaderID,
|
HeaderID: cids7[0].StateNodes[0].HeaderID,
|
||||||
NodeType: 2,
|
NodeType: 2,
|
||||||
StateKey: common.BytesToHash(mocks2.AccountLeafKey).Hex(),
|
StateKey: common.BytesToHash(test_helpers.AccountLeafKey).Hex(),
|
||||||
CID: mocks2.State2CID.String(),
|
CID: test_helpers.State2CID.String(),
|
||||||
MhKey: mocks2.State2MhKey,
|
MhKey: test_helpers.State2MhKey,
|
||||||
Path: []byte{'\x0c'},
|
Path: []byte{'\x0c'},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -397,7 +396,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
})
|
})
|
||||||
It("Gets the number of the first block that has data in the database", func() {
|
It("Gets the number of the first block that has data in the database", func() {
|
||||||
err := repo.Publish(mocks2.MockConvertedPayload)
|
err := repo.Publish(test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
num, err := retriever.RetrieveFirstBlockNumber()
|
num, err := retriever.RetrieveFirstBlockNumber()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -405,7 +404,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Gets the number of the first block that has data in the database", func() {
|
It("Gets the number of the first block that has data in the database", func() {
|
||||||
payload := mocks2.MockConvertedPayload
|
payload := test_helpers.MockConvertedPayload
|
||||||
payload.Block = newMockBlock(1010101)
|
payload.Block = newMockBlock(1010101)
|
||||||
err := repo.Publish(payload)
|
err := repo.Publish(payload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -415,7 +414,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Gets the number of the first block that has data in the database", func() {
|
It("Gets the number of the first block that has data in the database", func() {
|
||||||
payload1 := mocks2.MockConvertedPayload
|
payload1 := test_helpers.MockConvertedPayload
|
||||||
payload1.Block = newMockBlock(1010101)
|
payload1.Block = newMockBlock(1010101)
|
||||||
payload2 := payload1
|
payload2 := payload1
|
||||||
payload2.Block = newMockBlock(5)
|
payload2.Block = newMockBlock(5)
|
||||||
@ -435,7 +434,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
})
|
})
|
||||||
It("Gets the number of the latest block that has data in the database", func() {
|
It("Gets the number of the latest block that has data in the database", func() {
|
||||||
err := repo.Publish(mocks2.MockConvertedPayload)
|
err := repo.Publish(test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
num, err := retriever.RetrieveLastBlockNumber()
|
num, err := retriever.RetrieveLastBlockNumber()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -443,7 +442,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Gets the number of the latest block that has data in the database", func() {
|
It("Gets the number of the latest block that has data in the database", func() {
|
||||||
payload := mocks2.MockConvertedPayload
|
payload := test_helpers.MockConvertedPayload
|
||||||
payload.Block = newMockBlock(1010101)
|
payload.Block = newMockBlock(1010101)
|
||||||
err := repo.Publish(payload)
|
err := repo.Publish(payload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -453,7 +452,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Gets the number of the latest block that has data in the database", func() {
|
It("Gets the number of the latest block that has data in the database", func() {
|
||||||
payload1 := mocks2.MockConvertedPayload
|
payload1 := test_helpers.MockConvertedPayload
|
||||||
payload1.Block = newMockBlock(1010101)
|
payload1.Block = newMockBlock(1010101)
|
||||||
payload2 := payload1
|
payload2 := payload1
|
||||||
payload2.Block = newMockBlock(5)
|
payload2.Block = newMockBlock(5)
|
||||||
@ -469,7 +468,7 @@ var _ = Describe("Retriever", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
func newMockBlock(blockNumber uint64) *types.Block {
|
func newMockBlock(blockNumber uint64) *types.Block {
|
||||||
header := mocks2.MockHeader
|
header := test_helpers.MockHeader
|
||||||
header.Number.SetUint64(blockNumber)
|
header.Number.SetUint64(blockNumber)
|
||||||
return types.NewBlock(&mocks2.MockHeader, mocks2.MockTransactions, nil, mocks2.MockReceipts)
|
return types.NewBlock(&test_helpers.MockHeader, test_helpers.MockTransactions, nil, test_helpers.MockReceipts)
|
||||||
}
|
}
|
||||||
|
165
pkg/eth/eth_call_test.go
Normal file
165
pkg/eth/eth_call_test.go
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
// VulcanizeDB
|
||||||
|
// Copyright © 2019 Vulcanize
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package eth_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"io/ioutil"
|
||||||
|
"math/big"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
|
. "github.com/onsi/ginkgo"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
|
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth/test_helpers"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
parsedABI abi.ABI
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// load abi
|
||||||
|
abiBytes, err := ioutil.ReadFile("./test_helpers/abi.json")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
parsedABI, err = abi.JSON(bytes.NewReader(abiBytes))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ = Describe("eth_call", func() {
|
||||||
|
var (
|
||||||
|
blocks []*types.Block
|
||||||
|
receipts []types.Receipts
|
||||||
|
chain *core.BlockChain
|
||||||
|
db *postgres.DB
|
||||||
|
transformer *eth2.StateDiffTransformer
|
||||||
|
backend *eth.Backend
|
||||||
|
api *eth.PublicEthAPI
|
||||||
|
builder statediff.Builder
|
||||||
|
pams statediff.Params
|
||||||
|
chainConfig = params.TestChainConfig
|
||||||
|
mockTD = big.NewInt(1337)
|
||||||
|
)
|
||||||
|
|
||||||
|
BeforeEach(func() {
|
||||||
|
// db and type initializations
|
||||||
|
var err error
|
||||||
|
db, err = shared.SetupDB()
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
transformer = eth2.NewStateDiffTransformer(chainConfig, db)
|
||||||
|
backend, err = eth.NewEthBackend(db, ð.Config{
|
||||||
|
ChainConfig: chainConfig,
|
||||||
|
VmConfig: vm.Config{},
|
||||||
|
RPCGasCap: big.NewInt(10000000000),
|
||||||
|
})
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
api = eth.NewPublicEthAPI(backend)
|
||||||
|
|
||||||
|
// make the test blockchain (and state)
|
||||||
|
blocks, receipts, chain = test_helpers.MakeChain(4, test_helpers.Genesis, test_helpers.TestChainGen)
|
||||||
|
pams = statediff.Params{
|
||||||
|
IntermediateStateNodes: true,
|
||||||
|
IntermediateStorageNodes: true,
|
||||||
|
}
|
||||||
|
// iterate over the blocks, generating statediff payloads, and transforming the data into Postgres
|
||||||
|
builder = statediff.NewBuilder(chain.StateCache())
|
||||||
|
for i, block := range blocks {
|
||||||
|
var args statediff.Args
|
||||||
|
var rcts types.Receipts
|
||||||
|
if i == 0 {
|
||||||
|
args = statediff.Args{
|
||||||
|
OldStateRoot: common.Hash{},
|
||||||
|
NewStateRoot: block.Root(),
|
||||||
|
BlockNumber: block.Number(),
|
||||||
|
BlockHash: block.Hash(),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
args = statediff.Args{
|
||||||
|
OldStateRoot: blocks[i-1].Root(),
|
||||||
|
NewStateRoot: block.Root(),
|
||||||
|
BlockNumber: block.Number(),
|
||||||
|
BlockHash: block.Hash(),
|
||||||
|
}
|
||||||
|
rcts = receipts[i-1]
|
||||||
|
}
|
||||||
|
diff, err := builder.BuildStateDiffObject(args, pams)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
diffRlp, err := rlp.EncodeToBytes(diff)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
blockRlp, err := rlp.EncodeToBytes(block)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
receiptsRlp, err := rlp.EncodeToBytes(rcts)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
payload := statediff.Payload{
|
||||||
|
StateObjectRlp: diffRlp,
|
||||||
|
BlockRlp: blockRlp,
|
||||||
|
ReceiptsRlp: receiptsRlp,
|
||||||
|
TotalDifficulty: mockTD,
|
||||||
|
}
|
||||||
|
_, err = transformer.Transform(0, payload)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
AfterEach(func() {
|
||||||
|
eth.TearDownDB(db)
|
||||||
|
chain.Stop()
|
||||||
|
})
|
||||||
|
Describe("eth_call", func() {
|
||||||
|
It("Applies call args (tx data) on top of state, returning the result (e.g. a Getter method call)", func() {
|
||||||
|
data, err := parsedABI.Pack("data")
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
bdata := hexutil.Bytes(data)
|
||||||
|
callArgs := eth.CallArgs{
|
||||||
|
To: &test_helpers.ContractAddr,
|
||||||
|
Data: &bdata,
|
||||||
|
}
|
||||||
|
res, err := api.Call(context.Background(), callArgs, rpc.BlockNumberOrHashWithNumber(2), nil)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
expectedRes := hexutil.Bytes(common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000001"))
|
||||||
|
Expect(res).To(Equal(expectedRes))
|
||||||
|
|
||||||
|
res, err = api.Call(context.Background(), callArgs, rpc.BlockNumberOrHashWithNumber(3), nil)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
expectedRes = hexutil.Bytes(common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000003"))
|
||||||
|
Expect(res).To(Equal(expectedRes))
|
||||||
|
|
||||||
|
res, err = api.Call(context.Background(), callArgs, rpc.BlockNumberOrHashWithNumber(4), nil)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
expectedRes = hexutil.Bytes(common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000009"))
|
||||||
|
Expect(res).To(Equal(expectedRes))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
@ -18,16 +18,15 @@ package eth_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth/mocks"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/statediff"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
mocks2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth/mocks"
|
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,45 +41,45 @@ var _ = Describe("Filterer", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Transcribes all the data from the IPLDPayload into the StreamPayload if given an open filter", func() {
|
It("Transcribes all the data from the IPLDPayload into the StreamPayload if given an open filter", func() {
|
||||||
iplds, err := filterer.Filter(openFilter, mocks.MockConvertedPayload)
|
iplds, err := filterer.Filter(openFilter, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds).ToNot(BeNil())
|
Expect(iplds).ToNot(BeNil())
|
||||||
Expect(iplds.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds.Header).To(Equal(mocks.MockIPLDs.Header))
|
Expect(iplds.Header).To(Equal(test_helpers.MockIPLDs.Header))
|
||||||
var expectedEmptyUncles []ipfs.BlockModel
|
var expectedEmptyUncles []ipfs.BlockModel
|
||||||
Expect(iplds.Uncles).To(Equal(expectedEmptyUncles))
|
Expect(iplds.Uncles).To(Equal(expectedEmptyUncles))
|
||||||
Expect(len(iplds.Transactions)).To(Equal(3))
|
Expect(len(iplds.Transactions)).To(Equal(3))
|
||||||
Expect(shared.IPLDsContainBytes(iplds.Transactions, mocks.MockTransactions.GetRlp(0))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds.Transactions, test_helpers.MockTransactions.GetRlp(0))).To(BeTrue())
|
||||||
Expect(shared.IPLDsContainBytes(iplds.Transactions, mocks.MockTransactions.GetRlp(1))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds.Transactions, test_helpers.MockTransactions.GetRlp(1))).To(BeTrue())
|
||||||
Expect(shared.IPLDsContainBytes(iplds.Transactions, mocks.MockTransactions.GetRlp(2))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds.Transactions, test_helpers.MockTransactions.GetRlp(2))).To(BeTrue())
|
||||||
Expect(len(iplds.Receipts)).To(Equal(3))
|
Expect(len(iplds.Receipts)).To(Equal(3))
|
||||||
Expect(shared.IPLDsContainBytes(iplds.Receipts, mocks.MockReceipts.GetRlp(0))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds.Receipts, test_helpers.MockReceipts.GetRlp(0))).To(BeTrue())
|
||||||
Expect(shared.IPLDsContainBytes(iplds.Receipts, mocks.MockReceipts.GetRlp(1))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds.Receipts, test_helpers.MockReceipts.GetRlp(1))).To(BeTrue())
|
||||||
Expect(shared.IPLDsContainBytes(iplds.Receipts, mocks.MockReceipts.GetRlp(2))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds.Receipts, test_helpers.MockReceipts.GetRlp(2))).To(BeTrue())
|
||||||
Expect(len(iplds.StateNodes)).To(Equal(2))
|
Expect(len(iplds.StateNodes)).To(Equal(2))
|
||||||
for _, stateNode := range iplds.StateNodes {
|
for _, stateNode := range iplds.StateNodes {
|
||||||
Expect(stateNode.Type).To(Equal(statediff.Leaf))
|
Expect(stateNode.Type).To(Equal(statediff.Leaf))
|
||||||
if bytes.Equal(stateNode.StateLeafKey.Bytes(), mocks.AccountLeafKey) {
|
if bytes.Equal(stateNode.StateLeafKey.Bytes(), test_helpers.AccountLeafKey) {
|
||||||
Expect(stateNode.IPLD).To(Equal(ipfs.BlockModel{
|
Expect(stateNode.IPLD).To(Equal(ipfs.BlockModel{
|
||||||
Data: mocks.State2IPLD.RawData(),
|
Data: test_helpers.State2IPLD.RawData(),
|
||||||
CID: mocks.State2IPLD.Cid().String(),
|
CID: test_helpers.State2IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
if bytes.Equal(stateNode.StateLeafKey.Bytes(), mocks.ContractLeafKey) {
|
if bytes.Equal(stateNode.StateLeafKey.Bytes(), test_helpers.ContractLeafKey) {
|
||||||
Expect(stateNode.IPLD).To(Equal(ipfs.BlockModel{
|
Expect(stateNode.IPLD).To(Equal(ipfs.BlockModel{
|
||||||
Data: mocks.State1IPLD.RawData(),
|
Data: test_helpers.State1IPLD.RawData(),
|
||||||
CID: mocks.State1IPLD.Cid().String(),
|
CID: test_helpers.State1IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expect(iplds.StorageNodes).To(Equal(mocks.MockIPLDs.StorageNodes))
|
Expect(iplds.StorageNodes).To(Equal(test_helpers.MockIPLDs.StorageNodes))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Applies filters from the provided config.Subscription", func() {
|
It("Applies filters from the provided config.Subscription", func() {
|
||||||
iplds1, err := filterer.Filter(rctAddressFilter, mocks.MockConvertedPayload)
|
iplds1, err := filterer.Filter(rctAddressFilter, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds1).ToNot(BeNil())
|
Expect(iplds1).ToNot(BeNil())
|
||||||
Expect(iplds1.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds1.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds1.Header).To(Equal(ipfs.BlockModel{}))
|
Expect(iplds1.Header).To(Equal(ipfs.BlockModel{}))
|
||||||
Expect(len(iplds1.Uncles)).To(Equal(0))
|
Expect(len(iplds1.Uncles)).To(Equal(0))
|
||||||
Expect(len(iplds1.Transactions)).To(Equal(0))
|
Expect(len(iplds1.Transactions)).To(Equal(0))
|
||||||
@ -88,14 +87,14 @@ 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(ipfs.BlockModel{
|
Expect(iplds1.Receipts[0]).To(Equal(ipfs.BlockModel{
|
||||||
Data: mocks.Rct1IPLD.RawData(),
|
Data: test_helpers.Rct1IPLD.RawData(),
|
||||||
CID: mocks.Rct1IPLD.Cid().String(),
|
CID: test_helpers.Rct1IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
iplds2, err := filterer.Filter(rctTopicsFilter, mocks.MockConvertedPayload)
|
iplds2, err := filterer.Filter(rctTopicsFilter, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds2).ToNot(BeNil())
|
Expect(iplds2).ToNot(BeNil())
|
||||||
Expect(iplds2.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds2.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds2.Header).To(Equal(ipfs.BlockModel{}))
|
Expect(iplds2.Header).To(Equal(ipfs.BlockModel{}))
|
||||||
Expect(len(iplds2.Uncles)).To(Equal(0))
|
Expect(len(iplds2.Uncles)).To(Equal(0))
|
||||||
Expect(len(iplds2.Transactions)).To(Equal(0))
|
Expect(len(iplds2.Transactions)).To(Equal(0))
|
||||||
@ -103,14 +102,14 @@ 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(ipfs.BlockModel{
|
Expect(iplds2.Receipts[0]).To(Equal(ipfs.BlockModel{
|
||||||
Data: mocks.Rct1IPLD.RawData(),
|
Data: test_helpers.Rct1IPLD.RawData(),
|
||||||
CID: mocks.Rct1IPLD.Cid().String(),
|
CID: test_helpers.Rct1IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
iplds3, err := filterer.Filter(rctTopicsAndAddressFilter, mocks2.MockConvertedPayload)
|
iplds3, err := filterer.Filter(rctTopicsAndAddressFilter, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds3).ToNot(BeNil())
|
Expect(iplds3).ToNot(BeNil())
|
||||||
Expect(iplds3.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds3.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds3.Header).To(Equal(ipfs.BlockModel{}))
|
Expect(iplds3.Header).To(Equal(ipfs.BlockModel{}))
|
||||||
Expect(len(iplds3.Uncles)).To(Equal(0))
|
Expect(len(iplds3.Uncles)).To(Equal(0))
|
||||||
Expect(len(iplds3.Transactions)).To(Equal(0))
|
Expect(len(iplds3.Transactions)).To(Equal(0))
|
||||||
@ -118,14 +117,14 @@ 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(ipfs.BlockModel{
|
Expect(iplds3.Receipts[0]).To(Equal(ipfs.BlockModel{
|
||||||
Data: mocks.Rct1IPLD.RawData(),
|
Data: test_helpers.Rct1IPLD.RawData(),
|
||||||
CID: mocks.Rct1IPLD.Cid().String(),
|
CID: test_helpers.Rct1IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
iplds4, err := filterer.Filter(rctAddressesAndTopicFilter, mocks.MockConvertedPayload)
|
iplds4, err := filterer.Filter(rctAddressesAndTopicFilter, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds4).ToNot(BeNil())
|
Expect(iplds4).ToNot(BeNil())
|
||||||
Expect(iplds4.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds4.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds4.Header).To(Equal(ipfs.BlockModel{}))
|
Expect(iplds4.Header).To(Equal(ipfs.BlockModel{}))
|
||||||
Expect(len(iplds4.Uncles)).To(Equal(0))
|
Expect(len(iplds4.Uncles)).To(Equal(0))
|
||||||
Expect(len(iplds4.Transactions)).To(Equal(0))
|
Expect(len(iplds4.Transactions)).To(Equal(0))
|
||||||
@ -133,63 +132,63 @@ 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(ipfs.BlockModel{
|
Expect(iplds4.Receipts[0]).To(Equal(ipfs.BlockModel{
|
||||||
Data: mocks.Rct2IPLD.RawData(),
|
Data: test_helpers.Rct2IPLD.RawData(),
|
||||||
CID: mocks.Rct2IPLD.Cid().String(),
|
CID: test_helpers.Rct2IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
iplds5, err := filterer.Filter(rctsForAllCollectedTrxs, mocks.MockConvertedPayload)
|
iplds5, err := filterer.Filter(rctsForAllCollectedTrxs, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds5).ToNot(BeNil())
|
Expect(iplds5).ToNot(BeNil())
|
||||||
Expect(iplds5.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds5.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds5.Header).To(Equal(ipfs.BlockModel{}))
|
Expect(iplds5.Header).To(Equal(ipfs.BlockModel{}))
|
||||||
Expect(len(iplds5.Uncles)).To(Equal(0))
|
Expect(len(iplds5.Uncles)).To(Equal(0))
|
||||||
Expect(len(iplds5.Transactions)).To(Equal(3))
|
Expect(len(iplds5.Transactions)).To(Equal(3))
|
||||||
Expect(shared.IPLDsContainBytes(iplds5.Transactions, mocks.MockTransactions.GetRlp(0))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds5.Transactions, test_helpers.MockTransactions.GetRlp(0))).To(BeTrue())
|
||||||
Expect(shared.IPLDsContainBytes(iplds5.Transactions, mocks.MockTransactions.GetRlp(1))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds5.Transactions, test_helpers.MockTransactions.GetRlp(1))).To(BeTrue())
|
||||||
Expect(shared.IPLDsContainBytes(iplds5.Transactions, mocks.MockTransactions.GetRlp(2))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds5.Transactions, test_helpers.MockTransactions.GetRlp(2))).To(BeTrue())
|
||||||
Expect(len(iplds5.StorageNodes)).To(Equal(0))
|
Expect(len(iplds5.StorageNodes)).To(Equal(0))
|
||||||
Expect(len(iplds5.StateNodes)).To(Equal(0))
|
Expect(len(iplds5.StateNodes)).To(Equal(0))
|
||||||
Expect(len(iplds5.Receipts)).To(Equal(3))
|
Expect(len(iplds5.Receipts)).To(Equal(3))
|
||||||
Expect(shared.IPLDsContainBytes(iplds5.Receipts, mocks.MockReceipts.GetRlp(0))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds5.Receipts, test_helpers.MockReceipts.GetRlp(0))).To(BeTrue())
|
||||||
Expect(shared.IPLDsContainBytes(iplds5.Receipts, mocks.MockReceipts.GetRlp(1))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds5.Receipts, test_helpers.MockReceipts.GetRlp(1))).To(BeTrue())
|
||||||
Expect(shared.IPLDsContainBytes(iplds5.Receipts, mocks.MockReceipts.GetRlp(2))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds5.Receipts, test_helpers.MockReceipts.GetRlp(2))).To(BeTrue())
|
||||||
|
|
||||||
iplds6, err := filterer.Filter(rctsForSelectCollectedTrxs, mocks.MockConvertedPayload)
|
iplds6, err := filterer.Filter(rctsForSelectCollectedTrxs, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds6).ToNot(BeNil())
|
Expect(iplds6).ToNot(BeNil())
|
||||||
Expect(iplds6.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds6.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds6.Header).To(Equal(ipfs.BlockModel{}))
|
Expect(iplds6.Header).To(Equal(ipfs.BlockModel{}))
|
||||||
Expect(len(iplds6.Uncles)).To(Equal(0))
|
Expect(len(iplds6.Uncles)).To(Equal(0))
|
||||||
Expect(len(iplds6.Transactions)).To(Equal(1))
|
Expect(len(iplds6.Transactions)).To(Equal(1))
|
||||||
Expect(shared.IPLDsContainBytes(iplds5.Transactions, mocks.MockTransactions.GetRlp(1))).To(BeTrue())
|
Expect(shared.IPLDsContainBytes(iplds5.Transactions, test_helpers.MockTransactions.GetRlp(1))).To(BeTrue())
|
||||||
Expect(len(iplds6.StorageNodes)).To(Equal(0))
|
Expect(len(iplds6.StorageNodes)).To(Equal(0))
|
||||||
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(ipfs.BlockModel{
|
Expect(iplds4.Receipts[0]).To(Equal(ipfs.BlockModel{
|
||||||
Data: mocks.Rct2IPLD.RawData(),
|
Data: test_helpers.Rct2IPLD.RawData(),
|
||||||
CID: mocks.Rct2IPLD.Cid().String(),
|
CID: test_helpers.Rct2IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
iplds7, err := filterer.Filter(stateFilter, mocks2.MockConvertedPayload)
|
iplds7, err := filterer.Filter(stateFilter, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds7).ToNot(BeNil())
|
Expect(iplds7).ToNot(BeNil())
|
||||||
Expect(iplds7.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds7.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds7.Header).To(Equal(ipfs.BlockModel{}))
|
Expect(iplds7.Header).To(Equal(ipfs.BlockModel{}))
|
||||||
Expect(len(iplds7.Uncles)).To(Equal(0))
|
Expect(len(iplds7.Uncles)).To(Equal(0))
|
||||||
Expect(len(iplds7.Transactions)).To(Equal(0))
|
Expect(len(iplds7.Transactions)).To(Equal(0))
|
||||||
Expect(len(iplds7.StorageNodes)).To(Equal(0))
|
Expect(len(iplds7.StorageNodes)).To(Equal(0))
|
||||||
Expect(len(iplds7.Receipts)).To(Equal(0))
|
Expect(len(iplds7.Receipts)).To(Equal(0))
|
||||||
Expect(len(iplds7.StateNodes)).To(Equal(1))
|
Expect(len(iplds7.StateNodes)).To(Equal(1))
|
||||||
Expect(iplds7.StateNodes[0].StateLeafKey.Bytes()).To(Equal(mocks2.AccountLeafKey))
|
Expect(iplds7.StateNodes[0].StateLeafKey.Bytes()).To(Equal(test_helpers.AccountLeafKey))
|
||||||
Expect(iplds7.StateNodes[0].IPLD).To(Equal(ipfs.BlockModel{
|
Expect(iplds7.StateNodes[0].IPLD).To(Equal(ipfs.BlockModel{
|
||||||
Data: mocks2.State2IPLD.RawData(),
|
Data: test_helpers.State2IPLD.RawData(),
|
||||||
CID: mocks2.State2IPLD.Cid().String(),
|
CID: test_helpers.State2IPLD.Cid().String(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
iplds8, err := filterer.Filter(rctTopicsAndAddressFilterFail, mocks2.MockConvertedPayload)
|
iplds8, err := filterer.Filter(rctTopicsAndAddressFilterFail, test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds8).ToNot(BeNil())
|
Expect(iplds8).ToNot(BeNil())
|
||||||
Expect(iplds8.BlockNumber.Int64()).To(Equal(mocks.MockIPLDs.BlockNumber.Int64()))
|
Expect(iplds8.BlockNumber.Int64()).To(Equal(test_helpers.MockIPLDs.BlockNumber.Int64()))
|
||||||
Expect(iplds8.Header).To(Equal(ipfs.BlockModel{}))
|
Expect(iplds8.Header).To(Equal(ipfs.BlockModel{}))
|
||||||
Expect(len(iplds8.Uncles)).To(Equal(0))
|
Expect(len(iplds8.Uncles)).To(Equal(0))
|
||||||
Expect(len(iplds8.Transactions)).To(Equal(0))
|
Expect(len(iplds8.Transactions)).To(Equal(0))
|
||||||
|
@ -23,21 +23,6 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/statediff"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ResolveFromNodeType(nodeType statediff.NodeType) int {
|
|
||||||
switch nodeType {
|
|
||||||
case statediff.Branch:
|
|
||||||
return 0
|
|
||||||
case statediff.Extension:
|
|
||||||
return 1
|
|
||||||
case statediff.Leaf:
|
|
||||||
return 2
|
|
||||||
case statediff.Removed:
|
|
||||||
return 3
|
|
||||||
default:
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func ResolveToNodeType(nodeType int) statediff.NodeType {
|
func ResolveToNodeType(nodeType int) statediff.NodeType {
|
||||||
switch nodeType {
|
switch nodeType {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -19,29 +19,28 @@ package eth_test
|
|||||||
import (
|
import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth/mocks"
|
|
||||||
|
|
||||||
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth/test_helpers"
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var _ = Describe("IPLDFetcher", func() {
|
||||||
|
var (
|
||||||
db *postgres.DB
|
db *postgres.DB
|
||||||
pubAndIndexer *eth2.IPLDPublisher
|
pubAndIndexer *eth2.IPLDPublisher
|
||||||
fetcher *eth.IPLDFetcher
|
fetcher *eth.IPLDFetcher
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("IPLDFetcher", func() {
|
|
||||||
Describe("Fetch", func() {
|
Describe("Fetch", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
var err error
|
var err error
|
||||||
db, err = shared.SetupDB()
|
db, err = shared.SetupDB()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
pubAndIndexer = eth2.NewIPLDPublisher(db)
|
pubAndIndexer = eth2.NewIPLDPublisher(db)
|
||||||
err = pubAndIndexer.Publish(mocks.MockConvertedPayload)
|
err = pubAndIndexer.Publish(test_helpers.MockConvertedPayload)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
fetcher = eth.NewIPLDFetcher(db)
|
fetcher = eth.NewIPLDFetcher(db)
|
||||||
})
|
})
|
||||||
@ -50,17 +49,17 @@ var _ = Describe("IPLDFetcher", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Fetches and returns IPLDs for the CIDs provided in the CIDWrapper", func() {
|
It("Fetches and returns IPLDs for the CIDs provided in the CIDWrapper", func() {
|
||||||
iplds, err := fetcher.Fetch(*mocks.MockCIDWrapper)
|
iplds, err := fetcher.Fetch(*test_helpers.MockCIDWrapper)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(iplds).ToNot(BeNil())
|
Expect(iplds).ToNot(BeNil())
|
||||||
Expect(iplds.TotalDifficulty).To(Equal(mocks.MockConvertedPayload.TotalDifficulty))
|
Expect(iplds.TotalDifficulty).To(Equal(test_helpers.MockConvertedPayload.TotalDifficulty))
|
||||||
Expect(iplds.BlockNumber).To(Equal(mocks.MockConvertedPayload.Block.Number()))
|
Expect(iplds.BlockNumber).To(Equal(test_helpers.MockConvertedPayload.Block.Number()))
|
||||||
Expect(iplds.Header).To(Equal(mocks.MockIPLDs.Header))
|
Expect(iplds.Header).To(Equal(test_helpers.MockIPLDs.Header))
|
||||||
Expect(len(iplds.Uncles)).To(Equal(0))
|
Expect(len(iplds.Uncles)).To(Equal(0))
|
||||||
Expect(iplds.Transactions).To(Equal(mocks.MockIPLDs.Transactions))
|
Expect(iplds.Transactions).To(Equal(test_helpers.MockIPLDs.Transactions))
|
||||||
Expect(iplds.Receipts).To(Equal(mocks.MockIPLDs.Receipts))
|
Expect(iplds.Receipts).To(Equal(test_helpers.MockIPLDs.Receipts))
|
||||||
Expect(iplds.StateNodes).To(Equal(mocks.MockIPLDs.StateNodes))
|
Expect(iplds.StateNodes).To(Equal(test_helpers.MockIPLDs.StateNodes))
|
||||||
Expect(iplds.StorageNodes).To(Equal(mocks.MockIPLDs.StorageNodes))
|
Expect(iplds.StorageNodes).To(Equal(test_helpers.MockIPLDs.StorageNodes))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
357
pkg/eth/ipld_retriever.go
Normal file
357
pkg/eth/ipld_retriever.go
Normal file
@ -0,0 +1,357 @@
|
|||||||
|
// VulcanizeDB
|
||||||
|
// Copyright © 2019 Vulcanize
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package eth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
|
"github.com/lib/pq"
|
||||||
|
|
||||||
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
RetrieveHeadersByHashesPgStr = `SELECT cid, data FROM eth.header_cids
|
||||||
|
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
||||||
|
WHERE block_hash = ANY($1::VARCHAR(66)[])`
|
||||||
|
RetrieveHeadersByBlockNumberPgStr = `SELECT cid, data FROM eth.header_cids
|
||||||
|
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
||||||
|
WHERE block_number = $1`
|
||||||
|
RetrieveHeaderByHashPgStr = `SELECT cid, data FROM eth.header_cids
|
||||||
|
INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key)
|
||||||
|
WHERE block_hash = $1`
|
||||||
|
RetrieveUnclesByHashesPgStr = `SELECT cid, data FROM eth.uncle_cids
|
||||||
|
INNER JOIN public.blocks ON (uncle_cids.mh_key = blocks.key)
|
||||||
|
WHERE block_hash = ANY($1::VARCHAR(66)[])`
|
||||||
|
RetrieveUnclesByBlockHashPgStr = `SELECT cid, data FROM eth.uncle_cids, eth.header_cids, public.blocks
|
||||||
|
WHERE uncle_cids.header_id = header_cids.id
|
||||||
|
AND uncle_cids.mh_key = blocks.key
|
||||||
|
AND block_hash = $1`
|
||||||
|
RetrieveUnclesByBlockNumberPgStr = `SELECT cid, data FROM eth.uncle_cids, eth.header_cids, public.blocks
|
||||||
|
WHERE uncle_cids.header_id = header_cids.id
|
||||||
|
AND uncle_cids.mh_key = blocks.key
|
||||||
|
AND block_number = $1`
|
||||||
|
RetrieveUncleByHashPgStr = `SELECT cid, data FROM eth.uncle_cids
|
||||||
|
INNER JOIN public.blocks ON (uncle_cids.mh_key = blocks.key)
|
||||||
|
WHERE block_hash = $1`
|
||||||
|
RetrieveTransactionsByHashesPgStr = `SELECT cid, data FROM eth.transaction_cids
|
||||||
|
INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key)
|
||||||
|
WHERE tx_hash = ANY($1::VARCHAR(66)[])`
|
||||||
|
RetrieveTransactionsByBlockHashPgStr = `SELECT cid, data FROM eth.transaction_cids, eth.header_cids, public.blocks
|
||||||
|
WHERE transaction_cids.header_id = header_cids.id
|
||||||
|
AND transaction_cids.mh_key = blocks.key
|
||||||
|
AND block_hash = $1`
|
||||||
|
RetrieveTransactionsByBlockNumberPgStr = `SELECT cid, data FROM eth.transaction_cids, eth.header_cids, public.blocks
|
||||||
|
WHERE transaction_cids.header_id = header_cids.id
|
||||||
|
AND transaction_cids.mh_key = blocks.key
|
||||||
|
AND block_number = $1`
|
||||||
|
RetrieveTransactionByHashPgStr = `SELECT cid, data FROM eth.transaction_cids
|
||||||
|
INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key)
|
||||||
|
WHERE tx_hash = $1`
|
||||||
|
RetrieveReceiptsByTxHashesPgStr = `SELECT cid, data FROM eth.receipt_cids, eth.transaction_cids, public.blocks
|
||||||
|
WHERE receipt_cids.mh_key = blocks.key
|
||||||
|
AND receipt_cids.tx_id = transaction_cids.id
|
||||||
|
AND tx_hash = ANY($1::VARCHAR(66)[])`
|
||||||
|
RetrieveReceiptsByBlockHashPgStr = `SELECT cid, data FROM eth.receipt_cids, eth.transaction_cids, eth.header_cids, public.blocks
|
||||||
|
WHERE receipt_cids.tx_id = transaction_cids.id
|
||||||
|
AND transaction_cids.header_id = header_cids.id
|
||||||
|
AND receipt_cids.mh_key = blocks.key
|
||||||
|
AND block_hash = $1`
|
||||||
|
RetrieveReceiptsByBlockNumberPgStr = `SELECT cid, data FROM eth.receipt_cids, eth.transaction_cids, eth.header_cids, public.blocks
|
||||||
|
WHERE receipt_cids.tx_id = transaction_cids.id
|
||||||
|
AND transaction_cids.header_id = header_cids.id
|
||||||
|
AND receipt_cids.mh_key = blocks.key
|
||||||
|
AND block_number = $1`
|
||||||
|
RetrieveReceiptByTxHashPgStr = `SELECT cid, data FROM eth.receipt_cids, eth.transaction_cids, eth.receipt_cids
|
||||||
|
WHERE receipt_cids.mh_key = blocks.key
|
||||||
|
AND receipt_cids.tx_id = transaction_cids.id
|
||||||
|
AND tx_hash = $1`
|
||||||
|
RetrieveAccountByLeafKeyAndBlockHashPgStr = `SELECT cid, data FROM eth.state_cids, eth.header_cids, public.blocks
|
||||||
|
WHERE state_cids.header_id = header_cids.id
|
||||||
|
AND state_cids.mh_key = blocks.key
|
||||||
|
AND state_leaf_key = $1
|
||||||
|
AND block_hash = $2`
|
||||||
|
RetrieveAccountByLeafKeyAndBlockNumberPgStr = `SELECT cid, data FROM eth.state_cids, eth.header_cids, public.blocks
|
||||||
|
WHERE state_cids.header_id = header_cids.id
|
||||||
|
AND state_cids.mh_key = blocks.key
|
||||||
|
AND state_leaf_key = $1
|
||||||
|
AND block_number = $2`
|
||||||
|
)
|
||||||
|
|
||||||
|
type ipldResult struct {
|
||||||
|
cid string `db:"cid"`
|
||||||
|
data []byte `db:"data"`
|
||||||
|
}
|
||||||
|
type IPLDRetriever struct {
|
||||||
|
db *postgres.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIPLDRetriever(db *postgres.DB) *IPLDRetriever {
|
||||||
|
return &IPLDRetriever{
|
||||||
|
db: db,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveHeadersByHashes returns the cids and rlp bytes for the headers corresponding to the provided block hashes
|
||||||
|
func (r *IPLDRetriever) RetrieveHeadersByHashes(hashes []common.Hash) ([]string, [][]byte, error) {
|
||||||
|
headerResults := make([]ipldResult, 0)
|
||||||
|
hashStrs := make([]string, len(hashes))
|
||||||
|
for i, hash := range hashes {
|
||||||
|
hashStrs[i] = hash.Hex()
|
||||||
|
}
|
||||||
|
if err := r.db.Select(&headerResults, RetrieveHeadersByHashesPgStr, pq.Array(hashStrs)); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(headerResults))
|
||||||
|
headers := make([][]byte, len(headerResults))
|
||||||
|
for i, res := range headerResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
headers[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, headers, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveHeadersByBlockNumber returns the cids and rlp bytes for the headers corresponding to the provided block number
|
||||||
|
// This can return more than one result since there can be more than one header (non-canonical headers)
|
||||||
|
func (r *IPLDRetriever) RetrieveHeadersByBlockNumber(number uint64) ([]string, [][]byte, error) {
|
||||||
|
headerResults := make([]ipldResult, 0)
|
||||||
|
if err := r.db.Select(&headerResults, RetrieveHeadersByBlockNumberPgStr, number); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(headerResults))
|
||||||
|
headers := make([][]byte, len(headerResults))
|
||||||
|
for i, res := range headerResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
headers[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, headers, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveHeaderByHash returns the cid and rlp bytes for the header corresponding to the provided block hash
|
||||||
|
func (r *IPLDRetriever) RetrieveHeaderByHash(hash common.Hash) (string, []byte, error) {
|
||||||
|
headerResult := new(ipldResult)
|
||||||
|
return headerResult.cid, headerResult.data, r.db.Get(headerResult, RetrieveHeaderByHashPgStr, hash.Hex())
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveUnclesByHashes returns the cids and rlp bytes for the uncles corresponding to the provided uncle hashes
|
||||||
|
func (r *IPLDRetriever) RetrieveUnclesByHashes(hashes []common.Hash) ([]string, [][]byte, error) {
|
||||||
|
uncleResults := make([]ipldResult, 0)
|
||||||
|
hashStrs := make([]string, len(hashes))
|
||||||
|
for i, hash := range hashes {
|
||||||
|
hashStrs[i] = hash.Hex()
|
||||||
|
}
|
||||||
|
if err := r.db.Select(&uncleResults, RetrieveUnclesByHashesPgStr, pq.Array(hashStrs)); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(uncleResults))
|
||||||
|
uncles := make([][]byte, len(uncleResults))
|
||||||
|
for i, res := range uncleResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
uncles[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, uncles, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveUnclesByBlockHash returns the cids and rlp bytes for the uncles corresponding to the provided block hash (of non-omner root block)
|
||||||
|
func (r *IPLDRetriever) RetrieveUnclesByBlockHash(hash common.Hash) ([]string, [][]byte, error) {
|
||||||
|
uncleResults := make([]ipldResult, 0)
|
||||||
|
if err := r.db.Select(&uncleResults, RetrieveUnclesByBlockHashPgStr, hash.Hex()); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(uncleResults))
|
||||||
|
uncles := make([][]byte, len(uncleResults))
|
||||||
|
for i, res := range uncleResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
uncles[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, uncles, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveUnclesByBlockNumber returns the cids and rlp bytes for the uncles corresponding to the provided block number (of non-omner root block)
|
||||||
|
func (r *IPLDRetriever) RetrieveUnclesByBlockNumber(number uint64) ([]string, [][]byte, error) {
|
||||||
|
uncleResults := make([]ipldResult, 0)
|
||||||
|
if err := r.db.Select(&uncleResults, RetrieveUnclesByBlockNumberPgStr, number); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(uncleResults))
|
||||||
|
uncles := make([][]byte, len(uncleResults))
|
||||||
|
for i, res := range uncleResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
uncles[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, uncles, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveUncleByHash returns the cid and rlp bytes for the uncle corresponding to the provided uncle hash
|
||||||
|
func (r *IPLDRetriever) RetrieveUncleByHash(hash common.Hash) (string, []byte, error) {
|
||||||
|
uncleResult := new(ipldResult)
|
||||||
|
return uncleResult.cid, uncleResult.data, r.db.Get(uncleResult, RetrieveUncleByHashPgStr, hash.Hex())
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveTransactionsByHashes returns the cids and rlp bytes for the transactions corresponding to the provided tx hashes
|
||||||
|
func (r *IPLDRetriever) RetrieveTransactionsByHashes(hashes []common.Hash) ([]string, [][]byte, error) {
|
||||||
|
txResults := make([]ipldResult, 0)
|
||||||
|
hashStrs := make([]string, len(hashes))
|
||||||
|
for i, hash := range hashes {
|
||||||
|
hashStrs[i] = hash.Hex()
|
||||||
|
}
|
||||||
|
if err := r.db.Select(&txResults, RetrieveTransactionsByHashesPgStr, pq.Array(hashStrs)); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(txResults))
|
||||||
|
txs := make([][]byte, len(txResults))
|
||||||
|
for i, res := range txResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
txs[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, txs, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveTransactionsByBlockHash returns the cids and rlp bytes for the transactions corresponding to the provided block hash
|
||||||
|
func (r *IPLDRetriever) RetrieveTransactionsByBlockHash(hash common.Hash) ([]string, [][]byte, error) {
|
||||||
|
txResults := make([]ipldResult, 0)
|
||||||
|
if err := r.db.Select(&txResults, RetrieveTransactionsByBlockHashPgStr, hash.Hex()); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(txResults))
|
||||||
|
txs := make([][]byte, len(txResults))
|
||||||
|
for i, res := range txResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
txs[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, txs, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveTransactionsByBlockNumber returns the cids and rlp bytes for the transactions corresponding to the provided block number
|
||||||
|
func (r *IPLDRetriever) RetrieveTransactionsByBlockNumber(number uint64) ([]string, [][]byte, error) {
|
||||||
|
txResults := make([]ipldResult, 0)
|
||||||
|
if err := r.db.Select(&txResults, RetrieveTransactionsByBlockNumberPgStr, number); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(txResults))
|
||||||
|
txs := make([][]byte, len(txResults))
|
||||||
|
for i, res := range txResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
txs[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, txs, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveTransactionByTxHash returns the cid and rlp bytes for the transaction corresponding to the provided tx hash
|
||||||
|
func (r *IPLDRetriever) RetrieveTransactionByTxHash(hash common.Hash) (string, []byte, error) {
|
||||||
|
txResult := new(ipldResult)
|
||||||
|
return txResult.cid, txResult.data, r.db.Get(txResult, RetrieveTransactionByHashPgStr, hash.Hex())
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveReceiptsByTxHashes returns the cids and rlp bytes for the receipts corresponding to the provided tx hashes
|
||||||
|
func (r *IPLDRetriever) RetrieveReceiptsByTxHashes(hashes []common.Hash) ([]string, [][]byte, error) {
|
||||||
|
rctResults := make([]ipldResult, 0)
|
||||||
|
hashStrs := make([]string, len(hashes))
|
||||||
|
for i, hash := range hashes {
|
||||||
|
hashStrs[i] = hash.Hex()
|
||||||
|
}
|
||||||
|
if err := r.db.Select(&rctResults, RetrieveReceiptsByTxHashesPgStr, pq.Array(hashStrs)); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(rctResults))
|
||||||
|
rcts := make([][]byte, len(rctResults))
|
||||||
|
for i, res := range rctResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
rcts[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, rcts, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveReceiptsByBlockHash returns the cids and rlp bytes for the receipts corresponding to the provided block hash
|
||||||
|
func (r *IPLDRetriever) RetrieveReceiptsByBlockHash(hash common.Hash) ([]string, [][]byte, error) {
|
||||||
|
rctResults := make([]ipldResult, 0)
|
||||||
|
if err := r.db.Select(&rctResults, RetrieveReceiptsByBlockHashPgStr, hash.Hex()); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(rctResults))
|
||||||
|
rcts := make([][]byte, len(rctResults))
|
||||||
|
for i, res := range rctResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
rcts[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, rcts, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveReceiptsByBlockNumber returns the cids and rlp bytes for the receipts corresponding to the provided block hash
|
||||||
|
func (r *IPLDRetriever) RetrieveReceiptsByBlockNumber(number uint64) ([]string, [][]byte, error) {
|
||||||
|
rctResults := make([]ipldResult, 0)
|
||||||
|
if err := r.db.Select(&rctResults, RetrieveReceiptsByBlockNumberPgStr, number); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(rctResults))
|
||||||
|
rcts := make([][]byte, len(rctResults))
|
||||||
|
for i, res := range rctResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
rcts[i] = res.data
|
||||||
|
}
|
||||||
|
return cids, rcts, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveReceiptByHash returns the cid and rlp bytes for the receipt corresponding to the provided tx hash
|
||||||
|
func (r *IPLDRetriever) RetrieveReceiptByHash(hash common.Hash) (string, []byte, error) {
|
||||||
|
rctResult := new(ipldResult)
|
||||||
|
return rctResult.cid, rctResult.data, r.db.Get(rctResult, RetrieveReceiptByTxHashPgStr, hash.Hex())
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveAccountByAddressAndBlockHash returns the cid and rlp bytes for the account corresponding to the provided address and block hash
|
||||||
|
func (r *IPLDRetriever) RetrieveAccountByAddressAndBlockHash(address common.Address, hash common.Hash) (string, []byte, error) {
|
||||||
|
accountResult := new(ipldResult)
|
||||||
|
leafKey := crypto.Keccak256Hash(address.Bytes())
|
||||||
|
if err := r.db.Get(accountResult, RetrieveAccountByLeafKeyAndBlockHashPgStr, leafKey.Hex(), hash.Hex()); err != nil {
|
||||||
|
return "", nil, err
|
||||||
|
}
|
||||||
|
var i []interface{}
|
||||||
|
if err := rlp.DecodeBytes(accountResult.data, &i); err != nil {
|
||||||
|
return "", nil, fmt.Errorf("error decoding state leaf node rlp: %s", err.Error())
|
||||||
|
}
|
||||||
|
if len(i) != 2 {
|
||||||
|
return "", nil, fmt.Errorf("eth IPLDRetriever expected state leaf node rlp to decode into two elements")
|
||||||
|
}
|
||||||
|
return accountResult.cid, i[1].([]byte), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetrieveAccountByAddressAndBlockNumber returns the cid and rlp bytes for the account corresponding to the provided address and block number
|
||||||
|
// This can return multiple results if we have two versions of state in the database as the provided height
|
||||||
|
func (r *IPLDRetriever) RetrieveAccountByAddressAndBlockNumber(address common.Address, number uint64) ([]string, [][]byte, error) {
|
||||||
|
accountResults := make([]ipldResult, 0)
|
||||||
|
leafKey := crypto.Keccak256Hash(address.Bytes())
|
||||||
|
if err := r.db.Get(&accountResults, RetrieveAccountByLeafKeyAndBlockNumberPgStr, leafKey.Hex(), number); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
cids := make([]string, len(accountResults))
|
||||||
|
accounts := make([][]byte, len(accountResults))
|
||||||
|
for i, res := range accountResults {
|
||||||
|
cids[i] = res.cid
|
||||||
|
var iface []interface{}
|
||||||
|
if err := rlp.DecodeBytes(res.data, &iface); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("error decoding state leaf node rlp: %s", err.Error())
|
||||||
|
}
|
||||||
|
if len(iface) != 2 {
|
||||||
|
return nil, nil, fmt.Errorf("eth IPLDRetriever expected state leaf node rlp to decode into two elements")
|
||||||
|
}
|
||||||
|
accounts[i] = iface[1].([]byte)
|
||||||
|
}
|
||||||
|
return cids, accounts, nil
|
||||||
|
}
|
156
pkg/eth/ipld_retriever_test.go
Normal file
156
pkg/eth/ipld_retriever_test.go
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
// VulcanizeDB
|
||||||
|
// Copyright © 2019 Vulcanize
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package eth_test
|
||||||
|
|
||||||
|
/*
|
||||||
|
import (
|
||||||
|
. "github.com/onsi/ginkgo"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
|
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth/mocks"
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = Describe("IPLD Retriever", func() {
|
||||||
|
var (
|
||||||
|
db *postgres.DB
|
||||||
|
repo *eth2.IPLDPublisher
|
||||||
|
//retriever *eth.IPLDRetriever
|
||||||
|
)
|
||||||
|
BeforeEach(func() {
|
||||||
|
var err error
|
||||||
|
db, err = shared.SetupDB()
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
repo = eth2.NewIPLDPublisher(db)
|
||||||
|
//retriever = eth.NewIPLDRetriever(db)
|
||||||
|
err = repo.Publish(mocks.MockConvertedPayload)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
err = repo.Publish(mocks.MockConvertedPayload2)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
})
|
||||||
|
AfterEach(func() {
|
||||||
|
eth.TearDownDB(db)
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveHeadersByHashes", func() {
|
||||||
|
It("Retrieves all of the headers that correspond to the provided hashes", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveHeadersByBlockNumber", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveHeaderByHash", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveUnclesByHashes", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveUnclesByBlockHash", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveUnclesByBlockNumber", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveUncleByHash", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveTransactionsByHashes", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveTransactionsByBlockHash", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveTransactionsByBlockNumber", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveTransactionByTxHash", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveReceiptsByTxHashes", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveReceiptsByBlockHash", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveReceiptsByBlockNumber", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveReceiptByHash", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveAccountByAddressAndBlockHash", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Describe("RetrieveAccountByAddressAndBlockNumber", func() {
|
||||||
|
It("Retrieves all CIDs for the given blocknumber when provided an open filter", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
*/
|
47
pkg/eth/test_helpers/abi.json
Normal file
47
pkg/eth/test_helpers/abi.json
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"payable": false,
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "constructor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"constant": false,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "value",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "Put",
|
||||||
|
"outputs": [],
|
||||||
|
"payable": false,
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"constant": false,
|
||||||
|
"inputs": [],
|
||||||
|
"name": "close",
|
||||||
|
"outputs": [],
|
||||||
|
"payable": false,
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"constant": true,
|
||||||
|
"inputs": [],
|
||||||
|
"name": "data",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"payable": false,
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
}
|
||||||
|
]
|
99
pkg/eth/test_helpers/chain_maker.go
Normal file
99
pkg/eth/test_helpers/chain_maker.go
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// VulcanizeDB
|
||||||
|
// Copyright © 2020 Vulcanize
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package test_helpers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/big"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Test variables
|
||||||
|
var (
|
||||||
|
Testdb = rawdb.NewMemoryDatabase()
|
||||||
|
TestBankKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
|
TestBankAddress = crypto.PubkeyToAddress(TestBankKey.PublicKey) //0x71562b71999873DB5b286dF957af199Ec94617F7
|
||||||
|
TestBankFunds = big.NewInt(100000000)
|
||||||
|
Genesis = core.GenesisBlockForTesting(Testdb, TestBankAddress, TestBankFunds)
|
||||||
|
|
||||||
|
Account1Key, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
|
||||||
|
Account2Key, _ = crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee")
|
||||||
|
Account1Addr = crypto.PubkeyToAddress(Account1Key.PublicKey) //0x703c4b2bD70c169f5717101CaeE543299Fc946C7
|
||||||
|
Account2Addr = crypto.PubkeyToAddress(Account2Key.PublicKey) //0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e
|
||||||
|
ContractCode = common.Hex2Bytes("608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600180819055506101e2806100676000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806343d726d61461004657806365f3c31a1461005057806373d4a13a1461007e575b600080fd5b61004e61009c565b005b61007c6004803603602081101561006657600080fd5b810190808035906020019092919050505061017b565b005b610086610185565b6040518082815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061018c6022913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b8060018190555050565b6001548156fe4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2ea265627a7a723158205ba91466129f45285f53176d805117208c231ec6343d7896790e6fc4165b802b64736f6c63430005110032")
|
||||||
|
ContractAddr common.Address
|
||||||
|
)
|
||||||
|
|
||||||
|
/* test function signatures
|
||||||
|
put function sig: 65f3c31a
|
||||||
|
close function sig: 43d726d6
|
||||||
|
data function sig: 73d4a13a
|
||||||
|
*/
|
||||||
|
|
||||||
|
// MakeChain creates a chain of n blocks starting at and including parent.
|
||||||
|
// the returned hash chain is ordered head->parent.
|
||||||
|
func MakeChain(n int, parent *types.Block, chainGen func(int, *core.BlockGen)) ([]*types.Block, []types.Receipts, *core.BlockChain) {
|
||||||
|
config := params.TestChainConfig
|
||||||
|
blocks, receipts := core.GenerateChain(config, parent, ethash.NewFaker(), Testdb, n, chainGen)
|
||||||
|
chain, _ := core.NewBlockChain(Testdb, nil, params.TestChainConfig, ethash.NewFaker(), vm.Config{}, nil)
|
||||||
|
return append([]*types.Block{parent}, blocks...), receipts, chain
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestChainGen(i int, block *core.BlockGen) {
|
||||||
|
signer := types.HomesteadSigner{}
|
||||||
|
switch i {
|
||||||
|
case 0:
|
||||||
|
// In block 1, the test bank sends account #1 some ether.
|
||||||
|
tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(TestBankAddress), Account1Addr, big.NewInt(10000), params.TxGas, nil, nil), signer, TestBankKey)
|
||||||
|
block.AddTx(tx)
|
||||||
|
case 1:
|
||||||
|
// In block 2, the test bank sends some more ether to account #1.
|
||||||
|
// Account1Addr passes it on to account #2.
|
||||||
|
// Account1Addr creates a test contract.
|
||||||
|
tx1, _ := types.SignTx(types.NewTransaction(block.TxNonce(TestBankAddress), Account1Addr, big.NewInt(1000), params.TxGas, nil, nil), signer, TestBankKey)
|
||||||
|
nonce := block.TxNonce(Account1Addr)
|
||||||
|
tx2, _ := types.SignTx(types.NewTransaction(nonce, Account2Addr, big.NewInt(1000), params.TxGas, nil, nil), signer, Account1Key)
|
||||||
|
nonce++
|
||||||
|
tx3, _ := types.SignTx(types.NewContractCreation(nonce, big.NewInt(0), 1000000, big.NewInt(0), ContractCode), signer, Account1Key)
|
||||||
|
ContractAddr = crypto.CreateAddress(Account1Addr, nonce)
|
||||||
|
block.AddTx(tx1)
|
||||||
|
block.AddTx(tx2)
|
||||||
|
block.AddTx(tx3)
|
||||||
|
case 2:
|
||||||
|
block.SetCoinbase(Account2Addr)
|
||||||
|
data := common.Hex2Bytes("65F3C31A0000000000000000000000000000000000000000000000000000000000000003")
|
||||||
|
tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(TestBankAddress), ContractAddr, big.NewInt(0), 100000, nil, data), signer, TestBankKey)
|
||||||
|
block.AddTx(tx)
|
||||||
|
case 3:
|
||||||
|
block.SetCoinbase(Account2Addr)
|
||||||
|
data := common.Hex2Bytes("65F3C31A0000000000000000000000000000000000000000000000000000000000000009")
|
||||||
|
tx1, _ := types.SignTx(types.NewTransaction(block.TxNonce(TestBankAddress), ContractAddr, big.NewInt(0), 100000, nil, data), signer, TestBankKey)
|
||||||
|
block.AddTx(tx1)
|
||||||
|
case 4:
|
||||||
|
block.SetCoinbase(Account1Addr)
|
||||||
|
data := common.Hex2Bytes("65F3C31A0000000000000000000000000000000000000000000000000000000000000000")
|
||||||
|
tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(TestBankAddress), ContractAddr, big.NewInt(0), 100000, nil, data), signer, TestBankKey)
|
||||||
|
block.AddTx(tx)
|
||||||
|
}
|
||||||
|
}
|
6
pkg/eth/test_helpers/compiler_output.json
Normal file
6
pkg/eth/test_helpers/compiler_output.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"linkReferences": {},
|
||||||
|
"object": "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600180819055506101e2806100676000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806343d726d61461004657806365f3c31a1461005057806373d4a13a1461007e575b600080fd5b61004e61009c565b005b61007c6004803603602081101561006657600080fd5b810190808035906020019092919050505061017b565b005b610086610185565b6040518082815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061018c6022913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b8060018190555050565b6001548156fe4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2ea265627a7a723158205ba91466129f45285f53176d805117208c231ec6343d7896790e6fc4165b802b64736f6c63430005110032",
|
||||||
|
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH2 0x1E2 DUP1 PUSH2 0x67 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x41 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x43D726D6 EQ PUSH2 0x46 JUMPI DUP1 PUSH4 0x65F3C31A EQ PUSH2 0x50 JUMPI DUP1 PUSH4 0x73D4A13A EQ PUSH2 0x7E JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E PUSH2 0x9C JUMP JUMPDEST STOP JUMPDEST PUSH2 0x7C PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x66 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x17B JUMP JUMPDEST STOP JUMPDEST PUSH2 0x86 PUSH2 0x185 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x141 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE PUSH1 0x22 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH2 0x18C PUSH1 0x22 SWAP2 CODECOPY PUSH1 0x40 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST DUP1 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 JUMP INVALID 0x4F PUSH15 0x6C79206F776E65722063616E206361 PUSH13 0x6C20746869732066756E637469 PUSH16 0x6E2EA265627A7A723158205BA9146612 SWAP16 GASLIMIT 0x28 0x5F MSTORE8 OR PUSH14 0x805117208C231EC6343D7896790E PUSH16 0xC4165B802B64736F6C63430005110032 ",
|
||||||
|
"sourceMap": "26:449:0:-;;;253:74;8:9:-1;5:2;;;30:1;27;20:12;5:2;253:74:0;292:10;284:5;;:18;;;;;;;;;;;;;;;;;;319:1;312:4;:8;;;;26:449;;;;;;"
|
||||||
|
}
|
28
pkg/eth/test_helpers/test_contract.sol
Normal file
28
pkg/eth/test_helpers/test_contract.sol
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
pragma solidity ^0.5.10;
|
||||||
|
|
||||||
|
contract test {
|
||||||
|
address payable owner;
|
||||||
|
|
||||||
|
modifier onlyOwner {
|
||||||
|
require(
|
||||||
|
msg.sender == owner,
|
||||||
|
"Only owner can call this function."
|
||||||
|
);
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint256 public data;
|
||||||
|
|
||||||
|
constructor() public {
|
||||||
|
owner = msg.sender;
|
||||||
|
data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Put(uint256 value) public {
|
||||||
|
data = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() public onlyOwner {
|
||||||
|
selfdestruct(owner);
|
||||||
|
}
|
||||||
|
}
|
@ -14,12 +14,16 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package mocks
|
package test_helpers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"math/big"
|
||||||
|
|
||||||
|
"github.com/vulcanize/ipld-eth-indexer/pkg/shared"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
@ -31,14 +35,15 @@ import (
|
|||||||
"github.com/ipfs/go-block-format"
|
"github.com/ipfs/go-block-format"
|
||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
|
||||||
|
"github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs/ipld"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs/ipld"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/shared"
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
eth2 "github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
"math/big"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Test variables
|
||||||
var (
|
var (
|
||||||
// block data
|
// block data
|
||||||
BlockNumber = big.NewInt(1)
|
BlockNumber = big.NewInt(1)
|
||||||
@ -54,7 +59,6 @@ var (
|
|||||||
MockTransactions, MockReceipts, SenderAddr = createTransactionsAndReceipts()
|
MockTransactions, MockReceipts, SenderAddr = createTransactionsAndReceipts()
|
||||||
ReceiptsRlp, _ = rlp.EncodeToBytes(MockReceipts)
|
ReceiptsRlp, _ = rlp.EncodeToBytes(MockReceipts)
|
||||||
MockBlock = types.NewBlock(&MockHeader, MockTransactions, nil, MockReceipts)
|
MockBlock = types.NewBlock(&MockHeader, MockTransactions, nil, MockReceipts)
|
||||||
MockBlockRlp, _ = rlp.EncodeToBytes(MockBlock)
|
|
||||||
MockHeaderRlp, _ = rlp.EncodeToBytes(MockBlock.Header())
|
MockHeaderRlp, _ = rlp.EncodeToBytes(MockBlock.Header())
|
||||||
Address = common.HexToAddress("0xaE9BEa628c4Ce503DcFD7E305CaB4e29E7476592")
|
Address = common.HexToAddress("0xaE9BEa628c4Ce503DcFD7E305CaB4e29E7476592")
|
||||||
AnotherAddress = common.HexToAddress("0xaE9BEa628c4Ce503DcFD7E305CaB4e29E7476593")
|
AnotherAddress = common.HexToAddress("0xaE9BEa628c4Ce503DcFD7E305CaB4e29E7476593")
|
||||||
@ -95,8 +99,7 @@ var (
|
|||||||
State2MhKey = shared.MultihashKeyFromCID(State2CID)
|
State2MhKey = shared.MultihashKeyFromCID(State2CID)
|
||||||
StorageCID, _ = ipld.RawdataToCid(ipld.MEthStorageTrie, StorageLeafNode, multihash.KECCAK_256)
|
StorageCID, _ = ipld.RawdataToCid(ipld.MEthStorageTrie, StorageLeafNode, multihash.KECCAK_256)
|
||||||
StorageMhKey = shared.MultihashKeyFromCID(StorageCID)
|
StorageMhKey = shared.MultihashKeyFromCID(StorageCID)
|
||||||
|
MockTrxMeta = []eth.TxModel{
|
||||||
MockTrxMeta = []eth2.TxModel{
|
|
||||||
{
|
{
|
||||||
CID: "", // This is empty until we go to publish to ipfs
|
CID: "", // This is empty until we go to publish to ipfs
|
||||||
MhKey: "",
|
MhKey: "",
|
||||||
@ -105,7 +108,6 @@ var (
|
|||||||
Index: 0,
|
Index: 0,
|
||||||
TxHash: MockTransactions[0].Hash().String(),
|
TxHash: MockTransactions[0].Hash().String(),
|
||||||
Data: []byte{},
|
Data: []byte{},
|
||||||
Deployment: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
CID: "",
|
CID: "",
|
||||||
@ -115,7 +117,6 @@ var (
|
|||||||
Index: 1,
|
Index: 1,
|
||||||
TxHash: MockTransactions[1].Hash().String(),
|
TxHash: MockTransactions[1].Hash().String(),
|
||||||
Data: []byte{},
|
Data: []byte{},
|
||||||
Deployment: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
CID: "",
|
CID: "",
|
||||||
@ -125,10 +126,9 @@ var (
|
|||||||
Index: 2,
|
Index: 2,
|
||||||
TxHash: MockTransactions[2].Hash().String(),
|
TxHash: MockTransactions[2].Hash().String(),
|
||||||
Data: MockContractByteCode,
|
Data: MockContractByteCode,
|
||||||
Deployment: true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
MockTrxMetaPostPublsh = []eth2.TxModel{
|
MockTrxMetaPostPublsh = []eth.TxModel{
|
||||||
{
|
{
|
||||||
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,
|
||||||
@ -137,7 +137,6 @@ var (
|
|||||||
Index: 0,
|
Index: 0,
|
||||||
TxHash: MockTransactions[0].Hash().String(),
|
TxHash: MockTransactions[0].Hash().String(),
|
||||||
Data: []byte{},
|
Data: []byte{},
|
||||||
Deployment: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
CID: Trx2CID.String(),
|
CID: Trx2CID.String(),
|
||||||
@ -147,7 +146,6 @@ var (
|
|||||||
Index: 1,
|
Index: 1,
|
||||||
TxHash: MockTransactions[1].Hash().String(),
|
TxHash: MockTransactions[1].Hash().String(),
|
||||||
Data: []byte{},
|
Data: []byte{},
|
||||||
Deployment: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
CID: Trx3CID.String(),
|
CID: Trx3CID.String(),
|
||||||
@ -157,10 +155,9 @@ var (
|
|||||||
Index: 2,
|
Index: 2,
|
||||||
TxHash: MockTransactions[2].Hash().String(),
|
TxHash: MockTransactions[2].Hash().String(),
|
||||||
Data: MockContractByteCode,
|
Data: MockContractByteCode,
|
||||||
Deployment: true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
MockRctMeta = []eth2.ReceiptModel{
|
MockRctMeta = []eth.ReceiptModel{
|
||||||
{
|
{
|
||||||
CID: "",
|
CID: "",
|
||||||
MhKey: "",
|
MhKey: "",
|
||||||
@ -199,7 +196,7 @@ var (
|
|||||||
LogContracts: []string{},
|
LogContracts: []string{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
MockRctMetaPostPublish = []eth2.ReceiptModel{
|
MockRctMetaPostPublish = []eth.ReceiptModel{
|
||||||
{
|
{
|
||||||
CID: Rct1CID.String(),
|
CID: Rct1CID.String(),
|
||||||
MhKey: Rct1MhKey,
|
MhKey: Rct1MhKey,
|
||||||
@ -284,37 +281,7 @@ var (
|
|||||||
Account,
|
Account,
|
||||||
})
|
})
|
||||||
|
|
||||||
StateDiffs = []statediff.StateNode{
|
MockStateNodes = []eth.TrieNode{
|
||||||
{
|
|
||||||
Path: []byte{'\x06'},
|
|
||||||
NodeType: statediff.Leaf,
|
|
||||||
LeafKey: ContractLeafKey,
|
|
||||||
NodeValue: ContractLeafNode,
|
|
||||||
StorageNodes: []statediff.StorageNode{
|
|
||||||
{
|
|
||||||
Path: []byte{},
|
|
||||||
NodeType: statediff.Leaf,
|
|
||||||
LeafKey: StorageLeafKey,
|
|
||||||
NodeValue: StorageLeafNode,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Path: []byte{'\x0c'},
|
|
||||||
NodeType: statediff.Leaf,
|
|
||||||
LeafKey: AccountLeafKey,
|
|
||||||
NodeValue: AccountLeafNode,
|
|
||||||
StorageNodes: []statediff.StorageNode{},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
MockStateDiff = statediff.StateObject{
|
|
||||||
BlockNumber: new(big.Int).Set(BlockNumber),
|
|
||||||
BlockHash: MockBlock.Hash(),
|
|
||||||
Nodes: StateDiffs,
|
|
||||||
}
|
|
||||||
MockStateDiffBytes, _ = rlp.EncodeToBytes(MockStateDiff)
|
|
||||||
MockStateNodes = []eth2.TrieNode{
|
|
||||||
{
|
{
|
||||||
LeafKey: common.BytesToHash(ContractLeafKey),
|
LeafKey: common.BytesToHash(ContractLeafKey),
|
||||||
Path: []byte{'\x06'},
|
Path: []byte{'\x06'},
|
||||||
@ -328,7 +295,7 @@ var (
|
|||||||
Type: statediff.Leaf,
|
Type: statediff.Leaf,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
MockStateMetaPostPublish = []eth2.StateNodeModel{
|
MockStateMetaPostPublish = []eth.StateNodeModel{
|
||||||
{
|
{
|
||||||
CID: State1CID.String(),
|
CID: State1CID.String(),
|
||||||
MhKey: State1MhKey,
|
MhKey: State1MhKey,
|
||||||
@ -344,7 +311,7 @@ var (
|
|||||||
StateKey: common.BytesToHash(AccountLeafKey).Hex(),
|
StateKey: common.BytesToHash(AccountLeafKey).Hex(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
MockStorageNodes = map[string][]eth2.TrieNode{
|
MockStorageNodes = map[string][]eth.TrieNode{
|
||||||
contractPath: {
|
contractPath: {
|
||||||
{
|
{
|
||||||
LeafKey: common.BytesToHash(StorageLeafKey),
|
LeafKey: common.BytesToHash(StorageLeafKey),
|
||||||
@ -355,15 +322,7 @@ var (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// aggregate payloads
|
MockConvertedPayload = eth.ConvertedPayload{
|
||||||
MockStateDiffPayload = statediff.Payload{
|
|
||||||
BlockRlp: MockBlockRlp,
|
|
||||||
StateObjectRlp: MockStateDiffBytes,
|
|
||||||
ReceiptsRlp: ReceiptsRlp,
|
|
||||||
TotalDifficulty: MockBlock.Difficulty(),
|
|
||||||
}
|
|
||||||
|
|
||||||
MockConvertedPayload = eth2.ConvertedPayload{
|
|
||||||
TotalDifficulty: MockBlock.Difficulty(),
|
TotalDifficulty: MockBlock.Difficulty(),
|
||||||
Block: MockBlock,
|
Block: MockBlock,
|
||||||
Receipts: MockReceipts,
|
Receipts: MockReceipts,
|
||||||
@ -373,9 +332,9 @@ var (
|
|||||||
StateNodes: MockStateNodes,
|
StateNodes: MockStateNodes,
|
||||||
}
|
}
|
||||||
|
|
||||||
MockCIDWrapper = ð.CIDWrapper{
|
MockCIDWrapper = ð2.CIDWrapper{
|
||||||
BlockNumber: new(big.Int).Set(BlockNumber),
|
BlockNumber: new(big.Int).Set(BlockNumber),
|
||||||
Header: eth2.HeaderModel{
|
Header: eth.HeaderModel{
|
||||||
BlockNumber: "1",
|
BlockNumber: "1",
|
||||||
BlockHash: MockBlock.Hash().String(),
|
BlockHash: MockBlock.Hash().String(),
|
||||||
ParentHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
ParentHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
@ -393,9 +352,9 @@ var (
|
|||||||
},
|
},
|
||||||
Transactions: MockTrxMetaPostPublsh,
|
Transactions: MockTrxMetaPostPublsh,
|
||||||
Receipts: MockRctMetaPostPublish,
|
Receipts: MockRctMetaPostPublish,
|
||||||
Uncles: []eth2.UncleModel{},
|
Uncles: []eth.UncleModel{},
|
||||||
StateNodes: MockStateMetaPostPublish,
|
StateNodes: MockStateMetaPostPublish,
|
||||||
StorageNodes: []eth2.StorageNodeWithStateKeyModel{
|
StorageNodes: []eth.StorageNodeWithStateKeyModel{
|
||||||
{
|
{
|
||||||
Path: []byte{},
|
Path: []byte{},
|
||||||
CID: StorageCID.String(),
|
CID: StorageCID.String(),
|
||||||
@ -418,7 +377,7 @@ var (
|
|||||||
State2IPLD, _ = blocks.NewBlockWithCid(AccountLeafNode, State2CID)
|
State2IPLD, _ = blocks.NewBlockWithCid(AccountLeafNode, State2CID)
|
||||||
StorageIPLD, _ = blocks.NewBlockWithCid(StorageLeafNode, StorageCID)
|
StorageIPLD, _ = blocks.NewBlockWithCid(StorageLeafNode, StorageCID)
|
||||||
|
|
||||||
MockIPLDs = eth.IPLDs{
|
MockIPLDs = eth2.IPLDs{
|
||||||
BlockNumber: new(big.Int).Set(BlockNumber),
|
BlockNumber: new(big.Int).Set(BlockNumber),
|
||||||
Header: ipfs.BlockModel{
|
Header: ipfs.BlockModel{
|
||||||
Data: HeaderIPLD.RawData(),
|
Data: HeaderIPLD.RawData(),
|
||||||
@ -452,7 +411,7 @@ var (
|
|||||||
CID: Rct3IPLD.Cid().String(),
|
CID: Rct3IPLD.Cid().String(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
StateNodes: []eth.StateNode{
|
StateNodes: []eth2.StateNode{
|
||||||
{
|
{
|
||||||
StateLeafKey: common.BytesToHash(ContractLeafKey),
|
StateLeafKey: common.BytesToHash(ContractLeafKey),
|
||||||
Type: statediff.Leaf,
|
Type: statediff.Leaf,
|
||||||
@ -472,7 +431,7 @@ var (
|
|||||||
Path: []byte{'\x0c'},
|
Path: []byte{'\x0c'},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
StorageNodes: []eth.StorageNode{
|
StorageNodes: []eth2.StorageNode{
|
||||||
{
|
{
|
||||||
StateLeafKey: common.BytesToHash(ContractLeafKey),
|
StateLeafKey: common.BytesToHash(ContractLeafKey),
|
||||||
StorageLeafKey: common.BytesToHash(StorageLeafKey),
|
StorageLeafKey: common.BytesToHash(StorageLeafKey),
|
@ -1,26 +1,30 @@
|
|||||||
|
// VulcanizeDB
|
||||||
|
// Copyright © 2019 Vulcanize
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package eth
|
package eth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/big"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/statediff"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs"
|
||||||
"math/big"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CIDWrapper is used to direct fetching of IPLDs from IPFS
|
|
||||||
// Returned by CIDRetriever
|
|
||||||
// Passed to IPLDFetcher
|
|
||||||
type CIDWrapper struct {
|
|
||||||
BlockNumber *big.Int
|
|
||||||
Header eth2.HeaderModel
|
|
||||||
Uncles []eth2.UncleModel
|
|
||||||
Transactions []eth2.TxModel
|
|
||||||
Receipts []eth2.ReceiptModel
|
|
||||||
StateNodes []eth2.StateNodeModel
|
|
||||||
StorageNodes []eth2.StorageNodeWithStateKeyModel
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPLDs is used to package raw IPLD block data fetched from IPFS and returned by the server
|
// IPLDs is used to package raw IPLD block data fetched from IPFS and returned by the server
|
||||||
// Returned by IPLDFetcher and ResponseFilterer
|
// Returned by IPLDFetcher and ResponseFilterer
|
||||||
type IPLDs struct {
|
type IPLDs struct {
|
||||||
@ -48,3 +52,16 @@ type StorageNode struct {
|
|||||||
Path []byte
|
Path []byte
|
||||||
IPLD ipfs.BlockModel
|
IPLD ipfs.BlockModel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CIDWrapper is used to direct fetching of IPLDs from IPFS
|
||||||
|
// Returned by CIDRetriever
|
||||||
|
// Passed to IPLDFetcher
|
||||||
|
type CIDWrapper struct {
|
||||||
|
BlockNumber *big.Int
|
||||||
|
Header eth.HeaderModel
|
||||||
|
Uncles []eth.UncleModel
|
||||||
|
Transactions []eth.TxModel
|
||||||
|
Receipts []eth.ReceiptModel
|
||||||
|
StateNodes []eth.StateNodeModel
|
||||||
|
StorageNodes []eth.StorageNodeWithStateKeyModel
|
||||||
|
}
|
||||||
|
@ -23,8 +23,9 @@ import (
|
|||||||
"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-indexer/pkg/shared"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
|
||||||
v "github.com/vulcanize/ipld-eth-server/version"
|
v "github.com/vulcanize/ipld-eth-server/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ func (api *PublicServerAPI) Stream(ctx context.Context, params eth.SubscriptionS
|
|||||||
|
|
||||||
// Chain returns the chain type that this watcher instance supports
|
// Chain returns the chain type that this watcher instance supports
|
||||||
func (api *PublicServerAPI) Chain() shared.ChainType {
|
func (api *PublicServerAPI) Chain() shared.ChainType {
|
||||||
return api.w.Chain()
|
return shared.Ethereum
|
||||||
}
|
}
|
||||||
|
|
||||||
// Struct for holding watcher meta data
|
// Struct for holding watcher meta data
|
||||||
|
@ -17,16 +17,19 @@
|
|||||||
package serve
|
package serve
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/node"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
"github.com/vulcanize/ipld-eth-indexer/pkg/node"
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-indexer/utils"
|
"github.com/vulcanize/ipld-eth-indexer/utils"
|
||||||
|
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Env variables
|
// Env variables
|
||||||
@ -38,6 +41,12 @@ const (
|
|||||||
SERVER_MAX_IDLE_CONNECTIONS = "SERVER_MAX_IDLE_CONNECTIONS"
|
SERVER_MAX_IDLE_CONNECTIONS = "SERVER_MAX_IDLE_CONNECTIONS"
|
||||||
SERVER_MAX_OPEN_CONNECTIONS = "SERVER_MAX_OPEN_CONNECTIONS"
|
SERVER_MAX_OPEN_CONNECTIONS = "SERVER_MAX_OPEN_CONNECTIONS"
|
||||||
SERVER_MAX_CONN_LIFETIME = "SERVER_MAX_CONN_LIFETIME"
|
SERVER_MAX_CONN_LIFETIME = "SERVER_MAX_CONN_LIFETIME"
|
||||||
|
|
||||||
|
ETH_CHAIN_ID = "ETH_CHAIN_ID"
|
||||||
|
|
||||||
|
ETH_DEFAULT_SENDER_ADDR = "ETH_DEFAULT_SENDER_ADDR"
|
||||||
|
|
||||||
|
ETH_RPC_GAS_CAP = "ETH_RPC_GAS_CAP"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config struct
|
// Config struct
|
||||||
@ -47,6 +56,9 @@ type Config struct {
|
|||||||
WSEndpoint string
|
WSEndpoint string
|
||||||
HTTPEndpoint string
|
HTTPEndpoint string
|
||||||
IPCEndpoint string
|
IPCEndpoint string
|
||||||
|
ChainConfig *params.ChainConfig
|
||||||
|
DefaultSender *common.Address
|
||||||
|
RPCGasCap *big.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConfig is used to initialize a watcher config from a .toml file
|
// NewConfig is used to initialize a watcher config from a .toml file
|
||||||
@ -57,6 +69,9 @@ func NewConfig() (*Config, error) {
|
|||||||
viper.BindEnv("server.wsPath", SERVER_WS_PATH)
|
viper.BindEnv("server.wsPath", SERVER_WS_PATH)
|
||||||
viper.BindEnv("server.ipcPath", SERVER_IPC_PATH)
|
viper.BindEnv("server.ipcPath", SERVER_IPC_PATH)
|
||||||
viper.BindEnv("server.httpPath", SERVER_HTTP_PATH)
|
viper.BindEnv("server.httpPath", SERVER_HTTP_PATH)
|
||||||
|
viper.BindEnv("ethereum.chainID", ETH_CHAIN_ID)
|
||||||
|
viper.BindEnv("ethereum.defaultSender", ETH_DEFAULT_SENDER_ADDR)
|
||||||
|
viper.BindEnv("ethereum.rpcGasCap", ETH_RPC_GAS_CAP)
|
||||||
|
|
||||||
c.DBConfig.Init()
|
c.DBConfig.Init()
|
||||||
|
|
||||||
@ -83,7 +98,21 @@ func NewConfig() (*Config, error) {
|
|||||||
serveDB := utils.LoadPostgres(c.DBConfig, node.Info{})
|
serveDB := utils.LoadPostgres(c.DBConfig, node.Info{})
|
||||||
c.DB = &serveDB
|
c.DB = &serveDB
|
||||||
|
|
||||||
return c, nil
|
defaultSenderStr := viper.GetString("ethereum.defaultSender")
|
||||||
|
if defaultSenderStr != "" {
|
||||||
|
sender := common.HexToAddress(defaultSenderStr)
|
||||||
|
c.DefaultSender = &sender
|
||||||
|
}
|
||||||
|
rpcGasCapStr := viper.GetString("ethereum.rpcGasCap")
|
||||||
|
if rpcGasCapStr != "" {
|
||||||
|
if rpcGasCap, ok := new(big.Int).SetString(rpcGasCapStr, 10); ok {
|
||||||
|
c.RPCGasCap = rpcGasCap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chainID := viper.GetUint64("ethereum.chainID")
|
||||||
|
var err error
|
||||||
|
c.ChainConfig, err = eth.ChainConfig(chainID)
|
||||||
|
return c, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func overrideDBConnConfig(con *postgres.Config) {
|
func overrideDBConnConfig(con *postgres.Config) {
|
||||||
|
@ -20,6 +20,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
ethnode "github.com/ethereum/go-ethereum/node"
|
ethnode "github.com/ethereum/go-ethereum/node"
|
||||||
@ -32,7 +34,6 @@ import (
|
|||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
"github.com/vulcanize/ipld-eth-indexer/pkg/postgres"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -51,8 +52,6 @@ type Server interface {
|
|||||||
Subscribe(id rpc.ID, sub chan<- SubscriptionPayload, quitChan chan<- bool, params eth.SubscriptionSettings)
|
Subscribe(id rpc.ID, sub chan<- SubscriptionPayload, quitChan chan<- bool, params eth.SubscriptionSettings)
|
||||||
// Method to unsubscribe from the service
|
// Method to unsubscribe from the service
|
||||||
Unsubscribe(id rpc.ID)
|
Unsubscribe(id rpc.ID)
|
||||||
// Method to access chain type
|
|
||||||
Chain() shared.ChainType
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Service is the underlying struct for the watcher
|
// Service is the underlying struct for the watcher
|
||||||
@ -75,6 +74,8 @@ type Service struct {
|
|||||||
db *postgres.DB
|
db *postgres.DB
|
||||||
// wg for syncing serve processes
|
// wg for syncing serve processes
|
||||||
serveWg *sync.WaitGroup
|
serveWg *sync.WaitGroup
|
||||||
|
// config for backend
|
||||||
|
config *eth.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewServer creates a new Server using an underlying Service struct
|
// NewServer creates a new Server using an underlying Service struct
|
||||||
@ -87,6 +88,12 @@ func NewServer(settings *Config) (Server, error) {
|
|||||||
sn.QuitChan = make(chan bool)
|
sn.QuitChan = make(chan bool)
|
||||||
sn.Subscriptions = make(map[common.Hash]map[rpc.ID]Subscription)
|
sn.Subscriptions = make(map[common.Hash]map[rpc.ID]Subscription)
|
||||||
sn.SubscriptionTypes = make(map[common.Hash]eth.SubscriptionSettings)
|
sn.SubscriptionTypes = make(map[common.Hash]eth.SubscriptionSettings)
|
||||||
|
sn.config = ð.Config{
|
||||||
|
ChainConfig: settings.ChainConfig,
|
||||||
|
VmConfig: vm.Config{},
|
||||||
|
DefaultSender: settings.DefaultSender,
|
||||||
|
RPCGasCap: settings.RPCGasCap,
|
||||||
|
}
|
||||||
return sn, nil
|
return sn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +131,7 @@ func (sap *Service) APIs() []rpc.API {
|
|||||||
Public: true,
|
Public: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
backend, err := eth.NewEthBackend(sap.db)
|
backend, err := eth.NewEthBackend(sap.db, sap.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return nil
|
return nil
|
||||||
@ -349,11 +356,6 @@ func (sap *Service) Stop() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chain returns the chain type for this service
|
|
||||||
func (sap *Service) Chain() shared.ChainType {
|
|
||||||
return shared.Ethereum
|
|
||||||
}
|
|
||||||
|
|
||||||
// close is used to close all listening subscriptions
|
// close is used to close all listening subscriptions
|
||||||
// close needs to be called with subscription access locked
|
// close needs to be called with subscription access locked
|
||||||
func (sap *Service) close() {
|
func (sap *Service) close() {
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
// VulcanizeDB
|
|
||||||
// Copyright © 2019 Vulcanize
|
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package shared
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ChainType enum for specifying blockchain
|
|
||||||
type ChainType int
|
|
||||||
|
|
||||||
const (
|
|
||||||
UnknownChain ChainType = iota
|
|
||||||
Ethereum
|
|
||||||
Bitcoin
|
|
||||||
Omni
|
|
||||||
EthereumClassic
|
|
||||||
)
|
|
||||||
|
|
||||||
func (c ChainType) String() string {
|
|
||||||
switch c {
|
|
||||||
case Ethereum:
|
|
||||||
return "Ethereum"
|
|
||||||
case Bitcoin:
|
|
||||||
return "Bitcoin"
|
|
||||||
case Omni:
|
|
||||||
return "Omni"
|
|
||||||
case EthereumClassic:
|
|
||||||
return "EthereumClassic"
|
|
||||||
default:
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c ChainType) API() string {
|
|
||||||
switch c {
|
|
||||||
case Ethereum:
|
|
||||||
return "eth"
|
|
||||||
case Bitcoin:
|
|
||||||
return "btc"
|
|
||||||
case Omni:
|
|
||||||
return "omni"
|
|
||||||
case EthereumClassic:
|
|
||||||
return "etc"
|
|
||||||
default:
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewChainType(name string) (ChainType, error) {
|
|
||||||
switch strings.ToLower(name) {
|
|
||||||
case "ethereum", "eth":
|
|
||||||
return Ethereum, nil
|
|
||||||
case "bitcoin", "btc", "xbt":
|
|
||||||
return Bitcoin, nil
|
|
||||||
case "omni":
|
|
||||||
return Omni, nil
|
|
||||||
case "classic", "etc":
|
|
||||||
return EthereumClassic, nil
|
|
||||||
default:
|
|
||||||
return UnknownChain, errors.New("invalid name for chain")
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
// VulcanizeDB
|
|
||||||
// Copyright © 2019 Vulcanize
|
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package shared
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/spf13/viper"
|
|
||||||
"github.com/vulcanize/ipld-eth-indexer/pkg/node"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Env variables
|
|
||||||
const (
|
|
||||||
ETH_NODE_ID = "ETH_NODE_ID"
|
|
||||||
ETH_CLIENT_NAME = "ETH_CLIENT_NAME"
|
|
||||||
ETH_GENESIS_BLOCK = "ETH_GENESIS_BLOCK"
|
|
||||||
ETH_NETWORK_ID = "ETH_NETWORK_ID"
|
|
||||||
ETH_CHAIN_ID = "ETH_CHAIN_ID"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetNodeInfo returns the ethereum node info from env variables
|
|
||||||
func GetNodeInfo() node.Info {
|
|
||||||
viper.BindEnv("ethereum.nodeID", ETH_NODE_ID)
|
|
||||||
viper.BindEnv("ethereum.clientName", ETH_CLIENT_NAME)
|
|
||||||
viper.BindEnv("ethereum.genesisBlock", ETH_GENESIS_BLOCK)
|
|
||||||
viper.BindEnv("ethereum.networkID", ETH_NETWORK_ID)
|
|
||||||
viper.BindEnv("ethereum.chainID", ETH_CHAIN_ID)
|
|
||||||
|
|
||||||
return node.Info{
|
|
||||||
ID: viper.GetString("ethereum.nodeID"),
|
|
||||||
ClientName: viper.GetString("ethereum.clientName"),
|
|
||||||
GenesisBlock: viper.GetString("ethereum.genesisBlock"),
|
|
||||||
NetworkID: viper.GetString("ethereum.networkID"),
|
|
||||||
ChainID: viper.GetUint64("ethereum.chainID"),
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,7 +20,7 @@ import "fmt"
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
Major = 0 // Major version component of the current release
|
Major = 0 // Major version component of the current release
|
||||||
Minor = 2 // Minor version component of the current release
|
Minor = 1 // Minor version component of the current release
|
||||||
Patch = 0 // Patch version component of the current release
|
Patch = 0 // Patch version component of the current release
|
||||||
Meta = "alpha" // Version metadata to append to the version string
|
Meta = "alpha" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user