public void Nothing_to_commit()
        {
            EvmState parentEvmState = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);
            EvmState evmState       = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);

            evmState.CommitToParent(parentEvmState);
        }
        public void Commit_adds_refunds()
        {
            EvmState parentEvmState = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);
            EvmState evmState       = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);

            evmState.CommitToParent(parentEvmState);
            parentEvmState.Refund.Should().Be(evmState.Refund);
        }
Exemple #3
0
        public void Nothing_to_commit()
        {
            EvmState parentEvmState = CreateEvmState();

            using (EvmState evmState = CreateEvmState(parentEvmState))
            {
                evmState.CommitToParent(parentEvmState);
            }
        }
        public void Address_to_commit_keeps_it_warm()
        {
            EvmState parentEvmState = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);
            EvmState evmState       = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);

            evmState.WarmUp(TestItem.AddressA);

            evmState.CommitToParent(parentEvmState);
            parentEvmState.IsCold(TestItem.AddressA).Should().BeFalse();
        }
        public void Destroy_list_is_committed()
        {
            EvmState parentEvmState = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);
            EvmState evmState       = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);

            evmState.DestroyList.Add(Address.Zero);

            evmState.CommitToParent(parentEvmState);
            parentEvmState.DestroyList.Contains(Address.Zero).Should().BeTrue();
        }
        public void Logs_are_committed()
        {
            EvmState parentEvmState = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);
            EvmState evmState       = new EvmState(10000, new ExecutionEnvironment(), ExecutionType.Call, true, false);
            LogEntry logEntry       = new LogEntry(Address.Zero, Bytes.Empty, Array.Empty <Keccak>());

            evmState.Logs.Add(logEntry);

            evmState.CommitToParent(parentEvmState);
            parentEvmState.Logs.Contains(logEntry).Should().BeTrue();
        }
Exemple #7
0
        public void Commit_adds_refunds()
        {
            EvmState parentEvmState = CreateEvmState();

            using (EvmState evmState = CreateEvmState(parentEvmState))
            {
                evmState.Refund = 333;
                evmState.CommitToParent(parentEvmState);
            }

            parentEvmState.Refund.Should().Be(333);
        }
Exemple #8
0
        public void Destroy_list_is_committed()
        {
            EvmState parentEvmState = CreateEvmState();

            using (EvmState evmState = CreateEvmState(parentEvmState))
            {
                evmState.DestroyList.Add(Address.Zero);
                evmState.CommitToParent(parentEvmState);
            }

            parentEvmState.DestroyList.Contains(Address.Zero).Should().BeTrue();
        }
Exemple #9
0
        public void Address_to_commit_keeps_it_warm()
        {
            EvmState parentEvmState = CreateEvmState();

            using (EvmState evmState = CreateEvmState(parentEvmState))
            {
                evmState.WarmUp(TestItem.AddressA);
                evmState.CommitToParent(parentEvmState);
            }

            parentEvmState.IsCold(TestItem.AddressA).Should().BeFalse();
        }
Exemple #10
0
        public void Logs_are_committed()
        {
            EvmState parentEvmState = CreateEvmState();
            LogEntry logEntry       = new(Address.Zero, Bytes.Empty, Array.Empty <Keccak>());

            using (EvmState evmState = CreateEvmState(parentEvmState))
            {
                evmState.Logs.Add(logEntry);
                evmState.CommitToParent(parentEvmState);
            }

            parentEvmState.Logs.Contains(logEntry).Should().BeTrue();
        }
Exemple #11
0
        public void Storage_to_commit_keeps_it_warm()
        {
            EvmState    parentEvmState = CreateEvmState();
            StorageCell storageCell    = new(TestItem.AddressA, 1);

            using (EvmState evmState = CreateEvmState(parentEvmState))
            {
                evmState.WarmUp(storageCell);
                evmState.CommitToParent(parentEvmState);
            }

            parentEvmState.IsCold(storageCell).Should().BeFalse();
        }