Skip to content

Commit a8dace9

Browse files
authored
Merge pull request #798 from qubic/develop
Release v1.282.0 Add QBridge contract (Vottun) Add Oracle Documentation Fix bug on loading execution fee after seamless epoch change Fix problem during loading of assets from snapshot Adjust TICK_DURATION_FOR_ALLOCATION_MS and TRANSACTION_SPARSENESS Increase ADDITION_SOLUTION_THRESHOLD_DEFAULT to 74800
2 parents f08f172 + 6f03fff commit a8dace9

25 files changed

+3680
-720
lines changed

.github/workflows/contract-verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ jobs:
3939
echo "contract-filepaths=$files" >> "$GITHUB_OUTPUT"
4040
- name: Contract verify action step
4141
id: verify
42-
uses: Franziska-Mueller/qubic-contract-verify@v1.0.4
42+
uses: Franziska-Mueller/qubic-contract-verify@v1.0.5
4343
with:
4444
filepaths: '${{ steps.filepaths.outputs.contract-filepaths }}'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,6 @@ We cannot support you in any case. You are welcome to provide updates, bug fixes
150150
- [Qubic protocol](doc/protocol.md)
151151
- [Custom mining](doc/custom_mining.md)
152152
- [Seamless epoch transition](SEAMLESS.md)
153+
- [Querying oracles](doc/contracts_oracles.md)
153154
- [Proposals and voting](doc/contracts_proposals.md)
154155

doc/OracleEngine.png

86.6 KB
Loading

doc/OracleEngine.svg

Lines changed: 3 additions & 0 deletions
Loading

doc/contracts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,12 @@ QX never releases shares passively (following call of `qpi.acquireShares()` by a
478478
The callbacks `PRE_RELEASE_SHARES()` and `PRE_ACQUIRE_SHARES()` may also check that the `qpi.originator()` initiating the transfer is the owner/possessor.
479479

480480

481+
## Querying off-chain data from Oracles
482+
483+
Oracles enable Smart Contracts to actively query off-chain data sources called Oracles.
484+
Read [Querying Oracles from Contracts](contracts_oracles.md) for more details.
485+
486+
481487
## Other QPI features
482488

483489
### Container types

doc/contracts_oracles.md

Lines changed: 484 additions & 0 deletions
Large diffs are not rendered by default.

src/Qubic.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<ClInclude Include="contracts\Qdraw.h" />
2727
<ClInclude Include="contracts\qRWA.h" />
2828
<ClInclude Include="contracts\Qswap.h" />
29-
<ClInclude Include="contracts\QVAULT_old.h" />
3029
<ClInclude Include="contracts\RandomLottery.h" />
3130
<ClInclude Include="contracts\QDuel.h" />
3231
<ClInclude Include="contracts\SupplyWatcher.h" />

src/Qubic.vcxproj.filters

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,6 @@
365365
<ClInclude Include="oracle_core\snapshot_files.h">
366366
<Filter>oracle_core</Filter>
367367
</ClInclude>
368-
<ClInclude Include="contracts\QVAULT_old.h">
369-
<Filter>contracts</Filter>
370-
</ClInclude>
371368
</ItemGroup>
372369
<ItemGroup>
373370
<Filter Include="platform">
@@ -418,4 +415,4 @@
418415
<Filter>platform</Filter>
419416
</MASM>
420417
</ItemGroup>
421-
</Project>
418+
</Project>

src/assets/assets.h

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "contract_core/contract_def.h"
1515

1616
#include "public_settings.h"
17+
#include "private_settings.h"
1718
#include "logging/logging.h"
1819
#include "kangaroo_twelve.h"
1920
#include "four_q.h"
@@ -771,7 +772,7 @@ static bool saveUniverse(const CHAR16* fileName = UNIVERSE_FILE_NAME, const CHAR
771772
return false;
772773
}
773774

774-
static bool loadUniverse(const CHAR16* fileName = UNIVERSE_FILE_NAME, CHAR16* directory = NULL)
775+
static bool loadUniverse(const CHAR16* fileName = UNIVERSE_FILE_NAME, CHAR16* directory = NULL, bool rebuildIndexLists = true)
775776
{
776777
PROFILE_SCOPE();
777778

@@ -782,9 +783,38 @@ static bool loadUniverse(const CHAR16* fileName = UNIVERSE_FILE_NAME, CHAR16* di
782783

783784
return false;
784785
}
785-
as.indexLists.rebuild();
786+
787+
if (rebuildIndexLists)
788+
as.indexLists.rebuild();
789+
790+
return true;
791+
}
792+
793+
#if TICK_STORAGE_AUTOSAVE_MODE
794+
static bool saveSnapshotUniverseIndex(const CHAR16* fileName, const CHAR16* directory = NULL)
795+
{
796+
long long savedSize = save(fileName, sizeof(as.indexLists), (unsigned char*)&as.indexLists, directory);
797+
logToConsole(L"Saving universe index");
798+
if (savedSize != sizeof(as.indexLists))
799+
{
800+
logToConsole(L"Failed to save universe index");
801+
return false;
802+
}
803+
return true;
804+
}
805+
806+
static bool loadSnapshotUniverseIndex(const CHAR16* fileName, CHAR16* directory = NULL)
807+
{
808+
long long loadedSize = load(fileName, sizeof(as.indexLists), (unsigned char*)&as.indexLists, directory);
809+
logToConsole(L"Loading universe index");
810+
if (loadedSize != sizeof(as.indexLists))
811+
{
812+
logToConsole(L"Failed to load universe index");
813+
return false;
814+
}
786815
return true;
787816
}
817+
#endif
788818

789819
static void assetsEndEpoch()
790820
{

src/assets/net_msg_impl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ static void processRequestAssetsSendRecord(Peer* peer, RequestResponseHeader* re
135135

136136
static void processRequestAssets(Peer* peer, RequestResponseHeader* header)
137137
{
138-
// check size of recieved message (request by universe index may be smaller than sizeof(RequestAssets))
138+
// check size of received message (request by universe index may be smaller than sizeof(RequestAssets))
139139
if (!header->checkPayloadSizeMinMax(sizeof(RequestAssets::byUniverseIdx), sizeof(RequestAssets)))
140140
return;
141141
RequestAssets* request = header->getPayload<RequestAssets>();
142142
if (request->assetReqType != RequestAssets::requestByUniverseIdx && !header->checkPayloadSize(sizeof(RequestAssets)))
143143
return;
144144

145-
// initalize output message (with siblings because the variant without siblings is just a subset)
145+
// initialize output message (with siblings because the variant without siblings is just a subset)
146146
struct
147147
{
148148
RequestResponseHeader header;
@@ -152,7 +152,7 @@ static void processRequestAssets(Peer* peer, RequestResponseHeader* header)
152152
response.header.setType(RespondAssets::type());
153153
response.header.setDejavu(header->dejavu());
154154

155-
// size of output message depends on whether sibilings are requested
155+
// size of output message depends on whether siblings are requested
156156
if (request->byFilter.flags & RequestAssets::getSiblings)
157157
response.header.setSize<sizeof(RequestResponseHeader) + sizeof(RespondAssetsWithSiblings)>();
158158
else

0 commit comments

Comments
 (0)