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

refactor: change the inner type of Hex #1371

Merged
merged 3 commits into from
Aug 29, 2023
Merged

refactor: change the inner type of Hex #1371

merged 3 commits into from
Aug 29, 2023

Conversation

KaoImin
Copy link
Contributor

@KaoImin KaoImin commented Aug 28, 2023

What this PR does / why we need it?

Change the inner type of Hex to Bytes with the following advantages:

  1. Half memory cost.
  2. No error handling.
  3. Cloning bytes::Bytes is very cheap.

What is the impact of this PR?

No Breaking Change

PR relation:

CI Settings

CI Usage

Tip: Check the CI you want to run below, and then comment /run-ci.

CI Switch

  • Coverage Test
  • E2E Tests
  • Code Format
  • Web3 Compatible Tests
  • OCT 1-5 And 12-15
  • OCT 6-10
  • OCT 11
  • OCT 16-19
  • v3 Core Tests

CI Description

CI Name Description
Chaos CI Test the liveness and robustness of Axon under terrible network condition
Cargo Clippy Run cargo clippy --all --all-targets --all-features
Coverage Test Get the unit test coverage report
E2E Test Run end-to-end test to check interfaces
Code Format Run cargo +nightly fmt --all -- --check and cargo sort -gwc
Web3 Compatible Test Test the Web3 compatibility of Axon
v3 Core Test Run the compatibility tests provided by Uniswap V3
OCT 1-5 | 6-10 | 11 | 12-15 | 16-19 Run the compatibility tests provided by OpenZeppelin

@KaoImin KaoImin requested a review from a team as a code owner August 28, 2023 07:16
@KaoImin KaoImin requested review from wenyuanhust and ahonn August 28, 2023 07:16
@KaoImin KaoImin requested review from Flouse, driftluo and yangby-cryptape and removed request for wenyuanhust and ahonn August 28, 2023 07:21
@KaoImin

This comment was marked as off-topic.

@axon-bot
Copy link

axon-bot bot commented Aug 28, 2023

CI tests run on commit:

CI test list:

  • OCT 1-5 And 12-15
  • v3 Core Tests
  • Web3 Compatible Tests

Please check ci test results later.

Copy link
Collaborator

@yangby-cryptape yangby-cryptape left a comment

Choose a reason for hiding this comment

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

I prefer the current method of handling hex strings.

Also, I have to point that:

  • The serde deserialization is changed.

    • Previous is not strict with 0x prefix.

    • Current is strict with 0x prefix; no-prefix or 0X prefix is not acceptable.

  • But the from_string and decode is still not strict with 0x prefix.

There should be only one rule for hex conversion to reduce ambiguity.

p.s. I prefer to use the strict method, but I don't persist in.

protocol/src/types/primitive.rs Outdated Show resolved Hide resolved
@KaoImin KaoImin requested a review from blckngm August 29, 2023 03:04
@KaoImin
Copy link
Contributor Author

KaoImin commented Aug 29, 2023

/run-ci

blckngm
blckngm previously approved these changes Aug 29, 2023
Copy link
Contributor

@blckngm blckngm left a comment

Choose a reason for hiding this comment

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

Nit: it's a bit more idiomatic to use parse instead of from_str directly.

@axon-bot
Copy link

axon-bot bot commented Aug 29, 2023

CI tests run on commit:

CI test list:

  • OCT 1-5 And 12-15
  • v3 Core Tests
  • Web3 Compatible Tests

Please check ci test results later.

@KaoImin KaoImin dismissed stale reviews from blckngm and yangby-cryptape via 3df8053 August 29, 2023 03:31
@KaoImin
Copy link
Contributor Author

KaoImin commented Aug 29, 2023

/run-ci

@axon-bot
Copy link

axon-bot bot commented Aug 29, 2023

CI tests run on commit:

CI test list:

  • OCT 1-5 And 12-15
  • v3 Core Tests
  • Web3 Compatible Tests

Please check ci test results later.

@yangby-cryptape yangby-cryptape added this pull request to the merge queue Aug 29, 2023
Merged via the queue into main with commit 67b0d87 Aug 29, 2023
@yangby-cryptape yangby-cryptape deleted the refactor-hex branch August 29, 2023 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants