Skip to content

Commit 08a6a2c

Browse files
committed
Move HexBinary
1 parent 6036bc8 commit 08a6a2c

File tree

21 files changed

+76
-113
lines changed

21 files changed

+76
-113
lines changed

Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/burner/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/crypto-verify/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/cyberpunk/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/empty/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/floaty/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/hackatom/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ibc-reflect-send/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ibc-reflect/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/queue/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/reflect/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/staking/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/virus/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ base64 = { version = "0.21.0", default-features = false, features = ["alloc"] }
1212
bnum = "0.10.0"
1313
crc32fast = { version = "1.4.0", optional = true, default-features = false }
1414
derive_more = { version = "1.0.0-beta.6", default-features = false, features = ["display", "from"] }
15+
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
1516
schemars = { version = "0.8.16", optional = true }
1617
serde = { version = "1.0.197", default-features = false, features = ["derive"] }
1718
serde-json-wasm = { version = "1.0.1", default-features = false }

packages/core/src/errors/core_error.rs

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,8 @@ pub enum CoreError {
1717
actual: u64,
1818
backtrace: BT,
1919
},
20-
#[display("Error parsing into type {target_type}: {msg}")]
21-
ParseErr {
22-
/// the target type that was attempted
23-
target_type: String,
24-
msg: String,
25-
backtrace: BT,
26-
},
27-
#[display("Error serializing type {source_type}: {msg}")]
28-
SerializeErr {
29-
/// the source type that was attempted
30-
source_type: String,
31-
msg: String,
32-
backtrace: BT,
33-
},
20+
#[display("Invalid hex string: {msg}")]
21+
InvalidHex { msg: String, backtrace: BT },
3422
#[display("Overflow: {source}")]
3523
Overflow {
3624
source: OverflowError,
@@ -81,17 +69,8 @@ impl CoreError {
8169
}
8270
}
8371

84-
pub fn parse_err(target: impl Into<String>, msg: impl ToString) -> Self {
85-
CoreError::ParseErr {
86-
target_type: target.into(),
87-
msg: msg.to_string(),
88-
backtrace: BT::capture(),
89-
}
90-
}
91-
92-
pub fn serialize_err(source: impl Into<String>, msg: impl ToString) -> Self {
93-
CoreError::SerializeErr {
94-
source_type: source.into(),
72+
pub fn invalid_hex(msg: impl ToString) -> Self {
73+
CoreError::InvalidHex {
9574
msg: msg.to_string(),
9675
backtrace: BT::capture(),
9776
}
@@ -153,34 +132,13 @@ impl PartialEq<CoreError> for CoreError {
153132
false
154133
}
155134
}
156-
CoreError::ParseErr {
157-
target_type,
158-
msg,
159-
backtrace: _,
160-
} => {
161-
if let CoreError::ParseErr {
162-
target_type: rhs_target_type,
163-
msg: rhs_msg,
164-
backtrace: _,
165-
} = rhs
166-
{
167-
target_type == rhs_target_type && msg == rhs_msg
168-
} else {
169-
false
170-
}
171-
}
172-
CoreError::SerializeErr {
173-
source_type,
174-
msg,
175-
backtrace: _,
176-
} => {
177-
if let CoreError::SerializeErr {
178-
source_type: rhs_source_type,
135+
CoreError::InvalidHex { msg, backtrace: _ } => {
136+
if let CoreError::InvalidHex {
179137
msg: rhs_msg,
180138
backtrace: _,
181139
} = rhs
182140
{
183-
source_type == rhs_source_type && msg == rhs_msg
141+
msg == rhs_msg
184142
} else {
185143
false
186144
}

0 commit comments

Comments
 (0)