Skip to content

Commit

Permalink
integrate tee and nft updates (#294)
Browse files Browse the repository at this point in the history
* integrate tee and nft updates

* update commit for ternoa-pallet

* update ternoa pallets commit

* update cluster size and update TEE pallet

* add correct confiuguration values for TEE

* set next spec version to 13

* update versions, remove bagslist fix migration

* phase-4 - capsule and transmission

* comment revert_capsule

* update ternoa-pallets

* update weight and conf values

* add transmission protocols weight

* update ternoa-pallets

* update ternoa pallets for duplicates

* update version

* change init nft and transmission values

* update ternoa-pallet version
  • Loading branch information
Leouarz authored Feb 17, 2023
1 parent 6772932 commit fcd3326
Show file tree
Hide file tree
Showing 21 changed files with 1,352 additions and 587 deletions.
1,108 changes: 642 additions & 466 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</h3>

Welcome to the Ternoa Blockchain repo which hosts the code used to build and run the Ternoa node.
Ternoa supports the transfer of arbitrary data to your descendants, friends and loved ones even after your death or disappearence or a given timed period in a **non custodial**, cryptographically enforced manner.
Ternoa supports the transfer of arbitrary data to your descendants, friends and loved ones even after your death or disappearance or a given timed period in a **non custodial**, cryptographically enforced manner.

</br>

Expand Down Expand Up @@ -84,7 +84,7 @@ All the examples in this document assume that you use a Ubuntu like system. If t

# Run
Node flag explanation:
- `--chain alphanet-dev`: There are a couple of chain configurations that we provide and each configuration have a drastic impact on how the chain behaves and what features it has. For testing purposes it's best to stick with alphanet-dev configuration.
- `--chain alphanet-dev`: There are a couple of chain configurations that we provide and each configuration has a drastic impact on how the chain behaves and what features it has. For testing purposes it's best to stick with alphanet-dev configuration.
- `--alice`: This sets a couple of flags for us. It sets the `--validator` flag so that the client is running in a validator mode, it makes Alice a validator and it inserts Alice's keys into the local keystore.
- `--tmp`: Makes is so that the blockchain data is stored in a temporary location. Usually this data is deleted on reboot.
- `--name MyLocalNode`: Sets the name of the name. This should be something unique.
Expand Down Expand Up @@ -142,12 +142,12 @@ Depending on what binary you downloaded certain features might not be available
```

# Running With Podman Tips
In the next examples some useful Podman commands will be shown. It's important to note that most flags have been omitted in order to make the examples more concise. Before running anything make sure that the image was built from the the "Build With Podman" step.
In the next examples some useful Podman commands will be shown. It's important to note that most flags have been omitted in order to make the examples more concise. Before running anything make sure that the image was built from the "Build With Podman" step.

If no command arguments are given by default it will try run the Ternoa Node with default parameters. To cancel this add `bash` at the end of the command. Example: `podman run tsdk bash`;

### Remove Container After Exit
A container that was run and it's job has been finished or the user has exited will not automatically be removed instead it will enter the Exit state.
A container that was run and its job has been finished or the user has exited will not automatically be removed instead it will enter the Exit state.
To make sure that the container is deleted and removed after it's being used the flag `--rm` should be used.

```bash
Expand Down Expand Up @@ -202,18 +202,18 @@ The predefined operation/command of the container when run is to run the Ternoa
```

### Create A Development Environment
The dockerfile is made in a way that it can be used to develope new applications with it.
The dockerfile is made in a way that it can be used to develop new applications with it.
Example of a typical workflows:
- The host installs git, clones the repo and install a code editor like VS Code.
- The host runs the container in a interactive mode with /workdir pointing to a workdir on host machine (can be your own project or chain repo).
- The host runs the container in an interactive mode with /workdir pointing to a workdir on host machine (can be your own project or chain repo).
- The host writes code via a code editor and uses the terminal (which is connected to the container) to run the `cargo build` and `cargo check` commands.
- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the chain.

```bash
mkdir ternoa-data
# Flag "--name" is used to name the container.
podman run -it --name my_chain_env -v ./ternoa-data:/data -v ./.:/workdir tchain bash
# Do some activity and the exit the container
# Do some activity and exit the container
[root@d4ad8ec11655:/workdir] nano -V
[root@d4ad8ec11655:/workdir] apt install nano
[root@d4ad8ec11655:/workdir] exit
Expand Down
10 changes: 9 additions & 1 deletion runtime/alphanet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "alphanet-runtime"
authors = [ "Ternoa" ]
version = "1.2.6"
version = "1.3.0"
edition = "2021"
build = "build.rs"

Expand Down Expand Up @@ -84,6 +84,8 @@ ternoa-nft = { path = "../../ternoa-pallets/nft", default-features = false }
ternoa-marketplace = { path = "../../ternoa-pallets/marketplace", default-features = false }
ternoa-auction = { path = "../../ternoa-pallets/auction", default-features = false }
ternoa-rent = { path = "../../ternoa-pallets/rent", default-features = false }
ternoa-tee = { path = "../../ternoa-pallets/tee", default-features = false }
ternoa-transmission-protocols = { path = "../../ternoa-pallets/transmission-protocols", default-features = false }

[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/capsule-corp-ternoa/substrate", tag = "ternoa-substrate-2022-10-01" }
Expand All @@ -101,6 +103,8 @@ std = [
"ternoa-marketplace/std",
"ternoa-auction/std",
"ternoa-rent/std",
"ternoa-tee/std",
"ternoa-transmission-protocols/std",
# Substrate
"parity-scale-codec/std",
"frame-election-provider-support/std",
Expand Down Expand Up @@ -192,6 +196,8 @@ runtime-benchmarks = [
"ternoa-marketplace/runtime-benchmarks",
"ternoa-auction/runtime-benchmarks",
"ternoa-rent/runtime-benchmarks",
"ternoa-tee/runtime-benchmarks",
"ternoa-transmission-protocols/runtime-benchmarks",
]

try-runtime = [
Expand Down Expand Up @@ -232,4 +238,6 @@ try-runtime = [
"ternoa-marketplace/try-runtime",
"ternoa-auction/try-runtime",
"ternoa-rent/try-runtime",
"ternoa-tee/try-runtime",
"ternoa-transmission-protocols/try-runtime",
]
4 changes: 4 additions & 0 deletions runtime/alphanet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ construct_runtime!(
Assets: pallet_assets = 31,
Auction: ternoa_auction = 32,
Rent: ternoa_rent = 33,
TEE: ternoa_tee = 34,
TransmissionProtocols: ternoa_transmission_protocols = 35,
}
);

Expand Down Expand Up @@ -460,6 +462,8 @@ mod benches {
[ternoa_marketplace, Marketplace]
[ternoa_auction, Auction]
[ternoa_rent, Rent]
[ternoa_tee, TEE]
[ternoa_transmission_protocols, TransmissionProtocols]
// Substrate
[pallet_babe, Babe]
[pallet_bags_list, BagsList]
Expand Down
53 changes: 50 additions & 3 deletions runtime/alphanet/src/pallets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use crate::{
OffchainSolutionLengthLimit, OffchainSolutionWeightLimit, Offences, OriginCaller, PalletInfo,
Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, Scheduler, Session, Signature,
SignedPayload, Staking, StakingRewards, System, TechnicalCommittee, Timestamp,
TransactionPayment, Treasury, UncheckedExtrinsic, NFT, VERSION,
TransactionPayment, Treasury, UncheckedExtrinsic, NFT, TEE, VERSION,
};

pub use common::babe::BABE_GENESIS_EPOCH_CONFIG;
Expand Down Expand Up @@ -316,7 +316,7 @@ impl frame_election_provider_support::onchain::Config for OnChainSeqPhragmen {
type System = Runtime;
type Solver = SequentialPhragmen<AccountId, common::election_provider_support::OnChainAccuracy>;
type DataProvider = Staking;
type WeightInfo = frame_election_provider_support::weights::SubstrateWeight<Runtime>; // TODO Weights
type WeightInfo = frame_election_provider_support::weights::SubstrateWeight<Runtime>;
}

impl pallet_staking::Config for Runtime {
Expand Down Expand Up @@ -652,7 +652,8 @@ parameter_types! {
pub const NFTOffchainDataLimit: u32 = 150;
pub const CollectionOffchainDataLimit: u32 = 150;
pub const CollectionSizeLimit: u32 = 1_000_000;
pub const InitialSecretMintFee: Balance = 75_000_000_000_000_000_000;
pub const InitialSecretMintFee: Balance = 50_000_000_000_000_000_000;
pub const InitialCapsuleMintFee: Balance = 100_000_000_000_000_000_000;
pub const ShardsNumber: u32 = 5;
}

Expand All @@ -666,7 +667,9 @@ impl ternoa_nft::Config for Runtime {
type CollectionOffchainDataLimit = CollectionOffchainDataLimit;
type CollectionSizeLimit = CollectionSizeLimit;
type InitialSecretMintFee = InitialSecretMintFee;
type InitialCapsuleMintFee = InitialCapsuleMintFee;
type ShardsNumber = ShardsNumber;
type TEEExt = TEE;
}

parameter_types! {
Expand Down Expand Up @@ -732,6 +735,7 @@ impl ternoa_auction::Config for Runtime {
type BidderListLengthLimit = BidderListLengthLimit;
type ParallelAuctionLimit = ParallelAuctionLimit;
type ActionsInBlockLimit = AuctionActionsInBlockLimit;
type ExistentialDeposit = common::balances::ExistentialDeposit;
}

parameter_types! {
Expand All @@ -754,4 +758,47 @@ impl ternoa_rent::Config for Runtime {
type ActionsInBlockLimit = RentActionsInBlockLimit;
type MaximumContractAvailabilityLimit = MaximumContractAvailabilityLimit;
type MaximumContractDurationLimit = MaximumContractDurationLimit;
type ExistentialDeposit = common::balances::ExistentialDeposit;
}

parameter_types! {
pub const ClusterSize: u32 = 5;
pub const MaxUriLen: u32 = 150;
pub const ListSizeLimit: u32 = 10;
}

impl ternoa_tee::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type WeightInfo = weights::ternoa_tee::WeightInfo<Runtime>;
type ClusterSize = ClusterSize;
type MaxUriLen = MaxUriLen;
type ListSizeLimit = ListSizeLimit;
}

parameter_types! {
pub const AtBlockFee: Balance = 20_000_000_000_000_000_000;
pub const AtBlockWithResetFee: Balance = 40_000_000_000_000_000_000;
pub const OnConsentFee: Balance = 30_000_000_000_000_000_000;
pub const OnConsentAtBlockFee: Balance = 40_000_000_000_000_000_000;
pub const MaxBlockDuration: u32 = 500;
pub const MaxConsentListSize: u32 = 10;
pub const SimultaneousTransmissionLimit: u32 = 50;
pub const ActionsInBlockLimit: u32 = 1_000;
}

impl ternoa_transmission_protocols::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::ternoa_transmission_protocols::WeightInfo<Runtime>;
type Currency = Balances;
type FeesCollector = Treasury;
type NFTExt = NFT;
type InitialAtBlockFee = AtBlockFee;
type InitialAtBlockWithResetFee = AtBlockWithResetFee;
type InitialOnConsentFee = OnConsentFee;
type InitialOnConsentAtBlockFee = OnConsentAtBlockFee;
type MaxBlockDuration = MaxBlockDuration;
type MaxConsentListSize = MaxConsentListSize;
type SimultaneousTransmissionLimit = SimultaneousTransmissionLimit;
type ActionsInBlockLimit = ActionsInBlockLimit;
}
2 changes: 1 addition & 1 deletion runtime/alphanet/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
/// Version of the runtime specification. A full-node will not attempt to use its native
/// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
/// `spec_version` and `authoring_version` are the same between Wasm and native.
spec_version: 11,
spec_version: 14,

/// Version of the implementation of the specification. Nodes are free to ignore this; it
/// serves only as an indication that the code is different; as long as the other two versions
Expand Down
2 changes: 2 additions & 0 deletions runtime/alphanet/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ pub mod ternoa_marketplace;
pub mod ternoa_nft;
pub mod ternoa_rent;
pub mod ternoa_staking_rewards;
pub mod ternoa_tee;
pub mod ternoa_transmission_protocols;
// pub mod pallet_session;
// pub mod pallet_staking;
Loading

0 comments on commit fcd3326

Please sign in to comment.