-
Notifications
You must be signed in to change notification settings - Fork 44
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
[Bounty] Add raw storage operations #216
Comments
Issue Status: 1. Open 2. Started 3. Submitted 4. Done Work has been started. These users each claimed they can complete the work by 266 years, 3 months from now. 1) kichjang has been approved to start work. These functions look like a very straightforward API change. As I understand it, it is a matter of adding host functions to the contract registry, and making new APIs for the collection classes to utilize them. The real difficulty here is ensuring that all the collection classes are ensuring adequate test coverage and that they all pass correctly. I'll do my best anything! But please let me guide me Get a team, and work with due diligence in the discharge of my duty Learn more on the Gitcoin Issue Details page. |
@KiChjang left you a comment on gitcoin. |
@willemneal I'm trying to understand env.ts, how are the functions there being hooked up by the host? |
They are indirect calls to global functions. This way the declared imports are compiled only when it's called. I would check out storage.ts to start. |
@willemneal Ok, what I am trying to understand here is if I can just add |
Sorry if it wasn't clear but you add a function in the name space and it is not a new import from the host. You will write it; it's in env because it's low level and a helper function. You don't need to worry about adding any new imports. |
@KiChjang Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!
Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days |
@gitcoinbot Yes, currently working on writing tests for the collection classes. |
@KiChjang I'd recommend in the future immediately creating a PR that is a work in progress and then pushing to that often. At the end of the PR I'll squash your commits anyway. |
@willemneal Per your request, I made PR that doesn't contain any tests yet. It'd be great if you can also take a look at it and see if I'm on the right track. |
@KiChjang Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!
Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days |
Before beginning work on the bounty, you must submit a proposal. Only if your proposal is accepted will you be able to claim the reward of the bounty.
Currently when writing to and reading from storage data is serialized and deserialized. This is useful when the the contract needs to understand or process the data. However, in many use cases the data doesn't need to be altered, just written and read by the caller of the contract.
For example, consider a contract registry, which allows users to store contract binaries that can be use in a generic factory for deploying contracts.
The two host functions for reading/writing storage are:
This C-like interface informs the host of the size and location of the bytes to be stored and read. In the case of
storage_read
, the corresponding value read is placed into a register. The host provides a hash map of registers, which maps id's to byte arrays. There are two more functions needed to interact with the registers:The first function returns the number of bytes that should be allocated and the second writes those bytes to
ptr
.Thus typical interaction with storage requires both serialization and memory. However, in any function that takes a length and a pointer, if a length of zero is passed, the pointer is treated as a
register_id.
The register is read instead of the contracts memory. For example,This can be very useful for large values as you can skip the expensive copying and serializing.
The same is true for every collection class. For example,
Each of the follow also includes tests
300 DAI
The text was updated successfully, but these errors were encountered: