Skip to content

Use selfbalance for address(this).balance.#7539

Merged
chriseth merged 1 commit intodevelopfrom
selfbalance
Oct 16, 2019
Merged

Use selfbalance for address(this).balance.#7539
chriseth merged 1 commit intodevelopfrom
selfbalance

Conversation

@chriseth
Copy link
Copy Markdown
Contributor

References #7310

}
// Another special case for `address(this).balance`. Post-Istanbul, we can use the selfbalance
// opcode.
// TODO also add optimizer rule `balance(address) -> selfbalance`.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This needs information about the dialect together with the rules (or applicability function?).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shall we create an issue which tracks this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Created #7542

bytes expectation({uint8_t(Instruction::SELFBALANCE)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does it make sense to check that BALANCE together with ADDRESS is used for pre-Istanbul here? Couldn't find a test which does that check.

@erak
Copy link
Copy Markdown
Collaborator

erak commented Oct 16, 2019

Tests are failing due to a weird Circle glitch(?). We can try to retrigger the tests.

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.

2 participants