-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
internal/ethapi: fix panic in accesslist creation #23225
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it fixes the panic, which is good, but I'm a bit unsure of the semantics here. So we tell it to apply a tx with 0
tipcap and 0
maxTipand
0` gas -- won't it panic on invalid basefee?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's fine since we have nobasefee=true set
internal/ethapi/api.go
Outdated
if gasPrice == nil { | ||
gasPrice = new(big.Int) | ||
} | ||
msg := types.NewMessage(args.from(), args.To, uint64(*args.Nonce), args.Value.ToInt(), uint64(*args.Gas), gasPrice, big.NewInt(0), big.NewInt(0), args.data(), accessList, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest assigning it outside of the for loop
// gas price fallback
if args.GasPrice == nil {
args.GasPrice = (*hexutil.Big)(big.NewInt(0))
}
internal/ethapi/api.go
Outdated
if gasPrice == nil { | ||
gasPrice = new(big.Int) | ||
} | ||
msg := types.NewMessage(args.from(), args.To, uint64(*args.Nonce), args.Value.ToInt(), uint64(*args.Gas), gasPrice, big.NewInt(0), big.NewInt(0), args.data(), accessList, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use the args.toMessage()
function instead? Perhaps you can re-assign the accessList after converting it to the message. So that you don't need to handle the gasPrice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep using to message now, and set the accesslist beforehand
|
|
03f68df
to
6376c75
Compare
@@ -96,7 +96,7 @@ func (al accessList) equal(other accessList) bool { | |||
func (al accessList) accessList() types.AccessList { | |||
acl := make(types.AccessList, 0, len(al)) | |||
for addr, slots := range al { | |||
tuple := types.AccessTuple{Address: addr} | |||
tuple := types.AccessTuple{Address: addr, StorageKeys: []common.Hash{}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes an issue where sometimes the AL tracer would produce an accesslist with nil StorageKeys. This would then fail the marshaling/unmarshaling
* internal/ethapi: revert + fix properly in al tracer * internal/ethapi: use toMessage instead of creating new message * internal/ethapi: remove ineffassign * core: fix invalid unmarshalling, fix test Co-authored-by: Martin Holst Swende <[email protected]>
* internal/ethapi: revert + fix properly in al tracer * internal/ethapi: use toMessage instead of creating new message * internal/ethapi: remove ineffassign * core: fix invalid unmarshalling, fix test Co-authored-by: Martin Holst Swende <[email protected]>
closes #23223