Skip to content

Commit

Permalink
Fixing billing activity issue (#431)
Browse files Browse the repository at this point in the history
## Description
<!-- Describe what change this PR is implementing -->

## Types of Changes
Please select the branch type you are merging and fill in the relevant
template.
<!--- Check the following box with an x if the following applies: -->
- [ ] Hotfix
- [ ] Release
- [ ] Fix or Feature

## Fix or Feature
<!--- Check the following box with an x if the following applies: -->

### Types of Changes
<!--- What types of changes does your code introduce? -->
- [ ] Tech Debt (Code improvements)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Dependency upgrade (A change in substrate or any 3rd party crate
version)

### Migrations and Hooks
<!--- Check the following box with an x if the following applies: -->
- [ ] This change requires a runtime migration.
- [ ] Modifies `on_initialize`
- [ ] Modifies `on_finalize`

### Checklist for Fix or Feature
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [ ] Change has been tested locally.
- [ ] Change adds / updates tests if applicable.
- [ ] Changelog doc updated.
- [ ] `spec_version` has been incremented.
- [ ] `network-relayer`'s
[events](https://github.com/Cerebellum-Network/network-relayer/blob/dev-cere/shared/substrate/events.go)
have been updated according to the blockchain events if applicable.
- [ ] All CI checks have been passed successfully

## Checklist for Hotfix
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [ ] Change has been deployed to Testnet.
- [ ] Change has been tested in Testnet.
- [ ] Changelog has been updated.
- [ ] Crate version has been updated.
- [ ] `spec_version` has been incremented.
- [ ] Transaction version has been updated if required.
- [ ] Pull Request to `dev` has been created.
- [ ] Pull Request to `staging` has been created.
- [ ] `network-relayer`'s
[events](https://github.com/Cerebellum-Network/network-relayer/blob/dev-cere/shared/substrate/events.go)
have been updated according to the blockchain events if applicable.
- [ ] All CI checks have been passed successfully

## Checklist for Release
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [ ] Change has been deployed to Devnet.
- [ ] Change has been tested in Devnet.
- [ ] Change has been deployed to Qanet.
- [ ] Change has been tested in Qanet.
- [ ] Change has been deployed to Testnet.
- [ ] Change has been tested in Testnet.
- [ ] Changelog has been updated.
- [ ] Crate version has been updated.
- [ ] Spec version has been updated.
- [ ] Transaction version has been updated if required.
- [ ] All CI checks have been passed successfully
  • Loading branch information
ayushmishra2005 authored Sep 20, 2024
1 parent 7e421cf commit 5288a1a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
50 changes: 31 additions & 19 deletions pallets/ddc-verification/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1532,9 +1532,11 @@ pub mod pallet {
PayoutState::Initialized
{
if let Some((_, _, customers_activity_batch_roots, _, _, _)) =
Self::fetch_validation_activities::<CustomerActivity, NodeActivity>(
cluster_id, era_id,
) {
Self::fetch_validation_activities::<
BucketNodeAggregatesActivity,
NodeActivity,
>(cluster_id, era_id)
{
Self::fetch_customer_activity(
cluster_id,
era_id,
Expand All @@ -1552,9 +1554,11 @@ pub mod pallet {
)?;

if let Some((_, _, customers_activity_batch_roots, _, _, _)) =
Self::fetch_validation_activities::<CustomerActivity, NodeActivity>(
cluster_id, era_id,
) {
Self::fetch_validation_activities::<
BucketNodeAggregatesActivity,
NodeActivity,
>(cluster_id, era_id)
{
Self::fetch_customer_activity(
cluster_id,
era_id,
Expand Down Expand Up @@ -1784,9 +1788,11 @@ pub mod pallet {
nodes_activity_in_consensus,
_,
nodes_activity_batch_roots,
)) = Self::fetch_validation_activities::<CustomerActivity, NodeActivity>(
cluster_id, era_id,
) {
)) = Self::fetch_validation_activities::<
BucketNodeAggregatesActivity,
NodeActivity,
>(cluster_id, era_id)
{
Self::fetch_reward_activities(
cluster_id,
era_id,
Expand All @@ -1812,9 +1818,11 @@ pub mod pallet {
nodes_activity_in_consensus,
_,
nodes_activity_batch_roots,
)) = Self::fetch_validation_activities::<CustomerActivity, NodeActivity>(
cluster_id, era_id,
) {
)) = Self::fetch_validation_activities::<
BucketNodeAggregatesActivity,
NodeActivity,
>(cluster_id, era_id)
{
Self::fetch_reward_activities(
cluster_id,
era_id,
Expand Down Expand Up @@ -1887,9 +1895,11 @@ pub mod pallet {
nodes_activity_in_consensus,
_,
nodes_activity_batch_roots,
)) = Self::fetch_validation_activities::<CustomerActivity, NodeActivity>(
cluster_id, era_id,
) {
)) = Self::fetch_validation_activities::<
BucketNodeAggregatesActivity,
NodeActivity,
>(cluster_id, era_id)
{
Self::fetch_reward_provider_batch(
cluster_id,
batch_size,
Expand All @@ -1915,9 +1925,11 @@ pub mod pallet {
nodes_activity_in_consensus,
_,
nodes_activity_batch_roots,
)) = Self::fetch_validation_activities::<CustomerActivity, NodeActivity>(
cluster_id, era_id,
) {
)) = Self::fetch_validation_activities::<
BucketNodeAggregatesActivity,
NodeActivity,
>(cluster_id, era_id)
{
Self::fetch_reward_provider_batch(
cluster_id,
batch_size,
Expand Down Expand Up @@ -2907,7 +2919,7 @@ pub mod pallet {
let threshold = percent * <ValidatorSet<T>>::get().len();

let mut should_deposit_ready_event = false;
if threshold < signed_validators.len() {
if threshold <= signed_validators.len() {
// Update payers_merkle_root_hash and payees_merkle_root_hash as ones passed the
// threshold
era_validation.payers_merkle_root_hash = payers_merkle_root_hash;
Expand Down
2 changes: 1 addition & 1 deletion runtime/cere-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 54123,
spec_version: 54126,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 19,
Expand Down
2 changes: 1 addition & 1 deletion runtime/cere/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 54123,
spec_version: 54126,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 19,
Expand Down

0 comments on commit 5288a1a

Please sign in to comment.