-
Notifications
You must be signed in to change notification settings - Fork 151
Adding new functionality #586
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
Adding new functionality #586
Conversation
Release v1.265.0
…ers, contract state, and balance
…s in lottery contract
…nce state management for lottery epochs
…edule and SetSchedule procedures
…duling logic; update state management for draw hour and schedule
…innerCounter utility function for better clarity and maintainability
…apacity; enhance test expectations for accuracy
…dureCall for consistency
… for improved clarity and maintainability
…improve clarity in usage
…g and revenue calculation to improve clarity and maintainability
|
it looks like you want to change the initialize() method of the contract. i can also see updates to the contract state itself. what is your change strategy from the previous state to the current? |
That's right. I added it there just in case. All necessary new states are processed at the beginning of the epoch.
What do you mean? |
|
while you're at it, please remove the default values from all input/output/locals. |
…ations for clarity and consistency
… RL_DEFAULT_SCHEDULE for clarity and maintainability
|
@philippwerner |
src/contracts/RandomLottery.h
Outdated
| * @brief Date/time guard for draw operations. | ||
| * lastDrawDateStamp prevents more than one action per calendar day (UTC). | ||
| */ | ||
| uint8 lastDrawDay = RL_INVALID_DAY; |
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.
This won't be initialized correctly as you intended and is misleading because this init syntax is not supported for contracts in Qubic. All of the state is initialized with 0 before INITIALIZE is invoked after the IPO. After that, the state isn't reinitialized (exception: you do it in your procedures).
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.
This won't be initialized correctly as you intended and is misleading because this init syntax is not supported for contracts in Qubic.
I understand this won't be called. If it's confusing, I'll remove it now.
If you change the size or the binary structure of the contract state after the IPO, you need to provide a state file conversion tool that the computor operators can run (an inspect) in order to convert the old state file (used by v1 code) to the new state file (used by v2 code). The core doesn't handle changes in state size and INITIALIZE won't be called if you release v2, because the original idea of contracts is to be immutable (no v2). Or if you plan to have a fresh restart with an "empty" state (I don't know if there is any relevant data is kept in your state across epochs), you can give instructions for the computor operators (such as generate a file of size X containing all zero bytes) and have some code in BEGIN_EPOCH that does additional initialization in the specific first epoch of v2. |
Remove initialize
Is there any example implementation? Where can I find the file for v1? |
Has been done for QVAULT #365 with this tool https://github.com/TakaYuPP/qubic-stateFile-migration-QVAULT-SC--tool
For the contract state of the main net, there is a new file after each epoch. For developing and testing the tool, you may download the ep185.zip file posted in the computor-operators channel by Pomm3sgab3l on Oct 29th. |
|
Thanks a lot |
|
@N-010 @philippwerner
For an example, please see MsVault 2.0: #485 |
|
@Franziska-Mueller |
Proposal:
https://github.com/N-010/proposal/blob/feature/2025-09-13-RandomLottery/SmartContracts/2025-09-13-RandomLotteryV2.md
Migration tool:
https://github.com/[N-010/convert-rl-state](https://github.com/N-010/convert-rl-state)