Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cannon/mipsevm/testutil/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func NewEVMEnv(contracts *ContractMetadata) (*vm.EVM, *state.StateDB) {
copy(mipsCtorArgs[12:], contracts.Addresses.Oracle[:])
mipsDeploy := append(bytes.Clone(contracts.Artifacts.MIPS.Bytecode.Object), mipsCtorArgs[:]...)
startingGas := uint64(30_000_000)
_, deployedMipsAddr, leftOverGas, err := env.Create(vm.AccountRef(contracts.Addresses.Sender), mipsDeploy, startingGas, common.U2560)
_, deployedMipsAddr, leftOverGas, err := env.Create(contracts.Addresses.Sender, mipsDeploy, startingGas, common.U2560)
if err != nil {
panic(fmt.Errorf("failed to deploy MIPS contract: %w. took %d gas", err, startingGas-leftOverGas))
}
Expand Down
6 changes: 3 additions & 3 deletions cannon/mipsevm/testutil/mips.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
const maxStepGas = 20_000_000

type MIPSEVM struct {
sender vm.AccountRef
sender common.Address
startingGas uint64
env *vm.EVM
evmState *state.StateDB
Expand All @@ -42,7 +42,7 @@ type MIPSEVM struct {

func newMIPSEVM(contracts *ContractMetadata, opts ...evmOption) *MIPSEVM {
env, evmState := NewEVMEnv(contracts)
sender := vm.AccountRef{0x13, 0x37}
sender := common.Address{0x13, 0x37}
startingGas := uint64(maxStepGas)
evm := &MIPSEVM{sender, startingGas, env, evmState, contracts.Addresses, nil, contracts.Artifacts, math.MaxUint64, nil, nil}
for _, opt := range opts {
Expand Down Expand Up @@ -264,7 +264,7 @@ func AssertEVMReverts(t *testing.T, state mipsevm.FPVMState, contracts *Contract
env, evmState := NewEVMEnv(contracts)
env.Config.Tracer = tracer
sender := common.Address{0x13, 0x37}
ret, _, err := env.Call(vm.AccountRef(sender), contracts.Addresses.MIPS, input, startingGas, common.U2560)
ret, _, err := env.Call(sender, contracts.Addresses.MIPS, input, startingGas, common.U2560)

require.EqualValues(t, err, vm.ErrExecutionReverted)
matcher(t, ret)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250228185245-d4bb112dc979
github.com/ethereum/go-ethereum v1.15.1
github.com/ethereum/go-ethereum v1.15.3
github.com/fatih/color v1.18.0
github.com/fsnotify/fsnotify v1.8.0
github.com/go-task/slim-sprig/v3 v3.0.0
Expand Down Expand Up @@ -256,7 +256,7 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101500.2-rc.3
replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101503.0-rc.1

//replace github.com/ethereum/go-ethereum => ../op-geth

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ github.com/elastic/gosigar v0.14.3 h1:xwkKwPia+hSfg9GqrCUKYdId102m9qTJIIr7egmK/u
github.com/elastic/gosigar v0.14.3/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z8veEq5ZO3DfIhZ7xgRP9WTc=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v1.101500.2-rc.3 h1:rA/pwy10ep9RDK08x5F1fjkDh8BFUg7OtCAICTo43Kg=
github.com/ethereum-optimism/op-geth v1.101500.2-rc.3/go.mod h1:OMpyVMMy5zpAAHlR5s/aGbXRk+7cIKczUEIJj54APbY=
github.com/ethereum-optimism/op-geth v1.101503.0-rc.1 h1:8qSXpCfLvLIPlkmwO4J+J9chi9NgZlhRckVJEjxS5Lg=
github.com/ethereum-optimism/op-geth v1.101503.0-rc.1/go.mod h1:QUo3fn+45vWqJWzJW+rIzRHUV7NmhhHLPdI87mAn1M8=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250228185245-d4bb112dc979 h1:P37l7EFCz5KxE20+yPa3LWiH2Cg+xx6lQ4mOKYCZFPs=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250228185245-d4bb112dc979/go.mod h1:NZ816PzLU1TLv1RdAvYAb6KWOj4Zm5aInT0YpDVml2Y=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
Expand Down
2 changes: 1 addition & 1 deletion mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ just = "1.37.0"
"go:github.com/ethereum/go-ethereum/cmd/abigen" = "1.10.25"
"go:gotest.tools/gotestsum" = "1.12.0"
"go:github.com/vektra/mockery/v2" = "2.46.0"
"go:github.com/golangci/golangci-lint/cmd/golangci-lint" = "1.61.0"
"go:github.com/golangci/golangci-lint/cmd/golangci-lint" = "1.64.5"

# Python dependencies
"pipx:slither-analyzer" = "0.10.2"
Expand Down
32 changes: 4 additions & 28 deletions op-chain-ops/script/prank.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,17 @@ type Prank struct {
Broadcast bool
}

// prankRef implements the vm.ContractRef interface, to mock a caller.
type prankRef struct {
prank common.Address
ref vm.ContractRef
}

var _ vm.ContractRef = (*prankRef)(nil)

func (p *prankRef) Address() common.Address {
return p.prank
}

// Value returns the value send into this contract context.
// The delegate call tracer implicitly relies on this being implemented on ContractRef
func (p *prankRef) Value() *uint256.Int {
return p.ref.(interface{ Value() *uint256.Int }).Value()
}

func (h *Host) handleCaller(caller vm.ContractRef) vm.ContractRef {
func (h *Host) handleCaller(caller common.Address) common.Address {
// apply prank, if top call-frame had set up a prank
if len(h.callStack) > 0 {
parentCallFrame := h.callStack[len(h.callStack)-1]
if parentCallFrame.Prank != nil && caller.Address() != addresses.VMAddr { // pranks do not apply to the cheatcode precompile
if parentCallFrame.Prank != nil && caller != addresses.VMAddr { // pranks do not apply to the cheatcode precompile
if parentCallFrame.Prank.Broadcast && parentCallFrame.LastOp == vm.CREATE2 && h.useCreate2Deployer {
return &prankRef{
prank: DeterministicDeployerAddress,
ref: caller,
}
return DeterministicDeployerAddress
}

if parentCallFrame.Prank.Sender != nil {
return &prankRef{
prank: *parentCallFrame.Prank.Sender,
ref: caller,
}
return *parentCallFrame.Prank.Sender
}
if parentCallFrame.Prank.Origin != nil {
h.env.TxContext.Origin = *parentCallFrame.Prank.Origin
Expand Down
7 changes: 2 additions & 5 deletions op-chain-ops/script/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (h *Host) prelude(from common.Address, to *common.Address) {
// Call calls a contract in the EVM. The state changes persist.
func (h *Host) Call(from common.Address, to common.Address, input []byte, gas uint64, value *uint256.Int) (returnData []byte, leftOverGas uint64, err error) {
h.prelude(from, &to)
return h.env.Call(vm.AccountRef(from), to, input, gas, value)
return h.env.Call(from, to, input, gas, value)
}

// LoadContract loads the bytecode of a contract, and deploys it with regular CREATE.
Expand Down Expand Up @@ -386,7 +386,7 @@ func (h *Host) RememberArtifact(addr common.Address, artifact *foundry.Artifact,
// This create function helps deploy contracts quickly for scripting etc.
func (h *Host) Create(from common.Address, initCode []byte) (common.Address, error) {
h.prelude(from, nil)
ret, addr, _, err := h.env.Create(vm.AccountRef(from),
ret, addr, _, err := h.env.Create(from,
initCode, DefaultFoundryGasLimit, uint256.NewInt(0))
if err != nil {
retStr := fmt.Sprintf("%x", ret)
Expand Down Expand Up @@ -790,9 +790,6 @@ func (h *Host) LogCallStack() {
for _, cf := range h.callStack {
callsite := ""
srcMap, ok := h.srcMaps[cf.Ctx.Address()]
if !ok && cf.Ctx.Contract.CodeAddr != nil { // if delegate-call, we might know the implementation code.
srcMap, ok = h.srcMaps[*cf.Ctx.Contract.CodeAddr]
}
if ok {
callsite = srcMap.FormattedInfo(cf.LastPC)
if callsite == "unknown:0:0" && len(cf.LastJumps) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion op-program/client/l2/fast_canon.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (o *FastCanonicalBlockHeaderOracle) getHistoricalBlockHash(head *types.Head

context := core.NewEVMBlockContext(head, o.ctx, nil, o.config, statedb)
vmenv := vm.NewEVM(context, statedb, o.config, vm.Config{})
var caller vm.AccountRef // can be anything as long as it's not the system contract
var caller common.Address // can be anything as long as it's not the system contract
gas := uint64(1000000)
var input [32]byte
binary.BigEndian.PutUint64(input[24:], n)
Expand Down