-
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
EIP158 & 160 Hardfork #3179
EIP158 & 160 Hardfork #3179
Conversation
@obscuren, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fjl, @karalabe and @zsfelfoldi to be potential reviewers. |
00b71cf
to
97b4109
Compare
eda9c0f
to
2e6397f
Compare
|
||
// Nothing should be returned when an error is thrown. | ||
return nil, addr, err | ||
} else if env.ChainConfig().IsEIP170(env.BlockNumber()) && len(ret) > params.MaxCodeSize { |
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.
A few lines up, back at L:157, there's if err == nil
, where the clause which does setCode
is performed. I suggest to check MaxCodeSize
up there instead of down here, and then also skip the SetCode
stuff.
7f8828b
to
e6c838f
Compare
EIP155Block *big.Int `json:"EIP155Block"` // EIP155 HF block | ||
EIP158Block *big.Int `json:"EIP158Block"` // EIP158 HF block | ||
EIP155Block *big.Int `json:"eip155Block"` // EIP155 HF block | ||
EIP158Block *big.Int `json:"eiP158Block"` // EIP158 HF block |
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 P is uppercase
if tx.Protected() { | ||
signer = types.NewEIP155Signer(tx.ChainId()) | ||
} | ||
if _, r, _ := types.SignatureValues(signer, tx); r == 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.
You can use RawSignatureValues
here (and below). The point of this check is to see whether the fields were set in JSON.
signer = types.NewEIP155Signer(tx.ChainId()) | ||
} | ||
from, _ := types.Sender(signer, tx) | ||
v, r, s := types.SignatureValues(signer, tx) |
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 think this should be RawSignatureValues
. The v, r, s JSON fields are new in 1.5 and we can define the semantics for them. Raw values are preferable here because the client should be able to reconstruct the whole transaction.
e.g. if you do
client, _ := ethclient.Dial("http://127.0.0.1:8085")
tx, _ := client.TransactionByHash(ctx, common.HexToHash("...."))
from, _ := types.Sender(types.NewEIP155Signer(signer), tx))
The from value should be the same as it was on the server. Normalising the values breaks this.
7449ade
to
aa3017c
Compare
@@ -40,10 +40,11 @@ type ChainConfig struct { | |||
|
|||
EIP155Block *big.Int `json:"eip155Block"` // EIP155 HF block | |||
EIP158Block *big.Int `json:"eiP158Block"` // EIP158 HF block | |||
EIP170Block *big.Int `json:"eip158Block"` // EIP170 HF block |
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.
s/eip158Block/eip170Block no?
f108749
to
75bf510
Compare
This commit implements EIP158 part 1, 2, 3 & 4 1. If an account is empty it's no longer written to the trie. An empty account is defined as (balance=0, nonce=0, storage=0, code=0). 2. Delete an empty account if it's touched 3. An empty account is redefined as either non-existent or empty. 4. Zero value calls and zero value suicides no longer consume the 25k reation costs. params: moved core/config to params Signed-off-by: Jeffrey Wilcke <jeffrey@ethereum.org>
@obscuren please fix the go vet issue |
This PR implements the EIP158 proposal and EIP160.
It also changes the location where the chain configuration is kept to the
params
package. This is done so that any time a HF proposal is added or if the chain config needs modification, only a single location needs to be changed. This also means that thevm.Environment
no longer has aRuleSet
but aChainConfig
directly. All locations in the tests wherecore.GenerateChain
took anil
parameter for theChainConfig
are now passingparams.TestChainConfig
.ChainConfig
is no longer optional, it is an requirement. Passingnil
anywhere (as done in mostGenerateChain
calls) will result in a hard panic.Note for reviewers: please make sure that a
params.TestChainConfig
is suitable for your tests. It has the following parameters:homestead = 0, dao = 0, daoEnabled = true, EIP150 = true, EIP158 = true
.TODO list
core.ChainConfig
and moved toparams
package instead