Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
add DA fee
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed May 7, 2024
1 parent 711dddc commit d3a1e5a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion mocks/src/relayer/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use sov_consensus_state_tracker::CelestiaService;
use sov_consensus_state_tracker::HasConsensusState;
#[cfg(feature = "mock-da")]
use sov_consensus_state_tracker::MockDaService;
use sov_mock_da::MockFee;
use sov_modules_api::{Context, Spec, WorkingSet};
use sov_prover_storage_manager::new_orphan_storage;
use sov_rollup_interface::services::da::DaService;
Expand Down Expand Up @@ -75,7 +76,7 @@ where
pub async fn setup<P>(self) -> DefaultRelayer<S, Da, P>
where
S: Spec<Storage = ProverStorage<P>> + Send + Sync,
Da: DaService<Error = anyhow::Error> + Clone,
Da: DaService<Error = anyhow::Error, Fee = MockFee> + Clone,
Da::Spec: HasConsensusState,
P: MerkleProofSpec + Clone + 'static,
<P as MerkleProofSpec>::Hasher: Send,
Expand Down
3 changes: 2 additions & 1 deletion mocks/src/relayer/handle/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ibc_core::host::ValidationContext;
use ibc_query::core::channel::QueryPacketCommitmentRequest;
use ibc_query::core::client::{QueryClientStateRequest, QueryConsensusStateRequest};
use sov_consensus_state_tracker::HasConsensusState;
use sov_mock_da::MockFee;
use sov_modules_api::{Spec, WorkingSet};
use sov_rollup_interface::services::da::DaService;
use sov_state::{MerkleProofSpec, ProverStorage};
Expand All @@ -20,7 +21,7 @@ use crate::utils::{wait_for_block, MutexUtil};
impl<S, Da, P> Handle for MockRollup<S, Da, P>
where
S: Spec<Storage = ProverStorage<P>> + Send + Sync,
Da: DaService<Error = anyhow::Error> + Clone,
Da: DaService<Error = anyhow::Error, Fee = MockFee> + Clone,
Da::Spec: HasConsensusState,
<Da as DaService>::Spec: Clone,
P: MerkleProofSpec + Clone + 'static,
Expand Down
3 changes: 2 additions & 1 deletion mocks/src/sovereign/manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use ibc_core::host::types::path::{
use ibc_core::host::{ExecutionContext, ValidationContext};
use sov_consensus_state_tracker::HasConsensusState;
use sov_ibc::context::IbcContext;
use sov_mock_da::MockFee;
use sov_modules_api::{Spec, StateCheckpoint};
use sov_rollup_interface::services::da::DaService;
use sov_state::{MerkleProofSpec, ProverStorage};
Expand All @@ -31,7 +32,7 @@ use crate::cosmos::{dummy_tm_client_state, dummy_tm_consensus_state};
impl<S, Da, P> MockRollup<S, Da, P>
where
S: Spec<Storage = ProverStorage<P>> + Send + Sync,
Da: DaService<Error = anyhow::Error> + Clone,
Da: DaService<Error = anyhow::Error, Fee = MockFee> + Clone,
Da::Spec: HasConsensusState,
P: MerkleProofSpec + Clone + 'static,
<P as MerkleProofSpec>::Hasher: Send,
Expand Down
5 changes: 3 additions & 2 deletions mocks/src/sovereign/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use sov_consensus_state_tracker::{ConsensusStateTracker, HasConsensusState};
use sov_ibc::call::CallMessage as IbcCallMessage;
use sov_ibc::context::IbcContext;
use sov_kernels::basic::BasicKernel;
use sov_mock_da::MockFee;
use sov_modules_api::{Context, Spec, WorkingSet};
use sov_rollup_interface::services::da::DaService;
use sov_state::{MerkleProofSpec, ProverStorage, Storage};
Expand All @@ -30,7 +31,7 @@ type Mempool<C> = Vec<RuntimeCall<C>>;
pub struct MockRollup<S, Da, P>
where
S: Spec,
Da: DaService<Error = anyhow::Error> + Clone,
Da: DaService<Error = anyhow::Error, Fee = MockFee> + Clone,
Da::Spec: HasConsensusState,
P: MerkleProofSpec,
{
Expand All @@ -47,7 +48,7 @@ where
impl<S, Da, P> MockRollup<S, Da, P>
where
S: Spec<Storage = ProverStorage<P>> + Send + Sync,
Da: DaService<Error = anyhow::Error> + Clone,
Da: DaService<Error = anyhow::Error, Fee = MockFee> + Clone,
Da::Spec: HasConsensusState,
P: MerkleProofSpec + Clone + 'static,
<P as MerkleProofSpec>::Hasher: Send,
Expand Down
8 changes: 6 additions & 2 deletions mocks/src/sovereign/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use std::time::Duration;

use sov_consensus_state_tracker::HasConsensusState;
use sov_mock_da::MockFee;
use sov_modules_api::runtime::capabilities::{Kernel, KernelSlotHooks};
use sov_modules_api::{
CallResponse, DispatchCall, Gas, GasMeter, Genesis, KernelWorkingSet, SlotData, Spec,
Expand All @@ -21,7 +22,7 @@ use crate::utils::{wait_for_block, MutexUtil};
impl<S, Da, P> MockRollup<S, Da, P>
where
S: Spec<Storage = ProverStorage<P>> + Send + Sync,
Da: DaService<Error = anyhow::Error> + Clone,
Da: DaService<Error = anyhow::Error, Fee = MockFee> + Clone,
Da::Spec: HasConsensusState,
P: MerkleProofSpec + Clone + 'static,
<P as MerkleProofSpec>::Hasher: Send,
Expand Down Expand Up @@ -59,7 +60,10 @@ where
let height = loop {
self.da_core.grow_blocks(pre_state_root.as_ref().to_vec());
// Dummy transaction to trigger the block generation
self.da_service().send_transaction(&[0; 32]).await.unwrap();
self.da_service()
.send_transaction(&[0; 32], MockFee::zero())
.await
.unwrap();
tokio::time::sleep(Duration::from_millis(100)).await;
match self.da_service().get_last_finalized_block_header().await {
Ok(header) => {
Expand Down

0 comments on commit d3a1e5a

Please sign in to comment.