Coverage Summary for Class: ExecutionEnvironment (co.rsk.pcc)
Class |
Class, %
|
Method, %
|
Line, %
|
ExecutionEnvironment |
0%
(0/1)
|
0%
(0/9)
|
0%
(0/16)
|
1 /*
2 * This file is part of RskJ
3 * Copyright (C) 2019 RSK Labs Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 package co.rsk.pcc;
20
21 import org.ethereum.config.blockchain.upgrades.ActivationConfig;
22 import org.ethereum.core.Block;
23 import org.ethereum.core.Repository;
24 import org.ethereum.core.Transaction;
25 import org.ethereum.db.BlockStore;
26 import org.ethereum.db.ReceiptStore;
27 import org.ethereum.vm.LogInfo;
28
29 import java.util.List;
30
31 /**
32 * Represents the execution environment of a particular native contract's method execution.
33 * Things as block-dependent configuration, execution block and repository are kept here.
34 *
35 * @author Ariel Mendelzon
36 */
37 public class ExecutionEnvironment {
38 private ActivationConfig.ForBlock activations;
39 private Transaction transaction;
40 private Block block;
41 private Repository repository;
42 private BlockStore blockStore;
43 private ReceiptStore receiptStore;
44 private List<LogInfo> logs;
45
46 public ExecutionEnvironment(
47 ActivationConfig activationConfig,
48 Transaction transaction,
49 Block block,
50 Repository repository,
51 BlockStore blockStore,
52 ReceiptStore receiptStore,
53 List<LogInfo> logs) {
54 this.activations = activationConfig.forBlock(block.getNumber());
55 this.transaction = transaction;
56 this.block = block;
57 this.repository = repository;
58 this.blockStore = blockStore;
59 this.receiptStore = receiptStore;
60 this.logs = logs;
61 }
62
63 public ActivationConfig.ForBlock getActivations() {
64 return activations;
65 }
66
67 public Transaction getTransaction() {
68 return transaction;
69 }
70
71 public Block getBlock() {
72 return block;
73 }
74
75 public Repository getRepository() {
76 return repository;
77 }
78
79 public BlockStore getBlockStore() {
80 return blockStore;
81 }
82
83 public ReceiptStore getReceiptStore() {
84 return receiptStore;
85 }
86
87 public List<LogInfo> getLogs() {
88 return logs;
89 }
90
91 public boolean isLocalCall() {
92 return transaction.isLocalCallTransaction();
93 }
94 }