Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,40 @@
- Type `Event`/`BakerPoolInfo` field `open_status` is now wrapped in `Upward`.
- Bubble `Upward` from new variants of `VerifyKey` to `Upward<AccountCredentialWithoutProofs<...>>` in `AccountInfo::account_credentials`.

- BREAKING: Remove types associated with discontinued V1 API:
- `types::BlockSummary`;
- `types::UpdateKeysCollectionSkeleton` and `types::UpdateKeysCollection`;
- `types::ChainParametersV0`, `types::ChainParametersV1`, `types::ChainParametersV2`, `types::ChainParametersV3`, `types::ChainParametersFamily` and `types::ChainParameters`.
- `types::RewardParametersSkeleton` and `types::RewardParameters`;
- `types::ScheduledUpdate`;
- `types::UpdateQueue`;
- `types::PendingUpdatesV0`, `types::PendingUpdatesV1`, `types::PendingUpdatesFamily`, and `types::PendingUpdates`;
- `types::UpdatesSkeleton` and `types::Updates`;
- removed from `concordium_base`:
- `ChainParametersVersion0`, `ChainParametersVersion1`, `ChainParametersVersion2`, `ChainParametersVersion3`;
- `MintDistributionFamily`, `MintDistribution` (use `MintDistributionV0` or `MintDistributionV1` directly instead where needed);
- `GASRewardsFamily` and `GASRewardsFor` (use `GASRewards` and `GASRewardsV1` directly where needed);
- `AuthorizationsFamily` and `Authorizations` (use `AuthorizationsV0` and `AuthorizationsV1` directly where needed).

- BREAKING: Remove `v2::ChainParameters`, `v2::ChainParametersV0`, `v2::ChainParametersV1`, `v2::ChainParametersV2` and `v2::ChainParametersV3`. These are replaced by `types::chain_parameters::ChainParameters`.
- A number of supporting types for `ChainParameters` are introduced. These have conversions that can be used to construct the payload types for updating the corresponding parameter sets.
- `types::chain_parameters::MintDistribution` (convertible to `types::MintDistributionV1`);
- `types::chain_parameters::TransactionFeeDistribution` (convertible to `types::TransactionFeeDistribution`);
- `types::chain_parameters::GasRewards` (convertible to `types::GASRewards` and `types::GASRewardsV1`);
- `types::chain_parameters::StakingParameters` (convertible to `types::PoolParameters`);
- `types::chain_parameters::Level2Keys` (provides `construct_update_signer`, convertible to `types::AuthorizationsV0` and `types::AuthorizationsV1`);
- `types::chain_parameters::UpdateKeys`;
- `types::chain_parameters::TimeoutParameters` (convertible to `types::TimeParameters`);
- `types::chain_parameters::CooldownParameters` (convertible to `types::CooldownParameters`);
- `types::chain_parameters::FinalizationCommitteeParameters` (convertible to `types::FinalizationCommitteeParameters`).
- `types::chain_parameters::EnergyRate` with `ccd_cost` for computing Energy costs in CCD.
- Compared to the former `v2::ChainParameters`, `types::chain_parameters::ChainParameters`:
- no longer provides `micro_cd_per_energy`, which is replaced by `energy_rate`;
- `ccd_cost` is removed, which should be replaced by calling `ccd_cost` on the energy rate instead;
- the `foundation_account` getter function is removed, and should be replaced by direct access to the `foundation_account` field;
- `common_update_keys` is removed, and instead `keys.level_2_keys` should be used, which can be used to construct an `UpdateSigner`, or converted to `types::AuthorizationsV0`.
- BREAKING: The parameter of `PendingUpdateEffect::AddAnonymityRevoker` is now `Box`ed.

## 7.0.0

Adds support for integrating with Concordium nodes running protocol version 9.
Expand Down
2 changes: 1 addition & 1 deletion concordium-base
Submodule concordium-base updated 30 files
+53 −0 .github/workflows/release-concordium-base-derive.yaml
+51 −0 .github/workflows/release-concordium-base.yaml
+2 −0 .gitignore
+2 −2 identity-provider-service/Cargo.lock
+2 −2 idiss/Cargo.lock
+2 −2 mobile_wallet/Cargo.lock
+2 −2 rust-bins/Cargo.lock
+8 −2 rust-bins/src/bin/identity_provider_cli.rs
+2 −2 rust-src/Cargo.lock
+18 −0 rust-src/concordium_base/CHANGELOG.md
+2 −2 rust-src/concordium_base/Cargo.toml
+9 −1 rust-src/concordium_base/src/aggregate_sig/mod.rs
+9 −61 rust-src/concordium_base/src/base.rs
+4 −2 rust-src/concordium_base/src/common/types.rs
+8 −1 rust-src/concordium_base/src/curve_arithmetic/secret_value.rs
+1 −1 rust-src/concordium_base/src/ecvrf/secret.rs
+9 −1 rust-src/concordium_base/src/elgamal/message.rs
+10 −1 rust-src/concordium_base/src/elgamal/secret.rs
+139 −13 rust-src/concordium_base/src/id/constants.rs
+12 −7 rust-src/concordium_base/src/id/id_proof_types.rs
+26 −21 rust-src/concordium_base/src/id/id_verifier.rs
+1 −0 rust-src/concordium_base/src/lib.rs
+1 −0 rust-src/concordium_base/src/pedersen_commitment/randomness.rs
+9 −1 rust-src/concordium_base/src/ps_sig/known_message.rs
+9 −1 rust-src/concordium_base/src/ps_sig/secret.rs
+39 −36 rust-src/concordium_base/src/updates.rs
+46 −18 rust-src/concordium_base/src/web3id/mod.rs
+1 −1 rust-src/concordium_base_derive/Cargo.toml
+3 −3 rust-src/wallet_library/src/default_wallet_config.rs
+4 −4 rust-src/wallet_library/src/statement.rs
23 changes: 16 additions & 7 deletions examples/create-initial-accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,22 @@ async fn main() -> anyhow::Result<()> {
created_at,
max_accounts: 100,
alist: vec![
(AttributeTag(0), AttributeKind("A".into())),
(AttributeTag(1), AttributeKind("B".into())),
(AttributeTag(2), AttributeKind("C".into())),
(AttributeTag(3), AttributeKind("D".into())),
(AttributeTag(4), AttributeKind("EE".into())),
(AttributeTag(5), AttributeKind("FFF".into())),
(AttributeTag(6), AttributeKind("GGGG".into())),
(AttributeTag(0), AttributeKind::try_new("A".into()).unwrap()),
(AttributeTag(1), AttributeKind::try_new("B".into()).unwrap()),
(AttributeTag(2), AttributeKind::try_new("C".into()).unwrap()),
(AttributeTag(3), AttributeKind::try_new("D".into()).unwrap()),
(
AttributeTag(4),
AttributeKind::try_new("EE".into()).unwrap(),
),
(
AttributeTag(5),
AttributeKind::try_new("FFF".into()).unwrap(),
),
(
AttributeTag(6),
AttributeKind::try_new("GGGG".into()).unwrap(),
),
]
.into_iter()
.collect(),
Expand Down
27 changes: 16 additions & 11 deletions examples/protocol-updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,19 @@ async fn main() -> anyhow::Result<()> {
.context("Could not obtain chain parameters.")?
.response;

let keys = summary
.keys
.level_2_keys
.context("No level 2 keys in chain parameters.")?;

// find the key indices to sign with
let signer = summary
.common_update_keys()
.construct_update_signer(&summary.common_update_keys().protocol, kps)
let signer = keys
.construct_update_signer(
keys.protocol
.as_ref()
.context("Missing protocol update keys")?,
kps,
)
.context("Could not construct signer.")?;

let mut seq_number = client
Expand Down Expand Up @@ -134,21 +143,17 @@ async fn main() -> anyhow::Result<()> {
specification_auxiliary_data: Vec::new(),
};

let pool_parameters_keys = keys.pool_parameters.context("Missing pool parameters")?;

let params_p4 = ProtocolUpdateDataP4 {
update_default_commission_rate: CommissionRates {
finalization: "1".parse().unwrap(),
baking: "0.1".parse().unwrap(),
transaction: "0.1".parse().unwrap(),
},
update_default_pool_state: OpenStatus::OpenForAll,
update_cooldown_parameters_access_structure: summary
.common_update_keys()
.pool_parameters
.clone(),
update_time_parameters_access_structure: summary
.common_update_keys()
.pool_parameters
.clone(),
update_cooldown_parameters_access_structure: pool_parameters_keys.clone(),
update_time_parameters_access_structure: pool_parameters_keys.clone(),
update_cooldown_parameters: CooldownParameters {
pool_owner_cooldown: 1800.into(),
delegator_cooldown: 900.into(),
Expand Down
18 changes: 14 additions & 4 deletions examples/update-exchange-rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ use clap::AppSettings;
use concordium_rust_sdk::{
common::types::TransactionTime,
types::{
chain_parameters::ChainParameters,
transactions::{update, BlockItem, Payload},
ExchangeRate, TransactionStatus, UpdateKeyPair, UpdatePayload,
},
v2::{self, BlockIdentifier, ChainParameters},
v2::{self, BlockIdentifier},
};
use std::path::PathBuf;
use structopt::StructOpt;
Expand Down Expand Up @@ -52,10 +53,19 @@ async fn main() -> anyhow::Result<()> {
.context("Could not obtain last finalized block's chain parameters")?
.response;

let keys = summary
.keys
.level_2_keys
.context("No level 2 keys in chain parameters.")?;

// find the key indices to sign with
let signer = summary
.common_update_keys()
.construct_update_signer(&summary.common_update_keys().micro_gtu_per_euro, kps)
let signer = keys
.construct_update_signer(
keys.micro_ccd_per_euro
.as_ref()
.context("Missing micro CCD per Euro update keys.")?,
kps,
)
.context("Invalid keys supplied.")?;

let seq_number = client
Expand Down
18 changes: 14 additions & 4 deletions examples/update-validator-score-param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ use concordium_base::updates::ValidatorScoreParameters;
use concordium_rust_sdk::{
common::types::TransactionTime,
types::{
chain_parameters::ChainParameters,
transactions::{update, BlockItem, Payload},
TransactionStatus, UpdateKeyPair, UpdatePayload,
},
v2::{self, BlockIdentifier, ChainParameters},
v2::{self, BlockIdentifier},
};
use std::path::PathBuf;
use structopt::StructOpt;
Expand Down Expand Up @@ -54,10 +55,19 @@ async fn main() -> anyhow::Result<()> {
.context("Could not obtain last finalized block's chain parameters")?
.response;

let keys = summary
.keys
.level_2_keys
.context("No level 2 keys in chain parameters.")?;

// find the key indices to sign with
let signer = summary
.common_update_keys()
.construct_update_signer(&summary.common_update_keys().micro_gtu_per_euro, kps)
let signer = keys
.construct_update_signer(
keys.micro_ccd_per_euro
.as_ref()
.context("Missing micro CCD per Euro update keys.")?,
kps,
)
.context("Invalid keys supplied.")?;

let seq_number = client
Expand Down
23 changes: 16 additions & 7 deletions examples/v2_create_initial_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,22 @@ async fn main() -> anyhow::Result<()> {
created_at,
max_accounts: 100,
alist: vec![
(AttributeTag(0), AttributeKind("A".into())),
(AttributeTag(1), AttributeKind("B".into())),
(AttributeTag(2), AttributeKind("C".into())),
(AttributeTag(3), AttributeKind("D".into())),
(AttributeTag(4), AttributeKind("EE".into())),
(AttributeTag(5), AttributeKind("FFF".into())),
(AttributeTag(6), AttributeKind("GGGG".into())),
(AttributeTag(0), AttributeKind::try_new("A".into()).unwrap()),
(AttributeTag(1), AttributeKind::try_new("B".into()).unwrap()),
(AttributeTag(2), AttributeKind::try_new("C".into()).unwrap()),
(AttributeTag(3), AttributeKind::try_new("D".into()).unwrap()),
(
AttributeTag(4),
AttributeKind::try_new("EE".into()).unwrap(),
),
(
AttributeTag(5),
AttributeKind::try_new("FFF".into()).unwrap(),
),
(
AttributeTag(6),
AttributeKind::try_new("GGGG".into()).unwrap(),
),
]
.into_iter()
.collect(),
Expand Down
24 changes: 14 additions & 10 deletions examples/v2_update_exchange_rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ async fn main() -> anyhow::Result<()> {
.await
.context("Could not obtain chain parameters")?;

// find the key indices to sign with
let signer = params
let keys = params
.response
.common_update_keys()
.keys
.level_2_keys
.context("No level 2 keys in chain parameters.")?;

// find the key indices to sign with
let signer = keys
.construct_update_signer(
&params.response.common_update_keys().micro_gtu_per_euro,
keys.micro_ccd_per_euro
.as_ref()
.context("Missing uCCD:EUR exchange rate update keys.")?,
kps,
)
.context("Invalid keys supplied.")?;
Expand All @@ -69,12 +75,10 @@ async fn main() -> anyhow::Result<()> {
.response
.micro_ccd_per_euro;

let exchange_rate = match &params.response {
v2::ChainParameters::V0(v0) => v0.micro_ccd_per_euro,
v2::ChainParameters::V1(v1) => v1.micro_ccd_per_euro,
v2::ChainParameters::V2(v2) => v2.micro_ccd_per_euro,
v2::ChainParameters::V3(v3) => v3.micro_ccd_per_euro,
};
let exchange_rate = params
.response
.micro_ccd_per_euro
.context("No exchange rate in chain parameters.")?;

let effective_time = 0.into(); // immediate effect
let timeout =
Expand Down
18 changes: 18 additions & 0 deletions src/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,21 @@ For the quick proof of concept application the value can be unwrapped using [`un
[`known_or_err`]: v2::Upward::known_or_err
[`known_or`]: v2::Upward::known_or
[`unwrap`]: v2::Upward::unwrap

#### `ChainParameters`

The `v2::ChainParameters` `enum` has been replaced by [`types::chain_parameters::ChainParameters`], which is a single `struct` with optional fields.
Applications should no longer case on the version of the chain parameters, but can directly access the relevant parameters.
Since parameters are added and removed across different protocol versions, each parameter is optional, even if it is present in all current protocol versions, in case it may be removed in a future protocol version.
The prior functions on `ChainParameters` have been removed, and should be migrated as set out below.

The `ChainParameters::common_update_keys()` function was removed.
Instead `keys.level_2_keys : Option<Level2Keys>` should be used.
The [`Level2Keys`](types::chain_parameters::Level2Keys) `struct` provides the level 2 keys and access structures.
For signing chain updates, use [`construct_update_signer()`](types::chain_parameters::Level2Keys::construct_update_signer).

The `ChainParameters::micro_ccd_per_energy()` and `ChainParameters::ccd_cost()` functions were removed.
Instead, use [`energy_rate()`](types::chain_parameters::ChainParameters::energy_rate) to obtain an [`EnergyRate`](types::chain_parameters::EnergyRate), which encapsulates the [`micro_ccd_per_energy`](types::chain_parameters::EnergyRate::micro_ccd_per_energy) exchange rate.
`EnergyRate` also provides [`ccd_cost()`](types::chain_parameters::EnergyRate::ccd_cost), which should be used in place of the former `ChainParameters::ccd_cost()`.

Finally, the `ChainParameters::foundation_account()` getter function was removed, and should be replaced by directly accessing [`ChainParameters::foundation_account`](types::chain_parameters::ChainParameters::foundation_account).
Loading