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

getDatastoreEntries return empty array when no value #556

Closed
Thykof opened this issue Apr 12, 2024 · 5 comments · Fixed by #736 · May be fixed by massalabs/docs#411
Closed

getDatastoreEntries return empty array when no value #556

Thykof opened this issue Apr 12, 2024 · 5 comments · Fixed by #736 · May be fixed by massalabs/docs#411
Assignees
Labels

Comments

@Thykof
Copy link
Contributor

Thykof commented Apr 12, 2024

I would like to investigate why getDatastoreEntries returns an empty Uint8Array in the final_value while it's supposed to return null.

In the case the key in the smart contract datastore is getting inserted in an operation not final, we should get null.
In the case the key in the smart contract datastore is getting inserted in an operation no executed yet, we should get null.

cc @gregLibert @AurelienFT this is a follow up issue after the late debugging session.

@pivilartisant pivilartisant self-assigned this Dec 23, 2024
@pivilartisant
Copy link
Collaborator

Still present as of December 2024

@SlnPons
Copy link

SlnPons commented Jan 3, 2025

@peterjah any idea on this bug? Should we priorise it?

@Leo-Besancon
Copy link

For me it's related to this line: https://github.com/massalabs/massa-web3/blob/dc6018c0f148630a7996f572cf9eb88335497a2e/src/client/publicAPI.ts#L161C7-L161C40

If we want to return null, we should not return Uint8Array.from(val ?? []), but return null if val is null, and Uint8Array.from(val) if val is not null.

But as I'm not a js dev I'll let someone else impl the fix, I'm not sure of the side effects or if I'm 100% right.

@damip
Copy link
Member

damip commented Jan 17, 2025

@peterjah WDYT ?

@peterjah
Copy link
Collaborator

lets to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
7 participants