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: ftm::Debug impl fails to compile #78

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches:
- "main"
pull_request:

name: "Build feature combinations"

jobs:
feature-powerset:
name: "Build ${{ matrix.package }} features"
runs-on: "ubuntu-latest"

strategy:
matrix:
package:
- "starknet-types-core"
- "starknet-types-rpc"

steps:
- name: "Checkout source code"
uses: "actions/checkout@v3"

- name: "Setup stable toolchain"
uses: "actions-rs/toolchain@v1"
with:
toolchain: "stable"
profile: "minimal"
override: true

- name: "Install cargo-hack"
run: |
cargo install --locked cargo-hack

- name: "Build all feature combinations"
run: |
cargo hack build --package ${{ matrix.package }} --feature-powerset
2 changes: 1 addition & 1 deletion crates/starknet-types-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ parity-scale-codec = ["dep:parity-scale-codec"]
serde = ["alloc", "dep:serde"]
prime-bigint = ["dep:lazy_static"]
num-traits = []
papyrus-serialization = []
papyrus-serialization = ["std"]

[dev-dependencies]
proptest = "1.4.0"
Expand Down
17 changes: 4 additions & 13 deletions crates/starknet-types-core/src/felt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ mod formatting {

impl fmt::Debug for Felt {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.to_fixed_hex_string())
write!(f, "{}", self.0)
}
}

Expand Down Expand Up @@ -1107,18 +1107,9 @@ mod test {

#[test]
fn test_debug_format() {
assert_eq!(
format!("{:?}", Felt::ONE),
String::from("0x") + &"0".repeat(63) + "1"
);
assert_eq!(
format!("{:?}", Felt::from(2)),
String::from("0x") + &"0".repeat(63) + "2"
);
assert_eq!(
format!("{:?}", Felt::from(12345)),
String::from("0x") + &"0".repeat(60) + "3039"
);
assert_eq!(format!("{:?}", Felt::ONE), "0x1");
assert_eq!(format!("{:?}", Felt::from(2)), "0x2");
assert_eq!(format!("{:?}", Felt::from(12345)), "0x3039");
}

// Helper function to generate a vector of bits for testing purposes
Expand Down
Loading