Skip to content
This repository was archived by the owner on Aug 17, 2026. It is now read-only.

refactor(compiler.rs): use hashmap for ABI storage - #335

Open
Timosdev99 wants to merge 3 commits into
clearloop:mainfrom
Timosdev99:Hashmap
Open

refactor(compiler.rs): use hashmap for ABI storage #335
Timosdev99 wants to merge 3 commits into
clearloop:mainfrom
Timosdev99:Hashmap

Conversation

@Timosdev99

Copy link
Copy Markdown

this changes refactor the compiler to use Hashmap<String, Abi> instead of using Vec for storing contracts ABIs

the reason for this pr is because the current implementation uses a Vec, which requires an O(n) linear search to look up an ABI by name. this method can become inefficient and a significant performance bottleneck as the number of ABIs increase. By using a HashMap, we achieve average O(1) lookup time by keying on the contract name leading to improvement in perfomance.

@g4titanx
g4titanx self-requested a review October 6, 2025 08:30
@Timosdev99

Copy link
Copy Markdown
Author

@clearloop @g4titanx what do you think about this change can I get a review on it

@clearloop clearloop left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This approach is reasonable, however looks like it has broken other places, as result we can see the CI is broken

could you please provide a unit test about ABI for examples::log to investigate the broken part?

@Timosdev99

Copy link
Copy Markdown
Author

i added a unit test to verify that the compiler correctly generate the ABI for the log example contract

@Timosdev99
Timosdev99 requested a review from clearloop October 6, 2025 12:02
@clearloop

Copy link
Copy Markdown
Owner

The CI is still broken XD, have you tried cargo test in the workspace?

@Timosdev99

Copy link
Copy Markdown
Author

yes all test passed in the workspace locally

@g4titanx

g4titanx commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

yes all test passed in the workspace locally

i dont think you ran all tests, check ci build.
run cargo tt locally

@Timosdev99

Copy link
Copy Markdown
Author

yes i did ran all the test
Screenshot_20251008_161305

@Timosdev99

Timosdev99 commented Oct 8, 2025

Copy link
Copy Markdown
Author

yes all test passed in the workspace locally

i dont think you ran all tests, check ci build. run cargo tt locally

but the error in the CI build suggest that some functions are not yet implemented in codegen/visitor/local.rs

@clearloop

Copy link
Copy Markdown
Owner

interesting, I'll take a look tonight

@Timosdev99

Timosdev99 commented Oct 10, 2025

Copy link
Copy Markdown
Author

@clearloop are you still looking into this, wanted to make a pr to complete the functions that are yet to be added

@clearloop

clearloop commented Oct 11, 2025

Copy link
Copy Markdown
Owner

@clearloop are you still looking into this, wanted to make a pr to complete the functions that are yet to be added

sry for the late, I'm AFKing these days XD, but likely it is caused by local cache! (e.g. you can pass the tests locally because you are running on cache)

@Timosdev99

Copy link
Copy Markdown
Author

@clearloop are you still looking into this, wanted to make a pr to complete the functions that are yet to be added

sry for the late, I'm AFKing these days XD, but likely it is caused by local cache! (e.g. you can pass the tests locally because you are running on cache

But I cleared it by running cargo clean before running the test and it passed

@clearloop

Copy link
Copy Markdown
Owner

blocked by #337

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants