Skip to content

Commit

Permalink
Fix nouse btreeset (#87)
Browse files Browse the repository at this point in the history
* Public chainspec for testnet v2
* Bump runtime version
* Switch current implementation to v0.6.1 in README
* fix docekr (#86)

* Fix substrate commit at plasm-v0.6.1

* fix docker make

* change btree to vec

* passed merge master

* only use latest nightly build

* fix not need nightly

* use stable plsm-cli
  • Loading branch information
satellitex authored Dec 6, 2019
1 parent 353b09e commit 3be805b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 33 deletions.
52 changes: 26 additions & 26 deletions bin/node/cli/res/testnet_v2.json

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions frame/operator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![cfg_attr(not(feature = "std"), no_std)]

use contract::{BalanceOf, CodeHash, ContractAddressFor, Gas};
use rstd::collections::btree_set::BTreeSet;
use sp_runtime::traits::{MaybeDisplay, MaybeSerialize, Member};
use support::{decl_event, decl_module, decl_storage, dispatch::Result, Parameter};
use system::{ensure_signed, RawOrigin};
Expand Down Expand Up @@ -31,7 +30,7 @@ pub trait Trait: contract::Trait {
decl_storage! {
trait Store for Module<T: Trait> as Operator {
/// A mapping from operators to operated contracts by them.
pub OperatorHasContracts: map T::AccountId => BTreeSet<T::AccountId>;
pub OperatorHasContracts: map T::AccountId => Vec<T::AccountId>;
/// A mapping from operated contract by operator to it.
pub ContractHasOperator: map T::AccountId => Option<T::AccountId>;
/// A mapping from contract to it's parameters.
Expand Down Expand Up @@ -62,7 +61,7 @@ decl_module! {
contract::Module::<T>::instantiate(RawOrigin::Signed(operator.clone()).into(), endowment, gas_limit, code_hash, data)?;

// add operator to contracts
<OperatorHasContracts<T>>::mutate(&operator, {|tree| (*tree).insert(contract.clone()) });
<OperatorHasContracts<T>>::mutate(&operator, {|tree| (*tree).push(contract.clone()) });
// add contract to operator
<ContractHasOperator<T>>::insert(&contract, operator.clone());
// add contract to parameters
Expand Down Expand Up @@ -106,11 +105,11 @@ decl_module! {

// remove origin operator to contracts
<OperatorHasContracts<T>>::mutate(&operator,
|tree| for c in contracts.iter() { (*tree).remove(c); }
);
|tree| *tree = tree.iter().filter(|&x| !contracts.contains(x)).cloned().collect());

// add new_operator to contracts
<OperatorHasContracts<T>>::mutate(&new_operator,
|tree| for c in contracts.iter() { (*tree).insert(c.clone()); }
|tree| for c in contracts.iter() { (*tree).push(c.clone()); }
);
for c in contracts.iter() {
// add contract to new_operator
Expand Down
2 changes: 1 addition & 1 deletion third-party/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CHILD_NODE_DIR := $(shell git rev-parse --show-toplevel)/child

.PHONY: docker-build
docker-build:
docker run -it -v $(shell pwd)/../..:/opt stakedtechnologies/plasm-builder cargo build -p plasm-cli --target-dir third-party/docker/target-debian --release
docker run -it -v $(shell pwd)/../..:/opt stakedtechnologies/plasm-builder cargo build --target-dir third-party/docker/target-debian --release
docker build . -t stakedtechnologies/plasm-node

.PHONY: docker-push
Expand Down

0 comments on commit 3be805b

Please sign in to comment.