Skip to content

Commit

Permalink
deny wasms until ArbOS 30
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-bousfield committed Apr 19, 2024
1 parent 75b0626 commit 33ee405
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions core/types/arbitrum_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (
"github.com/ethereum/go-ethereum/common"
)

const ArbosVersion_FixRedeemGas = uint64(11)
const ArbosVersion_Stylus = uint64(30)

var ArbosAddress = common.HexToAddress("0xa4b05")
var ArbosStateAddress = common.HexToAddress("0xA4B05FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")
var ArbSysAddress = common.HexToAddress("0x64")
Expand Down
6 changes: 3 additions & 3 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
// Reject code starting with 0xEF if EIP-3541 is enabled.
if err == nil && len(ret) >= 1 && ret[0] == 0xEF && evm.chainRules.IsLondon {
err = ErrInvalidCode
// Arbitrum: We do not reject Stylus programs and instead store them in the DB
// alongside normal EVM bytecode.
if evm.chainRules.IsArbitrum && state.IsStylusProgram(ret) {

// Arbitrum: retain Stylus programs and instead store them in the DB alongside normal EVM bytecode.
if evm.IsStylus() && state.IsStylusProgram(ret) {
err = nil
}
}
Expand Down
4 changes: 4 additions & 0 deletions core/vm/evm_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func (evm *EVM) DecrementDepth() {
evm.depth -= 1
}

func (evm *EVM) IsStylus() bool {
return evm.chainRules.IsArbitrum && evm.Context.ArbOSVersion >= types.ArbosVersion_Stylus
}

type TxProcessingHook interface {
StartTxHook() (bool, uint64, error, []byte) // return 4-tuple rather than *struct to avoid an import cycle
GasChargingHook(gasRemaining *uint64) (common.Address, error)
Expand Down
2 changes: 1 addition & 1 deletion core/vm/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
}

// Arbitrum: handle Stylus programs
if in.evm.chainRules.IsArbitrum && state.IsStylusProgram(contract.Code) {
if in.evm.IsStylus() && state.IsStylusProgram(contract.Code) {
ret, err = in.evm.ProcessingHook.ExecuteWASM(callContext, input, in)
return
}
Expand Down

0 comments on commit 33ee405

Please sign in to comment.