Skip to content
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/millis timestamp #217

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions pallets/funding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ pub mod pallet {
type ContributionTreasury: Get<AccountIdOf<Self>>;

/// The Ed25519 Verifier Public Key of credential JWTs
#[pallet::constant]
type VerifierPublicKey: Get<[u8; 32]>;

/// The type used for vesting
Expand Down
3 changes: 2 additions & 1 deletion polimec-common/common/src/credentials/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ where
let Some(who) = origin.clone().into_signer() else { return Err(origin) };
let Ok(token) = Self::verify_token(token, verifying_key) else { return Err(origin) };
let Ok(claims) = Self::extract_claims(&token) else { return Err(origin) };
// Get the current timestamp from the pallet_timestamp. It is in milliseconds.
let Ok(now) = Now::<T>::get().try_into() else { return Err(origin) };
let Some(date_time) = claims.expiration else { return Err(origin) };

if claims.custom.subject == who && (date_time.timestamp() as u64) >= now {
if claims.custom.subject == who && (date_time.timestamp_millis() as u64) >= now {
return Ok((who, claims.custom.did.clone(), claims.custom.investor_type.clone()));
}

Expand Down
2 changes: 1 addition & 1 deletion runtimes/politest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use frame_support::{
};
use frame_system::{EnsureNever, EnsureRoot, EnsureRootWithSuccess, EnsureSigned};
use pallet_democracy::GetElectorate;
use pallet_funding::{DaysToBlocks};
use pallet_funding::DaysToBlocks;

use parachains_common::{
message_queue::{NarrowOriginToSibling, ParaIdToSibling},
Expand Down
4 changes: 2 additions & 2 deletions runtimes/shared-configuration/src/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

use crate::Balance;
use frame_support::parameter_types;
use parachains_common::AssetIdForTrustBackedAssets as AssetId;
use pallet_funding::AcceptedFundingAsset;
use sp_runtime::{traits::Convert, FixedU128};
use pallet_oracle_ocw::types::AssetName;
use parachains_common::AssetIdForTrustBackedAssets as AssetId;
use sp_runtime::{traits::Convert, FixedU128};

/// One PLMC
pub const PLMC: Balance = 10u128.pow(10);
Expand Down
48 changes: 29 additions & 19 deletions scripts/zombienet/native/local-testnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,41 @@
timeout = 1000
provider = "native"

# Using Rococo 1.7.0 as relay.
[relaychain]
default_command = "polkadot"
default_command = "../polkadot-sdk/target/release/polkadot"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a bin folder that is ignored by git where we can personally add these binaries?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Copy link
Member Author

@lrazovic lrazovic Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed and tested in 82f9d3f.

Should also the polimec-node point to the bin folder or should I leave it to ./target/release?

chain = "rococo-local"

[[relaychain.nodes]]
name = "eve"
[[relaychain.nodes]]
name = "eve"

[[relaychain.nodes]]
name = "ferdie"
[[relaychain.nodes]]
name = "ferdie"

[[relaychain.nodes]]
name = "charlie"
[[relaychain.nodes]]
name = "charlie"

[[relaychain.nodes]]
name = "dave"
[[relaychain.nodes]]
name = "dave"

[[parachains]]
id = 3344
chain = "polimec-rococo-local"

[[parachains.collators]]
name = "alice"
command = "polimec"
ws_port = 8080

[[parachains.collators]]
name = "bob"
command = "polimec"
chain = "politest-local"

[[parachains.collators]]
name = "alice"
command = "./target/release/polimec-node"
args = [
"-lcredentials::try_origin",
"-lcredentials::ensure_origin"
]
ws_port = 8080

[[parachains.collators]]
name = "bob"
command = "./target/release/polimec-node"
args = [
"-lcredentials::try_origin",
"-lcredentials::ensure_origin"
]
ws_port = 8081