Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(levm): add legacy tests to the suite #1870

Merged
merged 31 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions .github/workflows/ci_levm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
cd crates/vm/levm && awk '/Summary: /,/Frontier/' test_result.txt;

- name: Check EF-TESTS status is 100%
# removed the exit 1 because we added new tests and the percentage is not 100%
tomip01 marked this conversation as resolved.
Show resolved Hide resolved
run: |
cd crates/vm/levm
if [ "$(awk '/Summary:/ {print $(NF)}' test_result.txt)" != "(100.00%)" ]; then
echo "Percentage is not 100%."
exit 1
fi
fi

hive-report-creation:
uses: ./.github/workflows/common_hive_reports.yaml
Expand Down
40 changes: 38 additions & 2 deletions cmd/ef_tests/levm/deserialize.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::types::{
EFTest, EFTestAccessListItem, EFTestAuthorizationListTuple, EFTests,
EFTest, EFTestAccessListItem, EFTestAuthorizationListTuple, EFTestPostValue, EFTests,
TransactionExpectedException,
};
use bytes::Bytes;
use ethrex_core::{H256, U256};
use ethrex_core::{types::Fork, H256, U256};
use serde::{Deserialize, Deserializer};
use std::{collections::HashMap, str::FromStr};

Expand Down Expand Up @@ -281,6 +281,42 @@ where
.collect()
}

pub fn deserialize_post<'de, D>(
deserializer: D,
) -> Result<HashMap<Fork, Vec<EFTestPostValue>>, D::Error>
where
D: serde::Deserializer<'de>,
{
let post_deserialized = HashMap::<String, Vec<EFTestPostValue>>::deserialize(deserializer)?;
let mut post_parsed = HashMap::new();
for (fork_str, values) in post_deserialized {
let fork = match fork_str.as_str() {
"Frontier" => Fork::Frontier,
"Homestead" => Fork::Homestead,
"Constantinople" | "ConstantinopleFix" | "Petersburg" => Fork::Constantinople,
"Istanbul" => Fork::Istanbul,
"Berlin" => Fork::Berlin,
"London" => Fork::London,
"Paris" | "Merge" => Fork::Paris,
"Shanghai" => Fork::Shanghai,
"Cancun" => Fork::Cancun,
"Prague" => Fork::Prague,
"Byzantium" => Fork::Byzantium,
"EIP158" => Fork::SpuriousDragon,
"EIP150" => Fork::Tangerine,
other => {
return Err(serde::de::Error::custom(format!(
"Unknown fork name: {}",
other
)))
}
};
post_parsed.insert(fork, values);
}

Ok(post_parsed)
}

impl<'de> Deserialize<'de> for EFTests {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
Expand Down
Loading
Loading