Skip to content

Commit

Permalink
Merge pull request #153 from qubic/develop (Release/v1.216.0)
Browse files Browse the repository at this point in the history
Release/v1.216.0 to main
  • Loading branch information
philippwerner authored Aug 27, 2024
2 parents 8e56ea1 + 6a5829f commit a2b0f0f
Show file tree
Hide file tree
Showing 18 changed files with 853 additions and 321 deletions.
61 changes: 13 additions & 48 deletions src/contract_core/contract_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ static SYSTEM_PROCEDURE contractSystemProcedures[contractCount][contractSystemPr
static unsigned short contractSystemProcedureLocalsSizes[contractCount][contractSystemProcedureCount];


#define REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(contractName)\
#define REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(contractName) { \
constexpr unsigned int contractIndex = contractName##_CONTRACT_INDEX; \
if (!contractName::__initializeEmpty) contractSystemProcedures[contractIndex][INITIALIZE] = (SYSTEM_PROCEDURE)contractName::__initialize;\
contractSystemProcedureLocalsSizes[contractIndex][INITIALIZE] = contractName::__initializeLocalsSize; \
if (!contractName::__beginEpochEmpty) contractSystemProcedures[contractIndex][BEGIN_EPOCH] = (SYSTEM_PROCEDURE)contractName::__beginEpoch;\
Expand All @@ -245,54 +246,18 @@ contractSystemProcedureLocalsSizes[contractIndex][POST_ACQUIRE_SHARES] = contrac
if (!contractName::__postReleaseSharesEmpty) contractSystemProcedures[contractIndex][POST_RELEASE_SHARES] = (SYSTEM_PROCEDURE)contractName::__postReleaseShares;\
contractSystemProcedureLocalsSizes[contractIndex][POST_RELEASE_SHARES] = contractName::__postReleaseSharesSize; \
if (!contractName::__expandEmpty) contractExpandProcedures[contractIndex] = (EXPAND_PROCEDURE)contractName::__expand;\
((contractName*)contractState)->__registerUserFunctionsAndProcedures(qpi);
QpiContextForInit qpi(contractIndex); \
contractName::__registerUserFunctionsAndProcedures(qpi); \
}


static void initializeContract(const unsigned int contractIndex, void* contractState)
static void initializeContracts()
{
QpiContextForInit qpi(contractIndex);
switch (contractIndex)
{
case QX_CONTRACT_INDEX:
{
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QX);
}
break;

case QUOTTERY_CONTRACT_INDEX:
{
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QUOTTERY);
}
break;

case RANDOM_CONTRACT_INDEX:
{
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(RANDOM);
}
break;

case QUTIL_CONTRACT_INDEX:
{
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QUTIL);
}
break;

case MLM_CONTRACT_INDEX:
{
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(MLM);
}
break;

case GQMPROP_CONTRACT_INDEX:
{
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(GQMPROP);
}
break;

case SWATCH_CONTRACT_INDEX:
{
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(SWATCH);
}
break;
}
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QX);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QUOTTERY);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(RANDOM);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QUTIL);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(MLM);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(GQMPROP);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(SWATCH);
}
53 changes: 0 additions & 53 deletions src/network_messages/special_command.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@

#include "common_def.h"

// proposal and ballot are replaced by SC
// TODO: remove completely for epoch 124
struct ComputorProposal
{
unsigned char uriSize;
unsigned char uri[255];
};
struct ComputorBallot
{
unsigned char zero;
unsigned char votes[(NUMBER_OF_COMPUTORS * 3 + 7) / 8];
unsigned char quasiRandomNumber;
};

struct SpecialCommand
{
Expand All @@ -27,46 +14,6 @@ struct SpecialCommand

#define SPECIAL_COMMAND_SHUT_DOWN 0ULL

// ProposalAndBallot are replaced by SC
// TODO: remove completely for epoch 124
#define SPECIAL_COMMAND_GET_PROPOSAL_AND_BALLOT_REQUEST 1ULL
struct SpecialCommandGetProposalAndBallotRequest
{
unsigned long long everIncreasingNonceAndCommandType;
unsigned short computorIndex;
unsigned char padding[6];
unsigned char signature[SIGNATURE_SIZE];
};

#define SPECIAL_COMMAND_GET_PROPOSAL_AND_BALLOT_RESPONSE 2ULL
struct SpecialCommandGetProposalAndBallotResponse
{
unsigned long long everIncreasingNonceAndCommandType;
unsigned short computorIndex;
unsigned char padding[6];
ComputorProposal proposal;
ComputorBallot ballot;
};

#define SPECIAL_COMMAND_SET_PROPOSAL_AND_BALLOT_REQUEST 3ULL
struct SpecialCommandSetProposalAndBallotRequest
{
unsigned long long everIncreasingNonceAndCommandType;
unsigned short computorIndex;
unsigned char padding[6];
ComputorProposal proposal;
ComputorBallot ballot;
unsigned char signature[SIGNATURE_SIZE];
};

#define SPECIAL_COMMAND_SET_PROPOSAL_AND_BALLOT_RESPONSE 4ULL
struct SpecialCommandSetProposalAndBallotResponse
{
unsigned long long everIncreasingNonceAndCommandType;
unsigned short computorIndex;
unsigned char padding[6];
};


#define SPECIAL_COMMAND_SET_SOLUTION_THRESHOLD_REQUEST 5ULL
#define SPECIAL_COMMAND_SET_SOLUTION_THRESHOLD_RESPONSE 6ULL
Expand Down
19 changes: 1 addition & 18 deletions src/network_messages/tick.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,14 @@ struct TickData
unsigned char month;
unsigned char year;

// proposal and ballot are replaced by SC
// TODO: remove completely for epoch 124
union
{
struct
{
unsigned char uriSize;
unsigned char uri[255];
} proposal;
struct
{
unsigned char zero;
unsigned char votes[(NUMBER_OF_COMPUTORS * 3 + 7) / 8];
unsigned char quasiRandomNumber;
} ballot;
} varStruct;

m256i timelock;
m256i transactionDigests[NUMBER_OF_TRANSACTIONS_PER_TICK];
long long contractFees[MAX_NUMBER_OF_CONTRACTS];

unsigned char signature[SIGNATURE_SIZE];
};

//static_assert(sizeof(TickData) == 8 + 8 + 32 + NUMBER_OF_TRANSACTIONS_PER_TICK * 32 + 8 * MAX_NUMBER_OF_CONTRACTS + SIGNATURE_SIZE, "Something is wrong with the struct size.");
static_assert(sizeof(TickData) == 8 + 8 + 32 + NUMBER_OF_TRANSACTIONS_PER_TICK * 32 + 8 * MAX_NUMBER_OF_CONTRACTS + SIGNATURE_SIZE, "Something is wrong with the struct size.");


struct BroadcastFutureTickData
Expand Down
10 changes: 5 additions & 5 deletions src/public_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// random seed is now obtained from spectrumDigests

#define MAX_NUMBER_OF_PROCESSORS 32
#define NUMBER_OF_SOLUTION_PROCESSORS 6 // do not increase this for this epoch, because there may be issues due to too fast ticking
#define NUMBER_OF_SOLUTION_PROCESSORS 12 // do not increase this, because there may be issues due to too fast ticking

// Number of buffers available for executing contract functions in parallel; having more means reserving a bit more RAM (+1 = +32 MB)
// and less waiting in request processors if there are more parallel contract function requests. The maximum value that may make sense
Expand Down Expand Up @@ -49,12 +49,12 @@
// Config options that should NOT be changed by operators

#define VERSION_A 1
#define VERSION_B 215
#define VERSION_B 216
#define VERSION_C 0

// Epoch and initial tick for node startup
#define EPOCH 123
#define TICK 15500000
#define EPOCH 124
#define TICK 15590000

#define ARBITRATOR "AFZPUAIYVPNUYGJRQVLUKOPPVLHAZQTGLYAAUUNBXFTVTAMSBKQBLEIEPCVJ"

Expand All @@ -73,7 +73,7 @@ static unsigned short REVENUE_FILE_NAME[] = L"revenueScore"; // TODO: for testin
#define MAX_INPUT_DURATION 16384
#define MAX_OUTPUT_DURATION 16384
#define NEURON_VALUE_LIMIT 1LL
#define SOLUTION_THRESHOLD_DEFAULT 39
#define SOLUTION_THRESHOLD_DEFAULT 40

// include commonly needed definitions
#include "network_messages/common_def.h"
Expand Down
Loading

0 comments on commit a2b0f0f

Please sign in to comment.