added effectiveGasPrice to eth_getTransactionReceipt return structure (#450)

This commit is contained in:
Dusan Stanivukovic
2021-06-28 19:04:52 +02:00
committed by GitHub
parent e6f3794dd4
commit e5ae846de4
6 changed files with 42 additions and 1 deletions

View File

@@ -1184,6 +1184,7 @@ fn rpc_eth_transaction_receipt() {
}],
log_bloom: Bloom::zero(),
outcome: TransactionOutcome::StateRoot(H256::zero()),
effective_gas_price: None,
};
let hash =
@@ -1242,6 +1243,7 @@ fn rpc_eth_pending_receipt() {
logs: Vec::new(),
log_bloom: Bloom::zero(),
outcome: TransactionOutcome::Unknown,
effective_gas_price: None,
};
let tester = EthTester::default();

View File

@@ -561,6 +561,7 @@ fn rpc_parity_block_receipts() {
outcome: TransactionOutcome::Unknown,
to: None,
from: Address::from_low_u64_be(9),
effective_gas_price: None,
},
);
let io = deps.default_client();

View File

@@ -55,6 +55,9 @@ pub struct Receipt {
// NOTE(niklasad1): Unknown after EIP98 rules, if it's missing then skip serializing it
#[serde(skip_serializing_if = "Option::is_none", rename = "status")]
pub status_code: Option<U64>,
/// Effective gas price
#[serde(skip_serializing_if = "Option::is_none")]
pub effective_gas_price: Option<U256>,
}
impl Receipt {
@@ -90,6 +93,7 @@ impl From<LocalizedReceipt> for Receipt {
status_code: Self::outcome_to_status_code(&r.outcome),
state_root: Self::outcome_to_state_root(r.outcome),
logs_bloom: r.log_bloom,
effective_gas_price: r.effective_gas_price,
}
}
}
@@ -111,6 +115,7 @@ impl From<RichReceipt> for Receipt {
status_code: Self::outcome_to_status_code(&r.outcome),
state_root: Self::outcome_to_state_root(r.outcome),
logs_bloom: r.log_bloom,
effective_gas_price: r.effective_gas_price,
}
}
}
@@ -134,6 +139,7 @@ impl From<TypedReceipt> for Receipt {
status_code: Self::outcome_to_status_code(&legacy_receipt.outcome),
state_root: Self::outcome_to_state_root(legacy_receipt.outcome),
logs_bloom: legacy_receipt.log_bloom,
effective_gas_price: None,
}
}
}
@@ -191,6 +197,7 @@ mod tests {
logs_bloom: Bloom::from_low_u64_be(15),
state_root: Some(H256::from_low_u64_be(10)),
status_code: Some(1u64.into()),
effective_gas_price: None,
};
let serialized = serde_json::to_string(&receipt).unwrap();