Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace to_be_bytes with to_bytes_be function #71

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions types/src/tx_type/contract/funding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::prelude::validator::*;
#[cfg(feature = "ffi")]
use crate::tx_builder::FundingBuilder;
use crate::tx_type::{TxTrait, ZkSignatureTrait};
use num::traits::ToBytes;
use num::BigUint;
use serde::{Deserialize, Serialize};
use validator::Validate;
Expand All @@ -34,7 +33,7 @@ impl GetBytes for FundingInfo {
let bytes_len = self.bytes_len();
let mut funding_rate_encode = Vec::with_capacity(bytes_len);
funding_rate_encode.push(*self.pair_id as u8);
funding_rate_encode.extend(pad_front(&self.price.to_be_bytes(), PRICE_BIT_WIDTH / 8));
funding_rate_encode.extend(pad_front(&self.price.to_bytes_be(), PRICE_BIT_WIDTH / 8));
// For the convenience of the circuit, we use the Original Code instead of the Two's Complement.
let mut rate_bytes = self.funding_rate.unsigned_abs().to_be_bytes();
if self.funding_rate.is_negative() {
Expand Down
Loading