EVM fix - issue #5077 (#5233)

* fix(evm): output and add makefile command

* fix(evm): correct number type conversion
This commit is contained in:
Max Revitt 2022-08-31 01:51:08 +01:00 committed by GitHub
parent 002aba4686
commit 159e53d503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 10 deletions

View File

@ -111,6 +111,7 @@ COMMANDS += rpctest
COMMANDS += sentry
COMMANDS += state
COMMANDS += txpool
COMMANDS += evm
# build each command using %.cmd rule
$(COMMANDS): %: %.cmd

View File

@ -30,7 +30,7 @@ import (
"github.com/ledgerwatch/erigon/params"
"github.com/ledgerwatch/erigon/tests"
"github.com/ledgerwatch/erigon/turbo/trie"
"github.com/ledgerwatch/log/v3"
log "github.com/ledgerwatch/log/v3"
"github.com/urfave/cli"
)
@ -93,8 +93,8 @@ func stateTestCmd(ctx *cli.Context) error {
}
// Iterate over all the stateTests, run them and aggregate the results
results := make([]StatetestResult, 0, len(stateTests))
if err := aggregateResultsFromStateTests(ctx, stateTests, results, tracer, debugger); err != nil {
results, err := aggregateResultsFromStateTests(ctx, stateTests, tracer, debugger)
if err != nil {
return err
}
@ -106,24 +106,23 @@ func stateTestCmd(ctx *cli.Context) error {
func aggregateResultsFromStateTests(
ctx *cli.Context,
stateTests map[string]tests.StateTest,
results []StatetestResult,
tracer vm.Tracer,
debugger *vm.StructLogger,
) error {
) ([]StatetestResult, error) {
// Iterate over all the stateTests, run them and aggregate the results
cfg := vm.Config{
Tracer: tracer,
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),
}
db := memdb.New()
defer db.Close()
tx, txErr := db.BeginRw(context.Background())
if txErr != nil {
return txErr
return nil, txErr
}
defer tx.Rollback()
results := make([]StatetestResult, 0, len(stateTests))
for key, test := range stateTests {
for _, st := range test.Subtests() {
@ -180,5 +179,5 @@ func aggregateResultsFromStateTests(
}
}
}
return nil
return results, nil
}

View File

@ -449,6 +449,7 @@ func toMessage(tx stTransactionMarshaling, ps stPostState, baseFee *big.Int) (co
gpi := big.Int(*gasPrice)
gasPriceInt := uint256.NewInt(gpi.Uint64())
// TODO the conversion to int64 then uint64 then new int isn't working!
msg := types.NewMessage(
from,
to,
@ -456,8 +457,8 @@ func toMessage(tx stTransactionMarshaling, ps stPostState, baseFee *big.Int) (co
value,
uint64(gasLimit),
gasPriceInt,
uint256.NewInt(uint64(feeCap.Int64())),
uint256.NewInt(uint64(tipCap.Int64())),
uint256.NewInt(feeCap.Uint64()),
uint256.NewInt(tipCap.Uint64()),
data,
accessList,
false)