Package org.ethereum.db

Examples of org.ethereum.db.ContractDetails


       
        ObjectNode statesNode = blockNode.objectNode();
        for (ByteArrayWrapper key : keys) {
            byte[] keyBytes = key.getData();
            AccountState    accountState    = repository.getAccountState(keyBytes);
            ContractDetails details  = repository.getContractDetails(keyBytes);
            JSONHelper.dumpState(statesNode, Hex.toHexString(keyBytes), accountState, details);
        }      
        blockNode.put("state", statesNode);
       
        blockNode.put("state_root", Hex.toHexString(state));
View Full Code Here


              Map<ByteArrayWrapper, ByteArrayWrapper> storage = accountState.getStorage();
              for (ByteArrayWrapper storageKey : storage.keySet()) {
 
                  byte[] expectedStValue = storage.get(storageKey).getData();
 
                  ContractDetails contractDetails =
                          program.getResult().getRepository().getContractDetails(accountState.getAddress());
 
                  if (contractDetails == null) {
 
                      String output =
                              String.format("Storage raw doesn't exist: key [ %s ], expectedValue: [ %s ]",
                                      Hex.toHexString(storageKey.getData()),
                                      Hex.toHexString(expectedStValue)
                              );
                      logger.info(output);
                      results.add(output);
                      continue;
                  }
 
                  Map<DataWord, DataWord>  testStorage = contractDetails.getStorage();
                  DataWord actualValue = testStorage.get(new DataWord(storageKey.getData()));

                  if (actualValue == null ||
                        !Arrays.equals(expectedStValue, actualValue.getNoLeadZeroesData())) {
 
View Full Code Here

    AccountState state = repository.getAccountState(account);
    if(state != null)
      ret += state.toString() + "\n";
   
    //3) print storage
    ContractDetails contractDetails = repository.getContractDetails(account);
    if(contractDetails != null) {
      Map<DataWord, DataWord> accountStorage = contractDetails.getStorage();
      dataModel.setData(accountStorage);
    }
   
    //4) code print
    byte[] code = repository.getCode(account);
View Full Code Here

    if(addr == null) {
      alertStatusMsg("Not a valid contract address");
          return;
    }
     
    ContractDetails contractDetails = UIEthereumManager.ethereum
        .getRepository().getContractDetails(addr);
        if (contractDetails == null) {
            alertStatusMsg("No contract for that address");
            return;
        }

        final byte[] programCode = contractDetails.getCode();
        if (programCode == null || programCode.length == 0) {
            alertStatusMsg("Such account exist but no code in the db");
            return;
        }
       
        final Map storageMap = contractDetails.getStorage();

        contractDataInput.setBounds(70, 80, 350, 145);
        contractDataInput.setViewportView(msgDataTA);

        URL expandIconURL = ClassLoader.getSystemResource("buttons/add-23x23.png");
View Full Code Here

    if(addr == null) {
      alertStatusMsg("Not a valid contract address");
          return;
    }
   
    ContractDetails contractDetails = UIEthereumManager.ethereum
        .getRepository().getContractDetails(addr);
        if (contractDetails == null) {
            alertStatusMsg("No contract for that address");
            return;
        }

        final byte[] programCode = contractDetails.getCode();
        if (programCode == null || programCode.length == 0) {
            alertStatusMsg("Such account exist but no code in the db");
            return;
        }
View Full Code Here

                stackData.append(" ").append(stack.get(i));
                if (i < stack.size() - 1) stackData.append("\n");
            }
            if (stackData.length() > 0) stackData.insert(0, "\n");

            ContractDetails contractDetails = this.result.getRepository().
                    getContractDetails(this.programAddress.getLast20Bytes());
            StringBuilder storageData = new StringBuilder();
            if(contractDetails != null) {
                List<DataWord> storageKeys = new ArrayList<>(contractDetails.getStorage().keySet());
            Collections.sort((List<DataWord>) storageKeys);
                for (DataWord key : storageKeys) {
                    storageData.append(" ").append(key).append(" -> ").
                            append(contractDetails.getStorage().get(key)).append("\n");
                }
                if (storageData.length() > 0) storageData.insert(0, "\n");
            }

            StringBuilder memoryData = new StringBuilder();
View Full Code Here

        op.setPc(pc);

        op.setOp(ops[pc]);
        op.saveGas(getGas());

        ContractDetails contractDetails = this.result.getRepository().
                getContractDetails(this.programAddress.getLast20Bytes());
        op.saveStorageMap(contractDetails.getStorage());
        op.saveMemory(memory);
        op.saveStack(stack);

        programTrace.addOp(op);
    }
View Full Code Here

    private void dumpLine(OpCode op, long gasBefore, long gasCost, long memWords, Program program) {
      if(CONFIG.dumpStyle().equals("standard+")) {
      switch (op) {
        case STOP: case RETURN: case SUICIDE:
         
          ContractDetails details = program.getResult().getRepository()
            .getContractDetails(program.getOwnerAddress().getLast20Bytes());
              List<DataWord> storageKeys = new ArrayList<>(details.getStorage().keySet());
          Collections.sort((List<DataWord>) storageKeys);
         
          for (DataWord key : storageKeys) {
            dumpLogger.trace("{} {}",
              Hex.toHexString(key.getNoLeadZeroesData()),
              Hex.toHexString(details.getStorage().get(key).getNoLeadZeroesData()));
          }
        default:
          break;
      }
      String addressString = Hex.toHexString(program.getOwnerAddress().getLast20Bytes());
      String pcString = Hex.toHexString(new DataWord(program.getPC()).getNoLeadZeroesData());
      String opString = Hex.toHexString(new byte[]{op.val()});
      String gasString = Hex.toHexString(program.getGas().getNoLeadZeroesData());

      dumpLogger.trace("{} {} {} {}", addressString, pcString, opString, gasString);
      } else if(CONFIG.dumpStyle().equals("pretty")) {
      dumpLogger.trace("    STACK");
      for (DataWord item : program.getStack()) {
        dumpLogger.trace("{}", item);
      }
      dumpLogger.trace("    MEMORY");
      String memoryString = program.memoryToString();
      if(!"".equals(memoryString))
        dumpLogger.trace("{}", memoryString);
     
      dumpLogger.trace("    STORAGE");
      ContractDetails details = program.getResult().getRepository()
          .getContractDetails(program.getOwnerAddress().getLast20Bytes());
          List<DataWord> storageKeys = new ArrayList<>(details.getStorage().keySet());
      Collections.sort((List<DataWord>) storageKeys);
     
      for (DataWord key : storageKeys) {
        dumpLogger.trace("{}: {}",
          key.shortHex(),
          details.getStorage().get(key).shortHex());
      }
     
      int level = program.invokeData.getCallDeep();
      String contract = Hex.toHexString(program.getOwnerAddress().getLast20Bytes());
      String internalSteps = String.format("%4s", Integer.toHexString(program.getPC())).replace(' ', '0').toUpperCase();
View Full Code Here

TOP

Related Classes of org.ethereum.db.ContractDetails

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.