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

syncing: refactor with tuple type #298

Merged
merged 3 commits into from
May 24, 2022
Merged

syncing: refactor with tuple type #298

merged 3 commits into from
May 24, 2022

Conversation

koivunej
Copy link
Contributor

Refactor avoid another field modified issues in the future.

Joonas Koivunen added 3 commits May 20, 2022 17:23
this allows to get rid of the pairs of fields, and just have three
fields in syncing::Status.

found out that one cannot use deny_unknown_fields within an untagged
tree, but the syncing::Status is only needs deserialize for testing.
this should make it less stressful not to have the deny_unknown_fields.
not really sure if this is a good idea. but we cannot have the flattened
fields with deny_extra_fields.
@koivunej koivunej force-pushed the syncing_refactor branch from a9f3424 to 6b37f81 Compare May 20, 2022 14:28
Copy link
Contributor

@kkovaacs kkovaacs left a comment

Choose a reason for hiding this comment

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

Great, it's much more expressive this way!
(TIL: serde_with::with_prefix! )

crates/pathfinder/src/rpc/types.rs Show resolved Hide resolved
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
(though I haven't built/run myself)

let latest_num = block.block_number.unwrap();
let latest = {
let latest_hash = block.block_hash.unwrap();
let latest_num = block.block_number.unwrap();
Copy link
Member

@CHr15F0x CHr15F0x May 20, 2022

Choose a reason for hiding this comment

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

I cannot see any regression test for the latest_num being updated. I know it seems a bit silly because that was an easy fix, but we still don't have an automated way of making sure it won't happen again in the future.

Generally I recall seeing at least another fix in the past to a regression that was not accompanied by a respective test, however now I don't remember which concrete fix it was. I think we should put more stress on tests when regressions pop up.

@koivunej koivunej merged commit 48e875b into main May 24, 2022
@koivunej koivunej deleted the syncing_refactor branch May 24, 2022 07:22
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.

4 participants