Skip to content

Commit

Permalink
refactor(generator): rename to allowlist according to reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroqn authored and jjyr committed Oct 26, 2021
1 parent 32eab74 commit f60a1f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use gw_common::H256;
use gw_types::offchain::RunResult;
use log::debug;

pub struct SUDTProxyAccountWhitelist {
pub struct SUDTProxyAccountAllowlist {
allowed_sudt_proxy_creator_account_id: Vec<u32>,
sudt_proxy_code_hashes: Vec<H256>,
}

impl SUDTProxyAccountWhitelist {
impl SUDTProxyAccountAllowlist {
pub fn new(
allowed_sudt_proxy_creator_account_id: Vec<u32>,
sudt_proxy_code_hashes: Vec<H256>,
Expand All @@ -18,7 +18,7 @@ impl SUDTProxyAccountWhitelist {
}
}

/// Only accounts in white list could create sUDT proxy contract.
/// Only accounts in allow list could create sUDT proxy contract.
pub fn validate(&self, run_result: &RunResult, from_id: u32) -> bool {
if self.allowed_sudt_proxy_creator_account_id.is_empty()
|| self.sudt_proxy_code_hashes.is_empty()
Expand All @@ -38,7 +38,7 @@ impl SUDTProxyAccountWhitelist {

for k in run_result.write_data.keys() {
debug!(
"whiltelist: from_id: {:?}, code_hash: {:?}",
"allowlist: from_id: {:?}, code_hash: {:?}",
&from_id,
hex::encode(k.as_slice())
);
Expand All @@ -53,7 +53,7 @@ impl SUDTProxyAccountWhitelist {
}
}

impl Default for SUDTProxyAccountWhitelist {
impl Default for SUDTProxyAccountAllowlist {
fn default() -> Self {
Self {
allowed_sudt_proxy_creator_account_id: vec![],
Expand Down
6 changes: 3 additions & 3 deletions crates/generator/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
account_lock_manage::AccountLockManage,
backend_manage::BackendManage,
constants::{L2TX_MAX_CYCLES, MAX_READ_DATA_BYTES_LIMIT, MAX_WRITE_DATA_BYTES_LIMIT},
erc20_creator_whitelist::SUDTProxyAccountWhitelist,
erc20_creator_allowlist::SUDTProxyAccountAllowlist,
error::{BlockError, TransactionValidateError, WithdrawalError},
vm_cost_model::instruction_cycles,
};
Expand Down Expand Up @@ -94,7 +94,7 @@ pub struct Generator {
backend_manage: BackendManage,
account_lock_manage: AccountLockManage,
rollup_context: RollupContext,
sudt_proxy_account_whitelist: SUDTProxyAccountWhitelist,
sudt_proxy_account_whitelist: SUDTProxyAccountAllowlist,
polyjuice_contract_creator_allowlist: Option<PolyjuiceContractCreatorAllowList>,
}

Expand All @@ -108,7 +108,7 @@ impl Generator {
let polyjuice_contract_creator_allowlist =
PolyjuiceContractCreatorAllowList::from_rpc_config(&rpc_config);

let sudt_proxy_account_whitelist = SUDTProxyAccountWhitelist::new(
let sudt_proxy_account_whitelist = SUDTProxyAccountAllowlist::new(
rpc_config.allowed_sudt_proxy_creator_account_id,
rpc_config
.sudt_proxy_code_hashes
Expand Down
2 changes: 1 addition & 1 deletion crates/generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub mod account_lock_manage;
pub mod backend_manage;
pub mod constants;
pub mod dummy_state;
pub mod erc20_creator_whitelist;
pub mod erc20_creator_allowlist;
pub mod error;
pub mod generator;
pub mod genesis;
Expand Down

0 comments on commit f60a1f0

Please sign in to comment.