Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5e22e85
compliance changes for CCF SC
Franziska-Mueller Jul 9, 2025
00a8607
compliance changes for GQMPROP SC
Franziska-Mueller Jul 9, 2025
3f4c16c
compliance changes for MSVAULT SC
Franziska-Mueller Jul 9, 2025
8acf937
compliance changes for QEARN SC
Franziska-Mueller Jul 9, 2025
3d71240
compliance changes for QBAY SC
Franziska-Mueller Jul 9, 2025
2ddaccf
compliance changes for QUOTTERY SC
Franziska-Mueller Jul 10, 2025
2568178
compliance changes for QUTIL SC
Franziska-Mueller Jul 10, 2025
7b1c9df
compliance changes for QX SC
Franziska-Mueller Jul 10, 2025
0377446
Qx: add div type explicitly to fix compile errors in test project
Franziska-Mueller Jul 10, 2025
7bf1714
compliance changes for TestExampleD SC
Franziska-Mueller Jul 10, 2025
8c08aa9
add contract verify workflow
Franziska-Mueller Aug 11, 2025
aec4ca7
Update contract-verify.yml
Franziska-Mueller Aug 12, 2025
25017e6
update branch name in contract-verify.yml
Franziska-Mueller Aug 13, 2025
beb82b0
find all contract files to verify
Franziska-Mueller Aug 13, 2025
3e2a7f5
fix typo in contract-verify.yml
Franziska-Mueller Aug 13, 2025
7b611f8
print full path to file list
Franziska-Mueller Aug 13, 2025
131e673
use list of contract files as input for verify action
Franziska-Mueller Aug 13, 2025
8aa3486
only trigger contract-verify.yml when contract files or workflow file…
Franziska-Mueller Aug 13, 2025
6fbd535
use published action in contract-verify.yml
Franziska-Mueller Aug 13, 2025
b913851
Revert "use published action in contract-verify.yml"
Franziska-Mueller Aug 13, 2025
3f4a85f
mention contract verification tool in contracts.md
Franziska-Mueller Aug 14, 2025
c0510bd
make QPI div and mod constexpr
Franziska-Mueller Aug 14, 2025
cd67d39
update contract verify tool text in contracts.md
Franziska-Mueller Aug 14, 2025
20ec9f5
add STATIC_ASSERT macro to enable use of static asserts in SC files
Franziska-Mueller Aug 14, 2025
78ae196
remove workflow trigger on feature branch before merging into develop
Franziska-Mueller Aug 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/contract-verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: ContractVerify

on:
push:
branches: [ "main", "develop", "feature/2025-08-13-contract-verify" ]
paths:
- 'src/contracts/*.h'
- '.github/workflows/contract-verify.yml'
pull_request:
branches: [ "main", "develop", "feature/2025-08-13-contract-verify" ]
paths:
- 'src/contracts/*.h'
- '.github/workflows/contract-verify.yml'

jobs:
contract_verify_job:
runs-on: ubuntu-latest
name: Verify smart contract files
steps:
# Checkout repo to use files of the repo as input for container action
- name: Checkout
uses: actions/checkout@v4
- name: Find all contract files to verify
id: filepaths
run: |
files=$(find src/contracts/ -maxdepth 1 -type f -name "*.h" ! -name "*TestExample*" ! -name "*math_lib*" ! -name "*qpi*" -printf "%p\n" | paste -sd, -)
echo "contract-filepaths=$files" >> "$GITHUB_OUTPUT"
- name: Contract verify action step
id: verify
uses: Franziska-Mueller/qubic-contract-verify@v0.3.0-beta
with:
filepaths: '${{ steps.filepaths.outputs.contract-filepaths }}'
9 changes: 5 additions & 4 deletions doc/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ In order to develop a contract, follow these steps:

Each contract must be validated with the following steps:
1. The contract is verified with a special software tool, ensuring that it complies with the formal requirements mentioned above, such as no use of forbidden C++ features.
(Currently, this tool has not been implemented yet. Thus, this check needs to be done during the review in point 3.)
2. The features of the contract have to be extensively tested with automated tests implemented within the Qubic Core's GoogleTest framework.
3. The contract and testing code must be reviewed by at least one of the Qubic Core devs, ensuring it meets high quality standards.
4. Before integrating the contract in the official Qubic Core release, the features of the contract must be tested in a test network with multiple nodes, showing that the contract works well in practice and that the nodes run stable with the contract.
The tool is available in [this repository](https://github.com/Franziska-Mueller/qubic-contract-verify). You can either built it from source or use the provided GitHub action to run it on your contract header file.
3. The features of the contract have to be extensively tested with automated tests implemented within the Qubic Core's GoogleTest framework.
4. The contract and testing code must be reviewed by at least one of the Qubic Core devs, ensuring it meets high quality standards.
5. Before integrating the contract in the official Qubic Core release, the features of the contract must be tested in a test network with multiple nodes, showing that the contract works well in practice and that the nodes run stable with the contract.

After going through this validation process, a contract can be integrated in official releases of the Qubic Core code.

Expand Down Expand Up @@ -627,3 +627,4 @@ The file `proposal.cpp` has a lot of examples showing how to use both functions.
For example, `getProposalIndices()` shows how to call a contract function requiring input and providing output with `runContractFunction()`.
An example use case of `makeContractTransaction()` can be found in `gqmpropSetProposal()`.
The function `castVote()` is a more complex example combining both, calling a contract function and invoking a contract procedure.

6 changes: 4 additions & 2 deletions src/contracts/ComputorControlledFund.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ struct CCF : public ContractBase
struct GetProposal_output
{
bit okay;
uint8 _padding0[7];
Array<uint8, 4> _padding0;
Array<uint8, 2> _padding1;
Array<uint8, 1> _padding2;
id proposerPubicKey;
ProposalDataT proposal;
};
Expand Down Expand Up @@ -285,7 +287,7 @@ struct CCF : public ContractBase
continue;

// Option for transfer has been accepted?
if (locals.results.optionVoteCount.get(1) > QUORUM / 2)
if (locals.results.optionVoteCount.get(1) > div<uint32>(QUORUM, 2U))
{
// Prepare log entry and do transfer
locals.transfer.destination = locals.proposal.transfer.destination;
Expand Down
6 changes: 4 additions & 2 deletions src/contracts/GeneralQuorumProposal.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ struct GQMPROP : public ContractBase
struct GetProposal_output
{
bit okay;
uint8 _padding0[7];
Array<uint8, 4> _padding0;
Array<uint8, 2> _padding1;
Array<uint8, 1> _padding2;
id proposerPubicKey;
ProposalDataT proposal;
};
Expand Down Expand Up @@ -410,7 +412,7 @@ struct GQMPROP : public ContractBase
}

// Option for changing status quo has been accepted? (option 0 is "no change")
if (locals.mostVotedOptionIndex > 0 && locals.mostVotedOptionVotes > QUORUM / 2)
if (locals.mostVotedOptionIndex > 0 && locals.mostVotedOptionVotes > div<uint32>(QUORUM, 2U))
{
// Set in revenueDonation table (cannot be done in END_EPOCH, because this may overwrite entries that
// are still needed unchanged for this epoch for the revenue donation which is run after END_EPOCH)
Expand Down
1 change: 1 addition & 0 deletions src/contracts/MsVault.h
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ struct MSVAULT : public ContractBase
// [TODO]: Uncomment this to enable live fee update
PUBLIC_PROCEDURE_WITH_LOCALS(voteFeeChange)
{
return;
// locals.ish_in.candidate = qpi.invocator();
// isShareHolder(qpi, state, locals.ish_in, locals.ish_out, locals.ish_locals);
// if (!locals.ish_out.result)
Expand Down
Loading
Loading