Skip to content

Commit d367ba0

Browse files
committed
chain/ethereum: Fix ABI conversion issues in alloy migration
1 parent cf5a566 commit d367ba0

File tree

1 file changed

+6
-11
lines changed
  • chain/ethereum/src/runtime

1 file changed

+6
-11
lines changed

chain/ethereum/src/runtime/abi.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,7 @@ impl<'a> ToAscObj<AscEthereumTransaction_0_0_1> for EthereumTransactionData<'a>
508508
hash: asc_new(heap, &self.hash(), gas).await?,
509509
index: asc_new(heap, &BigInt::from(self.index()), gas).await?,
510510
from: asc_new(heap, &self.from(), gas).await?,
511-
to: match self.to() {
512-
Some(to) => asc_new(heap, &to, gas).await?,
513-
None => AscPtr::null(),
514-
},
511+
to: asc_new_or_null(heap, &self.to(), gas).await?,
515512
value: asc_new(heap, &BigInt::from_unsigned_u256(&self.value()), gas).await?,
516513
gas_limit: asc_new(heap, &BigInt::from(self.gas_limit()), gas).await?,
517514
gas_price: asc_new(heap, &BigInt::from(self.gas_price()), gas).await?,
@@ -530,10 +527,7 @@ impl<'a> ToAscObj<AscEthereumTransaction_0_0_2> for EthereumTransactionData<'a>
530527
hash: asc_new(heap, &self.hash(), gas).await?,
531528
index: asc_new(heap, &BigInt::from(self.index()), gas).await?,
532529
from: asc_new(heap, &self.from(), gas).await?,
533-
to: match self.to() {
534-
Some(to) => asc_new(heap, &to, gas).await?,
535-
None => AscPtr::null(),
536-
},
530+
to: asc_new_or_null(heap, &self.to(), gas).await?,
537531
value: asc_new(heap, &BigInt::from_unsigned_u256(&self.value()), gas).await?,
538532
gas_limit: asc_new(heap, &BigInt::from(self.gas_limit()), gas).await?,
539533
gas_price: asc_new(heap, &BigInt::from(self.gas_price()), gas).await?,
@@ -675,8 +669,8 @@ impl ToAscObj<AscEthereumLog> for Log {
675669
transaction_hash: asc_new_or_null(heap, &self.transaction_hash, gas).await?,
676670
transaction_index: asc_new_or_null_u64(heap, &self.transaction_index, gas).await?,
677671
log_index: asc_new_or_null_u64(heap, &self.log_index, gas).await?,
678-
transaction_log_index: AscPtr::null(), // TODO(alloy): figure out how to get transaction log index
679-
log_type: AscPtr::null(), // TODO(alloy): figure out how to get log type
672+
transaction_log_index: AscPtr::null(), // Non-standard field, not available in alloy
673+
log_type: AscPtr::null(), // Non-standard field, not available in alloy
680674
removed: asc_new(
681675
heap,
682676
&AscWrapped {
@@ -708,7 +702,8 @@ impl ToAscObj<AscEthereumTransactionReceipt>
708702
transaction_index: asc_new(heap, &BigInt::from(transaction_index), gas).await?,
709703
block_hash: asc_new_or_null(heap, &self.block_hash, gas).await?,
710704
block_number: asc_new_or_null_u64(heap, &self.block_number, gas).await?,
711-
cumulative_gas_used: asc_new(heap, &BigInt::from(self.gas_used), gas).await?,
705+
cumulative_gas_used: asc_new(heap, &BigInt::from(self.cumulative_gas_used()), gas)
706+
.await?,
712707
gas_used: asc_new(heap, &BigInt::from(self.gas_used), gas).await?,
713708
contract_address: asc_new_or_null(heap, &self.contract_address, gas).await?,
714709
logs: asc_new(heap, &self.logs(), gas).await?,

0 commit comments

Comments
 (0)