Skip to content

Commit 122bc71

Browse files
authored
Merge branch 'main' into fix-eventdb-migrations-build
2 parents 578c327 + b4a8b5e commit 122bc71

File tree

9 files changed

+210
-58
lines changed

9 files changed

+210
-58
lines changed

services/voting-node/voting_node/helpers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ async def add_default_event(
5050
end_time = tallying_end + slotdelta(slots=5) # finish event 20 secs after tallying_end
5151

5252
voting_power_threshold = 450
53-
max_voting_power_pct = 1
53+
# Integer up to 100
54+
max_voting_power_pct = 100
5455

5556
insight_sharing_start = block0_date + timedelta(minutes=4)
5657
proposal_submission_start = block0_date + timedelta(minutes=5)

src/event-db/stage_data/dev/00001_fund12_event.sql src/event-db/stage_data/dev/00001_fund13_event.sql

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- F12
1+
-- F13
22
INSERT INTO event (
33
row_id,
44
name,
@@ -26,25 +26,25 @@ INSERT INTO event (
2626
extra,
2727
cast_to
2828
) VALUES (
29-
12,
30-
'Fund 12',
31-
'Catalyst Testnet - Fund 12',
32-
'2024-05-12 11:00:00', -- Registration Snapshot Time
33-
'2024-05-12 11:15:00', -- Snapshot Start.
34-
50000000, -- Voting Power Threshold
35-
1, -- Max Voting Power PCT
29+
13,
30+
'Fund 13',
31+
'Catalyst Testnet - Fund 13',
32+
'2024-11-07 11:00:00', -- Registration Snapshot Time
33+
'2024-11-07 11:15:00', -- Snapshot Start.
34+
25000000, -- Voting Power Threshold
35+
100, -- Max Voting Power PCT
3636
NULL, -- Review Rewards
37-
'2024-05-02 15:00:00', -- Start Time
38-
'2024-06-13 07:00:00', -- End Time
39-
'2024-04-17 11:00:00', -- Insight Sharing Start
40-
'2024-04-17 11:00:00', -- Proposal Submission Start
41-
'2024-04-17 11:00:00', -- Refine Proposals Start
42-
'2024-04-17 11:00:00', -- Finalize Proposals Start
43-
'2024-04-17 11:00:00', -- Proposal Assessment Start
44-
'2024-04-17 11:00:00', -- Assessment QA Start
45-
'2024-05-13 11:00:00', -- Voting Starts
46-
'2024-05-17 10:00:00', -- Voting Ends
47-
'2024-06-13 07:00:00', -- Tallying Ends
37+
'2024-11-06 12:00:00', -- Start Time
38+
'2024-11-27 03:00:00', -- End Time
39+
'2024-10-21 10:00:00', -- Insight Sharing Start
40+
'2024-10-21 10:00:00', -- Proposal Submission Start
41+
'2024-10-21 10:00:00', -- Refine Proposals Start
42+
'2024-10-21 10:00:00', -- Finalize Proposals Start
43+
'2024-10-21 10:00:00', -- Proposal Assessment Start
44+
'2024-11-06 12:00:00', -- Assessment QA Start
45+
'2024-11-08 09:00:00', -- Voting Starts
46+
'2024-11-12 13:00:00', -- Voting Ends
47+
'2024-11-27 03:00:00', -- Tallying Ends
4848
NULL, -- Block 0 Data
4949
NULL, -- Block 0 Hash
5050
1, -- Committee Size
@@ -75,4 +75,4 @@ SET name = EXCLUDED.name,
7575
committee_size = EXCLUDED.committee_size,
7676
committee_threshold = EXCLUDED.committee_threshold,
7777
extra = EXCLUDED.extra,
78-
cast_to = EXCLUDED.cast_to;
78+
cast_to = EXCLUDED.cast_to;

src/event-db/stage_data/dev/00002_fund12_params.sql src/event-db/stage_data/dev/00002_fund13_params.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
-- Define F12 IdeaScale parameters.
1+
-- Define F13 IdeaScale parameters.
22
INSERT INTO config (id, id2, id3, value) VALUES (
33
'ideascale',
4-
'12',
4+
'13',
55
'',
66
'{
77
"group_id": 31051,
@@ -51,11 +51,11 @@ INSERT INTO config (id, id2, id3, value) VALUES (
5151
) ON CONFLICT (id, id2, id3) DO UPDATE
5252
SET value = EXCLUDED.value;
5353

54-
-- Use F12 params for event with row_id = 12.
54+
-- Use F13 params for event with row_id = 13.
5555
INSERT INTO config (id, id2, id3, value) VALUES (
5656
'event',
5757
'ideascale_params',
58-
'12',
59-
'{"params_id": "F12"}'
58+
'13',
59+
'{"params_id": "F13"}'
6060
) ON CONFLICT (id, id2, id3) DO UPDATE
61-
SET value = EXCLUDED.value;
61+
SET value = EXCLUDED.value;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
-- F13
2+
INSERT INTO event (
3+
row_id,
4+
name,
5+
description,
6+
registration_snapshot_time,
7+
snapshot_start,
8+
voting_power_threshold,
9+
max_voting_power_pct,
10+
review_rewards,
11+
start_time,
12+
end_time,
13+
insight_sharing_start,
14+
proposal_submission_start,
15+
refine_proposals_start,
16+
finalize_proposals_start,
17+
proposal_assessment_start,
18+
assessment_qa_start,
19+
voting_start,
20+
voting_end,
21+
tallying_end,
22+
block0,
23+
block0_hash,
24+
committee_size,
25+
committee_threshold,
26+
extra,
27+
cast_to
28+
) VALUES (
29+
13,
30+
'Fund 13',
31+
'Catalyst Testnet - Fund 13',
32+
'2024-11-07 11:00:00', -- Registration Snapshot Time
33+
'2024-11-07 11:15:00', -- Snapshot Start.
34+
25000000, -- Voting Power Threshold
35+
100, -- Max Voting Power PCT
36+
NULL, -- Review Rewards
37+
'2024-11-06 12:00:00', -- Start Time
38+
'2024-11-27 08:00:00', -- End Time
39+
'2024-11-06 12:00:00', -- Insight Sharing Start
40+
'2024-11-06 12:00:00', -- Proposal Submission Start
41+
'2024-11-06 12:00:00', -- Refine Proposals Start
42+
'2024-11-06 12:00:00', -- Finalize Proposals Start
43+
'2024-11-06 12:00:00', -- Proposal Assessment Start
44+
'2024-11-06 12:00:00', -- Assessment QA Start
45+
'2024-11-08 09:00:00', -- Voting Starts
46+
'2024-11-12 18:00:00', -- Voting Ends
47+
'2024-11-27 08:00:00', -- Tallying Ends
48+
NULL, -- Block 0 Data
49+
NULL, -- Block 0 Hash
50+
1, -- Committee Size
51+
1, -- Committee Threshold
52+
NULL, -- Extra
53+
NULL -- Cast to
54+
) ON CONFLICT (row_id) DO UPDATE
55+
SET name = EXCLUDED.name,
56+
description = EXCLUDED.description,
57+
registration_snapshot_time = EXCLUDED.registration_snapshot_time,
58+
snapshot_start = EXCLUDED.snapshot_start,
59+
voting_power_threshold = EXCLUDED.voting_power_threshold,
60+
max_voting_power_pct = EXCLUDED.max_voting_power_pct,
61+
review_rewards = EXCLUDED.review_rewards,
62+
start_time = EXCLUDED.start_time,
63+
end_time = EXCLUDED.end_time,
64+
insight_sharing_start = EXCLUDED.insight_sharing_start,
65+
proposal_submission_start = EXCLUDED.proposal_submission_start,
66+
refine_proposals_start = EXCLUDED.refine_proposals_start,
67+
finalize_proposals_start = EXCLUDED.finalize_proposals_start,
68+
proposal_assessment_start = EXCLUDED.proposal_assessment_start,
69+
assessment_qa_start = EXCLUDED.assessment_qa_start,
70+
voting_start = EXCLUDED.voting_start,
71+
voting_end = EXCLUDED.voting_end,
72+
tallying_end = EXCLUDED.tallying_end,
73+
block0 = EXCLUDED.block0,
74+
block0_hash = EXCLUDED.block0_hash,
75+
committee_size = EXCLUDED.committee_size,
76+
committee_threshold = EXCLUDED.committee_threshold,
77+
extra = EXCLUDED.extra,
78+
cast_to = EXCLUDED.cast_to;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
-- Define F13 IdeaScale parameters.
2+
INSERT INTO config (id, id2, id3, value) VALUES (
3+
'ideascale',
4+
'13',
5+
'',
6+
'{
7+
"group_id": 31051,
8+
"review_stage_ids": [143, 145],
9+
"nr_allocations": [30, 80],
10+
"campaign_group_id": 63,
11+
"questions": {
12+
"You are reviewing the positive IMPACT this project will have on the Cardano Ecosystem.\nHas this project clearly demonstrated in all aspects of the proposal that it will have a positive impact on the Cardano Ecosystem?": "Impact / Alignment",
13+
"You are reviewing the FEASIBILITY of this project.\nIs this project feasible based on the proposal submitted? Does the plan and associated budget and milestones look achievable? Does the team have the skills, experience, capability and capacity to complete the project successfully?": "Feasibility",
14+
"You are reviewing the VALUE FOR MONEY this represents for the Treasury and the Community\nIs the funding amount requested for this project reasonable and does it provide good Value for Money to the Treasury?": "Auditability"
15+
},
16+
"stage_ids": [4590, 4596, 4602, 4608, 4614, 4620, 4626, 4632, 4638, 4644, 4650, 4656, 4662, 4591, 4597, 4603, 4609, 4615, 4621, 4627, 4633, 4639, 4645, 4651, 4657, 4663, 4592, 4598, 4604, 4610, 4616, 4622, 4628, 4634, 4640, 4646, 4652, 4658, 4664],
17+
"proposals": {
18+
"field_mappings": {
19+
"proposer_url": ["relevant_link_1", "website__github_repository__or_any_other_relevant_link__", "relevant_link_3"],
20+
"proposer_relevant_experience": "f11_project_team",
21+
"public_key": "ada_payment_address__",
22+
"funds": ["f11_requested_funds", "requested_funds_in_ada","requested_funds_coti"]
23+
},
24+
"extra_field_mappings": {
25+
"metrics": "key_metrics_to_measure",
26+
"goal": "how_does_success_look_like_",
27+
"solution": "f11_proposal_solution",
28+
"brief": "challenge_brief",
29+
"importance": "importance",
30+
"full_solution": "please_describe_your_proposed_solution",
31+
"team_details": "please_provide_details_of_the_people_who_will_work_on_the_project_",
32+
"auto_translated": "auto_translated",
33+
"budget_breakdown": "please_provide_a_detailed_budget_breakdown",
34+
"challenges_or_risks": "what_main_challenges_or_risks_do_you_foresee_to_deliver_this_project_successfully_",
35+
"timeline_and_key_milestones": "please_provide_a_detailed_plan__a_timeline__and_key_milestones_for_delivering_your_proposal_",
36+
"how_solution_address_challenge": "please_describe_how_your_proposed_solution_will_address_the_challenge_",
37+
"sdg_rating": "sdg_rating",
38+
"return_in_a_later_round": "if_you_are_funded__will_you_return_to_catalyst_in_a_later_round_for_further_funding__please_explain",
39+
"relevant_link_1": "relevant_link_1",
40+
"relevant_link_2": "website__github_repository__or_any_other_relevant_link__",
41+
"relevant_link_3": "relevant_link_3",
42+
"progress_metrics": "what_will_you_measure_to_track_your_project_s_progress__and_how_will_you_measure_it_",
43+
"new_proposal": "is_this_proposal_is_a_continuation_of_a_previously_funded_project_in_catalyst__or_an_entirely_new_o"
44+
}
45+
},
46+
"proposals_scores_csv": {
47+
"id_field": "proposal_id",
48+
"score_field": "Rating"
49+
}
50+
}'
51+
) ON CONFLICT (id, id2, id3) DO UPDATE
52+
SET value = EXCLUDED.value;
53+
54+
-- Use F13 params for event with row_id = 13.
55+
INSERT INTO config (id, id2, id3, value) VALUES (
56+
'event',
57+
'ideascale_params',
58+
'13',
59+
'{"params_id": "F13"}'
60+
) ON CONFLICT (id, id2, id3) DO UPDATE
61+
SET value = EXCLUDED.value;

src/event-db/stage_data/prod/00001_fund12_event.sql src/event-db/stage_data/prod/00001_fund13_event.sql

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- F100
1+
-- F13
22
INSERT INTO event (
33
row_id,
44
name,
@@ -26,25 +26,25 @@ INSERT INTO event (
2626
extra,
2727
cast_to
2828
) VALUES (
29-
12,
30-
'Fund 12',
31-
'Catalyst - Fund 12',
32-
'2024-06-18 21:45:00', -- Registration Snapshot Time
33-
'2024-06-18 22:00:00', -- Snapshot Start.
34-
50000000, -- Voting Power Threshold
35-
1, -- Max Voting Power PCT
29+
13,
30+
'Fund 13',
31+
'Catalyst - Fund 13',
32+
'2024-11-20 21:45:00', -- Registration Snapshot Time
33+
'2024-11-20 22:00:00', -- Snapshot Start.
34+
25000000, -- Voting Power Threshold
35+
100, -- Max Voting Power PCT
3636
NULL, -- Review Rewards
37-
'2024-04-17 11:00:00', -- Start Time
38-
'2024-07-24 09:00:00', -- End Time
39-
'2024-04-17 11:00:00', -- Insight Sharing Start
40-
'2024-04-17 11:00:00', -- Proposal Submission Start
41-
'2024-04-17 11:00:00', -- Refine Proposals Start
42-
'2024-04-17 11:00:00', -- Finalize Proposals Start
43-
'2024-04-17 11:00:00', -- Proposal Assessment Start
44-
'2024-04-17 11:00:00', -- Assessment QA Start
45-
'2024-06-27 12:00:00', -- Voting Starts
46-
'2024-07-11 11:00:00', -- Voting Ends
47-
'2024-07-24 09:00:00', -- Tallying Ends
37+
'2024-10-01 09:00:00', -- Start Time
38+
'2024-12-25 19:00:00', -- End Time
39+
'2024-10-01 09:00:00', -- Insight Sharing Start
40+
'2024-10-01 09:00:00', -- Proposal Submission Start
41+
'2024-10-01 09:00:00', -- Refine Proposals Start
42+
'2024-10-01 09:00:00', -- Finalize Proposals Start
43+
'2024-10-01 09:00:00', -- Proposal Assessment Start
44+
'2024-10-01 09:00:00', -- Assessment QA Start
45+
'2024-11-28 12:00:00', -- Voting Starts
46+
'2024-12-12 11:00:00', -- Voting Ends
47+
'2024-12-25 19:00:00', -- Tallying Ends
4848
NULL, -- Block 0 Data
4949
NULL, -- Block 0 Hash
5050
1, -- Committee Size

src/event-db/stage_data/prod/00002_fund12_params.sql src/event-db/stage_data/prod/00002_fund13_params.sql

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
-- Define F100 IdeaScale parameters.
1+
-- Define F113 IdeaScale parameters.
22
INSERT INTO config (id, id2, id3, value) VALUES (
33
'ideascale',
4-
'12',
4+
'13',
55
'',
66
'{
77
"group_id": 31051,
@@ -17,14 +17,14 @@ INSERT INTO config (id, id2, id3, value) VALUES (
1717
"proposals": {
1818
"field_mappings": {
1919
"proposer_url": ["relevant_link_1", "website__github_repository__or_any_other_relevant_link__", "relevant_link_3"],
20-
"proposer_relevant_experience": "f12_project_team",
20+
"proposer_relevant_experience": "f13_project_team",
2121
"public_key": "ada_payment_address__",
22-
"funds": ["f12_requested_funds", "requested_funds_in_ada","requested_funds_coti"]
22+
"funds": ["f13_requested_funds", "requested_funds_in_ada","requested_funds_coti"]
2323
},
2424
"extra_field_mappings": {
2525
"metrics": "key_metrics_to_measure",
2626
"goal": "how_does_success_look_like_",
27-
"solution": "f12_proposal_solution",
27+
"solution": "f13_proposal_solution",
2828
"brief": "challenge_brief",
2929
"importance": "importance",
3030
"full_solution": "please_describe_your_proposed_solution",
@@ -51,11 +51,11 @@ INSERT INTO config (id, id2, id3, value) VALUES (
5151
) ON CONFLICT (id, id2, id3) DO UPDATE
5252
SET value = EXCLUDED.value;
5353

54-
-- Use F12 params for event with row_id = 12.
54+
-- Use F13 params for event with row_id = 13.
5555
INSERT INTO config (id, id2, id3, value) VALUES (
5656
'event',
5757
'ideascale_params',
58-
'12',
59-
'{"params_id": "F12"}'
58+
'13',
59+
'{"params_id": "F13"}'
6060
) ON CONFLICT (id, id2, id3) DO UPDATE
6161
SET value = EXCLUDED.value;

src/voting-tools-rs/src/data/mod.rs

+15-3
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,15 @@ impl RawRegistration {
225225
&self,
226226
cddl_config: &CddlConfig,
227227
network_id: NetworkId,
228+
slot_no: SlotNo,
228229
) -> Result<SignedRegistration, Box<dyn Error>> {
229230
// validate cddl: 61284
230231
validate_reg_cddl(&self.bin_reg, cddl_config)?;
231232

232233
// validate cddl: 61285
233234
validate_sig_cddl(&self.bin_sig, cddl_config)?;
234235

235-
let registration = self.raw_reg_conversion(network_id)?;
236+
let registration = self.raw_reg_conversion(network_id, slot_no)?;
236237

237238
let signature = self.raw_sig_conversion()?;
238239

@@ -245,7 +246,11 @@ impl RawRegistration {
245246
})
246247
}
247248

248-
fn raw_reg_conversion(&self, network_id: NetworkId) -> Result<Registration, Box<dyn Error>> {
249+
fn raw_reg_conversion(
250+
&self,
251+
network_id: NetworkId,
252+
slot_no: SlotNo,
253+
) -> Result<Registration, Box<dyn Error>> {
249254
let decoded: ciborium::value::Value =
250255
ciborium::de::from_reader(Cursor::new(&self.bin_reg))?;
251256

@@ -283,7 +288,14 @@ impl RawRegistration {
283288

284289
// A nonce that identifies that most recent delegation
285290
let nonce = match inspect_nonce(metamap) {
286-
Ok(value) => value,
291+
Ok(value) => {
292+
if value.0 < slot_no.0 {
293+
// Don't allow nonce > slot number
294+
value
295+
} else {
296+
Nonce(slot_no.0)
297+
}
298+
}
287299
Err(value) => return value,
288300
};
289301

src/voting-tools-rs/src/verification/verify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub fn filter_registrations(
100100
};
101101

102102
// deserialize the raw Binary CBOR.
103-
let reg = match rawreg.to_signed(&cddl, network_id) {
103+
let reg = match rawreg.to_signed(&cddl, network_id, SlotNo(slot as u64)) {
104104
Err(err) => {
105105
invalids.push(InvalidRegistration {
106106
spec_61284: Some(prefix_hex(&rawreg.bin_reg)),

0 commit comments

Comments
 (0)