(VDB-298) Consume Pit contract storage diffs

- Continuously parse storage diffs CSV data to read Pit contract state
- Convert ilks in database to raw bytes32 value for use in generating
  storage keys dynamically
- Persist storage diffs with block number and hash for validation
This commit is contained in:
Rob Mulholand
2019-02-06 10:31:46 -06:00
parent c474933432
commit 867f92c431
85 changed files with 2143 additions and 79 deletions
+301 -2
View File
@@ -3,7 +3,7 @@
--
-- Dumped from database version 10.5
-- Dumped by pg_dump version 11.1
-- Dumped by pg_dump version 10.5
SET statement_timeout = 0;
SET lock_timeout = 0;
@@ -22,6 +22,20 @@ SET row_security = off;
CREATE SCHEMA maker;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: notify_pricefeed(); Type: FUNCTION; Schema: public; Owner: -
--
@@ -559,6 +573,38 @@ CREATE SEQUENCE maker.frob_id_seq
ALTER SEQUENCE maker.frob_id_seq OWNED BY maker.frob.id;
--
-- Name: pit_drip; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.pit_drip (
id integer NOT NULL,
block_number bigint,
block_hash text,
drip text
);
--
-- Name: pit_drip_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.pit_drip_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pit_drip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.pit_drip_id_seq OWNED BY maker.pit_drip.id;
--
-- Name: pit_file_debt_ceiling; Type: TABLE; Schema: maker; Owner: -
--
@@ -630,6 +676,168 @@ CREATE SEQUENCE maker.pit_file_ilk_id_seq
ALTER SEQUENCE maker.pit_file_ilk_id_seq OWNED BY maker.pit_file_ilk.id;
--
-- Name: pit_ilk_line; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.pit_ilk_line (
id integer NOT NULL,
block_number bigint,
block_hash text,
ilk text,
line numeric NOT NULL
);
--
-- Name: pit_ilk_line_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.pit_ilk_line_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pit_ilk_line_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.pit_ilk_line_id_seq OWNED BY maker.pit_ilk_line.id;
--
-- Name: pit_ilk_spot; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.pit_ilk_spot (
id integer NOT NULL,
block_number bigint,
block_hash text,
ilk text,
spot numeric NOT NULL
);
--
-- Name: pit_ilk_spot_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.pit_ilk_spot_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pit_ilk_spot_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.pit_ilk_spot_id_seq OWNED BY maker.pit_ilk_spot.id;
--
-- Name: pit_line; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.pit_line (
id integer NOT NULL,
block_number bigint,
block_hash text,
line numeric NOT NULL
);
--
-- Name: pit_line_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.pit_line_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pit_line_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.pit_line_id_seq OWNED BY maker.pit_line.id;
--
-- Name: pit_live; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.pit_live (
id integer NOT NULL,
block_number bigint,
block_hash text,
live numeric NOT NULL
);
--
-- Name: pit_live_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.pit_live_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pit_live_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.pit_live_id_seq OWNED BY maker.pit_live.id;
--
-- Name: pit_vat; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.pit_vat (
id integer NOT NULL,
block_number bigint,
block_hash text,
vat text
);
--
-- Name: pit_vat_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.pit_vat_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pit_vat_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.pit_vat_id_seq OWNED BY maker.pit_vat.id;
--
-- Name: price_feeds; Type: TABLE; Schema: maker; Owner: -
--
@@ -1618,6 +1826,13 @@ ALTER TABLE ONLY maker.flop_kick ALTER COLUMN id SET DEFAULT nextval('maker.flop
ALTER TABLE ONLY maker.frob ALTER COLUMN id SET DEFAULT nextval('maker.frob_id_seq'::regclass);
--
-- Name: pit_drip id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_drip ALTER COLUMN id SET DEFAULT nextval('maker.pit_drip_id_seq'::regclass);
--
-- Name: pit_file_debt_ceiling id; Type: DEFAULT; Schema: maker; Owner: -
--
@@ -1632,6 +1847,41 @@ ALTER TABLE ONLY maker.pit_file_debt_ceiling ALTER COLUMN id SET DEFAULT nextval
ALTER TABLE ONLY maker.pit_file_ilk ALTER COLUMN id SET DEFAULT nextval('maker.pit_file_ilk_id_seq'::regclass);
--
-- Name: pit_ilk_line id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_ilk_line ALTER COLUMN id SET DEFAULT nextval('maker.pit_ilk_line_id_seq'::regclass);
--
-- Name: pit_ilk_spot id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_ilk_spot ALTER COLUMN id SET DEFAULT nextval('maker.pit_ilk_spot_id_seq'::regclass);
--
-- Name: pit_line id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_line ALTER COLUMN id SET DEFAULT nextval('maker.pit_line_id_seq'::regclass);
--
-- Name: pit_live id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_live ALTER COLUMN id SET DEFAULT nextval('maker.pit_live_id_seq'::regclass);
--
-- Name: pit_vat id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_vat ALTER COLUMN id SET DEFAULT nextval('maker.pit_vat_id_seq'::regclass);
--
-- Name: price_feeds id; Type: DEFAULT; Schema: maker; Owner: -
--
@@ -2017,6 +2267,14 @@ ALTER TABLE ONLY maker.frob
ADD CONSTRAINT frob_pkey PRIMARY KEY (id);
--
-- Name: pit_drip pit_drip_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_drip
ADD CONSTRAINT pit_drip_pkey PRIMARY KEY (id);
--
-- Name: pit_file_debt_ceiling pit_file_debt_ceiling_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--
@@ -2049,6 +2307,46 @@ ALTER TABLE ONLY maker.pit_file_ilk
ADD CONSTRAINT pit_file_ilk_pkey PRIMARY KEY (id);
--
-- Name: pit_ilk_line pit_ilk_line_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_ilk_line
ADD CONSTRAINT pit_ilk_line_pkey PRIMARY KEY (id);
--
-- Name: pit_ilk_spot pit_ilk_spot_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_ilk_spot
ADD CONSTRAINT pit_ilk_spot_pkey PRIMARY KEY (id);
--
-- Name: pit_line pit_line_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_line
ADD CONSTRAINT pit_line_pkey PRIMARY KEY (id);
--
-- Name: pit_live pit_live_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_live
ADD CONSTRAINT pit_live_pkey PRIMARY KEY (id);
--
-- Name: pit_vat pit_vat_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.pit_vat
ADD CONSTRAINT pit_vat_pkey PRIMARY KEY (id);
--
-- Name: price_feeds price_feeds_header_id_medianizer_address_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--
@@ -2677,4 +2975,5 @@ ALTER TABLE ONLY public.logs
--
-- PostgreSQL database dump complete
--
--