From e18a6fc6a2596269db16c48ccc19acb1352eccf5 Mon Sep 17 00:00:00 2001 From: Bruno Wu Date: Mon, 9 Oct 2023 15:17:04 +0100 Subject: [PATCH] Fix sqlx compilation errors (#217) --- products/pdt/.gitignore | 6 ++++- ...ac179efbb9df801e6efb24f050f7ea700e558.json | 12 ++++++++++ ...9396b12e5800eb4c40f5e00ac48a2b3bf29f.json} | 4 ++-- ...d17529497366445227f40807dd27ee4666412.json | 13 +++++++++-- ...33d4e57cadcf74df725c116df19b7415c0373.json | 5 ++++- ...2aa5ea457f2bdf4c43255bcb3f7f84500ab82.json | 12 ---------- ...f8c3813aacb56a0339863aa559c31d543bbb2.json | 20 +++++++++++++++++ ...079c26b83febfbcef63579a7f62426b7e83b5.json | 11 ++++++++-- ...be2892132a29167e1ec20e809bd5231ca5b78.json | 8 +++++-- ...1c0855bf1f05869889aca50eab332aadc8918.json | 9 ++++++-- ...384081f834078584290607e9202a3d62776c9.json | 20 +++++++++++++++++ ...0200da91b642077ccd1d5be675d2a20a95cd4.json | 7 +++++- ...a71144c543ce7830443c4502373ed86262d3f.json | 22 +++++++++++++++++++ ...568ed4e9e2d2149b32036d1efc25e51dcf16a.json | 7 +++++- products/pdt/README.md | 2 +- products/pdt/pdtlib/src/context.rs | 2 +- 16 files changed, 132 insertions(+), 28 deletions(-) create mode 100644 products/pdt/.sqlx/query-1d578c16098148769ec757f2ad5ac179efbb9df801e6efb24f050f7ea700e558.json rename products/pdt/.sqlx/{query-638b114044c6f8444529f083367461294ca88b5d92eb15e1e4607bad4d35d852.json => query-2de42012e1769057964591eb08349396b12e5800eb4c40f5e00ac48a2b3bf29f.json} (61%) delete mode 100644 products/pdt/.sqlx/query-64b71b79db755614b8cf38ab4b42aa5ea457f2bdf4c43255bcb3f7f84500ab82.json create mode 100644 products/pdt/.sqlx/query-71113d4ffbd55c0d24f5b226118f8c3813aacb56a0339863aa559c31d543bbb2.json create mode 100644 products/pdt/.sqlx/query-b434efab20b5314c1d58a190349384081f834078584290607e9202a3d62776c9.json create mode 100644 products/pdt/.sqlx/query-cbd78c9aa74ef3e208237f30330a71144c543ce7830443c4502373ed86262d3f.json diff --git a/products/pdt/.gitignore b/products/pdt/.gitignore index 64ee209c8..130e74d72 100644 --- a/products/pdt/.gitignore +++ b/products/pdt/.gitignore @@ -1,2 +1,6 @@ target/ -.vscode/ \ No newline at end of file +.vscode/ +# Target for downloaded files +downloads/ +# Stores download metadata +meta.json diff --git a/products/pdt/.sqlx/query-1d578c16098148769ec757f2ad5ac179efbb9df801e6efb24f050f7ea700e558.json b/products/pdt/.sqlx/query-1d578c16098148769ec757f2ad5ac179efbb9df801e6efb24f050f7ea700e558.json new file mode 100644 index 000000000..d8ffc8505 --- /dev/null +++ b/products/pdt/.sqlx/query-1d578c16098148769ec757f2ad5ac179efbb9df801e6efb24f050f7ea700e558.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "CREATE TABLE IF NOT EXISTS microblocks (\n block BIGINT NOT NULL,\n offset_in_block BIGINT,\n shard_id BIGINT,\n header_version BIGINT NOT NULL,\n header_committee_hash bytea,\n header_prev_hash bytea,\n gas_limit BIGINT NOT NULL,\n rewards numeric(76, 38),\n --matching bq bignumeric\n prev_hash bytea,\n tx_root_hash bytea,\n miner_pubkey bytea,\n miner_addr_zil varchar(40),\n miner_addr_eth varchar(40),\n ds_block_num BIGINT,\n state_delta_hash bytea,\n tran_receipt_hash bytea,\n block_shard_id BIGINT,\n gas_used BIGINT NOT NULL,\n epoch_num BIGINT,\n num_txs BIGINT NOT NULL,\n blockhash bytea,\n --blockhash is unique\n timestamp BIGINT NOT NULL,\n cs1 bytea,\n b1 varchar(10),\n cs2 bytea,\n b2 varchar(10),\n imported_from text,\n --zq or eth\n eth_parent_hash bytea,\n eth_uncles_hash bytea,\n eth_state_root bytea,\n eth_extra_data bytea,\n eth_logs_bloom bytea,\n eth_difficulty BIGINT,\n eth_total_difficulty BIGINT,\n eth_nonce bytea,\n eth_base_fee_per_gas BIGINT,\n eth_withdrawals_root bytea,\n eth_withdrawals jsonb\n) PARTITION BY RANGE (block);", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "1d578c16098148769ec757f2ad5ac179efbb9df801e6efb24f050f7ea700e558" +} diff --git a/products/pdt/.sqlx/query-638b114044c6f8444529f083367461294ca88b5d92eb15e1e4607bad4d35d852.json b/products/pdt/.sqlx/query-2de42012e1769057964591eb08349396b12e5800eb4c40f5e00ac48a2b3bf29f.json similarity index 61% rename from products/pdt/.sqlx/query-638b114044c6f8444529f083367461294ca88b5d92eb15e1e4607bad4d35d852.json rename to products/pdt/.sqlx/query-2de42012e1769057964591eb08349396b12e5800eb4c40f5e00ac48a2b3bf29f.json index b05cc708a..76166d5ba 100644 --- a/products/pdt/.sqlx/query-638b114044c6f8444529f083367461294ca88b5d92eb15e1e4607bad4d35d852.json +++ b/products/pdt/.sqlx/query-2de42012e1769057964591eb08349396b12e5800eb4c40f5e00ac48a2b3bf29f.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "CREATE TABLE IF NOT EXISTS transactions (\n id text NOT NULL,\n block BIGINT NOT NULL,\n offset_in_block BIGINT NOT NULL,\n zqversion BIGINT NOT NULL,\n amount numeric(76, 38),\n api_type text,\n code bytea,\n data bytea,\n gas_limit BIGINT NOT NULL,\n gas_price numeric(76, 38),\n nonce BIGINT,\n raw_receipt bytea,\n receipt jsonb,\n sender_public_key bytea,\n from_addr_zil varchar(40),\n from_addr_eth varchar(40),\n signature bytea,\n to_addr varchar(40) NOT NULL,\n version BIGINT NOT NULL,\n cum_gas BIGINT,\n shard_id BIGINT\n) PARTITION BY RANGE (block);", + "query": "CREATE TABLE IF NOT EXISTS transactions (\n id text NOT NULL,\n block BIGINT NOT NULL,\n offset_in_block BIGINT NOT NULL,\n zqversion BIGINT NOT NULL,\n amount numeric(76, 38),\n api_type text,\n code bytea,\n data bytea,\n gas_limit BIGINT NOT NULL,\n gas_price numeric(76, 38),\n nonce BIGINT,\n raw_receipt bytea,\n receipt jsonb,\n sender_public_key bytea,\n from_addr_zil varchar(40),\n from_addr_eth varchar(40),\n signature bytea,\n to_addr varchar(40),\n version BIGINT NOT NULL,\n cum_gas BIGINT,\n shard_id BIGINT,\n imported_from text NOT NULL,\n eth_transaction_index bigint,\n eth_value numeric,\n eth_input bytea,\n eth_v BIGINT,\n eth_r text,\n eth_s text,\n eth_transaction_type BIGINT\n) PARTITION BY RANGE (block);", "describe": { "columns": [], "parameters": { @@ -8,5 +8,5 @@ }, "nullable": [] }, - "hash": "638b114044c6f8444529f083367461294ca88b5d92eb15e1e4607bad4d35d852" + "hash": "2de42012e1769057964591eb08349396b12e5800eb4c40f5e00ac48a2b3bf29f" } diff --git a/products/pdt/.sqlx/query-58f8c48042a724afbef484ebd28d17529497366445227f40807dd27ee4666412.json b/products/pdt/.sqlx/query-58f8c48042a724afbef484ebd28d17529497366445227f40807dd27ee4666412.json index 54b91f28b..26eab315a 100644 --- a/products/pdt/.sqlx/query-58f8c48042a724afbef484ebd28d17529497366445227f40807dd27ee4666412.json +++ b/products/pdt/.sqlx/query-58f8c48042a724afbef484ebd28d17529497366445227f40807dd27ee4666412.json @@ -25,9 +25,18 @@ } ], "parameters": { - "Left": ["TextArray", "Int8", "Text"] + "Left": [ + "TextArray", + "Int8", + "Text" + ] }, - "nullable": [true, true, true, true] + "nullable": [ + true, + true, + true, + true + ] }, "hash": "58f8c48042a724afbef484ebd28d17529497366445227f40807dd27ee4666412" } diff --git a/products/pdt/.sqlx/query-591ed9b54748f97f95364d4838533d4e57cadcf74df725c116df19b7415c0373.json b/products/pdt/.sqlx/query-591ed9b54748f97f95364d4838533d4e57cadcf74df725c116df19b7415c0373.json index 6617571af..69c6745ff 100644 --- a/products/pdt/.sqlx/query-591ed9b54748f97f95364d4838533d4e57cadcf74df725c116df19b7415c0373.json +++ b/products/pdt/.sqlx/query-591ed9b54748f97f95364d4838533d4e57cadcf74df725c116df19b7415c0373.json @@ -17,7 +17,10 @@ "parameters": { "Left": [] }, - "nullable": [null, null] + "nullable": [ + null, + null + ] }, "hash": "591ed9b54748f97f95364d4838533d4e57cadcf74df725c116df19b7415c0373" } diff --git a/products/pdt/.sqlx/query-64b71b79db755614b8cf38ab4b42aa5ea457f2bdf4c43255bcb3f7f84500ab82.json b/products/pdt/.sqlx/query-64b71b79db755614b8cf38ab4b42aa5ea457f2bdf4c43255bcb3f7f84500ab82.json deleted file mode 100644 index 766768b17..000000000 --- a/products/pdt/.sqlx/query-64b71b79db755614b8cf38ab4b42aa5ea457f2bdf4c43255bcb3f7f84500ab82.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "CREATE TABLE IF NOT EXISTS microblocks (\n block BIGINT NOT NULL,\n offset_in_block BIGINT NOT NULL,\n shard_id BIGINT NOT NULL,\n header_version BIGINT NOT NULL,\n header_committee_hash bytea,\n header_prev_hash bytea,\n gas_limit BIGINT NOT NULL,\n rewards numeric(76, 38),\n --matching bq bignumeric\n prev_hash bytea,\n tx_root_hash bytea,\n miner_pubkey bytea,\n miner_addr_zil varchar(40),\n miner_addr_eth varchar(40),\n ds_block_num BIGINT NOT NULL,\n state_delta_hash bytea,\n tran_receipt_hash bytea,\n block_shard_id BIGINT NOT NULL,\n gas_used BIGINT NOT NULL,\n epoch_num BIGINT NOT NULL,\n num_txs BIGINT NOT NULL,\n blockhash bytea,\n --blockhash is unique\n timestamp BIGINT NOT NULL,\n cs1 bytea,\n b1 varchar(10),\n cs2 bytea,\n b2 varchar(10)\n) PARTITION BY RANGE (block);", - "describe": { - "columns": [], - "parameters": { - "Left": [] - }, - "nullable": [] - }, - "hash": "64b71b79db755614b8cf38ab4b42aa5ea457f2bdf4c43255bcb3f7f84500ab82" -} diff --git a/products/pdt/.sqlx/query-71113d4ffbd55c0d24f5b226118f8c3813aacb56a0339863aa559c31d543bbb2.json b/products/pdt/.sqlx/query-71113d4ffbd55c0d24f5b226118f8c3813aacb56a0339863aa559c31d543bbb2.json new file mode 100644 index 000000000..0e4cdffa1 --- /dev/null +++ b/products/pdt/.sqlx/query-71113d4ffbd55c0d24f5b226118f8c3813aacb56a0339863aa559c31d543bbb2.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "select * from (select unnest(imported_ranges) as range from microblocks_meta) as r", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "range", + "type_info": "Int8Range" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null + ] + }, + "hash": "71113d4ffbd55c0d24f5b226118f8c3813aacb56a0339863aa559c31d543bbb2" +} diff --git a/products/pdt/.sqlx/query-7a624cbcfb8f10f559cd7e4a7d6079c26b83febfbcef63579a7f62426b7e83b5.json b/products/pdt/.sqlx/query-7a624cbcfb8f10f559cd7e4a7d6079c26b83febfbcef63579a7f62426b7e83b5.json index 0b066c7e7..f1b794519 100644 --- a/products/pdt/.sqlx/query-7a624cbcfb8f10f559cd7e4a7d6079c26b83febfbcef63579a7f62426b7e83b5.json +++ b/products/pdt/.sqlx/query-7a624cbcfb8f10f559cd7e4a7d6079c26b83febfbcef63579a7f62426b7e83b5.json @@ -25,9 +25,16 @@ } ], "parameters": { - "Left": ["TextArray"] + "Left": [ + "TextArray" + ] }, - "nullable": [true, true, true, true] + "nullable": [ + true, + true, + true, + true + ] }, "hash": "7a624cbcfb8f10f559cd7e4a7d6079c26b83febfbcef63579a7f62426b7e83b5" } diff --git a/products/pdt/.sqlx/query-9220db48958b2c43d5fb734f1c8be2892132a29167e1ec20e809bd5231ca5b78.json b/products/pdt/.sqlx/query-9220db48958b2c43d5fb734f1c8be2892132a29167e1ec20e809bd5231ca5b78.json index b2ced1c9f..d3f4179a6 100644 --- a/products/pdt/.sqlx/query-9220db48958b2c43d5fb734f1c8be2892132a29167e1ec20e809bd5231ca5b78.json +++ b/products/pdt/.sqlx/query-9220db48958b2c43d5fb734f1c8be2892132a29167e1ec20e809bd5231ca5b78.json @@ -10,9 +10,13 @@ } ], "parameters": { - "Left": ["Name"] + "Left": [ + "Name" + ] }, - "nullable": [true] + "nullable": [ + true + ] }, "hash": "9220db48958b2c43d5fb734f1c8be2892132a29167e1ec20e809bd5231ca5b78" } diff --git a/products/pdt/.sqlx/query-aa1826c9f7c13e3946f40f8d4c71c0855bf1f05869889aca50eab332aadc8918.json b/products/pdt/.sqlx/query-aa1826c9f7c13e3946f40f8d4c71c0855bf1f05869889aca50eab332aadc8918.json index 773a2c9b2..e97220199 100644 --- a/products/pdt/.sqlx/query-aa1826c9f7c13e3946f40f8d4c71c0855bf1f05869889aca50eab332aadc8918.json +++ b/products/pdt/.sqlx/query-aa1826c9f7c13e3946f40f8d4c71c0855bf1f05869889aca50eab332aadc8918.json @@ -15,9 +15,14 @@ } ], "parameters": { - "Left": ["Name"] + "Left": [ + "Name" + ] }, - "nullable": [true, true] + "nullable": [ + true, + true + ] }, "hash": "aa1826c9f7c13e3946f40f8d4c71c0855bf1f05869889aca50eab332aadc8918" } diff --git a/products/pdt/.sqlx/query-b434efab20b5314c1d58a190349384081f834078584290607e9202a3d62776c9.json b/products/pdt/.sqlx/query-b434efab20b5314c1d58a190349384081f834078584290607e9202a3d62776c9.json new file mode 100644 index 000000000..866bcf378 --- /dev/null +++ b/products/pdt/.sqlx/query-b434efab20b5314c1d58a190349384081f834078584290607e9202a3d62776c9.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "select * from (select unnest(imported_ranges) as range from transactions_meta) as r", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "range", + "type_info": "Int8Range" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null + ] + }, + "hash": "b434efab20b5314c1d58a190349384081f834078584290607e9202a3d62776c9" +} diff --git a/products/pdt/.sqlx/query-bef964da8bd0b24fe20c34e0e6d0200da91b642077ccd1d5be675d2a20a95cd4.json b/products/pdt/.sqlx/query-bef964da8bd0b24fe20c34e0e6d0200da91b642077ccd1d5be675d2a20a95cd4.json index 56976fa4d..b0dd59104 100644 --- a/products/pdt/.sqlx/query-bef964da8bd0b24fe20c34e0e6d0200da91b642077ccd1d5be675d2a20a95cd4.json +++ b/products/pdt/.sqlx/query-bef964da8bd0b24fe20c34e0e6d0200da91b642077ccd1d5be675d2a20a95cd4.json @@ -4,7 +4,12 @@ "describe": { "columns": [], "parameters": { - "Left": ["TextArray", "Int8Array", "TextArray", "NumericArray"] + "Left": [ + "TextArray", + "Int8Array", + "TextArray", + "NumericArray" + ] }, "nullable": [] }, diff --git a/products/pdt/.sqlx/query-cbd78c9aa74ef3e208237f30330a71144c543ce7830443c4502373ed86262d3f.json b/products/pdt/.sqlx/query-cbd78c9aa74ef3e208237f30330a71144c543ce7830443c4502373ed86262d3f.json new file mode 100644 index 000000000..d146b468f --- /dev/null +++ b/products/pdt/.sqlx/query-cbd78c9aa74ef3e208237f30330a71144c543ce7830443c4502373ed86262d3f.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "select relispartition from pg_class where relname=$1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "relispartition", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Name" + ] + }, + "nullable": [ + false + ] + }, + "hash": "cbd78c9aa74ef3e208237f30330a71144c543ce7830443c4502373ed86262d3f" +} diff --git a/products/pdt/.sqlx/query-ecae40c363376db91aecf6359e2568ed4e9e2d2149b32036d1efc25e51dcf16a.json b/products/pdt/.sqlx/query-ecae40c363376db91aecf6359e2568ed4e9e2d2149b32036d1efc25e51dcf16a.json index d60da4bd7..dc17a9efe 100644 --- a/products/pdt/.sqlx/query-ecae40c363376db91aecf6359e2568ed4e9e2d2149b32036d1efc25e51dcf16a.json +++ b/products/pdt/.sqlx/query-ecae40c363376db91aecf6359e2568ed4e9e2d2149b32036d1efc25e51dcf16a.json @@ -4,7 +4,12 @@ "describe": { "columns": [], "parameters": { - "Left": ["Text", "Int8", "Text", "Numeric"] + "Left": [ + "Text", + "Int8", + "Text", + "Numeric" + ] }, "nullable": [] }, diff --git a/products/pdt/README.md b/products/pdt/README.md index 60cf262c4..c8e7bc00b 100644 --- a/products/pdt/README.md +++ b/products/pdt/README.md @@ -23,7 +23,7 @@ cargo run -- --download-dir= --unpack-dir= --unpack-dir= --postgres_url= psqlmulti --nr-threads= --batch-blocks= --partition_size=10000 +cargo run -- --download-dir= --unpack-dir= --postgres-url= psqlmulti --nr-threads= --batch-blocks= --partition-size=10000 ``` All our import operations are multithreaded. Each thread will create a duplicate diff --git a/products/pdt/pdtlib/src/context.rs b/products/pdt/pdtlib/src/context.rs index 39b22e331..b32def04a 100644 --- a/products/pdt/pdtlib/src/context.rs +++ b/products/pdt/pdtlib/src/context.rs @@ -179,7 +179,7 @@ fn make_unsigned( ) -> Result, std::convert::Infallible> { { let mut props = operation.properties_mut(); - let mut signing_config = props + let signing_config = props .get_mut::() .expect("has signing_config"); signing_config.signing_requirements = aws_sig_auth::signer::SigningRequirements::Disabled;