Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3556df3
implement index for pallet + some tests
gui1117 Aug 26, 2020
766f510
add test and doc
gui1117 Sep 1, 2020
d246bdf
remove deprecated and document behavior
gui1117 Sep 1, 2020
11a3af2
update internal doc
gui1117 Sep 1, 2020
ce2d1bd
Apply suggestions from code review
gui1117 Sep 7, 2020
b56cbd7
address review
gui1117 Sep 7, 2020
da702ae
use index for all module, break construct_runtime
gui1117 Sep 8, 2020
0290c47
fix line length
gui1117 Sep 8, 2020
82e36e4
Merge remote-tracking branch 'origin/master' into gui-construct-runti…
gui1117 Sep 9, 2020
6c8e80a
implement migration helper funciton in scheduler
gui1117 Sep 9, 2020
4e5b4f8
fix start at index 0
gui1117 Sep 9, 2020
95a1eb7
Update frame/scheduler/src/lib.rs
gui1117 Sep 10, 2020
9518e5b
Merge remote-tracking branch 'origin/master' into gui-construct-runti…
gui1117 Sep 10, 2020
a830e2f
Update frame/support/procedural/src/lib.rs
gui1117 Sep 16, 2020
9812da2
bump frame-metadata crate
gui1117 Sep 16, 2020
5d86201
factorize
gui1117 Sep 16, 2020
078a543
avoid some unwrap and remove nightly join
gui1117 Sep 16, 2020
4bba712
Update frame/support/src/event.rs
gui1117 Sep 16, 2020
c6f073b
fix test
gui1117 Sep 16, 2020
43856fd
add test and improve error message
gui1117 Sep 16, 2020
7da2738
factorize test
gui1117 Sep 16, 2020
b9fca7e
keep iterator, and use slice instead of vec
gui1117 Sep 16, 2020
61019e7
refactor to avoid to have expects
gui1117 Sep 16, 2020
a9d454a
Merge remote-tracking branch 'origin/master' into gui-construct-runti…
gui1117 Sep 16, 2020
ae0f859
small refactor
gui1117 Sep 16, 2020
85a65f2
Test something
bkchr Sep 17, 2020
ab0c998
Make sure we update the `Cargo.lock`
bkchr Sep 17, 2020
fda8a1a
Apply suggestions from code review
gui1117 Sep 18, 2020
95ef421
return 2 error
gui1117 Sep 18, 2020
68b472e
Apply suggestions from code review
gui1117 Sep 21, 2020
21510d4
Merge remote-tracking branch 'origin/master' into gui-construct-runti…
gui1117 Sep 21, 2020
6feb460
Update frame/scheduler/src/lib.rs
gui1117 Sep 21, 2020
f2de8f2
fix typo
gui1117 Sep 21, 2020
3f38e1a
Revert "fix typo"
gui1117 Sep 21, 2020
492a83f
Revert "Update frame/scheduler/src/lib.rs"
gui1117 Sep 21, 2020
d04f8cd
Merge remote-tracking branch 'origin/master' into gui-construct-runti…
gui1117 Sep 22, 2020
986155b
Merge remote-tracking branch 'origin/master' into gui-construct-runti…
gui1117 Sep 22, 2020
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
Prev Previous commit
Next Next commit
fix start at index 0
  • Loading branch information
gui1117 committed Sep 9, 2020
commit 4e5b4f838b2790e3478b69d1ad65d8b1126a5830
9 changes: 5 additions & 4 deletions frame/support/procedural/src/construct_runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,22 +447,23 @@ fn decl_integrity_test(scrate: &TokenStream2) -> TokenStream2 {
/// I.e. implicit are assigned number incrementedly from last explicit or 0.
fn assign_implicit_index(modules: &mut Vec<ModuleDeclaration>) -> syn::Result<()> {
let mut indices = HashMap::new();
let mut last_index: u8 = 0;
let mut last_index: Option<u8> = None;

for module in modules {
match module.index {
Some(index) => {
last_index = index;
last_index = Some(index);
},
None => {
last_index = match last_index.checked_add(1) {
let index = match last_index.map_or(Some(0), |i| i.checked_add(1)) {
Some(i) => i,
None => {
let msg = "module index doesn't fit into u8, index is 256";
return Err(syn::Error::new(module.module.span(), msg));
},
};
module.index = Some(last_index);
module.index = Some(index);
last_index = Some(index);
},
}

Expand Down