This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Introduce basic skeleton for Polkadot runtime. #32
Merged
Merged
Changes from 1 commit
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
36c171c
Introduce basic skeleton for Polkador runtime.
gavofyork f79b7bb
Clean up the runtime skeleton.
gavofyork b48e053
Make initial runtime skeleton compile.
gavofyork 4e25b24
Compile polkadot-runtime both for Wasm ad native, allowing for testin…
gavofyork b28402c
More fleshing out on runtime.
gavofyork bac50a4
Update native support.
gavofyork 9a4360f
Fix warning.
gavofyork 0890e72
Update gitignore
gavofyork 4cf5fd1
Update path.
gavofyork 12b15fd
Fix path.
gavofyork 47260c2
Remove accidentally committed files.
gavofyork 800eb20
Add wasm binaries.
gavofyork 10eaefe
Fix test.
gavofyork 24ba809
Native storage support API.
gavofyork 36a49ff
Add environmental module
gavofyork 50e7222
Add native environment to make native source-code compatible with wasm.
gavofyork 3e17caa
Finish up & polish environment stuff.
gavofyork e807c9a
Avoid using reentrancy issues.
gavofyork 402ae29
Add some docs and a test.
gavofyork 762826b
Remove unneeded function.
gavofyork 7e969c8
Documentation
gavofyork 64b0670
Tweak docs
gavofyork d34f62a
Remove TODOs.
gavofyork 89f35e3
Balance transfers + util methods.
gavofyork 5e42240
Rejig tests and ensure authorities are addressed consistently.
gavofyork d97e2d6
Add marshaller for xfer function
gavofyork 26ccc14
Transaction dispatch test.
gavofyork 7258e1f
Minor fix.
gavofyork c02e335
Add test for ser/de transaction.
gavofyork 28fa761
Add ser/de for header.
gavofyork cd93a37
Add tests for header ser/de
gavofyork b55095a
Introduce basic block decoding/execution framework.
gavofyork 288f653
Introduce block decoding/execution framework (p2)
gavofyork c64976b
Big refactor.
gavofyork 40e28fc
Split out joiner.
gavofyork ab37f64
Hide away support modules.
gavofyork 4844086
Fix up wasm runtime.
gavofyork 28d775d
use externalities for chain_id
gavofyork 75cedd9
Clean up (Test)Externalities.
gavofyork 0feadc6
Repot and introduce keccak-256 external.
gavofyork 15ae775
Signing with crypto.
gavofyork 5650997
fix unsafety hole in environmental using function
rphmeier 7820149
Introduce Ed25519 crypto.
gavofyork 4ef4239
Repotting.
gavofyork 8fa858c
Merge branch 'signing-ring' into polkadot-runtime-skeleton
gavofyork 78a22d4
Add ed25519_verify external.
gavofyork 93f7aed
Introduce Ed25519 verify as an external.
gavofyork cdc1387
fix unsafety hole around unwinding
rphmeier 0477b7e
Compile fixes.
gavofyork 66c9384
use new environmental API
rphmeier 121aa0b
Merge branch 'polkadot-runtime-skeleton' into environmental-api
rphmeier eebc071
Tests for ed25519 verify.
gavofyork 5685173
Polish
gavofyork f3d415c
Introduce UncheckedTransaction & test.
gavofyork 2c9cb7b
Implement basic block and tx processing
gavofyork eda7d71
Introduce static hex and valid signature for block test.
gavofyork fd9d8dc
Merge pull request #35 from paritytech/environmental-api
gavofyork e8cd918
Repot session.
gavofyork 3d1ff94
comments.
gavofyork 92a12f0
Refactor and timestamp test
gavofyork 5523277
Remove fluff
gavofyork 39128b7
Merge branch 'polkadot-runtime-skeleton' of github.com:paritytech/pol…
gavofyork 9a8f61d
Remove fluff.
gavofyork 90f965a
Staking eras and tests.
gavofyork 58670fc
Implement sessions.
gavofyork 999025f
Polish
gavofyork 4fde6f0
Test sessions.
gavofyork 9c8cafd
Introduce better hashing.
gavofyork ae5a9c9
Fix tests.
gavofyork 639554c
Introduce staking.
gavofyork 0e88dad
Tests for simple staking system.
gavofyork 80aa38c
Build fix for wasm.
gavofyork ef5d78a
Fix tests.
gavofyork e068f44
Repotting and docs.
gavofyork 2499910
Docs and licence.
gavofyork 0c53f71
Documentation.
gavofyork 850f7ee
Remove superfluous code.
gavofyork dde319c
Remove dummy key.
gavofyork 17ef2d0
Remove other superfluous file.
gavofyork 8adb7c6
Optimise with swap_remove
gavofyork cbd65cb
Merge remote-tracking branch 'origin/master' into polkadot-runtime-sk…
gavofyork File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add environmental module
- Loading branch information
commit 36a49ffd58d6fbca37a06f8f26cb6023f3c4da42
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [package] | ||
| name = "environmental" | ||
| version = "0.1.0" | ||
| authors = ["Parity Technologies <[email protected]>"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| // Copyright 2017 Parity Technologies (UK) Ltd. | ||
| // This file is part of Polkadot. | ||
|
|
||
| // Polkadot is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // Polkadot is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| use std::cell::RefCell; | ||
| use std::thread::LocalKey; | ||
|
|
||
| pub fn using_environment<'a, T: 'a, S, F: FnOnce()>( | ||
| global: &'static LocalKey<RefCell<*mut S>>, | ||
| protected: &'a mut T, | ||
| f: F | ||
| ) { | ||
| global.with(|r| *r.borrow_mut() = protected as *mut T as *mut S); | ||
| f(); | ||
| global.with(|r| *r.borrow_mut() = 0 as *mut S); | ||
| } | ||
|
|
||
| pub fn with_environment<'r, S, T: 'r, F: FnOnce(&'r mut T)>( | ||
| global: &'static LocalKey<RefCell<*mut S>>, | ||
| mutator: F, | ||
| ) { | ||
| global.with(|r| { | ||
| let br = r.borrow_mut(); | ||
| if *br != 0 as *mut S { | ||
| // safe because it's only non-zero when it in with_environment, which | ||
| // is holding on to the underlying reference safely | ||
| unsafe { | ||
| mutator(&mut *(*br as *mut S as *mut T)); | ||
| } | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| #[macro_export] | ||
| macro_rules! decl_environment { | ||
| ($name:ident : $t:ty) => { | ||
| thread_local! { | ||
| static $name: std::cell::RefCell<*mut $t> = std::cell::RefCell::new(0 as *mut $t); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[macro_export] | ||
| macro_rules! declare_generic_environment { | ||
| ($name:ident : $t:tt) => { | ||
| mod $name { | ||
| use super::*; | ||
|
|
||
| decl_environment!(GLOBAL: $t<'static> ); | ||
|
|
||
| pub fn using<'a: 'b, 'b, F: FnOnce(), T: 'a>(protected: &'b mut T, f: F) { | ||
| $crate::using_environment(&GLOBAL, protected, f); | ||
| } | ||
|
|
||
| pub fn with<F: for<'r, 't: 'r> FnOnce(&'r mut $t<'t>)>(f: F) { | ||
| let dummy = (); | ||
| with_closed(f, &dummy); | ||
| } | ||
|
|
||
| fn with_closed<'d: 't, 't: 'r, 'r, F: FnOnce(&'r mut $t<'t>)>( | ||
| f: F, | ||
| _dummy: &'d (), | ||
| ) { | ||
| $crate::with_environment(&GLOBAL, f); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[macro_export] | ||
| macro_rules! declare_simple_environment { | ||
| ($name:ident : $t:tt) => { | ||
| mod $name { | ||
| use super::*; | ||
|
|
||
| decl_environment!(GLOBAL: $t ); | ||
|
|
||
| pub fn using<'a: 'b, 'b, F: FnOnce(), T: 'a>(protected: &'b mut T, f: F) { | ||
| $crate::using_environment(&GLOBAL, protected, f); | ||
| } | ||
|
|
||
| pub fn with<F: for<'r> FnOnce(&'r mut $t)>(f: F) { | ||
| let dummy = (); | ||
| with_closed(f, &dummy); | ||
| } | ||
|
|
||
| fn with_closed<'d: 'r, 'r, F: FnOnce(&'r mut $t)>( | ||
| f: F, | ||
| _dummy: &'d (), | ||
| ) { | ||
| $crate::with_environment(&GLOBAL, f); | ||
| } | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
$t:ty, otherwise you can't use types whose names are multiple tokens likeVec<u8>