NethermindEth / cairo-vm-go

A virtual machine for Cairo written in Go
MIT License
73 stars 43 forks source link

Implement `DictSquashCopyDict` hint #424

Closed TAdev0 closed 3 weeks ago

TAdev0 commented 1 month ago

This PR implements DictSquashCopyDict hint, which prepares arguments for creating a new dictionary with dict_new function. It copies the existing squashed dictionary in the current scope

Closes #292

TAdev0 commented 1 month ago

@har777 i'm not 100% sure i'm implementing correctly this python code

dict(__dict_manager.get_dict(ids.dict_accesses_end))

could you check this? I guess this code only retrieves from operanders the address dict_accesses_end , uses GetDictionary to retrieve the dictionary (a copy) and assign it in scope?

MaksymMalicki commented 1 month ago

could you resolve conflits? It will be easier to review ✅

TAdev0 commented 1 month ago

@har777 @MaksymMalicki just updated, now making a deep copy of the ZeroDict before assign it in the new scope. I added only one test for now with an empty dictionaryManager, will add other tests tomorrow

TAdev0 commented 1 month ago

currently FreeOffset field of the ZeroDict struct is of type *uint64 , any reason?

TAdev0 commented 4 weeks ago

@har777 ready for review, i think this is the last dict hint

TAdev0 commented 4 weeks ago

i guess we should use FreeOffset uint64 in ZeroDictionary, there is no benefit of using a pointer here, we can modify this later

TAdev0 commented 3 weeks ago

@har777 now only the dict Data is copied and I inlined the copy