Skip to content

Commit

Permalink
merged main into branch
Browse files Browse the repository at this point in the history
  • Loading branch information
aramikm committed Nov 4, 2024
2 parents 39a4661 + 1b526be commit 7c57404
Show file tree
Hide file tree
Showing 55 changed files with 4,458 additions and 912 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/common/try-runtime-migrations/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
shell: bash

- name: Run runtime checks
uses: paritytech/try-runtime-gha@v0.1.0
uses: paritytech/try-runtime-gha@v0.2.0
with:
runtime-package: ${{ inputs.runtime-package }}
node-uri: ${{ inputs.runtime-uri }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jobs:
run: sha256sum ${{env.RELEASE_BIN_FILENAME}} > ${{env.RELEASE_BIN_FILENAME}}.sha256
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5
with:
gpg_private_key: ${{secrets.FREQUENCY_PGP_SECRET_SUBKEYS}}
passphrase: ${{secrets.FREQUENCY_PGP_MASTER_KEY_PASSWORD}}
Expand Down Expand Up @@ -507,7 +507,7 @@ jobs:
with:
full-release-version-tag: ${{env.LATEST_FULL_RELEASE_TAG}}
- name: Fetch Reference Binary
uses: robinraju/release-downloader@c39a3b234af58f0cf85888573d361fb6fa281534
uses: robinraju/release-downloader@a96f54c1b5f5e09e47d9504526e96febd949d4c2
with:
tag: ${{steps.get-previous-full-release-version.outputs.version}}
fileName: ${{env.BIN_FILENAME}}
Expand Down Expand Up @@ -666,7 +666,7 @@ jobs:
tera --version
- name: Build Changelog
id: build-changelog
uses: mikepenz/release-changelog-builder-action@f3fc77b47b74e78971fffecb2102ae6eac9a44d6
uses: mikepenz/release-changelog-builder-action@32e3c96f29a6532607f638797455e9e98cfc703d
env:
GITHUB_TOKEN: ${{ github.token }}
with:
Expand Down Expand Up @@ -760,7 +760,7 @@ jobs:
> release-notes.md
- name: Publish Release Candidate on GitHub
if: steps.is-full-release.outputs.is-full-release != 'true'
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8
with:
name: "[Release Candidate] ${{env.NEW_RELEASE_TAG}}"
prerelease: true
Expand All @@ -772,7 +772,7 @@ jobs:
/tmp/polkadot-api-types-json/json/types.json
- name: Publish Full Release on GitHub
if: steps.is-full-release.outputs.is-full-release == 'true'
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8
with:
body_path: tools/ci/release-notes/release-notes.md
tag_name: ${{env.NEW_RELEASE_TAG}}
Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ serde_json = { version = "1.0.86", default-features = false }
tokio = { version = "1.25.0", default-features = false }
unicode-normalization = { version = "0.1.22", default-features = false }
clap = { version = "4.2.5", features = ["derive"] }
static_assertions = { version = "1.1.0", default-features = false }

sp-externalities = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false}
sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false}
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ benchmarks-multi:
benchmarks-multi-local:
./scripts/run_benchmarks.sh -t bench-dev $(PALLETS)

benchmarks-capacity:
./scripts/run_benchmark.sh -p capacity

.PHONY: docs
docs:
RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo doc --no-deps --workspace --features frequency
Expand Down
41 changes: 35 additions & 6 deletions common/primitives/src/capacity.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
use crate::msa::MessageSourceId;
use frame_support::traits::tokens::Balance;
use scale_info::TypeInfo;
use sp_core::{Decode, Encode, MaxEncodedLen, RuntimeDebug};
use sp_runtime::DispatchError;

/// The type of a Reward Era
pub type RewardEra = u32;

/// A trait for checking that a target MSA can be staked to.
pub trait TargetValidator {
/// Checks if an MSA is a valid target.
Expand All @@ -15,19 +20,24 @@ impl TargetValidator for () {
}
}

/// A trait for Non-transferable asset.
/// A trait for Non-transferable asset
pub trait Nontransferable {
/// Scalar type for representing balance of an account.
type Balance: Balance;

/// The balance Capacity for an MSA account.
/// The available Capacity for an MSA.
fn balance(msa_id: MessageSourceId) -> Self::Balance;

/// Reduce Capacity of an MSA account by amount.
fn deduct(msa_id: MessageSourceId, amount: Self::Balance) -> Result<(), DispatchError>;
/// Reduce Capacity of an MSA by amount.
fn deduct(msa_id: MessageSourceId, capacity_amount: Self::Balance)
-> Result<(), DispatchError>;

/// Increase Capacity of an MSA account by an amount.
fn deposit(msa_id: MessageSourceId, amount: Self::Balance) -> Result<(), DispatchError>;
/// Increase Staked Token + Capacity amounts of an MSA. (unused)
fn deposit(
msa_id: MessageSourceId,
token_amount: Self::Balance,
capacity_amount: Self::Balance,
) -> Result<(), DispatchError>;
}

/// A trait for replenishing Capacity.
Expand All @@ -47,3 +57,22 @@ pub trait Replenishable {
/// Checks if an account can be replenished.
fn can_replenish(msa_id: MessageSourceId) -> bool;
}

/// Result of checking a Boost History item to see if it's eligible for a reward.
#[derive(
Copy, Clone, Default, Encode, Eq, Decode, RuntimeDebug, MaxEncodedLen, PartialEq, TypeInfo,
)]

pub struct UnclaimedRewardInfo<Balance, BlockNumber> {
/// The Reward Era for which this reward was earned
pub reward_era: RewardEra,
/// When this reward expires, i.e. can no longer be claimed
pub expires_at_block: BlockNumber,
/// The total staked in this era as of the current block
pub staked_amount: Balance,
/// The amount staked in this era that is eligible for rewards. Does not count additional amounts
/// staked in this era.
pub eligible_amount: Balance,
/// The amount in token of the reward (only if it can be calculated using only on chain data)
pub earned_amount: Balance,
}
Loading

0 comments on commit 7c57404

Please sign in to comment.