Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(starknet_l1_provider): add fake l1 provider client #2856

Open
wants to merge 1 commit into
base: gilad/add-scraper-3
Choose a base branch
from

Conversation

giladchase
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@giladchase giladchase force-pushed the gilad/scraper-test-utils branch from 5c5c34b to 66ceab0 Compare December 20, 2024 21:43
Copy link

github-actions bot commented Dec 20, 2024

Artifacts upload workflows:

Copy link
Collaborator

@elintul elintul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @giladchase and @matan-starkware)


crates/starknet_l1_provider/src/test_utils.rs line 138 at r1 (raw file):

#[derive(Default)]
pub struct FakeL1ProviderClient {

Are we using "fake" throughout the codebase? Maybe "mock" is better?
Consistency is more important though.

Code quote:

Fake

crates/starknet_l1_provider/src/test_utils.rs line 139 at r1 (raw file):

#[derive(Default)]
pub struct FakeL1ProviderClient {
    pub events_received: Mutex<Vec<Event>>,

Why? Is it accessed concurrently?

Code quote:

Mutex

crates/starknet_l1_provider/src/test_utils.rs line 145 at r1 (raw file):

    #[track_caller]
    pub fn assert_add_events_received_with(&self, expected: &[Event]) {
        assert_eq!(self.events_received.lock().unwrap().drain(..).collect_vec(), expected);

Noice.

Code quote:

.drain(..)

crates/starknet_l1_provider/src/test_utils.rs line 161 at r1 (raw file):

        Ok(())
    }
    async fn validate(

Suggestion:

    }
    
    async fn add_events(&self, events: Vec<Event>) -> L1ProviderClientResult<()> {
        self.events_received.lock().unwrap().extend(events);
        Ok(())
    }
    
    async fn validate(

@giladchase giladchase force-pushed the gilad/scraper-test-utils branch from 66ceab0 to ef44633 Compare December 24, 2024 14:02
Copy link
Collaborator

@elintul elintul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @giladchase and @matan-starkware)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants