Skip to content

Commit

Permalink
Remove extra logic for EXTCODE* wrt 7702
Browse files Browse the repository at this point in the history
  • Loading branch information
somnathb1 committed Jan 31, 2025
1 parent a45a6e3 commit edd18dc
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,6 @@ func opExtCodeSize(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err)
}
if codeSize == types.DelegateDesignationCodeSize {
_, ok, err := interpreter.evm.IntraBlockState().GetDelegatedDesignation(addr)
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err)
}
if ok {
codeSize = 2 // first two bytes only: EIP-7702
}
}
slot.SetUint64(uint64(codeSize))
return nil, nil
}
Expand Down Expand Up @@ -430,9 +421,6 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err)
}
if _, ok := types.ParseDelegation(code); ok {
code = append([]byte{}, (params.DelegatedDesignationPrefix[0:2])...)
}

codeCopy := getDataBig(code, &codeOffset, len64)
scope.Memory.Set(memOffset.Uint64(), len64, codeCopy)
Expand Down Expand Up @@ -488,18 +476,10 @@ func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
slot.Clear()
} else {
var codeHash libcommon.Hash
_, ok, err := interpreter.evm.IntraBlockState().GetDelegatedDesignation(address)
codeHash, err = interpreter.evm.IntraBlockState().GetCodeHash(address)
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err)
}
if ok {
codeHash = params.DelegatedCodeHash
} else {
codeHash, err = interpreter.evm.IntraBlockState().GetCodeHash(address)
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err)
}
}
slot.SetBytes(codeHash.Bytes())
}
return nil, nil
Expand Down

0 comments on commit edd18dc

Please sign in to comment.