Skip to content

Commit

Permalink
Merge pull request #165 from multiversx/fix/data-gas-limit-empty
Browse files Browse the repository at this point in the history
Decode EthTransaction: decode if no function call
  • Loading branch information
dragos-rebegea authored Feb 14, 2024
2 parents 254633d + 59c8823 commit dd30da5
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions common/transaction/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,26 @@ impl<M: ManagedTypeApi> TopDecode for EthTransaction<M> {
let token_id = TokenIdentifier::dep_decode_or_handle_err(&mut nested_buffer, h)?;
let amount = BigUint::dep_decode_or_handle_err(&mut nested_buffer, h)?;
let tx_nonce = TxNonce::dep_decode_or_handle_err(&mut nested_buffer, h)?;
let data = ManagedBuffer::dep_decode_or_handle_err(&mut nested_buffer, h)?;
let gas_limit = u64::dep_decode_or_handle_err(&mut nested_buffer, h)?;

let mut data = ManagedBuffer::new();
let mut gas_limit = 0u64;
let mut args = ManagedVec::new();

while !nested_buffer.is_depleted() {
args.push(ManagedBuffer::dep_decode_or_handle_err(
&mut nested_buffer,
h,
)?);
if !nested_buffer.is_depleted() {
data = ManagedBuffer::dep_decode_or_handle_err(&mut nested_buffer, h)?;
gas_limit = u64::dep_decode_or_handle_err(&mut nested_buffer, h)?;
args = ManagedVec::new();

while !nested_buffer.is_depleted() {
args.push(ManagedBuffer::dep_decode_or_handle_err(
&mut nested_buffer,
h,
)?);
}

}


Result::Ok(EthTransaction {
from,
to,
Expand Down

0 comments on commit dd30da5

Please sign in to comment.