Skip to content

Commit

Permalink
Merge pull request #211 from Zondax/rename-method
Browse files Browse the repository at this point in the history
rename community to neurons
  • Loading branch information
ftheirs authored Jun 19, 2023
2 parents bdac696 + 3993be1 commit d744167
Show file tree
Hide file tree
Showing 29 changed files with 57 additions and 59 deletions.
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=2
# This is the minor version of this release
APPVERSION_N=4
# This is the patch version of this release
APPVERSION_P=3
APPVERSION_P=4
6 changes: 3 additions & 3 deletions app/src/candid/candid_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ typedef enum {
hash_operation_IncreaseDissolveDelay = 2143729936,
hash_operation_AddHotkey = 628424947,
hash_operation_RemoveHotkey = 45994902,
hash_operation_JoinCommunityFund = 3248805476,
hash_operation_JoinNeuronsFund = 3248805476,
hash_operation_ChangeAutoStakeMaturity = 1906071820,

hash_operation_StartDissolving = 1977744848,
hash_operation_LeaveCommunityFund = 3675510135,
hash_operation_LeaveNeuronsFund = 3675510135,
hash_operation_SetDissolvedTimestamp = 3913126211,
} operation_variant_hash_e;

Expand All @@ -178,7 +178,7 @@ typedef enum {
FOLLOW_TOPIC_SNS_DECENTRALIZATION_SALE = 11,
FOLLOW_TOPIC_SUBNET_REPLICA_VERSION_MANAGEMENT = 12,
FOLLOW_TOPIC_REPLICA_VERSION_MANAGEMENT = 13,
FOLLOW_TOPIC_SNS_AND_COMMUNITY_FUND = 14,
FOLLOW_TOPIC_SNS_AND_NEURONS_FUND = 14,
} candid_FollowTopics_e;

// Permissions ENUM
Expand Down
6 changes: 3 additions & 3 deletions app/src/candid/nns_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ __Z_INLINE parser_error_t readCommandFollow(parser_context_t *ctx, candid_transa

// now let's read
CHECK_PARSER_ERR(readCandidInt32(ctx, &val->command.follow.topic))
if (val->command.follow.topic < 0 || val->command.follow.topic > FOLLOW_TOPIC_SNS_AND_COMMUNITY_FUND) {
if (val->command.follow.topic < 0 || val->command.follow.topic > FOLLOW_TOPIC_SNS_AND_NEURONS_FUND) {
return parser_unexpected_value;
}
CHECK_PARSER_ERR(readCandidByte(ctx, &val->command.follow.followees_size))
Expand Down Expand Up @@ -498,10 +498,10 @@ __Z_INLINE parser_error_t readCommandConfigure(parser_context_t *ctx, candid_tra
case hash_operation_RemoveHotkey:
CHECK_PARSER_ERR(readOperationAddRemoveHotkey(ctx, txn, operation))
break;
case hash_operation_LeaveCommunityFund:
case hash_operation_LeaveNeuronsFund:
case hash_operation_StartDissolving:
case hash_operation_StopDissolving:
case hash_operation_JoinCommunityFund:
case hash_operation_JoinNeuronsFund:
// Check empty record
CHECK_PARSER_ERR(getCandidTypeFromTable(txn, txn->element.implementation))
CHECK_PARSER_ERR(readCandidRecordLength(txn))
Expand Down
16 changes: 8 additions & 8 deletions app/src/parser_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ parser_error_t getManageNeuronType(const parser_tx_t *v, manageNeuron_e *mn_type
case hash_operation_SetDissolvedTimestamp:
*mn_type = Configure_SetDissolvedTimestamp;
break;
case hash_operation_LeaveCommunityFund:
*mn_type = Configure_LeaveCommunityFundCandid;
case hash_operation_LeaveNeuronsFund:
*mn_type = Configure_LeaveNeuronsFundCandid;
break;
case hash_operation_ChangeAutoStakeMaturity:
*mn_type = Configure_ChangeAutoStakeMaturity;
Expand All @@ -345,8 +345,8 @@ parser_error_t getManageNeuronType(const parser_tx_t *v, manageNeuron_e *mn_type
case hash_operation_StopDissolving:
*mn_type = isSNS ? SNS_Configure_StopDissolving : Configure_StopDissolvingCandid;
break;
case hash_operation_JoinCommunityFund:
*mn_type = Configure_JoinCommunityFundCandid;
case hash_operation_JoinNeuronsFund:
*mn_type = Configure_JoinNeuronsFundCandid;
break;
case hash_operation_AddHotkey:
*mn_type = Configure_AddHotkeyCandid;
Expand Down Expand Up @@ -736,10 +736,10 @@ uint8_t getNumItemsManageNeurons(__Z_UNUSED const parser_context_t *c, const par

switch (mn_type) {
case Configure_StopDissolving :
case Configure_JoinCommunityFund :
case Configure_LeaveCommunityFund :
case Configure_JoinCommunityFundCandid:
case Configure_LeaveCommunityFundCandid:
case Configure_JoinNeuronsFund :
case Configure_LeaveNeuronsFund :
case Configure_JoinNeuronsFundCandid:
case Configure_LeaveNeuronsFundCandid:
case Configure_StartDissolving : {
return 2;
}
Expand Down
16 changes: 8 additions & 8 deletions app/src/parser_print_candid.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ __Z_INLINE parser_error_t print_follow_topic(int32_t topic, char *outVal, uint16
case FOLLOW_TOPIC_REPLICA_VERSION_MANAGEMENT:
pageString(outVal, outValLen, "Replica Version Management", pageIdx, pageCount);
break;
case FOLLOW_TOPIC_SNS_AND_COMMUNITY_FUND:
pageString(outVal, outValLen, "SNS & Community Fund", pageIdx, pageCount);
case FOLLOW_TOPIC_SNS_AND_NEURONS_FUND:
pageString(outVal, outValLen, "SNS & Neurons' Fund", pageIdx, pageCount);
break;

default:
Expand Down Expand Up @@ -733,10 +733,10 @@ static parser_error_t parser_getItemConfigureNoElementsCandid(uint8_t displayIdx
pageString(outVal, outValLen, "Start Dissolve Neuron", pageIdx, pageCount);
} else if (hash == hash_operation_StopDissolving) {
pageString(outVal, outValLen, "Stop Dissolve Neuron", pageIdx, pageCount);
} else if (hash == hash_operation_JoinCommunityFund) {
pageString(outVal, outValLen, JOIN_COMMUNITY_FUND, pageIdx, pageCount);
} else if (hash == hash_operation_LeaveCommunityFund) {
pageString(outVal, outValLen, "Leave Community Fund", pageIdx, pageCount);
} else if (hash == hash_operation_JoinNeuronsFund) {
pageString(outVal, outValLen, "Join Neurons' Fund", pageIdx, pageCount);
} else if (hash == hash_operation_LeaveNeuronsFund) {
pageString(outVal, outValLen, "Leave Neurons' Fund", pageIdx, pageCount);
} else {
return parser_unexpected_value;
}
Expand Down Expand Up @@ -1166,8 +1166,8 @@ __Z_INLINE parser_error_t parser_getItemManageNeuron(const parser_context_t *ctx
case Configure_AddHotkeyCandid:
case Configure_RemoveHotkeyCandid:
return parser_getItemConfigureAddRemoveHotkeyCandid(displayIdx, outKey, outKeyLen, outVal, outValLen, pageIdx, pageCount);
case Configure_JoinCommunityFundCandid:
case Configure_LeaveCommunityFundCandid:
case Configure_JoinNeuronsFundCandid:
case Configure_LeaveNeuronsFundCandid:
case Configure_StartDissolvingCandid:
case Configure_StopDissolvingCandid:
return parser_getItemConfigureNoElementsCandid(displayIdx, outKey, outKeyLen, outVal, outValLen, pageIdx, pageCount);
Expand Down
12 changes: 6 additions & 6 deletions app/src/parser_print_protobuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static parser_error_t parser_getItemIncreaseNeuronTimer(uint8_t displayIdx,
return parser_no_data;
}

static parser_error_t parser_getItemJoinCommunityFund(uint8_t displayIdx,
static parser_error_t parser_getItemJoinNeuronsFund(uint8_t displayIdx,
char *outKey, uint16_t outKeyLen,
char *outVal, uint16_t outValLen,
uint8_t pageIdx, uint8_t *pageCount) {
Expand All @@ -278,7 +278,7 @@ static parser_error_t parser_getItemJoinCommunityFund(uint8_t displayIdx,

if (displayIdx == 0) {
snprintf(outKey, outKeyLen, "Transaction type");
snprintf(outVal, outValLen, JOIN_COMMUNITY_FUND);
snprintf(outVal, outValLen, "Join Neurons' Fund");
return parser_ok;
}

Expand Down Expand Up @@ -723,7 +723,7 @@ static parser_error_t parser_getItemFollow(uint8_t displayIdx,
return parser_ok;
}
case ic_nns_governance_pb_v1_Topic_TOPIC_SNS_AND_COMMUNITY_FUND : {
snprintf(outVal, outValLen, "SNS & Community Fund");
snprintf(outVal, outValLen, "SNS & Neurons' Fund");
return parser_ok;
}
default: {
Expand Down Expand Up @@ -795,9 +795,9 @@ static parser_error_t parser_getItemManageNeuron(uint8_t displayIdx,
case Configure_IncreaseDissolveDelay:
return parser_getItemIncreaseNeuronTimer(displayIdx,
outKey, outKeyLen, outVal, outValLen, pageIdx, pageCount);
case Configure_JoinCommunityFund :
return parser_getItemJoinCommunityFund(displayIdx,
outKey, outKeyLen, outVal, outValLen, pageIdx, pageCount);
case Configure_JoinNeuronsFund :
return parser_getItemJoinNeuronsFund(displayIdx,
outKey, outKeyLen, outVal, outValLen, pageIdx, pageCount);
case Configure_StopDissolving :
case Configure_StartDissolving : {
return parser_getItemStartStopDissolve(displayIdx,
Expand Down
2 changes: 0 additions & 2 deletions app/src/parser_print_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ extern "C" {
#endif

#if defined(TARGET_STAX)
#define JOIN_COMMUNITY_FUND "Join Community Fund"
#define INCREASE_DISSOLVE_DELAY "Increase Dissolve\nDelay"
#define START_DISSOLVE_NEURON "Start Dissolve Neuron"
#define STOP_DISSOLVE_NEURON "Stop Dissolve Neuron"
#else
#define JOIN_COMMUNITY_FUND "Join Community Fund"
#define INCREASE_DISSOLVE_DELAY "Increase Dissolve Delay"
#define START_DISSOLVE_NEURON "Start Dissolve Neuron"
#define STOP_DISSOLVE_NEURON "Stop Dissolve Neuron"
Expand Down
8 changes: 4 additions & 4 deletions app/src/parser_txdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ typedef enum {
Configure_AddHotKey = 2004,
Configure_RemoveHotKey = 2005,
Configure_SetDissolvedTimestamp = 2006,
Configure_JoinCommunityFund = 2007,
Configure_LeaveCommunityFund = 2008,
Configure_JoinNeuronsFund = 2007,
Configure_LeaveNeuronsFund = 2008,
Configure_ChangeAutoStakeMaturity = 2009,

////
Expand All @@ -94,8 +94,8 @@ typedef enum {
Configure_StartDissolvingCandid = 1004,
Configure_StopDissolvingCandid = 1005,
DisburseCandid = 1006,
Configure_JoinCommunityFundCandid = 1007,
Configure_LeaveCommunityFundCandid = 1008,
Configure_JoinNeuronsFundCandid = 1007,
Configure_LeaveNeuronsFundCandid = 1008,
Configure_AddHotkeyCandid = 1009,
Configure_RemoveHotkeyCandid = 1010,
RegisterVoteCandid = 1011,
Expand Down
2 changes: 1 addition & 1 deletion deps/ledger-zxlib
2 changes: 1 addition & 1 deletion deps/nanos-secure-sdk
2 changes: 1 addition & 1 deletion deps/stax-secure-sdk
8 changes: 4 additions & 4 deletions tests/manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -9349,20 +9349,20 @@
"output": ["0 | Transaction type : Claim Neurons"]
},
{
"name": "Join Community Fund",
"name": "Join Neurons Fund",
"index": 1040,
"blob": "d9d9f7a167636f6e74656e74a663617267486202107b12023a006b63616e69737465725f69644a000000000000000101016e696e67726573735f6578706972791b16ba67d2b864bf406b6d6574686f645f6e616d65706d616e6167655f6e6575726f6e5f70626c726571756573745f747970656463616c6c6673656e646572581dd899978f029508f4fa5fce3d2539de5aade6d229efcc458233deee7502",
"output": [
"0 | Transaction type : Join Community Fund",
"0 | Transaction type : Join Neurons' Fund",
"1 | Neuron ID : 123"
]
},
{
"name": "Join Community Fund",
"name": "Join Neurons Fund",
"index": 1041,
"blob": "d9d9f7a167636f6e74656e74a66361726749620310c80312023a006b63616e69737465725f69644a000000000000000101016e696e67726573735f6578706972791b16ba68220c1cfe006b6d6574686f645f6e616d65706d616e6167655f6e6575726f6e5f70626c726571756573745f747970656463616c6c6673656e646572581dd899978f029508f4fa5fce3d2539de5aade6d229efcc458233deee7502",
"output": [
"0 | Transaction type : Join Community Fund",
"0 | Transaction type : Join Neurons' Fund",
"1 | Neuron ID : 456"
]
}
Expand Down
Loading

0 comments on commit d744167

Please sign in to comment.