Skip to content

Commit

Permalink
Issue 101 - Incorrect labels in receipt of Call. Replaced parameter '…
Browse files Browse the repository at this point in the history
…a' with 'param1' and 'b' with 'param2' (#102)
  • Loading branch information
Braqzen authored and xgreenx committed Dec 20, 2022
1 parent 389f419 commit a183ef3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions fuel-tx/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub enum Receipt {
amount: Word,
asset_id: AssetId,
gas: Word,
a: Word,
b: Word,
param1: Word,
param2: Word,
pc: Word,
is: Word,
},
Expand Down Expand Up @@ -116,8 +116,8 @@ impl Receipt {
amount: Word,
asset_id: AssetId,
gas: Word,
a: Word,
b: Word,
param1: Word,
param2: Word,
pc: Word,
is: Word,
) -> Self {
Expand All @@ -127,8 +127,8 @@ impl Receipt {
amount,
asset_id,
gas,
a,
b,
param1,
param2,
pc,
is,
}
Expand Down Expand Up @@ -336,16 +336,16 @@ impl Receipt {
}
}

pub const fn a(&self) -> Option<Word> {
pub const fn param1(&self) -> Option<Word> {
match self {
Self::Call { a, .. } => Some(*a),
Self::Call { param1, .. } => Some(*param1),
_ => None,
}
}

pub const fn b(&self) -> Option<Word> {
pub const fn param2(&self) -> Option<Word> {
match self {
Self::Call { b, .. } => Some(*b),
Self::Call { param2, .. } => Some(*param2),
_ => None,
}
}
Expand Down Expand Up @@ -459,8 +459,8 @@ impl Receipt {
+ WORD_SIZE // amount
+ AssetId::LEN // asset_id
+ WORD_SIZE // gas
+ WORD_SIZE // a
+ WORD_SIZE // b
+ WORD_SIZE // param1
+ WORD_SIZE // param2
}

ReceiptRepr::Return => WORD_SIZE, // val
Expand Down
14 changes: 7 additions & 7 deletions fuel-tx/src/receipt/receipt_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ impl io::Read for Receipt {
amount,
asset_id,
gas,
a,
b,
param1,
param2,
pc,
is,
} => {
Expand All @@ -34,8 +34,8 @@ impl io::Read for Receipt {
let buf = bytes::store_number_unchecked(buf, *amount);
let buf = bytes::store_array_unchecked(buf, asset_id);
let buf = bytes::store_number_unchecked(buf, *gas);
let buf = bytes::store_number_unchecked(buf, *a);
let buf = bytes::store_number_unchecked(buf, *b);
let buf = bytes::store_number_unchecked(buf, *param1);
let buf = bytes::store_number_unchecked(buf, *param2);
let buf = bytes::store_number_unchecked(buf, *pc);
bytes::store_number_unchecked(buf, *is);
}
Expand Down Expand Up @@ -206,16 +206,16 @@ impl io::Write for Receipt {
let (amount, buf) = unsafe { bytes::restore_word_unchecked(buf) };
let (asset_id, buf) = unsafe { bytes::restore_array_unchecked(buf) };
let (gas, buf) = unsafe { bytes::restore_word_unchecked(buf) };
let (a, buf) = unsafe { bytes::restore_word_unchecked(buf) };
let (b, buf) = unsafe { bytes::restore_word_unchecked(buf) };
let (param1, buf) = unsafe { bytes::restore_word_unchecked(buf) };
let (param2, buf) = unsafe { bytes::restore_word_unchecked(buf) };
let (pc, buf) = unsafe { bytes::restore_word_unchecked(buf) };
let (is, _) = unsafe { bytes::restore_word_unchecked(buf) };

let id = id.into();
let to = to.into();
let asset_id = asset_id.into();

*self = Self::call(id, to, amount, asset_id, gas, a, b, pc, is);
*self = Self::call(id, to, amount, asset_id, gas, param1, param2, pc, is);
}

ReceiptRepr::Return => {
Expand Down

0 comments on commit a183ef3

Please sign in to comment.