From 7d63c2e208d049e17a7cdfc6eb944a5544c88648 Mon Sep 17 00:00:00 2001 From: Miles Zhang Date: Tue, 28 Nov 2023 17:43:59 +0800 Subject: [PATCH 1/3] fix: cursor field must use fixed order column Signed-off-by: Miles Zhang --- lib/godwoken_explorer/graphql/resolovers/udt.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/godwoken_explorer/graphql/resolovers/udt.ex b/lib/godwoken_explorer/graphql/resolovers/udt.ex index 0e019f7f..104bc8ee 100644 --- a/lib/godwoken_explorer/graphql/resolovers/udt.ex +++ b/lib/godwoken_explorer/graphql/resolovers/udt.ex @@ -143,7 +143,7 @@ defmodule GodwokenExplorer.Graphql.Resolvers.UDT do } ) |> paginate_query(input, %{ - cursor_fields: [block_number: :desc, token_contract_address_hash: :asc, token_id: :asc], + cursor_fields: [token_contract_address_hash: :asc, token_id: :asc], total_count_primary_key_field: [:id] }) From 27bd06bc05d51fb01d8e52e500b6000b9ee7ab4b Mon Sep 17 00:00:00 2001 From: Miles Zhang Date: Wed, 29 Nov 2023 12:37:41 +0800 Subject: [PATCH 2/3] chore: update deps Signed-off-by: Miles Zhang --- mix.exs | 1 + mix.lock | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mix.exs b/mix.exs index df293441..a6f7f083 100644 --- a/mix.exs +++ b/mix.exs @@ -100,6 +100,7 @@ defmodule GodwokenExplorer.MixProject do # monitor {:sentry, "~> 10.0"}, + {:nimble_options, "~> 1.0"}, # static code analysis tool {:credo, "~> 1.7.0", only: [:dev, :test], runtime: false}, diff --git a/mix.lock b/mix.lock index 3c4b7a9f..9f7bbc7e 100644 --- a/mix.lock +++ b/mix.lock @@ -73,7 +73,7 @@ "money": {:hex, :money, "1.12.2", "8d294c9c3805bfeeaeeffadb3d8c9dce1be5ab1236dc4e564728badcbb79510d", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:ecto, "~> 1.0 or ~> 2.0 or ~> 2.1 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.0 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "d9cabe0549f0d815870c3832b2164afe1dab3802c76ba9cda8fd6199bd6383a9"}, "mox": {:hex, :mox, "1.0.1", "b651bf0113265cda0ba3a827fcb691f848b683c373b77e7d7439910a8d754d6e", [:mix], [], "hexpm", "35bc0dea5499d18db4ef7fe4360067a59b06c74376eb6ab3bd67e6295b133469"}, "nimble_csv": {:hex, :nimble_csv, "1.2.0", "4e26385d260c61eba9d4412c71cea34421f296d5353f914afe3f2e71cce97722", [:mix], [], "hexpm", "d0628117fcc2148178b034044c55359b26966c6eaa8e2ce15777be3bbc91b12a"}, - "nimble_options": {:hex, :nimble_options, "0.4.0", "c89babbab52221a24b8d1ff9e7d838be70f0d871be823165c94dd3418eea728f", [:mix], [], "hexpm", "e6701c1af326a11eea9634a3b1c62b475339ace9456c1a23ec3bc9a847bca02d"}, + "nimble_options": {:hex, :nimble_options, "1.0.2", "92098a74df0072ff37d0c12ace58574d26880e522c22801437151a159392270e", [:mix], [], "hexpm", "fd12a8db2021036ce12a309f26f564ec367373265b53e25403f0ee697380f1b8"}, "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, "nimble_pool": {:hex, :nimble_pool, "0.2.6", "91f2f4c357da4c4a0a548286c84a3a28004f68f05609b4534526871a22053cde", [:mix], [], "hexpm", "1c715055095d3f2705c4e236c18b618420a35490da94149ff8b580a2144f653f"}, "oban": {:hex, :oban, "2.16.2", "ec8dfd2f6dfdcd885061b58aeaa2794a0a6f62bad20c15939e4bb80bfd74ed76", [:mix], [{:ecto_sql, "~> 3.6", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:ecto_sqlite3, "~> 0.9", [hex: :ecto_sqlite3, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3d343c80948676abf9652da1e793ab6140ba64e9de7c8d6630eb5bb4aa8fea79"}, @@ -91,7 +91,7 @@ "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, "phoenix_template": {:hex, :phoenix_template, "1.0.3", "32de561eefcefa951aead30a1f94f1b5f0379bc9e340bb5c667f65f1edfa4326", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "16f4b6588a4152f3cc057b9d0c0ba7e82ee23afa65543da535313ad8d25d8e2c"}, "phoenix_view": {:hex, :phoenix_view, "2.0.2", "6bd4d2fd595ef80d33b439ede6a19326b78f0f1d8d62b9a318e3d9c1af351098", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "a929e7230ea5c7ee0e149ffcf44ce7cf7f4b6d2bfe1752dd7c084cdff152d36f"}, - "plug": {:hex, :plug, "1.15.1", "b7efd81c1a1286f13efb3f769de343236bd8b7d23b4a9f40d3002fc39ad8f74c", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "459497bd94d041d98d948054ec6c0b76feacd28eec38b219ca04c0de13c79d30"}, + "plug": {:hex, :plug, "1.15.2", "94cf1fa375526f30ff8770837cb804798e0045fd97185f0bb9e5fcd858c792a3", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "02731fa0c2dcb03d8d21a1d941bdbbe99c2946c0db098eee31008e04c6283615"}, "plug_cowboy": {:hex, :plug_cowboy, "2.6.1", "9a3bbfceeb65eff5f39dab529e5cd79137ac36e913c02067dba3963a26efe9b2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "de36e1a21f451a18b790f37765db198075c25875c64834bcc82d90b309eb6613"}, "plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"}, "plug_heartbeat": {:hex, :plug_heartbeat, "1.0.0", "11b263a4c04d45b85c16ae815dd9a29ad405d7962769313c1244959328ebc39c", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "fa17f6eac7f4d91fcef36d253bc0114ff8c4d6e91665f2b06be1beb753cbb6aa"}, @@ -110,7 +110,7 @@ "scrivener": {:hex, :scrivener, "2.7.2", "1d913c965ec352650a7f864ad7fd8d80462f76a32f33d57d1e48bc5e9d40aba2", [:mix], [], "hexpm", "7866a0ec4d40274efbee1db8bead13a995ea4926ecd8203345af8f90d2b620d9"}, "scrivener_ecto": {:hex, :scrivener_ecto, "2.7.0", "cf64b8cb8a96cd131cdbcecf64e7fd395e21aaa1cb0236c42a7c2e34b0dca580", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:scrivener, "~> 2.4", [hex: :scrivener, repo: "hexpm", optional: false]}], "hexpm", "e809f171687806b0031129034352f5ae44849720c48dd839200adeaf0ac3e260"}, "scrivener_list": {:hex, :scrivener_list, "2.0.1", "2b3b5c6aaf21d13b76071e755af498b641f37a069e34e68585ba4c624095d719", [:mix], [{:scrivener_ecto, "~> 1.0 or ~> 2.0", [hex: :scrivener_ecto, repo: "hexpm", optional: false]}], "hexpm", "dc82a317268e24b29891b2de659cd82d15654f49ceee86846de2c96b3c4f4e5d"}, - "sentry": {:hex, :sentry, "9.1.0", "8689b85774003ddcebfd9d48a93bc3f3bf72223983514521aa30645c6f204f86", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, "~> 2.3", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "d70c88ab0c6a511594856ae2244d1bd70b8b7a4a42201a3569880f1dd2a3adec"}, + "sentry": {:hex, :sentry, "10.0.2", "dbefd055fa0fa8e13bf9cdd1861046f4cbd1dd6cbba0d8bc79f8261e888b8c0d", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_options, "~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, "~> 2.3", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "7655afa3af7d907a2ac32ba07294a802a7773490c7c08bd26e0ef0705fbcf8c8"}, "sobelow": {:hex, :sobelow, "0.13.0", "218afe9075904793f5c64b8837cc356e493d88fddde126a463839351870b8d1e", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cd6e9026b85fc35d7529da14f95e85a078d9dd1907a9097b3ba6ac7ebbe34a0d"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, "table_rex": {:hex, :table_rex, "3.1.1", "0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa", [:mix], [], "hexpm", "678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490"}, From 59509dfa046fc2d51755b432945b6bee3680922a Mon Sep 17 00:00:00 2001 From: Miles Zhang Date: Wed, 29 Nov 2023 13:32:49 +0800 Subject: [PATCH 3/3] chore: set dsn nil Signed-off-by: Miles Zhang --- config/runtime.exs | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index 57cb5cc6..825de1d0 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -8,9 +8,11 @@ gwscan_endpoint_host = System.get_env("GWSCAN_ENDPOINT_HOST", "localhost") gwscan_endpoint_port = System.get_env("GWSCAN_ENDPOINT_PORT", "4001") |> String.to_integer() gwscan_endpoint_scheme = System.get_env("GWSCAN_ENDPOINT_SCHEME", "http") -default_gwscan_endpoint_secret_key = "RyKusGni7iTLOYLtHal3FRI4uKsV4mD/v25fyKBfVsxdrYChqL0IVTd07VvZoLx9" +default_gwscan_endpoint_secret_key = + "RyKusGni7iTLOYLtHal3FRI4uKsV4mD/v25fyKBfVsxdrYChqL0IVTd07VvZoLx9" -gwscan_endpoint_secret_key = System.get_env("GODWOKEN_SCAN_ENDPOINT_SECRET_KEY", default_gwscan_endpoint_secret_key) +gwscan_endpoint_secret_key = + System.get_env("GODWOKEN_SCAN_ENDPOINT_SECRET_KEY", default_gwscan_endpoint_secret_key) default_gwscan_endpoint_live_view_signing_salt = "Bd1hG/MH" @@ -76,7 +78,8 @@ config :godwoken_explorer, GodwokenExplorer.Repo, connect_timeout: pg_connect_timeout, socket_options: maybe_ipv6 -gwscan_block_sync_woker_on_off = System.get_env("GWSCAN_BLOCK_SYNC_WORKER_ON_OFF", "false") |> String.to_atom() +gwscan_block_sync_woker_on_off = + System.get_env("GWSCAN_BLOCK_SYNC_WORKER_ON_OFF", "false") |> String.to_atom() gwscan_block_global_state_worker_on_off = System.get_env("GWSCAN_BLOCK_GLOBAL_STATE_WORKER_ON_OFF", "false") |> String.to_atom() @@ -90,7 +93,8 @@ gwscan_block_sync_l1_block_woker_on_off = gwscan_block_pending_transaction_woker_on_off = System.get_env("GWSCAN_BLOCK_PENDING_TRANSACTION_WORKER_ON_OFF", "false") |> String.to_atom() -gwscan_udt_fetcher_on_off = System.get_env("GWSCAN_UDT_FETCHER_ON_OFF", "false") |> String.to_atom() +gwscan_udt_fetcher_on_off = + System.get_env("GWSCAN_UDT_FETCHER_ON_OFF", "false") |> String.to_atom() config :godwoken_explorer, :on_off, sync_worker: gwscan_block_sync_woker_on_off, @@ -154,11 +158,14 @@ config :godwoken_explorer, ] ] -gwscan_interval_sync_worker = System.get_env("GWSCAN_INTERVAL_SYNC_WORKER", "10") |> String.to_integer() +gwscan_interval_sync_worker = + System.get_env("GWSCAN_INTERVAL_SYNC_WORKER", "10") |> String.to_integer() -gwscan_interval_global_state_worker = System.get_env("GWSCAN_INTERVAL_GLOBAL_STATE_WORKER", "30") |> String.to_integer() +gwscan_interval_global_state_worker = + System.get_env("GWSCAN_INTERVAL_GLOBAL_STATE_WORKER", "30") |> String.to_integer() -gwscan_interval_bind_l1_woker = System.get_env("GWSCAN_INTERVAL_BIND_L1_WORKER", "10") |> String.to_integer() +gwscan_interval_bind_l1_woker = + System.get_env("GWSCAN_INTERVAL_BIND_L1_WORKER", "10") |> String.to_integer() gwscan_interval_sync_deposition_worker = System.get_env("GWSCAN_INTERVAL_SYNC_DEPOSITION_WORKER", "2") |> String.to_integer() @@ -173,7 +180,7 @@ config :godwoken_explorer, sync_deposition_worker_interval: gwscan_interval_sync_deposition_worker, pending_transaction_worker_interval: gwscan_interval_pending_transaction_worker -gwscan_sentry_dsn = System.get_env("GWSCAN_SENTRY_DSN", "") +gwscan_sentry_dsn = System.get_env("GWSCAN_SENTRY_DSN", nil) gwscan_sentry_environment_name = System.get_env("GWSCAN_SENTRY_ENVIRONMENT_NAME", "") config :sentry, @@ -181,13 +188,16 @@ config :sentry, dsn: gwscan_sentry_dsn, environment_name: gwscan_sentry_environment_name -gwscan_multiple_block_once = System.get_env("GWSCAN_MULTIPLE_BLOCK_ONCE", "false") |> String.to_atom() +gwscan_multiple_block_once = + System.get_env("GWSCAN_MULTIPLE_BLOCK_ONCE", "false") |> String.to_atom() gwscan_block_batch_size = System.get_env("GWSCAN_BLOCK_BATCH_SIZE", "1") |> String.to_integer() -gwscan_multiple_l1_block_once = System.get_env("GWSCAN_MULTIPLE_L1_BLOCK_ONCE", "false") |> String.to_atom() +gwscan_multiple_l1_block_once = + System.get_env("GWSCAN_MULTIPLE_L1_BLOCK_ONCE", "false") |> String.to_atom() -gwscan_l1_block_batch_size = System.get_env("GWSCAN_L1_BLOCK_BATCH_SIZE", "1") |> String.to_integer() +gwscan_l1_block_batch_size = + System.get_env("GWSCAN_L1_BLOCK_BATCH_SIZE", "1") |> String.to_integer() config :godwoken_explorer, multiple_block_once: gwscan_multiple_block_once, @@ -225,4 +235,5 @@ config :godwoken_explorer, Indexer, enabled: System.get_env("DISABLE_INDEXER") ! config :godwoken_explorer, Web, enabled: System.get_env("DISABLE_WEB") != "true" config :godwoken_explorer, Oban.Crontab, enabled: System.get_env("DISABLE_OBAN_CRONTAB") != "true" -config :godwoken_explorer, :bit, indexer_url: System.get_env("BIT_INDEXER_URL") || "https://indexer-v1.did.id" +config :godwoken_explorer, :bit, + indexer_url: System.get_env("BIT_INDEXER_URL") || "https://indexer-v1.did.id"