Skip to content
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

core/vm: evm fixes + add london to allprotocolchanges #22901

Closed
wants to merge 7 commits into from

Conversation

holiman
Copy link
Contributor

@holiman holiman commented May 18, 2021

This PR fixes some minor evm nits, like making it possible to execute /evm --json --code 0x48 run and see the BASEFEE opcode in all it's glory

@@ -43,6 +43,7 @@ type Config struct {
Value *big.Int
Debug bool
EVMConfig vm.Config
Basefee *big.Int

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Basefee *big.Int
BaseFee *big.Int

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand where is this being used?

Comment on lines +97 to +98
if cfg.Basefee == nil {
cfg.Basefee = new(big.Int)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if cfg.Basefee == nil {
cfg.Basefee = new(big.Int)
if cfg.BaseFee == nil {
cfg.BaseFee = new(big.Int)

@@ -35,6 +35,7 @@ func NewEnv(cfg *Config) *vm.EVM {
Time: cfg.Time,
Difficulty: cfg.Difficulty,
GasLimit: cfg.GasLimit,
BaseFee: cfg.Basefee,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BaseFee: cfg.Basefee,
BaseFee: cfg.BaseFee,

@holiman holiman mentioned this pull request Jun 1, 2021
@@ -426,9 +426,9 @@ func (b *SimulatedBackend) PendingNonceAt(ctx context.Context, account common.Ad
}

// SuggestGasPrice implements ContractTransactor.SuggestGasPrice. Since the simulated
// chain doesn't have miners, we just return a gas price of 1 for any call.
// chain doesn't have miners, we just return a gas price of 875000000 (initial basefee) for any call.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initial basefee is 1000000000

// We want to simulate an empty middle block, having the same state as the
// first one. The last is needs a state change again to force a reorg.
if i != 1 {
tx, err := types.SignTx(types.NewTransaction(block.TxNonce(addr), common.Address{0x00}, new(big.Int), params.TxGas, nil, nil), signer, key)
tx, err := types.SignTx(types.NewTransaction(block.TxNonce(addr), common.Address{0x00}, new(big.Int), params.TxGas, big.NewInt(875000000), nil), signer, key)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where 875 came from, use initial basefee instead

@@ -20,7 +20,9 @@ import (
"bytes"
"context"
"errors"
"github.com/ethereum/go-ethereum/log"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gofmt please

if g.Config == nil {
g.Config = params.AllEthashProtocolChanges
}
config := g.Config
block := g.ToBlock(db)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to move these codes up?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for setting the basefee. nvm

@holiman
Copy link
Contributor Author

holiman commented Jun 15, 2021

Closing, fixed by 7a7abe3 instead

@holiman holiman closed this Jun 15, 2021
@holiman holiman mentioned this pull request Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants