Skip to content

Commit 88a14cb

Browse files
committed
fix receipt
1 parent 164f9b6 commit 88a14cb

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

Diff for: src/tx_receipt.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ impl ConsensusTxReceipt {
2020
Ok(ConsensusTxReceipt(envelope))
2121
}
2222

23-
pub fn success(&self) -> bool {
23+
pub fn status(&self) -> &Eip658Value {
2424
match &self.0 {
25-
ReceiptEnvelope::Legacy(receipt) => receipt.receipt.status(),
26-
ReceiptEnvelope::Eip2930(receipt) => receipt.receipt.status(),
27-
ReceiptEnvelope::Eip1559(receipt) => receipt.receipt.status(),
28-
ReceiptEnvelope::Eip4844(receipt) => receipt.receipt.status(),
25+
ReceiptEnvelope::Legacy(receipt) => receipt.receipt.status_or_post_state(),
26+
ReceiptEnvelope::Eip2930(receipt) => receipt.receipt.status_or_post_state(),
27+
ReceiptEnvelope::Eip1559(receipt) => receipt.receipt.status_or_post_state(),
28+
ReceiptEnvelope::Eip4844(receipt) => receipt.receipt.status_or_post_state(),
2929
_ => todo!(),
3030
}
3131
}
@@ -71,7 +71,7 @@ impl TryFrom<RpcTxReceipt> for ConsensusTxReceipt {
7171
TxType::Legacy => {
7272
let res = ReceiptEnvelope::Legacy(ReceiptWithBloom {
7373
receipt: Receipt {
74-
status: Eip658Value::Eip658(tx.success()),
74+
status: Eip658Value::from(tx.status()),
7575
cumulative_gas_used: tx.cumulative_gas_used(),
7676
logs: tx.logs(),
7777
},
@@ -82,7 +82,7 @@ impl TryFrom<RpcTxReceipt> for ConsensusTxReceipt {
8282
TxType::Eip2930 => {
8383
let res = ReceiptEnvelope::Eip2930(ReceiptWithBloom {
8484
receipt: Receipt {
85-
status: Eip658Value::Eip658(tx.success()),
85+
status: Eip658Value::from(tx.status()),
8686
cumulative_gas_used: tx.cumulative_gas_used(),
8787
logs: tx.logs(),
8888
},
@@ -93,7 +93,7 @@ impl TryFrom<RpcTxReceipt> for ConsensusTxReceipt {
9393
TxType::Eip1559 => {
9494
let res = ReceiptEnvelope::Eip1559(ReceiptWithBloom {
9595
receipt: Receipt {
96-
status: Eip658Value::Eip658(tx.success()),
96+
status: Eip658Value::from(tx.status()),
9797
cumulative_gas_used: tx.cumulative_gas_used(),
9898
logs: tx.logs(),
9999
},
@@ -104,7 +104,7 @@ impl TryFrom<RpcTxReceipt> for ConsensusTxReceipt {
104104
TxType::Eip4844 => {
105105
let res = ReceiptEnvelope::Eip4844(ReceiptWithBloom {
106106
receipt: Receipt {
107-
status: Eip658Value::Eip658(tx.success()),
107+
status: Eip658Value::from(tx.status()),
108108
cumulative_gas_used: tx.cumulative_gas_used(),
109109
logs: tx.logs(),
110110
},
@@ -121,12 +121,12 @@ impl RpcTxReceipt {
121121
Ok(self.0.transaction_type())
122122
}
123123

124-
fn success(&self) -> bool {
124+
fn status(&self) -> bool {
125125
self.0.status()
126126
}
127127

128128
fn cumulative_gas_used(&self) -> u128 {
129-
self.0.gas_used
129+
self.0.inner.cumulative_gas_used()
130130
}
131131

132132
fn logs(&self) -> Vec<alloy::primitives::Log<LogData>> {
@@ -136,7 +136,6 @@ impl RpcTxReceipt {
136136
let result = rpc_log.inner;
137137
logs.push(result);
138138
}
139-
140139
logs
141140
}
142141

Diff for: src/tx_receipt_trie.rs

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ impl TxReceiptsMptHandler {
9696
let rlp = tx.0.encoded_2718();
9797
trie.insert(key.as_slice(), rlp.as_slice())?;
9898
}
99-
10099
if trie.root_hash()?.as_bytes() != expected_root.as_slice() {
101100
return Err(Error::UnexpectedRoot);
102101
}

0 commit comments

Comments
 (0)