Skip to content

Commit

Permalink
Fix validator id decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Sep 5, 2020
1 parent d9f5773 commit e76d476
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
17 changes: 5 additions & 12 deletions beacon_node/http_api/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,11 @@ impl ApiTester {
.unwrap()
.map(|res| res.data);

let state = if let Some(state) = state_opt.as_ref() {
state
} else {
if result.is_none() {
continue;
} else {
panic!(
"should have returned none: {:?}, {:?}",
state_id, validator_id
)
}
};
if result.is_none() && state_opt.is_none() {
continue;
}

let state = state_opt.as_ref().expect("result should be none");

let expected = {
let epoch = state.current_epoch();
Expand Down
2 changes: 1 addition & 1 deletion common/eth2/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl FromStr for ValidatorId {

fn from_str(s: &str) -> Result<Self, Self::Err> {
if s.starts_with("0x") {
serde_json::from_str(s)
serde_json::from_str(&format!("\"{}\"", s))
.map(ValidatorId::PublicKey)
.map_err(|_| format!("{} cannot be parsed as a public key", s))
} else {
Expand Down

0 comments on commit e76d476

Please sign in to comment.