Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sdk)!: impl Fetch/FetchMany for masternode voting endpoints #1864

Merged
Show file tree
Hide file tree
Changes from 221 commits
Commits
Show all changes
239 commits
Select commit Hold shift + click to select a range
0f3a11b
original approach
QuantumExplorer Sep 4, 2023
b2319b1
added a masternode vote state transition
QuantumExplorer Sep 6, 2023
e0f7a4f
started working on drive structure
QuantumExplorer Sep 6, 2023
52dcb74
temp work
QuantumExplorer Sep 9, 2023
55c7ec4
more work and formatting
QuantumExplorer Sep 11, 2023
3d5fb76
more work
QuantumExplorer Sep 17, 2023
6eaff5b
more work
QuantumExplorer Sep 17, 2023
9b676fb
Merge branch 'v0.25-dev' into feat/masternodeVoting
QuantumExplorer Oct 2, 2023
fba087b
more work
QuantumExplorer Oct 3, 2023
9799f74
more work on masternode voting
QuantumExplorer Oct 6, 2023
701bf40
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Oct 10, 2023
66857cb
a little cleanup
QuantumExplorer Oct 11, 2023
53722c5
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Nov 8, 2023
94cdfff
more fixes
QuantumExplorer Nov 8, 2023
5599632
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Dec 3, 2023
50b0ae3
small fix
QuantumExplorer Dec 3, 2023
9e5e5d6
Merge branch 'master' into feat/masternodeVoting
QuantumExplorer Dec 17, 2023
83c8da0
updated lock
QuantumExplorer Dec 17, 2023
a17afb9
updated proto requests
QuantumExplorer Dec 17, 2023
2210228
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Dec 30, 2023
0a2cdfe
added thing
QuantumExplorer Jan 2, 2024
42ebe6a
Merge branch 'master' into feat/masternodeVoting
QuantumExplorer Jan 2, 2024
afa81fb
dev.2
QuantumExplorer Jan 3, 2024
8ccef9f
more work
QuantumExplorer Jan 4, 2024
8af3443
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Jan 9, 2024
ba24387
review fixes
QuantumExplorer Jan 9, 2024
19b739f
fmt
QuantumExplorer Jan 9, 2024
3cee601
got insert of trees working
QuantumExplorer Jan 10, 2024
1238463
more work
QuantumExplorer Jan 10, 2024
98cc21d
more work
QuantumExplorer Jan 10, 2024
fb550f2
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Feb 21, 2024
f4c859d
more fixes
QuantumExplorer Feb 21, 2024
0541be3
more fixes
QuantumExplorer Feb 21, 2024
c3868e8
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Feb 27, 2024
1ff1a33
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Feb 28, 2024
477cda5
more fixes
QuantumExplorer Feb 29, 2024
2cfdb4f
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Apr 8, 2024
41a3bba
proto update
QuantumExplorer Apr 8, 2024
60f61e9
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Apr 8, 2024
c4f0e35
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Apr 13, 2024
56024d5
small fixes
QuantumExplorer Apr 13, 2024
8467a19
more work
QuantumExplorer Apr 15, 2024
cc6cc81
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Apr 17, 2024
2b662a1
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Apr 24, 2024
256fe4c
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Apr 25, 2024
bd50c0c
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Apr 27, 2024
8980d2e
more work on the actions
QuantumExplorer Apr 28, 2024
a3ca8df
more fixes
QuantumExplorer Apr 28, 2024
82e128e
more work
QuantumExplorer Apr 29, 2024
fcabf19
more work
QuantumExplorer May 2, 2024
b0aa04e
more fixes
QuantumExplorer May 6, 2024
e32cabf
more work
QuantumExplorer May 7, 2024
4af5f4e
more work
QuantumExplorer May 7, 2024
7d6560d
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer May 7, 2024
d9c413a
a lot more work
QuantumExplorer May 7, 2024
b5a8ff3
more work
QuantumExplorer May 8, 2024
cb5a8e6
another function
QuantumExplorer May 8, 2024
9cf2d75
more work on prefunded balances
QuantumExplorer May 8, 2024
ad42409
more work
QuantumExplorer May 8, 2024
3fadcea
more work on masternode voting
QuantumExplorer May 9, 2024
0ce04ff
more work
QuantumExplorer May 9, 2024
4b3bed3
a lot more work
QuantumExplorer May 9, 2024
b8eb464
a lot more work
QuantumExplorer May 9, 2024
b8b93d6
more work
QuantumExplorer May 11, 2024
b87a063
more work
QuantumExplorer May 11, 2024
6a2bdb2
more work
QuantumExplorer May 11, 2024
9ee09fb
more work
QuantumExplorer May 12, 2024
8022778
finally compiles
QuantumExplorer May 12, 2024
5c21022
small
QuantumExplorer May 13, 2024
25ec93a
more work
QuantumExplorer May 13, 2024
2665bb7
more work
QuantumExplorer May 13, 2024
3f21e6e
more fixes
QuantumExplorer May 13, 2024
74ba652
more work
QuantumExplorer May 13, 2024
0454ce1
a lot more work
QuantumExplorer May 14, 2024
3580bae
more work
QuantumExplorer May 14, 2024
e8fd6f8
worked on estimated costs
QuantumExplorer May 14, 2024
acfa5ab
got the trees inserted in contested area
QuantumExplorer May 15, 2024
a6857e6
more work
QuantumExplorer May 15, 2024
0ea1320
more work
QuantumExplorer May 16, 2024
cd443e5
a lot of work on queries
QuantumExplorer May 17, 2024
622eb18
a lot more work
QuantumExplorer May 19, 2024
b54e765
another query
QuantumExplorer May 19, 2024
095e845
more work
QuantumExplorer May 19, 2024
231219b
query now working
QuantumExplorer May 19, 2024
1ee7486
proof verification
QuantumExplorer May 19, 2024
f649798
more work
QuantumExplorer May 20, 2024
67fcc95
more fixes
QuantumExplorer May 20, 2024
470318b
vote validation
QuantumExplorer May 20, 2024
18094a5
voting is working
QuantumExplorer May 21, 2024
a8c9e5c
nit
QuantumExplorer May 21, 2024
afbf2f5
more work
QuantumExplorer May 22, 2024
56b888b
query working
QuantumExplorer May 22, 2024
203ce1e
end date query working
QuantumExplorer May 22, 2024
bbdbf97
work
QuantumExplorer May 22, 2024
a3d1350
much more work
QuantumExplorer May 23, 2024
21d4b81
more work
QuantumExplorer May 24, 2024
37074be
more work on abci execution
QuantumExplorer May 24, 2024
7c3c5fd
work on cleanup
QuantumExplorer May 25, 2024
9e09c5a
small fixes
QuantumExplorer May 27, 2024
bc51eca
more fixes
QuantumExplorer May 27, 2024
d21ee73
builds
QuantumExplorer May 27, 2024
7df7636
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer May 27, 2024
24c4eb8
resolve with provided contract
QuantumExplorer May 27, 2024
5c0547f
fixes
QuantumExplorer May 27, 2024
9cfbebb
fixes
QuantumExplorer May 27, 2024
f6f770c
a lot more work
QuantumExplorer May 28, 2024
cf9513b
contested resource query done
QuantumExplorer May 28, 2024
02a6a4f
fix
QuantumExplorer May 28, 2024
0991a26
feature fixes
QuantumExplorer May 28, 2024
7832cd9
more fixes
QuantumExplorer May 28, 2024
cd12857
more fixes
QuantumExplorer May 28, 2024
a19f599
feature fixes
QuantumExplorer May 28, 2024
cfd2958
more fixes
QuantumExplorer May 28, 2024
170706a
another verification
QuantumExplorer May 28, 2024
96e9230
more work
QuantumExplorer May 29, 2024
c707993
more fixes
QuantumExplorer May 29, 2024
9a83628
a lot more end date queries and tests
QuantumExplorer May 29, 2024
36fb18c
more query tests
QuantumExplorer May 29, 2024
fbc4785
added more tests
QuantumExplorer May 29, 2024
7d77413
query contender votes
QuantumExplorer May 30, 2024
795e67d
query contender votes (better)
QuantumExplorer May 30, 2024
03f8ae7
added lock and abstain tree and did more work on identity votes query
QuantumExplorer May 31, 2024
dec5f81
broke things
QuantumExplorer May 31, 2024
eddf487
repaired some requests
QuantumExplorer May 31, 2024
c43f1ec
last test passed
QuantumExplorer May 31, 2024
748e50d
a lot of work
QuantumExplorer May 31, 2024
f731520
last query done
QuantumExplorer May 31, 2024
635b535
more work
QuantumExplorer May 31, 2024
6912bec
refactored vote tests
QuantumExplorer Jun 2, 2024
4b271ef
chore(dapi-grpc): add GetPrefundedSpecializedBalanceRequest to build.rs
lklimek May 27, 2024
cd7ba4f
chore(rs-dapi-client): implement masternode voting grpc
lklimek May 27, 2024
3be6634
chore(drive): make verify mod public
lklimek May 28, 2024
b5b030c
refactor(drive): define type ContractLookupFn to simplify code
lklimek May 28, 2024
1fb1eb7
feat(rs-sdk): GetContestedResourceVoteStateRequest - WIP
lklimek May 28, 2024
9e374ef
doc(rs-sdk): improve new request type impl docs
lklimek May 28, 2024
f32c931
chore(dapi-grpc): detect duplicate versioned requests/responses on build
lklimek May 29, 2024
b50a361
chore: fix build issues
lklimek May 29, 2024
952a5a2
fix(sdk): tokio::block_on() panics in sync fn in async context
lklimek May 29, 2024
a8906cf
feat(sdk):MN voting, WIP
lklimek May 29, 2024
ba60e0e
chore: fix build
lklimek Jun 3, 2024
ea57cce
a lot of fixes
QuantumExplorer Jun 3, 2024
32d42f3
chore(drive): fix verify feature build issues
lklimek Jun 3, 2024
982adc4
refactor(sdk): FetchMany takes generic return type
lklimek Jun 3, 2024
97ad218
build: upgrade grovedb to fix build issues
lklimek Jun 3, 2024
c25b206
fix(sdk): GrpcContextProvider panics when switching sync-async
lklimek Jun 3, 2024
0cce3a3
refactor(sdk): cpu-friendly pool in mock provider
lklimek Jun 3, 2024
0042898
chore: fix test
lklimek Jun 3, 2024
923b924
refactor(sdk): cpu-friendly pool in mock provider
lklimek Jun 3, 2024
888ecef
chore(sdk): add some docs
lklimek Jun 3, 2024
e34bd3b
refactor(sdk): use arc-swap to store sdk in GrpcContextProvider
lklimek Jun 3, 2024
b1f20d2
Merge branch 'fix/sdk-context-provider-not-set' into feat/mn-voting-sdk
lklimek Jun 3, 2024
30b8ffb
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 3, 2024
9173410
test: test_contested_resources_not_found WIP
lklimek Jun 4, 2024
9d2110f
refactor(sdk): replace own poller with pollster crate
lklimek Jun 4, 2024
2e40e4f
Merge branch 'fix/sdk-context-provider-not-set' into feat/mn-voting-sdk
lklimek Jun 4, 2024
2eb9eb0
chore: fix build
lklimek Jun 4, 2024
483ea8d
chore: FetchMany<Identifier, Contenders> for Contender
lklimek Jun 4, 2024
5e1ad48
chore: rename contested_resource_vote_state tests
lklimek Jun 4, 2024
5bf45a3
feat(drive): ContestedDocumentVotePollVotesDriveQuery::resolve_with_k…
lklimek Jun 5, 2024
930afeb
feat(sdk): GetVotePollsByEndDateRequest
lklimek Jun 5, 2024
bd7b519
chore(drive): convert request to query using o2o macro
lklimek Jun 5, 2024
aa2d257
more work
QuantumExplorer Jun 5, 2024
2ff26c7
feat(sdk): VotePollsByEndDateDriveQuery
lklimek Jun 5, 2024
bb5e81a
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 5, 2024
6c6eb83
build: update cargo.lock
lklimek Jun 5, 2024
8757326
small fix
QuantumExplorer Jun 5, 2024
c13c009
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 6, 2024
58398ac
temp
QuantumExplorer Jun 6, 2024
4aacdc4
chore(drive): use ContractLookupFn in verify_identity_votes_given_proof
lklimek Jun 6, 2024
9a778bd
test(drive): use ContractLookupFn in verify_identity_votes_given_proof
lklimek Jun 6, 2024
2e1c589
feat(sdk): GetContestedResourceIdentityVotesRequest
lklimek Jun 6, 2024
473592e
feat(sdk): GetPrefundedSpecializedBalanceRequest
lklimek Jun 6, 2024
8e0c9d0
more work on cleanup
QuantumExplorer Jun 7, 2024
24fffe3
feat(sdk): PrefundedSpecializedBalance
lklimek Jun 7, 2024
4612c7d
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 7, 2024
ddebc1e
build: cargo update
lklimek Jun 7, 2024
fe93d52
refactor: move query conversions to drive
lklimek Jun 7, 2024
c29cccb
refactor(rs-sdk): remove Option from VotePollsGroupedByTimestamp
lklimek Jun 7, 2024
74b75ca
refactor(rs-sdk): simplify Contenders
lklimek Jun 7, 2024
6dfa610
more work
QuantumExplorer Jun 7, 2024
f0e94f6
Merge branch 'v1.0-dev' into feat/masternodeVoting
QuantumExplorer Jun 7, 2024
bfc8ba2
refactor(rs-sdk): simplify ContestedResources
lklimek Jun 7, 2024
f101010
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 7, 2024
df7a212
chore(drive): fix some feature deps
lklimek Jun 7, 2024
a3089fa
removed votes from identity table
QuantumExplorer Jun 7, 2024
7d3e52f
Merge branch 'tempmasternodevoting' into feat/masternodeVoting
QuantumExplorer Jun 7, 2024
a2ece4a
more cleanup
QuantumExplorer Jun 8, 2024
da30633
storage of finishing info
QuantumExplorer Jun 8, 2024
3fc6346
its alive
QuantumExplorer Jun 8, 2024
01d29e0
more work
QuantumExplorer Jun 8, 2024
c7072e3
locking test
QuantumExplorer Jun 8, 2024
b5b392b
locking test
QuantumExplorer Jun 8, 2024
83c23ce
more work
QuantumExplorer Jun 9, 2024
eec4cf4
small fixes
QuantumExplorer Jun 9, 2024
6a57303
a lot of validation
QuantumExplorer Jun 9, 2024
df9f373
more work
QuantumExplorer Jun 9, 2024
a6e107d
things working
QuantumExplorer Jun 9, 2024
2f681b7
validation done
QuantumExplorer Jun 9, 2024
21e6b13
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 10, 2024
af3406f
chore: fixes after merge
lklimek Jun 10, 2024
29056eb
chore(sdk): refactor query
lklimek Jun 10, 2024
683fb70
feat(sdk): fetch Vote
lklimek Jun 10, 2024
89a2ddc
chore: clippy
lklimek Jun 10, 2024
20635e1
changing votes is validated now
QuantumExplorer Jun 10, 2024
a221194
last home stretch
QuantumExplorer Jun 10, 2024
a8ac4d2
old vote is removed when new vote is added
QuantumExplorer Jun 10, 2024
e35f963
more validation
QuantumExplorer Jun 10, 2024
eba991a
cleanup
QuantumExplorer Jun 11, 2024
4fb426a
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 11, 2024
a5c3065
another fix
QuantumExplorer Jun 11, 2024
46aad85
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 11, 2024
3ddd0e4
wasm-dpp
QuantumExplorer Jun 11, 2024
72237cf
Merge remote-tracking branch 'origin/feat/masternodeVoting' into feat…
lklimek Jun 11, 2024
4b3bd39
Merge remote-tracking branch 'origin/feat/contestedDocumentResolution…
lklimek Jun 11, 2024
b9eef96
fix(drive): verify_identity_votes_given_proof_v0 ref storage form lookup
lklimek Jun 11, 2024
ded885d
chore(rs-sdk): fix features and clippy warnings
lklimek Jun 11, 2024
d75acfc
Merge remote-tracking branch 'origin/feat/contestedDocumentResolution…
lklimek Jun 11, 2024
81a4bee
chore: self-review
lklimek Jun 11, 2024
55c1092
chore: fix features
lklimek Jun 11, 2024
0af294f
Merge remote-tracking branch 'origin/feat/contestedDocumentResolution…
lklimek Jun 11, 2024
5648607
Merge remote-tracking branch 'origin/feat/contestedDocumentResolution…
lklimek Jun 11, 2024
dc2a059
refactor(sdk): simplify lifetimes
lklimek Jun 11, 2024
2926969
chore: review
lklimek Jun 11, 2024
0fac656
Merge remote-tracking branch 'origin/feat/contestedDocumentResolution…
lklimek Jun 11, 2024
e2b5ae1
fix(docker): workaround to force rebuild of dapi-grpc
lklimek Jun 12, 2024
6078f98
chore(sdk): remove impl From<FinalizedContender> for Contender
lklimek Jun 12, 2024
cf95deb
Merge remote-tracking branch 'origin/feat/contestedDocumentResolution…
lklimek Jun 12, 2024
e487192
refactor(proof-verifier): change how we serialize in MockRequest to u…
lklimek Jun 12, 2024
809b81e
refactor(sdk): remove serde from MockResponse impl
lklimek Jun 13, 2024
15a4f52
chore: sdk and proof verifier deps/features cleanup
lklimek Jun 13, 2024
e999811
feat(dpp): PlatformVersionEncode and PlatformVersionedDecode for Exte…
lklimek Jun 13, 2024
7c91bb4
test(sdk): support data contract load in mocks
lklimek Jun 13, 2024
30ed869
test(sdk): update test vectors
lklimek Jun 13, 2024
8d64f94
fix(sdk): fix ContestedResources
lklimek Jun 13, 2024
f5c62ec
test(sdk): test_vote_polls_by_ts_ok, test_contested_resources_ok
lklimek Jun 13, 2024
a8fe9b4
test(sdk): vectors for test_vote_polls_by_ts_ok, test_contested_resou…
lklimek Jun 13, 2024
94d0459
Merge remote-tracking branch 'origin/feat/contestedDocumentResolution…
lklimek Jun 14, 2024
fa039bd
chore(drive-proof-verifier): fix build after merge
lklimek Jun 14, 2024
ded1111
test(sdk): document query fails when cond contains "l"
lklimek Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions packages/dapi-grpc/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{
collections::HashSet,
fs::{create_dir_all, remove_dir_all},
path::PathBuf,
process::exit,
Expand Down Expand Up @@ -104,6 +105,9 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
"GetVotePollsByEndDateResponse",
];

check_unique(&VERSIONED_REQUESTS).expect("VERSIONED_REQUESTS");
check_unique(&VERSIONED_RESPONSES).expect("VERSIONED_RESPONSES");

// Derive VersionedGrpcMessage on requests
for msg in VERSIONED_REQUESTS {
platform = platform
Expand Down Expand Up @@ -158,6 +162,28 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
platform
}

/// Check for duplicate messages in the list.
fn check_unique(messages: &[&'static str]) -> Result<(), String> {
let mut hashset: HashSet<&'static str> = HashSet::new();
let mut duplicates = String::new();

for value in messages {
if !hashset.insert(*value) {
duplicates.push_str(value);
duplicates.push_str(", ");
}
}

if duplicates.is_empty() {
Ok(())
} else {
Err(format!(
"Duplicate messages found: {}",
duplicates.trim_end_matches(", ")
))
}
}

fn configure_core(core: MappingConfig) -> MappingConfig {
// All messages can be mocked.
let core = core.message_attribute(".", r#"#[derive(::dapi_grpc_macros::Mockable)]"#);
Expand Down
52 changes: 52 additions & 0 deletions packages/rs-dapi-client/src/transport/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,58 @@ impl_transport_request_grpc!(
get_data_contracts
);

// rpc getContestedResources(GetContestedResourcesRequest) returns (GetContestedResourcesResponse);
impl_transport_request_grpc!(
platform_proto::GetContestedResourcesRequest,
platform_proto::GetContestedResourcesResponse,
PlatformGrpcClient,
RequestSettings::default(),
get_contested_resources
);

// rpc getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse);
impl_transport_request_grpc!(
platform_proto::GetContestedResourceVoteStateRequest,
platform_proto::GetContestedResourceVoteStateResponse,
PlatformGrpcClient,
RequestSettings::default(),
get_contested_resource_vote_state
);

// rpc getContestedResourceVotersForIdentity(GetContestedResourceVotersForIdentityRequest) returns (GetContestedResourceVotersForIdentityResponse);
impl_transport_request_grpc!(
platform_proto::GetContestedResourceVotersForIdentityRequest,
platform_proto::GetContestedResourceVotersForIdentityResponse,
PlatformGrpcClient,
RequestSettings::default(),
get_contested_resource_voters_for_identity
);
// rpc getContestedResourceIdentityVoteStatus(GetContestedResourceIdentityVoteStatusRequest) returns (GetContestedResourceIdentityVoteStatusResponse);
impl_transport_request_grpc!(
platform_proto::GetContestedResourceIdentityVotesRequest,
platform_proto::GetContestedResourceIdentityVotesResponse,
PlatformGrpcClient,
RequestSettings::default(),
get_contested_resource_identity_votes
);
// rpc GetVotePollsByEndDateRequest(GetVotePollsByEndDateRequest) returns (GetVotePollsByEndDateResponse);
impl_transport_request_grpc!(
platform_proto::GetVotePollsByEndDateRequest,
platform_proto::GetVotePollsByEndDateResponse,
PlatformGrpcClient,
RequestSettings::default(),
get_vote_polls_by_end_date
);

// rpc getPrefundedSpecializedBalance(GetPrefundedSpecializedBalanceRequest) returns (GetPrefundedSpecializedBalanceResponse);
impl_transport_request_grpc!(
platform_proto::GetPrefundedSpecializedBalanceRequest,
platform_proto::GetPrefundedSpecializedBalanceResponse,
PlatformGrpcClient,
RequestSettings::default(),
get_prefunded_specialized_balance
);

// Link to each core gRPC request what client and method to use:

impl_transport_request_grpc!(
Expand Down
5 changes: 4 additions & 1 deletion packages/rs-dpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ identity-cbor-conversion = [
"platform-value-cbor",
]
index-serde-conversion = []
state-transition-serde-conversion = ["data-contract-serde-conversion", "vote-serde-conversion"]
state-transition-serde-conversion = [
"data-contract-serde-conversion",
"vote-serde-conversion",
]
state-transition-value-conversion = [
"platform-value",
"state-transition-serde-conversion",
Expand Down
45 changes: 45 additions & 0 deletions packages/rs-dpp/src/voting/contender_structs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ impl TryFrom<ContenderWithSerializedDocument> for FinalizedContenderWithSerializ
/// This struct holds the identity ID of the contender, the serialized document,
/// and the vote tally.
#[derive(Debug, PartialEq, Clone, Default)]
#[cfg_attr(
feature = "document-serde-conversion",
QuantumExplorer marked this conversation as resolved.
Show resolved Hide resolved
derive(serde::Serialize, serde::Deserialize),
serde(tag = "$version")
QuantumExplorer marked this conversation as resolved.
Show resolved Hide resolved
)]
pub struct Contender {
/// The identity ID of the contender.
pub identity_id: Identifier,
Expand All @@ -141,3 +146,43 @@ pub struct Contender {
/// The vote tally for the contender.
pub vote_tally: Option<u32>,
}

impl From<FinalizedContender> for Contender {
fn from(value: FinalizedContender) -> Self {
let FinalizedContender {
identity_id,
document,
final_vote_tally,
..
} = value;

Contender {
identity_id,
document: Some(document),
vote_tally: Some(final_vote_tally),
}
}
}
QuantumExplorer marked this conversation as resolved.
Show resolved Hide resolved

impl Contender {
/// Try to get the finalized contender from a finalized contender with a serialized document
pub fn try_from_contender_with_serialized_document(
value: ContenderWithSerializedDocument,
document_type: DocumentTypeRef,
platform_version: &PlatformVersion,
) -> Result<Self, ProtocolError> {
let ContenderWithSerializedDocument {
identity_id,
serialized_document,
vote_tally,
} = value;

Ok(Contender {
identity_id,
document: serialized_document
.map(|v| Document::from_bytes(&v, document_type, platform_version))
.transpose()?,
vote_tally,
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,10 @@ mod tests {

mod identity_given_votes_query {
use super::*;
use drive::query::{
contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery,
contract_lookup_fn_for_contract,
};

fn get_identity_given_votes(
platform: &TempPlatform<MockCoreRPCLike>,
Expand Down Expand Up @@ -1455,7 +1459,7 @@ mod tests {
query
.verify_identity_votes_given_proof(
proof.grovedb_proof.as_slice(),
contract,
&contract_lookup_fn_for_contract(Arc::new(contract.to_owned())),
platform_version,
)
.expect("expected to verify proof")
Expand Down
16 changes: 13 additions & 3 deletions packages/rs-drive-proof-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ crate-type = ["cdylib"]

[features]
default = ["mocks"]
mocks = ["dep:serde", "json"]
mocks = [
"dep:serde",
"json",
"dep:bincode",
"dpp/document-serde-conversion",
"dpp/document-value-conversion",
]
json = ["dep:serde_json"]

[dependencies]
Expand All @@ -18,13 +24,17 @@ dapi-grpc = { path = "../dapi-grpc" }
drive = { path = "../rs-drive", default-features = false, features = [
"verify",
] }
dpp = { path = "../rs-dpp", features = ["bls-signatures"], default-features = false }
dpp = { path = "../rs-dpp", features = [
"bls-signatures",
], default-features = false }
bincode = { version = "2.0.0-rc.3", features = ["serde"], optional = true }
QuantumExplorer marked this conversation as resolved.
Show resolved Hide resolved
tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "0.14.0-dev.12", features = [
"crypto"
"crypto",
], default-features = false }
tracing = { version = "0.1.37" }
serde = { version = "1.0.197", default-features = false, optional = true }
serde_json = { version = "1.0.103", features = [
"preserve_order",
], optional = true }
hex = { version = "0.4.3" }
derive_more = { version = "0.99.11" }
4 changes: 2 additions & 2 deletions packages/rs-drive-proof-verifier/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub enum Error {

/// Decode protobuf error
#[error("decode request: {error}")]
RequestDecodeError { error: String },
RequestError { error: String },

/// Decode protobuf response error
#[error("decode response: {error}")]
Expand Down Expand Up @@ -97,7 +97,7 @@ pub enum ContextProviderError {

/// Data contract is invalid or not found, or some error occurred during data contract retrieval
#[error("cannot get data contract: {0}")]
InvalidDataContract(String),
DataContractFailure(String),

/// Provided quorum is invalid
#[error("invalid quorum: {0}")]
Expand Down
Loading
Loading