Skip to content

Fix: Also replace tags in the list of tags referenced from outside.#6047

Merged
chriseth merged 1 commit intodevelopfrom
fixTagReplacement
Feb 20, 2019
Merged

Fix: Also replace tags in the list of tags referenced from outside.#6047
chriseth merged 1 commit intodevelopfrom
fixTagReplacement

Conversation

@chriseth
Copy link
Contributor

Hopefully the last fix needed by #5102

@chriseth chriseth force-pushed the fixTagReplacement branch 2 times, most recently from abb7116 to 1e58244 Compare February 20, 2019 11:22
@codecov
Copy link

codecov bot commented Feb 20, 2019

Codecov Report

Merging #6047 into develop will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6047      +/-   ##
===========================================
+ Coverage    88.34%   88.34%   +<.01%     
===========================================
  Files          361      361              
  Lines        34858    34862       +4     
  Branches      4128     4130       +2     
===========================================
+ Hits         30796    30800       +4     
  Misses        2685     2685              
  Partials      1377     1377
Flag Coverage Δ
#all 88.34% <100%> (ø) ⬆️
#syntax 27.79% <0%> (-0.01%) ⬇️

for (auto const& replacement: dedup.replacedTags())
{
tagReplacements[replacement.first] = replacement.second;
assertThrow(
Copy link
Contributor

@axic axic Feb 20, 2019

Choose a reason for hiding this comment

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

Swap these two statements?

tagReplacements.insert(dedup.replacedTags().begin(), dedup.replacedTags().end());
for (auto const& replacement: dedup.replacedTags())
{
tagReplacements[replacement.first] = replacement.second;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this assert that replacement.first doesn't exist yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can try and see what happens...

Changelog.md Outdated
* ABIEncoderV2: Fix internal error related to ecrecover.
* ABIEncoderV2: Fix internal error related to mappings as library parameters.
* Inline Assembly: Proper error message for missing variables.
* Optimizer: Fix bug related to unused tag removal across assemblies.
Copy link
Contributor

Choose a reason for hiding this comment

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

If this never had any adverse effect we should mention that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reworded into mentioning "internal error", I think this should be sufficient. It always resulted in a "tag not found" - tag numbers are not re-used, only replaced.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should still mention it didn't generate invalid code to avoid scaring people.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@chriseth chriseth force-pushed the fixTagReplacement branch 2 times, most recently from 2c51fb2 to f92c129 Compare February 20, 2019 14:00
map<u256, u256> Assembly::optimiseInternal(
OptimiserSettings const& _settings,
std::set<size_t> const& _tagsReferencedFromOutside
std::set<size_t> _tagsReferencedFromOutside

Choose a reason for hiding this comment

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

Shouldn't it be &?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it is not needed in the caller. The function returns the replacements themselves and then the caller takes them into account.

@chriseth chriseth merged commit b43d75c into develop Feb 20, 2019
@axic axic deleted the fixTagReplacement branch February 20, 2019 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants