Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
Merged
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
30 changes: 19 additions & 11 deletions testool/src/statetest/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,25 +445,33 @@ fn parse_raw_access_list(access_list: Option<&Yaml>) -> Result<Option<parse::Raw
item.as_hash().map_or(
Err(anyhow!("Parsed access list item must be a hash")),
|item| {
let address = if let Some(Yaml::String(address)) =
item.get(&Yaml::String("address".to_string()))
{
address.to_string()
} else {
bail!("Parsed access list address must be a string");
let address = match item.get(&Yaml::String("address".to_string())) {
Some(Yaml::Integer(i)) => format!("{i:x}"),
Some(Yaml::String(s)) => {
assert!(s.starts_with("0x"));
s[2..].to_string()
}
val => bail!("Failed to parse access list address = {val:?}"),
};
let address = format!("0x{:0>40}", address);

let storage_keys = if let Some(Yaml::Array(storage_keys)) =
item.get(&Yaml::String("storageKeys".to_string()))
{
storage_keys
.iter()
.map(|key| {
if let Yaml::Integer(key) = key {
Ok(format!("0x{:064x}", key))
} else {
bail!("Parsed access list storage key must be an integer");
}
let key = match key {
Yaml::Integer(i) => format!("{i:x}"),
Yaml::String(s) => {
assert!(s.starts_with("0x"));
s[2..].to_string()
}
val => bail!(
"Failed to parse access list storage key = {val:?}"
),
};
Ok(format!("0x{:0>64}", key))
})
.collect::<Result<_>>()?
} else {
Expand Down