Skip to content

Commit

Permalink
pulled main into this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilyak777 committed Jan 27, 2025
2 parents 506c310 + 9bfeb5d commit 64213c9
Show file tree
Hide file tree
Showing 254 changed files with 10,419 additions and 5,473 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ on:
outputs:
tag-value:
description: 'A semver compatible version retrieved from the tag'
value: ${{ jobs.build-and-push.tag-value }}
value: ${{ jobs.build-and-push.outputs.tag-value }}

jobs:
build-and-push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13.8
image: postgres:17.2
env:
POSTGRES_PASSWORD: admin
POSTGRES_USER: postgres
Expand Down
39 changes: 37 additions & 2 deletions blockscout-ens/bens-server/config/prod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"subgraphs_reader": {
"refresh_cache_schedule": "0 0 * * * *",
"refresh_cache_schedule": "0 0 */5 * * *",
"networks": {
"1": {
"blockscout": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"url": "https://gnosis.blockscout.com/"
},
"use_protocols": [
"genome"
"genome", "ens"
]
},
"109": {
Expand Down Expand Up @@ -88,6 +88,15 @@
"base-name-service", "ens"
]
},
"33139": {
"blockscout": {
"url": "https://apechain.calderaexplorer.xyz"
},
"use_protocols": [
"d3-connect-ape"
],
"rpc_url": "https://rpc.apechain.com"
},
"34443": {
"blockscout": {
"url": "https://explorer.mode.network"
Expand Down Expand Up @@ -143,6 +152,14 @@
"use_protocols": [
"zns-blast"
]
},
"57073": {
"blockscout": {
"url": "https://explorer.inkonchain.com/"
},
"use_protocols": [
"ens"
]
}
},
"protocols": {
Expand Down Expand Up @@ -388,6 +405,24 @@
"icon_url": "https://i.imgur.com/cD6VIXk.png",
"docs_url": "https://docs.d3.app/"
}
},
"d3-connect-ape": {
"tld_list": ["ape"],
"network_id": 33139,
"subgraph_name": "d3-connect-ape-subgraph",
"address_resolve_technique": "addr2name",
"specific": {
"type": "d3_connect",
"native_token_contract": "0x0D435A6c16045Abeaf6A442Bf162fd52597B4Ed3",
"resolver_contract": "0xeA54b0E40E956383C95e28cb407FF35235Aa31fE"
},
"meta": {
"short_name": "D3",
"title": "D3 Connect",
"description": "D3 Connect is official identity service for top web3 communities.",
"icon_url": "https://i.imgur.com/cD6VIXk.png",
"docs_url": "https://docs.d3.app/"
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion blockscout-ens/bens-server/tests/domains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ async fn eth_protocol_scenario(base: Url, settings: &Settings) {
);

let request: Value = send_get_request(&base, "/api/v1/1/domains/abcnews").await;
println!("{:?}", request);

assert_eq!(
request,
Expand Down
5 changes: 5 additions & 0 deletions blockscout-ens/graph-node/deployer/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
"subgraph_path": "../subgraphs/d3-connect-subgraph",
"subgraph_name": "d3-connect-shib-subgraph",
"network": "shibarium"
},
"d3-connect-ape": {
"subgraph_path": "../subgraphs/d3-connect-subgraph",
"subgraph_name": "d3-connect-ape-subgraph",
"network": "ape-mainnet"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
"Registry": {
"address": "0xDe74799371Ceac11A0F52BA2694392A391D0dA18",
"startBlock": 3473390
},
"": ""
}
},
"shibarium-testnet": {
"Registry": {
"address": "0x91c2d22ca1028B2E55e3097096494Eb34b7fc81c",
"startBlock": 4555130
},
"": ""
}
},
"ape-mainnet": {
"Registry": {
"address": "0x0D435A6c16045Abeaf6A442Bf162fd52597B4Ed3",
"startBlock": 36550
}
}
}
}
1 change: 0 additions & 1 deletion libs/api-client-framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ edition = "2021"
anyhow = { version = "1.0", default-features = false }
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }
reqwest-middleware = { version = "0.4", default-features = false }
reqwest-retry = { version = "0.7", default-features = false }
serde = { version = "1", default-features = false }
serde_json = { version = "1", default-features = false, features = ["std"] }
serde_path_to_error = { version = "0.1.16", default-features = false }
Expand Down
25 changes: 15 additions & 10 deletions libs/api-client-framework/src/async_client.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
use super::endpoint::Endpoint;
use crate::Error;
use reqwest::{header::HeaderMap, Response, StatusCode};
use reqwest_middleware::ClientBuilder;
use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware};
use reqwest_middleware::{ClientBuilder, Middleware};
use serde::Deserialize;
use std::time::Duration;
use std::{sync::Arc, time::Duration};

#[derive(Clone)]
pub struct HttpApiClientConfig {
/// The maximum time limit for an API request. If a request takes longer than this, it will be
/// cancelled.
pub http_timeout: Duration,
/// Maximum number of allowed retries attempts. Defaults to 1.
pub max_retries: u32,
/// A default set of HTTP headers which will be sent with each API request.
pub default_headers: HeaderMap,
/// Middlewares that will process each API request before the request is actually sent.
pub middlewares: Vec<Arc<dyn Middleware>>,
}

impl Default for HttpApiClientConfig {
fn default() -> Self {
Self {
http_timeout: Duration::from_secs(30),
max_retries: 1,
default_headers: HeaderMap::default(),
middlewares: Vec::new(),
}
}
}
Expand All @@ -35,14 +34,16 @@ pub struct HttpApiClient {

impl HttpApiClient {
pub fn new(base_url: url::Url, config: HttpApiClientConfig) -> Result<Self, Error> {
let retry_policy = ExponentialBackoff::builder().build_with_max_retries(config.max_retries);
let reqwest_client = reqwest::Client::builder()
.default_headers(config.default_headers)
.timeout(config.http_timeout)
.build()?;
let client = ClientBuilder::new(reqwest_client)
.with(RetryTransientMiddleware::new_with_policy(retry_policy))
.build();
let mut client_builder = ClientBuilder::new(reqwest_client);
for middleware in config.middlewares {
client_builder = client_builder.with_arc(middleware);
}
let client = client_builder.build();

Ok(Self {
base_url,
http_client: client,
Expand All @@ -67,6 +68,10 @@ impl HttpApiClient {
);
}

if let Some(headers) = endpoint.headers() {
request = request.headers(headers);
}

let response = request.send().await?;
process_api_response(response).await
}
Expand Down
8 changes: 8 additions & 0 deletions libs/api-client-framework/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ pub trait Endpoint {
None
}

/// The set of headers to be sent with request. Defaults to `None`.
///
/// Implementors should inline this.
#[inline]
fn headers(&self) -> Option<reqwest::header::HeaderMap> {
None
}

/// The HTTP body associated with this endpoint. If not implemented, defaults to `None`.
///
/// Implementors should inline this.
Expand Down
4 changes: 4 additions & 0 deletions libs/api-client-framework/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ mod endpoint;
pub use async_client::{HttpApiClient, HttpApiClientConfig};
pub use endpoint::{serialize_query, Endpoint};

pub use reqwest;
pub use reqwest_middleware;
pub use url;

/******************** Config definition ********************/

#[derive(Debug, thiserror::Error)]
Expand Down
12 changes: 6 additions & 6 deletions libs/blockscout-auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cookie = {version = "0.17", features = ["percent-encode"]}
reqwest = "0.11"
serde = { version = "1.0", features = ["derive"] }
cookie = { version = "0.18", features = [ "percent-encode" ] }
reqwest = "0.12"
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1"
thiserror = "1"
tonic = "0.8"
thiserror = "2"
tonic = "0.12"
tracing = "0.1"
url = "2"
wiremock = "0.5"
wiremock = "0.6"

[dev-dependencies]
tokio = "1.0"
2 changes: 1 addition & 1 deletion libs/blockscout-db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blockscout-db"
version = "0.2.0+blockscout.6.8.0"
version = "0.3.0+blockscout.6.10.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blockscout-db-entity"
version = "0.2.1+blockscout.6.8.0"
version = "0.3.0+blockscout.6.10.1"
edition = "2021"
publish = false

Expand Down
1 change: 1 addition & 0 deletions libs/blockscout-db/entity/src/account_custom_abis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct Model {
pub address_hash: Option<Vec<u8>>,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub name: Option<Vec<u8>>,
pub user_created: Option<bool>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
5 changes: 1 addition & 4 deletions libs/blockscout-db/entity/src/account_identities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ pub struct Model {
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub email: Option<Vec<u8>>,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub name: Option<Vec<u8>>,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub nickname: Option<Vec<u8>>,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub avatar: Option<Vec<u8>>,
pub verification_email_sent_at: Option<DateTime>,
pub otp_sent_at: Option<DateTime>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
1 change: 1 addition & 0 deletions libs/blockscout-db/entity/src/account_tag_addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct Model {
pub name: Option<Vec<u8>>,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub address_hash: Option<Vec<u8>>,
pub user_created: Option<bool>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
5 changes: 3 additions & 2 deletions libs/blockscout-db/entity/src/account_tag_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ pub struct Model {
pub inserted_at: DateTime,
pub updated_at: DateTime,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub tx_hash_hash: Option<Vec<u8>>,
pub transaction_hash_hash: Option<Vec<u8>>,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub name: Option<Vec<u8>>,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub tx_hash: Option<Vec<u8>>,
pub transaction_hash: Option<Vec<u8>>,
pub user_created: Option<bool>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct Model {
pub address_hash: Option<Vec<u8>>,
pub watch_erc_404_input: Option<bool>,
pub watch_erc_404_output: Option<bool>,
pub user_created: Option<bool>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pub struct Model {
pub r#type: Option<String>,
pub method: Option<String>,
pub block_number: Option<i32>,
pub amount: Option<BigDecimal>,
pub tx_fee: Option<BigDecimal>,
pub amount: Option<Decimal>,
pub transaction_fee: Option<Decimal>,
pub viewed_at: Option<DateTime>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/address_coin_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub block_number: i64,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub value: Option<BigDecimal>,
pub value: Option<Decimal>,
pub value_fetched_at: Option<DateTime>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub day: Date,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub value: Option<BigDecimal>,
pub value: Option<Decimal>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ pub struct Model {
pub block_number: i64,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub token_contract_address_hash: Vec<u8>,
pub value: Option<BigDecimal>,
pub value: Option<Decimal>,
pub value_fetched_at: Option<DateTime>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
pub old_value: Option<BigDecimal>,
pub old_value: Option<Decimal>,
#[sea_orm(column_type = "Decimal(Some((78, 0)))", nullable)]
pub token_id: Option<Decimal>,
pub token_type: Option<String>,
Expand Down
4 changes: 2 additions & 2 deletions libs/blockscout-db/entity/src/address_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "address_tags")]
pub struct Model {
#[sea_orm(unique, primary_key, auto_increment = false)] // changed: fix no key column
#[sea_orm(unique)]
pub id: i32,
#[sea_orm(unique, primary_key, auto_increment = false)] // changed: fix no key columns
#[sea_orm(primary_key, auto_increment = false, unique)]
pub label: String,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
4 changes: 3 additions & 1 deletion libs/blockscout-db/entity/src/address_token_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ pub struct Model {
pub block_number: i64,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub token_contract_address_hash: Vec<u8>,
pub value: Option<BigDecimal>,
pub value: Option<Decimal>,
pub value_fetched_at: Option<DateTime>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
#[sea_orm(column_type = "Decimal(Some((78, 0)))", nullable)]
pub token_id: Option<Decimal>,
pub token_type: Option<String>,
pub refetch_after: Option<DateTime>,
pub retries_count: Option<i16>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
Loading

0 comments on commit 64213c9

Please sign in to comment.