Skip to content

Commit

Permalink
update spec-gen to handle type alias in return type
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexstokes committed May 7, 2024
1 parent 420e7b7 commit 2e053d5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ethereum-consensus/src/deneb/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub use crate::{
},
blob_sidecar::{
verify_blob_sidecar_inclusion_proof, Blob, BlobIdentifier, BlobSidecar, BlobsBundle,
VERSIONED_HASH_VERSION_KZG,
VersionedHash, VERSIONED_HASH_VERSION_KZG,
},
block_processing::{
process_attestation, process_block, process_execution_payload, process_voluntary_exit,
Expand Down
2 changes: 1 addition & 1 deletion ethereum-consensus/src/electra/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub use crate::{
},
blob_sidecar::{
verify_blob_sidecar_inclusion_proof, Blob, BlobIdentifier, BlobSidecar, BlobsBundle,
VERSIONED_HASH_VERSION_KZG,
VersionedHash, VERSIONED_HASH_VERSION_KZG,
},
helpers::kzg_commitment_to_versioned_hash,
light_client::{
Expand Down
32 changes: 15 additions & 17 deletions spec-gen/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,23 +444,21 @@ impl Spec {
for name in type_names {
if let Some(target_module) = index.get(&name) {
let target_module = self.diff.modules.get(target_module).unwrap();
let container = target_module
.containers
.iter()
.find(|&c| c.name == name)
.expect("internal state integrity");

// if we find a newer definition, edit the types of this function
// if not, just import from the earlier fork
if container.fork == self.fork {
let arguments = generics_to_arguments(&container.item.generics);
let mut editor = ArgumentsEditor::new(&container.name, &arguments);
editor.edit(&mut fragment);

all_arguments.push(arguments);
f.fork = self.fork;
} else {
f.can_import = true;
if let Some(container) =
target_module.containers.iter().find(|&c| c.name == name)
{
// if we find a newer definition, edit the types of this function
// if not, just import from the earlier fork
if container.fork == self.fork {
let arguments = generics_to_arguments(&container.item.generics);
let mut editor = ArgumentsEditor::new(&container.name, &arguments);
editor.edit(&mut fragment);

all_arguments.push(arguments);
f.fork = self.fork;
} else {
f.can_import = true;
}
}
}
}
Expand Down

0 comments on commit 2e053d5

Please sign in to comment.