Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: function idx#21

Open
varex83 wants to merge 2 commits into
native2.8.xfrom
bohdan/fix-function-idx
Open

fix: function idx#21
varex83 wants to merge 2 commits into
native2.8.xfrom
bohdan/fix-function-idx

Conversation

@varex83

@varex83 varex83 commented Sep 17, 2024

Copy link
Copy Markdown

Use the proper function id in the lookup mapping, since function_idx it's just the order of function in the sierra program and function.id.id is u64 used to be based on an hash (of size 64) of the name of the function - so that was the original cause there. So to be more convenient it's better to use direct order of function instead of converting types

@PearsonWhite PearsonWhite self-requested a review September 17, 2024 20:05
Comment on lines +652 to +654
let lookup_fid: HashMap<usize, &FunctionId> = HashMap::from_iter(
sierra_program.funcs.iter().enumerate().map(|(idx, func)| (idx, &func.id)),
);

@xrvdg xrvdg Sep 18, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be a HashMap anymore as it's just an index into a vector. Removing the HashMap and using just sierra_program will improve the constructor of NativeContractEntryPoint as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants