Skip to content
2 changes: 1 addition & 1 deletion lib/state/contract_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ impl<'a> ContractState<'a> {
)
);
// Look for mapping usages
if length_in_bytes > U256::from(32_u64)
if length_in_bytes >= U256::from(32_u64)
&& length_in_bytes < U256::from(usize::MAX / 2)
{
let usize_str_length =
Expand Down
2 changes: 1 addition & 1 deletion lib/web3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ impl StorageSnapshot {
}
}

// Collect all storage slots that have not previously been queried
// Collect all storage slots that have not been queried previously
pub fn get_unused_nonzero_storage_slots(&self) -> Vec<UnusedStoragePart> {
let mut unused_storage_parts: Vec<UnusedStoragePart> = vec![];

Expand Down
1 change: 1 addition & 0 deletions tests/Contracts/src/BytesMapping.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ contract BytesMapping {
x[bytes("Hello this is a test")] = 5;
x[bytes("A veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryvery long string")] = 42;
b = bytes("Just some normal bytes.");
x[bytes("")] = 42;
}

function f() external {
Expand Down
1 change: 1 addition & 0 deletions tests/Contracts/src/StringMapping.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ contract StringMapping {
x["A veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryvery long string"] = 42;
y["abc"] = "a short string";
y["a"] = "A veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryvery long string.";
x[""] = 42;
emit SomeE("EventData", 1000);
}

Expand Down
9 changes: 9 additions & 0 deletions tests/expected_dvfs/Deploy_0.dvf.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
"value_hint": "4a75737420736f6d65206e6f726d616c2062797465732e",
"comparison_operator": "Equal"
},
{
"slot": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563",
"offset": 0,
"var_name": "x[0x]",
"var_type": "t_uint256",
"value": "0x000000000000000000000000000000000000000000000000000000000000002a",
"value_hint": "42",
"comparison_operator": "Equal"
},
{
"slot": "0x4a8918e67ba0b26637797e1472ee3d675d66efda39253f7139f8eabc58b20ffb",
"offset": 0,
Expand Down
15 changes: 12 additions & 3 deletions tests/expected_dvfs/Deploy_0_b1.dvf.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": "0.9.1",
"id": "0x4be820f0e3915aa5f0cc36ac62260161931c5873c01ed998e18c5f62fbcd2ed0",
"id": "0x25996dc252a0472b41456da06f497121e6d712e89eb3d46b84765f3759640a5b",
"contract_name": "BytesMapping",
"address": "0x5fbdb2315678afecb367f032d93f642f64180aa3",
"chain_id": 1337,
"chain_id": 31337,
"deployment_block_num": 2,
"init_block_num": 2,
"deployment_tx": "0x11819f70620f7d3a7a69eee5e9ad55cedec78c9fc5a83ab743fdec42a77ab504",
"deployment_tx": "0xa2179eff8c7827da8b42a4b2a304d7449f49a8923818b21e553fdb7c8b3357cb",
"codehash": "0x3867a08d0f6ad7f18a522cb18383fa3eb688bbde257d84652a614fda9167b190",
"insecure": false,
"immutables": [],
Expand All @@ -21,6 +21,15 @@
"value_hint": "4a75737420736f6d65206e6f726d616c2062797465732e",
"comparison_operator": "Equal"
},
{
"slot": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563",
"offset": 0,
"var_name": "x[0x]",
"var_type": "t_uint256",
"value": "0x000000000000000000000000000000000000000000000000000000000000002a",
"value_hint": "42",
"comparison_operator": "Equal"
},
{
"slot": "0x4a8918e67ba0b26637797e1472ee3d675d66efda39253f7139f8eabc58b20ffb",
"offset": 0,
Expand Down
9 changes: 9 additions & 0 deletions tests/expected_dvfs/Deploy_0_updated.dvf.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
"value_hint": "4a75737420736f6d65206e6f726d616c2062797465732e",
"comparison_operator": "Equal"
},
{
"slot": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563",
"offset": 0,
"var_name": "x[0x]",
"var_type": "t_uint256",
"value": "0x000000000000000000000000000000000000000000000000000000000000002a",
"value_hint": "42",
"comparison_operator": "Equal"
},
{
"slot": "0x4a8918e67ba0b26637797e1472ee3d675d66efda39253f7139f8eabc58b20ffb",
"offset": 0,
Expand Down
9 changes: 9 additions & 0 deletions tests/expected_dvfs/Deploy_1.dvf.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
"immutables": [],
"constructor_args": [],
"critical_storage_variables": [
{
"slot": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563",
"offset": 0,
"var_name": "x[]",
"var_type": "t_uint256",
"value": "0x000000000000000000000000000000000000000000000000000000000000002a",
"value_hint": "42",
"comparison_operator": "Equal"
},
{
"slot": "0x2fccf76901d0aa8dbb54cf0f8d3d8db6b27e630b57020bc913d21efd33831cbc",
"offset": 0,
Expand Down
15 changes: 12 additions & 3 deletions tests/expected_dvfs/Deploy_1_b1.dvf.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
{
"version": "0.9.1",
"id": "0xddec5fab35250ee9bb557688e3df2c8ddca9c277e454546e5358aa48a1dfd25c",
"id": "0x62fabab8f05c6d0fd7dfe72a984b8a9260ca936be36a3a203e40d8143d4240f0",
"contract_name": "StringMapping",
"address": "0x5fbdb2315678afecb367f032d93f642f64180aa3",
"chain_id": 1337,
"chain_id": 31337,
"deployment_block_num": 2,
"init_block_num": 2,
"deployment_tx": "0xbd44492ce35b11b438be83b11fef8e1f18f3dd1f847c791083f3659d2a66885c",
"deployment_tx": "0x7a0aa5e701e0c9d0e249bf3ae61a1723583ab168eec26b652e6d7331ea3980fb",
"codehash": "0x2feab59f98325c0ad112156daca7c79dc9e9e17c16be3e374874788370b91e02",
"insecure": false,
"immutables": [],
"constructor_args": [],
"critical_storage_variables": [
{
"slot": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563",
"offset": 0,
"var_name": "x[]",
"var_type": "t_uint256",
"value": "0x000000000000000000000000000000000000000000000000000000000000002a",
"value_hint": "42",
"comparison_operator": "Equal"
},
{
"slot": "0x2fccf76901d0aa8dbb54cf0f8d3d8db6b27e630b57020bc913d21efd33831cbc",
"offset": 0,
Expand Down
9 changes: 9 additions & 0 deletions tests/expected_dvfs/Deploy_1_updated.dvf.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
"immutables": [],
"constructor_args": [],
"critical_storage_variables": [
{
"slot": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563",
"offset": 0,
"var_name": "x[]",
"var_type": "t_uint256",
"value": "0x000000000000000000000000000000000000000000000000000000000000002a",
"value_hint": "42",
"comparison_operator": "Equal"
},
{
"slot": "0x2fccf76901d0aa8dbb54cf0f8d3d8db6b27e630b57020bc913d21efd33831cbc",
"offset": 0,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_end_to_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ mod tests {

#[test]
fn test_e2e_proxy_upgrade() {
let port = 8548u16;
let port = 8557u16;
let config_file = match DVFConfig::test_config_file(Some(port)) {
Ok(config) => config,
Err(err) => {
Expand Down Expand Up @@ -1331,7 +1331,7 @@ mod tests {

#[test]
fn test_e2e_failing_validate_events() {
let port = 8551u16;
let port = 8558u16;
let config_file = match DVFConfig::test_config_file(Some(port)) {
Ok(config) => config,
Err(err) => {
Expand Down
Loading