Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for eip1559 incorrect assert #2415

Merged
merged 1 commit into from
Jul 21, 2021
Merged

Fix for eip1559 incorrect assert #2415

merged 1 commit into from
Jul 21, 2021

Conversation

AlexeyAkhunov
Copy link
Contributor

No description provided.

@AlexeyAkhunov AlexeyAkhunov merged commit 96ee6e1 into devel Jul 21, 2021
@AlexeyAkhunov AlexeyAkhunov deleted the ropste-fix branch July 21, 2021 18:35
Copy link
Contributor

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

This fix is incorrect, pre-1559 balanceCheck is an alias for mgval, thus we buy more gas than needed pre 1559.
Correct fix:

	if st.gasFeeCap != nil {
		balanceCheck = new(big.Int).SetUint64(st.msg.Gas())
		balanceCheck = balanceCheck.Mul(balanceCheck, st.gasFeeCap)
		balanceCheck.Add(balanceCheck, st.value)
	}
	if have, want := st.state.GetBalance(st.msg.From()), balanceCheck; have.Cmp(want) < 0 {
		return fmt.Errorf("%w: address %v have %v want %v", ErrInsufficientFunds, st.msg.From().Hex(), have, want)
		```
See also: https://github.com/ethereum/go-ethereum/pull/23244/files

@AlexeyAkhunov
Copy link
Contributor Author

This fix is incorrect, pre-1559 balanceCheck is an alias for mgval, thus we buy more gas than needed pre 1559.
Correct fix:

Thank you very much!

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.

None yet

2 participants