Example #1
0
        public unsafe (ReadOnlyMemory <byte>, bool) Run(ReadOnlyMemory <byte> inputData, IReleaseSpec releaseSpec)
        {
            Metrics.Bn256AddPrecompile++;
            Span <byte> inputDataSpan = stackalloc byte[128];

            inputData.PrepareEthInput(inputDataSpan);

            Span <byte> output  = stackalloc byte[64];
            bool        success = ShamatarLib.Bn256Add(inputDataSpan, output);

            (byte[], bool)result;
            if (success)
            {
                result = (output.ToArray(), true);
            }
            else
            {
                result = (Array.Empty <byte>(), false);
            }

            return(result);
        }