-
Notifications
You must be signed in to change notification settings - Fork 39
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): asset lock quorum and core locked height verification #2030
Open
lklimek
wants to merge
20
commits into
v2.0-dev
Choose a base branch
from
fix/sdk-invalid-quorum
base: v2.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b3f5f17
feat(sdk): asset lock quorum verify against platform
lklimek 9de013f
feat(sdk)!: params of dash networks - testnet, mainnet, etc
lklimek 6362883
feat(sdk): network type, continued
lklimek f984ced
feat: asset lock verify
lklimek bff31d5
refactor(dapi-client): replace CanRetry.is_node_failure with !CanRetr…
lklimek e3a5538
feat(sdk): Error implements CanRetry
lklimek 4df0c40
fix(dapi-grpc): GetEpochsInfoRequest not marked as versioned
lklimek f41f2bc
test(sdk): asset locks verify tests, WIP
lklimek 3517779
fix(sdk): local devnet uses LlmqTest
lklimek d9cada9
test(sdk): asset_lock test vectors
lklimek 0c04b42
Merge remote-tracking branch 'origin/v1.1-dev' into fix/sdk-invalid-q…
lklimek c9c4a21
fix(dapi-grpc): fix const
lklimek f57e455
fix(sdk): build error due to imports
lklimek b5dfc6a
chore(sdk): cargo fmt
lklimek 1f1c957
Merge remote-tracking branch 'origin/v1.1-dev' into fix/sdk-invalid-q…
lklimek c4cc766
Merge branch 'master' into fix/sdk-invalid-quorum
lklimek 5d33c31
Merge remote-tracking branch 'origin/v1.7-dev' into fix/sdk-invalid-q…
lklimek 727cc20
chore: fix build
lklimek 50a5267
Merge branch 'v1.8-dev' into fix/sdk-invalid-quorum
lklimek ee83d83
Merge remote-tracking branch 'origin/v2.0-dev' into fix/sdk-invalid-q…
lklimek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(sdk): network type, continued
- Loading branch information
commit 6362883a6b7233b7db3488ff7f1ab42e51ef9c42
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
//! Configuration of dash networks (devnet, testnet, mainnet, etc.). | ||
//! | ||
//! See also: | ||
//! * https://github.com/dashpay/dash/blob/develop/src/chainparams.cpp | ||
|
||
/* | ||
Mainnet: | ||
|
@@ -23,54 +26,61 @@ Devnet: | |
|
||
use dashcore_rpc::json::QuorumType; | ||
|
||
/// Dash network types. | ||
#[derive(Eq, PartialEq, Clone, Debug)] | ||
pub enum NetworkType { | ||
/// Mock implementation; in practice, feaults to Devnet config for Mock mode. Errors when used in non-mock mode. | ||
Mock, | ||
/// Mainnet network, used for production. | ||
Mainnet, | ||
/// Testnet network, used for testing and development. | ||
Testnet, | ||
/// Devnet network, used local for development. | ||
Devnet, | ||
Mock, | ||
Custom(NetworkConfig), | ||
/// Custom network configuration. | ||
Custom(QuorumParams), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Local |
||
} | ||
|
||
impl NetworkType { | ||
pub fn instant_lock_quorum_type(&self) -> QuorumType { | ||
self.to_network_config().instant_lock | ||
self.to_quorum_params().instant_lock_quorum_type | ||
} | ||
|
||
fn to_network_config(&self) -> NetworkConfig { | ||
pub(crate) fn to_quorum_params(&self) -> QuorumParams { | ||
match self { | ||
NetworkType::Mainnet => NetworkConfig::new_mainnet(), | ||
NetworkType::Testnet => NetworkConfig::new_testnet(), | ||
NetworkType::Devnet => NetworkConfig::new_devnet(), | ||
NetworkType::Mock => NetworkConfig::new_mock(), | ||
NetworkType::Mainnet => QuorumParams::new_mainnet(), | ||
NetworkType::Testnet => QuorumParams::new_testnet(), | ||
NetworkType::Devnet => QuorumParams::new_devnet(), | ||
NetworkType::Custom(config) => config.clone(), | ||
NetworkType::Mock => QuorumParams::new_mock(), | ||
} | ||
} | ||
} | ||
|
||
/// Configuration of Dash Core Quorums. | ||
/// | ||
/// In most cases, you should use the [`new_mainnet`] or [`new_testnet`] functions to create a new instance. | ||
#[derive(Clone, Debug)] | ||
pub struct NetworkConfig { | ||
pub instant_lock: QuorumType, | ||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct QuorumParams { | ||
pub instant_lock_quorum_type: QuorumType, | ||
} | ||
|
||
impl NetworkConfig { | ||
impl QuorumParams { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have quorum params in Drive and dashcore library. I think the correct place for them is dashcore lib |
||
pub fn new_mainnet() -> Self { | ||
NetworkConfig { | ||
instant_lock: QuorumType::Llmq400_60, | ||
QuorumParams { | ||
instant_lock_quorum_type: QuorumType::Llmq400_60, | ||
} | ||
} | ||
|
||
pub fn new_testnet() -> Self { | ||
NetworkConfig { | ||
instant_lock: QuorumType::Llmq50_60, | ||
QuorumParams { | ||
instant_lock_quorum_type: QuorumType::Llmq50_60, | ||
} | ||
} | ||
|
||
pub fn new_devnet() -> Self { | ||
NetworkConfig { | ||
instant_lock: QuorumType::LlmqDevnet, | ||
QuorumParams { | ||
instant_lock_quorum_type: QuorumType::LlmqDevnet, | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should receive quorum params