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(core): prevent chain_id from serializing for requests #879
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.
hmm, this is a bit tricky, because I'm not sure what side-effects this could potentially cause, what does? since this is a client issue for openethereum
I believe in geth chainid is omitempty, so this approach seems fine. But not sure if there is some kind of check that chainids match so that tx intended for chain X are rejected on chain Y? so we'd lose that
alternatives:
- should we skip this instead based on the chainid?
- should we rather take the chain id if the client is OE, I believe we already have some calls that check the client first, definitely more effort, not ideal.
Since I'm not sure that alternative 1 (skip based on the chainid), or any solution that depends on only the chainid would work since OE will not accept any chainId field. Geth does have omitempty for the chainId, but it would be up to us to ensure that the This would not be necessary for |
thanks, sgtm! |
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.
smol nit
@@ -42,7 +42,8 @@ pub struct TransactionRequest { | |||
pub nonce: Option<U256>, | |||
|
|||
/// Chain ID (None for mainnet) | |||
#[serde(skip_serializing_if = "Option::is_none")] | |||
#[serde(skip_serializing)] | |||
#[serde(rename = "chainId")] |
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.
#[serde(rename = "chainId")] | |
#[serde(default, rename = "chainId")] |
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.
added to both request and 1559 request
@Rjected I'm still running into this issue after updating foundry to use this PR
It looks like it is still serialized into the txn |
@Rjected maybe let's add a serialization test which ensures that neither txs have chainId in the serialized form? |
Motivation
OpenEthereum seems to not have a
chainId
field in itsTransactionRequest
type.Solution
This PR disables serialization for the
chain_id
, so we don't send it in RPC requests.PR Checklist
Fixes #877