Skip to content

Commit

Permalink
Update geth dependency from v1.10.18 to v1.11.5 (scroll-tech#1363)
Browse files Browse the repository at this point in the history
### Description

Updates the geth dependency in geth-utils to latest release.

Pulled this out from scroll-tech#1361.

### Issue Link

Related to scroll-tech#1362.

### Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Contents

- Update geth dependency (and ran `go mod tidy` to update
sub-dependencies)
- Update code bindings to struct changes

### Rationale

N/A

### How Has This Been Tested?

Using the testing suite in the repo.
  • Loading branch information
axic authored Apr 18, 2023
1 parent 3aa36a2 commit 3429f83
Show file tree
Hide file tree
Showing 6 changed files with 853 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Setup golang
uses: actions/setup-go@v3
with:
go-version: ~1.18
go-version: ~1.19
# Go cache for building geth-utils
- name: Go cache
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Setup golang
uses: actions/setup-go@v3
with:
go-version: ~1.18
go-version: ~1.19
# Go cache for building geth-utils
- name: Go cache
uses: actions/cache@v3
Expand Down
36 changes: 19 additions & 17 deletions geth-utils/gethutil/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ type TraceConfig struct {
LoggerConfig *logger.Config `json:"logger_config"`
}

func newUint64(val uint64) *uint64 { return &val }

func Trace(config TraceConfig) ([]*ExecutionResult, error) {
chainConfig := params.ChainConfig{
ChainID: toBigInt(config.ChainID),
Expand All @@ -145,7 +147,7 @@ func Trace(config TraceConfig) ([]*ExecutionResult, error) {

var txsGasLimit uint64
blockGasLimit := toBigInt(config.Block.GasLimit).Uint64()
messages := make([]types.Message, len(config.Transactions))
messages := make([]core.Message, len(config.Transactions))
for i, tx := range config.Transactions {
// If gas price is specified directly, the tx is treated as legacy type.
if tx.GasPrice != nil {
Expand All @@ -158,19 +160,19 @@ func Trace(config TraceConfig) ([]*ExecutionResult, error) {
txAccessList[i].Address = accessList.Address
txAccessList[i].StorageKeys = accessList.StorageKeys
}
messages[i] = types.NewMessage(
tx.From,
tx.To,
uint64(tx.Nonce),
toBigInt(tx.Value),
uint64(tx.GasLimit),
toBigInt(tx.GasPrice),
toBigInt(tx.GasFeeCap),
toBigInt(tx.GasTipCap),
tx.CallData,
txAccessList,
false,
)
messages[i] = core.Message{
From: tx.From,
To: tx.To,
Nonce: uint64(tx.Nonce),
Value: toBigInt(tx.Value),
GasLimit: uint64(tx.GasLimit),
GasPrice: toBigInt(tx.GasPrice),
GasFeeCap: toBigInt(tx.GasFeeCap),
GasTipCap: toBigInt(tx.GasTipCap),
Data: tx.CallData,
AccessList: txAccessList,
SkipAccountChecks: false,
}

txsGasLimit += uint64(tx.GasLimit)
}
Expand All @@ -191,7 +193,7 @@ func Trace(config TraceConfig) ([]*ExecutionResult, error) {
},
Coinbase: config.Block.Coinbase,
BlockNumber: toBigInt(config.Block.Number),
Time: toBigInt(config.Block.Timestamp),
Time: toBigInt(config.Block.Timestamp).Uint64(),
Difficulty: toBigInt(config.Block.Difficulty),
BaseFee: toBigInt(config.Block.BaseFee),
GasLimit: blockGasLimit,
Expand All @@ -215,9 +217,9 @@ func Trace(config TraceConfig) ([]*ExecutionResult, error) {
executionResults := make([]*ExecutionResult, len(config.Transactions))
for i, message := range messages {
tracer := logger.NewStructLogger(config.LoggerConfig)
evm := vm.NewEVM(blockCtx, core.NewEVMTxContext(message), stateDB, &chainConfig, vm.Config{Debug: true, Tracer: tracer, NoBaseFee: true})
evm := vm.NewEVM(blockCtx, core.NewEVMTxContext(&message), stateDB, &chainConfig, vm.Config{Debug: true, Tracer: tracer, NoBaseFee: true})

result, err := core.ApplyMessage(evm, message, new(core.GasPool).AddGas(message.Gas()))
result, err := core.ApplyMessage(evm, &message, new(core.GasPool).AddGas(message.GasLimit))
if err != nil {
return nil, fmt.Errorf("Failed to apply config.Transactions[%d]: %w", i, err)
}
Expand Down
2 changes: 1 addition & 1 deletion geth-utils/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module main
go 1.16

require (
github.com/ethereum/go-ethereum v1.10.18
github.com/ethereum/go-ethereum v1.11.5
github.com/holiman/uint256 v1.2.0
)

Expand Down
Loading

0 comments on commit 3429f83

Please sign in to comment.