-
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: disable sending of non eip155 replay protected tx #22339
Conversation
Do we want to add a flag to disable this protection? |
I suggest |
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.
$ geth --dev --rpc.allow-unprotected-txs console 2>&1 | tail -n2
flag provided but not defined: -rpc.allow-unprotected-txs
You forgot to add it to the enabled flags, I think
@@ -966,6 +970,10 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { | |||
if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) { | |||
cfg.HTTPPathPrefix = ctx.GlobalString(HTTPPathPrefixFlag.Name) | |||
} | |||
|
|||
if ctx.GlobalIsSet(AllowUnprotectedTxs.Name) { |
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.
There is no reason to check if it's set or not. That's only needed if the default has some special meaning. We only care about the actual value of the flag, so pls just use cfg.UnprotectedAllowed = ctx.GlobalBool(AllowUnprotectedTxs.Name)
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.
Yes there is, when we simply override it here, then we will always overwrite the value we read out of the config.
See martins comments below
@holiman Duh, I enabled it now and tested it |
Almost, but not quite :)
And
Stored to config?
Yes. However:
|
cmd/utils/flags.go
Outdated
@@ -970,8 +970,9 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { | |||
if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) { | |||
cfg.HTTPPathPrefix = ctx.GlobalString(HTTPPathPrefixFlag.Name) | |||
} | |||
|
|||
cfg.UnprotectedAllowed = ctx.GlobalBool(AllowUnprotectedTxs.Name) | |||
if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) { |
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 is this tied to the http flag?
eth/backend.go
Outdated
@@ -222,7 +222,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { | |||
eth.miner = miner.New(eth, &config.Miner, chainConfig, eth.EventMux(), eth.engine, eth.isLocalBlock) | |||
eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData)) | |||
|
|||
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().UnprotectedAllowed, eth, nil} | |||
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil} | |||
log.Info("Unprotected TXs allowed", "value", eth.APIBackend.allowUnprotectedTxs) |
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.
please type it out, transactions
:P
Oh, that log line, I just usee it for testing, didn't mean it had to be incorporated.... But actually it might be good to have somewhere
|
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
when I send tx,I still got error:"Cannot submit unprotected transaction". |
Don't use non-eip155 replay protected transactions. They are unsafe as they can be replayed on a different chain. |
but seng tx as I usually do,usually I successsend tx.
This time just to metis mannet.what should I do ?
mars
***@***.***
…------------------ 原始邮件 ------------------
发件人: "ethereum/go-ethereum" ***@***.***>;
发送时间: 2022年5月27日(星期五) 凌晨0:39
***@***.***>;
***@***.******@***.***>;
主题: Re: [ethereum/go-ethereum] internal/ethapi: disable sending of non eip155 replay protected tx (#22339)
Don't use non-eip155 replay protected transactions. They are unsafe as they can be replayed on a different chain.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
This PR prevents users from submitting transactions without EIP-155 enabled.
Replay protection is important so we should gently force our users to use it.
It changes the JSON-RPC API quite significantly, so if you see the "only replay-protected (EIP-155) transactions allowed over RPC" error, you know that you need to update your signer.
To test: