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

Improve return data truncate logic #9254

Merged
merged 2 commits into from
Aug 7, 2018
Merged

Improve return data truncate logic #9254

merged 2 commits into from
Aug 7, 2018

Conversation

sorpaas
Copy link
Collaborator

@sorpaas sorpaas commented Jul 31, 2018

Rust's Vec allocator will never change the init pointer, so drain will do copy anyway (with the unwanted tail data). This PR fixes it by only attempting to truncate if offset is 0, and for other cases, just create a new Vec.

@sorpaas sorpaas added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Jul 31, 2018
@sorpaas sorpaas added this to the 2.1 milestone Jul 31, 2018
@debris debris added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Aug 7, 2018
if !is_valid_range(offset, size) {
return ReturnData::empty()
return ReturnData::empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid redundant ;

@debris debris merged commit 0d8001a into master Aug 7, 2018
@debris debris deleted the sp-returndata branch August 7, 2018 09:48
ordian added a commit to ordian/parity that referenced this pull request Aug 10, 2018
…rp_sync_on_light_client

* 'master' of https://github.com/paritytech/parity:
  ethcore: add transition flag for transaction permission contract (openethereum#9275)
  Remove all dapp permissions related settings (openethereum#9120)
  Improve return data truncate logic (openethereum#9254)
  Update wasm-tests hash (openethereum#9295)
  Implement KIP4: create2 for wasm (openethereum#9277)
  Fix loop start value (openethereum#9285)
  Avoid using $HOME if not necessary (openethereum#9273)
  Fix path to parity.h (openethereum#9274)
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. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants