-
Notifications
You must be signed in to change notification settings - Fork 225
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
wip: use libevm (params, core/vm) #1335
base: master
Are you sure you want to change the base?
Changes from 1 commit
6d60741
d999563
1c7e25b
a119516
25bb446
c371a3a
9b27ebe
784e2e6
a8a5c80
d74cea6
ed1165b
e1088b1
846f52a
932967d
053af95
44db6c7
cd5adc9
70659d3
5d5fb59
07203b0
99c1b70
e8febb8
04338c7
a5a43cc
4a41e81
5049989
2a46ead
672f54e
7b8ec21
f30f450
dc4b361
5038b15
dad843a
0fe10ff
5b073ad
34a17a6
73b5559
61b1694
8d2493f
12cd83e
20854a1
e9ee414
61eb933
28caecc
86cdfbe
f1d77d2
7bfbe08
27a8bfb
d72ff25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2179,7 +2179,7 @@ func golangBindings(t *testing.T, overload bool) { | |
if out, err := replacer.CombinedOutput(); err != nil { | ||
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out) | ||
} | ||
replacer = exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/ethereum/[email protected]", "-replace", "github.com/ethereum/go-ethereum=github.com/ava-labs/[email protected]20240912213608-cee51efc87e1") | ||
replacer = exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/ethereum/[email protected]", "-replace", "github.com/ethereum/go-ethereum=github.com/ava-labs/[email protected]20240917194312-1d6987fb6342") | ||
replacer.Dir = pkg | ||
if out, err := replacer.CombinedOutput(); err != nil { | ||
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -695,7 +695,7 @@ func TestPrecompileBind(t *testing.T) { | |
if out, err := replacer.CombinedOutput(); err != nil { | ||
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out) | ||
} | ||
replacer = exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/ethereum/[email protected]", "-replace", "github.com/ethereum/go-ethereum=github.com/ava-labs/[email protected]20240912213608-cee51efc87e1") | ||
replacer = exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/ethereum/[email protected]", "-replace", "github.com/ethereum/go-ethereum=github.com/ava-labs/[email protected]20240917194312-1d6987fb6342") | ||
replacer.Dir = pkg | ||
if out, err := replacer.CombinedOutput(); err != nil { | ||
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ import ( | |
"github.com/ava-labs/subnet-evm/eth/tracers/logger" | ||
"github.com/ava-labs/subnet-evm/internal/ethapi" | ||
"github.com/ava-labs/subnet-evm/params" | ||
"github.com/ava-labs/subnet-evm/predicate" | ||
"github.com/ava-labs/subnet-evm/rpc" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/common/hexutil" | ||
|
@@ -959,13 +960,22 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc | |
defer release() | ||
|
||
vmctx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why don't we just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what your suggestion is here? |
||
|
||
var predicateResults params.PredicateResults | ||
predicateBytes, ok := predicate.GetPredicateResultBytes(vmctx.Header.Extra) | ||
if ok { | ||
predicateResults, err = predicate.ParseResults(predicateBytes) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
// Apply the customization rules if required. | ||
if config != nil { | ||
originalTime := block.Time() | ||
config.BlockOverrides.Apply(&vmctx) | ||
// Apply all relevant upgrades from [originalTime] to the block time set in the override. | ||
// Should be applied before the state overrides. | ||
blockContext := params.NewBlockContext(vmctx.BlockNumber, vmctx.Time, vmctx.PredicateResults) | ||
blockContext := params.NewBlockContext(vmctx.BlockNumber, vmctx.Time, predicateResults) | ||
err = core.ApplyUpgrades(api.backend.ChainConfig(), &originalTime, blockContext, statedb) | ||
if err != nil { | ||
return nil, err | ||
|
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.
isn't this potentially dangerous as we have activated Durango without this field set?
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.
it should not be dangerous since we will not serialize this value back.
it is used by the "random" opcode, so we keep it as "difficulty", which retains the previous semantics.
This way we can avoid changing the jump table compared with upstream, which seems better.
however, I do agree that it's not in correspondence with the block header.