Skip to content

Commit 32e5b2a

Browse files
committed
core update
1 parent 974b57d commit 32e5b2a

File tree

8 files changed

+236
-26
lines changed

8 files changed

+236
-26
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "deps/qubic-core"]
2+
path = deps/qubic-core
3+
url = https://github.com/qubic/core.git

UPDATE_PLAN.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Qubic.Net Update Plan
2+
3+
Run this checklist each time a new version of [qubic/core](https://github.com/qubic/core) is released.
4+
5+
The C++ source is linked as a git submodule at `deps/qubic-core`.
6+
7+
## 0. Update the submodule
8+
9+
```bash
10+
cd deps/qubic-core
11+
git fetch origin
12+
git checkout <new-release-tag-or-commit>
13+
cd ../..
14+
```
15+
16+
---
17+
18+
## 1. Check version
19+
20+
**C++ source:** `deps/qubic-core/src/public_settings.h``VERSION_A`, `VERSION_B`, `VERSION_C`
21+
**C# target:** `src/Qubic.Core/QubicConstants.cs``QubicCoreVersion`
22+
**C# target:** `src/Qubic.Core/Qubic.Core.csproj``<Version>`
23+
24+
Update the version string and the doc comment at the top of `QubicConstants.cs`.
25+
The NuGet package version in `Qubic.Core.csproj` mirrors the core version (e.g., core `1.278.0` → package `1.278.0`).
26+
For C#-only bugfixes between core releases, use a 4th segment (e.g., `1.278.0.1`).
27+
28+
---
29+
30+
## 2. Update constants
31+
32+
**C++ source:** `deps/qubic-core/src/network_messages/common_def.h`
33+
**C# target:** `src/Qubic.Core/QubicConstants.cs`
34+
35+
Check these values:
36+
- `NUMBER_OF_COMPUTORS``NumberOfComputors`
37+
- `QUORUM``Quorum`
38+
- `NUMBER_OF_EXCHANGED_PEERS``NumberOfExchangedPeers`
39+
- `SPECTRUM_DEPTH``SpectrumDepth`
40+
- `SPECTRUM_CAPACITY``SpectrumCapacity`
41+
- `ASSETS_DEPTH``AssetsDepth`
42+
- `ASSETS_CAPACITY``AssetsCapacity`
43+
- `NUMBER_OF_TRANSACTIONS_PER_TICK``MaxTransactionsPerTick`
44+
- `MAX_NUMBER_OF_CONTRACTS``MaxNumberOfContracts`
45+
- `MAX_INPUT_SIZE``MaxInputSize`
46+
- `SIGNATURE_SIZE``SignatureSize`
47+
- `ISSUANCE_RATE``IssuanceRate`
48+
- `MAX_AMOUNT``MaxAmount`
49+
- `MAX_SUPPLY``MaxSupply`
50+
51+
Also check `deps/qubic-core/src/public_settings.h` for any new constants.
52+
53+
---
54+
55+
## 3. Update network message types
56+
57+
**C++ source:** `deps/qubic-core/src/network_messages/network_message_type.h``enum NetworkMessageType`
58+
**C# target:** `src/Qubic.Core/NetworkMessageTypes.cs`
59+
60+
Add any new message types, verify existing values haven't changed.
61+
62+
---
63+
64+
## 4. Update contract definitions
65+
66+
**C++ source:** `deps/qubic-core/src/contract_core/contract_def.h``contractDescriptions[]` array
67+
**C# target:** `src/Qubic.Core/QubicContracts.cs`
68+
69+
For each contract entry verify index, name, and construction epoch.
70+
71+
---
72+
73+
## 5. Update QX procedures
74+
75+
**C++ source:** `deps/qubic-core/src/contracts/Qx.h``REGISTER_USER_PROCEDURES` macro
76+
**C# target:** `src/Qubic.Core/QxProcedures.cs`
77+
78+
Each `REGISTER_USER_PROCEDURE(Name, ID)` maps to `public const ushort Name = ID;`
79+
80+
---
81+
82+
## 6. Update QUTIL procedures
83+
84+
**C++ source:** `deps/qubic-core/src/contracts/QUtil.h``REGISTER_USER_PROCEDURES` macro
85+
**C# target:** `src/Qubic.Core/QutilProcedures.cs`
86+
87+
---
88+
89+
## 7. Check struct sizes
90+
91+
If network structs changed, verify derived size constants in `QubicConstants.cs`:
92+
- `EntityRecordSize` (64) — `deps/qubic-core/src/network_messages/entity.h`
93+
- `TransactionHeaderSize` (80) — transaction struct
94+
- `TickSize` (344) — tick struct
95+
- `AssetRecordSize` (48) — asset structs
96+
- `PacketHeaderSize` (8) — `RequestResponseHeader`
97+
98+
Also check if `Qubic.Serialization` readers/writers need updates.
99+
100+
---
101+
102+
## 8. Build and test
103+
104+
```bash
105+
dotnet build
106+
dotnet test
107+
```
108+
109+
---
110+
111+
## 9. Publish updated packages
112+
113+
If `Qubic.Crypto` changed:
114+
1. Bump version in `src/Qubic.Crypto/Qubic.Crypto.csproj`
115+
2. `dotnet pack src/Qubic.Crypto -c Release` → publish to NuGet
116+
3. Update `PackageReference` version in `src/Qubic.Core/Qubic.Core.csproj`
117+
118+
Then for `Qubic.Core`:
119+
1. Set version in `src/Qubic.Core/Qubic.Core.csproj` to match core (e.g., `1.279.0`)
120+
2. `dotnet pack src/Qubic.Core -c Release` → publish to NuGet
121+
122+
---
123+
124+
## Quick reference: C++ → C# file mapping
125+
126+
| C++ Source (deps/qubic-core/) | C# Target (src/Qubic.Core/) |
127+
|-------------------------------|------------------------------|
128+
| `src/public_settings.h` | `QubicConstants.cs` |
129+
| `src/network_messages/common_def.h` | `QubicConstants.cs` |
130+
| `src/network_messages/network_message_type.h` | `NetworkMessageTypes.cs` |
131+
| `src/contract_core/contract_def.h` | `QubicContracts.cs` |
132+
| `src/contracts/Qx.h` | `QxProcedures.cs` |
133+
| `src/contracts/QUtil.h` | `QutilProcedures.cs` |

deps/qubic-core

Submodule qubic-core added at bcc5531

src/Qubic.Core/NetworkMessageTypes.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace Qubic.Core;
22

33
/// <summary>
44
/// Network message types for the Qubic protocol.
5+
/// Based on: https://github.com/qubic/core network_message_type.h
56
/// </summary>
67
public static class NetworkMessageTypes
78
{
@@ -14,13 +15,15 @@ public static class NetworkMessageTypes
1415
public const byte RequestQuorumTick = 14;
1516
public const byte RequestTickData = 16;
1617
public const byte BroadcastTransaction = 24;
18+
public const byte RequestTransactionInfo = 26;
1719
public const byte RequestCurrentTickInfo = 27;
1820
public const byte RespondCurrentTickInfo = 28;
1921
public const byte RequestTickTransactions = 29;
2022
public const byte RequestEntity = 31;
2123
public const byte RespondEntity = 32;
2224
public const byte RequestContractIpo = 33;
2325
public const byte RespondContractIpo = 34;
26+
public const byte EndResponse = 35;
2427
public const byte RequestIssuedAssets = 36;
2528
public const byte RespondIssuedAssets = 37;
2629
public const byte RequestOwnedAssets = 38;
@@ -29,5 +32,32 @@ public static class NetworkMessageTypes
2932
public const byte RespondPossessedAssets = 41;
3033
public const byte RequestContractFunction = 42;
3134
public const byte RespondContractFunction = 43;
35+
public const byte RequestLog = 44;
36+
public const byte RespondLog = 45;
37+
public const byte RequestSystemInfo = 46;
38+
public const byte RespondSystemInfo = 47;
39+
public const byte RequestLogIdRangeFromTx = 48;
40+
public const byte RespondLogIdRangeFromTx = 49;
41+
public const byte RequestAllLogIdRangesFromTx = 50;
42+
public const byte RespondAllLogIdRangesFromTx = 51;
43+
public const byte RequestAssets = 52;
44+
public const byte RespondAssets = 53;
45+
public const byte TryAgain = 54;
46+
public const byte RequestPruningLog = 56;
47+
public const byte RespondPruningLog = 57;
48+
public const byte RequestLogStateDigest = 58;
49+
public const byte RespondLogStateDigest = 59;
50+
public const byte RequestCustomMiningData = 60;
51+
public const byte RespondCustomMiningData = 61;
52+
public const byte RequestCustomMiningSolutionVerification = 62;
53+
public const byte RespondCustomMiningSolutionVerification = 63;
54+
public const byte RequestActiveIpos = 64;
55+
public const byte RespondActiveIpo = 65;
56+
public const byte RequestOracleData = 66;
57+
public const byte RespondOracleData = 67;
58+
public const byte OracleMachineQuery = 190;
59+
public const byte OracleMachineReply = 191;
60+
public const byte RequestTxStatus = 201;
61+
public const byte RespondTxStatus = 202;
3262
public const byte SpecialCommand = 255;
3363
}

src/Qubic.Core/Qubic.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<!-- NuGet Package Metadata -->
1010
<PackageId>Qubic.Core</PackageId>
11-
<Version>1.1.0</Version>
11+
<Version>1.278.0</Version>
1212
<Authors>Qubic.NET Contributors</Authors>
1313
<Description>Core domain models and abstractions for the Qubic network</Description>
1414
<PackageTags>qubic;blockchain;cryptocurrency</PackageTags>

src/Qubic.Core/QubicConstants.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ namespace Qubic.Core;
22

33
/// <summary>
44
/// Qubic protocol constants derived from qubic/core.
5-
/// Based on: https://github.com/qubic/core v1.276.0 (4ee886a)
5+
/// Based on: https://github.com/qubic/core v1.278.0
66
/// </summary>
77
public static class QubicConstants
88
{
99
/// <summary>
1010
/// The Qubic core release version these models are based on.
1111
/// </summary>
12-
public const string QubicCoreVersion = "1.276.0";
12+
public const string QubicCoreVersion = "1.278.0";
1313

1414

1515
#region Network Configuration

src/Qubic.Core/QubicContracts.cs

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,81 @@ namespace Qubic.Core;
44

55
/// <summary>
66
/// Well-known Qubic contract indices.
7+
/// Based on: https://github.com/qubic/core contract_def.h
78
/// </summary>
89
public static class QubicContracts
910
{
10-
/// <summary>
11-
/// QX - Asset exchange contract.
12-
/// </summary>
11+
/// <summary>Contract 0 - Core/system contract.</summary>
12+
public const int Core = 0;
13+
14+
/// <summary>QX - Asset exchange contract. (epoch 66)</summary>
1315
public const int Qx = 1;
1416

15-
/// <summary>
16-
/// Quottery - Lottery contract.
17-
/// </summary>
17+
/// <summary>QUOTTERY - Lottery contract. (epoch 72)</summary>
1818
public const int Quottery = 2;
1919

20-
/// <summary>
21-
/// Random - Random number generation contract.
22-
/// </summary>
20+
/// <summary>RANDOM - Random number generation contract. (epoch 88)</summary>
2321
public const int Random = 3;
2422

25-
/// <summary>
26-
/// QUTIL - Utility functions (SendToMany, etc).
27-
/// </summary>
23+
/// <summary>QUTIL - Utility functions (SendToMany, etc). (epoch 99)</summary>
2824
public const int Qutil = 4;
2925

30-
/// <summary>
31-
/// MLM - Machine Learning Mining contract.
32-
/// </summary>
26+
/// <summary>MLM - Machine Learning Mining contract. (epoch 112)</summary>
3327
public const int Mlm = 5;
3428

35-
/// <summary>
36-
/// QVAULT - Vault contract.
37-
/// </summary>
38-
public const int Qvault = 6;
29+
/// <summary>GQMPROP - GQM proposal contract. (epoch 123)</summary>
30+
public const int Gqmprop = 6;
3931

40-
/// <summary>
41-
/// QEARN - Earning/staking contract.
42-
/// </summary>
43-
public const int Qearn = 7;
32+
/// <summary>SWATCH - Swatch contract. (epoch 123)</summary>
33+
public const int Swatch = 7;
34+
35+
/// <summary>CCF - Community Contribution Fund contract. (epoch 127)</summary>
36+
public const int Ccf = 8;
37+
38+
/// <summary>QEARN - Earning/staking contract. (epoch 137)</summary>
39+
public const int Qearn = 9;
40+
41+
/// <summary>QVAULT - Vault contract. (epoch 138)</summary>
42+
public const int Qvault = 10;
43+
44+
/// <summary>MSVAULT - Multi-sig vault contract. (epoch 149)</summary>
45+
public const int Msvault = 11;
46+
47+
/// <summary>QBAY - Marketplace contract. (epoch 154)</summary>
48+
public const int Qbay = 12;
49+
50+
/// <summary>QSWAP - Swap contract. (epoch 171)</summary>
51+
public const int Qswap = 13;
52+
53+
/// <summary>NOST - Nostr contract. (epoch 172)</summary>
54+
public const int Nost = 14;
55+
56+
/// <summary>QDRAW - Draw contract. (epoch 179)</summary>
57+
public const int Qdraw = 15;
58+
59+
/// <summary>RL - RL contract. (epoch 182)</summary>
60+
public const int Rl = 16;
61+
62+
/// <summary>QBOND - Bond contract. (epoch 182)</summary>
63+
public const int Qbond = 17;
64+
65+
/// <summary>QIP - Qubic Improvement Proposal contract. (epoch 189)</summary>
66+
public const int Qip = 18;
67+
68+
/// <summary>QRAFFLE - Raffle contract. (epoch 192)</summary>
69+
public const int Qraffle = 19;
70+
71+
/// <summary>QRWA - Real World Assets contract. (epoch 197)</summary>
72+
public const int Qrwa = 20;
73+
74+
/// <summary>QRP - QRP contract. (epoch 199)</summary>
75+
public const int Qrp = 21;
76+
77+
/// <summary>QTF - QTF contract. (epoch 199)</summary>
78+
public const int Qtf = 22;
79+
80+
/// <summary>QDUEL - Duel contract. (epoch 199)</summary>
81+
public const int Qduel = 23;
4482

4583
/// <summary>
4684
/// Gets the contract public key for a given contract index.

src/Qubic.Core/QxProcedures.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,9 @@ public static class QxProcedures
3434
/// Remove a bid order.
3535
/// </summary>
3636
public const ushort RemoveFromBidOrder = 8;
37+
38+
/// <summary>
39+
/// Transfer asset management rights to another contract.
40+
/// </summary>
41+
public const ushort TransferShareManagementRights = 9;
3742
}

0 commit comments

Comments
 (0)