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

fix(rpc): starknet_syncing returns wrong value #164

Merged
merged 3 commits into from
Mar 3, 2022
Merged

Conversation

Mirko-von-Leipzig
Copy link
Contributor

This was incorrectly routed to chain_id. Also enabled tests for this.

This was incorrectly routed to chain_id. Also enabled tests for this.
Copy link
Member

@CHr15F0x CHr15F0x left a comment

Choose a reason for hiding this comment

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

LGTM, however I think this part doesn't update the value in the static variable:

(state/sync.rs)

                match &mut *SYNC_STATUS.lock().await {
                    SyncStatus::False(_) => {}
                    syn_status @ SyncStatus::Status(mut status) => {
                        status.current_block = block_hash;
                    }
                }

It was updating a copy instead of the reference.
@Mirko-von-Leipzig
Copy link
Contributor Author

LGTM, however I think this part doesn't update the value in the static variable:

(state/sync.rs)

                match &mut *SYNC_STATUS.lock().await {
                    SyncStatus::False(_) => {}
                    syn_status @ SyncStatus::Status(mut status) => {
                        status.current_block = block_hash;
                    }
                }

Yes, the mut status in the match was causing us to mutate a copy instead of the reference.

Copy link
Member

@CHr15F0x CHr15F0x left a comment

Choose a reason for hiding this comment

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

👏

@Mirko-von-Leipzig Mirko-von-Leipzig merged commit 9fd6c51 into main Mar 3, 2022
@Mirko-von-Leipzig Mirko-von-Leipzig deleted the rpc_sync branch March 3, 2022 14:05
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.

2 participants