fix: incorrect encoding on TransactionReceipt (#1661)
* fix TransactionReceipt rlp encoding * add tests * update changelog
This commit is contained in:
parent
de90662725
commit
744d5c055e
|
@ -4,6 +4,7 @@
|
|||
|
||||
### Unreleased
|
||||
|
||||
- Fix RLP encoding of `TransactionReceipt`
|
||||
- Add `Unit8` helper type [#1639](https://github.com/gakonst/ethers-rs/pull/1639)
|
||||
- Add `evm.deployedBytecode.immutableReferences` output selector [#1523](https://github.com/gakonst/ethers-rs/pull/1523)
|
||||
- Added `get_erc1155_token_transfer_events` function for etherscan client [#1503](https://github.com/gakonst/ethers-rs/pull/1503)
|
||||
|
|
|
@ -425,7 +425,7 @@ pub struct TransactionReceipt {
|
|||
impl rlp::Encodable for TransactionReceipt {
|
||||
fn rlp_append(&self, s: &mut RlpStream) {
|
||||
s.begin_list(4);
|
||||
s.append(&self.status);
|
||||
rlp_opt(s, &self.status);
|
||||
s.append(&self.cumulative_gas_used);
|
||||
s.append(&self.logs_bloom);
|
||||
s.append_list(&self.logs);
|
||||
|
@ -457,6 +457,8 @@ impl PartialOrd<Self> for TransactionReceipt {
|
|||
#[cfg(test)]
|
||||
#[cfg(not(feature = "celo"))]
|
||||
mod tests {
|
||||
use rlp::Encodable;
|
||||
|
||||
use crate::types::transaction::eip2930::AccessListItem;
|
||||
|
||||
use super::*;
|
||||
|
@ -907,6 +909,17 @@ mod tests {
|
|||
assert_eq!(v, receipt);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rlp_encode_receipt() {
|
||||
let receipt = TransactionReceipt { status: Some(1u64.into()), ..Default::default() };
|
||||
let encoded = receipt.rlp_bytes();
|
||||
|
||||
assert_eq!(
|
||||
encoded,
|
||||
hex::decode("f901060180b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0").unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_sort_receipts() {
|
||||
let mut a = TransactionReceipt { block_number: Some(0u64.into()), ..Default::default() };
|
||||
|
|
Loading…
Reference in New Issue