-
Notifications
You must be signed in to change notification settings - Fork 137
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
[Discussion] Shared global key-value storage #93
Comments
I think this will create some issues long term because we cannot reshard this global storage. Even if it is more expensive to write to, because values cannot be removed, this storage will eventually grow so large that nodes will not be able to track it anymore. |
The price of this storage is linked to the total_supply + inflation. Let's say we dedicate 1TB for it and map it to the total supply of 1B NEAR. Then we define the price of global storage will be 1 NEAR = 1Kb. Let's say the global storage grows similarly to the inflation at 5% per year. Then the maximum storage requirement is 1TB + 5% grows per year. |
Big fan of this idea! Why would all developers deploy the same code for common design patterns? Why not leverage existing code and extend it by wrapping it in a higher order contract? I think every account where the code is referenced having it's own storage space is key here too. Personally I think there will be many more use cases where someone will want to deploy, instantiate and provide their own arguments to a contract that's already written. The examples from Ethereum in ERC20/721s, DeFi tokens, etc... are many. |
@evgenykuzyakov I don't see how that answers my concern. Given that this storage is shared globally, even 100GB feels too much. It will decrease the speed of syncing significantly. |
Current proposal is for permanent storage, so there are no issue for syncing it. Downloading 100GB seems like a trivial problem, so long as you don't have to worry about it changing over time. |
@evgenykuzyakov are we not going to make it verifiable? |
If the key is the hash of the value, then we need to merkalize keys only. Rollout idea for global contracts.Let's say we have a global storage that all nodes have access to. And each key is the hash of the corresponding value. Automatic state clean-upLet's say I deploy a fungible contract to a global storage. If the contract was already used by a lot of existing accounts, then these accounts can now use it for free and we should be able to release the occupied trie space (by deleting a copy for an account) and refund the locked storage value for the account. Ideally we do this the next time we touch this account. We can do this without modifying Or we can have upgradable ProsDevelopers can create contracts and first deploy them on accounts. If contract becomes popular then someone can create a DAO to publish it globally. Once the DAO reaches the limit, it will submit the contract to the global key-value store and the contract becomes free to deploy. |
As discussed during a townhall session. The current proposal for implementation is to introduce a new shard with a single ephemeral account (e.g. All nodes will have to track this shard. In order to deploy there, you'll have to pass enough token amount to cover the storage of contract through a transfer action. The deployment may look as:
If this action succeeds then the contract code will be hashed and stored in the state. We want to achieve the following:
|
@evgenykuzyakov @Longarithm @abacabadabacaba I wonder whether it is better to do this per shard vs. having a global shard that everyone needs to track. This reduces the complexity on the protocol level since we don't need to worry about how it interacts with sharding, state sync, etc. However, it likely requires changing the deploy contract action to allow users to specify how the contract should be deployed (burning tokens vs. staking tokens). |
|
We have not decided on this yet. @abacabadabacaba correctly pointed out that my proposal does not work well if we decide to implement dynamic resharding one day (contract deployment would be underpaid because it now replicates to another shard). Currently @Longarithm is discussing with @abacabadabacaba on possible solutions. |
@abacabadabacaba actually we should not consider the storage cost to be constant. If we increase the number of shards, theoretically the amount of storage also increases and therefore the storage price should go down proportionally. Let's say we have dynamic resharding and there is some contract deployed in one out of |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
To be able to reuse contracts code across multiple accounts, we suggest to dedicate a shared global key-value storage that is available for reads from every shard.
Simple version:
This storage has the following properties:
PRICE_PER_BYTE_PER_SHARD * NUM_SHARD * (NUM_BYTES_VALUES + NUM_BYTES_KEY)
This will allow the following use-cases:
The text was updated successfully, but these errors were encountered: