conflict_resolution
stringlengths
27
16k
<<<<<<< import org.tron.api.GrpcAPI.ProposalList; ======= import org.tron.api.GrpcAPI.Return.response_code; >>>>>>> import org.tron.api.GrpcAPI.ProposalList; import org.tron.api.GrpcAPI.Return.response_code;
<<<<<<< import org.tron.protos.Contract.MerklePath; ======= import org.tron.protos.Contract.CreateSmartContract.Builder; >>>>>>> import org.tron.protos.Contract.MerklePath; import org.tron.protos.Contract.CreateSmartContract.Builder;
<<<<<<< try { this.getDeferredTransactionOccupySpace(); } catch (IllegalArgumentException e) { this.saveDeferredTransactionOccupySpace(0); } ======= >>>>>>> try { this.getDeferredTransactionOccupySpace(); } catch (IllegalArgumentException e) { this.saveDeferredTransactionOccupySpace(0); }
<<<<<<< logExecutor.scheduleWithFixedDelay(() -> { try { logNodeStatus(); } catch (Throwable t) { logger.error("Exception in log worker", t); } }, 10, 10, TimeUnit.SECONDS); ======= cleanInventoryExecutor.scheduleWithFixedDelay(() -> { try { getActivePeer().forEach(p -> p.cleanInvGarbage()); } catch (Throwable t) { logger.error("Unhandled exception", t); } }, 2, NetConstants.MAX_INVENTORY_SIZE_IN_MINUTES / 2, TimeUnit.MINUTES); >>>>>>> logExecutor.scheduleWithFixedDelay(() -> { try { logNodeStatus(); } catch (Throwable t) { logger.error("Exception in log worker", t); } }, 10, 10, TimeUnit.SECONDS); cleanInventoryExecutor.scheduleWithFixedDelay(() -> { try { getActivePeer().forEach(p -> p.cleanInvGarbage()); } catch (Throwable t) { logger.error("Unhandled exception", t); } }, 2, NetConstants.MAX_INVENTORY_SIZE_IN_MINUTES / 2, TimeUnit.MINUTES);
<<<<<<< import static org.fusesource.jansi.Ansi.ansi; public class ConsensusCommand { ======= public class ConsensusCommand extends Command { >>>>>>> import static org.fusesource.jansi.Ansi.ansi; public class ConsensusCommand extends Command {
<<<<<<< @Getter @Setter private static boolean isECKeyCryptoEngine; ======= @Getter @Setter private static String transactionHistoreSwitch; >>>>>>> @Getter @Setter private static boolean isECKeyCryptoEngine; @Getter @Setter private static String transactionHistoreSwitch;
<<<<<<< import org.apache.commons.lang3.ArrayUtils; ======= import org.apache.commons.lang3.StringUtils; >>>>>>> import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils;
<<<<<<< import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLatestNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLimitNextOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetExchangeByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetMerkleTreeVoucherInfoOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNodeInfoOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNowBlockOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetPaginatedAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetTransactionCountByBlockNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.IsSpendOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListExchangesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListWitnessesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ScanAndMarkNoteByIvkOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ScanNoteByIvkOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ScanNoteByOvkOnSolidityServlet; ======= import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLatestNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLimitNextOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBrokerageOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetExchangeByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNodeInfoOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNowBlockOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetPaginatedAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetRewardOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetTransactionCountByBlockNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListExchangesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListWitnessesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.TriggerConstantContractOnSolidityServlet; >>>>>>> import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLatestNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLimitNextOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBrokerageOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetExchangeByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetMerkleTreeVoucherInfoOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNodeInfoOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNowBlockOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetPaginatedAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetRewardOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetTransactionCountByBlockNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.IsSpendOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListExchangesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListWitnessesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ScanAndMarkNoteByIvkOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ScanNoteByIvkOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ScanNoteByOvkOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.TriggerConstantContractOnSolidityServlet; <<<<<<< @Autowired private GetMerkleTreeVoucherInfoOnSolidityServlet getMerkleTreeVoucherInfoOnSolidityServlet; @Autowired private ScanNoteByIvkOnSolidityServlet scanNoteByIvkOnSolidityServlet; @Autowired private ScanAndMarkNoteByIvkOnSolidityServlet scanAndMarkNoteByIvkOnSolidityServlet; @Autowired private ScanNoteByOvkOnSolidityServlet scanNoteByOvkOnSolidityServlet; @Autowired private IsSpendOnSolidityServlet isSpendOnSolidityServlet; ======= @Autowired private GetBrokerageOnSolidityServlet getBrokerageServlet; @Autowired private GetRewardOnSolidityServlet getRewardServlet; @Autowired private TriggerConstantContractOnSolidityServlet triggerConstantContractOnSolidityServlet; >>>>>>> @Autowired private GetMerkleTreeVoucherInfoOnSolidityServlet getMerkleTreeVoucherInfoOnSolidityServlet; @Autowired private ScanNoteByIvkOnSolidityServlet scanNoteByIvkOnSolidityServlet; @Autowired private ScanAndMarkNoteByIvkOnSolidityServlet scanAndMarkNoteByIvkOnSolidityServlet; @Autowired private ScanNoteByOvkOnSolidityServlet scanNoteByOvkOnSolidityServlet; @Autowired private IsSpendOnSolidityServlet isSpendOnSolidityServlet; @Autowired private GetBrokerageOnSolidityServlet getBrokerageServlet; @Autowired private GetRewardOnSolidityServlet getRewardServlet; @Autowired private TriggerConstantContractOnSolidityServlet triggerConstantContractOnSolidityServlet; <<<<<<< context.addServlet(new ServletHolder(getMerkleTreeVoucherInfoOnSolidityServlet), "/walletsolidity/getmerkletreevoucherinfo"); context.addServlet(new ServletHolder(scanAndMarkNoteByIvkOnSolidityServlet), "/walletsolidity/scanandmarknotebyivk"); context.addServlet(new ServletHolder(scanNoteByIvkOnSolidityServlet), "/walletsolidity/scannotebyivk"); context.addServlet(new ServletHolder(scanNoteByOvkOnSolidityServlet), "/walletsolidity/scannotebyovk"); context.addServlet(new ServletHolder(isSpendOnSolidityServlet), "/walletsolidity/isspend"); ======= context.addServlet(new ServletHolder(triggerConstantContractOnSolidityServlet), "/walletsolidity/triggerconstantcontract"); >>>>>>> context.addServlet(new ServletHolder(getMerkleTreeVoucherInfoOnSolidityServlet), "/walletsolidity/getmerkletreevoucherinfo"); context.addServlet(new ServletHolder(scanAndMarkNoteByIvkOnSolidityServlet), "/walletsolidity/scanandmarknotebyivk"); context.addServlet(new ServletHolder(scanNoteByIvkOnSolidityServlet), "/walletsolidity/scannotebyivk"); context.addServlet(new ServletHolder(scanNoteByOvkOnSolidityServlet), "/walletsolidity/scannotebyovk"); context.addServlet(new ServletHolder(isSpendOnSolidityServlet), "/walletsolidity/isspend"); context.addServlet(new ServletHolder(triggerConstantContractOnSolidityServlet), "/walletsolidity/triggerconstantcontract");
<<<<<<< // according to version if (IS_NEW_VERSION) { // TODO according to version return getTotalEnergyLimitWithFixRatio(creator, caller, contract, feeLimit, callValue); ======= // according to version if (IS_NEW_VERSION) { return getEnergyLimitWithFixRatio(creator, caller, contract, feeLimit, callValue); >>>>>>> // according to version if (IS_NEW_VERSION) { // TODO according to version return getTotalEnergyLimitWithFixRatio(creator, caller, contract, feeLimit, callValue); <<<<<<< ======= public long getEnergyLimit(AccountCapsule creator, long feeLimit, long callValue) { // according to version if (IS_NEW_VERSION) { return getEnergyLimitWithFixRatio(creator, feeLimit, callValue); } else { return getEnergyLimitWithFloatRatio(creator, feeLimit, callValue); } } >>>>>>> <<<<<<< AccountCapsule creator = this.deposit .getAccount(newSmartContract.getOriginAddress().toByteArray()); long energyLimit; if (IS_NEW_VERSION) { // TODO according to version if (callValue < 0) { throw new ContractValidateException("callValue must >= 0"); } if (newSmartContract.getOriginEnergyLimit() <= 0) { ======= // according to version if (RuntimeImpl.IS_NEW_VERSION) { long originEnergyLimit = newSmartContract.getOriginEnergyLimit(); if (originEnergyLimit <= 0) { >>>>>>> AccountCapsule creator = this.deposit .getAccount(newSmartContract.getOriginAddress().toByteArray()); long energyLimit; if (IS_NEW_VERSION) { // TODO according to version if (callValue < 0) { throw new ContractValidateException("callValue must >= 0"); } if (newSmartContract.getOriginEnergyLimit() <= 0) {
<<<<<<< public static final String METRICS_STORAGE_ENABLE = "node.metrics.storageEnable"; public static final String METRICS_INFLUXDB_IP = "node.metrics.influxdb.ip"; public static final String METRICS_INFLUXDB_PORT = "node.metrics.influxdb.port"; public static final String METRICS_INFLUXDB_DATABASE = "node.metrics.influxdb.database"; public static final String METRICS_REPORT_INTERVAL = "node.metrics.influxdb.metricsReportInterval"; ======= public static final String COMMITTEE_ALLOW_PBFT = "committee.allowPBFT"; public static final String NODE_AGREE_NODE_COUNT = "node.agreeNodeCount"; >>>>>>> public static final String COMMITTEE_ALLOW_PBFT = "committee.allowPBFT"; public static final String NODE_AGREE_NODE_COUNT = "node.agreeNodeCount"; public static final String METRICS_STORAGE_ENABLE = "node.metrics.storageEnable"; public static final String METRICS_INFLUXDB_IP = "node.metrics.influxdb.ip"; public static final String METRICS_INFLUXDB_PORT = "node.metrics.influxdb.port"; public static final String METRICS_INFLUXDB_DATABASE = "node.metrics.influxdb.database"; public static final String METRICS_REPORT_INTERVAL = "node.metrics.influxdb.metricsReportInterval";
<<<<<<< import org.tron.core.exception.ValidateBandwidthException; ======= import org.tron.core.exception.TaposException; >>>>>>> import org.tron.core.exception.TaposException; import org.tron.core.exception.ValidateBandwidthException;
<<<<<<< ((AbstractRevokingStore) revokingStore).setMaxSize((int) ( dynamicPropertiesStore.getLatestBlockHeaderNumber() - dynamicPropertiesStore.getLatestSolidifiedBlockNum() + 1) ); logger.info("update solid block, num = {}", latestSolidifiedBlockNum); ======= >>>>>>> ((AbstractRevokingStore) revokingStore).setMaxSize((int) ( dynamicPropertiesStore.getLatestBlockHeaderNumber() - dynamicPropertiesStore.getLatestSolidifiedBlockNum() + 1) ); logger.info("update solid block, num = {}", latestSolidifiedBlockNum);
<<<<<<< import org.tron.core.Constant; import org.tron.core.Wallet; import org.tron.core.db.AccountStore; ======= import org.tron.core.config.Configuration; >>>>>>> import org.tron.core.Constant; import org.tron.core.Wallet; import org.tron.core.db.AccountStore; import org.tron.core.config.Configuration;
<<<<<<< Function<Table.ID,Boolean> existenceCheck = tableId -> !deletedTableId.contentEquals(tableId.canonicalID()); LargestFirstMemoryManagerWithExistenceCheck mgr = new LargestFirstMemoryManagerWithExistenceCheck(existenceCheck); ======= Function<String,Boolean> existenceCheck = new Function<String,Boolean>() { @Override public Boolean apply(String tableId) { return !deletedTableId.equals(tableId); } }; LargestFirstMemoryManagerWithExistenceCheck mgr = new LargestFirstMemoryManagerWithExistenceCheck( existenceCheck); >>>>>>> Function<Table.ID,Boolean> existenceCheck = tableId -> !deletedTableId .contentEquals(tableId.canonicalID()); LargestFirstMemoryManagerWithExistenceCheck mgr = new LargestFirstMemoryManagerWithExistenceCheck( existenceCheck); <<<<<<< KeyExtent extent = new KeyExtent(Table.ID.of("2"), new Text("j"), null); result = mgr.getMemoryManagementActions(tablets(t(extent, ZERO, ONE_GIG, 0), t(k("j"), ZERO, ONE_GIG, 0))); ======= KeyExtent extent = new KeyExtent("2", new Text("j"), null); result = mgr.getMemoryManagementActions( tablets(t(extent, ZERO, ONE_GIG, 0), t(k("j"), ZERO, ONE_GIG, 0))); >>>>>>> KeyExtent extent = new KeyExtent(Table.ID.of("2"), new Text("j"), null); result = mgr.getMemoryManagementActions( tablets(t(extent, ZERO, ONE_GIG, 0), t(k("j"), ZERO, ONE_GIG, 0)));
<<<<<<< consumeBandwidth(trx); validateTapos(trx); ======= //validateTapos(trx); validateFreq(trx); >>>>>>> consumeBandwidth(trx); //validateTapos(trx); validateFreq(trx);
<<<<<<< import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.spongycastle.util.encoders.Hex; import org.tron.common.crypto.ECKey; import org.tron.common.overlay.discover.Node; import org.tron.common.overlay.message.MessageCodec; import org.tron.common.utils.ByteUtil; import java.io.*; ======= import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.Writer; >>>>>>> import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.spongycastle.util.encoders.Hex; import org.tron.common.crypto.ECKey; import org.tron.common.overlay.discover.Node; import org.tron.common.overlay.message.MessageCodec; import org.tron.common.utils.ByteUtil; import java.io.*; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.Writer;
<<<<<<< ======= import org.tron.core.capsule.BlockCapsule; >>>>>>> import org.tron.core.capsule.BlockCapsule; <<<<<<< Thread.sleep(1000); Map<ByteArrayWrapper, Channel> activePeers = ReflectUtils .getFieldValue(channelManager, "activePeers"); int tryTimes = 0; while (MapUtils.isEmpty(activePeers) && ++tryTimes < 10) { Thread.sleep(1000); } ======= Thread.sleep(5000); // List<Channel> newChanelList = ReflectUtils.getFieldValue(channelManager, "newPeers"); // int tryTimes = 0; // while (CollectionUtils.isEmpty(newChanelList) && ++tryTimes < 10) { // Thread.sleep(1000); // } // logger.info("newChanelList size : {}", newChanelList.size()); // Field activePeersField = channelManager.getClass().getDeclaredField("activePeers"); // activePeersField.setAccessible(true); // Map<ByteArrayWrapper, Channel> activePeersMap = (Map<ByteArrayWrapper, Channel>) activePeersField // .get(channelManager); // // Field apField = pool.getClass().getDeclaredField("activePeers"); // apField.setAccessible(true); // List<PeerConnection> activePeers = (List<PeerConnection>) apField.get(pool); // for (Channel channel : newChanelList) { // activePeersMap.put(channel.getNodeIdWrapper(), channel); // activePeers.add((PeerConnection) channel); // } // apField.set(pool, activePeers); // activePeersField.set(channelManager, activePeersMap); // >>>>>>> Thread.sleep(5000);
<<<<<<< import org.tron.common.overlay.discover.node.Node; ======= import org.tron.common.overlay.discover.Node; import org.tron.common.overlay.server.Channel; >>>>>>> import org.tron.common.overlay.discover.node.Node; import org.tron.common.overlay.server.Channel; <<<<<<< private void prepare() { try { ExecutorService advertiseLoopThread = ReflectUtils.getFieldValue(node, "broadPool"); advertiseLoopThread.shutdownNow(); ReflectUtils.setFieldValue(node, "isAdvertiseActive", false); ReflectUtils.setFieldValue(node, "isFetchActive", false); // ScheduledExecutorService mainWorker = ReflectUtils // .getFieldValue(channelManager, "mainWorker"); // mainWorker.shutdownNow(); Node node = new Node( "enode://e437a4836b77ad9d9ffe73ee782ef2614e6d8370fcf62191a6e488276e23717147073a7ce0b444d485fff5a0c34c4577251a7a990cf80d8542e21b95aa8c5e6c@127.0.0.1:17891"); new Thread(new Runnable() { @Override public void run() { peerClient.connect(node.getHost(), node.getPort(), node.getHexId()); } }).start(); Thread.sleep(1000); // List<Channel> newChanelList = ReflectUtils.getFieldValue(channelManager, "newPeers"); // int tryTimes = 0; // while (CollectionUtils.isEmpty(newChanelList) && ++tryTimes < 10) { // Thread.sleep(1000); // } // logger.info("newChanelList size : {}", newChanelList.size()); // // Field activePeersField = channelManager.getClass().getDeclaredField("activePeers"); // activePeersField.setAccessible(true); // Map<ByteArrayWrapper, Channel> activePeersMap = (Map<ByteArrayWrapper, Channel>) activePeersField // .get(channelManager); // // Field apField = pool.getClass().getDeclaredField("activePeers"); // apField.setAccessible(true); // List<PeerConnection> activePeers = (List<PeerConnection>) apField.get(pool); // // for (Channel channel : newChanelList) { // activePeersMap.put(channel.getNodeIdWrapper(), channel); // activePeers.add((PeerConnection) channel); // } // apField.set(pool, activePeers); // activePeersField.set(channelManager, activePeersMap); // go = true; } catch (Exception e) { e.printStackTrace(); ======= } private void prepare() { try { ExecutorService advertiseLoopThread = ReflectUtils.getFieldValue(node, "broadPool"); advertiseLoopThread.shutdownNow(); ReflectUtils.setFieldValue(node, "isAdvertiseActive", false); ReflectUtils.setFieldValue(node, "isFetchActive", false); org.tron.common.overlay.discover.Node node = new Node( "enode://e437a4836b77ad9d9ffe73ee782ef2614e6d8370fcf62191a6e488276e23717147073a7ce0b444d485fff5a0c34c4577251a7a990cf80d8542e21b95aa8c5e6c@127.0.0.1:17891"); new Thread(new Runnable() { @Override public void run() { peerClient.connect(node.getHost(), node.getPort(), node.getHexId()); >>>>>>> } private void prepare() { try { ExecutorService advertiseLoopThread = ReflectUtils.getFieldValue(node, "broadPool"); advertiseLoopThread.shutdownNow(); ReflectUtils.setFieldValue(node, "isAdvertiseActive", false); ReflectUtils.setFieldValue(node, "isFetchActive", false); Node node = new Node( "enode://e437a4836b77ad9d9ffe73ee782ef2614e6d8370fcf62191a6e488276e23717147073a7ce0b444d485fff5a0c34c4577251a7a990cf80d8542e21b95aa8c5e6c@127.0.0.1:17891"); new Thread(new Runnable() { @Override public void run() { peerClient.connect(node.getHost(), node.getPort(), node.getHexId());
<<<<<<< private static final long BLOCK_LIMIT_NUM = 100; private static final long TRANSACTION_LIMIT_NUM = 1000; ======= public static final String CONTRACT_VALIDATE_EXCEPTION = "ContractValidateException: {}"; >>>>>>> private static final long BLOCK_LIMIT_NUM = 100; private static final long TRANSACTION_LIMIT_NUM = 1000; public static final String CONTRACT_VALIDATE_EXCEPTION = "ContractValidateException: {}"; <<<<<<< @Override public void getMerkleTreeVoucherInfo(OutputPointInfo request, StreamObserver<IncrementalMerkleVoucherInfo> responseObserver) { try { IncrementalMerkleVoucherInfo witnessInfo = wallet .getMerkleTreeVoucherInfo(request); responseObserver.onNext(witnessInfo); } catch (Exception ex) { responseObserver.onError(getRunTimeException(ex)); } responseObserver.onCompleted(); } @Override public void scanNoteByIvk(GrpcAPI.IvkDecryptParameters request, StreamObserver<GrpcAPI.DecryptNotes> responseObserver) { long startNum = request.getStartBlockIndex(); long endNum = request.getEndBlockIndex(); try { DecryptNotes decryptNotes = wallet .scanNoteByIvk(startNum, endNum, request.getIvk().toByteArray()); responseObserver.onNext(decryptNotes); } catch (BadItemException | ZksnarkException e) { responseObserver.onError(getRunTimeException(e)); } responseObserver.onCompleted(); } @Override public void scanAndMarkNoteByIvk(GrpcAPI.IvkDecryptAndMarkParameters request, StreamObserver<GrpcAPI.DecryptNotesMarked> responseObserver) { long startNum = request.getStartBlockIndex(); long endNum = request.getEndBlockIndex(); try { DecryptNotesMarked decryptNotes = wallet.scanAndMarkNoteByIvk(startNum, endNum, request.getIvk().toByteArray(), request.getAk().toByteArray(), request.getNk().toByteArray()); responseObserver.onNext(decryptNotes); } catch (BadItemException | ZksnarkException | InvalidProtocolBufferException | ItemNotFoundException e) { responseObserver.onError(getRunTimeException(e)); } responseObserver.onCompleted(); } @Override public void scanNoteByOvk(GrpcAPI.OvkDecryptParameters request, StreamObserver<GrpcAPI.DecryptNotes> responseObserver) { long startNum = request.getStartBlockIndex(); long endNum = request.getEndBlockIndex(); try { DecryptNotes decryptNotes = wallet .scanNoteByOvk(startNum, endNum, request.getOvk().toByteArray()); responseObserver.onNext(decryptNotes); } catch (BadItemException | ZksnarkException e) { responseObserver.onError(getRunTimeException(e)); } responseObserver.onCompleted(); } @Override public void isSpend(NoteParameters request, StreamObserver<SpendResult> responseObserver) { try { responseObserver.onNext(wallet.isSpend(request)); } catch (Exception e) { responseObserver.onError(getRunTimeException(e)); } responseObserver.onCompleted(); } ======= @Override public void getRewardInfo(BytesMessage request, StreamObserver<NumberMessage> responseObserver) { try { long value = dbManager.getDelegationService().queryReward(request.getValue().toByteArray()); NumberMessage.Builder builder = NumberMessage.newBuilder(); builder.setNum(value); responseObserver.onNext(builder.build()); } catch (Exception e) { responseObserver.onError(e); } responseObserver.onCompleted(); } @Override public void getBrokerageInfo(BytesMessage request, StreamObserver<NumberMessage> responseObserver) { try { long cycle = dbManager.getDynamicPropertiesStore().getCurrentCycleNumber(); long value = dbManager.getDelegationStore() .getBrokerage(cycle, request.getValue().toByteArray()); NumberMessage.Builder builder = NumberMessage.newBuilder(); builder.setNum(value); responseObserver.onNext(builder.build()); } catch (Exception e) { responseObserver.onError(e); } responseObserver.onCompleted(); } @Override public void triggerConstantContract(Contract.TriggerSmartContract request, StreamObserver<TransactionExtention> responseObserver) { callContract(request, responseObserver, true); } >>>>>>> @Override public void getMerkleTreeVoucherInfo(OutputPointInfo request, StreamObserver<IncrementalMerkleVoucherInfo> responseObserver) { try { IncrementalMerkleVoucherInfo witnessInfo = wallet .getMerkleTreeVoucherInfo(request); responseObserver.onNext(witnessInfo); } catch (Exception ex) { responseObserver.onError(getRunTimeException(ex)); } responseObserver.onCompleted(); } @Override public void getRewardInfo(BytesMessage request, StreamObserver<NumberMessage> responseObserver) { try { long value = dbManager.getDelegationService().queryReward(request.getValue().toByteArray()); NumberMessage.Builder builder = NumberMessage.newBuilder(); builder.setNum(value); responseObserver.onNext(builder.build()); } catch (Exception e) { responseObserver.onError(e); } responseObserver.onCompleted(); } @Override public void scanNoteByIvk(GrpcAPI.IvkDecryptParameters request, StreamObserver<GrpcAPI.DecryptNotes> responseObserver) { long startNum = request.getStartBlockIndex(); long endNum = request.getEndBlockIndex(); try { DecryptNotes decryptNotes = wallet .scanNoteByIvk(startNum, endNum, request.getIvk().toByteArray()); responseObserver.onNext(decryptNotes); } catch (BadItemException | ZksnarkException e) { responseObserver.onError(getRunTimeException(e)); } responseObserver.onCompleted(); } @Override public void scanAndMarkNoteByIvk(GrpcAPI.IvkDecryptAndMarkParameters request, StreamObserver<GrpcAPI.DecryptNotesMarked> responseObserver) { long startNum = request.getStartBlockIndex(); long endNum = request.getEndBlockIndex(); try { DecryptNotesMarked decryptNotes = wallet.scanAndMarkNoteByIvk(startNum, endNum, request.getIvk().toByteArray(), request.getAk().toByteArray(), request.getNk().toByteArray()); responseObserver.onNext(decryptNotes); } catch (BadItemException | ZksnarkException | InvalidProtocolBufferException | ItemNotFoundException e) { responseObserver.onError(getRunTimeException(e)); } responseObserver.onCompleted(); } @Override public void getBrokerageInfo(BytesMessage request, StreamObserver<NumberMessage> responseObserver) { try { long cycle = dbManager.getDynamicPropertiesStore().getCurrentCycleNumber(); long value = dbManager.getDelegationStore() .getBrokerage(cycle, request.getValue().toByteArray()); NumberMessage.Builder builder = NumberMessage.newBuilder(); builder.setNum(value); responseObserver.onNext(builder.build()); } catch (Exception e) { responseObserver.onError(e); } responseObserver.onCompleted(); } @Override public void scanNoteByOvk(GrpcAPI.OvkDecryptParameters request, StreamObserver<GrpcAPI.DecryptNotes> responseObserver) { long startNum = request.getStartBlockIndex(); long endNum = request.getEndBlockIndex(); try { DecryptNotes decryptNotes = wallet .scanNoteByOvk(startNum, endNum, request.getOvk().toByteArray()); responseObserver.onNext(decryptNotes); } catch (BadItemException | ZksnarkException e) { responseObserver.onError(getRunTimeException(e)); } responseObserver.onCompleted(); } @Override public void isSpend(NoteParameters request, StreamObserver<SpendResult> responseObserver) { try { responseObserver.onNext(wallet.isSpend(request)); } catch (Exception e) { responseObserver.onError(getRunTimeException(e)); } responseObserver.onCompleted(); } @Override public void triggerConstantContract(Contract.TriggerSmartContract request, StreamObserver<TransactionExtention> responseObserver) { callContract(request, responseObserver, true); } <<<<<<< .setMessage(ByteString.copyFromUtf8(CONTRACT_VALIDATE_ERROR + e.getMessage())); logger.debug("ContractValidateException: {}", e.getMessage()); ======= .setMessage(ByteString.copyFromUtf8("contract validate error : " + e.getMessage())); logger.debug(CONTRACT_VALIDATE_EXCEPTION, e.getMessage()); >>>>>>> .setMessage(ByteString.copyFromUtf8(CONTRACT_VALIDATE_ERROR + e.getMessage())); logger.debug(CONTRACT_VALIDATE_EXCEPTION, e.getMessage()); <<<<<<< private void callContract(Contract.TriggerSmartContract request, StreamObserver<TransactionExtention> responseObserver, boolean isConstant) { TransactionExtention.Builder trxExtBuilder = TransactionExtention.newBuilder(); Return.Builder retBuilder = Return.newBuilder(); try { TransactionCapsule trxCap = createTransactionCapsule(request, ContractType.TriggerSmartContract); Transaction trx; if (isConstant) { trx = wallet.triggerConstantContract(request, trxCap, trxExtBuilder, retBuilder); } else { trx = wallet.triggerContract(request, trxCap, trxExtBuilder, retBuilder); } trxExtBuilder.setTransaction(trx); trxExtBuilder.setTxid(trxCap.getTransactionId().getByteString()); retBuilder.setResult(true).setCode(response_code.SUCCESS); trxExtBuilder.setResult(retBuilder); } catch (ContractValidateException | VMIllegalException e) { retBuilder.setResult(false).setCode(response_code.CONTRACT_VALIDATE_ERROR) .setMessage(ByteString.copyFromUtf8(CONTRACT_VALIDATE_ERROR + e.getMessage())); trxExtBuilder.setResult(retBuilder); logger.warn("ContractValidateException: {}", e.getMessage()); } catch (RuntimeException e) { retBuilder.setResult(false).setCode(response_code.CONTRACT_EXE_ERROR) .setMessage(ByteString.copyFromUtf8(e.getClass() + " : " + e.getMessage())); trxExtBuilder.setResult(retBuilder); logger.warn("When run constant call in VM, have RuntimeException: " + e.getMessage()); } catch (Exception e) { retBuilder.setResult(false).setCode(response_code.OTHER_ERROR) .setMessage(ByteString.copyFromUtf8(e.getClass() + " : " + e.getMessage())); trxExtBuilder.setResult(retBuilder); logger.warn("unknown exception caught: " + e.getMessage(), e); } finally { responseObserver.onNext(trxExtBuilder.build()); responseObserver.onCompleted(); } } ======= >>>>>>> private void callContract(Contract.TriggerSmartContract request, StreamObserver<TransactionExtention> responseObserver, boolean isConstant) { TransactionExtention.Builder trxExtBuilder = TransactionExtention.newBuilder(); Return.Builder retBuilder = Return.newBuilder(); try { TransactionCapsule trxCap = createTransactionCapsule(request, ContractType.TriggerSmartContract); Transaction trx; if (isConstant) { trx = wallet.triggerConstantContract(request, trxCap, trxExtBuilder, retBuilder); } else { trx = wallet.triggerContract(request, trxCap, trxExtBuilder, retBuilder); } trxExtBuilder.setTransaction(trx); trxExtBuilder.setTxid(trxCap.getTransactionId().getByteString()); retBuilder.setResult(true).setCode(response_code.SUCCESS); trxExtBuilder.setResult(retBuilder); } catch (ContractValidateException | VMIllegalException e) { retBuilder.setResult(false).setCode(response_code.CONTRACT_VALIDATE_ERROR) .setMessage(ByteString.copyFromUtf8(CONTRACT_VALIDATE_ERROR + e.getMessage())); trxExtBuilder.setResult(retBuilder); logger.warn("ContractValidateException: {}", e.getMessage()); } catch (RuntimeException e) { retBuilder.setResult(false).setCode(response_code.CONTRACT_EXE_ERROR) .setMessage(ByteString.copyFromUtf8(e.getClass() + " : " + e.getMessage())); trxExtBuilder.setResult(retBuilder); logger.warn("When run constant call in VM, have RuntimeException: " + e.getMessage()); } catch (Exception e) { retBuilder.setResult(false).setCode(response_code.OTHER_ERROR) .setMessage(ByteString.copyFromUtf8(e.getClass() + " : " + e.getMessage())); trxExtBuilder.setResult(retBuilder); logger.warn("unknown exception caught: " + e.getMessage(), e); } finally { responseObserver.onNext(trxExtBuilder.build()); responseObserver.onCompleted(); } } <<<<<<< // @Override // public void getNullifier(BytesMessage request, StreamObserver<BytesMessage> responseObserver) { // ByteString id = request.getValue(); // if (null != id) { // BytesMessage trxId = wallet.getNullifier(id); // // responseObserver.onNext(trxId); // } else { // responseObserver.onNext(null); // } // responseObserver.onCompleted(); // } ======= @Override public void getRewardInfo(BytesMessage request, StreamObserver<NumberMessage> responseObserver) { try { long value = dbManager.getDelegationService().queryReward(request.getValue().toByteArray()); NumberMessage.Builder builder = NumberMessage.newBuilder(); builder.setNum(value); responseObserver.onNext(builder.build()); } catch (Exception e) { responseObserver.onError(e); } responseObserver.onCompleted(); } @Override public void getBrokerageInfo(BytesMessage request, StreamObserver<NumberMessage> responseObserver) { try { long cycle = dbManager.getDynamicPropertiesStore().getCurrentCycleNumber(); long value = dbManager.getDelegationStore() .getBrokerage(cycle, request.getValue().toByteArray()); NumberMessage.Builder builder = NumberMessage.newBuilder(); builder.setNum(value); responseObserver.onNext(builder.build()); } catch (Exception e) { responseObserver.onError(e); } responseObserver.onCompleted(); } @Override public void updateBrokerage(UpdateBrokerageContract request, StreamObserver<TransactionExtention> responseObserver) { createTransactionExtention(request, ContractType.UpdateBrokerageContract, responseObserver); } } >>>>>>> // @Override // public void getNullifier(BytesMessage request, StreamObserver<BytesMessage> responseObserver) { // ByteString id = request.getValue(); // if (null != id) { // BytesMessage trxId = wallet.getNullifier(id); // // responseObserver.onNext(trxId); // } else { // responseObserver.onNext(null); // } // responseObserver.onCompleted(); // }
<<<<<<< ======= import org.tron.core.Sha256Hash; import org.tron.core.capsule.BlockCapsule; import org.tron.core.capsule.TransactionCapsule; import org.tron.core.config.args.Args; >>>>>>> <<<<<<< ======= //NodeDelegate @Override public void handleBlock(BlockCapsule block) { logger.info("handle block"); blockStoreDb.saveBlock(block.getHash(), block); DynamicPropertiesStore dynamicPropertiesStore = dbManager.getDynamicPropertiesStore(); //dynamicPropertiesStore.saveLatestBlockHeaderTimestamp(block.get); dynamicPropertiesStore.saveLatestBlockHeaderNumber(block.getNum()); //dynamicPropertiesStore.saveLatestBlockHeaderHash(block.getHash()); } @Override public void handleTransaction(TransactionCapsule trx) { logger.info("handle transaction"); blockStoreDb.pushTransactions(trx.getTransaction()); } @Override public Message getData(Sha256Hash hash, MessageTypes type) { switch (type) { case BLOCK: return new BlockMessage(blockStoreDb.findBlockByHash(hash)); case TRX: return new TransactionMessage( dbManager.getTransactionStore().findTransactionByHash(hash.getBytes())); default: logger.info("message type not block or trx."); return null; } } @Override public void syncToCli() { //sync to cli or gui } @Override public void getBlockNum(byte[] hash) { } @Override public void getBlockTime(byte[] hash) { } @Override public byte[] getHeadBlockId() { return new byte[0]; } @Override public boolean contain(Sha256Hash hash, MessageTypes type) { if (type == MessageTypes.BLOCK) { return blockStoreDb.containBlock(hash); } else if (type == MessageTypes.TRX) { //TODO: check it return false; } return false; } //IApplication >>>>>>>
<<<<<<< ======= import org.tron.protos.Protocol.Account; import org.tron.protos.Protocol.Block; import org.tron.protos.contract.AssetIssueContractOuterClass; >>>>>>> import org.tron.protos.contract.AssetIssueContractOuterClass;
<<<<<<< /* BLOCK env **/ private final DataWord prevHash, coinbase, timestamp, number; private Deposit deposit = null; private boolean byTransaction = true; private boolean byTestingSuite = false; private int callDeep = 0; private boolean isStaticCall = false; public ProgramInvokeImpl(DataWord address, DataWord origin, DataWord caller, DataWord balance, DataWord callValue, byte[] msgData, DataWord lastHash, DataWord coinbase, DataWord timestamp, DataWord number, DataWord difficulty, Deposit deposit, int callDeep, boolean isStaticCall, boolean byTestingSuite) { this.address = address; this.origin = origin; this.caller = caller; this.balance = balance; this.callValue = callValue; this.msgData = msgData; // last Block env this.prevHash = lastHash; this.coinbase = coinbase; this.timestamp = timestamp; this.number = number; this.deposit = deposit; this.byTransaction = false; this.isStaticCall = isStaticCall; this.byTestingSuite = byTestingSuite; // this.dropLimit = balance.clone(); } public ProgramInvokeImpl(byte[] address, byte[] origin, byte[] caller, long balance, byte[] callValue, byte[] msgData, byte[] lastHash, byte[] coinbase, long timestamp, long number, Deposit deposit, byte[] dropLimit, boolean byTestingSuite) { this(address, origin, caller, balance, callValue, msgData, lastHash, coinbase, timestamp, number, deposit, dropLimit); this.byTestingSuite = byTestingSuite; } public ProgramInvokeImpl(byte[] address, byte[] origin, byte[] caller, long balance, byte[] callValue, byte[] msgData, byte[] lastHash, byte[] coinbase, long timestamp, long number, Deposit deposit, byte[] dropLimit, byte[] ownerResourceUsagePercent) { this(address, origin, caller, balance, callValue, msgData, lastHash, coinbase, timestamp, number, deposit, dropLimit); // this.ownerResourceUsagePercent = new DataWord(ownerResourceUsagePercent); } public ProgramInvokeImpl(byte[] address, byte[] origin, byte[] caller, long balance, byte[] callValue, byte[] msgData, byte[] lastHash, byte[] coinbase, long timestamp, long number, Deposit deposit, byte[] dropLimit) { // Transaction env this.address = new DataWord(address); this.origin = new DataWord(origin); this.caller = new DataWord(caller); this.balance = new DataWord(balance); this.callValue = new DataWord(callValue); this.msgData = msgData; // last Block env this.prevHash = new DataWord(lastHash); this.coinbase = new DataWord(coinbase); this.timestamp = new DataWord(timestamp); this.number = new DataWord(number); this.deposit = deposit; // this.dropLimit = new DataWord(dropLimit); } /* ADDRESS op */ public DataWord getOwnerAddress() { return address; } /* BALANCE op */ public DataWord getBalance() { return balance; } /* ORIGIN op */ public DataWord getOriginAddress() { return origin; } /* CALLER op */ public DataWord getCallerAddress() { return caller; } /* CALLVALUE op */ public DataWord getCallValue() { return callValue; } /*****************/ /*** msg data ***/ /*****************/ /* NOTE: In the protocol there is no restriction on the maximum message data, * However msgData here is a byte[] and this can't hold more than 2^32-1 */ private static BigInteger MAX_MSG_DATA = BigInteger.valueOf(Integer.MAX_VALUE); /* CALLDATALOAD op */ public DataWord getDataValue(DataWord indexData) { BigInteger tempIndex = indexData.value(); int index = tempIndex.intValue(); // possible overflow is caught below int size = 32; // maximum datavalue size if (msgData == null || index >= msgData.length || tempIndex.compareTo(MAX_MSG_DATA) > 0) { return new DataWord(); ======= /* BLOCK env **/ private final DataWord prevHash, coinbase, timestamp, number; private Deposit deposit = null; private boolean byTransaction = true; private boolean byTestingSuite = false; private int callDeep = 0; private boolean isStaticCall = false; public ProgramInvokeImpl(DataWord address, DataWord origin, DataWord caller, DataWord balance, DataWord callValue, byte[] msgData, DataWord lastHash, DataWord coinbase, DataWord timestamp, DataWord number, DataWord difficulty, Deposit deposit, int callDeep, boolean isStaticCall, boolean byTestingSuite, long vmStartInUs, long vmShouldEndInUs) { this.address = address; this.origin = origin; this.caller = caller; this.balance = balance; this.callValue = callValue; this.msgData = msgData; // last Block env this.prevHash = lastHash; this.coinbase = coinbase; this.timestamp = timestamp; this.number = number; this.deposit = deposit; this.byTransaction = false; this.isStaticCall = isStaticCall; this.byTestingSuite = byTestingSuite; this.vmStartInUs = vmStartInUs; this.vmShouldEndInUs = vmShouldEndInUs; } public ProgramInvokeImpl(byte[] address, byte[] origin, byte[] caller, long balance, byte[] callValue, byte[] msgData, byte[] lastHash, byte[] coinbase, long timestamp, long number, Deposit deposit, long vmStartInUs, long vmShouldEndInUs, boolean byTestingSuite) { this(address, origin, caller, balance, callValue, msgData, lastHash, coinbase, timestamp, number, deposit, vmStartInUs, vmShouldEndInUs); this.byTestingSuite = byTestingSuite; } public ProgramInvokeImpl(byte[] address, byte[] origin, byte[] caller, long balance, byte[] callValue, byte[] msgData, byte[] lastHash, byte[] coinbase, long timestamp, long number, Deposit deposit, long vmStartInUs, long vmShouldEndInUs) { // Transaction env this.address = new DataWord(address); this.origin = new DataWord(origin); this.caller = new DataWord(caller); this.balance = new DataWord(balance); this.callValue = new DataWord(callValue); this.msgData = msgData; // last Block env this.prevHash = new DataWord(lastHash); this.coinbase = new DataWord(coinbase); this.timestamp = new DataWord(timestamp); this.number = new DataWord(number); this.deposit = deposit; // calc should end time this.vmStartInUs = vmStartInUs; this.vmShouldEndInUs = vmShouldEndInUs; // logger.info("vmStartInUs: {}", vmStartInUs); // logger.info("vmShouldEndInUs: {}", vmShouldEndInUs); } /* ADDRESS op */ public DataWord getOwnerAddress() { return address; } /* BALANCE op */ public DataWord getBalance() { return balance; } /* ORIGIN op */ public DataWord getOriginAddress() { return origin; } /* CALLER op */ public DataWord getCallerAddress() { return caller; } /* CALLVALUE op */ public DataWord getCallValue() { return callValue; } /*****************/ /*** msg data ***/ /*****************/ /* NOTE: In the protocol there is no restriction on the maximum message data, * However msgData here is a byte[] and this can't hold more than 2^32-1 */ private static BigInteger MAX_MSG_DATA = BigInteger.valueOf(Integer.MAX_VALUE); /* CALLDATALOAD op */ public DataWord getDataValue(DataWord indexData) { BigInteger tempIndex = indexData.value(); int index = tempIndex.intValue(); // possible overflow is caught below int size = 32; // maximum datavalue size if (msgData == null || index >= msgData.length || tempIndex.compareTo(MAX_MSG_DATA) > 0) { return new DataWord(); >>>>>>> /* BLOCK env **/ private final DataWord prevHash, coinbase, timestamp, number; private Deposit deposit = null; private boolean byTransaction = true; private boolean byTestingSuite = false; private int callDeep = 0; private boolean isStaticCall = false; public ProgramInvokeImpl(DataWord address, DataWord origin, DataWord caller, DataWord balance, DataWord callValue, byte[] msgData, DataWord lastHash, DataWord coinbase, DataWord timestamp, DataWord number, DataWord difficulty, Deposit deposit, int callDeep, boolean isStaticCall, boolean byTestingSuite, long vmStartInUs, long vmShouldEndInUs) { this.address = address; this.origin = origin; this.caller = caller; this.balance = balance; this.callValue = callValue; this.msgData = msgData; // last Block env this.prevHash = lastHash; this.coinbase = coinbase; this.timestamp = timestamp; this.number = number; this.deposit = deposit; this.byTransaction = false; this.isStaticCall = isStaticCall; this.byTestingSuite = byTestingSuite; this.vmStartInUs = vmStartInUs; this.vmShouldEndInUs = vmShouldEndInUs; } public ProgramInvokeImpl(byte[] address, byte[] origin, byte[] caller, long balance, byte[] callValue, byte[] msgData, byte[] lastHash, byte[] coinbase, long timestamp, long number, Deposit deposit, long vmStartInUs, long vmShouldEndInUs, boolean byTestingSuite) { this(address, origin, caller, balance, callValue, msgData, lastHash, coinbase, timestamp, number, deposit, vmStartInUs, vmShouldEndInUs); this.byTestingSuite = byTestingSuite; } public ProgramInvokeImpl(byte[] address, byte[] origin, byte[] caller, long balance, byte[] callValue, byte[] msgData, byte[] lastHash, byte[] coinbase, long timestamp, long number, Deposit deposit, long vmStartInUs, long vmShouldEndInUs) { // Transaction env this.address = new DataWord(address); this.origin = new DataWord(origin); this.caller = new DataWord(caller); this.balance = new DataWord(balance); this.callValue = new DataWord(callValue); this.msgData = msgData; // last Block env this.prevHash = new DataWord(lastHash); this.coinbase = new DataWord(coinbase); this.timestamp = new DataWord(timestamp); this.number = new DataWord(number); this.deposit = deposit; // calc should end time this.vmStartInUs = vmStartInUs; this.vmShouldEndInUs = vmShouldEndInUs; // logger.info("vmStartInUs: {}", vmStartInUs); // logger.info("vmShouldEndInUs: {}", vmShouldEndInUs); } /* ADDRESS op */ public DataWord getOwnerAddress() { return address; } /* BALANCE op */ public DataWord getBalance() { return balance; } /* ORIGIN op */ public DataWord getOriginAddress() { return origin; } /* CALLER op */ public DataWord getCallerAddress() { return caller; } /* CALLVALUE op */ public DataWord getCallValue() { return callValue; } /*****************/ /*** msg data ***/ /*****************/ /* NOTE: In the protocol there is no restriction on the maximum message data, * However msgData here is a byte[] and this can't hold more than 2^32-1 */ private static BigInteger MAX_MSG_DATA = BigInteger.valueOf(Integer.MAX_VALUE); /* CALLDATALOAD op */ public DataWord getDataValue(DataWord indexData) { BigInteger tempIndex = indexData.value(); int index = tempIndex.intValue(); // possible overflow is caught below int size = 32; // maximum datavalue size if (msgData == null || index >= msgData.length || tempIndex.compareTo(MAX_MSG_DATA) > 0) { return new DataWord(); <<<<<<< public Deposit getDeposit() { return deposit; } @Override public BlockStore getBlockStore() { return null; //return deposit.getBlockStore(); } @Override public boolean byTransaction() { return byTransaction; } @Override public boolean isStaticCall() { return isStaticCall; } @Override public long getVmStartInUs() { return vmStartInUs; } @Override public boolean byTestingSuite() { return byTestingSuite; } @Override public int getCallDeep() { return this.callDeep; } @Override public boolean equals(Object o) { if (this == o) { return true; ======= public Deposit getDeposit() { return deposit; } @Override public BlockStore getBlockStore() { return null; //return deposit.getBlockStore(); } @Override public boolean byTransaction() { return byTransaction; } @Override public boolean isStaticCall() { return isStaticCall; } @Override public boolean byTestingSuite() { return byTestingSuite; } @Override public int getCallDeep() { return this.callDeep; } @Override public boolean equals(Object o) { if (this == o) { return true; >>>>>>> public Deposit getDeposit() { return deposit; } @Override public BlockStore getBlockStore() { return null; //return deposit.getBlockStore(); } @Override public boolean byTransaction() { return byTransaction; } @Override public boolean isStaticCall() { return isStaticCall; } @Override public boolean byTestingSuite() { return byTestingSuite; } @Override public long getVmStartInUs() { return vmStartInUs; } @Override public int getCallDeep() { return this.callDeep; } @Override public boolean equals(Object o) { if (this == o) { return true;
<<<<<<< private Cache<ByteString, Long> blocks = CacheBuilder.newBuilder().maximumSize(10).build(); /** * Construction method. */ public WitnessService(Application tronApp, TronApplicationContext context) { this.tronApp = tronApp; this.context = context; backupManager = context.getBean(BackupManager.class); backupServer = context.getBean(BackupServer.class); tronNetService = context.getBean(TronNetService.class); generateThread = new Thread(scheduleProductionLoop); manager = tronApp.getDbManager(); manager.setWitnessService(this); controller = manager.getWitnessController(); new Thread(() -> { while (needSyncCheck) { try { Thread.sleep(100); } catch (Exception e) { } } backupServer.initServer(); }).start(); } ======= >>>>>>> private Cache<ByteString, Long> blocks = CacheBuilder.newBuilder().maximumSize(10).build(); /** * Construction method. */ public WitnessService(Application tronApp, TronApplicationContext context) { this.tronApp = tronApp; this.context = context; backupManager = context.getBean(BackupManager.class); backupServer = context.getBean(BackupServer.class); tronNetService = context.getBean(TronNetService.class); generateThread = new Thread(scheduleProductionLoop); manager = tronApp.getDbManager(); manager.setWitnessService(this); controller = manager.getWitnessController(); new Thread(() -> { while (needSyncCheck) { try { Thread.sleep(100); } catch (Exception e) { } } backupServer.initServer(); }).start(); }
<<<<<<< MAINTENANCE_TIME_INTERVAL(0), //ms ,0 ACCOUNT_UPGRADE_COST(1), //drop ,1 CREATE_ACCOUNT_FEE(2), //drop ,2 TRANSACTION_FEE(3), //drop ,3 ASSET_ISSUE_FEE(4), //drop ,4 WITNESS_PAY_PER_BLOCK(5), //drop ,5 WITNESS_STANDBY_ALLOWANCE(6), //drop ,6 CREATE_NEW_ACCOUNT_FEE_IN_SYSTEM_CONTRACT(7), //drop ,7 CREATE_NEW_ACCOUNT_BANDWIDTH_RATE(8), // 1 ~ ,8 ALLOW_CREATION_OF_CONTRACTS(9), // 0 / >0 ,9 REMOVE_THE_POWER_OF_THE_GR(10), // 1 ,10 ENERGY_FEE(11), // drop, 11 EXCHANGE_CREATE_FEE(12), // drop, 12 MAX_CPU_TIME_OF_ONE_TX(13), // ms, 13 ALLOW_UPDATE_ACCOUNT_NAME(14), // 1, 14 ALLOW_SAME_TOKEN_NAME(15), // 1, 15 ALLOW_DELEGATE_RESOURCE(16), // 0, 16 TOTAL_ENERGY_LIMIT(17), // 50,000,000,000, 17 ALLOW_TVM_TRANSFER_TRC10(18), // 1, 18 TOTAL_CURRENT_ENERGY_LIMIT(19), // 50,000,000,000, 19 ALLOW_MULTI_SIGN(20), // 1, 20 ALLOW_ADAPTIVE_ENERGY(21), // 1, 21 UPDATE_ACCOUNT_PERMISSION_FEE(22), // 100, 22 MULTI_SIGN_FEE(23), // 1, 23 ALLOW_PROTO_FILTER_NUM(24), // 1, 24 ALLOW_ACCOUNT_STATE_ROOT(25), // 1, 25 ALLOW_TVM_CONSTANTINOPLE(26), // 1, 26 ALLOW_SHIELDED_TRANSACTION(27), // 27 SHIELDED_TRANSACTION_FEE(28), // 28 ADAPTIVE_RESOURCE_LIMIT_MULTIPLIER(29), // 1000, 29 ALLOW_CHANGE_DELEGATION(30), //1, 30 WITNESS_127_PAY_PER_BLOCK(31), //drop, 31 ALLOW_TVM_SOLIDITY_059(32), // 1, 32 ADAPTIVE_RESOURCE_LIMIT_TARGET_RATIO(33), // 10, 33 SHIELDED_TRANSACTION_CREATE_ACCOUNT_FEE(34), // 34 FORBID_TRANSFER_TO_CONTRACT(35); // 1, 35 ======= // current value, value range MAINTENANCE_TIME_INTERVAL(0), // 6 Hours, [3 * 27, 24 * 3600] s ACCOUNT_UPGRADE_COST(1), // 9999 TRX, [0, 100000000000] TRX CREATE_ACCOUNT_FEE(2), // 0.1 TRX, [0, 100000000000] TRX TRANSACTION_FEE(3), // 10 Sun/Byte, [0, 100000000000] TRX ASSET_ISSUE_FEE(4), // 1024 TRX, [0, 100000000000] TRX WITNESS_PAY_PER_BLOCK(5), // 16 TRX, [0, 100000000000] TRX WITNESS_STANDBY_ALLOWANCE(6), // 115200 TRX, [0, 100000000000] TRX CREATE_NEW_ACCOUNT_FEE_IN_SYSTEM_CONTRACT(7), // 0 TRX, [0, 100000000000] TRX CREATE_NEW_ACCOUNT_BANDWIDTH_RATE(8), // 1 Bandwith/Byte, [0, 100000000000000000] Bandwith/Byte ALLOW_CREATION_OF_CONTRACTS(9), // 1, {0, 1} REMOVE_THE_POWER_OF_THE_GR(10), // 1, {0, 1} ENERGY_FEE(11), // 10 Sun, [0, 100000000000] TRX EXCHANGE_CREATE_FEE(12), // 1024 TRX, [0, 100000000000] TRX MAX_CPU_TIME_OF_ONE_TX(13), // 50 ms, [0, 1000] ms ALLOW_UPDATE_ACCOUNT_NAME(14), // 0, {0, 1} ALLOW_SAME_TOKEN_NAME(15), // 1, {0, 1} ALLOW_DELEGATE_RESOURCE(16), // 1, {0, 1} TOTAL_ENERGY_LIMIT(17), // 50,000,000,000, [0, 100000000000000000] ALLOW_TVM_TRANSFER_TRC10(18), // 1, {0, 1} TOTAL_CURRENT_ENERGY_LIMIT(19), // 50,000,000,000, [0, 100000000000000000] ALLOW_MULTI_SIGN(20), // 1, {0, 1} ALLOW_ADAPTIVE_ENERGY(21), // 1, {0, 1} UPDATE_ACCOUNT_PERMISSION_FEE(22), // 100 TRX, [0, 100000] TRX MULTI_SIGN_FEE(23), // 1 TRX, [0, 100000] TRX ALLOW_PROTO_FILTER_NUM(24), // 0, {0, 1} ALLOW_ACCOUNT_STATE_ROOT(25), // 1, {0, 1} ALLOW_TVM_CONSTANTINOPLE(26), // 1, {0, 1} ALLOW_SHIELDED_TRANSACTION(27), // 0, {0, 1} SHIELDED_TRANSACTION_FEE(28), // 10 TRX, [0, 10000] TRX ADAPTIVE_RESOURCE_LIMIT_MULTIPLIER(29), // 1000, [1, 10000] ALLOW_CHANGE_DELEGATION(30), // 1, {0, 1} WITNESS_127_PAY_PER_BLOCK(31), // 160 TRX, [0, 100000000000] TRX ALLOW_TVM_SOLIDITY_059(32), // 1, {0, 1} ADAPTIVE_RESOURCE_LIMIT_TARGET_RATIO(33), // 10, [1, 1000] SHIELDED_TRANSACTION_CREATE_ACCOUNT_FEE(34); // 1 TRX, [0, 10000] TRX >>>>>>> // current value, value range MAINTENANCE_TIME_INTERVAL(0), // 6 Hours, [3 * 27, 24 * 3600] s ACCOUNT_UPGRADE_COST(1), // 9999 TRX, [0, 100000000000] TRX CREATE_ACCOUNT_FEE(2), // 0.1 TRX, [0, 100000000000] TRX TRANSACTION_FEE(3), // 10 Sun/Byte, [0, 100000000000] TRX ASSET_ISSUE_FEE(4), // 1024 TRX, [0, 100000000000] TRX WITNESS_PAY_PER_BLOCK(5), // 16 TRX, [0, 100000000000] TRX WITNESS_STANDBY_ALLOWANCE(6), // 115200 TRX, [0, 100000000000] TRX CREATE_NEW_ACCOUNT_FEE_IN_SYSTEM_CONTRACT(7), // 0 TRX, [0, 100000000000] TRX CREATE_NEW_ACCOUNT_BANDWIDTH_RATE(8), // 1 Bandwith/Byte, [0, 100000000000000000] Bandwith/Byte ALLOW_CREATION_OF_CONTRACTS(9), // 1, {0, 1} REMOVE_THE_POWER_OF_THE_GR(10), // 1, {0, 1} ENERGY_FEE(11), // 10 Sun, [0, 100000000000] TRX EXCHANGE_CREATE_FEE(12), // 1024 TRX, [0, 100000000000] TRX MAX_CPU_TIME_OF_ONE_TX(13), // 50 ms, [0, 1000] ms ALLOW_UPDATE_ACCOUNT_NAME(14), // 0, {0, 1} ALLOW_SAME_TOKEN_NAME(15), // 1, {0, 1} ALLOW_DELEGATE_RESOURCE(16), // 1, {0, 1} TOTAL_ENERGY_LIMIT(17), // 50,000,000,000, [0, 100000000000000000] ALLOW_TVM_TRANSFER_TRC10(18), // 1, {0, 1} TOTAL_CURRENT_ENERGY_LIMIT(19), // 50,000,000,000, [0, 100000000000000000] ALLOW_MULTI_SIGN(20), // 1, {0, 1} ALLOW_ADAPTIVE_ENERGY(21), // 1, {0, 1} UPDATE_ACCOUNT_PERMISSION_FEE(22), // 100 TRX, [0, 100000] TRX MULTI_SIGN_FEE(23), // 1 TRX, [0, 100000] TRX ALLOW_PROTO_FILTER_NUM(24), // 0, {0, 1} ALLOW_ACCOUNT_STATE_ROOT(25), // 1, {0, 1} ALLOW_TVM_CONSTANTINOPLE(26), // 1, {0, 1} ALLOW_SHIELDED_TRANSACTION(27), // 0, {0, 1} SHIELDED_TRANSACTION_FEE(28), // 10 TRX, [0, 10000] TRX ADAPTIVE_RESOURCE_LIMIT_MULTIPLIER(29), // 1000, [1, 10000] ALLOW_CHANGE_DELEGATION(30), // 1, {0, 1} WITNESS_127_PAY_PER_BLOCK(31), // 160 TRX, [0, 100000000000] TRX ALLOW_TVM_SOLIDITY_059(32), // 1, {0, 1} ADAPTIVE_RESOURCE_LIMIT_TARGET_RATIO(33), // 10, [1, 1000] SHIELDED_TRANSACTION_CREATE_ACCOUNT_FEE(34), // 1 TRX, [0, 10000] TRX FORBID_TRANSFER_TO_CONTRACT(35); // 1, {0, 1}
<<<<<<< case ZksnarkV0TransferContract: ZksnarkV0TransferContract zksnarkV0TransferContract = contractParameter .unpack(ZksnarkV0TransferContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(zksnarkV0TransferContract)); break; ======= case AccountPermissionUpdateContract: AccountPermissionUpdateContract accountPermissionUpdateContract = contractParameter .unpack(AccountPermissionUpdateContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(accountPermissionUpdateContract)); break; case PermissionAddKeyContract: PermissionAddKeyContract permissionAddKeyContract = contractParameter .unpack(PermissionAddKeyContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(permissionAddKeyContract)); break; case PermissionUpdateKeyContract: PermissionUpdateKeyContract permissionUpdateKeyContract = contractParameter .unpack(PermissionUpdateKeyContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(permissionUpdateKeyContract)); break; case PermissionDeleteKeyContract: PermissionDeleteKeyContract permissionDeleteKeyContract = contractParameter .unpack(PermissionDeleteKeyContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(permissionDeleteKeyContract)); break; >>>>>>> case ZksnarkV0TransferContract: ZksnarkV0TransferContract zksnarkV0TransferContract = contractParameter .unpack(ZksnarkV0TransferContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(zksnarkV0TransferContract)); break; case AccountPermissionUpdateContract: AccountPermissionUpdateContract accountPermissionUpdateContract = contractParameter .unpack(AccountPermissionUpdateContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(accountPermissionUpdateContract)); break; case PermissionAddKeyContract: PermissionAddKeyContract permissionAddKeyContract = contractParameter .unpack(PermissionAddKeyContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(permissionAddKeyContract)); break; case PermissionUpdateKeyContract: PermissionUpdateKeyContract permissionUpdateKeyContract = contractParameter .unpack(PermissionUpdateKeyContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(permissionUpdateKeyContract)); break; case PermissionDeleteKeyContract: PermissionDeleteKeyContract permissionDeleteKeyContract = contractParameter .unpack(PermissionDeleteKeyContract.class); contractJson = JSONObject .parseObject(JsonFormat.printToString(permissionDeleteKeyContract)); break;
<<<<<<< ======= Blockchain blockchain = new Blockchain ("0304f784e4e7bae517bcab94c3e0c9214fb4ac7ff9d7d5a937d1f40031f87b85","server"); >>>>>>> Blockchain blockchain = new Blockchain ("0304f784e4e7bae517bcab94c3e0c9214fb4ac7ff9d7d5a937d1f40031f87b85","server"); <<<<<<< ======= Blockchain blockchain = new Blockchain("","server"); >>>>>>> Blockchain blockchain = new Blockchain("","server"); <<<<<<< long testAmount = 10; ======= Blockchain blockchain = new Blockchain ("fd0f3c8ab4877f0fd96cd156b0ad42ea7aa82c31","server"); >>>>>>> long testAmount = 10; Blockchain blockchain = new Blockchain ("fd0f3c8ab4877f0fd96cd156b0ad42ea7aa82c31","server");
<<<<<<< import org.tron.protos.contract.AccountContract.AccountCreateContract; import org.tron.protos.contract.AccountContract.AccountPermissionUpdateContract; import org.tron.protos.contract.AccountContract.AccountUpdateContract; import org.tron.protos.contract.SmartContractOuterClass.ClearABIContract; import org.tron.protos.contract.SmartContractOuterClass.CreateSmartContract; import org.tron.protos.contract.ExchangeContract.ExchangeCreateContract; import org.tron.protos.contract.ExchangeContract.ExchangeInjectContract; import org.tron.protos.contract.ExchangeContract.ExchangeTransactionContract; import org.tron.protos.contract.ExchangeContract.ExchangeWithdrawContract; import org.tron.protos.contract.BalanceContract.FreezeBalanceContract; import org.tron.protos.contract.AssetIssueContractOuterClass.ParticipateAssetIssueContract; import org.tron.protos.contract.ProposalContract.ProposalApproveContract; import org.tron.protos.contract.ProposalContract.ProposalCreateContract; import org.tron.protos.contract.ProposalContract.ProposalDeleteContract; import org.tron.protos.contract.AccountContract.SetAccountIdContract; import org.tron.protos.contract.ShieldContract.ShieldedTransferContract; import org.tron.protos.contract.ShieldContract.SpendDescription; import org.tron.protos.contract.AssetIssueContractOuterClass.TransferAssetContract; import org.tron.protos.contract.BalanceContract.TransferContract; import org.tron.protos.contract.SmartContractOuterClass.TriggerSmartContract; import org.tron.protos.contract.AssetIssueContractOuterClass.UnfreezeAssetContract; import org.tron.protos.contract.BalanceContract.UnfreezeBalanceContract; import org.tron.protos.contract.AssetIssueContractOuterClass.UpdateAssetContract; import org.tron.protos.contract.SmartContractOuterClass.UpdateEnergyLimitContract; import org.tron.protos.contract.SmartContractOuterClass.UpdateSettingContract; import org.tron.protos.contract.BalanceContract.WithdrawBalanceContract; ======= import org.tron.core.store.AccountStore; import org.tron.protos.Contract; import org.tron.protos.Contract.AccountCreateContract; import org.tron.protos.Contract.AccountPermissionUpdateContract; import org.tron.protos.Contract.AccountUpdateContract; import org.tron.protos.Contract.ClearABIContract; import org.tron.protos.Contract.CreateSmartContract; import org.tron.protos.Contract.ExchangeCreateContract; import org.tron.protos.Contract.ExchangeInjectContract; import org.tron.protos.Contract.ExchangeTransactionContract; import org.tron.protos.Contract.ExchangeWithdrawContract; import org.tron.protos.Contract.FreezeBalanceContract; import org.tron.protos.Contract.ParticipateAssetIssueContract; import org.tron.protos.Contract.ProposalApproveContract; import org.tron.protos.Contract.ProposalCreateContract; import org.tron.protos.Contract.ProposalDeleteContract; import org.tron.protos.Contract.SetAccountIdContract; import org.tron.protos.Contract.ShieldedTransferContract; import org.tron.protos.Contract.SpendDescription; import org.tron.protos.Contract.TransferAssetContract; import org.tron.protos.Contract.TransferContract; import org.tron.protos.Contract.TriggerSmartContract; import org.tron.protos.Contract.UnfreezeAssetContract; import org.tron.protos.Contract.UnfreezeBalanceContract; import org.tron.protos.Contract.UpdateAssetContract; import org.tron.protos.Contract.UpdateEnergyLimitContract; import org.tron.protos.Contract.UpdateSettingContract; import org.tron.protos.Contract.WithdrawBalanceContract; >>>>>>> import org.tron.protos.contract.AccountContract.AccountCreateContract; import org.tron.protos.contract.AccountContract.AccountPermissionUpdateContract; import org.tron.protos.contract.AccountContract.AccountUpdateContract; import org.tron.protos.contract.SmartContractOuterClass.ClearABIContract; import org.tron.protos.contract.SmartContractOuterClass.CreateSmartContract; import org.tron.protos.contract.ExchangeContract.ExchangeCreateContract; import org.tron.protos.contract.ExchangeContract.ExchangeInjectContract; import org.tron.protos.contract.ExchangeContract.ExchangeTransactionContract; import org.tron.protos.contract.ExchangeContract.ExchangeWithdrawContract; import org.tron.protos.contract.BalanceContract.FreezeBalanceContract; import org.tron.protos.contract.AssetIssueContractOuterClass.ParticipateAssetIssueContract; import org.tron.protos.contract.ProposalContract.ProposalApproveContract; import org.tron.protos.contract.ProposalContract.ProposalCreateContract; import org.tron.protos.contract.ProposalContract.ProposalDeleteContract; import org.tron.protos.contract.AccountContract.SetAccountIdContract; import org.tron.protos.contract.ShieldContract.ShieldedTransferContract; import org.tron.protos.contract.ShieldContract.SpendDescription; import org.tron.protos.contract.AssetIssueContractOuterClass.TransferAssetContract; import org.tron.protos.contract.BalanceContract.TransferContract; import org.tron.protos.contract.SmartContractOuterClass.TriggerSmartContract; import org.tron.protos.contract.AssetIssueContractOuterClass.UnfreezeAssetContract; import org.tron.protos.contract.BalanceContract.UnfreezeBalanceContract; import org.tron.protos.contract.AssetIssueContractOuterClass.UpdateAssetContract; import org.tron.protos.contract.SmartContractOuterClass.UpdateEnergyLimitContract; import org.tron.protos.contract.SmartContractOuterClass.UpdateSettingContract; import org.tron.protos.contract.BalanceContract.WithdrawBalanceContract; import org.tron.core.store.AccountStore;
<<<<<<< @Getter @Setter public long allowShieldedTransaction; //committee parameter @Getter @Setter public long allowMarketTransaction; //committee parameter ======= // @Getter // @Setter // public long allowShieldedTransaction; //committee parameter >>>>>>> @Getter @Setter public long allowMarketTransaction; //committee parameter // @Getter // @Setter // public long allowShieldedTransaction; //committee parameter
<<<<<<< private static final byte[] ALLOW_TVM_ISTANBUL = "ALLOW_TVM_ISTANBUL".getBytes(); ======= private static final byte[] ALLOW_TVM_STAKE = "ALLOW_TVM_STAKE".getBytes(); private static final byte[] ALLOW_TVM_ASSET_ISSUE = "ALLOW_TVM_ASSET_ISSUE".getBytes(); >>>>>>> private static final byte[] ALLOW_TVM_ISTANBUL = "ALLOW_TVM_ISTANBUL".getBytes(); private static final byte[] ALLOW_TVM_STAKE = "ALLOW_TVM_STAKE".getBytes(); private static final byte[] ALLOW_TVM_ASSET_ISSUE = "ALLOW_TVM_ASSET_ISSUE".getBytes(); <<<<<<< this.getAllowTvmIstanbul(); } catch (IllegalArgumentException e) { this.saveAllowTvmIstanbul( CommonParameter.getInstance().getAllowTvmIstanbul()); } try { ======= this.getAllowTvmStake(); } catch (IllegalArgumentException e) { this.saveAllowTvmStake( CommonParameter.getInstance().getAllowTvmStake()); } try { this.getAllowTvmAssetIssue(); } catch (IllegalArgumentException e) { this.saveAllowTvmAssetIssue( CommonParameter.getInstance().getAllowTvmAssetIssue()); } try { >>>>>>> this.getAllowTvmIstanbul(); } catch (IllegalArgumentException e) { this.saveAllowTvmIstanbul( CommonParameter.getInstance().getAllowTvmIstanbul()); } try { this.getAllowTvmStake(); } catch (IllegalArgumentException e) { this.saveAllowTvmStake( CommonParameter.getInstance().getAllowTvmStake()); } try { this.getAllowTvmAssetIssue(); } catch (IllegalArgumentException e) { this.saveAllowTvmAssetIssue( CommonParameter.getInstance().getAllowTvmAssetIssue()); } try { <<<<<<< public void saveAllowTvmIstanbul(long allowTVMIstanbul) { this.put(DynamicPropertiesStore.ALLOW_TVM_ISTANBUL, new BytesCapsule(ByteArray.fromLong(allowTVMIstanbul))); } public long getAllowTvmIstanbul() { String msg = "not found ALLOW_TVM_ISTANBUL"; return Optional.ofNullable(getUnchecked(ALLOW_TVM_ISTANBUL)) .map(BytesCapsule::getData) .map(ByteArray::toLong) .orElseThrow( () -> new IllegalArgumentException(msg)); } ======= public void saveAllowTvmStake(long allowTvmStake) { this.put(DynamicPropertiesStore.ALLOW_TVM_STAKE, new BytesCapsule(ByteArray.fromLong(allowTvmStake))); } public void saveAllowTvmAssetIssue(long allowTvmAssetIssue) { this.put(DynamicPropertiesStore.ALLOW_TVM_ASSET_ISSUE, new BytesCapsule(ByteArray.fromLong(allowTvmAssetIssue))); } public long getAllowTvmStake() { String msg = "not found ALLOW_TVM_STAKE"; return Optional.ofNullable(getUnchecked(ALLOW_TVM_STAKE)) .map(BytesCapsule::getData) .map(ByteArray::toLong) .orElseThrow( () -> new IllegalArgumentException(msg)); } public long getAllowTvmAssetIssue() { String msg = "not found ALLOW_TVM_ASSETISSUE"; return Optional.ofNullable(getUnchecked(ALLOW_TVM_ASSET_ISSUE)) .map(BytesCapsule::getData) .map(ByteArray::toLong) .orElseThrow( () -> new IllegalArgumentException(msg)); } >>>>>>> public void saveAllowTvmIstanbul(long allowTVMIstanbul) { this.put(DynamicPropertiesStore.ALLOW_TVM_ISTANBUL, new BytesCapsule(ByteArray.fromLong(allowTVMIstanbul))); } public long getAllowTvmIstanbul() { String msg = "not found ALLOW_TVM_ISTANBUL"; return Optional.ofNullable(getUnchecked(ALLOW_TVM_ISTANBUL)) .map(BytesCapsule::getData) .map(ByteArray::toLong) .orElseThrow( () -> new IllegalArgumentException(msg)); } public void saveAllowTvmStake(long allowTvmStake) { this.put(DynamicPropertiesStore.ALLOW_TVM_STAKE, new BytesCapsule(ByteArray.fromLong(allowTvmStake))); } public void saveAllowTvmAssetIssue(long allowTvmAssetIssue) { this.put(DynamicPropertiesStore.ALLOW_TVM_ASSET_ISSUE, new BytesCapsule(ByteArray.fromLong(allowTvmAssetIssue))); } public long getAllowTvmStake() { String msg = "not found ALLOW_TVM_STAKE"; return Optional.ofNullable(getUnchecked(ALLOW_TVM_STAKE)) .map(BytesCapsule::getData) .map(ByteArray::toLong) .orElseThrow( () -> new IllegalArgumentException(msg)); } public long getAllowTvmAssetIssue() { String msg = "not found ALLOW_TVM_ASSETISSUE"; return Optional.ofNullable(getUnchecked(ALLOW_TVM_ASSET_ISSUE)) .map(BytesCapsule::getData) .map(ByteArray::toLong) .orElseThrow( () -> new IllegalArgumentException(msg)); }
<<<<<<< PARAMETER.allowTvmIstanbul = 0; ======= PARAMETER.allowTvmStake = 0; PARAMETER.allowTvmAssetIssue = 0; >>>>>>> PARAMETER.allowTvmIstanbul = 0; PARAMETER.allowTvmStake = 0; PARAMETER.allowTvmAssetIssue = 0;
<<<<<<< @Autowired private GetMarketOrderByAccountOnSolidityServlet getMarketOrderByAccountOnSolidityServlet; @Autowired private GetMarketOrderByIdOnSolidityServlet getMarketOrderByIdOnSolidityServlet; @Autowired private GetMarketPriceByPairOnSolidityServlet getMarketPriceByPairOnSolidityServlet; @Autowired private GetMarketOrderListByPairOnSolidityServlet getMarketOrderListByPairOnSolidityServlet; @Autowired private GetMarketPairListOnSolidityServlet getMarketPairListOnSolidityServlet; ======= @Autowired private GetTransactionInfoByBlockNumOnSolidityServlet getTransactionInfoByBlockNumOnSolidityServlet; >>>>>>> @Autowired private GetTransactionInfoByBlockNumOnSolidityServlet getTransactionInfoByBlockNumOnSolidityServlet; @Autowired private GetMarketOrderByAccountOnSolidityServlet getMarketOrderByAccountOnSolidityServlet; @Autowired private GetMarketOrderByIdOnSolidityServlet getMarketOrderByIdOnSolidityServlet; @Autowired private GetMarketPriceByPairOnSolidityServlet getMarketPriceByPairOnSolidityServlet; @Autowired private GetMarketOrderListByPairOnSolidityServlet getMarketOrderListByPairOnSolidityServlet; @Autowired private GetMarketPairListOnSolidityServlet getMarketPairListOnSolidityServlet; <<<<<<< context.addServlet(new ServletHolder(getMarketOrderByAccountOnSolidityServlet), "/walletsolidity/getmarketorderbyaccount"); context.addServlet(new ServletHolder(getMarketOrderByIdOnSolidityServlet), "/walletsolidity/getmarketorderbyid"); context.addServlet(new ServletHolder(getMarketPriceByPairOnSolidityServlet), "/walletsolidity/getmarketpricebypair"); context.addServlet(new ServletHolder(getMarketOrderListByPairOnSolidityServlet), "/walletsolidity/getmarketorderlistbypair"); context.addServlet(new ServletHolder(getMarketPairListOnSolidityServlet), "/walletsolidity/getmarketpairlist"); ======= context.addServlet(new ServletHolder(getTransactionInfoByBlockNumOnSolidityServlet), "/walletsolidity/gettransactioninfobyblocknum"); >>>>>>> context.addServlet(new ServletHolder(getTransactionInfoByBlockNumOnSolidityServlet), "/walletsolidity/gettransactioninfobyblocknum"); context.addServlet(new ServletHolder(getMarketOrderByAccountOnSolidityServlet), "/walletsolidity/getmarketorderbyaccount"); context.addServlet(new ServletHolder(getMarketOrderByIdOnSolidityServlet), "/walletsolidity/getmarketorderbyid"); context.addServlet(new ServletHolder(getMarketPriceByPairOnSolidityServlet), "/walletsolidity/getmarketpricebypair"); context.addServlet(new ServletHolder(getMarketOrderListByPairOnSolidityServlet), "/walletsolidity/getmarketorderlistbypair"); context.addServlet(new ServletHolder(getMarketPairListOnSolidityServlet), "/walletsolidity/getmarketpairlist");
<<<<<<< import org.tron.core.capsule.BytesCapsule; ======= import org.tron.core.Wallet; import org.tron.core.capsule.AccountCapsule; import org.tron.core.capsule.BytesCapsule; >>>>>>> import org.tron.core.capsule.BytesCapsule; import org.tron.core.Wallet; import org.tron.core.capsule.AccountCapsule; import org.tron.core.capsule.BytesCapsule; <<<<<<< executeTransparentOut(strx.getTransparentFromAddress().toByteArray(), strx.getFromAmount(), fee, ret); executeShielded(strx); executeTransparentIn(strx.getTransparentToAddress().toByteArray(), strx.getToAmount()); ======= if (strx.getTransparentFromAddress().toByteArray().length > 0) { executeTransparentOut(strx.getTransparentFromAddress().toByteArray(), strx.getFromAmount(), fee, ret); } executeShielded(strx.getSpendDescriptionList(), strx.getReceiveDescriptionList()); if (strx.getTransparentToAddress().toByteArray().length > 0) { executeTransparentIn(strx.getTransparentToAddress().toByteArray(), strx.getToAmount()); } >>>>>>> if (strx.getTransparentFromAddress().toByteArray().length > 0) { executeTransparentOut(strx.getTransparentFromAddress().toByteArray(), strx.getFromAmount(), fee, ret); } executeShielded(strx.getSpendDescriptionList(), strx.getReceiveDescriptionList()); if (strx.getTransparentToAddress().toByteArray().length > 0) { executeTransparentIn(strx.getTransparentToAddress().toByteArray(), strx.getToAmount()); } <<<<<<< private void executeShielded(ShieldedTransferContract strx) { MerkleContainer merkleContainer = dbManager.getMerkleContainer(); IncrementalMerkleTreeContainer currentMerkle = dbManager.getMerkleContainer() .getCurrentMerkle(); for(SpendDescription sd:strx.getSpendDescriptionList()){ byte[] nf = sd.getNullifier().toByteArray(); dbManager.getNullfierStore().put(nf, new BytesCapsule(nf)); } for(ReceiveDescription rd:strx.getReceiveDescriptionList()){ merkleContainer.saveCmIntoMerkleTree(currentMerkle, rd.getNoteCommitment().toByteArray()); } merkleContainer.setCurrentMerkle(currentMerkle); ======= private void executeShielded(List<SpendDescription> spends, List<ReceiveDescription> receives) { //handle spends for (SpendDescription spend: spends ) { dbManager.getNullfierStore().put(new BytesCapsule(spend.getNullifier().toByteArray())); } //handle receives for (ReceiveDescription receive : receives) { dbManager.processNoteCommitment(receive.getNoteCommitment().toByteArray()); } >>>>>>> private void executeShielded(List<SpendDescription> spends, List<ReceiveDescription> receives) { //handle spends for (SpendDescription spend: spends ) { dbManager.getNullfierStore().put(new BytesCapsule(spend.getNullifier().toByteArray())); } MerkleContainer merkleContainer = dbManager.getMerkleContainer(); IncrementalMerkleTreeContainer currentMerkle = dbManager.getMerkleContainer() .getCurrentMerkle(); //handle receives for (ReceiveDescription receive : receives) { dbManager.processNoteCommitment(receive.getNoteCommitment().toByteArray()); } merkleContainer.setCurrentMerkle(currentMerkle);
<<<<<<< private void call() throws ContractExeException { Contract.TriggerSmartContract contract = ContractCapsule.getTriggerContractFromTransaction(trx); if (contract == null) { return; } byte[] contractAddress = contract.getContractAddress().toByteArray(); byte[] code = this.deposit.getCode(contractAddress); if (isEmpty(code)) { } else { AccountCapsule sender = this.deposit.getAccount(contract.getOwnerAddress().toByteArray()); AccountCapsule creator = this.deposit.getAccount( this.deposit.getContract(contractAddress).getInstance() .getOriginAddress().toByteArray()); long thisTxCPULimitInUs; long accountCPULimitInUs = getAccountCPULimitInUs(creator, sender, contract); if (executorType == ET_NORMAL_TYPE) { long blockCPULeftInUs = getBlockCPULeftInUs().longValue(); thisTxCPULimitInUs = min(accountCPULimitInUs, blockCPULeftInUs, Constant.CPU_LIMIT_IN_ONE_TX_OF_SMART_CONTRACT); } else { thisTxCPULimitInUs = min(accountCPULimitInUs, Constant.CPU_LIMIT_IN_ONE_TX_OF_SMART_CONTRACT); } long vmStartInUs = System.nanoTime() / 1000; long vmShouldEndInUs = vmStartInUs + thisTxCPULimitInUs; ProgramInvoke programInvoke = programInvokeFactory .createProgramInvoke(TRX_CONTRACT_CALL_TYPE, executorType, trx, block, deposit, vmStartInUs, vmShouldEndInUs); this.vm = new VM(config); InternalTransaction internalTransaction = new InternalTransaction(trx); this.program = new Program(null, code, programInvoke, internalTransaction, config); } program.getResult().setContractAddress(contractAddress); //transfer from callerAddress to targetAddress according to callValue byte[] callerAddress = contract.getOwnerAddress().toByteArray(); long callValue = contract.getCallValue(); if (callValue != 0) { this.deposit.addBalance(callerAddress, -callValue); this.deposit.addBalance(contractAddress, callValue); } } ======= >>>>>>> <<<<<<< long accountCPULimitInUs = getAccountCPULimitInUs(creator, contract); if (executorType == ET_NORMAL_TYPE) { ======= long maxCpuInUsByCreator = trx.getRawData().getMaxCpuUsage(); long limitInDrop = trx.getRawData().getFeeLimit(); long accountCPULimitInUs = getAccountCPULimitInUs(creator, limitInDrop, maxCpuInUsByCreator); if (executerType == ET_NORMAL_TYPE) { >>>>>>> long maxCpuInUsByCreator = trx.getRawData().getMaxCpuUsage(); long limitInDrop = trx.getRawData().getFeeLimit(); long accountCPULimitInUs = getAccountCPULimitInUs(creator, limitInDrop, maxCpuInUsByCreator); if (executorType == ET_NORMAL_TYPE) { <<<<<<< if (executorType == ET_NORMAL_TYPE) { ======= spendUsage(usedStorageSize); if (executerType == ET_NORMAL_TYPE) { >>>>>>> spendUsage(usedStorageSize); if (executorType == ET_NORMAL_TYPE) { <<<<<<< cpuUsage = now - program.getVmStartInUs(); if (executorType == ET_NORMAL_TYPE) { /* * trx.getCpuRecipt * * */ } ContractCapsule contract = deposit.getContract(result.getContractAddress()); ByteString originAddress = contract.getInstance().getOriginAddress(); AccountCapsule origin = deposit.getAccount(originAddress.toByteArray()); ======= long cpuUsage = now - program.getVmStartInUs(); >>>>>>> long cpuUsage = now - program.getVmStartInUs();
<<<<<<< public void saveZksnarkTransactionFee(long fee) { this.put(ZKSNARK_TRANSACTION_FEE, new BytesCapsule(ByteArray.fromLong(fee))); } public long getZksnarkTransactionFee() { return Optional.ofNullable(getUnchecked(ZKSNARK_TRANSACTION_FEE)) .map(BytesCapsule::getData) .map(ByteArray::toLong) .orElseThrow( () -> new IllegalArgumentException("not found ZKSNARK_TRANSACTION_FEE")); } ======= >>>>>>> public void saveZksnarkTransactionFee(long fee) { this.put(ZKSNARK_TRANSACTION_FEE, new BytesCapsule(ByteArray.fromLong(fee))); } public long getZksnarkTransactionFee() { return Optional.ofNullable(getUnchecked(ZKSNARK_TRANSACTION_FEE)) .map(BytesCapsule::getData) .map(ByteArray::toLong) .orElseThrow( () -> new IllegalArgumentException("not found ZKSNARK_TRANSACTION_FEE")); }
<<<<<<< case "exit": case "quit": case "bye": new ExitCommand().execute(peer, cmdParameters); break; ======= case "put": new ConsensusCommand().execute(peer, cmdParameters); break; case "loadblock": new ConsensusCommand().loadBlock(peer); break; >>>>>>> case "exit": case "quit": case "bye": new ExitCommand().execute(peer, cmdParameters); case "put": new ConsensusCommand().execute(peer, cmdParameters); break; case "loadblock": new ConsensusCommand().loadBlock(peer); break;
<<<<<<< PARAMETER.allowMarketTransaction = 0; ======= PARAMETER.allowSetTransactionRet = 0; >>>>>>> PARAMETER.allowMarketTransaction = 0; PARAMETER.allowSetTransactionRet = 0; <<<<<<< PARAMETER.allowMarketTransaction = config.hasPath(Constant.COMMITTEE_ALLOW_MARKET_TRANSACTION) ? config .getInt(Constant.COMMITTEE_ALLOW_MARKET_TRANSACTION) : 0; ======= PARAMETER.allowSetTransactionRet = config.hasPath(Constant.COMMITTEE_ALLOW_SET_TRANSACTION_RET) ? config .getInt(Constant.COMMITTEE_ALLOW_SET_TRANSACTION_RET) : 0; >>>>>>> PARAMETER.allowMarketTransaction = config.hasPath(Constant.COMMITTEE_ALLOW_MARKET_TRANSACTION) ? config .getInt(Constant.COMMITTEE_ALLOW_MARKET_TRANSACTION) : 0; PARAMETER.allowSetTransactionRet = config.hasPath(Constant.COMMITTEE_ALLOW_SET_TRANSACTION_RET) ? config .getInt(Constant.COMMITTEE_ALLOW_SET_TRANSACTION_RET) : 0;
<<<<<<< ======= try { this.getBlockFilledSlots(); } catch (IllegalArgumentException e) { int[] blockFilledSlots = new int[BLOCK_FILLED_SLOTS_NUMBER]; Arrays.fill(blockFilledSlots, 1); this.saveBlockFilledSlots(blockFilledSlots); } >>>>>>> try { this.getBlockFilledSlots(); } catch (IllegalArgumentException e) { int[] blockFilledSlots = new int[BLOCK_FILLED_SLOTS_NUMBER]; Arrays.fill(blockFilledSlots, 1); this.saveBlockFilledSlots(blockFilledSlots); } <<<<<<< public BlockFilledSlots getBlockFilledSlots() { return blockFilledSlots; } ======= >>>>>>>
<<<<<<< ======= //for test only dynamicPropertiesStore.updateDynamicStoreByConfig(); >>>>>>> //for test only dynamicPropertiesStore.updateDynamicStoreByConfig(); <<<<<<< VMIllegalException, TooBigTransactionResultException, ZksnarkException { ======= VMIllegalException, TooBigTransactionResultException, BadBlockException { >>>>>>> VMIllegalException, TooBigTransactionResultException, ZksnarkException, BadBlockException { <<<<<<< VMIllegalException, ZksnarkException { ======= VMIllegalException, BadBlockException { >>>>>>> VMIllegalException, ZksnarkException, BadBlockException { <<<<<<< | VMIllegalException | ZksnarkException e) { ======= | VMIllegalException | BadBlockException e) { >>>>>>> | VMIllegalException | ZksnarkException | BadBlockException e) { <<<<<<< ReceiptCheckErrException, VMIllegalException, TooBigTransactionResultException, ZksnarkException { ======= ReceiptCheckErrException, VMIllegalException, TooBigTransactionResultException, BadBlockException { >>>>>>> ReceiptCheckErrException, VMIllegalException, TooBigTransactionResultException, ZksnarkException, BadBlockException {
<<<<<<< private static final String version = "3.5"; public static final String versionName = ""; public static final String versionCode = ""; ======= private static final String version = "3.5.1"; >>>>>>> private static final String version = "3.5.1"; public static final String versionName = ""; public static final String versionCode = "";
<<<<<<< /** */ public void init() { switch (trxType) { case TRX_PRECOMPILED_TYPE: readyToExecute = true; break; case TRX_CONTRACT_CREATION_TYPE: case TRX_CONTRACT_CALL_TYPE: if (!curCPULimitReachedBlockCPULimit()) { readyToExecute = true; } break; default: break; } } public BigInteger getBlockCPULeftInUs() { // insure block is not null BigInteger curBlockHaveElapsedCPUInUs = BigInteger.valueOf( 1000 * (DateTime.now().getMillis() - block.getBlockHeader().getRawDataOrBuilder() .getTimestamp())); // us BigInteger curBlockCPULimitInUs = BigInteger.valueOf((long) (1000 * ChainConstant.BLOCK_PRODUCED_INTERVAL * 0.5 * ChainConstant.BLOCK_PRODUCED_TIME_OUT / 100)); // us return curBlockCPULimitInUs.subtract(curBlockHaveElapsedCPUInUs); } public boolean curCPULimitReachedBlockCPULimit() { if (executerType == ET_NORMAL_TYPE) { BigInteger blockCPULeftInUs = getBlockCPULeftInUs(); BigInteger oneTxCPULimitInUs = BigInteger .valueOf(Constant.CPU_LIMIT_IN_ONE_TX_OF_SMART_CONTRACT); boolean cumulativeCPUReached = oneTxCPULimitInUs.compareTo(blockCPULeftInUs) > 0; if (cumulativeCPUReached) { logger.error("cumulative CPU Reached"); return true; } } return false; } private long getAccountCPULimitInUs(AccountCapsule creator, CreateSmartContract contract) { CpuProcessor cpuProcessor = new CpuProcessor(this.deposit.getDbManager()); long cpuFromFrozen = cpuProcessor.calculateGlobalCpuLimit( creator.getAccountResource().getFrozenBalanceForCpu().getFrozenBalance()); logger.info("cpuFromFrozen: {}", cpuFromFrozen); long cpuFromTRX = Constant.CPU_IN_US_PER_TRX * contract.getCpuLimitInTrx(); return max(cpuFromFrozen, cpuFromTRX); // us } private long getAccountCPULimitInUs(AccountCapsule creator, AccountCapsule sender, TriggerSmartContract contract) { CpuProcessor cpuProcessor = new CpuProcessor(this.deposit.getDbManager()); SmartContract smartContract = this.deposit .getContract(contract.getContractAddress().toByteArray()).getInstance(); long consumeUserResourcePercent = smartContract.getConsumeUserResourcePercent(); long senderCpuFromTrx = Constant.CPU_IN_US_PER_TRX * contract.getCpuLimitInTrx(); long senderCpuFromFrozen = cpuProcessor.calculateGlobalCpuLimit( sender.getAccountResource().getFrozenBalanceForCpu().getFrozenBalance()); long creatorCpuFromFrozen = cpuProcessor.calculateGlobalCpuLimit( creator.getAccountResource().getFrozenBalanceForCpu().getFrozenBalance()); long senderCpuMax = max(senderCpuFromTrx, senderCpuFromFrozen); if (consumeUserResourcePercent >= 1.0) { return senderCpuMax; } else if (consumeUserResourcePercent <= 0.0) { return creatorCpuFromFrozen; } else { return max(min(creatorCpuFromFrozen / (1 - consumeUserResourcePercent), senderCpuMax / consumeUserResourcePercent), consumeUserResourcePercent); } } ======= /** */ public void init() { switch (trxType) { case TRX_PRECOMPILED_TYPE: break; case TRX_CONTRACT_CREATION_TYPE: initForCreate(); break; case TRX_CONTRACT_CALL_TYPE: initForCall(); break; default: break; } } public void initForCall() { // Contract.TriggerSmartContract contract = ContractCapsule.getTriggerContractFromTransaction(trx); } public void initForCreate() { CreateSmartContract contract = ContractCapsule.getSmartContractFromTransaction(trx); SmartContract smartContract = contract.getNewContract(); // if (Args.getInstance().isWitness()) if (null != block) { long blockStartTimestamp = block.getBlockHeader().getRawDataOrBuilder().getTimestamp(); // DateTime.now().getMillis() - when // ChainConstant.BLOCK_PRODUCED_INTERVAL * 0.5 * ChainConstant.BLOCK_PRODUCED_TIME_OU / 100 // [1] check this trx cpu time limit exceed the block time limit or not BigInteger curBlockCPULimit = BigInteger.valueOf(1125000); // get current block elapsed time BigInteger curBlockHaveElapsedCPU = BigInteger.valueOf(10000); BigInteger trxCPULimit = new BigInteger(1, contract.getCpuLimitInTrx().toByteArray()); // TODO get from account BigInteger increasedStorageLimit = BigInteger.valueOf(10000000); boolean cumulativeCPUReached = trxCPULimit.add(curBlockHaveElapsedCPU).compareTo(curBlockCPULimit) > 0; if (cumulativeCPUReached) { logger.error("cumulative CPU Reached"); return; } } // [2] check the account balance // BigInteger txGasCost = toBI(tx.getGasPrice()).multiply(txGasLimit); // BigInteger totalCost = toBI(tx.getValue()).add(txGasCost); // BigInteger senderBalance = track.getBalance(tx.getSender()); // // if (!isCovers(senderBalance, totalCost)) { // // execError( // String.format("Not enough cash: Require: %s, Sender cash: %s", totalCost, senderBalance)); // // return; // } readyToExecute = true; } >>>>>>> /** */ public void init() { switch (trxType) { case TRX_PRECOMPILED_TYPE: readyToExecute = true; break; case TRX_CONTRACT_CREATION_TYPE: case TRX_CONTRACT_CALL_TYPE: if (!curCPULimitReachedBlockCPULimit()) { readyToExecute = true; } break; default: break; } } public BigInteger getBlockCPULeftInUs() { // insure block is not null BigInteger curBlockHaveElapsedCPUInUs = BigInteger.valueOf( 1000 * (DateTime.now().getMillis() - block.getBlockHeader().getRawDataOrBuilder() .getTimestamp())); // us BigInteger curBlockCPULimitInUs = BigInteger.valueOf((long) (1000 * ChainConstant.BLOCK_PRODUCED_INTERVAL * 0.5 * ChainConstant.BLOCK_PRODUCED_TIME_OUT / 100)); // us return curBlockCPULimitInUs.subtract(curBlockHaveElapsedCPUInUs); } public boolean curCPULimitReachedBlockCPULimit() { if (executerType == ET_NORMAL_TYPE) { BigInteger blockCPULeftInUs = getBlockCPULeftInUs(); BigInteger oneTxCPULimitInUs = BigInteger .valueOf(Constant.CPU_LIMIT_IN_ONE_TX_OF_SMART_CONTRACT); // TODO get from account BigInteger increasedStorageLimit = BigInteger.valueOf(10000000); boolean cumulativeCPUReached = oneTxCPULimitInUs.compareTo(blockCPULeftInUs) > 0; if (cumulativeCPUReached) { logger.error("cumulative CPU Reached"); return true; } } return false; } private long getAccountCPULimitInUs(AccountCapsule creator, CreateSmartContract contract) { CpuProcessor cpuProcessor = new CpuProcessor(this.deposit.getDbManager()); long cpuFromFrozen = cpuProcessor.calculateGlobalCpuLimit( creator.getAccountResource().getFrozenBalanceForCpu().getFrozenBalance()); logger.info("cpuFromFrozen: {}", cpuFromFrozen); long cpuFromTRX = Constant.CPU_IN_US_PER_TRX * contract.getCpuLimitInTrx(); return max(cpuFromFrozen, cpuFromTRX); // us } private long getAccountCPULimitInUs(AccountCapsule creator, AccountCapsule sender, TriggerSmartContract contract) { CpuProcessor cpuProcessor = new CpuProcessor(this.deposit.getDbManager()); SmartContract smartContract = this.deposit .getContract(contract.getContractAddress().toByteArray()).getInstance(); long consumeUserResourcePercent = smartContract.getConsumeUserResourcePercent(); long senderCpuFromTrx = Constant.CPU_IN_US_PER_TRX * contract.getCpuLimitInTrx(); long senderCpuFromFrozen = cpuProcessor.calculateGlobalCpuLimit( sender.getAccountResource().getFrozenBalanceForCpu().getFrozenBalance()); long creatorCpuFromFrozen = cpuProcessor.calculateGlobalCpuLimit( creator.getAccountResource().getFrozenBalanceForCpu().getFrozenBalance()); long senderCpuMax = max(senderCpuFromTrx, senderCpuFromFrozen); if (consumeUserResourcePercent >= 1.0) { return senderCpuMax; } else if (consumeUserResourcePercent <= 0.0) { return creatorCpuFromFrozen; } else { return max(min(creatorCpuFromFrozen / (1 - consumeUserResourcePercent), senderCpuMax / consumeUserResourcePercent), consumeUserResourcePercent); } } <<<<<<< ======= // touchedAccounts.addAll(result.getTouchedAccounts()); // check storage useage long useedStorageSize = deposit.getBeforeRunStorageSize() - deposit.computeAfterRunStorageSize(); if (useedStorageSize > 1000000) { result.setException(Program.Exception.notEnoughStorage()); throw result.getException(); } >>>>>>> // touchedAccounts.addAll(result.getTouchedAccounts()); // check storage useage long useedStorageSize = deposit.getBeforeRunStorageSize() - deposit.computeAfterRunStorageSize(); if (useedStorageSize > 1000000) { result.setException(Program.Exception.notEnoughStorage()); throw result.getException(); } <<<<<<< } catch (OutOfResourceException e) { logger.error(e.getMessage()); runtimeError = e.getMessage(); } catch (TronException e) { spendUsage(false); ======= } catch (Exception e) { >>>>>>> } catch (OutOfResourceException e) { logger.error(e.getMessage()); runtimeError = e.getMessage(); } catch (TronException e) { spendUsage(false);
<<<<<<< @Autowired private GetExpandedSpendingKeyServlet getExpandedSpendingKeyServlet; @Autowired private GetAkFromAskServlet getAkFromAskServlet; @Autowired private GetNkFromNskServlet getNkFromNskServlet; @Autowired private GetSpendingKeyServlet getSpendingKeyServlet; @Autowired private GetDiversifierServlet getDiversifierServlet; @Autowired private GetIncomingViewingKeyServlet getIncomingViewingKeyServlet; @Autowired private GetZenPaymentAddressServlet getZenPaymentAddressServlet; @Autowired private CreateShieldedTransactionServlet createShieldedTransactionServlet; @Autowired private ScanNoteByIvkServlet scanNoteByIvkServlet; @Autowired private ScanAndMarkNoteByIvkServlet scanAndMarkNoteByIvkServlet; @Autowired private ScanNoteByOvkServlet scanNoteByOvkServlet; @Autowired private GetRcmServlet getRcmServlet; @Autowired private CreateSpendAuthSigServlet createSpendAuthSigServlet; @Autowired private CreateShieldNullifierServlet createShieldNullifierServlet; @Autowired private GetShieldTransactionHashServlet getShieldTransactionHashServlet; @Autowired private GetMerkleTreeVoucherInfoServlet getMerkleTreeVoucherInfoServlet; @Autowired private IsSpendServlet isSpendServlet; @Autowired private CreateShieldedTransactionWithoutSpendAuthSigServlet createShieldedTransactionWithoutSpendAuthSigServlet; @Autowired private BroadcastHexServlet broadcastHexServlet; ======= @Autowired private GetBrokerageServlet getBrokerageServlet; @Autowired private GetRewardServlet getRewardServlet; @Autowired private UpdateBrokerageServlet updateBrokerageServlet; >>>>>>> @Autowired private GetExpandedSpendingKeyServlet getExpandedSpendingKeyServlet; @Autowired private GetAkFromAskServlet getAkFromAskServlet; @Autowired private GetNkFromNskServlet getNkFromNskServlet; @Autowired private GetSpendingKeyServlet getSpendingKeyServlet; @Autowired private GetDiversifierServlet getDiversifierServlet; @Autowired private GetIncomingViewingKeyServlet getIncomingViewingKeyServlet; @Autowired private GetZenPaymentAddressServlet getZenPaymentAddressServlet; @Autowired private CreateShieldedTransactionServlet createShieldedTransactionServlet; @Autowired private ScanNoteByIvkServlet scanNoteByIvkServlet; @Autowired private ScanAndMarkNoteByIvkServlet scanAndMarkNoteByIvkServlet; @Autowired private ScanNoteByOvkServlet scanNoteByOvkServlet; @Autowired private GetRcmServlet getRcmServlet; @Autowired private CreateSpendAuthSigServlet createSpendAuthSigServlet; @Autowired private CreateShieldNullifierServlet createShieldNullifierServlet; @Autowired private GetShieldTransactionHashServlet getShieldTransactionHashServlet; @Autowired private GetMerkleTreeVoucherInfoServlet getMerkleTreeVoucherInfoServlet; @Autowired private IsSpendServlet isSpendServlet; @Autowired private CreateShieldedTransactionWithoutSpendAuthSigServlet createShieldedTransactionWithoutSpendAuthSigServlet; @Autowired private BroadcastHexServlet broadcastHexServlet; @Autowired private GetBrokerageServlet getBrokerageServlet; @Autowired private GetRewardServlet getRewardServlet; @Autowired private UpdateBrokerageServlet updateBrokerageServlet; <<<<<<< context .addServlet(new ServletHolder(getExpandedSpendingKeyServlet), "/getexpandedspendingkey"); context.addServlet(new ServletHolder(getAkFromAskServlet), "/getakfromask"); context.addServlet(new ServletHolder(getNkFromNskServlet), "/getnkfromnsk"); context.addServlet(new ServletHolder(getSpendingKeyServlet), "/getspendingkey"); context.addServlet(new ServletHolder(getDiversifierServlet), "/getdiversifier"); context.addServlet(new ServletHolder(getIncomingViewingKeyServlet), "/getincomingviewingkey"); context.addServlet(new ServletHolder(getZenPaymentAddressServlet), "/getzenpaymentaddress"); context.addServlet(new ServletHolder(createShieldedTransactionServlet), "/createshieldedtransaction"); context.addServlet(new ServletHolder(createShieldedTransactionWithoutSpendAuthSigServlet), "/createshieldedtransactionwithoutspendauthsig"); context.addServlet(new ServletHolder(scanNoteByIvkServlet), "/scannotebyivk"); context.addServlet(new ServletHolder(scanAndMarkNoteByIvkServlet), "/scanandmarknotebyivk"); context.addServlet(new ServletHolder(scanNoteByOvkServlet), "/scannotebyovk"); context.addServlet(new ServletHolder(getRcmServlet), "/getrcm"); context.addServlet(new ServletHolder(getMerkleTreeVoucherInfoServlet), "/getmerkletreevoucherinfo"); context.addServlet(new ServletHolder(isSpendServlet), "/isspend"); context.addServlet(new ServletHolder(createSpendAuthSigServlet), "/createspendauthsig"); context.addServlet(new ServletHolder(createShieldNullifierServlet), "/createshieldnullifier"); context.addServlet(new ServletHolder(getShieldTransactionHashServlet), "/getshieldtransactionhash"); context.addServlet(new ServletHolder(broadcastHexServlet), "/broadcasthex"); ======= context.addServlet(new ServletHolder(getBrokerageServlet), "/getBrokerage"); context.addServlet(new ServletHolder(getRewardServlet), "/getReward"); context.addServlet(new ServletHolder(updateBrokerageServlet), "/updateBrokerage"); >>>>>>> context .addServlet(new ServletHolder(getExpandedSpendingKeyServlet), "/getexpandedspendingkey"); context.addServlet(new ServletHolder(getAkFromAskServlet), "/getakfromask"); context.addServlet(new ServletHolder(getNkFromNskServlet), "/getnkfromnsk"); context.addServlet(new ServletHolder(getSpendingKeyServlet), "/getspendingkey"); context.addServlet(new ServletHolder(getDiversifierServlet), "/getdiversifier"); context.addServlet(new ServletHolder(getIncomingViewingKeyServlet), "/getincomingviewingkey"); context.addServlet(new ServletHolder(getZenPaymentAddressServlet), "/getzenpaymentaddress"); context.addServlet(new ServletHolder(createShieldedTransactionServlet), "/createshieldedtransaction"); context.addServlet(new ServletHolder(createShieldedTransactionWithoutSpendAuthSigServlet), "/createshieldedtransactionwithoutspendauthsig"); context.addServlet(new ServletHolder(scanNoteByIvkServlet), "/scannotebyivk"); context.addServlet(new ServletHolder(scanAndMarkNoteByIvkServlet), "/scanandmarknotebyivk"); context.addServlet(new ServletHolder(scanNoteByOvkServlet), "/scannotebyovk"); context.addServlet(new ServletHolder(getRcmServlet), "/getrcm"); context.addServlet(new ServletHolder(getMerkleTreeVoucherInfoServlet), "/getmerkletreevoucherinfo"); context.addServlet(new ServletHolder(isSpendServlet), "/isspend"); context.addServlet(new ServletHolder(createSpendAuthSigServlet), "/createspendauthsig"); context.addServlet(new ServletHolder(createShieldNullifierServlet), "/createshieldnullifier"); context.addServlet(new ServletHolder(getShieldTransactionHashServlet), "/getshieldtransactionhash"); context.addServlet(new ServletHolder(broadcastHexServlet), "/broadcasthex"); context.addServlet(new ServletHolder(getBrokerageServlet), "/getBrokerage"); context.addServlet(new ServletHolder(getRewardServlet), "/getReward"); context.addServlet(new ServletHolder(updateBrokerageServlet), "/updateBrokerage");
<<<<<<< case ALLOW_SHIELDED_TRANSACTION: { if (manager.getDynamicPropertiesStore().getAllowShieldedTransaction() == 0) { manager.getDynamicPropertiesStore().saveAllowShieldedTransaction(entry.getValue()); manager.getDynamicPropertiesStore().addSystemContractAndSetPermission(51); } break; } case SHIELDED_TRANSACTION_FEE: { manager.getDynamicPropertiesStore().saveShieldedTransactionFee(entry.getValue()); break; } case FORBID_TRANSFER_TO_CONTRACT: { manager.getDynamicPropertiesStore().saveForbidTransferToContract(entry.getValue()); break; } ======= // case ALLOW_SHIELDED_TRANSACTION: { // if (manager.getDynamicPropertiesStore().getAllowShieldedTransaction() == 0) { // manager.getDynamicPropertiesStore().saveAllowShieldedTransaction(entry.getValue()); // manager.getDynamicPropertiesStore().addSystemContractAndSetPermission(51); // } // break; // } // case SHIELDED_TRANSACTION_FEE: { // manager.getDynamicPropertiesStore().saveShieldedTransactionFee(entry.getValue()); // break; // } // case SHIELDED_TRANSACTION_CREATE_ACCOUNT_FEE: { // manager.getDynamicPropertiesStore() // .saveShieldedTransactionCreateAccountFee(entry.getValue()); // break; // } >>>>>>> // case ALLOW_SHIELDED_TRANSACTION: { // if (manager.getDynamicPropertiesStore().getAllowShieldedTransaction() == 0) { // manager.getDynamicPropertiesStore().saveAllowShieldedTransaction(entry.getValue()); // manager.getDynamicPropertiesStore().addSystemContractAndSetPermission(51); // } // break; // } // case SHIELDED_TRANSACTION_FEE: { // manager.getDynamicPropertiesStore().saveShieldedTransactionFee(entry.getValue()); // break; // } // case SHIELDED_TRANSACTION_CREATE_ACCOUNT_FEE: { // manager.getDynamicPropertiesStore() // .saveShieldedTransactionCreateAccountFee(entry.getValue()); // break; // } case FORBID_TRANSFER_TO_CONTRACT: { manager.getDynamicPropertiesStore().saveForbidTransferToContract(entry.getValue()); break; }
<<<<<<< private Map<String, Object> stores; private ChainBaseManager chainBaseManager; ======= public StoreFactory setDelegationService(DelegationService delegationService) { add(delegationService); return this; } >>>>>>> private Map<String, Object> stores; private ChainBaseManager chainBaseManager; public StoreFactory setDelegationService(DelegationService delegationService) { add(delegationService); return this; }
<<<<<<< public List<AssetIssueCapsule> getAllAssetIssuesOnSolidity() { List<AssetIssueCapsule> assetIssueCapsuleList = assetIssueStoreTrie .getAllAssetIssuesOnSolidity(); if (CollectionUtils.isNotEmpty(assetIssueCapsuleList)) { return assetIssueCapsuleList; } return Streams.stream(iteratorOnSolidity()) .map(Entry::getValue) .collect(Collectors.toList()); } ======= >>>>>>> <<<<<<< public List<AssetIssueCapsule> getAssetIssuesPaginatedOnSolidity(long offset, long limit) { return getAssetIssuesPaginated(getAllAssetIssuesOnSolidity(), offset, limit); } public AssetIssueCapsule getValue(byte[] key) { byte[] value = assetIssueStoreTrie.getValue(key); if (ArrayUtils.isNotEmpty(value)) { return new AssetIssueCapsule(value); } return null; } private AssetIssueCapsule getSolidityValue(byte[] key) { byte[] value = assetIssueStoreTrie.getSolidityValue(key); if (ArrayUtils.isNotEmpty(value)) { return new AssetIssueCapsule(value); } return null; } @Override public void delete(byte[] key) { super.delete(key); fastSyncCallBack.delete(key, ASSET); } @Override public void put(byte[] key, AssetIssueCapsule item) { super.put(key, item); fastSyncCallBack.callBack(key, item.getData(), ASSET); } ======= >>>>>>> public AssetIssueCapsule getValue(byte[] key) { byte[] value = assetIssueStoreTrie.getValue(key); if (ArrayUtils.isNotEmpty(value)) { return new AssetIssueCapsule(value); } return null; } @Override public void delete(byte[] key) { super.delete(key); fastSyncCallBack.delete(key, ASSET); } @Override public void put(byte[] key, AssetIssueCapsule item) { super.put(key, item); fastSyncCallBack.callBack(key, item.getData(), ASSET); }
<<<<<<< // while (true) { // try { // initGrpcClient(args.getTrustNodeAddr()); // syncSolidityBlock(); // shutdownGrpcClient(); // } catch (Exception e) { // logger.error("Error in sync solidity block " + e.getMessage(), e); // } // try { // Thread.sleep(5000); // } catch (InterruptedException e) { // e.printStackTrace(); // } // } ======= while (true) { try { initGrpcClient(args.getTrustNodeAddr()); syncSolidityBlock(); shutdownGrpcClient(); } catch (Exception e) { logger.error("Error in sync solidity block " + e.getMessage(), e); } try { Thread.sleep(5000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace(); } } >>>>>>> // while (true) { // try { // initGrpcClient(args.getTrustNodeAddr()); // syncSolidityBlock(); // shutdownGrpcClient(); // } catch (Exception e) { // logger.error("Error in sync solidity block " + e.getMessage(), e); // } // try { // Thread.sleep(5000); // } catch (InterruptedException e) { // Thread.currentThread().interrupt(); // e.printStackTrace(); // } // }
<<<<<<< @Getter/**/ @Setter public long allowTvmIstanbul; @Getter @Setter public long allowTvmStake; @Getter @Setter public long allowTvmAssetIssue; ======= @Getter @Setter public boolean openHistoryQueryWhenLiteFN = false; @Getter @Setter public boolean isLiteFullNode = false; >>>>>>> @Getter/**/ @Setter public long allowTvmIstanbul; @Getter @Setter public long allowTvmStake; @Getter @Setter public long allowTvmAssetIssue; @Getter @Setter public boolean openHistoryQueryWhenLiteFN = false; @Getter @Setter public boolean isLiteFullNode = false;
<<<<<<< import org.tron.protos.Protocal; ======= import org.tron.program.Args; >>>>>>> import org.tron.protos.Protocal; import org.tron.program.Args;
<<<<<<< import org.tron.core.exception.BadBlockException; import org.tron.core.exception.ValidateSignatureException; ======= import org.tron.core.capsule.BlockCapsule.BlockId; >>>>>>> import org.tron.core.capsule.BlockCapsule.BlockId; import org.tron.core.exception.BadBlockException; import org.tron.core.exception.ValidateSignatureException; <<<<<<< peer.setLastBlockPeerKnow(blkMsg.getMessageId()); try { del.handleBlock(blkMsg.getBlockCapsule()); } catch (ValidateSignatureException e) { //TODO process validate signature exception e.printStackTrace(); } catch (BadBlockException e) { } ======= peer.setLastBlockPeerKnow((BlockId)blkMsg.getMessageId()); del.handleBlock(blkMsg.getBlockCapsule()); >>>>>>> peer.setLastBlockPeerKnow((BlockId) blkMsg.getMessageId()); try { del.handleBlock(blkMsg.getBlockCapsule()); } catch (ValidateSignatureException e) { //TODO process validate signature exception e.printStackTrace(); } catch (BadBlockException e) { } <<<<<<< private void fetchNextBatchChainIds(PeerConnection peer) { ======= private void syncNextBatchChainIds(PeerConnection peer) { try { List<BlockId> chainSummary = del .getBlockChainSummary(peer.getLastBlockPeerKnow(), peer.getBlockChainToFetch()); peer.setLastBlockPeerKnow(chainSummary.isEmpty() ? del.getGenesisBlock() : chainSummary.get(chainSummary.size() - 1)); peer.sendMessage(new SyncBlockChainMessage(chainSummary)); } catch (Exception e) { //TODO: use tron excpetion here e.printStackTrace(); disconnectPeer(peer); } >>>>>>> private void syncNextBatchChainIds(PeerConnection peer) { try { List<BlockId> chainSummary = del .getBlockChainSummary(peer.getLastBlockPeerKnow(), peer.getBlockChainToFetch()); peer.setLastBlockPeerKnow(chainSummary.isEmpty() ? del.getGenesisBlock() : chainSummary.get(chainSummary.size() - 1)); peer.sendMessage(new SyncBlockChainMessage(chainSummary)); } catch (Exception e) { //TODO: use tron excpetion here e.printStackTrace(); disconnectPeer(peer); }
<<<<<<< import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.name.Names; import javax.inject.Inject; ======= >>>>>>> import javax.inject.Inject; <<<<<<< private Blockchain blockchain; private UTXOSet utxoSet; private Wallet wallet; private ECKey key; private String type; private Injector injector; @Inject public PeerBuilder(Injector injector) { this.injector = injector; } private void buildBlockchain() { if (wallet == null) { throw new IllegalStateException("Wallet must be set before building the blockchain"); } if (type == null) { throw new IllegalStateException("Type must be set before building the blockchain"); } blockchain = new Blockchain( injector.getInstance(Key.get(LevelDbDataSourceImpl.class, Names.named("block"))), ByteArray.toHexString(wallet.getAddress()), this.type ); } private void buildUTXOSet() { if (blockchain == null) { throw new IllegalStateException("Blockchain must be set before building the UTXOSet"); ======= private Blockchain blockchain; private UTXOSet utxoSet; private Wallet wallet; private ECKey key; private String type; private Client client; @Inject public PeerBuilder(Blockchain blockchain, UTXOSet utxoSet, Client client) { this.blockchain = blockchain; this.utxoSet = utxoSet; this.client = client; >>>>>>> private Blockchain blockchain; private UTXOSet utxoSet; private Wallet wallet; private ECKey key; private String type; private Client client; @Inject public PeerBuilder(Blockchain blockchain, UTXOSet utxoSet, Client client) { this.blockchain = blockchain; this.utxoSet = utxoSet; this.client = client; } private void buildWallet() { if (key == null) { throw new IllegalStateException("Key must be set before building the wallet"); <<<<<<< public PeerBuilder setKey(ECKey key) { this.key = key; return this; } public Peer build() { buildWallet(); buildBlockchain(); buildUTXOSet(); Peer peer = new Peer(type, blockchain, utxoSet, wallet, key); peer.setClient(injector.getInstance(Client.class)); blockchain.addListener(new BlockchainClientListener(injector.getInstance(Client.class), peer)); return peer; } ======= public Peer build() { buildWallet(); utxoSet.reindex(); Peer peer = new Peer(type, blockchain, utxoSet, wallet, key); peer.setClient(client); blockchain.addListener(new BlockchainClientListener(client, peer)); return peer; } >>>>>>> public PeerBuilder setKey(ECKey key) { this.key = key; return this; } public Peer build() { buildWallet(); utxoSet.reindex(); Peer peer = new Peer(type, blockchain, utxoSet, wallet, key); peer.setClient(client); blockchain.addListener(new BlockchainClientListener(client, peer)); return peer; }
<<<<<<< @Getter private boolean allowShieldedTransactionApi; ======= @Getter @Setter private long allowProtoFilterNum; @Getter @Setter private long allowAccountStateRoot; @Getter @Setter private int validContractProtoThreadNum; >>>>>>> @Getter private boolean allowShieldedTransactionApi; @Setter private long allowProtoFilterNum; @Getter @Setter private long allowAccountStateRoot; @Getter @Setter private int validContractProtoThreadNum; <<<<<<< INSTANCE.allowShieldedTransactionApi = false; ======= INSTANCE.allowProtoFilterNum = 0; INSTANCE.allowAccountStateRoot = 0; INSTANCE.validContractProtoThreadNum = 1; >>>>>>> INSTANCE.allowShieldedTransactionApi = false; INSTANCE.allowProtoFilterNum = 0; INSTANCE.allowAccountStateRoot = 0; INSTANCE.validContractProtoThreadNum = 1; <<<<<<< INSTANCE.allowShieldedTransactionApi = config.hasPath("node.allowShieldedTransactionApi") ? config.getBoolean("node.allowShieldedTransactionApi") : false; ======= INSTANCE.allowProtoFilterNum = config.hasPath("committee.allowProtoFilterNum") ? config .getInt("committee.allowProtoFilterNum") : 0; INSTANCE.allowAccountStateRoot = config.hasPath("committee.allowAccountStateRoot") ? config .getInt("committee.allowAccountStateRoot") : 0; INSTANCE.validContractProtoThreadNum = config.hasPath("node.validContractProto.threads") ? config .getInt("node.validContractProto.threads") : Runtime.getRuntime().availableProcessors(); >>>>>>> INSTANCE.allowShieldedTransactionApi = config.hasPath("node.allowShieldedTransactionApi") ? config.getBoolean("node.allowShieldedTransactionApi") : false; INSTANCE.allowProtoFilterNum = config.hasPath("committee.allowProtoFilterNum") ? config .getInt("committee.allowProtoFilterNum") : 0; INSTANCE.allowAccountStateRoot = config.hasPath("committee.allowAccountStateRoot") ? config .getInt("committee.allowAccountStateRoot") : 0; INSTANCE.validContractProtoThreadNum = config.hasPath("node.validContractProto.threads") ? config .getInt("node.validContractProto.threads") : Runtime.getRuntime().availableProcessors();
<<<<<<< import javax.inject.Inject; ======= import com.google.inject.Key; import com.google.inject.name.Names; import org.tron.consensus.client.BlockchainClientListener; >>>>>>> import com.google.inject.Key; import com.google.inject.name.Names; import javax.inject.Inject; import org.tron.consensus.client.BlockchainClientListener; <<<<<<< private void buildBlockchain() { if (wallet == null) { throw new IllegalStateException("Wallet must be set before building the blockchain"); } if (type == null) { throw new IllegalStateException("Type must be set before building the blockchain"); ======= blockchain = new Blockchain( injector.getInstance(Key.get(LevelDbDataSourceImpl.class, Names.named("block"))), ByteArray.toHexString(wallet.getAddress()), this.type ); >>>>>>> private void buildBlockchain() { if (wallet == null) { throw new IllegalStateException("Wallet must be set before building the blockchain"); } if (type == null) { throw new IllegalStateException("Type must be set before building the blockchain"); <<<<<<< public PeerBuilder setKey(ECKey key) { this.key = key; return this; } public Peer build() { buildWallet(); buildBlockchain(); buildUTXOSet(); Peer peer = new Peer(type, blockchain, utxoSet, wallet, key); peer.setClient(injector.getInstance(Client.class)); return peer; } ======= public Peer build() { buildWallet(); buildBlockchain(); buildUTXOSet(); Peer peer = new Peer(type, blockchain, utxoSet, wallet, key); peer.setClient(injector.getInstance(Client.class)); blockchain.addListener(new BlockchainClientListener(injector.getInstance(Client.class), peer)); return peer; } >>>>>>> public PeerBuilder setKey(ECKey key) { this.key = key; return this; } public Peer build() { buildWallet(); buildBlockchain(); buildUTXOSet(); Peer peer = new Peer(type, blockchain, utxoSet, wallet, key); peer.setClient(injector.getInstance(Client.class)); blockchain.addListener(new BlockchainClientListener(injector.getInstance(Client.class), peer)); return peer; }
<<<<<<< @Autowired private AddTransactionSignServlet addTransactionSignServlet; @Autowired private GetTransactionSignWeightServlet getTransactionSignWeightServlet; @Autowired private AccountPermissionUpdateServlet accountPermissionUpdateServlet; @Autowired private PermissionAddKeyServlet permissionAddKeyServlet; @Autowired private PermissionDeleteKeyServlet permissionDeleteKeyServlet; @Autowired private PermissionUpdateKeyServlet permissionUpdateKeyServlet; ======= @Autowired private GetNodeInfoServlet getNodeInfoServlet; @Autowired private UpdateSettingServlet updateSettingServlet; @Autowired private UpdateEnergyLimitServlet updateEnergyLimitServlet; @Autowired private GetDelegatedResourceAccountIndexServlet getDelegatedResourceAccountIndexServlet; @Autowired private GetDelegatedResourceServlet getDelegatedResourceServlet; >>>>>>> @Autowired private AddTransactionSignServlet addTransactionSignServlet; @Autowired private GetTransactionSignWeightServlet getTransactionSignWeightServlet; @Autowired private AccountPermissionUpdateServlet accountPermissionUpdateServlet; @Autowired private PermissionAddKeyServlet permissionAddKeyServlet; @Autowired private PermissionDeleteKeyServlet permissionDeleteKeyServlet; @Autowired private PermissionUpdateKeyServlet permissionUpdateKeyServlet; private GetNodeInfoServlet getNodeInfoServlet; @Autowired private UpdateSettingServlet updateSettingServlet; @Autowired private UpdateEnergyLimitServlet updateEnergyLimitServlet; @Autowired private GetDelegatedResourceAccountIndexServlet getDelegatedResourceAccountIndexServlet; @Autowired private GetDelegatedResourceServlet getDelegatedResourceServlet; <<<<<<< context.addServlet(new ServletHolder(addTransactionSignServlet), "/addtransactionsign"); context.addServlet(new ServletHolder(getTransactionSignWeightServlet), "/getsignweight"); context.addServlet(new ServletHolder(accountPermissionUpdateServlet), "/accountpermissionupdate"); context.addServlet(new ServletHolder(permissionAddKeyServlet), "/permissionaddkey"); context.addServlet(new ServletHolder(permissionDeleteKeyServlet), "/permissiondeletekey"); context.addServlet(new ServletHolder(permissionUpdateKeyServlet), "/permissionupdatekey"); ======= context.addServlet(new ServletHolder(getNodeInfoServlet), "/getnodeinfo"); context.addServlet(new ServletHolder(updateSettingServlet), "/updatesetting"); context.addServlet(new ServletHolder(updateEnergyLimitServlet), "/updateenergylimit"); context.addServlet(new ServletHolder(getDelegatedResourceServlet), "/getdelegatedresource"); context.addServlet( new ServletHolder(getDelegatedResourceAccountIndexServlet), "/getdelegatedresourceaccountindex"); >>>>>>> context.addServlet(new ServletHolder(addTransactionSignServlet), "/addtransactionsign"); context.addServlet(new ServletHolder(getTransactionSignWeightServlet), "/getsignweight"); context.addServlet(new ServletHolder(accountPermissionUpdateServlet), "/accountpermissionupdate"); context.addServlet(new ServletHolder(permissionAddKeyServlet), "/permissionaddkey"); context.addServlet(new ServletHolder(permissionDeleteKeyServlet), "/permissiondeletekey"); context.addServlet(new ServletHolder(permissionUpdateKeyServlet), "/permissionupdatekey"); context.addServlet(new ServletHolder(getNodeInfoServlet), "/getnodeinfo"); context.addServlet(new ServletHolder(updateSettingServlet), "/updatesetting"); context.addServlet(new ServletHolder(updateEnergyLimitServlet), "/updateenergylimit"); context.addServlet(new ServletHolder(getDelegatedResourceServlet), "/getdelegatedresource"); context.addServlet( new ServletHolder(getDelegatedResourceAccountIndexServlet), "/getdelegatedresourceaccountindex");
<<<<<<< public void setMaxCapacity(int maxCapacity) { this.maxCapacity = maxCapacity; ======= public synchronized void setMaxCapcity(int maxCapacity) { this.maxCapacity = maxCapacity; >>>>>>> public synchronized void setMaxCapacity(int maxCapacity) { this.maxCapacity = maxCapacity;
<<<<<<< InternalTransaction internalTransaction = new InternalTransaction(trx); this.program = new Program(null, code, programInvoke,internalTransaction, config); ======= //InternalTransaction internalTransaction = new InternalTransaction(trx); InternalTransaction internalTransaction = new InternalTransaction(trx, contract.getOwnerAddress().toByteArray(), contract.getContractAddress().toByteArray(), contract.getCallValue().isEmpty() ? new Byte("0") : contract.getCallValue().toByteArray()[0]); this.program = new Program(null, code, programInvoke, internalTransaction, config); >>>>>>> InternalTransaction internalTransaction = new InternalTransaction(trx); this.program = new Program(null, code, programInvoke,internalTransaction, config); <<<<<<< byte[] ops = contract.getBytecode().toByteArray(); InternalTransaction internalTransaction = new InternalTransaction(trx); ======= byte[] ops = newSmartContract.getBytecode().toByteArray(); InternalTransaction internalTransaction = new InternalTransaction(trx, contract.getOwnerAddress().toByteArray(), newSmartContract.getContractAddress().toByteArray(), newSmartContract.getCallValue().isEmpty() ? new Byte("0") : newSmartContract.getCallValue().toByteArray()[0]); >>>>>>> byte[] ops = newSmartContract.getBytecode().toByteArray(); InternalTransaction internalTransaction = new InternalTransaction(trx);
<<<<<<< import org.tron.core.services.http.GetBrokerageServlet; import org.tron.core.services.http.GetRewardServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLatestNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLimitNextOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetExchangeByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNodeInfoOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNowBlockOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetPaginatedAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetTransactionCountByBlockNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListExchangesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListWitnessesOnSolidityServlet; ======= import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLatestNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLimitNextOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetExchangeByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNodeInfoOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNowBlockOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetPaginatedAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetTransactionCountByBlockNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListExchangesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListWitnessesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.TriggerConstantContractOnSolidityServlet; >>>>>>> import org.tron.core.services.http.GetBrokerageServlet; import org.tron.core.services.http.GetRewardServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListByNameOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLatestNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLimitNextOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetBlockByNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetExchangeByIdOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNodeInfoOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetNowBlockOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetPaginatedAssetIssueListOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.GetTransactionCountByBlockNumOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListExchangesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.ListWitnessesOnSolidityServlet; import org.tron.core.services.interfaceOnSolidity.http.TriggerConstantContractOnSolidityServlet; <<<<<<< @Autowired private GetBrokerageServlet getBrokerageServlet; @Autowired private GetRewardServlet getRewardServlet; ======= @Autowired private TriggerConstantContractOnSolidityServlet triggerConstantContractOnSolidityServlet; >>>>>>> @Autowired private GetBrokerageServlet getBrokerageServlet; @Autowired private GetRewardServlet getRewardServlet; @Autowired private TriggerConstantContractOnSolidityServlet triggerConstantContractOnSolidityServlet;
<<<<<<< ApplicationFactory.create(context).shutdown(); context.destroy(); ======= >>>>>>> <<<<<<< ======= context.destroy(); >>>>>>> context.destroy();
<<<<<<< static abstract class Coder { ======= abstract static class Coder { >>>>>>> static abstract class Coder { <<<<<<< ======= /** * constructor. */ >>>>>>> <<<<<<< private static Coder getParamCoder(String type) { ======= public static String geMethodId(String methodSign) { return null; } /** * constructor. */ public static Coder getParamCoder(String type) { >>>>>>> private static Coder getParamCoder(String type) { <<<<<<< static class CoderDynamicBytes extends Coder { ======= static class CoderToken extends Coder { @Override byte[] encode(String value) { String hex = Hex.toHexString(new DataWord(value.getBytes()).getData()); return new CoderFixedBytes().encode(hex); } @Override byte[] decode() { return new byte[0]; } } static class CoderDynamicBytes extends Coder { >>>>>>> static class CoderDynamicBytes extends Coder { <<<<<<< ======= /** * constructor. */ >>>>>>> <<<<<<< ======= /** * constructor. */ >>>>>>> <<<<<<< System.arraycopy(encodedList.get(idx), 0,data, dynamicOffset, encodedList.get(idx).length ); ======= System.arraycopy(encodedList.get(idx), 0, data, dynamicOffset, encodedList.get(idx).length); >>>>>>> System.arraycopy(encodedList.get(idx), 0, data, dynamicOffset, encodedList.get(idx).length); <<<<<<< ======= /** * constructor. */ >>>>>>> <<<<<<< ======= /** * constructor. */ >>>>>>> <<<<<<< ======= /** * constructor. */ >>>>>>>
<<<<<<< import java.util.function.Predicate; ======= import java.util.concurrent.TimeUnit; >>>>>>> import java.util.concurrent.TimeUnit; import java.util.function.Predicate; <<<<<<< ======= import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; >>>>>>> import com.google.common.base.Supplier; import com.google.common.base.Suppliers; <<<<<<< ======= // These fields are very frequently accessed (each time a connection is created) and expensive to compute, so cache them. private Supplier<Long> timeoutSupplier; private Supplier<SaslConnectionParams> saslSupplier; private Supplier<SslConnectionParams> sslSupplier; private TCredentials rpcCreds; /** * Instantiate a client context */ >>>>>>> // These fields are very frequently accessed (each time a connection is created) and expensive to compute, so cache them. private Supplier<Long> timeoutSupplier; private Supplier<SaslConnectionParams> saslSupplier; private Supplier<SslConnectionParams> sslSupplier; private TCredentials rpcCreds; /** * Instantiate a client context */
<<<<<<< ======= import java.util.ArrayList; import java.util.Collection; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Queue; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; >>>>>>> import java.util.ArrayList; import java.util.Collection; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map.Entry; import java.util.Queue; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit;
<<<<<<< ======= import org.tron.core.exception.ContractExeException; import org.tron.core.exception.ContractValidateException; >>>>>>> import org.tron.core.exception.ContractExeException; import org.tron.core.exception.ContractValidateException; <<<<<<< public void step(Program program) { ======= public void step(Program program) throws ContractExeException, OutOfResourceException, ContractValidateException { >>>>>>> public void step(Program program) throws ContractValidateException { <<<<<<< public void play(Program program) { ======= public void play(Program program) throws ContractExeException, ContractValidateException { >>>>>>> public void play(Program program) throws ContractValidateException {
<<<<<<< ParamVector batchGradient = c.trainer.findGradient( masterFeatures, ======= ParamVector<String,?> batchGradient = c.trainer.findGradient( >>>>>>> ParamVector<String,?> batchGradient = c.trainer.findGradient( masterFeatures,
<<<<<<< protected void saveGraphKey(RawPosNegExample rawX, GraphWriter writer) { try { this.graphKeyWriter.write(serializeGraphKey(rawX,writer)); } catch (IOException e) { throw new IllegalStateException("Couldn't write to graph key file "+this.graphKeyFile.getName(),e); } } ======= >>>>>>> <<<<<<< if (this.graphKeyFile!= null) { saveGraphKey(rawX, writer); } ======= updateStatistics(rawX,rawX.getPosList().length,rawX.getNegList().length,posIds.size(),negIds.size()); >>>>>>> if (this.graphKeyFile!= null) { saveGraphKey(rawX, writer); } updateStatistics(rawX,rawX.getPosList().length,rawX.getNegList().length,posIds.size(),negIds.size()); <<<<<<< ExampleCookerConfiguration c = new ExampleCookerConfiguration(args, Configuration.USE_DEFAULTS | Configuration.USE_DATA | Configuration.USE_OUTPUT); ======= int flags = Configuration.USE_DEFAULTS | Configuration.USE_DATA | Configuration.USE_OUTPUT; Configuration c = new Configuration(args, flags); if (c.programFiles == null) Configuration.missing(Configuration.USE_PROGRAMFILES,flags); >>>>>>> int flags = Configuration.USE_DEFAULTS | Configuration.USE_DATA | Configuration.USE_OUTPUT; ExampleCookerConfiguration c = new ExampleCookerConfiguration(args, flags); if (c.programFiles == null) Configuration.missing(Configuration.USE_PROGRAMFILES,flags);
<<<<<<< import org.apache.hadoop.util.StringUtils; import org.eclipse.jetty.server.HttpConnectionFactory; ======= import org.apache.commons.lang.StringUtils; >>>>>>> import org.apache.commons.lang.StringUtils; import org.eclipse.jetty.server.HttpConnectionFactory;
<<<<<<< import java.io.File; import java.io.FileReader; ======= >>>>>>> import java.io.File; import java.io.FileReader; <<<<<<< import org.apache.log4j.Logger; import edu.cmu.ml.praprolog.learn.PosNegRWExample; import edu.cmu.ml.praprolog.learn.SRW; import edu.cmu.ml.praprolog.learn.WeightingScheme; import edu.cmu.ml.praprolog.prove.Component; import edu.cmu.ml.praprolog.prove.Goal; import edu.cmu.ml.praprolog.prove.InnerProductWeighter; import edu.cmu.ml.praprolog.prove.LogicProgram; import edu.cmu.ml.praprolog.prove.LogicProgramState; import edu.cmu.ml.praprolog.prove.ProPPRLogicProgramState; import edu.cmu.ml.praprolog.prove.Prover; import edu.cmu.ml.praprolog.prove.ThawedPosNegExample; import edu.cmu.ml.praprolog.util.Configuration; import edu.cmu.ml.praprolog.util.Dictionary; import edu.cmu.ml.praprolog.util.ExperimentConfiguration; import edu.cmu.ml.praprolog.util.ParsedFile; import edu.cmu.ml.praprolog.util.SymbolTable; ======= >>>>>>> import org.apache.log4j.Logger; import edu.cmu.ml.praprolog.learn.PosNegRWExample; import edu.cmu.ml.praprolog.learn.SRW; import edu.cmu.ml.praprolog.learn.WeightingScheme; import edu.cmu.ml.praprolog.prove.Component; import edu.cmu.ml.praprolog.prove.Goal; import edu.cmu.ml.praprolog.prove.InnerProductWeighter; import edu.cmu.ml.praprolog.prove.LogicProgram; import edu.cmu.ml.praprolog.prove.LogicProgramState; import edu.cmu.ml.praprolog.prove.ProPPRLogicProgramState; import edu.cmu.ml.praprolog.prove.Prover; import edu.cmu.ml.praprolog.prove.ThawedPosNegExample; import edu.cmu.ml.praprolog.util.Configuration; import edu.cmu.ml.praprolog.util.Dictionary; import edu.cmu.ml.praprolog.util.ExperimentConfiguration; import edu.cmu.ml.praprolog.util.ParsedFile; import edu.cmu.ml.praprolog.util.SymbolTable; import edu.cmu.ml.praprolog.prove.feat.ComplexFeatureLibrary; <<<<<<< private static final Logger log = Logger.getLogger(QueryAnswerer.class); static class QueryAnswererConfiguration extends ExperimentConfiguration { boolean normalize; boolean rerank; public QueryAnswererConfiguration(String[] args, int flags) { super(args, flags); } @Override protected void addOptions(Options options, int flags) { super.addOptions(options,flags); options.addOption( OptionBuilder .withLongOpt("unnormalized") .withDescription("Show unnormalized scores for answers") .create()); options.addOption( OptionBuilder .withLongOpt("reranked") .withDescription("Cook with unit weights and rerank solutions, instead of cooking with trained weights") .create()); } @Override protected void retrieveSettings(CommandLine line, int flags, Options options) { super.retrieveSettings(line, flags, options); this.normalize = true; if (line.hasOption("unnormalized")) this.normalize = false; this.rerank=false; if (line.hasOption("reranked")) this.rerank=true; } } public static void main(String[] args) throws IOException { QueryAnswererConfiguration c = new QueryAnswererConfiguration(args, Configuration.USE_DEFAULTS|Configuration.USE_QUERIES|Configuration.USE_OUTPUT|Configuration.USE_PARAMS); LogicProgram program = new LogicProgram(Component.loadComponents(c.programFiles,c.alpha)); QueryAnswerer qa = null; if (c.rerank) qa = new RerankingQueryAnswerer( (SRW<PosNegRWExample<String>>) c.srw); else qa = new QueryAnswerer(); log.info("Running queries from "+c.queryFile+"; saving results to "+c.outputFile); if (c.paramsFile != null) { qa.addParams(program,c.paramsFile, c.weightingScheme); } qa.findSolutions(program, c.prover, c.queryFile, c.outputFile, c.normalize); } public Map<LogicProgramState,Double> getSolutions(Prover prover,Goal query,LogicProgram program) { return prover.proveState(program, new ProPPRLogicProgramState(query)); } public void addParams(LogicProgram program, String paramsFile, WeightingScheme wScheme) { program.setFeatureDictWeighter(InnerProductWeighter.fromParamVec(Dictionary.load(paramsFile), wScheme)); } public void findSolutions(LogicProgram program, Prover prover, File queryFile, String outputFile, boolean normalize) throws IOException { ParsedFile reader = new ParsedFile(queryFile); BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile)); try { int querynum=0; for (String line : reader) { querynum++; String queryString = line.split("\t")[0]; queryString = queryString.replaceAll("[(]", ",").replaceAll("\\)","").trim(); Goal query = Goal.parseGoal(queryString, ","); query.compile(program.getSymbolTable()); log.info("Querying: "+query); long start = System.currentTimeMillis(); Map<LogicProgramState,Double> dist = getSolutions(prover,query,program); long end = System.currentTimeMillis(); Map<String,Double> solutions = Prover.filterSolutions(dist); if (normalize) { log.debug("normalizing"); solutions = Dictionary.normalize(solutions); } else { log.debug("not normalizing"); } List<Map.Entry<String,Double>> solutionDist = Dictionary.sort(solutions); // List<Map.Entry<String,Double>> solutionDist = Dictionary.sort(Dictionary.normalize(dist)); log.info("Writing "+solutionDist.size()+" solutions..."); writer.append("# proved ").append(String.valueOf(querynum)).append("\t").append(query.toSaveString()).append("\t").append((end-start) + " msec"); writer.newLine(); int rank = 0; for (Map.Entry<String,Double> soln : solutionDist) { ++rank; writer.append(rank+"\t").append(soln.getValue().toString()).append("\t").append(soln.getKey()); writer.newLine(); } } } finally { reader.close(); writer.close(); } } ======= private static final Logger log = Logger.getLogger(QueryAnswerer.class); public static void main(String[] args) throws Exception { QueryAnswererConfiguration c = new QueryAnswererConfiguration( args, Configuration.USE_DEFAULTS | Configuration.USE_QUERIES | Configuration.USE_OUTPUT | Configuration.USE_PARAMS | Configuration.USE_COMPLEX_FEATURES); LogicProgram program = new LogicProgram(Component.loadComponents(c.programFiles, c.alpha)); ComplexFeatureLibrary.init(program, c.complexFeatureConfigFile); QueryAnswerer qa; if (c.rerank) qa = new RerankingQueryAnswerer((SRW<PosNegRWExample<String>>) c.srw); else qa = new QueryAnswerer(); log.info("Running queries from " + c.queryFile + "; saving results to " + c.outputFile); qa.findSolutions(program, c.prover, c.queryFile, c.outputFile, c.normalize, c.paramsFile); } public Map<LogicProgramState, Double> getSolutions(Prover prover, Goal query, LogicProgram program) { return prover.proveState(program, new ProPPRLogicProgramState(query)); } public void addParams(LogicProgram program, String paramsFile) { program.setFeatureDictWeighter(InnerProductWeighter.fromParamVec(Dictionary.load(paramsFile))); } public void findSolutions(LogicProgram program, Prover prover, String queryFile, String outputFile, boolean normalize, String paramsFile) throws IOException { if (paramsFile != null) { addParams(program, paramsFile); } ParsedFile reader = new ParsedFile(queryFile); BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile)); try { int querynum = 0; for (String line : reader) { querynum++; String queryString = line.split("\t")[0]; queryString = queryString.replaceAll("[(]", ",").replaceAll("\\)", "").trim(); Goal query = Goal.parseGoal(queryString, ","); query.compile(program.getSymbolTable()); log.info("Querying: " + query); long start = System.currentTimeMillis(); Map<LogicProgramState, Double> dist = getSolutions(prover, query, program); long end = System.currentTimeMillis(); Map<String, Double> solutions = Prover.filterSolutions(dist); if (normalize) { log.debug("normalizing"); solutions = Dictionary.normalize(solutions); } else { log.debug("not normalizing"); } List<Map.Entry<String, Double>> solutionDist = Dictionary.sort(solutions); // List<Map.Entry<String,Double>> solutionDist = Dictionary.sort(Dictionary.normalize(dist)); log.info("Writing " + solutionDist.size() + " solutions..."); writer.append("# proved ").append(String.valueOf(querynum)).append("\t").append(query.toSaveString()) .append("\t").append((end - start) + " msec"); writer.newLine(); int rank = 0; for (Map.Entry<String, Double> soln : solutionDist) { ++rank; writer.append(rank + "\t").append(soln.getValue().toString()).append("\t").append(soln.getKey()); writer.newLine(); } } } finally { reader.close(); writer.close(); } } static class QueryAnswererConfiguration extends ExperimentConfiguration { boolean normalize; boolean rerank; public QueryAnswererConfiguration(String[] args, int flags) { super(args, flags); } @Override protected void addOptions(Options options, int flags) { super.addOptions(options, flags); options.addOption( OptionBuilder .withLongOpt("unnormalized") .withDescription("Show unnormalized scores for answers") .create()); options.addOption( OptionBuilder .withLongOpt("reranked") .withDescription("Cook with unit weights and rerank solutions, instead of cooking with trained weights") .create()); } @Override protected void retrieveSettings(CommandLine line, int flags, Options options) { super.retrieveSettings(line, flags, options); this.normalize = true; if (line.hasOption("unnormalized")) this.normalize = false; this.rerank = false; if (line.hasOption("reranked")) this.rerank = true; } } >>>>>>> private static final Logger log = Logger.getLogger(QueryAnswerer.class); static class QueryAnswererConfiguration extends ExperimentConfiguration { boolean normalize; boolean rerank; public QueryAnswererConfiguration(String[] args, int flags) { super(args, flags); } @Override protected void addOptions(Options options, int flags) { super.addOptions(options,flags); options.addOption( OptionBuilder .withLongOpt("unnormalized") .withDescription("Show unnormalized scores for answers") .create()); options.addOption( OptionBuilder .withLongOpt("reranked") .withDescription("Cook with unit weights and rerank solutions, instead of cooking with trained weights") .create()); } @Override protected void retrieveSettings(CommandLine line, int flags, Options options) { super.retrieveSettings(line, flags, options); this.normalize = true; if (line.hasOption("unnormalized")) this.normalize = false; this.rerank=false; if (line.hasOption("reranked")) this.rerank=true; } } public static void main(String[] args) throws IOException { QueryAnswererConfiguration c = new QueryAnswererConfiguration(args, Configuration.USE_DEFAULTS|Configuration.USE_QUERIES|Configuration.USE_OUTPUT|Configuration.USE_PARAMS); LogicProgram program = new LogicProgram(Component.loadComponents(c.programFiles,c.alpha)); ComplexFeatureLibrary.init(program, c.complexFeatureConfigFile); QueryAnswerer qa = null; if (c.rerank) qa = new RerankingQueryAnswerer( (SRW<PosNegRWExample<String>>) c.srw); else qa = new QueryAnswerer(); log.info("Running queries from "+c.queryFile+"; saving results to "+c.outputFile); if (c.paramsFile != null) { qa.addParams(program,c.paramsFile, c.weightingScheme); } qa.findSolutions(program, c.prover, c.queryFile, c.outputFile, c.normalize); } public Map<LogicProgramState,Double> getSolutions(Prover prover,Goal query,LogicProgram program) { return prover.proveState(program, new ProPPRLogicProgramState(query)); } public void addParams(LogicProgram program, String paramsFile, WeightingScheme wScheme) { program.setFeatureDictWeighter(InnerProductWeighter.fromParamVec(Dictionary.load(paramsFile), wScheme)); } public void findSolutions(LogicProgram program, Prover prover, File queryFile, String outputFile, boolean normalize) throws IOException { ParsedFile reader = new ParsedFile(queryFile); BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile)); try { int querynum=0; for (String line : reader) { querynum++; String queryString = line.split("\t")[0]; queryString = queryString.replaceAll("[(]", ",").replaceAll("\\)","").trim(); Goal query = Goal.parseGoal(queryString, ","); query.compile(program.getSymbolTable()); log.info("Querying: "+query); long start = System.currentTimeMillis(); Map<LogicProgramState,Double> dist = getSolutions(prover,query,program); long end = System.currentTimeMillis(); Map<String,Double> solutions = Prover.filterSolutions(dist); if (normalize) { log.debug("normalizing"); solutions = Dictionary.normalize(solutions); } else { log.debug("not normalizing"); } List<Map.Entry<String,Double>> solutionDist = Dictionary.sort(solutions); // List<Map.Entry<String,Double>> solutionDist = Dictionary.sort(Dictionary.normalize(dist)); log.info("Writing "+solutionDist.size()+" solutions..."); writer.append("# proved ").append(String.valueOf(querynum)).append("\t").append(query.toSaveString()) .append("\t").append((end - start) + " msec"); writer.newLine(); int rank = 0; for (Map.Entry<String,Double> soln : solutionDist) { ++rank; writer.append(rank+"\t").append(soln.getValue().toString()).append("\t").append(soln.getKey()); writer.newLine(); } } } finally { reader.close(); writer.close(); } }
<<<<<<< if (DataStore.INSTANCE.getDataCount() > 0) { try { LocalDateTime validTime = LocalDateTime.parse(validDate); Map<String, Serializable> map = new HashMap<>(3); map.put("test", "NO"); map.put("validDate", OffsetDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX"))); map.put("count", DataStore.INSTANCE.getDataCount()); return map; } catch (DateTimeParseException e) { throw new InvalidQueryParameterException("'" + validDate + "' is not a date", e); } } else { throw new NoDataException(); ======= try { LocalDateTime validTime = LocalDateTime.parse(validDate); Map<String, Serializable> map = new HashMap<>(3); map.put("test", "NO"); map.put("validDate", OffsetDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXX"))); map.put("count", 1000); return map; } catch (DateTimeParseException e) { throw new InvalidQueryParameterException("'" + validDate + "' is not a date", e); >>>>>>> if (DataStore.INSTANCE.getDataCount() > 0) { try { LocalDateTime validTime = LocalDateTime.parse(validDate); Map<String, Serializable> map = new HashMap<>(3); map.put("test", "NO"); map.put("validDate", OffsetDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXX"))); map.put("count", DataStore.INSTANCE.getDataCount()); return map; } catch (DateTimeParseException e) { throw new InvalidQueryParameterException("'" + validDate + "' is not a date", e); } } else { throw new NoDataException();
<<<<<<< import android.support.v4.app.FragmentManager; ======= import android.util.Log; >>>>>>> import android.support.v4.app.FragmentManager; import android.util.Log; <<<<<<< /** * We use the fragment ID as a tag as well so we try both methodes of lookup * @return */ protected Fragment findChildFragmentByIdOrTag(int id){ Fragment frag = this.getChildFragmentManager().findFragmentById(id); if(null != frag) return frag; frag = this.getChildFragmentManager().findFragmentByTag(Integer.toString(id)); return frag; } ======= protected class BackendStatusTask extends AsyncTask<Void, Void, Status> { @Override protected org.mythtv.services.api.status.Status doInBackground( Void... params ) { Log.i( TAG, "BackendStatusTask.doInBackground : enter" ); LocationProfile mLocationProfile = mLocationProfileDaoHelper.findConnectedProfile( getActivity() ); ETagInfo etag = ETagInfo.createEmptyETag(); ResponseEntity<org.mythtv.services.api.status.Status> status = mMythtvServiceHelper.getMythServicesApi( mLocationProfile ).statusOperations().getStatus( etag ); if( status.getStatusCode() == HttpStatus.OK ) { Log.i( TAG, "BackendStatusTask.doInBackground : exit" ); return status.getBody(); } Log.i( TAG, "BackendStatusTask.doInBackground : exit, status not returned" ); return null; } /* (non-Javadoc) * @see android.os.AsyncTask#onPostExecute(java.lang.Object) */ @Override protected void onPostExecute( org.mythtv.services.api.status.Status result ) { Log.i( TAG, "BackendStatusTask.onPostExecute : enter" ); super.onPostExecute( result ); if( null != result ) { mStatus = result; } Log.i( TAG, "BackendStatusTask.onPostExecute : exit" ); } } >>>>>>> }
<<<<<<< import org.sonar.api.rule.Severity; import org.sonar.plugins.stash.StashPlugin.IssueType; ======= >>>>>>> import org.sonar.plugins.stash.StashPlugin.IssueType;
<<<<<<< when(stashRequestFacade.getSonarQubeReviewer(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), Mockito.anyString(), (StashClient) Mockito.anyObject())).thenReturn(stashUser); when(stashRequestFacade.getPullRequestDiffReport(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), (StashClient) Mockito.anyObject())).thenReturn(diffReport); ======= when(stashRequestFacade.getIssueThreshold()).thenReturn(STASH_ISSUE_THRESHOLD); >>>>>>> when(stashRequestFacade.getSonarQubeReviewer(Mockito.anyString(), (StashClient) Mockito.anyObject())).thenReturn(stashUser); when(stashRequestFacade.getPullRequestDiffReport(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), (StashClient) Mockito.anyObject())).thenReturn(diffReport); when(stashRequestFacade.getIssueThreshold()).thenReturn(STASH_ISSUE_THRESHOLD); <<<<<<< ======= when(stashRequestFacade.getIssueThreshold()).thenReturn(100); >>>>>>> when(stashRequestFacade.getIssueThreshold()).thenReturn(100); <<<<<<< verify(stashRequestFacade, times(0)).resetComments(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), eq(diffReport), eq(stashUser), (StashClient) Mockito.anyObject()); verify(stashRequestFacade, times(0)).postCommentPerIssue(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), eq(SONARQUBE_URL), eq(report), eq(diffReport), (StashClient) Mockito.anyObject()); verify(stashRequestFacade, times(1)).postAnalysisOverview(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), eq(SONARQUBE_URL), eq(STASH_ISSUE_THRESHOLD), eq(report), (StashClient) Mockito.anyObject()); ======= verify(stashRequestFacade, times(0)).postCommentPerIssue(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), eq(SONARQUBE_URL), eq(report), (StashClient) Mockito.anyObject()); verify(stashRequestFacade, times(1)).postAnalysisOverview(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), eq(SONARQUBE_URL), eq(STASH_ISSUE_THRESHOLD), eq(report), (StashClient) Mockito.anyObject()); >>>>>>> verify(stashRequestFacade, times(0)).resetComments(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), eq(diffReport), eq(stashUser), (StashClient) Mockito.anyObject()); verify(stashRequestFacade, times(0)).postCommentPerIssue(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), eq(SONARQUBE_URL), eq(report), eq(diffReport), (StashClient) Mockito.anyObject()); verify(stashRequestFacade, times(1)).postAnalysisOverview(eq(STASH_PROJECT), eq(STASH_REPOSITORY), eq(STASH_PULLREQUEST_ID), eq(SONARQUBE_URL), eq(STASH_ISSUE_THRESHOLD), eq(report), (StashClient) Mockito.anyObject());
<<<<<<< import org.sonar.plugins.stash.issue.StashUser; ======= import org.sonar.plugins.stash.issue.StashPullRequest; import org.sonar.plugins.stash.issue.StashUser; >>>>>>> import org.sonar.plugins.stash.issue.StashPullRequest; import org.sonar.plugins.stash.issue.StashUser; <<<<<<< private static final String CONNECTION_POST_ERROR_MESSAGE = "Unable to post a comment to {0} #{1}. Received {2} with message {3}."; private static final String CONNECTION_GET_ERROR_MESSAGE = "Unable to get comment linked to {0} #{1}. Received {2} with message {3}."; private static final String COMMENT_DELETION_ERROR_MESSAGE = "Unable to delete comment {0} from pull-request {1} #{2}. Received {3} with message {4}."; private static final String USER_GET_ERROR_MESSAGE = "Unable to retrieve user {0}. Received {1} with message {2}."; ======= private static final String PULL_REQUEST_APPROVAL_POST_ERROR_MESSAGE = "Unable to change status of pull-request {0} #{1}. Received {2} with message {3}."; private static final String PULL_REQUEST_GET_ERROR_MESSAGE = "Unable to retrieve pull-request {0} #{1}. Received {2} with message {3}."; private static final String PULL_REQUEST_PUT_ERROR_MESSAGE = "Unable to update pull-request {0} #{1}. Received {2} with message {3}."; private static final String USER_GET_ERROR_MESSAGE = "Unable to retrieve user {0}. Received {1} with message {2}."; private static final String COMMENT_POST_ERROR_MESSAGE = "Unable to post a comment to {0} #{1}. Received {2} with message {3}."; private static final String COMMENT_GET_ERROR_MESSAGE = "Unable to get comment linked to {0} #{1}. Received {2} with message {3}."; >>>>>>> private static final String PULL_REQUEST_APPROVAL_POST_ERROR_MESSAGE = "Unable to change status of pull-request {0} #{1}. Received {2} with message {3}."; private static final String PULL_REQUEST_GET_ERROR_MESSAGE = "Unable to retrieve pull-request {0} #{1}. Received {2} with message {3}."; private static final String PULL_REQUEST_PUT_ERROR_MESSAGE = "Unable to update pull-request {0} #{1}. Received {2} with message {3}."; private static final String USER_GET_ERROR_MESSAGE = "Unable to retrieve user {0}. Received {1} with message {2}."; private static final String COMMENT_POST_ERROR_MESSAGE = "Unable to post a comment to {0} #{1}. Received {2} with message {3}."; private static final String COMMENT_GET_ERROR_MESSAGE = "Unable to get comment linked to {0} #{1}. Received {2} with message {3}."; private static final String COMMENT_DELETION_ERROR_MESSAGE = "Unable to delete comment {0} from pull-request {1} #{2}. Received {3} with message {4}."; <<<<<<< public StashUser getUser(String project, String repository, String pullRequestId, String userSlug) throws StashClientException { AsyncHttpClient httpClient = createHttpClient(); try { String request = MessageFormat.format(USER_API, baseUrl + REST_API, userSlug); BoundRequestBuilder requestBuilder = httpClient.prepareGet(request); ======= public StashUser getUser(String project, String repository, String pullRequestId, String userSlug) throws StashClientException { AsyncHttpClient httpClient = createHttpClient(); try { String request = MessageFormat.format(USER_API, baseUrl + REST_API, userSlug); BoundRequestBuilder requestBuilder = httpClient.prepareGet(request); Response response = executeRequest(requestBuilder); int responseCode = response.getStatusCode(); if (responseCode != HttpURLConnection.HTTP_OK) { String responseMessage = response.getStatusText(); throw new StashClientException(MessageFormat.format(USER_GET_ERROR_MESSAGE, userSlug, responseCode, responseMessage)); } else { String jsonUser = response.getResponseBody(); return StashCollector.extractUser(jsonUser); } } catch (ExecutionException | TimeoutException | InterruptedException | StashReportExtractionException | IOException e) { throw new StashClientException(e); } finally { httpClient.close(); } } public StashPullRequest getPullRequest(String project, String repository, String pullRequestId) throws StashClientException { AsyncHttpClient httpClient = createHttpClient(); try { String request = MessageFormat.format(PULL_REQUEST_API, baseUrl + REST_API, project, repository, pullRequestId); BoundRequestBuilder requestBuilder = httpClient.prepareGet(request); Response response = executeRequest(requestBuilder); int responseCode = response.getStatusCode(); if (responseCode != HttpURLConnection.HTTP_OK) { String responseMessage = response.getStatusText(); throw new StashClientException(MessageFormat.format(PULL_REQUEST_GET_ERROR_MESSAGE, repository, pullRequestId, responseCode, responseMessage)); } else { String jsonPullRequest = response.getResponseBody(); return StashCollector.extractPullRequest(project, repository, pullRequestId, jsonPullRequest); } } catch (ExecutionException | TimeoutException | InterruptedException | StashReportExtractionException | IOException e) { throw new StashClientException(e); } finally { httpClient.close(); } } public void addPullRequestReviewer(String project, String repository, String pullRequestId, long pullRequestVersion, ArrayList<StashUser> reviewers) throws StashClientException { String request = MessageFormat.format(PULL_REQUEST_API, baseUrl + REST_API, project, repository, pullRequestId); JSONObject json = new JSONObject(); JSONArray jsonReviewers = new JSONArray(); for (StashUser reviewer: reviewers) { JSONObject reviewerName = new JSONObject(); reviewerName.put("name", reviewer.getName()); JSONObject user = new JSONObject(); user.put("user", reviewerName); jsonReviewers.add(user); } json.put("reviewers", jsonReviewers); json.put("id", pullRequestId); json.put("version", pullRequestVersion); AsyncHttpClient httpClient = createHttpClient(); BoundRequestBuilder requestBuilder = httpClient.preparePut(request); requestBuilder.setBody(json.toString()); try { Response response = executeRequest(requestBuilder); int responseCode = response.getStatusCode(); if (responseCode != HttpURLConnection.HTTP_OK) { String responseMessage = response.getStatusText(); throw new StashClientException(MessageFormat.format(PULL_REQUEST_PUT_ERROR_MESSAGE, repository, pullRequestId, responseCode, responseMessage)); } } catch (ExecutionException | TimeoutException | InterruptedException | IOException e) { throw new StashClientException(e); } finally { httpClient.close(); } } public void approvePullRequest(String project, String repository, String pullRequestId) throws StashClientException { String request = MessageFormat.format(APPROVAL_PULL_REQUEST_API, baseUrl + REST_API, project, repository, pullRequestId); AsyncHttpClient httpClient = createHttpClient(); BoundRequestBuilder requestBuilder = httpClient.preparePost(request); try { Response response = executeRequest(requestBuilder); int responseCode = response.getStatusCode(); if (responseCode != HttpURLConnection.HTTP_OK) { String responseMessage = response.getStatusText(); throw new StashClientException(MessageFormat.format(PULL_REQUEST_APPROVAL_POST_ERROR_MESSAGE, repository, pullRequestId, responseCode, responseMessage)); } } catch (ExecutionException | TimeoutException | InterruptedException | IOException e) { throw new StashClientException(e); } finally{ httpClient.close(); } } public void resetPullRequestApproval(String project, String repository, String pullRequestId) throws StashClientException { String request = MessageFormat.format(APPROVAL_PULL_REQUEST_API, baseUrl + REST_API, project, repository, pullRequestId); AsyncHttpClient httpClient = createHttpClient(); BoundRequestBuilder requestBuilder = httpClient.prepareDelete(request); try { Response response = executeRequest(requestBuilder); int responseCode = response.getStatusCode(); if (responseCode != HttpURLConnection.HTTP_OK) { String responseMessage = response.getStatusText(); throw new StashClientException(MessageFormat.format(PULL_REQUEST_APPROVAL_POST_ERROR_MESSAGE, repository, pullRequestId, responseCode, responseMessage)); } } catch (ExecutionException | TimeoutException | InterruptedException | IOException e) { throw new StashClientException(e); } finally{ httpClient.close(); } } >>>>>>> public StashUser getUser(String userSlug) throws StashClientException { AsyncHttpClient httpClient = createHttpClient(); try { String request = MessageFormat.format(USER_API, baseUrl + REST_API, userSlug); BoundRequestBuilder requestBuilder = httpClient.prepareGet(request);
<<<<<<< settings.setProperty("sonar.scanAllFiles", false); StashPluginConfiguration SPC = new StashPluginConfiguration(settings, null); ======= StashPluginConfiguration SPC = new StashPluginConfiguration(settings); >>>>>>> StashPluginConfiguration SPC = new StashPluginConfiguration(settings, null);
<<<<<<< final int[] themes = {R.style.default_theme, R.style.material_theme, R.style.westeros_theme}; final int[] colors = {R.color.colorPrimary_default, R.color.colorPrimary_material, R.color.colorPrimary_westeros}; private Integer _currentThemePosition; private View _content; ======= int[] themes = {R.style.default_theme, R.style.material_theme, R.style.westeros_theme}; int[] colors = {R.color.colorPrimary_default, R.color.colorPrimary_material, R.color.colorPrimary_westeros}; private Integer currentThemePosition; private View content; >>>>>>> private final int[] themes = {R.style.default_theme, R.style.material_theme, R.style.westeros_theme}; private final int[] colors = {R.color.colorPrimary_default, R.color.colorPrimary_material, R.color.colorPrimary_westeros}; private Integer currentThemePosition; private View content;
<<<<<<< import android.os.Build; import android.support.annotation.RequiresApi; ======= import android.net.Uri; import android.support.v4.content.FileProvider; >>>>>>> import android.os.Build; import android.support.annotation.RequiresApi; import android.net.Uri; import android.support.v4.content.FileProvider;
<<<<<<< import com.liferay.mobile.screens.viewsets.defaultviews.DefaultTheme; ======= import com.liferay.mobile.screens.viewsets.defaultviews.DefaultCrouton; >>>>>>> import com.liferay.mobile.screens.viewsets.defaultviews.DefaultTheme; import com.liferay.mobile.screens.viewsets.defaultviews.DefaultCrouton; <<<<<<< super(context, null); DefaultTheme.initIfThemeNotPresent(context); ======= super(context); >>>>>>> super(context); DefaultTheme.initIfThemeNotPresent(context); <<<<<<< super(context, attributes, 0); DefaultTheme.initIfThemeNotPresent(context); ======= super(context, attributes); >>>>>>> super(context, attributes); DefaultTheme.initIfThemeNotPresent(context);
<<<<<<< _screenlet = (UserPortraitScreenlet) findViewById(R.id.user_portrait_screenlet); _screenlet.setListener(this); _screenlet.setCacheListener(this); ======= screenlet = (UserPortraitScreenlet) findViewById(R.id.user_portrait_screenlet); screenlet.setListener(this); >>>>>>> screenlet = (UserPortraitScreenlet) findViewById(R.id.user_portrait_screenlet); screenlet.setListener(this); screenlet.setCacheListener(this); <<<<<<< @Override public void error(Exception e, String userAction) { } private UserPortraitScreenlet _screenlet; ======= private UserPortraitScreenlet screenlet; >>>>>>> @Override public void error(Exception e, String userAction) { } private UserPortraitScreenlet screenlet;
<<<<<<< private CachePolicy _cachePolicy; ======= private String _templateId; >>>>>>> private CachePolicy _cachePolicy; private String _templateId;
<<<<<<< long groupId = LiferayServerContext.getGroupId(); _groupId = castToLongOrUseDefault(typedArray.getString( R.styleable.AssetListScreenlet_groupId), groupId); ======= _groupId = typedArray.getInteger( R.styleable.AssetListScreenlet_groupId, (int) LiferayServerContext.getGroupId()); _portletItemName = typedArray.getString(R.styleable.AssetListScreenlet_portletItemName); >>>>>>> long groupId = LiferayServerContext.getGroupId(); _groupId = castToLongOrUseDefault(typedArray.getString( R.styleable.AssetListScreenlet_groupId), groupId); _portletItemName = typedArray.getString(R.styleable.AssetListScreenlet_portletItemName); <<<<<<< private long _classNameId; private long _groupId; ======= private String _portletItemName; private int _classNameId; private int _groupId; >>>>>>> private long _classNameId; private long _groupId; private String _portletItemName;
<<<<<<< public static void reloadFromResources(Resources resources, final String packageName) { int companyIdentifier = resources.getIdentifier("liferay_company_id", "integer", packageName); int groupIdentifier = resources.getIdentifier("liferay_group_id", "integer", packageName); _companyId = getValueFromIntegerOrString(resources, R.string.liferay_company_id, companyIdentifier); _groupId = getValueFromIntegerOrString(resources, R.string.liferay_group_id, groupIdentifier); _server = resources.getString(R.string.liferay_server); _classFactory = resources.getString(R.string.liferay_class_factory); _portalVersion = LiferayPortalVersion.fromInt(resources.getInteger(R.integer.liferay_portal_version)); _versionFactory = resources.getString(R.string.liferay_version_factory); } public static void loadFromResources(Resources resources, final String packageName) { if (_companyId == 0 || _groupId == 0 || _server == null) { reloadFromResources(resources, packageName); } } public static long getCompanyId() { return _companyId; } public static void setCompanyId(long companyId) { _companyId = companyId; } public static long getGroupId() { return _groupId; } public static void setGroupId(long groupId) { _groupId = groupId; } public static String getServer() { return _server; } public static void setServer(String server) { _server = server; } public static String getClassFactory() { return _classFactory; } public static void setFactoryClass(String factoryClass) { _classFactory = factoryClass; } public static boolean isLiferay7() { return LiferayPortalVersion.VERSION_70.equals(_portalVersion); } public static boolean isLiferay62() { return LiferayPortalVersion.VERSION_70.equals(_portalVersion); } public static String getVersionFactory() { return _versionFactory; } private static long getValueFromIntegerOrString(final Resources resources, final int stringId, int integerId) { return integerId == 0 ? Long.valueOf(resources.getString(stringId)) : resources.getInteger(integerId); } private static String _server; private static long _companyId; private static long _groupId; private static String _classFactory; private static LiferayPortalVersion _portalVersion; private static String _versionFactory; ======= public static void loadFromResources(Resources resources, final String packageName) { if (_companyId == 0 || _groupId == 0 || _server == null) { int companyIdentifier = resources.getIdentifier("liferay_company_id", "integer", packageName); int groupIdentifier = resources.getIdentifier("liferay_group_id", "integer", packageName); _companyId = getValueFromIntegerOrString(resources, R.string.liferay_company_id, companyIdentifier); _groupId = getValueFromIntegerOrString(resources, R.string.liferay_group_id, groupIdentifier); _server = resources.getString(R.string.liferay_server); _classFactory = resources.getString(R.string.liferay_class_factory); _portalVersion = LiferayPortalVersion.fromInt(resources.getInteger(R.integer.liferay_portal_version)); _versionFactory = resources.getString(R.string.liferay_version_factory); } } public static long getCompanyId() { return _companyId; } public static void setCompanyId(long companyId) { _companyId = companyId; } public static long getGroupId() { return _groupId; } public static void setGroupId(long groupId) { _groupId = groupId; } public static String getServer() { return _server; } public static void setServer(String server) { _server = server; } public static String getClassFactory() { return _classFactory; } public static void setFactoryClass(String factoryClass) { _classFactory = factoryClass; } public static boolean isLiferay7() { return LiferayPortalVersion.VERSION_70.equals(_portalVersion); } public static boolean isLiferay62() { return LiferayPortalVersion.VERSION_70.equals(_portalVersion); } public static LiferayPortalVersion getPortalVersion() { return _portalVersion; } public static String getVersionFactory() { return _versionFactory; } private static long getValueFromIntegerOrString(final Resources resources, final int stringId, int integerId) { return integerId == 0 ? Long.valueOf(resources.getString(stringId)) : resources.getInteger(integerId); } private static String _server; private static long _companyId; private static long _groupId; private static String _classFactory; private static LiferayPortalVersion _portalVersion; private static String _versionFactory; >>>>>>> public static void reloadFromResources(Resources resources, final String packageName) { int companyIdentifier = resources.getIdentifier("liferay_company_id", "integer", packageName); int groupIdentifier = resources.getIdentifier("liferay_group_id", "integer", packageName); _companyId = getValueFromIntegerOrString(resources, R.string.liferay_company_id, companyIdentifier); _groupId = getValueFromIntegerOrString(resources, R.string.liferay_group_id, groupIdentifier); _server = resources.getString(R.string.liferay_server); _classFactory = resources.getString(R.string.liferay_class_factory); _portalVersion = LiferayPortalVersion.fromInt(resources.getInteger(R.integer.liferay_portal_version)); _versionFactory = resources.getString(R.string.liferay_version_factory); } public static void loadFromResources(Resources resources, final String packageName) { if (_companyId == 0 || _groupId == 0 || _server == null) { reloadFromResources(resources, packageName); } } public static long getCompanyId() { return _companyId; } public static void setCompanyId(long companyId) { _companyId = companyId; } public static long getGroupId() { return _groupId; } public static void setGroupId(long groupId) { _groupId = groupId; } public static String getServer() { return _server; } public static void setServer(String server) { _server = server; } public static String getClassFactory() { return _classFactory; } public static void setFactoryClass(String factoryClass) { _classFactory = factoryClass; } public static boolean isLiferay7() { return LiferayPortalVersion.VERSION_70.equals(_portalVersion); } public static boolean isLiferay62() { return LiferayPortalVersion.VERSION_70.equals(_portalVersion); } public static LiferayPortalVersion getPortalVersion() { return _portalVersion; } public static String getVersionFactory() { return _versionFactory; } private static long getValueFromIntegerOrString(final Resources resources, final int stringId, int integerId) { return integerId == 0 ? Long.valueOf(resources.getString(stringId)) : resources.getInteger(integerId); } private static String _server; private static long _companyId; private static long _groupId; private static String _classFactory; private static LiferayPortalVersion _portalVersion; private static String _versionFactory;
<<<<<<< screenlet.setFileEntry((FileEntry) assetEntry); screenlet.setAutoLoad(autoLoad); screenlet.render(layoutId); screenlet.loadFile(); return screenlet; } return null; } else if (assetEntry instanceof BlogsEntry) { BlogsEntryDisplayScreenlet blogsScreenlet = new BlogsEntryDisplayScreenlet(context); Integer layoutId = layouts.get(blogsScreenlet.getClass().getName()); blogsScreenlet.setBlogsEntry((BlogsEntry) assetEntry); blogsScreenlet.render(layoutId); blogsScreenlet.loadBlogsEntry(); return blogsScreenlet; ======= screenlet.setFileEntry((FileEntry) assetEntry); screenlet.setAutoLoad(autoLoad); screenlet.render(layoutId); return screenlet; } return null; } else if (assetEntry instanceof WebContent) { WebContentDisplayScreenlet webContentDisplayScreenlet = new WebContentDisplayScreenlet(context); Integer layoutId = layouts.get(webContentDisplayScreenlet.getClass().getName()); webContentDisplayScreenlet.setAutoLoad(autoLoad); webContentDisplayScreenlet.render(layoutId); webContentDisplayScreenlet.onWebContentReceived((WebContent) assetEntry); return webContentDisplayScreenlet; } else if (assetEntry instanceof BlogsEntry) { BlogsEntryDisplayScreenlet blogsScreenlet = new BlogsEntryDisplayScreenlet(context); Integer layoutId = layouts.get(blogsScreenlet.getClass().getName()); blogsScreenlet.setBlogsEntry((BlogsEntry) assetEntry); blogsScreenlet.setAutoLoad(autoLoad); blogsScreenlet.render(layoutId); return blogsScreenlet; >>>>>>> screenlet.setFileEntry((FileEntry) assetEntry); screenlet.setAutoLoad(autoLoad); screenlet.render(layoutId); screenlet.loadFile(); return screenlet; } } else if (assetEntry instanceof WebContent) { WebContentDisplayScreenlet webContentDisplayScreenlet = new WebContentDisplayScreenlet(context); Integer layoutId = layouts.get(webContentDisplayScreenlet.getClass().getName()); webContentDisplayScreenlet.setAutoLoad(autoLoad); webContentDisplayScreenlet.render(layoutId); webContentDisplayScreenlet.onWebContentReceived((WebContent) assetEntry); return webContentDisplayScreenlet; } else if (assetEntry instanceof BlogsEntry) { BlogsEntryDisplayScreenlet blogsScreenlet = new BlogsEntryDisplayScreenlet(context); Integer layoutId = layouts.get(blogsScreenlet.getClass().getName()); blogsScreenlet.setBlogsEntry((BlogsEntry) assetEntry); blogsScreenlet.setAutoLoad(autoLoad); blogsScreenlet.render(layoutId); blogsScreenlet.loadBlogsEntry(); return blogsScreenlet;
<<<<<<< BatchWriterPlusProblem bwpe = getWriter(login, tableName, null); ======= bwpe = getWriter(login, tableName, null); >>>>>>> bwpe = getWriter(login, tableName, null); <<<<<<< private void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusProblem bwpe) { ======= void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException bwpe) { >>>>>>> void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusProblem bwpe) { <<<<<<< private BatchWriterPlusProblem getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { ======= BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { >>>>>>> BatchWriterPlusProblem getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception {
<<<<<<< if (fileEntry == null) { AssetDisplayInteractorImpl assetDisplayInteractor = new AssetDisplayInteractorImpl(); assetDisplayInteractor.onScreenletAttached(this); assetDisplayInteractor.start(entryId); } else { onRetrieveAssetSuccess(fileEntry); ======= try { if (fileEntry == null || (className != null && classPK != 0)) { load(); } else { loadFile(); } } catch (Exception e) { onRetrieveAssetFailure(e); >>>>>>> if (fileEntry == null || (className != null && classPK != 0)) { load(); } else { loadFile();
<<<<<<< _groupId = castToLongOrUseDefault(typedArray.getString( R.styleable.WebContentDisplayScreenlet_groupId), LiferayServerContext.getGroupId()); ======= _templateId = typedArray.getString(R.styleable.WebContentDisplayScreenlet_templateId); _groupId = typedArray.getInt( R.styleable.WebContentDisplayScreenlet_groupId, (int) LiferayServerContext.getGroupId()); >>>>>>> _groupId = castToLongOrUseDefault(typedArray.getString( R.styleable.WebContentDisplayScreenlet_groupId), LiferayServerContext.getGroupId()); _templateId = typedArray.getString(R.styleable.WebContentDisplayScreenlet_templateId);
<<<<<<< public void load() { try { if (_userId != 0) { getInteractor().load(_userId); } else { getInteractor().load(_male, _portraitId, _uuid); } } catch (Exception e) { onUserPortraitFailure(e); } ======= public void load() { performUserAction(); >>>>>>> public void load() { try { if (_userId != 0) { getInteractor().load(_userId); } else { getInteractor().load(_male, _portraitId, _uuid); } } catch (Exception e) { onUserPortraitFailure(e); } performUserAction();
<<<<<<< findViewById(R.id.list_comments).setOnClickListener(this); ======= findViewById(R.id.ratings).setOnClickListener(this); >>>>>>> findViewById(R.id.list_comments).setOnClickListener(this); findViewById(R.id.ratings).setOnClickListener(this); <<<<<<< case R.id.list_comments: DefaultAnimation.startActivityWithAnimation(this, getIntentWithTheme(CommentsActivity.class)); break; ======= case R.id.ratings: DefaultAnimation.startActivityWithAnimation(this, getIntentWithTheme(RatingsActivity.class)); break; >>>>>>> case R.id.list_comments: DefaultAnimation.startActivityWithAnimation(this, getIntentWithTheme(CommentsActivity.class)); case R.id.ratings: DefaultAnimation.startActivityWithAnimation(this, getIntentWithTheme(RatingsActivity.class)); break;
<<<<<<< import hudson.security.ACL; import hudson.security.NotSerilizableSecurityContext; ======= import hudson.model.Action; import hudson.model.ParametersAction; >>>>>>> import hudson.security.ACL; import hudson.security.NotSerilizableSecurityContext; import hudson.model.Action; import hudson.model.ParametersAction; <<<<<<< CauseOfBlockage cause = canRunImpl(task, tjp); if (cause != null) return cause; ======= CauseOfBlockage cause = canRun(task, tjp); if (cause != null) { return cause; } >>>>>>> CauseOfBlockage cause = canRunImpl(task, tjp); if (cause != null) { return cause; }
<<<<<<< public void testRegionClickOffset() throws Exception { System.out.println("testRegionClickOffset"); JButtons frame = new JButtons(); assertEquals(0, frame.getCount()[1]); assertEquals(0, frame.getCount()[2]); Screen scr = new Screen(); Pattern ptn = new Pattern("test-res/cup-btn.png").targetOffset(-80,2); Thread.sleep(500); int ret = scr.click(ptn, 0); assertEquals(1, frame.getCount()[1]); assertEquals(0, frame.getCount()[2]); frame.dispose(); } ======= public void testRegionFind() throws Exception { System.out.println("testRegionFind"); Screen scr = new Screen(); scr.setROI(new Region(0,0,300,300)); scr.setAutoWaitTimeout(2); scr.setThrowException(true); long begin = (new Date()).getTime(); boolean gotFindFailed = false; try{ Match m = scr.find("test-res/google.png"); System.out.println("match: " + m); } catch(FindFailed e){ gotFindFailed = true; } long end = (new Date()).getTime(); assertTrue(gotFindFailed); assertTrue(end-begin >= 2000); scr.setAutoWaitTimeout(0); scr.setThrowException(false); begin = (new Date()).getTime(); scr.find("test-res/google.png"); end = (new Date()).getTime(); assertTrue(end-begin < 2500); } public void testSmallRegion() throws Exception { System.out.println("testSmallRegion"); Screen scr = new Screen(); scr.setROI(new Region(0,0,100,200)); scr.setAutoWaitTimeout(2); scr.setThrowException(true); long begin = (new Date()).getTime(); boolean gotFindFailed = false; try{ Match m = scr.find("test-res/google.png"); System.out.println("match: " + m); } catch(FindFailed e){ gotFindFailed = true; } long end = (new Date()).getTime(); assertTrue(gotFindFailed); } >>>>>>> public void testRegionClickOffset() throws Exception { System.out.println("testRegionClickOffset"); JButtons frame = new JButtons(); assertEquals(0, frame.getCount()[1]); assertEquals(0, frame.getCount()[2]); Screen scr = new Screen(); Pattern ptn = new Pattern("test-res/cup-btn.png").targetOffset(-80,2); Thread.sleep(500); int ret = scr.click(ptn, 0); assertEquals(1, frame.getCount()[1]); assertEquals(0, frame.getCount()[2]); frame.dispose(); } public void testRegionFind() throws Exception { System.out.println("testRegionFind"); Screen scr = new Screen(); scr.setROI(new Region(0,0,300,300)); scr.setAutoWaitTimeout(2); scr.setThrowException(true); long begin = (new Date()).getTime(); boolean gotFindFailed = false; try{ Match m = scr.find("test-res/google.png"); System.out.println("match: " + m); } catch(FindFailed e){ gotFindFailed = true; } long end = (new Date()).getTime(); assertTrue(gotFindFailed); assertTrue(end-begin >= 2000); scr.setAutoWaitTimeout(0); scr.setThrowException(false); begin = (new Date()).getTime(); scr.find("test-res/google.png"); end = (new Date()).getTime(); assertTrue(end-begin < 2500); } public void testSmallRegion() throws Exception { System.out.println("testSmallRegion"); Screen scr = new Screen(); scr.setROI(new Region(0,0,100,200)); scr.setAutoWaitTimeout(2); scr.setThrowException(true); long begin = (new Date()).getTime(); boolean gotFindFailed = false; try{ Match m = scr.find("test-res/google.png"); System.out.println("match: " + m); } catch(FindFailed e){ gotFindFailed = true; } long end = (new Date()).getTime(); assertTrue(gotFindFailed); } <<<<<<< /* ======= >>>>>>> /* <<<<<<< ======= public void testRegionClickOffset() throws Exception { System.out.println("testRegionClickOffset"); JButtons frame = new JButtons(); assertEquals(0, frame.getCount()[1]); assertEquals(0, frame.getCount()[2]); Screen scr = new Screen(); Pattern ptn = new Pattern("test-res/cup-btn.png").targetOffset(-80,2); int ret = scr.click(ptn, 0); Thread.sleep(500); assertEquals(1, frame.getCount()[1]); assertEquals(0, frame.getCount()[2]); frame.dispose(); } >>>>>>> public void testRegionClickOffset() throws Exception { System.out.println("testRegionClickOffset"); JButtons frame = new JButtons(); assertEquals(0, frame.getCount()[1]); assertEquals(0, frame.getCount()[2]); Screen scr = new Screen(); Pattern ptn = new Pattern("test-res/cup-btn.png").targetOffset(-80,2); int ret = scr.click(ptn, 0); Thread.sleep(500); assertEquals(1, frame.getCount()[1]); assertEquals(0, frame.getCount()[2]); frame.dispose(); } <<<<<<< System.out.println("testDragDrop"); JFrame frame = DragListDemo.createAndShowGUI(); Screen scr = new Screen(); scr.wait("test-res/item1-list2.png", 3); scr.dragDrop("test-res/item2-list1.png", "test-res/item1-list2.png",0); assertNotNull(scr.wait("test-res/draglist-result.png",3)); frame.dispose(); } public void testRegionFind() throws Exception { System.out.println("testRegionFind"); Screen scr = new Screen(); scr.setROI(new Region(0,0,300,300)); scr.setAutoWaitTimeout(2); scr.setThrowException(true); long begin = (new Date()).getTime(); boolean gotFindFailed = false; try{ Match m = scr.find("test-res/google.png"); System.out.println("match: " + m); } catch(FindFailed e){ gotFindFailed = true; } long end = (new Date()).getTime(); assertTrue(gotFindFailed); assertTrue(end-begin >= 2000); scr.setAutoWaitTimeout(0); scr.setThrowException(false); begin = (new Date()).getTime(); scr.find("test-res/google.png"); end = (new Date()).getTime(); assertTrue(end-begin < 2500); ======= System.out.println("testDragDrop"); JFrame frame = DragListDemo.createAndShowGUI(); Screen scr = new Screen(); scr.wait("test-res/item1-list2.png", 3); scr.dragDrop("test-res/item2-list1.png", "test-res/item1-list2.png",0); assertNotNull(scr.wait("test-res/draglist-result.png",3)); frame.dispose(); >>>>>>> System.out.println("testDragDrop"); JFrame frame = DragListDemo.createAndShowGUI(); Screen scr = new Screen(); scr.wait("test-res/item1-list2.png", 3); scr.dragDrop("test-res/item2-list1.png", "test-res/item1-list2.png",0); assertNotNull(scr.wait("test-res/draglist-result.png",3)); frame.dispose(); } public void testRegionFind() throws Exception { System.out.println("testRegionFind"); Screen scr = new Screen(); scr.setROI(new Region(0,0,300,300)); scr.setAutoWaitTimeout(2); scr.setThrowException(true); long begin = (new Date()).getTime(); boolean gotFindFailed = false; try{ Match m = scr.find("test-res/google.png"); System.out.println("match: " + m); } catch(FindFailed e){ gotFindFailed = true; } long end = (new Date()).getTime(); assertTrue(gotFindFailed); assertTrue(end-begin >= 2000); scr.setAutoWaitTimeout(0); scr.setThrowException(false); begin = (new Date()).getTime(); scr.find("test-res/google.png"); end = (new Date()).getTime(); assertTrue(end-begin < 2500);
<<<<<<< boolean legacyMetrics = cmd.hasOption('l'); ======= boolean autoDelete = boolArg(cmd, "ad", true); String queueArgs = strArg(cmd, "qa", null); int consumerLatencyInMicroseconds = intArg(cmd, 'L', 0); >>>>>>> boolean legacyMetrics = cmd.hasOption('l'); boolean autoDelete = boolArg(cmd, "ad", true); String queueArgs = strArg(cmd, "qa", null); int consumerLatencyInMicroseconds = intArg(cmd, 'L', 0); <<<<<<< options.addOption(new Option("l", "legacyMetrics", false, "display legacy metrics (min/avg/max latency)")); options.addOption(new Option("o", "outputFile", true, "output file for timing results")); ======= options.addOption(new Option("ad", "autoDelete", true, "should the queue be auto-deleted, default is true")); options.addOption(new Option("qa", "queueArgs", true, "queue arguments as key/pair values, separated by commas")); options.addOption(new Option("L", "consumerLatency", true, "consumer latency in microseconds")); >>>>>>> options.addOption(new Option("l", "legacyMetrics", false, "display legacy metrics (min/avg/max latency)")); options.addOption(new Option("o", "outputFile", true, "output file for timing results")); options.addOption(new Option("ad", "autoDelete", true, "should the queue be auto-deleted, default is true")); options.addOption(new Option("qa", "queueArgs", true, "queue arguments as key/pair values, separated by commas")); options.addOption(new Option("L", "consumerLatency", true, "consumer latency in microseconds"));
<<<<<<< import java.io.*; ======= import java.security.NoSuchAlgorithmException; >>>>>>> import java.io.*; import java.security.NoSuchAlgorithmException; <<<<<<< options.addOption(new Option("l", "legacyMetrics", false, "display legacy metrics (min/avg/max latency)")); options.addOption(new Option("o", "outputFile", true, "output file for timing results")); ======= options.addOption(new Option("useDefaultSslContext", "useDefaultSslContext", false,"use JVM default SSL context")); >>>>>>> options.addOption(new Option("l", "legacyMetrics", false, "display legacy metrics (min/avg/max latency)")); options.addOption(new Option("o", "outputFile", true, "output file for timing results")); options.addOption(new Option("useDefaultSslContext", "useDefaultSslContext", false,"use JVM default SSL context"));
<<<<<<< ======= import java.util.Arrays; import org.eclipse.ditto.model.base.entity.id.NamespacedEntityIdInvalidException; >>>>>>> import java.util.Arrays; import org.eclipse.ditto.model.base.entity.id.NamespacedEntityIdInvalidException; <<<<<<< JwtAudienceInvalidException.class); ======= JwtAudienceInvalidException.class, NamespacedEntityIdInvalidException.class, ThingIdInvalidException.class, PolicyIdInvalidException.class )); >>>>>>> JwtAudienceInvalidException.class, NamespacedEntityIdInvalidException.class, ThingIdInvalidException.class, PolicyIdInvalidException.class );
<<<<<<< import akka.testkit.TestKit; ======= >>>>>>> <<<<<<< final int sourceDelayMillis = 500; return Source.single(Boolean.TRUE).initialDelay(Duration.create(sourceDelayMillis, MILLISECONDS)); ======= final int sourceDelayMillis = 1500; return Source.single(Boolean.TRUE).initialDelay(Duration.create(sourceDelayMillis, TimeUnit.MILLISECONDS)); >>>>>>> final int sourceDelayMillis = 1500; return Source.single(Boolean.TRUE).initialDelay(Duration.create(sourceDelayMillis, MILLISECONDS)); <<<<<<< TestKit.shutdownActorSystem(actorSystem, Duration.create(60, SECONDS), true); ======= TestKit.shutdownActorSystem(actorSystem); >>>>>>> TestKit.shutdownActorSystem(actorSystem);
<<<<<<< @SuppressWarnings("unused") private RabbitMQClientActor(final Connection connection, final ConnectionStatus connectionStatus, ======= @SuppressWarnings("unused") private RabbitMQClientActor(final Connection connection, final ConnectionStatus connectionStatus, >>>>>>> @SuppressWarnings("unused") private RabbitMQClientActor(final Connection connection, final ConnectionStatus connectionStatus, <<<<<<< return connect(connection, null); ======= createConnectionSender = getSender(); return connect(connection, getSender(), FiniteDuration.apply(TEST_CONNECTION_TIMEOUT, TimeUnit.SECONDS)); >>>>>>> return connect(connection, FiniteDuration.apply(TEST_CONNECTION_TIMEOUT, TimeUnit.SECONDS)); <<<<<<< final boolean consuming = isConsuming(); final ActorRef self = getSelf(); connect(connection, origin).thenAccept(status -> createConsumerChannelAndNotifySelf(status, consuming, rmqConnectionActor, self)); ======= createConnectionSender = origin; connect(connection, origin).thenAccept( status -> log.info("Status of connecting in doConnectClient: {}", status)); } @Override protected void doReconnectClient(final Connection connection, @Nullable final ActorRef origin) { stopCommandConsumers(); stopCommandPublisher(); onClientDisconnected(Optional::empty, stateData()); createConnectionSender = origin; // wait a little until connecting again: getContext().getSystem() .scheduler() .scheduleOnce(FiniteDuration.apply(500, TimeUnit.MILLISECONDS), () -> connect(connection, origin).thenAccept(status -> log.info("Reconnected successfully.")), getContext().getSystem().dispatcher()); >>>>>>> final boolean consuming = isConsuming(); final ActorRef self = getSelf(); connect(connection, FiniteDuration.create(CONNECTING_TIMEOUT, TimeUnit.SECONDS)) .thenAccept(status -> createConsumerChannelAndNotifySelf(status, consuming, rmqConnectionActor, self)); <<<<<<< protected void allocateResourcesOnConnection(final ClientConnected clientConnected) { log.debug("Received ClientConnected"); if (clientConnected instanceof RmqConsumerChannelCreated) { final RmqConsumerChannelCreated rmqConsumerChannelCreated = (RmqConsumerChannelCreated) clientConnected; startCommandConsumers(rmqConsumerChannelCreated.getChannel()); ======= protected void onClientConnected(final ClientConnected clientConnected, final BaseClientData data) { log.info("Received ClientConnected"); if (rmqConnectionActor != null) { if (consumerChannelActor == null) { // create a consumer channel - if source is configured if (isConsuming()) { rmqConnectionActor.tell( CreateChannel.apply( ChannelActor.props((channel, actorRef) -> { log.info("Did set up consumer channel: {}", channel); startCommandConsumers(channel); consumerChannelActor = actorRef; return null; }), Option.apply(CONSUMER_CHANNEL)), getSelf()); } else { log.info("Not starting channels as no sources were configured."); } } else { log.info("Consumer is already created, didn't create it again."); } log.debug("Connection <{}> opened.", connectionId()); >>>>>>> protected void allocateResourcesOnConnection(final ClientConnected clientConnected) { log.debug("Received ClientConnected"); if (clientConnected instanceof RmqConsumerChannelCreated) { final RmqConsumerChannelCreated rmqConsumerChannelCreated = (RmqConsumerChannelCreated) clientConnected; startCommandConsumers(rmqConsumerChannelCreated.getChannel()); <<<<<<< consumedTagsToAddresses.clear(); consumerByAddressWithIndex.forEach((addressWithIndex, child) -> stopChildActor(child)); consumerByAddressWithIndex.clear(); ======= getContext().getChildren().forEach(child -> { final String actorName = child.path().name(); if (actorName.startsWith(CONSUMER_ACTOR_PREFIX)) { stopChildActor(child); } }); // block until all were stopped: getContext().getChildren().forEach(child -> { final String actorName = child.path().name(); if (actorName.startsWith(CONSUMER_ACTOR_PREFIX)) { int counter = 5; while (getContext().findChild(actorName).isPresent()) { try { Thread.sleep(10); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } if (--counter == 0) { break; } } } }); >>>>>>> consumedTagsToAddresses.clear(); consumerByAddressWithIndex.forEach((addressWithIndex, child) -> stopChildActor(child)); consumerByAddressWithIndex.clear(); <<<<<<< log.info("Starting to consume queues..."); ensureQueuesExist(channel); stopCommandConsumers(); startConsumers(channel); ======= log.info("Starting to consume queues ..."); try { ensureQueuesExist(channel); stopCommandConsumers(); startConsumers(channel); } catch (final DittoRuntimeException dre) { if (createConnectionSender != null) { createConnectionSender.tell(new Status.Failure(dre), getSelf()); createConnectionSender = null; } if (consumerChannelActor != null) { // stop consumer channel actor stopChildActor(consumerChannelActor); consumerChannelActor = null; } } if (createConnectionSender != null) { createConnectionSender.tell(new Status.Success(BaseClientState.CONNECTED), getSelf()); createConnectionSender = null; } >>>>>>> log.info("Starting to consume queues..."); ensureQueuesExist(channel); stopCommandConsumers(); startConsumers(channel); <<<<<<< private Optional<String> consumingQueueByTag(final String consumerTag) { return Optional.ofNullable(consumedTagsToAddresses.get(consumerTag)); } private static long askTimeoutMillis() { // 45% of connection timeout return CONNECTING_TIMEOUT * 450L; } ======= >>>>>>> private static long askTimeoutMillis() { // 45% of connection timeout return CONNECTING_TIMEOUT * 450L; }
<<<<<<< ======= this(PayloadMappers.createMapperOptionsBuilder(Collections.emptyMap()).build()); } RhinoJavaScriptPayloadMapper(final MessageMapperConfiguration configuration) { configure(configuration); >>>>>>> this(PayloadMappers.createMapperOptionsBuilder(Collections.emptyMap()).build()); } RhinoJavaScriptPayloadMapper(final MessageMapperConfiguration configuration) { configure(configuration); <<<<<<< //TODO pm evaulate if bytes or text payload return AmqpBridgeModelFactory.newExternalMessageBuilder(headers, ExternalMessage.MessageType.RESPONSE) .withAdditionalHeaders("content-type", contentType).withText(mappingString); ======= return PayloadMappers.createPayloadMapperMessage(contentType, convertToByteBuffer(mappingByteArray), mappingString, headers != null ? headers : Collections.emptyMap()); >>>>>>> return PayloadMappers.createPayloadMapperMessage(contentType, convertToByteBuffer(mappingByteArray), mappingString, headers != null ? headers : Collections.emptyMap()); //TODO pm evaulate if bytes or text payload return AmqpBridgeModelFactory.newExternalMessageBuilder(headers, ExternalMessage.MessageType.RESPONSE) .withAdditionalHeaders("content-type", contentType).withText(mappingString);
<<<<<<< import org.eclipse.ditto.protocoladapter.Adaptable; ======= import org.eclipse.ditto.model.base.auth.AuthorizationContext; >>>>>>> import org.eclipse.ditto.model.base.auth.AuthorizationContext; import org.eclipse.ditto.protocoladapter.Adaptable; <<<<<<< @Nullable private final Adaptable originatingAdaptable; ======= @Nullable private final AuthorizationContext authorizationContext; >>>>>>> @Nullable private final Adaptable originatingAdaptable; @Nullable private final AuthorizationContext authorizationContext; <<<<<<< @Nullable final ByteBuffer bytePayload, @Nullable final Adaptable originatingAdaptable) { ======= @Nullable final ByteBuffer bytePayload, @Nullable final AuthorizationContext authorizationContext) { >>>>>>> @Nullable final ByteBuffer bytePayload, @Nullable final AuthorizationContext authorizationContext, @Nullable final Adaptable originatingAdaptable) { <<<<<<< this.originatingAdaptable = originatingAdaptable; ======= this.authorizationContext = authorizationContext; >>>>>>> this.authorizationContext = authorizationContext; this.originatingAdaptable = originatingAdaptable; <<<<<<< public Optional<Adaptable> getOriginatingAdaptable() { return Optional.ofNullable(originatingAdaptable); } @Override ======= public boolean isError() { return error; } @Override public Optional<AuthorizationContext> getAuthorizationContext() { return Optional.ofNullable(authorizationContext); } @Override >>>>>>> public boolean isError() { return error; } @Override public Optional<AuthorizationContext> getAuthorizationContext() { return Optional.ofNullable(authorizationContext); } @Override public Optional<Adaptable> getOriginatingAdaptable() { return Optional.ofNullable(originatingAdaptable); } @Override <<<<<<< Objects.equals(originatingAdaptable, that.originatingAdaptable) && ======= Objects.equals(error, that.error) && >>>>>>> Objects.equals(error, that.error) && Objects.equals(originatingAdaptable, that.originatingAdaptable) && <<<<<<< return Objects.hash(headers, textPayload, bytePayload, payloadType, response, topicPath, originatingAdaptable); ======= return Objects.hash(headers, textPayload, bytePayload, payloadType, response, error, authorizationContext); >>>>>>> return Objects.hash(headers, textPayload, bytePayload, payloadType, response, error, topicPath, authorizationContext, originatingAdaptable);
<<<<<<< import static java.util.Collections.emptySet; import java.util.Collections; ======= import java.util.Map; >>>>>>> import java.util.Collections; import java.util.Map; <<<<<<< private final Cache<String, TraceContext> traces; ======= private final AuthorizationContext authorizationContext; private final Map<String, StartedTimer> timers; >>>>>>> private final Map<String, StartedTimer> timers; <<<<<<< final ActorRef conciergeForwarder, final DittoHeadersFilter headerFilter, ======= final ActorRef conciergeForwarder, final AuthorizationContext authorizationContext, >>>>>>> final ActorRef conciergeForwarder, <<<<<<< this.placeholderFilter = new PlaceholderFilter(); final Caffeine caffeine = Caffeine.newBuilder() .expireAfterWrite(5, TimeUnit.MINUTES); traces = CaffeineCache.of(caffeine); ======= timers = new ConcurrentHashMap<>(); >>>>>>> this.placeholderFilter = new PlaceholderFilter(); timers = new ConcurrentHashMap<>(); <<<<<<< * @param headerFilter the header filter used to apply on responses. ======= * @param authorizationContext the authorization context (authorized subjects) that are set in command headers. >>>>>>> <<<<<<< final ActorRef conciergeForwarder, final DittoHeadersFilter headerFilter, ======= final ActorRef conciergeForwarder, final AuthorizationContext authorizationContext, >>>>>>> final ActorRef conciergeForwarder, <<<<<<< final DittoHeaders filteredDittoHeaders = headerFilter.apply(signal.getDittoHeaders()); final Signal signalWithFilteredHeaders = signal.setDittoHeaders(filteredDittoHeaders); return processor.process(signalWithFilteredHeaders); ======= processor.process(signal) .ifPresent(message -> publisherActor.forward(message, getContext())); >>>>>>> return processor.process(signal);
<<<<<<< public class MqttClientActorTest extends AbstractBaseClientActorTest { ======= public final class MqttClientActorTest { >>>>>>> public final class MqttClientActorTest extends AbstractBaseClientActorTest { <<<<<<< return Props.create(MqttClientActor.class, () -> new MqttClientActor(connection, connection.getConnectionStatus(), conciergeForwarder, factoryCreator)); ======= return Props.create(MqttClientActor.class, connection, connection.getConnectionStatus(), testProbe, factoryCreator); >>>>>>> return Props.create(MqttClientActor.class, connection, connection.getConnectionStatus(), conciergeForwarder, factoryCreator); <<<<<<< @Override protected Connection getConnection() { return connection; } @Override protected Props createClientActor(final ActorRef conciergeForwarder) { return mqttClientActor(getConnection(), conciergeForwarder, MockMqttConnectionFactory.with(conciergeForwarder)); } @Override protected ActorSystem getActorSystem() { return actorSystem; } private static class FreePort { ======= private static final class FreePort { >>>>>>> @Override protected Connection getConnection() { return connection; } @Override protected Props createClientActor(final ActorRef conciergeForwarder) { return mqttClientActor(getConnection(), conciergeForwarder, MockMqttConnectionFactory.with(conciergeForwarder)); } @Override protected ActorSystem getActorSystem() { return actorSystem; } private static final class FreePort {
<<<<<<< final BaseClientData startingData = new BaseClientData(connection.getId(), connection, ConnectivityStatus.UNKNOWN, desiredConnectionStatus, "initialized", Instant.now(), null, null, new InitializationState(connection.getProcessorPoolSize())); ======= final BaseClientData startingData = new BaseClientData(connectionId, connection, ConnectivityStatus.UNKNOWN, desiredConnectionStatus, "initialized", Instant.now(), null, null); >>>>>>> final BaseClientData startingData = new BaseClientData(connectionId, connection, ConnectivityStatus.UNKNOWN, desiredConnectionStatus, "initialized", Instant.now(), null, null, new InitializationState(connection.getProcessorPoolSize())); <<<<<<< final Object msg = new ConsistentHashingRouter.ConsistentHashableEnvelope(signal, signal.getSource().getId()); messageMappingProcessorActor.tell(msg, getSender()); ======= if (messageMappingProcessorActor != null) { final Object msg = new ConsistentHashingRouter.ConsistentHashableEnvelope(signal, signal.getSource().getEntityId().toString()); messageMappingProcessorActor.tell(msg, getSender()); } else { log.info("Cannot handle <{}> signal as there is no MessageMappingProcessor available.", signal.getSource().getType()); } >>>>>>> final Object msg = new ConsistentHashingRouter.ConsistentHashableEnvelope(signal, signal.getSource().getEntityId().toString()); messageMappingProcessorActor.tell(msg, getSender());
<<<<<<< import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; import java.util.List; ======= import java.util.Optional; >>>>>>> import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; <<<<<<< return contextFactory.call(cx -> { final NativeObject headersObj = new NativeObject(); message.getHeaders().forEach((key, value) -> headersObj.put(key, headersObj, value)); final NativeArrayBuffer bytePayload; if (message.getBytePayload().isPresent()) { final ByteBuffer byteBuffer = message.getBytePayload().get(); final byte[] array = byteBuffer.array(); bytePayload = new NativeArrayBuffer(array.length); for (int a = 0; a < array.length; a++) { bytePayload.getBuffer()[a] = array[a]; } } else { bytePayload = null; } final String contentType = message.getHeaders().get(ExternalMessage.CONTENT_TYPE_HEADER); final String textPayload = message.getTextPayload().orElse(null); final NativeObject externalMessage = new NativeObject(); externalMessage.put(EXTERNAL_MESSAGE_HEADERS, externalMessage, headersObj); externalMessage.put(EXTERNAL_MESSAGE_TEXT_PAYLOAD, externalMessage, textPayload); externalMessage.put(EXTERNAL_MESSAGE_BYTE_PAYLOAD, externalMessage, bytePayload); externalMessage.put(EXTERNAL_MESSAGE_CONTENT_TYPE, externalMessage, contentType); ======= return Optional.ofNullable((Adaptable) contextFactory.call(cx -> { final NativeObject externalMessage = mapExternalMessageToNativeObject(message); >>>>>>> return contextFactory.call(cx -> { final NativeObject externalMessage = mapExternalMessageToNativeObject(message); <<<<<<< private Adaptable getAdaptableFromObject(final Context cx, final Object result) { final String dittoProtocolJsonStr = (String) NativeJSON.stringify(cx, scope, result, null, null); return DittoJsonException.wrapJsonRuntimeException(() -> { final JsonObject jsonObject = JsonFactory.readFrom(dittoProtocolJsonStr).asObject(); return ProtocolFactory.jsonifiableAdaptableFromJson(jsonObject); }); } ======= static NativeObject mapExternalMessageToNativeObject(final ExternalMessage message) { final NativeObject headersObj = new NativeObject(); message.getHeaders().forEach((key, value) -> headersObj.put(key, headersObj, value)); final NativeArrayBuffer bytePayload = message.getBytePayload() .map(bb -> { final NativeArrayBuffer nativeArrayBuffer = new NativeArrayBuffer(bb.remaining()); bb.get(nativeArrayBuffer.getBuffer()); return nativeArrayBuffer; }) .orElse(null); final String contentType = message.getHeaders().get(ExternalMessage.CONTENT_TYPE_HEADER); final String textPayload = message.getTextPayload().orElse(null); final NativeObject externalMessage = new NativeObject(); externalMessage.put(EXTERNAL_MESSAGE_HEADERS, externalMessage, headersObj); externalMessage.put(EXTERNAL_MESSAGE_TEXT_PAYLOAD, externalMessage, textPayload); externalMessage.put(EXTERNAL_MESSAGE_BYTE_PAYLOAD, externalMessage, bytePayload); externalMessage.put(EXTERNAL_MESSAGE_CONTENT_TYPE, externalMessage, contentType); return externalMessage; } >>>>>>> static NativeObject mapExternalMessageToNativeObject(final ExternalMessage message) { final NativeObject headersObj = new NativeObject(); message.getHeaders().forEach((key, value) -> headersObj.put(key, headersObj, value)); final NativeArrayBuffer bytePayload = message.getBytePayload() .map(bb -> { final NativeArrayBuffer nativeArrayBuffer = new NativeArrayBuffer(bb.remaining()); bb.get(nativeArrayBuffer.getBuffer()); return nativeArrayBuffer; }) .orElse(null); final String contentType = message.getHeaders().get(ExternalMessage.CONTENT_TYPE_HEADER); final String textPayload = message.getTextPayload().orElse(null); final NativeObject externalMessage = new NativeObject(); externalMessage.put(EXTERNAL_MESSAGE_HEADERS, externalMessage, headersObj); externalMessage.put(EXTERNAL_MESSAGE_TEXT_PAYLOAD, externalMessage, textPayload); externalMessage.put(EXTERNAL_MESSAGE_BYTE_PAYLOAD, externalMessage, bytePayload); externalMessage.put(EXTERNAL_MESSAGE_CONTENT_TYPE, externalMessage, contentType); return externalMessage; } private Adaptable getAdaptableFromObject(final Context cx, final Object result) { final String dittoProtocolJsonStr = (String) NativeJSON.stringify(cx, scope, result, null, null); return DittoJsonException.wrapJsonRuntimeException(() -> { final JsonObject jsonObject = JsonFactory.readFrom(dittoProtocolJsonStr).asObject(); return ProtocolFactory.jsonifiableAdaptableFromJson(jsonObject); }); }
<<<<<<< import org.eclipse.ditto.model.base.headers.DittoHeaders; ======= import org.eclipse.ditto.model.base.exceptions.DittoRuntimeException; import org.eclipse.ditto.model.base.headers.DittoHeaders; >>>>>>> import org.eclipse.ditto.model.base.exceptions.DittoRuntimeException; import org.eclipse.ditto.model.base.headers.DittoHeaders; <<<<<<< import org.eclipse.ditto.model.connectivity.Source; ======= >>>>>>> import org.eclipse.ditto.model.connectivity.Source; <<<<<<< ======= private final ActorRef connectionActor; private final java.time.Duration initTimeout; private final List<String> headerBlacklist; >>>>>>>
<<<<<<< import org.eclipse.ditto.services.connectivity.messaging.persistence.ConnectionPersistenceOperationsActor; import org.eclipse.ditto.services.connectivity.util.ConfigKeys; ======= import org.eclipse.ditto.services.connectivity.messaging.config.ConnectivityConfig; >>>>>>> import org.eclipse.ditto.services.connectivity.messaging.config.ConnectivityConfig; import org.eclipse.ditto.services.connectivity.messaging.persistence.ConnectionPersistenceOperationsActor; <<<<<<< startClusterSingletonActor(ReconnectActor.ACTOR_NAME, ReconnectActor.props(connectionShardRegion, mongoReadJournal::currentPersistenceIds)); startChildActor(ConnectionPersistenceOperationsActor.ACTOR_NAME, ConnectionPersistenceOperationsActor.props(pubSubMediator, config)); String hostname = config.getString(ConfigKeys.Http.HOSTNAME); if (hostname.isEmpty()) { hostname = ConfigUtil.getLocalHostAddress(); log.info("No explicit hostname configured, using HTTP hostname: {}", hostname); } ======= final ActorRef conciergeForwarder = getConciergeForwarder(clusterConfig, pubSubMediator, conciergeForwarderSignalTransformer); final Props connectionSupervisorProps = getConnectionSupervisorProps(pubSubMediator, conciergeForwarder, commandValidator); >>>>>>> final ActorRef conciergeForwarder = getConciergeForwarder(clusterConfig, pubSubMediator, conciergeForwarderSignalTransformer); final Props connectionSupervisorProps = getConnectionSupervisorProps(pubSubMediator, conciergeForwarder, commandValidator);
<<<<<<< import org.eclipse.ditto.services.connectivity.messaging.amqp.status.ProducerClosedStatusReport; import org.eclipse.ditto.services.connectivity.messaging.metrics.ConnectionMetricsCollector; ======= import org.eclipse.ditto.services.connectivity.messaging.monitoring.ConnectionMonitor; >>>>>>> import org.eclipse.ditto.services.connectivity.messaging.amqp.status.ProducerClosedStatusReport; import org.eclipse.ditto.services.connectivity.messaging.monitoring.ConnectionMonitor;
<<<<<<< MessageMappingProcessor.of(connectionId(), connection().getConnectionType(), connection().getPayloadMappingDefinition(), actorSystem, connectivityConfig, protocolAdapterProvider, log); ======= MessageMappingProcessor.of(connection.getId(), connection.getPayloadMappingDefinition(), context.getSystem(), connectivityConfig, protocolAdapterProvider, logger); >>>>>>> MessageMappingProcessor.of(connection.getId(), connection.getConnectionType(), connection.getPayloadMappingDefinition(), context.getSystem(), connectivityConfig, protocolAdapterProvider, logger); <<<<<<< processor = MessageMappingProcessor.of(connection.getId(), connection.getConnectionType(), connection.getPayloadMappingDefinition(), getContext().getSystem(), connectivityConfig, protocolAdapterProvider, log); ======= processor = MessageMappingProcessor.of(connection.getId(), connection.getPayloadMappingDefinition(), getContext().getSystem(), connectivityConfig, protocolAdapterProvider, logger); >>>>>>> processor = MessageMappingProcessor.of(connection.getId(), connection.getConnectionType(), connection.getPayloadMappingDefinition(), getContext().getSystem(), connectivityConfig, protocolAdapterProvider, logger);