Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • nodes/rust/duniter-v2s
  • llaq/lc-core-substrate
  • pini-gh/duniter-v2s
  • vincentux/duniter-v2s
  • mildred/duniter-v2s
  • d0p1/duniter-v2s
  • bgallois/duniter-v2s
  • Nicolas80/duniter-v2s
8 results
Show changes
Commits on Source (7)
Showing
with 129 additions and 83 deletions
......@@ -5,5 +5,4 @@
docker/Dockerfile
docker-compose.yml
arm-build/
build/
**/target/
......@@ -23,12 +23,12 @@ g1 = ["g1-runtime"]
gdev = ["gdev-runtime"]
gtest = ["gtest-runtime"]
runtime-benchmarks = [
'g1-runtime',
'g1-runtime/runtime-benchmarks',
'gdev-runtime',
'gdev-runtime/runtime-benchmarks',
'gtest-runtime',
'gtest-runtime/runtime-benchmarks',
'g1-runtime',
'g1-runtime/runtime-benchmarks',
'gdev-runtime',
'gdev-runtime/runtime-benchmarks',
'gtest-runtime',
'gtest-runtime/runtime-benchmarks',
]
try-runtime = [
"g1-runtime/try-runtime",
......@@ -122,21 +122,21 @@ try-runtime-cli = { git = "https://github.com/librelois/substrate.git", branch =
resolver = "2"
members = [
'end2end-tests',
'end2end-tests',
'pallets/certification',
'pallets/duniter-test-parameters',
'pallets/duniter-test-parameters/macro',
'pallets/duniter-wot',
'pallets/identity',
'pallets/membership',
'pallets/authority-members',
'pallets/membership',
'pallets/authority-members',
'pallets/ud-accounts-storage',
'pallets/universal-dividend',
'pallets/upgrade-origin',
'pallets/upgrade-origin',
'primitives/membership',
'runtime/common',
'runtime/gdev',
'xtask',
'xtask',
]
# The list of dependencies below (which can be both direct and indirect dependencies) are crates
......
......@@ -16,7 +16,7 @@ Minimal command to deploy a **temporary** mirror peer:
docker run -it -p9944:9944 -e DUNITER_CHAIN_NAME=gdev duniter/duniter-v2s:v0.1.0 --tmp --execution=Wasm
```
To go further, read [How to deploy a permanent mirror node on ĞDev network](./docs/user/mirror.md).
To go further, read [How to deploy a permanent mirror node on ĞDev network](./docs/user/rpc.md).
### Create your local blockchain
......
......@@ -28,7 +28,7 @@ services:
#
# The PEER_ID should be replaced by the output of this command:
# docker run --rm -it --entrypoint duniter -v $PWD:/var/lib/duniter/ duniter/duniter-v2s:v0.1.0 key generate-node-key --file /var/lib/duniter/node.key
- "/dns/SERVER_DOMAIN/tcp/30333/p2p/PEER_ID"
- "/dns/${SERVER_DOMAIN?SERVER_DOMAIN should be set}/tcp/30333/p2p/${PEER_ID?PEER_ID should be set}"
- "--rpc-cors"
- "all"
......
......@@ -14,22 +14,20 @@ services:
# p2p
- 30333:30333
volumes:
- ./duniter-rpc/:/var/lib/duniter/
- ./node.key:/etc/duniter/validator-node.key
- duniter-rpc-data:/var/lib/duniter/
environment:
- DUNITER_CHAIN_NAME=gdev
command:
- "--execution"
- "Wasm"
- "--node-key-file"
- "/var/lib/duniter/node-key"
- "--execution=Wasm"
- "--node-key-file=/var/lib/duniter/node.key"
- "--public-addr"
# SERVER_IP should be replaced by the public IP of your server
# SERVER_DOMAIN should be replaced by a domain name that point on your server
#
# The PEER_ID should be replaced by the output of this command:
# docker run --rm -it --entrypoint -v $PWD/duniter-rpc/:/var/lib/duniter/ duniter duniter/duniter-v2s:v0.1.0 key generate-node-key --file /var/lib/duniter/node-key.txt
- "/ip4/SERVER_IP/tcp/30333/p2p/PEER_ID"
- "--rpc-cors"
- "all"
- "/dns/${SERVER_DOMAIN?SERVER_DOMAIN should be set}/tcp/30333/p2p/${PEER_ID?PEER_ID should be set}"
- "--rpc-cors=all"
duniter-validator:
image: duniter/duniter-v2s:v0.1.0
......@@ -44,21 +42,19 @@ services:
# p2p
- 30334:30333
volumes:
- ./duniter-validator/:/var/lib/duniter/
- ./node.key:/etc/duniter/validator-node.key
- duniter-validator-data:/var/lib/duniter/
environment:
- DUNITER_CHAIN_NAME=gdev
command:
- "--execution"
- "Wasm"
- "--node-key-file"
- "/var/lib/duniter/node-key"
- "--execution=Wasm"
- "--node-key-file=/var/lib/duniter/node.key"
- "--public-addr"
# SERVER_IP should be replaced by the public IP of your server
# SERVER_DOMAIN should be replaced by a domain name that point on your server
#
# The PEER_ID should be replaced by the output of this command:
# docker run --rm -it --entrypoint duniter -v $PWD/duniter-validator/:/var/lib/duniter/ duniter/duniter-v2s:v0.1.0 key generate-node-key --file /var/lib/duniter/node-key.txt
- "/ip4/SERVER_IP/tcp/30334/p2p/PEER_ID"
# docker run --rm -it --entrypoint -v $PWD/duniter-rpc/:/var/lib/duniter/ duniter duniter/duniter-v2s:v0.1.0 key generate-node-key --file /var/lib/duniter/node-key.txt
- "/dns/${SERVER_DOMAIN?SERVER_DOMAIN should be set}/tcp/30333/p2p/${VALIDATOR_PEER_ID?VALIDATOR_PEER_ID should be set}"
- "--rpc-cors=all"
- "--rpc-methods=Unsafe"
- "--validator"
- "--rpc-cors"
- "all"
# Manual for wallet developers
This functionnal documentation presents how wallets can interact with the blockchain.
It is intended to complete the [runtime calls documentation](./runtime-calls.md) in a runtime-specific way to fit the real needs of wallet developers.
Only ĞDev is covered for now.
## Notations
1 ĞD = 100 units
## Account existence
An account exists if and only if it contains at least the existential deposit (2 ĞD).
## Become member
Only use `identity` pallet. The `membership` calls are disabled.
1. The account that wants to gain membership needs to exists.
1. Any account that already has membership and respects the identity creation period can create an identity for another account, using `identity.createIdentity`.
1. The account has to confirm its identity with a name, using `identity.confirmIdentity`. The name must be ASCII alphanumeric, punctuation or space characters: ``/^[-!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~a-zA-Z0-9 ]{3,64}$/`` (additionally, trailing spaces and double spaces are forbidden, as a phishing countermeasure). If the name is already used, the call will fail.
## Revoke an identity
Revoking an identity makes it lose its membership, hence UD creation and governance rights. Orher data such as balance will remain.
This feature is useful in case the user has lost their private key.
### Generate the revocation payload
1. Scale-encode the revocation payload, that is the concatenation of the 32-bits public key and the genesis block hash.
2. Store this payload and its signature.
### Effectively revoke the identity
1. From any origin that can pay the fee, use `identity.revokeIdentity` with the revocation payload.
# How to deploy a permanent mirror node on ĞDev network
# How to deploy a permanent rpc node on ĞDev network
## Publish a node
### Duniter part
- Add this docker-compose on your server :
[docker/compose/gdev-mirror.docker-compose.yml](https://git.duniter.org/nodes/rust/duniter-v2s/-/blob/master/docker/compose/gdev-mirror.docker-compose.yml)
- Edit lines 26: `"/dns/SERVER_DOMAIN/tcp/30333/p2p/PEER_ID"`
with your domain name an the PEER_ID you get using te command in comment.
[docker/compose/gdev-rpc.docker-compose.yml](https://git.duniter.org/nodes/rust/duniter-v2s/-/blob/master/docker/compose/gdev-rpc.docker-compose.yml)
- Create a `.env` file that defime environment variables `SERVER_DOMAIN` and `PEER_ID`:
- `SERVER_DOMAIN`: a domain name that point on your server
- `PEER_ID`: Your node peer id, shoud be generated with this command: `docker run --rm -it --entrypoint duniter -v $PWD:/var/lib/duniter/ duniter/duniter-v2s:v0.1.0 key generate-node-key --file /var/lib/duniter/node.key`
- If you have write access errors run in docker-compose.yml folder : `chmod o+rwX -R .`
- `docker-compose up -d` to start your node
### Reverse-proxy part (with Nginx)
In `/etc/nginx/sites-enabled/gdev.YOUR_DOMAIN` put (you can probably do simpler) :
```
server {
......@@ -55,7 +59,7 @@ and replace `YOUR_DOMAIN` by your domain each time.
if you don't already have a wildcard certificate.
- `service nginx reload`
Your node is now online as a mirror node. It's fully capable for wallet use.
Your node is now online as a rpc node. It's fully capable for wallet use.
To go further, read [How to become a (black)smith](./smith.md)
......
......@@ -3,14 +3,19 @@
## Publish a node
### Duniter part
- Add this docker-compose on your server :
[docker/compose/gdev-validator.docker-compose.yml](https://git.duniter.org/nodes/rust/duniter-v2s/-/blob/master/docker/compose/gdev-validator.docker-compose.yml)
- Edit lines 26 and 51 : `/ip4/SERVER_IP/tcp/30333/p2p/PEER_ID`
with your IP or domain an the PEER_ID you get using te command in comment.
- Create a `.env` file that define environment variables `SERVER_DOMAIN`, `PEER_ID` and `VALIDATOR_PEER_ID`:
- `SERVER_DOMAIN`: a domain name that point on your server
- `PEER_ID`: Your rpc node peer id, shoud be generated with this command: `docker run --rm -it --entrypoint -v $PWD:/var/lib/duniter/ duniter duniter/duniter-v2s:v0.1.0 key generate-node-key --file /var/lib/duniter/rpc-node.key`
- `VALIDATOR_PEER_ID`: Your validator node peer id, shoud be generated with this command: `docker run --rm -it --entrypoint -v $PWD:/var/lib/duniter/ duniter duniter/duniter-v2s:v0.1.0 key generate-node-key --file /var/lib/duniter/validator-node.key`
Note: duniter-rpc PEER_ID and duniter-validator PEER_ID isn't the same.
- If you have write access errors run in docker-compose.yml folder : `chmod o+rwX -R .`
- `docker-compose up -d` to start your node
### Reverse-proxy part (with Nginx)
In `/etc/nginx/sites-enabled/gdev.YOUR_DOMAIN` put (you can probably do simpler) :
```
server {
......@@ -56,9 +61,10 @@ and replace `YOUR_DOMAIN` by your domain each time.
if you don't already have a wildcard certificate.
- `service nginx reload`
Your node is now online as a mirror node. It's fully capable for wallet use.
Your node is now online as a rpc node. It's fully capable for wallet use.
## Join the Smith WoT
- add polkadot webextension to be able to authentificate with your account.
- Go to [any node with polkadotjs ui](https://gdev.1000i100.fr/dev-ui/?rpc=wss://gdev.1000i100.fr/ws)
- Ask to join Smith WoT (you need to already be in the main WoT)
......@@ -70,8 +76,6 @@ Your node is now online as a mirror node. It's fully capable for wallet use.
When you have at least 3 certifications, your'in !
## Validate blocks (blacksmith work)
- Generate and publish your session keys
......@@ -85,6 +89,7 @@ When you have at least 3 certifications, your'in !
- In the UI : developer > extrinsics > YOUR_SMITH_ACCOUNT > authorityMembers > goOnline()
If you're not able to monitor, reboot, act on your node, goOffline() to avoid penality to the blockchain and to you.
## Upgrade your node with minimal interruption
1. Modify docker image tag on your compose file
......
......@@ -7,7 +7,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
......@@ -266,7 +266,7 @@ pub fn run() -> sc_cli::Result<()> {
}
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
You can enable it with `--features runtime-benchmarks`."
.into())
}
}
......
......@@ -545,10 +545,10 @@ where
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
let slot =
sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration(
*timestamp,
slot_duration,
);
sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration(
*timestamp,
slot_duration,
);
Ok((timestamp, slot, uncles))
}
......
......@@ -61,16 +61,16 @@ impl From<Arc<super::FullClient<gdev_runtime::RuntimeApi, super::GDevExecutor>>>
}
macro_rules! match_client {
($self:ident, $method:ident($($param:ident),*)) => {
match $self {
#[cfg(feature = "g1")]
Self::G1(client) => client.$method($($param),*),
#[cfg(feature = "gtest")]
Self::GTest(client) => client.$method($($param),*),
#[cfg(feature = "gdev")]
Self::GDev(client) => client.$method($($param),*),
}
};
($self:ident, $method:ident($($param:ident),*)) => {
match $self {
#[cfg(feature = "g1")]
Self::G1(client) => client.$method($($param),*),
#[cfg(feature = "gtest")]
Self::GTest(client) => client.$method($($param),*),
#[cfg(feature = "gdev")]
Self::GDev(client) => client.$method($($param),*),
}
};
}
impl sc_client_api::UsageProvider<Block> for Client {
......
......@@ -17,14 +17,14 @@ std = [
'frame-support/std',
'frame-system/std',
'frame-benchmarking/std',
'log/std',
'log/std',
'pallet-session/std',
'serde',
'sp-core/std',
'sp-membership/std',
'sp-runtime/std',
'sp-staking/std',
'sp-std/std',
'sp-staking/std',
'sp-std/std',
]
try-runtime = ['frame-support/try-runtime']
......
......@@ -20,7 +20,7 @@ std = [
'serde',
'sp-core/std',
'sp-runtime/std',
'sp-std/std',
'sp-std/std',
]
try-runtime = ['frame-support/try-runtime']
......
......@@ -335,6 +335,11 @@ pub mod pallet {
Self::do_add_cert(block_number, create, issuer, receiver)
}
/// Add a new certification or renew an existing one
///
/// - `receiver`: the account receiving the certification from the origin
///
/// The origin must be allow to certify.
#[pallet::weight(1_000_000_000)]
pub fn add_cert(
origin: OriginFor<T>,
......
......@@ -24,7 +24,7 @@ std = [
'sp-core/std',
'sp-io/std',
'sp-runtime/std',
'sp-std/std',
'sp-std/std',
]
try-runtime = ['frame-support/try-runtime']
......
......@@ -191,9 +191,9 @@ pub mod pallet {
);
T::OnUnbalanced::on_unbalanced(imbalance);
let request_id = pallet_provide_randomness::Pallet::<T>::force_request(
pallet_provide_randomness::RandomnessType::RandomnessFromTwoEpochsAgo,
H256(T::AccountIdToSalt::convert(account_id.clone())),
);
pallet_provide_randomness::RandomnessType::RandomnessFromTwoEpochsAgo,
H256(T::AccountIdToSalt::convert(account_id.clone())),
);
PendingRandomIdAssignments::<T>::insert(request_id, account_id);
total_weight += 200_000;
}
......
......@@ -18,7 +18,7 @@ std = [
'frame-benchmarking/std',
'serde',
"sp-io/std",
"sp-std/std",
"sp-std/std",
]
try-runtime = ['frame-support/try-runtime']
......
......@@ -25,7 +25,7 @@ std = [
'sp-io/std',
'sp-membership/std',
'sp-runtime/std',
'sp-std/std',
'sp-std/std',
]
try-runtime = ['frame-support/try-runtime']
......
......@@ -41,7 +41,7 @@ fn test_creator_not_allowed_to_create_idty() {
new_test_ext(3, 2).execute_with(|| {
run_to_block(1);
// Alice should not be able te create an identity before block #2
// Alice should not be able to create an identity before block #2
// because Alice.next_issuable_on = 2
assert_err!(
Identity::create_identity(Origin::signed(1), 4),
......@@ -55,7 +55,7 @@ fn test_join_smiths() {
new_test_ext(5, 3).execute_with(|| {
run_to_block(2);
// Dave shoud be able to requst smith membership
// Dave shoud be able to request smith membership
assert_ok!(SmithsMembership::request_membership(
Origin::signed(4),
crate::MembershipMetaData(4)
......@@ -73,20 +73,20 @@ fn test_revoke_smiths_them_rejoin() {
new_test_ext(5, 4).execute_with(|| {
run_to_block(2);
// Dave shoud be able to revoke is smith membership
// Dave shoud be able to revoke his smith membership
assert_ok!(SmithsMembership::revoke_membership(
Origin::signed(4),
Some(4)
));
// Dave should not be able te re-request membership before the RevocationPeriod end
// Dave should not be able to re-request membership before the RevocationPeriod end
run_to_block(3);
assert_err!(
SmithsMembership::request_membership(Origin::signed(4), crate::MembershipMetaData(4)),
pallet_membership::Error::<Test, crate::Instance2>::MembershipRevokedRecently
);
// At bloc #6, Dave shoud be able to request smith membership
// At block #6, Dave shoud be able to request smith membership
run_to_block(6);
assert_ok!(SmithsMembership::request_membership(
Origin::signed(4),
......@@ -103,7 +103,7 @@ fn test_create_idty_ok() {
new_test_ext(5, 2).execute_with(|| {
run_to_block(2);
// Alice should be able te create an identity at block #2
// Alice should be able to create an identity at block #2
assert_ok!(Identity::create_identity(Origin::signed(1), 6));
// 2 events should have occurred: IdtyCreated and NewCert
let events = System::events();
......@@ -140,11 +140,11 @@ fn test_create_idty_ok() {
#[test]
fn test_new_idty_validation() {
new_test_ext(5, 2).execute_with(|| {
// Alice create Ferdie identity
// Alice creates Ferdie identity
run_to_block(2);
assert_ok!(Identity::create_identity(Origin::signed(1), 6));
// Ferdie confirm it's identity
// Ferdie confirms his identity
run_to_block(3);
assert_ok!(Identity::confirm_identity(
Origin::signed(6),
......@@ -207,12 +207,12 @@ fn test_confirm_idty_ok() {
new_test_ext(5, 2).execute_with(|| {
run_to_block(2);
// Alice create Ferdie identity
// Alice creates Ferdie identity
assert_ok!(Identity::create_identity(Origin::signed(1), 6));
run_to_block(3);
// Ferdie should be able to confirm it's identity
// Ferdie should be able to confirm his identity
assert_ok!(Identity::confirm_identity(
Origin::signed(6),
IdtyName::from("Ferdie"),
......@@ -249,9 +249,9 @@ fn test_idty_membership_expire_them_requested() {
new_test_ext(3, 2).execute_with(|| {
run_to_block(4);
// Alice renew her membership
// Alice renews her membership
assert_ok!(Membership::renew_membership(Origin::signed(1), None));
// Bob renew his membership
// Bob renews his membership
assert_ok!(Membership::renew_membership(Origin::signed(2), None));
// Charlie's membership should expire at block #8
......@@ -280,7 +280,7 @@ fn test_idty_membership_expire_them_requested() {
// Charlie's identity should be removed at block #8
assert!(Identity::identity(3).is_none());
// Alice can't renew it's cert to Charlie
// Alice can't renew her cert to Charlie
assert_err!(
Cert::add_cert(Origin::signed(1), 3),
pallet_certification::Error::<Test, Instance1>::ReceiverNotFound
......
......@@ -20,7 +20,7 @@ std = [
'serde',
'sp-core/std',
'sp-runtime/std',
'sp-std/std',
'sp-std/std',
]
try-runtime = ['frame-support/try-runtime']
......