switch to the new storage API (#396)

This PR switches to the new `get_storage_or_zero` and
`set_storage_or_clear` syscalls which are more tailored towards
Solidity.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus
2025-10-30 14:13:37 +01:00
committed by GitHub
parent 42cac55be8
commit 84018c18ae
5 changed files with 20 additions and 38 deletions
+4 -7
View File
@@ -510,13 +510,10 @@ impl Specs {
expected,
} => {
let address = contract.to_eth_addr(&results);
let Ok(value) = Contracts::get_storage(address, key) else {
panic!("error reading storage for address {address}");
};
let Some(value) = value else {
panic!("no value at {address} key 0x{}", hex::encode(key));
};
assert_eq!(value, expected, "at key 0x{}", hex::encode(key));
let value = Contracts::get_storage(address, key)
.unwrap_or_else(|error| panic!("at {address}: {error:?}"))
.unwrap_or_else(|| vec![0; 32]);
assert_eq!(value, expected, "at {address} key 0x{}", hex::encode(key));
}
}
}