Skip to content

Commit

Permalink
fix: rlp issue resolved (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcranju authored Dec 4, 2024
1 parent 3cdf0b3 commit c72a550
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions contracts/soroban/libs/soroban-rlp/src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ pub fn decode_u64(env: &Env, bytes: Bytes) -> u64 {
}

pub fn decode_u128(env: &Env, bytes: Bytes) -> u128 {
if bytes.len() == 1 {
return bytes_to_u128(bytes);
}
let decoded = decode(&env, bytes);
bytes_to_u128(decoded)
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/soroban/libs/soroban-rlp/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn bytes_to_u64(bytes: Bytes) -> u64 {
}

pub fn u128_to_bytes(env: &Env, number: u128) -> Bytes {
let mut bytes: Bytes = Bytes::new(&env);
let mut bytes = bytes!(&env, 0x00);
let mut i = 15;
let mut leading_zero = true;
while i >= 0 {
Expand Down

0 comments on commit c72a550

Please sign in to comment.