Skip to content

Commit

Permalink
Add decoder tests for complex abi types
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Sep 5, 2023
1 parent 34206be commit 88bee5b
Show file tree
Hide file tree
Showing 4 changed files with 370 additions and 67 deletions.
20 changes: 10 additions & 10 deletions src/abi/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ impl_with_abi_type! {
Uint12 => Uint(12),
Uint15 => Uint(15),

i8 => Uint(8),
i16 => Uint(16),
i32 => Uint(32),
i64 => Uint(64),
i128 => Uint(128),
i8 => Int(8),
i16 => Int(16),
i32 => Int(32),
i64 => Int(64),
i128 => Int(128),

bool => Bool,

Expand Down Expand Up @@ -192,11 +192,11 @@ impl_with_plain_abi_type! {
Uint12 => Uint(12),
Uint15 => Uint(15),

i8 => Uint(8),
i16 => Uint(16),
i32 => Uint(32),
i64 => Uint(64),
i128 => Uint(128),
i8 => Int(8),
i16 => Int(16),
i32 => Int(32),
i64 => Int(64),
i128 => Int(128),

bool => Bool,

Expand Down
6 changes: 3 additions & 3 deletions src/abi/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};

use super::error::{ParseAbiTypeError, ParseNamedAbiTypeError};
use crate::cell::{MAX_BIT_LEN, MAX_REF_COUNT};
use crate::models::IntAddr;
use crate::models::{IntAddr, StdAddr};
use crate::num::Tokens;

/// ABI value type with name.
Expand Down Expand Up @@ -549,11 +549,11 @@ pub enum PlainAbiType {

impl PlainAbiType {
/// Returns the maximum number of bits that this type can occupy.
pub fn max_bits(&self) -> u16 {
pub fn key_bits(&self) -> u16 {
match self {
Self::Uint(n) | Self::Int(n) => *n,
Self::Bool => 1,
Self::Address => IntAddr::BITS_MAX,
Self::Address => StdAddr::BITS_WITHOUT_ANYCAST,
}
}
}
Expand Down
Loading

0 comments on commit 88bee5b

Please sign in to comment.