Skip to content

Commit

Permalink
remove ethaddr due to unstable deps
Browse files Browse the repository at this point in the history
  • Loading branch information
dssei committed Apr 8, 2024
1 parent 9bec22b commit dbe15b5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
1 change: 0 additions & 1 deletion contracts/sei-tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
base64 = { version = "0.13.0" }
thiserror = { version = "1.0.31" }
protobuf = { version = "3.2.0", features = ["with-bytes"] }
ethaddr = "0.2.2"

[dev-dependencies]
cosmwasm-schema = "1.0.0"
Expand Down
9 changes: 2 additions & 7 deletions contracts/sei-tester/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_std::to_json_binary;
#[cfg(not(feature = "library"))]
// #[cfg(not(feature = "library"))]
use cosmwasm_std::{
coin, entry_point, Attribute, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, MessageInfo,
Order as IteratorOrder, Reply, Response, StdError, StdResult, SubMsg, SubMsgResponse, Uint128,
Expand All @@ -11,7 +11,6 @@ use crate::{
state::{PARALLEL_VALS, USER_SUMS, VALUES},
types::{OrderData, PositionEffect},
};
use ethaddr::Address;
use protobuf::Message;
use sei_cosmwasm::{
BulkOrderPlacementsResponse, Cancellation, DenomAuthorityMetadataResponse, DenomUnit,
Expand Down Expand Up @@ -573,12 +572,8 @@ pub fn query_sei_address(
deps: Deps<SeiQueryWrapper>,
evm_address: String,
) -> StdResult<SeiAddressResponse> {
let valid_addr = match Address::from_str_checksum(&*evm_address) {
Ok(addr) => addr,
Err(_) => return Err(StdError::generic_err("Failed to parse Ethereum address")),
};
let querier = SeiQuerier::new(&deps.querier);
let res = querier.get_sei_address(valid_addr.to_string())?;
let res = querier.get_sei_address(evm_address)?;

Ok(res)
}
17 changes: 0 additions & 17 deletions contracts/sei-tester/tests/sei_tester_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,21 +1012,4 @@ fn test_sei_address_query() {
associated: false,
};
assert_eq!(res, expected_res);

// Test error case when EVM address is invalid
let res: Result<SeiAddressResponse, StdError> = app.wrap().query_wasm_smart(
sei_tester_addr.clone(),
&QueryMsg::GetSeiAddressByEvmAddress {
evm_address: "fakeaddress".to_string(),
},
);

assert!(res.is_err());

let err = res.expect_err("Expected an error because the EVM address is invalid");
assert_eq!(
err.to_string(),
"Generic error: Querier contract error: Generic error: Failed to parse Ethereum \
address"
);
}

0 comments on commit dbe15b5

Please sign in to comment.