-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat: virtual group and sp exit #284
Conversation
083fa5d
to
891e8e1
Compare
…ription into virtual_group_dev
} | ||
} | ||
|
||
if k.ExistsAutoResumeRecord(ctx, record.Timestamp, addr) { // this check should be cheap usually |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that a streamrecord is STREAM_ACCOUNT_STATUS_ACTIVE
and still ExistsAutoResumeRecord
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, when the stream is changed to active
, the related AutoResumeRecord
will be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the case, why dont we use the status of stream record to replace the ExistsAutoResumeRecord
condition here?
* init virtual group module * add create/delete/deposit/withdraw/swapout messages * add sp keeper dependency * add router and type function * refactor sequence to support uint32 and U256 * impl virtual group module * refactor storage module * refactor challenge module to algin the new design * self review code * fix testcase and punish code * fix challenge testcases * refactor payment module to algin the new design * add e2e test * fix some unit tests * update cosmos-sdk * update go mod * fix e2e test * store deposit * update gomod * fix some e2e test case * fix cancel create object * ignore error for testing * fix storage test * fix test case * make GetGVG more simple * add virtual group swap out message * fix swap out * add event * fix ignite missing placeholder * add sp exit message * add sp exit * complete sp exit * add swap deposit * remove virtual payment account from local virtual group/ event * complete sp exit process * fix mock file error * add mock gen * fix swap out as secondary sp error * refator payment * refactor approval to get more extends * fix payment unit test * add withdraw cli * revert extends of approval * refactor payment for settlement and resume * refactor payment for out flow * fix proto * add basic migration bucket logic * fix the sp exit * refine the code * add payment for bucket migration * refactor code * fix some issues * fix issue and unit tests * add migration check and rebinding * refine the code * refactor withdraw from gvg & gvg family * feat: use bls sig in sealObject by secondary sps (#283) * fix gensp test error * add more check and params * add some unit tests for payment * fix compile error * add exit,completeexit, swapout events * add migration event * add create gvg family event * mirror update * fix lint issues * fix lint issues * fix some unit tests * fix the limit of gvgs and lvgs * fix bucket migration * fix address issues for new messages * refine challenge module * refine payment module * fix basesuite for create so many families * fix lint * add deposit/withdraw test for virtual group * fix issue of iterator * add basic sp exit test and fix some bugs * fix issue and refactor e2e tests * add e2e test cases * fix and add e2e test cases * refactor e2e test * add sp swap out test * refine code by cr * fix some review comments * fix cr suggestion * fix some review comments * refine the code * calculate sp num instead of constant * add migration e2e test * feat: bls sig for complete migrate bucket (#291) * fix bucket migration issue * update cosmos sdk version * fix migration bucket e2e test * fix CodeReview issues * fix some bugs * update staking per GB * refine some var * fix RebindingGVGsToBucket revert error * feat: Local virtual group and Billing info refacot (#306) * fix challenge refactor * fix some review tips * fix internal bucket info error * add family id to CreateBucketEvent * refactor challenge module * refactor payment module * fix redundany GenId * add family id check * refactor payment module * fix error * refactor payment module * fix issue * implement virtual group cmd * refine the comments of protobuf * fix e2e test * remove some useless code * fix sp exit test * add more sp exit test and fix some bugs * using id instead of address for some interfaces and events * fix some tests * fix e2e * fix unit test * add more check and parmas check * fix e2e tests * fix an issue * fix sp test * fix ci lint * remove useless code (#308) * chore: refine payment for gvg settle (#309) * chore: refine gvg staking per bytes and default params (#310) * rename gvgstakingprice to gvgstakingperbytes * fix DefaultMaxStoreSizePerFamily * feat: add chainId to bls sign doc (#313) * add chainId to bls sign doc * get chain id from cosmos context * feat: refine swap out and migrate bucket (#311) * fix: update swagger (#317) * feat: enhance head object api (#321) * fix gnfd query api (#318) * feat: update challenge and stop serving for sp exit (#322) * feat: fix review comments of sp exit (#320) * fix code review tips (#325) * fix cosmos sdk version * fix e2e test case * fix review tips
* init virtual group module * add create/delete/deposit/withdraw/swapout messages * add sp keeper dependency * add router and type function * refactor sequence to support uint32 and U256 * impl virtual group module * refactor storage module * refactor challenge module to algin the new design * self review code * fix testcase and punish code * fix challenge testcases * refactor payment module to algin the new design * add e2e test * fix some unit tests * update cosmos-sdk * update go mod * fix e2e test * store deposit * update gomod * fix some e2e test case * fix cancel create object * ignore error for testing * fix storage test * fix test case * make GetGVG more simple * add virtual group swap out message * fix swap out * add event * fix ignite missing placeholder * add sp exit message * add sp exit * complete sp exit * add swap deposit * remove virtual payment account from local virtual group/ event * complete sp exit process * fix mock file error * add mock gen * fix swap out as secondary sp error * refator payment * refactor approval to get more extends * fix payment unit test * add withdraw cli * revert extends of approval * refactor payment for settlement and resume * refactor payment for out flow * fix proto * add basic migration bucket logic * fix the sp exit * refine the code * add payment for bucket migration * refactor code * fix some issues * fix issue and unit tests * add migration check and rebinding * refine the code * refactor withdraw from gvg & gvg family * feat: use bls sig in sealObject by secondary sps (#283) * fix gensp test error * add more check and params * add some unit tests for payment * fix compile error * add exit,completeexit, swapout events * add migration event * add create gvg family event * mirror update * fix lint issues * fix lint issues * fix some unit tests * fix the limit of gvgs and lvgs * fix bucket migration * fix address issues for new messages * refine challenge module * refine payment module * fix basesuite for create so many families * fix lint * add deposit/withdraw test for virtual group * fix issue of iterator * add basic sp exit test and fix some bugs * fix issue and refactor e2e tests * add e2e test cases * fix and add e2e test cases * refactor e2e test * add sp swap out test * refine code by cr * fix some review comments * fix cr suggestion * fix some review comments * refine the code * calculate sp num instead of constant * add migration e2e test * feat: bls sig for complete migrate bucket (#291) * fix bucket migration issue * update cosmos sdk version * fix migration bucket e2e test * fix CodeReview issues * fix some bugs * update staking per GB * refine some var * fix RebindingGVGsToBucket revert error * feat: Local virtual group and Billing info refacot (#306) * fix challenge refactor * fix some review tips * fix internal bucket info error * add family id to CreateBucketEvent * refactor challenge module * refactor payment module * fix redundany GenId * add family id check * refactor payment module * fix error * refactor payment module * fix issue * implement virtual group cmd * refine the comments of protobuf * fix e2e test * remove some useless code * fix sp exit test * add more sp exit test and fix some bugs * using id instead of address for some interfaces and events * fix some tests * fix e2e * fix unit test * add more check and parmas check * fix e2e tests * fix an issue * fix sp test * fix ci lint * remove useless code (#308) * chore: refine payment for gvg settle (#309) * chore: refine gvg staking per bytes and default params (#310) * rename gvgstakingprice to gvgstakingperbytes * fix DefaultMaxStoreSizePerFamily * feat: add chainId to bls sign doc (#313) * add chainId to bls sign doc * get chain id from cosmos context * feat: refine swap out and migrate bucket (#311) * fix: update swagger (#317) * feat: enhance head object api (#321) * fix gnfd query api (#318) * feat: update challenge and stop serving for sp exit (#322) * feat: fix review comments of sp exit (#320) * fix code review tips (#325) * fix cosmos sdk version * fix e2e test case * fix review tips
* init virtual group module * add create/delete/deposit/withdraw/swapout messages * add sp keeper dependency * add router and type function * refactor sequence to support uint32 and U256 * impl virtual group module * refactor storage module * refactor challenge module to algin the new design * self review code * fix testcase and punish code * fix challenge testcases * refactor payment module to algin the new design * add e2e test * fix some unit tests * update cosmos-sdk * update go mod * fix e2e test * store deposit * update gomod * fix some e2e test case * fix cancel create object * ignore error for testing * fix storage test * fix test case * make GetGVG more simple * add virtual group swap out message * fix swap out * add event * fix ignite missing placeholder * add sp exit message * add sp exit * complete sp exit * add swap deposit * remove virtual payment account from local virtual group/ event * complete sp exit process * fix mock file error * add mock gen * fix swap out as secondary sp error * refator payment * refactor approval to get more extends * fix payment unit test * add withdraw cli * revert extends of approval * refactor payment for settlement and resume * refactor payment for out flow * fix proto * add basic migration bucket logic * fix the sp exit * refine the code * add payment for bucket migration * refactor code * fix some issues * fix issue and unit tests * add migration check and rebinding * refine the code * refactor withdraw from gvg & gvg family * feat: use bls sig in sealObject by secondary sps (#283) * fix gensp test error * add more check and params * add some unit tests for payment * fix compile error * add exit,completeexit, swapout events * add migration event * add create gvg family event * mirror update * fix lint issues * fix lint issues * fix some unit tests * fix the limit of gvgs and lvgs * fix bucket migration * fix address issues for new messages * refine challenge module * refine payment module * fix basesuite for create so many families * fix lint * add deposit/withdraw test for virtual group * fix issue of iterator * add basic sp exit test and fix some bugs * fix issue and refactor e2e tests * add e2e test cases * fix and add e2e test cases * refactor e2e test * add sp swap out test * refine code by cr * fix some review comments * fix cr suggestion * fix some review comments * refine the code * calculate sp num instead of constant * add migration e2e test * feat: bls sig for complete migrate bucket (#291) * fix bucket migration issue * update cosmos sdk version * fix migration bucket e2e test * fix CodeReview issues * fix some bugs * update staking per GB * refine some var * fix RebindingGVGsToBucket revert error * feat: Local virtual group and Billing info refacot (#306) * fix challenge refactor * fix some review tips * fix internal bucket info error * add family id to CreateBucketEvent * refactor challenge module * refactor payment module * fix redundany GenId * add family id check * refactor payment module * fix error * refactor payment module * fix issue * implement virtual group cmd * refine the comments of protobuf * fix e2e test * remove some useless code * fix sp exit test * add more sp exit test and fix some bugs * using id instead of address for some interfaces and events * fix some tests * fix e2e * fix unit test * add more check and parmas check * fix e2e tests * fix an issue * fix sp test * fix ci lint * remove useless code (#308) * chore: refine payment for gvg settle (#309) * chore: refine gvg staking per bytes and default params (#310) * rename gvgstakingprice to gvgstakingperbytes * fix DefaultMaxStoreSizePerFamily * feat: add chainId to bls sign doc (#313) * add chainId to bls sign doc * get chain id from cosmos context * feat: refine swap out and migrate bucket (#311) * fix: update swagger (#317) * feat: enhance head object api (#321) * fix gnfd query api (#318) * feat: update challenge and stop serving for sp exit (#322) * feat: fix review comments of sp exit (#320) * fix code review tips (#325) * fix cosmos sdk version * fix e2e test case * fix review tips
Description
In the previous design, the operator addresses of storage providers were directly stored in BucketInfo and ObjectInfo, resulting in a significant amount of metadata modification when a storage provider exited. To address this issue, we propose the concept of virtual groups. A virtual group consists of a primary storage provider and several secondary storage providers. Each object is associated with a virtual group, limiting the range of secondary storage providers for storing object replica data. This design offers several benefits. Firstly, it provides better support for bucket migration and storage provider exit, reducing the number of transactions required. Secondly, it reduces the size of metadata stored on the blockchain for both buckets and objects.
However, this proposal will have a huge impact on various existing modules and processes. The key changes are listed as follows:
Virtual Group Module
We will introduce a new module to manage all virtual groups. The number of storage providers in each virtual group is determined by the redundancy policy. E.g If our redundancy policy specifies a full replica and a 4+2 erasure coding (EC) replica tree, so every virtual group should have one primary sp and six secondary sp.
Terminology
Global Virtual Group (GVG): A global virtual group consists of one primary SP (SP) and multiple secondary SPs.
Local Virtual Group(LVG): Each bucket maintains a mapping from the local group ID to the global group ID. j(e.g 3 ➝ 001960583).
Virtual Group Family(VGF): Each primary storage provider can create multiple virtual group families, with each family containing several global virtual groups. Each family serves a limited number of buckets. Once the store size exceeds a specified threshold, the family will no longer allow to serve more buckets.
Relationships
Local virtual groups are linked to their corresponding buckets, and each object needs to store the ID information of the local virtual group. Each local virtual group must correspond to one and only one global virtual group.
In order to avoid all the data of a primary SP being transferred to one SP within a short period of time, we introduce the concept of "family".
A family can contain multiple GVG that the same SP creates. A bucket can only be served by the GVGs that are in the same family, cross family GVG is not allowed within one bucket. Once the total storage size of a family exceeds 64TB(TBD), the GVG inside the family can not server new buckets, the SP has to create a new family. By introducing family , the primary SP can exit at family level without breaking the one bucket, one primary SP rule.
[Need confirm] When all GVGs within a family become unavailable and it's not possible to create new GVGs and add them to the family, how to handle this situation?
Staking
We introduce a new staking rule based on storage size. The minimum required staking tokens can be calculated using the formula
storage_staking_price * stored_size
. The storage providers have the option to pre-stake tokens for upcoming storage if needed.All staking tokens will be managed by the Virtual Group Module account. Only during deletion or swapping out, the storage providers can get these staking tokens back. In the event of a storage provider's forced exit, these tokens will be forfeited and used to reward those storage providers which take over these GVG.
SP Exit
Bucket Migration
Rationale
This solution can significantly reduce the amount of meta data modifications when the service provider (SP) exits or during bucket migration.
Example
NA
Changes
Notable changes: