Skip to content

Commit fbc8b3e

Browse files
authored
Merge branch 'dev' into issue-215-ethereum-channel-redundant-validator_id-check
2 parents ecc121b + 794793b commit fbc8b3e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

adapter/src/ethereum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl Adapter for EthereumAdapter {
145145
));
146146
}
147147

148-
let contract_address = Address::from_slice(&self.config.ethereum_core_address);
148+
let contract_address: Address = self.config.ethereum_core_address.into();
149149

150150
let (_eloop, transport) = web3::transports::Http::new(&self.config.ethereum_network)
151151
.map_err(|_| map_error("failed to init http transport"))?;
@@ -209,7 +209,7 @@ impl Adapter for EthereumAdapter {
209209

210210
let sess = match &verified.payload.identity {
211211
Some(identity) => {
212-
let contract_address = Address::from_slice(identity);
212+
let contract_address: Address = identity.into();
213213
let (_eloop, transport) =
214214
web3::transports::Http::new(&self.config.ethereum_network)
215215
.map_err(|_| map_error("failed to init http transport"))?;

adapter/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl EthereumChannel {
172172
}
173173

174174
pub fn hash_hex(&self, contract_addr: &[u8; 20]) -> Result<String, Box<dyn Error>> {
175-
let result = self.hash(&contract_addr)?;
175+
let result = self.hash(contract_addr)?;
176176
Ok(format!("0x{}", hex::encode(result)))
177177
}
178178

primitives/src/validator.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ impl ValidatorId {
3232
}
3333
}
3434

35-
impl AsRef<[u8]> for ValidatorId {
36-
fn as_ref(&self) -> &[u8] {
37-
&self.0
38-
}
39-
}
40-
4135
impl From<&[u8; 20]> for ValidatorId {
4236
fn from(bytes: &[u8; 20]) -> Self {
4337
Self(*bytes)
4438
}
4539
}
4640

41+
impl AsRef<[u8]> for ValidatorId {
42+
fn as_ref(&self) -> &[u8] {
43+
&self.0
44+
}
45+
}
46+
4747
impl TryFrom<&str> for ValidatorId {
4848
type Error = DomainError;
4949
fn try_from(value: &str) -> Result<Self, Self::Error> {

validator_worker/src/sentry_interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<T: Adapter + 'static> SentryApi<T> {
3636
let client = Client::builder()
3737
.timeout(Duration::from_secs(config.fetch_timeout.into()))
3838
.build()
39-
.unwrap();
39+
.map_err(|e| ValidatorWorker::Failed(format!("building Client error: {}", e)))?;
4040

4141
// validate that we are to validate the channel
4242
match channel.spec.validators.find(adapter.whoami()) {

0 commit comments

Comments
 (0)