Skip to content

Commit

Permalink
OCW additional logs (#413)
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 Aug 9, 2024
1 parent e0ce0e5 commit 92e08a3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
47 changes: 33 additions & 14 deletions pallets/ddc-verification/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,11 +1220,17 @@ pub mod pallet {
Percent::from_percent(T::MAJORITY),
)?;

let customer_activity_hashes: Vec<ActivityHash> = customers_activity_in_consensus
.clone()
.into_iter()
.map(|c| c.hash::<T>())
.collect();

log::info!(
"🧗‍ Customer Activity for ClusterId: {:?} EraId: {:?} is: {:?}",
"🧗‍ Customer Activity hashes for ClusterId: {:?} EraId: {:?} is: {:?}",
cluster_id,
era_activity.id,
customers_activity_in_consensus
customer_activity_hashes
);
let customers_activity_batch_roots = Self::convert_to_batch_merkle_roots(
cluster_id,
Expand All @@ -1236,12 +1242,16 @@ pub mod pallet {
let customer_batch_roots_string: Vec<String> =
customers_activity_batch_roots.clone().into_iter().map(hex::encode).collect();

log::info!(
"🧗‍ Customer Activity_batch_roots for ClusterId: {:?} EraId: {:?} is: {:?}",
for (pos, batch_root) in customer_batch_roots_string.iter().enumerate() {
log::info!(
"🧗‍ Customer Activity batches for ClusterId: {:?} EraId: {:?} is: batch {:?} with root {:?} for activities {:?}",
cluster_id,
era_activity.id,
customer_batch_roots_string
);
pos,
batch_root,
customer_activity_hashes
);
}

let customers_activity_root = Self::create_merkle_root(
cluster_id,
Expand All @@ -1251,10 +1261,11 @@ pub mod pallet {
.map_err(|err| vec![err])?;

log::info!(
"🧗‍ Customer Activity _ roots for ClusterId: {:?} EraId: {:?} is: {:?}",
"🧗‍ Customer Activity batches tree for ClusterId: {:?} EraId: {:?} is: batch with root {:?} for activities {:?}",
cluster_id,
era_activity.id,
hex::encode(customers_activity_root)
hex::encode(customers_activity_root),
customer_batch_roots_string,
);

let nodes_activity_in_consensus = Self::get_consensus_for_activities(
Expand All @@ -1265,12 +1276,16 @@ pub mod pallet {
Percent::from_percent(T::MAJORITY),
)?;

let node_activity_hashes: Vec<ActivityHash> =
nodes_activity_in_consensus.clone().into_iter().map(|c| c.hash::<T>()).collect();

log::info!(
"🧗‍ Node Activity for ClusterId: {:?} EraId: {:?} is: {:?}",
"🧗‍ Node Activity hashes for ClusterId: {:?} EraId: {:?} is: {:?}",
cluster_id,
era_activity.id,
nodes_activity_in_consensus
node_activity_hashes
);

let nodes_activity_batch_roots = Self::convert_to_batch_merkle_roots(
cluster_id,
era_activity.id,
Expand All @@ -1282,20 +1297,23 @@ pub mod pallet {
nodes_activity_batch_roots.clone().into_iter().map(hex::encode).collect();

log::info!(
"🧗‍ Node Activity_batch_roots for ClusterId: {:?} EraId: {:?} is: {:?}",
"🧗‍ Node Activity batches for ClusterId: {:?} EraId: {:?} is: batch 1 with root {:?} for activities {:?}",
cluster_id,
era_activity.id,
nodes_activity_batch_roots_string
nodes_activity_batch_roots_string,
node_activity_hashes
);

let nodes_activity_root =
Self::create_merkle_root(cluster_id, era_activity.id, &nodes_activity_batch_roots)
.map_err(|err| vec![err])?;

log::info!(
"🧗‍ Node Activity _ roots for ClusterId: {:?} EraId: {:?} is: {:?}",
"🧗‍ Node Activity batches tree for ClusterId: {:?} EraId: {:?} is: batch 1 with root {:?} for activities {:?}",
cluster_id,
era_activity.id,
hex::encode(nodes_activity_root)
hex::encode(nodes_activity_root),
nodes_activity_batch_roots_string,
);

Self::store_validation_activities(
Expand Down Expand Up @@ -2223,6 +2241,7 @@ pub mod pallet {
let last_validated_era = Self::get_last_validated_era(cluster_id, current_validator)?
.unwrap_or_else(DdcEra::default);

log::info!("🚀 last_validated_era for cluster_id: {:?}", last_validated_era);
let all_ids = Self::fetch_processed_era_for_node(cluster_id, dac_nodes)?;

let ids_greater_than_last_validated_era: Vec<EraActivity> = all_ids
Expand Down
4 changes: 2 additions & 2 deletions 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: 54113,
spec_version: 54114,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 19,
Expand Down Expand Up @@ -1408,7 +1408,7 @@ pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;

/// Runtime migrations
type Migrations = (pallet_ddc_nodes::migrations::MigrateToV1<Runtime>,);
type Migrations = ();

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
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: 54113,
spec_version: 54114,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 19,
Expand Down

0 comments on commit 92e08a3

Please sign in to comment.