Rename more things related to contract instantiation (#3664)

* Rename more things related to contract instantiation

* rename `creator_ch`

* Fix node runtime

* fix contracts tests

* Little fix
This commit is contained in:
Ashley
2019-09-23 21:32:44 +12:00
committed by Sergei Pepyakin
parent e0b3564f2d
commit 0a469666c1
8 changed files with 117 additions and 114 deletions
+11 -11
View File
@@ -69,7 +69,7 @@ impl_outer_dispatch! {
thread_local! {
static EXISTENTIAL_DEPOSIT: RefCell<u64> = RefCell::new(0);
static TRANSFER_FEE: RefCell<u64> = RefCell::new(0);
static CREATION_FEE: RefCell<u64> = RefCell::new(0);
static INSTANTIATION_FEE: RefCell<u64> = RefCell::new(0);
static BLOCK_GAS_LIMIT: RefCell<u64> = RefCell::new(0);
}
@@ -85,7 +85,7 @@ impl Get<u64> for TransferFee {
pub struct CreationFee;
impl Get<u64> for CreationFee {
fn get() -> u64 { CREATION_FEE.with(|v| *v.borrow()) }
fn get() -> u64 { INSTANTIATION_FEE.with(|v| *v.borrow()) }
}
pub struct BlockGasLimit;
@@ -155,7 +155,7 @@ parameter_types! {
pub const TransactionByteFee: u64 = 6;
pub const ContractFee: u64 = 21;
pub const CallBaseFee: u64 = 135;
pub const CreateBaseFee: u64 = 175;
pub const InstantiateBaseFee: u64 = 175;
pub const MaxDepth: u32 = 100;
pub const MaxValueSize: u32 = 16_384;
}
@@ -179,7 +179,7 @@ impl Trait for Test {
type TransactionByteFee = TransactionByteFee;
type ContractFee = ContractFee;
type CallBaseFee = CallBaseFee;
type CreateBaseFee = CreateBaseFee;
type InstantiateBaseFee = InstantiateBaseFee;
type MaxDepth = MaxDepth;
type MaxValueSize = MaxValueSize;
type BlockGasLimit = BlockGasLimit;
@@ -233,7 +233,7 @@ pub struct ExtBuilder {
gas_price: u64,
block_gas_limit: u64,
transfer_fee: u64,
creation_fee: u64,
instantiation_fee: u64,
}
impl Default for ExtBuilder {
fn default() -> Self {
@@ -242,7 +242,7 @@ impl Default for ExtBuilder {
gas_price: 2,
block_gas_limit: 100_000_000,
transfer_fee: 0,
creation_fee: 0,
instantiation_fee: 0,
}
}
}
@@ -263,14 +263,14 @@ impl ExtBuilder {
self.transfer_fee = transfer_fee;
self
}
pub fn creation_fee(mut self, creation_fee: u64) -> Self {
self.creation_fee = creation_fee;
pub fn instantiation_fee(mut self, instantiation_fee: u64) -> Self {
self.instantiation_fee = instantiation_fee;
self
}
pub fn set_associated_consts(&self) {
EXISTENTIAL_DEPOSIT.with(|v| *v.borrow_mut() = self.existential_deposit);
TRANSFER_FEE.with(|v| *v.borrow_mut() = self.transfer_fee);
CREATION_FEE.with(|v| *v.borrow_mut() = self.creation_fee);
INSTANTIATION_FEE.with(|v| *v.borrow_mut() = self.instantiation_fee);
BLOCK_GAS_LIMIT.with(|v| *v.borrow_mut() = self.block_gas_limit);
}
pub fn build(self) -> runtime_io::TestExternalities<Blake2Hasher> {
@@ -651,7 +651,7 @@ fn dispatch_call_not_dispatched_after_top_level_transaction_failure() {
vec![],
));
// Call the newly created contract. The contract is expected to dispatch a call
// Call the newly instantiated contract. The contract is expected to dispatch a call
// and then trap.
assert_err!(
Contract::call(
@@ -1225,7 +1225,7 @@ const CODE_CHECK_DEFAULT_RENT_ALLOWANCE: &str = r#"
"#;
#[test]
fn default_rent_allowance_on_create() {
fn default_rent_allowance_on_instantiate() {
let (wasm, code_hash) = compile_module::<Test>(CODE_CHECK_DEFAULT_RENT_ALLOWANCE).unwrap();
with_externalities(