Example #1
0
        public ExecutionStatus Execute()
        {
            var method = Exports.GetMethod("start");

            if (method is null)
            {
                return(ExecutionStatus.MissingEntry);
            }
            var gasLimitField = Exports.GetField("💩 GasLimit");

            gasLimitField.SetValue(null, GasLimit);
            try
            {
                CompiledInstance.Exports.start();
            }
            catch (OverflowException e)
            {
                Logger.LogWarning($"Overflow exception {e}");
                throw new OutOfGasException(GasUsed);
            }
            catch (InvalidProgramException e)
            {
                Logger.LogWarning($"Invalid program exception {e}");
                return(ExecutionStatus.JitCorruption);
            }

            return(ExecutionStatus.Ok);
        }