Skip to content

Commit

Permalink
Remove da_deploy_height
Browse files Browse the repository at this point in the history
  • Loading branch information
bvrooman committed Apr 28, 2024
1 parent 04608ce commit ef805da
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 49 deletions.
14 changes: 3 additions & 11 deletions bin/fuel-core/src/cli/run/relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ use clap::{
Args,
};
use core::time::Duration;
use fuel_core::{
relayer::{
Config,
H160,
},
types::blockchain::primitives::DaBlockHeight,
use fuel_core::relayer::{
Config,
H160,
};
use std::str::FromStr;

Expand All @@ -31,10 +28,6 @@ pub struct RelayerArgs {
#[arg(long = "relayer-v2-listening-contracts", value_parser = parse_h160, env)]
pub eth_v2_listening_contracts: Vec<H160>,

/// Number of da block that the contract is deployed at.
#[clap(long = "relayer-da-deploy-height", default_value_t = Config::DEFAULT_DA_DEPLOY_HEIGHT, env)]
pub da_deploy_height: u64,

/// Number of pages or blocks containing logs that
/// should be downloaded in a single call to the da layer
#[clap(long = "relayer-log-page-size", default_value_t = Config::DEFAULT_LOG_PAGE_SIZE, env)]
Expand Down Expand Up @@ -65,7 +58,6 @@ impl RelayerArgs {
}

let config = Config {
da_deploy_height: DaBlockHeight(self.da_deploy_height),
relayer: self.relayer,
eth_v2_listening_contracts: self.eth_v2_listening_contracts,
log_page_size: self.log_page_size,
Expand Down
2 changes: 0 additions & 2 deletions crates/fuel-core/src/service/adapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ impl ConsensusAdapter {
pub struct MaybeRelayerAdapter {
#[cfg(feature = "relayer")]
pub relayer_synced: Option<fuel_core_relayer::SharedState<Database<Relayer>>>,
#[cfg(feature = "relayer")]
pub da_deploy_height: fuel_core_types::blockchain::primitives::DaBlockHeight,
}

#[derive(Clone)]
Expand Down
9 changes: 0 additions & 9 deletions crates/fuel-core/src/service/sub_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ use fuel_core_poa::Trigger;
use std::sync::Arc;
use tokio::sync::Mutex;

#[cfg(feature = "relayer")]
use crate::relayer::Config as RelayerConfig;
use crate::service::StaticGasPrice;
#[cfg(feature = "relayer")]
use fuel_core_types::blockchain::primitives::DaBlockHeight;

pub type PoAService =
fuel_core_poa::Service<TxPoolAdapter, BlockProducerAdapter, BlockImporterAdapter>;
Expand Down Expand Up @@ -92,11 +88,6 @@ pub fn init_sub_services(
let relayer_adapter = MaybeRelayerAdapter {
#[cfg(feature = "relayer")]
relayer_synced: relayer_service.as_ref().map(|r| r.shared.clone()),
#[cfg(feature = "relayer")]
da_deploy_height: config.relayer.as_ref().map_or(
DaBlockHeight(RelayerConfig::DEFAULT_DA_DEPLOY_HEIGHT),
|config| config.da_deploy_height,
),
};

#[cfg(feature = "p2p")]
Expand Down
5 changes: 0 additions & 5 deletions crates/services/relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use ethers_core::types::{
H160,
H256,
};
use fuel_core_types::blockchain::primitives::DaBlockHeight;
use once_cell::sync::Lazy;
use std::{
str::FromStr,
Expand All @@ -20,8 +19,6 @@ pub(crate) static ETH_FORCED_TX: Lazy<H256> =
#[derive(Clone, Debug)]
/// Configuration settings for the Relayer.
pub struct Config {
/// The da block to which the contract was deployed.
pub da_deploy_height: DaBlockHeight,
/// Uri address to ethereum client.
pub relayer: Option<url::Url>,
// TODO: Create `EthAddress` into `fuel_core_types`.
Expand All @@ -47,7 +44,6 @@ pub struct Config {
#[allow(missing_docs)]
impl Config {
pub const DEFAULT_LOG_PAGE_SIZE: u64 = 10_000;
pub const DEFAULT_DA_DEPLOY_HEIGHT: u64 = 0;
pub const DEFAULT_SYNC_MINIMUM_DURATION: Duration = Duration::from_secs(5);
pub const DEFAULT_SYNCING_CALL_FREQ: Duration = Duration::from_secs(5);
pub const DEFAULT_SYNCING_LOG_FREQ: Duration = Duration::from_secs(60);
Expand All @@ -56,7 +52,6 @@ impl Config {
impl Default for Config {
fn default() -> Self {
Self {
da_deploy_height: DaBlockHeight::from(Self::DEFAULT_DA_DEPLOY_HEIGHT),
relayer: None,
eth_v2_listening_contracts: vec![H160::from_str(
"0x03E4538018285e1c03CCce2F92C9538c87606911",
Expand Down
9 changes: 4 additions & 5 deletions crates/services/relayer/src/ports/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{
DaHeightTable,
EventsHistory,
},
Config,
};
use fuel_core_storage::test_helpers::{
MockBasic,
Expand Down Expand Up @@ -69,7 +68,7 @@ fn test_insert_events() {
db.storage
.expect_get::<DaHeightTable>()
.times(1)
.returning(|_| Ok(Some(Cow::Owned(Config::DEFAULT_DA_DEPLOY_HEIGHT.into()))));
.returning(|_| Ok(Some(Cow::Owned(0u64.into()))));
db.storage
.expect_get::<DaHeightTable>()
.returning(|_| Ok(Some(Cow::Owned(9u64.into()))));
Expand Down Expand Up @@ -126,7 +125,7 @@ fn insert_always_raises_da_height_monotonically() {
db.storage
.expect_get::<DaHeightTable>()
.times(1)
.returning(|_| Ok(Some(Cow::Owned(Config::DEFAULT_DA_DEPLOY_HEIGHT.into()))));
.returning(|_| Ok(Some(Cow::Owned(0u64.into()))));
db.storage
.expect_get::<DaHeightTable>()
.returning(|_| Ok(None));
Expand All @@ -152,7 +151,7 @@ fn insert_fails_for_events_with_different_height() {
db.storage
.expect_get::<DaHeightTable>()
.times(1)
.returning(|_| Ok(Some(Cow::Owned(Config::DEFAULT_DA_DEPLOY_HEIGHT.into()))));
.returning(|_| Ok(Some(Cow::Owned(0u64.into()))));
db.storage
.expect_get::<DaHeightTable>()
.returning(|_| Ok(None));
Expand Down Expand Up @@ -199,7 +198,7 @@ fn insert_fails_for_events_same_height_but_on_different_height() {
db.storage
.expect_get::<DaHeightTable>()
.times(1)
.returning(|_| Ok(Some(Cow::Owned(Config::DEFAULT_DA_DEPLOY_HEIGHT.into()))));
.returning(|_| Ok(Some(Cow::Owned(0u64.into()))));
db.storage
.expect_get::<DaHeightTable>()
.returning(|_| Ok(None));
Expand Down
10 changes: 2 additions & 8 deletions crates/services/relayer/src/service/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ async fn deploy_height_does_not_override() {
mock_db
.set_finalized_da_height_to_at_least(&50u64.into())
.unwrap();
let config = Config {
da_deploy_height: 20u64.into(),
..Default::default()
};
let config = Config::default();
let eth_node = MockMiddleware::default();
let relayer = NotInitializedTask::new(eth_node, mock_db.clone(), config, false);
let _ = relayer.into_task(&Default::default(), ()).await;
Expand All @@ -74,10 +71,7 @@ async fn update_sync__changes_latest_eth_state(
) {
// given
let mock_db = crate::mock_db::MockDb::default();
let config = Config {
da_deploy_height: 20u64.into(),
..Default::default()
};
let config = Config::default();
let eth_node = MockMiddleware::default();
let relayer = NotInitializedTask::new(eth_node, mock_db.clone(), config, false);
let shared = relayer.shared_data();
Expand Down
10 changes: 3 additions & 7 deletions deployment/charts/templates/fuel-core-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ spec:
matchLabels:
app: {{ .Values.app.selector_name }}
endpoints:
- path: /v1/metrics
port: http
- path: /v1/metrics
port: http
{{- end }}
---
{{- if .Values.app.volume.pvc_clone_enabled }}
Expand Down Expand Up @@ -129,7 +129,7 @@ spec:
containers:
- name: {{ .Values.app.name }}
image: "{{ .Values.app.image.repository }}:{{ .Values.app.image.tag }}"
command: ["./fuel-core"]
command: [ "./fuel-core" ]
args:
- "run"
- "--ip"
Expand Down Expand Up @@ -172,10 +172,6 @@ spec:
- "--relayer-da-finalization"
- "{{ .Values.app.relayer_da_finalization }}"
{{- end }}
{{- if .Values.app.relayer_da_deploy_height }}
- "--relayer-da-deploy-height"
- "{{ .Values.app.relayer_da_deploy_height }}"
{{- end }}
{{- if .Values.app.relayer_log_page_size }}
- "--relayer-log-page-size"
- "{{ .Values.app.relayer_log_page_size }}"
Expand Down
3 changes: 1 addition & 2 deletions deployment/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ app:
relayer: ${fuel_core_relayer}
relayer_v2_listening_contracts: ${fuel_core_relayer_v2_listening_contracts}
relayer_da_finalization: "${fuel_core_relayer_da_finalization}"
relayer_da_deploy_height: "${fuel_core_relayer_da_deploy_height}"
relayer_log_page_size: "${fuel_core_relayer_log_page_size}"
relayer_min_duration_s: "${fuel_core_relayer_min_duration_s}"
relayer_eth_sync_call_freq_s: "${fuel_core_relayer_eth_sync_call_freq_s}"
Expand All @@ -46,7 +45,7 @@ app:
repository: ${fuel_core_image_repository}
tag: ${fuel_core_image_tag}
pullPolicy: Always
volume:
volume:
pvname: ${fuel_core_pv_name}
mountPath: /mnt/db/
claimname: ${fuel_core_pvc_name}
Expand Down

0 comments on commit ef805da

Please sign in to comment.