fix: upgrade WASM hash validation, VRF mode docs, StakingPeriod error handling, and governance token set_admin event (#305, #306, #307, #301) - #395
Open
linesofcodes0-cloud wants to merge 2 commits into
Conversation
added 2 commits
August 31, 2026 10:50
… handling, and governance token set_admin event (cocor-tech#305, cocor-tech#306, cocor-tech#307, cocor-tech#301)
|
@linesofcodes0-cloud Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
This PR has merge conflicts against the latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #305
Closes #306
Closes #307
Closes #301
Fixes #305
Fixes #306
Fixes #307
Fixes #301
Resolves #305
Resolves #306
Resolves #307
Resolves #301
Closes #305
Closes #306
Closes #307
Closes #301
Fixes #305
Fixes #306
Fixes #307
Fixes #301
Resolves #305
Resolves #306
Resolves #307
Resolves #301
#305
#306
#307
#301
Linked Issues
Summary
This PR resolves four contract issues in
cocor-tech/moistello-contracts:1. Upgrade
upgrade_contractWASM hash validation (Closes #305)packages/common/src/upgrade.rsaccepted anynew_wasm_hashwithout checking for zero/invalid hash.upgrade_contractreturningErr(UpgradeError::InvalidWasmHash)ifnew_wasm_hashis all zero ([0u8; 32]). Added unit testtest_upgrade_contract_zero_hash_fails.2. VRF
init_vrfwithNoneadmin key documentation & protection (Closes #306)init_vrfallowedadmin_key = None(hash-chain-only mode) without explicit rustdoc documentation, and reinitialization check checkedADMIN_KEYinstead ofSALT_KEY.init_vrfandverify_vrfdocstrings. Fixed reinitialization check to inspectSALT_KEYso reinitialization is blocked whether an admin key was provided or not. Added unit testtest_vrf_hash_chain_only_mode.3. Staking
StakingPeriodfrom_u32error handling (Closes #307)StakingPeriod::from_u32returnedOption<Self>, losing context when parsing invalid period numbers.StakingPeriod::try_from_u32(value: u32) -> Result<Self, StakingError>returningStakingError::InvalidPeriodfor invalid periods. Updatedstake()inpackages/staking/src/contract.rsto usetry_from_u32(period_months)?. Added unit testtest_staking_period_try_from_u32.4. Governance token
set_adminevent emission (Closes #301)set_admininpackages/governance-token/src/contract.rsdid not emit an event when updating the admin address.AdminChanged { old_admin: Address, new_admin: Address }contract event struct inpackages/governance-token/src/types.rsand published it insideset_admin.Verification
common(13/13),staking(30/30), andgovernance-token(26/26) passed 100%.