예제 #1
0
        protected VmTestResultTracer Execute(UInt256 blockNumber, long gasLimit, byte[] code)
        {
            (var block, var transaction) = PrepareTx(blockNumber, gasLimit, code);
            VmTestResultTracer tracer = new VmTestResultTracer();

            _processor.Execute(transaction, block.Header, tracer);
            return(tracer);
        }
예제 #2
0
        protected VmTestResultTracer Execute(params byte[] code)
        {
            (var block, var transaction) = PrepareTx(BlockNumber, 100000, code);
            VmTestResultTracer tracer = new VmTestResultTracer();

            _processor.Execute(transaction, block.Header, tracer);
            return(tracer);
        }
예제 #3
0
        public void Shift_right(string a, string b, string result)
        {
            byte[] code = Prepare.EvmCode
                          .PushData(a)
                          .PushData(b)
                          .Op(Instruction.SHR)
                          .PushData(0)
                          .Op(Instruction.SSTORE)
                          .Done;

            VmTestResultTracer receipt = Execute(code);

            AssertEip145(receipt, result);
        }
예제 #4
0
 private void AssertEip145(VmTestResultTracer receipt, byte[] result)
 {
     AssertStorage(0, result);
     AssertGas(receipt, result.IsZero() ? ZeroResultGas : NonZeroResultGas);
 }
예제 #5
0
 private void AssertEip145(VmTestResultTracer receipt, string result)
 {
     AssertEip145(receipt, Bytes.FromHexString(result));
 }
예제 #6
0
 private void AssertEip145(VmTestResultTracer receipt, byte result)
 {
     AssertEip145(receipt, new[] { result });
 }
예제 #7
0
 protected void AssertGas(VmTestResultTracer receipt, long gas)
 {
     Assert.AreEqual(gas, receipt.GasUsed, "gas");
 }