Skip to content

Commit

Permalink
remove op_codes of ZkLinkTxType, fix params
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred0327 committed Nov 2, 2023
1 parent d22308c commit 60b586f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
1 change: 1 addition & 0 deletions signers/src/zklink_signer/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ fn get_bits_le_fixed(fr: &Fr, size: usize) -> Vec<bool> {
}

pub fn rescue_hash_orders(msg: &[u8]) -> Vec<u8> {
assert_eq!(msg.len(), 178);
let msg_bits = bytes_into_be_bits(msg);
let hash_fr = rescue_hash_fr(msg_bits);
let hash_bits = get_bits_le_fixed(&hash_fr, 248);
Expand Down
2 changes: 1 addition & 1 deletion types/src/basic_types/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub const USED_BALANCE_SUBTREE_DEPTH: usize = 8;
pub const TOTAL_ACCOUNT_NUMBER: usize = usize::pow(2, USED_ACCOUNT_SUBTREE_DEPTH as u32);
pub const MAX_ACCOUNT_ID: AccountId = AccountId(TOTAL_ACCOUNT_NUMBER as u32 - 1);
/// The total token number and maximum token id allowed for the current zklink layer2(if not enough, modify this parameter and update circuit).
pub const TOTAL_TOKEN_NUMBER: usize = usize::pow(2, USED_BALANCE_SUBTREE_DEPTH as u32);
pub const TOTAL_TOKEN_NUMBER: usize = 65536;
pub const MAX_TOKEN_ID: TokenId = TokenId(TOTAL_TOKEN_NUMBER as u32 - 1);
/// One slot is a leaf of order subtree, slot number = 2 ^ ORDER_SUB_TREE_DEPTH, max slot id = slot number - 1
pub const TOTAL_SLOT_NUMBER: usize = usize::pow(2, ORDER_SUB_TREE_DEPTH as u32);
Expand Down
19 changes: 0 additions & 19 deletions types/src/tx_type/zklink_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,6 @@ pub enum ZkLinkTxType {
UpdateGlobalVar,
}

impl ZkLinkTxType {
pub fn op_codes(&self) -> Vec<u8> {
match self {
ZkLinkTxType::Deposit => vec![Deposit::TX_TYPE],
ZkLinkTxType::Transfer => vec![Transfer::TX_TYPE],
ZkLinkTxType::Withdraw => vec![Withdraw::TX_TYPE],
ZkLinkTxType::FullExit => vec![FullExit::TX_TYPE],
ZkLinkTxType::ChangePubKey => vec![ChangePubKey::TX_TYPE],
ZkLinkTxType::ForcedExit => vec![ForcedExit::TX_TYPE],
ZkLinkTxType::OrderMatching => vec![OrderMatching::TX_TYPE],
ZkLinkTxType::ContractMatching => vec![ContractMatching::TX_TYPE],
ZkLinkTxType::Liquidation => vec![Liquidation::TX_TYPE],
ZkLinkTxType::AutoDeleveraging => vec![AutoDeleveraging::TX_TYPE],
ZkLinkTxType::UpdateGlobalVar => vec![UpdateGlobalVar::TX_TYPE],
ZkLinkTxType::Funding => vec![Funding::TX_TYPE],
}
}
}

/// A set of L2 transaction supported by the zklink network.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
Expand Down

0 comments on commit 60b586f

Please sign in to comment.