Skip to content

Feature/qraffle rev#823

Closed
double-k-3033 wants to merge 5 commits intoqubic:developfrom
double-k-3033:feature/qraffle-rev
Closed

Feature/qraffle rev#823
double-k-3033 wants to merge 5 commits intoqubic:developfrom
double-k-3033:feature/qraffle-rev

Conversation

@double-k-3033
Copy link
Copy Markdown
Contributor

No description provided.

@Franziska-Mueller
Copy link
Copy Markdown
Collaborator

could you please give some context how this PR is related to #809 ?

@double-k-3033
Copy link
Copy Markdown
Contributor Author

double-k-3033 commented Apr 8, 2026

could you please give some context how this PR is related to #809 ?

#809, it was merely a simple numerical change.
In #823, We conducted an audit of the Qraffle contract and eliminated defects after #809

Comment thread src/contracts/QRaffle.h
constexpr uint32 QRAFFLE_MIN_QRAFFLE_AMOUNT = 1000000ull;
constexpr uint32 QRAFFLE_MAX_QRAFFLE_AMOUNT = 1000000000ull;
constexpr uint32 QRAFFLE_MAX_TOKEN_RAFFLES = 1048576;
constexpr uint32 QRAFFLE_MAX_SHAREHOLDERS = 1024;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are only 676 shares, why do you need this constant?

Comment thread src/contracts/QRaffle.h
Array<uint32, QRAFFLE_MAX_EPOCH> daoMemberCount; // Number of DAO members (registers) at each epoch
HashMap<id, uint8, QRAFFLE_MAX_MEMBER> registers;
Array<ProposalInfo, QRAFFLE_MAX_PROPOSAL_EPOCH> proposals;
HashMap<VoteKey, bit, QRAFFLE_MAX_VOTE_ENTRIES> voteStatus;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're changing the memory layout of the state here, this means all previous data will be scrambled.

Copy link
Copy Markdown
Contributor

@philippwerner philippwerner Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@double-k-3033 For the core, the state is a binary blob of data and by replacing HashMap <uint32, Array <VotedId, QRAFFLE_MAX_MEMBER>, QRAFFLE_MAX_PROPOSAL_EPOCH> voteStatus; with HashMap<VoteKey, bit, QRAFFLE_MAX_VOTE_ENTRIES> voteStatus; you just change how this part of the binary blob is interpreted, which usually leads to nonsense data and a lot of problems.

Quite common practice is extending the state with additional members, which are initialized with zeros.

For changing parts of the existing state (what you do here), you need to build a separate state conversion tool for the computor operators that reads the state file of the contract from before the change and writes the new state that the new version of the contract expects. That is why changing the memory layout of the state should be avoided.

Franziska-Mueller and others added 2 commits April 15, 2026 16:31
* update contract verification tool for oracles 
* reenable check for QUtil
* use pre-built docker image for contract verify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants