use of org.hyperledger.besu.evm.operation.InvalidOperation in project besu by hyperledger.
the class EVM method operationAtOffset.
@VisibleForTesting
public Operation operationAtOffset(final Code code, final int offset) {
final Bytes bytecode = code.getBytes();
// If the length of the program code is shorter than the offset halt execution.
if (offset >= bytecode.size()) {
return endOfScriptStop;
}
final byte opcode = bytecode.get(offset);
final Operation operation = operations.get(opcode);
return Objects.requireNonNullElseGet(operation, () -> new InvalidOperation(opcode, null));
}
use of org.hyperledger.besu.evm.operation.InvalidOperation in project besu by hyperledger.
the class MainnetEVMs method registerFrontierOperations.
public static void registerFrontierOperations(final OperationRegistry registry, final GasCalculator gasCalculator) {
registry.put(new AddOperation(gasCalculator));
registry.put(new MulOperation(gasCalculator));
registry.put(new SubOperation(gasCalculator));
registry.put(new DivOperation(gasCalculator));
registry.put(new SDivOperation(gasCalculator));
registry.put(new ModOperation(gasCalculator));
registry.put(new SModOperation(gasCalculator));
registry.put(new ExpOperation(gasCalculator));
registry.put(new AddModOperation(gasCalculator));
registry.put(new MulModOperation(gasCalculator));
registry.put(new SignExtendOperation(gasCalculator));
registry.put(new LtOperation(gasCalculator));
registry.put(new GtOperation(gasCalculator));
registry.put(new SLtOperation(gasCalculator));
registry.put(new SGtOperation(gasCalculator));
registry.put(new EqOperation(gasCalculator));
registry.put(new IsZeroOperation(gasCalculator));
registry.put(new AndOperation(gasCalculator));
registry.put(new OrOperation(gasCalculator));
registry.put(new XorOperation(gasCalculator));
registry.put(new NotOperation(gasCalculator));
registry.put(new ByteOperation(gasCalculator));
registry.put(new Keccak256Operation(gasCalculator));
registry.put(new AddressOperation(gasCalculator));
registry.put(new BalanceOperation(gasCalculator));
registry.put(new OriginOperation(gasCalculator));
registry.put(new CallerOperation(gasCalculator));
registry.put(new CallValueOperation(gasCalculator));
registry.put(new CallDataLoadOperation(gasCalculator));
registry.put(new CallDataSizeOperation(gasCalculator));
registry.put(new CallDataCopyOperation(gasCalculator));
registry.put(new CodeSizeOperation(gasCalculator));
registry.put(new CodeCopyOperation(gasCalculator));
registry.put(new GasPriceOperation(gasCalculator));
registry.put(new ExtCodeCopyOperation(gasCalculator));
registry.put(new ExtCodeSizeOperation(gasCalculator));
registry.put(new BlockHashOperation(gasCalculator));
registry.put(new CoinbaseOperation(gasCalculator));
registry.put(new TimestampOperation(gasCalculator));
registry.put(new NumberOperation(gasCalculator));
registry.put(new DifficultyOperation(gasCalculator));
registry.put(new GasLimitOperation(gasCalculator));
registry.put(new PopOperation(gasCalculator));
registry.put(new MLoadOperation(gasCalculator));
registry.put(new MStoreOperation(gasCalculator));
registry.put(new MStore8Operation(gasCalculator));
registry.put(new SLoadOperation(gasCalculator));
registry.put(new SStoreOperation(gasCalculator, SStoreOperation.FRONTIER_MINIMUM));
registry.put(new JumpOperation(gasCalculator));
registry.put(new JumpiOperation(gasCalculator));
registry.put(new PCOperation(gasCalculator));
registry.put(new MSizeOperation(gasCalculator));
registry.put(new GasOperation(gasCalculator));
registry.put(new JumpDestOperation(gasCalculator));
registry.put(new ReturnOperation(gasCalculator));
registry.put(new InvalidOperation(gasCalculator));
registry.put(new StopOperation(gasCalculator));
registry.put(new SelfDestructOperation(gasCalculator));
registry.put(new CreateOperation(gasCalculator));
registry.put(new CallOperation(gasCalculator));
registry.put(new CallCodeOperation(gasCalculator));
// Register the PUSH1, PUSH2, ..., PUSH32 operations.
for (int i = 1; i <= 32; ++i) {
registry.put(new PushOperation(i, gasCalculator));
}
// Register the DUP1, DUP2, ..., DUP16 operations.
for (int i = 1; i <= 16; ++i) {
registry.put(new DupOperation(i, gasCalculator));
}
// Register the SWAP1, SWAP2, ..., SWAP16 operations.
for (int i = 1; i <= 16; ++i) {
registry.put(new SwapOperation(i, gasCalculator));
}
// Register the LOG0, LOG1, ..., LOG4 operations.
for (int i = 0; i < 5; ++i) {
registry.put(new LogOperation(i, gasCalculator));
}
}
Aggregations