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

Decode EthTransaction: decode if no function call #165

Merged
merged 1 commit into from
Feb 14, 2024
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
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
Loading