Skip to content

Commit 94a3b37

Browse files
author
Joshua Mir
committed
instantseal node working
1 parent 2ce5b37 commit 94a3b37

File tree

4 files changed

+19
-27
lines changed

4 files changed

+19
-27
lines changed

datdot-node/node/Cargo.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,10 @@ repository = 'https://github.com/substrate-developer-hub/recipes'
77
description = 'An instant-sealing Substrate node for datdot. Based on the substrate kitchen-node.'
88
license = "GPL-3.0-or-later"
99

10-
[package.metadata.substrate]
11-
categories = [
12-
"Node",
13-
"Instant Seal",
14-
"tutorial",
15-
"recipe",
16-
]
1710
compatibility_version = "2.0.0-rc3"
1811

1912
[[bin]]
20-
name = "kitchen-node"
13+
name = "datdot-node"
2114
path = "src/main.rs"
2215

2316
[dependencies]

datdot-node/pallets/datdot/src/lib.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ decl_module!{
433433
const AttestorsPerChallenge: u32 = T::AttestorsPerChallenge::get();
434434
const ChallengeDelay: u32 = T::ChallengeDelay::get();
435435

436-
#[weight = (10000, Operational, Pays::No)] //todo weight
436+
#[weight = (100000, Operational, Pays::No)] //todo weight
437437
fn force_clear_challenge(origin, user_index: u64, dat_index: u64, chunk_index: u64){
438438
T::ForceOrigin::try_origin(origin)
439439
.map(|_| ())
@@ -445,7 +445,7 @@ decl_module!{
445445
//test things progressively, doing quicker computations first.
446446
//gutted temporarily to demonstrate datdot flow.
447447
//we should manually verify proof from raw bits.
448-
#[weight = (10000, Operational, Pays::No)] //todo weight
448+
#[weight = (100000, Operational, Pays::No)] //todo weight
449449
fn submit_proof(origin, dat_index: u64, chunk_index:u64, _proof: Vec<u8>) {
450450
let account = ensure_signed(origin)?;
451451
let user_index = <UserIndices<T>>::get(&account);
@@ -461,7 +461,7 @@ decl_module!{
461461

462462

463463
/// Submit or update a piece of data that you want to have users copy, optionally provide chunk for execution.
464-
#[weight = (10000, Pays::No)]
464+
#[weight = (100000, Pays::No)]
465465
fn register_data(origin, merkle_root: (Public, TreeHashPayload, H512)) {
466466
let account = ensure_signed(origin)?;
467467
let pubkey = merkle_root.0;
@@ -487,7 +487,7 @@ decl_module!{
487487
}
488488

489489
//debug method when you don't have valid data for register_data, no validity checks, only root.
490-
#[weight = (10000, Pays::No)]
490+
#[weight = (100000, Pays::No)]
491491
fn force_register_data(
492492
origin,
493493
account: T::AccountId,
@@ -501,7 +501,7 @@ decl_module!{
501501
}
502502

503503
//user stops requesting others pin their data
504-
#[weight = (10000, Pays::No)]
504+
#[weight = (100000, Pays::No)]
505505
fn unregister_data(origin, index: DatIdIndex){
506506
let account = ensure_signed(origin)?;
507507
let pubkey = <DatKey>::get(index);
@@ -537,7 +537,7 @@ decl_module!{
537537
}
538538

539539

540-
#[weight = (10000, Pays::No)]
540+
#[weight = (100000, Pays::No)]
541541
fn register_attestor(origin){
542542
let account = ensure_signed(origin)?;
543543
// if already active, stop here. (if any active attestor matches. shortcircuit)
@@ -566,41 +566,41 @@ decl_module!{
566566
}
567567
}
568568

569-
#[weight = (10000, Pays::No)]
569+
#[weight = (100000, Pays::No)]
570570
fn register_encoder(origin){
571571
let account = ensure_signed(origin)?;
572572

573573
}
574574

575-
#[weight = (10000, Pays::No)]
575+
#[weight = (100000, Pays::No)]
576576
fn unregister_encoder(origin){
577577
let account = ensure_signed(origin)?;
578578

579579
}
580580

581-
#[weight = (10000, Pays::No)]
581+
#[weight = (100000, Pays::No)]
582582
fn register_encoding(origin, hoster_id: u64, dat_id: u64, start: u64, range: u64){
583583
let account = ensure_signed(origin)?;
584584
// TODO: register encoding and begin challenge phase
585585
// TODO: selected_hoster AND selected_encoder must register_encoding
586586
}
587587

588588

589-
#[weight = (10000, Pays::No)]
589+
#[weight = (100000, Pays::No)]
590590
fn refute_encoding(origin, archive: u64, index: u64, encoded: Vec<u8>, proof: Vec<u8>){
591591
//TODO
592592
//remove an invalid encoding if `encoded` is
593593
//signed by `encoder` and `proof` does not match encoded chunk.
594594
}
595595

596-
#[weight = (10000, Pays::No)]
596+
#[weight = (100000, Pays::No)]
597597
fn confirm_hosting(origin, archive: u64){
598598
//TODO
599599
//move a valid encoding to `encoded` if `encoded` is
600600
//signed by `encoder` and `proof` does match encoded chunk.
601601
}
602602

603-
#[weight = (10000, Pays::No)]
603+
#[weight = (100000, Pays::No)]
604604
fn submit_attestation(
605605
origin,
606606
hoster_index: u64,
@@ -611,7 +611,7 @@ decl_module!{
611611
let attestor = ensure_signed(origin)?;
612612
}
613613

614-
#[weight = (10000, Pays::No)]
614+
#[weight = (100000, Pays::No)]
615615
fn unregister_attestor(origin){
616616
let account = ensure_signed(origin)?;
617617
for (user_index, user_account) in <Attestors<T>>::iter(){
@@ -644,7 +644,7 @@ decl_module!{
644644
}
645645

646646
// User requests a dat for them to pin. FIXME: May return a dat they are already pinning.
647-
#[weight = (10000, Pays::No)]
647+
#[weight = (100000, Pays::No)]
648648
fn register_seeder(origin) {
649649
//TODO: bias towards unseeded dats and high incentive
650650
let account = ensure_signed(origin)?;
@@ -694,7 +694,7 @@ decl_module!{
694694
}
695695

696696

697-
#[weight = (10000, Pays::No)]
697+
#[weight = (100000, Pays::No)]
698698
fn unregister_seeder(origin) {
699699
let account = ensure_signed(origin)?;
700700
let user_id = <UserIndices<T>>::get(account);
@@ -703,7 +703,7 @@ decl_module!{
703703
}
704704

705705

706-
#[weight = (10000, Operational, Pays::No)] //todo weight
706+
#[weight = (100000, Operational, Pays::No)] //todo weight
707707
fn submit_challenge(_origin, selected_user: u64, dat_id: u64){
708708
let hosted_map = <HostedMap>::get(selected_user, dat_id);
709709
// TODO: verify has encoded and block if encoding is not complete.
@@ -722,7 +722,7 @@ decl_module!{
722722
Self::deposit_event(RawEvent::Challenge(selected_user_key, dat_pubkey));
723723
}
724724

725-
#[weight = (100000, Operational, Pays::No)] //todo
725+
#[weight = (1000000, Operational, Pays::No)] //todo
726726
fn submit_scheduled_challenge(
727727
origin,
728728
selected_user: u64,

datdot-node/runtime/aggregate_types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const fs = require('fs');
77
// Does not include system pallets because Apps already supports them.
88
// Redundant with construct_runtime!
99
const pallets = [
10-
"weights",
1110
"dat_verify"
1211
]
1312

datdot-node/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
105105
spec_name: create_runtime_str!("datdot-runtime"),
106106
impl_name: create_runtime_str!("datdot-runtime"),
107107
authoring_version: 1,
108-
spec_version: 1,
108+
spec_version: 3,
109109
impl_version: 1,
110110
apis: RUNTIME_API_VERSIONS,
111111
transaction_version: 1,

0 commit comments

Comments
 (0)