-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
accounts/external: handle 0 chainid as not-set for the Clef API #23394
Conversation
accounts/external/backend.go
Outdated
} | ||
// We should request the default chain id that we're operating with | ||
// (the chain we're executing on) | ||
if chainID != nil { | ||
if chainID != nil && chainID.BitLen() > 0 { |
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.
btw, the canonical zero check we use everywhere is int.Sign() == 0
.
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.
PTAL
accounts/external/backend.go
Outdated
args.ChainID = (*hexutil.Big)(chainID) | ||
} | ||
if tx.Type() != types.LegacyTxType { | ||
// However, if the user asked for a particular chain id, then we should | ||
// use that instead. | ||
if tx.ChainId() != nil { | ||
if tx.ChainId() != nil && tx.ChainId().BitLen() > 0 { |
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.
Here, tx.ChainId
can never be nil.
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.
PTAL
7d89fe2
to
365197d
Compare
args.ChainID = (*hexutil.Big)(chainID) | ||
} | ||
if tx.Type() != types.LegacyTxType { | ||
// However, if the user asked for a particular chain id, then we should | ||
// use that instead. | ||
if tx.ChainId() != nil { | ||
if tx.ChainId().Sign() != 0 { |
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.
Don't we need a nil-check here?
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.
ChainId()
cannot return nil for non-legacy transactions.
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.
LGTM
…reum#23394) * accounts/external: handle 0 chainid as not-set for the Clef API * accounts/external: document SignTx Co-authored-by: Felix Lange <fjl@twurst.com>
No description provided.