mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: remove PartialEq+Eq from ProviderError and all others affected (#13592)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -702,7 +702,9 @@ mod tests {
|
||||
previous_checkpoint,
|
||||
);
|
||||
|
||||
assert_eq!(stage_checkpoint, Ok(previous_stage_checkpoint));
|
||||
assert!(
|
||||
matches!(stage_checkpoint, Ok(checkpoint) if checkpoint == previous_stage_checkpoint)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -938,28 +940,21 @@ mod tests {
|
||||
};
|
||||
|
||||
// assert accounts
|
||||
assert_eq!(
|
||||
provider.basic_account(&account1),
|
||||
Ok(Some(account1_info)),
|
||||
"Post changed of a account"
|
||||
assert!(
|
||||
matches!(provider.basic_account(&account1), Ok(Some(acc)) if acc == account1_info)
|
||||
);
|
||||
assert_eq!(
|
||||
provider.basic_account(&account2),
|
||||
Ok(Some(account2_info)),
|
||||
"Post changed of a account"
|
||||
assert!(
|
||||
matches!(provider.basic_account(&account2), Ok(Some(acc)) if acc == account2_info)
|
||||
);
|
||||
assert_eq!(
|
||||
provider.basic_account(&account3),
|
||||
Ok(Some(account3_info)),
|
||||
"Post changed of a account"
|
||||
assert!(
|
||||
matches!(provider.basic_account(&account3), Ok(Some(acc)) if acc == account3_info)
|
||||
);
|
||||
// assert storage
|
||||
// Get on dupsort would return only first value. This is good enough for this test.
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
provider.tx_ref().get::<tables::PlainStorageState>(account1),
|
||||
Ok(Some(StorageEntry { key: B256::with_last_byte(1), value: U256::from(2) })),
|
||||
"Post changed of a account"
|
||||
);
|
||||
Ok(Some(entry)) if entry.key == B256::with_last_byte(1) && entry.value == U256::from(2)
|
||||
));
|
||||
|
||||
let mut provider = factory.database_provider_rw().unwrap();
|
||||
let mut stage = stage();
|
||||
@ -1074,25 +1069,13 @@ mod tests {
|
||||
} if total == block.gas_used);
|
||||
|
||||
// assert unwind stage
|
||||
assert_eq!(
|
||||
provider.basic_account(&acc1),
|
||||
Ok(Some(acc1_info)),
|
||||
"Pre changed of a account"
|
||||
);
|
||||
assert_eq!(
|
||||
provider.basic_account(&acc2),
|
||||
Ok(Some(acc2_info)),
|
||||
"Post changed of a account"
|
||||
);
|
||||
assert!(matches!(provider.basic_account(&acc1), Ok(Some(acc)) if acc == acc1_info));
|
||||
assert!(matches!(provider.basic_account(&acc2), Ok(Some(acc)) if acc == acc2_info));
|
||||
|
||||
let miner_acc = address!("2adc25665018aa1fe0e6bc666dac8fc2697ff9ba");
|
||||
assert_eq!(
|
||||
provider.basic_account(&miner_acc),
|
||||
Ok(None),
|
||||
"Third account should be unwound"
|
||||
);
|
||||
assert!(matches!(provider.basic_account(&miner_acc), Ok(None)));
|
||||
|
||||
assert_eq!(provider.receipt(0), Ok(None), "First receipt should be unwound");
|
||||
assert!(matches!(provider.receipt(0), Ok(None)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1173,13 +1156,12 @@ mod tests {
|
||||
|
||||
// assert unwind stage
|
||||
let provider = test_db.factory.database_provider_rw().unwrap();
|
||||
assert_eq!(provider.basic_account(&destroyed_address), Ok(None), "Account was destroyed");
|
||||
assert!(matches!(provider.basic_account(&destroyed_address), Ok(None)));
|
||||
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
provider.tx_ref().get::<tables::PlainStorageState>(destroyed_address),
|
||||
Ok(None),
|
||||
"There is storage for destroyed account"
|
||||
);
|
||||
Ok(None)
|
||||
));
|
||||
// drops tx so that it returns write privilege to test_tx
|
||||
drop(provider);
|
||||
let plain_accounts = test_db.table::<tables::PlainAccountState>().unwrap();
|
||||
|
||||
@ -317,11 +317,11 @@ mod tests {
|
||||
// writer for the first time.
|
||||
let mut static_file_provider = db.factory.static_file_provider();
|
||||
static_file_provider = StaticFileProvider::read_write(static_file_provider.path()).unwrap();
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
static_file_provider
|
||||
.check_consistency(&db.factory.database_provider_ro().unwrap(), is_full_node,),
|
||||
Ok(expected)
|
||||
);
|
||||
Ok(e) if e == expected
|
||||
));
|
||||
}
|
||||
|
||||
/// Saves a checkpoint with `checkpoint_block_number` and compare the check consistency result
|
||||
@ -338,12 +338,12 @@ mod tests {
|
||||
.unwrap();
|
||||
provider_rw.commit().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
db.factory
|
||||
.static_file_provider()
|
||||
.check_consistency(&db.factory.database_provider_ro().unwrap(), false,),
|
||||
Ok(expected)
|
||||
);
|
||||
Ok(e) if e == expected
|
||||
));
|
||||
}
|
||||
|
||||
/// Inserts a dummy value at key and compare the check consistency result against the expected
|
||||
@ -360,12 +360,12 @@ mod tests {
|
||||
cursor.insert(key, Default::default()).unwrap();
|
||||
provider_rw.commit().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
db.factory
|
||||
.static_file_provider()
|
||||
.check_consistency(&db.factory.database_provider_ro().unwrap(), false),
|
||||
Ok(expected)
|
||||
);
|
||||
Ok(e) if e == expected
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -373,10 +373,10 @@ mod tests {
|
||||
let db = seed_data(90).unwrap();
|
||||
let db_provider = db.factory.database_provider_ro().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
db.factory.static_file_provider().check_consistency(&db_provider, false),
|
||||
Ok(None)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user