Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Correct log index in transaction receipt #3995

Merged
merged 6 commits into from
Dec 29, 2016
Merged

Correct log index in transaction receipt #3995

merged 6 commits into from
Dec 29, 2016

Conversation

tomusdrw
Copy link
Collaborator

@tomusdrw tomusdrw commented Dec 29, 2016

Fixes log_index to mean log index in block consistently.
Introduces transaction_log_index.

Closes #3601, #2075, #3537

@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. M6-rpcapi 📣 RPC API. A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 29, 2016
@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. B0-patch B7-releasenotes 📜 Changes should be mentioned in the release notes of the next minor version release. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Dec 29, 2016
@@ -1535,6 +1499,52 @@ impl Drop for Client {
}
}

fn transaction_receipt(transaction: Option<LocalizedTransaction>, receipts: Option<Vec<Receipt>>) -> Option<LocalizedReceipt> {
let tx_and_sender = transaction
.and_then(|tx| tx.sender().ok().map(|sender| (tx, sender)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having this check within the body (and corresponding match for the output) is a bit weird.
fn transaction_receipt(LocalizedTransaction, Address, Vec<Receipt>) -> LocalizedReceipt seems like a cleaner interface.

a comment explaining what it does would be nice too. although it seems to me that actually you just need a fn(Transaction, Address, Receipt, usize) to do the same thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not really needed at all, but it is very difficult to test Client::transaction_receipt so I wanted to move as much logic as possible here to be able to test it properly.

Also most of the options could be replaced with .expect("Blockchain database is never pruned and stays consistent.") but I think current approach with .and_then chain is more future proof.

I will move Options to Client::transaction_receipt

@tomusdrw tomusdrw added A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 29, 2016
@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Dec 29, 2016
@rphmeier rphmeier added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 29, 2016
@gavofyork gavofyork merged commit b24fc97 into master Dec 29, 2016
@gavofyork gavofyork deleted the tx-logs branch December 29, 2016 18:48
tomusdrw added a commit that referenced this pull request Jan 3, 2017
* Moving logs to separate, testable function

* Adding test

* Fixing log index

* Adding transaction log index

* Fixing rpc tests

* Making interface of  a bit cleaner.

Conflicts:
	ethcore/src/client/client.rs
	ethcore/src/tests/client.rs
	ethcore/src/types/transaction.rs
@tomusdrw tomusdrw mentioned this pull request Jan 3, 2017
gavofyork pushed a commit that referenced this pull request Jan 5, 2017
* Fix up the transaction JSON serialisation for RPC.

* Introduce to_hex() utility in bigint. Fix tests.

Conflicts:
	rpc/src/v1/tests/mocked/eth.rs
	rpc/src/v1/tests/mocked/signing.rs
	rpc/src/v1/types/block.rs
	rpc/src/v1/types/transaction.rs

* fix comment

* Fix build.

* Bump hyper

* Correct log index in transaction receipt (#3995)

* Moving logs to separate, testable function

* Adding test

* Fixing log index

* Adding transaction log index

* Fixing rpc tests

* Making interface of  a bit cleaner.

Conflicts:
	ethcore/src/client/client.rs
	ethcore/src/tests/client.rs
	ethcore/src/types/transaction.rs

* Encode networkid as a u64.

Conflicts:
	ethcore/src/types/transaction.rs

* Fixing compilation issues

* parse testnet chain as ropsten

* Removing unused import
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. B7-releasenotes 📜 Changes should be mentioned in the release notes of the next minor version release. M6-rpcapi 📣 RPC API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants