Skip to content

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

Merged
QuantumExplorer merged 239 commits into
feat/contestedDocumentResolutionWithMasternodeVotingfrom
feat/mn-voting-sdk
Jun 14, 2024
Merged

QuantumExplorer merged 239 commits into
feat/contestedDocumentResolutionWithMasternodeVotingfrom
feat/mn-voting-sdk

Conversation

@lklimek

@lklimek lklimek commented May 28, 2024 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Masternode Voting introduces several new endpoints that should be implemented.

What was done?

  1. Implemented 6 new endpoints in SDK.
  2. Refactored FetchMany trait to also include type of returned result.
  3. Fixed 2 bugs in mock context provider.

How Has This Been Tested?

Only "proof of non-existence" tests implemented, more tests will be added in separate PR.

Breaking Changes

FetchMany trait now uses 2 generics instead of one.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@lklimek lklimek changed the title feat(sdk): impl Fetch/FetchMany for masternode voting endpoints feat(sdk)!: impl Fetch/FetchMany for masternode voting endpoints Jun 11, 2024
@lklimek
lklimek marked this pull request as ready for review June 11, 2024 11:05
@shumkov
shumkov force-pushed the feat/contestedDocumentResolutionWithMasternodeVoting branch from fbbc8da to f6b572f Compare June 11, 2024 13:53
@QuantumExplorer
QuantumExplorer force-pushed the feat/contestedDocumentResolutionWithMasternodeVoting branch from f6b572f to 2d30333 Compare June 11, 2024 13:57
Comment on lines +73 to +100
impl PlatformVersionEncode for ExtendedDocument {
fn platform_encode<E: Encoder>(
&self,
encoder: &mut E,
platform_version: &PlatformVersion,
) -> Result<(), EncodeError> {
let serialized = self.serialize_to_bytes(platform_version).map_err(|e| {
EncodeError::OtherString(format!("Failed to serialize ExtendedDocument: {}", e))
})?;

serialized.platform_encode(encoder, platform_version)
}
}

impl PlatformVersionedDecode for ExtendedDocument {
fn platform_versioned_decode<D: bincode::de::Decoder>(
decoder: &mut D,
platform_version: &PlatformVersion,
) -> Result<Self, bincode::error::DecodeError> {
let bytes = Vec::<u8>::platform_versioned_decode(decoder, platform_version)?;

Self::from_bytes(&bytes, platform_version)
.map_err(|e| {
EncodeError::OtherString(format!("Failed to serialize ExtendedDocument: {}", e))
})
.map_err(|e| bincode::error::DecodeError::OtherString(e.to_string()))
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this just get a vec that you would reencode? I don't mind all that much because nothing very important uses ExtendedDocument.

@QuantumExplorer
QuantumExplorer merged commit 9919a8f into feat/contestedDocumentResolutionWithMasternodeVoting Jun 14, 2024
@QuantumExplorer
QuantumExplorer deleted the feat/mn-voting-sdk branch June 14, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants